@webflow/webflow-cli 2.5.0-next.0 → 2.5.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,76 +1,115 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var tR=Object.create;var mp=Object.defineProperty;var rR=Object.getOwnPropertyDescriptor;var nR=Object.getOwnPropertyNames;var oR=Object.getPrototypeOf,iR=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var gp=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hp=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},sR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nR(t))!iR.call(e,o)&&o!==r&&mp(e,o,{get:()=>t[o],enumerable:!(n=rR(t,o))||n.enumerable});return e};var w=(e,t,r)=>(r=e!=null?tR(oR(e)):{},sR(t||!e||!e.__esModule?mp(r,"default",{value:e,enumerable:!0}):r,e));var dw,Ne,yp,Ut,ue,_t,z,se,P,me=x(()=>{"use strict";dw=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,Ne=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,yp=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Ut=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,ue=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,_t=e=>`\x1B[97m${e}\x1B[0m`,z=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,P=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function dR(){let e=new Map;for(let[t,r]of Object.entries(Ie)){for(let[n,o]of Object.entries(r))Ie[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ie[n],e.set(o[0],o[1]);Object.defineProperty(Ie,t,{value:r,enumerable:!1})}return Object.defineProperty(Ie,"codes",{value:e,enumerable:!1}),Ie.color.close="\x1B[39m",Ie.bgColor.close="\x1B[49m",Ie.color.ansi=pw(),Ie.color.ansi256=fw(),Ie.color.ansi16m=mw(),Ie.bgColor.ansi=pw(10),Ie.bgColor.ansi256=fw(10),Ie.bgColor.ansi16m=mw(10),Object.defineProperties(Ie,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>Ie.rgbToAnsi256(...Ie.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,o;if(t>=232)r=((t-232)*10+8)/255,n=r,o=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>Ie.ansi256ToAnsi(Ie.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Ie.ansi256ToAnsi(Ie.hexToAnsi256(t)),enumerable:!1}}),Ie}var pw,fw,mw,Ie,O1,cR,uR,L1,pR,ir,gw=x(()=>{"use strict";pw=(e=0)=>t=>`\x1B[${t+e}m`,fw=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,mw=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Ie={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},O1=Object.keys(Ie.modifier),cR=Object.keys(Ie.color),uR=Object.keys(Ie.bgColor),L1=[...cR,...uR];pR=dR(),ir=pR});function Wt(e,t=globalThis.Deno?globalThis.Deno.args:Kl.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1||n<o)}function fR(){if("FORCE_COLOR"in Ue)return Ue.FORCE_COLOR==="true"?1:Ue.FORCE_COLOR==="false"?0:Ue.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ue.FORCE_COLOR,10),3)}function mR(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function gR(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=fR();n!==void 0&&(Gl=n);let o=r?Gl:n;if(o===0)return 0;if(r){if(Wt("color=16m")||Wt("color=full")||Wt("color=truecolor"))return 3;if(Wt("color=256"))return 2}if("TF_BUILD"in Ue&&"AGENT_NAME"in Ue)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(Ue.TERM==="dumb")return i;if(Kl.default.platform==="win32"){let s=yw.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Ue)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in Ue)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in Ue)||Ue.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in Ue)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ue.TEAMCITY_VERSION)?1:0;if(Ue.COLORTERM==="truecolor"||Ue.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Ue){let s=Number.parseInt((Ue.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ue.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ue.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ue.TERM)||"COLORTERM"in Ue?1:i}function hw(e,t={}){let r=gR(e,{streamIsTTY:e&&e.isTTY,...t});return mR(r)}var Kl,yw,wp,Ue,Gl,hR,ww,bw=x(()=>{"use strict";Kl=w(require("process"),1),yw=w(require("os"),1),wp=w(require("tty"),1);({env:Ue}=Kl.default);Wt("no-color")||Wt("no-colors")||Wt("color=false")||Wt("color=never")?Gl=0:(Wt("color")||Wt("colors")||Wt("color=true")||Wt("color=always"))&&(Gl=1);hR={stdout:hw({isTTY:wp.default.isatty(1)}),stderr:hw({isTTY:wp.default.isatty(2)})},ww=hR});function kw(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i);while(n!==-1);return s+=e.slice(i),s}function Dw(e,t,r,n){let o=0,i="";do{let s=e[n-1]==="\r";i+=e.slice(o,s?n-1:n)+t+(s?`\r
|
|
3
3
|
`:`
|
|
4
|
-
`)+
|
|
5
|
-
`,o)}while(
|
|
6
|
-
`);return i!==-1&&(t=
|
|
7
|
-
${t}`,TA=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),PA=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),$A=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=IA.bind(null,r,t.toString());Object.defineProperty(o,"name",PA);let{writable:i,enumerable:s,configurable:a}=TA;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var Hl,lw,cw,uw=L(()=>{"use strict";aw();Hl=new WeakMap,lw=(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(Hl.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 up(i,e),Hl.set(i,r),i};lw.callCount=e=>{if(!Hl.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Hl.get(e)};cw=lw});var eo,dw=L(()=>{"use strict";eo=[];eo.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&eo.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&eo.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Vl,dp,pp,OA,fp,Gl,LA,mp,gp,hp,pw,Nj,jj,fw=L(()=>{"use strict";dw();Vl=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",dp=Symbol.for("signal-exit emitter"),pp=globalThis,OA=Object.defineProperty.bind(Object),fp=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(pp[dp])return pp[dp];OA(pp,dp,{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}},Gl=class{},LA=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),mp=class extends Gl{onExit(){return()=>{}}load(){}unload(){}},gp=class extends Gl{#s=hp.platform==="win32"?"SIGINT":"SIGHUP";#n=new fp;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let n of eo)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(!Vl(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 eo)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,eo.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 Vl(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"&&Vl(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)}},hp=globalThis.process,{onExit:pw,load:Nj,unload:jj}=LA(Vl(hp)?new gp(hp):new mp)});var Ws,mw,NA,gw,hw=L(()=>{"use strict";Ws=w(require("process"),1);uw();fw();mw=Ws.default.stderr.isTTY?Ws.default.stderr:Ws.default.stdout.isTTY?Ws.default.stdout:void 0,NA=mw?cw(()=>{pw(()=>{mw.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},gw=NA});var yp,Kl,mi,wp,yw=L(()=>{"use strict";yp=w(require("process"),1);hw();Kl=!1,mi={};mi.show=(e=yp.default.stderr)=>{e.isTTY&&(Kl=!1,e.write("\x1B[?25h"))};mi.hide=(e=yp.default.stderr)=>{e.isTTY&&(gw(),Kl=!0,e.write("\x1B[?25l"))};mi.toggle=(e,t)=>{e!==void 0&&(Kl=e),Kl?mi.show(t):mi.hide(t)};wp=mi});var ww=rp((Gj,jA)=>{jA.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 bp=rp((Kj,Dw)=>{"use strict";var Jl=Object.assign({},ww()),bw=Object.keys(Jl);Object.defineProperty(Jl,"random",{get(){let e=Math.floor(Math.random()*bw.length),t=bw[e];return Jl[t]}});Dw.exports=Jl});function Dp(){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,kw=L(()=>{"use strict";Wt=w(require("process"),1)});var MA,BA,UA,Hs,Ew=L(()=>{"use strict";cp();kw();MA={info:on.blue("\u2139"),success:on.green("\u2714"),warning:on.yellow("\u26A0"),error:on.red("\u2716")},BA={info:on.blue("i"),success:on.green("\u221A"),warning:on.yellow("\u203C"),error:on.red("\xD7")},UA=Dp()?MA:BA,Hs=UA});function kp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var vw=L(()=>{"use strict"});function Ep(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(WA,"")}var WA,Sw=L(()=>{"use strict";vw();WA=kp()});function vp({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 xw=L(()=>{"use strict"});function Sp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(HA,"")}var HA,Cw=L(()=>{"use strict";xw();HA=vp()});var zl,ql,xp,Cp,Vs,Fw=L(()=>{"use strict";zl=[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],ql=[12288,12288,65281,65376,65504,65510],xp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Cp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Vs=[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 Xl,_w=L(()=>{"use strict";Xl=(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 ZA(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(Aw>=o&&Aw<=i)return[o,i];i-o>n-t&&(t=o,n=i)}return[t,n]}var VA,GA,KA,JA,a1,l1,c1,u1,zA,qA,Aw,XA,YA,Rw,Iw,Tw,Pw=L(()=>{"use strict";Fw();_w();VA=zl[0],GA=zl.at(-1),KA=ql[0],JA=ql.at(-1),a1=xp[0],l1=xp.at(-1),c1=Cp[0],u1=Cp.at(-1),zA=Vs[0],qA=Vs.at(-1),Aw=19968,[XA,YA]=ZA(Vs);Rw=e=>e<VA||e>GA?!1:Xl(zl,e),Iw=e=>e<KA||e>JA?!1:Xl(ql,e),Tw=e=>e>=XA&&e<=YA?!0:e<zA||e>qA?!1:Xl(Vs,e)});function QA(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function $w(e,{ambiguousAsWide:t=!1}={}){return QA(e),Iw(e)||Tw(e)||t&&Rw(e)?2:1}var Ow=L(()=>{"use strict";Pw()});var Lw,Nw=L(()=>{"use strict";Lw=()=>/[#*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=Sp(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!n};for(let{segment:s}of eR.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)&&!tR.test(s)){if(Lw().test(s)){o+=2;continue}o+=$w(a,i)}}return o}var eR,tR,jw=L(()=>{"use strict";Cw();Ow();Nw();eR=new Intl.Segmenter,tR=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function _p({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var Mw=L(()=>{"use strict"});function Rp(){let{env:e}=Ap.default,{TERM:t,TERM_PROGRAM:n}=e;return Ap.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 Ap,Bw=L(()=>{"use strict";Ap=w(require("process"),1)});var sn,nR,Ip,rR,Tp,Uw=L(()=>{"use strict";sn=w(require("process"),1),nR=3,Ip=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(){sn.default.platform==="win32"||!sn.default.stdin.isTTY||(sn.default.stdin.setRawMode(!0),sn.default.stdin.on("data",this.#o),sn.default.stdin.resume())}#e(){sn.default.stdin.isTTY&&(sn.default.stdin.off("data",this.#o),sn.default.stdin.pause(),sn.default.stdin.setRawMode(!1))}#o(t){t[0]===nR&&sn.default.emit("SIGINT")}},rR=new Ip,Tp=rR});function $p(e){return new Pp(e)}var Gs,Ks,oR,Pp,Ww=L(()=>{"use strict";Gs=w(require("process"),1);cp();yw();Ks=w(bp(),1);Ew();Sw();jw();Mw();Bw();Uw();oR=w(bp(),1),Pp=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:Gs.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:_p({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,Gs.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(!Rp())this.#i=Ks.default.line;else if(t===void 0)this.#i=Ks.default.dots;else if(t!=="default"&&Ks.default[t])this.#i=Ks.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 Ep(o).split(`
|
|
8
|
-
`))this.#e+=Math.max(1,Math.ceil(
|
|
9
|
-
`),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&
|
|
10
|
-
`;return this.stop(),this.#r.write(d),this}}});function Js(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),Yl.default.platform==="darwin"?iR(e):Yl.default.platform==="win32"?sR(e):aR(e)}var Pe,Op,Yl,mr,Lp,gi,iR,sR,aR,Np=L(()=>{"use strict";Pe=w(require("path"),1),Op=w(require("os"),1),Yl=w(require("process"),1),mr=Op.default.homedir(),Lp=Op.default.tmpdir(),{env:gi}=Yl.default,iR=e=>{let t=Pe.default.join(mr,"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(Lp,e)}},sR=e=>{let t=gi.APPDATA||Pe.default.join(mr,"AppData","Roaming"),n=gi.LOCALAPPDATA||Pe.default.join(mr,"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(Lp,e)}},aR=e=>{let t=Pe.default.basename(mr);return{data:Pe.default.join(gi.XDG_DATA_HOME||Pe.default.join(mr,".local","share"),e),config:Pe.default.join(gi.XDG_CONFIG_HOME||Pe.default.join(mr,".config"),e),cache:Pe.default.join(gi.XDG_CACHE_HOME||Pe.default.join(mr,".cache"),e),log:Pe.default.join(gi.XDG_STATE_HOME||Pe.default.join(mr,".local","state"),e),temp:Pe.default.join(Lp,t,e)}}});function Zl(){return/[<>:"/\\|?*\u0000-\u001F]/g}function Hw(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var Vw=L(()=>{"use strict"});function zs(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(Zl().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(cR,o),e=e.replace(Zl(),o),e=e.replace(n,o),e=e.replace(uR,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=Hw().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:lR;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 lR,cR,uR,jp=L(()=>{"use strict";Vw();lR=100,cR=/^\.+(\\|\/)|^\.+$/,uR=/\.+$/});var dR,Gw=L(()=>{"use strict";dR=w(require("path"),1);jp()});var Kw=L(()=>{"use strict";jp();Gw()});var Ql,Mp=L(()=>{"use strict";Ql="webflow.json"});var to,Bp=L(()=>{"use strict";to=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function Yw(e){Jw=e}function Zw(e){zw=e}function pR(){for(let e of Qw){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function fR(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||pR()!==null}function V(){return Jw?!0:zw?!1:fR()}function an(){return!V()}function eb(e){qw=e}function Ze(){return qw}function tb(e){Xw=e}function nb(){return Xw}var Jw,zw,qw,Xw,Qw,V1,be=L(()=>{"use strict";Jw=!1,zw=!1,qw=!1;Qw=[{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"}],V1=Qw.map(e=>e.variable)});function ln(){let e=nb();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,rb.statSync)(e)?.isDirectory())return{path:(0,ob.join)(e,Ql),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:`./${Ql}`,isUserDefined:!1}}var rb,ob,Up=L(()=>{"use strict";rb=require("fs"),ob=require("path");Mp();be()});var ib,mR,gR,Wp,sb=L(()=>{"use strict";ib=w(require("ajv")),mR=new ib.default,gR={type:"object",properties:{region:{type:"string",enum:["us","eu"]},library:{type:"object",properties:{name:{type:"string",minLength:1},id:{type:"string",minLength:1},components:{type:"array",items:{type:"string"},minItems:1},renderer:{anyOf:[{type:"object",properties:{client:{type:"string",minLength:1},server:{type:"string",minLength:1}}},{type:"string",minLength:1}]},globals:{type:"string",minLength:1}},required:[]},devlink:{type:"object",properties:{rootDir:{type:"string",minLength:1},cssModules:{type:"boolean"},allowTelemetry:{type:"boolean"},overwriteModule:{type:"boolean"},skipTagSelectors:{type:"boolean"},envVariables:{type:"object",additionalProperties:{type:"string"}},components:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},fileExtensions:{type:"object",properties:{js:{type:"string"},css:{type:"string"}}},relativeHrefRoot:{oneOf:[{type:"boolean"},{type:"string"}]}},required:["rootDir"]},"devlink-export":{type:"object",properties:{rootDir:{type:"string",minLength:1},components:{type:"string"},componentGroups:{type:"string"},ts:{type:"boolean"},cssScopes:{type:"boolean"},relativeHrefRoot:{oneOf:[{type:"boolean",const:!1},{type:"string"}]},treeShake:{type:"boolean"},camelCaseVariantNames:{type:"boolean"}},required:[]},site:{type:"object",properties:{layout:{type:"object",properties:{preset:{type:"string",enum:["library","astro","nextjs","nextjs-pages"]},pagesRoot:{type:"string",minLength:1},componentsRoot:{type:"string",minLength:1},pagesShape:{type:"string",enum:["flat","nested"]}},required:[]}},required:[]}}},Wp=mR.compile(gR)});function ab(e){return e instanceof Error?e:new Error("Unknown error")}function ne(){let{path:e}=ln();if(!(0,ec.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,ec.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${ab(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: ${ab(o).message}`)}if(!Wp(r)){let o=Wp.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:r,manifestPath:e}}var ec,qs=L(()=>{"use strict";ec=require("fs");Up();sb()});function Xs(e,t){let n=e[t];if(!n)throw new to(t);return n}var lb=L(()=>{"use strict";Bp()});function xe(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,cb.writeFileSync)(r,JSON.stringify(o,null,2),"utf-8"),o}var cb,Hp=L(()=>{"use strict";cb=require("fs");qs()});var Me=L(()=>{"use strict";Mp();Bp();qs();Up();lb();Hp()});var tc=rp((u2,hR)=>{hR.exports={name:"@webflow/webflow-cli",version:"2.5.0-next.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 Sn(){try{return tc().version}catch{return"unknown"}}function cn(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=Ys.default.homedir();if(n){let o=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let r=Ys.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 Vp(e){if(e.stack)return cn(e.stack)}function gr(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]=cn(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?n[r]=gr(o):Array.isArray(o)?n[r]=o.map(s=>typeof s=="object"&&s!==null?gr(s):typeof s=="string"?cn(s):s):n[r]=o}return n}function ub(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${Ys.default.type()} ${Ys.default.release()}`}}function Gp(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var Ys,Zs=L(()=>{"use strict";Ys=w(require("os"))});function hi(){if(process.platform==="win32"){let n=process.env.APPDATA??Qs.default.join(Kp.default.homedir(),"AppData","Roaming");return Qs.default.join(n,db)}let t=process.env.XDG_CONFIG_HOME??Qs.default.join(Kp.default.homedir(),".config");return Qs.default.join(t,db)}function pb(){return Js("webflow-cli").cache}var Kp,Qs,db,ea=L(()=>{"use strict";Kp=w(require("os")),Qs=w(require("path"));Np();db="webflow"});function ta(){return Jp.default.join(hi(),yR)}function zp(){let e=ta();try{if(!yi.default.existsSync(e))return null;let t=yi.default.readFileSync(e,"utf8"),n=JSON.parse(t);return typeof n=="object"&&n!==null&&typeof n.allowTelemetry=="boolean"?n:null}catch{return null}}function qp(e){let t=ta(),n=Jp.default.dirname(t);yi.default.existsSync(n)||yi.default.mkdirSync(n,{recursive:!0,mode:448}),yi.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}var yi,Jp,yR,Xp=L(()=>{"use strict";yi=w(require("fs")),Jp=w(require("path"));ea();yR="telemetry.json"});var P,k,Ce,wi,Yp,nt,Q,nc,Zp,Hn,M=L(()=>{"use strict";pe();P=J("\u2713"),k=Bt("\u2716"),Ce=je("\u2139"),wi=J("\u279C"),Yp=Bt("\u279C"),nt="\u279C",Q=le("\u26A0"),nc=I("\u2732"),Zp=J("\u2732"),Hn=le("[Deprecated]")});var fb,hr,Qp=L(()=>{"use strict";fb=w(require("fs"));Me();Zs();Xp();A();pe();M();be();hr=class e{static instance;cache=void 0;static isDoNotTrackEnabled(){let t=process.env.DO_NOT_TRACK;return t==="1"||t?.toLowerCase()==="true"}static getInstance(){return e.instance||(e.instance=new e),e.instance}static localManifestExists(){try{let{path:t}=ln();return fb.default.existsSync(t)}catch{return!1}}static readLocalPreference(){if(e.localManifestExists())try{let{manifest:t}=ne();return t?.telemetry?.global?.allowTelemetry}catch{return}}static readGlobalPreference(){return zp()?.allowTelemetry}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;let t=e.readLocalPreference();if(t!==void 0)return this.cache=t,t;let n=e.readGlobalPreference();if(n!==void 0)return this.cache=n,n}async setPreference(t,n){this.cache=t,n?.local?await this.setLocalPreference(t):await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(Ze()||u.info(`${Ce} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(Ze()||(u.info(`${Zp} ${I("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${Zp} ${I("To opt out, run")} ${J("webflow auth telemetry --disable")}`)),await this.setGlobalPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return e.isDoNotTrackEnabled()?!1:e.readGlobalPreference()}async setGlobalPreference(t){qp({allowTelemetry:t,lastPrompted:Date.now(),version:Sn()}),Ze()||u.info(`${P} Telemetry configuration updated in ${ta()}`);let n=e.readLocalPreference();if(n!==void 0&&n!==t){let{path:r}=ln();u.warn(`${Q} ${r} sets telemetry to ${n?"enabled":"disabled"} and overrides the global config for commands run in this directory. Re-run with --local to update it.`)}this.cache=t}async setLocalPreference(t){let n={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:Sn()}}};if(xe(n),!Ze()){let{path:r}=ln();u.info(`${P} Telemetry configuration updated in ${r}`)}this.cache=t}async hasGlobalPreference(){return e.readGlobalPreference()!==void 0}async getTelemetryStatus(){if(e.isDoNotTrackEnabled())return{enabled:!1,source:"env",hasPreference:!0};let t=e.readLocalPreference();if(t!==void 0)return{enabled:t,source:"local",hasPreference:!0};let n=e.readGlobalPreference();return n!==void 0?{enabled:n,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@${Sn()}`};return(0,mb.default)(e,{...t,headers:{...t?.headers,...r}})}var mb,lt=L(()=>{"use strict";mb=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 hb(e){gb=e}function ct(){return gb}function ef(e,t){if(no.includes(e))return e;throw new f(`Invalid region "${e}" from ${t}. Valid regions: ${no.join(", ")}.`,{isUserError:!0})}function yb(e){if(e)return ef(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return ef(t,"WEBFLOW_REGION");let n;try{n=ne().manifest.region}catch(r){if(r instanceof Error&&r.message.startsWith("Invalid manifest:"))throw new f(r.message,{isUserError:!0});return"us"}return n?ef(n,"webflow.json"):"us"}var no,gb,yr=L(()=>{"use strict";C();Me();no=["us","eu"],gb="us"});var wb,bb=L(()=>{"use strict";wb=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 rc(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function nf(){return wR[rc()][ct()]}function $(){return process.env.WEBFLOW_API_HOST?tf("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):nf().api}function bi(){return process.env.WEBFLOW_CDN_API_HOST?tf("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):nf().cdnApi}function xn(){return process.env.WEBFLOW_HOST?tf("WEBFLOW_HOST",process.env.WEBFLOW_HOST):nf().webflow}var tf,wR,na,rf,ra,oa,Di,De=L(()=>{"use strict";yr();bb();tf=(e,t)=>(wb(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),wR={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"}}};na="wf-manifest.json",rf="mf-manifest.json",ra="@webflow_renderer",oa="ssr-bundle.tar",Di="index.js"});function bR(){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&&Db.has(r.slice(0,o))){t.push(`${r.slice(0,o)}=<redacted>`);continue}t.push(r),Db.has(r)&&n+1<e.length&&(t.push("<redacted>"),n+=1)}return t.join(" ")||void 0}var Db,F,of=L(()=>{"use strict";Qp();Zs();A();lt();De();Db=new Set(["--ref","--name","--q","--branch","--key"]);F=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=hr.getInstance(),this.sessionId=Gp(),this.platformInfo=ub()}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,feature:n,name:t.name,message:t.message,cause:t.cause,stack:Vp(t),context:n,metadata:r?gr(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?gr(o):void 0})}async sendPerformance(t,n,r,o){await this.sendEvent({eventType:"performance",feature:o,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=hr.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:Sn(),command:this.config.suppressCommand?void 0:bR(),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=cn(n.message)),n.stack&&(n.stack=cn(n.stack)),n.feature&&(n.feature=cn(n.feature)),n.context&&(n.context=cn(n.context)),n.metadata&&(n.metadata=gr(n.metadata)),n.data&&(n.data=gr(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||$(),authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||$(),authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||$(),authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||$(),authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||$(),authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||$(),authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||$(),authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||$(),authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||$(),authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||$(),authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||$(),authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||$(),authToken:t.authToken,commandType:"skills"})}}});var kb=L(()=>{"use strict"});function Eb(e,t){return async(n,r,o)=>{let i=Date.now(),s=process.memoryUsage().heapUsed;try{let a=await r(),l=Date.now()-i,c=process.memoryUsage().heapUsed;return await e.sendPerformance(n,l,{memoryDelta:c-s,...o},t),a}catch(a){let l=Date.now()-i;throw await e.sendPerformance(n,l,{failed:1,...o},t),a}}}var X=L(()=>{"use strict";of();Qp();Xp();kb();Zs();Zs()});var af,sf,DR,Vn,lf=L(()=>{"use strict";af=Symbol("webflow-cli-warn"),sf=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let n=t.split(`
|
|
11
|
-
`);for(let
|
|
4
|
+
`)+r,o=n+1,n=e.indexOf(`
|
|
5
|
+
`,o)}while(n!==-1);return i+=e.slice(o),i}var Ew=x(()=>{"use strict"});function Gs(e){return wR(e)}var vw,Sw,bp,mi,Vs,xw,gi,yR,wR,kp,bR,kR,Dp,Jl,DR,ER,H1,sr,Ep=x(()=>{"use strict";gw();bw();Ew();({stdout:vw,stderr:Sw}=ww),bp=Symbol("GENERATOR"),mi=Symbol("STYLER"),Vs=Symbol("IS_EMPTY"),xw=["ansi","ansi","ansi256","ansi16m"],gi=Object.create(null),yR=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=vw?vw.level:0;e.level=t.level===void 0?r:t.level},wR=e=>{let t=(...r)=>r.join(" ");return yR(t,e),Object.setPrototypeOf(t,Gs.prototype),t};Object.setPrototypeOf(Gs.prototype,Function.prototype);for(let[e,t]of Object.entries(ir))gi[e]={get(){let r=Jl(this,Dp(t.open,t.close,this[mi]),this[Vs]);return Object.defineProperty(this,e,{value:r}),r}};gi.visible={get(){let e=Jl(this,this[mi],!0);return Object.defineProperty(this,"visible",{value:e}),e}};kp=(e,t,r,...n)=>e==="rgb"?t==="ansi16m"?ir[r].ansi16m(...n):t==="ansi256"?ir[r].ansi256(ir.rgbToAnsi256(...n)):ir[r].ansi(ir.rgbToAnsi(...n)):e==="hex"?kp("rgb",t,r,...ir.hexToRgb(...n)):ir[r][e](...n),bR=["rgb","hex","ansi256"];for(let e of bR){gi[e]={get(){let{level:r}=this;return function(...n){let o=Dp(kp(e,xw[r],"color",...n),ir.color.close,this[mi]);return Jl(this,o,this[Vs])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);gi[t]={get(){let{level:r}=this;return function(...n){let o=Dp(kp(e,xw[r],"bgColor",...n),ir.bgColor.close,this[mi]);return Jl(this,o,this[Vs])}}}}kR=Object.defineProperties(()=>{},{...gi,level:{enumerable:!0,get(){return this[bp].level},set(e){this[bp].level=e}}}),Dp=(e,t,r)=>{let n,o;return r===void 0?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},Jl=(e,t,r)=>{let n=(...o)=>DR(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,kR),n[bp]=e,n[mi]=t,n[Vs]=r,n},DR=(e,t)=>{if(e.level<=0||!t)return e[Vs]?"":t;let r=e[mi];if(r===void 0)return t;let{openAll:n,closeAll:o}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=kw(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
|
|
6
|
+
`);return i!==-1&&(t=Dw(t,o,n,i)),n+t+o};Object.defineProperties(Gs.prototype,gi);ER=Gs(),H1=Gs({level:Sw?Sw.level:0}),sr=ER});function vp(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))vR(e,t,o,r);return xR(e,t),AR(e,t,n),e}var vR,SR,xR,CR,FR,_R,AR,Cw=x(()=>{"use strict";vR=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let o=Object.getOwnPropertyDescriptor(e,r),i=Object.getOwnPropertyDescriptor(t,r);!SR(o,i)&&n||Object.defineProperty(e,r,i)},SR=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},xR=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},CR=(e,t)=>`/* Wrapped ${e}*/
|
|
7
|
+
${t}`,FR=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),_R=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),AR=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=CR.bind(null,n,t.toString());Object.defineProperty(o,"name",_R);let{writable:i,enumerable:s,configurable:a}=FR;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var zl,Fw,_w,Aw=x(()=>{"use strict";Cw();zl=new WeakMap,Fw=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(zl.set(i,++n),n===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return vp(i,e),zl.set(i,n),i};Fw.callCount=e=>{if(!zl.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return zl.get(e)};_w=Fw});var no,Rw=x(()=>{"use strict";no=[];no.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&no.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&no.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var ql,Sp,xp,RR,Cp,Yl,IR,Fp,_p,Ap,Iw,Y1,X1,Tw=x(()=>{"use strict";Rw();ql=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Sp=Symbol.for("signal-exit emitter"),xp=globalThis,RR=Object.defineProperty.bind(Object),Cp=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(xp[Sp])return xp[Sp];RR(xp,Sp,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},Yl=class{},IR=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Fp=class extends Yl{onExit(){return()=>{}}load(){}unload(){}},_p=class extends Yl{#s=Ap.platform==="win32"?"SIGINT":"SIGHUP";#r=new Cp;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let r of no)this.#t[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#s:r;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,r){if(!ql(this.#e))return()=>{};this.#i===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{this.#r.removeListener(n,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#r.count+=1;for(let t of no)try{let r=this.#t[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#f(t,...r),this.#e.reallyExit=t=>this.#n(t)}}unload(){this.#i&&(this.#i=!1,no.forEach(t=>{let r=this.#t[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#r.count-=1)}#n(t){return ql(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...r){let n=this.#o;if(t==="exit"&&ql(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},Ap=globalThis.process,{onExit:Iw,load:Y1,unload:X1}=IR(ql(Ap)?new _p(Ap):new Fp)});var Ks,Pw,TR,$w,Ow=x(()=>{"use strict";Ks=w(require("process"),1);Aw();Tw();Pw=Ks.default.stderr.isTTY?Ks.default.stderr:Ks.default.stdout.isTTY?Ks.default.stdout:void 0,TR=Pw?_w(()=>{Iw(()=>{Pw.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},$w=TR});var Rp,Xl,hi,Ip,Lw=x(()=>{"use strict";Rp=w(require("process"),1);Ow();Xl=!1,hi={};hi.show=(e=Rp.default.stderr)=>{e.isTTY&&(Xl=!1,e.write("\x1B[?25h"))};hi.hide=(e=Rp.default.stderr)=>{e.isTTY&&($w(),Xl=!0,e.write("\x1B[?25l"))};hi.toggle=(e,t)=>{e!==void 0&&(Xl=e),Xl?hi.show(t):hi.hide(t)};Ip=hi});var Nw=gp((o2,PR)=>{PR.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Tp=gp((i2,Mw)=>{"use strict";var Zl=Object.assign({},Nw()),jw=Object.keys(Zl);Object.defineProperty(Zl,"random",{get(){let e=Math.floor(Math.random()*jw.length),t=jw[e];return Zl[t]}});Mw.exports=Zl});function Pp(){return Ht.default.platform!=="win32"?Ht.default.env.TERM!=="linux":!!Ht.default.env.CI||!!Ht.default.env.WT_SESSION||!!Ht.default.env.TERMINUS_SUBLIME||Ht.default.env.ConEmuTask==="{cmd::Cmder}"||Ht.default.env.TERM_PROGRAM==="Terminus-Sublime"||Ht.default.env.TERM_PROGRAM==="vscode"||Ht.default.env.TERM==="xterm-256color"||Ht.default.env.TERM==="alacritty"||Ht.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ht,Bw=x(()=>{"use strict";Ht=w(require("process"),1)});var $R,OR,LR,Js,Uw=x(()=>{"use strict";Ep();Bw();$R={info:sr.blue("\u2139"),success:sr.green("\u2714"),warning:sr.yellow("\u26A0"),error:sr.red("\u2716")},OR={info:sr.blue("i"),success:sr.green("\u221A"),warning:sr.yellow("\u203C"),error:sr.red("\xD7")},LR=Pp()?$R:OR,Js=LR});function $p({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Ww=x(()=>{"use strict"});function Op(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(NR,"")}var NR,Hw=x(()=>{"use strict";Ww();NR=$p()});function Lp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Vw=x(()=>{"use strict"});function Np(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(jR,"")}var jR,Gw=x(()=>{"use strict";Vw();jR=Lp()});var Ql,ec,jp,Mp,zs,Kw=x(()=>{"use strict";Ql=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ec=[12288,12288,65281,65376,65504,65510],jp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Mp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],zs=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var tc,Jw=x(()=>{"use strict";tc=(e,t)=>{let r=0,n=Math.floor(e.length/2)-1;for(;r<=n;){let o=Math.floor((r+n)/2),i=o*2;if(t<e[i])n=o-1;else if(t>e[i+1])r=o+1;else return!0}return!1}});function JR(e){let t=e[0],r=e[1];for(let n=0;n<e.length;n+=2){let o=e[n],i=e[n+1];if(zw>=o&&zw<=i)return[o,i];i-o>r-t&&(t=o,r=i)}return[t,r]}var MR,BR,UR,WR,k2,D2,E2,v2,HR,VR,zw,GR,KR,qw,Yw,Xw,Zw=x(()=>{"use strict";Kw();Jw();MR=Ql[0],BR=Ql.at(-1),UR=ec[0],WR=ec.at(-1),k2=jp[0],D2=jp.at(-1),E2=Mp[0],v2=Mp.at(-1),HR=zs[0],VR=zs.at(-1),zw=19968,[GR,KR]=JR(zs);qw=e=>e<MR||e>BR?!1:tc(Ql,e),Yw=e=>e<UR||e>WR?!1:tc(ec,e),Xw=e=>e>=GR&&e<=KR?!0:e<HR||e>VR?!1:tc(zs,e)});function zR(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Qw(e,{ambiguousAsWide:t=!1}={}){return zR(e),Yw(e)||Xw(e)||t&&qw(e)?2:1}var eb=x(()=>{"use strict";Zw()});var tb,rb=x(()=>{"use strict";tb=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});function Bp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=Np(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!r};for(let{segment:s}of qR.segment(e)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!YR.test(s)){if(tb().test(s)){o+=2;continue}o+=Qw(a,i)}}return o}var qR,YR,nb=x(()=>{"use strict";Gw();eb();rb();qR=new Intl.Segmenter,YR=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Up({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var ob=x(()=>{"use strict"});function Hp(){let{env:e}=Wp.default,{TERM:t,TERM_PROGRAM:r}=e;return Wp.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Wp,ib=x(()=>{"use strict";Wp=w(require("process"),1)});var ar,XR,Vp,ZR,Gp,sb=x(()=>{"use strict";ar=w(require("process"),1),XR=3,Vp=class{#s=0;start(){this.#s++,this.#s===1&&this.#r()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#r(){ar.default.platform==="win32"||!ar.default.stdin.isTTY||(ar.default.stdin.setRawMode(!0),ar.default.stdin.on("data",this.#o),ar.default.stdin.resume())}#e(){ar.default.stdin.isTTY&&(ar.default.stdin.off("data",this.#o),ar.default.stdin.pause(),ar.default.stdin.setRawMode(!1))}#o(t){t[0]===XR&&ar.default.emit("SIGINT")}},ZR=new Vp,Gp=ZR});function Jp(e){return new Kp(e)}var qs,Ys,QR,Kp,ab=x(()=>{"use strict";qs=w(require("process"),1);Ep();Lw();Ys=w(Tp(),1);Uw();Hw();nb();ob();ib();sb();QR=w(Tp(),1),Kp=class{#s=0;#r=!1;#e=0;#o=-1;#p=0;#t;#i;#n;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:qs.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#n=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Up({stream:this.#n}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,qs.default.env.NODE_ENV==="test"&&(this._stream=this.#n,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(r){this.#s=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=t,this.#m()}get interval(){return this.#g??this.#i.interval??100}get spinner(){return this.#i}set spinner(t){if(this.#o=-1,this.#g=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#i=t}else if(!Hp())this.#i=Ys.default.line;else if(t===void 0)this.#i=Ys.default.dots;else if(t!=="default"&&Ys.default[t])this.#i=Ys.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#l}set suffixText(t=""){this.#l=t,this.#m()}get isSpinning(){return this.#f!==void 0}#y(t=this.#a,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}#w(t=this.#l,r=" "){return typeof t=="string"&&t!==""?r+t:typeof t=="function"?r+t():""}#m(){let t=this.#n.columns??80,r=this.#y(this.#a,"-"),n=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+r+"--"+this.#h+"--"+n;this.#e=0;for(let i of Op(o).split(`
|
|
8
|
+
`))this.#e+=Math.max(1,Math.ceil(Bp(i,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#c&&!this.#u}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=t}get isSilent(){return this.#u}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=t}frame(){let t=Date.now();(this.#o===-1||t-this.#p>=this.interval)&&(this.#o=++this.#o%this.#i.frames.length,this.#p=t);let{frames:r}=this.#i,n=r[this.#o];this.color&&(n=sr[this.color](n));let o=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text=="string"?" "+this.text:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return o+n+i+s}clear(){if(!this.#c||!this.#n.isTTY)return this;this.#n.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#n.moveCursor(0,-1),this.#n.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#n.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#n.write(this.frame()),this.#s=this.#e,this)}start(t){return t&&(this.text=t),this.#u?this:this.#c?this.isSpinning?this:(this.#t.hideCursor&&Ip.hide(this.#n),this.#t.discardStdin&&qs.default.stdin.isTTY&&(this.#r=!0,Gp.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#n.write(`- ${this.text}
|
|
9
|
+
`),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&Ip.show(this.#n),this.#t.discardStdin&&qs.default.stdin.isTTY&&this.#r&&(Gp.stop(),this.#r=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Js.success,text:t})}fail(t){return this.stopAndPersist({symbol:Js.error,text:t})}warn(t){return this.stopAndPersist({symbol:Js.warning,text:t})}info(t){return this.stopAndPersist({symbol:Js.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let r=t.prefixText??this.#a,n=this.#y(r," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),p=n+o+a+c+`
|
|
10
|
+
`;return this.stop(),this.#n.write(p),this}}});function Xs(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),rc.default.platform==="darwin"?eI(e):rc.default.platform==="win32"?tI(e):rI(e)}var Te,zp,rc,wn,qp,yi,eI,tI,rI,Yp=x(()=>{"use strict";Te=w(require("path"),1),zp=w(require("os"),1),rc=w(require("process"),1),wn=zp.default.homedir(),qp=zp.default.tmpdir(),{env:yi}=rc.default,eI=e=>{let t=Te.default.join(wn,"Library");return{data:Te.default.join(t,"Application Support",e),config:Te.default.join(t,"Preferences",e),cache:Te.default.join(t,"Caches",e),log:Te.default.join(t,"Logs",e),temp:Te.default.join(qp,e)}},tI=e=>{let t=yi.APPDATA||Te.default.join(wn,"AppData","Roaming"),r=yi.LOCALAPPDATA||Te.default.join(wn,"AppData","Local");return{data:Te.default.join(r,e,"Data"),config:Te.default.join(t,e,"Config"),cache:Te.default.join(r,e,"Cache"),log:Te.default.join(r,e,"Log"),temp:Te.default.join(qp,e)}},rI=e=>{let t=Te.default.basename(wn);return{data:Te.default.join(yi.XDG_DATA_HOME||Te.default.join(wn,".local","share"),e),config:Te.default.join(yi.XDG_CONFIG_HOME||Te.default.join(wn,".config"),e),cache:Te.default.join(yi.XDG_CACHE_HOME||Te.default.join(wn,".cache"),e),log:Te.default.join(yi.XDG_STATE_HOME||Te.default.join(wn,".local","state"),e),temp:Te.default.join(qp,t,e)}}});function nc(){return/[<>:"/\\|?*\u0000-\u001F]/g}function lb(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var cb=x(()=>{"use strict"});function Zs(e,t={}){let r=/[\u0000-\u001F\u0080-\u009F]/g,n=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(nc().test(o)&&r.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(n,"$1")),e=e.normalize("NFD"),e=e.replace(oI,o),e=e.replace(nc(),o),e=e.replace(r,o),e=e.replace(iI,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=lb().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:nI;if(e.length>i){let s=e.lastIndexOf(".");if(s===-1)e=e.slice(0,i);else{let a=e.slice(0,s),l=e.slice(s);e=a.slice(0,Math.max(1,i-l.length))+l}}return e}var nI,oI,iI,Xp=x(()=>{"use strict";cb();nI=100,oI=/^\.+(\\|\/)|^\.+$/,iI=/\.+$/});var sI,ub=x(()=>{"use strict";sI=w(require("path"),1);Xp()});var db=x(()=>{"use strict";Xp();ub()});var oc,Zp=x(()=>{"use strict";oc="webflow.json"});var oo,Qp=x(()=>{"use strict";oo=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function hb(e){pb=e}function yb(e){fb=e}function aI(){for(let e of wb){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function lI(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||aI()!==null}function V(){return pb?!0:fb?!1:lI()}function lr(){return!V()}function bb(e){mb=e}function Xe(){return mb}function kb(e){gb=e}function ic(){return gb}var pb,fb,mb,gb,wb,nM,we=x(()=>{"use strict";pb=!1,fb=!1,mb=!1;wb=[{variable:"CLAUDECODE",agent:"claude-code"},{variable:"CODEX_THREAD_ID",agent:"codex"},{variable:"CODEX_SANDBOX",agent:"codex"},{variable:"GEMINI_CLI",agent:"gemini-cli"},{variable:"OPENCODE_CLIENT",agent:"opencode"},{variable:"AI_AGENT",agent:"generic-agent"},{variable:"COPILOT_MODEL",agent:"copilot"},{variable:"AUGMENT_AGENT",agent:"augment"},{variable:"ANTIGRAVITY_AGENT",agent:"antigravity"},{variable:"CURSOR_AGENT",agent:"cursor"},{variable:"CURSOR_EXTENSION_HOST_ROLE",agent:"cursor",value:"agent-exec"}],nM=wb.map(e=>e.variable)});function cr(){let e=ic();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Db.statSync)(e)?.isDirectory())return{path:(0,Eb.join)(e,oc),isUserDefined:!0}}catch{if(e.endsWith(".json"))return{path:e,isUserDefined:!0}}throw new Error(`Manifest path must be either a directory or a .json file. Got: ${e}`)}return{path:`./${oc}`,isUserDefined:!1}}var Db,Eb,ef=x(()=>{"use strict";Db=require("fs"),Eb=require("path");Zp();we()});var vb,cI,uI,tf,Sb=x(()=>{"use strict";vb=w(require("ajv")),cI=new vb.default,uI={type:"object",properties:{region:{type:"string",enum:["us","eu"]},library:{type:"object",properties:{name:{type:"string",minLength:1},id:{type:"string",minLength:1},components:{type:"array",items:{type:"string"},minItems:1},renderer:{anyOf:[{type:"object",properties:{client:{type:"string",minLength:1},server:{type:"string",minLength:1}}},{type:"string",minLength:1}]},globals:{type:"string",minLength:1}},required:[]},devlink:{type:"object",properties:{rootDir:{type:"string",minLength:1},cssModules:{type:"boolean"},allowTelemetry:{type:"boolean"},overwriteModule:{type:"boolean"},skipTagSelectors:{type:"boolean"},envVariables:{type:"object",additionalProperties:{type:"string"}},components:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},fileExtensions:{type:"object",properties:{js:{type:"string"},css:{type:"string"}}},relativeHrefRoot:{oneOf:[{type:"boolean"},{type:"string"}]}},required:["rootDir"]},"devlink-export":{type:"object",properties:{rootDir:{type:"string",minLength:1},components:{type:"string"},componentGroups:{type:"string"},ts:{type:"boolean"},cssScopes:{type:"boolean"},relativeHrefRoot:{oneOf:[{type:"boolean",const:!1},{type:"string"}]},treeShake:{type:"boolean"},camelCaseVariantNames:{type:"boolean"}},required:[]},site:{type:"object",properties:{layout:{type:"object",properties:{preset:{type:"string",enum:["library","astro","nextjs","nextjs-pages"]},pagesRoot:{type:"string",minLength:1},componentsRoot:{type:"string",minLength:1},pagesShape:{type:"string",enum:["flat","nested"]}},required:[]}},required:[]}}},tf=cI.compile(uI)});function xb(e){return e instanceof Error?e:new Error("Unknown error")}function oe(){let{path:e}=cr();if(!(0,sc.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,sc.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${xb(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let n;try{n=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${xb(o).message}`)}if(!tf(n)){let o=tf.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:n,manifestPath:e}}var sc,Qs=x(()=>{"use strict";sc=require("fs");ef();Sb()});function ea(e,t){let r=e[t];if(!r)throw new oo(t);return r}var Cb=x(()=>{"use strict";Qp()});function Se(e){let t=oe(),r=t.manifest,n=t.manifestPath,o={...r};for(let i in e){let s=i,a=e[s];if(a!==void 0)if(typeof a=="string"||typeof a=="number"||typeof a=="boolean"||a===null)o[s]=a;else{let l=o[s];o[s]={...typeof l=="object"&&l!==null?l:{},...a}}}return(0,Fb.writeFileSync)(n,JSON.stringify(o,null,2),"utf-8"),o}var Fb,rf=x(()=>{"use strict";Fb=require("fs");Qs()});var Pe=x(()=>{"use strict";Zp();Qp();Qs();ef();Cb();rf()});var ac=gp((vM,dI)=>{dI.exports={name:"@webflow/webflow-cli",version:"2.5.0",license:"MIT",bin:{webflow:"./dist/index.js"},scripts:{build:"tsup",dev:"tsup",lint:"eslint .","type-check":"tsc -p tsconfig.typecheck.json",test:"jest --ci","test:unit":"jest --ci --ignoreProjects e2e","test:local":"jest","test:e2e:deploy":"bash regression/run-local.sh","test:regression":"jest --config regression/jest.config.js --testTimeout=420000","test:e2e-cache-clear":"bash scripts/clear-e2e-cache.sh"},files:["CHANGELOG.md","dist/**/*"],publishConfig:{access:"public"},dependencies:{"@babel/parser":"^7.26.9","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@babel/preset-typescript":"^7.27.0","@babel/types":"^7.26.9","@dotenvx/dotenvx":"^1.44.1","@inquirer/prompts":"^7.9.0","@module-federation/enhanced":"2.5.1","@rspack/core":"^1.7.8","@webflow/app":"0.1.0-beta.6","@webflow/cosmic-deploy-contract":"^1.1.0","@webflow/data-types":"*",ajv:"^8.17.1",archiver:"^5.3.1","babel-loader":"^10.0.0",commander:"^10.0.0",cosmiconfig:"^8.2.0","css-loader":"^7.1.2",dotenv:"^16.0.3","env-paths":"^3.0.0","fast-glob":"^3.3.3",filenamify:"^6.0.0","fork-ts-checker-webpack-plugin":"9.1.0","form-data":"4.0.4","fs-extra":"^11.3.0",jsdom:"^26.0.0","jsonc-parser":"^3.2.0",md5:"^2.2.1",memfs:"4.17.0","mime-types":"^2.1.35","mini-css-extract-plugin":"^2.9.2","node-fetch":"^2.6.7",open:"^8.4.2",ora:"^8.2.0",postcss:"^8.5.23","postcss-loader":"^8.1.1","postcss-selector-parser":"^7.1.0",prettier:"^3.9.6",semver:"^7.7.2","serve-handler":"^6.1.5","source-map-support":"^0.5.21",tar:"^7.5.19","ts-checker-rspack-plugin":"^1.0.0","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.2.0",unionfs:"^4.5.4","webflow-api":"3.3.4",webpack:">=5.99.7 <5.106.0","webpack-merge":"^6.0.1","webpack-node-externals":"^3.0.0",yaml:"^2.8.4",zod:"^3.22.4"},devDependencies:{"@module-federation/sdk":"2.5.1","@types/archiver":"^5.3.2","@types/express":"^4.17.13","@types/fs-extra":"^11.0.4","@types/jest":"^30.0.0","@types/md5":"^2.3.2","@types/mime-types":"^2.1.4","@types/nock":"^8.0.33","@types/node":"^22.13.0","@types/node-fetch":"2.6.13","@types/serve-handler":"^6.1.1","@types/source-map":"^0.5.2","@types/webpack-node-externals":"^3.0.4",astro:"^7.0.6","eslint-config-custom":"*",express:"^4.18.1",jest:"^30.4.2","jest-config-custom":"*",nock:"13.3.1",tar:"^7.5.19",tsconfig:"*",tsup:"^8.4.0",typescript:"^5.9.3"},engines:{node:">=22.13.0"}}});function Sr(){try{return ac().version}catch{return"unknown"}}function ur(e=""){if(!e)return"";let t=e;t=t.replace(/\/.*?\/webflow-cli/gi,"/REDACTED_PII/webflow-cli"),t=t.replace(/\/.*?\/node_modules/gi,"/REDACTED_PII/node_modules");let r=ta.default.homedir();if(r){let o=new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let n=ta.default.userInfo().username;if(n){let o=new RegExp(`/Users/${n}`,"gi");t=t.replace(o,"/Users/REDACTED_PII")}return t=t.replace(/\/Users\/[^\/\s]+/gi,"/Users/REDACTED_PII"),t=t.replace(/C:\\Users\\[^\\]+/gi,"C:\\Users\\REDACTED_PII"),t=t.replace(/[a-zA-Z0-9]{32,}/g,"[REDACTED_TOKEN]"),t=t.replace(/Bearer\s+[^\s]+/gi,"Bearer [REDACTED_TOKEN]"),t=t.replace(/token[=:]\s*[^\s]+/gi,"token=[REDACTED_TOKEN]"),t=t.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[REDACTED_EMAIL]"),t=t.replace(/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,"[REDACTED_IP]"),t}function nf(e){if(e.stack)return ur(e.stack)}function bn(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],r={};for(let[n,o]of Object.entries(e)){let i=n.toLowerCase();t.some(s=>i.includes(s))?r[n]="[REDACTED]":typeof o=="string"?r[n]=ur(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?r[n]=bn(o):Array.isArray(o)?r[n]=o.map(s=>typeof s=="object"&&s!==null?bn(s):typeof s=="string"?ur(s):s):r[n]=o}return r}function _b(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${ta.default.type()} ${ta.default.release()}`}}function of(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var ta,ra=x(()=>{"use strict";ta=w(require("os"))});function wi(){if(process.platform==="win32"){let r=process.env.APPDATA??na.default.join(sf.default.homedir(),"AppData","Roaming");return na.default.join(r,Ab)}let t=process.env.XDG_CONFIG_HOME??na.default.join(sf.default.homedir(),".config");return na.default.join(t,Ab)}function Rb(){return Xs("webflow-cli").cache}var sf,na,Ab,oa=x(()=>{"use strict";sf=w(require("os")),na=w(require("path"));Yp();Ab="webflow"});function ia(){return af.default.join(wi(),pI)}function lf(){let e=ia();try{if(!bi.default.existsSync(e))return null;let t=bi.default.readFileSync(e,"utf8"),r=JSON.parse(t);return typeof r=="object"&&r!==null&&typeof r.allowTelemetry=="boolean"?r:null}catch{return null}}function cf(e){let t=ia(),r=af.default.dirname(t);bi.default.existsSync(r)||bi.default.mkdirSync(r,{recursive:!0,mode:448}),bi.default.writeFileSync(t,JSON.stringify(e,null,2),{encoding:"utf8",mode:384})}var bi,af,pI,uf=x(()=>{"use strict";bi=w(require("fs")),af=w(require("path"));oa();pI="telemetry.json"});var $,D,xe,ki,df,rt,X,lc,pf,Kr,j=x(()=>{"use strict";me();$=z("\u2713"),D=Ut("\u2716"),xe=Ne("\u2139"),ki=z("\u279C"),df=Ut("\u279C"),rt="\u279C",X=ue("\u26A0"),lc=P("\u2732"),pf=z("\u2732"),Kr=ue("[Deprecated]")});var Ib,kn,ff=x(()=>{"use strict";Ib=w(require("fs"));Pe();ra();uf();R();me();j();we();kn=class e{static instance;cache=void 0;static isDoNotTrackEnabled(){let t=process.env.DO_NOT_TRACK;return t==="1"||t?.toLowerCase()==="true"}static getInstance(){return e.instance||(e.instance=new e),e.instance}static localManifestExists(){try{let{path:t}=cr();return Ib.default.existsSync(t)}catch{return!1}}static readLocalPreference(){if(e.localManifestExists())try{let{manifest:t}=oe();return t?.telemetry?.global?.allowTelemetry}catch{return}}static readGlobalPreference(){return lf()?.allowTelemetry}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;let t=e.readLocalPreference();if(t!==void 0)return this.cache=t,t;let r=e.readGlobalPreference();if(r!==void 0)return this.cache=r,r}async setPreference(t,r){this.cache=t,r?.local?await this.setLocalPreference(t):await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(Xe()||u.info(`${xe} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(Xe()||(u.info(`${pf} ${P("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${pf} ${P("To opt out, run")} ${z("webflow auth telemetry --disable")}`)),await this.setGlobalPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return e.isDoNotTrackEnabled()?!1:e.readGlobalPreference()}async setGlobalPreference(t){cf({allowTelemetry:t,lastPrompted:Date.now(),version:Sr()}),Xe()||u.info(`${$} Telemetry configuration updated in ${ia()}`);let r=e.readLocalPreference();if(r!==void 0&&r!==t){let{path:n}=cr();u.warn(`${X} ${n} sets telemetry to ${r?"enabled":"disabled"} and overrides the global config for commands run in this directory. Re-run with --local to update it.`)}this.cache=t}async setLocalPreference(t){let r={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:Sr()}}};if(Se(r),!Xe()){let{path:n}=cr();u.info(`${$} Telemetry configuration updated in ${n}`)}this.cache=t}async hasGlobalPreference(){return e.readGlobalPreference()!==void 0}async getTelemetryStatus(){if(e.isDoNotTrackEnabled())return{enabled:!1,source:"env",hasPreference:!0};let t=e.readLocalPreference();if(t!==void 0)return{enabled:t,source:"local",hasPreference:!0};let r=e.readGlobalPreference();return r!==void 0?{enabled:r,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,r){this.cache=r}}});async function K(e,t){let n={"User-Agent":`webflow-cli@${Sr()}`};return(0,Tb.default)(e,{...t,headers:{...t?.headers,...n}})}var Tb,lt=x(()=>{"use strict";Tb=w(require("node-fetch"));Z()});var d,C=x(()=>{"use strict";d=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;constructor(t,r){let n=t instanceof Error?t.message:String(t);super(n),this.name="CLIError",this.prefix=r?.prefix,this.skipLogging=r?.skipLogging??!1,this.isUserError=r?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=r?.missingFlag,this.code=r?.code??(t instanceof e?t.code:void 0),t instanceof Error?(this.cause=t,this.stack=t.stack):Error.captureStackTrace&&Error.captureStackTrace(this,e)}}});function $b(e){Pb=e}function ct(){return Pb}function mf(e,t){if(io.includes(e))return e;throw new d(`Invalid region "${e}" from ${t}. Valid regions: ${io.join(", ")}.`,{isUserError:!0})}function Ob(e){if(e)return mf(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return mf(t,"WEBFLOW_REGION");let r;try{r=oe().manifest.region}catch(n){if(n instanceof Error&&n.message.startsWith("Invalid manifest:"))throw new d(n.message,{isUserError:!0});return"us"}return r?mf(r,"webflow.json"):"us"}var io,Pb,Dn=x(()=>{"use strict";C();Pe();io=["us","eu"],Pb="us"});var Lb,Nb=x(()=>{"use strict";Lb=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});function cc(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function hf(){return fI[cc()][ct()]}function O(){return process.env.WEBFLOW_API_HOST?gf("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):hf().api}function Di(){return process.env.WEBFLOW_CDN_API_HOST?gf("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):hf().cdnApi}function xr(){return process.env.WEBFLOW_HOST?gf("WEBFLOW_HOST",process.env.WEBFLOW_HOST):hf().webflow}var gf,fI,sa,yf,aa,la,Ei,ke=x(()=>{"use strict";Dn();Nb();gf=(e,t)=>(Lb(t)||(console.error(`Error: Invalid ${e} environment variable. Only valid plain HTTP/HTTPS URLs without query parameters and anchors is allowed.`),process.exit(1)),t),fI={development:{us:{webflow:"https://wfdev.io:8443",api:"https://api.wfdev.io:8443",cdnApi:"https://api-cdn.wfdev.io:8443"},eu:{webflow:"https://eu.wfdev.io:8443",api:"https://api.eu.wfdev.io:8443",cdnApi:"https://api-cdn.eu.wfdev.io:8443"}},acceptance:{us:{webflow:"https://webflowtest.com",api:"https://api.webflowtest.com",cdnApi:"https://api-cdn.webflowtest.com"},eu:{webflow:"https://eu.webflowtest.com",api:"https://api.eu.webflowtest.com",cdnApi:"https://api-cdn.eu.webflowtest.com"}},sai:{us:{webflow:"https://webflow-sai.com",api:"https://api.webflow-sai.com",cdnApi:"https://api-cdn.webflow-sai.com"},eu:{webflow:"https://eu.webflow-sai.com",api:"https://api.eu.webflow-sai.com",cdnApi:"https://api-cdn.eu.webflow-sai.com"}},production:{us:{webflow:"https://webflow.com",api:"https://api.webflow.com",cdnApi:"https://api-cdn.webflow.com"},eu:{webflow:"https://eu.webflow.com",api:"https://api.eu.webflow.com",cdnApi:"https://api-cdn.eu.webflow.com"}}};sa="wf-manifest.json",yf="mf-manifest.json",aa="@webflow_renderer",la="ssr-bundle.tar",Ei="index.js"});function mI(){let e=process.argv.slice(2),t=[];for(let r=0;r<e.length;r+=1){let n=e[r],o=n.indexOf("=");if(o>0&&jb.has(n.slice(0,o))){t.push(`${n.slice(0,o)}=<redacted>`);continue}t.push(n),jb.has(n)&&r+1<e.length&&(t.push("<redacted>"),r+=1)}return t.join(" ")||void 0}var jb,_,wf=x(()=>{"use strict";ff();ra();R();lt();ke();jb=new Set(["--ref","--name","--q","--branch","--key"]);_=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=kn.getInstance(),this.sessionId=of(),this.platformInfo=_b()}async sendEvent(t){try{if(!await this.isEnabled())return;let r=this.enrichEvent(t),n=this.sanitizeEvent(r);await this.transmitEvent(n)}catch(r){u.debug(`Failed to send telemetry event: ${r}`)}}async sendError(t,r,n){await this.sendEvent({eventType:"error",success:!1,feature:r,name:t.name,message:t.message,cause:t.cause,stack:nf(t),context:r,metadata:n?bn(n):void 0})}async sendUsage(t,r){let{duration:n,...o}=r??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof n=="number"?n:void 0,data:Object.keys(o).length>0?bn(o):void 0})}async sendPerformance(t,r,n,o){await this.sendEvent({eventType:"performance",feature:o,operation:t,duration:r,metrics:n})}async isEnabled(){return await this.consentManager.getPreference()!==!1}async isGloballyEnabled(){return await this.consentManager.getGlobalPreference()!==!1}async updatePreferences(t){await this.consentManager.setPreference(t)}static async promptForConsentIfNeeded(t){let r=kn.getInstance(),n=await r.getPreference();return n!==void 0?n:await r.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:Sr(),command:this.config.suppressCommand?void 0:mI(),metadata:{...t.metadata,commandType:this.config.commandType,siteId:this.config.siteId,projectId:this.config.projectId,os:this.platformInfo.os,arch:this.platformInfo.arch}},...t}}sanitizeEvent(t){let r=JSON.parse(JSON.stringify(t));return r.message&&(r.message=ur(r.message)),r.stack&&(r.stack=ur(r.stack)),r.feature&&(r.feature=ur(r.feature)),r.context&&(r.context=ur(r.context)),r.metadata&&(r.metadata=bn(r.metadata)),r.data&&(r.data=bn(r.data)),r}async transmitEvent(t){let r=this.getEndpoint(),n=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(n){console.log(`\u{1F4CA} [Telemetry] Sending to: ${r}`);let i={...t};i.metadata&&(delete i.metadata.authToken,delete i.metadata.apiToken),console.log("\u{1F4CA} [Telemetry] Payload:",JSON.stringify(i,null,2))}let o=await K(r,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)n&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw n&&console.error(`\u{1F4CA} [Telemetry] Request failed: ${o.status} ${o.statusText}`),new Error(`Telemetry request failed: ${o.status} ${o.statusText}`)}getEndpoint(){let{host:t,commandType:r}=this.config;return`${t}/webflow-cli/${r}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||O(),authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||O(),authToken:t.authToken,commandType:"skills"})}}});var Mb=x(()=>{"use strict"});function Bb(e,t){return async(r,n,o)=>{let i=Date.now(),s=process.memoryUsage().heapUsed;try{let a=await n(),l=Date.now()-i,c=process.memoryUsage().heapUsed;return await e.sendPerformance(r,l,{memoryDelta:c-s,...o},t),a}catch(a){let l=Date.now()-i;throw await e.sendPerformance(r,l,{failed:1,...o},t),a}}}var Z=x(()=>{"use strict";wf();ff();uf();Mb();ra();ra()});var kf,bf,gI,Jr,Df=x(()=>{"use strict";kf=Symbol("webflow-cli-warn"),bf=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let r=t.split(`
|
|
11
|
+
`);for(let n=2;n<r.length;n++){let o=r[n],i=o.match(/at .+? \((.+?):\d+:\d+\)/)||o.match(/at (.+?):\d+:\d+/);if(i){let s=i[1];if(s.includes("node_modules")){let a=s.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)/);return a?`External: ${a[1]}`:"External Dependencies"}else if(s.includes("webflow-cli"))return s.includes("/metadata/")?"Metadata Collection":s.includes("/bundler/")?"Bundling":s.includes("/commands/")?"CLI Commands":"Webflow CLI"}}return"General"}start(){this.isActive||(this.warnings=[],this.originalConsoleWarn=console.warn,this.isActive=!0,console.warn=(...t)=>{if(t.length>1&&t[t.length-1]===kf){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let r=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),n=new Error().stack||"",o=this.parseSource(n);this.warnings.push({message:r,timestamp:Date.now(),source:o,stackTrace:n})})}stop(){this.isActive&&(this.originalConsoleWarn&&(console.warn=this.originalConsoleWarn,this.originalConsoleWarn=null),this.isActive=!1)}displayGrouped(){if(this.warnings.length===0)return;console.log(`
|
|
12
12
|
\u26A0\uFE0F Warnings:
|
|
13
|
-
`);let t=this.warnings.reduce((n
|
|
13
|
+
`);let t=this.warnings.reduce((r,n)=>{let o=n.source||"General";return r[o]||(r[o]=[]),r[o].push(n),r},{});Object.entries(t).forEach(([r,n])=>{r!=="General"&&console.log(` ${r}:`),n.forEach((o,i)=>{let s=r!=="General"?" ":" ",a=o.message||"[Empty warning message]";console.log(`${s}${i+1}. ${a}`)}),r!=="General"&&console.log("")}),t.General&&console.log("")}debug(){console.log(`
|
|
14
14
|
\u{1F41B} Debug: Captured Warnings
|
|
15
|
-
`),this.warnings.forEach((t,
|
|
16
|
-
`).slice(0,3).forEach(
|
|
17
|
-
`)),
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
`).map(
|
|
21
|
-
`);return
|
|
22
|
-
`+t):t};
|
|
23
|
-
`);try{return await e()}catch(t){throw t instanceof Error&&
|
|
15
|
+
`),this.warnings.forEach((t,r)=>{console.log(`Warning ${r+1}:`),console.log(` Source: ${t.source}`),console.log(` Message: ${t.message}`),console.log(` Message length: ${t.message.length}`),console.log(` Timestamp: ${new Date(t.timestamp).toISOString()}`),t.stackTrace&&(console.log(" Stack (first 3 lines):"),t.stackTrace.split(`
|
|
16
|
+
`).slice(0,3).forEach(n=>{console.log(` ${n}`)})),console.log("")})}},gI=new bf,Jr=gI});function bt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function Hb(e,t){if(!e)return t;let r=parseInt(e,10);return isNaN(r)||r<=0?t:r}function zr(e){ua.push(ur(e)),ua.length>wI&&ua.shift()}function Vb(e){vf=e}function Ub(e){return zr(`DEBUG: ${e}`),e}function kI(e){return zr(`INFO: ${e}`),e}function DI(e){return zr(`WARN: ${e}`),e}function EI(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";zr(`ERROR: ${n}${r}`),Sf=!0;let o=e instanceof Error?e.message:String(e);return Ut(`${n}${o}`)}function vI(e){return zr(`SUCCESS: ${e}`),z(e)}function CI(e){let t=Jp({text:`${e}...`,indent:1}).start(),r=!1,n=o=>i=>{if(zr(`${SI[o]||"INFO"}: ${i||e}`),o==="fail"&&(Sf=!0),o==="update"){t.text=i||e;return}r||(r=!0,t.stopAndPersist({symbol:xI[o],text:P(i||e)}))};return{succeed:n("succeed"),fail:n("fail"),warn:n("warn"),info:n("info"),neutral:n("neutral"),update:n("update"),stop:()=>{r||(r=!0,t.stop())}}}function FI(){let e=vi.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:vi.default.statSync(uc.default.join(At,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);for(;e.length>=yI;)try{let t=e.pop();if(!t)break;vi.default.removeSync(uc.default.join(At,t.name))}catch{}}function xf(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;vi.default.ensureDirSync(At),FI(),ua.unshift(`CLI Version: ${Sr()}`,`Node Version: ${process.version}`,`Platform: ${process.platform}`,`Architecture: ${process.arch}`,`Command: ${t||"N/A"}`,`Exit Code: ${e??0}`,`Memory Usage: ${Math.round(process.memoryUsage().heapUsed/1024/1024)}MB`,`Timestamp: ${new Date().toISOString()}`,...vf?[`Sync ID: ${vf}`]:[],"");let r=ua.map(bt);vi.default.writeFileSync(Ef,r.join(`
|
|
17
|
+
`)),Sf&&(console.info(`
|
|
18
|
+
${D} ${P("An error occurred. See logs for more information:")}`),console.info(` ${df} Latest log: ${Ef}`),console.info(` ${df} All logs: ${At}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
|
|
19
|
+
${$} Command completed successfully. Logs written to:`),console.info(` ${ki} Latest log: ${Ef}`),console.info(` ${ki} All logs: ${At}`))}catch(t){console.error("Failed to write logs:",t)}}function Gb(e,t){let r=e instanceof Error?e.stack||e.message:e,n=t?.prefix?`${t.prefix} `:"";zr(`ERROR: ${n}${r}`)}var vi,uc,dB,hI,At,yI,wI,bI,Ef,ua,Sf,vf,SI,xI,Si,Wb,ca,_I,u,R=x(()=>{"use strict";vi=w(require("fs-extra")),uc=w(require("path")),dB=require("source-map-support/register");ab();Yp();db();Z();me();Df();j();hI=Xs("webflow-cli"),At=hI.log;yI=Hb(process.env.MAX_PERSISTED_LOGS,50),wI=Hb(process.env.MAX_IN_MEMORY_LOGS,1e3),bI=`${Zs(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,Ef=uc.default.join(At,bI);ua=[],Sf=!1;SI={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},xI={succeed:$,fail:D,warn:X,info:xe,neutral:" ",update:void 0};Si=!1;process.on("uncaughtException",e=>{Si||(Si=!0,zr(`UNCAUGHT EXCEPTION: ${e?.stack}`),xf(1)),Jr.displayGrouped(),Jr.stop(),process.exit(1)});process.on("unhandledRejection",e=>{Si||(Si=!0,zr(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),xf(1)),Jr.displayGrouped(),Jr.stop(),process.exit(1)});process.on("exit",e=>{Si||(Si=!0,xf(e))});Wb=!0,ca=e=>{let t=e.split(`
|
|
20
|
+
`).map(r=>r.length?` ${r}`:r).join(`
|
|
21
|
+
`);return Wb?(Wb=!1,`
|
|
22
|
+
`+t):t};_I={debug:e=>{let t=Ub(e);process.env.DEBUG&&console.debug(ca(t))},trace:e=>{let t=Ub(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(ca(kI(e))),warn:e=>console.warn(ca(DI(e)),kf),error:(e,t)=>{console.error(ca(EI(e,t)))},success:e=>console.log(ca(vI(e))),spinner:CI},u=_I});async function xi(e){process.stdout.write(`
|
|
23
|
+
`);try{return await e()}catch(t){throw t instanceof Error&&OI.test(t.message)&&(u.debug(t.message),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&process.stdin.setRawMode(!1),process.exit(130)),t}}async function $e(e){return V()?e.default??!1:xi(()=>ut.confirm({...e,theme:RI}))}async function je(e){if(V())return"default"in e?e.default:null;let t=e.choices.map(r=>{if(!r||typeof r!="object"||ut.Separator.isSeparator(r)||r.type==="separator")return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return xi(()=>ut.select({...e,choices:t,theme:TI}))}async function Ge(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:xi(()=>ut.input({...e,theme:zb}))}async function Xb(e){return V()?null:xi(()=>ut.password({...e,theme:zb}))}async function Cr(e){if(V()){let r=[];return await e.validate?.(r)!==!0?null:r}let t=e.choices.map(r=>{if(!r||typeof r!="object"||r.type==="separator"||ut.Separator.isSeparator(r))return r;let n=r.name??String(r.value??"");return{...r,name:` ${P(n)}`}});return xi(()=>ut.checkbox({...e,choices:t,theme:PI}))}async function pc(e){if(V())return"default"in e?e.default:null;let t=(async(r,n)=>(await e.source(r,n)).map(i=>!i||typeof i!="object"||ut.Separator.isSeparator(i)?i:{...i,name:` ${P(i.name??"")}`}));return xi(()=>ut.search({...e,source:t,theme:$I}))}var ut,RI,zb,da,qb,_f,Af,Yb,II,TI,PI,$I,OI,Oe=x(()=>{"use strict";ut=w(require("@inquirer/prompts"));we();R();me();RI={prefix:` ${Ne("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
|
|
24
24
|
`:`${se(e)}
|
|
25
|
-
`,answer:e=>` ${
|
|
26
|
-
`,answer:e=>
|
|
27
|
-
`:se(e),
|
|
25
|
+
`,answer:e=>` ${P(e)}`}},zb={prefix:` ${Ne("?")}`,style:{message:e=>`${se(e)}
|
|
26
|
+
`,answer:e=>P(e)}},da=2,qb=1,_f=(e,t)=>t==="done"?`${se(e)}
|
|
27
|
+
`:se(e),Af=e=>` ${P(bt(e).trim())}`,Yb=e=>{let t=bt(e),r=t.slice(0,da),n=t.slice(da+1+qb);return Ne(`${r} ${n}`)},II=e=>{let t=bt(e),r=t.slice(0,da),n=t[da+2],o=t.slice(da+3+qb);return Ne(`${r} ${n} ${o}`)},TI={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:Yb,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`}},PI={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:II,keysHelpTip:e=>` ${e.map(([t,r])=>`${P(t)} ${P(r)}`).join(" ")}`},icon:{cursor:` ${Ne("\u23F5")}`,checked:` ${z("\u25C9")}`,unchecked:` ${P("\u25EF")}`}},$I={prefix:` ${Ne("?")}`,style:{message:_f,answer:Af,highlight:Yb,searchTerm:e=>Ne(e)},icon:{cursor:` ${Ne("\u23F5")}`}},OI=/SIGINT/i});function Ke(){return!1}var qr=x(()=>{"use strict"});function Yr({apiToken:e,siteId:t,directory:r}){let n=fa.resolve(r?fa.join(r,".env"):fa.join(process.cwd(),".env"));r&&!co.existsSync(r)&&co.mkdirSync(r,{recursive:!0}),co.existsSync(n)||co.writeFileSync(n,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),fc.default.config({path:n,quiet:!0}),e&&fc.default.set("WEBFLOW_API_TOKEN",e,{path:n,encrypt:!1}),t&&fc.default.set("WEBFLOW_SITE_ID",t,{path:n,encrypt:!1})}var co,fa,fc,nk=x(()=>{"use strict";co=w(require("fs")),fa=w(require("path")),fc=w(require("@dotenvx/dotenvx"))});function If(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version===mc&&io.includes(t.region)&&typeof t.session=="object"&&t.session!==null&&typeof t.session.accessToken=="string"}function Sn(){let e=wi();return Tf.default.join(e,jI)}function ok(){let e=Sn();try{if(!vn.default.existsSync(e))return null;let t=vn.default.readFileSync(e,"utf8"),r=JSON.parse(t);if(If(r))return r;let n=r;if(n.version===2&&typeof n.sessions=="object"&&n.sessions){let i=ct(),s=n.sessions,a=s[i]!=null?i:Object.keys(s).find(p=>s[p]!=null);if(a==null)return null;let l=s[a];if(l==null)return null;let c={version:mc,region:a,session:l};return If(c)?c:null}let o=r;if(typeof o.accessToken=="string"){let i={version:mc,region:"us",session:o};return If(i)?i:null}return null}catch{return null}}function Ci(e=ct()){let t=ok();return!t||t.region!==e?null:t.session}function ma(){return ok()?.region??null}function Pf(e,t=ct()){let r=Sn(),n=Tf.default.dirname(r);vn.default.existsSync(n)||vn.default.mkdirSync(n,{recursive:!0,mode:448});let o={version:mc,region:t,session:e};vn.default.writeFileSync(r,JSON.stringify(o,null,2),{encoding:"utf8",mode:384})}function $f(){let e=Sn();try{if(!vn.default.existsSync(e))return;vn.default.unlinkSync(e)}catch{}}var vn,Tf,jI,mc,Of=x(()=>{"use strict";vn=w(require("fs")),Tf=w(require("path"));oa();Dn();jI="auth.json",mc=3});function Fi(){return{serverUrl:xr(),timeoutMs:300*1e3}}var Lf=x(()=>{"use strict";ke()});var ik,sk,ak,lk,MI,ck,BI,uk,dk=x(()=>{"use strict";ik=require("crypto"),sk=w(require("open"));Lf();R();lt();ak=e=>{let t=new Uint8Array(e);return ik.webcrypto.getRandomValues(t),Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")},lk=({pollId:e,clientId:t,scope:r})=>`${Fi().serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(r.join(" "))}`,MI=e=>`${Fi().serverUrl}/oauth/webflow/poll?pollId=${e}`,ck=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(r=>setTimeout(r,3e3)),await(0,sk.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},BI=async e=>{let t=MI(e),r=await K(t);if(!r.ok){let n=`Failed to poll for authentication status (${r.status})`;try{let o=await r.json();o&&o.error&&(n+=`: ${o.error}`)}catch{}throw new Error(n)}return r.json()},uk=(e,t)=>{let r=u.spinner("Waiting");return new Promise((n,o)=>{let i=setTimeout(()=>{clearTimeout(i),clearInterval(s),o(new Error("Authentication timed out. Please try again."))},t),s=setInterval(async()=>{try{let a=await BI(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),r.succeed("Authentication successful! You can close the browser window."),n(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),r.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function fk(){return[...UI,...Ke()?WI:[]].sort()}function Vt(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=Ci();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!pk&&(pk=!0,u.warn(`${X} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${z("webflow auth login --force")} to update your .env file.`)),t}async function T(e){if(e?.apiToken&&!e.force)return e.apiToken;if(!e?.force){let s=Vt();if(s)return s}if(V())throw new d(`No API token found. To authenticate in CI/CD environments:
|
|
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=ct(),
|
|
30
|
-
`})}}async function
|
|
31
|
-
Run ${
|
|
32
|
-
or provide --site and --api-token when running a CLI command`);let
|
|
33
|
-
${
|
|
34
|
-
`+k})}throw new f(r,{skipLogging:!0})}}var gk,hk=L(()=>{"use strict";gk=require("crypto");ak();nm();pk();X();q();Me();mk();A();C();Gf();M();zf()});var yk={};Vy(yk,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>em,exportComponents:()=>Hc,isDevlinkNotEntitledError:()=>uo});var Vc=L(()=>{"use strict";hk();nm()});var Gy=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function pA(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 fA(e=process){if(e[Gy])return;e[Gy]=!0;let t=e.emit;e.emit=function(r,...o){return r==="warning"&&pA(o[0])?!1:t.call(this,r,...o)}}fA();var nA=w(require("fs")),rA=require("commander");var Q_=require("commander");pe();A();var _b=require("child_process"),Ab=require("fs"),ff=w(require("semver"));A();var mf="@webflow/webflow-cli",ro="@webflow/data-types",ic="@webflow/react",$R=[mf,ro,ic],oo=class{getInstalledDependencies(){try{let t=(0,_b.execSync)(`npm ls ${$R.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,Ab.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...n.dependencies,...n.devDependencies}}checkCLIAndDataTypes(t){let n=t[ro];if(!n)return;let o=this.getRequiredDependencies(mf)[ro];if(!ff.default.satisfies(n,o))throw new Error(`Version mismatch: ${mf} requires ${ro} v${o} but found v${n}`)}checkReactAndDataTypes(t){let n=t[ro],r=t[ic];if(!(!n||!r)&&!ff.default.eq(n,r))throw new Error(`Version mismatch: ${ic} and ${ro} must be on the same version. Found ${ic}@${r} and ${ro}@${n}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var Nb=require("fs-extra");Oe();var jb=require("@dotenvx/dotenvx"),io=w(require("semver"));A();var $b=require("child_process"),Ob=require("util"),UR=(0,Ob.promisify)($b.exec);async function wr(e,t){try{let{stdout:n,stderr:r}=await UR(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 yf=w(tc());M();pe();(0,jb.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var Lb={npm:{updateCommand:"npm install",update:async e=>await wr(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await wr(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await wr(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await wr(`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}},WR=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],la=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(Lb))if((0,Nb.existsSync)(t.lockFile))return t;return Lb.npm}async listOutdatedPackages(t="local",n=WR){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} ${nt} ${a})`,value:i})),o=await Cn({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(` ${nc} ${s} (${a} ${nt} ${l})`))});let o=Object.entries(t).filter(([,{installationType:s}])=>s==="local").map(([s])=>`${s}@latest`),i=Object.entries(t).filter(([,{installationType:s}])=>s==="global").map(([s])=>`${s}@latest`);u.info(`
|
|
35
|
-
|
|
36
|
-
`);return}let{
|
|
37
|
-
|
|
29
|
+
2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=ct(),r=ma();r&&r!==t&&u.warn(`${X} Switching region from ${r.toUpperCase()} to ${t.toUpperCase()} \u2014 the ${r.toUpperCase()} session will be replaced.`);let n=ak(16),o=VI(),i=fk();try{let s=lk({pollId:n,clientId:o,scope:i});u.debug(`OAuth login: region="${ct()}" buildEnv="${cc()}" apiHost="${O()}" oauthServer="${Fi().serverUrl}" clientId="${o}" authorizeUrl="${s}"`),await ck(s);let a=await uk(n,Fi().timeoutMs);return Pf({accessToken:a,scopes:i,createdAt:new Date().toISOString()}),u.info(`${$} Credentials saved: ${Sn()}`),a}catch(s){throw new d(s)}}function VI(){if(process.env.WEBFLOW_OAUTH_CLIENT_ID)return process.env.WEBFLOW_OAUTH_CLIENT_ID;let e=cc(),t=ct(),r=HI[e][t];if(r)return r;let n=t.toUpperCase();throw new d(`${n} login is not available for this environment yet. Set WEBFLOW_API_TOKEN to a token from your ${n} workspace, or set WEBFLOW_OAUTH_CLIENT_ID if you have a ${n} client ID.`,{isUserError:!0})}var UI,WI,pk,HI,Nf=x(()=>{"use strict";ke();we();R();j();C();Dn();Of();Lf();dk();me();qr();UI=["assets:read","assets:write","authorized_user:read","cloud_apps:write","cms:read","cms:write","code_components:read","code_components:write","devlink_export:read","forms:read","sites:read","sites:write","workspace:read"],WI=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];pk=!1;HI={development:{us:"db64c798d0a5adb3c9c43b10c80f93fece223acd072246f957d9700b1bf3cab0"},acceptance:{us:"32a6440eefa0b608b39c36164a9cf274c9c096cfe6541e9dab08ff4f372fe245"},sai:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074",eu:"6e2027b2c3a881e6d1f7a0933e7240e9ddf50df5afdde06740e30d56e3deed4b"},production:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}}});function uo(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function xn(e){try{let r=await new mk.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Di()}/v2`}}).sites.list();if(!r||typeof r!="object"||!r.sites||!Array.isArray(r.sites))throw new d("Invalid response from Webflow API");let n=r.sites.map(o=>({id:o.id,displayName:o.displayName??"",shortName:o.shortName||(o.displayName??"").toLowerCase().replace(/\s+/g,"-"),lastUpdated:o.lastUpdated??null,workspaceId:o.workspaceId??null}));return n.sort((o,i)=>o.displayName.localeCompare(i.displayName)),n}catch(t){throw new d(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
|
|
30
|
+
`})}}async function _i(e){let t=e.map(n=>({name:`${n.displayName} (${n.shortName})`,value:n})),r=await pc({message:"Search for a Webflow site:",source:n=>{if(!n)return t;let o=n.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!r){if(e.length===0)throw new d("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return r}var mk,gc=x(()=>{"use strict";mk=require("webflow-api");Oe();R();ke();ke();C()});var po,Cn,jf=x(()=>{"use strict";C();po=class extends d{constructor(t){super(t),this.name="NoWebflowSitesError"}},Cn=class extends d{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function Je(e,t){let r=t?.site??uo(e);if(V()&&!r)throw new d(`No site ID configured for this project.
|
|
31
|
+
Run ${z("webflow auth login")} locally to authenticate and associate this project with a Webflow site,
|
|
32
|
+
or provide --site and --api-token when running a CLI command`);let n=await T({apiToken:t?.apiToken,force:t?.force});if(!r||t?.force){let o=await xn(n);if(o.length===0)throw new po("No Webflow sites found in your account. Please make sure you have at least one authorized site in your Webflow account");let i=o.length>1?await _i(o):o[0];r=i.id;let s=Se({siteId:r});return e.siteId=s.siteId,u.info(`${$} Site ID updated in webflow.json`),{siteId:r,siteName:i.displayName,accessToken:n}}return{siteId:r,accessToken:n}}var gk=x(()=>{"use strict";Pe();we();Nf();gc();C();jf();j();me();R()});async function Mf(e){let t=O(),r=Di();u.debug(`getTokenInfo: region="${ct()}" apiHost="${t}" cdnApiHost="${r}"`);let n=new hk.WebflowClient({accessToken:e,environment:{base:`${t}/v2`,dataApi:`${t}/v2`,contentDeliveryApi:`${r}/v2`}});try{return await n.token.authorizedBy()}catch(o){return u.debug(`getTokenInfo failed: ${o}`),null}}var hk,yk=x(()=>{"use strict";hk=require("webflow-api");ke();R();Dn()});var Y=x(()=>{"use strict";nk();Nf();gk();gc();gc();Of();yk();jf()});function l0(e,t){if(e.includes("..")||dr.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let r=dr.resolve(t,e),n=dr.resolve(t);if(!r.startsWith(n+dr.sep)&&r!==n)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function Uc(e,t,r){let n=dr.join(process.cwd(),t);r&&(0,Rn.existsSync)(n)&&await(0,Bc.rm)(n,{recursive:!0,force:!0}),(0,Rn.existsSync)(n)||await(0,Bc.mkdir)(n);for(let o of e){l0(o.path,n);let i=c0(n,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));u0(n,s)}(0,Rn.writeFileSync)(i,o.content,{flag:"w+"})}}function c0(e,t){return dr.join(e,...t.split("/"))}function u0(e,t){let r=t.split("/"),n=e;for(let o of r)n=dr.join(n,o),(0,Rn.existsSync)(n)||(0,Rn.mkdirSync)(n)}var Rn,Bc,dr,om=x(()=>{"use strict";Rn=require("fs"),Bc=require("fs/promises"),dr=w(require("path"))});function Hc(e){for(let t of e??[]){let r=u[t.status]??u.info,n=m0[t.status]??xe;r(`
|
|
33
|
+
${n} ${t.content}`)}}var m0,am=x(()=>{"use strict";R();j();m0={info:xe,warn:X,success:$}});function cm(e){let{manifestPath:t}=oe();return(0,hD.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var hD,yD=x(()=>{"use strict";hD=require("fs");Qs()});function Vc(e,t,r){try{let n=um(r),o=dm(Object.values(e)),i=t?.force;return o&&n&&!i}catch{return!1}}var wD,bD,um,dm,Gc=x(()=>{"use strict";wD=require("path"),bD=require("fs-extra");um=e=>{try{return(0,bD.existsSync)((0,wD.join)(e,"tsconfig.json"))}catch{return!1}},dm=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function g0(e){let{export:t,...r}=e;return t?r["devlink-export"]!=null?(cm(r),r):(u.warn(`${X} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),r["devlink-export"]={...t},cm(r),r):r}function ED(e,t){try{new RegExp(e)}catch{throw new d(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function SD(e){e=g0(e);let t=e["devlink-export"]||{},r=!1,n=t.rootDir;n||(V()?n=kD:(r=!0,n=await Ge({message:"Enter the root directory for exported components:",default:kD,validate:p=>!p||p.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(w0()?o=!0:V()?o=!1:(r=!0,o=await $e({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=DD:(r=!0,i=await $e({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:DD}))),t.components&&ED(t.components,"components"),t.componentGroups&&ED(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=Kc,a=Jc):(r=!0,await $e({message:"Do you want to export all components?",default:!0})?(s=Kc,a=Jc):(s=await Ge({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:Kc,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Ge({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:Jc,validate:f=>{try{return new RegExp(f),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||Kc,a=a||Jc;let l=t.relativeHrefRoot;l===void 0&&(l=h0);let c={...t,rootDir:n,components:s,componentGroups:a,ts:o,cssScopes:i,relativeHrefRoot:l};return(!t.rootDir||t.ts===void 0||t.cssScopes===void 0||!t.components||!t.componentGroups||t.relativeHrefRoot===void 0)&&y0(c),{config:c,wasPrompted:r}}function y0(e){Se({"devlink-export":{...e}}),u.info(`${$} Devlink Export configuration updated in webflow.json`)}function w0(){try{let e=process.cwd();if(um(e))return!0;let t=["src","app","pages","components"];for(let r of t){let n=vD.join(e,r);if(zc.existsSync(n)&&dm(zc.readdirSync(n)))return!0}}catch{}return!1}var zc,vD,kD,Kc,Jc,DD,h0,xD=x(()=>{"use strict";zc=w(require("fs")),vD=w(require("path"));Oe();we();R();j();C();rf();yD();Gc();kD="./webflow",Kc=".*",Jc=".*",DD=!0,h0="/"});function mo(e){let t=e;for(let r=0;r<8&&t instanceof Error;r+=1){if(t.code===fm)return!0;t=t.cause}return!1}async function _D(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let r,n;try{let o=JSON.parse(t);r=o.message,n=o.code}catch{}throw new Fa(r||`Request failed (HTTP ${e.status}).`,{code:n})}async function mm(e,t,r,n){let o=await b0(r,n,t,e);if(!o.files||!Array.isArray(o.files))throw new d("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function b0(e,t,r,n){let{taskId:o,polling:i}=await k0(e,t,r,n);return D0(e,t,r,o,i)}async function k0(e,t,r,n){let o=await(0,pm.default)(`${O()}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",[FD]:t},body:JSON.stringify(n),timeout:6e4});return o.ok||await _D(o),await o.json()}async function D0(e,t,r,n,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,p=i;do{let f=await(0,pm.default)(`${O()}/v2/devlink/${e}/export/${n}`,{headers:{Authorization:`Bearer ${r}`,[FD]:t},timeout:6e4});f.ok||await _D(f);let m=await f.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new Fa("The export task failed. Please try again or report a bug.");await(0,CD.setTimeout)(p),p=Math.min(p*a,s)}while(Date.now()<c);throw new Fa(`Export task timed out after ${l}ms. Please try again.`)}var pm,CD,FD,fm,Fa,gm=x(()=>{"use strict";pm=w(require("node-fetch")),CD=require("timers/promises");R();ke();C();FD="X-WF-Sync-Id",fm="devlink_export_not_entitled",Fa=class extends Error{code;constructor(t,r){super(t),this.code=r?.code}}});var AD,RD=x(()=>{"use strict";Oe();R();AD=async(e,t)=>{if(!t)return;await $e({message:`Ready to export components to ${e.rootDir}?`,default:!0})||(u.info("Export cancelled."),process.exit(0))}});function ID(e,t,r){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:r||`${t}s`;return`${e} ${i}`}var TD=x(()=>{"use strict"});async function qc(e){let t=Date.now(),r;try{let{manifest:n}=oe(),{siteId:o,accessToken:i}=await Je(n,e),s=(0,PD.randomUUID)();Vb(s);let{config:a,wasPrompted:l}=await SD(n);u.info(`${$} Export configuration loaded!`),await AD(a,l);let c=_.forExport({authToken:i,siteId:o});r=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:p,messages:f,metadata:m}=await mm(a,i,o,s),g=m.exportCoverage==="full";await Uc(p,a.rootDir,g),r.succeed(`${ID(m.componentCount,"component")} exported to ${a.rootDir}`),Hc(f);let h=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:h,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);throw e?.silentNotEntitled&&mo(p)?r.stop():r.fail(`Components export failed: ${f}`),await c.sendError(p instanceof Error?p:new Error(String(p)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),p}}catch(n){if(!(e?.silentNotEntitled&&mo(n))){let i="Export failed: "+(n instanceof Error?n.message:n);r?r.fail(i):u.error(i,{prefix:`
|
|
34
|
+
`+D})}throw new d(n,{skipLogging:!0})}}var PD,$D=x(()=>{"use strict";PD=require("crypto");xD();gm();RD();Z();Y();Pe();TD();R();C();om();j();am()});var OD={};hp(OD,{DEVLINK_EXPORT_NOT_ENTITLED_CODE:()=>fm,exportComponents:()=>qc,isDevlinkNotEntitledError:()=>mo});var Yc=x(()=>{"use strict";$D();gm()});var fe,qm,H,Rr,ja=x(()=>{"use strict";(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(fe||(fe={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qm||(qm={}));H=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rr=e=>{switch(typeof e){case"undefined":return H.undefined;case"string":return H.string;case"number":return Number.isNaN(e)?H.nan:H.number;case"boolean":return H.boolean;case"function":return H.function;case"bigint":return H.bigint;case"symbol":return H.symbol;case"object":return Array.isArray(e)?H.array:e===null?H.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?H.promise:typeof Map<"u"&&e instanceof Map?H.map:typeof Set<"u"&&e instanceof Set?H.set:typeof Date<"u"&&e instanceof Date?H.date:H.object;default:return H.unknown}}});var I,CT,kt,ku=x(()=>{"use strict";ja();I=fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),CT=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),kt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};kt.create=e=>new kt(e)});var FT,rn,Ym=x(()=>{"use strict";ku();ja();FT=(e,t)=>{let r;switch(e.code){case I.invalid_type:e.received===H.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,fe.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:r=`Unrecognized key(s) in object: ${fe.joinValues(e.keys,", ")}`;break;case I.invalid_union:r="Invalid input";break;case I.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${fe.joinValues(e.options)}`;break;case I.invalid_enum_value:r=`Invalid enum value. Expected ${fe.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:r="Invalid function arguments";break;case I.invalid_return_type:r="Invalid function return type";break;case I.invalid_date:r="Invalid date";break;case I.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:fe.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case I.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case I.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case I.custom:r="Invalid input";break;case I.invalid_intersection_types:r="Intersection results could not be merged";break;case I.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:r="Number must be finite";break;default:r=t.defaultError,fe.assertNever(e)}return{message:r}},rn=FT});function _T(e){pv=e}function Vi(){return pv}var pv,Du=x(()=>{"use strict";Ym();pv=rn});function M(e,t){let r=Vi(),n=Ma({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===rn?void 0:rn].filter(o=>!!o)});e.common.issues.push(n)}var Ma,AT,nt,ee,wo,pt,Eu,vu,Nn,Gi,Xm=x(()=>{"use strict";Du();Ym();Ma=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},AT=[];nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return ee;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ee;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},ee=Object.freeze({status:"aborted"}),wo=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),Eu=e=>e.status==="aborted",vu=e=>e.status==="dirty",Nn=e=>e.status==="valid",Gi=e=>typeof Promise<"u"&&e instanceof Promise});var fv=x(()=>{"use strict"});var J,mv=x(()=>{"use strict";(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(J||(J={}))});function ae(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:l}=e;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:o}}function wv(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function KT(e){return new RegExp(`^${wv(e)}$`)}function bv(e){let t=`${yv}T${wv(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function JT(e,t){return!!((t==="v4"||!t)&&MT.test(e)||(t==="v6"||!t)&&UT.test(e))}function zT(e,t){if(!OT.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function qT(e,t){return!!((t==="v4"||!t)&&BT.test(e)||(t==="v6"||!t)&&WT.test(e))}function YT(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function Ki(e){if(e instanceof Dt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Yt.create(Ki(n))}return new Dt({...e._def,shape:()=>t})}else return e instanceof sn?new sn({...e._def,type:Ki(e.element)}):e instanceof Yt?Yt.create(Ki(e.unwrap())):e instanceof Tr?Tr.create(Ki(e.unwrap())):e instanceof Ir?Ir.create(e.items.map(t=>Ki(t))):e}function Qm(e,t){let r=Rr(e),n=Rr(t);if(e===t)return{valid:!0,data:e};if(r===H.object&&n===H.object){let o=fe.objectKeys(t),i=fe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=Qm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===H.array&&n===H.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],l=Qm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===H.date&&n===H.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function kv(e,t){return new Ao({values:e,typeName:ne.ZodEnum,...ae(t)})}function hv(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Dv(e,t={},r){return e?Mn.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=hv(t,n),l=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=hv(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Mn.create()}var Xt,gv,le,RT,IT,TT,PT,$T,OT,LT,NT,jT,Zm,MT,BT,UT,WT,HT,VT,yv,GT,jn,bo,ko,Do,Eo,Ji,vo,So,Mn,on,pr,zi,sn,Dt,xo,nn,Su,Co,Ir,xu,qi,Yi,Cu,Fo,_o,Ao,Ro,Bn,Zt,Yt,Tr,Io,To,Xi,XT,Ba,Ua,Po,ZT,ne,QT,Ev,vv,eP,tP,Sv,rP,nP,oP,iP,sP,aP,lP,cP,uP,dP,pP,fP,mP,gP,hP,yP,wP,bP,kP,DP,EP,vP,SP,xP,CP,FP,_P,AP,RP,IP,TP,PP,$P,OP,xv=x(()=>{"use strict";ku();Du();mv();Xm();ja();Xt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},gv=(e,t)=>{if(Nn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new kt(e.common.issues);return this._error=r,this._error}}};le=class{get description(){return this._def.description}_getType(t){return Rr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Rr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:Rr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Gi(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return gv(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rr(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Nn(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Nn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rr(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Gi(o)?o:Promise.resolve(o));return gv(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:I.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Zt({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Yt.create(this,this._def)}nullable(){return Tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return Bn.create(this,this._def)}or(t){return xo.create([this,t],this._def)}and(t){return Co.create(this,t,this._def)}transform(t){return new Zt({...ae(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Io({...ae(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new Ba({typeName:ne.ZodBranded,type:this,...ae(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new To({...ae(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ua.create(this,t)}readonly(){return Po.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},RT=/^c[^\s-]{8,}$/i,IT=/^[0-9a-z]+$/,TT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,PT=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$T=/^[a-z0-9_-]{21}$/i,OT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,LT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,NT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",MT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,UT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,WT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yv="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",GT=new RegExp(`^${yv}$`);jn=class e extends le{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==H.string){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.string,received:i.parsedType}),ee}let n=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?M(o,{code:I.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&M(o,{code:I.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")NT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"email",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Zm||(Zm=new RegExp(jT,"u")),Zm.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"emoji",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")PT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"uuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")$T.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"nanoid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")RT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")IT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cuid2",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")TT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ulid",code:I.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),M(o,{validation:"url",code:I.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"regex",code:I.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?bv(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?GT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?KT(i).test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{code:I.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?LT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"duration",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?JT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"ip",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?zT(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"jwt",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?qT(t.data,i.version)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"cidr",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?HT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64",code:I.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?VT.test(t.data)||(o=this._getOrReturnCtx(t,o),M(o,{validation:"base64url",code:I.invalid_string,message:i.message}),n.dirty()):fe.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:I.invalid_string,...J.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...J.errToObj(t)})}url(t){return this._addCheck({kind:"url",...J.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...J.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...J.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...J.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...J.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...J.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...J.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...J.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...J.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...J.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...J.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...J.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...J.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...J.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...J.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...J.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...J.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...J.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...J.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...J.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...J.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...J.errToObj(r)})}nonempty(t){return this.min(1,J.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};jn.create=e=>new jn({checks:[],typeName:ne.ZodString,coerce:e?.coerce??!1,...ae(e)});bo=class e extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==H.number){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.number,received:i.parsedType}),ee}let n,o=new nt;for(let i of this._def.checks)i.kind==="int"?fe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{code:I.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?YT(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_finite,message:i.message}),o.dirty()):fe.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:J.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:J.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&fe.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};bo.create=e=>new bo({checks:[],typeName:ne.ZodNumber,coerce:e?.coerce||!1,...ae(e)});ko=class e extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==H.bigint)return this._getInvalidInput(t);let n,o=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),M(n,{code:I.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):fe.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return M(r,{code:I.invalid_type,expected:H.bigint,received:r.parsedType}),ee}gte(t,r){return this.setLimit("min",t,!0,J.toString(r))}gt(t,r){return this.setLimit("min",t,!1,J.toString(r))}lte(t,r){return this.setLimit("max",t,!0,J.toString(r))}lt(t,r){return this.setLimit("max",t,!1,J.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:J.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};ko.create=e=>new ko({checks:[],typeName:ne.ZodBigInt,coerce:e?.coerce??!1,...ae(e)});Do=class extends le{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==H.boolean){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.boolean,received:n.parsedType}),ee}return pt(t.data)}};Do.create=e=>new Do({typeName:ne.ZodBoolean,coerce:e?.coerce||!1,...ae(e)});Eo=class e extends le{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==H.date){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_type,expected:H.date,received:i.parsedType}),ee}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return M(i,{code:I.invalid_date}),ee}let n=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),M(o,{code:I.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):fe.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:J.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:J.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Eo.create=e=>new Eo({checks:[],coerce:e?.coerce||!1,typeName:ne.ZodDate,...ae(e)});Ji=class extends le{_parse(t){if(this._getType(t)!==H.symbol){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.symbol,received:n.parsedType}),ee}return pt(t.data)}};Ji.create=e=>new Ji({typeName:ne.ZodSymbol,...ae(e)});vo=class extends le{_parse(t){if(this._getType(t)!==H.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.undefined,received:n.parsedType}),ee}return pt(t.data)}};vo.create=e=>new vo({typeName:ne.ZodUndefined,...ae(e)});So=class extends le{_parse(t){if(this._getType(t)!==H.null){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.null,received:n.parsedType}),ee}return pt(t.data)}};So.create=e=>new So({typeName:ne.ZodNull,...ae(e)});Mn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};Mn.create=e=>new Mn({typeName:ne.ZodAny,...ae(e)});on=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};on.create=e=>new on({typeName:ne.ZodUnknown,...ae(e)});pr=class extends le{_parse(t){let r=this._getOrReturnCtx(t);return M(r,{code:I.invalid_type,expected:H.never,received:r.parsedType}),ee}};pr.create=e=>new pr({typeName:ne.ZodNever,...ae(e)});zi=class extends le{_parse(t){if(this._getType(t)!==H.undefined){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.void,received:n.parsedType}),ee}return pt(t.data)}};zi.create=e=>new zi({typeName:ne.ZodVoid,...ae(e)});sn=class e extends le{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==H.array)return M(r,{code:I.invalid_type,expected:H.array,received:r.parsedType}),ee;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(M(r,{code:s?I.too_big:I.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(M(r,{code:I.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(M(r,{code:I.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Xt(r,s,r.path,a)))).then(s=>nt.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Xt(r,s,r.path,a)));return nt.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:J.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:J.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:J.toString(r)}})}nonempty(t){return this.min(1,t)}};sn.create=(e,t)=>new sn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ae(t)});Dt=class e extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=fe.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==H.object){let c=this._getOrReturnCtx(t);return M(c,{code:I.invalid_type,expected:H.object,received:c.parsedType}),ee}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof pr&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let p=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new Xt(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof pr){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(c==="strict")a.length>0&&(M(o,{code:I.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let p of a){let f=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Xt(o,f,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let f=await p.key,m=await p.value;c.push({key:f,value:m,alwaysSet:p.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(n,c)):nt.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return J.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:J.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ne.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of fe.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of fe.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ki(this)}partial(t){let r={};for(let n of fe.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of fe.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Yt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return kv(fe.objectKeys(this.shape))}};Dt.create=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strip",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});Dt.strictCreate=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strict",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});Dt.lazycreate=(e,t)=>new Dt({shape:e,unknownKeys:"strip",catchall:pr.create(),typeName:ne.ZodObject,...ae(t)});xo=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new kt(a.ctx.common.issues));return M(r,{code:I.invalid_union,unionErrors:s}),ee}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},p=l._parseSync({data:r.data,path:r.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new kt(l));return M(r,{code:I.invalid_union,unionErrors:a}),ee}}get options(){return this._def.options}};xo.create=(e,t)=>new xo({options:e,typeName:ne.ZodUnion,...ae(t)});nn=e=>e instanceof Fo?nn(e.schema):e instanceof Zt?nn(e.innerType()):e instanceof _o?[e.value]:e instanceof Ao?e.options:e instanceof Ro?fe.objectValues(e.enum):e instanceof Io?nn(e._def.innerType):e instanceof vo?[void 0]:e instanceof So?[null]:e instanceof Yt?[void 0,...nn(e.unwrap())]:e instanceof Tr?[null,...nn(e.unwrap())]:e instanceof Ba||e instanceof Po?nn(e.unwrap()):e instanceof To?nn(e._def.innerType):[],Su=class e extends le{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.object)return M(r,{code:I.invalid_type,expected:H.object,received:r.parsedType}),ee;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(M(r,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=nn(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:ne.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...ae(n)})}};Co=class extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Eu(i)||Eu(s))return ee;let a=Qm(i.value,s.value);return a.valid?((vu(i)||vu(s))&&r.dirty(),{status:r.value,value:a.data}):(M(n,{code:I.invalid_intersection_types}),ee)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Co.create=(e,t,r)=>new Co({left:e,right:t,typeName:ne.ZodIntersection,...ae(r)});Ir=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.array)return M(n,{code:I.invalid_type,expected:H.array,received:n.parsedType}),ee;if(n.data.length<this._def.items.length)return M(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&n.data.length>this._def.items.length&&(M(n,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Xt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>nt.mergeArray(r,s)):nt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ir.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ir({items:e,typeName:ne.ZodTuple,rest:null,...ae(t)})};xu=class e extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.object)return M(n,{code:I.invalid_type,expected:H.object,received:n.parsedType}),ee;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Xt(n,a,n.path,a)),value:s._parse(new Xt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?nt.mergeObjectAsync(r,o):nt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof le?new e({keyType:t,valueType:r,typeName:ne.ZodRecord,...ae(n)}):new e({keyType:jn.create(),valueType:t,typeName:ne.ZodRecord,...ae(r)})}},qi=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.map)return M(n,{code:I.invalid_type,expected:H.map,received:n.parsedType}),ee;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:o._parse(new Xt(n,a,n.path,[c,"key"])),value:i._parse(new Xt(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return ee;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return ee;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(c.value,p.value)}return{status:r.value,value:a}}}};qi.create=(e,t,r)=>new qi({valueType:t,keyType:e,typeName:ne.ZodMap,...ae(r)});Yi=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==H.set)return M(n,{code:I.invalid_type,expected:H.set,received:n.parsedType}),ee;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(M(n,{code:I.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(M(n,{code:I.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let p of l){if(p.status==="aborted")return ee;p.status==="dirty"&&r.dirty(),c.add(p.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>i._parse(new Xt(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:J.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:J.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Yi.create=(e,t)=>new Yi({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...ae(t)});Cu=class e extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.function)return M(r,{code:I.invalid_type,expected:H.function,received:r.parsedType}),ee;function n(a,l){return Ma({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),rn].filter(c=>!!c),issueData:{code:I.invalid_arguments,argumentsError:l}})}function o(a,l){return Ma({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),rn].filter(c=>!!c),issueData:{code:I.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Bn){let a=this;return pt(async function(...l){let c=new kt([]),p=await a._def.args.parseAsync(l,i).catch(g=>{throw c.addIssue(n(l,g)),c}),f=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(f,i).catch(g=>{throw c.addIssue(o(f,g)),c})})}else{let a=this;return pt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new kt([n(l,c.error)]);let p=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(p,i);if(!f.success)throw new kt([o(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ir.create(t).rest(on.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ir.create([]).rest(on.create()),returns:r||on.create(),typeName:ne.ZodFunction,...ae(n)})}},Fo=class extends le{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Fo.create=(e,t)=>new Fo({getter:e,typeName:ne.ZodLazy,...ae(t)});_o=class extends le{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return M(r,{received:r.data,code:I.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:t.data}}get value(){return this._def.value}};_o.create=(e,t)=>new _o({value:e,typeName:ne.ZodLiteral,...ae(t)});Ao=class e extends le{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return M(r,{expected:fe.joinValues(n),received:r.parsedType,code:I.invalid_type}),ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return M(r,{received:r.data,code:I.invalid_enum_value,options:n}),ee}return pt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Ao.create=kv;Ro=class extends le{_parse(t){let r=fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==H.string&&n.parsedType!==H.number){let o=fe.objectValues(r);return M(n,{expected:fe.joinValues(o),received:n.parsedType,code:I.invalid_type}),ee}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=fe.objectValues(r);return M(n,{received:n.data,code:I.invalid_enum_value,options:o}),ee}return pt(t.data)}get enum(){return this._def.values}};Ro.create=(e,t)=>new Ro({values:e,typeName:ne.ZodNativeEnum,...ae(t)});Bn=class extends le{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==H.promise&&r.common.async===!1)return M(r,{code:I.invalid_type,expected:H.promise,received:r.parsedType}),ee;let n=r.parsedType===H.promise?r.data:Promise.resolve(r.data);return pt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Bn.create=(e,t)=>new Bn({type:e,typeName:ne.ZodPromise,...ae(t)});Zt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{M(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ee;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?ee:l.status==="dirty"?wo(l.value):r.value==="dirty"?wo(l.value):l});{if(r.value==="aborted")return ee;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ee:a.status==="dirty"?wo(a.value):r.value==="dirty"?wo(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ee:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ee:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Nn(s))return ee;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Nn(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):ee);fe.assertNever(o)}};Zt.create=(e,t,r)=>new Zt({schema:e,typeName:ne.ZodEffects,effect:t,...ae(r)});Zt.createWithPreprocess=(e,t,r)=>new Zt({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...ae(r)});Yt=class extends le{_parse(t){return this._getType(t)===H.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Yt.create=(e,t)=>new Yt({innerType:e,typeName:ne.ZodOptional,...ae(t)});Tr=class extends le{_parse(t){return this._getType(t)===H.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tr.create=(e,t)=>new Tr({innerType:e,typeName:ne.ZodNullable,...ae(t)});Io=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Io.create=(e,t)=>new Io({innerType:e,typeName:ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ae(t)});To=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Gi(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new kt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};To.create=(e,t)=>new To({innerType:e,typeName:ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ae(t)});Xi=class extends le{_parse(t){if(this._getType(t)!==H.nan){let n=this._getOrReturnCtx(t);return M(n,{code:I.invalid_type,expected:H.nan,received:n.parsedType}),ee}return{status:"valid",value:t.data}}};Xi.create=e=>new Xi({typeName:ne.ZodNaN,...ae(e)});XT=Symbol("zod_brand"),Ba=class extends le{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ua=class e extends le{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ee:i.status==="dirty"?(r.dirty(),wo(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ee:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ne.ZodPipeline})}},Po=class extends le{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Nn(o)&&(o.value=Object.freeze(o.value)),o);return Gi(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Po.create=(e,t)=>new Po({innerType:e,typeName:ne.ZodReadonly,...ae(t)});ZT={object:Dt.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ne||(ne={}));QT=(e,t={message:`Input not instance of ${e.name}`})=>Dv(r=>r instanceof e,t),Ev=jn.create,vv=bo.create,eP=Xi.create,tP=ko.create,Sv=Do.create,rP=Eo.create,nP=Ji.create,oP=vo.create,iP=So.create,sP=Mn.create,aP=on.create,lP=pr.create,cP=zi.create,uP=sn.create,dP=Dt.create,pP=Dt.strictCreate,fP=xo.create,mP=Su.create,gP=Co.create,hP=Ir.create,yP=xu.create,wP=qi.create,bP=Yi.create,kP=Cu.create,DP=Fo.create,EP=_o.create,vP=Ao.create,SP=Ro.create,xP=Bn.create,CP=Zt.create,FP=Yt.create,_P=Tr.create,AP=Zt.createWithPreprocess,RP=Ua.create,IP=()=>Ev().optional(),TP=()=>vv().optional(),PP=()=>Sv().optional(),$P={string:(e=>jn.create({...e,coerce:!0})),number:(e=>bo.create({...e,coerce:!0})),boolean:(e=>Do.create({...e,coerce:!0})),bigint:(e=>ko.create({...e,coerce:!0})),date:(e=>Eo.create({...e,coerce:!0}))},OP=ee});var B={};hp(B,{BRAND:()=>XT,DIRTY:()=>wo,EMPTY_PATH:()=>AT,INVALID:()=>ee,NEVER:()=>OP,OK:()=>pt,ParseStatus:()=>nt,Schema:()=>le,ZodAny:()=>Mn,ZodArray:()=>sn,ZodBigInt:()=>ko,ZodBoolean:()=>Do,ZodBranded:()=>Ba,ZodCatch:()=>To,ZodDate:()=>Eo,ZodDefault:()=>Io,ZodDiscriminatedUnion:()=>Su,ZodEffects:()=>Zt,ZodEnum:()=>Ao,ZodError:()=>kt,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>Cu,ZodIntersection:()=>Co,ZodIssueCode:()=>I,ZodLazy:()=>Fo,ZodLiteral:()=>_o,ZodMap:()=>qi,ZodNaN:()=>Xi,ZodNativeEnum:()=>Ro,ZodNever:()=>pr,ZodNull:()=>So,ZodNullable:()=>Tr,ZodNumber:()=>bo,ZodObject:()=>Dt,ZodOptional:()=>Yt,ZodParsedType:()=>H,ZodPipeline:()=>Ua,ZodPromise:()=>Bn,ZodReadonly:()=>Po,ZodRecord:()=>xu,ZodSchema:()=>le,ZodSet:()=>Yi,ZodString:()=>jn,ZodSymbol:()=>Ji,ZodTransformer:()=>Zt,ZodTuple:()=>Ir,ZodType:()=>le,ZodUndefined:()=>vo,ZodUnion:()=>xo,ZodUnknown:()=>on,ZodVoid:()=>zi,addIssueToContext:()=>M,any:()=>sP,array:()=>uP,bigint:()=>tP,boolean:()=>Sv,coerce:()=>$P,custom:()=>Dv,date:()=>rP,datetimeRegex:()=>bv,defaultErrorMap:()=>rn,discriminatedUnion:()=>mP,effect:()=>CP,enum:()=>vP,function:()=>kP,getErrorMap:()=>Vi,getParsedType:()=>Rr,instanceof:()=>QT,intersection:()=>gP,isAborted:()=>Eu,isAsync:()=>Gi,isDirty:()=>vu,isValid:()=>Nn,late:()=>ZT,lazy:()=>DP,literal:()=>EP,makeIssue:()=>Ma,map:()=>wP,nan:()=>eP,nativeEnum:()=>SP,never:()=>lP,null:()=>iP,nullable:()=>_P,number:()=>vv,object:()=>dP,objectUtil:()=>qm,oboolean:()=>PP,onumber:()=>TP,optional:()=>FP,ostring:()=>IP,pipeline:()=>RP,preprocess:()=>AP,promise:()=>xP,quotelessJson:()=>CT,record:()=>yP,set:()=>bP,setErrorMap:()=>_T,strictObject:()=>pP,string:()=>Ev,symbol:()=>nP,transformer:()=>CP,tuple:()=>hP,undefined:()=>oP,union:()=>fP,unknown:()=>aP,util:()=>fe,void:()=>cP});var eg=x(()=>{"use strict";Du();Xm();fv();ja();xv();ku()});var Zi=x(()=>{"use strict";eg();eg()});function Fu(e,t=!1){let r=e.length,n=0,o="",i=0,s=16,a=0,l=0,c=0,p=0,f=0;function m(E,S){let L=0,U=0;for(;L<E||!S;){let N=e.charCodeAt(n);if(N>=48&&N<=57)U=U*16+N-48;else if(N>=65&&N<=70)U=U*16+N-65+10;else if(N>=97&&N<=102)U=U*16+N-97+10;else break;n++,L++}return L<E&&(U=-1),U}function g(E){n=E,o="",i=0,s=16,f=0}function h(){let E=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Qi(e.charCodeAt(n)))for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;else return f=3,e.substring(E,n);let S=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&Qi(e.charCodeAt(n))){for(n++;n<e.length&&Qi(e.charCodeAt(n));)n++;S=n}else f=3;return e.substring(E,S)}function y(){let E="",S=n;for(;;){if(n>=r){E+=e.substring(S,n),f=2;break}let L=e.charCodeAt(n);if(L===34){E+=e.substring(S,n),n++;break}if(L===92){if(E+=e.substring(S,n),n++,n>=r){f=2;break}switch(e.charCodeAt(n++)){case 34:E+='"';break;case 92:E+="\\";break;case 47:E+="/";break;case 98:E+="\b";break;case 102:E+="\f";break;case 110:E+=`
|
|
35
|
+
`;break;case 114:E+="\r";break;case 116:E+=" ";break;case 117:let N=m(4,!0);N>=0?E+=String.fromCharCode(N):f=4;break;default:f=5}S=n;continue}if(L>=0&&L<=31)if(Wa(L)){E+=e.substring(S,n),f=2;break}else f=6;n++}return E}function k(){if(o="",f=0,i=n,l=a,p=c,n>=r)return i=r,s=17;let E=e.charCodeAt(n);if(tg(E)){do n++,o+=String.fromCharCode(E),E=e.charCodeAt(n);while(tg(E));return s=15}if(Wa(E))return n++,o+=String.fromCharCode(E),E===13&&e.charCodeAt(n)===10&&(n++,o+=`
|
|
36
|
+
`),a++,c=n,s=14;switch(E){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,o=y(),s=10;case 47:let S=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!Wa(e.charCodeAt(n));)n++;return o=e.substring(S,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;let L=r-1,U=!1;for(;n<L;){let N=e.charCodeAt(n);if(N===42&&e.charCodeAt(n+1)===47){n+=2,U=!0;break}n++,Wa(N)&&(N===13&&e.charCodeAt(n)===10&&n++,a++,c=n)}return U||(n++,f=1),o=e.substring(S,n),s=13}return o+=String.fromCharCode(E),n++,s=16;case 45:if(o+=String.fromCharCode(E),n++,n===r||!Qi(e.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=h(),s=11;default:for(;n<r&&v(E);)n++,E=e.charCodeAt(n);if(i!==n){switch(o=e.substring(i,n),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(E),n++,s=16}}function v(E){if(tg(E)||Wa(E))return!1;switch(E){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function F(){let E;do E=k();while(E>=12&&E<=15);return E}return{setPosition:g,getPosition:()=>n,scan:t?F:k,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>n-i,getTokenStartLine:()=>l,getTokenStartCharacter:()=>i-p,getTokenError:()=>f}}function tg(e){return e===32||e===9}function Wa(e){return e===10||e===13}function Qi(e){return e>=48&&e<=57}var Cv,_u=x(()=>{"use strict";(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Cv||(Cv={}))});var NP,es,jP,Fv=x(()=>{"use strict";NP=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),es=200,jP={" ":{"\n":new Array(es).fill(0).map((e,t)=>`
|
|
37
|
+
`+" ".repeat(t)),"\r":new Array(es).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(es).fill(0).map((e,t)=>`\r
|
|
38
|
+
`+" ".repeat(t))}," ":{"\n":new Array(es).fill(0).map((e,t)=>`
|
|
39
|
+
`+" ".repeat(t)),"\r":new Array(es).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(es).fill(0).map((e,t)=>`\r
|
|
40
|
+
`+" ".repeat(t))}}});var rg=x(()=>{"use strict";_u();Fv()});function _v(e,t=[],r=Au.DEFAULT){let n=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):n!==null&&(o[n]=l)}return Av(e,{onObjectBegin:()=>{let l={};s(l),i.push(o),o=l,n=null},onObjectProperty:l=>{n=l},onObjectEnd:()=>{o=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(o),o=l,n=null},onArrayEnd:()=>{o=i.pop()},onLiteralValue:s,onError:(l,c,p)=>{t.push({error:l,offset:c,length:p})}},r),o[0]}function Av(e,t,r=Au.DEFAULT){let n=Fu(e,!1),o=[],i=0;function s(W){return W?()=>i===0&&W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(W){return W?he=>i===0&&W(he,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(W){return W?he=>i===0&&W(he,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function c(W){return W?()=>{i>0?i++:W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function p(W){return W?()=>{i>0&&i--,i===0&&W(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let f=c(t.onObjectBegin),m=l(t.onObjectProperty),g=p(t.onObjectEnd),h=c(t.onArrayBegin),y=p(t.onArrayEnd),k=l(t.onLiteralValue),v=a(t.onSeparator),F=s(t.onComment),E=a(t.onError),S=r&&r.disallowComments,L=r&&r.allowTrailingComma;function U(){for(;;){let W=n.scan();switch(n.getTokenError()){case 4:N(14);break;case 5:N(15);break;case 3:N(13);break;case 1:S||N(11);break;case 2:N(12);break;case 6:N(16);break}switch(W){case 12:case 13:S?N(10):F();break;case 16:N(1);break;case 15:case 14:break;default:return W}}}function N(W,he=[],Vr=[]){if(E(W),he.length+Vr.length>0){let Gr=n.getToken();for(;Gr!==17;){if(he.indexOf(Gr)!==-1){U();break}else if(Vr.indexOf(Gr)!==-1)break;Gr=U()}}}function te(W){let he=n.getTokenValue();return W?k(he):(m(he),o.push(he)),U(),!0}function G(){switch(n.getToken()){case 11:let W=n.getTokenValue(),he=Number(W);isNaN(he)&&(N(2),he=0),k(he);break;case 7:k(null);break;case 8:k(!0);break;case 9:k(!1);break;default:return!1}return U(),!0}function ce(){return n.getToken()!==10?(N(3,[],[2,5]),!1):(te(!1),n.getToken()===6?(v(":"),U(),q()||N(4,[],[2,5])):N(5,[],[2,5]),o.pop(),!0)}function Be(){f(),U();let W=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(W||N(4,[],[]),v(","),U(),n.getToken()===2&&L)break}else W&&N(6,[],[]);ce()||N(4,[],[2,5]),W=!0}return g(),n.getToken()!==2?N(7,[2],[]):U(),!0}function A(){h(),U();let W=!0,he=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(he||N(4,[],[]),v(","),U(),n.getToken()===4&&L)break}else he&&N(6,[],[]);W?(o.push(0),W=!1):o[o.length-1]++,q()||N(4,[],[4,5]),he=!0}return y(),W||o.pop(),n.getToken()!==4?N(8,[4],[]):U(),!0}function q(){switch(n.getToken()){case 3:return A();case 1:return Be();case 10:return te(!0);default:return G()}}return U(),n.getToken()===17?r.allowEmptyContent?!0:(N(4,[],[]),!1):q()?(n.getToken()!==17&&N(9,[],[]),!0):(N(4,[],[]),!1)}var Au,ng=x(()=>{"use strict";_u();(function(e){e.DEFAULT={allowTrailingComma:!1}})(Au||(Au={}))});var Rv=x(()=>{"use strict";rg();ng()});var Iv,Tv,$o,Pv,Ru=x(()=>{"use strict";rg();Rv();_u();ng();(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Iv||(Iv={}));(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Tv||(Tv={}));$o=_v;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Pv||(Pv={}))});var ts,Ae,Oo,an,Tt=x(()=>{"use strict";ts=class extends Error{remediation;documentationUrl;cause;constructor(t,r){super(t),this.name="FrameworkError",this.cause=r?.cause,this.remediation=r?.remediation,this.documentationUrl=r?.documentationUrl,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toDisplayString(){let t=this.message;return this.remediation&&(t+=`
|
|
41
|
+
|
|
42
|
+
How to fix: ${this.remediation}`),this.documentationUrl&&(t+=`
|
|
43
|
+
|
|
44
|
+
Documentation: ${this.documentationUrl}`),t}},Ae=class extends ts{constructor(t,r){super(t,r),this.name="FrameworkValidationError"}},Oo=class extends ts{configFile;constructor(t,r){super(t,r),this.name="FrameworkConfigError",this.configFile=r?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
|
|
45
|
+
|
|
46
|
+
Config file: ${this.configFile}`),t}},an=class extends ts{constructor(t,r){super(t,r),this.name="FrameworkDetectionError"}}});var $v,ft,ln=x(()=>{"use strict";$v=w(require("semver")),ft=class{static frameworkName="";ctx;constructor(t){this.ctx=t}static detect(t,r){return{detected:!1}}static detectFromBuiltOutput(t){return!1}static getOutputDeployMetadata(){throw new Error("getOutputDeployMetadata must be implemented by the framework subclass")}getOutputDeployMetadata(){return this.constructor.getOutputDeployMetadata()}getFrameworkVersion(){}async postBuild(){}getAdditionalConfigFiles(){return[]}getUserConfigPatterns(){return[]}hasDependency(t){let{packageJson:r}=this.ctx;return t in(r.dependencies||{})||t in(r.devDependencies||{})}getDependencyVersion(t){let{packageJson:r}=this.ctx;return r.dependencies?.[t]||r.devDependencies?.[t]}resolveFrameworkVersion(t){let r=this.getDependencyVersion(t);if(r)return $v.default.coerce(r)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}}});function GP(){return process.version.slice(1)}function KP(e){let t=Lo.coerce(e);return t?t.major:null}function JP(e,t){let r=Lo.coerce(e),n=Lo.coerce(t);return!r||!n?!1:Lo.gte(r,n)}function Un(e,t,r){let n=GP(),o=t.minimum;if(JP(n,o))e.debug(`Node.js version ${n} meets requirement ${o}`);else{let i=KP(o),s=`${r} requires Node.js ${o} or higher. Current version: ${n}`;if(t.severity==="error")throw new Ae(s,{remediation:`Please upgrade Node.js to ${o} or higher. You can use nvm, fnm, or similar tools to manage Node.js versions.
|
|
47
|
+
|
|
48
|
+
nvm install ${i}
|
|
49
|
+
nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var Lo,Ov=x(()=>{"use strict";Lo=w(require("semver"));Tt()});function Ha(e){let t=Lv.default.join(e,"package.json");if(!Iu.statSync(t,{throwIfNoEntry:!1}))return;let r=Iu.readFileSync(t).toString("utf8"),n;try{n=JSON.parse(r)}catch(o){throw new Ae("package.json was not valid JSON",{cause:o})}try{return Nv.parse(n)}catch(o){throw new Ae("package.json schema validation failed",{cause:o})}}var Iu,Lv,Nv,ig=x(()=>{"use strict";Iu=w(require("fs")),Lv=w(require("path"));Zi();Tt();Nv=B.object({name:B.string().optional(),version:B.string().optional(),dependencies:B.record(B.string()).optional(),devDependencies:B.record(B.string()).optional()})});function rs(e,t,r="webflow.json"){let n=jv.default.join(t,r);if(!Tu.statSync(n,{throwIfNoEntry:!1}))return r.endsWith(".json")?rs(e,t,r+"c"):void 0;let o=Tu.readFileSync(n).toString("utf8"),i;try{i=$o(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${n} ${JSON.stringify(o)}: ${s}`);return}try{let s=Pu.parse(i);return e.debug(`loaded ${n}: ${JSON.stringify(s)}`),s}catch(s){e?.error(`${n} was valid JSON but schema validation failed: ${s}`);return}}var Tu,jv,Pu,sg=x(()=>{"use strict";Tu=w(require("fs")),jv=w(require("path"));Zi();Ru();Pu=B.object({cloud:B.object({contract_version:B.string().optional(),framework:B.string().optional(),framework_version:B.string().optional(),entrypoint_path:B.string().optional(),deployment_type:B.enum(["spa","ssg","ssr","ssr-spa-combo","static"]).optional(),skip_no_bundle:B.boolean().optional(),assets_path_prefix:B.string().optional(),assets_source_skip_mount_path:B.boolean().optional()}).passthrough().optional()}).passthrough()});function ag(e,t,r,n,o){if(!r||n!=="astro"&&n!=="nextjs")return t;let i=Mv.join(e,t);if(!ns.existsSync(i)||!ns.statSync(i).isDirectory())return t;let a=ns.readdirSync(i,{withFileTypes:!0}).find(l=>!(!l.isDirectory()||o&&l.name===o||n==="astro"&&(l.name==="_routes.json"||l.name==="_worker.js")));return a?`${t}/${a.name}`:t}var ns,Mv,Bv=x(()=>{"use strict";ns=w(require("fs")),Mv=w(require("path"))});async function Ze(e){let{log:t,cwd:r,args:n}=e,o={...process.env,...e.env||{},WRANGLER_SEND_METRICS:"false",NEXT_TELEMETRY_DISABLED:"1"},i=[...Wv,...n];t.debug(`npm ${i.join(" ")} (in ${r})`),(0,Uv.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:r,env:o,stdio:"inherit"})}var Uv,Wv,Hv=x(()=>{"use strict";Uv=require("child_process"),Wv=["--no-update-notifier","--no-progress","--no-audit","--no-fund"]});function fr(e){if(!e)return null;let t=Vv.coerce(e);return t?t.major:null}function Wn(e,t,r,n){let o=n?.exclude?Array.isArray(n.exclude)?n.exclude:[n.exclude]:[],i=Pr.basename(t);if(o.some(c=>i===c))return e.trace(`Skipping excluded: ${t}`),0;if(n?.excludeFn?.(i))return e.trace(`Skipping excluded (predicate): ${t}`),0;let s=n?.followSymlinks!==!1,a=s?Le.statSync(t,{throwIfNoEntry:!1}):Le.lstatSync(t,{throwIfNoEntry:!1});if(!a)return e.trace(`Source does not exist: ${t}`),0;if(!s&&a.isSymbolicLink())return e.trace(`Skipping symlink: ${t}`),0;if(a.isDirectory()){e.trace(`Copying directory: ${t} -> ${r}`);let c=Le.readdirSync(t),p=0;for(let f of c)p+=Wn(e,Pr.join(t,f),Pr.join(r,f),n);return p}let l=Pr.dirname(r);return Le.existsSync(l)||Le.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${r}`),Le.copyFileSync(t,r),1}function Et(e){return Le.existsSync(e)}function wt(...e){for(let t of e)if(Le.existsSync(t))return t;return e[0]??""}async function $r(e,t,r,n){if(!Le.existsSync(t))throw new Oo(`Template not found: ${t}`,{configFile:t});let o=Le.readFileSync(t,"utf8");e.debug(`envsubst: ${t} -> ${r}`);let i=n||process.env,s=o.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(l,c)=>i[c]??"").replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(l,c)=>i[c]??""),a=Pr.dirname(r);Le.existsSync(a)||Le.mkdirSync(a,{recursive:!0}),Le.writeFileSync(r,s)}function Or(e,t,r,n){for(let o of n){let i=Pr.join(t,`${r}.${o}`);if(Le.existsSync(i)){let s=Pr.join(t,`clouduser.${r}.${o}`);return e.info(`Renaming user config: ${r}.${o} -> clouduser.${r}.${o}`),Le.renameSync(i,s),s}}return null}var Vv,Le,Pr,Lr=x(()=>{"use strict";Vv=w(require("semver")),Le=w(require("fs")),Pr=w(require("path"));Tt();Ov();ig();sg();Bv();Hv()});var vt,Va,lg,Gv,No,Kv=x(()=>{"use strict";vt=w(require("path")),Va=w(require("fs"));ln();Tt();Lr();lg=wt(vt.join(__dirname,"templates","astro","v5"),vt.join(__dirname,"templates","v5")),Gv=wt(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),No=class extends ft{static frameworkName="astro";get info(){return{name:"astro",version:"5.x",displayName:"Astro 5"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return n==="astro"?{detected:!0,reason:"Specified as astro in webflow.json"}:{detected:!1};let i=fr(o);return i!==null&&i>=6?{detected:!1}:{detected:!0,reason:`Found astro@${o}`}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^5.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^5.0.0"});let i=fr(o);if(i!==null&&i>=6)throw new Ae(`Astro ${i}.x detected but was routed to the Astro 5 builder. This is an internal error.`,{remediation:"Ensure your package.json has astro@^6.0.0 - the Astro 6 builder will be used automatically. If this persists, please report the issue."});t.info(`Validated Astro project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^12.0.0"}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^4.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn(`Installing ${n.name}@${n.version} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:r,args:["install","--save",`${n.name}@${n.version}`]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:vt.join(lg,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return vt.join(lg,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(Gv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Va.writeFileSync(vt.join(r,"clouduser.astro.config.mjs"),`export default {};
|
|
50
|
+
`));let i=vt.join(Gv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Va.copyFileSync(i,vt.join(r,"astro.config.webflow.ts")));let s=vt.join(lg,"astro.config.mjs.template"),a=vt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Va.copyFileSync(l.templatePath,vt.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist",staticAssetsExclude:["_worker.js"],workerEntryPath:"dist/_worker.js/index.js",deploymentType:"ssr",dryRunEntryPath:"./index.js"}}}});async function $u(e){let{log:t,cwd:r,adapterName:n,installVersion:o,fixedFloor:i,declaredVersion:s}=e;if(!s){t.warn(`Installing ${n}@${o} (required for Cloudflare deployment)...`),await Ze({log:t,cwd:r,args:["install","--save",`${n}@${o}`]});return}let a=Ga.coerce(s);if(!a||!Ga.lt(a,i))return;let l=Ga.coerce(i)?.major;a.major===l?(t.warn(`Detected ${n}@${s}, which has a known base-path bug (withastro/astro#16276) that breaks static assets on mounted apps. Upgrading to ${o}.`),await Ze({log:t,cwd:r,args:["install","--save",`${n}@${o}`]})):t.warn(`${n}@${s} predates the base-path fix in ${i} and upgrading crosses a major version. Please upgrade to ${n}@${o} manually to avoid broken asset serving on mounted apps.`)}var Ga,cg=x(()=>{"use strict";Ga=w(require("semver"));Lr()});var St,Ka,ug,Jv,jo,zv=x(()=>{"use strict";St=w(require("path")),Ka=w(require("fs"));ln();Tt();Lr();cg();ug=wt(St.join(__dirname,"templates","astro","v6"),St.join(__dirname,"templates","v6")),Jv=wt(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),jo=class extends ft{static frameworkName="astro";get info(){return{name:"astro",version:"6.x",displayName:"Astro 6"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=fr(o);return i!==null&&i>=7?{detected:!1}:i!==null&&i>=6?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^6.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^6.0.0"});let i=fr(o);if(i!==null&&i<6)throw new Ae(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro5Builder for Astro 5.x, or upgrade: npm install astro@^6.0.0"});if(i!==null&&i>=7)throw new Ae(`Astro ${i}.x detected but Astro6Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro7Builder for Astro 7.x, or downgrade: npm install astro@^6.0.0"});t.info(`Validated Astro 6 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"^13.3.1",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^5.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(await $u({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"13.3.1",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ze({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:St.join(ug,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return St.join(ug,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(Jv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Ka.writeFileSync(St.join(r,"clouduser.astro.config.mjs"),`export default {};
|
|
51
|
+
`));let i=St.join(Jv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ka.copyFileSync(i,St.join(r,"astro.config.webflow.ts")));let s=St.join(ug,"astro.config.mjs.template"),a=St.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ka.copyFileSync(l.templatePath,St.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}}});var xt,Ja,dg,qv,os,Yv=x(()=>{"use strict";xt=w(require("path")),Ja=w(require("fs"));ln();Tt();Lr();cg();dg=wt(xt.join(__dirname,"templates","astro","v7"),xt.join(__dirname,"templates","v7")),qv=wt(xt.join(__dirname,"templates","astro"),xt.join(__dirname,"templates")),os=class extends ft{static frameworkName="astro";get info(){return{name:"astro",version:"7.x",displayName:"Astro 7"}}static detect(t,r){let n=r?.cloud?.framework;if(n&&n!=="astro")return{detected:!1};let o=t.dependencies?.astro||t.devDependencies?.astro;if(!o)return{detected:!1};let i=fr(o);return i!==null&&i>=7?{detected:!0,reason:`Found astro@${o} (Astro ${i}.x)`}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=this.getNodeVersionRequirement();n&&Un(t,n,this.info.displayName);let o=r.dependencies?.astro||r.devDependencies?.astro;if(!o)throw new Ae("Astro is not installed in this project.",{remediation:"Install Astro by running: npm install astro@^7.0.0",documentationUrl:"https://docs.astro.build/en/install/"});if(o==="latest")throw new Ae('Astro version "latest" is not supported by Webflow Cloud.',{remediation:"Please specify a version, e.g.: npm install astro@^7.0.0"});let i=fr(o);if(i!==null&&i<7)throw new Ae(`Astro ${i}.x detected but Astro7Builder was selected. This is likely a configuration error.`,{remediation:"Use Astro6Builder for Astro 6.x, or upgrade: npm install astro@^7.0.0"});t.info(`Validated Astro 7 project: astro@${o}`)}getCloudflareAdapter(){return{name:"@astrojs/cloudflare",version:"14.1.7",peerDependencies:["@cloudflare/vite-plugin"]}}getRequiredIntegrations(){return[{name:"@astrojs/react",version:"^6.0.0",reason:"Required for Webflow React components"}]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();if(await $u({log:t,cwd:r,adapterName:n.name,installVersion:n.version,fixedFloor:"14.0.0",declaredVersion:this.getDependencyVersion(n.name)}),n.peerDependencies)for(let o of n.peerDependencies)this.hasDependency(o)||(t.warn(`Installing ${o} (peer dependency of ${n.name})...`),await Ze({log:t,cwd:r,args:["install","--save",o]}));for(let o of this.getRequiredIntegrations())this.hasDependency(o.name)||(t.warn(`Installing ${o.name}@${o.version} (${o.reason})...`),await Ze({log:t,cwd:r,args:["install","--save",`${o.name}@${o.version}`]}))}getWebflowLoader(){return{templatePath:xt.join(dg,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return xt.join(dg,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,xt.join(qv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx;Or(t,r,"astro.config",["mjs","cjs","js","ts"])===null&&(t.info("no user astro.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.astro.config.mjs stub"),Ja.writeFileSync(xt.join(r,"clouduser.astro.config.mjs"),`export default {};
|
|
52
|
+
`));let i=xt.join(qv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ja.copyFileSync(i,xt.join(r,"astro.config.webflow.ts")));let s=xt.join(dg,"astro.config.mjs.template"),a=xt.join(r,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ja.copyFileSync(l.templatePath,xt.join(r,l.destinationName)))}getBuildCommand(){return"astro build"}getNodeVersionRequirement(){return{minimum:"22.12.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("astro")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"dist/server/entry.mjs",wranglerMainOverride:"@astrojs/cloudflare/entrypoints/server",deploymentType:"ssr",usesAssetsBinding:!0,skipNoBundle:!0,assetsSourceSkipMountPath:!0,dryRunEntryPath:"./entry.mjs"}}}});var Ou=x(()=>{"use strict";Kv();zv();Yv()});var He,Qt,is,ss,Lu=x(()=>{"use strict";He=w(require("path")),Qt=w(require("fs"));ln();Tt();Lr();is=wt(He.join(__dirname,"templates","nextjs"),He.join(__dirname,"templates")),ss=class extends ft{static frameworkName="nextjs";get info(){return{name:"nextjs",version:"*",displayName:"Next.js"}}static detect(t,r){let n=r?.cloud?.framework;return n==="nextjs"?{detected:!0,reason:"Specified as nextjs in webflow.json"}:n&&n!=="nextjs"?{detected:!1}:t.dependencies?.next!==void 0||t.devDependencies?.next!==void 0?{detected:!0,reason:'Found "next" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.next||r.devDependencies?.next;if(!n)throw new Ae("Next.js is not installed in this project.",{remediation:"Install Next.js by running: npm install next",documentationUrl:"https://nextjs.org/docs/getting-started/installation"});t.info(`Validated Next.js project: next@${n}`)}getCloudflareAdapter(){return{name:"@opennextjs/cloudflare",version:"*"}}getRequiredIntegrations(){return[]}async installDependencies(){let{log:t,cwd:r}=this.ctx,n=this.getCloudflareAdapter();this.hasDependency(n.name)||(t.warn("nextjs integration requires @opennextjs/cloudflare and this project doesn't have it. installing now..."),await Ze({log:t,cwd:r,args:["install","--save",n.name]}))}getWebflowLoader(){return{templatePath:He.join(is,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["next.config.mjs","next.config.cjs","next.config.js","next.config.ts"]}getWranglerTemplatePath(){return He.join(is,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,He.join(is,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(Qt.existsSync(He.join(this.cwd,t)))return t}ensureOpenNextConfig(t){let{log:r,cwd:n}=this.ctx,o=this.findOpenNextConfig();if(o){r.info(`${o} found, skipping creation (opennextjs-cloudflare will validate)`);return}if(r.info("open-next.config not found, creating open-next.config.ts with default Webflow Cloud configuration..."),!Qt.existsSync(t))throw new Oo(`open-next.config.ts template not found at ${t}. This is a Webflow Cloud build system error.`,{configFile:t});let i=He.join(n,"open-next.config.ts");Qt.copyFileSync(t,i),r.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=Or(t,r,"next.config",["mjs","cjs","js","ts"]);o===null?(t.info("no user next.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.next.config.ts stub"),Qt.writeFileSync(He.join(r,"clouduser.next.config.ts"),`export default {};
|
|
53
|
+
`)):He.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${He.basename(o)}`),Qt.writeFileSync(He.join(r,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
|
|
54
|
+
declare const config: UserNextConfig;
|
|
55
|
+
export default config;
|
|
56
|
+
`));let i=He.join(is,"next.config.webflow.ts");Et(i)&&(t.info("Copying next.config.webflow.ts..."),Qt.copyFileSync(i,He.join(r,"next.config.webflow.ts")));let s=He.join(is,"next.config.ts.template"),a=He.join(r,"next.config.ts");t.info("Generating next.config.ts from template..."),await $r(t,s,a,{...process.env,...n});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Qt.copyFileSync(l.templatePath,He.join(r,l.destinationName)));let c=He.join(is,"open-next.config.ts");this.ensureOpenNextConfig(c)}getBuildCommand(){return"opennextjs-cloudflare build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("next")}static getOutputDeployMetadata(){return{staticAssetsPath:".open-next/assets",workerEntryPath:".open-next/worker.js",deploymentType:"ssr",dryRunEntryPath:"./worker.js"}}static detectFromBuiltOutput(t){return Qt.statSync(He.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}}});var Pt,er,Nu,as,ju=x(()=>{"use strict";Pt=w(require("path")),er=w(require("fs"));Ru();ln();Tt();Lr();Nu=wt(Pt.join(__dirname,"templates","vite"),Pt.join(__dirname,"templates")),as=class extends ft{static frameworkName="vite";get info(){return{name:"vite",version:"6.x",displayName:"Vite"}}static detect(t,r){let n=r?.cloud?.framework;return n==="vite"?{detected:!0,reason:"Specified as vite in webflow.json"}:n&&n!=="vite"?{detected:!1}:t.dependencies?.vite!==void 0||t.devDependencies?.vite!==void 0?{detected:!0,reason:'Found "vite" in package.json'}:{detected:!1}}async validate(){let{log:t,packageJson:r}=this.ctx,n=r.dependencies?.vite||r.devDependencies?.vite;if(!n)throw new Ae("Vite is not installed in this project.",{remediation:"Install Vite by running: npm install vite",documentationUrl:"https://vitejs.dev/guide/"});t.info(`Validated Vite project: vite@${n}`)}getCloudflareAdapter(){return{name:"@cloudflare/vite-plugin",version:"*"}}getRequiredIntegrations(){return[{name:"@cloudflare/workers-types",version:"*",dev:!0}]}async installDependencies(){let{log:t,cwd:r,packageJson:n}=this.ctx,o=n.devDependencies?.vite||n.dependencies?.vite||"",i=fr(o);i!==null&&i<6&&(t.warn("Upgrading vite to ^6.1.0 (required by @cloudflare/vite-plugin)..."),await Ze({log:t,cwd:r,args:["install","--save-dev","vite@^6.1.0"]}));let s=this.getCloudflareAdapter();this.hasDependency(s.name)||(t.warn("Vite integration requires @cloudflare/vite-plugin, installing now..."),await Ze({log:t,cwd:r,args:["install","--save",s.name]}));let a=this.getRequiredIntegrations();for(let l of a)if(!this.hasDependency(l.name)){t.info(`Installing ${l.name}...`);let c=l.dev?["install","--save-dev",l.name]:["install","--save",l.name];await Ze({log:t,cwd:r,args:c})}}getWebflowLoader(){return null}getUserConfigPatterns(){return["vite.config.mjs","vite.config.cjs","vite.config.js","vite.config.ts"]}getWranglerTemplatePath(){return Pt.join(Nu,"wrangler.json")}getAdditionalConfigFiles(){return[Pt.join(Nu,"vite.config.webflow.ts")]}hasCustomWorkerEntry(){let{log:t,cwd:r}=this.ctx;for(let n of["wrangler.json","wrangler.jsonc"]){let o=Pt.join(r,n);if(er.existsSync(o)){try{let i=er.readFileSync(o,"utf8"),s=$o(i);if(s?.main&&s.main!=="./src/worker.ts")return t.info(`user-provided ${n} has custom main entrypoint "${s.main}", will preserve user's worker`),!0}catch(i){t.warn(`failed to parse ${n}: ${i}`)}break}}return!1}ensureWorkerEntry(){let{log:t,cwd:r}=this.ctx,n=Pt.join(r,"src","worker.ts");if(er.existsSync(n)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),er.mkdirSync(Pt.join(r,"src"),{recursive:!0}),er.writeFileSync(n,`/// <reference types="@cloudflare/workers-types" />
|
|
57
|
+
|
|
58
|
+
interface Env {
|
|
59
|
+
ASSETS: Fetcher;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
async fetch(request: Request, env: Env): Promise<Response> {
|
|
64
|
+
return env.ASSETS.fetch(request);
|
|
65
|
+
},
|
|
66
|
+
} satisfies ExportedHandler<Env>;
|
|
67
|
+
`)}async prepareConfig(){let{log:t,cwd:r,userEnv:n}=this.ctx,o=this.hasCustomWorkerEntry();Or(t,r,"vite.config",["mjs","cjs","js","ts"])===null&&(t.info("no user vite.config.{mjs,cjs,js,ts} found \u2014 writing empty clouduser.vite.config.ts stub"),er.writeFileSync(Pt.join(r,"clouduser.vite.config.ts"),`export default {};
|
|
68
|
+
`));let s=Pt.join(Nu,"vite.config.webflow.ts");Et(s)&&(t.info("Copying vite.config.webflow.ts..."),er.copyFileSync(s,Pt.join(r,"vite.config.webflow.ts")));let a=Pt.join(Nu,"vite.config.ts.template"),l=Pt.join(r,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await $r(t,a,l,{...process.env,...n}),o||this.ensureWorkerEntry()}getBuildCommand(){return"vite build"}getNodeVersionRequirement(){return{minimum:"18.0.0",severity:"error"}}getFrameworkVersion(){return this.resolveFrameworkVersion("vite")}static getOutputDeployMetadata(){return{staticAssetsPath:"dist/client",workerEntryPath:"./src/worker.ts",deploymentType:"ssr-spa-combo",usesAssetsBinding:!0}}}});function qP(e,t){if(!t.includes("*"))return e===t;let r=t.split("*").map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${r}$`).test(e)}function Ya(e){return e===".well-known"?!1:e.startsWith(".")||qa.includes(e)?!0:pg.some(t=>qP(e,t))}function Xa(e){let t=[],r=(n,o)=>{let i;try{i=Xv.readdirSync(n,{withFileTypes:!0})}catch{return}for(let s of i){let a=o?`${o}/${s.name}`:s.name;if(s.isSymbolicLink())continue;if(s.isDirectory()){Ya(s.name)||r(za.join(n,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||ZP.has(s.name))&&t.push(a)}};return r(e,""),t}var Xv,za,zP,qa,pg,YP,XP,ZP,mr,Mu=x(()=>{"use strict";Xv=w(require("fs")),za=w(require("path"));ln();Lr();zP=wt(za.join(__dirname,"templates","static"),za.join(__dirname,"templates")),qa=["_headers","_redirects"],pg=["node_modules","package.json","package-lock.json","yarn.lock","pnpm-lock.yaml","webflow.json","webflow.jsonc","wrangler.json","wrangler.jsonc","wrangler.toml","clouduser.wrangler.json","clouduser","terraform.tfstate","terraform.tfstate.*","*.tfvars","auth.json","*.pem","*.key","*.pfx","*.p12","id_rsa","id_rsa.*","id_dsa","id_ecdsa","id_ed25519"];YP=["requirements.txt","Pipfile","Pipfile.lock","pyproject.toml","setup.py","setup.cfg","composer.json","composer.lock","auth.json","Gemfile","Gemfile.lock","config.ru","go.mod","go.sum","Cargo.toml","Cargo.lock","pom.xml","build.gradle","build.gradle.kts","deno.json","deno.jsonc","bun.lockb","mix.exs","Dockerfile","Procfile"],XP=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],ZP=new Set([...YP,...XP]);mr=class extends ft{static frameworkName="static";get info(){return{name:"static",version:"n/a",displayName:"Static (HTML/CSS/JS)"}}static detect(t,r){return r?.cloud?.framework==="static"?{detected:!0,reason:"Specified as static in webflow.json"}:{detected:!1}}async validate(){let t=Xa(this.cwd);t.length>0&&this.log.warn(`static app declared, but build/runtime files are present (${t.join(", ")}); they will be published as static assets unless removed`),this.log.info("Static app: no framework, no dependencies, no build \u2014 nothing to validate")}async installDependencies(){}async prepareConfig(){}getBuildCommand(){return""}getCloudflareAdapter(){return null}getRequiredIntegrations(){return[]}getWebflowLoader(){return null}getNodeVersionRequirement(){return null}getWranglerTemplatePath(){return za.join(zP,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}}});var Zv=x(()=>{"use strict"});function Bu(e,t){for(let r of tS){let n=r.detect(e,t);if(n.detected)return{Builder:r,result:n}}return null}function fg(e,t){let r=Bu(e.packageJson,t);if(!r)throw new an("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${Za.join(", ")})`});return e.log.info(`Detected framework: ${r.result.reason}`),new r.Builder(e)}function rS(e){let{hasPackageJson:t,specifiedFramework:r,hasRootIndexHtmlFile:n,hasRuntimeIndicators:o}=e;if(r==="static")return!0;let i=r!=null&&r!=="static";return!t&&!i&&n&&!o}function Qa(e,t,r){let n=r?.cloud?.framework,i=Qv.lstatSync(eS.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Xa(e),a=rS({hasPackageJson:t!=null,specifiedFramework:n,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&n==null)throw new an(`Found index.html but also build/runtime indicators (${s.join(", ")}); this is not a no-framework static app and will not be published as static assets.`,{remediation:'Remove those files, or declare a framework in webflow.json (e.g. { "cloud": { "framework": "static" } } to force static).'});return{isStatic:a}}var Qv,eS,tS,Za,mg=x(()=>{"use strict";Qv=w(require("fs")),eS=w(require("path"));Tt();Ou();Lu();ju();Mu();Ou();Lu();ju();Mu();ln();Zv();Tt();tS=[os,jo,No,ss,as,mr],Za=["astro","nextjs","vite","static"]});var nS=x(()=>{"use strict";mg();ln();Ou();Lu();ju();Mu();Tt()});function Uu(e,t,r,n){let o=oS.join(t,"webflow.json"),i={cloud:{}};if(ls.existsSync(o))try{let a=ls.readFileSync(o,"utf8"),l=JSON.parse(a),c=Pu.safeParse(l);if(c.success)i=c.data;else{let p=c.error.issues.map(f=>`${f.path.join(".")}: ${f.message}`).join(", ");e.warn(`webflow.json has schema issues (will be corrected): ${p}`),i=l}i.cloud||(e.warn('webflow.json is missing "cloud" property, adding it'),i.cloud={})}catch(a){e.warn(`Failed to parse existing webflow.json, overwriting: ${a}`)}let s=i.cloud;if(s.framework=r,n){let a=n.getOutputDeployMetadata();s.contract_version="1",s.deployment_type=a.deploymentType,a.deploymentType!=="static"&&(s.entrypoint_path=a.dryRunEntryPath??"./index.js"),s.skip_no_bundle=a.skipNoBundle===!0;let l=n.getFrameworkVersion();l&&(s.framework_version=l),a.assetsSourceSkipMountPath&&(s.assets_source_skip_mount_path=!0),(0,iS.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${r}`),ls.writeFileSync(o,JSON.stringify(i,null,2))}function sS(e,t){let r=rs(e,t);if(r?.cloud?.framework)return r.cloud.framework;let n=Ha(t),{isStatic:o}=Qa(t,n,r);if(o)return e.info("Detected static app (no framework, no build)"),Uu(e,t,mr.frameworkName),mr.frameworkName;if(!n)throw new an("Cannot detect framework: no package.json found",{remediation:'Run this command from your project root, or add a webflow.json with: { "cloud": { "framework": "<name>" } }'});e.info("webflow.json has no framework \u2014 detecting from package.json...");let i=Bu(n,r);if(!i)throw new an("Could not detect framework from package.json or webflow.json",{remediation:'Add a webflow.json with: { "cloud": { "framework": "<name>" } } (supported: astro, nextjs, vite)'});let s=i.Builder.frameworkName;return e.info(`Detected framework: ${i.result.reason}`),Uu(e,t,s),s}var ls,oS,iS,aS=x(()=>{"use strict";ls=w(require("fs")),oS=w(require("path")),iS=require("@webflow/cosmic-deploy-contract");mg();Tt();ig();sg();Lr();nS();Lr()});var el=x(()=>{"use strict";aS()});function cS(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
|
|
69
|
+
`)}function uS(e,t="wrangler.json"){let r=gr.join(e,t);if(!mt.existsSync(r)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),uS(e,t+"c");u.warn(`/${t} not found`);return}let n=mt.readFileSync(r,"utf8");u.info(`reading /${t}...`);let o;try{o=$o(n)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=lS.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
|
|
70
|
+
${cS(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function dS(e,t){let r=null,n=null,o=gr.join(t,"wrangler.json"),i=gr.join(t,"wrangler.jsonc");mt.existsSync(o)?(r=o,n=".json"):mt.existsSync(i)&&(r=i,n=".jsonc"),r&&n&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${n}...`),mt.copyFileSync(r,gr.join(t,`clouduser.wrangler${n}`)));let s=r?uS(t,gr.basename(r)):null,a=e.getWranglerTemplatePath(),l=gr.join(t,"wrangler.json");if(!mt.existsSync(a))throw new Error(`Wrangler template not found at ${a}. Make sure the template is properly copied during build.`);if(u.info(`copying wrangler template for ${e.info.name} to /wrangler.json`),mt.copyFileSync(a,l),!s)return;let c=JSON.parse(mt.readFileSync(l,"utf8"));if(s.kv_namespaces&&s.kv_namespaces.length>0&&(c.kv_namespaces=s.kv_namespaces,u.info(`merged ${s.kv_namespaces.length} KV namespace(s) into template`)),s.r2_buckets&&s.r2_buckets.length>0&&(c.r2_buckets=s.r2_buckets,u.info(`merged ${s.r2_buckets.length} R2 bucket(s) into template`)),s.d1_databases&&s.d1_databases.length>0&&(c.d1_databases=s.d1_databases,u.info(`merged ${s.d1_databases.length} D1 database(s) into template`)),mt.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let p in s.d1_databases){let f=s.d1_databases[p];if(!f.migrations_dir){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir is not defined`);continue}let m=f.migrations_dir,g=gr.join(t,m);if(!mt.existsSync(g)){u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let h=gr.join(t,"clouduser","migrations",m),y=Wn(u,g,h);y>0?u.info(`copied ${y} migrations to /clouduser/migrations/${m}`):u.info(`skipping migrations for database ${p} in wrangler.json; migrations dir (/${m}) is empty`)}}function QP(e){if(!/^[a-z0-9-]+$/.test(e))throw new Error(`Invalid object storage bucket name ${JSON.stringify(e)}: Only lowercase letters, numbers, and hyphens are allowed.`);if(e.startsWith("-")||e.endsWith("-"))throw new Error(`Invalid object storage bucket name "${e}": Cannot begin or end with a hyphen.`);if(e.length>27)throw new Error(`Invalid object storage bucket name "${e}": Must be 27 characters or fewer (currently ${e.length} characters).`)}function pS(e){let t=null;for(let s of[".json",".jsonc"]){let a=gr.join(e,`clouduser.wrangler${s}`);if(mt.existsSync(a)){t=a;break}}if(!t)return;let r=mt.readFileSync(t,"utf8"),n;try{n=$o(r)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=lS.safeParse(n);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
|
|
71
|
+
${cS(o.error)}`);let i=o.data;if(i.r2_buckets&&i.r2_buckets.length>0){u.info(`validating ${i.r2_buckets.length} object storage bucket name(s)...`);for(let s of i.r2_buckets)QP(s.bucket_name)}}var mt,gr,lS,fS=x(()=>{"use strict";mt=w(require("fs")),gr=w(require("path"));Zi();Ru();el();R();lS=B.object({name:B.string(),main:B.string().optional(),compatibility_date:B.string(),compatibility_flags:B.array(B.string()).optional(),placement:B.object({mode:B.string()}).passthrough().optional(),assets:B.object({directory:B.string(),binding:B.string().optional()}).passthrough().optional(),d1_databases:B.array(B.object({database_name:B.string(),database_id:B.string(),binding:B.string(),migrations_dir:B.string().optional()}).passthrough()).default([]),kv_namespaces:B.array(B.object({binding:B.string(),id:B.string()}).passthrough()).default([]),r2_buckets:B.array(B.object({binding:B.string(),bucket_name:B.string()}).passthrough()).default([])}).passthrough()});var cn,mS=x(()=>{"use strict";cn={LEGACY:"legacy",V2:"v2"}});function hS(e,t,r){if(!r)return t;let n=`${t}/${r}`,o=gS.join(e,n);return Wu.existsSync(o)&&Wu.statSync(o).isDirectory()?n:t}var Wu,gS,yS=x(()=>{"use strict";Wu=w(require("fs")),gS=w(require("path"))});var wS={};hp(wS,{detectBuilderV2:()=>e$});async function e$(e=process.cwd(),t,r,n){let o=(0,gt.loadPackageJson)(e),i=(0,gt.loadWebflowJson)(u,e),s={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:gg(r)}:{}},a={cwd:e,log:{debug:c=>u.debug(c),info:c=>u.info(c),warn:c=>u.warn(c),error:c=>u.error(c)},runCommand:gt.nodeCommandRunner,telemetry:gt.noopTelemetry,fs:gt.nodeFileSystem,packageJson:o??{},userEnv:s},{isStatic:l}=(0,gt.detectStaticApp)(e,o,i);if(l)return new gt.StaticBuilder(a);if(!o)throw new Error("No package.json file found");return(0,gt.detectAndCreateBuilder)(a,i)}var gt,bS=x(()=>{"use strict";gt=require("@webflow/app");R();hg()});function ES(e){let t=process.env.COSMIC_BUILD_ENGINE;return t===cn.V2||t===cn.LEGACY?t:e===cn.V2||e===cn.LEGACY?e:cn.LEGACY}function r$(e){return e===cn.V2?"@webflow/app@0.1.0-beta.6":cn.LEGACY}function un(e,t){let r=Math.min(Hu,process.stdout.columns??Hu),n=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,r-n.length));u.info(`
|
|
72
|
+
${se(`${n}${o}`)}`)}function yg(e,t){let r=Math.min(Hu,process.stdout.columns??Hu),n=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,r-n.length));u.info(`
|
|
73
|
+
${se(_t(`${n}${o}`))}`)}async function vS(e=process.cwd(),t,r,n,o){if(ES(o)===cn.V2){let{detectBuilderV2:p}=await Promise.resolve().then(()=>(bS(),wS));return p(e,t,r,n)}let i=Ha(e),s=rs(u,e),a={...n?{COSMIC_MOUNT_PATH:n}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...r&&!t?{COSMIC_DEPLOY_URL:gg(r)}:{}},l={cwd:e,log:u,packageJson:i??{},userEnv:a},{isStatic:c}=Qa(e,i,s);if(c)return new mr(l);if(!i)throw new Error("No package.json file found");return fg(l,s)}async function SS(e,t={}){let r=t.projectPath||process.cwd(),n=Date.now(),o=pe.join(r,".tmp",`webflow-build-${n}`),i=t.outputDir||pe.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=wg(r),c=t.telemetry,p=e.getBuildCommand(),f=e.getOutputDeployMetadata(),m=f.deploymentType==="static",g=ES(t.serverBuildEngine);await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),ie.mkdirSync(o,{recursive:!0});try{u.info(`Build engine: ${se(r$(g))}`),un("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${f.deploymentType}`);let h=e.getNodeVersionRequirement();h&&Un(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),un("\u2699\uFE0F ","Configure wrangler"),await dS(e,r),u.info("Preparing framework configuration..."),await e.prepareConfig()),Uu(u,r,e.info.name,e),m||(un("\u{1F4E6}","Install dependencies"),await n$(r,e.info.name,t.telemetry),pS(r),un("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${p}...`),await o$(r,p,t.telemetry),await e.postBuild(),un("\u{1F9EA}","Wrangler dry-run"),await i$(r,i)),un("\u{1F4C1}","Copy assets"),await a$(r,i,e,s),un("\u{1F381}","Create tarball");let y=await l$(i),k=Date.now()-a;return u.info(`${$} Build completed in ${(k/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:k,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),y}catch(h){let y=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:y,framework:e.info.name,buildEngine:g,buildCommand:p,deploymentType:f.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function wg(e){let t=pe.join(e,"wrangler.json");if(!ie.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let r=JSON.parse(ie.readFileSync(t,"utf8")),n=r.kv_namespaces||[],o=r.d1_databases||[],i=r.r2_buckets||[],s=r.vars||{};return{hasKV:n.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:n.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(r){return console.debug("Failed to parse wrangler.json for bindings detection:",r),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function xS(e){try{let t=pe.dirname(e);t.includes(".tmp/webflow-build-")&&(un("\u{1F9F9}","Clean up build artifacts"),ie.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function CS(e,t){try{un("\u{1F9F9}","Revert framework configuration");let r=t.getUserConfigPatterns(),n=new Set;for(let s of r){let a=pe.extname(s).slice(1),l=pe.basename(s,`.${a}`);if(!n.has(l)){n.add(l);for(let c of["mjs","cjs","js","ts"]){let p=pe.join(e,`clouduser.${l}.${c}`),f=pe.join(e,`${l}.${c}`);if(ie.existsSync(p)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),ie.existsSync(f)&&ie.unlinkSync(f),ie.renameSync(p,f);break}}}}for(let s of[".jsonc",".json"]){let a=pe.join(e,`clouduser.wrangler${s}`);if(ie.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=pe.join(e,"wrangler.json");ie.existsSync(l)&&ie.unlinkSync(l);let c=pe.join(e,`wrangler${s}`);ie.renameSync(a,c);break}}let o=pe.join(e,"clouduser");ie.existsSync(o)&&(u.info("cleaning up clouduser directory..."),ie.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=pe.join(e,pe.basename(s));ie.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),ie.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=pe.join(e,i.destinationName);ie.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),ie.unlinkSync(s))}}catch(r){u.warn(`Warning: Failed to cleanup framework configuration: ${r}`)}}async function n$(e,t,r){let n=Date.now(),o=["--no-update-notifier","--no-progress"],i=pe.join(e,"package-lock.json");try{ie.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,tl.execSync)(`npm ci --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"})):(u.info("Warning: No package-lock.json found, installing dependencies with npm install --include=dev"),(0,tl.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-n;await r?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:ie.existsSync(i)})}catch(s){let a=Date.now()-n;throw await r?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:ie.existsSync(i)}),s}}function gg(e){let t="production",r;switch(t){case"development":r="wf-app-dev";break;case"acceptance":r="wf-app-acceptance";break;default:r="wf-app-prod"}return`https://${e}.${r}.cosmic.webflow.services`}async function o$(e,t,r){let n=Date.now();try{(0,tl.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-n;await r?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-n;throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"cloud_build_command_failure",{duration:i,buildCommand:t}),new Error(`Build command failed: ${t}`)}}async function i$(e,t){ie.mkdirSync(t,{recursive:!0});let r=pe.join(e,"wrangler.json"),n=pe.join(e,"wrangler.jsonc");if(!ie.existsSync(r)&&!ie.existsSync(n))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,tl.execSync)(`npx wrangler@${t$} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function kS(e,t){let r=pe.join(e,"webflow.json");ie.existsSync(r)?(u.info("including webflow.json in output..."),ie.copyFileSync(r,pe.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function s$(e,t,r){let n=r.replace(/\/+$/,"").replace(/^\/+/,""),o=pe.join(t,"assets"),i=pe.join(o,n||"");ie.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${n}...`);for(let s of ie.readdirSync(e))Wn(u,pe.join(e,s),pe.join(i,s),{excludeFn:Ya,followSymlinks:!1});for(let s of qa){let a=pe.join(e,s);ie.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),ie.copyFileSync(a,pe.join(o,s)))}}async function a$(e,t,r,n){let o=r.getOutputDeployMetadata();if(o.deploymentType==="static"){s$(e,t,n),kS(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=n.replace(/\/+$/,"").replace(/^\/+/,"");a?i=hS(e,i,l):i=ag(e,i,l,r.info.name,s);let c=pe.join(t,"assets",l||"");ie.mkdirSync(c,{recursive:!0});let p=pe.join(e,i);if(ie.existsSync(p)&&ie.statSync(p).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Wn(u,p,c,{exclude:s})):Wn(u,p,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");kS(e,t);let f=null;for(let m of[".json",".jsonc"]){let g=pe.join(e,`clouduser.wrangler${m}`);if(ie.existsSync(g)){f=g;break}}if(f){u.info("including user wrangler config in output..."),ie.copyFileSync(f,pe.join(t,"clouduser.wrangler.json"));let m=pe.join(e,"clouduser","migrations");if(ie.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let g=pe.join(t,"migrations");Wn(u,m,g)}}}async function l$(e){let t=`${e}.tar.gz`;try{return await DS.create({gzip:!0,file:t,cwd:pe.dirname(e)},[pe.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(r){throw new d(r,{prefix:"Failed to create tarball:"})}}var ie,pe,tl,DS,t$,Hu,hg=x(()=>{"use strict";ie=w(require("fs")),pe=w(require("path")),tl=require("child_process"),DS=w(require("tar"));fS();R();C();j();me();el();mS();yS();t$="4.82.1",Hu=60});var uw=Symbol.for("@webflow/webflow-cli/suppress-deprecation");function aR(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.code==="DEP0040"&&typeof t.message=="string"&&t.message.includes("punycode")}function lR(e=process){if(e[uw])return;e[uw]=!0;let t=e.emit;e.emit=function(n,...o){return n==="warning"&&aR(o[0])?!1:t.call(this,n,...o)}}lR();var ZA=w(require("fs")),QA=require("commander");var qA=require("commander");me();R();var Kb=require("child_process"),Jb=require("fs"),Cf=w(require("semver"));R();var Ff="@webflow/webflow-cli",so="@webflow/data-types",dc="@webflow/react",AI=[Ff,so,dc],ao=class{getInstalledDependencies(){try{let t=(0,Kb.execSync)(`npm ls ${AI.join(" ")} --depth=0 --json --silent`,{encoding:"utf-8"}),r=JSON.parse(t);return r.dependencies?Object.entries(r.dependencies).reduce((n,[o,{version:i}])=>(n[o]=i,n),{}):{}}catch(t){return u.debug(`Failed to get installed dependencies: ${t}`),{}}}getRequiredDependencies(t){let r=JSON.parse((0,Jb.readFileSync)(require.resolve(`${t}/package.json`),"utf8"));return{...r.dependencies,...r.devDependencies}}checkCLIAndDataTypes(t){let r=t[so];if(!r)return;let o=this.getRequiredDependencies(Ff)[so];if(!Cf.default.satisfies(r,o))throw new Error(`Version mismatch: ${Ff} requires ${so} v${o} but found v${r}`)}checkReactAndDataTypes(t){let r=t[so],n=t[dc];if(!(!r||!n)&&!Cf.default.eq(r,n))throw new Error(`Version mismatch: ${dc} and ${so} must be on the same version. Found ${dc}@${n} and ${so}@${r}`)}run(){let t=this.getInstalledDependencies();this.checkCLIAndDataTypes(t),this.checkReactAndDataTypes(t)}};var tk=require("fs-extra");Oe();var rk=require("@dotenvx/dotenvx"),lo=w(require("semver"));R();var Zb=require("child_process"),Qb=require("util"),LI=(0,Qb.promisify)(Zb.exec);async function En(e,t){try{let{stdout:r,stderr:n}=await LI(e,t);return{stdout:r.toString().trim(),stderr:n.toString().trim(),code:0}}catch(r){let n=r;return{stdout:n.stdout??"",stderr:n.stderr??String(n.message??""),code:n.code??1}}}we();var Rf=w(ac());j();me();(0,rk.config)({quiet:!0,ignore:["MISSING_ENV_FILE"]});var ek={npm:{updateCommand:"npm install",update:async e=>await En(`npm install ${e}`),getOutdated:async e=>{let{stdout:t}=await En(`npm outdated --json ${e}`);return JSON.parse(t)},lockFile:"package-lock.json",globalFlag:"--global",supported:!0},pnpm:{updateCommand:"pnpm add",update:async e=>await En(`pnpm add ${e}`),getOutdated:async e=>{let{stdout:t}=await En(`pnpm outdated --json ${e}`);return JSON.parse(t)},lockFile:"pnpm-lock.yaml",globalFlag:"--global",supported:!0},yarn:{lockFile:"yarn.lock",globalFlag:"",updateCommand:"",getOutdated:async()=>({}),update:async()=>({stdout:"",stderr:"",code:0}),supported:!1}},NI=["@webflow/webflow-cli","@webflow/data-types","@webflow/react","@webflow/emotion-utils","@webflow/styled-components-utils"],pa=class{packageManager;constructor(){this.packageManager=this.getPackagerManagerInfo()}getPackagerManagerInfo(){for(let[,t]of Object.entries(ek))if((0,tk.existsSync)(t.lockFile))return t;return ek.npm}async listOutdatedPackages(t="local",r=NI){let{getOutdated:n,globalFlag:o}=this.packageManager,i=await n(`${t==="global"?o:""} ${r?.join(" ")}`);return Object.fromEntries(Object.entries(i).map(([s,a])=>Array.isArray(a)?[s,{current:a[0].current,latest:a[0].latest,installationType:t}]:[s,{current:a.current,latest:a.latest,installationType:t}]))}async getOutdatedPackages(){let t=await this.listOutdatedPackages();if(t["@webflow/webflow-cli"])return t;let r=await this.listOutdatedPackages("global",["@webflow/webflow-cli"]);return{...t,...r}}async showUpdatePrompt(t){let r={name:"Update all packages",value:"update-all"},n=Object.entries(t).map(([i,{current:s,latest:a}])=>({name:`${i} (${s} ${rt} ${a})`,value:i})),o=await Cr({message:`New versions of the following ${Ne("@webflow")} packages are available. Would you like to update them?`,choices:[r,...n]});return o==null?[]:o.includes("update-all")?Object.keys(t):o}showUpdateSuggestions(t){let{updateCommand:r,globalFlag:n}=this.packageManager;u.info(`${xe} New versions of the following ${Ne("@webflow")} packages are available:`),Object.entries(t).forEach(([s,{current:a,latest:l}])=>{u.info(P(` ${lc} ${s} (${a} ${rt} ${l})`))});let o=Object.entries(t).filter(([,{installationType:s}])=>s==="local").map(([s])=>`${s}@latest`),i=Object.entries(t).filter(([,{installationType:s}])=>s==="global").map(([s])=>`${s}@latest`);u.info(`
|
|
74
|
+
${rt} To update, run:`),o.length>0&&u.info(z(` ${r} ${o.join(" ")}`)),i.length>0&&u.info(z(` ${r} ${n} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=lo.prerelease(Rf.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:n,code:o}=await En(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!n.trim()){r.succeed("Up to date");return}let i=n.trim(),s=Rf.default.version;if(!lo.valid(i)||!lo.valid(s)){r.succeed("Up to date");return}if(!lo.gt(i,s)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||V()){u.info(`${xe} A new version of @webflow/webflow-cli@${t} is available.`);let{code:f}=await En("npm ls @webflow/webflow-cli --json"),g=(f===0?"local":"global")==="global"?" --global":"";u.info(`${rt} To update, run: `+z(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`)+`
|
|
75
|
+
`);return}let{code:l}=await En("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await $e({message:`A new version of @webflow/webflow-cli@${t} is available.
|
|
76
|
+
Would you like to update it?`,default:!1})){r=u.spinner("Updating");let f=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${f} @webflow/webflow-cli@${t}`),r.succeed("Updated successfully")}catch{let g=c==="global"?` ${this.packageManager.globalFlag}`:"";r.fail("Update failed. Manually run: "+z(`${this.packageManager.updateCommand}${g} @webflow/webflow-cli@${t}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let r;try{r=u.spinner("Checking for updates (to disable, use --skip-update-check)");let n=await this.getOutdatedPackages();if(!(Object.keys(n).length>0)){r.succeed("All @webflow packages are up to date");return}if(r.succeed(),!process.stdin.isTTY||V()){this.showUpdateSuggestions(n);return}let s=await this.showUpdatePrompt(n);if(s.length>0){r=u.spinner("Updating");let{local:a,global:l}=s.reduce((m,g)=>(m[n[g].installationType==="global"?"global":"local"].push(g),m),{local:[],global:[]}),{update:c,globalFlag:p,updateCommand:f}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${p} ${l.map(m=>`${m}@latest`).join(" ")}`),r.succeed("Updated successfully")}catch{r.fail("Update failed. Manually run: "+z(`${f} ${s.map(g=>`${g}@latest`).join(" ")}`))}}}catch(n){r?.fail("Failed to check for updates"),u.debug(String(n))}}};we();Dn();qr();Df();wf();Oe();Z();Y();we();Pe();R();C();j();me();Dn();var be=require("commander");C();R();function dt(e){let t=Object.fromEntries(e.map(r=>[r.toLowerCase(),r]));return r=>{let n=[],o=[];for(let i of r){let s=t[i.toLowerCase()];s?n.push(s):o.push(i)}return{valid:n,invalid:o}}}function Fe(e,t,r){let n=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(n);if(o.length===0)throw new d(`No valid fields specified. Available: ${r.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${r.join(", ")}`),o}me();R();var wk=(e,t)=>e+" ".repeat(Math.max(0,t-bt(e).length));function ze(e,t){let r=e.map((s,a)=>Math.max(bt(s).length,...t.map(l=>bt(String(l[a])).length))),n=r.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>wk(s,r[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>wk(String(a),r[l]+2)).join("")).join(`
|
|
38
77
|
`);return`${o}
|
|
39
|
-
${
|
|
40
|
-
${i}`}function
|
|
78
|
+
${n}
|
|
79
|
+
${i}`}function Ai(e){return e?`
|
|
41
80
|
|
|
42
|
-
More: pass --cursor ${e}`:""}var
|
|
43
|
-
Use --force flag to reauthenticate anyway`);return}try{u.info(`${
|
|
44
|
-
You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new
|
|
81
|
+
More: pass --cursor ${e}`:""}var bk=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],kk=["id","url","lastPublished","fullSiteCompiledAt"],Dk=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],hc="id,name,siteId,createdAt",Bf="id,name,description,siteId,appPath,createdAt",yc="id,url,lastPublished",wc="id,branch,deployUrl,latestDeploymentStatus,createdAt",GI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function KI(e,t){return e==null||e===""?P("\u2014"):GI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ga(e,t,r){if(e.length===0)return P(r);let n=t.map(i=>se(i)),o=e.map(i=>t.map(s=>KI(i[s],s)));return ze(n,o)}var bc=dt(bk),Ek=dt(kk),vk=dt(Dk);function Fn(){return bk}function ha(){return kk}function ya(){return Dk}function kc(e,t=hc.split(",")){return ga(e,t,"No apps found.")}function Sk(e,t=yc.split(",")){return ga(e,t,"No domains found.")}function xk(e,t=wc.split(",")){return ga(e,t,"No environments found.")}function Ck(e){return e.siteName?`Permanently delete app "${e.name}" (attached to site "${e.siteName}", ${e.id}). This cannot be undone.`:`Archive standalone app "${e.name}" (${e.id}).`}var JI=["success","failed","canceled","unstaged"],Dc=5,Ec=600;function Fk(e){return JI.includes(e)}var _k=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],wa="id,status,sourceType,commitHash,buildStartedAt",vc=dt(_k);function _n(){return _k}function ba(e,t=wa.split(",")){return ga(e,t,"No deployments found.")}Dn();var Uf=()=>new be.Option("--no-input","Avoid prompting or doing anything interactive. Use this for CI/CD pipelines. Auto-enabled when CI=true, when stdout or stdin is not a TTY, or when a coding agent's execution environment is detected."),Wf=()=>new be.Option("--region <region>",`Webflow region to target: ${io.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(io),Ak=()=>new be.Option("--input","Force interactive mode, overriding the automatic no-input detection."),Hf=()=>new be.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),Vf=()=>new be.Option("--skip-update-check","Skip checking for @webflow packages updates"),Gf=()=>new be.Option("--verbose","Display more information for debugging purposes."),Xr=()=>new be.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Rt=()=>new be.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ri=e=>{if(e.trim()==="")throw new be.InvalidArgumentError("must be a non-empty value.");return e},Sc=(e,t)=>`Supplying multiple filters combines them with AND (all must match), so ${t} plus a non-matching --q returns an empty page \u2014 that means nothing matched all filters, not that the ${e} is absent.`,xc=e=>new be.Option("--q <text>",`Case-insensitive substring (contains) match on ${e}. Use it to discover matches; it never searches ids or variable values. For an exact single-item lookup, prefer the exact filter instead.`).argParser(Ri),re=()=>new be.Option("--json","Output as JSON"),ka=()=>new be.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),Da=()=>new be.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),Kf=()=>new be.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),_e=()=>new be.Option("--dry-run","Preview without executing"),Ii=()=>new be.Option("-y, --yes","Skip confirmation prompt"),Ti=()=>new be.Option("--order <dir>","Sort direction: asc or desc").default("asc"),Cc=()=>new be.Option("-a, --agent <ids>",'Target coding agent, repeatable and comma-separated (e.g. --agent claude-code,cursor). Use "all" for every supported agent.').argParser((e,t)=>[...t??[],e]),Ea=()=>new be.Option("-g, --global","Operate on the per-user (home directory) install"),va=()=>new be.Option("-p, --project","Operate on the current project's install"),We=e=>new be.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),Pi=e=>new be.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),Fc=()=>new be.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),_c=()=>new be.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),zI=100,Ac=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new be.InvalidArgumentError("must be a positive integer.");return t},Jf=()=>new be.Option("--limit <n>","Max log lines to return (default: 100)").default(zI).argParser(Ac),qI=20,Rk=()=>new be.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(qI).argParser(Ac),Ik=e=>{let t=Number(e);if(!Number.isInteger(t))throw new be.InvalidArgumentError("must be an integer number of seconds.");return t},Tk=()=>new be.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(Dc).argParser(Ik),Pk=()=>new be.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Ec).argParser(Ik),Sa=e=>async(t,r)=>{let o={...r.parent?.opts()||{},...t};await e(o)};var Ok=e=>{let t=e.command("auth").description("Authentication and configuration commands");t.command("login").description("Authenticate with Webflow and save credentials to .env file").option("-f, --force","Force reauthentication even if credentials exist").action(async r=>{if(V()){u.info(`${D} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:n}=oe();if(!r.force&&Ci()?.accessToken){let i=uo(n);u.info(`${$} Webflow credentials already exist (${ct().toUpperCase()}):`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
|
|
82
|
+
Use --force flag to reauthenticate anyway`);return}try{u.info(`${rt} Authenticating against the ${ct().toUpperCase()} region...`);let o=await T({force:!0});Yr({apiToken:o}),u.info(`
|
|
83
|
+
You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new d(o,{prefix:`${D} Authentication failed:`})}}),t.command("status").description("Show current authentication status").addOption(re()).action(async r=>{let n=ct(),o=Ci(),i=o?.accessToken?null:Vt(),s=o?.accessToken??i,a=!o?.accessToken&&!!i,l=a?process.env.WEBFLOW_API_TOKEN===i?"WEBFLOW_API_TOKEN":process.env.WEBFLOW_WORKSPACE_API_TOKEN===i?"WEBFLOW_WORKSPACE_API_TOKEN":"WEBFLOW_SITE_API_TOKEN":null;if(!s){r.json?u.info(JSON.stringify({loggedIn:!1,region:n},null,2)):u.info(`${D} Not logged in to the ${n.toUpperCase()} region. Run ${z("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let c=await Mf(s);if(!c){r.json?u.info(JSON.stringify({loggedIn:!1,region:n,error:"invalid_or_expired_token"},null,2)):u.info(`${D} Token is invalid or expired. Run ${z("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}if(r.json){u.info(JSON.stringify({loggedIn:!0,region:a?"unknown":n,user:{firstName:c.firstName,lastName:c.lastName,email:c.email},scopes:o?.scopes??[],...l?{tokenSource:l}:{}},null,2));return}u.info(`${$} Logged in as ${c.firstName} ${c.lastName} (${c.email})`),u.info(l?` Region: unknown (from ${l})`:` Region: ${n.toUpperCase()}`),o?.scopes?.length&&u.info(` Scopes: ${o.scopes.join(", ")}`),u.info(` Session: ${Sn()}`)}catch(c){throw new d(c,{prefix:`${D} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove the stored credentials").action(async()=>{let r=ma();if($f(),!r){u.info(`${$} No stored session to log out of.`);return}u.info(`${$} Logged out of the ${r.toUpperCase()} region.`),u.info(`${rt} Run ${z("webflow auth login")} to authenticate again.`)}),t.command("telemetry").description("Manage telemetry settings for all Webflow CLI commands").option("--enable","Enable telemetry for all commands").option("--disable","Disable telemetry for all commands").option("--status","Show current telemetry status").option("--local","Write the preference to the current directory's webflow.json instead of the global config").action(async r=>{let n=kn.getInstance();if(r.status){let s=await n.getTelemetryStatus();u.info($k(s.enabled));return}if(r.enable){await n.setPreference(!0,{local:r.local}),u.info(zf(!0));return}if(r.disable){await n.setPreference(!1,{local:r.local}),u.info(zf(!1));return}let o=await n.getTelemetryStatus();if(u.info($k(o.enabled)),V()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await je({message:"What would you like to do?",choices:[{name:"Enable telemetry for all commands",value:"enable"},{name:"Disable telemetry for all commands",value:"disable"},{name:"Cancel",value:"cancel"}]});if(i==="enable"||i==="disable"){let s=i==="enable";await n.setPreference(s,{local:r.local}),u.info(zf(s))}})},zf=e=>`${$} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,$k=e=>`${xe} Telemetry status: ${e?`enabled ${$}`:`disabled ${D}`}`;var tD=w(require("http")),rD=w(require("node-fetch")),nD=w(require("serve-handler")),oD=require("fs"),iD=w(require("path")),sD=require("commander");var Nk=w(require("archiver")),Yf=require("commander"),Tc=require("fs");var Lk=require("cosmiconfig"),qf=require("commander"),Rc=async(e,t)=>{let r=await YI(t),n=r.config.apiVersion;return n&&typeof n!="string"&&qf.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:r.filepath,config:{publicDir:e,...r.config}}},YI=async e=>{let r=await(0,Lk.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return r||qf.program.error(`No ${e} file was found. Run this command within your extension folder.`),r};var jk=w(require("mime-types")),Ic=w(require("path")),XI=5*1024*1024,ZI=new Set(["application/javascript","application/json","application/xml","image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/vnd.microsoft.icon","image/x-icon","video/webm","font/ttf","font/otf","font/woff","font/woff2","text/plain","text/markdown","text/html","text/css"]),Mk=async(e,t,r)=>{let{config:n,filepath:o}=await Rc(e,t),i=Ic.join(o,".."),s=!0,a=!1,l=p=>{let f=p.name,m=jk.default.lookup(f);return f==="index.html"&&(a=!0),f&&f.endsWith(".DS_Store")||!m?!1:ZI.has(m)?p:(console.log(`Invalid file type: ${m} for file: ${f}`),s=!1,!1)},c=p=>{(0,Tc.unlink)(r,f=>{f&&console.error(`Failed to delete file: ${f}`),Yf.program.error(p)})};return console.log(`Packaging the contents of the ${n.publicDir} folder into ${r}...`),new Promise(p=>{let f=(0,Nk.default)("zip",{zlib:{level:9}}),m=(0,Tc.createWriteStream)(Ic.join(i,r));m.on("close",()=>{p(void 0)}),f.directory(Ic.join(i,n.publicDir),!1,l),f.file(o,{name:t}),f.pipe(m),f.finalize(),f.on("warning",g=>{console.log(g)}),f.on("error",g=>{Yf.program.error(g.message)}),f.on("finish",()=>{if(!a){c("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!s){c("Bundling failed due to invalid file types");return}if(!f.pointer()||f.pointer()===0){c("Bundling failed with no output");return}if(f.pointer()>=XI){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${f.pointer()} total bytes written`),console.log(`Done! ${r} is ready for you to upload to your Webflow app.`)})})};var xa=w(require("path")),Fr=w(require("fs/promises")),Oc=w(require("fs")),Uk=require("url"),wW=require("dotenv/config"),Wk=["js","cjs","json"],Qf=process.cwd(),Hk=".webflowrc",Qr=xa.extname(Oc.readdirSync(Qf).find(e=>e.includes(Hk))??"").replace(/\./g,""),Zr=xa.join(Qf,`${Hk}${Qr&&`.${Qr}`}`),Vk=Oc.existsSync(Zr),Xf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${Wk.join(", ")}`)}},Pc=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Qr}. The supported extensions are: ${Wk.join(", ")}`)}},$c=class extends Error{constructor(t){let r=t.includes(".webflowrc"),n=t.includes("webflow.json"),o;r?o=`It seems like you don't have a .webflowrc file in your project (${t}). Make sure there is a .webflowrc file in your project root.`:n?o=`It seems like you don't have a webflow.json file in your project (${t}). Make sure there is a webflow.json file in your project root.`:o=`It seems like you don't have a config file in your project (${t}). Make sure there is a config file in your project root.`,super(o)}},Zf=class extends Error{constructor(t){super(`The following required fields are missing or undefined in your .webflowrc file: ${t}. If you're using process.env variables, make sure they're set up correctly.`)}};async function QI(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,Uk.pathToFileURL)(e).href:e)).default}function Bk(e,t){let r=t.filter(n=>!e[n]);if(r.length)throw new Zf(r.join(", "))}async function $i(e=[],t=!1){if(!Vk){if(t)return{};throw new $c(Zr)}if(!Qr)throw new Xf;switch(Qr){case"js":case"cjs":{await Fr.access(Zr);let r=await QI(Zr);return Bk(r,e),r}case"json":{let r=JSON.parse(await Fr.readFile(Zr,"utf8"));return Bk(r,e),r}default:throw new Pc}}function e0(e,t){if(Qr==="js"||Qr==="cjs"){let n=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(n)return n[1]}}function t0(e,t,r){let n=e0(t,r);if(n){let o=new RegExp(`${r}: ".*?",`,"g");return e.replace(o,`${r}: process.env.${n},`)}return e}async function r0(e){let t=["authToken","host","siteId"],r=await Fr.readFile(Zr,"utf-8");for(let n of t)e=t0(e,r,n);return e}async function n0(){try{let e=xa.join(Qf,"package.json");return await Fr.access(e),JSON.parse(await Fr.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function Gk(e){if(!Vk)throw new $c(Zr);let t=JSON.stringify(e,null,2);switch(Qr){case"js":case"cjs":{let r=await r0(t.replace(/"([^"]+)":/g,"$1:")),n=await n0()&&Qr==="js"?"export default ":"module.exports = ";return Fr.writeFile(Zr,n+r)}case"json":return Fr.writeFile(Zr,t);default:throw new Pc}}var An=w(require("fs")),Gt=w(require("path"));var Ca="webflow.json",Kk="index.html",Jk="bundle.zip",em="public",tm="extension-scaffolds",Lc="default";var zk="package.json",qk="wf-placeholder-name",rm=e=>JSON.stringify(e,null,2),Yk=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
|
|
45
84
|
\u2502 `+e+` \u2502
|
|
46
|
-
\u2570`+t+"\u256F"};var
|
|
47
|
-
`)},
|
|
85
|
+
\u2570`+t+"\u256F"};var Xk=async(e,t="./",r=Lc,n)=>{let o=n[r];try{for(let i of o){let s=Gt.join(t,i),a=s0(s,r,e);if(i.includes(zk)||i.includes(Ca))await i0(i,a,e);else{let l=await An.promises.readFile(i);await eD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},Zk=async()=>{let e={},t=Gt.resolve(__dirname),r=Gt.join(t,tm),n=await An.promises.readdir(r);for(let o of n){let i=Gt.join(r,o),s=await Qk(i);e[o]=s}return e},Qk=async e=>{let t=[];try{let r=await An.promises.readdir(e);for(let n of r){let o=Gt.join(e,n);if((await An.promises.stat(o)).isDirectory()){let s=await Qk(o);t.push(...s)}else t.push(o)}}catch(r){console.error(`Error reading ${Gt}, `,r)}return t},eD=async(e,t)=>{try{await An.promises.mkdir(Gt.dirname(e),{recursive:!0}),await An.promises.writeFile(e,t)}catch(r){console.error("Error writing file ",r)}},i0=async(e,t,r)=>An.promises.readFile(e,"utf8").then(async n=>{let o=n.replace(qk,r);await eD(t,o)}),s0=(e,t,r)=>{let n=Gt.join(tm,t),o=e.indexOf(n);if(o!==-1){let i=e.substring(o+n.length+1);return Gt.join(r,i)}return""};var Nc=async()=>await Zk(),aD=async()=>{let e=await Nc(),t=Object.keys(e).join(", ");console.log(`Your available templates are: ${t}`),console.log('\u{1F4A1} Syntax: "webflow extension init projectName templateName"'),console.log('\u{1F31F} Example: "webflow extension init my-first-extension react"')},lD=async(e,t=Lc)=>{let r=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let n=await Nc();await Xk(e,r,t,n),console.log(`Done! Check out ${r}/README.md for steps on how to develop your extension.`)},cD=()=>Mk(em,Ca,Jk),uD=async e=>{let{config:t,filepath:r}=await Rc(em,Ca),n=iD.join(r,"..",t.publicDir,Kk),i=(await $i([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(g=>t.featureFlags?.[g]===!0?`ff_on=${g}`:`ff_off=${g}`).join("&"),l=a?`&${a}`:"",p=await(await(0,rD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),f=new tD.Server((g,h)=>{if(g.url==="/"){oD.promises.readFile(n,{encoding:"utf-8"}).catch(y=>{sD.program.error(y.message)}).then(y=>{let k=p.replace("{{ui}}",y);return h.writeHead(200,{"Content-Length":Buffer.byteLength(k),"Content-Type":"text/html"}),h.end(k)});return}if(g.url==="/__webflow")return h.writeHead(200,{"Content-Length":Buffer.byteLength(rm(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),h.end(rm(t));(0,nD.default)(g,h,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=a0(e);f.listen(m),console.log(Yk(`Serving your extension at http://localhost:${m}`)+`
|
|
86
|
+
`)},a0=e=>{if(e){let t=parseInt(e,10);return isNaN(t)?(console.log("Invalid port number provided. Using the default port "+1337),1337):t}return 1337};Oe();C();var dD=e=>{let t=e.command("extension").description("CLI for developing Designer Extensions.");t.command("list").description("Get list of project templates that can be used for `init`").action(aD),t.command("init").description("Bootstrap a Designer Extension.").argument("[projectName]","What is your Designer Extension's name?").argument("[scaffoldName]","Which project template do you want to use?").action(async(r,n)=>{let o=await Nc(),i=Object.keys(o),s=await Ge({message:"What would you like to name your Designer Extension?",default:r,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new d("When --no-input mode is enabled please provide the [projectName] argument.");let a=await je({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:n||"default"});await lD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(cD),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(uD)};var lm=w(require("process"));R();ke();Pe();var fD=w(require("fs"));C();async function Mc(e){let{authToken:t,siteId:r}=e||{},{path:n,isUserDefined:o}=cr(),i=fD.existsSync(n),s=!1;try{let{manifest:a}=oe();s=!0,o&&u.info(`Using manifest file: ${n}`);try{let l=ea(a,"devlink");if(!t||!r)throw new Error(`Missing Site ID or API token. Make sure you have WEBFLOW_API_TOKEN and WEBFLOW_SITE_ID set in your environment variables, or pass them as arguments --site and --api-token.
|
|
48
87
|
|
|
49
88
|
To set up your credentials, run:
|
|
50
|
-
webflow auth login`);return
|
|
51
|
-
`})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${
|
|
52
|
-
`:`Your manifest file exists but is invalid or missing required properties: ${
|
|
53
|
-
`;throw new
|
|
89
|
+
webflow auth login`);return pD(l?.relativeHrefRoot),{...l,host:O(),authToken:t,siteId:r,cssModules:!!l?.cssModules,components:jc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new d(l,{prefix:`Failed to read devlink config from manifest file: ${n}
|
|
90
|
+
`})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${n}
|
|
91
|
+
`:`Your manifest file exists but is invalid or missing required properties: ${n}
|
|
92
|
+
`;throw new d(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),r||a.push("siteId");let l=await $i(a);return pD(l?.relativeHrefRoot),{...l,host:l.host||O(),cssModules:!!l?.cssModules,components:jc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(a){throw a instanceof Error&&a.message.includes(".webflowrc")&&(a.message=`No configuration file found. Please create either:
|
|
54
93
|
- webflow.json with a "devlink" section, or
|
|
55
94
|
- .webflowrc file
|
|
56
|
-
in your project root.`),new
|
|
57
|
-
`),
|
|
95
|
+
in your project root.`),new d(a)}}function pD(e){if(!(e===void 0||e===!1)){if(typeof e=="string"){if(e==="/"||e.startsWith("http://")||e.startsWith("https://"))return;throw new Error(`Invalid relativeHrefRoot value "${e}". Must be false, "/" or an absolute URL starting with http:// or https://`)}throw new Error(`Invalid relativeHrefRoot type. Must be false, "/" or an absolute URL string, got: ${typeof e}`)}}function jc(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}om();lt();C();var Oi=class extends Error{};function d0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function p0(e){switch(e.status){case 400:{let t=await e.text(),r=d0(t);throw new Oi(r||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new Oi("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new Oi("`webflow devlink sync` is no longer available. Run `webflow devlink export` instead \u2014 see the migration guide: https://developers.webflow.com/devlink/docs/reference/migrate-from-sync");default:throw new Oi(`Something went wrong (HTTP ${e.status}).`)}}async function f0(e){try{let{siteId:t,host:r,authToken:n,...o}=e,i=await K(`${r}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():p0(i)}catch(t){throw new d(t,{skipLogging:!0})}}async function im(e){try{let t=await f0(e);if(!t.files||!Array.isArray(t.files))throw new d("Invalid response format from V1 API: expected 'files' array");let r=t.metadata?.exportCoverage==="full";return await Uc(t.files,e.rootDir,r),{messages:t.messages}}catch(t){throw t instanceof d?t:new d(t,{skipLogging:!0})}}var fo=w(require("process"));R();Pe();lt();var sm=class{config;error;constructor(t,r){this.config=t,this.error=r}stripPII(t=""){return t.replace(/\/(.*)webflow-cli/gi,"/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi,"/REDACTED_PII/node_modules")}sendTelemetry(){let t=this.config,r=this.error;K(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:r.cause,message:r.message,name:r.name,stack:this.stripPII(r.stack),platform:fo.default.platform,node:fo.default.version})})}async storeChoice(t){try{return Se({devlink:{allowTelemetry:t}})}catch{let n=await $i();await Gk({...n,allowTelemetry:t})}}async prompt(){let t=this.config;u.error(this.error),t.allowTelemetry===!0?this.sendTelemetry():t.allowTelemetry===void 0&&(await this.storeChoice(!0),this.sendTelemetry())}};function Wc(e){return async function(r){fo.default.removeListener("uncaughtException",Wc),fo.default.removeListener("unhandledRejection",Wc);let n=await Mc(e);if(!n)return;await new sm(n,r).prompt()}}function mD(e){fo.default.on("uncaughtException",Wc(e)),fo.default.on("unhandledRejection",Wc(e))}Z();R();Y();Pe();am();async function gD(e,t){let r=Date.now(),{manifest:n}=oe(),{accessToken:o,siteId:i}=await Je(n,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:jc(e),overwriteModule:!1}:{overwriteModule:!0}};mD(s);let a=await Mc(s);if(!a)return lm.default.exit();let l;try{l=_.forDevlinkSync(a)}catch(p){u.debug(`Failed to initialize telemetry: ${p}`)}await l?.sendUsage("devlink_sync_start",{specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot});let c=u.spinner(`Exporting components into ${a.rootDir}`);try{let{messages:p}=await im(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),Hc(p);let f=Date.now()-r;await l?.sendUsage("devlink_sync_success",{duration:f,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(p){let f=p instanceof Error?p.message:String(p);c.fail(`Failed to export components: ${f}`);let m=Date.now()-r;throw await l?.sendError(p instanceof Error?p:new Error(String(p)),"devlink_sync_failure",{duration:m,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot,configOverrides:Object.keys(s),argv:lm.default.argv.slice(2)}),p}}Yc();var $n=require("commander");var ho=require("path"),Hi=require("@webflow/data-types");ke();var Xc=require("fs"),hm=w(require("md5"));function _a(e,t){try{let r=(0,Xc.statSync)(e),n=(0,Xc.readFileSync)(e);return{value:n,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,hm.default)(n),size:r.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function Aa(e,t,r){try{let n=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,hm.default)(o),size:n,...r}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var LD=w(require("node-fetch")),ND=w(require("form-data"));async function Ra(e,t){let r={...t.fields,file:e.value},n=new ND.default;Object.entries(r).forEach(([i,s])=>{n.append(i,s)});let o=await(0,LD.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:n});E0(o)}function E0(e){switch(e.status){case 200:case 201:return;case 403:throw new Error("Unauthorized. Please check your AWS access key");default:throw new Error(`Something went wrong when uploading the file: ${e.statusText}`)}}R();Pe();Z();ke();lt();me();function v0({apiToken:e=process.env.WEBFLOW_API_TOKEN??process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN,siteId:t=process.env.WEBFLOW_SITE_ID,libraryTarget:r=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(r==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${O()}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${O()}/v2/workspaces`,authToken:e}}function S0(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function x0(e){if(e.ok)return;if(e.status===401||e.status===403)throw new Error(`Your API token is invalid or not authorized to perform this action. Run ${z("webflow auth login --force")} to generate a new token.`);if(e.status===404)throw new Error("Code components are rolling out in phases. Check back soon for access.");let t=await e.json();throw new Error(t.message||e.statusText)}async function In({endpoint:e,method:t="GET",body:r,options:n}){let{baseUrl:o,authToken:i}=v0(n),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await K(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:S0(r)});return await x0(a),a.json()}async function ym({options:e}){return(await In({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function wm({name:e,description:t,slug:r,options:n}){return(await In({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:r},options:n})).payload}async function bm({resourceId:e,files:t,options:r}){return(await In({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:r})).payload}async function km({resourceId:e,codeModule:t,components:r,options:n}){return(await In({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:r},options:n})).payload}var Mi=require("path"),_E=w(require("webpack-merge")),go=require("@webflow/data-types");ke();R();var BD=require("memfs/lib/volume"),Ia=require("@webflow/data-types");var _r="./tmp_entry",jD="components";function Zc(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+|[^\p{L}\p{N}]/gu," ").toLowerCase().replace(new RegExp("(?:^|\\s)(\\p{L})","gu"),(t,r)=>r.toUpperCase()).replace(/\s+/g,"")}function C0(e){let t=Zc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function MD(e,t){let r=e.map(({name:l,path:c,isDefaultExport:p})=>p?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
|
|
96
|
+
`),n=e.filter(l=>l.type==="internal").map(({name:l,exportKey:c})=>`${c}: ${l}`).join(", "),o=e.filter(l=>l.type==="component").map(({name:l,exportKey:c})=>`"${c}": ${l}`).join(", "),i=`env: "${t}"`,s=n,a=o?`components: { ${o} }`:void 0;return`${r}
|
|
58
97
|
|
|
59
|
-
export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function vk(e,t,n,r){let o={},i=`${_n}/Client.js`,s=`${_n}/Server.js`;o[i]=kk([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],Fa.Environment.Client);let a={},l=d=>{let p=I0(d);return a[p]?(a[p]+=1,`${p}${a[p]}`):(a[p]=1,p)};o[s]=kk([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([d])=>n[d]?.ssr??!0).map(([d,p])=>{let m=l(d),h=p.startsWith(_n)?p.replace(`${_n}/`,"./"):p;return{name:m,path:h,exportKey:d,isDefaultExport:!0,type:"component"}})],Fa.Environment.Server);let c={[Fa.Environment.Client]:i,[Fa.Environment.Server]:s};return{entryPointsVolume:Ek.Volume.fromJSON(o,r),paths:c}}var dE=require("memfs/lib/volume");var _k=w(require("archiver")),$i=require("path");De();var _a=require("@webflow/data-types");De();A();var _r=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var Sk=2;function xk(e){let t={type:_a.ModuleLoader.FEDERATION,version:Sk,entry:rf,renderer:ra,components:e};return{title:na,content:JSON.stringify(t)}}function Ck(e){let t={type:_a.ModuleLoader.SSR,version:Sk,entry:Di,components:e};return{title:na,content:JSON.stringify(t)}}function Fk(e){let t=`/${_a.Environment.Client}/${rf}`;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===ra||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${_r(o)}${l}`)})),i},{})}}catch(n){u.error(n,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Jc=require("@webflow/data-types"),T0=/\.css$/i;async function Ak(e,t,n){let r=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Jc.Environment.Server}/${oa}`,a=(0,_k.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:oa,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let h=(0,$i.resolve)((0,$i.join)(`/${Jc.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}=Ck(n);a.append(d,{name:c}),e.forEach(p=>{if(!T0.test(p.name))try{let m=(0,$i.resolve)((0,$i.join)(`/${Jc.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 Rk=require("@webflow/data-types");async function Ik(e,t,n){let{title:r,content:o}=xk(n);await t.promises.writeFile(`/${Rk.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 rE=require("@rspack/core"),oE=w(require("fork-ts-checker-webpack-plugin")),iE=require("ts-checker-rspack-plugin"),sE=w(require("mini-css-extract-plugin")),aE=require("@webflow/data-types");var Pk=require("webpack"),cm=w(require("mini-css-extract-plugin")),$k=w(require("tsconfig-paths-webpack-plugin")),Ok=require("tsconfig-paths"),um=require("@webflow/data-types"),Lk=require("path");De();var Tk=w(require("postcss-selector-parser")),lm=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,Tk.default)(n=>{n.walkPseudos(r=>{r.value===":root"&&(r.value=":host")})}).processSync(t.selector)})}});lm.postcss=!0;lm.postcssPlugin="CSSinShadowDOM";var zc=lm;function P0(e){let t=(0,Ok.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function Nk({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:cm.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[zc]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new cm.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=P0(s);return l?new $k.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===um.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,Lk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===um.Environment.Server)return{...a,plugins:[...a.plugins||[],new Pk.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Di,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var jk=require("@module-federation/enhanced"),dm=require("@webflow/data-types");function Mk({libraryName:e,env:t,exposes:n}){if(t===dm.Environment.Client)return{plugins:[new jk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===dm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function Bk(){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 qc(){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 Xc=require("@rspack/core"),Uk=require("tsconfig-paths"),pm=require("@webflow/data-types"),Wk=require("path");De();function $0(e){let t=(0,Uk.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function Hk({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:Xc.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:[zc]}}}],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 Xc.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=$0(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===pm.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,Wk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===pm.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new Xc.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Di,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var Vk=require("@module-federation/enhanced/rspack"),fm=require("@webflow/data-types");function Gk({libraryName:e,env:t,exposes:n}){if(t===fm.Environment.Client)return{plugins:[new Vk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===fm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var L0=w(require("fs")),Kk=require("unionfs"),Jk=require("webpack");function O0(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function Yc(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:n=>e.toString(n),toJson:()=>({...t,assets:(t.assets??[]).map(O0)})}}async function zk({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new Kk.Union().use(L0));return new Promise((s,a)=>{let l=(0,Jk.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(Yc(d)):a(new Error("Webpack stats are undefined"))})})})}var N0=w(require("fs")),mm=w(require("webpack-merge")),qk=require("memfs"),Xk=require("unionfs"),Yk=require("@rspack/core");async function Zc({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new Xk.Union().use(N0)),s=e;return t.length>0&&(s=(0,mm.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),n&&(s=(0,mm.default)(s,{output:{clean:!1,...r&&{path:r}}})),new Promise((a,l)=>{let c=(0,Yk.rspack)(s);c.inputFileSystem=i,n&&(c.outputFileSystem=(0,qk.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(Yc(p)):l(new Error("Rspack stats are undefined"))})})})}var Qk=require("@module-federation/enhanced");var Oi=w(require("webpack-merge"));A();function Ar(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function Zk(e,t){let n=Object.entries(e).filter(([r])=>!t.includes(r));return Object.fromEntries(n)}function j0(e,t){return e instanceof t||Ar(e)==="ModuleFederationPlugin"}function eu(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:n,getPluginOptions:r,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],d=M0(s),p=Array.isArray(l)?Qc(...l.map(d)):Qc(d(l));Object.keys(p).some(H=>c.includes(H))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let h={...Zk(p,[...c,"ModuleFederationPlugin","module","plugins"]),module:Zk(p.module??{},["rules"])},g=(0,Oi.default)(a,h),y=p.plugins??[];o&&(y=y.filter(o));let b=a.plugins??[],_=(0,Oi.mergeWithCustomize)({customizeArray:(0,Oi.unique)("plugins",t,H=>Ar(H))})({plugins:y},{plugins:b}).plugins,v=p?.ModuleFederationPlugin?.shared,x=_?.map(H=>{if(j0(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 Qc(...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 M0(e){return t=>typeof t=="function"?t(e):t}var B0=eu({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:Qk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function eE(e,t,n){return B0(e,t,n)}var tE=require("@module-federation/enhanced/rspack");var U0=eu({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:tE.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Ar(e)!=="MiniCssExtractPlugin"});function nE(e,t,n){return U0(e,t,n)}var gm={[aE.Framework.React]:{generateWebpackBundlerConfig:Bk,generateRspackBundlerConfig:qc}},W0={webpack:{generateBaseConfig:Nk,getFrameworkConfig:(e,t)=>gm[e].generateWebpackBundlerConfig(t),generateFederationConfig:Mk,mergeConfigs:(e,t,n)=>eE(e,t,n),bundle:e=>zk({...e,config:e.config}),typeCheckerPlugin:oE.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Ar(t)==="MiniCssExtractPlugin"?new sE.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:Hk,getFrameworkConfig:(e,t)=>gm[e].generateRspackBundlerConfig(t),generateFederationConfig:Gk,mergeConfigs:(e,t,n)=>nE(e,t,n),bundle:e=>Zc({...e,config:e.config}),typeCheckerPlugin:iE.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Ar(t)==="CssExtractRspackPlugin"?new rE.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},Li=e=>W0[e],lE=e=>!!gm[e];var cE={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 tu(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:n,paths:r}=vk(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=dE.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=Li(t),a=b=>{let S=H0({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,d]=await Promise.all([s.bundle({...l,config:a(po.Environment.Server),outputPath:`/${po.Environment.Server}`}),s.bundle({...l,config:a(po.Environment.Client),outputPath:`/${po.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(cE)}`),u.debug(`Client Bundler Stats: ${d.toString(cE)}`));let p=Fk(o);u.debug("Packaging server bundle...");let m=await Ak(c.toJson().assets||[],o,p);u.debug("Packaging client bundle...");let h=await Ik(d.toJson().assets||[],o,p),g=b=>S=>[S,b];return{outputFiles:[...m.map(g(po.Environment.Server)),...h.map(g(po.Environment.Client))],outputVolume:o}}function H0({env:e,mode:t="production",framework:n,publicPath:r,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!lE(n))throw new Error(`Unknown framework: ${n}`);let d=Object.entries({[ra]:i[e],...o}).reduce((y,[b,S])=>{let _=(0,Ni.isAbsolute)(S)?S:(0,Ni.join)(c,S);return{...y,[`./${b}`]:`./${(0,Ni.relative)(c,_)}`}},{}),p=Li(l),m=p.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:r,outputPath:a,projectDir:c}),h=p.getFrameworkConfig(n,e),g=p.generateFederationConfig({exposes:d,env:e,libraryName:s});return(0,uE.default)(m,h,g)}var mE=w(require("path")),ym=require("memfs/lib/volume"),wm=w(require("webpack-merge")),gE=w(require("webpack-node-externals")),Gt=require("@webflow/data-types");var V0=w(require("fs")),ji=require("path"),Mi=require("webpack");function G0(e,t,n=V0){let r=(0,ji.join)(t,"node_modules",e);for(;r!==(0,ji.dirname)(r)&&r!=="node_modules";){let o=(0,ji.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,ji.dirname)(r)}return null}var nu=class{apply(t){let n=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(r){r.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Mi.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,d]=s.split("."),p=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=G0(y,n,r.inputFileSystem);if(!b)throw new Error(`Could not find package information for ${y}`);b&&m.add(b)}}),i[l]={sources:{...p,[`./${l}.${d}`]:c},dependencies:m},r.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{r.emitAsset(`${s}.js.map`,new Mi.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){r.errors.push(new Mi.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var pE=w(require("module")),fE=require("jsdom"),hm="__webflowCliImportModuleWindow__";function K0(e){let n=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),r=!!n,o=`module[${JSON.stringify(hm)}]`,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(`
|
|
98
|
+
export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function UD(e,t,r,n){let o={},i=`${_r}/Client.js`,s=`${_r}/Server.js`;o[i]=MD([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],Ia.Environment.Client);let a={},l=p=>{let f=C0(p);return a[f]?(a[f]+=1,`${f}${a[f]}`):(a[f]=1,f)};o[s]=MD([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([p])=>r[p]?.ssr??!0).map(([p,f])=>{let m=l(p),g=f.startsWith(_r)?f.replace(`${_r}/`,"./"):f;return{name:m,path:g,exportKey:p,isDefaultExport:!0,type:"component"}})],Ia.Environment.Server);let c={[Ia.Environment.Client]:i,[Ia.Environment.Server]:s};return{entryPointsVolume:BD.Volume.fromJSON(o,n),paths:c}}var AE=require("memfs/lib/volume");var KD=w(require("archiver")),Li=require("path");ke();var Ta=require("@webflow/data-types");ke();R();var Tn=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var WD=2;function HD(e){let t={type:Ta.ModuleLoader.FEDERATION,version:WD,entry:yf,renderer:aa,components:e};return{title:sa,content:JSON.stringify(t)}}function VD(e){let t={type:Ta.ModuleLoader.SSR,version:WD,entry:Ei,components:e};return{title:sa,content:JSON.stringify(t)}}function GD(e){let t=`/${Ta.Environment.Client}/${yf}`;try{if(e.existsSync(t)){let r=e.readFileSync(t,"utf8"),n=JSON.parse(r.toString()),o="publicPath"in n.metaData?n.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return n.exposes.reduce((i,s)=>{let a=s.name;return a===aa||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${Tn(o)}${l}`)})),i},{})}}catch(r){u.error(r,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Qc=require("@webflow/data-types"),F0=/\.css$/i;async function JD(e,t,r){let n=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Qc.Environment.Server}/${la}`,a=(0,KD.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",f=>(n=!0,i(f))),l.on("close",()=>{if(!n)try{let f={type:"asset",name:la,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let g=(0,Li.resolve)((0,Li.join)(`/${Qc.Environment.Server}`,m.name));t.existsSync(g)&&t.rmSync(g)}),o([f])}catch(f){return i(f)}finally{n=!0}}),a.pipe(l);let{title:c,content:p}=VD(r);a.append(p,{name:c}),e.forEach(f=>{if(!F0.test(f.name))try{let m=(0,Li.resolve)((0,Li.join)(`/${Qc.Environment.Server}`,f.name)),g=t.readFileSync(m,"utf8");a.append(g,{name:f.name})}catch(m){return n=!0,i(m)}}),await a.finalize()})}var zD=require("@webflow/data-types");async function qD(e,t,r){let{title:n,content:o}=HD(r);await t.promises.writeFile(`/${zD.Environment.Client}/${n}`,o);let i={type:"asset",name:n,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var DE=require("@rspack/core"),EE=w(require("fork-ts-checker-webpack-plugin")),vE=require("ts-checker-rspack-plugin"),SE=w(require("mini-css-extract-plugin")),xE=require("@webflow/data-types");var XD=require("webpack"),Em=w(require("mini-css-extract-plugin")),ZD=w(require("tsconfig-paths-webpack-plugin")),QD=require("tsconfig-paths"),vm=require("@webflow/data-types"),eE=require("path");ke();var YD=w(require("postcss-selector-parser")),Dm=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,YD.default)(r=>{r.walkPseudos(n=>{n.value===":root"&&(n.value=":host")})}).processSync(t.selector)})}});Dm.postcss=!0;Dm.postcssPlugin="CSSinShadowDOM";var eu=Dm;function _0(e){let t=(0,QD.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function tE({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Em.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[eu]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Em.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=_0(s);return l?new ZD.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===vm.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,eE.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===vm.Environment.Server)return{...a,plugins:[...a.plugins||[],new XD.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Ei,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var rE=require("@module-federation/enhanced"),Sm=require("@webflow/data-types");function nE({libraryName:e,env:t,exposes:r}){if(t===Sm.Environment.Client)return{plugins:[new rE.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Sm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function oE(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,use:[{ident:"babel-loader",loader:require.resolve("babel-loader"),options:{presets:[require.resolve("@babel/preset-env"),[require.resolve("@babel/preset-react"),{runtime:"automatic"}],require.resolve("@babel/preset-typescript")]}}]}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}function tu(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,loader:"builtin:swc-loader",options:{jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{runtime:"automatic",development:!1,refresh:!1}}}}}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}var ru=require("@rspack/core"),iE=require("tsconfig-paths"),xm=require("@webflow/data-types"),sE=require("path");ke();function A0(e){let t=(0,iE.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function aE({entry:e,env:t,mode:r="production",publicPath:n,libraryName:o,outputPath:i,projectDir:s}){let a={mode:r,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:ru.rspack.CssExtractRspackPlugin.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[eu]}}}],type:"javascript/auto"},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new ru.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=A0(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===xm.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,sE.join)(s,i,t):"/",publicPath:n,clean:!0,uniqueName:o},target:"web"};if(t===xm.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new ru.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:Ei,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var lE=require("@module-federation/enhanced/rspack"),Cm=require("@webflow/data-types");function cE({libraryName:e,env:t,exposes:r}){if(t===Cm.Environment.Client)return{plugins:[new lE.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:r,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Cm.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var I0=w(require("fs")),uE=require("unionfs"),dE=require("webpack");function R0(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function nu(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:r=>e.toString(r),toJson:()=>({...t,assets:(t.assets??[]).map(R0)})}}async function pE({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new uE.Union().use(I0));return new Promise((s,a)=>{let l=(0,dE.webpack)(e);l.inputFileSystem=i,r&&(l.outputFileSystem=r),n&&(l.outputPath=n),l.run((c,p)=>{l.close(f=>{c||f?a(c||f):p?p.hasErrors()||o&&p.hasWarnings()?a(new Error(p.toString("errors-warnings"))):s(nu(p)):a(new Error("Webpack stats are undefined"))})})})}var T0=w(require("fs")),Fm=w(require("webpack-merge")),fE=require("memfs"),mE=require("unionfs"),gE=require("@rspack/core");async function ou({config:e,sourceVolumes:t=[],outputVolume:r,outputPath:n,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new mE.Union().use(T0)),s=e;return t.length>0&&(s=(0,Fm.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),r&&(s=(0,Fm.default)(s,{output:{clean:!1,...n&&{path:n}}})),new Promise((a,l)=>{let c=(0,gE.rspack)(s);c.inputFileSystem=i,r&&(c.outputFileSystem=(0,fE.createFsFromVolume)(r)),n&&(c.outputPath=n),c.run((p,f)=>{c.close(m=>{p||m?l(p||m):f?f.hasErrors()||o&&f.hasWarnings()?l(new Error(f.toString("errors-warnings"))):a(nu(f)):l(new Error("Rspack stats are undefined"))})})})}var yE=require("@module-federation/enhanced");var Ni=w(require("webpack-merge"));R();function Pn(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function hE(e,t){let r=Object.entries(e).filter(([n])=>!t.includes(n));return Object.fromEntries(r)}function P0(e,t){return e instanceof t||Pn(e)==="ModuleFederationPlugin"}function su(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:r,getPluginOptions:n,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],p=$0(s),f=Array.isArray(l)?iu(...l.map(p)):iu(p(l));Object.keys(f).some(U=>c.includes(U))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let g={...hE(f,[...c,"ModuleFederationPlugin","module","plugins"]),module:hE(f.module??{},["rules"])},h=(0,Ni.default)(a,g),y=f.plugins??[];o&&(y=y.filter(o));let k=a.plugins??[],F=(0,Ni.mergeWithCustomize)({customizeArray:(0,Ni.unique)("plugins",t,U=>Pn(U))})({plugins:y},{plugins:k}).plugins,E=f?.ModuleFederationPlugin?.shared,S=F?.map(U=>{if(P0(U,r)){let N=n(U);return new r({...N,...E?{shared:E}:{}})}return U});h.plugins=S;let L=f.module?.rules;if(L&&typeof L=="function"){let U=a.module?.rules??[];h.module={...h.module??{},rules:L(U)}}return h}}function iu(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let r of e){let{module:n,ModuleFederationPlugin:o,plugins:i,...s}=r;if(t={...t,...s},n){let{rules:a,...l}=n;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=p=>{let f=c(p);return a(f)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function $0(e){return t=>typeof t=="function"?t(e):t}var O0=su({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:yE.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function wE(e,t,r){return O0(e,t,r)}var bE=require("@module-federation/enhanced/rspack");var L0=su({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:bE.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Pn(e)!=="MiniCssExtractPlugin"});function kE(e,t,r){return L0(e,t,r)}var _m={[xE.Framework.React]:{generateWebpackBundlerConfig:oE,generateRspackBundlerConfig:tu}},N0={webpack:{generateBaseConfig:tE,getFrameworkConfig:(e,t)=>_m[e].generateWebpackBundlerConfig(t),generateFederationConfig:nE,mergeConfigs:(e,t,r)=>wE(e,t,r),bundle:e=>pE({...e,config:e.config}),typeCheckerPlugin:EE.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Pn(t)==="MiniCssExtractPlugin"?new SE.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:aE,getFrameworkConfig:(e,t)=>_m[e].generateRspackBundlerConfig(t),generateFederationConfig:cE,mergeConfigs:(e,t,r)=>kE(e,t,r),bundle:e=>ou({...e,config:e.config}),typeCheckerPlugin:vE.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Pn(t)==="CssExtractRspackPlugin"?new DE.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},ji=e=>N0[e],CE=e=>!!_m[e];var FE={colors:!0,chunks:!1,modules:!1,chunkModules:!1,reasons:!1,errorDetails:!1,assetsSpace:1/0,warnings:!1,assets:!0,entrypoints:!0,performance:!0};async function au(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:r,paths:n}=UD(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=AE.Volume.fromJSON({"/Server":null,"/Client":null});u.debug("Generating bundling config...");let i=e.overrideConfig??{};Object.keys(i).length&&u.debug("Found bundle config overrides. Merging...");let s=ji(t),a=k=>{let v=j0({env:k,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:n,libraryName:e.libraryIdentifier,bundler:t,projectDir:e.projectDir}),F=s.mergeConfigs(k,v,i);return e?.debugBundler&&(u.info(`${t} config for env ${k}:`),u.dir(F)),F},l={sourceVolumes:[...e.sourceVolumes,r],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,p]=await Promise.all([s.bundle({...l,config:a(go.Environment.Server),outputPath:`/${go.Environment.Server}`}),s.bundle({...l,config:a(go.Environment.Client),outputPath:`/${go.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(FE)}`),u.debug(`Client Bundler Stats: ${p.toString(FE)}`));let f=GD(o);u.debug("Packaging server bundle...");let m=await JD(c.toJson().assets||[],o,f);u.debug("Packaging client bundle...");let g=await qD(p.toJson().assets||[],o,f),h=k=>v=>[v,k];return{outputFiles:[...m.map(h(go.Environment.Server)),...g.map(h(go.Environment.Client))],outputVolume:o}}function j0({env:e,mode:t="production",framework:r,publicPath:n,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!CE(r))throw new Error(`Unknown framework: ${r}`);let p=Object.entries({[aa]:i[e],...o}).reduce((y,[k,v])=>{let F=(0,Mi.isAbsolute)(v)?v:(0,Mi.join)(c,v);return{...y,[`./${k}`]:`./${(0,Mi.relative)(c,F)}`}},{}),f=ji(l),m=f.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:n,outputPath:a,projectDir:c}),g=f.getFrameworkConfig(r,e),h=f.generateFederationConfig({exposes:p,env:e,libraryName:s});return(0,_E.default)(m,g,h)}var TE=w(require("path")),Rm=require("memfs/lib/volume"),Im=w(require("webpack-merge")),PE=w(require("webpack-node-externals")),Kt=require("@webflow/data-types");var M0=w(require("fs")),Bi=require("path"),Ui=require("webpack");function B0(e,t,r=M0){let n=(0,Bi.join)(t,"node_modules",e);for(;n!==(0,Bi.dirname)(n)&&n!=="node_modules";){let o=(0,Bi.join)(n,"package.json");if(r.existsSync(o))try{let{name:i,version:s}=JSON.parse(r.readFileSync(o,"utf8"));return`${i}@${s}`}catch{return null}n=(0,Bi.dirname)(n)}return null}var lu=class{apply(t){let r=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(n){n.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Ui.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let o=n.getAssets(),i={};Object.values(o).forEach(({name:s,source:a})=>{if(!s.endsWith(".map"))return;let[l,c,p]=s.split("."),f=i[l]?.sources??{},m=i[l]?.dependencies??new Set;JSON.parse(a.source().toString()).sources.forEach(h=>{if(h.startsWith("external")){let y=h.match(/^external \S+ "(.+)"$/)?.[1];if(!y)throw new Error(`Could not extract package name from ${h}`);let k=B0(y,r,n.inputFileSystem);if(!k)throw new Error(`Could not find package information for ${y}`);k&&m.add(k)}}),i[l]={sources:{...f,[`./${l}.${p}`]:c},dependencies:m},n.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{n.emitAsset(`${s}.js.map`,new Ui.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){n.errors.push(new Ui.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var RE=w(require("module")),IE=require("jsdom"),Am="__webflowCliImportModuleWindow__";function U0(e){let r=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),n=!!r,o=`module[${JSON.stringify(Am)}]`,i=[];n||i.push('"use strict";'),i.push(`var __wfW = ${o};`,'if (__wfW == null) { throw new ReferenceError("Webflow CLI internal: missing JSDOM window on module"); }',"var window = __wfW;","var document = __wfW.document;","var navigator = __wfW.navigator;","var HTMLElement = __wfW.HTMLElement;","var localStorage = __wfW.localStorage;","var sessionStorage = __wfW.sessionStorage;","var requestAnimationFrame = __wfW.requestAnimationFrame.bind(__wfW);","var cancelAnimationFrame = __wfW.cancelAnimationFrame.bind(__wfW);","var getComputedStyle = __wfW.getComputedStyle.bind(__wfW);","var performance = __wfW.performance;","");let s=i.join(`
|
|
60
99
|
`)+`
|
|
61
|
-
`;return
|
|
62
|
-
`)}function
|
|
63
|
-
`)}async function
|
|
100
|
+
`;return r?e.slice(0,r[0].length)+s+e.slice(r[0].length):s+e}function Pa(e,t){let r=e.readFileSync(t,"utf-8"),o=new IE.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=U0(r),s=new RE.default(t,module);Object.defineProperty(s,Am,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,Am),o.close()}}function W0(e,t){let r=`/${t}.js`,n=Pa(e,r),o=n.exports.default||n.exports;if(o&&typeof o=="object")try{return(0,Kt.parseComponentMetadata)(o)}catch(i){let s=i instanceof Error?i.stack:String(i);throw new Error(`Error parsing component data for '${t}': ${s}`)}throw new Error(`Could not get declaration for '${t}'`)}async function H0({declarations:e,sources:t,overrideConfig:r={},performTypeCheck:n,bundler:o="webpack",projectDir:i}){let s=new Rm.Volume,a=ji(o),l=(0,Im.default)(a.generateBaseConfig({entry:e,env:Kt.Environment.Client,publicPath:"/",libraryName:"metadata",projectDir:i}),a.getFrameworkConfig(Kt.Framework.React,Kt.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:n?[new a.typeCheckerPlugin]:[]}),c=a.mergeConfigs(Kt.Environment.Client,l,r);return await a.bundle({outputPath:"/",config:c,sourceVolumes:t?[t]:[],outputVolume:s,failOnWarnings:!1}),s}async function V0({declarations:e,sources:t,overrideConfig:r={},bundler:n,projectDir:o}){let i=new Rm.Volume,s=ji(n),a=(0,Im.default)(s.generateBaseConfig({entry:e,env:Kt.Environment.Client,publicPath:"/",libraryName:"source-maps",projectDir:o}),s.getFrameworkConfig(Kt.Framework.React,Kt.Environment.Client),{entry:e,mode:"production",optimization:{mangleExports:"deterministic",moduleIds:"deterministic",chunkIds:"deterministic"},output:{filename:"[name].[contenthash].js",path:"/",library:{type:"commonjs2"},devtoolModuleFilenameTemplate:"[resource-path]",hashFunction:s.hashFunction},externalsPresets:{node:!0},devtool:"source-map",plugins:[new lu],externals:[(0,PE.default)()]}),l=s.mergeConfigs(Kt.Environment.Client,a,r);return l=s.replaceCssPlugin(l),await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}function G0(e){return Object.entries(e.toJSON()).reduce((t,[r,n])=>{if(r.endsWith(".map")&&n?.length){let o=TE.default.basename(r).split(".")[0];t[o]=n}return t},{})}async function cu({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n=!1,skipSourceMaps:o=!1,bundler:i="webpack",projectDir:s}){let[a,l]=await Promise.all([H0({declarations:e,sources:t,overrideConfig:r,performTypeCheck:n,bundler:i,projectDir:s}),o||i==="rspack"?Promise.resolve(null):V0({declarations:e,sources:t,overrideConfig:r,bundler:i,projectDir:s})]),{metadata:c,options:p}=Object.keys(e).reduce((m,g)=>{let h=W0(a,g);return m.metadata[g]=h,m.options[g]=h.options||{},m},{metadata:{},options:{}});return{sourceMaps:l?G0(l):{},metadata:c,options:p}}function $E(e,{framework:t,sourceMaps:r}){return Object.fromEntries(Object.keys(e).map(n=>[n,{...e[n],id:n,framework:t,exportPath:"default",hash:r[n]}]))}Oe();var LE=w(require("md5"));we();me();j();var Tm=" ",NE=`${Tm}${lc} `;function K0(e){return e==="added"?` ${z("(Added)")}`:e==="removed"?` ${ue("(Removed)")}`:e==="changed"?` ${Ne("(Changed)")}`:""}function OE(e){if(!e)return"";let t=JSON.parse(e);return(0,LE.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(r=>!r.includes("@webflow/data-types")&&!r.includes("@webflow/react"))].sort()))}function J0({componentsMetadata:e,latestVersion:t,sourceMaps:r}){let n=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(n).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=OE(r[s]),p=a.displayName&&l.displayName!==a.displayName,f=c&&a.hash&&c!==OE(a.hash),m=p||f;o[s]={component:l,status:m?"changed":"unchanged",previousName:p?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{n[s]||(o[s]={component:a,status:"added"})}),Object.values(o).map(({component:s,status:a,previousName:l})=>{let c=s.displayName??"Unknown Component",p=l?`${l} ${rt} ${c}`:c;return`${P(`${NE}${p}`)}${K0(a)}`}).sort().join(`
|
|
101
|
+
`)}function z0({componentsMetadata:e}){return Object.values(e).map(r=>`${P(NE+(r.displayName??"Unknown Component"))}`).sort().join(`
|
|
102
|
+
`)}async function jE({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:r,sourceMaps:n,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?r.find(({profile:p})=>p.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?J0({componentsMetadata:t,latestVersion:i,sourceMaps:n}):z0({componentsMetadata:t}),l=s?`Ready to update ${Ne(e.name)} on ${yp(o.name)}?`:`Ready to share ${Ne(e.name)} with ${yp(o.name)}?`;return await $e({message:`${l}
|
|
64
103
|
|
|
65
|
-
${
|
|
104
|
+
${Tm}${P("Code components:")}
|
|
66
105
|
${a}
|
|
67
106
|
|
|
68
|
-
${
|
|
69
|
-
import componentDefinition from ${
|
|
107
|
+
${Tm}Confirm to proceed`})}var uu=require("path"),UE=require("memfs/lib/volume");var ME=w(require("fast-glob")),q0=e=>{let t=e.split("/");return t[t.length-1]},Y0=e=>q0(e).split(".")[0];async function BE(e,t){return(await ME.default.glob(e,{absolute:!0,...t||{}})).reduce((n,o)=>{let i=Y0(o);if(n[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${n[i]}, but also found at ${o}.`);return{...n,[i]:o}},{})}function It(e){return e.replace(/\\/g,"/")}async function du(e,t){let r=await BE(e.components,{cwd:(0,uu.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(i=>i!=null)});if(!Object.keys(r).length)throw new Error("No declaration files found");let{componentsFiles:n,componentsVolume:o}=X0(r,e.renderer.client,e.globals,t);return{componentsFiles:n,componentsVolume:o}}function X0(e,t,r,n){let o={},i={};return Object.entries(e).forEach(([s,a])=>{let l=(0,uu.extname)(a),c=`${_r}/${jD}/${s}${l}`;o[s]=c,i[c]=Z0(t,a,r)}),{componentsFiles:o,componentsVolume:UE.Volume.fromJSON(i,n)}}function Z0(e,t,r){let n=JSON.stringify(It(t)),o=JSON.stringify(It(e));if(!r)return`
|
|
108
|
+
import componentDefinition from ${n};
|
|
70
109
|
export default {...componentDefinition};
|
|
71
|
-
`.trim();let i=JSON.stringify(
|
|
110
|
+
`.trim();let i=JSON.stringify(It(r));return`
|
|
72
111
|
import { applyDecorators } from ${o};
|
|
73
|
-
import componentDefinition from ${
|
|
112
|
+
import componentDefinition from ${n};
|
|
74
113
|
const globals = require(${i}) || {};
|
|
75
114
|
|
|
76
115
|
const globalDecorators = globals?.decorators || [];
|
|
@@ -87,210 +126,173 @@ if (componentDefinition?.component) {
|
|
|
87
126
|
}
|
|
88
127
|
|
|
89
128
|
export default decoratedDefinition;
|
|
90
|
-
`.trim()}
|
|
91
|
-
Resolved path: ${
|
|
92
|
-
Please ensure the file exists or remove the 'globals' field from your manifest.`);
|
|
93
|
-
Resolved path: ${
|
|
94
|
-
Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);
|
|
95
|
-
export * from "${
|
|
96
|
-
`,[
|
|
129
|
+
`.trim()}Y();Gc();var fu=require("path");var WE=require("@webflow/data-types"),pu={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:WE.Framework.React};var en=require("path"),Wi=require("fs");Oe();R();Pe();we();C();me();j();function HE(e,t){let r={...e};if(e.globals){let n=(0,en.resolve)(t,e.globals);if(!(0,Wi.existsSync)(n))throw new Error(`Globals file not found: ${e.globals}
|
|
130
|
+
Resolved path: ${n}
|
|
131
|
+
Please ensure the file exists or remove the 'globals' field from your manifest.`);r.globals=It(n)}if(e.bundleConfig){let n=(0,en.resolve)(t,e.bundleConfig);if(!(0,Wi.existsSync)(n))throw new Error(`Bundle config file not found: ${e.bundleConfig}
|
|
132
|
+
Resolved path: ${n}
|
|
133
|
+
Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);r.bundleConfig=It(n)}if(typeof e.renderer=="string"){let n=(0,en.resolve)(t,e.renderer);(0,Wi.existsSync)(n)&&(r.renderer=It(n))}else if(typeof e.renderer=="object"&&typeof r.renderer=="object"){if(typeof e.renderer.client=="string"){let n=(0,en.resolve)(t,e.renderer.client);(0,Wi.existsSync)(n)&&(r.renderer={...r.renderer,client:It(n)})}if(typeof e.renderer.server=="string"){let n=(0,en.resolve)(t,e.renderer.server);(0,Wi.existsSync)(n)&&(r.renderer={...r.renderer,server:It(n)})}}return r}async function Q0({initialData:e}){let t=await Ge({message:"Enter a name for your code library",validate:o=>o.trim()===""?"The library name cannot be empty.":!0,default:e?.name});if(t==null)throw new d("When --no-input mode is enabled please provide a name in your library manifest");let r=await Ge({message:"Enter a description for your code library",default:e?.description??""});if(!await $e({message:"Is the code (including 3rd party packages) you are uploading to Webflow trusted and secure?"}))throw new Error("Code library is not trusted and secure");return{name:t,description:r}}async function eT({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},n=[...e].sort((i,s)=>{let a=i.resource.codeLibraryResource.manifest.name??"",l=s.resource.codeLibraryResource.manifest.name??"",c=a.localeCompare(l,void 0,{sensitivity:"base"});return c!==0?c:i.profile.slug.localeCompare(s.profile.slug,void 0,{sensitivity:"base"})}).map(({resource:i,profile:s})=>{let a=`${i.codeLibraryResource.manifest.name} (${s.slug})`;s.status==="ARCHIVED"&&(a+=` ${ue("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await pc({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...n];let s=i.toLowerCase(),a=n.filter(l=>{let c=l.value?.id??"",p=l.value?.name??"",f=l.value?.description??"";return c.toLowerCase().includes(s)||p.toLowerCase().includes(s)||f.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function Pm({initialData:e,existingCodeLibraries:t}){let r,n={components:pu.components},o=t.length>0?await eT({existingCodeLibraries:t}):null;if(o)r={...n,...o,...e,id:o.id};else{let a=await Q0({initialData:e});r={...n,...e,...a}}let{path:i}=cr(),s=HE(r,(0,en.dirname)(i));return Se({library:s}),u.info(`${$} Library configuration updated in webflow.json`),{libraryManifest:s,manifestPath:i}}async function VE({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:r,manifestPath:n}=oe(),o=ea(r,"library");if(!o.id){if(lr())return t.succeed(),Pm({initialData:o,existingCodeLibraries:e});throw new Error("Library manifest does not have an id")}let i=o.name??e.find(({profile:a})=>a.slug===o.id)?.resource.codeLibraryResource.manifest.name;if(!i&&lr())return t.succeed(),Pm({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=HE({...o,name:i},(0,en.dirname)(n));return Promise.resolve({libraryManifest:s,manifestPath:n})}catch(r){if(r instanceof oo&&lr())return t.info(r.message),Pm({existingCodeLibraries:e});throw t.fail(),r}}var $m=require("memfs/lib/volume"),JE=w(require("webpack-merge"));var zE="/client-renderer.js",qE="/server-renderer.js",GE=`${_r}/test-renderers${zE}`,KE=`${_r}/test-renderers${qE}`,tT=new Set(["@webflow/react"]),rT=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function YE(e,t){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(tT.has(e.client)&&rT.has(e.server))return;let r=await iT(e,t);nT(e.client,r),oT(e.server,r)}function nT(e,t){let r=Pa(t,zE);if(typeof r.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof r.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let n=()=>null,o=r.exports.ClientRenderer(n),i=["mount","hydrate","render","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid client renderer: ${e} ClientRenderer must return an object with a '${s}' function.`)}function oT(e,t){let r=Pa(t,qE);if(typeof r.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let n=()=>null,o=r.exports.ServerRenderer(n),i=["renderToStream","renderToString","prerenderToString","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid server renderer: ${e} ServerRenderer must return an object with a '${s}' function.`)}async function iT(e,t){let r=new $m.Volume,n=It(e.client),o=It(e.server),i={[GE]:`
|
|
134
|
+
export * from "${n}";
|
|
135
|
+
`,[KE]:`
|
|
97
136
|
export * from "${o}";
|
|
98
|
-
`},s=(0,
|
|
99
|
-
|
|
100
|
-
${Object.entries(a).reduce((d,[p,m])=>(d+=`${p}: ${JSON.stringify(JSON.parse(m),null,2)}
|
|
101
|
-
|
|
102
|
-
`,d),"")}`),{componentsFiles:i,componentsVolume:s,componentsMetadata:l,componentsOptions:c,sourceMaps:a}})}async function pI(e,t,n,r,o,i,s){let{trackPerformance:a,libraryConfig:l,projectDir:c}=e;return await a("generate_library_bundle",async()=>await tu({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:_r(i[Ui.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 fI(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,fo.resolve)((0,fo.join)(`/${c}`,`${l.name}`));return xa(n.readFileSync(d,"utf8").toString(),d,{bundleEnvironment:c})}),{signatures:a}=await sm({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 Ca(c,l.value)}))})}async function mI(e,t,n,r,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:_r(o[Ui.Environment.Client])+na,loaderType:Ui.ModuleLoader.FEDERATION},serverModule:{bundleUrl:_r(o[Ui.Environment.Server])+oa}},c=hE(t,{framework:s.framework,sourceMaps:n}),{taskId:d}=await am({resourceId:r,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:d},null,2))})}async function Em(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=Eb(o,"share_library");try{u.debug("Checking dependencies versions..."),new oo().run();let s={apiToken:r};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await om({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let d=await lu({existingCodeLibraries:c}),p=d.bundleConfig?require(d.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:d,overrideConfig:p,projectDir:(0,fo.resolve)((0,fo.dirname)(d.manifestPath))};t=u.spinner("Collecting metadata");let{componentsFiles:h,componentsVolume:g,componentsMetadata:y,componentsOptions:b,sourceMaps:S}=await dI(m,e);if(t.succeed(),!await DE({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 im({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||(xe({library:{id:x}}),u.info(`${P} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:we,outputVolume:Se}=await pI(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 fI(m,we,Se,v),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:d.name,fileCount:we.length,resourceId:v,profileSlug:x}),t=u.spinner("Sharing library"),await mI(m,y,S,v,B),t.succeed(),u.success(`Code library shared successfully${O?.slug?`: ${xn()}/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 cu=w(require("fs")),An=require("path");A();Mc();C();var gI="CodeLibrary",hI="dist",yI="http://localhost/";async function vm(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new oo().run(),u.debug("Looking for manifest...");let n=await lu({existingCodeLibraries:[]}),r=Kc(n.name)||gI,o=`_${e.libraryId||r}`,i=(0,An.resolve)((0,An.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 iu(n,i);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(s,null,2)}`);let l=n.bundleConfig?require(n.bundleConfig):{},{sourceMaps:c,metadata:d,options:p}=await ru({declarations:s,sources:a,overrideConfig:l,performTypeCheck:jc(s,e,i),skipSourceMaps:!e?.debugBundler,bundler:e.bundler,projectDir:i});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(d,null,2)}`),u.debug(`Source Maps:
|
|
103
|
-
|
|
104
|
-
${Object.entries(c).reduce((g,[y,b])=>(g+=`${y}: ${JSON.stringify(JSON.parse(b),null,2)}
|
|
137
|
+
`},s=(0,JE.default)(tu(),{context:t,entry:{"client-renderer":GE,"server-renderer":KE},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await ou({config:s,sourceVolumes:[$m.Volume.fromJSON(i,t)],outputVolume:r,failOnWarnings:!1}),r}async function mu({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:r}=await VE({existingCodeLibraries:e}),n=(0,fu.resolve)((0,fu.dirname)(r)),{renderer:o,...i}=pu,s=typeof t.renderer=="string"?{client:t.renderer,server:t.renderer}:{client:t.renderer?.client??o.client,server:t.renderer?.server??o.server};return s.server==="@webflow/react"&&(s.server="@webflow/react/server"),await YE(s,n),{...i,...t,renderer:s,manifestPath:r}}C();j();async function sT(e,t){let{trackPerformance:r,libraryConfig:n,projectDir:o}=e;return await r("collect_metadata",async()=>{let{componentsFiles:i,componentsVolume:s}=await du(n,o);u.debug(`Components: ${JSON.stringify(i,null,2)}`);let{sourceMaps:a,metadata:l,options:c}=await cu({declarations:i,sources:s,overrideConfig:e.overrideConfig,performTypeCheck:Vc(i,t,o),bundler:t?.bundler,projectDir:o});return u.debug(`Metadata: ${JSON.stringify(l,null,2)}`),u.debug(`Source Maps:
|
|
105
138
|
|
|
106
|
-
|
|
107
|
-
Use ${J("webflow devlink import")} instead.
|
|
108
|
-
`)},kI=()=>{u.warn(`${Q} ${le("webflow library bundle")} is deprecated and will be removed in the next major release.
|
|
109
|
-
Use ${J("webflow devlink bundle")} instead.
|
|
110
|
-
`)},EI=()=>{u.warn(`${Q} ${le("webflow library log")} is deprecated and will be removed in the next major release.
|
|
111
|
-
Use ${J("webflow log")} instead.
|
|
112
|
-
`)},vI="Import a library of Code Components into your Webflow Workspace.",SI="Bundle a library of Code Components for local development.",$E=()=>new Rr.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),OE=()=>new Rr.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),LE=()=>new Rr.Option("--dev","Bundle in development mode for debugging purposes."),NE=()=>new Rr.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),xI=()=>new Rr.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),CI=()=>new Rr.Option("--public-path <path>","Set the public path for the bundle."),FI=()=>new Rr.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function Cm(e,t){return e.command(t).description(vI).addOption(zn()).addOption($E()).addOption(OE()).addOption(LE()).addOption(NE()).action(Da(Em))}function Fm(e,t){return e.command(t).description(SI).addOption(xI()).addOption(CI()).addOption(FI()).addOption($E()).addOption(OE()).addOption(LE()).addOption(NE()).action(Da(vm))}var jE=e=>{let t=e.command("library").description(bI);Cm(t,"share").description(`${le("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",DI),Fm(t,"bundle").description(`${le("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",kI),t.command("log").description(`${le("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",EI).action(xm)};pe();var ME=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(zn()).addOption(It()).action(YD),Cm(t,"import"),Fm(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(zn()).addOption(It()).action(Da(Hc))};var er=w(require("fs")),Kt=w(require("path"));A();q();var Fe={New:"new",Existing:"existing"},BE="cli",Zn=3,Qn=39,uu="astro",UE="cloud-scaffolds";var WE="package.json",mo="webflow.json",du="wf-placeholder-name",HE="CLOUD_MOUNT_PATH",VE="gitignore";function _m(e){return!e.siteId}var Ia=async(e,t,n=uu,r,o,i)=>{try{let s,a;if("content"in r){let l=r.content;s=l.files,a=c=>Kt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=r[n];if(!c)throw new Error(`Scaffold "${n}" not found`);s=c;let d=Kt.join(UE,n);a=p=>p.split(d)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=Kt.join(e,a(l)),d=l.includes("next.config.ts"),p=l.includes("astro.config.mjs"),m=d||p;if(l.includes(mo)&&er.existsSync(c))continue;if(l.includes(WE)||l.includes(mo)){let g=(await er.promises.readFile(l,"utf8")).replace(du,e);await pu(c,g)}else if(m){let h=await er.promises.readFile(l,"utf8");await pu(c,h.replace(HE,t))}else if(Kt.basename(c).toLowerCase()===VE){let h=await er.promises.readFile(l,"utf8"),g=Kt.join(Kt.dirname(c),".gitignore");await pu(g,h)}else{let h=await er.promises.readFile(l);await pu(c,h)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Jn({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 pu=async(e,t)=>{try{await er.promises.mkdir(Kt.dirname(e),{recursive:!0}),await er.promises.writeFile(e,t)}catch(n){throw u.error(`Error writing file ${e}: ${n}`),n}};var Ir=w(require("fs")),GE=w(require("fs-extra")),Tr=w(require("path")),Pm=w(require("os")),KE=w(require("tar"));var tt=class extends Error{constructor(n,r,o){super(n);this.scaffoldId=r;this.supportedIds=o;this.name="ScaffoldError"}};var Ta={"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 Pa(e){let t=Ta[e];if(!t){let n=Object.keys(Ta);throw new tt(`Unsupported framework: "${e}". Supported: ${n.join(", ")}`,e,n)}return t}function Am(){return Object.keys(Ta)}function Rm(){return[...new Set(Am().map(e=>e.replace(/-minimal$/,"")))]}function Im(){return["astro","nextjs"]}function Tm(e){let n=`${e.replace(/-minimal$/,"")}-minimal`;if(!Ta[n]){let r=Am();throw new tt(`No minimal scaffold for "${e}". Supported: ${r.join(", ")}`,n,r)}return n}A();Kn();var _I="https://github.com";async function $m(e){let t=e.endsWith("-minimal")?e:Tm(e);return fu(t)}async function fu(e){return Pa(e).source.type==="github"?AI(e):JE(e)}async function JE(e){let t=Pa(e);if(t.source.type!=="local")throw new tt(`Scaffold "${e}" does not have a local source`,e);let n=Tr.isAbsolute(t.source.path)?t.source.path:Tr.join(__dirname,t.source.path);if(!Ir.existsSync(n))throw new tt(`Scaffold directory not found: ${n}`,e);let r=await Om(n);return{scaffoldId:e,files:r,extractionRoot:n}}async function AI(e){let t=Pa(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=`${_I}/${t.source.repo}/archive/${n}.tar.gz`,o=await Ir.promises.mkdtemp(Tr.join(Pm.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 RI(a,o),l.succeed("Scaffold ready")}catch(h){throw l.fail("Unpack failed"),h}let c=await Ir.promises.readdir(o),d=c[0];if(!d||c.length!==1)throw new tt(`Unexpected tarball structure for ${t.source.repo}`,e);let p=Tr.join(o,d),m=await Om(p);return{scaffoldId:e,files:m,extractionRoot:p}}catch(s){try{GE.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 RI(e,t){let n=Tr.join(Pm.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await Ir.promises.writeFile(n,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await KE.extract({file:n,cwd:t})}finally{await Ir.promises.unlink(n).catch(()=>{})}}async function Om(e){let t=[],n=await Ir.promises.readdir(e,{withFileTypes:!0});for(let r of n){let o=Tr.join(e,r.name);r.isDirectory()?t.push(...await Om(o)):t.push(o)}return t}var lg=w(require("fs-extra"));q();X();var oe=w(require("fs")),ue=w(require("path")),qa=require("child_process"),jv=w(require("tar"));var mt=w(require("fs")),mn=w(require("path"));var j={};Vy(j,{BRAND:()=>nT,DIRTY:()=>go,EMPTY_PATH:()=>$I,INVALID:()=>Y,NEVER:()=>BT,OK:()=>pt,ParseStatus:()=>rt,Schema:()=>ae,ZodAny:()=>Or,ZodArray:()=>or,ZodBigInt:()=>yo,ZodBoolean:()=>wo,ZodBranded:()=>Oa,ZodCatch:()=>Ao,ZodDate:()=>bo,ZodDefault:()=>_o,ZodDiscriminatedUnion:()=>hu,ZodEffects:()=>qt,ZodEnum:()=>Co,ZodError:()=>Dt,ZodFirstPartyTypeKind:()=>te,ZodFunction:()=>wu,ZodIntersection:()=>vo,ZodIssueCode:()=>R,ZodLazy:()=>So,ZodLiteral:()=>xo,ZodMap:()=>Ji,ZodNaN:()=>qi,ZodNativeEnum:()=>Fo,ZodNever:()=>dn,ZodNull:()=>ko,ZodNullable:()=>Tn,ZodNumber:()=>ho,ZodObject:()=>kt,ZodOptional:()=>Jt,ZodParsedType:()=>W,ZodPipeline:()=>La,ZodPromise:()=>Lr,ZodReadonly:()=>Ro,ZodRecord:()=>yu,ZodSchema:()=>ae,ZodSet:()=>zi,ZodString:()=>$r,ZodSymbol:()=>Gi,ZodTransformer:()=>qt,ZodTuple:()=>In,ZodType:()=>ae,ZodUndefined:()=>Do,ZodUnion:()=>Eo,ZodUnknown:()=>rr,ZodVoid:()=>Ki,addIssueToContext:()=>N,any:()=>dT,array:()=>gT,bigint:()=>sT,boolean:()=>ov,coerce:()=>MT,custom:()=>tv,date:()=>aT,datetimeRegex:()=>QE,defaultErrorMap:()=>tr,discriminatedUnion:()=>bT,effect:()=>IT,enum:()=>_T,function:()=>xT,getErrorMap:()=>Wi,getParsedType:()=>Rn,instanceof:()=>oT,intersection:()=>DT,isAborted:()=>mu,isAsync:()=>Hi,isDirty:()=>gu,isValid:()=>Pr,late:()=>rT,lazy:()=>CT,literal:()=>FT,makeIssue:()=>$a,map:()=>vT,nan:()=>iT,nativeEnum:()=>AT,never:()=>fT,null:()=>uT,nullable:()=>PT,number:()=>rv,object:()=>hT,objectUtil:()=>Lm,oboolean:()=>jT,onumber:()=>NT,optional:()=>TT,ostring:()=>LT,pipeline:()=>OT,preprocess:()=>$T,promise:()=>RT,quotelessJson:()=>II,record:()=>ET,set:()=>ST,setErrorMap:()=>PI,strictObject:()=>yT,string:()=>nv,symbol:()=>lT,transformer:()=>IT,tuple:()=>kT,undefined:()=>cT,union:()=>wT,unknown:()=>pT,util:()=>de,void:()=>mT});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 Lm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Lm||(Lm={}));var W=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rn=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"]),II=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 TI=(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}},tr=TI;var zE=tr;function PI(e){zE=e}function Wi(){return zE}var $a=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}},$I=[];function N(e,t){let n=Wi(),r=$a({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===tr?void 0:tr].filter(o=>!!o)});e.common.issues.push(r)}var rt=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"}),go=e=>({status:"dirty",value:e}),pt=e=>({status:"valid",value:e}),mu=e=>e.status==="aborted",gu=e=>e.status==="dirty",Pr=e=>e.status==="valid",Hi=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 zt=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}},qE=(e,t)=>{if(Pr(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 Rn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Rn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Rn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Hi(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:Rn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return qE(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rn(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Pr(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=>Pr(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:Rn(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Hi(o)?o:Promise.resolve(o));return qE(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 qt({schema:this,typeName:te.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 Jt.create(this,this._def)}nullable(){return Tn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return or.create(this)}promise(){return Lr.create(this,this._def)}or(t){return Eo.create([this,t],this._def)}and(t){return vo.create(this,t,this._def)}transform(t){return new qt({...ie(this._def),schema:this,typeName:te.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new _o({...ie(this._def),innerType:this,defaultValue:n,typeName:te.ZodDefault})}brand(){return new Oa({typeName:te.ZodBranded,type:this,...ie(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Ao({...ie(this._def),innerType:this,catchValue:n,typeName:te.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return La.create(this,t)}readonly(){return Ro.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},OI=/^c[^\s-]{8,}$/i,LI=/^[0-9a-z]+$/,NI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jI=/^[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,MI=/^[a-z0-9_-]{21}$/i,BI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,UI=/^[-+]?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)?)??$/,WI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,HI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Nm,VI=/^(?:(?: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])$/,GI=/^(?:(?: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])$/,KI=/^(([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]))$/,JI=/^(([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])$/,zI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,YE="((\\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])))",XI=new RegExp(`^${YE}$`);function ZE(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 YI(e){return new RegExp(`^${ZE(e)}$`)}function QE(e){let t=`${YE}T${ZE(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 ZI(e,t){return!!((t==="v4"||!t)&&VI.test(e)||(t==="v6"||!t)&&KI.test(e))}function QI(e,t){if(!BI.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 eT(e,t){return!!((t==="v4"||!t)&&GI.test(e)||(t==="v6"||!t)&&JI.test(e))}var $r=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 rt,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")WI.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")Nm||(Nm=new RegExp(HI,"u")),Nm.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")jI.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")MI.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")OI.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")LI.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")NI.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"?QE(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"?XI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?YI(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"?UI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"duration",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?ZI(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"?QI(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"?eT(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"?zI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?qI.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}};$r.create=e=>new $r({checks:[],typeName:te.ZodString,coerce:e?.coerce??!1,...ie(e)});function tT(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 ho=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 rt;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"?tT(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)}};ho.create=e=>new ho({checks:[],typeName:te.ZodNumber,coerce:e?.coerce||!1,...ie(e)});var yo=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 rt;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}};yo.create=e=>new yo({checks:[],typeName:te.ZodBigInt,coerce:e?.coerce??!1,...ie(e)});var wo=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 pt(t.data)}};wo.create=e=>new wo({typeName:te.ZodBoolean,coerce:e?.coerce||!1,...ie(e)});var bo=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 rt,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}};bo.create=e=>new bo({checks:[],coerce:e?.coerce||!1,typeName:te.ZodDate,...ie(e)});var Gi=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 pt(t.data)}};Gi.create=e=>new Gi({typeName:te.ZodSymbol,...ie(e)});var Do=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 pt(t.data)}};Do.create=e=>new Do({typeName:te.ZodUndefined,...ie(e)});var ko=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 pt(t.data)}};ko.create=e=>new ko({typeName:te.ZodNull,...ie(e)});var Or=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(t){return pt(t.data)}};Or.create=e=>new Or({typeName:te.ZodAny,...ie(e)});var rr=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(t){return pt(t.data)}};rr.create=e=>new rr({typeName:te.ZodUnknown,...ie(e)});var dn=class extends ae{_parse(t){let n=this._getOrReturnCtx(t);return N(n,{code:R.invalid_type,expected:W.never,received:n.parsedType}),Y}};dn.create=e=>new dn({typeName:te.ZodNever,...ie(e)});var Ki=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 pt(t.data)}};Ki.create=e=>new Ki({typeName:te.ZodVoid,...ie(e)});var or=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 zt(n,s,n.path,a)))).then(s=>rt.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new zt(n,s,n.path,a)));return rt.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)}};or.create=(e,t)=>new or({type:e,minLength:null,maxLength:null,exactLength:null,typeName:te.ZodArray,...ie(t)});function Vi(e){if(e instanceof kt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Jt.create(Vi(r))}return new kt({...e._def,shape:()=>t})}else return e instanceof or?new or({...e._def,type:Vi(e.element)}):e instanceof Jt?Jt.create(Vi(e.unwrap())):e instanceof Tn?Tn.create(Vi(e.unwrap())):e instanceof In?In.create(e.items.map(t=>Vi(t))):e}var kt=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 dn&&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 zt(o,p,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof dn){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: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 d of a){let p=o.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new zt(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=>rt.mergeObjectSync(r,c)):rt.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:te.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 Vi(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 Jt;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return ev(de.objectKeys(this.shape))}};kt.create=(e,t)=>new kt({shape:()=>e,unknownKeys:"strip",catchall:dn.create(),typeName:te.ZodObject,...ie(t)});kt.strictCreate=(e,t)=>new kt({shape:()=>e,unknownKeys:"strict",catchall:dn.create(),typeName:te.ZodObject,...ie(t)});kt.lazycreate=(e,t)=>new kt({shape:e,unknownKeys:"strip",catchall:dn.create(),typeName:te.ZodObject,...ie(t)});var Eo=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: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},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:R.invalid_union,unionErrors:a}),Y}}get options(){return this._def.options}};Eo.create=(e,t)=>new Eo({options:e,typeName:te.ZodUnion,...ie(t)});var nr=e=>e instanceof So?nr(e.schema):e instanceof qt?nr(e.innerType()):e instanceof xo?[e.value]:e instanceof Co?e.options:e instanceof Fo?de.objectValues(e.enum):e instanceof _o?nr(e._def.innerType):e instanceof Do?[void 0]:e instanceof ko?[null]:e instanceof Jt?[void 0,...nr(e.unwrap())]:e instanceof Tn?[null,...nr(e.unwrap())]:e instanceof Oa||e instanceof Ro?nr(e.unwrap()):e instanceof Ao?nr(e._def.innerType):[],hu=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=nr(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:te.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ie(r)})}};function jm(e,t){let n=Rn(e),r=Rn(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=jm(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=jm(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 vo=class extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(mu(i)||mu(s))return Y;let a=jm(i.value,s.value);return a.valid?((gu(i)||gu(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}))}};vo.create=(e,t,n)=>new vo({left:e,right:t,typeName:te.ZodIntersection,...ie(n)});var In=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 zt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>rt.mergeArray(n,s)):rt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};In.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new In({items:e,typeName:te.ZodTuple,rest:null,...ie(t)})};var yu=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 zt(r,a,r.path,a)),value:s._parse(new zt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?rt.mergeObjectAsync(n,o):rt.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:te.ZodRecord,...ie(r)}):new e({keyType:$r.create(),valueType:t,typeName:te.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: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 zt(r,a,r.path,[c,"key"])),value:i._parse(new zt(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:te.ZodMap,...ie(n)});var zi=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 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 zt(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)}};zi.create=(e,t)=>new zi({valueType:e,minSize:null,maxSize:null,typeName:te.ZodSet,...ie(t)});var wu=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 $a({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Wi(),tr].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:l}})}function o(a,l){return $a({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Wi(),tr].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 Lr){let a=this;return pt(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 pt(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:In.create(t).rest(rr.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||In.create([]).rest(rr.create()),returns:n||rr.create(),typeName:te.ZodFunction,...ie(r)})}},So=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})}};So.create=(e,t)=>new So({getter:e,typeName:te.ZodLazy,...ie(t)});var xo=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}};xo.create=(e,t)=>new xo({value:e,typeName:te.ZodLiteral,...ie(t)});function ev(e,t){return new Co({values:e,typeName:te.ZodEnum,...ie(t)})}var Co=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 pt(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})}};Co.create=ev;var Fo=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 pt(t.data)}get enum(){return this._def.values}};Fo.create=(e,t)=>new Fo({values:e,typeName:te.ZodNativeEnum,...ie(t)});var Lr=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 pt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Lr.create=(e,t)=>new Lr({type:e,typeName:te.ZodPromise,...ie(t)});var qt=class extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===te.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"?go(l.value):n.value==="dirty"?go(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"?go(a.value):n.value==="dirty"?go(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(!Pr(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=>Pr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):Y);de.assertNever(o)}};qt.create=(e,t,n)=>new qt({schema:e,typeName:te.ZodEffects,effect:t,...ie(n)});qt.createWithPreprocess=(e,t,n)=>new qt({schema:t,effect:{type:"preprocess",transform:e},typeName:te.ZodEffects,...ie(n)});var Jt=class extends ae{_parse(t){return this._getType(t)===W.undefined?pt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Jt.create=(e,t)=>new Jt({innerType:e,typeName:te.ZodOptional,...ie(t)});var Tn=class extends ae{_parse(t){return this._getType(t)===W.null?pt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tn.create=(e,t)=>new Tn({innerType:e,typeName:te.ZodNullable,...ie(t)});var _o=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}};_o.create=(e,t)=>new _o({innerType:e,typeName:te.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ie(t)});var Ao=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 Hi(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}};Ao.create=(e,t)=>new Ao({innerType:e,typeName:te.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ie(t)});var qi=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}}};qi.create=e=>new qi({typeName:te.ZodNaN,...ie(e)});var nT=Symbol("zod_brand"),Oa=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}},La=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(),go(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:te.ZodPipeline})}},Ro=class extends ae{_parse(t){let n=this._def.innerType._parse(t),r=o=>(Pr(o)&&(o.value=Object.freeze(o.value)),o);return Hi(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Ro.create=(e,t)=>new Ro({innerType:e,typeName:te.ZodReadonly,...ie(t)});function XE(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function tv(e,t={},n){return e?Or.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=XE(t,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=XE(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Or.create()}var rT={object:kt.lazycreate},te;(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"})(te||(te={}));var oT=(e,t={message:`Input not instance of ${e.name}`})=>tv(n=>n instanceof e,t),nv=$r.create,rv=ho.create,iT=qi.create,sT=yo.create,ov=wo.create,aT=bo.create,lT=Gi.create,cT=Do.create,uT=ko.create,dT=Or.create,pT=rr.create,fT=dn.create,mT=Ki.create,gT=or.create,hT=kt.create,yT=kt.strictCreate,wT=Eo.create,bT=hu.create,DT=vo.create,kT=In.create,ET=yu.create,vT=Ji.create,ST=zi.create,xT=wu.create,CT=So.create,FT=xo.create,_T=Co.create,AT=Fo.create,RT=Lr.create,IT=qt.create,TT=Jt.create,PT=Tn.create,$T=qt.createWithPreprocess,OT=La.create,LT=()=>nv().optional(),NT=()=>rv().optional(),jT=()=>ov().optional(),MT={string:(e=>$r.create({...e,coerce:!0})),number:(e=>ho.create({...e,coerce:!0})),boolean:(e=>wo.create({...e,coerce:!0})),bigint:(e=>yo.create({...e,coerce:!0})),date:(e=>bo.create({...e,coerce:!0}))};var BT=Y;function bu(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&&Xi(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Xi(e.charCodeAt(r)))for(r++;r<e.length&&Xi(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&&Xi(e.charCodeAt(r))){for(r++;r<e.length&&Xi(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(Na(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(Mm(v)){do r++,o+=String.fromCharCode(v),v=e.charCodeAt(r);while(Mm(v));return s=15}if(Na(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&&!Na(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++,Na(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||!Xi(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(Mm(v)||Na(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-d,getTokenError:()=>p}}function Mm(e){return e===32||e===9}function Na(e){return e===10||e===13}function Xi(e){return e>=48&&e<=57}var iv;(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"})(iv||(iv={}));var WT=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Yi=200,HT={" ":{"\n":new Array(Yi).fill(0).map((e,t)=>`
|
|
115
|
-
`+" ".repeat(t)),"\r":new Array(Yi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Yi).fill(0).map((e,t)=>`\r
|
|
116
|
-
`+" ".repeat(t))}," ":{"\n":new Array(Yi).fill(0).map((e,t)=>`
|
|
117
|
-
`+" ".repeat(t)),"\r":new Array(Yi).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Yi).fill(0).map((e,t)=>`\r
|
|
118
|
-
`+" ".repeat(t))}};var Du;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Du||(Du={}));function sv(e,t=[],n=Du.DEFAULT){let r=null,o=[],i=[];function s(l){Array.isArray(o)?o.push(l):r!==null&&(o[r]=l)}return av(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 av(e,t,n=Du.DEFAULT){let r=bu(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),_=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=[],pr=[]){if(v(U),ge.length+pr.length>0){let fr=r.getToken();for(;fr!==17;){if(ge.indexOf(fr)!==-1){H();break}else if(pr.indexOf(fr)!==-1)break;fr=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(){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 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 lv;(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"})(lv||(lv={}));var cv;(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"})(cv||(cv={}));var Io=sv;var uv;(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"})(uv||(uv={}));var is=w(require("fs")),Fv=w(require("path")),_v=require("@webflow/cosmic-deploy-contract");var vv=w(require("fs")),Sv=w(require("path"));var Zi=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+=`
|
|
139
|
+
${Object.entries(a).reduce((p,[f,m])=>(p+=`${f}: ${JSON.stringify(JSON.parse(m),null,2)}
|
|
119
140
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Documentation: ${this.documentationUrl}`),t}},Re=class extends Zi{constructor(t,n){super(t,n),this.name="FrameworkValidationError"}};var To=class extends Zi{configFile;constructor(t,n){super(t,n),this.name="FrameworkConfigError",this.configFile=n?.configFile}toDisplayString(){let t=super.toDisplayString();return this.configFile&&(t+=`
|
|
123
|
-
|
|
124
|
-
Config file: ${this.configFile}`),t}},ir=class extends Zi{constructor(t,n){super(t,n),this.name="FrameworkDetectionError"}};var vt=w(require("path")),Ma=w(require("fs"));var dv=w(require("semver")),ft=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 dv.default.coerce(n)?.version}get log(){return this.ctx.log}get cwd(){return this.ctx.cwd}};var wv=w(require("semver")),Le=w(require("fs")),Pn=w(require("path"));var Po=w(require("semver"));function XT(){return process.version.slice(1)}function YT(e){let t=Po.coerce(e);return t?t.major:null}function ZT(e,t){let n=Po.coerce(e),r=Po.coerce(t);return!n||!r?!1:Po.gte(n,r)}function Nr(e,t,n){let r=XT(),o=t.minimum;if(ZT(r,o))e.debug(`Node.js version ${r} meets requirement ${o}`);else{let i=YT(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.
|
|
141
|
+
`,p),"")}`),{componentsFiles:i,componentsVolume:s,componentsMetadata:l,componentsOptions:c,sourceMaps:a}})}async function aT(e,t,r,n,o,i,s){let{trackPerformance:a,libraryConfig:l,projectDir:c}=e;return await a("generate_library_bundle",async()=>await au({libraryIdentifier:`_${o}`,renderer:l.renderer,framework:l.framework,publicPath:Tn(i[Hi.Environment.Client]),sourceVolumes:[r],componentsFiles:t,componentsOptions:n,debugBundler:s?.debugBundler,dev:s?.dev,overrideConfig:e.overrideConfig,failOnWarnings:!s?.force,bundler:s?.bundler,projectDir:c}))}async function lT(e,t,r,n){let{trackPerformance:o,apiOptions:i}=e;return await o("upload_files",async()=>{let s=t.map(([l,c])=>{let p=(0,ho.resolve)((0,ho.join)(`/${c}`,`${l.name}`));return Aa(r.readFileSync(p,"utf8").toString(),p,{bundleEnvironment:c})}),{signatures:a}=await bm({resourceId:n,files:s.map(({meta:l})=>l),options:i});await Promise.all(a.map(async l=>{let c=s.find(p=>p.meta.fileHash===l.hash);if(!c)throw new Error(`File not found: ${l.hash}`);await Ra(c,l.value)}))})}async function cT(e,t,r,n,o){let{trackPerformance:i,libraryConfig:s,apiOptions:a}=e;return await i("share_library",async()=>{let l={clientModule:{bundleUrl:Tn(o[Hi.Environment.Client])+sa,loaderType:Hi.ModuleLoader.FEDERATION},serverModule:{bundleUrl:Tn(o[Hi.Environment.Server])+la}},c=$E(t,{framework:s.framework,sourceMaps:r}),{taskId:p}=await km({resourceId:n,codeModule:l,components:Object.values(c),options:a});u.debug(JSON.stringify({taskId:p},null,2))})}async function Om(e){e?.verbose&&(process.env.DEBUG="true");let t,r=Date.now(),n=await T({apiToken:e?.apiToken});u.debug("Initializing telemetry service...");let o=_.forCodeLibraries({authToken:n}),i=Bb(o,"share_library");try{u.debug("Checking dependencies versions..."),new ao().run();let s={apiToken:n};t=u.spinner("Initializing");let a=await i("get_code_libraries",async()=>await ym({options:s})),{workspace:l,libraries:c}=a;t.succeed(),u.debug("Parsing library config...");let p=await mu({existingCodeLibraries:c}),f=p.bundleConfig?require(p.bundleConfig):{},m={trackPerformance:i,apiOptions:s,libraryConfig:p,overrideConfig:f,projectDir:(0,ho.resolve)((0,ho.dirname)(p.manifestPath))};t=u.spinner("Collecting metadata");let{componentsFiles:g,componentsVolume:h,componentsMetadata:y,componentsOptions:k,sourceMaps:v}=await sT(m,e);if(t.succeed(),!await jE({libraryConfig:p,componentsMetadata:y,existingCodeLibraries:c,sourceMaps:v,workspaceInfo:l}))return;t=u.spinner("Creating code library");let{resourceId:E,profileSlug:S,workspace:L,s3Urls:U,cdnUrls:N}=await i("init_code_library",async()=>await wm({name:p.name,slug:p.id,description:p.description,options:s}));t.succeed(),u.debug(JSON.stringify({resourceId:E,profileSlug:S,s3Urls:U,cdnUrls:N},null,2)),await o.sendUsage("library_initialized",{libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S}),p.id||(Se({library:{id:S}}),u.info(`${$} Library ID updated in webflow.json`)),t=u.spinner("Compiling code components");let{outputFiles:te,outputVolume:G}=await aT(m,g,h,k,E,N,e);t.succeed(),await o.sendUsage("bundle_generated",{libraryName:p.name,componentCount:Object.keys(g).length,resourceId:E,profileSlug:S}),t=u.spinner("Uploading files"),await lT(m,te,G,E),t.succeed(),await o.sendUsage("files_uploaded",{libraryName:p.name,fileCount:te.length,resourceId:E,profileSlug:S}),t=u.spinner("Sharing library"),await cT(m,y,v,E,N),t.succeed(),u.success(`Code library shared successfully${L?.slug?`: ${xr()}/dashboard/workspace/${L?.slug}/shared-libraries-and-templates`:"!"}`);let ce=Date.now()-r;await o.sendUsage("share_library",{duration:ce,componentCount:Object.keys(g).length,libraryName:p.name,framework:p.framework,resourceId:E,profileSlug:S})}catch(s){t?.fail();let a=Date.now()-r;throw await o.sendError(s instanceof Error?s:new Error(String(s)),"share_library",{duration:a}),new d(s)}}var gu=w(require("fs")),Ar=require("path");R();Gc();C();var uT="CodeLibrary",dT="dist",pT="http://localhost/";async function Lm(e){e.verbose&&(process.env.DEBUG="true");let t;try{u.debug("Checking dependencies versions..."),new ao().run(),u.debug("Looking for manifest...");let r=await mu({existingCodeLibraries:[]}),n=Zc(r.name)||uT,o=`_${e.libraryId||n}`,i=(0,Ar.resolve)((0,Ar.dirname)(r.manifestPath));e?.debugBundler&&u.debug(`Library Config: ${JSON.stringify(r,null,2)}`),t=u.spinner("Collecting metadata");let{componentsFiles:s,componentsVolume:a}=await du(r,i);e?.debugBundler&&u.debug(`Components: ${JSON.stringify(s,null,2)}`);let l=r.bundleConfig?require(r.bundleConfig):{},{sourceMaps:c,metadata:p,options:f}=await cu({declarations:s,sources:a,overrideConfig:l,performTypeCheck:Vc(s,e,i),skipSourceMaps:!e?.debugBundler,bundler:e.bundler,projectDir:i});e?.debugBundler&&(u.debug(`Metadata: ${JSON.stringify(p,null,2)}`),u.debug(`Source Maps:
|
|
125
142
|
|
|
126
|
-
|
|
127
|
-
nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var ku=w(require("fs")),pv=w(require("path"));var fv=j.object({name:j.string().optional(),version:j.string().optional(),dependencies:j.record(j.string()).optional(),devDependencies:j.record(j.string()).optional()});function ja(e){let t=pv.default.join(e,"package.json");if(!ku.statSync(t,{throwIfNoEntry:!1}))return;let n=ku.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 fv.parse(r)}catch(o){throw new Re("package.json schema validation failed",{cause:o})}}var Eu=w(require("fs")),mv=w(require("path"));var vu=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 Qi(e,t,n="webflow.json"){let r=mv.default.join(t,n);if(!Eu.statSync(r,{throwIfNoEntry:!1}))return n.endsWith(".json")?Qi(e,t,n+"c"):void 0;let o=Eu.readFileSync(r).toString("utf8"),i;try{i=Io(o)}catch(s){e?.error(`loaded but could not parse as JSONC ${r} ${JSON.stringify(o)}: ${s}`);return}try{let s=vu.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 es=w(require("fs")),gv=w(require("path"));function Um(e,t,n,r,o){if(!n||r!=="astro"&&r!=="nextjs")return t;let i=gv.join(e,t);if(!es.existsSync(i)||!es.statSync(i).isDirectory())return t;let a=es.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 hv=require("child_process"),yv=["--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=[...yv,...r];t.debug(`npm ${i.join(" ")} (in ${n})`),(0,hv.execSync)(`npm ${i.map(s=>JSON.stringify(s)).join(" ")}`,{cwd:n,env:o,stdio:"inherit"})}function pn(e){if(!e)return null;let t=wv.coerce(e);return t?t.major:null}function jr(e,t,n,r){let o=r?.exclude?Array.isArray(r.exclude)?r.exclude:[r.exclude]:[],i=Pn.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),d=0;for(let p of c)d+=jr(e,Pn.join(t,p),Pn.join(n,p),r);return d}let l=Pn.dirname(n);return Le.existsSync(l)||Le.mkdirSync(l,{recursive:!0}),e.trace(`Copying file: ${t} -> ${n}`),Le.copyFileSync(t,n),1}function Et(e){return Le.existsSync(e)}function wt(...e){for(let t of e)if(Le.existsSync(t))return t;return e[0]??""}async function $n(e,t,n,r){if(!Le.existsSync(t))throw new To(`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=Pn.dirname(n);Le.existsSync(a)||Le.mkdirSync(a,{recursive:!0}),Le.writeFileSync(n,s)}function On(e,t,n,r){for(let o of r){let i=Pn.join(t,`${n}.${o}`);if(Le.existsSync(i)){let s=Pn.join(t,`clouduser.${n}.${o}`);return e.info(`Renaming user config: ${n}.${o} -> clouduser.${n}.${o}`),Le.renameSync(i,s),s}}return null}var Wm=wt(vt.join(__dirname,"templates","astro","v5"),vt.join(__dirname,"templates","v5")),bv=wt(vt.join(__dirname,"templates","astro"),vt.join(__dirname,"templates")),$o=class extends ft{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=pn(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&&Nr(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=pn(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 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:vt.join(Wm,"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(Wm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,vt.join(bv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;On(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"),Ma.writeFileSync(vt.join(n,"clouduser.astro.config.mjs"),`export default {};
|
|
128
|
-
`));let i=vt.join(bv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ma.copyFileSync(i,vt.join(n,"astro.config.webflow.ts")));let s=vt.join(Wm,"astro.config.mjs.template"),a=vt.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template..."),await $n(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ma.copyFileSync(l.templatePath,vt.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 St=w(require("path")),Ua=w(require("fs"));var Ba=w(require("semver"));async function Su(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 Qe({log:t,cwd:n,args:["install","--save",`${r}@${o}`]});return}let a=Ba.coerce(s);if(!a||!Ba.lt(a,i))return;let l=Ba.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 Qe({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 Hm=wt(St.join(__dirname,"templates","astro","v6"),St.join(__dirname,"templates","v6")),Dv=wt(St.join(__dirname,"templates","astro"),St.join(__dirname,"templates")),Oo=class extends ft{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=pn(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&&Nr(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=pn(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 Su({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 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(Hm,"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(Hm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,St.join(Dv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;On(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"),Ua.writeFileSync(St.join(n,"clouduser.astro.config.mjs"),`export default {};
|
|
129
|
-
`));let i=St.join(Dv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Ua.copyFileSync(i,St.join(n,"astro.config.webflow.ts")));let s=St.join(Hm,"astro.config.mjs.template"),a=St.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 6)..."),await $n(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Ua.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 xt=w(require("path")),Wa=w(require("fs"));var Vm=wt(xt.join(__dirname,"templates","astro","v7"),xt.join(__dirname,"templates","v7")),kv=wt(xt.join(__dirname,"templates","astro"),xt.join(__dirname,"templates")),ts=class extends ft{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=pn(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&&Nr(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=pn(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 Su({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 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:xt.join(Vm,"webflow-loader.ts"),destinationName:"webflow-loader.ts",configPath:"./webflow-loader.ts"}}getUserConfigPatterns(){return["astro.config.mjs","astro.config.cjs","astro.config.js","astro.config.ts"]}getWranglerTemplatePath(){return xt.join(Vm,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,xt.join(kv,"astro.config.webflow.ts")]}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx;On(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"),Wa.writeFileSync(xt.join(n,"clouduser.astro.config.mjs"),`export default {};
|
|
130
|
-
`));let i=xt.join(kv,"astro.config.webflow.ts");Et(i)&&(t.info("Copying astro.config.webflow.ts..."),Wa.copyFileSync(i,xt.join(n,"astro.config.webflow.ts")));let s=xt.join(Vm,"astro.config.mjs.template"),a=xt.join(n,"astro.config.mjs");t.info("Generating astro.config.mjs from template (Astro 7)..."),await $n(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Wa.copyFileSync(l.templatePath,xt.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")),Xt=w(require("fs"));var ns=wt(Ve.join(__dirname,"templates","nextjs"),Ve.join(__dirname,"templates")),rs=class extends ft{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 Qe({log:t,cwd:n,args:["install","--save",r.name]}))}getWebflowLoader(){return{templatePath:Ve.join(ns,"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(ns,"wrangler.json")}getAdditionalConfigFiles(){return[this.getWebflowLoader().templatePath,Ve.join(ns,"open-next.config.ts")]}findOpenNextConfig(){let t="open-next.config.ts";if(Xt.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..."),!Xt.existsSync(t))throw new To(`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");Xt.copyFileSync(t,i),n.info("open-next.config.ts created successfully")}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=On(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"),Xt.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)}`),Xt.writeFileSync(Ve.join(n,"clouduser.next.config.d.ts"),`import type { UserNextConfig } from './next.config.webflow';
|
|
132
|
-
declare const config: UserNextConfig;
|
|
133
|
-
export default config;
|
|
134
|
-
`));let i=Ve.join(ns,"next.config.webflow.ts");Et(i)&&(t.info("Copying next.config.webflow.ts..."),Xt.copyFileSync(i,Ve.join(n,"next.config.webflow.ts")));let s=Ve.join(ns,"next.config.ts.template"),a=Ve.join(n,"next.config.ts");t.info("Generating next.config.ts from template..."),await $n(t,s,a,{...process.env,...r});let l=this.getWebflowLoader();Et(l.templatePath)&&(t.info(`Copying ${l.destinationName}...`),Xt.copyFileSync(l.templatePath,Ve.join(n,l.destinationName)));let c=Ve.join(ns,"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 Xt.statSync(Ve.join(t,"./worker.js"),{throwIfNoEntry:!1})?.isFile()??!1}};var Pt=w(require("path")),Yt=w(require("fs"));var xu=wt(Pt.join(__dirname,"templates","vite"),Pt.join(__dirname,"templates")),os=class extends ft{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=pn(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 Pt.join(xu,"wrangler.json")}getAdditionalConfigFiles(){return[Pt.join(xu,"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(Yt.existsSync(o)){try{let i=Yt.readFileSync(o,"utf8"),s=Io(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(Yt.existsSync(r)){t.info("src/worker.ts already exists, skipping creation");return}t.warn("src/worker.ts does not exist, creating a minimal worker..."),Yt.mkdirSync(Pt.join(n,"src"),{recursive:!0}),Yt.writeFileSync(r,`/// <reference types="@cloudflare/workers-types" />
|
|
143
|
+
${Object.entries(c).reduce((h,[y,k])=>(h+=`${y}: ${JSON.stringify(JSON.parse(k),null,2)}
|
|
135
144
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return env.ASSETS.fetch(request);
|
|
143
|
-
},
|
|
144
|
-
} satisfies ExportedHandler<Env>;
|
|
145
|
-
`)}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=this.hasCustomWorkerEntry();On(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"),Yt.writeFileSync(Pt.join(n,"clouduser.vite.config.ts"),`export default {};
|
|
146
|
-
`));let s=Pt.join(xu,"vite.config.webflow.ts");Et(s)&&(t.info("Copying vite.config.webflow.ts..."),Yt.copyFileSync(s,Pt.join(n,"vite.config.webflow.ts")));let a=Pt.join(xu,"vite.config.ts.template"),l=Pt.join(n,"vite.config.ts");t.info("Generating vite.config.ts from template..."),await $n(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 Ev=w(require("fs")),Ha=w(require("path"));var QT=wt(Ha.join(__dirname,"templates","static"),Ha.join(__dirname,"templates")),Va=["_headers","_redirects"],Gm=["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 eP(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 Ga(e){return e===".well-known"?!1:e.startsWith(".")||Va.includes(e)?!0:Gm.some(t=>eP(e,t))}var tP=["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"],nP=["server.py","app.py","wsgi.py","asgi.py","manage.py","main.py","server.js","server.mjs","main.go","app.rb","index.php"],rP=new Set([...tP,...nP]);function Ka(e){let t=[],n=(r,o)=>{let i;try{i=Ev.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()){Ga(s.name)||n(Ha.join(r,s.name),a);continue}if(!s.isFile())continue;(s.name==="package.json"&&a!=="package.json"||rP.has(s.name))&&t.push(a)}};return n(e,""),t}var fn=class extends ft{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=Ka(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 Ha.join(QT,"wrangler.json")}static getOutputDeployMetadata(){return{staticAssetsPath:".",deploymentType:"static",usesAssetsBinding:!1,skipNoBundle:!1}}};var xv=[ts,Oo,$o,rs,os,fn],Ja=["astro","nextjs","vite","static"];function Cu(e,t){for(let n of xv){let r=n.detect(e,t);if(r.detected)return{Builder:n,result:r}}return null}function Km(e,t){let n=Cu(e.packageJson,t);if(!n)throw new ir("Could not detect framework from package.json or webflow.json",{remediation:`Create a webflow.json file with: { "cloud": { "framework": "astro" } } (or one of: ${Ja.join(", ")})`});return e.log.info(`Detected framework: ${n.result.reason}`),new n.Builder(e)}function Cv(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 za(e,t,n){let r=n?.cloud?.framework,i=vv.lstatSync(Sv.join(e,"index.html"),{throwIfNoEntry:!1})?.isFile()??!1,s=Ka(e),a=Cv({hasPackageJson:t!=null,specifiedFramework:r,hasRootIndexHtmlFile:i,hasRuntimeIndicators:s.length>0});if(!t&&!a&&i&&s.length>0&&r==null)throw new ir(`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=Fv.join(t,"webflow.json"),i={cloud:{}};if(is.existsSync(o))try{let a=is.readFileSync(o,"utf8"),l=JSON.parse(a),c=vu.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,_v.validateForDeploy)(i)}e.info(`Creating webflow.json with framework: ${n}`),is.writeFileSync(o,JSON.stringify(i,null,2))}function Av(e,t){let n=Qi(e,t);if(n?.cloud?.framework)return n.cloud.framework;let r=ja(t),{isStatic:o}=za(t,r,n);if(o)return e.info("Detected static app (no framework, no build)"),Fu(e,t,fn.frameworkName),fn.frameworkName;if(!r)throw new ir("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=Cu(r,n);if(!i)throw new ir("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}A();var Rv=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 Iv(e){return e.issues.map(t=>` - ${t.path.length>0?t.path.join("."):"<root>"}: ${t.message}`).join(`
|
|
147
|
-
`)}function Tv(e,t="wrangler.json"){let n=mn.join(e,t);if(!mt.existsSync(n)){if(t.endsWith(".json"))return u.warn(`/${t} not found, checking for /${t}c`),Tv(e,t+"c");u.warn(`/${t} not found`);return}let r=mt.readFileSync(n,"utf8");u.info(`reading /${t}...`);let o;try{o=Io(r)}catch(s){u.error(`/${t} loaded but could not parse as JSONC: ${s}`);return}let i=Rv.safeParse(o);if(!i.success){u.error(`/${t} loaded but schema validation failed:
|
|
148
|
-
${Iv(i.error)}`);return}return u.info(`successfully loaded /${t}`),i.data}async function Pv(e,t){let n=null,r=null,o=mn.join(t,"wrangler.json"),i=mn.join(t,"wrangler.jsonc");mt.existsSync(o)?(n=o,r=".json"):mt.existsSync(i)&&(n=i,r=".jsonc"),n&&r&&(u.info(`saving user-provided wrangler JSON as /clouduser.wrangler${r}...`),mt.copyFileSync(n,mn.join(t,`clouduser.wrangler${r}`)));let s=n?Tv(t,mn.basename(n)):null,a=e.getWranglerTemplatePath(),l=mn.join(t,"wrangler.json");if(!mt.existsSync(a))throw new Error(`Wrangler template not found at ${a}. Make sure the template is properly copied during build.`);if(u.info(`copying wrangler template for ${e.info.name} to /wrangler.json`),mt.copyFileSync(a,l),!s)return;let c=JSON.parse(mt.readFileSync(l,"utf8"));if(s.kv_namespaces&&s.kv_namespaces.length>0&&(c.kv_namespaces=s.kv_namespaces,u.info(`merged ${s.kv_namespaces.length} KV namespace(s) into template`)),s.r2_buckets&&s.r2_buckets.length>0&&(c.r2_buckets=s.r2_buckets,u.info(`merged ${s.r2_buckets.length} R2 bucket(s) into template`)),s.d1_databases&&s.d1_databases.length>0&&(c.d1_databases=s.d1_databases,u.info(`merged ${s.d1_databases.length} D1 database(s) into template`)),mt.writeFileSync(l,JSON.stringify(c,null,2)),s.d1_databases.length!==0)for(let 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=mn.join(t,m);if(!mt.existsSync(h)){u.info(`skipping migrations for database ${d} in wrangler.json; migrations dir (/${m}) does not exist`);continue}let g=mn.join(t,"clouduser","migrations",m),y=jr(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 oP(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 $v(e){let t=null;for(let s of[".json",".jsonc"]){let a=mn.join(e,`clouduser.wrangler${s}`);if(mt.existsSync(a)){t=a;break}}if(!t)return;let n=mt.readFileSync(t,"utf8"),r;try{r=Io(n)}catch(s){throw new Error(`Failed to parse wrangler config at ${t} as JSONC: ${s}`)}let o=Rv.safeParse(r);if(!o.success)throw new Error(`Invalid wrangler config at ${t}:
|
|
149
|
-
${Iv(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)oP(s.bucket_name)}}A();C();M();pe();var _u=w(require("fs")),Ov=w(require("path"));function Lv(e,t,n){if(!n)return t;let r=`${t}/${n}`,o=Ov.join(e,r);return _u.existsSync(o)&&_u.statSync(o).isDirectory()?r:t}var iP="4.82.1",Au=60;function sr(e,t){let n=Math.min(Au,process.stdout.columns??Au),r=`\u2500\u2500\u2500 ${e} ${t} `,o="\u2500".repeat(Math.max(0,n-r.length));u.info(`
|
|
150
|
-
${se(`${r}${o}`)}`)}function Jm(e,t){let n=Math.min(Au,process.stdout.columns??Au),r=`\u2550\u2550\u2550 ${e} ${t} `,o="\u2550".repeat(Math.max(0,n-r.length));u.info(`
|
|
151
|
-
${se(At(`${r}${o}`))}`)}async function Mv(e=process.cwd(),t,n,r){let o=ja(e),i=Qi(u,e),s={...r?{COSMIC_MOUNT_PATH:r}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...n&&!t?{COSMIC_DEPLOY_URL:aP(n)}:{}},a={cwd:e,log:u,packageJson:o??{},userEnv:s},{isStatic:l}=za(e,o,i);if(l)return new fn(a);if(!o)throw new Error("No package.json file found");return Km(a,i)}async function Bv(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=zm(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}),oe.mkdirSync(o,{recursive:!0});try{sr("\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&&Nr(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),sr("\u2699\uFE0F ","Configure wrangler"),await Pv(e,n),u.info("Preparing framework configuration..."),await e.prepareConfig()),Fu(u,n,e.info.name,e),m||(sr("\u{1F4E6}","Install dependencies"),await sP(n,e.info.name,t.telemetry),$v(n),sr("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${d}...`),await lP(n,d,t.telemetry),await e.postBuild(),sr("\u{1F9EA}","Wrangler dry-run"),await cP(n,i)),sr("\u{1F4C1}","Copy assets"),await dP(n,i,e,s),sr("\u{1F381}","Create tarball");let g=await pP(i),y=Date.now()-a;return u.info(`${P} 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 zm(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 Uv(e){try{let t=ue.dirname(e);t.includes(".tmp/webflow-build-")&&(sr("\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 Wv(e,t){try{sr("\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 d=ue.join(e,`clouduser.${l}.${c}`),p=ue.join(e,`${l}.${c}`);if(oe.existsSync(d)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),oe.existsSync(p)&&oe.unlinkSync(p),oe.renameSync(d,p);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 sP(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,qa.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,qa.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 aP(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 lP(e,t,n){let r=Date.now();try{(0,qa.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 cP(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,qa.execSync)(`npx wrangler@${iP} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function Nv(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 uP(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))jr(u,ue.join(e,s),ue.join(i,s),{excludeFn:Ga,followSymlinks:!1});for(let s of Va){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 dP(e,t,n,r){let o=n.getOutputDeployMetadata();if(o.deploymentType==="static"){uP(e,t,r),Nv(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=r.replace(/\/+$/,"").replace(/^\/+/,"");a?i=Lv(e,i,l):i=Um(e,i,l,n.info.name,s);let c=ue.join(t,"assets",l||"");oe.mkdirSync(c,{recursive:!0});let d=ue.join(e,i);if(oe.existsSync(d)&&oe.statSync(d).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),jr(u,d,c,{exclude:s})):jr(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");Nv(e,t);let p=null;for(let m of[".json",".jsonc"]){let h=ue.join(e,`clouduser.wrangler${m}`);if(oe.existsSync(h)){p=h;break}}if(p){u.info("including user wrangler config in output..."),oe.copyFileSync(p,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");jr(u,m,h)}}}async function pP(e){let t=`${e}.tar.gz`;try{return await jv.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 fP="DUPLICATE_ENVIRONMENT_MOUNT",mP="ENVIRONMENT_MOUNT_MISMATCH",gP="DUPLICATE_ENVIRONMENT_BRANCH",hP="INVALID_MOUNT_PATH_FORMAT",yP="INVALID_PROJECT_ID",wP="DUPLICATE_PROJECT_NAME",bP="MAX_PROJECTS_PER_SITE",Hv={[fP]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[mP]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[gP]:"An environment with this branch already exists for this app.",[hP]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[yP]:"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.",[wP]:"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.",[bP]:"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 Vv(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 Hv)if(n.includes(i))return Hv[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var as=w(require("fs")),Xm=require("child_process"),Jv=w(require("semver"));A();C();M();C();be();A();C();function ss(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0})}var DP={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 qm(e){return typeof e=="string"&&e.trim()!==""}async function Lo(e,t={}){let n=DP[e],{flagValue:r,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??Ze();if(qm(r))return ss(r,e),r;let c=process.env[n.env];if(qm(c))return ss(c,e),c;let d=n.manifest(o??{});if(qm(d))return l||u.info(`Using ${e} from webflow.json`),ss(d,e),d;if(!a&&s){let m=await s();return ss(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 Mr(e,t={}){try{return await Lo(e,t)}catch(n){if(n instanceof f&&n.missingFlag===e)return;throw n}}C();var kP=/[\x00-\x1f?#%/\\]/;function Br(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0});if(kP.test(e)||e.includes(".."))throw new f(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function ve(e,t){Br(e,t)}function EP(e){if(!e)return"unknown";let t=Jv.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var Gv=104857600;function Kv(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 vP(){try{let e=(0,Xm.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,Xm.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 Ym(e,t,n){let r=await fetch(`${$()}${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=Vv(i);throw new Error(s)}return r.json()}async function zv(e,t,n,r){let{manifest:o}=ne(),i=o.cloud||{},s=i.framework,a=await Mr("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=EP(i.framework_version),c=await SP({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:vP()});return!a&&c.project_id&&(xe({cloud:{...i,app_id:c.project_id}}),u.info(`${P} App ID updated in webflow.json`)),c}async function SP(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 Ym(e.apiToken,m,{method:"POST",body:p})}async function qv(e,t){let{siteId:n,accessToken:r}=e,o=n?`/cosmic/${n}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Ym(r,o,{method:"GET"})}async function Xv(e){let{siteId:t,accessToken:n}=e,r=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Ym(n,r,{method:"GET"})}async function Yv(e,t){if(!as.existsSync(e))throw new Error(`Tarball not found at ${e}`);let n=as.statSync(e);if(n.size>Gv)throw new Error(`Build output is too large (${Kv(n.size)}). Maximum allowed size is ${Kv(Gv)}.`);let r=as.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 Zv(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 Qv=require("webflow-api");De();De();C();function Zm(e){return new Qv.WebflowClient({accessToken:e,environment:{base:`${$()}/v2`,dataApi:`${$()}/v2`,contentDeliveryApi:`${bi()}/v2`}})}async function Xa(e,t){try{let r=await Zm(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 Qm(e,t){try{return{customDomains:(await Zm(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 eg(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 tg(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 eS(e,t,n){try{let r=Zm(e),o=await Xa(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 tS(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 Xa(o,r),a=await Qm(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 eg(g),b=Array.isArray(y.cosmic)?y.cosmic.map(_=>_.mountPath).filter(_=>typeof _=="string"):[],S=tg(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 nS(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)return[];try{let i=await Xa(o,r),s=await Qm(o,r),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(d=>d.url)||[]].map(async d=>{try{let p=await eg(d),m=tg(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 rS(e,t){return e.map(n=>`${n.startsWith("localhost")||n.startsWith("127.0.0.1")?"http":"https"}://${n}${t}`)}async function oS(e){let t=e.map(r=>({name:r,value:r,checked:!0})),n=await Cn({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 iS(){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 ng(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 Xa(r,n)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await eS(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 No=w(require("path"));Me();De();be();var sS="apps";function rg(e){sS=e}function ls(){return sS}var Iu=w(require("fs"));C();De();Oe();C();A();async function cs(e){let t=await fetch(`${$()}/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
|
+
`,h),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:g}=await au({libraryIdentifier:o,renderer:r.renderer,framework:r.framework,publicPath:Tn(e.publicPath||pT),sourceVolumes:[a],componentsFiles:s,componentsOptions:f,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:l,failOnWarnings:!e.force,bundler:e.bundler,projectDir:i});t.succeed(),t=u.spinner("Writing to disk"),m.forEach(([h,y])=>{let k=(0,Ar.join)(`/${y}`,`${h.name}`),v=Aa(g.readFileSync(k,"utf8").toString(),k,{bundleEnvironment:y}),F=(0,Ar.join)(i,e.outputPath||dT);gu.default.existsSync((0,Ar.join)(F,`${y}`))||gu.default.mkdirSync((0,Ar.join)(F,`${y}`),{recursive:!0}),gu.default.writeFileSync((0,Ar.join)(F,y,h.name),v.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(r){throw t?.fail(),new d(r)}}R();j();var $a=w(require("fs-extra")),Nm=w(require("path"));R();j();function fT(){try{if(!$a.default.existsSync(At))return null;let e=$a.default.readdirSync(At).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:Nm.default.join(At,t),time:$a.default.statSync(Nm.default.join(At,t)).mtime.getTime()})).sort((t,r)=>r.time-t.time);if(e.length===0)return null;for(let t of e)try{let n=$a.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(n){let o=n[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function jm(){let e=fT();e&&u.info(`${ki} Latest log: ${e}`),u.info(`${ki} All logs: ${At}`)}async function XE(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(jm)}me();var mT=`${ue("[Deprecated]")} The 'library' commands will be removed in the next major release.`,gT=()=>{u.warn(`${X} ${ue("webflow library share")} is deprecated and will be removed in the next major release.
|
|
146
|
+
Use ${z("webflow devlink import")} instead.
|
|
147
|
+
`)},hT=()=>{u.warn(`${X} ${ue("webflow library bundle")} is deprecated and will be removed in the next major release.
|
|
148
|
+
Use ${z("webflow devlink bundle")} instead.
|
|
149
|
+
`)},yT=()=>{u.warn(`${X} ${ue("webflow library log")} is deprecated and will be removed in the next major release.
|
|
150
|
+
Use ${z("webflow log")} instead.
|
|
151
|
+
`)},wT="Import a library of Code Components into your Webflow Workspace.",bT="Bundle a library of Code Components for local development.",ZE=()=>new $n.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),QE=()=>new $n.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),ev=()=>new $n.Option("--dev","Bundle in development mode for debugging purposes."),tv=()=>new $n.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),kT=()=>new $n.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),DT=()=>new $n.Option("--public-path <path>","Set the public path for the bundle."),ET=()=>new $n.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function Mm(e,t){return e.command(t).description(wT).addOption(Xr()).addOption(ZE()).addOption(QE()).addOption(ev()).addOption(tv()).action(Sa(Om))}function Bm(e,t){return e.command(t).description(bT).addOption(kT()).addOption(DT()).addOption(ET()).addOption(ZE()).addOption(QE()).addOption(ev()).addOption(tv()).action(Sa(Lm))}var rv=e=>{let t=e.command("library").description(mT);Mm(t,"share").description(`${ue("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",gT),Bm(t,"bundle").description(`${ue("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",hT),t.command("log").description(`${ue("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",yT).action(jm)};me();var nv=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${ue("[Deprecated]")} Use 'webflow devlink export' instead. Sync your Webflow components to your filesystem.`).argument("[components...]","A list of components to sync. If none is provided, all components will be synced.").addOption(Xr()).addOption(Rt()).action(gD),Mm(t,"import"),Bm(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(Xr()).addOption(Rt()).action(Sa(qc))};var tn=w(require("fs")),qt=w(require("path"));R();Y();var Ce={New:"new",Existing:"existing"},ov="cli",Jt=3,zt=39,hu="astro",iv="cloud-scaffolds";var sv="package.json",yo="webflow.json",yu="wf-placeholder-name",av="CLOUD_MOUNT_PATH",lv="gitignore";function Um(e){return!e.siteId}var Oa=async(e,t,r=hu,n,o,i)=>{try{let s,a;if("content"in n){let l=n.content;s=l.files,a=c=>qt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=n[r];if(!c)throw new Error(`Scaffold "${r}" not found`);s=c;let p=qt.join(iv,r);a=f=>f.split(p)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=qt.join(e,a(l)),p=l.includes("next.config.ts"),f=l.includes("astro.config.mjs"),m=p||f;if(l.includes(yo)&&tn.existsSync(c))continue;if(l.includes(sv)||l.includes(yo)){let h=(await tn.promises.readFile(l,"utf8")).replace(yu,e);await wu(c,h)}else if(m){let g=await tn.promises.readFile(l,"utf8");await wu(c,g.replace(av,t))}else if(qt.basename(c).toLowerCase()===lv){let g=await tn.promises.readFile(l,"utf8"),h=qt.join(qt.dirname(c),".gitignore");await wu(h,g)}else{let g=await tn.promises.readFile(l);await wu(c,g)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Yr({siteId:o,apiToken:i,directory:e})}catch(l){u.error(`Error creating .env file: ${l}`)}}catch(s){throw u.error(`Error applying scaffold: ${s}`),s}};var wu=async(e,t)=>{try{await tn.promises.mkdir(qt.dirname(e),{recursive:!0}),await tn.promises.writeFile(e,t)}catch(r){throw u.error(`Error writing file ${e}: ${r}`),r}};var On=w(require("fs")),cv=w(require("fs-extra")),Ln=w(require("path")),Km=w(require("os")),uv=w(require("tar"));var et=class extends Error{constructor(r,n,o){super(r);this.scaffoldId=n;this.supportedIds=o;this.name="ScaffoldError"}};var La={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v3"}},"nextjs-minimal":{id:"nextjs-minimal",name:"Next.js",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs",ref:"v1"}},astro:{id:"astro",name:"Astro (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-astro-devlink",ref:"v3"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function Na(e){let t=La[e];if(!t){let r=Object.keys(La);throw new et(`Unsupported framework: "${e}". Supported: ${r.join(", ")}`,e,r)}return t}function Wm(){return Object.keys(La)}function Hm(){return[...new Set(Wm().map(e=>e.replace(/-minimal$/,"")))]}function Vm(){return["astro","nextjs"]}function Gm(e){let r=`${e.replace(/-minimal$/,"")}-minimal`;if(!La[r]){let n=Wm();throw new et(`No minimal scaffold for "${e}". Supported: ${n.join(", ")}`,r,n)}return r}R();qr();var vT="https://github.com";async function Jm(e){let t=e.endsWith("-minimal")?e:Gm(e);return bu(t)}async function bu(e){return Na(e).source.type==="github"?ST(e):dv(e)}async function dv(e){let t=Na(e);if(t.source.type!=="local")throw new et(`Scaffold "${e}" does not have a local source`,e);let r=Ln.isAbsolute(t.source.path)?t.source.path:Ln.join(__dirname,t.source.path);if(!On.existsSync(r))throw new et(`Scaffold directory not found: ${r}`,e);let n=await zm(r);return{scaffoldId:e,files:n,extractionRoot:r}}async function ST(e){let t=Na(e);if(t.source.type!=="github")throw new et(`Scaffold "${e}" does not have a GitHub source`,e);let r=(Ke()?t.source.betaRef:void 0)??t.source.ref??"main",n=`${vT}/${t.source.repo}/archive/${r}.tar.gz`,o=await On.promises.mkdtemp(Ln.join(Km.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${r})`);try{let s;try{s=await fetch(n,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(g){throw i.fail("Download failed"),new et(`Failed to fetch scaffold from GitHub: ${g instanceof Error?g.message:String(g)}. Repo: ${t.source.repo}, ref: ${r}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new et(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${r}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await xT(a,o),l.succeed("Scaffold ready")}catch(g){throw l.fail("Unpack failed"),g}let c=await On.promises.readdir(o),p=c[0];if(!p||c.length!==1)throw new et(`Unexpected tarball structure for ${t.source.repo}`,e);let f=Ln.join(o,p),m=await zm(f);return{scaffoldId:e,files:m,extractionRoot:f}}catch(s){try{cv.default.removeSync(o)}catch{}throw s instanceof et?s:new et(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function xT(e,t){let r=Ln.join(Km.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await On.promises.writeFile(r,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await uv.extract({file:r,cwd:t})}finally{await On.promises.unlink(r).catch(()=>{})}}async function zm(e){let t=[],r=await On.promises.readdir(e,{withFileTypes:!0});for(let n of r){let o=Ln.join(e,n.name);n.isDirectory()?t.push(...await zm(o)):t.push(o)}return t}var Tg=w(require("fs-extra"));Y();Z();hg();el();Pe();ke();R();var c$="DUPLICATE_ENVIRONMENT_MOUNT",u$="ENVIRONMENT_MOUNT_MISMATCH",d$="DUPLICATE_ENVIRONMENT_BRANCH",p$="INVALID_MOUNT_PATH_FORMAT",f$="INVALID_PROJECT_ID",m$="DUPLICATE_PROJECT_NAME",g$="MAX_PROJECTS_PER_SITE",FS={[c$]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[u$]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[d$]:"An environment with this branch already exists for this app.",[p$]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[f$]:"Invalid app ID. This app may have been deleted or belongs to a different site. Please remove the 'app_id' field (or the legacy 'project_id' field) from your webflow.json and redeploy to create a new app.",[m$]:"An app with this name already exists on this site, usually because 'app_id' is missing from your webflow.json. To deploy to the existing app, provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json \u2014 you can find the ID in the Webflow Cloud dashboard.",[g$]:"This site has reached its limit of Cloud apps, so no new app can be created. Deploy to one of its existing apps, or delete an app you no longer need from the Webflow Cloud dashboard."};function _S(e){let t={timestamp:new Date().toISOString()};if(e instanceof Error)t.code=e.name,t.msg=e.message,t.stack=e.stack;else if(typeof e=="object"&&e!==null){let i=e;t.code=typeof i.code=="string"?i.code:void 0,t.msg=typeof i.msg=="string"?i.msg:void 0,t.status=typeof i.status=="number"?i.status:void 0}let r=t.msg||"",n=t.status??t.code,o=typeof n=="number"?n:typeof n=="string"&&/^\d+$/.test(n)?Number(n):void 0;if(u.error(`Error Details: ${JSON.stringify({timestamp:t.timestamp,code:t.code,message:t.msg,status:t.status,stack:t.stack},null,2)}`),o===401)return"Your access token is expired or invalid. Run 'webflow auth login' to re-authenticate.";if(o===403)return"Your access token is missing required permissions. Run 'webflow auth login' to re-authenticate with the necessary scopes.";for(let i in FS)if(r.includes(i))return FS[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var us=w(require("fs")),kg=require("child_process"),IS=w(require("semver"));R();C();j();C();we();R();C();function cs(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0})}var h$={siteId:{missingFlag:"siteId",flagHint:"--site",env:"WEBFLOW_SITE_ID",manifest:e=>e.siteId},appId:{missingFlag:"appId",flagHint:"--app-id",env:"WEBFLOW_APP_ID",manifest:e=>e.cloud?.app_id??e.cloud?.project_id},environmentId:{missingFlag:"environmentId",flagHint:"--environment-id",env:"WEBFLOW_APP_ENVIRONMENT_ID",manifest:e=>e.cloud?.environment_id},workspaceId:{missingFlag:"workspaceId",flagHint:"--workspace-id",env:"WEBFLOW_WORKSPACE_ID",manifest:e=>e.cloud?.workspace_id}};function bg(e){return typeof e=="string"&&e.trim()!==""}async function Mo(e,t={}){let r=h$[e],{flagValue:n,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??Xe();if(bg(n))return cs(n,e),n;let c=process.env[r.env];if(bg(c))return cs(c,e),c;let p=r.manifest(o??{});if(bg(p))return l||u.info(`Using ${e} from webflow.json`),cs(p,e),p;if(!a&&s){let m=await s();return cs(m,e),m}let f=i??r.flagHint;throw new d(`Missing required ${e}. Pass ${f}, set ${r.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:r.missingFlag})}async function Hn(e,t={}){try{return await Mo(e,t)}catch(r){if(r instanceof d&&r.missingFlag===e)return;throw r}}C();var y$=/[\x00-\x1f?#%/\\]/;function Vn(e,t){if(!e||e.trim()==="")throw new d(`Invalid ${t}: value is empty.`,{isUserError:!0});if(y$.test(e)||e.includes(".."))throw new d(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function ve(e,t){Vn(e,t)}function w$(e){if(!e)return"unknown";let t=IS.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var AS=104857600;function RS(e){if(e===0)return"0 B";let t=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${r[n]}`}function b$(){try{let e=(0,kg.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(!/^[0-9a-f]{40}$/.test(e))throw new Error("Invalid commit hash format");try{return(0,kg.execSync)("git status --porcelain --untracked-files=no",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0?`git@${e}+dirty`:`git@${e}`}catch{return`git@${e}`}}catch{return`noversion@${new Date().toISOString()}`}}async function Dg(e,t,r){let n=await fetch(`${O()}${t}`,{method:r.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:r.body?JSON.stringify(r.body):void 0});if(!n.ok){let o=await n.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=_S(i);throw new Error(s)}return n.json()}async function TS(e,t,r,n){let{manifest:o}=oe(),i=o.cloud||{},s=i.framework,a=await Hn("appId",{flagValue:n?.appId,manifest:o});if(!s)throw new d("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=w$(i.framework_version),c=await k$({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:r,environment:t,projectId:a,projectName:n?.projectName,description:n?.description,directory:n?.directory,version:b$()});return!a&&c.project_id&&(Se({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function k$(e){let{siteId:t,framework:r,frameworkVersion:n,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:p}=e,f={framework:r,framework_version:n,mount_path:o,environment:i,version:s};a&&(f.project_id=a),l&&(f.project_name=l),c&&(f.description=c),p&&(f.app_path=p);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Dg(e.apiToken,m,{method:"POST",body:f})}async function PS(e,t){let{siteId:r,accessToken:n}=e,o=r?`/cosmic/${r}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Dg(n,o,{method:"GET"})}async function $S(e){let{siteId:t,accessToken:r}=e,n=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Dg(r,n,{method:"GET"})}async function OS(e,t){if(!us.existsSync(e))throw new Error(`Tarball not found at ${e}`);let r=us.statSync(e);if(r.size>AS)throw new Error(`Build output is too large (${RS(r.size)}). Maximum allowed size is ${RS(AS)}.`);let n=us.readFileSync(e),o=JSON.parse(t);if(!o.fields)throw new Error("Upload URL is missing fields property");let i=new FormData;Object.entries(o.fields).forEach(([l,c])=>{i.append(l,c)});let s=new Blob([n],{type:"application/gzip"});i.append("file",s,"output.tar.gz");let a=await fetch(o.url,{method:"POST",body:i});if(!a.ok){let l=await a.text();throw new d(l,{prefix:`${D} Upload failed with response:`})}}async function LS(e,t){if(!e||e==="undefined")throw new d("Completion URL is undefined or invalid");let r=new URL(e);t&&r.searchParams.set("failed","true");let n=await fetch(r.toString(),{method:"GET"});if(!n.ok)throw new d(`Failed to trigger deployment: ${n.status} ${n.statusText}`)}var NS=require("webflow-api");ke();ke();C();function Eg(e){return new NS.WebflowClient({accessToken:e,environment:{base:`${O()}/v2`,dataApi:`${O()}/v2`,contentDeliveryApi:`${Di()}/v2`}})}async function rl(e,t){try{let n=await Eg(e).sites.get(t);return{id:n.id||t,displayName:n.displayName||"Unknown Site",shortName:n.shortName||"unknown-site",customDomains:n.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new d(r,{prefix:"Error fetching site details:"})}}async function vg(e,t){try{return{customDomains:(await Eg(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(r){throw new d(r,{prefix:"Error fetching custom domains:"})}}async function Sg(e){try{let t=await fetch(`https://${e}/manifest.json`);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(t){throw new d(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function xg(e,t,r){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(n=>{if(n.mountPath!==t)return!1;if(!r)return!0;if(n.workerUrl)try{return new URL(n.workerUrl).hostname.split(".")[0]===r}catch{return!1}return!1}):!1}async function jS(e,t,r){try{let n=Eg(e),o=await rl(e,t),i=[];if(r?.domains&&r.domains.length>0)for(let s of r.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await n.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:r?.publishToWebflowSubdomain??!0})}catch(n){throw new d(n,{prefix:"Error publishing site:"})}}Oe();R();async function MS(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)throw new Error("Site ID is required for mount path validation. Apps without a connected site skip this step.");let i=u.spinner("Validating mount path configuration");try{let s=await rl(o,n),a=await vg(o,n),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(h=>h.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let p=l.map(async h=>{try{let y=await Sg(h),k=Array.isArray(y.cosmic)?y.cosmic.map(F=>F.mountPath).filter(F=>typeof F=="string"):[],v=xg(y,t,r);return{domain:h,mountPaths:k,isValid:v===!0}}catch(y){return{domain:h,mountPaths:[],isValid:!1,error:y instanceof Error?y.message:String(y)}}finally{c++,i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (${c}/${l.length})`)}}),f=await Promise.all(p),m=f.some(h=>!h.isValid),g=f.every(h=>h.isValid);return i.succeed("Mount path validation completed"),{isValid:g,domains:f,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function BS(e,t,r){let{siteId:n,accessToken:o}=e;if(!n)return[];try{let i=await rl(o,n),s=await vg(o,n),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(p=>p.url)||[]].map(async p=>{try{let f=await Sg(p),m=xg(f,t,r);return{domain:p,isValid:m}}catch(f){return u.debug(`Could not verify mount path for ${p}: ${f}`),{domain:p,isValid:!1}}});return(await Promise.all(l)).filter(p=>p.isValid).map(p=>p.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function US(e,t){return e.map(r=>`${r.startsWith("localhost")||r.startsWith("127.0.0.1")?"http":"https"}://${r}${t}`)}async function WS(e){let t=e.map(n=>({name:n,value:n,checked:!0})),r=await Cr({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:n=>n.length===0?"Please select at least one domain to publish to.":!0});return r??[]}async function HS(){return await $e({message:"The mount path doesn't match on some domains. Would you like to publish the site to update the configuration?",default:!0})}async function Cg(e,t){let{siteId:r,accessToken:n}=e;if(!r)throw new Error("Site ID is required to publish. Apps without a connected site do not use this.");let o=u.spinner(`Publishing site to ${t.length} domain(s)`);try{let s=`${(await rl(n,r)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await jS(n,r,{domains:l,publishToWebflowSubdomain:a}),o.succeed(`Site published successfully to selected domains: ${t.join(", ")}`)}catch{throw o.fail("Failed to publish site"),new Error("Failed to publish site")}}R();me();var Uo=w(require("path"));Pe();ke();we();var VS="apps";function Fg(e){VS=e}function ds(){return VS}var Gu=w(require("fs"));C();ke();Oe();C();R();async function ps(e){let t=await fetch(`${O()}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let n=await t.text(),o={};try{o=JSON.parse(n)}catch{}throw t.status===403&&o.code==="missing_scopes"?new d(`Missing required scopes for workspace access.
|
|
152
152
|
${o.message??""}
|
|
153
|
-
Re-run 'webflow auth login' to grant the necessary permissions.`):new
|
|
154
|
-
${o.message}`:""))}return(await t.json()).workspaces}async function
|
|
155
|
-
Use ${
|
|
156
|
-
`);let{framework:
|
|
157
|
-
To list your Cloud apps, use ${
|
|
153
|
+
Re-run 'webflow auth login' to grant the necessary permissions.`):new d(`Failed to fetch workspaces: ${t.status} ${t.statusText}`+(o.message?`
|
|
154
|
+
${o.message}`:""))}return(await t.json()).workspaces}async function fs(e){if(e.length===1)return e[0];let t=await je({message:"Select the workspace for this app:",choices:e.map(r=>({name:r.name,value:r}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}Yc();j();R();j();me();async function _g(e,t){u.warn(`${X} ${ue("webflow cloud create")} is deprecated and will be removed in the next major release.
|
|
155
|
+
Use ${z("webflow cloud init")} instead.
|
|
156
|
+
`);let{framework:r}=t;if(!(await ms()).find(i=>i===r)){u.error(`Framework ${r} not found`);return}await Vu(e,"/app",r,void 0,Ce.Existing,void 0)}R();me();j();qr();async function Ag(){let e=Ke()?"webflow apps init":"webflow cloud init",t=Ke()?`
|
|
157
|
+
To list your Cloud apps, use ${z("webflow apps list")}.`:"";u.warn(`${X} ${ue("webflow cloud list")} is deprecated and will be removed in the next major release.
|
|
158
158
|
It lists scaffold templates, not your apps.
|
|
159
|
-
Use ${
|
|
160
|
-
`);let
|
|
161
|
-
- `);throw new
|
|
159
|
+
Use ${z(`${e} --framework`)} / ${z("--help")} for available templates.${t}
|
|
160
|
+
`);let r=await ms();u.info("Available app templates:"),r.length>0?r.forEach(n=>u.info(`- ${n}`)):u.info("No templates found.")}Y();C();we();Oe();R();j();var GS=w(require("path"));function dn(e){if(!e||e.trim()==="")return"/";let t=GS.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((n,o)=>o===0?n:encodeURIComponent(n)).join("/"),t}var D$=/^\/([a-zA-Z0-9_.~-]+(\/[a-zA-Z0-9_.~-]+)*)?$/;function Bo(e){return!e||e.trim()===""||!e.startsWith("/")||e.includes("..")?!1:D$.test(e)}me();R();j();function nl(e,t){u.warn(`${X} ${ue(e)} is deprecated; use ${z(t)} instead.`)}async function Rg(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");e.projectName!==void 0&&nl("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new d("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new d("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let r=process.stdin.isTTY,n;r&&lr()&&(n=await T());let o=!1;if(n&&!e.new&&!e.siteId)try{(await xn(n)).length===0&&(u.info(`${xe} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(g){u.debug(`Skipped sites lookup in cloud init preflight: ${g}`)}let i=await ms(),s={};if(r&&lr()){if(!e.new&&!o&&(s.initMode=await je({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:Ce.New},{name:"Existing site",value:Ce.Existing}],default:Ce.New})),e?.framework||(s.scaffoldName=await je({message:"Which framework would you like to use?",choices:i.map(h=>({name:h,value:h})),default:"astro"})),!t){let h=await Ge({message:"What would you like to name your app?",validate:y=>{let k=y.trim();return k===""?"App name cannot be empty":k.length<Jt||k.length>zt?`App name must be between ${Jt} and ${zt} characters`:!0}});if(h==null)throw new d("When --no-input mode is enabled please provide the --app-name option.");s.appName=h}let g=e.new||o||s.initMode===Ce.New;!e.mount&&!g&&(s.mountPath=await Ge({message:"What path do you want to use locally? (e.g., /app)",default:"/app"}))}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?Ce.New:s.initMode??(e.siteId?Ce.Existing:V()?Ce.New:Ce.Existing),p=c===Ce.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",f=e.siteId,m=dn(p);if(!a||typeof a!="string"||a.trim()==="")throw new d("--app-name cannot be empty");if(a.length<Jt||a.length>zt)throw new d(`--app-name must be between ${Jt} and ${zt} characters`);if(!l)throw new d("--framework is required");if(!i.includes(l)){let g=i.join(`
|
|
161
|
+
- `);throw new d(`--framework "${l}" not found
|
|
162
162
|
|
|
163
163
|
Available frameworks:
|
|
164
|
-
- ${
|
|
165
|
-
${
|
|
166
|
-
Re-run 'webflow auth login' to grant the necessary permissions.`):new
|
|
167
|
-
Upgrade your plan or remove unused apps to create a new one.`):new
|
|
168
|
-
${
|
|
169
|
-
${
|
|
170
|
-
${
|
|
171
|
-
${
|
|
172
|
-
`+
|
|
164
|
+
- ${g}`)}if(typeof m!="string"||!Bo(m))throw new d(`Invalid mount path: ${JSON.stringify(p)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);if(c===Ce.Existing&&!f&&(!r||V()))throw new d("--site-id is required when connecting to an existing site in non-interactive mode.");await Vu(a,m,l,f,c,e.workspaceId)}var XS=w(require("path"));Y();C();we();Oe();R();j();Pe();Z();el();var KS=require("crypto");ke();C();async function JS(e){let{accessToken:t,workspaceId:r,displayName:n,description:o,appPath:i}=e,a={requestId:(0,KS.randomUUID)(),cloudApp:{displayName:n,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:ov}}}},l=`${O()}/cosmic/workspaces/${r}/cloudApps`,c=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Version":"1.0.0"},body:JSON.stringify(a)});if(!c.ok){let p=await c.text();throw E$(c.status,c.statusText,p)}return c.json()}function E$(e,t,r){let n={};try{n=JSON.parse(r)}catch{}return e===403?n.publicErrorCode==="missing_scopes"?new d(`Missing required scopes to create a Cloud app.
|
|
165
|
+
${n.msg??""}
|
|
166
|
+
Re-run 'webflow auth login' to grant the necessary permissions.`):new d(n.msg??"You don't have permission to create apps in this workspace."):e===404?new d("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?n.publicErrorCode==="workspace_unhosted_project_limit"?new d(v$(n.planName,n.limit)):n.msg?.includes("No new sites can be created")?new d(`Failed to create app: your workspace has reached its app limit.
|
|
167
|
+
Upgrade your plan or remove unused apps to create a new one.`):new d(n.msg??"A Cloud app creation request is already being processed. Please wait and try again."):new d(`Failed to create app: ${e} ${t}`+(n.msg?`
|
|
168
|
+
${n.msg}`:""))}function v$(e,t){let r="Upgrade your plan or remove unused apps to create a new one.",n=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${n}.
|
|
169
|
+
${r}`:typeof t=="number"&&t>0?`Your workspace is limited to ${t} ${n}.
|
|
170
|
+
${r}`:e?`Your "${e}" workspace has reached its Cloud app limit.
|
|
171
|
+
${r}`:`Failed to create app: your workspace has reached its app limit.
|
|
172
|
+
`+r}Pe();C();we();Oe();Y();async function YS(e={}){S$(e);let t=await x$(e,oe().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:oe().manifest}}function S$(e){if(e.siteId&&e.workspaceId)throw new d("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function x$(e,t){if(e.siteId)return zS(t,e.siteId);if(e.workspaceId)return qS(e.workspaceId);let r=await Hn("siteId",{manifest:t});if(r)return zS(t,r);let n=await Hn("workspaceId",{manifest:t});if(n)return qS(n);if(V()||!lr())throw new d(`No identity configured for this app.
|
|
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
|
|
177
|
-
Use --app-name to provide a valid name.`);let
|
|
178
|
-
No existing apps found. A new app will be created during deployment.`)}catch(
|
|
179
|
-
Available frameworks: ${s.supportedIds.join(", ")}`),new
|
|
180
|
-
Available frameworks: ${s.supportedIds.join(", ")}`),new
|
|
181
|
-
Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid
|
|
182
|
-
\u{1F310} Your cloud app will soon be available at:`);try{let o=
|
|
176
|
+
Or run 'webflow cloud init' to scaffold a new app.`);return F$(t)}async function zS(e,t){return{credentials:await Je(e,{site:t})}}async function qS(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function C$(){let e=await T(),t=await ps(e);if(t.length===0)throw new Cn("No workspaces found in your account. Please make sure you have at least one workspace.");let r=await fs(t);return Se({cloud:{workspace_id:r.id}}),{workspaceId:r.id,credentials:{accessToken:e,siteId:""}}}async function F$(e){let t=await je({message:"This app isn't initialized for Webflow Cloud. How would you like to deploy?",choices:[{name:"Create a new app",value:"standalone"},{name:"Attach to an existing Webflow site",value:"site-attached"},{name:"Cancel",value:"cancel"}]});if(t==="cancel"||!t)throw new d("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?C$():{credentials:await Je(e,{})}}async function Ig(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new d("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");if(e.appId!==void 0&&e.projectId!==void 0)throw new d("--app-id and --project-id are aliases of the same option. Pass exactly one (--app-id is preferred; --project-id is deprecated).");e.projectName!==void 0&&nl("--project-name","--app-name"),e.projectId!==void 0&&nl("--project-id","--app-id");let t=e.appName??e.projectName,r=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(y){throw u.error(`Error: Could not change to directory ${e.directory}`),new d(y)}if(e.framework){if(!Za.includes(e.framework))throw new d(`Framework "${e.framework}" is not supported. Allowed: ${Za.join(", ")}.`);Se({cloud:{framework:e.framework}})}let n=await YS({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=n,{credentials:i,manifest:s}=n,a=!!o;if(o){let y=XS.default.basename(process.cwd()).trim(),k=y.length>=Jt&&y.length<=zt,v=t??(k?y:"Cloud App");if(v.length<Jt||v.length>zt)throw new d(`App name must be between ${Jt} and ${zt} characters (got ${v.length}).
|
|
177
|
+
Use --app-name to provide a valid name.`);let F=u.spinner("Creating Cloud app...");try{let S=await JS({accessToken:i.accessToken,workspaceId:o,displayName:v});F.succeed(`Cloud app created: ${S.cloudApp.displayName}`),Se({siteId:S.cloudApp.siteId,cloud:{...s.cloud,app_id:S.cloudApp.project.id,environment_id:S.cloudApp.environment.id}}),Yr({siteId:S.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=S.cloudApp.siteId,{manifest:s}=oe()}catch(S){throw F.fail("Failed to create app"),new d(S,{prefix:"Could not create app:"})}let E=s.siteId;if(!E)throw new d("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:E}}let l;try{l=_.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(y){u.debug(`Failed to initialize telemetry: ${y}`)}let c=await Hn("appId",{flagValue:r,manifest:s}),p,f,m,g=t,h=e.description;if(e.environment&&e.mount){if(p=e.environment,m=e.mount,f=dn(e.mount),!Bo(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`)}else{let y=[];if(!c){if(!g&&V())throw new d("When --no-input mode is enabled, provide --app-name to create an app, or provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json to deploy to an existing app.");try{let v=await $S(i);if(v.projects.length>0){let F=await je({message:"Select an app to deploy to:",choices:[...v.projects.map(E=>({name:`${E.name} (${E.description||"No description"})`,value:E.id})),{name:"Create new app",value:null}]});F?(c=F,Se({cloud:{app_id:F}}),u.info(`${$} App ID updated in webflow.json`)):u.info("Creating a new app will be handled during deployment.")}else u.info(`
|
|
178
|
+
No existing apps found. A new app will be created during deployment.`)}catch(v){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(v instanceof Error?v.message:String(v))}}if(!c&&!g&&(g=await Ge({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:v=>v.trim()===""?"App name cannot be empty":!0})),c)try{let F=(await PS(i,c)).environments.map(E=>({name:`${E.branch} (${E.mount})`,value:{branch:E.branch,mount:E.mount}}));y.push(...F)}catch(v){throw new d(v,{prefix:"Error fetching app environments:"})}y.push({name:"Create new environment",value:null});let k=await je({message:"Select an environment to deploy to:",choices:y});k?(p=k.branch,m=k.mount,f=dn(k.mount)):(e.environment?p=e.environment:p=await Ge({message:"What environment would you like to deploy to?",default:"main",validate:v=>v.trim()===""?"Environment cannot be empty":!0}),e.mount?(m=e.mount,f=dn(e.mount)):(m=await Ge({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"}),f=dn(m)))}if(!Bo(f))throw new d(`Invalid mount path: ${JSON.stringify(m)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`);await ZS(i,p,f,{projectName:g,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new d(t,{prefix:"Error during deployment setup:"})}}var ol=null;process.once("exit",()=>ol?.());var QS=(e,t,r)=>t instanceof po?"no-sites":t instanceof Cn?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&r===Ce.New?"no-workspaces":"unknown",ms=async()=>{try{let e=Hm(),t=Vm();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},_$=async(e,t,r)=>{let n;if("content"in r)n=r.content.files;else{let l=r[t];if(!l)throw new Error(`Scaffold "${t}" not found`);n=l}let o=n.find(l=>l.includes(yo));if(!o)throw new Error(`No ${yo} found in scaffold "${t}"`);await Gu.promises.mkdir(e,{recursive:!0});let s=(await Gu.promises.readFile(o,"utf8")).replace(yu,e),a=Uo.join(e,yo);await Gu.promises.writeFile(a,s,"utf8")},Vu=async(e,t,r=hu,n,o=Ce.Existing,i)=>{if(o===Ce.New){try{let s=await Jm(r);await A$(e,t,s.scaffoldId,{content:s},r,i)}catch(s){if(s instanceof et){let a=s.message;throw s.supportedIds?.length&&(a+=`
|
|
179
|
+
Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}return}try{let s=await bu(r);await R$(e,t,r,{content:s},n)}catch(s){if(s instanceof et){let a=s.message;throw s.supportedIds?.length&&(a+=`
|
|
180
|
+
Available frameworks: ${s.supportedIds.join(", ")}`),new d(a)}throw s}},A$=async(e,t,r,n,o,i)=>{let s=`./${e}`,a="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,l=a?Uo.dirname(a.extractionRoot):null,c="auth",p=!1,f=!1,m=null;try{let g=Date.now(),h=await T();c="workspaces";let y;if(i)y={id:i};else{let F=await ps(h);if(F.length===0)throw new Cn("No workspaces found in your account. Please make sure you have at least one workspace.");y=await fs(F)}c="scaffold",await Oa(e,t,r,n,void 0,void 0),f=!0,process.chdir(s);let k=o??r;Se({cloud:{framework:k,workspace_id:y.id}}),Yr({apiToken:h,directory:"."}),process.env.WEBFLOW_API_TOKEN=h;let v=Date.now()-g;try{await _.forCloud({authToken:h}).sendUsage("project_init",{scaffold:k,scaffoldName:k,initMode:Ce.New,workspaceId:y.id,totalDuration:v,mountPath:t,namespace:ds()})}catch{}p=!0}catch(g){if(m=g,g instanceof d||g instanceof Error&&g.message.includes("OAuth")){try{await Oa(e,t,r,n),process.chdir(s),Se({cloud:{framework:o??r}}),Yr({directory:"."}),f=!0}catch{}throw u.error(g),new d(g,{skipLogging:!0})}throw g}finally{if(l)try{Tg.default.removeSync(l)}catch{}if(p){let g=tx(e,Ce.New);ol=()=>u.info(g)}else{let g=QS(c,m,Ce.New),h=rx(e,Ce.New,g,f);ol=()=>u.info(h)}}},R$=async(e,t,r,n,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in n&&typeof n.content=="object"&&"extractionRoot"in n.content?n.content:null,c=l?Uo.dirname(l.extractionRoot):null,p="auth",f=!1,m=!1,g=null;try{let h=Date.now();await _$(e,r,n),process.chdir(i);let{manifest:y}=oe(),k=await Je(y,{site:o}),v=k.accessToken,F=k.siteId;if(s=_.forCloud({authToken:v,siteId:F}),p="scaffold",await Oa(".",t,r,n,F,v),m=!0,p="devlink",F){u.info(`${xe} Running devlink export to fetch your Webflow components`);try{await I$({site:F,apiToken:v}),a=!0}catch(S){mo(S)?u.info(`${xe} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(S,{prefix:"Failed to run devlink export:"})}}let E=Date.now()-h;await s?.sendUsage("project_init",{scaffold:r,scaffoldName:r,devlinkSyncStatus:a,totalDuration:E,mountPath:t,namespace:ds()}),f=!0}catch(h){g=h,u.error(h);try{await Oa(".",t,r,n),m=!0}catch{}throw new d(h,{skipLogging:!0})}finally{if(c)try{Tg.default.removeSync(c)}catch{}if(f){let h=tx(e,Ce.Existing);ol=()=>u.info(h)}else{let h=QS(p,g,Ce.Existing),y=rx(e,Ce.Existing,h,m);ol=()=>u.info(y)}}},I$=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(Yc(),OD));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},T$=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=oe();return Um(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},P$=async(e,t,r,n)=>{u.info(Ne("Validating mount path configuration..."));let o=await MS(e,t,r);if(o.isValid)u.info(z("Mount path validation passed"));else if(u.info(P(`
|
|
181
|
+
Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?$:X,a=i.isValid?z(`${i.domain} (mountPath: ${i.mountPaths[0]})`):ue(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(n){u.info("\u{1F680} Auto-publishing site to update mount path configuration...");let i=o.domains.filter(s=>!s.isValid).map(s=>s.domain);await Cg(e,i)}else if(await HS()&&lr()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await WS(s);await Cg(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},$$=async(e,t,r,n)=>{yg("\u{1F3D7}\uFE0F ","Building app");let o=await SS(e,{mountPath:r,telemetry:n?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id,serverBuildEngine:t.build_engine});yg("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await OS(o,t.upload_url);let s=Date.now()-i;return u.info(`${$} Upload completed in ${(s/1e3).toFixed(1)}s`),o},O$=async(e,t,r,n)=>{u.success(`
|
|
182
|
+
\u{1F310} Your cloud app will soon be available at:`);try{let o=n?.domainsOverride??await BS(e,t,r),i=US(o??[],t);i?.length>0?i.forEach(s=>{u.info(` ${s}`)}):u.warn(" No domains found with the correct mount path configuration yet.")}catch(o){u.warn(` Could not determine deployment links: ${o instanceof Error?o.message:o}`)}},L$=e=>{e.site_slug?u.success(`Visit your deployment:
|
|
183
|
+
|
|
184
|
+
${xr()}/dashboard/sites/${e.site_slug}/webflow-cloud/projects/${e.project_id}/environments/${e.environment_id}/deployments/${e.deployment_id}`):u.info(`
|
|
185
|
+
Visit the webflow Cloud dashboard to view your deployment: https://webflow.com/dashboard/sites`)},N$=async(e,t,r,n,o)=>{try{if(await LS(t.completion_url,!!n),n)u.error(`
|
|
186
|
+
${D} Deployment failed due to build error.`);else{u.success(`
|
|
187
|
+
${$} Deployment triggered successfully!`);let i;try{let{manifest:s}=oe();Um(s)&&(i=[`${o?.projectName??Uo.basename(process.cwd())}.webflow.io`])}catch(s){u.debug(`Could not read manifest for standalone deploy link hint: ${s instanceof Error?s.message:String(s)}`)}await O$(e,r,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),L$(t)}}catch(i){throw new d(i,{prefix:"Failed to trigger deployment:"})}},j$=(e,t)=>{e&&CS(process.cwd(),e),t&&xS(t)},ZS=async(e,t,r,n)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=wg(process.cwd()),p=n?.telemetry;await p?.sendUsage("cloud_deploy_start",{environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,cloudflareBindings:c,namespace:ds()});try{sS(u,process.cwd()),o=await TS(e,t,r,n),u.info("\u{1F527} Detecting framework..."),a=await vS(process.cwd(),o.deploy_url,o.environment_id,r,o.build_engine),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),T$(n)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await P$(e,r,o.environment_id,n?.autoPublish),i=await $$(a,o,r,n),u.info(`Starting deployment process for environment: ${t} at mount path: ${r}`);let f=Date.now()-s;await p?.sendUsage("cloud_deploy_success",{duration:f,environment:t,mountPath:r,projectName:n?.projectName,hasDescription:!!n?.description,hasDirectory:!!n?.directory,framework:a.info.name,buildCommand:a.getBuildCommand(),cloudflareBindings:c,namespace:ds()})}catch(f){l=f instanceof Error?f:new Error(String(f)),u.error(l,{prefix:"Error during deployment initialization:"});let m=Date.now()-s;await p?.sendError(l,"cloud_deploy_failure",{duration:m,environment:t,mountPath:r,projectName:n?.projectName,cloudflareBindings:c,argv:process.argv.slice(2),namespace:ds()})}finally{if(j$(a,i),o&&await N$(e,o,r,l,{projectName:n?.projectName}),l)throw new d(l,{skipLogging:!0})}},ex=e=>{let t=Math.max(...e.map(i=>bt(i).length)),r=P(`\u250C${"\u2500".repeat(t+2)}\u2510`),n=P(`\u2514${"\u2500".repeat(t+2)}\u2518`),o=e.map(i=>{let s=" ".repeat(t-bt(i).length);return`${P("\u2502")} ${i}${s} ${P("\u2502")}`});return[r,...o,n].join(`
|
|
188
|
+
`)},tx=(e,t)=>{let r=[_t(`${rt} Get started with the following commands:`),z(`cd ${e}`),z("npm install"),z("npm run dev"),z("webflow cloud deploy")];return t!==Ce.New&&(r.push(""),r.push(_t(`${rt} Run the following command to export Webflow components when they update:`)),r.push(z("webflow devlink export"))),ex(r)},rx=(e,t,r,n=!0)=>{let o=[],i=t===Ce.New?"webflow cloud init --new":"webflow cloud init",s=l=>n?`App scaffold created at ${e}/ but ${l}`:l.charAt(0).toUpperCase()+l.slice(1),a=n?[z(`cd ${e}`)]:[];switch(r){case"auth":o.push(_t(`${rt} ${s("Webflow authentication did not complete.")}`),"",_t(n?"To finish setup:":"To retry:"),...a,z("webflow auth login"),z(i));break;case"no-sites":o.push(_t(`${rt} ${s("no Webflow sites were found in your account.")}`),"",_t(n?"Create a site in the Webflow Designer, then:":"Create a site in the Webflow Designer, then rerun:"),...a,z("webflow cloud init"));break;case"no-workspaces":o.push(_t(`${rt} ${s("no Webflow workspaces were found in your account.")}`),"",_t(n?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,z("webflow cloud init --new"));break;default:o.push(_t(`${rt} ${s("setup did not complete.")}`),"",_t(n?"To retry setup:":"To retry:"),...a,z(i));break}return ex(o)};j();qr();var pn=require("commander");Y();C();R();j();Z();ke();C();lt();lt();C();async function il(e,t,r,n){let o=[],i=0,s=100;for(;;){let a=new URL(e);a.searchParams.set("limit",String(s)),a.searchParams.set("offset",String(i));let l=await K(a.toString(),{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!l.ok)throw new d(`${n}: ${l.status} ${l.statusText}`);let c=await l.json(),p=c[r]??[];o.push(...p);let f=c.pagination?.total??p.length;if(i+=p.length,i>=f||p.length<s)break}return o}function Gn(e,t){if(Array.isArray(e))return{items:e,nextCursor:null};if(e&&typeof e=="object"){let r=e;return{items:r[t]??[],nextCursor:r.nextCursor??null}}return{items:[],nextCursor:null}}var M$=100;async function gs(e,t){let r=[],n=t?.maxPages??M$,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(r.push(...a),s+=1,t?.stopWhen?.(r)||!l)break;if(o.has(l))throw new d("Pagination aborted: the server returned a repeated cursor, which would loop indefinitely.");if(o.add(l),s>=n)throw new d(`Pagination aborted after ${n} pages (safety cap). The result set is larger than expected.`);i=l}return r}C();var nx="GITHUB_APP_NOT_INSTALLED",ox="GITHUB_REPO_NOT_CONNECTED",hs=class extends d{code;installUrl;constructor(t,{code:r,installUrl:n}){super(t,{isUserError:!0}),this.name="GithubConnectionError",this.code=r,this.installUrl=n}};function B$(e){let t=e.meta,r=e.extras,n=t?.installUrl??e.installUrl??r?.installUrl;if(typeof n=="string")try{let o=new URL(n);return o.protocol==="https:"&&o.hostname==="github.com"?n:void 0}catch{return}}function ix(e,t){return new RegExp(`\\b${t}\\b`).test(e)}function sx(e){if(!e||typeof e!="object")return null;let t=e,r=t.message??t.msg;if(typeof r!="string")return null;let n=B$(t),o=n?`
|
|
183
189
|
|
|
184
|
-
${
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
${P} Deployment triggered successfully!`);let i;try{let{manifest:s}=ne();_m(s)&&(i=[`${o?.projectName??No.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 jP(e,n,t.environment_id,i!==void 0?{domainsOverride:i}:void 0),MP(t)}}catch(i){throw new f(i,{prefix:"Failed to trigger deployment:"})}},UP=(e,t)=>{e&&Wv(process.cwd(),e),t&&Uv(t)},mS=async(e,t,n,r)=>{let o=null,i=null,s=Date.now(),a=null,l=null,c=zm(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:ls()});try{Av(u,process.cwd()),o=await zv(e,t,n,r),u.info("\u{1F527} Detecting framework..."),a=await Mv(process.cwd(),o.deploy_url,o.environment_id,n),u.info(`Framework: ${a.info.displayName}`),u.info(`Build command: ${a.getBuildCommand()}`),OP(r)?u.info("\u23ED\uFE0F Skipping mount path validation..."):await LP(e,n,o.environment_id,r?.autoPublish),i=await NP(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:ls()})}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:ls()})}finally{if(UP(a,i),o&&await BP(e,o,n,l,{projectName:r?.projectName}),l)throw new f(l,{skipLogging:!0})}},hS=e=>{let t=Math.max(...e.map(i=>bt(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-bt(i).length);return`${I("\u2502")} ${i}${s} ${I("\u2502")}`});return[n,...o,r].join(`
|
|
188
|
-
`)},yS=(e,t)=>{let n=[At(`${nt} 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(At(`${nt} Run the following command to export Webflow components when they update:`)),n.push(J("webflow devlink export"))),hS(n)},wS=(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(At(`${nt} ${s("Webflow authentication did not complete.")}`),"",At(r?"To finish setup:":"To retry:"),...a,J("webflow auth login"),J(i));break;case"no-sites":o.push(At(`${nt} ${s("no Webflow sites were found in your account.")}`),"",At(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(At(`${nt} ${s("no Webflow workspaces were found in your account.")}`),"",At(r?"Create a workspace, then:":"Create a workspace, then rerun:"),...a,J("webflow cloud init --new"));break;default:o.push(At(`${nt} ${s("setup did not complete.")}`),"",At(r?"To retry setup:":"To retry:"),...a,J(i));break}return hS(o)};M();Kn();var jo=require("commander");pe();A();M();Kn();function bS(e,t,n){Je()&&e==="cloud"&&(n.json||u.warn(`${Q} ${le(`webflow cloud ${t}`)} is deprecated \u2014 use ${le(`webflow apps ${t}`)} instead.`))}function Tu(e,{namespace:t}){e.command("init").description("Bootstrap a new Webflow Cloud app").addOption(new jo.Option("-n, --app-name <name>","App name")).addOption(new jo.Option("--project-name <name>",`${Hn} 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)=>{rg(t),bS(t,"init",n),await WP(n,r)})}function Pu(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 jo.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new jo.Option("--project-name <name>",`${Hn} 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 jo.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new jo.Option("--project-id <appId>",`${Hn} 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)=>{rg(t),bS(t,"deploy",n),await HP(n,r)})}var WP=sg,HP=ag;var DS=e=>{let t=Je(),n=e.command("cloud").description(t?`${Hn} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");n.command("create").description(`${Hn} 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(og),n.command("list").description(t?`${Hn} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Hn} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(ig),Tu(n,{namespace:"cloud"}),Pu(n,{namespace:"cloud"})};var US=require("commander");q();C();A();M();X();De();C();lt();lt();C();async function el(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(),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 Mo(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 VP=100;async function tl(e,t){let n=[],r=t?.maxPages??VP,o=new Set,i,s=0;for(;;){let{items:a,nextCursor:l}=await e(i);if(n.push(...a),s+=1,t?.stopWhen?.(n)||!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 ps(e){return Object.values(e).some(t=>t!==void 0)}function fs(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 GP="1.0.0";function gt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":GP}}async function Ct(e,t={}){let{scopeLabel:n="apps",fallbackPrefix:r,userErrorOn4xx:o=!1}=t,i={};try{let c=JSON.parse(await e.text());c!==null&&typeof c=="object"&&(i=c)}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new f(`Missing required scopes for ${n}.
|
|
190
|
+
${n}
|
|
191
|
+
|
|
192
|
+
The link is signed and expires; re-run this command to get a fresh one.`:"";return ix(r,nx)?new hs(`The Webflow GitHub App is not installed on the account that owns this repository. Install it, then re-run this command.${o}`,{code:nx,installUrl:n}):ix(r,ox)?new hs(`The Webflow GitHub App is installed on this repository, but that installation is not connected to your workspace yet. Authorize the connection, then re-run this command.${o}`,{code:ox,installUrl:n}):null}var sl=100;function ys(e){return Object.values(e).some(t=>t!==void 0)}function Wo(e,t={}){let r=[];if(t.limit!==void 0&&Number.isFinite(t.limit)&&r.push(`limit=${encodeURIComponent(String(t.limit))}`),t.cursor&&r.push(`cursor=${encodeURIComponent(t.cursor)}`),t.filters)for(let[n,o]of Object.entries(t.filters)){if(o===void 0)continue;let i=o.trim();if(i==="")throw new d(`List filter "${n}" must be a non-empty value.`,{isUserError:!0});r.push(`${n}=${encodeURIComponent(i)}`)}return r.length>0?`${e}?${r.join("&")}`:e}var U$="1.0.0";function tt(e){return{Authorization:`Bearer ${e}`,Accept:"application/json","Accept-Version":U$}}async function ht(e,t={}){let{scopeLabel:r="apps",fallbackPrefix:n,userErrorOn4xx:o=!1}=t,i={};try{let c=JSON.parse(await e.text());c!==null&&typeof c=="object"&&(i=c)}catch{}let s=i.msg??i.message;if(e.status===403&&i.publicErrorCode==="missing_scopes")return new d(`Missing required scopes for ${r}.
|
|
189
193
|
${s??""}
|
|
190
|
-
Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0});let a=
|
|
191
|
-
${s}`:""),l?{isUserError:!0}:void 0)}async function
|
|
192
|
-
`);throw new
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
`)
|
|
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}=ne(),r=await Lo("appId",{flagValue:t.appId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>ju(e,{json:t.json})}),o=await Lo("environmentId",{flagValue:t.environmentId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>RS(e,r,{json:t.json})});return{appId:r,envId:o}}async function mg(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,Mu,Wr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await xS(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(Bu(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 gg(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,Mu,Wr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await CS(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(Bu(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 hg(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=e.json?void 0:_e(e.fields,yc,Sr()),i=F.forApps({authToken:t}),s=Date.now();try{let a=await FS(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(ga(a.deployments,o)+Fi(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 XP=5,IS=1800;function YP(e){return new Promise(t=>setTimeout(t,e))}async function TS(e,t,n,r,o={}){let i=Math.min(IS,Math.max(XP,o.interval??gc)),s=Math.min(IS,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 Nu(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(cD(g))break;let y=a-Date.now();if(y<=0){d=!0;break}if(g!==l&&o.onStatusChange?.(l,g),l=g,await YP(Math.min(i*1e3,y)),Date.now()>=a){d=!0;break}}return{deployment:c,timedOut:d,timeoutSeconds:s}}async function yg(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,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 TS(n,r,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:d?(y,b)=>u.info(I(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(ga([p],i)),m&&u.warn(`Timed out after ${h}s waiting for a terminal status (last status: ${p?.status??"unknown"}).`);return}let c=await Nu(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(ga([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 wg(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"),Br(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 _S(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(`${P} 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 PS=require("child_process");function $S(){try{let e=(0,PS.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 ZP(e){let t=$S();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function QP(e,t,n){try{return(await ms(e,t)).find(o=>o.id===n)}catch{return}}async function bg(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=await QP(t,n,r);if(ZP(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 AS(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(`${P} 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 Dg(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 Ln(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 kS(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(`${P} 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 kg(e,t){let n=await T(),r=await Ln(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 Lu(n,r),a=lD(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 ES(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 gs=100;function Eg(e,t){return`${$()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function vg(e,t){return Ct(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function e$(e,t,n,r,o={}){let i=fs(Eg(t,n),{limit:$u,cursor:r,filters:o}),s=await G(i,{headers:gt(e)});if(!s.ok)throw await vg(s,"Failed to list environment variables");return Mo(await s.json(),"variables")}async function Sg(e,t,n,r={}){return tl(o=>e$(e,t,n,o,r))}async function xg(e,t,n,r){let o=await G(`${Eg(t,n)}/${encodeURIComponent(r)}`,{method:"DELETE",headers:gt(e)});if(!o.ok)throw await vg(o,"Failed to delete environment variable")}async function rl(e,t,n,r,o){let i=Object.keys(r).length;if(i>gs)throw new f(`Cannot import more than ${gs} variables at once (received ${i}).`,{isUserError:!0});let s=await G(`${Eg(t,n)}/bulk`,{method:"POST",headers:{...gt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:r,overwriteExisting:o})});if(!s.ok)throw await vg(s,"Failed to import environment variables");return await s.json()}var OS=require("dotenv");pe();var LS=["key","isSecret","value","id","environmentId"],ol=["key","isSecret"];function hs(){return LS}var Cg=dt(LS);function t$(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 Fg(e,t=ol){if(e.length===0)return I("No environment variables found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>t$(o,i)));return qe(n,r)}function _g(e){let t=e.split(/\r?\n/).map(n=>n.replace(/^\s*export\s+/,"")).join(`
|
|
197
|
-
`);return(0,OS.parse)(t)}async function Ag(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=ps(s),l=await Sg(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,Cg,hs());u.info(Fg(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 NS(){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 Rg(e){u.warn(`${Q} 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 jS(e,t){if(e!==void 0)return t.secret&&!t.json&&Rg(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let n=await NS();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 Pb({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 Ig(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&&Rg(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 jS(t,{key:e,secret:n.secret,json:n.json}),p={[e]:{value:c,...n.secret?{isSecret:!0}:{}}},m=await rl(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(`${P} 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 Tg(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 xg(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(`${P} 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 MS=require("fs"),BS=require("path");q();C();A();M();X();function Pg(e){return e.map(({id:t,environmentId:n,key:r,isSecret:o})=>({id:t,environmentId:n,key:r,isSecret:o}))}async function $g(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,MS.readFileSync)((0,BS.resolve)(e),"utf8")}catch{throw new f(`Could not read file: ${e}`,{isUserError:!0})}let l=_g(a),c=Object.keys(l);if(c.length===0)throw new f(`No variables found in ${e}.`,{isUserError:!0});if(c.length>gs)throw new f(`Cannot import more than ${gs} 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 rl(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:Pg(p.created),updated:Pg(p.updated),skipped:Pg(p.skipped),errors:p.errors},null,2));else{u.info(`${P} 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:`}))}}Kn();var WS=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");Tu(t,{namespace:"apps"}),Pu(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. ${wc("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.",_i).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",_i).addOption(bc("the app name")).addOption(ee()).addOption(He([...vr()]).default(uc)).action(cg),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(ee()).addOption(He([...vr()]).default(Ff)).action(ug),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([...pa()]).default(dc)).addOption(ee()).option("--limit <n>","Max number of domains to return (server caps at 100)",vc).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(dg),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(ee()).addOption(Ae()).action(Dg),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(Ai()).addOption(ee()).addOption(Ae()).action(kg)),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). ${wc("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.",_i).addOption(bc("the environment branch")).addOption(He([...fa()]).default(pc)).addOption(ee()).action(pg);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(pD()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(ee()).addOption(He([...Sr()]).default(ma)).action(hg),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 US.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(mD()).addOption(gD()).addOption(ee()).addOption(He([...Sr()]).default(ma)).action(yg),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(ee()).addOption(Ae()).action(wg),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(ee()).addOption(Ae()).action(bg);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(ee()).addOption(He([...Wr()]).default(nl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption($f()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(mg),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(ee()).addOption(He([...Wr()]).default(nl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption($f()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(gg);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). ${wc("variable","--key")} Secret values are never returned.`).addOption(ha()).addOption(ya()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",_i).addOption(bc("the variable key")).addOption(ee()).addOption(He([...hs()]).default(ol.join(","))).action(Ag),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(ha()).addOption(ya()).addOption(Pf()).addOption(Ae()).addOption(ee()).action(Ig),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ha()).addOption(ya()).addOption(Ae()).addOption(ee()).action(Tg),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(ha()).addOption(ya()).addOption(Pf()).addOption(Ae()).addOption(ee()).action($g)};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 Nn(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function HS(e,t){Z(t,"siteId");let n=await G(`${$()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok){let o=await Nn(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 VS(e,t){Z(t,"collectionId");let n=await G(`${$()}/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 Nn(n)}`);let r=await n.json();return{...r,fields:r.fields??[]}}async function GS(e,t,n){Z(t,"siteId");let r={displayName:n.displayName,singularName:n.singularName};n.slug&&(r.slug=n.slug);let o=await G(`${$()}/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 Nn(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 KS(e,t,n){Z(t,"collectionId");let r=await G(`${$()}/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 Nn(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 Og(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(`${$()}/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 Nn(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 JS(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=r?`?cmsLocaleId=${encodeURIComponent(r)}`:"",i=await G(`${$()}/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 Nn(i)}`);return await i.json()}async function Lg(e,t,n,r=!1){Z(t,"collectionId");let o=await G(`${$()}/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 Nn(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 Ng(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=await G(`${$()}/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 Nn(o)}`);return await o.json()}async function zS(e,t,n){Z(t,"collectionId"),Z(n,"itemId");let r=await G(`${$()}/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 Nn(r)}`)}async function qS(e,t,n){Z(t,"collectionId"),n.forEach(o=>Z(o,"itemId"));let r=await G(`${$()}/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 Nn(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 Uu(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=ne(),n=await ze(t);return{token:n.accessToken,siteId:n.siteId}}function XS(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 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(I(" No fields defined.")),t.join(`
|
|
198
|
-
`)
|
|
199
|
-
`)
|
|
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 Ug(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 KS(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(`${P} 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 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 Og(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(ZS(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();A();M();X();async function Hg(e){let t=await T(),n=F.forCms({authToken:t}),r=Date.now();try{let o=await JS(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 Vg(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 Lg(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(`${P} 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 Gg(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 Ng(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(`${P} 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 Kg(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 zS(t,e.collection,e.item),await n.sendUsage("cms_items_delete",{duration:Date.now()-r,dryRun:!1}),u.info(`${P} 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 Jg(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 qS(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(`${P} 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 QS=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(ee()).addOption(He(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(Ii(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Ri()).action(jg),n.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(ee()).action(Mg),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(Ae()).addOption(ee()).action(Bg),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(ee()).action(Ug);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(kc()).addOption(Ec()).addOption(ee()).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(ee()).action(Hg),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(ee()).action(Vg),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(ee()).action(Gg),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(Kg),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(ee()).action(Jg)};q();pe();C();A();M();Me();X();De();lt();C();C();pe();var ex={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 Hu(e,t){let n=e.split(".").pop()?.toLowerCase()??"",r=ex[n];if(!r){let o=Object.keys(ex).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 zg=["id","displayName","originalFileName","contentType","size","lastUpdated"];function tx(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return I("No assets found.");let n=Object.fromEntries(zg.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: ${zg.join(", ")}`);let o=t.filter(l=>n[l.toLowerCase()]==null),i=o.length>0?le(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${zg.join(", ")}
|
|
202
|
-
`)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
Create
|
|
206
|
-
|
|
207
|
-
`)?i.
|
|
208
|
-
`):i.length).
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
`,
|
|
212
|
-
`,
|
|
213
|
-
`,"utf8")}for(let s of r){if(s in e.files)continue;let a=dh(t,s);a&&(0,yt.existsSync)(a)&&(0,yt.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=Ux(t);(0,yt.mkdirSync)((0,Uo.dirname)(i),{recursive:!0}),(0,yt.writeFileSync)(i,`${JSON.stringify(o,null,2)}
|
|
214
|
-
|
|
215
|
-
`)}function R$(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=ed(i.content,s,Qu(i.path),l=>o.get(l)??Xu(l,r.themeRoot)??Jx(l,r.componentsRoot));return{...i,content:a}})}function I$(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}=Ox(i.content,s);l&&n.add(i.path);let c=t.files[i.path]?.styleIds??[],{desugared:d,hasNewStyles:p}=Mx(a,c);return p&&r.add(i.path),{...i,content:d}}),pathsWithNewNodes:n,pathsWithNewStyles:r}}function T$(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=Cx(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=Fx(o.content);r.push(s===void 0?o:{...o,content:s})}return{pushChanges:r,spliceFailures:n}}function P$(e,t,n,r){let o=R$(e,t,n,r),{pushChanges:i,pathsWithNewNodes:s,pathsWithNewStyles:a}=I$(o,t),{pushChanges:l,spliceFailures:c}=T$(i,t);return{pushChanges:l,pathsWithNewNodes:s,pathsWithNewStyles:a,spliceFailures:c}}async function $$(e,t,n,r,o){let i=[],s=!1,a=!1;for(let[l,c]of n.entries()){let d;try{d=await bx(e,t,c,{conflictPolicy:r,schemaHash:o})}catch(m){throw s&&u.warn(`${Q} 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 O$(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 L$(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:hn(p.content),...m?{localPath:m}:{}}}let a=O$(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:hn(p),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{siteId:e.siteId??t,schemaHash:n,files:s},created:a}}function N$(e,t){for(let{path:n,componentId:r}of e)u.info(`${P} 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 j$(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 Yu(a)){let d=await il(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}=Ju(p.content);g.length>0&&(h.nodeIds=g)}if(o.has(p.path)){let{entries:g}=zu(p.content);g.length>0&&(h.styleIds=g)}Object.keys(h).length>0&&(l[p.path]={...m,...h})}}return{...i,files:l}}function M$({missing:e,renameCandidates:t,unmappable:n,stale:r,orphanedUpstream:o},i){for(let s of e)u.warn(`${Q} ${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(`${Q} ${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(`${Q} ${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(`${Q} ${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?`${Q} ${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\`.`:`${Q} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function B$(e){let t=qu();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 U$(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 W$(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&&!_x(a.content),c=t.files[a.path]?.componentId,d=n[a.path]??a.path,p=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(` ${d}${p}`)}u.info("Dry run \u2014 no changes made.")}async function td(e={}){let t=ys(),n=B$(t.siteId),r=await Yx(n,t.layout,void 0,e.force),{changes:o,localPaths:i}=r;if(M$(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=_$(n,i);try{let{pushChanges:d,pathsWithNewNodes:p,pathsWithNewStyles:m,spliceFailures:h}=P$(o,n,i,t.layout);for(let E of h)u.warn(`${Q} ${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(U$(t.siteId,o,i,h)):W$(o,n,i,h,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let g=Zx(d),{results:y,schemaHash:b,aborted:S}=await $$(s,t.siteId,g,e.force?"rebase":void 0,n.schemaHash),_=new Map(o.map(E=>[E.path,E])),{lockfile:v,created:x}=L$(n,t.siteId,b,_,i,y);sl(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{sl(await j$(s,t.siteId,y,H,B,v))}catch(E){u.warn(`${Q} 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{N$(x,c);for(let U of y)u.info(A$(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(`${Q} 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(`${Q} 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(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 Ho=require("fs"),Qx=require("module"),Wo=require("path");q();pe();C();A();M();X();function H$(e,t,n,r){let o=n.get(e.path);if(o)return Kx(o,t);let i=zx(e.path,t);if(i)return i;let s=r?.files[e.path]?.localPath;return hh(e.path,t,s)??e.path}function V$(e,t,n){if(!Array.isArray(e)||e.length===0)return;let r=(0,Qx.createRequire)((0,Wo.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 G$(e,t){try{let{format:n,resolveConfig:r}=await import("prettier"),o=await r(t,{editorconfig:!0}),i=V$(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 K$(e,t){if(t){Hx();return}let n=qu();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 ${Gr}/ 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 ${Gr}/ 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 nd(e={}){let t=ys(e.siteId),n=K$(t.siteId,!!e.reset),r=await T({apiToken:e.apiToken}),o=F.forSites({authToken:r}),i=Date.now();try{let s=await il(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 Yu(a)){let z=await il(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=Zu(U),pr=ge!==void 0&&hn(ge)!==z.contentSha256,fr=E.hash!==z.serverHash;pr&&fr&&g.set(E.path,U)}let y=!e.force,b=[...g.values()],S=process.cwd(),_=new Map(m.map(E=>[E.path,H$(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);Vx(U);let ge=(0,Wo.join)(S,U);(0,Ho.mkdirSync)((0,Wo.dirname)(ge),{recursive:!0});let pr=U.endsWith(".tsw")?ed(E.content,Qu(E.path),U,di=>_.get(di)??hh(di,t.layout,n?.files[di]?.localPath)):E.content,{sugared:fr,entries:iA}=Ju(pr),{sugared:By,entries:Uy}=zu(fr),tp=U.endsWith(".tsw")?await G$(By,ge):By;(0,Ho.writeFileSync)(ge,tp,"utf8");let Wy=uh(tp,iA);B.push(E);let Qr=z?z.localPath??E.path:void 0;if(z&&Qr&&Qr!==U&&!H.has(Qr)){let di=Zu(Qr);di===void 0||(hn(di)===z.contentSha256?((0,Ho.rmSync)((0,Wo.join)(S,Qr),{force:!0}),we.push({from:Qr,to:U})):Se.push({from:Qr,to:U}))}let Hy=d[E.path],Ml=h.get(E.path);O.files[E.path]={serverHash:E.hash,contentSha256:hn(tp),localPath:U,...Hy?{componentId:Hy}:{},...Wy.length>0?{nodeIds:Wy}:{},...Uy.length>0?{styleIds:Uy}:{},...Ml?{slug:Ml.slug,isDefault:Ml.isDefault,folderSegments:Ml.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=Zu(U);ge!==void 0&&(hn(ge)===z.contentSha256?((0,Ho.rmSync)((0,Wo.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(sl(O),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:E,slug:z,title:U,path:ge,folderSegments:pr})=>({pageId:E,slug:z,title:U,path:ge,folderSegments:pr})),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(`${P} ${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?`${Q} ${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).`:`${Q} ${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(`${Q} ${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(`${Q} ${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:`})}}Kn();var eC=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(ee()).addOption(He(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(th),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(ee()).action(nh),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(ee()).action(rh),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(ee()).action(oh),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(zn()).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(Gu),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(zn()).addOption(Ae()).addOption(ee()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(td),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(zn()).addOption(ee()).option("--site-id <siteId>","Pull from this site only, bypassing (and not modifying) the siteId in webflow.json. Needs --reset when the project is already synced with another site.").option("--force","Overwrite local files that changed both here and in the Designer since the last sync.").option("--reset","Discard the existing local sync state and pull from scratch.").action(nd))};q();C();A();M();X();De();async function tC(e,t){return Z(t,"siteId"),el(`${$()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function nC(e,t,n){return Z(t,"siteId"),Z(n,"formId"),el(`${$()}/v2/sites/${t}/forms/${n}/submissions`,e,"formSubmissions","Failed to list submissions")}C();pe();var wh=["id","displayName","name","slug","createdOn","lastUpdated"],rC=dt(wh);function oC(){return wh}function iC(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: ${wh.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 sC(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 aC(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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
Please report this.`)}function q$(e,t,n=Vo()){return ot(e,t,n)||ot(t,e,n)}async function Sh(e,t,n=Vo()){if(zr(e)||zr(t))return!1;let[r,o]=await Promise.all([yn(e),yn(t)]);return q$(r,o,n)}function Ye(e,t,n=Vo()){return typeof e!="string"||typeof t!="string"||zr(e)||zr(t)?!1:rd(e,n)===rd(t,n)}async function yn(e){let t=Jr.default.resolve(e);try{return await Eh.default.promises.realpath(t)}catch{}try{let n=await Eh.default.promises.realpath(Jr.default.dirname(t));return Jr.default.join(n,Jr.default.basename(t))}catch{return t}}var X$=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function Ds(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(X$.test(t))return"Windows reserved device name in entry path"}return null}var Fh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),Y$=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),Z$=32,Q$=512,xh=10,fC=100,dC=100;function mC(){return{retained:[],fatal:[],fatalCount:0,count:0}}function gC(e,t,n){e.count+=1;let r={code:t,message:kh(n)};e.retained.length<dC&&e.retained.push(r),Y$.has(t)&&(e.fatalCount+=1,e.fatal.length<dC&&e.fatal.push(r))}async function hC(e,t,n){let r=await eO(n.containmentRoot),o=await tO(r,t),i=await pC(e),s=await rO(e,n),a=await iO(e,o,n);if(a.warnings.fatal.length>0)throw EC(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 lO(a.refused,a.refusedCount);let l=await pC(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 sO(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 pC(e){try{let t=await Ko.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 eO(e){try{return await Ko.default.promises.realpath(Go.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 tO(e,t){let n=Go.default.resolve(t);Ue(e,n,"the extraction directory");let o=Go.default.relative(e,n).split(Go.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Go.default.join(i,s);let a=await nO(i);if(a===null){await Ko.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 nO(e){try{return await Ko.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 rO(e,t){let n=yC(t.limits),r=DC(t.consumedSubtrees),o=[],i=[],s=mC(),a=0,l=0,c=0,d=!1,p=!1,m=(h,g)=>{c+=1,o.length<fC&&o.push({entryPath:h,reason:g})};try{await id.list({file:e,onReadEntry:h=>{let g=h.path,y=h.type;if(wC(y)||(a+=1,a>n.maxFiles&&!d&&(d=!0,m(g,`archive has more than ${n.maxFiles} files`))),!Fh.has(y)){let _=`unsupported entry type ${y}`;r(g)?m(g,_):d||i.push({entryPath:g,reason:_});return}let b=Ds(g)??bC(g,n);if(b){m(g,b);return}let S=h.size;S>n.maxEntryBytes&&m(g,`entry is ${ks(S)}, over the ${ks(n.maxEntryBytes)} per-file cap`),l+=S,l>n.maxUnpackedBytes&&!p&&(p=!0,m(g,`unpacked total passes the ${ks(n.maxUnpackedBytes)} cap`))},onwarn:(h,g)=>{gC(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 aO(o,c);if(s.fatal.length>0)throw EC(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 oO(e,t,n,r){if(!Fh.has(t))return`unsupported entry type ${t}`;let o=Ds(e)??bC(e,r);return o||(n>r.maxEntryBytes?`entry is ${ks(n)}, over the ${ks(r.maxEntryBytes)} per-file cap`:null)}async function iO(e,t,n){let r=yC(n.limits),o=DC(n.consumedSubtrees),i=mC(),s=[],a=0,l=0,c=0,d=(h,g)=>(a+=1,s.length<fC&&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(!Fh.has(y)&&!o(h))return p();let S=oO(h,y,b,r);if(S)return d(h,S);if(c+b>r.maxUnpackedBytes)return d(h,`unpacked total passes the ${ks(r.maxUnpackedBytes)} cap`);if(!wC(y)){if(l+1>r.maxFiles)return d(h,`archive has more than ${r.maxFiles} files`);l+=1}return c+=b,!0};try{await id.extract({file:e,cwd:t,strip:n.strip??0,preservePaths:!1,filter:m,onwarn:(h,g)=>{gC(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 sO(e,t){Ue(e,await Ko.default.promises.realpath(t),"the extracted directory");let n=[t];for(;n.length>0;){let r=n.pop(),o=await Ko.default.promises.readdir(r,{withFileTypes:!0});for(let i of o){let s=Go.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 yC(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??Z$,maxPathLength:e.maxPathLength??Q$}}function wC(e){return e==="Directory"||e==="GNUDumpDir"}function Ch(e){return e.replace(/\/+$/,"")}function bC(e,t){let n=Ch(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 DC(e){let t=e.map(Ch);return n=>{let r=Ch(n).split("/").slice(1).join("/");return t.some(o=>r===o||r.startsWith(`${o}/`))}}function ks(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 aO(e,t){return new f(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
|
|
224
|
-
${kC(e,t).join(`
|
|
194
|
+
Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0});let a=n?`${n}: `:"",l=o&&e.status>=400&&e.status<500;return new d(`${a}${e.status} ${e.statusText}`+(s?`
|
|
195
|
+
${s}`:""),l?{isUserError:!0}:void 0)}async function ax(e,t){let r=await K(`${O()}/cosmic/apps`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let n=await r.text(),o;try{o=JSON.parse(n)}catch{}let i=sx(o);throw i||await ht({status:r.status,statusText:r.statusText,text:async()=>n},{fallbackPrefix:"Failed to create app",userErrorOn4xx:!0})}return await r.json()}async function W$(e,t){let r=await K(Wo(`${O()}/cosmic/github/repositories`,{limit:sl,cursor:t}),{headers:tt(e)});if(!r.ok)throw await ht(r);return Gn(await r.json(),"repositories")}async function lx(e,t){let r=t.toLowerCase(),n=i=>i.fullName.toLowerCase()===r;return(await gs(i=>W$(e,i),{stopWhen:i=>i.some(n)})).find(n)??null}async function H$(e,t,r={}){let n=await K(Wo(`${O()}/cosmic/apps`,{limit:sl,cursor:t,filters:r}),{headers:tt(e)});if(!n.ok)throw await ht(n);return Gn(await n.json(),"apps")}async function Ku(e,t={}){return gs(r=>H$(e,r,t))}async function Ju(e,t){ve(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{headers:tt(e)});if(!r.ok)throw await ht(r);return await r.json()}async function cx(e,t,r){ve(t,"appId");let n=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw await ht(n);return await n.json()}async function ux(e,t){ve(t,"appId");let r=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:tt(e)});if(!r.ok)throw await ht(r);return await r.json()}async function dx(e,t,r={}){ve(t,"appId");let n=Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:r.limit,cursor:r.cursor}),o=await K(n,{headers:tt(e)});if(!o.ok)throw await ht(o);let{items:i,nextCursor:s}=Gn(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function V$(e,t,r,n={}){let o=await K(Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:sl,cursor:r,filters:n}),{headers:tt(e)});if(!o.ok)throw await ht(o);return Gn(await o.json(),"environments")}async function Kn(e,t,r={}){return ve(t,"appId"),gs(n=>V$(e,t,n,r))}function px(e={}){let t=[];return e.limit!==void 0&&Number.isFinite(e.limit)&&t.push(`limit=${encodeURIComponent(String(e.limit))}`),e.cursor!==void 0&&t.push(`cursor=${encodeURIComponent(e.cursor)}`),e.since!==void 0&&t.push(`since=${encodeURIComponent(e.since)}`),e.q!==void 0&&t.push(`q=${encodeURIComponent(e.q)}`),t.length>0?`?${t.join("&")}`:""}async function fx(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/buildLogs${px(o)}`,{headers:tt(e)});if(!i.ok)throw await ht(i);return await i.json()}async function mx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/logs${px(n)}`,{headers:tt(e)});if(!o.ok)throw await ht(o);return await o.json()}async function gx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(Wo(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{limit:n.limit,cursor:n.cursor}),{headers:tt(e)});if(!o.ok)throw await ht(o);let{items:i,nextCursor:s}=Gn(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function zu(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}`,{headers:tt(e),signal:o.signal});if(!i.ok)throw await ht(i);return await i.json()}async function hx(e,t,r,n,o={}){ve(t,"appId"),ve(r,"environmentId"),Vn(n,"deploymentId");let i=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments/${encodeURIComponent(n)}/redeploy`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await ht(i);return await i.json()}async function yx(e,t,r,n={}){ve(t,"appId"),ve(r,"environmentId");let o=await K(`${O()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(r)}/deployments`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json",...n.idempotencyKey?{"Idempotency-Key":n.idempotencyKey}:{}},body:JSON.stringify({})});if(!o.ok)throw await ht(o);return await o.json()}async function Pg(e){let t=await T(),r=_.forApps({authToken:t}),n=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=ys(o),s=await Ku(t,o);if(await r.sendUsage("apps_list",{duration:Date.now()-n,count:s.length,filtered:i}),e.json){u.info(JSON.stringify(s,null,2));return}if(s.length===0){u.info(i?"No apps matched the given filters.":"No apps found.");return}let a=Fe(e.fields,bc,Fn());u.info(kc(s,a))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list apps:`}))}}var Ax=require("crypto"),Rx=require("fs"),ws=w(require("path"));Y();C();R();j();we();Pe();var G$=[/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,/\x1b[P^_][\s\S]*?\x1b\\/g,/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,/\x1b[\x20-\x7e]/g,/[\x80-\x9f]/g,/[\x00-\x08\x0b-\x1f\x7f]/g,/[\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g],K$=/[\r\n\u2028\u2029]+/g;function al(e){if(e==null)return"";let t=String(e);for(let r of G$)t=t.replace(r,"");return t}function b(e){return al(e).replace(K$," ").trim()}Z();C();function Q(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new d(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}var wx=require("child_process"),bx=require("crypto"),qu=require("fs"),kx=require("os"),Dx=w(require("path")),Ex=require("util");C();var $g=(0,Ex.promisify)(wx.execFile);function J$(){return Dx.default.resolve((0,kx.tmpdir)(),`webflow-cli-disabled-askpass-${(0,bx.randomUUID)()}`)}function vx(e){return{...process.env,...e.nonInteractive&&{GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:J$()}}}async function Og(e){try{await $g("git",["check-ref-format","--branch",e],{})}catch(t){throw t?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):typeof t?.code!="number"?new d(`Could not validate the branch name with git: ${t instanceof Error?t.message:String(t)}`,{isUserError:!0}):new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}}async function Lg(e,t,r={}){try{return await $g("git",["ls-remote","--exit-code","--heads","--",e,`refs/heads/${t}`],{env:vx(r)}),"exists"}catch(n){if(n?.code==="ENOENT")throw new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0});return n?.code===2?"missing":"unverifiable"}}async function Sx(e,t,r={}){let n=await Lg(e,t,r);if(n==="missing")throw new d("The repository does not contain the requested branch.",{isUserError:!0,missingFlag:"--branch"});if(n==="unverifiable")throw new d("Could not verify the requested branch before creating an app. Ensure git can access the repository, then retry.",{isUserError:!0,missingFlag:"--branch"})}function xx(e){let t;try{t=(0,qu.lstatSync)(e)}catch(n){if(n.code==="ENOENT")return;throw new d(`Cannot inspect the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(t.isSymbolicLink())throw new d(`${e} already exists as a symbolic link. Move or remove it, or run this command from a different directory.`,{isUserError:!0});let r;try{r=(0,qu.readdirSync)(e)}catch(n){throw new d(`Cannot read the target directory ${e}: ${n instanceof Error?n.message:String(n)}`,{isUserError:!0})}if(r.length>0)throw new d(`${e} already exists and is not empty. Move or remove it, or run this command from a different directory.`,{isUserError:!0})}async function Cx(e,t,r,n={}){let o=["clone"];r&&o.push("--branch",r),o.push("--",e,t);try{await $g("git",o,{env:vx(n)})}catch(i){let s=typeof i?.stderr=="string"?al(i.stderr).trim():"";throw i?.code==="ENOENT"?new d("git was not found on your PATH. Install git, then re-run this command.",{isUserError:!0}):new d(`Failed to clone repository${s?`:
|
|
196
|
+
${s}`:"."}`,{isUserError:!0})}}C();var Yu="github.com",z$=/^[A-Za-z0-9][A-Za-z0-9-]*$/,q$=/^[A-Za-z0-9._-]+$/,Y$=/[\x00-\x1f\x7f]/;function $t(e){throw new d(`Invalid --import repository URL: ${e}`,{isUserError:!0,missingFlag:"--import"})}function ll(e){return b(e)}function X$(e){let t=e.match(/^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#]*([^?#]*)/)?.[1];return t?t.split("/").some(r=>{try{let n=decodeURIComponent(r);return n==="."||n===".."}catch{return!1}}):!1}function Fx(e){let t=e.trim();t===""&&$t("value is empty."),Y$.test(t)&&$t("value contains control characters."),t.startsWith("-")&&$t("value must not start with '-'."),X$(t)&&$t("path must not contain '.' or '..' segments.");let r;try{r=new URL(t)}catch{$t(`value is not a URL. Expected https://${Yu}/<owner>/<repo>.`)}r.protocol!=="https:"&&$t(`only https:// URLs are supported (got "${ll(r.protocol)}").`),(r.username!==""||r.password!=="")&&$t("URLs must not embed credentials."),r.hostname.toLowerCase()!==Yu&&$t(`only ${Yu} repositories are supported.`),(r.search!==""||r.hash!=="")&&$t("URLs must not contain a query string or fragment.");let n=r.pathname.split("/").filter(s=>s!=="");n.length!==2&&$t(`expected exactly <owner>/<repo> in the path (got "${ll(r.pathname)}").`);let o=n[0],i=n[1].replace(/\.git$/i,"");return z$.test(o)||$t(`"${ll(o)}" is not a valid owner.`),(i===""||!q$.test(i))&&$t(`"${ll(n[1])}" is not a valid repository name.`),/^\.+$/.test(i)&&$t(`"${ll(n[1])}" is not a valid repository name.`),{url:`https://${Yu}/${o}/${i}`,owner:o,repo:i,fullName:`${o}/${i}`}}var Z$="main",Q$="CLONE_FAILED";function eO(e,t,r){let n=r?` and cloud.environment_id "${r}"`:"";return`write cloud.app_id "${e}"${n} to ${ws.default.join(t,"webflow.json")}, then deploy with git push to the tracked branch`}var tO=/[\x00-\x1f\x7f]/;function Ix(e){return tO.test(e)||b(e)!==e}function Tx(e){if(e.startsWith("-")||Ix(e))throw new d("Invalid branch name.",{isUserError:!0,missingFlag:"--branch"})}function rO(e,t){let r=t?.trim(),n=r&&r!==""?r:e,o=r?"--app-name":`repository name "${e}"`;if(Ix(n))throw new d("App name must not contain terminal control or formatting characters.",{isUserError:!0,missingFlag:"--app-name"});if(n.length<Jt||n.length>zt)throw new d(`App name must be between ${Jt} and ${zt} characters, but ${o} is ${n.length}. Pass --app-name with a name in that range.`,{isUserError:!0,missingFlag:"--app-name"});return n}async function nO(e,t,r){if(r)return{branch:r,source:"flag"};let n;try{n=await lx(e,t)}catch(o){throw new d(`Could not look up the default branch for ${t}: ${o instanceof Error?o.message:String(o)}
|
|
197
|
+
Pass --branch to skip the lookup.`,{isUserError:!0,missingFlag:"--branch"})}return n?.defaultBranch?(Tx(n.defaultBranch),await Og(n.defaultBranch),{branch:n.defaultBranch,source:"resolved"}):{branch:Z$,source:"fallback"}}function oO(e){try{Q(e,"siteId")}catch(t){throw t instanceof d?new d(b(t.message),{isUserError:!0,missingFlag:"--site-id"}):t}}function iO(e){if(e==="/")throw new d(`Mount path cannot be "/" when attaching to an existing site: the root is served by the site's own pages, so an app there would take the site over. Pick a path such as --mount /app, or pass --new to create a standalone app that owns its root.`,{isUserError:!0,missingFlag:"--mount"})}function sO(e){let t=e.siteId!==void 0;if(t&&e.newSite)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!t&&!e.newSite)throw new d("--import requires exactly one target: pass --site-id <siteId> to attach to an existing site or --new to create a standalone app.",{isUserError:!0,missingFlag:"--site-id"});return t?{siteId:e.siteId,source:"flag"}:{source:"new"}}function aO(e){return e.siteId??"(a new site would be created)"}async function _x(e,t){try{let r=await Kn(e,t);return r.length===1?r[0].id:void 0}catch(r){u.debug(`Could not read environments for app ${t}: ${r}`);return}}function lO(e){let t=ws.default.join(e,"webflow.json"),r;try{r=(0,Rx.lstatSync)(t)}catch(n){if(n.code==="ENOENT")return;throw n}if(!r.isFile())throw new Error(`${t} is a symbolic link or another non-regular file, so reading or writing it could touch a file outside the clone`)}function cO(e,t){let r;try{return lO(e),r=process.cwd(),process.chdir(e),uO(t),{written:!0}}catch(n){return{written:!1,reason:n instanceof Error?n.message:String(n)}}finally{if(r!==void 0)try{process.chdir(r)}catch(n){u.warn(`${X} Could not return to ${r}: ${n instanceof Error?n.message:String(n)}`)}}}function uO(e){Se({...e.siteId?{siteId:e.siteId}:{},cloud:{app_id:e.appId,environment_id:e.environmentId,project_id:void 0,workspace_id:void 0}})}function dO(e,t){u.info(`${$} App created: ${e.id}`),u.info(` Name: ${e.name}`),u.info(` Branch: ${t.branch}`),u.info(` Directory: ${t.directory}`),t.mount!==void 0&&u.warn(`${X} Requested mount ${t.mount} is not honored by the server yet \u2014 this app is currently served at its default mount instead.`),t.linkage.written?t.environmentId||u.warn(`${X} Could not read this app's environment, so only app_id was written to webflow.json. Commands that need an environment will ask for --environment-id until the app is readable.`):u.warn(`${X} The app was created and cloned, but writing the linkage into ${t.directory}/webflow.json failed: ${b(t.linkage.reason)}. Nothing needs re-running \u2014 ${eO(e.id,t.directory,t.environmentId)}.`),e.deployStatus==="triggered"&&e.deployment?u.info(`${xe} Initial deploy queued: ${e.deployment.dashboardUrl}`):e.message&&u.warn(`${X} ${e.message}`)}async function Ng(e){let t=Fx(e.import),r=rO(t.repo,e.appName),n=e.branch?.trim()||void 0;n&&(Tx(n),await Og(n)),e.siteId!==void 0&&oO(e.siteId);let o=sO(e),i=e.mount!==void 0?dn(e.mount):void 0;if(i!==void 0){if(!Bo(i))throw new d(`Invalid mount path: ${JSON.stringify(e.mount)}. Use /-separated segments of letters, digits, and _ . ~ - (for example, --mount /app).`,{isUserError:!0,missingFlag:"--mount"});if(o.source==="new")throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});iO(i)}if(o.source==="flag"&&i===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"});let s=ws.default.resolve(process.cwd(),t.repo);if(xx(s),ic())throw new d(`--manifest cannot be combined with --import: the linkage is written into the repository being cloned, at ${ws.default.join(s,"webflow.json")}. Re-run without --manifest.`,{isUserError:!0,missingFlag:"--manifest"});let a=e.idempotencyKey?.trim()||void 0;if(V()&&!a)throw new d("--idempotency-key is required for non-interactive --import creates so a retry can safely replay the same create.",{isUserError:!0,missingFlag:"--idempotency-key"});let l=await T();if(e.dryRun){let G={repoUrl:t.url,branch:n??null,appName:r,siteId:o.siteId??null,siteSource:o.source,mount:i??null,directory:s,dryRun:!0};e.json?u.info(JSON.stringify(G,null,2)):(u.info(`Dry run \u2014 would create app "${r}"`),u.info(` Repository: ${G.repoUrl}`),u.info(` Branch: ${G.branch??"(default branch of the repo)"}`),u.info(` Site: ${aO(e)}`),u.info(` Mount: ${G.mount===null?"(server default: /)":`${G.mount} (requested \u2014 the server does not honor this field yet, so the app will mount at its current default until that ships)`}`),u.info(` Clone into: ${s}`),u.info("Dry run complete \u2014 no changes made."));return}if(n){let G=e.json?void 0:u.spinner("Checking requested branch");try{await Sx(t.url,n,{nonInteractive:V()}),G?.succeed(`Using branch "${n}"`)}catch(ce){throw G?.fail("Requested branch is unavailable"),ce}}let c=_.forApps({authToken:l,suppressCommand:!0}),p=Date.now(),f=G=>e.json?void 0:u.spinner(G),m=n?void 0:f("Looking up repository"),g,h;try{({branch:g,source:h}=await nO(l,t.fullName,n)),m?.succeed(`Using branch "${g}"`)}catch(G){throw m?.fail("Could not look up repository"),G}let y;if(h!=="flag"){let G=e.json?void 0:u.spinner(`Confirming "${g}" still exists on the remote`);try{y=await Lg(t.url,g,{nonInteractive:V()})}catch(ce){throw G?.fail("Could not check the resolved branch"),ce}if(y==="missing")throw G?.fail("Resolved branch is unavailable"),new d(`${h==="fallback"?"No branch was given and the repository is not visible to discovery, so":"The repository's default branch resolved to"} "${g}", which does not exist on the remote. Pass --branch <name> with the branch to build.`,{isUserError:!0,missingFlag:"--branch"});y==="unverifiable"?G?.warn(`Could not confirm "${g}" exists on the remote \u2014 continuing`):G?.succeed(`Branch "${g}" exists on the remote`)}let k=y??"exists",v=a??(0,Ax.randomUUID)(),F,E=f("Creating app");try{F=await ax(l,{cloudApp:{displayName:r,siteId:o.siteId,...i!==void 0&&{mount:i},source:{type:"GITHUB",github:{sourceUrl:t.url,branch:g}}},requestId:v}),E?.succeed("App created")}catch(G){throw E?.fail("Could not create app"),G instanceof hs&&e.json?(u.info(JSON.stringify({error:{message:G.message,code:G.code,installUrl:G.installUrl??null}},null,2)),new d(G.message,{isUserError:!0,skipLogging:!0})):G instanceof d&&G.isUserError?G:(await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"create"}),new d(`${G instanceof Error?G.message:String(G)}
|
|
198
|
+
The create may still have succeeded server-side with its response lost. Retry with --idempotency-key ${v} to replay this exact attempt instead of creating a second app.`,{prefix:"Failed to create app:"}))}let S=h==="fallback"&&y!=="exists"?void 0:g,L=f("Cloning repository");try{await Cx(t.url,s,S,{nonInteractive:V()}),L?.succeed("Repository cloned")}catch(G){L?.fail("Could not clone repository");let ce=await _x(l,F.id),Be={clone:{repositoryUrl:t.url,directory:s,branch:S??null},linkage:{manifestPath:ws.default.join(s,"webflow.json"),cloud:{app_id:F.id,environment_id:ce??null}},deploy:{command:"git push",description:"Push to the tracked branch after restoring the linkage."}},A=a?"Do not re-run --import unless you reuse the exact idempotency key supplied to this invocation.":"Do not re-run --import: this invocation used a generated idempotency key that cannot be reused, so a retry would create a second app.",q=`App ${F.id} was created, but cloning ${t.url} failed. ${A} Clone the repository, restore the linkage in webflow.json, then deploy with git push.`,W=G instanceof Error?G.message:String(G);throw await c.sendError(G instanceof Error?G:new Error(String(G)),"apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,stage:"clone"}),e.json?(u.info(JSON.stringify({error:{message:q,code:Q$,appId:F.id,recoveryInstructions:Be,branchVerification:k,mount:i??null,reason:W}},null,2)),new d(`${q}
|
|
199
|
+
${W}`,{isUserError:!0,skipLogging:!0})):(u.warn(`${X} ${q}`),G)}let U=f("Linking app to repository"),N=await _x(l,F.id),te=cO(s,{siteId:F.siteId,appId:F.id,environmentId:N});if(te.written?U?.succeed(N?"Webflow linkage written":"Webflow linkage written (app_id only)"):U?.warn("Could not write Webflow linkage"),await c.sendUsage("apps_init",{duration:Date.now()-p,source:"github",branchSource:h,branchVerification:k,siteSource:o.source,deployStatus:F.deployStatus,linkageWritten:te.written}),e.json){u.info(JSON.stringify({...F,deployStatus:F.deployStatus??null,message:F.message??null,siteSource:o.source,branch:g,branchVerification:k,mount:i??null,directory:s,environmentId:N??null,linkageWritten:te.written,linkageError:te.written?null:te.reason},null,2));return}dO(F,{directory:s,branch:g,mount:i,environmentId:N,linkage:te})}Y();C();R();j();Z();Pe();C();we();Oe();async function Xu(e,t={}){let r=await Ku(e);if(r.length===0)throw new d("No apps found in this workspace.",{isUserError:!0});if(r.length===1)return r[0].id;if(V()||t.json){let o=r.map(i=>` ${i.id} (${i.name})`).join(`
|
|
200
|
+
`);throw new d(`This workspace has multiple apps. Pass the app id to choose one:
|
|
201
|
+
${o}`,{isUserError:!0,missingFlag:"appId"})}let n=await je({message:"Select an app:",choices:r.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!n)throw new d("No app selected.",{isUserError:!0});return n}async function Nr(e,t,r){let{manifest:n}=oe();return Mo("appId",{flagValue:t,manifest:n,isNoInput:!1,json:r.json,prompt:()=>Xu(e,{json:r.json})})}async function jg(e,t){let r=await T(),n=await Nr(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await Ju(r,n);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=Fe(t.fields,bc,Fn());u.info(kc([s],a))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app:`}))}}Y();C();R();j();Z();async function Mg(e,t){let r=await T(),n=await Nr(r,e,t),o=_.forApps({authToken:r}),i=Date.now();try{let s=await dx(r,n,{limit:t.limit,cursor:t.cursor});if(await o.sendUsage("apps_domains",{duration:Date.now()-i,count:s.customDomains.length}),t.json){u.info(JSON.stringify(s,null,2));return}if(s.customDomains.length===0){u.info("No domains found.");return}let a=Fe(t.fields,Ek,ha());u.info(Sk(s.customDomains,a)+Ai(s.nextCursor))}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to get app domains:`}))}}Y();C();R();j();Z();async function Bg(e,t){let r=await T(),n=await Nr(r,e,t),o=t.json?void 0:Fe(t.fields,vk,ya()),i=_.forApps({authToken:r}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=ys(a),c=await Kn(r,n,a);if(await i.sendUsage("apps_environments_list",{duration:Date.now()-s,count:c.length,filtered:l}),t.json){u.info(JSON.stringify(c,null,2));return}if(c.length===0){u.info(l?"No environments matched the given filters.":"No environments found.");return}u.info(xk(c,o))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list app environments:`}))}}Y();C();R();j();Z();me();var Ug=["timestamp","message","phase"],cl="timestamp,message",Zu=dt(Ug);function Jn(){return Ug}function pO(e,t){return e==null||e===""?P("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function fO(e,t=cl.split(",")){return e.map(r=>t.map(n=>pO(r[n],n)).join(" ")).join(`
|
|
202
|
+
`)}function Qu(e,t,r){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":fO(e.logs,r)+Ai(e.nextCursor)}Pe();C();we();Oe();async function Px(e,t,r={}){let n=await Kn(e,t);if(n.length===0)throw new d("No environments found for this app.",{isUserError:!0});if(n.length===1)return n[0].id;if(V()||r.json){let i=n.map(s=>` ${s.id} (${s.branch})`).join(`
|
|
203
|
+
`);throw new d(`This app has multiple environments. Pass the environment id to choose one:
|
|
204
|
+
${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await je({message:"Select an environment:",choices:n.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new d("No environment selected.",{isUserError:!0});return o}async function qe(e,t){let{manifest:r}=oe(),n=await Mo("appId",{flagValue:t.appId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>Xu(e,{json:t.json})}),o=await Mo("environmentId",{flagValue:t.environmentId,manifest:r,isNoInput:!1,json:t.json,prompt:()=>Px(e,n,{json:t.json})});return{appId:n,envId:o}}async function Wg(e,t){if(!e)throw new d("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json}),i=t.json?void 0:Fe(t.fields,Zu,Jn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=await fx(r,n,o,e,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_build",{duration:Date.now()-a,count:l.logs.length}),u.info(Qu(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read build logs:`}))}}Y();C();R();j();Z();async function Hg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{environmentId:e,json:t.json}),i=t.json?void 0:Fe(t.fields,Zu,Jn()),s=_.forApps({authToken:r}),a=Date.now();try{let l=await mx(r,n,o,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_runtime",{duration:Date.now()-a,count:l.logs.length}),u.info(Qu(l,t,i))}catch(l){throw l instanceof d&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new d(l,{prefix:`${D} Failed to read runtime logs:`}))}}Y();C();R();j();Z();async function Vg(e){let t=await T(),{appId:r,envId:n}=await qe(t,{json:e.json}),o=e.json?void 0:Fe(e.fields,vc,_n()),i=_.forApps({authToken:t}),s=Date.now();try{let a=await gx(t,r,n,{limit:e.limit,cursor:e.cursor});if(await i.sendUsage("apps_deployments_list",{duration:Date.now()-s,count:a.deployments.length}),e.json){u.info(JSON.stringify(a,null,2));return}if(a.deployments.length===0){u.info("No deployments found.");return}u.info(ba(a.deployments,o)+Ai(a.nextCursor))}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to list deployments:`}))}}Y();me();C();we();R();j();Z();var mO=5,$x=1800;function gO(e){return new Promise(t=>setTimeout(t,e))}async function Ox(e,t,r,n,o={}){let i=Math.min($x,Math.max(mO,o.interval??Dc)),s=Math.min($x,Math.max(1,o.timeout??Ec)),a=Date.now()+s*1e3,l,c,p=!1;for(;;){let f=new AbortController,m=setTimeout(()=>f.abort(),Math.max(0,a-Date.now())),g;try{g=await zu(e,t,r,n,{signal:f.signal})}catch(k){if(f.signal.aborted){p=!0;break}throw k}finally{clearTimeout(m)}c=g;let h=g.status;if(Fk(h))break;let y=a-Date.now();if(y<=0){p=!0;break}if(h!==l&&o.onStatusChange?.(l,h),l=h,await gO(Math.min(i*1e3,y)),Date.now()>=a){p=!0;break}}return{deployment:c,timedOut:p,timeoutSeconds:s}}async function Gg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json}),i=t.json?void 0:Fe(t.fields,vc,_n()),s=_.forApps({authToken:r}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let p=!t.json&&!V(),{deployment:f,timedOut:m,timeoutSeconds:g}=await Ox(r,n,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:p?(y,k)=>u.info(P(y===void 0?k:`${y} \u2192 ${k}`)):void 0}),h=m?"timeout":f?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:h}),process.exitCode=!m&&f?.status==="success"?0:1,t.json){u.info(JSON.stringify(f??null,null,2));return}f&&u.info(ba([f],i)),m&&u.warn(`Timed out after ${g}s waiting for a terminal status (last status: ${f?.status??"unknown"}).`);return}let c=await zu(r,n,o,e);if(await s.sendUsage("apps_deployments_get",{duration:Date.now()-a}),t.json){u.info(JSON.stringify(c,null,2));return}u.info(ba([c],i))}catch(c){throw c instanceof d&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new d(c,{prefix:`${D} Failed to ${t.wait?"watch":"get"} deployment:`}))}}Y();me();C();R();j();Z();async function Kg(e,t){let r=await T(),{appId:n,envId:o}=await qe(r,{json:t.json});if(t.dryRun){ve(n,"appId"),ve(o,"environmentId"),Vn(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:n,environmentId:o,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${n}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let i=_.forApps({authToken:r,suppressCommand:!!t.idempotencyKey}),s=Date.now();try{let a=await hx(r,n,o,e,{idempotencyKey:t.idempotencyKey});if(await i.sendUsage("apps_deployments_redeploy",{duration:Date.now()-s}),t.json){u.info(JSON.stringify(a,null,2));return}let l=a.commitSha.slice(0,7);a.status==="queued"?u.info(`${$} Redeploy queued \u2014 commit ${l}`):u.info(`${xe} Redeploy in progress \u2014 commit ${l} ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to redeploy deployment:`}))}}Y();me();C();var Lx=require("child_process");function Nx(){try{let e=(0,Lx.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}R();j();Z();function hO(e){let t=Nx();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function yO(e,t,r){try{return(await Kn(e,t)).find(o=>o.id===r)}catch{return}}async function Jg(e){let t=await T(),{appId:r,envId:n}=await qe(t,{json:e.json}),o=await yO(t,r,n);if(hO(o?.branch),e.dryRun){ve(r,"appId"),ve(n,"environmentId"),e.json?u.info(JSON.stringify({appId:r,environmentId:n,branch:o?.branch??null,dryRun:!0},null,2)):(u.info(`Would trigger a build of ${o?.branch?`\`${o.branch}\` `:""}in app ${r}, environment ${n}.`),u.info("Dry run \u2014 no changes made."));return}let i=_.forApps({authToken:t,suppressCommand:!!e.idempotencyKey}),s=Date.now();try{let a=await yx(t,r,n,{idempotencyKey:e.idempotencyKey});if(await i.sendUsage("apps_deployments_trigger",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}a.status==="queued"?u.info(`${$} Trigger queued${o?.branch?` for \`${o.branch}\``:""}.`):a.status==="skipped"?u.info(`${xe} Nothing to build \u2014 the branch has no commits yet. Push a commit and try again.`):u.info(`${xe} Trigger in progress ${P("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_trigger",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to trigger deployment:`}))}}Y();C();R();j();Z();async function zg(e,t){if(t.name===void 0&&t.description===void 0)throw new d("Provide --name or --description",{isUserError:!0});let r=await T(),n=await Nr(r,e,t);if(ve(n,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${n}`),t.name!==void 0&&u.info(` Name: ${t.name}`),t.description!==void 0&&u.info(` Description: ${t.description}`),u.info("Dry run complete \u2014 no changes made.");return}let o=_.forApps({authToken:r}),i=Date.now();try{let s=await cx(r,n,{name:t.name,description:t.description});if(await o.sendUsage("apps_update",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} App updated: ${s.id}`),s.name&&u.info(` Name: ${s.name}`),s.description!=null&&u.info(` Description: ${s.description}`)}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to update app:`}))}}Y();C();we();Oe();R();j();Z();async function qg(e,t){let r=await T(),n=await Nr(r,e,t);if(ve(n,"appId"),!t.dryRun&&!t.yes&&(V()||t.json))throw new d("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await Ju(r,n),a=Ck(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${n}`),u.info(` ${a}`),u.info("Dry run complete \u2014 no changes made.");return}if(!await $e({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=_.forApps({authToken:r}),i=Date.now();try{let s=await ux(r,n);if(await o.sendUsage("apps_delete",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(s.message)}catch(s){throw s instanceof d&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to delete app:`}))}}Y();C();R();j();Z();ke();C();lt();var bs=100;function Yg(e,t){return`${O()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function Xg(e,t){return ht(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function wO(e,t,r,n,o={}){let i=Wo(Yg(t,r),{limit:sl,cursor:n,filters:o}),s=await K(i,{headers:tt(e)});if(!s.ok)throw await Xg(s,"Failed to list environment variables");return Gn(await s.json(),"variables")}async function Zg(e,t,r,n={}){return gs(o=>wO(e,t,r,o,n))}async function Qg(e,t,r,n){let o=await K(`${Yg(t,r)}/${encodeURIComponent(n)}`,{method:"DELETE",headers:tt(e)});if(!o.ok)throw await Xg(o,"Failed to delete environment variable")}async function ul(e,t,r,n,o){let i=Object.keys(n).length;if(i>bs)throw new d(`Cannot import more than ${bs} variables at once (received ${i}).`,{isUserError:!0});let s=await K(`${Yg(t,r)}/bulk`,{method:"POST",headers:{...tt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:n,overwriteExisting:o})});if(!s.ok)throw await Xg(s,"Failed to import environment variables");return await s.json()}var jx=require("dotenv");me();var Mx=["key","isSecret","value","id","environmentId"],dl=["key","isSecret"];function ks(){return Mx}var eh=dt(Mx);function bO(e,t){switch(t){case"value":return e.isSecret?P("(secret)"):e.value!==""?e.value:P("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):P("\u2014")}}function th(e,t=dl){if(e.length===0)return P("No environment variables found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>bO(o,i)));return ze(r,n)}function rh(e){let t=e.split(/\r?\n/).map(r=>r.replace(/^\s*export\s+/,"")).join(`
|
|
205
|
+
`);return(0,jx.parse)(t)}async function nh(e){let t=await T(),r=_.forAppsEnvVars({authToken:t}),n=Date.now();try{let{appId:o,envId:i}=await qe(t,e),s={key:e.key,q:e.q},a=ys(s),l=await Zg(t,o,i,s);if(await r.sendUsage("apps_env_vars_list",{duration:Date.now()-n,variableCount:l.length,filtered:a}),e.json){u.info(JSON.stringify(l,null,2));return}if(l.length===0){u.info(a?"No environment variables matched the given filters.":"No environment variables found.");return}let c=Fe(e.fields,eh,ks());u.info(th(l,c))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list environment variables:`}))}}Y();C();R();j();Z();C();we();Oe();R();j();async function Bx(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e).toString("utf8").replace(/\r?\n$/,"")}function oh(e){u.warn(`${X} Passing a secret as a command-line argument exposes it in your shell history and process list. Pipe it via stdin (e.g. \`printf %s "$VALUE" | webflow apps env-vars set ${e} --secret\`) or omit the value to be prompted.`)}async function Ux(e,t){if(e!==void 0)return t.secret&&!t.json&&oh(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let r=await Bx();if(r==="")throw new d(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:r,source:"stdin"}}if(!V()){let r=t.secret?await Xb({message:`Enter the value for ${t.key}:`}):await Ge({message:`Enter the value for ${t.key}:`});if(r===null||r==="")throw new d(`No value provided for ${t.key}.`,{isUserError:!0});return{value:r,source:"prompt"}}throw new d(`No value provided for ${t.key}. Pass it as an argument, pipe it via stdin, or run interactively (without --no-input).`,{isUserError:!0})}async function ih(e,t,r){let n=r.secret?" (secret)":"",o=await T(),i=_.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await qe(o,r);if(r.dryRun){t!==void 0&&r.secret&&!r.json&&oh(e),r.json?u.info(JSON.stringify({key:e,...r.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${n} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:p}=await Ux(t,{key:e,secret:r.secret,json:r.json}),f={[e]:{value:c,...r.secret?{isSecret:!0}:{}}},m=await ul(o,a,l,f,!0),g=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!g){let y=m.errors.find(k=>k.key===e);throw new d(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let h=g.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:r.secret?"secret":"plain",valueSource:p}),r.json){u.info(JSON.stringify({key:e,isSecret:h,status:"set"},null,2));return}u.info(`${$} Set ${e}${h?" (secret)":""}`)}catch(c){throw c instanceof d&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new d(c,{prefix:`${D} Failed to set environment variable:`}))}}Y();C();R();j();Z();async function sh(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await qe(r,t);if(t.dryRun){t.json?u.info(JSON.stringify({key:e,appId:i,environmentId:s,dryRun:!0},null,2)):(u.info(`Would delete ${e} from app ${i}, environment ${s}.`),u.info("Dry run \u2014 no changes made."));return}try{if(await Qg(r,i,s,e),await n.sendUsage("apps_env_vars_delete",{duration:Date.now()-o}),t.json){u.info(JSON.stringify({key:e,status:"deleted"},null,2));return}u.info(`${$} Deleted ${e}`)}catch(a){throw a instanceof d&&a.isUserError?a:(await n.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new d(a,{prefix:`${D} Failed to delete environment variable:`}))}}var Wx=require("fs"),Hx=require("path");Y();C();R();j();Z();function ah(e){return e.map(({id:t,environmentId:r,key:n,isSecret:o})=>({id:t,environmentId:r,key:n,isSecret:o}))}async function lh(e,t){let r=await T(),n=_.forAppsEnvVars({authToken:r}),o=Date.now(),{appId:i,envId:s}=await qe(r,t),a;try{a=(0,Wx.readFileSync)((0,Hx.resolve)(e),"utf8")}catch{throw new d(`Could not read file: ${e}`,{isUserError:!0})}let l=rh(a),c=Object.keys(l);if(c.length===0)throw new d(`No variables found in ${e}.`,{isUserError:!0});if(c.length>bs)throw new d(`Cannot import more than ${bs} variables at once (${e} has ${c.length}).`,{isUserError:!0});let p={};for(let f of c)p[f]={value:l[f],...t.secret?{isSecret:!0}:{}};if(t.dryRun){if(t.json)u.info(JSON.stringify({appId:i,environmentId:s,secret:!!t.secret,variables:c,dryRun:!0},null,2));else{u.info(`Would import ${c.length} variable(s)${t.secret?" as secrets":""} into app ${i}, environment ${s}:`);for(let f of c)u.info(` ${f}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let f=await ul(r,i,s,p,!0);if(await n.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:f.created.length,updatedCount:f.updated.length,skippedCount:f.skipped.length,errorCount:f.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:ah(f.created),updated:ah(f.updated),skipped:ah(f.skipped),errors:f.errors},null,2));else{u.info(`${$} Imported: ${f.created.length} created, ${f.updated.length} updated, ${f.skipped.length} skipped, ${f.errors.length} failed`);for(let m of f.errors)u.warn(` ${m.key}: ${m.error}`)}if(f.errors.length>0)throw new d(`Import completed with ${f.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(f){throw f instanceof d&&f.isUserError?f:(await n.sendError(f instanceof Error?f:new Error(String(f)),"apps_env_vars_import",{duration:Date.now()-o}),new d(f,{prefix:`${D} Failed to import environment variables:`}))}}me();C();R();j();qr();function Jx(e,t,r){Ke()&&e==="cloud"&&(r.json||u.warn(`${X} ${ue(`webflow cloud ${t}`)} is deprecated \u2014 use ${ue(`webflow apps ${t}`)} instead.`))}var Vx={branch:"--branch selects which branch of the repository to build",idempotencyKey:"--idempotency-key dedupes a retried create from a repository",json:"--json describes the app created from a repository",dryRun:"--dry-run previews the app that would be created from a repository"},Gx={framework:"--framework selects a starter template",workspaceId:"--workspace-id is derived from your token when using --import",projectName:"--project-name is deprecated \u2014 use --app-name"};function kO(e){if(e.import===void 0){for(let t of Object.keys(Vx))if(e[t]!==void 0){let r=Kx(t);throw new d(`${r} is only supported together with --import <repo-url> (${Vx[t]}).`,{isUserError:!0,missingFlag:"--import"})}return}if(e.import.trim()==="")throw new d("--import requires a repository URL.",{isUserError:!0,missingFlag:"--import"});for(let t of Object.keys(Gx))if(e[t]!==void 0){let r=Kx(t);throw new d(`${r} cannot be combined with --import (${Gx[t]}).`,{isUserError:!0,missingFlag:r})}if(e.new&&e.siteId)throw new d("--new and --site-id are mutually exclusive. Use --site-id to attach the app to an existing site, or --new to create a standalone app.",{isUserError:!0,missingFlag:"--new"});if(!e.new&&!e.siteId)throw new d("--import requires either --site-id <siteId> to attach to an existing site or --new to create a standalone app. A siteId from the repository is not used to choose the mutation target.",{isUserError:!0,missingFlag:"--site-id"});if(e.new&&e.mount!==void 0)throw new d("--mount cannot be combined with --new: a standalone app owns the root of its own domain, so it always mounts at /. Use --site-id <siteId> to attach the app to an existing site at a path.",{isUserError:!0,missingFlag:"--mount"});if(e.siteId&&e.mount===void 0)throw new d("--site-id requires --mount <path> for repository imports. Use a non-root path such as --mount /app.",{isUserError:!0,missingFlag:"--mount"})}function Kx(e){return`--${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function ed(e,{namespace:t}){let r=t==="apps",n=e.command("init").description(r?"Bootstrap a new Webflow Cloud app, from a starter template or from an existing GitHub repository (--import)":"Bootstrap a new Webflow Cloud app from a starter template").addOption(new pn.Option("-n, --app-name <name>","App name")).addOption(new pn.Option("--project-name <name>",`${Kr} Use --app-name instead.`)).option("-f, --framework <framework>","Framework to use (e.g., astro, nextjs)").option("-m, --mount <mount>","Mount path (default: '/' for new domain, '/app' for existing site). With --import: required (non-root) when attaching to a site with --site-id, not allowed with --new").option("-s, --site-id <siteId>","Webflow site ID to connect to").option("--new","Create an app without connecting to an existing site").option("-w, --workspace-id <workspaceId>","Workspace ID where the app should be deployed (skips workspace picker)");r&&n.option("--import <repo-url>","Create the app from an existing GitHub repository (https://github.com/<owner>/<repo>) and clone it locally. Requires --site-id to attach to an existing site or --new to create a standalone app. The Webflow GitHub App must be installed on the repository and connected to your workspace.").option("--branch <branch>","Branch to build when using --import. Defaults to the repository's default branch.").option("--idempotency-key <key>","Required for non-interactive runs (CI, --no-input). Reuse a retry-stable key unique to this repository and target (for example, $GITHUB_RUN_ID-$REPOSITORY-$SITE_ID) so a retry replays the original app instead of creating a second one").addOption(new pn.Option("--json","Output as JSON when using --import")).addOption(new pn.Option("--dry-run","Preview the repository import without executing")),n.action(async(o,i)=>{if(Fg(t),Jx(t,"init",o),kO(o),r&&o.import!==void 0){await Ng({import:o.import,branch:o.branch,appName:o.appName,siteId:o.siteId,newSite:o.new,mount:o.mount,idempotencyKey:o.idempotencyKey,json:o.json,dryRun:o.dryRun});return}await DO(o,i)})}function td(e,{namespace:t}){e.command("deploy").description("Deploy your Webflow Cloud app").option("-e, --environment <environment>","Environment name").option("-m, --mount <mount>","Mount path (e.g., /app)").addOption(new pn.Option("-n, --app-name <name>","App name (for new apps)")).addOption(new pn.Option("--project-name <name>",`${Kr} Use --app-name instead.`)).option("-d, --directory <path>","App directory path (for new apps)").option("--description <description>","App description (for new apps)").option("--skip-mount-path-check","Skip mount path checking").option("--auto-publish","Automatically publish site for mount path updates").option("-s, --site-id <siteId>","Webflow site ID for site-attached deploys (skips site picker)").addOption(new pn.Option("-a, --app-id <appId>","App ID (skips app picker)")).addOption(new pn.Option("--project-id <appId>",`${Kr} Use --app-id instead.`)).option("-f, --framework <framework>","Override framework detection (e.g., nextjs, astro)").option("-w, --workspace-id <workspaceId>","Workspace ID where the app will be deployed (skips workspace picker)").action(async(r,n)=>{Fg(t),Jx(t,"deploy",r),await EO(r,n)})}var DO=Rg,EO=Ig;var zx=e=>{let t=Ke(),r=e.command("cloud").description(t?`${Kr} Use 'webflow apps' instead. Create and manage Webflow Cloud apps`:"Create and manage Webflow Cloud apps");r.command("create").description(`${Kr} Use 'webflow ${t?"apps":"cloud"} init' instead. Quick non-interactive scaffold for site-attached apps (hardcoded to /app).`).argument("<name>","App name").option("-f, --framework <framework>","Framework to use","nextjs").action(_g),r.command("list").description(t?`${Kr} Lists scaffold templates (not your apps). Use 'webflow apps init --framework' / --help; for apps use 'webflow apps list'.`:`${Kr} Lists scaffold templates (not your apps). Use 'webflow cloud init --framework' / --help.`).action(Ag),ed(r,{namespace:"cloud"}),td(r,{namespace:"cloud"})};var qx=require("commander");qr();var Yx=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");ed(t,{namespace:"apps"}),td(t,{namespace:"apps"}),t.command("list").description(`List all apps in your Webflow workspace. Optional filters: --site (exact site id), --name (exact, case-sensitive), and --q (case-insensitive substring on name). App names are unique only within a site, so pass --site AND --name together to resolve to at most one app; --site alone can match many apps and --name alone can match apps across sites. ${Sc("app","an exact filter")}`).option("-s, --site <site-id>","Filter apps to an exact Webflow site id. Combine with --name to resolve to at most one app. Does not default from webflow.json.",Ri).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ri).addOption(xc("the app name")).addOption(re()).addOption(We([...Fn()]).default(hc)).action(Pg),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(re()).addOption(We([...Fn()]).default(Bf)).action(jg),t.command("domains").description("List domains and live URLs for an app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(We([...ha()]).default(yc)).addOption(re()).option("--limit <n>","Max number of domains to return (server caps at 100)",Ac).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Mg),Ke()&&(t.command("update").description("Update an app's name or description. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--name <name>","New app name").option("--description <description>","New app description").addOption(re()).addOption(_e()).action(zg),t.command("delete").description("Delete (or archive) an app. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Ii()).addOption(re()).addOption(_e()).action(qg)),t.command("environments").description("Manage the environments of a Webflow Cloud app").command("list").description(`List the environments of an app. Optional filters: --branch (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on branch, for discovery). ${Sc("environment","--branch")}`).argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--branch <branch>","Filter environments by exact branch name (case-sensitive) \u2014 resolves to at most one environment.",Ri).addOption(xc("the environment branch")).addOption(We([...ya()]).default(wc)).addOption(re()).action(Bg);let n=t.command("deployments").description("Inspect Webflow Cloud deployments");n.command("list").description("List the most recent deployments of an environment (newest first). Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").addOption(Rk()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(re()).addOption(We([..._n()]).default(wa)).action(Vg),n.command("get").description("Get details for a specific deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Pass --wait to poll until the deployment reaches a terminal status (exit 0 on success, 1 otherwise); --interval is floored at 5s and --timeout capped at 30min.").argument("<depId>","Deployment ID").addOption(new qx.Option("--wait","Poll until the deployment reaches a terminal status (success/failed/canceled/unstaged) or the timeout elapses, then exit 0 on success or 1 otherwise")).addOption(Tk()).addOption(Pk()).addOption(re()).addOption(We([..._n()]).default(wa)).action(Gg),n.command("redeploy").description("Re-run a deployment at its SAME commit (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. To roll back, redeploy an earlier successful deployment's ID. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Use --dry-run to preview.").argument("<depId>","Deployment ID to re-run").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(re()).addOption(_e()).action(Kg),n.command("trigger").description("Build a GitHub-connected environment's current HEAD on demand (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker; builds whatever branch that environment is configured for. Warns (without blocking) if that branch differs from your current local branch. Use --dry-run to preview.").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(re()).addOption(_e()).action(Jg);let o=t.command("logs").description("Read Webflow Cloud app logs");o.command("build").description("Read the build logs of a deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").argument("[depId]","Deployment ID (required) \u2014 run 'webflow apps deployments list' to find one").addOption(re()).addOption(We([...Jn()]).default(cl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Jf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Wg),o.command("runtime").description("Read the runtime logs of an environment. Resolves the app from WEBFLOW_APP_ID / webflow.json (or a picker); the environment from the [envId] argument, WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or a picker.").argument("[envId]","Environment ID (defaults to the only env; required if the app has several)").addOption(re()).addOption(We([...Jn()]).default(cl)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(Jf()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(Hg);let i=t.command("env-vars").description("Manage Webflow Cloud app environment variables");i.command("list").description(`List environment variables for a Cloud app environment. Optional filters: --key (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on key, for discovery \u2014 --q never searches values). ${Sc("variable","--key")} Secret values are never returned.`).addOption(ka()).addOption(Da()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ri).addOption(xc("the variable key")).addOption(re()).addOption(We([...ks()]).default(dl.join(","))).action(nh),i.command("set").description("Create or update an environment variable. Use --secret to encrypt the value. Use --dry-run to preview.").argument("<key>","Variable name").argument("[value]","Variable value. Omit to read from piped stdin or be prompted (recommended for secrets, keeps them out of shell history).").addOption(ka()).addOption(Da()).addOption(Kf()).addOption(_e()).addOption(re()).action(ih),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ka()).addOption(Da()).addOption(_e()).addOption(re()).action(sh),i.command("import").description("Bulk import environment variables from a .env file. Use --secret to mark every key secret. Use --dry-run to preview.").argument("<file>","Path to a .env (KEY=value) file").addOption(ka()).addOption(Da()).addOption(Kf()).addOption(_e()).addOption(re()).action(lh)};ke();C();lt();async function jr(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function Xx(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok){let o=await jr(r);throw r.status>=400&&r.status<500?new d(o,{isUserError:!0}):new d(`Failed to list collections: ${o}`)}return(await r.json()).collections??[]}async function Zx(e,t){Q(t,"collectionId");let r=await K(`${O()}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!r.ok)throw new d(`Failed to get collection: ${await jr(r)}`);let n=await r.json();return{...n,fields:n.fields??[]}}async function Qx(e,t,r){Q(t,"siteId");let n={displayName:r.displayName,singularName:r.singularName};r.slug&&(n.slug=r.slug);let o=await K(`${O()}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!o.ok){let i=await jr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create collection: ${i}`)}return await o.json()}async function eC(e,t,r){Q(t,"collectionId");let n=await K(`${O()}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:r.displayName,type:r.type,isRequired:r.isRequired??!1})});if(!n.ok){let o=await jr(n);throw n.status===404?new d(`Collection "${t}" not found`,{isUserError:!0}):n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to create field: ${o}`)}return await n.json()}async function ch(e,t,r={}){Q(t,"collectionId");let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset)),r.cmsLocaleId&&n.set("cmsLocaleId",r.cmsLocaleId);let o=n.toString()?`?${n.toString()}`:"",i=await K(`${O()}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to list items: ${await jr(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??r.limit??100,offset:s.offset??r.offset??0}}async function tC(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=n?`?cmsLocaleId=${encodeURIComponent(n)}`:"",i=await K(`${O()}/v2/collections/${t}/items/${r}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!i.ok)throw new d(`Failed to get item: ${await jr(i)}`);return await i.json()}async function uh(e,t,r,n=!1){Q(t,"collectionId");let o=await K(`${O()}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r,isDraft:n})});if(!o.ok){let i=await jr(o);throw o.status>=400&&o.status<500?new d(i,{isUserError:!0}):new d(`Failed to create item: ${i}`)}return await o.json()}async function dh(e,t,r,n){Q(t,"collectionId"),Q(r,"itemId");let o=await K(`${O()}/v2/collections/${t}/items/${r}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n})});if(o.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!o.ok)throw new d(`Failed to update item: ${await jr(o)}`);return await o.json()}async function rC(e,t,r){Q(t,"collectionId"),Q(r,"itemId");let n=await K(`${O()}/v2/collections/${t}/items/${r}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new d(`Item "${r}" not found`,{isUserError:!0});if(!n.ok)throw new d(`Failed to delete item: ${await jr(n)}`)}async function nC(e,t,r){Q(t,"collectionId"),r.forEach(o=>Q(o,"itemId"));let n=await K(`${O()}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:r})});if(!n.ok){let o=await jr(n);throw n.status>=400&&n.status<500?new d(o,{isUserError:!0}):new d(`Failed to publish items: ${o}`)}return await n.json()}me();Y();Pe();async function rd(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=oe(),r=await Je(t);return{token:r.accessToken,siteId:r.siteId}}function oC(e,t=["id","displayName","slug"]){if(e.length===0)return P("No collections found.");let r=["id","displayName","singularName","slug","lastUpdated"],n=Object.fromEntries(r.map(a=>[a.toLowerCase(),a])),o=t.map(a=>n[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Ut(`Invalid fields. Available: ${r.join(", ")}`);let i=o.map(a=>se(a)),s=e.map(a=>o.map(l=>{let c=a[l];return c?l==="lastUpdated"?new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c:P("\u2014")}));return ze(i,s)}function iC(e){let t=[`${se("Collection:")} ${e.displayName}`,`${se("ID:")} ${e.id}`,`${se("Slug:")} ${e.slug}`,`${se("Singular:")} ${e.singularName}`,`${se("Updated:")} ${new Date(e.lastUpdated).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`,"",se("Fields:")];if(e.fields.length===0)return t.push(P(" No fields defined.")),t.join(`
|
|
206
|
+
`);let r=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),n=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(ze(r,n)),t.join(`
|
|
207
|
+
`)}function sC(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return P("No items found.");let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?ue("draft"):z("live");if(i==="isArchived")return o.isArchived?P("archived"):"";if(i==="lastUpdated"||i==="lastPublished"||i==="createdOn"){let a=o[i];return a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):P("\u2014")}let s=o[i];return s==null?P("\u2014"):String(s)}));return ze(r,n)}C();R();j();function nd(e,t,r="asc"){return[...e].sort((n,o)=>{let i=n[t],s=o[t];if(i==null&&s==null)return 0;if(i==null)return 1;if(s==null)return-1;let a=0;return typeof i=="string"&&typeof s=="string"?a=i.localeCompare(s):typeof i=="number"&&typeof s=="number"?a=i-s:a=String(i).localeCompare(String(s)),r==="desc"?-a:a})}Z();async function ph(e){let{token:t,siteId:r}=await rd(e),n=_.forCms({authToken:t,siteId:r}),o=Date.now();try{let i=await Xx(t,r);if(await n.sendUsage("cms_collections_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No collections found.");return}let s=["displayName","slug","lastUpdated"];if(s.includes(e.sortBy)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${s.join(", ")}. Defaulting to displayName.`),e.sortBy="displayName"),!["asc","desc"].includes(e.order))throw new d(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=nd(i,e.sortBy,e.order);if(e.json){u.info(JSON.stringify(a,null,2));return}let l=e.fields.split(",").map(c=>c.trim());u.info(oC(a,l))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list collections:`})}}Y();C();R();j();Z();async function fh(e,t){let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await Zx(r,e);if(await n.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(iC(i))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to get collection:`})}}C();R();j();Z();async function mh(e){let t=e.singularName??e.name,r=e.slug??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(e.dryRun){u.info("Dry run \u2014 would create collection:"),u.info(JSON.stringify({displayName:e.name,singularName:t,slug:r},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:n,siteId:o}=await rd(e),i=_.forCms({authToken:n,siteId:o}),s=Date.now();try{let a=await Qx(n,o,{displayName:e.name,singularName:t,slug:r});if(await i.sendUsage("cms_collections_create",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Collection created: ${a.id}`),u.info(` Name: ${a.displayName}`),u.info(` Slug: ${a.slug}`),u.info(`
|
|
208
|
+
Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof d&&a.isUserError){u.info(`${D} ${a.message}`),process.exitCode=1;return}throw await i.sendError(a instanceof Error?a:new Error(String(a)),"cms_collections_create",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to create collection:`})}}Y();C();R();j();Z();async function gh(e){if(e.dryRun){u.info("Dry run \u2014 would create field:"),u.info(JSON.stringify({collectionId:e.collection,displayName:e.name,type:e.type,isRequired:e.required??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{let o=await eC(t,e.collection,{displayName:e.name,type:e.type,isRequired:e.required??!1});if(await r.sendUsage("cms_fields_create",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(`${$} Field created: ${o.id}`),u.info(` Name: ${o.displayName}`),u.info(` Type: ${o.type}`),u.info(` Slug: ${o.slug}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_fields_create",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to create field:`})}}Y();C();R();j();Z();async function hh(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now(),o=e.limit??100,i=e.offset??0;try{let s=await ch(t,e.collection,{limit:o,offset:i,cmsLocaleId:e.locale});if(await r.sendUsage("cms_items_list",{duration:Date.now()-n,count:s.items.length}),s.items.length===0){u.info("No items found.");return}if(e.json){u.info(JSON.stringify(s,null,2));return}let a=e.fields.split(",").map(f=>f.trim());u.info(sC(s.items,a));let l=i+1,c=i+s.items.length;if(s.items.length>=o||i>0){let f=s.total>0?` of ${s.total}`:"";u.info(`
|
|
209
|
+
Showing ${l}\u2013${c}${f} items. Use --offset ${c} to load next page.`)}}catch(s){if(s instanceof d&&s.isUserError){u.info(`${D} ${s.message}`),process.exitCode=1;return}throw await r.sendError(s instanceof Error?s:new Error(String(s)),"cms_items_list",{duration:Date.now()-n}),new d(s,{prefix:`${D} Failed to list items:`})}}Y();C();R();j();Z();async function yh(e){let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{let o=await tC(t,e.collection,e.item,e.locale);if(await r.sendUsage("cms_items_get",{duration:Date.now()-n}),e.json){u.info(JSON.stringify(o,null,2));return}let i=o.isArchived?"archived":o.isDraft?"draft":"live";u.info(`${o.id} [${i}]`),u.info(` Last updated: ${new Date(o.lastUpdated).toLocaleString()}`),o.lastPublished&&u.info(` Last published: ${new Date(o.lastPublished).toLocaleString()}`),u.info(" Fields:"),u.info(JSON.stringify(o.fieldData,null,4).replace(/^/gm," "))}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_get",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to get item:`})}}Y();C();R();j();Z();async function wh(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would create item:"),u.info(JSON.stringify({fieldData:t,isDraft:e.draft??!1},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await uh(r,e.collection,t,e.draft??!1);if(await n.sendUsage("cms_items_create",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item created: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_create",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to create item:`})}}Y();C();R();j();Z();async function bh(e){let t;try{t=JSON.parse(e.data)}catch{throw new d(`Invalid JSON for --data: ${e.data}`)}if(e.dryRun){u.info("Dry run \u2014 would update item:"),u.info(JSON.stringify({collectionId:e.collection,itemId:e.item,fieldData:t},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await dh(r,e.collection,e.item,t);if(await n.sendUsage("cms_items_update",{duration:Date.now()-o,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Item updated: ${i.id}`)}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_update",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to update item:`})}}Y();C();R();j();Z();async function kh(e){if(e.dryRun){u.info(`Dry run \u2014 would delete item ${e.item} from collection ${e.collection}`),u.info("Dry run complete \u2014 no changes made.");return}let t=await T(),r=_.forCms({authToken:t}),n=Date.now();try{await rC(t,e.collection,e.item),await r.sendUsage("cms_items_delete",{duration:Date.now()-n,dryRun:!1}),u.info(`${$} Item deleted: ${e.item}`)}catch(o){if(o instanceof d&&o.isUserError){u.info(`${D} ${o.message}`),process.exitCode=1;return}throw await r.sendError(o instanceof Error?o:new Error(String(o)),"cms_items_delete",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to delete item:`})}}Y();C();R();j();Z();async function Dh(e){let t=e.items.split(",").map(i=>i.trim());if(e.dryRun){u.info(`Dry run \u2014 would publish ${t.length} item(s) in collection ${e.collection}:`),t.forEach(i=>u.info(` ${i}`)),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forCms({authToken:r}),o=Date.now();try{let i=await nC(r,e.collection,t);if(await n.sendUsage("cms_items_publish",{duration:Date.now()-o,itemCount:t.length,dryRun:!1}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishedItemIds?.length??0;u.info(`${$} Published ${s} item(s)`),i.errors?.length&&i.errors.forEach(a=>u.warn(` ${a.itemId}: ${a.message}`))}catch(i){if(i instanceof d&&i.isUserError){u.info(`${D} ${i.message}`),process.exitCode=1;return}throw await n.sendError(i instanceof Error?i:new Error(String(i)),"cms_items_publish",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to publish items:`})}}var aC=e=>{let t=e.command("cms").description("Manage Webflow CMS content"),r=t.command("collections").description("Manage CMS collections");r.command("list").description("List all CMS collections for a site").addOption(Rt()).addOption(re()).addOption(We(["id","displayName","singularName","slug","lastUpdated"]).default("id,displayName,slug")).addOption(Pi(["displayName","slug","lastUpdated"]).default("displayName")).addOption(Ti()).action(ph),r.command("get").description("Get details and field schema for a CMS collection").argument("<collectionId>","Collection ID").addOption(re()).action(fh),r.command("create").description("Create a new CMS collection on a site. Use --dry-run to preview.").addOption(Rt()).requiredOption("--name <displayName>","Collection display name").option("--singular-name <singularName>","Singular name (defaults to --name)").option("--slug <slug>","URL slug for the collection (auto-derived from --name if omitted)").addOption(_e()).addOption(re()).action(mh),t.command("fields").description("Manage CMS collection fields").command("create").description("Add a field to a CMS collection. Use --dry-run to preview.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--name <displayName>","Field display name").requiredOption("--type <type>","Field type (e.g. PlainText, RichText, Number, DateTime, Link, Image, Video, Color, Bool, Option, ItemRef, ItemRefSet)").option("--required","Mark field as required").addOption(_e()).addOption(re()).action(gh);let o=t.command("items").description("Manage CMS items");o.command("list").description("List items in a CMS collection").requiredOption("--collection <collectionId>","Collection ID").option("--locale <cmsLocaleId>","CMS locale ID to filter by").addOption(Fc()).addOption(_c()).addOption(re()).addOption(We(["id","isDraft","isArchived","lastUpdated","fieldData"]).default("id,isDraft,lastUpdated")).action(hh),o.command("get").description("Get a single CMS item by ID").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").option("--locale <cmsLocaleId>","CMS locale ID to retrieve content for").addOption(re()).action(yh),o.command("create").description("Create a new CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--data <json>","Item field data as a JSON string").option("--draft","Create as draft (not published)").addOption(_e()).addOption(re()).action(wh),o.command("update").description("Update an existing CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").requiredOption("--data <json>","Updated field data as a JSON string").addOption(_e()).addOption(re()).action(bh),o.command("delete").description("Delete a CMS item. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--item <itemId>","Item ID").addOption(_e()).action(kh),o.command("publish").description("Publish one or more CMS items. Use --dry-run to preview before executing.").requiredOption("--collection <collectionId>","Collection ID").requiredOption("--items <itemIds>","Comma-separated item IDs to publish").addOption(_e()).addOption(re()).action(Dh)};Y();me();C();R();j();Pe();Z();ke();lt();C();C();me();var lC={png:{category:"image",maxBytes:4*1024*1024},jpeg:{category:"image",maxBytes:4*1024*1024},jpg:{category:"image",maxBytes:4*1024*1024},gif:{category:"image",maxBytes:4*1024*1024},svg:{category:"image",maxBytes:4*1024*1024},webp:{category:"image",maxBytes:4*1024*1024},avif:{category:"image",maxBytes:4*1024*1024},pdf:{category:"document",maxBytes:10*1024*1024},doc:{category:"document",maxBytes:10*1024*1024},docx:{category:"document",maxBytes:10*1024*1024},xls:{category:"document",maxBytes:10*1024*1024},xlsx:{category:"document",maxBytes:10*1024*1024},ppt:{category:"document",maxBytes:10*1024*1024},pptx:{category:"document",maxBytes:10*1024*1024},txt:{category:"document",maxBytes:10*1024*1024},csv:{category:"document",maxBytes:10*1024*1024},odt:{category:"document",maxBytes:10*1024*1024},ods:{category:"document",maxBytes:10*1024*1024},odp:{category:"document",maxBytes:10*1024*1024},json:{category:"lottie",maxBytes:10*1024*1024},lottie:{category:"lottie",maxBytes:10*1024*1024}};function od(e,t){let r=e.split(".").pop()?.toLowerCase()??"",n=lC[r];if(!n){let o=Object.keys(lC).join(", ");throw new d(`Unsupported file type ".${r}". Allowed types: ${o}`,{isUserError:!0})}if(t>n.maxBytes){let o=n.maxBytes/1048576,i=(t/(1024*1024)).toFixed(1);throw new d(`File too large: ${i} MB exceeds the ${o} MB limit for ${n.category} files.`,{isUserError:!0})}}var Eh=["id","displayName","originalFileName","contentType","size","lastUpdated"];function cC(e,t=["id","displayName","lastUpdated","size"]){if(e.length===0)return P("No assets found.");let r=Object.fromEntries(Eh.map(l=>[l.toLowerCase(),l])),n=t.map(l=>r[l.toLowerCase()]).filter(l=>l!=null);if(n.length===0)return Ut(`Invalid fields. Available: ${Eh.join(", ")}`);let o=t.filter(l=>r[l.toLowerCase()]==null),i=o.length>0?ue(`Warning: unknown field(s) ignored: ${o.join(", ")}. Available: ${Eh.join(", ")}
|
|
210
|
+
`):"",s=n.map(l=>se(l)),a=e.map(l=>n.map(c=>{let p=l[c];if(p==null||c==="size"&&p===0)return P("\u2014");if(c==="size")return vO(Number(p));if(c==="lastUpdated"){let m=new Date(String(p)),g=String(m.getMonth()+1).padStart(2,"0"),h=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),k=String(m.getHours()).padStart(2,"0"),v=String(m.getMinutes()).padStart(2,"0");return`${g}/${h}/${y} ${k}:${v}`}let f=String(p);return c==="displayName"&&f.length>40?P("\u2026")+f.slice(-39):f}));return i+ze(s,a)}function vO(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function uC(e){if(e.length===0)return P("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),r=["id","displayName","assets","lastUpdated"].map(o=>se(o)),n=t.map(o=>[o.id,o.displayName,String(o.assets.length),new Date(o.lastUpdated).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]);return ze(r,n)}async function dC(e,t,r={}){if(Q(t,"siteId"),r.folderId){Q(r.folderId,"folderId");let a=await SO(e,r.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],p=0,f=100;for(;;){let k=await K(`${O()}/v2/sites/${t}/assets?limit=${f}&offset=${p}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!k.ok)throw new d(`Failed to list assets: ${k.status} ${k.statusText}`);let v=await k.json(),F=v.assets??[];c.push(...F);let E=v.pagination?.total??0;if(p+=F.length,p>=E||F.length===0)break}let m=c.filter(k=>l.has(k.id)),g=r.offset??0,h=r.limit??m.length,y=m.slice(g,g+h);return{assets:y,pagination:{total:m.length,limit:y.length,offset:g}}}let n=new URLSearchParams;r.limit!=null&&n.set("limit",String(r.limit)),r.offset!=null&&n.set("offset",String(r.offset));let o=n.toString(),i=await K(`${O()}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new d(`Failed to list assets: ${i.status} ${i.statusText}`);let s=await i.json();return{assets:s.assets??[],pagination:s.pagination??{total:0,limit:100,offset:0}}}async function pC(e,t,r,n,o){Q(t,"siteId"),o&&Q(o,"folderId");let i=_a(r);od(i.meta.title,i.meta.size);let s=n??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await K(`${O()}/v2/sites/${t}/assets`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)});if(!l.ok)throw new d(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),p={fields:c.uploadDetails,_id:c.id,s3Url:c.hostedUrl??"",url:c.uploadUrl??"",contentType:c.contentType??"",origFileName:c.originalFileName??i.meta.title,success_action_redirect:"",createdOn:"",updatedOn:""};try{await Ra(i,p)}catch(f){throw await K(`${O()}/v2/assets/${p._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),f}return{id:p._id,hostedUrl:p.s3Url,displayName:s,originalFileName:i.meta.title}}async function fC(e,t,r){Q(t,"assetId");let n=await K(`${O()}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new d(`Failed to update asset: ${n.status} ${n.statusText}`);return await n.json()}async function SO(e,t){Q(t,"folderId");let r=await K(`${O()}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get folder: ${r.status} ${r.statusText}`);return await r.json()}async function mC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to list folders: ${r.status} ${r.statusText}`);return(await r.json()).assetFolders??[]}async function gC(e,t,r,n){Q(t,"siteId"),n&&Q(n,"parentFolderId");let o={displayName:r};n&&(o.parentFolder=n);let i=await K(`${O()}/v2/sites/${t}/asset_folders`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new d(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function vh(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=oe(),s=await Je(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let{assets:i,pagination:s}=await dC(t,r,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await n.sendUsage("assets_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No assets found.");return}let a=["displayName","originalFileName","contentType","size","lastUpdated"],l=e.sortBy;a.includes(l)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${a.join(", ")}. Defaulting to displayName.`),l="displayName");let c=e.order;["asc","desc"].includes(e.order)||(u.warn(`Unknown --order "${e.order}". Valid values: asc, desc. Defaulting to asc.`),c="asc");let p=nd(i,l,c);if(e.json){u.info(JSON.stringify({assets:p,pagination:s},null,2));return}let f=e.fields.split(",").map(g=>g.trim());u.info(cC(p,f));let m=(e.offset??0)+i.length;m<s.total&&u.info(P(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list assets:`})}}Y();C();R();j();Pe();Z();async function Sh(e,t){let r=_a(e);if(od(r.meta.title,r.meta.size),t.dryRun){u.info(`Dry run \u2014 would upload: ${e} (validated)`),t.name&&u.info(` Display name: ${t.name}`),t.folder&&u.info(` Folder: ${t.folder}`),u.info("Dry run complete \u2014 no changes made.");return}let n,o;if(t.site)n=await T(),o=t.site;else{let{manifest:a}=oe(),l=await Je(a);n=l.accessToken,o=l.siteId}let i=_.forAssets({authToken:n,siteId:o}),s=Date.now();try{let a=await pC(n,o,e,t.name,t.folder);if(await i.sendUsage("assets_upload",{duration:Date.now()-s,dryRun:!1}),t.json){u.info(JSON.stringify(a,null,2));return}u.info(`${$} Asset uploaded: ${a.id}`),a.hostedUrl&&u.info(` URL: ${a.hostedUrl}`)}catch(a){throw await i.sendError(a instanceof Error?a:new Error(String(a)),"assets_upload",{duration:Date.now()-s}),new d(a,{prefix:`${D} Failed to upload asset:`})}}Y();C();R();j();Z();async function xh(e,t){if(!t.altText&&!t.displayName)throw new d("Provide at least one of --alt-text or --display-name.",{isUserError:!0});if(t.dryRun){u.info(`Dry run \u2014 would update asset: ${e}`),t.altText&&u.info(` Alt text: ${t.altText}`),t.displayName&&u.info(` Display name: ${t.displayName}`),u.info("Dry run complete \u2014 no changes made.");return}let r=await T(),n=_.forAssets({authToken:r}),o=Date.now();try{let i=await fC(r,e,{altText:t.altText,displayName:t.displayName});if(await n.sendUsage("assets_update",{duration:Date.now()-o,dryRun:!1}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${$} Asset updated: ${i.id}`),i.displayName&&u.info(` Display name: ${i.displayName}`),i.altText&&u.info(` Alt text: ${i.altText}`)}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to update asset:`})}}Y();C();R();j();Pe();Z();async function Ch(e){let t,r;if(e.site)t=await T(),r=e.site;else{let{manifest:i}=oe(),s=await Je(i);t=s.accessToken,r=s.siteId}let n=_.forAssets({authToken:t,siteId:r}),o=Date.now();try{let i=await mC(t,r);if(await n.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(uC(i))}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to list folders:`})}}Y();C();R();j();Qs();Z();async function Fh(e,t){let r,n;if(t.site)r=await T(),n=t.site;else{let{manifest:s}=oe(),a=await Je(s);r=a.accessToken,n=a.siteId}let o=_.forAssets({authToken:r,siteId:n}),i=Date.now();try{let s=await gC(r,n,e,t.parent);if(await o.sendUsage("assets_folders_create",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} Folder created: ${s.id}`),u.info(` Name: ${s.displayName}`),s.parentFolder&&u.info(` Parent: ${s.parentFolder}`)}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"assets_folders_create",{duration:Date.now()-i}),new d(s,{prefix:`${D} Failed to create folder:`})}}var hC=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(Rt()).option("--folder <folderId>","Filter by folder ID").addOption(re()).addOption(We(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(Fc()).addOption(_c()).addOption(Pi(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Ti()).action(vh),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
|
|
211
|
+
Supported types: png, jpg, jpeg, gif, svg, webp, avif (\u22644 MB); pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, odt, ods, odp, json, lottie (\u226410 MB)`).argument("<file>","Path to the file to upload (see supported types above)").addOption(Rt()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(_e()).addOption(re()).action(Sh),t.command("update").description("Update an asset's metadata. Use --dry-run to preview.").argument("<assetId>","Asset ID to update").option("--alt-text <text>","Alt text for the asset").option("--display-name <name>","New display name for the asset").addOption(_e()).addOption(re()).action(xh);let r=t.command("folders").description("Manage asset folders");r.command("list").description("List all asset folders for a site").addOption(Rt()).addOption(re()).action(Ch),r.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(Rt()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(re()).action(Fh)};Y();C();R();j();Z();ke();C();lt();async function yC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get site: ${r.status} ${r.statusText}`);return await r.json()}async function wC(e){return il(`${O()}/v2/sites`,e,"sites","Failed to list sites")}async function bC(e,t){Q(t,"siteId");let r=await K(`${O()}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!r.ok)throw new d(`Failed to get custom domains: ${r.status} ${r.statusText}`);return(await r.json()).customDomains??[]}async function kC(e,t,r=[],n){Q(t,"siteId"),n&&Q(n,"pageId");let o=r.length>0?{customDomains:r}:{publishToWebflowSubdomain:!0};n&&(o.pageId=n);let i=await K(`${O()}/v2/sites/${t}/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new d(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();me();var _h=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],DC=dt(_h);function EC(){return _h}function vC(e,t=["id","displayName","lastPublished"]){if(e.length===0)return P("No sites found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${_h.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="lastPublished"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:P("\u2014")}));return ze(r,n)}function SC(e){if(e.length===0)return P("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],r=e.map(n=>[n.id,n.url,n.lastPublished?new Date(n.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):P("\u2014")]);return ze(t,r)}async function Ah(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await wC(t);if(await r.sendUsage("sites_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No sites found.");return}let i=Fe(e.fields,DC,EC());u.info(vC(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list sites:`}))}}Y();C();R();j();Z();async function Rh(e,t){let r=await T(),n=_.forSites({authToken:r}),o=Date.now();try{let i=await yC(r,e);if(await n.sendUsage("sites_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${i.displayName} (${i.id})`),u.info(` Short name: ${i.shortName}`),u.info(` Time zone: ${i.timeZone}`),i.lastPublished&&u.info(` Published: ${new Date(i.lastPublished).toLocaleString()}`),i.previewUrl&&u.info(` Preview: ${i.previewUrl}`)}catch(i){throw i instanceof d&&i.isUserError?i:(await n.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new d(i,{prefix:`${D} Failed to get site:`}))}}Y();C();R();j();Z();async function Ih(e){let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=await bC(t,e.site);if(await r.sendUsage("sites_domains",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(SC(o))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to get custom domains:`}))}}Y();C();R();j();Z();async function Th(e){if(Q(e.site,"siteId"),e.dryRun){u.info(`Would publish ${e.page?`page ${e.page} on`:"site"} ${e.site}`),e.domains?u.info(` Custom domains: ${e.domains}`):u.info(" Domains: Webflow subdomain");return}let t=await T(),r=_.forSites({authToken:t}),n=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await kC(t,e.site,o,e.page);if(await r.sendUsage("sites_publish",{duration:Date.now()-n,dryRun:!1,publishScope:i.publishScope}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishScope==="page"?"Page":"Site";u.info(`${$} ${s} published successfully`);let a=i.customDomains??[];a.length>0?a.forEach(l=>{let c=l.lastPublished?` (${new Date(l.lastPublished).toLocaleString()})`:"";u.info(` Live at: https://${l.url}${c}`)}):i.publishToWebflowSubdomain&&u.info(" Published to Webflow subdomain")}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to publish site:`}))}}Y();Y();ke();C();we();Oe();R();j();Pe();Z();ke();lt();C();var id="not_enterprise_plan_workspace";async function xC(e,t,r){Q(t,"workspaceId");let n=r.trim();if(!n)throw new d("Site name cannot be empty.",{isUserError:!0});let o=await K(`${O()}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:n})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===id?new d("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:id}):a==="missing_scopes"?new d(`Your token is missing the 'workspace:write' scope.
|
|
212
|
+
Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new d(`Failed to create site "${n}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new d("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??n,shortName:i.shortName??""}}function xO(e){Se({siteId:e.id});let{manifestPath:t}=oe();u.info(`${$} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function CO(e,t){let r=new Map;for(let i of t)i.workspaceId&&r.set(i.workspaceId,(r.get(i.workspaceId)??0)+1);let n=[...r.keys()];if(n.length===1)return n[0];if(n.length===0){let i=await ps(e);if(i.length===0)throw new d("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(V())throw new d(`This token can access ${i.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});return(await fs(i)).id}if(V())throw new d(`This token's sites span ${n.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});let o=await je({message:"Which workspace should the new site be created in?",choices:n.map(i=>({name:`${i} (${r.get(i)} site${r.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new d("No workspace selected.",{isUserError:!0});return o}async function FO(e,t){if(u.warn(`${D} ${t.message}
|
|
213
|
+
Create the site in the Webflow dashboard: ${xr()}/dashboard
|
|
214
|
+
then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await $e({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let n=await xn(e);if(n.length===0)throw new d("No existing sites are accessible with this token yet. Create one in the Webflow dashboard, then re-run `webflow sites init`.",{isUserError:!0});return{site:await _i(n),created:!1}}async function _O(e,t,r){let n=await CO(e,t),o=r.name;if(o||(o=await Ge({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new d("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await xC(e,n,o)}catch(s){if(s instanceof d&&s.code===id)return FO(e,s);throw s}return u.info(`${$} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function sd(e={}){let t=await T({apiToken:e.apiToken}),r=_.forSites({authToken:t}),n=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new d("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await xn(t),s;if(e.siteId){Q(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new d(`Site "${e.siteId}" is not among the ${i.length} site(s) this token can access.`,{isUserError:!0});s=a}else{let a=!!(e.create||e.name);if(!a&&V())throw new d("`webflow sites init` needs an explicit target when prompts are unavailable. Pass --site-id <siteId> to bind, or --create --name <name> to create a new site.",{isUserError:!0,missingFlag:"site-id"});if(a||(i.length===0?(u.info("No sites are accessible with this token."),a=!0):a=await je({message:"How do you want to connect this project?",choices:[{name:"Bind to an existing Webflow site",value:"bind"},{name:"Create a new Webflow site",value:"create"}],default:"bind"})==="create"),a){let l=await _O(t,i,e);s=l.site,o=l.created}else s=await _i(i)}xO(s),await r.sendUsage("site_init",{duration:Date.now()-n,created:o})}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-n}),i instanceof d?i:new d(i,{prefix:`${D} Failed to initialize site:`})}}Y();me();C();R();j();Z();ke();lt();C();function AO(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function RO(e,t){let r=await t.text(),n;try{n=JSON.parse(r)}catch{}throw t.status===404&&n?.error==="Not found"&&!n.code?new d(`Failed to ${e}: WFS Sync is not enabled on this environment (the server feature flag is off, or the host does not serve /api/ai/wfs).`,{isUserError:!0}):n?.code==="SCHEMA_STALE"?new d(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):n?.code&&n.error?new d(`Failed to ${e}: ${n.error} (${n.code})`,{isUserError:t.status<500}):new d(`Failed to ${e}: ${t.status} ${t.statusText}${AO(r)}`)}async function CC(e,t,r,n){let o=await K(`${xr()}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});o.ok||await RO(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new d(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function Ph(e,t,r){Q(t,"siteId");let n=await CC("pull the site files","pull",e,{siteId:t,identityMode:"clean",...r?.pageIds&&r.pageIds.length>0?{pageIds:r.pageIds}:{},...r?.manifestOnly?{manifestOnly:!0}:{}});if(n.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});return{...n,pages:n.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function FC(e,t,r,n){Q(t,"siteId");let o=await CC("push the site files","push",e,{siteId:t,identityMode:"clean",changes:r,...n?.conflictPolicy?{conflictPolicy:n.conflictPolicy}:{},...n?.schemaHash?{schemaHash:n.schemaHash}:{}});if(o.identityMode!=="clean")throw new d("This version of the CLI requires clean identity mode support from the Webflow API \u2014 the environment you're targeting doesn't support it yet. Use an older CLI or target a newer environment.",{isUserError:!0});if(!Array.isArray(o.results))throw new d("Invalid response from the WFS Sync API: expected a `results` array.");return o}Pe();Y();C();var ad=require("path");function $h(e){return e.split(ad.sep).join("/").replace(/\\/g,"/")}function fn(e){if(e===""||e.includes("\0")||(0,ad.isAbsolute)(e))return!1;let t=$h(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(r=>r==="..")}var IO={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},_C={library:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},astro:{pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat"},nextjs:{pagesRoot:"src/app",componentsRoot:"src/components",pagesShape:"nested"},"nextjs-pages":{pagesRoot:"pages",componentsRoot:"src/components",pagesShape:"flat"}};function TO(e){return e.endsWith("/")?e.slice(0,-1):e}function AC(e,t,r){let n=e.trim();if(!fn(n))throw new d(`"site.layout.${t}" in ${r} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=n.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new d(`"site.layout.${t}" in ${r} must name a directory inside the project, not "${e}".`,{isUserError:!0});return TO(o)}function PO(e,t,r){let n=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(n.length,o.length)-1&&n[s]===o[s];s++)i.push(n[s]);return i.length>0?`${i.join("/")}/${r}`:r}function $O(e,t){let r=e?.layout;if(!r)return IO;let n=r.preset?_C[r.preset]:void 0;if(r.preset&&!n)throw new d(`Unknown "site.layout.preset" value "${r.preset}" in ${t}. Known presets: ${Object.keys(_C).join(", ")}.`,{isUserError:!0});let o=r.pagesRoot??n?.pagesRoot,i=r.componentsRoot??n?.componentsRoot;if(!o||!i)throw new d(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=r.pagesShape??n?.pagesShape??"flat",a=AC(o,"pagesRoot",t),l=AC(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:PO(a,l,"theme")}}function Ds(e){let{manifest:t,manifestPath:r}=oe(),n=e?.trim();n&&Q(n,"site-id");let o=n||uo(t);if(!o||o.trim()==="")throw new d(`Missing "siteId" in ${r}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=$O(t.site,r);return{siteId:o,layout:i}}var qn=require("fs"),Es=require("path"),WC=w(require("fast-glob"));C();var RC=require("crypto"),yt=require("fs"),Ho=require("path");C();var zn=".webflow/wfs";function hr(e){return(0,RC.createHash)("sha256").update(e,"utf8").digest("hex")}function IC(e){let{nodeIds:t,styleIds:r,...n}=e;return n}function TC(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function OO(e){return TC(e)&&typeof e.wirePath=="string"&&fn(e.wirePath)&&typeof e.localPath=="string"&&fn(e.localPath)}function LO(e){return TC(e)?typeof e.serverHash=="string"&&typeof e.contentSha256=="string"&&(e.componentId===void 0||typeof e.componentId=="string"&&e.componentId.length>0)&&(e.localPath===void 0||typeof e.localPath=="string"&&fn(e.localPath)):!1}function PC(e){return(0,Ho.join)(e,zn,"index.json")}function Oh(e,t){return fn(t)?(0,Ho.join)(e,zn,`${t}.json`):void 0}function $C(e){let t=PC(e);if((0,yt.existsSync)(t))try{let r=JSON.parse((0,yt.readFileSync)(t,"utf8"));return!r||typeof r.schemaHash!="string"||!Array.isArray(r.files)||!r.files.every(OO)?"corrupt":{...typeof r.siteId=="string"?{siteId:r.siteId}:{},...r.identityMode==="clean"?{identityMode:"clean"}:{},schemaHash:r.schemaHash,files:r.files}}catch{return"corrupt"}}function ld(e=process.cwd()){let t=$C(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${zn}/index.json could not be read`};let r={},n=[];for(let{wirePath:o}of t.files){let i=Oh(e,o);if(!i){n.push(o);continue}if(!(0,yt.existsSync)(i)){n.push(o);continue}try{let s=JSON.parse((0,yt.readFileSync)(i,"utf8"));if(!LO(s)){n.push(o);continue}r[o]=IC(s)}catch{n.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},...t.identityMode?{identityMode:t.identityMode}:{},schemaHash:t.schemaHash,files:r},corruptPaths:n}}function cd(e,t=process.cwd()){let r=$C(t),n=new Set(r&&r!=="corrupt"?r.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=Oh(t,s);if(!a)throw new d(`Refusing to write a lock entry outside ${zn}: "${s}"`);(0,yt.mkdirSync)((0,Ho.dirname)(a),{recursive:!0}),(0,yt.writeFileSync)(a,`${JSON.stringify(IC(e.files[s]),null,2)}
|
|
215
|
+
`,"utf8")}for(let s of n){if(s in e.files)continue;let a=Oh(t,s);a&&(0,yt.existsSync)(a)&&(0,yt.rmSync)(a)}let o={...e.siteId?{siteId:e.siteId}:{},...e.identityMode?{identityMode:e.identityMode}:{},schemaHash:e.schemaHash,files:Object.keys(e.files).sort().map(s=>({wirePath:s,localPath:e.files[s].localPath??s}))},i=PC(t);(0,yt.mkdirSync)((0,Ho.dirname)(i),{recursive:!0}),(0,yt.writeFileSync)(i,`${JSON.stringify(o,null,2)}
|
|
216
|
+
`,"utf8")}function OC(e=process.cwd()){(0,yt.rmSync)((0,Ho.join)(e,zn),{recursive:!0,force:!0})}C();function LC(e){if(!fn(e))throw new d(`Refusing to write unsafe path from server: "${e}"`)}var NO=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function pl(e){return NO.exec(e)?.[1]}var NC=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function jO(e){return NC.exec(e)?.[2]}function MO(e){let t=NC.exec(e);return t?t[1]??"":void 0}function Nh(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function jh(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function Mh(e,t){let n=e.slice(t.length+1).split("/");if(n.length===1)return"";if(n.length===2)return n[0]}function jC(e,t){if(t.pagesShape==="nested"){let n=e.isDefault?[]:[...e.folderSegments,e.slug];return n.length>0?`${t.pagesRoot}/${n.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let r=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${r.join("/")}.tsw`}function Bh(e,t,r){if(r)return r;let n=jO(e);if(!n)return;let o=MO(e)??"";return o?`${t.componentsRoot}/${o}/${n}.tsw`:`${t.componentsRoot}/${n}.tsw`}function MC(e,t){let r=jh(e,t);if(!r)return;let n=Mh(e,t);if(n!==void 0)return Nh(r,n)}var Lh="site/theme/";function BC(e,t){if(e.startsWith(Lh))return`${t.themeRoot}/${e.slice(Lh.length)}`}function ud(e,t){let r=`${t}/`;if(e.startsWith(r))return`${Lh}${e.slice(r.length)}`}async function HC(e,t,r=process.cwd(),n=!1){let o=[],i=[],s=[],a=[],l=[],c=[],p={},f=new Map,m=new Map;for(let[y,k]of Object.entries(e.files)){let v=k.localPath??y;f.set(y,v),m.set(v,y)}let g=new Set((await(0,WC.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:r,onlyFiles:!0,dot:!1})).map($h)),h=new Map;for(let y of Object.keys(e.files).sort()){let k=e.files[y],v=f.get(y);if(k.deletedUpstream){(0,qn.existsSync)((0,Es.join)(r,v))&&c.push(v);continue}if(!(0,qn.existsSync)((0,Es.join)(r,v))){i.push(v),h.set(k.contentSha256,v);continue}p[y]=v;let F=(0,qn.readFileSync)((0,Es.join)(r,v),"utf8");(n||hr(F)!==k.contentSha256)&&o.push({path:y,content:F,baseHash:k.serverHash})}for(let y of[...g].sort()){if(m.has(y))continue;let k=(0,qn.readFileSync)((0,Es.join)(r,y),"utf8"),v=h.get(hr(k));if(v!==void 0){s.push({oldPath:v,newPath:y});continue}let F=UO(y,t);if(F.kind==="unmappable"){a.push(y);continue}let{wirePath:E}=F,S=f.get(E);if(S!==void 0&&S!==y){l.push(y);continue}p[E]=y;let L=e.files[E];o.push(L?{path:E,content:k,baseHash:L.serverHash}:{path:E,content:k})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:p}}function UO(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let n=jh(e,t.componentsRoot);if(!n)return{kind:"unmappable"};let o=Mh(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:Nh(n,o)}}let r=ud(e,t.themeRoot);return r!==void 0?{kind:"theme",wirePath:r}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function VC(e){let t=[];for(let r=0;r<e.length;r+=20)t.push(e.slice(r,r+20));return t}function GC(e){let t=e.filter(a=>!pl(a.path)),r=new Map;for(let a of e){let l=pl(a.path);if(!l)continue;let c=r.get(l)??[];c.push(a),r.set(l,c)}let n=r.size>0?199:200;if(t.length>n)throw new d(`Too many changed site-global files to push in one request (${t.length} > ${n}). Run \`webflow sites push\` without --force to send only the files that changed, then use --force just for the ones that still conflict.`,{isUserError:!0});let o=[],i=[...t],s=0;for(let[,a]of r)!(s<20&&i.length+a.length<=200)&&(i.length>0||s>0)&&(o.push(i),i=[],s=0),i.push(...a),s+=1;return i.length>0&&o.push(i),o}function dd(e,t=process.cwd()){let r=(0,Es.join)(t,e);if((0,qn.existsSync)(r))return(0,qn.readFileSync)(r,"utf8")}var KC=require("@babel/parser");function JC(e){try{return(0,KC.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function zC(e,t){if(t.length===0)return e;let r=e;for(let{start:n,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))r=r.slice(0,n)+i+r.slice(o);return r}var WO="site/current-page.tsw";function pd(e){return pl(e)!==void 0?WO:e}function HO(e,t){let r=e.split("/").slice(0,-1);for(let n of t.split("/"))if(!(n===""||n===".")){if(n===".."){r.length>0&&r.pop();continue}r.push(n)}return r.join("/")}function VO(e,t){let r=e.split("/").slice(0,-1),n=t.split("/"),o=0;for(;o<r.length&&o<n.length-1&&r[o]===n[o];)o++;let i=r.length-o,s=n.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function fd(e,t,r,n){let o=JC(e);if(!o)return e;let i=[];for(let s of o.program.body){if(s.type!=="ImportDeclaration")continue;let a=s.source;if(a.start==null||a.end==null)continue;let l=a.value;if(!l.endsWith(".tsw")||!l.startsWith("./")&&!l.startsWith("../"))continue;let c=n(HO(t,l));if(c===void 0)continue;let p=VO(r,c);if(p===l)continue;let f=e[a.start],m=f==="'"||f==='"'?`${f}${p}${f}`:JSON.stringify(p);i.push({start:a.start,end:a.end,text:m})}return zC(e,i)}function GO(e,t){return r=>t[r]??e.files[r]?.localPath??r}function KO(e,t){let r=e.outcome==="committed"||e.outcome==="noop"?$:D,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${r} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(P(` ${t(a)} changed upstream \u2014 run \`webflow sites pull\`, re-apply your edit, and push again (or push with --force to overwrite).`));e.outcome==="skipped"&&s.push(P(" an earlier change carrying site-global files failed to commit in this push, so this page was never attempted \u2014 resolve the issue above and push again.")),e.error&&s.push(P(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${X} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
|
|
217
|
+
`)}function JO(e,t,r,n){let o=new Map;for(let[i,s]of Object.entries(t.files))o.set(s.localPath??i,i);for(let i of e)o.set(r[i.path]??i.path,i.path);return e.map(i=>{let s=r[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=fd(i.content,s,pd(i.path),l=>o.get(l)??ud(l,n.themeRoot)??MC(l,n.componentsRoot));return{...i,content:a}})}function zO(e,t){return e.map(r=>{if(!r.path.startsWith("site/components/")||!r.path.endsWith(".tsw")||r.content===void 0)return r;let n=t.files[r.path]?.componentId;if(n)return{...r,componentId:n};if(r.baseHash===void 0)return{...r,create:!0};throw new d(`Tracked component ${r.path} has no component id in sync state. Run \`webflow sites pull\` before pushing it.`,{isUserError:!0})})}function qO(e,t,r,n){return zO(JO(e,t,r,n),t)}async function YO(e,t,r,n,o){let i=[],s=!1,a=!1;for(let[l,c]of r.entries()){let p;try{p=await FC(e,t,c,{conflictPolicy:n,schemaHash:o})}catch(m){return s&&u.warn(`${X} The push failed after ${l} of ${r.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),{results:i,schemaHash:o,aborted:!0,failed:!0,failure:m}}o=p.schemaHash,i.push(...p.results);let f=p.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(p.results.some(m=>m.outcome==="committed")&&(s=!0),f&&l<r.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function XO(e){let t=[];for(let r of e)if(r.outcome==="committed")for(let[n,o]of Object.entries(r.createdComponents??{}))t.push({path:n,componentId:o,hash:r.hashes?.[n]});return t}function ZO(e,t,r,n,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,p]of Object.entries(l.hashes??{})){let f=n.get(c);if(!f||f.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:p,contentSha256:hr(f.content),...m?{localPath:m}:{}}}let a=XO(i);for(let{path:l,componentId:c,hash:p}of a){let f=n.get(l)?.content;if(f===void 0||p===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:p,contentSha256:hr(f),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{...e,siteId:e.siteId??t,schemaHash:r,files:s},created:a}}function QO(e,t){for(let{path:r,componentId:n}of e)u.info(`${$} Created component ${t(r)} (id ${n})`),u.info(P(" id tracked locally \u2014 it will be sent as metadata on future pushes without changing this file"))}function eL({missing:e,renameCandidates:t,unmappable:r,stale:n,orphanedUpstream:o},i){for(let s of e)u.warn(`${X} ${s} is tracked but missing on disk \u2014 deletions are not supported by the WFS Sync API; the file is skipped. Restore it with \`webflow sites pull\`.`);for(let{oldPath:s,newPath:a}of t){let l=s.startsWith(`${i.pagesRoot}/`),c=l?`Webflow doesn't support renaming a page's file directly: restore ${s}, then rename or move the page in the Designer instead, push, then \`webflow sites pull\` to get the file moved automatically.`:`Webflow doesn't support renaming a component's file directly: restore ${s}, edit its \`name:\` meta in place instead, push, then \`webflow sites pull\` to get the file moved automatically.`;u.warn(`${X} ${a} looks like ${s} renamed locally \u2014 skipped, since its content is byte-for-byte unchanged. ${c} (If you also edited the content before this push, this warning won't catch it \u2014 rename first, push, THEN make content edits, or the push may create a duplicate ${l?"page":"component"} instead of updating the original.)`)}for(let s of o)u.warn(`${X} ${s} was deleted or renamed in the Designer, but still has local edits \u2014 skipped. Pushing it would re-create it. Merge anything you need elsewhere, then delete it.`);for(let s of n)u.warn(`${X} ${s} is a leftover copy of a file that now lives elsewhere \u2014 skipped. Pushing it would overwrite the current version with this stale content. Delete it, or merge anything you still need into the tracked file first.`);for(let s of r){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${X} ${s} doesn't match a tracked page \u2014 creating a page via push isn't supported yet. Create it in the Designer, then \`webflow sites pull\`.`:`${X} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function tL(e){let t=ld();if(t.kind==="missing")throw new d("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new d(`This project's sync state is unreadable (${t.reason}), so push can't tell which files are tracked. Run \`webflow sites pull\` to rebuild it (add --reset to discard it first).`,{isUserError:!0});if(t.corruptPaths.length>0)throw new d(`${t.corruptPaths.length} tracked file(s) have unreadable sync state (${t.corruptPaths.slice(0,3).join(", ")}${t.corruptPaths.length>3?", \u2026":""}). Pushing now would re-create them as new objects instead of updating them. Run \`webflow sites pull\` to rebuild the state first.`,{isUserError:!0});let r=t.lockfile;if(r.siteId!==void 0&&r.siteId!==e)throw new d(`This project's sync state was pulled from site ${r.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return r}function rL(e,t,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(n=>({path:n.path,localPath:r[n.path]??n.path,isNew:n.baseHash===void 0}))},null,2)}function nL(e,t,r){u.info(`Would push ${e.length} file(s) to site ${r}:`);for(let n of e){let o=t[n.path]??n.path,i=n.create?P(" (new component)"):n.baseHash?"":P(" (new)");u.info(` ${o}${i}`)}u.info("Dry run \u2014 no changes made.")}async function md(e={}){let t=Ds(),r=tL(t.siteId),n=await HC(r,t.layout,void 0,e.force),{changes:o,localPaths:i}=n;if(eL(n,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:r.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await T({apiToken:e.apiToken}),a=_.forSites({authToken:s}),l=Date.now(),c=GO(r,i);try{let p=qO(o,r,i,t.layout);if(e.dryRun){e.json?u.info(rL(t.siteId,o,i)):nL(p,i,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let f=GC(p),{results:m,schemaHash:g,aborted:h,failed:y,failure:k}=await YO(s,t.siteId,f,e.force?"rebase":void 0,r.schemaHash),v=new Map(o.map(te=>[te.path,te])),{lockfile:F,created:E}=ZO(r,t.siteId,g,v,i,m);if(m.some(te=>te.outcome==="committed")&&cd(F),y)throw k;let S=m.filter(te=>te.outcome==="conflict"),L=m.filter(te=>te.outcome==="error"),U=m.filter(te=>te.outcome==="skipped"),N=m.flatMap(te=>te.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:g,results:m},null,2));else{QO(E,c);for(let ce of m)u.info(KO(ce,c));let te=m.filter(ce=>ce.outcome==="committed").length,G=E.length>0?` Created ${E.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length} file(s) across ${m.length} page group(s): ${te} committed, ${S.length} conflicted, ${L.length} failed, ${U.length} skipped.${G}`),h&&u.warn(`${X} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(S.length>0||L.length>0||U.length>0||N.length>0)throw new d(`${X} Push finished with ${S.length} conflict(s), ${L.length} error(s), ${U.length} skipped page(s), ${N.length} rejected file(s). Resolve the issues above and try again.`,{isUserError:!0,skipLogging:!!e.json});await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,createdComponents:E.length,dryRun:!1})}catch(p){throw await a.sendError(p instanceof Error?p:new Error(String(p)),"site_push",{duration:Date.now()-l}),p instanceof d?p:new d(p,{prefix:`${D} Failed to push site files:`})}}var Go=require("fs"),qC=require("module"),Vo=require("path");Y();me();C();R();j();Z();function oL(e,t,r,n){let o=r.get(e.path);if(o)return jC(o,t);let i=BC(e.path,t);if(i)return i;let s=n?.files[e.path]?.localPath;return Bh(e.path,t,s)??e.path}function iL(e,t,r){if(!Array.isArray(e)||e.length===0)return;let n=(0,qC.createRequire)((0,Vo.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(n.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${r} without it.`)}}return o}async function sL(e,t){try{let{format:r,resolveConfig:n}=await import("prettier"),o=await n(t,{editorconfig:!0}),i=iL(o?.plugins,process.cwd(),t);return await r(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(r){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${r instanceof Error?r.message:String(r)}`),e}}function aL(e,t){if(t){OC();return}let r=ld();if(r.kind==="missing")return;if(r.kind==="corrupt")throw new d(`This project's sync state is unreadable (${r.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${zn}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(r.corruptPaths.length>0)throw new d(`${r.corruptPaths.length} tracked file(s) have unreadable sync state (${r.corruptPaths.slice(0,3).join(", ")}${r.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${zn}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let n=r.lockfile;if(n?.siteId!==void 0&&n.siteId!==e&&Object.keys(n.files).length>0)throw new d(`This project's sync state was pulled from site ${n.siteId}, but this pull targets ${e}. Pulling a second site into the same project would leave \`webflow sites push\` (which always targets the site in webflow.json) applying it to the wrong one. Re-run with --reset to discard the existing state and pull ${e} from scratch.`,{isUserError:!0});return n}async function gd(e={}){let t=Ds(e.siteId),r=aL(t.siteId,!!e.reset),n=await T({apiToken:e.apiToken}),o=_.forSites({authToken:n}),i=Date.now();try{let s=await Ph(n,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new d("This site is served as a WFDL projection, which `webflow sites pull` doesn't support \u2014 it reads and writes `.tsw` modules. No files were written.",{isUserError:!0});let a=s.pages.map(A=>A.pageId);if(a.length===0){await o.sendUsage("site_pull",{duration:Date.now()-i,count:0}),u.info(e.json?JSON.stringify({schemaHash:s.schemaHash,pages:[],files:[]},null,2):"The site has no static pages to pull.");return}let l=new Map,c=s.schemaHash,p={},f=[];for(let A of VC(a)){let q=await Ph(n,t.siteId,{pageIds:A});c=q.schemaHash,p=q.componentIds??p,q.warnings&&f.push(...q.warnings);for(let W of q.files)l.set(W.path,W)}let m=[...l.values()].sort((A,q)=>A.path.localeCompare(q.path)),g=new Map(s.pages.map(A=>[A.path,A])),h=new Map;for(let A of m){let q=r?.files[A.path];if(!q)continue;let W=q.localPath??A.path,he=dd(W),Vr=he!==void 0&&hr(he)!==q.contentSha256,Gr=A.hash!==q.serverHash;Vr&&Gr&&h.set(A.path,W)}let y=!e.force,k=[...h.values()],v=process.cwd(),F=new Map(m.map(A=>[A.path,oL(A,t.layout,g,r)])),E=new Map;for(let[A,q]of F)E.set(q,[...E.get(q)??[],A]);let S=[...E.entries()].filter(([,A])=>A.length>1);if(S.length>0){let A=S.map(([q,W])=>`${q} \u2190 ${W.join(", ")}`).join("; ");throw new d(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${A}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let L={siteId:t.siteId,identityMode:"clean",schemaHash:c,files:{}},U=new Set(F.values()),N=[],te=[],G=[],ce=[];for(let A of m){let q=r?.files[A.path];if(y&&h.has(A.path)){q&&(L.files[A.path]=q);continue}let W=F.get(A.path);LC(W);let he=(0,Vo.join)(v,W);(0,Go.mkdirSync)((0,Vo.dirname)(he),{recursive:!0});let Vr=W.endsWith(".tsw")?fd(A.content,pd(A.path),W,fi=>F.get(fi)??Bh(fi,t.layout,r?.files[fi]?.localPath)):A.content,Gr=W.endsWith(".tsw")?await sL(Vr,he):Vr;(0,Go.writeFileSync)(he,Gr,"utf8"),N.push(A);let ro=q?q.localPath??A.path:void 0;if(q&&ro&&ro!==W&&!U.has(ro)){let fi=dd(ro);fi===void 0||(hr(fi)===q.contentSha256?((0,Go.rmSync)((0,Vo.join)(v,ro),{force:!0}),te.push({from:ro,to:W})):G.push({from:ro,to:W}))}let cw=p[A.path],Vl=g.get(A.path);L.files[A.path]={serverHash:A.hash,contentSha256:hr(Gr),localPath:W,...cw?{componentId:cw}:{},...Vl?{slug:Vl.slug,isDefault:Vl.isDefault,folderSegments:Vl.folderSegments}:{}}}let Be=new Set(m.map(A=>A.path));for(let[A,q]of Object.entries(r?.files??{})){if(Be.has(A))continue;let W=q.localPath??A;if(U.has(W))continue;let he=dd(W);he!==void 0&&(hr(he)===q.contentSha256?((0,Go.rmSync)((0,Vo.join)(v,W),{force:!0}),ce.push(W)):(G.push({from:W,to:"(no longer on the site)"}),L.files[A]={...q,deletedUpstream:!0}))}if(cd(L),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:A,slug:q,title:W,path:he,folderSegments:Vr})=>({pageId:A,slug:q,title:W,path:he,folderSegments:Vr})),files:N.map(A=>({path:A.path,hash:A.hash,size:A.size,localPath:L.files[A.path]?.localPath})),...y&&k.length>0?{skipped:k}:{},...ce.length>0?{removed:ce}:{},...te.length>0?{relocated:te}:{},...G.length>0?{orphaned:G}:{}},null,2));else{for(let A of N){let q=g.get(A.path),W=L.files[A.path]?.localPath??A.path,he=q?P(` (page, slug: "${q.slug}")`):"";u.info(`${$} ${W}${he}`)}u.info(`Pulled ${N.length} file(s) across ${a.length} page(s).`);for(let A of ce)u.info(P(` removed ${A} (no longer on the site)`));for(let{from:A,to:q}of te)u.info(P(` moved ${A} \u2192 ${q}`))}for(let A of k)u.warn(y?`${X} ${A} changed both locally and in the Designer since the last sync \u2014 left as-is, so your local edit is intact. Commit or move it, then pull again (or pull with --force to take the Designer's version).`:`${X} ${A} changed both locally and in the Designer since the last sync \u2014 the local edit was overwritten by --force; recover it from git if needed.`);for(let{from:A,to:q}of G)u.warn(`${X} ${A} is now at ${q}, but the old file has local edits so it was left in place. \`sites push\` will skip it \u2014 merge anything you still need into ${q} and delete ${A}, since while it's there the two copies disagree.`);for(let{path:A,reason:q}of f){let W=L.files[A]?.localPath??A;u.warn(`${X} ${W}: ${q}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:N.length,skipped:y?k.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof d?s:new d(s,{prefix:`${D} Failed to pull site files:`})}}qr();var YC=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(re()).addOption(We(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Ah),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(re()).action(Rh),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(re()).action(Ih),t.command("publish").description("Publish a Webflow site (defaults to Webflow subdomain)").requiredOption("--site <siteId>","Site ID to publish").option("--domains <domains>","Comma-separated custom domain IDs to publish to").option("--page <pageId>","Publish a single page instead of the whole site").addOption(_e()).addOption(re()).action(Th),Ke()&&(t.command("init").description("Bind this project to an existing Webflow site or create a new one, saving its ID as `siteId` in webflow.json.").addOption(Xr()).option("--site-id <siteId>","Skip the interactive picker and bind to this site ID (CI/scripted setup).").option("--create","Create a new Webflow site instead of binding.").option("--name <name>","Name for the new site (implies --create; skips the prompt).").action(sd),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(Xr()).addOption(_e()).addOption(re()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(md),t.command("pull").description("Pull your Webflow Site's source files. Files edited both locally and in the Designer are left alone unless --force.").addOption(Xr()).addOption(re()).option("--site-id <siteId>","Pull from this site only, bypassing (and not modifying) the siteId in webflow.json. Needs --reset when the project is already synced with another site.").option("--force","Overwrite local files that changed both here and in the Designer since the last sync.").option("--reset","Discard the existing local sync state and pull from scratch.").action(gd))};Y();C();R();j();Z();ke();async function XC(e,t){return Q(t,"siteId"),il(`${O()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function ZC(e,t,r){return Q(t,"siteId"),Q(r,"formId"),il(`${O()}/v2/sites/${t}/forms/${r}/submissions`,e,"formSubmissions","Failed to list submissions")}C();me();var Wh=["id","displayName","name","slug","createdOn","lastUpdated"],QC=dt(Wh);function eF(){return Wh}function tF(e,t=["id","displayName","slug"]){if(e.length===0)return P("No forms found.");if(t.length===0)throw new d(`No valid fields specified. Available: ${Wh.join(", ")}`,{isUserError:!0});let r=t.map(o=>se(o)),n=e.map(o=>t.map(i=>{let s=o[i];return s?i==="createdOn"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:P("\u2014")}));return ze(r,n)}function rF(e){if(e.length===0)return P("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),r=["id","dateSubmitted",...t].map(o=>se(o)),n=e.map(o=>[o.id,new Date(o.dateSubmitted).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),...t.map(i=>{let s=o.formResponse[i];return s==null?P("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return ze(r,n)}function nF(e){if(e.length===0)return"";let r=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],n=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
|
|
218
|
+
`)?`"${s.replace(/"/g,'""')}"`:s};return[r.join(","),...e.map(i=>r.map(s=>n(s==="id"?i.id:s==="formId"?i.formId:s==="displayName"?i.displayName:s==="dateSubmitted"?i.dateSubmitted:i.formResponse[s])).join(","))].join(`
|
|
219
|
+
`)}async function Hh(e){Q(e.site,"siteId");let t=await T(),r=_.forForms({authToken:t}),n=Date.now();try{let o=await XC(t,e.site);if(await r.sendUsage("forms_list",{duration:Date.now()-n,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No forms found.");return}let i=Fe(e.fields,QC,eF());u.info(tF(o,i))}catch(o){throw o instanceof d&&o.isUserError?o:(await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to list forms:`}))}}var oF=w(require("fs"));Y();C();R();j();Z();async function Vh(e){Q(e.site,"siteId"),Q(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await T(),r=_.forForms({authToken:t}),n=Date.now();try{let o=await ZC(t,e.site,e.form);if(await r.sendUsage("forms_submissions",{duration:Date.now()-n,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=nF(o);oF.default.writeFileSync(e.output,i,"utf8"),u.info(`${$} ${o.length} submission${o.length===1?"":"s"} written to ${e.output}`);return}if(e.json){u.info(JSON.stringify(o,null,2));return}u.info(rF(o))}catch(o){throw await r.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-n}),new d(o,{prefix:`${D} Failed to fetch submissions:`})}}var iF=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(Rt()).addOption(re()).addOption(We(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(Hh),t.command("submissions").description("List or export form submissions").requiredOption("--site <siteId>","Site ID").requiredOption("--form <formId>","Form ID").option("--json","Output as JSON").option("--output <file>","Save submissions as CSV to a file").action(Vh)};var ay=w(require("fs")),ly=w(require("path"));R();var zo=w(require("fs")),Jo=w(require("path")),wd=w(require("tar"));C();R();var Gh=w(require("fs")),Yn=w(require("path"));C();var sF={impl:Yn.default.posix,caseInsensitive:!1},Kh={impl:Yn.default.win32,caseInsensitive:!0};function Ko(){let e=process.platform;return e==="win32"?Kh:{impl:Yn.default.posix,caseInsensitive:e==="darwin"}}function hd(e,t){let r=t.impl.resolve(e);return t.caseInsensitive?r.toLowerCase():r}function Xn(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function ot(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let n=hd(e,r),o=hd(t,r);if(n===o)return!0;let i=r.impl.relative(n,o);return i===""?!0:r.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function yd(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let[n,o]=await Promise.all([yr(e),yr(t)]);return ot(n,o,r)}function Me(e,t,r,n=Ko()){if(!ot(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside.
|
|
220
|
+
expected inside: ${b(e)}
|
|
221
|
+
resolved to: ${b(t)}
|
|
222
|
+
Please report this.`)}async function vs(e,t,r,n=Ko()){if(!await yd(e,t,n))throw new d(`Refusing to continue: ${r} resolves outside the directory it must stay inside once symlinks are followed.
|
|
223
|
+
expected inside: ${b(e)}
|
|
224
|
+
resolved to: ${b(t)}
|
|
225
|
+
Please report this.`)}function lL(e,t,r=Ko()){return ot(e,t,r)||ot(t,e,r)}async function Jh(e,t,r=Ko()){if(Xn(e)||Xn(t))return!1;let[n,o]=await Promise.all([yr(e),yr(t)]);return lL(n,o,r)}function Ye(e,t,r=Ko()){return typeof e!="string"||typeof t!="string"||Xn(e)||Xn(t)?!1:hd(e,r)===hd(t,r)}async function yr(e){let t=Yn.default.resolve(e);try{return await Gh.default.promises.realpath(t)}catch{}try{let r=await Gh.default.promises.realpath(Yn.default.dirname(t));return Yn.default.join(r,Yn.default.basename(t))}catch{return t}}var cL=/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;function Ss(e){if(!e)return"empty entry path";if(e.includes("\0"))return"NUL byte in entry path";if(/[\x01-\x1f\x7f]/.test(e))return"control character in entry path";if(e.startsWith("/")||e.startsWith("\\"))return"absolute entry path";if(/^[A-Za-z]:/.test(e))return"Windows drive-relative entry path";if(e.includes("\\"))return"backslash in entry path";for(let t of e.split("/")){if(t===""||t==="."){if(t===".")return'traversal segment "." in entry path';continue}if(t==="..")return'traversal segment ".." in entry path';if(/[. ]$/.test(t))return"entry path segment ends with a dot or space";if(cL.test(t))return"Windows reserved device name in entry path"}return null}var Yh=new Set(["File","OldFile","ContiguousFile","Directory","GNUDumpDir"]),uL=new Set(["TAR_ENTRY_INVALID","TAR_BAD_ARCHIVE","TAR_ABORT","TAR_ENTRY_ERROR"]),dL=32,pL=512,zh=10,cF=100,aF=100;function uF(){return{retained:[],fatal:[],fatalCount:0,count:0}}function dF(e,t,r){e.count+=1;let n={code:t,message:al(r)};e.retained.length<aF&&e.retained.push(n),uL.has(t)&&(e.fatalCount+=1,e.fatal.length<aF&&e.fatal.push(n))}async function pF(e,t,r){let n=await fL(r.containmentRoot),o=await mL(n,t),i=await lF(e),s=await hL(e,r),a=await wL(e,o,r);if(a.warnings.fatal.length>0)throw wF(a.warnings.fatal,a.warnings.fatalCount);for(let c of a.warnings.retained)u.debug(`tar warning ${c.code}: ${c.message}`);if(a.refused.length>0)throw DL(a.refused,a.refusedCount);let l=await lF(e);if(i!==l)throw new d("Refusing to continue: the downloaded archive changed while it was being read, so what was validated is not what was extracted. Nothing about the extracted directory can be trusted. Please retry.");return await bL(n,o),{skipped:s.skipped,fileCount:a.fileCount,unpackedBytes:a.unpackedBytes,warnings:[...s.warnings.retained,...a.warnings.retained],warningCount:s.warnings.count+a.warnings.count}}async function lF(e){try{let t=await zo.default.promises.stat(e);return[t.dev,t.ino,t.size,t.mtimeMs,t.ctimeMs].join(":")}catch(t){throw new d(`Could not read the downloaded archive: ${t instanceof Error?t.message:String(t)}`)}}async function fL(e){try{return await zo.default.promises.realpath(Jo.default.resolve(e))}catch(t){throw new d(`Refusing to extract: the directory the extraction must stay inside ("${b(e)}") could not be resolved: ${t instanceof Error?t.message:String(t)}`)}}async function mL(e,t){let r=Jo.default.resolve(t);Me(e,r,"the extraction directory");let o=Jo.default.relative(e,r).split(Jo.default.sep).filter(s=>s!==""),i=e;for(let s of o){i=Jo.default.join(i,s);let a=await gL(i);if(a===null){await zo.default.promises.mkdir(i);continue}if(a.isSymbolicLink())throw new d(`Refusing to extract: "${b(i)}" is a symbolic link, and extracting into it would write the archive somewhere other than where it was checked. Remove or replace it with a real directory and retry.`);if(!a.isDirectory())throw new d(`Refusing to extract: "${b(i)}" exists and is not a directory.`)}return r}async function gL(e){try{return await zo.default.promises.lstat(e)}catch(t){if(t.code==="ENOENT")return null;throw new d(`Could not inspect "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function hL(e,t){let r=fF(t.limits),n=hF(t.consumedSubtrees),o=[],i=[],s=uF(),a=0,l=0,c=0,p=!1,f=!1,m=(g,h)=>{c+=1,o.length<cF&&o.push({entryPath:g,reason:h})};try{await wd.list({file:e,onReadEntry:g=>{let h=g.path,y=g.type;if(mF(y)||(a+=1,a>r.maxFiles&&!p&&(p=!0,m(h,`archive has more than ${r.maxFiles} files`))),!Yh.has(y)){let F=`unsupported entry type ${y}`;n(h)?m(h,F):p||i.push({entryPath:h,reason:F});return}let k=Ss(h)??gF(h,r);if(k){m(h,k);return}let v=g.size;v>r.maxEntryBytes&&m(h,`entry is ${xs(v)}, over the ${xs(r.maxEntryBytes)} per-file cap`),l+=v,l>r.maxUnpackedBytes&&!f&&(f=!0,m(h,`unpacked total passes the ${xs(r.maxUnpackedBytes)} cap`))},onwarn:(g,h)=>{dF(s,g,h)}})}catch(g){throw g instanceof d?g:new d(`Could not read the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}if(o.length>0)throw kL(o,c);if(s.fatal.length>0)throw wF(s.fatal,s.fatalCount);for(let g of i)u.debug(`Skipped archive entry "${b(g.entryPath)}": ${g.reason}`);return{skipped:i,warnings:s}}function yL(e,t,r,n){if(!Yh.has(t))return`unsupported entry type ${t}`;let o=Ss(e)??gF(e,n);return o||(r>n.maxEntryBytes?`entry is ${xs(r)}, over the ${xs(n.maxEntryBytes)} per-file cap`:null)}async function wL(e,t,r){let n=fF(r.limits),o=hF(r.consumedSubtrees),i=uF(),s=[],a=0,l=0,c=0,p=(g,h)=>(a+=1,s.length<cF&&s.push({entryPath:g,reason:h}),!1),f=()=>!1,m=(g,h)=>{let y="type"in h?h.type:h.isDirectory()?"Directory":"File",k=h.size;if(!Yh.has(y)&&!o(g))return f();let v=yL(g,y,k,n);if(v)return p(g,v);if(c+k>n.maxUnpackedBytes)return p(g,`unpacked total passes the ${xs(n.maxUnpackedBytes)} cap`);if(!mF(y)){if(l+1>n.maxFiles)return p(g,`archive has more than ${n.maxFiles} files`);l+=1}return c+=k,!0};try{await wd.extract({file:e,cwd:t,strip:r.strip??0,preservePaths:!1,filter:m,onwarn:(g,h)=>{dF(i,g,h)}})}catch(g){throw g instanceof d?g:new d(`Could not extract the downloaded archive: ${g instanceof Error?g.message:String(g)}`)}return{warnings:i,fileCount:l,unpackedBytes:c,refused:s,refusedCount:a}}async function bL(e,t){Me(e,await zo.default.promises.realpath(t),"the extracted directory");let r=[t];for(;r.length>0;){let n=r.pop(),o=await zo.default.promises.readdir(n,{withFileTypes:!0});for(let i of o){let s=Jo.default.join(n,i.name);if(!i.isFile()&&!i.isDirectory())throw new d(`Refusing to continue: extraction produced a non-regular entry at "${b(s)}". Please report this.`);Me(e,s,"an extracted archive entry"),i.isDirectory()&&r.push(s)}}}function fF(e){return{maxUnpackedBytes:e.maxUnpackedBytes,maxFiles:e.maxFiles,maxEntryBytes:e.maxEntryBytes,maxPathDepth:e.maxPathDepth??dL,maxPathLength:e.maxPathLength??pL}}function mF(e){return e==="Directory"||e==="GNUDumpDir"}function qh(e){return e.replace(/\/+$/,"")}function gF(e,t){let r=qh(e);if(r.length>t.maxPathLength)return`entry path is ${r.length} characters, over the ${t.maxPathLength}-character limit`;let n=r.split("/").filter(o=>o!=="").length;return n>t.maxPathDepth?`entry path is ${n} levels deep, over the ${t.maxPathDepth}-level limit`:null}function hF(e){let t=e.map(qh);return r=>{let n=qh(r).split("/").slice(1).join("/");return t.some(o=>n===o||n.startsWith(`${o}/`))}}function xs(e){if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB"],r=e/1024,n=t[0];for(let o=1;o<t.length&&r>=1024;o+=1)r/=1024,n=t[o];return`${parseFloat(r.toFixed(1))} ${n}`}function kL(e,t){return new d(`Refusing to extract the downloaded archive: it contains ${t} ${t===1?"entry":"entries"} this CLI will not write.
|
|
226
|
+
${yF(e,t).join(`
|
|
225
227
|
`)}
|
|
226
|
-
Nothing was extracted. Please report this.`)}function
|
|
227
|
-
${
|
|
228
|
+
Nothing was extracted. Please report this.`)}function DL(e,t){return new d(`Refusing to continue: the downloaded archive changed while it was being read. ${t} ${t===1?"entry":"entries"} that passed validation would not have passed it on the second read.
|
|
229
|
+
${yF(e,t).join(`
|
|
228
230
|
`)}
|
|
229
|
-
The extracted directory cannot be trusted. Please retry.`)}function
|
|
230
|
-
${
|
|
231
|
+
The extracted directory cannot be trusted. Please retry.`)}function yF(e,t){let r=e.slice(0,zh),n=r.map(i=>` - "${b(i.entryPath)}": ${i.reason}`),o=t-r.length;return o>0&&n.push(` \u2026 and ${o} more.`),n}function wF(e,t){let r=e.slice(0,zh).map(o=>` - ${o.code}: ${o.message}`),n=t-Math.min(e.length,zh);return n>0&&r.push(` \u2026 and ${n} more.`),new d(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
|
|
232
|
+
${r.join(`
|
|
231
233
|
`)}
|
|
232
|
-
This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var
|
|
233
|
-
\u2022 The default branch is "${
|
|
234
|
+
This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var EL="webflow",Xh="webflow-skills",ye=`${EL}/${Xh}`,Ve="main",bd=`plugins/${Xh}`,mn=`${bd}/.claude-plugin/plugin.json`,Zh=[`${bd}/skills`,"skills"],bF=[`${bd}/skills`,`${bd}/.claude-plugin`];function kF(e){return`${Xh}-${e}`}var tr=/^[0-9a-f]{40}$/,kd=/^[A-Za-z0-9._/-]{1,255}$/,vL=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function DF(e){let t=e.split(":",1)[0];return vL.includes(t)}var Ot="https://api.github.com",qo="https://codeload.github.com";var EF="skills",Dd="download-",Ed="extract-";var hn=w(require("fs")),xd=w(require("path"));oa();C();R();C();function SF(e){let t=r=>Math.round(r*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function wr(e){try{return new URL(e).hostname}catch{return e}}function SL(e){return new d(`Could not find ref "${b(e)}" in ${ye}.
|
|
235
|
+
\u2022 The default branch is "${Ve}".
|
|
234
236
|
\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
|
|
236
|
-
\u2022 Retry after ${
|
|
237
|
+
\u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function xL(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let r=new Date(t*1e3);if(Number.isNaN(r.getTime()))return"a few minutes";let n=String(r.getHours()).padStart(2,"0"),o=String(r.getMinutes()).padStart(2,"0");return`${n}:${o} local time`}function CL(e){return new d(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
|
|
238
|
+
\u2022 Retry after ${xL(e)}.
|
|
237
239
|
\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
|
|
239
|
-
\u2022 If you are behind a proxy that filters ${
|
|
240
|
-
\u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function
|
|
240
|
+
\u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function FL(){return new d(`GitHub refused the request (403). This is a permission error, not a rate limit.
|
|
241
|
+
\u2022 If you are behind a proxy that filters ${wr(Ot)}, set HTTPS_PROXY.
|
|
242
|
+
\u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function _L(e,t){return new d(`${wr(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function AL(e,t,r){return new d(`${wr(e)} returned an unexpected ${t} ${b(r)} response. Please report this if it persists.`)}function Cs(e,t,r){let{status:n}=t;if(n===404)return SL(r??Ve);let o=t.headers.get("x-ratelimit-remaining");return n===429||n===403&&o==="0"?CL(t.headers.get("x-ratelimit-reset")):n===403?FL():n>=500?_L(e,n):AL(e,n,t.statusText)}function xF(e){let t=e?wr(e):"an unnamed host";return new d(`Refusing to follow a redirect to ${b(t)} while a GitHub token is attached, because the token would be re-sent to that host. Unset GITHUB_TOKEN / GH_TOKEN to retry unauthenticated, or report this if ${wr(Ot)} is genuinely redirecting.`,{isUserError:!0})}function vF(e,t){return new d(`Could not reach ${wr(e)}${t?` (${t})`:""}.
|
|
241
243
|
\u2022 Check your network connection.
|
|
242
244
|
\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
|
|
245
|
+
\u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function vd(e,t){return new d(`Timed out after ${Math.round(t/1e3)}s waiting for ${wr(e)}.
|
|
244
246
|
\u2022 Check your network connection, then retry.
|
|
245
247
|
\u2022 Behind a corporate proxy, set HTTPS_PROXY.
|
|
246
|
-
\u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function
|
|
247
|
-
\u2022 Retry without --ref to take the current "${
|
|
248
|
-
\u2022 If a proxy is intercepting ${
|
|
249
|
-
\u2022 Pass a branch name (e.g. "${Ge}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function $C(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 yO=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function wO(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 ul(e,t,n){if(n instanceof f)return n;let r=wO(n);if(r==="ENOSPC"||r==="EDQUOT"||r==="EFBIG")return ll("writing the skills catalog");if(r&&yO.has(r))return FC(e,r);let o=n?.type;if(o==="request-timeout")return ud(e,t);if(o==="max-size")return dd();let i=n instanceof Error?n.message:String(n);return/network timeout|timed? ?out/i.test(i)?ud(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?FC(e,""):new f(`Could not fetch the skills catalog from ${wn(e)}: ${D(i)}`)}function Ss(){return pd.default.join(pb(),CC)}function Ih(e){if(!Qt.test(e))throw vs(e);return pd.default.join(Ss(),e)}async function dl(){let e=Ss();try{return await ur.default.promises.mkdir(e,{recursive:!0,mode:448}),await ur.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?ll("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 Th(e){let t=Ih(e),n;try{n=await ur.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 DO=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function kO(e){try{return(await ur.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function Ph(e,t){let n=Ih(e),r=Ss();await bs(r,n,"the skills cache entry"),await bs(r,t,"the extracted skills catalog being published");try{return await ur.default.promises.rename(t,n),{dir:n,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw ll("publishing the skills catalog to the cache");if(i!==void 0&&DO.has(i)&&await kO(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 zo(e){await bs(Ss(),e,"the skills cache path being removed");try{await ur.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 EO(e){return Qt.test(e)||e.startsWith(ld)||e.startsWith(cd)}async function fd(e){let t=Ss(),n;try{n=await ur.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||!EO(o.name))continue;let i=pd.default.join(t,o.name);try{if((await ur.default.promises.lstat(i)).mtimeMs>=r)continue;await zo(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 Lh=w(require("fs")),$h=w(require("path")),NC=require("stream"),jC=require("stream/promises");lt();A();var vO="catalog.tar.gz",pl=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},md=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},Oh=class extends NC.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 md);return}o(null,i)}};async function Nh(e){if(!Qt.test(e))throw vs(e);let t=await dl(),n=await Lh.default.promises.mkdtemp($h.default.join(t,ld)),r=$h.default.join(n,vO),o=`${Jo}/${he}/tar.gz/${e}`;try{let i=await SO(o,e),s=await xO(i,r);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:r,downloadDir:n,bytes:s}}catch(i){throw await zo(n),ul(Jo,6e4,i)}}async function SO(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 dd();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?RC(t):Es(Jo,o)}throw Es(Jo,{status:n||500,statusText:"Server Error",headers:{get:()=>null}})}async function xO(e,t){let n=e.body;if(!n)throw IC();let r=new Oh(33554432),o=setTimeout(()=>{n.destroy?.(new pl),r.destroy(new pl)},6e4);o.unref?.();try{await(0,jC.pipeline)(n,r,Lh.default.createWriteStream(t,{mode:384}))}catch(i){throw LC(i,md)?dd():LC(i,pl)?ud(Jo,6e4):i}finally{clearTimeout(o)}return r.bytes}function LC(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 CO=["GITHUB_TOKEN","GH_TOKEN"];function FO(){for(let e of CO){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function _O(e){if(e==="")throw cr(e,"it is empty");if(!ad.test(e))throw cr(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw cr(e,"it starts with '-'");if(e.includes(".."))throw cr(e,"it contains '..'");if(e.endsWith(".lock"))throw cr(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw cr(e,"it starts or ends with '/'");if(e.includes("//"))throw cr(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw cr(e,"a path component ends with '.'")}function AO(e){return e.split("/").map(encodeURIComponent).join("/")}function RO(e){return new Promise(t=>{setTimeout(t,e)})}async function gl(e=Ge){if(Qt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};_O(e);let t=FO(),n=`${$t}/repos/${he}/commits/${AO(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let r=await IO(n,e,t),o=await PO(r);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function IO(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 ul($t,1e4,s)}if(n&&i.status>=300&&i.status<400)throw AC(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 RO(1e3);continue}throw Es($t,i,t)}throw Es($t,{status:r??500,statusText:"Server Error",headers:{get:()=>null}},t)}var hd=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function TO(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 hd;n.push(i)}return Buffer.concat(n).toString("utf8")}async function PO(e){let t;try{t=await TO(e)}catch(r){throw r instanceof hd?PC():ul($t,1e4,r)}let n=t.trim();if(!Qt.test(n))throw TC();return n}async function xs(e={}){let t=await $O(e),{commit:n,ref:r}=t,o=await Th(n);if(o)return u.debug(`Using cached skills catalog for ${n}.`),await fd(n),{ref:r,commit:n,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await OO(n);return await fd(n),{ref:r,commit:n,...i}}async function $O(e){if(e.commit!==void 0){if(!Qt.test(e.commit))throw vs(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return gl(e.ref)}async function OO(e){let t=await dl(),n=await Nh(e),r=await jh.default.promises.mkdtemp(Mh.default.join(t,cd));try{let o=await hC(n.tarPath,r,{strip:0,containmentRoot:t,consumedSubtrees:vC,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await LO(r,e),{dir:s,published:a}=await Ph(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 zo(r),await zo(n.downloadDir)}}async function LO(e,t){let n=SC(t),r=await jh.default.promises.readdir(e,{withFileTypes:!0}),o=r.filter(i=>i.isDirectory());if(r.length!==1||o.length!==1||o[0].name!==n)throw $C(n,r.map(i=>i.name));return Mh.default.join(e,n)}var qo=`https://github.com/${he}/issues`,Ot="SKILL.md",hl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Xo=new Set([".git","node_modules","__pycache__"]),Yo=new Set([".DS_Store","Thumbs.db"]),Zo=8,yd=512,wd=128,WC=1024,HC=32,VC=256,GC=64,KC=64,Bh=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,JC=256,zC=4;var Uh=w(require("fs")),Cs=w(require("path"));C();async function Fs(e){let t=Cs.default.join(e,...lr.split("/"));Ue(e,t,"the catalog plugin manifest");let n;try{n=await Uh.default.promises.readFile(t,"utf8")}catch(i){if(!MO(i))throw new f(`Failed to read the catalog manifest at ${lr}: ${i instanceof Error?i.message:String(i)}`)}if(n===void 0)return{...await qC(e),version:"",source:"fallback"};let r=jO(n);if(r.skills===void 0)return{...await qC(e),version:r.version,source:"fallback"};let o=await NO(t,r.skills,e);if(!o)throw new f(`The catalog manifest at ${lr} 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 NO(e,t,n){let r=Cs.default.dirname(e),o=[{base:Cs.default.dirname(r),relativeTo:"plugin root"},{base:r,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=Cs.default.resolve(s.base,t);if(Ue(n,a,"the catalog skills directory"),!!await XC(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${lr} declares "skills": "${D(t)}", which only resolves relative to the ${s.relativeTo}. This means ${he} changed its layout; please report it at ${qo}.`]}}}function jO(e){let t;try{t=JSON.parse(e)}catch(o){throw new f(`The catalog manifest at ${lr} 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 ${lr} 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 ${lr} declares "skills" as ${BO(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 qC(e){for(let t of Ah){let n=Cs.default.join(e,...t.split("/"));if(Ue(e,n,"the catalog skills directory"),!!await XC(n))return{skillsDir:n,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${he} changed its layout; please report it at ${qo}.`]}}throw new f(`The downloaded catalog has no skills directory: ${lr} is absent and none of ${Ah.join(", ")} exists. This is a bug in ${he}. Please report it.`)}async function XC(e){try{return(await Uh.default.promises.stat(e)).isDirectory()}catch{return!1}}function MO(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function BO(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 Lt=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},UO=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,WO=/^\uFEFF/,HO="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",ZC="\u2014 wrap the value in double quotes",VO={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},GO=100,KO=j.object({name:j.string().trim().min(1).max(wd),description:j.string().trim().min(1).max(WC),"mcp-version":j.string().max(HC).optional(),compatibility:j.string().max(VC).optional(),license:j.string().max(GC).optional(),metadata:j.record(j.unknown()).optional()}).passthrough(),Wh=["name","description"];function Qo(e){let t=e.replace(WO,""),n=UO.exec(t);if(!n){if(t.trimStart().startsWith("---"))throw new Lt(HO);return{frontmatter:Hh({}),body:t,raw:e}}let r=n[1]??"",o=n[2]??"",i=JO(r,1);return{frontmatter:Hh(i),body:o,raw:e}}function JO(e,t){let n=(0,YC.parseDocument)(e,VO),[r]=n.errors;if(r)throw new Lt(zO(r,e,t));let o;try{o=n.toJS({maxAliasCount:GO})}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 ${Vh(o)})`);return o}function zO(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
|
-
`).length,c=
|
|
251
|
-
`)+1)+1;o=` at line ${l+
|
|
252
|
-
${
|
|
248
|
+
\u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function Sd(){return new d(`The skills catalog download exceeded ${SF(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function CF(e){return new d(`Commit ${b(e)} of ${ye} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
|
|
249
|
+
\u2022 Retry without --ref to take the current "${Ve}".`,{isUserError:!0})}function FF(){return new d("The skills catalog download returned no response body. Please retry.")}function fl(e){return new d(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function _F(){return new d(`${wr(Ot)} answered the ref lookup with something that is not a 40-character commit SHA. Refusing to guess at what to install. Please report this if it persists.`)}function AF(){return new d(`${wr(Ot)} answered the ref lookup with more than ${SF(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
|
|
250
|
+
\u2022 If a proxy is intercepting ${wr(Ot)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function Fs(e){return new d(`Expected a full 40-character commit SHA but got "${b(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function gn(e,t){return new d(`Invalid --ref "${b(e)}": ${t}.
|
|
251
|
+
\u2022 Pass a branch name (e.g. "${Ve}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function RF(e,t){let r=t.length===0?"nothing":t.map(n=>`"${b(n)}"`).join(", ");return new d(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${r}. Please report this.`)}var RL=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function IL(e){if(typeof e!="object"||e===null)return;let t=e;if(typeof t.code=="string")return t.code;if(typeof t.errno=="string")return t.errno}function gl(e,t,r){if(r instanceof d)return r;let n=IL(r);if(n==="ENOSPC"||n==="EDQUOT"||n==="EFBIG")return fl("writing the skills catalog");if(n&&RL.has(n))return vF(e,n);let o=r?.type;if(o==="request-timeout")return vd(e,t);if(o==="max-size")return Sd();let i=r instanceof Error?r.message:String(r);return/network timeout|timed? ?out/i.test(i)?vd(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?vF(e,""):new d(`Could not fetch the skills catalog from ${wr(e)}: ${b(i)}`)}function _s(){return xd.default.join(Rb(),EF)}function ey(e){if(!tr.test(e))throw Fs(e);return xd.default.join(_s(),e)}async function hl(){let e=_s();try{return await hn.default.promises.mkdir(e,{recursive:!0,mode:448}),await hn.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?fl("creating the skills cache directory"):new d(`Could not create the skills cache directory "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function ty(e){let t=ey(e),r;try{r=await hn.default.promises.lstat(t)}catch(n){return n.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${n instanceof Error?n.message:String(n)}`),null}if(r.isSymbolicLink())throw new d(`Refusing to use the skills cache: "${b(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return r.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var PL=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function $L(e){try{return(await hn.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function ry(e,t){let r=ey(e),n=_s();await vs(n,r,"the skills cache entry"),await vs(n,t,"the extracted skills catalog being published");try{return await hn.default.promises.rename(t,r),{dir:r,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw fl("publishing the skills catalog to the cache");if(i!==void 0&&PL.has(i)&&await $L(r))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:r,published:!1};throw new d(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Yo(e){await vs(_s(),e,"the skills cache path being removed");try{await hn.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${b(e)}": ${t instanceof Error?t.message:String(t)}`)}}function OL(e){return tr.test(e)||e.startsWith(Dd)||e.startsWith(Ed)}async function Cd(e){let t=_s(),r;try{r=await hn.default.promises.readdir(t,{withFileTypes:!0})}catch(o){o.code!=="ENOENT"&&u.debug(`Skills cache sweep skipped: ${o instanceof Error?o.message:String(o)}`);return}let n=Date.now()-6048e5;for(let o of r){if(o.name===e||!OL(o.name))continue;let i=xd.default.join(t,o.name);try{if((await hn.default.promises.lstat(i)).mtimeMs>=n)continue;await Yo(i),u.debug(`Swept stale skills cache entry "${o.name}".`)}catch(s){u.debug(`Skills cache sweep could not handle "${o.name}": ${s instanceof Error?s.message:String(s)}`)}}}var iy=w(require("fs")),ny=w(require("path")),PF=require("stream"),$F=require("stream/promises");lt();R();var LL="catalog.tar.gz",yl=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},Fd=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},oy=class extends PF.Transform{constructor(r){super();this.cap=r}bytes=0;_transform(r,n,o){let i=Buffer.isBuffer(r)?r:Buffer.from(r);if(this.bytes+=i.length,this.bytes>this.cap){o(new Fd);return}o(null,i)}};async function sy(e){if(!tr.test(e))throw Fs(e);let t=await hl(),r=await iy.default.promises.mkdtemp(ny.default.join(t,Dd)),n=ny.default.join(r,LL),o=`${qo}/${ye}/tar.gz/${e}`;try{let i=await NL(o,e),s=await jL(i,n);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:n,downloadDir:r,bytes:s}}catch(i){throw await Yo(r),gl(qo,6e4,i)}}async function NL(e,t){let r=0;for(let n=0;n<2;n+=1){let o=await K(e,{headers:{Accept:"application/x-gzip"},timeout:6e4});if(o.ok){let i=Number(o.headers.get("content-length"));if(Number.isFinite(i)&&i>33554432)throw Sd();return o}if(o.status>=500&&n===0){r=o.status,u.debug(`codeload.github.com returned ${o.status}; retrying once in ${1e3}ms.`),await new Promise(i=>{setTimeout(i,1e3)});continue}throw o.status===404?CF(t):Cs(qo,o)}throw Cs(qo,{status:r||500,statusText:"Server Error",headers:{get:()=>null}})}async function jL(e,t){let r=e.body;if(!r)throw FF();let n=new oy(33554432),o=setTimeout(()=>{r.destroy?.(new yl),n.destroy(new yl)},6e4);o.unref?.();try{await(0,$F.pipeline)(r,n,iy.default.createWriteStream(t,{mode:384}))}catch(i){throw TF(i,Fd)?Sd():TF(i,yl)?vd(qo,6e4):i}finally{clearTimeout(o)}return n.bytes}function TF(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let r=e.cause;if(r instanceof t||r instanceof Error&&r.name===t.name)return!0}return!1}lt();R();var ML=["GITHUB_TOKEN","GH_TOKEN"];function BL(){for(let e of ML){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function UL(e){if(e==="")throw gn(e,"it is empty");if(!kd.test(e))throw gn(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw gn(e,"it starts with '-'");if(e.includes(".."))throw gn(e,"it contains '..'");if(e.endsWith(".lock"))throw gn(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw gn(e,"it starts or ends with '/'");if(e.includes("//"))throw gn(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw gn(e,"a path component ends with '.'")}function WL(e){return e.split("/").map(encodeURIComponent).join("/")}function HL(e){return new Promise(t=>{setTimeout(t,e)})}async function kl(e=Ve){if(tr.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};UL(e);let t=BL(),r=`${Ot}/repos/${ye}/commits/${WL(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let n=await VL(r,e,t),o=await KL(n);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function VL(e,t,r){let n=null;for(let o=0;o<2;o+=1){let i;try{i=await K(e,{headers:{Accept:"application/vnd.github.sha",...r?{Authorization:`Bearer ${r}`}:{}},timeout:1e4,...r?{redirect:"manual"}:{}})}catch(s){throw gl(Ot,1e4,s)}if(r&&i.status>=300&&i.status<400)throw xF(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(n=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await HL(1e3);continue}throw Cs(Ot,i,t)}throw Cs(Ot,{status:n??500,statusText:"Server Error",headers:{get:()=>null}},t)}var Ad=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function GL(e){let t=e.body;if(!t)return"";let r=[],n=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(n+=i.length,n>4096)throw new Ad;r.push(i)}return Buffer.concat(r).toString("utf8")}async function KL(e){let t;try{t=await GL(e)}catch(n){throw n instanceof Ad?AF():gl(Ot,1e4,n)}let r=t.trim();if(!tr.test(r))throw _F();return r}async function As(e={}){let t=await JL(e),{commit:r,ref:n}=t,o=await ty(r);if(o)return u.debug(`Using cached skills catalog for ${r}.`),await Cd(r),{ref:n,commit:r,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await zL(r);return await Cd(r),{ref:n,commit:r,...i}}async function JL(e){if(e.commit!==void 0){if(!tr.test(e.commit))throw Fs(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return kl(e.ref)}async function zL(e){let t=await hl(),r=await sy(e),n=await ay.default.promises.mkdtemp(ly.default.join(t,Ed));try{let o=await pF(r.tarPath,n,{strip:0,containmentRoot:t,consumedSubtrees:bF,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await qL(n,e),{dir:s,published:a}=await ry(e,i);return u.debug(`Extracted skills catalog ${e}: ${o.fileCount} files, ${o.unpackedBytes} bytes, ${o.skipped.length} entries skipped${a?"":" (another process published first)"}.`),{root:s,fromCache:!1,skippedEntries:o.skipped,downloadedBytes:r.bytes}}finally{await Yo(n),await Yo(r.downloadDir)}}async function qL(e,t){let r=kF(t),n=await ay.default.promises.readdir(e,{withFileTypes:!0}),o=n.filter(i=>i.isDirectory());if(n.length!==1||o.length!==1||o[0].name!==r)throw RF(r,n.map(i=>i.name));return ly.default.join(e,r)}var Xo=`https://github.com/${ye}/issues`,Lt="SKILL.md",Dl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Zo=new Set([".git","node_modules","__pycache__"]),Qo=new Set([".DS_Store","Thumbs.db"]),ei=8,Rd=512,Id=128,jF=1024,MF=32,BF=256,UF=64,WF=64,cy=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,HF=256,VF=4;var uy=w(require("fs")),Rs=w(require("path"));C();async function Is(e){let t=Rs.default.join(e,...mn.split("/"));Me(e,t,"the catalog plugin manifest");let r;try{r=await uy.default.promises.readFile(t,"utf8")}catch(i){if(!ZL(i))throw new d(`Failed to read the catalog manifest at ${mn}: ${i instanceof Error?i.message:String(i)}`)}if(r===void 0)return{...await GF(e),version:"",source:"fallback"};let n=XL(r);if(n.skills===void 0)return{...await GF(e),version:n.version,source:"fallback"};let o=await YL(t,n.skills,e);if(!o)throw new d(`The catalog manifest at ${mn} declares its skills directory as "${b(n.skills)}", which does not exist in the downloaded catalog. This is a bug in ${ye}. Please report it.`);return{version:n.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function YL(e,t,r){let n=Rs.default.dirname(e),o=[{base:Rs.default.dirname(n),relativeTo:"plugin root"},{base:n,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=Rs.default.resolve(s.base,t);if(Me(r,a,"the catalog skills directory"),!!await KF(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${mn} declares "skills": "${b(t)}", which only resolves relative to the ${s.relativeTo}. This means ${ye} changed its layout; please report it at ${Xo}.`]}}}function XL(e){let t;try{t=JSON.parse(e)}catch(o){throw new d(`The catalog manifest at ${mn} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${ye}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new d(`The catalog manifest at ${mn} is not a JSON object. This is a bug in ${ye}. Please report it.`);let r=t,n=r.skills;if(n!==void 0&&(typeof n!="string"||n.trim()===""))throw new d(`The catalog manifest at ${mn} declares "skills" as ${QL(n)}, but it must be a non-empty string. This is a bug in ${ye}. Please report it.`);return{version:typeof r.version=="string"?r.version.trim():"",skills:typeof n=="string"?n:void 0}}async function GF(e){for(let t of Zh){let r=Rs.default.join(e,...t.split("/"));if(Me(e,r,"the catalog skills directory"),!!await KF(r))return{skillsDir:r,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${ye} changed its layout; please report it at ${Xo}.`]}}throw new d(`The downloaded catalog has no skills directory: ${mn} is absent and none of ${Zh.join(", ")} exists. This is a bug in ${ye}. Please report it.`)}async function KF(e){try{return(await uy.default.promises.stat(e)).isDirectory()}catch{return!1}}function ZL(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function QL(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="string"?"an empty string":typeof e=="object"?"an object":`a ${typeof e}`}var JF=require("yaml");Zi();var Nt=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},eN=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,tN=/^\uFEFF/,rN="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",zF="\u2014 wrap the value in double quotes",nN={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},oN=100,iN=B.object({name:B.string().trim().min(1).max(Id),description:B.string().trim().min(1).max(jF),"mcp-version":B.string().max(MF).optional(),compatibility:B.string().max(BF).optional(),license:B.string().max(UF).optional(),metadata:B.record(B.unknown()).optional()}).passthrough(),dy=["name","description"];function ti(e){let t=e.replace(tN,""),r=eN.exec(t);if(!r){if(t.trimStart().startsWith("---"))throw new Nt(rN);return{frontmatter:py({}),body:t,raw:e}}let n=r[1]??"",o=r[2]??"",i=sN(n,1);return{frontmatter:py(i),body:o,raw:e}}function sN(e,t){let r=(0,JF.parseDocument)(e,nN),[n]=r.errors;if(n)throw new Nt(aN(n,e,t));let o;try{o=r.toJS({maxAliasCount:oN})}catch(i){throw new Nt(`YAML parse error: ${i instanceof Error?i.message:String(i)}`)}if(o==null)return{};if(typeof o!="object"||Array.isArray(o)||o instanceof Date)throw new Nt(`frontmatter is not a YAML mapping (parsed as ${fy(o)})`);return o}function aN(e,t,r){let n=e.pos?.[0],o="",i="";if(typeof n=="number"&&n>=0){let a=t.slice(0,n),l=a.split(`
|
|
252
|
+
`).length,c=n-(a.lastIndexOf(`
|
|
253
|
+
`)+1)+1;o=` at line ${l+r}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${zF}`:"";return`YAML parse error: ${e.message}${o}${s}`}function py(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Nt(`frontmatter is not a YAML mapping (parsed as ${fy(e)})`);let t={...e},r=dy.filter(i=>!(i in t)||t[i]===void 0);if(r.length>0)throw new Nt(`missing required frontmatter field(s): ${r.join(", ")}`);let n=dy.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(n.length>0){let i=dy.map(a=>fy(t[a])).join(" and "),s=n.some(a=>cN(t[a]));throw new Nt(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${zF}`:""}`)}t.metadata=lN(t.metadata),t.metadata===void 0&&delete t.metadata;let o=iN.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Nt(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function lN(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function cN(e){return!(e==null||typeof e=="string")}function fy(e){return e===null?"null":e===void 0?"nothing":Array.isArray(e)?"list":e instanceof Date?"date":typeof e=="string"?e.trim()===""?"empty string":"string":typeof e=="object"?"mapping":typeof e}function my(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function gy(e){let t=e.metadata?.category;if(typeof t!="string")return;let r=t.trim();return r===""?void 0:r}var Td=w(require("path"));C();var uN=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),hy="/webflow-skills-store";function Ts(e){if(typeof e!="string")return;let t=qF(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,WF),r=qF(t);if(r&&!uN.has(r)&&dN(r))return r}function qF(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function dN(e){return[sF,Kh].every(r=>{let n=r.impl.join(hy,e);return!ot(hy,n,r)||r.impl.basename(n)!==e?!1:r.impl.dirname(n)===r.impl.normalize(hy)})}function yy(e){return cy.test(e)}var Zn=e=>Td.default.posix.basename(Td.default.posix.dirname(e.split(Td.default.win32.sep).join("/")));function yn(e,t){let r=typeof e=="string"?e.trim():"",n=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(r==="")return n();let o=[s=>s.name===r,s=>s.folderName===r,s=>s.dir===r],i=Ts(r);i!==void 0&&o.push(s=>s.dir===i||Ts(s.name)===i||Ts(s.folderName)===i);for(let s of o){let a=t.filter(s);if(a.length===1)return{kind:"match",skill:a[0]};if(a.length>1)return{kind:"ambiguous",matches:a}}return n()}function YF(e){return XF(e,t=>t.dir)}function wy(e){let[t]=YF(e);if(!t)return;let r=t.skills.length,n=t.skills.map(o=>` "${b(o.name)}" (${b(o.skillPath)})`);throw new d(`${r===2?"Two":String(r)} skills resolve to the same install directory "${b(t.value)}":
|
|
254
|
+
${n.join(`
|
|
253
255
|
`)}
|
|
254
|
-
This is a bug in ${he}. Please report it.`)}function Xh(e){return tF(e,t=>t.name)}function Yh(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 tF(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 As=w(require("fs")),en=w(require("path"));C();async function Rs(e,t){Ue(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 yl(e,"the catalog skills directory")){if(hl.has(p.name))continue;let m=en.default.join(e,p.name);if(!await Zh(m,p))continue;let h=await rF(m);if(h.kind!=="none"&&i.add(h.path),!(h.kind!=="none"&&s(await nF({skillDir:m,manifest:h,extractRoot:t}))))for(let g of await yl(m)){if(hl.has(g.name))continue;let y=en.default.join(m,g.name);if(!await Zh(y,g))continue;let b=await rF(y);b.kind!=="none"&&(i.add(b.path),s(await nF({skillDir:y,manifest:b,extractRoot:t,parentCategory:p.name})))}}let a=await eL(n),l=Xh(a),c=new Set;for(let p of l){o.push(Yh(p));for(let m of p.skills.slice(1))c.add(m.skillPath)}let d=a.filter(p=>!c.has(p.skillPath));qh(d),o.push(...await tL(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 ${qo}.`),{skills:d,skipped:r,warnings:o}}async function nF(e){let{skillDir:t,manifest:n,extractRoot:r,parentCategory:o}=e,i=sF(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 As.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=Qo(l).frontmatter}catch(g){if(g instanceof Lt)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=_s(d);if(m===void 0)return a(`frontmatter name "${d}" cannot be used as a directory name`);zh(d)||s.push(`${i} declares a non-standard skill name "${d}"; it installs as "${m}". This is a bug in ${he}.`);let h=await QO(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 ${yd} files; only the first ${yd} are listed.`),{kind:"skill",warnings:s,skill:{name:d,dir:m,folderName:qr(i),description:p,category:Kh(c)??o,internal:Gh(c),path:t,skillPath:i,supplementaryFiles:h.files}})}async function rF(e){let t=en.default.join(e,Ot),n=await oF(t);if(n)return n;let r=Ot.toLowerCase();for(let o of await yl(e)){if(o.name===Ot||o.name.toLowerCase()!==r)continue;let i=await oF(en.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function oF(e){try{let t=await As.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Zh(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await As.default.promises.stat(e)).isDirectory()}catch{return!1}}async function yl(e,t){try{return(await As.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 QO(e,t){let n=[],r,o=!1,i=async(s,a)=>{if(!(a>Zo||r!==void 0))for(let l of await yl(s)){if(r!==void 0)return;let c=en.default.join(s,l.name);if(l.isSymbolicLink()){r=iF(e,c);return}if(l.isDirectory()){if(Xo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Yo.has(l.name)&&c!==t){if(n.length>=yd){o=!0;return}n.push(iF(e,c))}}};return await i(e,1),{files:n.sort(),symlink:r,truncated:o}}async function eL(e){let t=new Set,n=[];for(let r of e){let o;try{o=await As.default.promises.realpath(r.path)}catch{o=en.default.resolve(r.path)}t.has(o)||(t.add(o),n.push(r))}return n}async function tL(e,t,n){let r=[],o=JC,i=async(s,a)=>{if(!(a>zC||o<=0)){o-=1;for(let l of await yl(s)){if(hl.has(l.name))continue;let c=en.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Ot.toLowerCase()){n.has(c)||r.push(sF(t,c));continue}await Zh(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 ${qo}.`]}function sF(e,t){return en.default.relative(e,t).split(en.default.sep).join("/")}function iF(e,t){return en.default.relative(e,t).split(en.default.sep).join("/")}var bn=w(require("os")),jn=w(require("path"));function ei(e,t){let n=process.env[e]?.trim();return n||t}function aF(e){let t=process.env[e]?.trim();return t||void 0}var ce={home:()=>bn.default.homedir(),configHome:()=>ei("XDG_CONFIG_HOME",jn.default.join(bn.default.homedir(),".config")),hardcodedConfigHome:()=>jn.default.join(bn.default.homedir(),".config"),claudeHome:()=>ei("CLAUDE_CONFIG_DIR",jn.default.join(bn.default.homedir(),".claude")),codexHome:()=>ei("CODEX_HOME",jn.default.join(bn.default.homedir(),".codex")),vibeHome:()=>ei("VIBE_HOME",jn.default.join(bn.default.homedir(),".vibe")),hermesHome:()=>ei("HERMES_HOME",jn.default.join(bn.default.homedir(),".hermes")),autohandHome:()=>ei("AUTOHAND_HOME",jn.default.join(bn.default.homedir(),".autohand")),grokHome:()=>ei("GROK_HOME",jn.default.join(bn.default.homedir(),".grok")),appData:()=>aF("APPDATA"),flatpakConfigHome:()=>aF("FLATPAK_XDG_CONFIG_HOME")};function Dn(...e){return jn.default.join(bn.default.homedir(),...e)}var wF=w(require("fs")),ke=w(require("path"));C();M();var Ft=w(require("path"));var Qh=[".openclaw",".clawdbot",".moltbot"];function lF(e,t){let n=Qh.find(r=>t(Ft.default.join(e,r)));return Ft.default.join(e,n??Qh[0],"skills")}function cF(e,t){return Qh.some(n=>t(Ft.default.join(e,n)))}function uF(e,t,n=ce.appData(),r=ce.flatpakConfigHome()){return!!(t(Ft.default.join(e,"zed"))||n&&t(Ft.default.join(n,"Zed"))||r&&t(Ft.default.join(r,"zed")))}var rL="/Applications/ZCode.app";function dF(e,t){return t(Ft.default.join(e,".zcode"))||t(rL)}function pF(e,t){return t(Ft.default.join(e,"kimchi"))}var oL="/etc/codex";function fF(e,t){return t(e)||t(oL)}function mF(e,t){return t(Ft.default.join(e,".replit"))}function gF(e,t){return t(Ft.default.join(e,".promptscript"))||t(Ft.default.join(e,"promptscript.yaml"))}function hF(e,t,n){return n(Ft.default.join(t,"data","skills"))||n(Ft.default.join(e,".astrbot"))}function yF(){return!1}function iL(e){try{return wF.default.existsSync(e)}catch{return!1}}function fe(e,t,n){return{id:e,displayName:t,skillsDir:`${n}/skills`,globalSkillsDir:()=>Dn(n,"skills"),detect:r=>r.pathExists(ke.default.join(r.homeDir,n)),sharedStore:!1}}function it(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>Dn(...e.global),detect:t=>t.pathExists(ke.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var et=".agents/skills",wl=[fe("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:et,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"amp")),sharedStore:!0},it({id:"antigravity",displayName:"Antigravity",project:et,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),it({id:"antigravity-cli",displayName:"Antigravity CLI",project:et,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>Dn(".astrbot","data","skills"),detect:e=>hF(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:()=>lF(ce.home(),iL),detect:e=>cF(e.homeDir,e.pathExists),sharedStore:!1},it({id:"cline",displayName:"Cline",project:et,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),fe("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>Dn(".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:et,globalSkillsDir:()=>ke.default.join(ce.codexHome(),"skills"),detect:e=>fF(ce.codexHome(),e.pathExists),sharedStore:!0},fe("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>Dn(".continue","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".continue"))||e.pathExists(ke.default.join(e.homeDir,".continue")),sharedStore:!1},it({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>ke.default.join(ce.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(ke.default.join(ce.hardcodedConfigHome(),"crush")),sharedStore:!1},it({id:"cursor",displayName:"Cursor",project:et,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),it({id:"deepagents",displayName:"Deep Agents",project:et,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},it({id:"dexto",displayName:"Dexto",project:et,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),fe("droid","Droid",".factory"),it({id:"firebender",displayName:"Firebender",project:et,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),fe("forgecode","ForgeCode",".forge"),it({id:"gemini-cli",displayName:"Gemini CLI",project:et,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),it({id:"github-copilot",displayName:"GitHub Copilot",project:et,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:()=>Dn(".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=>pF(ce.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:et,globalSkillsDir:()=>Dn(".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"),it({id:"loaf",displayName:"Loaf",project:et,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:et,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"),it({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),fe("qoder","Qoder",".qoder"),it({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:et,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>mF(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},fe("reasonix","Reasonix",".reasonix"),fe("rovodev","Rovo Dev",".rovodev"),fe("roo","Roo Code",".roo"),it({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"),it({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),it({id:"warp",displayName:"Warp",project:et,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),it({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:et,globalSkillsDir:()=>Dn(".agents","skills"),detect:e=>uF(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>Dn(".zcode","skills"),detect:e=>dF(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:et,globalSkillsDir:()=>{},detect:e=>gF(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},fe("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:et,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:yF,sharedStore:!0,showInSharedList:!1}],ey=new Map(wl.map(e=>[e.id,e])),ti=wl.map(e=>e.id);function bl(e){return ey.has(e)}function Mn(e){return ey.get(e)}function Dd(e){let t=ey.get(e);if(t)return t;throw new f(`${k} Unknown agent: ${D(e)}
|
|
255
|
-
${
|
|
256
|
-
`:"";throw new
|
|
257
|
-
`+
|
|
258
|
-
Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:
|
|
259
|
-
`)}function
|
|
260
|
-
`)}function
|
|
261
|
-
${o}`)}function
|
|
262
|
-
`)}function
|
|
263
|
-
`)}function
|
|
264
|
-
`)}q();C();be();Oe();A();M();X();be();A();function _L(e){let t=El(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${kl.join(", ")} found in this directory.`}async function Rd(e,t,n){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(n||u.info(_L(t)),vl(t)):Sd(e,t)}function $s(e){return e==="locally-modified"||e==="unmanaged"}var ii=w(require("fs")),kn=w(require("path"));C();var dy=require("crypto"),$d=w(require("fs"));C();var oi=w(require("fs")),Un=w(require("path"));C();var uy=2e3,JF=8;async function Id(e){let t=Un.default.resolve(e),n=[],r=[],o=async(i,s)=>{if(s>Zo)throw new f(`Skill directory ${D(t)} nests deeper than ${Zo} levels at ${D(i)}. Refusing to copy or hash a tree this deep.`);let a=await oi.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=Un.default.join(i,l.name);if(Ue(t,c,"a skill file"),l.isSymbolicLink()){r.push(KF(t,c));continue}if(l.isDirectory()){if(Xo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Yo.has(l.name))continue;let d=await oi.default.promises.lstat(c);if(n.length>=uy)throw new f(`Skill directory ${D(t)} contains more than ${uy} files. Refusing to copy or hash it.`);let p=KF(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 Td(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 Pd(e,t){let n=Un.default.resolve(e),r=Un.default.resolve(t),o=await Id(n);Td(n,o),await oi.default.promises.mkdir(r,{recursive:!0});let i=new Set;for(let a of o.files){let l=Un.default.dirname(Un.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 oi.default.promises.mkdir(a,{recursive:!0});let s=0;return await AL(o.files,JF,async a=>{let l=Un.default.join(r,...a.rel.split("/"));Ue(r,l,"a skill destination file"),await oi.default.promises.copyFile(a.abs,l),await oi.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function KF(e,t){return Un.default.relative(e,t).split(Un.default.sep).join("/")}async function AL(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 qF=1024*1024,XF=4294967295,py=Buffer.from([0]);async function Od(e){let t=await Id(e);Td(e,t);let n=(0,dy.createHash)("sha256"),r=(0,dy.createHash)("sha256"),o=0;for(let i of t.files)await RL(n,i),IL(r,i),o+=i.size;return{contentHash:`sha256:${n.digest("hex")}`,modeHash:`sha256:${r.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function nn(e){try{return await Od(e)}catch(t){if($L(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 RL(e,t){if(t.size<=qF){let o=await $d.default.promises.readFile(t.abs);return zF(e,t,o.length),e.update(o),o.length}let n=await TL(t.abs);zF(e,t,n);let r=await PL(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 zF(e,t,n){if(n>XF)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(py);let r=Buffer.alloc(4);r.writeUInt32BE(n,0),e.update(r)}function IL(e,t){e.update(t.key,"utf8"),e.update(py),e.update((t.mode&73)!==0?"x":"-"),e.update(py)}async function TL(e){let t=0;for await(let n of $d.default.createReadStream(e))t+=n.length;return t}async function PL(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 $L(e){return Zr(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:Zr(e.cause)==="ENOENT"}function Zr(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var QF=require("crypto"),Ie=w(require("fs")),Ee=w(require("path"));C();A();var OL=/\.[0-9a-f]{6}\.tmp$/,e_=3600*1e3;async function my(e,t=n=>n){let n=Ee.default.join(e,Ed);for(let r of[n,Ee.default.join(n,vd)]){if(await t_(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 Ld(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 Ld(e,t){if(!ot(e,t)||await gy(e,t)!==void 0)return!0;try{await Ie.default.promises.lstat(t)}catch{return!1}return!await od(e,t)}async function gy(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 od(n,i))return i}}async function Nd(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 t_(i);if(a==="absent")return;if(a==="other")return i}}async function _l(e,t={}){if(t.dryRun)return[];let n=t.maxAgeMs??e_,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(!OL.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 jd(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(!ot(r,l))return p(`it resolves outside ${D(r)}.`);let m=await gy(r,l);if(m!==void 0)return p(`${D(m)} is a symbolic link that leaves ${D(r)}.`);let h=await Nd(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(Ye(t,l))return{...c,success:!0,link:"canonical"};let g=await jL(l,t);if(g&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!g){let[y,b]=await Promise.all([yn(t),yn(l)]);if(Ye(y,b))return{...c,success:!0,link:"canonical"};if(Ye(await ZF(t),await ZF(l)))return{...c,success:!0,link:"canonical"};if(await Sh(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:Zr(y),error:fy(y)}}try{if(await ML(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 yn(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=Zr(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:Zr(S)??b,error:fy(S)}}}}async function Al(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($s(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 Sh(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 LL(t),i="written")}catch(l){return{...r,storeAction:"failed",hashes:null,targets:[],success:!1,error:fy(l)}}let a=[];for(let l of t.targets)a.push(await NL(e,t,l,n));return{...r,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function LL(e){await Ie.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=yy(e.storePath);try{await Pd(e.sourceDir,t),await hy(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 Od(e.storePath)}async function NL(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}:jd({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 Ie.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let r=yy(t);try{await Pd(e,r),await hy(t,n),await Ie.default.promises.rename(r,t)}finally{await Ie.default.promises.rm(r,{recursive:!0,force:!0}).catch(()=>{})}}async function jL(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([yn(o),yn(t)]);return Ye(i,s)}async function ML(e,t){let n;try{n=await Ie.default.promises.lstat(e)}catch(r){Zr(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 hy(e,t)}async function hy(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 yy(e){return`${e}.${(0,QF.randomBytes)(3).toString("hex")}.tmp`}async function ZF(e){let t=Ee.default.resolve(e),n=await yn(Ee.default.dirname(t));return Ee.default.join(n,Ee.default.basename(t))}async function t_(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 fy(e){let t=e instanceof Error?e.message:String(e);return D(t)}var BL=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],UL=64;async function Rl(e){let t=e.platform??process.platform,n=e.display??(c=>c),r=kn.default.resolve(e.root),o=st(e.scope,r),i=e.recorded??{},s=new Set(e.warnings??[]);await my(r,n);let a=await WL({targets:e.targets,scope:e.scope,root:r,storeBase:o,display:n,warn:c=>s.add(c)});for(let c of await KL({groups:a,skills:e.skills,display:n}))s.add(c);let l=[];for(let c of e.skills)l.push(await GL({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 WL(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=Nt(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(Ye(c,o)){l.push({dir:c,agents:p,canonical:!0});continue}if(await Ld(r,c)){let g=Md(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 Nd(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 VL(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 HL(e,t,n,r){if(t==="global")return kn.default.dirname(r);let[o]=e.skillsDir.split(/[\\/]/);return kn.default.join(n,o??e.skillsDir)}async function VL(e,t,n,r){for(let o of e)if(await JL(HL(o,t,n,r)))return!0;return!1}async function GL(e){let{discovered:t,groups:n,storeBase:r,mode:o,force:i,platform:s,display:a}=e,l=kn.default.join(r,t.dir),c=await zL(t.path),d=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,p=e.recorded!==null&&d===null,m=await r_({dest:l,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),h=[];for(let S of n){let _=S.canonical?l:kn.default.join(S.dir,t.dir),v=S.canonical?"canonical":o;if(S.canonical||S.skipReason!==void 0){h.push({agent:o_(S),agents:S.agents.map(H=>H.id),label:i_(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 r_({dest:_,storePath:l,recorded:d,recordedUnverifiable:p,upstream:c,platform:s}),O=$s(x.overwrite)&&!i;h.push({agent:o_(S),agents:S.agents.map(H=>H.id),label:i_(S),path:_,link:v,overwrite:x.overwrite,blocked:O,skipped:!1,...O?{detail:n_(x,_,a)}:{}})}let g=$s(m.overwrite)&&!i,y=h.find(S=>S.blocked),b=g?n_(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 n_(e,t,n){return e.problem===void 0?a_(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 r_(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 ii.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await ii.default.promises.readlink(t).catch(()=>null),d=c===null?null:kn.default.resolve(kn.default.dirname(t),c);return d!==null&&Ye(d,n)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await nn(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 s_(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 s_(e,t="",n=0){if(n>Zo)return;let r;try{r=await ii.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(Xo.has(o.name))return i;let s=await s_(kn.default.join(e,o.name),i,n+1);if(s!==void 0)return s;continue}if(!o.isFile()||Yo.has(o.name))return i}}function a_(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 KL(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 ii.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=UL;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let d=kn.default.join(s.dir,c.name,Ot),p;try{p=Qo(await ii.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 ${Ot} 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 Md(e){let t=kn.default.resolve(e);for(let n of BL){let r=process.env[n]?.trim();if(r&&ot(r,t))return n}}function o_(e){return e.agents[0]?.id??""}function i_(e){let t=e.agents.map(n=>n.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function JL(e){try{return await ii.default.promises.lstat(e),!0}catch{return!1}}async function zL(e){let t=await nn(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,p_=/^sha256:[0-9a-f]{64}$/,wy=128,by=1024,l_=256,qL=/[\x00-\x1f\x7f]/;function f_(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>wy?`must be at most ${wy} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":Ds(e)}function Bd(e){return e.trim()===""?"must not be empty":e.length>by?`must be at most ${by} characters`:Ds(e)}function c_(e){return(t,n)=>{let r=e(t);r!==null&&n.addIssue({code:j.ZodIssueCode.custom,message:r})}}var m_=j.string().regex(Qt,"must be a 40-character lowercase commit SHA"),g_=j.string().regex(ad,"is not a usable git ref for this repository"),u_=j.string().regex(p_,'must look like "sha256:<64 lowercase hex>"'),XL=j.string().min(1,"must not be empty").max(wd).refine(e=>e.trim()!=="","must not be blank").refine(e=>!qL.test(e),"must not contain control characters"),d_=j.string().datetime({offset:!0}),h_=j.object({commit:m_,dir:j.string().superRefine(c_(f_)),skillPath:j.string().superRefine(c_(Bd)).optional(),contentHash:u_.optional(),modeHash:u_.optional(),ref:g_.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:d_.optional(),updatedAt:d_.optional()}).passthrough(),y_=j.object({repo:j.string().min(1).max(l_).default(he),ref:g_.default(Ge),commit:m_.optional(),pluginVersion:j.string().min(1).max(l_).optional()}).passthrough(),w_=j.object({lockfileVersion:j.number().int().min(0),source:y_.default({}),skills:j.record(XL,h_).default({})}).passthrough();function b_(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 Dy(e){let[t]=e.issues;return t?`${b_([...t.path])} ${t.message}`:"did not match the expected shape"}function Ud(e){return w_.safeParse(e)}var Wd=w(require("path"));ea();C();var D_="webflow-skills-lock.json",k_="skills-lock.json";function si(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 Wd.default.join(Wd.default.resolve(e),D_)}function ai(){return Wd.default.join(hi(),k_)}function Il(e,t){return e==="global"?ai():si(t??"")}var v_=w(require("fs"));var YL=/^<{7}/m,ZL=/^\uFEFF/;async function Wn(e){let t;try{t=await v_.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:QL(c)}}let n=t.replace(ZL,"");if(YL.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:eN(c,n)}}if(r===null||typeof r!="object"||Array.isArray(r))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${E_(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 ${E_(i)})`};let s=typeof i=="number"?i:0;if(s>Mt){let c=Ud(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Mt?{...o,lockfileVersion:Mt}:o,l=Ud(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:Dy(l.error)}}function QL(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 eN(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(`
|
|
256
|
+
This is a bug in ${ye}. Please report it.`)}function by(e){return XF(e,t=>t.name)}function ky(e){let[t,...r]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${b(e.value)}": ${e.skills.map(n=>b(n.skillPath)).join(", ")}. Using ${b(t?.skillPath??"")} and ignoring ${r.length===1?"the other":"the others"}. This is a bug in ${ye}. Please report it.`}function XF(e,t){let r=new Map;for(let n of e){let o=t(n),i=r.get(o);i?i.push(n):r.set(o,[n])}return[...r.entries()].filter(([,n])=>n.length>1).map(([n,o])=>({value:n,skills:o}))}var Ps=w(require("fs")),rr=w(require("path"));C();async function $s(e,t){Me(t,e,"the catalog skills directory");let r=[],n=[],o=[],i=new Set,s=f=>(o.push(...f.warnings),f.kind==="skipped"?(n.push({skillPath:f.skillPath,reason:f.reason}),!1):(r.push(f.skill),!f.skill.internal));for(let f of await El(e,"the catalog skills directory")){if(Dl.has(f.name))continue;let m=rr.default.join(e,f.name);if(!await Dy(m,f))continue;let g=await QF(m);if(g.kind!=="none"&&i.add(g.path),!(g.kind!=="none"&&s(await ZF({skillDir:m,manifest:g,extractRoot:t}))))for(let h of await El(m)){if(Dl.has(h.name))continue;let y=rr.default.join(m,h.name);if(!await Dy(y,h))continue;let k=await QF(y);k.kind!=="none"&&(i.add(k.path),s(await ZF({skillDir:y,manifest:k,extractRoot:t,parentCategory:f.name})))}}let a=await fN(r),l=by(a),c=new Set;for(let f of l){o.push(ky(f));for(let m of f.skills.slice(1))c.add(m.skillPath)}let p=a.filter(f=>!c.has(f.skillPath));wy(p),o.push(...await mN(e,t,i));for(let f of n)o.push(`Skipped ${f.skillPath} \u2014 ${f.reason}`);return n.length>0&&o.push(`${n.length} skill${n.length===1?" was":"s were"} skipped. ${n.length===1?"This is a defect":"These are defects"} in ${ye} \u2014 please report ${n.length===1?"it":"them"} at ${Xo}.`),{skills:p,skipped:n,warnings:o}}async function ZF(e){let{skillDir:t,manifest:r,extractRoot:n,parentCategory:o}=e,i=r_(n,r.path),s=[],a=h=>({kind:"skipped",skillPath:i,reason:b(h),warnings:s});if(r.kind==="symlink")return a(`${Lt} is a symbolic link; skill files must be regular files`);let l;try{l=await Ps.default.promises.readFile(r.path,"utf8")}catch(h){return a(`failed to read file: ${h instanceof Error?h.message:String(h)}`)}let c;try{c=ti(l).frontmatter}catch(h){if(h instanceof Nt)return a(h.reason);throw h}let p=b(c.name),f=b(c.description);if(p==="")return a(`frontmatter name "${b(c.name)}" cannot be used as a directory name`);let m=Ts(p);if(m===void 0)return a(`frontmatter name "${p}" cannot be used as a directory name`);yy(p)||s.push(`${i} declares a non-standard skill name "${p}"; it installs as "${m}". This is a bug in ${ye}.`);let g=await pN(t,r.path);return g.symlink?a(`contains a symbolic link (${g.symlink}); skill files must be regular files`):(g.truncated&&s.push(`${i} sits in a directory with more than ${Rd} files; only the first ${Rd} are listed.`),{kind:"skill",warnings:s,skill:{name:p,dir:m,folderName:Zn(i),description:f,category:gy(c)??o,internal:my(c),path:t,skillPath:i,supplementaryFiles:g.files}})}async function QF(e){let t=rr.default.join(e,Lt),r=await e_(t);if(r)return r;let n=Lt.toLowerCase();for(let o of await El(e)){if(o.name===Lt||o.name.toLowerCase()!==n)continue;let i=await e_(rr.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function e_(e){try{let t=await Ps.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Dy(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await Ps.default.promises.stat(e)).isDirectory()}catch{return!1}}async function El(e,t){try{return(await Ps.default.promises.readdir(e,{withFileTypes:!0})).sort((n,o)=>n.name<o.name?-1:n.name>o.name?1:0)}catch(r){if(!t)return[];throw new d(`Failed to read ${t} (${b(e)}): ${r instanceof Error?r.message:String(r)}`)}}async function pN(e,t){let r=[],n,o=!1,i=async(s,a)=>{if(!(a>ei||n!==void 0))for(let l of await El(s)){if(n!==void 0)return;let c=rr.default.join(s,l.name);if(l.isSymbolicLink()){n=t_(e,c);return}if(l.isDirectory()){if(Zo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!Qo.has(l.name)&&c!==t){if(r.length>=Rd){o=!0;return}r.push(t_(e,c))}}};return await i(e,1),{files:r.sort(),symlink:n,truncated:o}}async function fN(e){let t=new Set,r=[];for(let n of e){let o;try{o=await Ps.default.promises.realpath(n.path)}catch{o=rr.default.resolve(n.path)}t.has(o)||(t.add(o),r.push(n))}return r}async function mN(e,t,r){let n=[],o=HF,i=async(s,a)=>{if(!(a>VF||o<=0)){o-=1;for(let l of await El(s)){if(Dl.has(l.name))continue;let c=rr.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Lt.toLowerCase()){r.has(c)||n.push(r_(t,c));continue}await Dy(c,l)&&await i(c,a+1)}}};return await i(e,1),n.length===0?[]:[`${n.length} ${Lt} file(s) in the catalog sit outside the layout this CLI reads (for example ${n[0]}) and were ignored. ${ye} may have changed its layout; please report it at ${Xo}.`]}function r_(e,t){return rr.default.relative(e,t).split(rr.default.sep).join("/")}function t_(e,t){return rr.default.relative(e,t).split(rr.default.sep).join("/")}var br=w(require("os")),Mr=w(require("path"));function ri(e,t){let r=process.env[e]?.trim();return r||t}function n_(e){let t=process.env[e]?.trim();return t||void 0}var de={home:()=>br.default.homedir(),configHome:()=>ri("XDG_CONFIG_HOME",Mr.default.join(br.default.homedir(),".config")),hardcodedConfigHome:()=>Mr.default.join(br.default.homedir(),".config"),claudeHome:()=>ri("CLAUDE_CONFIG_DIR",Mr.default.join(br.default.homedir(),".claude")),codexHome:()=>ri("CODEX_HOME",Mr.default.join(br.default.homedir(),".codex")),vibeHome:()=>ri("VIBE_HOME",Mr.default.join(br.default.homedir(),".vibe")),hermesHome:()=>ri("HERMES_HOME",Mr.default.join(br.default.homedir(),".hermes")),autohandHome:()=>ri("AUTOHAND_HOME",Mr.default.join(br.default.homedir(),".autohand")),grokHome:()=>ri("GROK_HOME",Mr.default.join(br.default.homedir(),".grok")),appData:()=>n_("APPDATA"),flatpakConfigHome:()=>n_("FLATPAK_XDG_CONFIG_HOME")};function kr(...e){return Mr.default.join(br.default.homedir(),...e)}var m_=w(require("fs")),De=w(require("path"));C();j();var Ct=w(require("path"));var Ey=[".openclaw",".clawdbot",".moltbot"];function o_(e,t){let r=Ey.find(n=>t(Ct.default.join(e,n)));return Ct.default.join(e,r??Ey[0],"skills")}function i_(e,t){return Ey.some(r=>t(Ct.default.join(e,r)))}function s_(e,t,r=de.appData(),n=de.flatpakConfigHome()){return!!(t(Ct.default.join(e,"zed"))||r&&t(Ct.default.join(r,"Zed"))||n&&t(Ct.default.join(n,"zed")))}var hN="/Applications/ZCode.app";function a_(e,t){return t(Ct.default.join(e,".zcode"))||t(hN)}function l_(e,t){return t(Ct.default.join(e,"kimchi"))}var yN="/etc/codex";function c_(e,t){return t(e)||t(yN)}function u_(e,t){return t(Ct.default.join(e,".replit"))}function d_(e,t){return t(Ct.default.join(e,".promptscript"))||t(Ct.default.join(e,"promptscript.yaml"))}function p_(e,t,r){return r(Ct.default.join(t,"data","skills"))||r(Ct.default.join(e,".astrbot"))}function f_(){return!1}function wN(e){try{return m_.default.existsSync(e)}catch{return!1}}function ge(e,t,r){return{id:e,displayName:t,skillsDir:`${r}/skills`,globalSkillsDir:()=>kr(r,"skills"),detect:n=>n.pathExists(De.default.join(n.homeDir,r)),sharedStore:!1}}function it(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>kr(...e.global),detect:t=>t.pathExists(De.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Qe=".agents/skills",vl=[ge("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"amp")),sharedStore:!0},it({id:"antigravity",displayName:"Antigravity",project:Qe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),it({id:"antigravity-cli",displayName:"Antigravity CLI",project:Qe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>kr(".astrbot","data","skills"),detect:e=>p_(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>De.default.join(de.autohandHome(),"skills"),detect:e=>e.pathExists(de.autohandHome()),sharedStore:!1},ge("augment","Augment",".augment"),ge("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>De.default.join(de.claudeHome(),"skills"),detect:e=>e.pathExists(de.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>o_(de.home(),wN),detect:e=>i_(e.homeDir,e.pathExists),sharedStore:!1},it({id:"cline",displayName:"Cline",project:Qe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),ge("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>kr(".codebuddy","skills"),detect:e=>e.pathExists(De.default.join(e.cwd,".codebuddy"))||e.pathExists(De.default.join(e.homeDir,".codebuddy")),sharedStore:!1},ge("codemaker","Codemaker",".codemaker"),ge("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.codexHome(),"skills"),detect:e=>c_(de.codexHome(),e.pathExists),sharedStore:!0},ge("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>kr(".continue","skills"),detect:e=>e.pathExists(De.default.join(e.cwd,".continue"))||e.pathExists(De.default.join(e.homeDir,".continue")),sharedStore:!1},it({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>De.default.join(de.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(De.default.join(de.hardcodedConfigHome(),"crush")),sharedStore:!1},it({id:"cursor",displayName:"Cursor",project:Qe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),it({id:"deepagents",displayName:"Deep Agents",project:Qe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>De.default.join(de.configHome(),"devin","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"devin")),sharedStore:!1},it({id:"dexto",displayName:"Dexto",project:Qe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),ge("droid","Droid",".factory"),it({id:"firebender",displayName:"Firebender",project:Qe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),ge("forgecode","ForgeCode",".forge"),it({id:"gemini-cli",displayName:"Gemini CLI",project:Qe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),it({id:"github-copilot",displayName:"GitHub Copilot",project:Qe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>De.default.join(de.configHome(),"goose","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>De.default.join(de.grokHome(),"skills"),detect:e=>e.pathExists(de.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>De.default.join(de.hermesHome(),"skills"),detect:e=>e.pathExists(de.hermesHome()),sharedStore:!1},ge("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>kr(".jazz","skills"),detect:e=>e.pathExists(De.default.join(e.homeDir,".jazz"))||e.pathExists(De.default.join(e.cwd,".jazz")),sharedStore:!1},ge("junie","Junie",".junie"),ge("iflow-cli","iFlow CLI",".iflow"),ge("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>De.default.join(de.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>l_(de.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Qe,globalSkillsDir:()=>kr(".agents","skills"),detect:e=>e.pathExists(De.default.join(e.homeDir,".kimi-code"))||e.pathExists(De.default.join(e.homeDir,".kimi")),sharedStore:!0},ge("kiro-cli","Kiro CLI",".kiro"),ge("kode","Kode",".kode"),ge("lingma","Lingma",".lingma"),it({id:"loaf",displayName:"Loaf",project:Qe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),ge("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>De.default.join(de.vibeHome(),"skills"),detect:e=>e.pathExists(de.vibeHome()),sharedStore:!1},ge("moxby","Moxby",".moxby"),ge("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"opencode","skills"),detect:e=>e.pathExists(De.default.join(e.configHome,"opencode")),sharedStore:!0},ge("openhands","OpenHands",".openhands"),ge("ona","Ona",".ona"),it({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),ge("qoder","Qoder",".qoder"),it({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),ge("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:e=>u_(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},ge("reasonix","Reasonix",".reasonix"),ge("rovodev","Rovo Dev",".rovodev"),ge("roo","Roo Code",".roo"),it({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),ge("terramind","Terramind",".terramind"),ge("tinycloud","Tinycloud",".tinycloud"),ge("trae","Trae",".trae"),it({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),it({id:"warp",displayName:"Warp",project:Qe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),it({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Qe,globalSkillsDir:()=>kr(".agents","skills"),detect:e=>s_(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>kr(".zcode","skills"),detect:e=>a_(e.homeDir,e.pathExists),sharedStore:!1},ge("zencoder","Zencoder",".zencoder"),ge("zenflow","Zenflow",".zencoder"),ge("neovate","Neovate",".neovate"),ge("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Qe,globalSkillsDir:()=>{},detect:e=>d_(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},ge("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Qe,globalSkillsDir:()=>De.default.join(de.configHome(),"agents","skills"),detect:f_,sharedStore:!0,showInSharedList:!1}],vy=new Map(vl.map(e=>[e.id,e])),ni=vl.map(e=>e.id);function Sl(e){return vy.has(e)}function Br(e){return vy.get(e)}function Pd(e){let t=vy.get(e);if(t)return t;throw new d(`${D} Unknown agent: ${b(e)}
|
|
257
|
+
${ni.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function $d(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Ur(e){return vl.filter(t=>$d(t,e))}var Sy=w(require("path"));C();j();var Od=".agents",Ld="skills";function st(e,t){let r=e==="global"?de.home():t;return Sy.default.join(r,Od,Ld)}function jt(e,t,r){if(t==="global")return e.globalSkillsDir()??null;let n=Sy.default.resolve(r,...e.skillsDir.split("/"));return Me(r,n,`${e.id} project skills directory`),n}function xy(e,t,r){return Ye(jt(e,t,r),st(t,r))}var Cy=w(require("fs")),g_=w(require("path"));function bN(e){try{return Cy.default.existsSync(e)}catch{return!1}}function kN(e){try{let t=JSON.parse(Cy.default.readFileSync(g_.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function h_(e){return{homeDir:de.home(),configHome:de.configHome(),cwd:e,pathExists:bN,readPackageJson:kN}}async function xl(e,t,r=h_(t)){return y_(Ur(e),r).map(n=>n.id)}function y_(e,t){return e.filter(r=>{try{return r.detect(t)}catch{return!1}})}var w_=w(require("fs")),b_=w(require("path"));C();we();Oe();R();j();var Cl=[".git","package.json","webflow.json"];function Fl(e){for(let t of Cl)try{if(w_.default.existsSync(b_.default.join(e,t)))return t}catch{}return null}function _l(e){return Fl(e)===null?"global":"project"}function k_(e){let t=Fl(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${Cl.join(", ")} found in this directory.`}async function Nd(e,t){if(e.global&&e.project)throw new d(`${D} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let r=_l(t);return e.yes||V()?(u.info(k_(t)),r):je({message:"Where should these skills be installed?",default:r,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}C();we();Oe();R();j();var Al="all",nr="universal",DN=6,EN=20,vN=80;function Os(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function SN(e,t){let r=Array.from({length:t.length+1},(n,o)=>o);for(let n=1;n<=e.length;n+=1){let o=[n];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(r[i]+1,o[i-1]+1,r[i-1]+(e[n-1]===t[i-1]?0:1));r=o}return r[t.length]}function v_(e){let t=e.toLowerCase(),r=Math.max(1,Math.floor(t.length/3)),n=null,o=Number.POSITIVE_INFINITY;for(let i of ni){let s=SN(t,i);s<o&&(o=s,n=i)}return o<=r?n:null}function Ls(e){let t=e.filter(r=>!Sl(r));if(t.length>0){let r=Array.from(new Set(t.map(o=>v_(o)).filter(o=>o!==null))),n=r.length>0?` Did you mean: ${r.join(", ")}?
|
|
258
|
+
`:"";throw new d(`${D} Unknown agent(s): ${t.map(o=>b(o)).join(", ")}
|
|
259
|
+
`+n+` ${ni.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(r=>Br(r))}function Md(e,t){return Ur(e).filter(r=>xy(r,e,t))}function S_(e,t){return Md(e,t).filter(r=>r.showInSharedList!==!1)}function x_(e,t){let n=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-n.length,i=n.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function C_(e,t,r=DN){return x_(S_(e,t),r)}function D_(e,t){let r=process.stdout.columns??vN,n=Math.max(20,r-t);return e.length<=n?e:`${e.slice(0,n-1)}\u2026`}function xN(e,t,r){return t==="project"?e.skillsDir:jt(e,t,r)??""}function jd(e,...t){let r=new Set(t.flat());return Ur(e).filter(n=>r.has(n.id))}async function E_(e,t,r){let n=Md(e,t),o=new Set(n.map(f=>f.id)),i=Ur(e).filter(f=>!o.has(f.id)),s=new Set(r),a=C_(e,t),l=st(e,t),c=[];n.length>0&&c.push({value:"",name:D_(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let f of i){let m=xN(f,e,t),g=s.has(f.id)?" (detected)":"";c.push({value:f.id,name:D_(`${f.displayName} ${m}${g}`,8),checked:s.has(f.id)})}let p=await Cr({message:n.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(EN,Math.max(4,c.length)),validate:f=>f.length>0||n.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return jd(e,n.map(f=>f.id),(p??[]).filter(Boolean))}async function Rl(e){let{scope:t,cwd:r,options:n}=e,o=Os(n.agent),i=n.allAgents===!0||o.includes(Al),s=o.filter(c=>c!==Al),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(p=>Sl(p));return{agents:jd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(p=>!Sl(p))}}if(s.length>0&&!i){let c=Ls(s),p=c.filter(f=>!$d(f,t));if(p.length>0){let f=p.map(m=>m.displayName).join(", ");throw new d(`${D} ${f} does not support global skill installation \u2014 its skills live inside a project.
|
|
260
|
+
Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:jd(t,c.map(f=>f.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Ur(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await xl(t,r);if(l.length===0){if(V()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${st(t,r)}).`);let c=Br(nr);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await E_(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}return n.yes||V()?{agents:jd(t,Md(t,r).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await E_(t,r,l),detected:l,source:"prompt",unknownRecorded:[]}}var R_=w(require("os")),Qn=w(require("path"));me();j();var eo=1,CN=24,FN=100,I_=8,_N=5;function oi(e,t={}){if(e==="")return"";let r=Qn.default.resolve(e),n=Qn.default.resolve(t.cwd??process.cwd()),o=Qn.default.resolve(t.home??R_.default.homedir()),i=F_(n,r);if(i!==null)return b(i===""?".":`.${Qn.default.sep}${i}`);let s=F_(o,r);return s!==null?b(s===""?"~":`~${Qn.default.sep}${s}`):b(r)}function Bd(e={}){return t=>oi(t,e)}function F_(e,t){let r=Qn.default.relative(e,t);return r===""?"":r.startsWith("..")||Qn.default.isAbsolute(r)?null:r}var __={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function _y(e){let{plan:t,materialized:r,dryRun:n}=e,o=[],i=[];for(let g of t.skills){let h=__[g.storeOverwrite];h!==void 0&&!t.force&&o.push({name:g.name,dir:g.dir,overwrite:g.storeOverwrite,reason:h,requiredFlag:"--force",...g.detail!==void 0?{detail:g.detail}:{}});for(let y of g.targets){if(!y.blocked)continue;let k=__[y.overwrite];k!==void 0&&o.push({name:g.name,dir:g.dir,agent:y.agent,overwrite:y.overwrite,reason:k,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let g of t.skills)for(let h of g.targets){if(!h.blocked)continue;let y=s.get(g.name)??new Set;y.add(h.path),s.set(g.name,y)}let a=0,l=0,c=0,p=0,f=0,m=0;for(let g of r){if(g.storeAction==="written"&&(l+=1),g.storeAction==="failed"){i.push({name:g.name,message:g.error??"the canonical store could not be written"});continue}if(g.storeAction!=="blocked"){(g.storeAction==="written"||g.storeAction==="adopted"||g.storeAction==="unchanged")&&(a+=1);for(let h of g.targets){if(h.skipped===!0){m+=1;continue}if(!h.success){if(s.get(g.name)?.has(h.path))continue;i.push({name:g.name,agent:h.agent,...h.errno!==void 0?{errno:h.errno}:{},message:h.error??"the destination could not be written"});continue}h.link==="symlink"&&(c+=1),h.link==="copy"&&h.requestedMode==="copy"&&(p+=1),h.symlinkFailed===!0&&(f+=1)}}}return n&&(m=t.skills.reduce((g,h)=>g+h.targets.filter(y=>y.skipped).length,0)),{blocked:o,failures:i,summary:{requested:t.skills.length,installed:a,skipped:m,blocked:o.length,failed:i.length,storeWrites:l,symlinks:c,copies:p,symlinkFallbacks:f}}}function Ay(e,t){let r=t.display??(o=>o),n=[];n.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),n.push(` scope ${e.scope} (${r(e.root)})`),n.push(` source ${AN(e.source)}`),n.push(` store ${r(e.storeBase)}`),n.push(` mode ${e.mode}`);for(let o of e.skills)n.push(""),n.push(` ${b(o.dir)}`),n.push(` store ${r(o.storePath)}`),n.push(...RN(o,r)),o.blocked&&o.detail!==void 0&&n.push(` ${ue("blocked")} ${o.detail}`);if(e.warnings.length>0){n.push("");for(let o of e.warnings)n.push(` ${ue("\u26A0")} ${o}`)}return n.join(`
|
|
261
|
+
`)}function AN(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${T_(e.commit)}${t}`}function T_(e){return e.slice(0,I_)}function RN(e,t){let r=[],n=e.targets.filter(s=>s.link==="canonical"),o=e.targets.filter(s=>!s.skipped&&s.link==="symlink"),i=e.targets.filter(s=>!s.skipped&&s.link==="copy");n.length>0&&r.push(` shared ${Il(n)}`),o.length>0&&r.push(` symlink \u2192 ${A_(o,t)}`),i.length>0&&r.push(` copy \u2192 ${A_(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&r.push(` ${P("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&r.push(` overwrites ${s.label} ${P(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return r}function A_(e,t){if(e.length===1){let r=e[0];return`${r.label} (${t(r.path)})`}return Il(e)}function Il(e,t=_N){let r=e.map(n=>b(n.label));return r.length<=t?r.join(", "):`${r.slice(0,t).join(", ")} +${r.length-t} more`}function P_(e,t={}){let r=t.display??(i=>i),n=[],{summary:o}=e;n.push(z(`Installed ${o.installed} ${Fy(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;n.push(` ${b(r(i.storePath))}`);let s=i.targets.filter(c=>c.success&&c.link==="canonical"),a=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="symlink"),l=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="copy");s.length>0&&n.push(` shared: ${Il(s)}`),a.length>0&&n.push(` symlinked: ${Il(a)}`),l.length>0&&n.push(` copied: ${Il(l)}`),i.detail!==void 0&&n.push(` ${P(i.detail)}`)}if(o.symlinkFallbacks>0){let i=IN(e.materialized);n.push(`${ue("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${Fy(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),n.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return n.push(...TN(e.blocked)),n.push(...PN(e.failures)),n.push(...Ud(e.plan.warnings)),n.join(`
|
|
262
|
+
`)}function IN(e){let t=new Set;for(let r of e)for(let n of r.targets)n.symlinkFailed===!0&&n.errno!==void 0&&t.add(n.errno);return[...t].sort()}function TN(e){if(e.length===0)return[];let t=["",ue(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let r of e){let n=r.agent===void 0?"shared store":b(r.agent);t.push(` \u2022 ${b(r.name)} (${n})`),r.detail!==void 0&&t.push(` ${r.detail}`)}return t}function PN(e){if(e.length===0)return[];let t=["",Ut(`${e.length} ${Fy(e.length,"failure")}:`)];for(let r of e){let n=r.agent===void 0?"":` (${b(r.agent)})`;t.push(` \u2022 ${b(r.name)}${n}: ${b(r.message)}`)}return t}function Ud(e){return e.length===0?[]:["",...e.map(t=>`${ue("\u26A0")} ${t}`)]}function Fy(e,t){return e===1?t:`${t}s`}function Wd(e){let{plan:t}=e,r=new Map(e.materialized.map(n=>[n.name,n]));return{kind:"skills.install",schemaVersion:eo,dryRun:e.dryRun,restored:e.restored,scope:t.scope,root:t.root,store:t.storeBase,mode:t.mode,force:t.force,lockfile:e.lockfilePath,source:{...t.source,cacheHit:e.cacheHit},...e.extraSources!==void 0&&e.extraSources.length>0?{sources:[t.source,...e.extraSources]}:{},skills:t.skills.map(n=>$N(n,r.get(n.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function $N(e,t){let r=new Map((t?.targets??[]).map(n=>[n.path,n]));return{name:e.name,dir:e.dir,description:e.description,skillPath:e.skillPath,storePath:e.storePath,storeOverwrite:e.storeOverwrite,storeAction:t?.storeAction??null,contentHash:t?.hashes?.contentHash??null,modeHash:t?.hashes?.modeHash??null,upToDate:e.upToDate,fileCount:e.fileCount,byteCount:e.byteCount,blocked:e.blocked,detail:e.detail??null,targets:e.targets.map(n=>ON(n,r.get(n.path)))}}function ON(e,t){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:t?.link??e.link,overwrite:e.overwrite,blocked:e.blocked,skipped:t?.skipped??e.skipped,skipReason:t?.skipReason??e.skipReason??null,symlinkFailed:t?.symlinkFailed??!1,errno:t?.errno??null,error:t?.error??null}}var ii=["name","dir","description","status","mode","agents","scope"],Tl="name,status,agents",Ns=["name","dir","status","scope"],LN={"up-to-date":z,modified:ue,missing:Ut,unmanaged:P};function $_(e,t,r={}){let n=r.columns??process.stdout.columns??FN,o=e.map(l=>t.map(c=>NN(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((p,f,m)=>{if(m===i)return p;let g=Math.max(f.length,...o.map(h=>h[m].length),0);return p+g+2},0),c=Math.max(CN,n-l-2);for(let p of o)p[i]=MN(p[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((p,f)=>t[f]==="status"?LN[e[c].status](p):p));return ze(s,a)}function NN(e,t){switch(t){case"name":return b(e.name);case"dir":return b(e.dir);case"description":return b(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return jN(e);case"scope":return e.scope}}var O_="shared";function jN(e){let t=[],r=0;for(let n of e.agents){let o=b(n.id);if(!n.present){t.push(`${o} (missing)`);continue}if(n.link==="canonical"){r+=1;continue}t.push(o)}return r>0?[O_,...t].join(", "):t.join(", ")}function L_(e,t={}){let r=t.display??(s=>s),n=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&n.add(a.id);if(n.size===0)return"";let o=[...n].sort().join(", "),i=t.store===void 0?"":` = ${r(t.store)}`;return P(`${O_}${i}, read directly by ${n.size} agent${n.size===1?"":"s"}:
|
|
263
|
+
${o}`)}function MN(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function N_(e,t={}){let r=t.display??(l=>l),n=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${T_(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${n} skills \u2014 ${r(a)}${s}`)}function Ry(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let r of e)for(let n of r.skills)t.total+=1,n.status==="up-to-date"?t.upToDate+=1:n.status==="modified"?t.modified+=1:n.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function j_(e){return{kind:"skills.list",schemaVersion:eo,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(r=>({name:r.name,dir:r.dir,description:r.description,skillPath:r.skillPath??null,storePath:r.storePath,recordedHash:r.recordedHash,onDiskHash:r.onDiskHash,status:r.status,statusDetail:r.statusDetail??null,mode:r.mode,commit:r.commit??null,ref:r.ref??null,category:r.category??null,agents:r.agents.map(n=>({id:n.id,label:n.label,path:n.path,link:n.link,present:n.present,diverged:n.diverged??!1}))}))})),summary:Ry(e.inventories),warnings:[...e.warnings]}}var Iy="No skills installed. Run `webflow skills install` to get started.";function M_(e,t){let r=t==="desc"?-1:1;return(n,o)=>{let i=String(n[e]??""),s=String(o[e]??"");return i===s?n.name<o.name?-1:n.name>o.name?1:0:(i<s?-1:1)*r}}function B_(e){let t=[],{summary:r}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return Iy;if(e.source.upToDate)t.push(`${$} ${b(e.source.repo)}@${b(e.source.ref)} is still ${BN(e.source.resolvedCommit)} \u2014 all ${r.checked} skill${r.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${xe} ${r.outdated+r.conflicts} of ${r.checked} skills would change.`:`${$} Updated ${r.updated} skill${r.updated===1?"":"s"}`+(r.blocked>0?`, skipped ${r.blocked}`:"")+(r.failed>0?`, ${r.failed} failed`:"");t.push(o)}let n=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[b(o.dir),o.action,o.detail?b(o.detail):""]);n.length>0&&t.push("",ze(["SKILL","ACTION","DETAIL"],n));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${b(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${b(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${D} ${b(o.name)}: ${b(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
|
|
264
|
+
`)}function BN(e){return e===null?"unknown":e.slice(0,I_)}function Ty(e,t,r={}){let n=i=>b((r.display??oi)(i)),o=[];o.push(`${r.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${b(i.name)} \u2192 ${b(i.dir)}`),!i.onDisk&&i.targets.length===0){o.push(" (lockfile entry only \u2014 no directory on disk; the stale entry will be removed)");continue}i.onDisk&&o.push(` ${n(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>b(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${n(s.path)} ${b(s.label)} (unlink)`)}return r.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
|
|
265
|
+
`)}function U_(e,t={}){let r=o=>b((t.display??oi)(o));if(e.skills.length===0)return"No skills removed.";let n=[];n.push(`${$} Removed ${e.summary.removed} skill${e.summary.removed===1?"":"s"}`+(e.summary.failed>0?`, ${e.summary.failed} failed`:""));for(let o of e.skills){let i=o.targets.filter(a=>a.action==="unlinked"),s=o.storeAction==="deleted"?"store directory deleted":o.storeAction==="kept"?`store kept \u2014 still used by ${o.keptBecause.map(a=>b(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";n.push(` ${b(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&n.push(` removed empty directories: ${e.removedDirectories.map(o=>r(o)).join(", ")}`);for(let o of e.failures)n.push(`${D} ${b(o.name)}: ${b(o.message)}`);return e.lockfileDeleted?n.push(`${xe} ${r(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&n.push(`${xe} ${r(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),n.join(`
|
|
266
|
+
`)}Y();C();we();Oe();R();j();Z();we();R();function UN(e){let t=Fl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${Cl.join(", ")} found in this directory.`}async function Hd(e,t,r){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(r||u.info(UN(t)),_l(t)):Nd(e,t)}function js(e){return e==="locally-modified"||e==="unmanaged"}var ai=w(require("fs")),Dr=w(require("path"));C();var $y=require("crypto"),Jd=w(require("fs"));C();var si=w(require("fs")),Wr=w(require("path"));C();var Py=2e3,H_=8;async function Vd(e){let t=Wr.default.resolve(e),r=[],n=[],o=async(i,s)=>{if(s>ei)throw new d(`Skill directory ${b(t)} nests deeper than ${ei} levels at ${b(i)}. Refusing to copy or hash a tree this deep.`);let a=await si.default.promises.readdir(i,{withFileTypes:!0});a.sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0);for(let l of a){let c=Wr.default.join(i,l.name);if(Me(t,c,"a skill file"),l.isSymbolicLink()){n.push(W_(t,c));continue}if(l.isDirectory()){if(Zo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||Qo.has(l.name))continue;let p=await si.default.promises.lstat(c);if(r.length>=Py)throw new d(`Skill directory ${b(t)} contains more than ${Py} files. Refusing to copy or hash it.`);let f=W_(t,c);r.push({rel:f,key:f.normalize("NFC"),abs:c,mode:p.mode&511,size:p.size})}};return await o(t,1),r.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),n.sort(),{files:r,symlinks:n}}function Gd(e,t){let[r]=t.symlinks;if(r!==void 0)throw new d(`Skill directory ${b(e)} contains a symbolic link ("${b(r)}"); skill files must be regular files. If this came from ${ye}, please report it.`)}async function Kd(e,t){let r=Wr.default.resolve(e),n=Wr.default.resolve(t),o=await Vd(r);Gd(r,o),await si.default.promises.mkdir(n,{recursive:!0});let i=new Set;for(let a of o.files){let l=Wr.default.dirname(Wr.default.join(n,...a.rel.split("/")));l!==n&&i.add(l)}for(let a of[...i].sort())Me(n,a,"a skill destination directory"),await si.default.promises.mkdir(a,{recursive:!0});let s=0;return await WN(o.files,H_,async a=>{let l=Wr.default.join(n,...a.rel.split("/"));Me(n,l,"a skill destination file"),await si.default.promises.copyFile(a.abs,l),await si.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function W_(e,t){return Wr.default.relative(e,t).split(Wr.default.sep).join("/")}async function WN(e,t,r){let n=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;n<e.length;){let i=e[n++];if(i===void 0)return;await r(i)}});await Promise.all(o)}var G_=1024*1024,K_=4294967295,Oy=Buffer.from([0]);async function zd(e){let t=await Vd(e);Gd(e,t);let r=(0,$y.createHash)("sha256"),n=(0,$y.createHash)("sha256"),o=0;for(let i of t.files)await HN(r,i),VN(n,i),o+=i.size;return{contentHash:`sha256:${r.digest("hex")}`,modeHash:`sha256:${n.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function or(e){try{return await zd(e)}catch(t){if(JN(t))return null;throw t}}function Mt(e,t,r=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:r==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function HN(e,t){if(t.size<=G_){let o=await Jd.default.promises.readFile(t.abs);return V_(e,t,o.length),e.update(o),o.length}let r=await GN(t.abs);V_(e,t,r);let n=await KN(e,t.abs,r);if(n!==r)throw new d(`${b(t.abs)} changed while it was being hashed (${r} bytes, then ${n}). Re-run the command.`);return n}function V_(e,t,r){if(r>K_)throw new d(`${b(t.abs)} is ${r} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update(Oy);let n=Buffer.alloc(4);n.writeUInt32BE(r,0),e.update(n)}function VN(e,t){e.update(t.key,"utf8"),e.update(Oy),e.update((t.mode&73)!==0?"x":"-"),e.update(Oy)}async function GN(e){let t=0;for await(let r of Jd.default.createReadStream(e))t+=r.length;return t}async function KN(e,t,r){let n=0;for await(let o of Jd.default.createReadStream(t)){let i=o;if(n+=i.length,n>r)return e.update(i.subarray(0,i.length-(n-r))),n;e.update(i)}return n}function JN(e){return to(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:to(e.cause)==="ENOENT"}function to(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var q_=require("crypto"),Re=w(require("fs")),Ee=w(require("path"));C();R();var zN=/\.[0-9a-f]{6}\.tmp$/,Y_=3600*1e3;async function Ny(e,t=r=>r){let r=Ee.default.join(e,Od);for(let n of[r,Ee.default.join(r,Ld)]){if(await X_(n)==="other")throw new d(`${b(t(n))} exists but is not a directory. The Webflow CLI needs it as the shared skills store. Remove or rename it, then re-run.`,{isUserError:!0});if(await qd(e,n))throw new d(`${b(t(n))} resolves outside ${b(t(e))} once symlinks are followed. The Webflow CLI will not use it as the shared skills store. Remove or repoint it, then re-run.`,{isUserError:!0})}}async function qd(e,t){if(!ot(e,t)||await jy(e,t)!==void 0)return!0;try{await Re.default.promises.lstat(t)}catch{return!1}return!await yd(e,t)}async function jy(e,t){let r=Ee.default.resolve(e),n=Ee.default.relative(r,Ee.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(Ee.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a;try{a=await Re.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await yd(r,i))return i}}async function Yd(e,t){let r=Ee.default.resolve(e),n=Ee.default.relative(r,Ee.default.resolve(t));if(n===""||n.startsWith(".."))return;let o=n.split(Ee.default.sep).filter(s=>s!==""),i=r;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a=await X_(i);if(a==="absent")return;if(a==="other")return i}}async function Pl(e,t={}){if(t.dryRun)return[];let r=t.maxAgeMs??Y_,n=t.now??Date.now(),o=[],i;try{i=await Re.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!zN.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Me(e,a,"a stale staging directory");let l=await Re.default.promises.lstat(a);if(n-l.mtimeMs<r)continue;await Re.default.promises.rm(a,{recursive:!0,force:!0}),o.push(a)}catch(l){u.debug(`Could not sweep staging directory ${a}: ${l instanceof Error?l.message:String(l)}`)}}return o}async function Xd(e){let{storeDir:t,slug:r,root:n,mode:o,agent:i,label:s}=e,a=e.platform??process.platform,l=Ee.default.resolve(e.linkPath),c={agent:i,label:s,path:l,canonicalPath:t,requestedMode:o},p=y=>({...c,success:!1,link:o,error:y});if(Ee.default.basename(l)!==r)return p(`Refusing to write ${b(l)}: its final component is not "${b(r)}".`);let f=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${b(l)} for ${b(s)}: ${y}`});if(!ot(n,l))return f(`it resolves outside ${b(n)}.`);let m=await jy(n,l);if(m!==void 0)return f(`${b(m)} is a symbolic link that leaves ${b(n)}.`);let g=await Yd(n,l);if(g!==void 0)return p(`${b(g)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(Ye(t,l))return{...c,success:!0,link:"canonical"};let h=await XN(l,t);if(h&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!h){let[y,k]=await Promise.all([yr(t),yr(l)]);if(Ye(y,k))return{...c,success:!0,link:"canonical"};if(Ye(await z_(t),await z_(l)))return{...c,success:!0,link:"canonical"};if(await Jh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await J_(t,l,r),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:to(y),error:Ly(y)}}try{if(await ZN(l,r),await Re.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await Re.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await yr(Ee.default.dirname(l));await Re.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let k=to(y);try{return await J_(t,l,r),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:k}}catch(v){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:to(v)??k,error:Ly(v)}}}}async function $l(e,t,r={}){if(Me(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),Ee.default.basename(t.storePath)!==t.dir)throw new d(`Refusing to write ${b(t.storePath)}: its final component is not "${b(t.dir)}". Please report this.`);let n={name:t.name,dir:t.dir,storePath:t.storePath};if(js(t.storeOverwrite)&&!e.force)return{...n,storeAction:"blocked",hashes:null,targets:[],success:!1,error:t.detail};let o,i,s;try{t.storeOverwrite==="adoptable"?(i="adopted",o=t.onDisk??t.upstream):t.upToDate?(i="unchanged",o=t.onDisk??t.upstream):await Jh(t.sourceDir,t.storePath)?(i="unchanged",o=t.onDisk??t.upstream,s="the extracted source and the canonical store are the same directory; nothing to copy"):(o=await qN(t),i="written")}catch(l){return{...n,storeAction:"failed",hashes:null,targets:[],success:!1,error:Ly(l)}}let a=[];for(let l of t.targets)a.push(await YN(e,t,l,r));return{...n,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function qN(e){await Re.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=By(e.storePath);try{await Kd(e.sourceDir,t),await My(e.storePath,e.dir),await Re.default.promises.rename(t,e.storePath)}finally{await Re.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return zd(e.storePath)}async function YN(e,t,r,n){let o={agent:r.agent,label:r.label,path:r.path,canonicalPath:t.storePath,requestedMode:e.mode};return r.link==="canonical"?{...o,success:!0,link:"canonical"}:r.skipped?{...o,success:!0,link:r.link,skipped:!0,skipReason:r.skipReason,error:void 0}:r.blocked?{...o,success:!1,link:r.link,error:r.detail}:Xd({storeDir:t.storePath,linkPath:r.path,slug:t.dir,root:e.root,mode:e.mode,agent:r.agent,label:r.label,platform:n.platform})}async function J_(e,t,r){await Re.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let n=By(t);try{await Kd(e,n),await My(t,r),await Re.default.promises.rename(n,t)}finally{await Re.default.promises.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}async function XN(e,t){let r;try{r=await Re.default.promises.lstat(e)}catch{return!1}if(!r.isSymbolicLink())return!1;let n=await Re.default.promises.readlink(e).catch(()=>null);if(n===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),n);if(Ye(o,t))return!0;let[i,s]=await Promise.all([yr(o),yr(t)]);return Ye(i,s)}async function ZN(e,t){let r;try{r=await Re.default.promises.lstat(e)}catch(n){to(n)==="ELOOP"&&await Re.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(r.isSymbolicLink()){await Re.default.promises.rm(e,{force:!0});return}await My(e,t)}async function My(e,t){if(Ee.default.basename(e)!==t)throw new d(`Refusing to delete ${b(e)}: its final component is not "${b(t)}". Please report this.`);let r;try{r=await Re.default.promises.lstat(e)}catch{return}if(r.isSymbolicLink()){await Re.default.promises.rm(e,{force:!0});return}await Re.default.promises.rm(e,{recursive:!0,force:!0})}function By(e){return`${e}.${(0,q_.randomBytes)(3).toString("hex")}.tmp`}async function z_(e){let t=Ee.default.resolve(e),r=await yr(Ee.default.dirname(t));return Ee.default.join(r,Ee.default.basename(t))}async function X_(e){let t;try{t=await Re.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await Re.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function Ly(e){let t=e instanceof Error?e.message:String(e);return b(t)}var QN=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],ej=64;async function Ol(e){let t=e.platform??process.platform,r=e.display??(c=>c),n=Dr.default.resolve(e.root),o=st(e.scope,n),i=e.recorded??{},s=new Set(e.warnings??[]);await Ny(n,r);let a=await tj({targets:e.targets,scope:e.scope,root:n,storeBase:o,display:r,warn:c=>s.add(c)});for(let c of await ij({groups:a,skills:e.skills,display:r}))s.add(c);let l=[];for(let c of e.skills)l.push(await oj({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:r}));return{scope:e.scope,root:n,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function tj(e){let{targets:t,scope:r,root:n,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let p=jt(c.agent,r,n);if(p===null){s(`${b(c.agent.displayName)} does not support ${r} installation and was skipped.`);continue}let f=a.get(p);f?(f.agents.push(c.agent),f.explicit=f.explicit||c.explicit):a.set(p,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,p]of a){let f=p.agents.slice().sort((h,y)=>h.id<y.id?-1:h.id>y.id?1:0);if(Ye(c,o)){l.push({dir:c,agents:f,canonical:!0});continue}if(await qd(n,c)){let h=Zd(c),y=`${b(i(c))} resolves outside ${b(i(n))}`+(h?` (check $${h})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:f,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await Yd(n,c);if(m!==void 0){let h=`${b(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(h),l.push({dir:c,agents:f,canonical:!1,skipReason:"path-conflict",detail:h});continue}if(!(p.explicit||await nj(p.agents,r,n,c))){l.push({dir:c,agents:f,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${b(i(o))}`});continue}l.push({dir:c,agents:f,canonical:!1})}return l}function rj(e,t,r,n){if(t==="global")return Dr.default.dirname(n);let[o]=e.skillsDir.split(/[\\/]/);return Dr.default.join(r,o??e.skillsDir)}async function nj(e,t,r,n){for(let o of e)if(await sj(rj(o,t,r,n)))return!0;return!1}async function oj(e){let{discovered:t,groups:r,storeBase:n,mode:o,force:i,platform:s,display:a}=e,l=Dr.default.join(n,t.dir),c=await aj(t.path),p=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,f=e.recorded!==null&&p===null,m=await Q_({dest:l,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),g=[];for(let v of r){let F=v.canonical?l:Dr.default.join(v.dir,t.dir),E=v.canonical?"canonical":o;if(v.canonical||v.skipReason!==void 0){g.push({agent:eA(v),agents:v.agents.map(U=>U.id),label:tA(v),path:F,link:E,overwrite:v.canonical?m.overwrite:"fresh",blocked:v.canonical?m.blocked:!1,skipped:!v.canonical,...v.skipReason!==void 0?{skipReason:v.skipReason}:{},...v.detail!==void 0?{detail:v.detail}:{}});continue}let S=await Q_({dest:F,storePath:l,recorded:p,recordedUnverifiable:f,upstream:c,platform:s}),L=js(S.overwrite)&&!i;g.push({agent:eA(v),agents:v.agents.map(U=>U.id),label:tA(v),path:F,link:E,overwrite:S.overwrite,blocked:L,skipped:!1,...L?{detail:Z_(S,F,a)}:{}})}let h=js(m.overwrite)&&!i,y=g.find(v=>v.blocked),k=h?Z_(m,l,a):y?.detail;return{name:t.name,dir:t.dir,description:t.description,skillPath:t.skillPath,sourceDir:t.path,storePath:l,storeOverwrite:m.overwrite,upToDate:m.upToDate,targets:g,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:p,blocked:h||y!==void 0,...k!==void 0?{detail:k}:{}}}function Z_(e,t,r){return e.problem===void 0?nA(e.overwrite,t,r):`${b(r(t))} could not be verified: ${e.problem} It was not installed by the Webflow CLI, or has been changed since. Re-run with --force to replace it.`}async function Q_(e){let{dest:t,storePath:r,recorded:n,upstream:o,platform:i}=e,s=(c,p,f)=>({overwrite:c,upToDate:p,onDisk:f,blocked:!1}),a;try{a=await ai.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await ai.default.promises.readlink(t).catch(()=>null),p=c===null?null:Dr.default.resolve(Dr.default.dirname(t),c);return p!==null&&Ye(p,r)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await or(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:b(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(n===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(n!==null)return Mt(l,n,i)?s("managed-update",Mt(l,o,i),l):s("locally-modified",!1,l);if(Mt(l,o,i)){let c=await rA(t);return c===void 0?s("adoptable",!0,l):{overwrite:"unmanaged",upToDate:!1,onDisk:l,blocked:!1,problem:`it matches the pinned upstream content but also contains "${b(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function rA(e,t="",r=0){if(r>ei)return;let n;try{n=await ai.default.promises.readdir(e,{withFileTypes:!0})}catch{return}n.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of n){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(Zo.has(o.name))return i;let s=await rA(Dr.default.join(e,o.name),i,r+1);if(s!==void 0)return s;continue}if(!o.isFile()||Qo.has(o.name))return i}}function nA(e,t,r=n=>n){let n=b(r(t));return e==="locally-modified"?`${n} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${n} already exists, differs from the pinned upstream content, and was not installed by the Webflow CLI (no lockfile entry). It may be managed by another tool \u2014 the Claude Code plugin marketplace installs the same skills. Re-run with --force to take ownership and replace it.`}async function ij(e){let{groups:t,skills:r,display:n}=e,o=new Map(r.map(s=>[s.name,s.dir]));if(o.size===0)return[];let i=[];for(let s of t){if(s.skipReason!==void 0)continue;let a;try{a=await ai.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,p)=>c.name<p.name?-1:c.name>p.name?1:0);let l=ej;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let p=Dr.default.join(s.dir,c.name,Lt),f;try{f=ti(await ai.default.promises.readFile(p,"utf8")).frontmatter.name}catch{continue}let m=o.get(f);m===void 0||m===c.name||i.push(`${b(n(s.dir))} already contains "${b(c.name)}", whose ${Lt} declares the name "${b(f)}" \u2014 the same skill this install writes to "${b(m)}". Your agent would load it twice; remove one of them.`)}}return i}function Zd(e){let t=Dr.default.resolve(e);for(let r of QN){let n=process.env[r]?.trim();if(n&&ot(n,t))return r}}function eA(e){return e.agents[0]?.id??""}function tA(e){let t=e.agents.map(r=>r.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function sj(e){try{return await ai.default.promises.lstat(e),!0}catch{return!1}}async function aj(e){let t=await or(e);if(t!==null)return t;throw new d(`The extracted skill directory ${b(e)} is no longer present. Re-run the command.`)}Zi();var Bt=1,lA=/^sha256:[0-9a-f]{64}$/,Uy=128,Wy=1024,oA=256,lj=/[\x00-\x1f\x7f]/;function cA(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>Uy?`must be at most ${Uy} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":Ss(e)}function Qd(e){return e.trim()===""?"must not be empty":e.length>Wy?`must be at most ${Wy} characters`:Ss(e)}function iA(e){return(t,r)=>{let n=e(t);n!==null&&r.addIssue({code:B.ZodIssueCode.custom,message:n})}}var uA=B.string().regex(tr,"must be a 40-character lowercase commit SHA"),dA=B.string().regex(kd,"is not a usable git ref for this repository"),sA=B.string().regex(lA,'must look like "sha256:<64 lowercase hex>"'),cj=B.string().min(1,"must not be empty").max(Id).refine(e=>e.trim()!=="","must not be blank").refine(e=>!lj.test(e),"must not contain control characters"),aA=B.string().datetime({offset:!0}),pA=B.object({commit:uA,dir:B.string().superRefine(iA(cA)),skillPath:B.string().superRefine(iA(Qd)).optional(),contentHash:sA.optional(),modeHash:sA.optional(),ref:dA.optional(),agents:B.array(B.string().min(1).max(64)).default([]),mode:B.enum(["symlink","copy"]).default("symlink"),category:B.string().min(1).max(64).optional(),installedAt:aA.optional(),updatedAt:aA.optional()}).passthrough(),fA=B.object({repo:B.string().min(1).max(oA).default(ye),ref:dA.default(Ve),commit:uA.optional(),pluginVersion:B.string().min(1).max(oA).optional()}).passthrough(),mA=B.object({lockfileVersion:B.number().int().min(0),source:fA.default({}),skills:B.record(cj,pA).default({})}).passthrough();function gA(e){return e.length===0?"the lockfile":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function Hy(e){let[t]=e.issues;return t?`${gA([...t.path])} ${t.message}`:"did not match the expected shape"}function ep(e){return mA.safeParse(e)}var tp=w(require("path"));oa();C();var hA="webflow-skills-lock.json",yA="skills-lock.json";function li(e){if(typeof e!="string"||e.trim()==="")throw new d("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return tp.default.join(tp.default.resolve(e),hA)}function ci(){return tp.default.join(wi(),yA)}function Ll(e,t){return e==="global"?ci():li(t??"")}var bA=w(require("fs"));var uj=/^<{7}/m,dj=/^\uFEFF/;async function Hr(e){let t;try{t=await bA.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:pj(c)}}let r=t.replace(dj,"");if(uj.test(r))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(r.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let n;try{n=JSON.parse(r)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:fj(c,r)}}if(n===null||typeof n!="object"||Array.isArray(n))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${wA(n)}, not an object`};let o=n,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${wA(i)})`};let s=typeof i=="number"?i:0;if(s>Bt){let c=ep(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Bt?{...o,lockfileVersion:Bt}:o,l=ep(a);return l.success?s<Bt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:Hy(l.error)}}function pj(e){let t=e.code,r=e instanceof Error?e.message:String(e);return t?`${{EACCES:"permission denied",EPERM:"operation not permitted",EISDIR:"the path is a directory, not a file",ELOOP:"too many symbolic links",ENOTDIR:"a parent path component is not a directory"}[t]??r} (${t})`:r}function fj(e,t){let r=e instanceof Error?e.message:String(e),n=/position (\d+)/.exec(r);if(!n)return r;let o=Number(n[1]);if(!Number.isFinite(o)||o<0)return r;let i=t.slice(0,o),s=i.split(`
|
|
265
267
|
`).length,a=o-(i.lastIndexOf(`
|
|
266
|
-
`)+1)+1;return`${
|
|
267
|
-
${
|
|
268
|
-
${
|
|
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
|
|
270
|
-
${
|
|
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
|
|
272
|
-
`}async function
|
|
273
|
-
Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let
|
|
274
|
-
Available: ${
|
|
275
|
-
`))}u.info(
|
|
268
|
+
`)+1)+1;return`${r.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function wA(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="object"?"an object":typeof e=="string"?"a string":typeof e=="number"?"a number":typeof e=="boolean"?"a boolean":typeof e}function Nl(e,t){return e<t?-1:e>t?1:0}function Ms(e){return[...new Set(e)].sort(Nl)}function Bs(e){return{lockfileVersion:Bt,source:{repo:ye,ref:Ve,...e},skills:{}}}function Er(e){return Object.keys(e.skills).sort(Nl)}function rp(e){return Object.keys(e.skills).length===0}function jl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function Vy(e,t){return{...e,skills:{...e.skills,...t}}}function Gy(e,t){return{...e,source:{...e.source,...t}}}function Ky(e,t){let r=[],n=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],r.push(i)):n.push(i);return{lock:{...e,skills:o},removed:r,missing:n}}function Ml(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function Jy(e){let{installedAt:t,updatedAt:r,...n}=e;return n}var DA=require("crypto"),Us=w(require("fs")),Xy=w(require("path"));R();var kA=w(require("path"));C();function np(e){return b(kA.default.basename(e))}function zy(e){return b(e)}function ui(e){let t=np(e.path),r=b(e.detail);if(e.reason==="merge-conflict")return new d(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new d(`Could not read ${t}: ${r}.
|
|
269
|
+
${zy(e.path)}`,{isUserError:!0});let n=e.reason==="invalid-json"?`${t} is not valid JSON: ${r}`:`${t} is not a valid lockfile: ${r}`;return new d(`${n}.
|
|
270
|
+
${zy(e.path)}
|
|
271
|
+
Fix the file and re-run. It is not read as empty on purpose \u2014 that would discard the record of every installed skill on the next write.`,{isUserError:!0})}function di(e){return new d(`Your ${np(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${Bt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function qy(e,t){return new d(`Refusing to write ${np(e)}: it is at lockfile version ${t} and this CLI supports ${Bt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function Yy(e,t){let r=b(t instanceof Error?t.message:String(t));return new d(`Could not write ${np(e)}: ${r}.
|
|
272
|
+
${zy(e)}
|
|
273
|
+
Your skills are on disk but are not recorded, so 'webflow skills update' and 'webflow skills remove' will not see them. Fix the problem and re-run the same install \u2014 it adopts the existing directories and does not need --force.`)}var EA=420,vA=448,SA=8;function op(e){if(Array.isArray(e))return e.map(op);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(Nl).map(r=>[r,op(t[r])]))}return e}function mj(e,t){let r={};for(let[n,o]of Object.entries(e.skills)){let i={...o,agents:Ms(o.agents??[])};r[n]=t==="project"?Jy(i):i}return{...e,skills:r}}function xA(e,t){let r=mj(e,t.kind);return`${JSON.stringify(op(r),null,2)}
|
|
274
|
+
`}async function CA(e,t,r){if(t.lockfileVersion>Bt)throw qy(e,t.lockfileVersion);let n=Xy.default.resolve(e),o=Xy.default.dirname(n),i=xA(t,r),s=`${n}.${(0,DA.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Us.default.promises.mkdir(o,{recursive:!0,mode:vA});let l=await Us.default.promises.open(s,"wx",EA);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Us.default.promises.rename(s,n),a=!0}catch(l){throw Yy(e,l)}finally{a||await Us.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function Zy(e){try{return await Us.default.promises.unlink(e),!0}catch(t){return t.code!=="ENOENT"&&u.debug(`Could not remove the empty skills state file: ${t instanceof Error?t.message:String(t)}`),!1}}function pi(e){let t=e.batchSize??SA,r=e.lock,n=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await CA(e.path,r,{kind:e.kind}),n=0,i=!1,o+=1)},a=async()=>{n+=1,i=!0,n>=t&&await s()};return{get lock(){return r},get pendingCount(){return n},get flushCount(){return o},async record(l,c){r=Vy(r,{[l]:c}),await a()},async forget(l){let c=Ky(r,[l]);return r=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){r=Gy(r,l),i=!0},flush:s}}var FA="skills_install";async function sp(e,t){let r=Date.now(),n=Vt(),o=n?_.forSkills({authToken:n}):null;try{let i=await gj(e??[],t);await o?.sendUsage(FA,{duration:Date.now()-r,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),FA,{duration:Date.now()-r}),new d(i,{prefix:`${D} Failed to install skills:`,...i instanceof d&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function gj(e,t){let r=t.json===!0||Xe(),n=t.dryRun===!0,o=process.cwd(),i=await Hd({global:t.global,project:t.project,yes:t.yes},o,r),s=t.global!==!0&&t.project!==!0,a=i==="global"?de.home():o,l=Bd({cwd:o,home:de.home()}),c=i==="global"?"global":"project",p=Ll(c,a),f=await Hr(p);if(f.kind==="corrupt")throw ui(f);if(f.kind==="too-new")throw di(f);let m=f.kind==="ok"?f.lock:Bs({ref:t.ref??Ve}),g=Er(m),h=e.length===0&&t.allSkills!==!0&&g.length>0&&(V()||t.yes===!0);await Pl(st(i,a),{dryRun:n});let y=h?bj(m,g,t.ref):[null],k=[],v=[],F=!1,E=[],S=0,L=0;for(let ce of y){let Be=await hj({group:ce,names:e,options:t,scope:i,root:a,lock:m,display:l,json:r});Be!==null&&(k.push(Be.plan),F=F||Be.cacheHit,E=Be.agents,S=Math.max(S,Be.detectedCount),L+=Be.duplicateNameWarnings)}if(k.length===0||k.every(ce=>ce.skills.length===0))return r?u.info(JSON.stringify(Wd(Cj({plan:k[0]??null,scope:i,root:a,lockPath:p,dryRun:n,restore:h,cacheHit:F,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L});let U=k[0];if(n){let ce=RA({plans:k,materialized:[],dryRun:!0,restore:h,cacheHit:F,lockPath:p});if(r)u.info(JSON.stringify(Wd(ce),null,2));else{for(let Be of k)u.info(Ay(Be,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L})}if(t.yes!==!0&&!V()&&r)throw new d(`Installation requires confirmation, and --json cannot prompt.
|
|
275
|
+
Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let Be of k)u.info(Ay(Be,{dryRun:!1,display:l}));if(!await $e({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:[],agents:E,detectedCount:S,duplicateNameWarnings:L,cancelled:!0})}let N=pi({path:p,kind:c,lock:m}),te=new Date().toISOString();for(let ce of k)for(let Be of ce.skills){let A=await $l(ce,Be);v.push(A);let q=xj({plan:ce,skill:A,skillPath:Be.skillPath,existing:jl(N.lock,A.name),previousAgents:jl(m,A.name)?.agents??[],restore:h,kind:c,now:te});q!==null&&await N.record(A.name,q)}N.updateSource({repo:U.source.repo,ref:U.source.ref,commit:U.source.commit,pluginVersion:U.source.pluginVersion}),await N.flush({force:!0});let G=RA({plans:k,materialized:v,dryRun:!1,restore:h,cacheHit:F,lockPath:p});return r?u.info(JSON.stringify(Wd(G),null,2)):(u.info(P_(G,{display:l})),u.info(`Wrote ${l(p)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(G.failures.length>0||G.summary.blocked>0&&G.summary.installed===0)&&(process.exitCode=1),ip({scope:i,scopeAutoDetected:s,options:t,dryRun:n,restore:h,cacheHit:F,plans:k,materialized:v,agents:E,detectedCount:S,duplicateNameWarnings:L})}async function hj(e){let{group:t,names:r,options:n,scope:o,root:i,lock:s,display:a}=e,l=await As(t===null||t.commit===void 0?{ref:t?.ref??n.ref}:{commit:t.commit,ref:t.ref}),c=await Is(l.root),p=await $s(c.skillsDir,l.root),f=[...c.warnings,...p.warnings],m=await kj({discovered:p.skills,names:r,allSkills:n.allSkills===!0,restoreNames:t?.names,recordedNames:Er(s),warn:E=>f.push(E)});if(m.length===0)return null;let g=t===null?void 0:Ms(t.names.flatMap(E=>jl(s,E)?.agents??[])),h=await yj({scope:o,root:i,options:n,json:e.json,...g!==void 0&&g.length>0?{recordedAgents:g}:{}});for(let E of h.unknownRecorded)f.push(`The lockfile records the agent "${b(E)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=h.source==="explicit"||h.source==="prompt",k=h.agents.map(E=>({agent:E,explicit:y})),v={repo:ye,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},F=await Ol({scope:o,root:i,mode:t?.mode??(n.copy===!0?"copy":"symlink"),force:n.force===!0,source:v,skills:m,targets:k,recorded:s.skills,warnings:f,display:a});return{plan:F,cacheHit:l.fromCache,agents:h.agents,detectedCount:h.detected.length,duplicateNameWarnings:wj(F.warnings)}}async function yj(e){let{scope:t,root:r,options:n,json:o}=e,i={scope:t,cwd:r,options:{agent:n.agent,allAgents:n.allAgents,yes:n.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(n.agent?.length??0)>0||n.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await xl(t,r);if(a.length===0){let l=Pd(nr);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return Rl({...i,detected:a})}return Rl(i)}function wj(e){return e.filter(t=>t.includes("would load it twice")).length}function bj(e,t,r){let n=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=r===void 0?`${i.commit}|${i.mode}`:i.mode,l=n.get(a);if(l){l.names.push(o);continue}n.set(a,{...r===void 0?{commit:i.commit}:{},ref:r??s,mode:i.mode,names:[o]})}return[...n.values()]}async function kj(e){let{discovered:t,names:r,allSkills:n,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let p of o){let f=t.find(m=>m.name===p);if(f===void 0){s(`${b(p)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(f)}return c}let a=t.filter(c=>!c.internal);if(n)return a;if(r.length>0)return r.map(c=>Dj(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(V())throw new d(`No skills were named. Pass skill names, or --all-skills to install every skill in the catalog (${a.length} available).`,{isUserError:!0,missingFlag:"all-skills"});return vj(a,l)}function Dj(e,t){let r=yn(e,[...t]);if(r.kind==="match")return r.skill;throw r.kind==="ambiguous"?new d(`"${b(e)}" matches more than one skill: ${r.matches.map(n=>b(n.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new d(`No skill matches "${b(e)}".`+(r.candidates.length>0?`
|
|
276
|
+
Available: ${r.candidates.map(n=>b(n)).join(", ")}`:""),{isUserError:!0})}var Ej=20,_A=60;async function vj(e,t){let r=new Set(t.map(s=>s.name)),n=[...e].sort((s,a)=>AA(s.category??"",a.category??"")||AA(s.name,a.name)),o=await Cr({message:"Select skills to install",pageSize:Math.min(Ej,Math.max(4,n.length)),choices:n.map(s=>({value:s.name,name:`${b(s.name)} ${Sj(b(s.description))}`,checked:r.has(s.name)})),validate:s=>s.length>0?!0:"Select at least one skill, or press Ctrl-C to cancel."}),i=new Set(o??[]);return n.filter(s=>i.has(s.name))}function AA(e,t){return e<t?-1:e>t?1:0}function Sj(e){return e.length<=_A?e:`${e.slice(0,_A-1)}\u2026`}function xj(e){let{plan:t,skill:r,existing:n,restore:o,kind:i,now:s}=e;if(!(r.storeAction==="written"||r.storeAction==="adopted"||r.storeAction==="unchanged")||r.hashes===null)return null;let l=new Map(t.skills.find(f=>f.name===r.name)?.targets.map(f=>[f.path,f.agents])??[]),c=[];for(let f of r.targets)f.skipped===!0||!f.success||c.push(...l.get(f.path)??[f.agent]);o&&c.push(...e.previousAgents);let p={agents:Ms(c),commit:t.source.commit,contentHash:r.hashes.contentHash,modeHash:r.hashes.modeHash,dir:r.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?Ml(p,{...n?{existing:n}:{},now:s}):p}function RA(e){let{plans:t,materialized:r,dryRun:n,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(p=>p.skills),warnings:[...new Set(t.flatMap(p=>p.warnings))],blocked:t.flatMap(p=>p.blocked)},c=_y({plan:l,materialized:r,dryRun:n});return{plan:l,dryRun:n,restored:o,cacheHit:i,materialized:[...r],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(p=>p.source)}:{}}}function Cj(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:ye,ref:e.options.ref??Ve,commit:"",pluginVersion:""},skills:[],warnings:[],blocked:[]};return{plan:e.plan??t,dryRun:e.dryRun,restored:e.restore,cacheHit:e.cacheHit,materialized:[],lockfilePath:e.lockPath,blocked:[],failures:[],summary:{requested:0,installed:0,skipped:0,blocked:0,failed:0,storeWrites:0,symlinks:0,copies:0,symlinkFallbacks:0}}}function ip(e){let t=e.plans[0],r=e.plans.flatMap(i=>i.skills),n={};for(let i of r)n[i.storeOverwrite]=(n[i.storeOverwrite]??0)+1;let o=t?_y({plan:{...t,skills:r,blocked:[]},materialized:e.materialized,dryRun:e.dryRun}):null;return{count:o?.summary.installed??0,scope:e.scope,scopeAutoDetected:e.scopeAutoDetected,mode:t?.mode??(e.options.copy===!0?"copy":"symlink"),agentCount:e.agents.length,agentIds:e.agents.map(i=>i.id),detectedAgentCount:e.detectedCount,sharedDirTargetCount:r.reduce((i,s)=>i+s.targets.filter(a=>a.link==="canonical").length,0),symlinkFallbackCount:o?.summary.symlinkFallbacks??0,symlinkFallbackErrno:[...new Set(e.materialized.flatMap(i=>i.targets.filter(s=>s.symlinkFailed===!0).map(s=>s.errno??"unknown")))].sort(),skillNames:r.map(i=>i.name),refKind:Fj(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:n,blockedCount:o?.summary.blocked??0,skippedCount:o?.summary.skipped??0,warningCount:[...new Set(e.plans.flatMap(i=>i.warnings))].length,restored:e.restore,duplicateNameWarnings:e.duplicateNameWarnings,...e.cancelled===!0?{cancelled:!0}:{}}}function Fj(e){return e===void 0||e===Ve?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}Y();C();we();R();j();Z();var ap=w(require("fs")),Ws=w(require("path"));var _j=256;async function IA(e){let{scope:t,lock:r}=e,n=Ws.default.resolve(e.root),o=st(t,n),i=e.display??(p=>p),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let p of Object.keys(r.skills).sort()){let f=r.skills[p];c.add(f.dir),l.push(await Aj({name:p,entry:f,scope:t,root:n,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await Pj({scope:t,root:n,store:o,recordedDirs:c})),{scope:t,root:n,store:o,lockfile:e.lockfile,source:r.source,skills:l,warnings:a}}async function Aj(e){let{name:t,entry:r,scope:n,root:o,store:i,platform:s,display:a,warn:l}=e,c=Ws.default.join(i,r.dir),p=Ij(r),f=await or(c),m={name:t,dir:r.dir,description:await $j(c),scope:n,status:"up-to-date",mode:r.mode,storePath:c,recordedHash:r.contentHash??null,onDiskHash:f?.contentHash??null,...r.skillPath!==void 0?{skillPath:r.skillPath}:{},...r.commit!==void 0?{commit:r.commit}:{},...r.ref!==void 0?{ref:r.ref}:{},...r.category!==void 0?{category:r.category}:{},agents:[]},g=[],h;for(let y of r.agents){let k=Br(y);if(k===void 0){g.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${b(t)} records the agent "${b(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let v=jt(k,n,o);if(v===null){g.push({id:y,label:k.displayName,path:null,link:"missing",present:!1});continue}let F=Ws.default.join(v,r.dir);if(Ye(F,c)){g.push({id:y,label:k.displayName,path:F,link:"canonical",present:f!==null});continue}let E=await Tj(F);if(E==="missing"){g.push({id:y,label:k.displayName,path:F,link:"missing",present:!1}),l(`${b(t)} is recorded for ${b(k.displayName)} but ${b(a(F))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let S=!1;if(r.mode==="copy"&&E==="copy"&&p!==null){let L=await or(F);S=L===null||!Mt(L,p,s),S&&h===void 0&&(h=k.displayName)}g.push({id:y,label:k.displayName,path:F,link:E,present:!0,...S?{diverged:!0}:{}})}return{...m,agents:g,...Rj({onDisk:f,recorded:p,platform:s,divergedLabel:h})}}function Rj(e){let{onDisk:t,recorded:r,platform:n,divergedLabel:o}=e;return t===null?{status:"missing"}:r!==null&&!Mt(t,r,n)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${b(o)} copy diverges`}:{status:"up-to-date"}}function Ij(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function Tj(e){try{let t=await ap.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function Pj(e){let{scope:t,store:r,recordedDirs:n}=e,o;try{o=await ap.default.promises.readdir(r,{withFileTypes:!0})}catch{return[]}let i=[],s=_j;for(let a of[...o].sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0)){if(s<=0)break;if(!a.isDirectory()&&!a.isSymbolicLink()||n.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=Ws.default.join(r,a.name),c=await or(l);if(c===null)continue;let p=await TA(l);p!==null&&DF(p.name)&&i.push({name:p.name,dir:a.name,description:p.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function $j(e){return(await TA(e))?.description??""}async function TA(e){try{let t=await ap.default.promises.readFile(Ws.default.join(e,Lt),"utf8"),r=ti(t);return{name:r.frontmatter.name,description:r.frontmatter.description}}catch{return null}}var PA="skills_list",Oj="name",Lj=dt(ii);async function lp(e){let t=Date.now(),r=Vt(),n=r?_.forSkills({authToken:r}):null;try{let o=await Nj(e);await n?.sendUsage(PA,{duration:Date.now()-t,...o})}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),PA,{duration:Date.now()-t}),new d(o,{prefix:`${D} Failed to list skills:`,...o instanceof d&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function Nj(e){let t=e.json===!0||Xe(),r=process.cwd(),n=Bd({cwd:r,home:de.home()}),o=[],i=Mj(e.fields,o),s=Bj(e.sortBy),a=Uj(e.order),l=Wj(e.agent),c=jj(e),p=[],f=0;for(let h of c){let y=h==="global"?de.home():r,k=Ll(h==="global"?"global":"project",y),v=await Hr(k),F;if(v.kind==="ok")F=v.lock;else if(v.kind==="too-new")F=v.lock??Bs(),o.push(`${n(k)} was written by a newer Webflow CLI (lockfile version ${v.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(v.kind==="corrupt"){o.push(`Skipped ${n(k)} \u2014 ${v.detail}. Fix the file and re-run.`);continue}else F=Bs();let E=await IA({scope:h,root:y,lockfile:k,lock:F,display:n});o.push(...E.warnings),f+=E.skills.length,l!==null&&(E.skills=E.skills.filter(S=>S.agents.some(L=>l.has(L.id)))),E.skills.sort(M_(s,a)),p.push(E)}let m=Ry(p);if(t)return u.info(JSON.stringify(j_({inventories:p,warnings:o}),null,2)),Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&f>0?`No skills are linked into ${[...l].sort().join(", ")}. ${f} ${f===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${f===1?"it":"them"}.`:Iy);for(let h of Ud(o))u.info(h);return Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}let g=[];for(let h of p){if(h.skills.length===0)continue;let y=L_(h.skills,{store:h.store,display:n});g.push([N_(h,{display:n}),"",$_(h.skills,i),...y===""?[]:["",y]].join(`
|
|
277
|
+
`))}u.info(g.join(`
|
|
276
278
|
|
|
277
|
-
`));for(let
|
|
278
|
-
Remove those first, or run \`webflow skills remove ${
|
|
279
|
-
It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${
|
|
280
|
-
Name one of them exactly.`,{isUserError:!0,prefix:`${
|
|
281
|
-
`+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>
|
|
282
|
-
Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${
|
|
283
|
-
Name one of them exactly.`,{isUserError:!0,prefix:`${
|
|
284
|
-
`+a.map(l=>` ${l.state.scope}: ${
|
|
279
|
+
`));for(let h of Ud(o))u.info(h);return Qy({inventories:p,summary:m,fields:i,json:t,agentFilter:l})}function jj(e){if(e.global===!0&&e.project===!0)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function Mj(e,t){let r=(e??Tl).split(",").map(i=>i.trim()).filter(Boolean),{valid:n,invalid:o}=Lj(r);if(n.length===0)throw new d(`No valid fields specified. Available: ${ii.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${ii.join(", ")}`),n}function Bj(e){if(e===void 0||e==="")return Oj;let t=Ns.find(r=>r===e.trim().toLowerCase());if(t===void 0)throw new d(`Cannot sort by "${e}". Available: ${Ns.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function Uj(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new d(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function Wj(e){let t=Os(e);return t.length===0?null:new Set(Ls(t).map(r=>r.id))}function Qy(e){let t=new Set;for(let r of e.inventories)for(let n of r.skills)for(let o of n.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(r=>r.scope),statusCounts:{upToDate:e.summary.upToDate,modified:e.summary.modified,missing:e.summary.missing,unmanaged:e.summary.unmanaged},agentIds:[...t].sort(),json:e.json,fieldCount:e.fields.length,agentFiltered:e.agentFilter!==null}}var Ft=w(require("fs")),Bl=w(require("os")),at=w(require("path"));Y();C();we();Oe();R();j();Z();async function pp(e,t){let r=Date.now(),n=s1();try{let o=t.json===!0||Xe(),i=await Hj(e,t,o);await n?.sendUsage("skills_remove",{duration:Date.now()-r,count:i.summary.requested,removed:i.summary.removed,storeDeleted:i.summary.storeDeleted,storeKept:i.summary.storeKept,failed:i.summary.failed,dryRun:i.dryRun,agentFiltered:i.agents!==null}),t1(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await n?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-r,dryRun:t.dryRun===!0}),o instanceof d?o:new d(o,{prefix:`${D} Failed to remove skills:`})}}async function Hj(e,t,r){let n=process.cwd(),o=[],i=t.dryRun===!0,s=await Hd(t,n,r),a=s==="global"?Bl.default.homedir():n,l=st(s,a),c=s==="global"?ci():li(a),p=await Hr(c);if(p.kind==="corrupt")throw ui(p);if(p.kind==="too-new")throw di(p);let f=p.kind==="ok"?p.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=Os(t.agent),h=m.length===0||m.includes(Al)?null:Ls(m).map(A=>A.id),y=Ur(s),k=await Vj({agents:y,scope:s,root:a,storeBase:l,warnings:o}),v=jA(k.dirNames,f),F=await Kj({names:e,options:t,identities:v,scope:s,cwd:n,json:r,warnings:o});if(F.length===0)return NA({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let E=new Set(h??[...ni,nr]);if(h?.includes(nr))for(let A of F){let q=(A.entry?.agents??[]).filter(W=>W!==nr&&!E.has(W));if(q.length>0)throw new d(`Cannot remove the shared store for "${b(A.name)}" while ${q.map(W=>b(W)).join(", ")} still link to it.
|
|
280
|
+
Remove those first, or run \`webflow skills remove ${b(A.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${D} Cannot remove skills:`})}let S=[];for(let A of F)S.push(await zj({identity:A,agents:h===null?y:y.filter(q=>h.includes(q.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:E}));if(i)return{...ew({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:S.map(A=>o1(A,s)),summary:{requested:S.length,removed:0,storeDeleted:S.filter(A=>A.storeWillBeDeleted).length,storeKept:S.filter(A=>A.onDisk&&!A.storeWillBeDeleted).length,staleLockEntriesRemoved:S.filter(A=>!A.onDisk).length,failed:0},lockfileEmpty:n1(f,S),lockfileDeleted:!1};if(!await e1(S,s,t,r))return r||u.info("Removal cancelled \u2014 no changes made."),NA({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f});let L=new Set(k.skillDirs),U=pi({path:c,kind:s,lock:f}),N=[],te=[],G=[];for(let A of S){let q=F.find(W=>W.dir===A.dir);te.push(await Yj({plan:A,identity:q,scope:s,root:a,storeBase:l,knownDirs:L,writer:U,failures:N,removedDirectories:G}))}await U.flush({force:!0});let ce=rp(U.lock),Be=!1;return ce&&s==="global"&&(Be=await Zy(c)),{...ew({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:h,warnings:o,lock:f,plans:S}),skills:te,removedDirectories:G,failures:N,summary:{requested:S.length,removed:te.filter(A=>A.success).length,storeDeleted:te.filter(A=>A.storeAction==="deleted").length,storeKept:te.filter(A=>A.storeAction==="kept").length,staleLockEntriesRemoved:te.filter(A=>A.storeAction==="absent"&&A.lockEntry==="removed").length,failed:N.length},lockfileEmpty:ce,lockfileDeleted:Be}}async function Vj(e){let{agents:t,scope:r,root:n,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...rw(t,r,n,l)]){if(await i1(c)){i.push(`${Ul(c)} is a symbolic link, not a directory. Skills are not removed through one \u2014 repoint or replace it, then re-run.`);continue}a.add(c);let p;try{p=await Ft.default.promises.readdir(c,{withFileTypes:!0})}catch(f){let m=f.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${Ul(c)}: ${tw(f)}`);continue}for(let f of p)(f.isDirectory()||f.isSymbolicLink())&&s.add(f.name)}return{dirNames:s,skillDirs:a}}function rw(e,t,r,n){let o=new Set;for(let i of e){try{let a=jt(i,t,r);if(a!==null){if(ot(r,a))o.add(a);else if(n){let l=Zd(a);n(`${Ul(a)} resolves outside ${Ul(r)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=at.default.resolve(r,...i.skillsDir.split("/"));s.startsWith(at.default.resolve(r)+at.default.sep)&&o.add(s)}return[...o]}function jA(e,t){let r=new Map;for(let n of e)r.set(n,{name:n,dir:n,folderName:n,entry:null});for(let n of Er(t)){let o=t.skills[n];r.set(o.dir,{name:n,dir:o.dir,folderName:o.skillPath?Zn(o.skillPath):o.dir,entry:o})}return[...r.values()]}function cp(e){return e.entry===null}function Gj(e){return new d(`"${b(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
|
|
281
|
+
It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${D} Refusing to remove an unmanaged skill directory:`})}async function Kj(e){let{names:t,options:r,identities:n,scope:o,cwd:i,json:s,warnings:a}=e,l=r.force===!0,c=n.filter(g=>!cp(g)),p=n.filter(cp);if(t.length>0){let g=[];for(let h of t){let y=yn(h,n);if(y.kind==="match"){if(!l&&cp(y.skill))throw Gj(y.skill);g.includes(y.skill)||g.push(y.skill);continue}throw y.kind==="ambiguous"?new d(`"${b(h)}" matches ${y.matches.length} installed skills: ${y.matches.map(k=>b(k.dir)).join(", ")}.
|
|
282
|
+
Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot remove skills:`}):await Jj(h,y.candidates,o,i)}return g}if(r.all)return l?n:($A(p,a),c);if(V()||s)throw new d("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${D} Nothing to remove:`});let f=l?n:c;return l||$A(p,a),f.length===0?[]:await Cr({message:`Which skills should be removed (${o} scope)?`,choices:f.map(g=>({value:g,name:`${b(g.dir)}${cp(g)?" (not in the lockfile)":""}`})),validate:g=>g.length>0?!0:"Select at least one skill."})??[]}function $A(e,t){e.length!==0&&t.push(`${e.length} skill ${e.length===1?"directory":"directories"} have no lockfile entry and were left untouched: ${e.map(r=>b(r.dir)).join(", ")}. Pass --force to remove them too.`)}async function Jj(e,t,r,n){let o=r==="project"?"global":"project",i=o==="global"?Bl.default.homedir():n,s=o==="global"?ci():li(i),a=await Hr(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await Ft.default.promises.readdir(st(o,i)).catch(()=>[]);if(yn(e,jA(c,l)).kind!=="none")return new d(`"${b(e)}" is not installed at ${r} scope (${Ul(r==="global"?Bl.default.homedir():n)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${D} Cannot remove skills:`})}}return new d(`"${b(e)}" is not installed at ${r} scope.
|
|
283
|
+
`+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>b(l)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot remove skills:`})}async function zj(e){let{identity:t,agents:r,scope:n,root:o,storeBase:i,removalTargets:s}=e,a=at.default.join(i,t.dir),l=new Map;for(let m of r)for(let g of rw([m],n,o)){let h=at.default.join(g,t.dir);if(Ye(h,a))continue;let y=l.get(h);if(y){y.agents.push(m.id);continue}await dp(h)&&l.set(h,{agent:m.id,agents:[m.id],label:m.displayName,path:h})}let c=[...l.values()].sort((m,g)=>m.path<g.path?-1:m.path>g.path?1:0),{deleted:p,keptBecause:f}=await qj({identity:t,allAgents:e.allAgents,scope:n,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await dp(a),targets:c,storeWillBeDeleted:p,keptBecause:f}}async function qj(e){let{identity:t,removalTargets:r}=e,n=t.entry?.agents??[];if(n.length>0){let i=n.filter(s=>!r.has(s)).sort((s,a)=>s<a?-1:s>a?1:0);return{deleted:i.length===0,keptBecause:i}}let o=[];for(let i of e.allAgents)if(!r.has(i.id))for(let s of rw([i],e.scope,e.root)){let a=at.default.join(s,t.dir);if(!Ye(a,at.default.join(e.storeBase,t.dir))&&await dp(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function Yj(e){let{plan:t,identity:r,scope:n,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let f of t.targets){let m=await dp(f.path);try{await OA({target:f.path,slug:t.dir,knownDirs:o,root:e.root}),await LA(f.path),a.push({...f,action:m?"unlinked":"absent",error:null})}catch(g){l=!0;let h=tw(g);s.push({name:r.name,agent:f.agent,...up(g)!==void 0?{errno:up(g)}:{},message:h}),a.push({...f,action:"failed",error:h})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await OA({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await LA(t.storePath),c="deleted"}catch(f){l=!0,c="failed",s.push({name:r.name,...up(f)!==void 0?{errno:up(f)}:{},message:tw(f)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let p="absent";return!l&&r.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(r.name,{...r.entry,agents:t.keptBecause}),p="updated"):p=await i.forget(r.name)?"removed":"absent"),l||e.removedDirectories.push(...await Zj({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:n})),{name:r.name,dir:t.dir,scope:n,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:p,targets:a,success:!l,error:null}}async function OA(e){let{target:t,slug:r,knownDirs:n,root:o}=e;if(at.default.basename(t)!==r)throw new d(`Refusing to delete ${b(t)}: its final component is not "${b(r)}".`);let i=at.default.dirname(t),s;try{s=await Ft.default.promises.realpath(i)}catch{throw new d(`Refusing to delete ${b(t)}: its parent directory ${b(i)} could not be resolved.`)}if(!await Xj(n,s))throw new d(`Refusing to delete ${b(t)}: ${b(i)} is not a known skills directory.`);let l=await Ft.default.promises.realpath(o).catch(()=>o);if(Ye(s,l))throw new d(`Refusing to delete ${b(t)}: ${b(i)} resolves to the scope root itself, not to a skills directory.`);Me(l,at.default.join(s,at.default.basename(t)),"a skill directory being removed")}async function Xj(e,t){for(let r of e){if(Ye(r,t))return!0;let n=await Ft.default.promises.realpath(r).catch(()=>null);if(n!==null&&Ye(n,t))return!0}return!1}async function LA(e){let t=null;try{t=await Ft.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await Ft.default.promises.rm(e,{force:!0});return}await Ft.default.promises.rm(e,{recursive:!0,force:!0})}async function Zj(e){let t=[],r=new Set([e.root,Bl.default.homedir(),at.default.dirname(e.root)].map(o=>at.default.resolve(o))),n=[];for(let o of e.targets)n.push(at.default.dirname(o.path));e.storeDeleted&&n.push(e.storeBase,at.default.dirname(e.storeBase));for(let o of n){let i=at.default.resolve(o);if(!r.has(i)&&ot(e.root,i))try{let s=await Ft.default.promises.realpath(i);if(r.has(s)||!await Qj(e.root,s))continue;await Ft.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function Qj(e,t){let r=await Ft.default.promises.realpath(e).catch(()=>e);return ot(r,t)&&!Ye(r,t)}async function e1(e,t,r,n){if(r.yes)return!0;if(V()||n)throw new d(`Removal requires confirmation in non-interactive mode.
|
|
284
|
+
Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} Cannot remove skills:`});return u.info(Ty(e,t)),$e({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function t1(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${X} ${b(r)}`);if(e.dryRun){u.info(Ty(e.skills.map(r=>({name:r.name,dir:r.dir,storePath:r.storePath,onDisk:r.storeAction!=="absent",targets:r.targets,storeWillBeDeleted:r.storeAction==="deleted",keptBecause:r.keptBecause})),e.scope,{dryRun:!0}));return}u.info(U_(e))}function r1(e,t){let r=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&r.add(i)}if(r.size!==1)return null;let[n]=[...r];return n==="copy"?"copy":"symlink"}function ew(e){return{kind:"skills.remove",schemaVersion:eo,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:r1(e.plans,e.lock),source:{...e.lock.source},agents:e.filterIds,skills:[],removedDirectories:[],failures:[],summary:{requested:0,removed:0,storeDeleted:0,storeKept:0,staleLockEntriesRemoved:0,failed:0},lockfileEmpty:!1,lockfileDeleted:!1,warnings:[...new Set(e.warnings)]}}function NA(e){return{...ew(e),lockfileEmpty:rp(e.lock)}}function n1(e,t){let r=new Set(t.filter(n=>n.keptBecause.length===0).map(n=>n.name));return Er(e).every(n=>r.has(n))}function o1(e,t){return{name:e.name,dir:e.dir,scope:t,storePath:e.storePath,storeAction:e.onDisk?e.storeWillBeDeleted?"deleted":"kept":"absent",keptBecause:e.keptBecause,lockEntry:e.keptBecause.length>0?"updated":"removed",targets:e.targets.map(r=>({...r,action:"unlinked",error:null})),success:!0,error:null}}async function i1(e){try{return(await Ft.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function dp(e){try{return await Ft.default.promises.lstat(e),!0}catch{return!1}}function up(e){let t=e?.code;return typeof t=="string"?t:void 0}function tw(e){return b(e instanceof Error?e.message:String(e))}function s1(){let e=Vt();return e?_.forSkills({authToken:e}):null}function Ul(e){return oi(e)}var Hs=w(require("fs")),UA=w(require("os")),vr=w(require("path"));Y();C();we();Oe();R();j();Z();function WA(e){let{presence:t,upstream:r,local:n,force:o}=e;if(!e.hasSkillPath){if(!e.foundByName)return{guard:"G2",state:"untracked",action:"skipped",willWrite:!1,blocked:!1,reason:"tracking-unrepairable"};let c=n==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:n==="absent"||r==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(n==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(n==="absent")return{guard:"G4",state:"missing",action:"reinstalled",willWrite:!0,blocked:!1,reason:"store-directory-missing"};if(t==="missing")return{guard:"G5",state:"removed-upstream",action:"orphaned",willWrite:!1,blocked:!1,reason:n==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":n==="differs"?r==="differs"?"conflict":"locally-modified":r==="differs"?"upstream-changed":"unchanged";if(n==="same")return i?{guard:"grid",state:s,action:r==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:r==="differs"?{guard:"grid",state:s,action:"updated",willWrite:!0,blocked:!1,reason:null}:{guard:"grid",state:s,action:"unchanged",willWrite:!1,blocked:!1,reason:null};let a=i?r==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":r==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?r==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&r==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function fp(e,t){let r=Date.now(),n=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new d("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${D} Cannot update skills:`});let i=R1(),s=t.json===!0||Xe();try{let a=await a1({names:e,options:t,checkOnly:n,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-r,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:n,force:o,scopeCount:a.scopes.length}),_1(a,s),(a.failures.length>0||!n&&a.summary.conflicts>0&&a.summary.updated===0)&&(process.exitCode=1)}catch(a){throw await i?.sendError(a instanceof Error?a:new Error(String(a)),"skills_update",{duration:Date.now()-r,checkOnly:n,force:o}),a instanceof d?a:new d(a,{prefix:`${D} Failed to update skills:`})}}async function a1(e){let{names:t,options:r,checkOnly:n,force:o,json:i}=e,s=[],a=process.cwd(),l=await l1(r,a,n,s);if(l.length===0)return ow({checkOnly:n,force:o,warnings:s});let c=c1(l,t,r);if(c.length===0)return ow({checkOnly:n,force:o,warnings:s,scopes:l.map(S=>S.scope)});let p=new Map;for(let{state:S,key:L}of c){let U=nw(r,S.lock,L);p.has(U)||p.set(U,(await kl(U)).commit)}let f=new Map;for(let{state:S,key:L}of c){let U=S.lock.skills[L];f.set(`${S.scope}\0${L}`,await f1(S,U))}let m=c.every(({state:S,key:L})=>{let U=S.lock.skills[L];return p.get(nw(r,S.lock,L))===U.commit}),g=c.every(({state:S,key:L})=>f.get(`${S.scope}\0${L}`)!==null);if(m&&g&&r.ref===void 0&&!o)return F1({selected:c,states:l,localDigests:f,refs:p,options:r,checkOnly:n,force:o,warnings:s});let h=new Map;for(let S of new Set(p.values()))h.set(S,await p1(S,s));let y=[],k=[];for(let{state:S,key:L}of c){let U=S.lock.skills[L],N=nw(r,S.lock,L),te=p.get(N),G=h.get(te);try{y.push(await m1({state:S,key:L,entry:U,ref:N,commit:te,catalog:G,force:o,checkOnly:n,localDigest:f.get(`${S.scope}\0${L}`)??null,warnings:s}))}catch(ce){k.push({name:L,errno:BA(ce),message:iw(ce)})}}let v=y.filter(S=>S.localDrift==="differs"&&S.outcome.willWrite);if(!n&&v.length>0&&!await v1(v,r,i))return ow({checkOnly:n,force:o,warnings:s,scopes:l.map(L=>L.scope),cancelled:!0});let F=new Map,E=[];if(!n)for(let S of l)S.readOnly||await Pl(S.storeBase,{dryRun:!1});for(let S of y)try{E.push(await y1({candidate:S,checkOnly:n,force:o,options:r,writers:F,failures:k,warnings:s}))}catch(L){k.push({name:S.key,errno:BA(L),message:iw(L)}),E.push(S1(S,iw(L)))}if(r.ref!==void 0&&!n)for(let S of l)S.readOnly||HA(S,F);for(let[S,L]of F){let U=l.find(ce=>ce.scope===S),N=r.ref??U.lock.source.ref??Ve,te=p.get(N)??y.find(ce=>ce.scopeState.scope===S)?.commit,G=JA(h);L.updateSource({ref:N,...te!==void 0?{commit:te}:{},...G!==void 0?{pluginVersion:G}:{}}),await L.flush({force:!0})}return C1({reports:E,candidates:y,failures:k,states:l,refs:p,catalogs:h,options:r,checkOnly:n,force:o,warnings:s})}async function l1(e,t,r,n){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?UA.default.homedir():t,l=s==="global"?ci():li(a),c=await Hr(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw ui(c);if(c.kind==="too-new"){if(!r||c.lock===null)throw di(c);n.push(`${Hl(l)} was written by a newer Webflow CLI (lockfile version ${c.version}); reporting read-only.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:st(s,a),readOnly:!0});continue}c.migratedFrom!==void 0&&n.push(`${Hl(l)} uses lockfile version ${c.migratedFrom}; the next write upgrades it.`),i.push({scope:s,root:a,lockPath:l,lock:c.lock,storeBase:st(s,a),readOnly:r})}}return i}function c1(e,t,r){if(t.length===0)return e.flatMap(s=>Er(s.lock).map(a=>({state:s,key:a})));let n=r.global===!0||r.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=yn(s,d1(l.lock));if(c.kind==="ambiguous")throw new d(`"${b(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(p=>b(p.name)).join(", ")}.
|
|
285
|
+
Name one of them exactly.`,{isUserError:!0,prefix:`${D} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw u1(s,e);if(a.length>1&&!n)throw new d(`"${b(s)}" is installed at more than one scope:
|
|
286
|
+
`+a.map(l=>` ${l.state.scope}: ${Hl(l.state.lockPath)}`).join(`
|
|
285
287
|
`)+`
|
|
286
|
-
Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${
|
|
287
|
-
`+(
|
|
288
|
-
`+e.map(
|
|
288
|
+
Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${D} Cannot update skills:`});for(let l of a){let c=`${l.state.scope}\0${l.key}`;i.has(c)||(i.add(c),o.push(l))}}return o}function u1(e,t){let r=t.flatMap(n=>Er(n.lock).map(o=>n.lock.skills[o]?.dir??o));return new d(`"${b(e)}" is not installed.
|
|
289
|
+
`+(r.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(r)].sort().map(n=>b(n)).join(", ")}`),{isUserError:!0,prefix:`${D} Cannot update skills:`})}function d1(e){return Er(e).map(t=>{let r=e.skills[t];return{name:t,dir:r.dir,folderName:r.skillPath?Zn(r.skillPath):r.dir}})}function nw(e,t,r){return e.ref??t.skills[r]?.ref??t.source.ref??Ve}async function p1(e,t){let r=await As({commit:e}),n=await Is(r.root),o=await $s(n.skillsDir,r.root);return t.push(...n.warnings,...o.warnings),{commit:e,root:r.root,pluginVersion:n.version,skills:o.skills}}async function f1(e,t){let r=vr.default.join(e.storeBase,t.dir),n=await or(r);if(n===null)return null;if(t.mode!=="copy")return n;let o=aw(t);if(o===null)return n;for(let i of A1(t)){let s=jt(i,e.scope,e.root);if(s===null)continue;let a=await or(vr.default.join(s,t.dir));if(a!==null&&!Mt(a,o))return a}return n}async function m1(e){let{state:t,key:r,entry:n,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=aw(n),p=vr.default.join(t.storeBase,n.dir),f=g1(n,s,l,r),m=s.skills.find(te=>te.name===r)??null,g=f!==null?"exists":m!==null?"moved":"missing",h=g==="exists"?f:g==="moved"?m.path:null,y=h===null?null:await or(h),k=e.localDigest===null?"absent":c===null||Mt(e.localDigest,c)?"same":"differs",v=Mt(y,c)?"same":"differs",F=WA({hasSkillPath:typeof n.skillPath=="string"&&n.skillPath!=="",foundByName:m!==null,presence:g,upstream:v,local:k,force:a}),E=g==="moved"&&m!==null?m.dir:n.dir,S=g==="exists"?n.skillPath:g==="moved"?m.skillPath:n.skillPath??null,{agents:L,dropped:U}=h1(t,n,l),N=h===null||S===null?null:{name:r,dir:E,folderName:Zn(S),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:h,skillPath:S,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:r,entry:n,dir:n.dir,newDir:E,storeDir:p,mode:n.mode,agents:L,droppedAgents:U,presence:g,upstreamDrift:v,localDrift:k,outcome:F,recorded:c,onDisk:e.localDigest,upstream:y,discovered:N,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:x1(F,{key:r,storeDir:p,recordedSkillPath:n.skillPath??null,newSkillPath:S,checkOnly:e.checkOnly})}}function g1(e,t,r,n){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=Qd(o);if(i!==null)return r.push(`The recorded path for "${b(n)}" ${i}; locating it by name instead.`),null;let s=vr.default.resolve(t.root,...o.split("/"));return Me(t.root,s,"the recorded skill path"),Hs.default.existsSync(s)?vr.default.dirname(s):null}function h1(e,t,r){let n=[],o=[];for(let i of t.agents??[]){if(i===nr){n.push(i);continue}let s=Br(i);if(s===void 0){n.push(i);continue}if(jt(s,e.scope,e.root)===null){o.push(i),r.push(`${b(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}n.push(i)}return{agents:n,dropped:o}}async function y1(e){let{candidate:t,checkOnly:r,force:n,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Wl(t,r,[]);let l=await w1(t,n),c=new Set(t.droppedAgents);for(let h of l.targets)if(h.skipReason==="agent-dir-absent")for(let y of h.agents)c.add(y);e.warnings.push(...l.warnings);let p=t.agents.filter(h=>!c.has(h));if(p.length===0&&p.push(nr),r)return Wl(t,!0,l.targets.map(h=>sw(h)),[...c]);let f,m=t.onDisk;if(a.willWrite){let h=await $l(l.plan,l.skill);if(f=h.targets.map((y,k)=>VA(y,l.targets[k])),m=h.hashes,!h.success||h.storeAction==="failed"){let y=h.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let k of h.targets)!k.success&&k.error&&s.push({name:t.key,agent:k.agent,...k.errno!==void 0?{errno:k.errno}:{},message:k.error});return{...Wl(t,!1,f,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await k1(t,l.targets)}else{f=[];for(let h of l.targets)f.push(await b1(t,h))}let g=p.length!==(t.entry.agents??[]).length||p.some((h,y)=>(t.entry.agents??[])[y]!==h);return D1(t,a,g,o)&&!t.scopeState.readOnly&&await HA(t.scopeState,i).record(t.key,E1(t,m,a,o,p)),Wl(t,!1,f,[...c])}async function w1(e,t){let r={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},n=[];for(let s of e.agents){if(s===nr)continue;let a=Br(s);a!==void 0&&n.push({agent:a,explicit:!1})}let o=await Ol({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:r,skills:[e.discovered],targets:n,recorded:e.scopeState.lock.skills,platform:process.platform,display:Hl}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function b1(e,t){if(t.skipped||t.link==="canonical")return sw(t);if(t.overwrite!=="fresh")return{...sw(t),action:"unchanged"};let r=await Xd({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...VA(r,t),action:r.success?"relinked":"failed"}}async function k1(e,t){let r=e.dir,n=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>vr.default.dirname(i.path))];for(let i of new Set(o)){let s=vr.default.join(i,r);if(vr.default.basename(s)===r&&s!==vr.default.join(i,e.newDir))try{let a=await Hs.default.promises.realpath(i);if(!ot(n,a))continue;await vs(n,vr.default.join(a,r),"a renamed skill directory"),(await Hs.default.promises.lstat(s)).isSymbolicLink()?await Hs.default.promises.rm(s,{force:!0}):await Hs.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function D1(e,t,r,n){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||n.ref!==void 0&&n.ref!==e.entry.ref?!0:r}function E1(e,t,r,n,o){let i=r.willWrite,s={...e.entry,commit:i?e.commit:e.entry.commit,dir:i?e.newDir:e.entry.dir,agents:[...o],mode:e.mode,...e.discovered!==null?{skillPath:e.discovered.skillPath}:{},...n.ref!==void 0?{ref:n.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?Ml(s,{existing:e.entry,now:new Date().toISOString()}):s}function HA(e,t){let r=t.get(e.scope);if(r)return r;let n=pi({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,n),n}async function v1(e,t,r){if(t.yes)return!0;if(V()||r)throw new d(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
|
|
290
|
+
`+e.map(n=>` ${b(n.key)}`).join(`
|
|
289
291
|
`)+`
|
|
290
|
-
Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${
|
|
291
|
-
With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(
|
|
292
|
-
`).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[
|
|
292
|
+
Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${D} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let n of e)u.warn(` ${b(n.key)}`);return $e({message:"Discard local changes and replace with upstream?",default:!1})}function Wl(e,t,r,n=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:GA(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!n.includes(o)),droppedAgents:n,reason:e.outcome.reason,detail:e.detail,fromCommit:e.entry.commit,toCommit:e.outcome.willWrite?e.commit:null,skillPath:e.discovered?.skillPath??e.entry.skillPath??null,targets:r}}function S1(e,t){return{...Wl(e,!1,[]),state:"failed",action:"failed",detail:t}}function sw(e){return{agent:e.agent,agents:e.agents,label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.overwrite==="fresh"?"relinked":"unchanged",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:!1,errno:null,error:e.detail??null}}function VA(e,t){return{agent:e.agent,agents:t?.agents??[e.agent],label:e.label,path:e.path,link:e.link,action:e.skipped?e.skipReason==="agent-dir-absent"?"unlinked":"skipped":e.success?"linked":"failed",skipped:e.skipped===!0,skipReason:e.skipReason??null,symlinkFailed:e.symlinkFailed===!0,errno:e.errno??null,error:e.error??null}}function GA(e,t){if(!t)return e;switch(e){case"updated":return"would-update";case"moved":return"would-move";case"moved+updated":return"would-move-and-update";case"reinstalled":return"would-reinstall";case"repaired":return"would-repair";default:return e}}function x1(e,t){let r=b(t.key),{checkOnly:n}=t;switch(e.reason){case"tracking-unrepairable":return"update tracking is missing and no upstream skill declares this name; nothing was changed.";case"not-on-disk-and-removed-upstream":return`not on disk and no longer published upstream. Clear the entry with \`webflow skills remove ${r}\`.`;case"store-directory-missing":return n?"the store directory is missing and would be restored.":"the store directory was missing and has been restored.";case"removed-upstream":return`no longer published upstream. Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${r}\`.`;case"locally-modified":return e.willWrite?MA(n):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?MA(n):`updating would discard your edits. Review ${Hl(t.storeDir)}, then run \`webflow skills update ${r} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${b(t.recordedSkillPath)} \u2192 ${b(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?n?"moved upstream; local changes would be discarded.":"moved upstream; local changes were discarded.":"moved upstream AND locally modified. Re-run with --force.";case"moved-upstream-changed-upstream-and-locally-modified":return e.willWrite?n?"moved and changed upstream; local changes would be discarded.":"moved and changed upstream; local changes were discarded.":"moved upstream, changed upstream, AND locally modified. Re-run with --force.";default:return null}}function MA(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function C1(e){let{reports:t,candidates:r,failures:n,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??Ve;return{kind:"skills.update",schemaVersion:eo,checkOnly:e.checkOnly,force:e.force,scopes:o.map(c=>c.scope),source:{repo:a?.lock.source.repo??"",ref:l,recordedCommit:a?.lock.source.commit??null,resolvedCommit:i.get(l)??null,recordedPluginVersion:a?.lock.source.pluginVersion??null,resolvedPluginVersion:JA(e.catalogs)??null,upToDate:!1},skills:t,blocked:r.filter(c=>c.outcome.blocked).map(c=>({name:c.key,dir:c.dir,scope:c.scopeState.scope,state:c.outcome.state,reason:c.outcome.reason,requiredFlag:"--force"})),failures:n,summary:KA(t,n,e.checkOnly),warnings:[...new Set(e.warnings)]}}function KA(e,t,r){let n=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:n("upstream-changed","renamed-upstream","missing","untracked"),unchanged:n("unchanged"),locallyModified:n("locally-modified"),conflicts:n("conflict"),removedUpstream:n("removed-upstream","stale-entry"),updated:r?0:e.filter(i=>o.has(i.action)).length,relinked:e.reduce((i,s)=>i+s.targets.filter(a=>a.action==="relinked").length,0),unlinked:e.reduce((i,s)=>i+s.droppedAgents.length,0),blocked:e.filter(i=>i.action==="blocked").length,failed:t.length}}function F1(e){let{selected:t,states:r,localDigests:n,refs:o,options:i}=e,s=r[0],a=i.ref??s?.lock.source.ref??Ve,l=t.map(({state:c,key:p})=>{let f=c.lock.skills[p],m=aw(f),g=n.get(`${c.scope}\0${p}`)??null,h=m!==null&&!Mt(g,m);return{name:p,dir:f.dir,scope:c.scope,guard:"grid",state:h?"locally-modified":"unchanged",action:h?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:g?.contentHash??null,agents:f.agents??[],droppedAgents:[],reason:h?"locally-modified":null,detail:h?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:f.commit,toCommit:null,skillPath:f.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:eo,checkOnly:e.checkOnly,force:e.force,scopes:r.map(c=>c.scope),source:{repo:s?.lock.source.repo??"",ref:a,recordedCommit:s?.lock.source.commit??null,resolvedCommit:o.get(a)??null,recordedPluginVersion:s?.lock.source.pluginVersion??null,resolvedPluginVersion:s?.lock.source.pluginVersion??null,upToDate:!0},skills:l,blocked:[],failures:[],summary:KA(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function ow(e){return{kind:"skills.update",schemaVersion:eo,checkOnly:e.checkOnly,force:e.force,...e.cancelled===!0?{cancelled:!0}:{},scopes:e.scopes??[],source:{repo:"",ref:Ve,recordedCommit:null,resolvedCommit:null,recordedPluginVersion:null,resolvedPluginVersion:null,upToDate:!0},skills:[],blocked:[],failures:[],summary:{checked:0,outdated:0,unchanged:0,locallyModified:0,conflicts:0,removedUpstream:0,updated:0,relinked:0,unlinked:0,blocked:0,failed:0},warnings:[...new Set(e.warnings)]}}function _1(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let r of e.warnings)u.warn(`${X} ${b(r)}`);u.info(B_(e))}function aw(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function A1(e){let t=[];for(let r of e.agents??[]){let n=Br(r);n!==void 0&&t.push(n)}return t}function JA(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function BA(e){let t=e?.code;return typeof t=="string"?t:void 0}function iw(e){return b(e instanceof Error?e.message:String(e))}function R1(){let e=Vt();return e?_.forSkills({authToken:e}):null}function Hl(e){return oi(e)}var zA=e=>{let t=e.command("skills").description("Install and manage Webflow's first-party agent skills");t.command("install").description(`Install Webflow skills into your coding agents. Writes into your home directory for --global installs; use --dry-run to preview every path first.
|
|
293
|
+
With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(Cc()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(Ea()).addOption(va()).option("--copy","Copy files instead of symlinking from the shared store").option("--ref <branch|sha>","Pin to a branch or 40-character commit SHA (default: main)").option("--force","Replace destinations that were modified locally or installed elsewhere").addOption(Ii()).addOption(_e()).addOption(re()).action(sp),t.command("update").description("Update installed skills to the latest upstream commit. Overwrites files in your agent directories; use --check to report what would change, or --dry-run to preview.").argument("[names...]","Skill names to update (default: all installed)").option("--check","Report what would change without writing anything").addOption(Ea()).addOption(va()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ii()).addOption(_e()).addOption(re()).action(fp),t.command("list").description("List installed skills and the agents they are linked into").addOption(Ea()).addOption(va()).addOption(Cc()).addOption(We([...ii]).default(Tl)).addOption(Pi([...Ns]).default("name")).addOption(Ti()).addOption(re()).action(lp),t.command("remove").description("Remove installed skills. Deletes skill directories and unlinks them from every agent; use --dry-run to preview exactly what is deleted.").argument("[names...]","Skill names to remove (default: choose interactively)").addOption(Cc()).option("--all","Remove every installed skill for the scope").addOption(Ea()).addOption(va()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ii()).addOption(_e()).addOption(re()).action(pp)};var YA=w(ac());function lw(e,t){t.forEach(r=>{e.addOption(r())}),e.commands.forEach(r=>lw(r,t))}function XA(e){let t=YA.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(r,n){return qA.Help.prototype.formatHelp.call(this,r,n).split(`
|
|
294
|
+
`).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[dw(o)]:o.trim()===""?[o]:[P(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
|
|
293
295
|
`)+`
|
|
294
|
-
`}}).addOption(
|
|
295
|
-
`)}
|
|
296
|
+
`}}).addOption(Uf()).addOption(Ak()).addOption(Hf()).addOption(Vf()).addOption(Gf()).showHelpAfterError(),Ke()&&e.addOption(Wf()),e.hook("preAction",async(r,n)=>{let o=r.opts();if(o.input?r.getOptionValueSource("input")==="cli"&&yb(!0):hb(!0),n.opts().json&&bb(!0),Jr.start(),o.manifest&&kb(o.manifest),Ke()){let i=Ob(o.region);$b(i),u.debug(`Region resolved to "${i}" (--region=${o.region??"unset"}, WEBFLOW_REGION=${process.env.WEBFLOW_REGION??"unset"})`)}else u.debug("Region targeting is beta-gated; not resolved on this build.");try{await _.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!Xe()&&await new pa().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Jr.displayGrouped(),Jr.stop()}),Ok(e),aC(e),dD(e),nv(e),zx(e),Ke()&&Yx(e),rv(e),hC(e),YC(e),iF(e),zA(e),XE(e),e.commands.forEach(r=>{lw(r,[Uf,Hf,...Ke()?[Wf]:[],Vf,Gf])})}R();C();we();var eR=new QA.Command;XA(eR);function I1(e){let t=e instanceof Error?e.message:String(e),r=e instanceof d?e.missingFlag:void 0,n=e instanceof d?e.prefix:void 0,o=n?bt(n).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;Gb(e,{prefix:n});let i=JSON.stringify({error:{message:t,context:o,missingFlag:r}});ZA.default.writeSync(1,`${i}
|
|
297
|
+
`)}eR.parseAsync().catch(e=>{if(!(e instanceof d&&e.skipLogging))if(Xe())I1(e);else if(e instanceof d)if(e.isUserError){let t=e.prefix?`${e.prefix} `:"";console.error(`${t}${e.message}`)}else u.error(e,{prefix:e.prefix});else u.error(e);process.exit(1)});
|
|
296
298
|
//# sourceMappingURL=index.js.map
|