@webflow/webflow-cli 2.4.0 → 2.5.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,69 +1,74 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var sA=Object.create;var np=Object.defineProperty;var aA=Object.getOwnPropertyDescriptor;var lA=Object.getOwnPropertyNames;var cA=Object.getPrototypeOf,uA=Object.prototype.hasOwnProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var rp=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vy=(e,t)=>{for(var n in t)np(e,n,{get:t[n],enumerable:!0})},dA=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lA(t))!uA.call(e,o)&&o!==n&&np(e,o,{get:()=>t[o],enumerable:!(r=aA(t,o))||r.enumerable});return e};var w=(e,t,n)=>(n=e!=null?sA(cA(e)):{},dA(t||!e||!e.__esModule?np(n,"default",{value:e,enumerable:!0}):n,e));var Ky,je,op,Bt,le,At,J,se,I,pe=L(()=>{"use strict";Ky=e=>`\x1B[1;48;2;20;110;245;97m ${e} \x1B[0m`,je=e=>`\x1B[38;2;167;209;255m${e}\x1B[0m`,op=e=>`\x1B[38;2;196;175;255m${e}\x1B[0m`,Bt=e=>`\x1B[38;2;255;156;156m${e}\x1B[0m`,le=e=>`\x1B[38;2;255;209;102m${e}\x1B[0m`,At=e=>`\x1B[97m${e}\x1B[0m`,J=e=>`\x1B[38;2;121;224;156m${e}\x1B[0m`,se=e=>`\x1B[1m${e}\x1B[0m`,I=e=>`\x1B[38;2;185;185;185m${e}\x1B[0m`});function hA(){let e=new Map;for(let[t,n]of Object.entries(Te)){for(let[r,o]of Object.entries(n))Te[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=Te[r],e.set(o[0],o[1]);Object.defineProperty(Te,t,{value:n,enumerable:!1})}return Object.defineProperty(Te,"codes",{value:e,enumerable:!1}),Te.color.close="\x1B[39m",Te.bgColor.close="\x1B[49m",Te.color.ansi=Jy(),Te.color.ansi256=zy(),Te.color.ansi16m=qy(),Te.bgColor.ansi=Jy(10),Te.bgColor.ansi256=zy(10),Te.bgColor.ansi16m=qy(10),Object.defineProperties(Te,{rgbToAnsi256:{value(t,n,r){return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(i=>i+i).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>Te.rgbToAnsi256(...Te.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,o;if(t>=232)n=((t-232)*10+8)/255,r=n,o=n;else{t-=16;let a=t%36;n=Math.floor(t/36)/5,r=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(n,r,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,n,r)=>Te.ansi256ToAnsi(Te.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:t=>Te.ansi256ToAnsi(Te.hexToAnsi256(t)),enumerable:!1}}),Te}var Jy,zy,qy,Te,Ej,mA,gA,vj,yA,rn,Xy=L(()=>{"use strict";Jy=(e=0)=>t=>`\x1B[${t+e}m`,zy=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,qy=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,Te={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Ej=Object.keys(Te.modifier),mA=Object.keys(Te.color),gA=Object.keys(Te.bgColor),vj=[...mA,...gA];yA=hA(),rn=yA});function Ut(e,t=globalThis.Deno?globalThis.Deno.args:Ul.default.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}function wA(){if("FORCE_COLOR"in We)return We.FORCE_COLOR==="true"?1:We.FORCE_COLOR==="false"?0:We.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(We.FORCE_COLOR,10),3)}function bA(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function DA(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=wA();r!==void 0&&(Bl=r);let o=n?Bl:r;if(o===0)return 0;if(n){if(Ut("color=16m")||Ut("color=full")||Ut("color=truecolor"))return 3;if(Ut("color=256"))return 2}if("TF_BUILD"in We&&"AGENT_NAME"in We)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(We.TERM==="dumb")return i;if(Ul.default.platform==="win32"){let s=Zy.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in We)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in We)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in We)||We.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in We)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(We.TEAMCITY_VERSION)?1:0;if(We.COLORTERM==="truecolor"||We.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in We){let s=Number.parseInt((We.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(We.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(We.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(We.TERM)||"COLORTERM"in We?1:i}function Yy(e,t={}){let n=DA(e,{streamIsTTY:e&&e.isTTY,...t});return bA(n)}var Ul,Zy,ip,We,Bl,kA,Qy,ew=L(()=>{"use strict";Ul=w(require("process"),1),Zy=w(require("os"),1),ip=w(require("tty"),1);({env:We}=Ul.default);Ut("no-color")||Ut("no-colors")||Ut("color=false")||Ut("color=never")?Bl=0:(Ut("color")||Ut("colors")||Ut("color=true")||Ut("color=always"))&&(Bl=1);kA={stdout:Yy({isTTY:ip.default.isatty(1)}),stderr:Yy({isTTY:ip.default.isatty(2)})},Qy=kA});function tw(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,r)+t+n,i=r+o,r=e.indexOf(t,i);while(r!==-1);return s+=e.slice(i),s}function nw(e,t,n,r){let o=0,i="";do{let s=e[r-1]==="\r";i+=e.slice(o,s?r-1:r)+t+(s?`\r
|
|
3
3
|
`:`
|
|
4
4
|
`)+n,o=r+1,r=e.indexOf(`
|
|
5
|
-
`,o)}while(r!==-1);return i+=e.slice(o),i}var
|
|
6
|
-
`);return i!==-1&&(t=
|
|
7
|
-
${t}`,DA=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),kA=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),EA=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=bA.bind(null,r,t.toString());Object.defineProperty(o,"name",kA);let{writable:i,enumerable:s,configurable:a}=DA;Object.defineProperty(e,"toString",{value:o,writable:i,enumerable:s,configurable:a})}});var Ll,Yy,Zy,Qy=L(()=>{"use strict";Xy();Ll=new WeakMap,Yy=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,r=0,o=e.displayName||e.name||"<anonymous>",i=function(...s){if(Ll.set(i,++r),r===1)n=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return n};return op(i,e),Ll.set(i,r),i};Yy.callCount=e=>{if(!Ll.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Ll.get(e)};Zy=Yy});var Yr,ew=L(()=>{"use strict";Yr=[];Yr.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Yr.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Yr.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Nl,ip,sp,vA,ap,jl,SA,lp,cp,up,tw,Sj,xj,nw=L(()=>{"use strict";ew();Nl=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",ip=Symbol.for("signal-exit emitter"),sp=globalThis,vA=Object.defineProperty.bind(Object),ap=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(sp[ip])return sp[ip];vA(sp,ip,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,n){this.listeners[t].push(n)}removeListener(t,n){let r=this.listeners[t],o=r.indexOf(n);o!==-1&&(o===0&&r.length===1?r.length=0:r.splice(o,1))}emit(t,n,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(n,r)===!0||o;return t==="exit"&&(o=this.emit("afterExit",n,r)||o),o}},jl=class{},SA=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}}),lp=class extends jl{onExit(){return()=>{}}load(){}unload(){}},cp=class extends jl{#s=up.platform==="win32"?"SIGINT":"SIGHUP";#n=new ap;#e;#o;#p;#t={};#i=!1;constructor(t){super(),this.#e=t,this.#t={};for(let n of Yr)this.#t[n]=()=>{let r=this.#e.listeners(n),{count:o}=this.#n,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),r.length===o){this.unload();let s=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#s:n;s||t.kill(t.pid,a)}};this.#p=t.reallyExit,this.#o=t.emit}onExit(t,n){if(!Nl(this.#e))return()=>{};this.#i===!1&&this.load();let r=n?.alwaysLast?"afterExit":"exit";return this.#n.on(r,t),()=>{this.#n.removeListener(r,t),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#n.count+=1;for(let t of Yr)try{let n=this.#t[t];n&&this.#e.on(t,n)}catch{}this.#e.emit=(t,...n)=>this.#f(t,...n),this.#e.reallyExit=t=>this.#r(t)}}unload(){this.#i&&(this.#i=!1,Yr.forEach(t=>{let n=this.#t[t];if(!n)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,n)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#p,this.#n.count-=1)}#r(t){return Nl(this.#e)?(this.#e.exitCode=t||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#f(t,...n){let r=this.#o;if(t==="exit"&&Nl(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let o=r.call(this.#e,t,...n);return this.#n.emit("exit",this.#e.exitCode,null),o}else return r.call(this.#e,t,...n)}},up=globalThis.process,{onExit:tw,load:Sj,unload:xj}=SA(Nl(up)?new cp(up):new lp)});var Os,rw,xA,ow,iw=L(()=>{"use strict";Os=w(require("process"),1);Qy();nw();rw=Os.default.stderr.isTTY?Os.default.stderr:Os.default.stdout.isTTY?Os.default.stdout:void 0,xA=rw?Zy(()=>{tw(()=>{rw.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},ow=xA});var dp,Ml,di,pp,sw=L(()=>{"use strict";dp=w(require("process"),1);iw();Ml=!1,di={};di.show=(e=dp.default.stderr)=>{e.isTTY&&(Ml=!1,e.write("\x1B[?25h"))};di.hide=(e=dp.default.stderr)=>{e.isTTY&&(ow(),Ml=!0,e.write("\x1B[?25l"))};di.toggle=(e,t)=>{e!==void 0&&(Ml=e),Ml?di.show(t):di.hide(t)};pp=di});var aw=Yd((Tj,CA)=>{CA.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var fp=Yd((Pj,cw)=>{"use strict";var Bl=Object.assign({},aw()),lw=Object.keys(Bl);Object.defineProperty(Bl,"random",{get(){let e=Math.floor(Math.random()*lw.length),t=lw[e];return Bl[t]}});cw.exports=Bl});function mp(){return Wt.default.platform!=="win32"?Wt.default.env.TERM!=="linux":!!Wt.default.env.CI||!!Wt.default.env.WT_SESSION||!!Wt.default.env.TERMINUS_SUBLIME||Wt.default.env.ConEmuTask==="{cmd::Cmder}"||Wt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Wt.default.env.TERM_PROGRAM==="vscode"||Wt.default.env.TERM==="xterm-256color"||Wt.default.env.TERM==="alacritty"||Wt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Wt,uw=L(()=>{"use strict";Wt=w(require("process"),1)});var FA,_A,AA,Ls,dw=L(()=>{"use strict";rp();uw();FA={info:rn.blue("\u2139"),success:rn.green("\u2714"),warning:rn.yellow("\u26A0"),error:rn.red("\u2716")},_A={info:rn.blue("i"),success:rn.green("\u221A"),warning:rn.yellow("\u203C"),error:rn.red("\xD7")},AA=mp()?FA:_A,Ls=AA});function gp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var pw=L(()=>{"use strict"});function hp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(RA,"")}var RA,fw=L(()=>{"use strict";pw();RA=gp()});function yp({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var mw=L(()=>{"use strict"});function wp(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(IA,"")}var IA,gw=L(()=>{"use strict";mw();IA=yp()});var Ul,Wl,bp,Dp,Ns,hw=L(()=>{"use strict";Ul=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Wl=[12288,12288,65281,65376,65504,65510],bp=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Dp=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ns=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var Hl,yw=L(()=>{"use strict";Hl=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=o*2;if(t<e[i])r=o-1;else if(t>e[i+1])n=o+1;else return!0}return!1}});function BA(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let o=e[r],i=e[r+1];if(ww>=o&&ww<=i)return[o,i];i-o>n-t&&(t=o,n=i)}return[t,n]}var TA,PA,$A,OA,zj,qj,Xj,Yj,LA,NA,ww,jA,MA,bw,Dw,kw,Ew=L(()=>{"use strict";hw();yw();TA=Ul[0],PA=Ul.at(-1),$A=Wl[0],OA=Wl.at(-1),zj=bp[0],qj=bp.at(-1),Xj=Dp[0],Yj=Dp.at(-1),LA=Ns[0],NA=Ns.at(-1),ww=19968,[jA,MA]=BA(Ns);bw=e=>e<TA||e>PA?!1:Hl(Ul,e),Dw=e=>e<$A||e>OA?!1:Hl(Wl,e),kw=e=>e>=jA&&e<=MA?!0:e<LA||e>NA?!1:Hl(Ns,e)});function UA(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function vw(e,{ambiguousAsWide:t=!1}={}){return UA(e),Dw(e)||kw(e)||t&&bw(e)?2:1}var Sw=L(()=>{"use strict";Ew()});var xw,Cw=L(()=>{"use strict";xw=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});function kp(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=wp(e)),e.length===0)return 0;let o=0,i={ambiguousAsWide:!n};for(let{segment:s}of WA.segment(e)){let a=s.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!HA.test(s)){if(xw().test(s)){o+=2;continue}o+=vw(a,i)}}return o}var WA,HA,Fw=L(()=>{"use strict";gw();Sw();Cw();WA=new Intl.Segmenter,HA=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});function Ep({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var _w=L(()=>{"use strict"});function Sp(){let{env:e}=vp.default,{TERM:t,TERM_PROGRAM:n}=e;return vp.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vp,Aw=L(()=>{"use strict";vp=w(require("process"),1)});var on,VA,xp,GA,Cp,Rw=L(()=>{"use strict";on=w(require("process"),1),VA=3,xp=class{#s=0;start(){this.#s++,this.#s===1&&this.#n()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#n(){on.default.platform==="win32"||!on.default.stdin.isTTY||(on.default.stdin.setRawMode(!0),on.default.stdin.on("data",this.#o),on.default.stdin.resume())}#e(){on.default.stdin.isTTY&&(on.default.stdin.off("data",this.#o),on.default.stdin.pause(),on.default.stdin.setRawMode(!1))}#o(t){t[0]===VA&&on.default.emit("SIGINT")}},GA=new xp,Cp=GA});function _p(e){return new Fp(e)}var js,Ms,KA,Fp,Iw=L(()=>{"use strict";js=w(require("process"),1);rp();sw();Ms=w(fp(),1);dw();fw();Fw();_w();Aw();Rw();KA=w(fp(),1),Fp=class{#s=0;#n=!1;#e=0;#o=-1;#p=0;#t;#i;#r;#f;#g;#c;#u;#d;#h;#a;#l;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:js.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#r=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ep({stream:this.#r}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,js.default.env.NODE_ENV==="test"&&(this._stream=this.#r,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(n){this.#s=n}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=t,this.#m()}get interval(){return this.#g??this.#i.interval??100}get spinner(){return this.#i}set spinner(t){if(this.#o=-1,this.#g=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#i=t}else if(!Sp())this.#i=Ms.default.line;else if(t===void 0)this.#i=Ms.default.dots;else if(t!=="default"&&Ms.default[t])this.#i=Ms.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#l}set suffixText(t=""){this.#l=t,this.#m()}get isSpinning(){return this.#f!==void 0}#y(t=this.#a,n=" "){return typeof t=="string"&&t!==""?t+n:typeof t=="function"?t()+n:""}#w(t=this.#l,n=" "){return typeof t=="string"&&t!==""?n+t:typeof t=="function"?n+t():""}#m(){let t=this.#r.columns??80,n=this.#y(this.#a,"-"),r=this.#w(this.#l,"-"),o=" ".repeat(this.#d)+n+"--"+this.#h+"--"+r;this.#e=0;for(let i of hp(o).split(`
|
|
8
|
-
`))this.#e+=Math.max(1,Math.ceil(
|
|
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(p),this}}});function Bs(e,{suffix:t="nodejs"}={}){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return t&&(e+=`-${t}`),Vl.default.platform==="darwin"?JA(e):Vl.default.platform==="win32"?zA(e):qA(e)}var Pe,Ap,Vl,pr,Rp,pi,JA,zA,qA,Ip=L(()=>{"use strict";Pe=w(require("path"),1),Ap=w(require("os"),1),Vl=w(require("process"),1),pr=Ap.default.homedir(),Rp=Ap.default.tmpdir(),{env:pi}=Vl.default,JA=e=>{let t=Pe.default.join(pr,"Library");return{data:Pe.default.join(t,"Application Support",e),config:Pe.default.join(t,"Preferences",e),cache:Pe.default.join(t,"Caches",e),log:Pe.default.join(t,"Logs",e),temp:Pe.default.join(Rp,e)}},zA=e=>{let t=pi.APPDATA||Pe.default.join(pr,"AppData","Roaming"),n=pi.LOCALAPPDATA||Pe.default.join(pr,"AppData","Local");return{data:Pe.default.join(n,e,"Data"),config:Pe.default.join(t,e,"Config"),cache:Pe.default.join(n,e,"Cache"),log:Pe.default.join(n,e,"Log"),temp:Pe.default.join(Rp,e)}},qA=e=>{let t=Pe.default.basename(pr);return{data:Pe.default.join(pi.XDG_DATA_HOME||Pe.default.join(pr,".local","share"),e),config:Pe.default.join(pi.XDG_CONFIG_HOME||Pe.default.join(pr,".config"),e),cache:Pe.default.join(pi.XDG_CACHE_HOME||Pe.default.join(pr,".cache"),e),log:Pe.default.join(pi.XDG_STATE_HOME||Pe.default.join(pr,".local","state"),e),temp:Pe.default.join(Rp,t,e)}}});function Gl(){return/[<>:"/\\|?*\u0000-\u001F]/g}function Tw(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}var Pw=L(()=>{"use strict"});function Us(e,t={}){let n=/[\u0000-\u001F\u0080-\u009F]/g,r=/([<>:"/\\|?*\u0000-\u001F]){2,}/g;if(typeof e!="string")throw new TypeError("Expected a string");let o=t.replacement===void 0?"!":t.replacement;if(Gl().test(o)&&n.test(o))throw new Error("Replacement string cannot contain reserved filename characters");o.length>0&&(e=e.replace(r,"$1")),e=e.normalize("NFD"),e=e.replace(YA,o),e=e.replace(Gl(),o),e=e.replace(n,o),e=e.replace(ZA,""),o.length>0&&(!(e[0]===".")&&e[0]==="."&&(e=o+e),e[e.length-1]==="."&&(e+=o)),e=Tw().test(e)?e+o:e;let i=typeof t.maxLength=="number"?t.maxLength:XA;if(e.length>i){let s=e.lastIndexOf(".");if(s===-1)e=e.slice(0,i);else{let a=e.slice(0,s),l=e.slice(s);e=a.slice(0,Math.max(1,i-l.length))+l}}return e}var XA,YA,ZA,Tp=L(()=>{"use strict";Pw();XA=100,YA=/^\.+(\\|\/)|^\.+$/,ZA=/\.+$/});var QA,$w=L(()=>{"use strict";QA=w(require("path"),1);Tp()});var Ow=L(()=>{"use strict";Tp();$w()});var Kl,Pp=L(()=>{"use strict";Kl="webflow.json"});var Zr,$p=L(()=>{"use strict";Zr=class extends Error{constructor(t){super(`Manifest config for key "${t}" not found`),this.name="ManifestConfigKeyNotFoundError"}}});function Bw(e){Lw=e}function Uw(e){Nw=e}function e0(){for(let e of Ww){let t=process.env[e.variable];if(!(t===void 0||t==="")&&!(e.value!==void 0&&t!==e.value))return e.agent}return null}function t0(){return process.env.CI==="true"||!process.stdout.isTTY||!process.stdin.isTTY||e0()!==null}function V(){return Lw?!0:Nw?!1:t0()}function sn(){return!V()}function Hw(e){jw=e}function et(){return jw}function Vw(e){Mw=e}function Gw(){return Mw}var Lw,Nw,jw,Mw,Ww,I1,be=L(()=>{"use strict";Lw=!1,Nw=!1,jw=!1;Ww=[{variable:"CLAUDECODE",agent:"claude-code"},{variable:"CODEX_THREAD_ID",agent:"codex"},{variable:"CODEX_SANDBOX",agent:"codex"},{variable:"GEMINI_CLI",agent:"gemini-cli"},{variable:"OPENCODE_CLIENT",agent:"opencode"},{variable:"AI_AGENT",agent:"generic-agent"},{variable:"COPILOT_MODEL",agent:"copilot"},{variable:"AUGMENT_AGENT",agent:"augment"},{variable:"ANTIGRAVITY_AGENT",agent:"antigravity"},{variable:"CURSOR_AGENT",agent:"cursor"},{variable:"CURSOR_EXTENSION_HOST_ROLE",agent:"cursor",value:"agent-exec"}],I1=Ww.map(e=>e.variable)});function Qr(){let e=Gw();if(e){if(e.endsWith(".json"))return{path:e,isUserDefined:!0};try{if((0,Kw.statSync)(e)?.isDirectory())return{path:(0,Jw.join)(e,Kl),isUserDefined:!0}}catch{if(e.endsWith(".json"))return{path:e,isUserDefined:!0}}throw new Error(`Manifest path must be either a directory or a .json file. Got: ${e}`)}return{path:`./${Kl}`,isUserDefined:!1}}var Kw,Jw,Op=L(()=>{"use strict";Kw=require("fs"),Jw=require("path");Pp();be()});var zw,n0,r0,Lp,qw=L(()=>{"use strict";zw=w(require("ajv")),n0=new zw.default,r0={type:"object",properties:{region:{type:"string",enum:["us","eu"]},library:{type:"object",properties:{name:{type:"string",minLength:1},id:{type:"string",minLength:1},components:{type:"array",items:{type:"string"},minItems:1},renderer:{anyOf:[{type:"object",properties:{client:{type:"string",minLength:1},server:{type:"string",minLength:1}}},{type:"string",minLength:1}]},globals:{type:"string",minLength:1}},required:[]},devlink:{type:"object",properties:{rootDir:{type:"string",minLength:1},cssModules:{type:"boolean"},allowTelemetry:{type:"boolean"},overwriteModule:{type:"boolean"},skipTagSelectors:{type:"boolean"},envVariables:{type:"object",additionalProperties:{type:"string"}},components:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},fileExtensions:{type:"object",properties:{js:{type:"string"},css:{type:"string"}}},relativeHrefRoot:{oneOf:[{type:"boolean"},{type:"string"}]}},required:["rootDir"]},"devlink-export":{type:"object",properties:{rootDir:{type:"string",minLength:1},components:{type:"string"},componentGroups:{type:"string"},ts:{type:"boolean"},cssScopes:{type:"boolean"},relativeHrefRoot:{oneOf:[{type:"boolean",const:!1},{type:"string"}]},treeShake:{type:"boolean"},camelCaseVariantNames:{type:"boolean"}},required:[]},site:{type:"object",properties:{layout:{type:"object",properties:{preset:{type:"string",enum:["library","astro","nextjs","nextjs-pages"]},pagesRoot:{type:"string",minLength:1},componentsRoot:{type:"string",minLength:1},pagesShape:{type:"string",enum:["flat","nested"]}},required:[]}},required:[]}}},Lp=n0.compile(r0)});function Xw(e){return e instanceof Error?e:new Error("Unknown error")}function ee(){let{path:e}=Qr();if(!(0,Jl.existsSync)(e))return{manifest:{},manifestPath:e};let t;try{t=(0,Jl.readFileSync)(e,"utf8")}catch(o){throw new Error(`Failed to read manifest file: ${Xw(o).message}`)}if(t.trim()==="")return{manifest:{},manifestPath:e};let r;try{r=JSON.parse(t)}catch(o){throw new Error(`Invalid JSON in manifest file: ${Xw(o).message}`)}if(!Lp(r)){let o=Lp.errors?.map(i=>`${i.instancePath} ${i.message}`).join(", ")||"Unknown error";throw new Error(`Invalid manifest: ${o}.`)}return{manifest:r,manifestPath:e}}var Jl,Ws=L(()=>{"use strict";Jl=require("fs");Op();qw()});function Hs(e,t){let n=e[t];if(!n)throw new Zr(t);return n}var Yw=L(()=>{"use strict";$p()});function xe(e){let t=ee(),n=t.manifest,r=t.manifestPath,o={...n};for(let i in e){let s=i,a=e[s];if(a!==void 0)if(typeof a=="string"||typeof a=="number"||typeof a=="boolean"||a===null)o[s]=a;else{let l=o[s];o[s]={...typeof l=="object"&&l!==null?l:{},...a}}}return(0,Zw.writeFileSync)(r,JSON.stringify(o,null,2),"utf-8"),o}var Zw,Np=L(()=>{"use strict";Zw=require("fs");Ws()});var Me=L(()=>{"use strict";Pp();$p();Ws();Op();Yw();Np()});var zl=Yd((Y1,o0)=>{o0.exports={name:"@webflow/webflow-cli",version:"2.4.0",license:"MIT",bin:{webflow:"./dist/index.js"},scripts:{build:"tsup",dev:"tsup",lint:"eslint .","type-check":"tsc -p tsconfig.typecheck.json",test:"jest --ci","test:unit":"jest --ci --ignoreProjects e2e","test:local":"jest","test:e2e:deploy":"bash regression/run-local.sh","test:regression":"jest --config regression/jest.config.js --testTimeout=420000","test:e2e-cache-clear":"bash scripts/clear-e2e-cache.sh"},files:["CHANGELOG.md","dist/**/*"],publishConfig:{access:"public"},dependencies:{"@babel/parser":"^7.26.9","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@babel/preset-typescript":"^7.27.0","@babel/types":"^7.26.9","@dotenvx/dotenvx":"^1.44.1","@inquirer/prompts":"^7.9.0","@module-federation/enhanced":"2.5.1","@rspack/core":"^1.7.8","@webflow/cosmic-deploy-contract":"^1.1.0","@webflow/data-types":"*",ajv:"^8.17.1",archiver:"^5.3.1","babel-loader":"^10.0.0",commander:"^10.0.0",cosmiconfig:"^8.2.0","css-loader":"^7.1.2",dotenv:"^16.0.3","env-paths":"^3.0.0","fast-glob":"^3.3.3",filenamify:"^6.0.0","fork-ts-checker-webpack-plugin":"9.1.0","form-data":"4.0.4","fs-extra":"^11.3.0",jsdom:"^26.0.0","jsonc-parser":"^3.2.0",md5:"^2.2.1",memfs:"4.17.0","mime-types":"^2.1.35","mini-css-extract-plugin":"^2.9.2","node-fetch":"^2.6.7",open:"^8.4.2",ora:"^8.2.0",postcss:"^8.5.6","postcss-loader":"^8.1.1","postcss-selector-parser":"^7.1.0",prettier:"^3.9.6",semver:"^7.7.2","serve-handler":"^6.1.5","source-map-support":"^0.5.21",tar:"^7.5.19","ts-checker-rspack-plugin":"^1.0.0","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.2.0",unionfs:"^4.5.4","webflow-api":"3.3.4",webpack:">=5.99.7 <5.106.0","webpack-merge":"^6.0.1","webpack-node-externals":"^3.0.0",yaml:"^2.8.4",zod:"^3.22.4"},devDependencies:{"@module-federation/sdk":"2.5.1","@types/archiver":"^5.3.2","@types/express":"^4.17.13","@types/fs-extra":"^11.0.4","@types/jest":"^30.0.0","@types/md5":"^2.3.2","@types/mime-types":"^2.1.4","@types/nock":"^8.0.33","@types/node":"^22.13.0","@types/node-fetch":"2.6.13","@types/serve-handler":"^6.1.1","@types/source-map":"^0.5.2","@types/webpack-node-externals":"^3.0.4",astro:"^7.0.6","eslint-config-custom":"*",express:"^4.18.1",jest:"^30.4.2","jest-config-custom":"*",nock:"13.3.1",tar:"^7.5.19",tsconfig:"*",tsup:"^8.4.0",typescript:"^5.9.3"},engines:{node:">=22.13.0"}}});function Bn(){try{return zl().version}catch{return"unknown"}}function kn(e=""){if(!e)return"";let t=e;t=t.replace(/\/.*?\/webflow-cli/gi,"/REDACTED_PII/webflow-cli"),t=t.replace(/\/.*?\/node_modules/gi,"/REDACTED_PII/node_modules");let n=Vs.default.homedir();if(n){let o=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");t=t.replace(o,"~/REDACTED_PII")}let r=Vs.default.userInfo().username;if(r){let o=new RegExp(`/Users/${r}`,"gi");t=t.replace(o,"/Users/REDACTED_PII")}return t=t.replace(/\/Users\/[^\/\s]+/gi,"/Users/REDACTED_PII"),t=t.replace(/C:\\Users\\[^\\]+/gi,"C:\\Users\\REDACTED_PII"),t=t.replace(/[a-zA-Z0-9]{32,}/g,"[REDACTED_TOKEN]"),t=t.replace(/Bearer\s+[^\s]+/gi,"Bearer [REDACTED_TOKEN]"),t=t.replace(/token[=:]\s*[^\s]+/gi,"token=[REDACTED_TOKEN]"),t=t.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,"[REDACTED_EMAIL]"),t=t.replace(/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,"[REDACTED_IP]"),t}function jp(e){if(e.stack)return kn(e.stack)}function fr(e){let t=["password","token","secret","key","auth","bearer","authorization","apikey","api_key","access_token","refresh_token","client_secret","private_key"],n={};for(let[r,o]of Object.entries(e)){let i=r.toLowerCase();t.some(s=>i.includes(s))?n[r]="[REDACTED]":typeof o=="string"?n[r]=kn(o):typeof o=="object"&&o!==null&&!Array.isArray(o)?n[r]=fr(o):Array.isArray(o)?n[r]=o.map(s=>typeof s=="object"&&s!==null?fr(s):typeof s=="string"?kn(s):s):n[r]=o}return n}function Qw(){return{platform:process.platform,nodeVersion:process.version,arch:process.arch,os:`${Vs.default.type()} ${Vs.default.release()}`}}function Mp(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}var Vs,Gs=L(()=>{"use strict";Vs=w(require("os"))});var $,k,Ce,fi,Bp,at,re,ql,Up,Un,M=L(()=>{"use strict";pe();$=J("\u2713"),k=Bt("\u2716"),Ce=je("\u2139"),fi=J("\u279C"),Bp=Bt("\u279C"),at="\u279C",re=le("\u26A0"),ql=I("\u2732"),Up=J("\u2732"),Un=le("[Deprecated]")});var mr,Wp=L(()=>{"use strict";Me();Gs();A();pe();M();be();mr=class e{static instance;cache=void 0;static isDoNotTrackEnabled(){let t=process.env.DO_NOT_TRACK;return t==="1"||t?.toLowerCase()==="true"}static getInstance(){return e.instance||(e.instance=new e),e.instance}async getPreference(){if(e.isDoNotTrackEnabled())return!1;if(this.cache!==void 0)return this.cache;try{let{manifest:t}=await ee(),n=t?.telemetry?.global?.allowTelemetry;return this.cache=n,n}catch{return}}async setPreference(t){this.cache=t,await this.setGlobalPreference(t)}async promptForConsent(t){return e.isDoNotTrackEnabled()?(et()||u.info(`${Ce} Telemetry is disabled because the DO_NOT_TRACK environment variable is set.`),!1):(et()||(u.info(`${Up} ${I("Telemetry is enabled. We collect usage data and error reports to improve the Webflow CLI.")}`),u.info(`${Up} ${I("To opt out, run")} ${J("webflow auth telemetry --disable")}`)),await this.setPreference(!0),!0)}clearCache(){this.cache=void 0}async getGlobalPreference(){return this.getPreference()}async setGlobalPreference(t){let n={telemetry:{global:{allowTelemetry:t,lastPrompted:Date.now(),version:Bn()}}};await xe(n),et()||u.info(`${$} Telemetry configuration updated in webflow.json`),this.cache=t}async hasGlobalPreference(){return await this.getPreference()!==void 0}async getTelemetryStatus(){let t=await this.getPreference();return t!==void 0?{enabled:t,source:"global",hasPreference:!0}:{enabled:!1,source:"none",hasPreference:!1}}setCacheValue(t,n){this.cache=n}}});async function G(e,t){let r={"User-Agent":`webflow-cli@${Bn()}`};return(0,eb.default)(e,{...t,headers:{...t?.headers,...r}})}var eb,lt=L(()=>{"use strict";eb=w(require("node-fetch"));X()});var f,C=L(()=>{"use strict";f=class e extends Error{prefix;skipLogging;isUserError;missingFlag;code;constructor(t,n){let r=t instanceof Error?t.message:String(t);super(r),this.name="CLIError",this.prefix=n?.prefix,this.skipLogging=n?.skipLogging??!1,this.isUserError=n?.isUserError??(t instanceof e?t.isUserError:!1),this.missingFlag=n?.missingFlag,this.code=n?.code??(t instanceof e?t.code:void 0),t instanceof Error?(this.cause=t,this.stack=t.stack):Error.captureStackTrace&&Error.captureStackTrace(this,e)}}});function nb(e){tb=e}function rb(){return tb}function Hp(e,t){if(Ks.includes(e))return e;throw new f(`Invalid region "${e}" from ${t}. Valid regions: ${Ks.join(", ")}.`,{isUserError:!0})}function ob(e){if(e)return Hp(e,"--region");let t=process.env.WEBFLOW_REGION;if(t)return Hp(t,"WEBFLOW_REGION");let n;try{n=ee().manifest.region}catch(r){if(r instanceof Error&&r.message.startsWith("Invalid manifest:"))throw new f(r.message,{isUserError:!0});return"us"}return n?Hp(n,"webflow.json"):"us"}var Ks,tb,Xl=L(()=>{"use strict";C();Me();Ks=["us","eu"],tb="us"});var ib,sb=L(()=>{"use strict";ib=e=>{try{let t=new URL(e);return!(!["http:","https:"].includes(t.protocol)||e.includes("?")||e.includes("#")||t.search||t.hash)}catch{return!1}}});function s0(){let e="production";return e==="development"||e==="acceptance"||e==="sai"?e:"production"}function Gp(){return i0[s0()][rb()]}function P(){return process.env.WEBFLOW_API_HOST?Vp("WEBFLOW_API_HOST",process.env.WEBFLOW_API_HOST):Gp().api}function mi(){return process.env.WEBFLOW_CDN_API_HOST?Vp("WEBFLOW_CDN_API_HOST",process.env.WEBFLOW_CDN_API_HOST):Gp().cdnApi}function En(){return process.env.WEBFLOW_HOST?Vp("WEBFLOW_HOST",process.env.WEBFLOW_HOST):Gp().webflow}var Vp,i0,Js,Kp,zs,qs,gi,De=L(()=>{"use strict";Xl();sb();Vp=(e,t)=>(ib(t)||(console.error(`Error: Invalid ${e} environment variable. Only valid plain HTTP/HTTPS URLs without query parameters and anchors is allowed.`),process.exit(1)),t),i0={development:{us:{webflow:"https://wfdev.io:8443",api:"https://api.wfdev.io:8443",cdnApi:"https://api-cdn.wfdev.io:8443"},eu:{webflow:"https://eu.wfdev.io:8443",api:"https://api.eu.wfdev.io:8443",cdnApi:"https://api-cdn.eu.wfdev.io:8443"}},acceptance:{us:{webflow:"https://webflowtest.com",api:"https://api.webflowtest.com",cdnApi:"https://api-cdn.webflowtest.com"},eu:{webflow:"https://eu.webflowtest.com",api:"https://api.eu.webflowtest.com",cdnApi:"https://api-cdn.eu.webflowtest.com"}},sai:{us:{webflow:"https://webflow-sai.com",api:"https://api.webflow-sai.com",cdnApi:"https://api-cdn.webflow-sai.com"},eu:{webflow:"https://eu.webflow-sai.com",api:"https://api.eu.webflow-sai.com",cdnApi:"https://api-cdn.eu.webflow-sai.com"}},production:{us:{webflow:"https://webflow.com",api:"https://api.webflow.com",cdnApi:"https://api-cdn.webflow.com"},eu:{webflow:"https://eu.webflow.com",api:"https://api.eu.webflow.com",cdnApi:"https://api-cdn.eu.webflow.com"}}};Js="wf-manifest.json",Kp="mf-manifest.json",zs="@webflow_renderer",qs="ssr-bundle.tar",gi="index.js"});function a0(){let e=process.argv.slice(2),t=[];for(let n=0;n<e.length;n+=1){let r=e[n],o=r.indexOf("=");if(o>0&&ab.has(r.slice(0,o))){t.push(`${r.slice(0,o)}=<redacted>`);continue}t.push(r),ab.has(r)&&n+1<e.length&&(t.push("<redacted>"),n+=1)}return t.join(" ")||void 0}var ab,F,Jp=L(()=>{"use strict";Wp();Gs();A();lt();De();ab=new Set(["--ref","--name","--q","--branch","--key"]);F=class e{config;consentManager;sessionId;platformInfo;constructor(t){this.config=t,this.consentManager=mr.getInstance(),this.sessionId=Mp(),this.platformInfo=Qw()}async sendEvent(t){try{if(!await this.isEnabled())return;let n=this.enrichEvent(t),r=this.sanitizeEvent(n);await this.transmitEvent(r)}catch(n){u.debug(`Failed to send telemetry event: ${n}`)}}async sendError(t,n,r){await this.sendEvent({eventType:"error",success:!1,name:t.name,message:t.message,cause:t.cause,stack:jp(t),context:n,metadata:r?fr(r):void 0})}async sendUsage(t,n){let{duration:r,...o}=n??{};await this.sendEvent({eventType:"usage",success:!0,feature:t,duration:typeof r=="number"?r:void 0,data:Object.keys(o).length>0?fr(o):void 0})}async sendPerformance(t,n,r){await this.sendEvent({eventType:"performance",operation:t,duration:n,metrics:r})}async isEnabled(){return await this.consentManager.getPreference()!==!1}async isGloballyEnabled(){return await this.consentManager.getGlobalPreference()!==!1}async updatePreferences(t){await this.consentManager.setPreference(t)}static async promptForConsentIfNeeded(t){let n=mr.getInstance(),r=await n.getPreference();return r!==void 0?r:await n.promptForConsent(t)}enrichEvent(t){return{...{eventType:t.eventType||"usage",timestamp:Date.now(),sessionId:this.sessionId,platform:this.platformInfo.platform,nodeVersion:this.platformInfo.nodeVersion,cliVersion:Bn(),command:this.config.suppressCommand?void 0:a0(),metadata:{...t.metadata,commandType:this.config.commandType,siteId:this.config.siteId,projectId:this.config.projectId,os:this.platformInfo.os,arch:this.platformInfo.arch}},...t}}sanitizeEvent(t){let n=JSON.parse(JSON.stringify(t));return n.message&&(n.message=kn(n.message)),n.stack&&(n.stack=kn(n.stack)),n.context&&(n.context=kn(n.context)),n.metadata&&(n.metadata=fr(n.metadata)),n.data&&(n.data=fr(n.data)),n}async transmitEvent(t){let n=this.getEndpoint(),r=process.env.WEBFLOW_TELEMETRY_DEBUG==="true";if(r){console.log(`\u{1F4CA} [Telemetry] Sending to: ${n}`);let i={...t};i.metadata&&(delete i.metadata.authToken,delete i.metadata.apiToken),console.log("\u{1F4CA} [Telemetry] Payload:",JSON.stringify(i,null,2))}let o=await G(n,{method:"POST",headers:{Authorization:`Bearer ${this.config.authToken}`,"Content-Type":"application/json"},body:JSON.stringify(t),timeout:5e3});if(o.ok)r&&console.log(`\u{1F4CA} [Telemetry] Request successful: ${o.status}`);else throw r&&console.error(`\u{1F4CA} [Telemetry] Request failed: ${o.status} ${o.statusText}`),new Error(`Telemetry request failed: ${o.status} ${o.statusText}`)}getEndpoint(){let{host:t,commandType:n}=this.config;return`${t}/webflow-cli/${n}/telemetry`}static forDevlinkSync(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"devlink"})}static forExport(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"export"})}static forCloud(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,projectId:t.projectId,commandType:"cloud"})}static forExtension(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"extension"})}static forCodeLibraries(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"library"})}static forCms(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"cms"})}static forAssets(t){return new e({host:t.host||P(),authToken:t.authToken,siteId:t.siteId,commandType:"assets"})}static forSites(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"sites"})}static forApps(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"apps",suppressCommand:t.suppressCommand})}static forForms(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"forms"})}static forAppsEnvVars(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"apps_env_vars",suppressCommand:!0})}static forSkills(t){return new e({host:t.host||P(),authToken:t.authToken,commandType:"skills"})}}});var lb=L(()=>{"use strict"});function cb(e){return async(t,n,r)=>{let o=Date.now(),i=process.memoryUsage().heapUsed;try{let s=await n(),a=Date.now()-o,l=process.memoryUsage().heapUsed;return await e.sendPerformance(t,a,{memoryDelta:l-i,...r}),s}catch(s){let a=Date.now()-o;throw await e.sendPerformance(t,a,{failed:1,...r}),s}}}var X=L(()=>{"use strict";Jp();Wp();lb();Gs();Gs()});var qp,zp,l0,Wn,Xp=L(()=>{"use strict";qp=Symbol("webflow-cli-warn"),zp=class{warnings=[];originalConsoleWarn=null;isActive=!1;parseSource(t){let n=t.split(`
|
|
11
|
-
`);for(let r=2;r<n.length;r++){let o=n[r],i=o.match(/at .+? \((.+?):\d+:\d+\)/)||o.match(/at (.+?):\d+:\d+/);if(i){let s=i[1];if(s.includes("node_modules")){let a=s.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)/);return a?`External: ${a[1]}`:"External Dependencies"}else if(s.includes("webflow-cli"))return s.includes("/metadata/")?"Metadata Collection":s.includes("/bundler/")?"Bundling":s.includes("/commands/")?"CLI Commands":"Webflow CLI"}}return"General"}start(){this.isActive||(this.warnings=[],this.originalConsoleWarn=console.warn,this.isActive=!0,console.warn=(...t)=>{if(t.length>1&&t[t.length-1]===
|
|
5
|
+
`,o)}while(r!==-1);return i+=e.slice(o),i}var rw=L(()=>{"use strict"});function Us(e){return vA(e)}var ow,iw,sp,pi,Bs,sw,fi,EA,vA,ap,SA,xA,lp,Wl,CA,FA,Rj,on,cp=L(()=>{"use strict";Xy();ew();rw();({stdout:ow,stderr:iw}=Qy),sp=Symbol("GENERATOR"),pi=Symbol("STYLER"),Bs=Symbol("IS_EMPTY"),sw=["ansi","ansi","ansi256","ansi16m"],fi=Object.create(null),EA=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=ow?ow.level:0;e.level=t.level===void 0?n:t.level},vA=e=>{let t=(...n)=>n.join(" ");return EA(t,e),Object.setPrototypeOf(t,Us.prototype),t};Object.setPrototypeOf(Us.prototype,Function.prototype);for(let[e,t]of Object.entries(rn))fi[e]={get(){let n=Wl(this,lp(t.open,t.close,this[pi]),this[Bs]);return Object.defineProperty(this,e,{value:n}),n}};fi.visible={get(){let e=Wl(this,this[pi],!0);return Object.defineProperty(this,"visible",{value:e}),e}};ap=(e,t,n,...r)=>e==="rgb"?t==="ansi16m"?rn[n].ansi16m(...r):t==="ansi256"?rn[n].ansi256(rn.rgbToAnsi256(...r)):rn[n].ansi(rn.rgbToAnsi(...r)):e==="hex"?ap("rgb",t,n,...rn.hexToRgb(...r)):rn[n][e](...r),SA=["rgb","hex","ansi256"];for(let e of SA){fi[e]={get(){let{level:n}=this;return function(...r){let o=lp(ap(e,sw[n],"color",...r),rn.color.close,this[pi]);return Wl(this,o,this[Bs])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);fi[t]={get(){let{level:n}=this;return function(...r){let o=lp(ap(e,sw[n],"bgColor",...r),rn.bgColor.close,this[pi]);return Wl(this,o,this[Bs])}}}}xA=Object.defineProperties(()=>{},{...fi,level:{enumerable:!0,get(){return this[sp].level},set(e){this[sp].level=e}}}),lp=(e,t,n)=>{let r,o;return n===void 0?(r=e,o=t):(r=n.openAll+e,o=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:o,parent:n}},Wl=(e,t,n)=>{let r=(...o)=>CA(r,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(r,xA),r[sp]=e,r[pi]=t,r[Bs]=n,r},CA=(e,t)=>{if(e.level<=0||!t)return e[Bs]?"":t;let n=e[pi];if(n===void 0)return t;let{openAll:r,closeAll:o}=n;if(t.includes("\x1B"))for(;n!==void 0;)t=tw(t,n.close,n.open),n=n.parent;let i=t.indexOf(`
|
|
6
|
+
`);return i!==-1&&(t=nw(t,o,r,i)),r+t+o};Object.defineProperties(Us.prototype,fi);FA=Us(),Rj=Us({level:iw?iw.level:0}),on=FA});function up(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let o of Reflect.ownKeys(t))_A(e,t,o,n);return RA(e,t),$A(e,t,r),e}var _A,AA,RA,IA,TA,PA,$A,aw=L(()=>{"use strict";_A=(e,t,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let o=Object.getOwnPropertyDescriptor(e,n),i=Object.getOwnPropertyDescriptor(t,n);!AA(o,i)&&r||Object.defineProperty(e,n,i)},AA=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)},RA=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},IA=(e,t)=>`/* Wrapped ${e}*/
|
|
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(Fp(i,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#c&&!this.#u}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=t}get isSilent(){return this.#u}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=t}frame(){let t=Date.now();(this.#o===-1||t-this.#p>=this.interval)&&(this.#o=++this.#o%this.#i.frames.length,this.#p=t);let{frames:n}=this.#i,r=n[this.#o];this.color&&(r=on[this.color](r));let o=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text=="string"?" "+this.text:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return o+r+i+s}clear(){if(!this.#c||!this.#r.isTTY)return this;this.#r.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#r.moveCursor(0,-1),this.#r.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#r.cursorTo(this.#d),this.lastIndent=this.#d,this.#s=0,this}render(){return this.#u?this:(this.clear(),this.#r.write(this.frame()),this.#s=this.#e,this)}start(t){return t&&(this.text=t),this.#u?this:this.#c?this.isSpinning?this:(this.#t.hideCursor&&wp.hide(this.#r),this.#t.discardStdin&&Gs.default.stdin.isTTY&&(this.#n=!0,Tp.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#r.write(`- ${this.text}
|
|
9
|
+
`),this)}stop(){return this.#c?(clearInterval(this.#f),this.#f=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&wp.show(this.#r),this.#t.discardStdin&&Gs.default.stdin.isTTY&&this.#n&&(Tp.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Hs.success,text:t})}fail(t){return this.stopAndPersist({symbol:Hs.error,text:t})}warn(t){return this.stopAndPersist({symbol:Hs.warning,text:t})}info(t){return this.stopAndPersist({symbol:Hs.info,text:t})}stopAndPersist(t={}){if(this.#u)return this;let n=t.prefixText??this.#a,r=this.#y(n," "),o=t.symbol??" ",i=t.text??this.text,a=typeof i=="string"?(o?" ":"")+i:"",l=t.suffixText??this.#l,c=this.#w(l," "),d=r+o+a+c+`
|
|
10
|
+
`;return this.stop(),this.#r.write(d),this}}});function 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 r=2;r<n.length;r++){let o=n[r],i=o.match(/at .+? \((.+?):\d+:\d+\)/)||o.match(/at (.+?):\d+:\d+/);if(i){let s=i[1];if(s.includes("node_modules")){let a=s.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)/);return a?`External: ${a[1]}`:"External Dependencies"}else if(s.includes("webflow-cli"))return s.includes("/metadata/")?"Metadata Collection":s.includes("/bundler/")?"Bundling":s.includes("/commands/")?"CLI Commands":"Webflow CLI"}}return"General"}start(){this.isActive||(this.warnings=[],this.originalConsoleWarn=console.warn,this.isActive=!0,console.warn=(...t)=>{if(t.length>1&&t[t.length-1]===af){let i=t.slice(0,-1);this.originalConsoleWarn&&this.originalConsoleWarn(...i);return}let n=t.map(i=>{if(typeof i=="string")return i;if(i instanceof Error)return i.message;try{return String(i)}catch{return"[Object]"}}).join(" "),r=new Error().stack||"",o=this.parseSource(r);this.warnings.push({message:n,timestamp:Date.now(),source:o,stackTrace:r})})}stop(){this.isActive&&(this.originalConsoleWarn&&(console.warn=this.originalConsoleWarn,this.originalConsoleWarn=null),this.isActive=!1)}displayGrouped(){if(this.warnings.length===0)return;console.log(`
|
|
12
12
|
\u26A0\uFE0F Warnings:
|
|
13
13
|
`);let t=this.warnings.reduce((n,r)=>{let o=r.source||"General";return n[o]||(n[o]=[]),n[o].push(r),n},{});Object.entries(t).forEach(([n,r])=>{n!=="General"&&console.log(` ${n}:`),r.forEach((o,i)=>{let s=n!=="General"?" ":" ",a=o.message||"[Empty warning message]";console.log(`${s}${i+1}. ${a}`)}),n!=="General"&&console.log("")}),t.General&&console.log("")}debug(){console.log(`
|
|
14
14
|
\u{1F41B} Debug: Captured Warnings
|
|
15
15
|
`),this.warnings.forEach((t,n)=>{console.log(`Warning ${n+1}:`),console.log(` Source: ${t.source}`),console.log(` Message: ${t.message}`),console.log(` Message length: ${t.message.length}`),console.log(` Timestamp: ${new Date(t.timestamp).toISOString()}`),t.stackTrace&&(console.log(" Stack (first 3 lines):"),t.stackTrace.split(`
|
|
16
|
-
`).slice(0,3).forEach(r=>{console.log(` ${r}`)})),console.log("")})}},
|
|
17
|
-
`)),
|
|
18
|
-
${k} ${I("An error occurred. See logs for more information:")}`),console.info(` ${
|
|
19
|
-
${
|
|
16
|
+
`).slice(0,3).forEach(r=>{console.log(` ${r}`)})),console.log("")})}},DR=new sf,Vn=DR});function bt(e){return e.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"")}function xb(e,t){if(!e)return t;let n=parseInt(e,10);return isNaN(n)||n<=0?t:n}function Gn(e){sa.push(cn(e)),sa.length>vR&&sa.shift()}function Cb(e){uf=e}function vb(e){return Gn(`DEBUG: ${e}`),e}function xR(e){return Gn(`INFO: ${e}`),e}function CR(e){return Gn(`WARN: ${e}`),e}function FR(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Gn(`ERROR: ${r}${n}`),df=!0;let o=e instanceof Error?e.message:String(e);return Bt(`${r}${o}`)}function _R(e){return Gn(`SUCCESS: ${e}`),J(e)}function IR(e){let t=$p({text:`${e}...`,indent:1}).start(),n=!1,r=o=>i=>{if(Gn(`${AR[o]||"INFO"}: ${i||e}`),o==="fail"&&(df=!0),o==="update"){t.text=i||e;return}n||(n=!0,t.stopAndPersist({symbol:RR[o],text:I(i||e)}))};return{succeed:r("succeed"),fail:r("fail"),warn:r("warn"),info:r("info"),neutral:r("neutral"),update:r("update"),stop:()=>{n||(n=!0,t.stop())}}}function TR(){let e=ki.default.readdirSync(Rt).filter(t=>t.endsWith(".log")).map(t=>({name:t,time:ki.default.statSync(oc.default.join(Rt,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);for(;e.length>=ER;)try{let t=e.pop();if(!t)break;ki.default.removeSync(oc.default.join(Rt,t.name))}catch{}}function pf(e){try{let t=process.argv.slice(2).join(" ");if(/^(log|library\s+log)(\s|$)/.test(t))return;ki.default.ensureDirSync(Rt),TR(),sa.unshift(`CLI Version: ${Sn()}`,`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()}`,...uf?[`Sync ID: ${uf}`]:[],"");let n=sa.map(bt);ki.default.writeFileSync(cf,n.join(`
|
|
17
|
+
`)),df&&(console.info(`
|
|
18
|
+
${k} ${I("An error occurred. See logs for more information:")}`),console.info(` ${Yp} Latest log: ${cf}`),console.info(` ${Yp} All logs: ${Rt}`)),(process.env.DEBUG||process.argv.includes("--verbose"))&&(console.info(`
|
|
19
|
+
${P} Command completed successfully. Logs written to:`),console.info(` ${wi} Latest log: ${cf}`),console.info(` ${wi} All logs: ${Rt}`))}catch(t){console.error("Failed to write logs:",t)}}function Fb(e,t){let n=e instanceof Error?e.stack||e.message:e,r=t?.prefix?`${t.prefix} `:"";Gn(`ERROR: ${r}${n}`)}var ki,oc,Z2,kR,Rt,ER,vR,SR,cf,sa,df,uf,AR,RR,Ei,Sb,ia,PR,u,A=L(()=>{"use strict";ki=w(require("fs-extra")),oc=w(require("path")),Z2=require("source-map-support/register");Ww();Np();Kw();X();pe();lf();M();kR=Js("webflow-cli"),Rt=kR.log;ER=xb(process.env.MAX_PERSISTED_LOGS,50),vR=xb(process.env.MAX_IN_MEMORY_LOGS,1e3),SR=`${zs(new Date().toISOString(),{replacement:"_"}).replace(/\./g,"_")}-debug.log`,cf=oc.default.join(Rt,SR);sa=[],df=!1;AR={succeed:"INFO",fail:"ERROR",warn:"WARN",info:"INFO",neutral:"INFO",update:"INFO"},RR={succeed:P,fail:k,warn:Q,info:Ce,neutral:" ",update:void 0};Ei=!1;process.on("uncaughtException",e=>{Ei||(Ei=!0,Gn(`UNCAUGHT EXCEPTION: ${e?.stack}`),pf(1)),Vn.displayGrouped(),Vn.stop(),process.exit(1)});process.on("unhandledRejection",e=>{Ei||(Ei=!0,Gn(`UNHANDLED REJECTION: ${e instanceof Error?e.stack:String(e)}`),pf(1)),Vn.displayGrouped(),Vn.stop(),process.exit(1)});process.on("exit",e=>{Ei||(Ei=!0,pf(e))});Sb=!0,ia=e=>{let t=e.split(`
|
|
20
20
|
`).map(n=>n.length?` ${n}`:n).join(`
|
|
21
|
-
`);return
|
|
22
|
-
`+t):t};
|
|
23
|
-
`);try{return await e()}catch(t){throw t instanceof Error&&
|
|
21
|
+
`);return Sb?(Sb=!1,`
|
|
22
|
+
`+t):t};PR={debug:e=>{let t=vb(e);process.env.DEBUG&&console.debug(ia(t))},trace:e=>{let t=vb(e);process.env.DEBUG&&console.debug(t)},dir:e=>console.dir(e,{depth:100}),info:e=>console.info(ia(xR(e))),warn:e=>console.warn(ia(CR(e)),af),error:(e,t)=>{console.error(ia(FR(e,t)))},success:e=>console.log(ia(_R(e))),spinner:IR},u=PR});async function vi(e){process.stdout.write(`
|
|
23
|
+
`);try{return await e()}catch(t){throw t instanceof Error&&BR.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:vi(()=>ut.confirm({...e,theme:OR}))}async function Be(e){if(V())return"default"in e?e.default:null;let t=e.choices.map(n=>{if(!n||typeof n!="object"||ut.Separator.isSeparator(n)||n.type==="separator")return n;let r=n.name??String(n.value??"");return{...n,name:` ${I(r)}`}});return vi(()=>ut.select({...e,choices:t,theme:NR}))}async function Ke(e){return V()?e.default!==void 0?await e.validate?.(e.default)!==!0?null:e.default:null:vi(()=>ut.input({...e,theme:Rb}))}async function Pb(e){return V()?null:vi(()=>ut.password({...e,theme:Rb}))}async function Cn(e){if(V()){let n=[];return await e.validate?.(n)!==!0?null:n}let t=e.choices.map(n=>{if(!n||typeof n!="object"||n.type==="separator"||ut.Separator.isSeparator(n))return n;let r=n.name??String(n.value??"");return{...n,name:` ${I(r)}`}});return vi(()=>ut.checkbox({...e,choices:t,theme:jR}))}async function sc(e){if(V())return"default"in e?e.default:null;let t=(async(n,r)=>(await e.source(n,r)).map(i=>!i||typeof i!="object"||ut.Separator.isSeparator(i)?i:{...i,name:` ${I(i.name??"")}`}));return vi(()=>ut.search({...e,source:t,theme:MR}))}var ut,OR,Rb,aa,Ib,gf,hf,Tb,LR,NR,jR,MR,BR,Oe=L(()=>{"use strict";ut=w(require("@inquirer/prompts"));be();A();pe();OR={prefix:` ${je("?")}`,style:{message:(e,t)=>t==="done"?`${se(e)}
|
|
24
24
|
`:`${se(e)}
|
|
25
|
-
`,answer:e=>` ${I(e)}`}},
|
|
26
|
-
`,answer:e=>I(e)}},
|
|
27
|
-
`:se(e),
|
|
25
|
+
`,answer:e=>` ${I(e)}`}},Rb={prefix:` ${je("?")}`,style:{message:e=>`${se(e)}
|
|
26
|
+
`,answer:e=>I(e)}},aa=2,Ib=1,gf=(e,t)=>t==="done"?`${se(e)}
|
|
27
|
+
`:se(e),hf=e=>` ${I(bt(e).trim())}`,Tb=e=>{let t=bt(e),n=t.slice(0,aa),r=t.slice(aa+1+Ib);return je(`${n} ${r}`)},LR=e=>{let t=bt(e),n=t.slice(0,aa),r=t[aa+2],o=t.slice(aa+3+Ib);return je(`${n} ${r} ${o}`)},NR={prefix:` ${je("?")}`,style:{message:gf,answer:hf,highlight:Tb,keysHelpTip:e=>` ${e.map(([t,n])=>`${I(t)} ${I(n)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`}},jR={prefix:` ${je("?")}`,style:{message:gf,answer:hf,highlight:LR,keysHelpTip:e=>` ${e.map(([t,n])=>`${I(t)} ${I(n)}`).join(" ")}`},icon:{cursor:` ${je("\u23F5")}`,checked:` ${J("\u25C9")}`,unchecked:` ${I("\u25EF")}`}},MR={prefix:` ${je("?")}`,style:{message:gf,answer:hf,highlight:Tb,searchTerm:e=>je(e)},icon:{cursor:` ${je("\u23F5")}`}},BR=/SIGINT/i});function Je(){return!0}var Kn=L(()=>{"use strict"});function Jn({apiToken:e,siteId:t,directory:n}){let r=ca.resolve(n?ca.join(n,".env"):ca.join(process.cwd(),".env"));n&&!so.existsSync(n)&&so.mkdirSync(n,{recursive:!0}),so.existsSync(r)||so.writeFileSync(r,`# automatically generated at ${new Date().toISOString()}`,{encoding:"utf8"}),ac.default.config({path:r,quiet:!0}),e&&ac.default.set("WEBFLOW_API_TOKEN",e,{path:r,encrypt:!1}),t&&ac.default.set("WEBFLOW_SITE_ID",t,{path:r,encrypt:!1})}var so,ca,ac,Mb=L(()=>{"use strict";so=w(require("fs")),ca=w(require("path")),ac=w(require("@dotenvx/dotenvx"))});function wf(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version===lc&&no.includes(t.region)&&typeof t.session=="object"&&t.session!==null&&typeof t.session.accessToken=="string"}function Dr(){let e=hi();return bf.default.join(e,HR)}function Bb(){let e=Dr();try{if(!br.default.existsSync(e))return null;let t=br.default.readFileSync(e,"utf8"),n=JSON.parse(t);if(wf(n))return n;let r=n;if(r.version===2&&typeof r.sessions=="object"&&r.sessions){let i=ct(),s=r.sessions,a=s[i]!=null?i:Object.keys(s).find(d=>s[d]!=null);if(a==null)return null;let l=s[a];if(l==null)return null;let c={version:lc,region:a,session:l};return wf(c)?c:null}let o=n;if(typeof o.accessToken=="string"){let i={version:lc,region:"us",session:o};return wf(i)?i:null}return null}catch{return null}}function Si(e=ct()){let t=Bb();return!t||t.region!==e?null:t.session}function ua(){return Bb()?.region??null}function Df(e,t=ct()){let n=Dr(),r=bf.default.dirname(n);br.default.existsSync(r)||br.default.mkdirSync(r,{recursive:!0,mode:448});let o={version:lc,region:t,session:e};br.default.writeFileSync(n,JSON.stringify(o,null,2),{encoding:"utf8",mode:384})}function kf(){let e=Dr();try{if(!br.default.existsSync(e))return;br.default.unlinkSync(e)}catch{}}var br,bf,HR,lc,Ef=L(()=>{"use strict";br=w(require("fs")),bf=w(require("path"));ea();yr();HR="auth.json",lc=3});function xi(){return{serverUrl:xn(),timeoutMs:300*1e3}}var vf=L(()=>{"use strict";De()});var Ub,Wb,Hb,Vb,VR,Gb,GR,Kb,Jb=L(()=>{"use strict";Ub=require("crypto"),Wb=w(require("open"));vf();A();lt();Hb=e=>{let t=new Uint8Array(e);return Ub.webcrypto.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")},Vb=({pollId:e,clientId:t,scope:n})=>`${xi().serverUrl}/oauth/webflow/initiate?pollId=${e}&clientId=${t}&scope=${encodeURIComponent(n.join(" "))}`,VR=e=>`${xi().serverUrl}/oauth/webflow/poll?pollId=${e}`,Gb=async e=>{let t=u.spinner("Browser opened for authentication");try{await new Promise(n=>setTimeout(n,3e3)),await(0,Wb.default)(e),t.succeed()}catch{t.fail(),u.warn(`Could not automatically open browser. Please open this URL manually: ${e}`)}},GR=async e=>{let t=VR(e),n=await G(t);if(!n.ok){let r=`Failed to poll for authentication status (${n.status})`;try{let o=await n.json();o&&o.error&&(r+=`: ${o.error}`)}catch{}throw new Error(r)}return n.json()},Kb=(e,t)=>{let n=u.spinner("Waiting");return new Promise((r,o)=>{let i=setTimeout(()=>{clearTimeout(i),clearInterval(s),o(new Error("Authentication timed out. Please try again."))},t),s=setInterval(async()=>{try{let a=await GR(e);a.status==="success"&&a.accessToken?(clearTimeout(i),clearInterval(s),n.succeed("Authentication successful! You can close the browser window."),r(a.accessToken)):a.status==="error"&&(clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(new Error(a.error||"Authentication failed")))}catch(a){clearTimeout(i),clearInterval(s),n.fail("Authentication failed"),o(a instanceof Error?a:new Error(String(a)))}},2e3)})}});function qb(){return[...KR,...Je()?JR:[]].sort()}function Ht(){if(process.env.WEBFLOW_API_TOKEN)return process.env.WEBFLOW_API_TOKEN;let e=Si();if(e?.accessToken)return e.accessToken;let t=process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN??null;return t&&!zb&&(zb=!0,u.warn(`${Q} WEBFLOW_SITE_API_TOKEN / WEBFLOW_WORKSPACE_API_TOKEN are deprecated. Please use WEBFLOW_API_TOKEN instead. Run ${J("webflow auth login --force")} to update your .env file.`)),t}async function T(e){if(e?.apiToken&&!e.force)return e.apiToken;if(!e?.force){let s=Ht();if(s)return s}if(V())throw new f(`No API token found. To authenticate in CI/CD environments:
|
|
28
28
|
1. Generate a Workspace API token in your Webflow Dashboard > Apps & Integrations > Manage > Workspace API Token
|
|
29
|
-
2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=
|
|
30
|
-
`})}}async function
|
|
29
|
+
2. Set it as the WEBFLOW_API_TOKEN environment variable in your CI/CD pipeline`);let t=ct(),n=ua();n&&n!==t&&u.warn(`${Q} Switching region from ${n.toUpperCase()} to ${t.toUpperCase()} \u2014 the ${n.toUpperCase()} session will be replaced.`);let r=Hb(16),o=qR(),i=qb();try{let s=Vb({pollId:r,clientId:o,scope:i});u.debug(`OAuth login: region="${ct()}" buildEnv="${rc()}" apiHost="${$()}" oauthServer="${xi().serverUrl}" clientId="${o}" authorizeUrl="${s}"`),await Gb(s);let a=await Kb(r,xi().timeoutMs);return Df({accessToken:a,scopes:i,createdAt:new Date().toISOString()}),u.info(`${P} Credentials saved: ${Dr()}`),a}catch(s){throw new f(s)}}function qR(){if(process.env.WEBFLOW_OAUTH_CLIENT_ID)return process.env.WEBFLOW_OAUTH_CLIENT_ID;let e=rc(),t=ct(),n=zR[e][t];if(n)return n;let r=t.toUpperCase();throw new f(`${r} login is not available for this environment yet. Set WEBFLOW_API_TOKEN to a token from your ${r} workspace, or set WEBFLOW_OAUTH_CLIENT_ID if you have a ${r} client ID.`,{isUserError:!0})}var KR,JR,zb,zR,Sf=L(()=>{"use strict";De();be();A();M();C();yr();Ef();vf();Jb();pe();Kn();KR=["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"],JR=["cloud_apps:read","components:read","components:write","page_client:write","pages:read","pages:write","workspace:write"];zb=!1;zR={development:{us:"db64c798d0a5adb3c9c43b10c80f93fece223acd072246f957d9700b1bf3cab0"},acceptance:{us:"32a6440eefa0b608b39c36164a9cf274c9c096cfe6541e9dab08ff4f372fe245"},sai:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074",eu:"6e2027b2c3a881e6d1f7a0933e7240e9ddf50df5afdde06740e30d56e3deed4b"},production:{us:"fbab9abdbeeb35bb2554a1b83b8bd060d719f22eca26ff9119b87608c87c0074"}}});function ao(e){return process.env.WEBFLOW_SITE_ID??e.siteId??null}async function kr(e){try{let n=await new Xb.WebflowClient({accessToken:e,environment:{base:`${$()}/v2`,dataApi:`${$()}/v2`,contentDeliveryApi:`${bi()}/v2`}}).sites.list();if(!n||typeof n!="object"||!n.sites||!Array.isArray(n.sites))throw new f("Invalid response from Webflow API");let r=n.sites.map(o=>({id:o.id,displayName:o.displayName??"",shortName:o.shortName||(o.displayName??"").toLowerCase().replace(/\s+/g,"-"),lastUpdated:o.lastUpdated??null,workspaceId:o.workspaceId??null}));return r.sort((o,i)=>o.displayName.localeCompare(i.displayName)),r}catch(t){throw new f(t,{prefix:`Failed to fetch Webflow sites. Please check your authorization.
|
|
30
|
+
`})}}async function Ci(e){let t=e.map(r=>({name:`${r.displayName} (${r.shortName})`,value:r})),n=await sc({message:"Search for a Webflow site:",source:r=>{if(!r)return t;let o=r.toLowerCase();return t.filter(i=>i.value.displayName.toLowerCase().includes(o)||i.value.shortName.toLowerCase().includes(o))},pageSize:15});if(!n){if(e.length===0)throw new f("No sites available for selection");return u.warn(`Auto fallback to first site: ${e[0].displayName}`),e[0]}return n}var Xb,cc=L(()=>{"use strict";Xb=require("webflow-api");Oe();A();De();De();C()});var lo,Er,xf=L(()=>{"use strict";C();lo=class extends f{constructor(t){super(t),this.name="NoWebflowSitesError"}},Er=class extends f{constructor(t){super(t),this.name="NoWebflowWorkspacesError"}}});async function ze(e,t){let n=t?.site??ao(e);if(V()&&!n)throw new f(`No site ID configured for this project.
|
|
31
31
|
Run ${J("webflow auth login")} locally to authenticate and associate this project with a Webflow site,
|
|
32
|
-
or provide --site and --api-token when running a CLI command`);let r=await T({apiToken:t?.apiToken,force:t?.force});if(!n||t?.force){let o=await
|
|
33
|
-
${r} ${t.content}`)}}var
|
|
34
|
-
`+k})}throw new f(r,{skipLogging:!0})}}var
|
|
35
|
-
${
|
|
36
|
-
`);return}let{code:l}=await
|
|
37
|
-
Would you like to update it?`,default:!1})){n=u.spinner("Updating");let
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
or provide --site and --api-token when running a CLI command`);let r=await T({apiToken:t?.apiToken,force:t?.force});if(!n||t?.force){let o=await kr(r);if(o.length===0)throw new lo("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 Ci(o):o[0];n=i.id;let s=xe({siteId:n});return e.siteId=s.siteId,u.info(`${P} Site ID updated in webflow.json`),{siteId:n,siteName:i.displayName,accessToken:r}}return{siteId:n,accessToken:r}}var Yb=L(()=>{"use strict";Me();be();Sf();cc();C();xf();M();pe();A()});async function Cf(e){let t=$(),n=bi();u.debug(`getTokenInfo: region="${ct()}" apiHost="${t}" cdnApiHost="${n}"`);let r=new Zb.WebflowClient({accessToken:e,environment:{base:`${t}/v2`,dataApi:`${t}/v2`,contentDeliveryApi:`${n}/v2`}});try{return await r.token.authorizedBy()}catch(o){return u.debug(`getTokenInfo failed: ${o}`),null}}var Zb,Qb=L(()=>{"use strict";Zb=require("webflow-api");De();A();yr()});var q=L(()=>{"use strict";Mb();Sf();Yb();cc();cc();Ef();Qb();xf()});function f0(e,t){if(e.includes("..")||un.isAbsolute(e))throw new Error(`Invalid file path: "${e}" - path traversal not allowed`);let n=un.resolve(t,e),r=un.resolve(t);if(!n.startsWith(r+un.sep)&&n!==r)throw new Error(`Invalid file path: "${e}" - resolves outside root directory`)}async function Oc(e,t,n){let r=un.join(process.cwd(),t);n&&(0,Cr.existsSync)(r)&&await(0,$c.rm)(r,{recursive:!0,force:!0}),(0,Cr.existsSync)(r)||await(0,$c.mkdir)(r);for(let o of e){f0(o.path,r);let i=m0(r,o.path);if(o.path.includes("/")){let s=o.path.substring(0,o.path.lastIndexOf("/"));g0(r,s)}(0,Cr.writeFileSync)(i,o.content,{flag:"w+"})}}function m0(e,t){return un.join(e,...t.split("/"))}function g0(e,t){let n=t.split("/"),r=e;for(let o of n)r=un.join(r,o),(0,Cr.existsSync)(r)||(0,Cr.mkdirSync)(r)}var Cr,$c,un,Gf=L(()=>{"use strict";Cr=require("fs"),$c=require("fs/promises"),un=w(require("path"))});function Nc(e){for(let t of e??[]){let n=u[t.status]??u.info,r=b0[t.status]??Ce;n(`
|
|
33
|
+
${r} ${t.content}`)}}var b0,zf=L(()=>{"use strict";A();M();b0={info:Ce,warn:Q,success:P}});function Xf(e){let{manifestPath:t}=ne();return(0,ZD.writeFileSync)(t,JSON.stringify(e,null,2),"utf-8"),e}var ZD,QD=L(()=>{"use strict";ZD=require("fs");qs()});function jc(e,t,n){try{let r=Yf(n),o=Zf(Object.values(e)),i=t?.force;return o&&r&&!i}catch{return!1}}var ek,tk,Yf,Zf,Mc=L(()=>{"use strict";ek=require("path"),tk=require("fs-extra");Yf=e=>{try{return(0,tk.existsSync)((0,ek.join)(e,"tsconfig.json"))}catch{return!1}},Zf=e=>e.some(t=>t.endsWith(".ts")||t.endsWith(".tsx"))});function D0(e){let{export:t,...n}=e;return t?n["devlink-export"]!=null?(Xf(n),n):(u.warn(`${Q} The 'export' key in webflow.json is deprecated. Use 'devlink-export' instead. Your configuration will be migrated automatically.`),n["devlink-export"]={...t},Xf(n),n):n}function ok(e,t){try{new RegExp(e)}catch{throw new f(`Invalid '${t}' regex '${e}' in webflow.json. Fix the value and re-run the export.`,{isUserError:!0})}}async function sk(e){e=D0(e);let t=e["devlink-export"]||{},n=!1,r=t.rootDir;r||(V()?r=nk:(n=!0,r=await Ke({message:"Enter the root directory for exported components:",default:nk,validate:d=>!d||d.trim()===""?"Root directory is required":!0})));let o=t.ts;o===void 0&&(v0()?o=!0:V()?o=!1:(n=!0,o=await $e({message:"Use TypeScript?",default:!0})));let i=t.cssScopes;i===void 0&&(V()?i=rk:(n=!0,i=await $e({message:"Use DevLink style isolation (scoped wrapper + @scope)?",default:rk}))),t.components&&ok(t.components,"components"),t.componentGroups&&ok(t.componentGroups,"componentGroups");let s=t.components,a=t.componentGroups;!s&&!a&&(V()?(s=Bc,a=Uc):(n=!0,await $e({message:"Do you want to export all components?",default:!0})?(s=Bc,a=Uc):(s=await Ke({message:"Enter regex pattern to filter components (e.g., 'Button|Card' for specific):",default:Bc,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}}),a=await Ke({message:"Enter regex pattern to filter component groups (e.g., 'mygroup'):",default:Uc,validate:p=>{try{return new RegExp(p),!0}catch{return"Invalid regex pattern. Please enter a valid regular expression."}}})))),s=s||Bc,a=a||Uc;let l=t.relativeHrefRoot;l===void 0&&(l=k0);let c={...t,rootDir:r,components:s,componentGroups:a,ts:o,cssScopes:i,relativeHrefRoot:l};return(!t.rootDir||t.ts===void 0||t.cssScopes===void 0||!t.components||!t.componentGroups||t.relativeHrefRoot===void 0)&&E0(c),{config:c,wasPrompted:n}}function E0(e){xe({"devlink-export":{...e}}),u.info(`${P} Devlink Export configuration updated in webflow.json`)}function v0(){try{let e=process.cwd();if(Yf(e))return!0;let t=["src","app","pages","components"];for(let n of t){let r=ik.join(e,n);if(Wc.existsSync(r)&&Zf(Wc.readdirSync(r)))return!0}}catch{}return!1}var Wc,ik,nk,Bc,Uc,rk,k0,ak=L(()=>{"use strict";Wc=w(require("fs")),ik=w(require("path"));Oe();be();A();M();C();Hp();QD();Mc();nk="./webflow",Bc=".*",Uc=".*",rk=!0,k0="/"});function uo(e){let t=e;for(let n=0;n<8&&t instanceof Error;n+=1){if(t.code===em)return!0;t=t.cause}return!1}async function uk(e){if(e.ok)return;let t=await e.text().catch(()=>"");u.debug(`Server error response (HTTP ${e.status}): ${t||"<empty>"}`);let n,r;try{let o=JSON.parse(t);n=o.message,r=o.code}catch{}throw new va(n||`Request failed (HTTP ${e.status}).`,{code:r})}async function tm(e,t,n,r){let o=await S0(n,r,t,e);if(!o.files||!Array.isArray(o.files))throw new f("Invalid response format from V2 API: expected 'files' array");return{files:o.files,messages:o.messages,metadata:o.metadata}}async function S0(e,t,n,r){let{taskId:o,polling:i}=await x0(e,t,n,r);return C0(e,t,n,o,i)}async function x0(e,t,n,r){let o=await(0,Qf.default)(`${$()}/v2/devlink/${e}/export`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",[ck]:t},body:JSON.stringify(r),timeout:6e4});return o.ok||await uk(o),await o.json()}async function C0(e,t,n,r,o){let{initialDelayMs:i,maxBackoffMs:s,backoffMultiplier:a,timeoutMs:l}=o,c=Date.now()+l,d=i;do{let p=await(0,Qf.default)(`${$()}/v2/devlink/${e}/export/${r}`,{headers:{Authorization:`Bearer ${n}`,[ck]:t},timeout:6e4});p.ok||await uk(p);let m=await p.json();if(m.status==="finished")return m.result;if(m.status==="failed")throw new va("The export task failed. Please try again or report a bug.");await(0,lk.setTimeout)(d),d=Math.min(d*a,s)}while(Date.now()<c);throw new va(`Export task timed out after ${l}ms. Please try again.`)}var Qf,lk,ck,em,va,nm=L(()=>{"use strict";Qf=w(require("node-fetch")),lk=require("timers/promises");A();De();C();ck="X-WF-Sync-Id",em="devlink_export_not_entitled",va=class extends Error{code;constructor(t,n){super(t),this.code=n?.code}}});var dk,pk=L(()=>{"use strict";Oe();A();dk=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 fk(e,t,n){let i=new Intl.PluralRules("en-US").select(e)==="one"&&e===1?t:n||`${t}s`;return`${e} ${i}`}var mk=L(()=>{"use strict"});async function Hc(e){let t=Date.now(),n;try{let{manifest:r}=ne(),{siteId:o,accessToken:i}=await ze(r,e),s=(0,gk.randomUUID)();Cb(s);let{config:a,wasPrompted:l}=await sk(r);u.info(`${P} Export configuration loaded!`),await dk(a,l);let c=F.forExport({authToken:i,siteId:o});n=u.spinner("Exporting components"),await c.sendUsage("devlink_export_start",{cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot});try{let{files:d,messages:p,metadata:m}=await tm(a,i,o,s),h=m.exportCoverage==="full";await Oc(d,a.rootDir,h),n.succeed(`${fk(m.componentCount,"component")} exported to ${a.rootDir}`),Nc(p);let g=Date.now()-t;await c.sendUsage("devlink_export_success",{duration:g,cssScopes:a.cssScopes,ts:a.ts,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);throw e?.silentNotEntitled&&uo(d)?n.stop():n.fail(`Components export failed: ${p}`),await c.sendError(d instanceof Error?d:new Error(String(d)),"devlink_export_failure",{cssScopes:a.cssScopes,ts:a.ts}),d}}catch(r){if(!(e?.silentNotEntitled&&uo(r))){let i="Export failed: "+(r instanceof Error?r.message:r);n?n.fail(i):u.error(i,{prefix:`
|
|
34
|
+
`+k})}throw new f(r,{skipLogging:!0})}}var 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
|
+
${nt} To update, run:`),o.length>0&&u.info(J(` ${n} ${o.join(" ")}`)),i.length>0&&u.info(J(` ${n} ${r} ${i.join(" ")}`)),u.info("")}shouldSkipUpdateChecks(){return!this.packageManager.supported||process.env.WEBFLOW_SKIP_UPDATE_CHECKS==="true"}getDistTag(){let t=io.prerelease(yf.default.version);return t&&t.length>0&&typeof t[0]=="string"?t[0]:"latest"}async promptPrerelease(t){let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let{stdout:r,code:o}=await wr(`npm view @webflow/webflow-cli@${t} version`);if(o!==0||!r.trim()){n.succeed("Up to date");return}let i=r.trim(),s=yf.default.version;if(!io.valid(i)||!io.valid(s)){n.succeed("Up to date");return}if(!io.gt(i,s)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){u.info(`${Ce} A new version of @webflow/webflow-cli@${t} is available.`);let{code:p}=await wr("npm ls @webflow/webflow-cli --json"),h=(p===0?"local":"global")==="global"?" --global":"";u.info(`${nt} To update, run: `+J(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`)+`
|
|
36
|
+
`);return}let{code:l}=await wr("npm ls @webflow/webflow-cli --json"),c=l===0?"local":"global";if(await $e({message:`A new version of @webflow/webflow-cli@${t} is available.
|
|
37
|
+
Would you like to update it?`,default:!1})){n=u.spinner("Updating");let p=c==="global"?` ${this.packageManager.globalFlag}`:"";try{await this.packageManager.update(`${p} @webflow/webflow-cli@${t}`),n.succeed("Updated successfully")}catch{let h=c==="global"?` ${this.packageManager.globalFlag}`:"";n.fail("Update failed. Manually run: "+J(`${this.packageManager.updateCommand}${h} @webflow/webflow-cli@${t}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}async prompt(){if(this.shouldSkipUpdateChecks())return;let t=this.getDistTag();if(t!=="latest")return this.promptPrerelease(t);let n;try{n=u.spinner("Checking for updates (to disable, use --skip-update-check)");let r=await this.getOutdatedPackages();if(!(Object.keys(r).length>0)){n.succeed("All @webflow packages are up to date");return}if(n.succeed(),!process.stdin.isTTY||V()){this.showUpdateSuggestions(r);return}let s=await this.showUpdatePrompt(r);if(s.length>0){n=u.spinner("Updating");let{local:a,global:l}=s.reduce((m,h)=>(m[r[h].installationType==="global"?"global":"local"].push(h),m),{local:[],global:[]}),{update:c,globalFlag:d,updateCommand:p}=this.packageManager;try{a.length>0&&await c(`${a.map(m=>`${m}@latest`).join(" ")}`),l.length>0&&await c(`${d} ${l.map(m=>`${m}@latest`).join(" ")}`),n.succeed("Updated successfully")}catch{n.fail("Update failed. Manually run: "+J(`${p} ${s.map(h=>`${h}@latest`).join(" ")}`))}}}catch(r){n?.fail("Failed to check for updates"),u.debug(String(r))}}};be();yr();Kn();lf();of();Oe();X();q();be();Me();A();C();M();pe();yr();var ye=require("commander");C();A();function dt(e){let t=Object.fromEntries(e.map(n=>[n.toLowerCase(),n]));return n=>{let r=[],o=[];for(let i of n){let s=t[i.toLowerCase()];s?r.push(s):o.push(i)}return{valid:r,invalid:o}}}function _e(e,t,n){let r=e.split(",").map(s=>s.trim()),{valid:o,invalid:i}=t(r);if(o.length===0)throw new f(`No valid fields specified. Available: ${n.join(", ")}`,{isUserError:!0});return i.length>0&&u.warn(`Unknown field(s): ${i.join(", ")}. Available: ${n.join(", ")}`),o}pe();A();var eD=(e,t)=>e+" ".repeat(Math.max(0,t-bt(e).length));function qe(e,t){let n=e.map((s,a)=>Math.max(bt(s).length,...t.map(l=>bt(String(l[a])).length))),r=n.map(s=>"\u2500".repeat(s+2)).join("\u2500"),o=e.map((s,a)=>eD(s,n[a]+2)).join(""),i=t.map(s=>s.map((a,l)=>eD(String(a),n[l]+2)).join("")).join(`
|
|
38
|
+
`);return`${o}
|
|
39
|
+
${r}
|
|
40
|
+
${i}`}function Fi(e){return e?`
|
|
41
|
+
|
|
42
|
+
More: pass --cursor ${e}`:""}var tD=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],nD=["id","url","lastPublished","fullSiteCompiledAt"],rD=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],uc="id,name,siteId,createdAt",Ff="id,name,description,siteId,appPath,createdAt",dc="id,url,lastPublished",pc="id,branch,deployUrl,latestDeploymentStatus,createdAt",XR=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function YR(e,t){return e==null||e===""?I("\u2014"):XR.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function da(e,t,n){if(e.length===0)return I(n);let r=t.map(i=>se(i)),o=e.map(i=>t.map(s=>YR(i[s],s)));return qe(r,o)}var fc=dt(tD),oD=dt(nD),iD=dt(rD);function vr(){return tD}function pa(){return nD}function fa(){return rD}function mc(e,t=uc.split(",")){return da(e,t,"No apps found.")}function sD(e,t=dc.split(",")){return da(e,t,"No domains found.")}function aD(e,t=pc.split(",")){return da(e,t,"No environments found.")}function lD(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 ZR=["success","failed","canceled","unstaged"],gc=5,hc=600;function cD(e){return ZR.includes(e)}var uD=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],ma="id,status,sourceType,commitHash,buildStartedAt",yc=dt(uD);function Sr(){return uD}function ga(e,t=ma.split(",")){return da(e,t,"No deployments found.")}yr();var _f=()=>new ye.Option("--no-input","Avoid prompting or doing anything interactive. Use this for CI/CD pipelines. Auto-enabled when CI=true, when stdout or stdin is not a TTY, or when a coding agent's execution environment is detected."),Af=()=>new ye.Option("--region <region>",`Webflow region to target: ${no.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(no),dD=()=>new ye.Option("--input","Force interactive mode, overriding the automatic no-input detection."),Rf=()=>new ye.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),If=()=>new ye.Option("--skip-update-check","Skip checking for @webflow packages updates"),Tf=()=>new ye.Option("--verbose","Display more information for debugging purposes."),zn=()=>new ye.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),It=()=>new ye.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),_i=e=>{if(e.trim()==="")throw new ye.InvalidArgumentError("must be a non-empty value.");return e},wc=(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.`,bc=e=>new ye.Option("--q <text>",`Case-insensitive substring (contains) match on ${e}. Use it to discover matches; it never searches ids or variable values. For an exact single-item lookup, prefer the exact filter instead.`).argParser(_i),ee=()=>new ye.Option("--json","Output as JSON"),ha=()=>new ye.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),ya=()=>new ye.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),Pf=()=>new ye.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),Ae=()=>new ye.Option("--dry-run","Preview without executing"),Ai=()=>new ye.Option("-y, --yes","Skip confirmation prompt"),Ri=()=>new ye.Option("--order <dir>","Sort direction: asc or desc").default("asc"),Dc=()=>new ye.Option("-a, --agent <ids>",'Target coding agent, repeatable and comma-separated (e.g. --agent claude-code,cursor). Use "all" for every supported agent.').argParser((e,t)=>[...t??[],e]),wa=()=>new ye.Option("-g, --global","Operate on the per-user (home directory) install"),ba=()=>new ye.Option("-p, --project","Operate on the current project's install"),He=e=>new ye.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),Ii=e=>new ye.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),kc=()=>new ye.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),Ec=()=>new ye.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),QR=100,vc=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new ye.InvalidArgumentError("must be a positive integer.");return t},$f=()=>new ye.Option("--limit <n>","Max log lines to return (default: 100)").default(QR).argParser(vc),e0=20,pD=()=>new ye.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(e0).argParser(vc),fD=e=>{let t=Number(e);if(!Number.isInteger(t))throw new ye.InvalidArgumentError("must be an integer number of seconds.");return t},mD=()=>new ye.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(gc).argParser(fD),gD=()=>new ye.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(hc).argParser(fD),Da=e=>async(t,n)=>{let o={...n.parent?.opts()||{},...t};await e(o)};var yD=e=>{let t=e.command("auth").description("Authentication and configuration commands");t.command("login").description("Authenticate with Webflow and save credentials to .env file").option("-f, --force","Force reauthentication even if credentials exist").action(async n=>{if(V()){u.info(`${k} No-input mode enabled. Aborting OAuth authentication`);return}let{manifest:r}=ne();if(!n.force&&Si()?.accessToken){let i=ao(r);u.info(`${P} Webflow credentials already exist (${ct().toUpperCase()}):`),i&&u.info(` Site ID: ${i}`),u.info(" API Token: [hidden]"),u.info(`
|
|
43
|
+
Use --force flag to reauthenticate anyway`);return}try{u.info(`${nt} Authenticating against the ${ct().toUpperCase()} region...`);let o=await T({force:!0});Jn({apiToken:o}),u.info(`
|
|
44
|
+
You can now use other Webflow CLI commands that require authentication`)}catch(o){throw new f(o,{prefix:`${k} Authentication failed:`})}}),t.command("status").description("Show current authentication status").addOption(ee()).action(async n=>{let r=ct(),o=Si(),i=o?.accessToken?null:Ht(),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){n.json?u.info(JSON.stringify({loggedIn:!1,region:r},null,2)):u.info(`${k} Not logged in to the ${r.toUpperCase()} region. Run ${J("webflow auth login")} to authenticate.`),process.exitCode=1;return}try{let c=await Cf(s);if(!c){n.json?u.info(JSON.stringify({loggedIn:!1,region:r,error:"invalid_or_expired_token"},null,2)):u.info(`${k} Token is invalid or expired. Run ${J("webflow auth login --force")} to reauthenticate.`),process.exitCode=1;return}if(n.json){u.info(JSON.stringify({loggedIn:!0,region:a?"unknown":r,user:{firstName:c.firstName,lastName:c.lastName,email:c.email},scopes:o?.scopes??[],...l?{tokenSource:l}:{}},null,2));return}u.info(`${P} Logged in as ${c.firstName} ${c.lastName} (${c.email})`),u.info(l?` Region: unknown (from ${l})`:` Region: ${r.toUpperCase()}`),o?.scopes?.length&&u.info(` Scopes: ${o.scopes.join(", ")}`),u.info(` Session: ${Dr()}`)}catch(c){throw new f(c,{prefix:`${k} Failed to fetch auth status:`})}}),t.command("logout").description("Log out and remove the stored credentials").action(async()=>{let n=ua();if(kf(),!n){u.info(`${P} No stored session to log out of.`);return}u.info(`${P} Logged out of the ${n.toUpperCase()} region.`),u.info(`${nt} Run ${J("webflow auth login")} to authenticate again.`)}),t.command("telemetry").description("Manage telemetry settings for all Webflow CLI commands").option("--enable","Enable telemetry for all commands").option("--disable","Disable telemetry for all commands").option("--status","Show current telemetry status").option("--local","Write the preference to the current directory's webflow.json instead of the global config").action(async n=>{let r=hr.getInstance();if(n.status){let s=await r.getTelemetryStatus();u.info(hD(s.enabled));return}if(n.enable){await r.setPreference(!0,{local:n.local}),u.info(Of(!0));return}if(n.disable){await r.setPreference(!1,{local:n.local}),u.info(Of(!1));return}let o=await r.getTelemetryStatus();if(u.info(hD(o.enabled)),V()){u.info("\u{1F4A1} When --no-input mode is enabled please provide --enable or --disable option");return}let i=await Be({message:"What would you like to do?",choices:[{name:"Enable telemetry for all commands",value:"enable"},{name:"Disable telemetry for all commands",value:"disable"},{name:"Cancel",value:"cancel"}]});if(i==="enable"||i==="disable"){let s=i==="enable";await r.setPreference(s,{local:n.local}),u.info(Of(s))}})},Of=e=>`${P} Telemetry ${e?"enabled":"disabled"} for all Webflow CLI commands`,hD=e=>`${Ce} Telemetry status: ${e?`enabled ${P}`:`disabled ${k}`}`;var ND=w(require("http")),jD=w(require("node-fetch")),MD=w(require("serve-handler")),BD=require("fs"),UD=w(require("path")),WD=require("commander");var bD=w(require("archiver")),Nf=require("commander"),Cc=require("fs");var wD=require("cosmiconfig"),Lf=require("commander"),Sc=async(e,t)=>{let n=await t0(t),r=n.config.apiVersion;return r&&typeof r!="string"&&Lf.program.error('Error: The apiVersion field in webflow.json must be a string (i.e. "apiVersion": "2").'),{filepath:n.filepath,config:{publicDir:e,...n.config}}},t0=async e=>{let n=await(0,wD.cosmiconfig)("webflow",{searchPlaces:[e]}).search();return n||Lf.program.error(`No ${e} file was found. Run this command within your extension folder.`),n};var DD=w(require("mime-types")),xc=w(require("path")),n0=5*1024*1024,r0=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"]),kD=async(e,t,n)=>{let{config:r,filepath:o}=await Sc(e,t),i=xc.join(o,".."),s=!0,a=!1,l=d=>{let p=d.name,m=DD.default.lookup(p);return p==="index.html"&&(a=!0),p&&p.endsWith(".DS_Store")||!m?!1:r0.has(m)?d:(console.log(`Invalid file type: ${m} for file: ${p}`),s=!1,!1)},c=d=>{(0,Cc.unlink)(n,p=>{p&&console.error(`Failed to delete file: ${p}`),Nf.program.error(d)})};return console.log(`Packaging the contents of the ${r.publicDir} folder into ${n}...`),new Promise(d=>{let p=(0,bD.default)("zip",{zlib:{level:9}}),m=(0,Cc.createWriteStream)(xc.join(i,n));m.on("close",()=>{d(void 0)}),p.directory(xc.join(i,r.publicDir),!1,l),p.file(o,{name:t}),p.pipe(m),p.finalize(),p.on("warning",h=>{console.log(h)}),p.on("error",h=>{Nf.program.error(h.message)}),p.on("finish",()=>{if(!a){c("Could not find index.html in your `publicDir`, all Designer Extension code needs to be inside of `publicDir`");return}if(!s){c("Bundling failed due to invalid file types");return}if(!p.pointer()||p.pointer()===0){c("Bundling failed with no output");return}if(p.pointer()>=n0){c("Bundling failed due to the bundle exceeding 5MB");return}console.log(`${p.pointer()} total bytes written`),console.log(`Done! ${n} is ready for you to upload to your Webflow app.`)})})};var ka=w(require("path")),Fn=w(require("fs/promises")),Ac=w(require("fs")),vD=require("url"),iU=require("dotenv/config"),SD=["js","cjs","json"],Bf=process.cwd(),xD=".webflowrc",Xn=ka.extname(Ac.readdirSync(Bf).find(e=>e.includes(xD))??"").replace(/\./g,""),qn=ka.join(Bf,`${xD}${Xn&&`.${Xn}`}`),CD=Ac.existsSync(qn),jf=class extends Error{constructor(){super(`Missing extension for .webflowrc file. The supported extensions are: ${SD.join(", ")}`)}},Fc=class extends Error{constructor(){super(`Unsupported extension for .webflowrc: ${Xn}. The supported extensions are: ${SD.join(", ")}`)}},_c=class extends Error{constructor(t){let n=t.includes(".webflowrc"),r=t.includes("webflow.json"),o;n?o=`It seems like you don't have a .webflowrc file in your project (${t}). Make sure there is a .webflowrc file in your project root.`:r?o=`It seems like you don't have a webflow.json file in your project (${t}). Make sure there is a webflow.json file in your project root.`:o=`It seems like you don't have a config file in your project (${t}). Make sure there is a config file in your project root.`,super(o)}},Mf=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 o0(e){return(await import(process.platform==="win32"&&e?.match(/[a-zA-Z]:[\\\/]/)?(0,vD.pathToFileURL)(e).href:e)).default}function ED(e,t){let n=t.filter(r=>!e[r]);if(n.length)throw new Mf(n.join(", "))}async function Ti(e=[],t=!1){if(!CD){if(t)return{};throw new _c(qn)}if(!Xn)throw new jf;switch(Xn){case"js":case"cjs":{await Fn.access(qn);let n=await o0(qn);return ED(n,e),n}case"json":{let n=JSON.parse(await Fn.readFile(qn,"utf8"));return ED(n,e),n}default:throw new Fc}}function i0(e,t){if(Xn==="js"||Xn==="cjs"){let r=new RegExp(`${t}: process.env.([\\w]+),`,"gi").exec(e);if(r)return r[1]}}function s0(e,t,n){let r=i0(t,n);if(r){let o=new RegExp(`${n}: ".*?",`,"g");return e.replace(o,`${n}: process.env.${r},`)}return e}async function a0(e){let t=["authToken","host","siteId"],n=await Fn.readFile(qn,"utf-8");for(let r of t)e=s0(e,n,r);return e}async function l0(){try{let e=ka.join(Bf,"package.json");return await Fn.access(e),JSON.parse(await Fn.readFile(e,"utf-8"))?.type==="module"}catch{return!1}}async function FD(e){if(!CD)throw new _c(qn);let t=JSON.stringify(e,null,2);switch(Xn){case"js":case"cjs":{let n=await a0(t.replace(/"([^"]+)":/g,"$1:")),r=await l0()&&Xn==="js"?"export default ":"module.exports = ";return Fn.writeFile(qn,r+n)}case"json":return Fn.writeFile(qn,t);default:throw new Fc}}var xr=w(require("fs")),Vt=w(require("path"));var Ea="webflow.json",_D="index.html",AD="bundle.zip",Uf="public",Wf="extension-scaffolds",Rc="default";var RD="package.json",ID="wf-placeholder-name",Hf=e=>JSON.stringify(e,null,2),TD=e=>{let t="\u2500".repeat(e.length+2);return"\u256D"+t+`\u256E
|
|
40
45
|
\u2502 `+e+` \u2502
|
|
41
|
-
\u2570`+t+"\u256F"};var
|
|
42
|
-
`)},
|
|
46
|
+
\u2570`+t+"\u256F"};var PD=async(e,t="./",n=Rc,r)=>{let o=r[n];try{for(let i of o){let s=Vt.join(t,i),a=d0(s,n,e);if(i.includes(RD)||i.includes(Ea))await u0(i,a,e);else{let l=await xr.promises.readFile(i);await LD(a,l)}}}catch(i){console.error("Error writing file, ",i)}},$D=async()=>{let e={},t=Vt.resolve(__dirname),n=Vt.join(t,Wf),r=await xr.promises.readdir(n);for(let o of r){let i=Vt.join(n,o),s=await OD(i);e[o]=s}return e},OD=async e=>{let t=[];try{let n=await xr.promises.readdir(e);for(let r of n){let o=Vt.join(e,r);if((await xr.promises.stat(o)).isDirectory()){let s=await OD(o);t.push(...s)}else t.push(o)}}catch(n){console.error(`Error reading ${Vt}, `,n)}return t},LD=async(e,t)=>{try{await xr.promises.mkdir(Vt.dirname(e),{recursive:!0}),await xr.promises.writeFile(e,t)}catch(n){console.error("Error writing file ",n)}},u0=async(e,t,n)=>xr.promises.readFile(e,"utf8").then(async r=>{let o=r.replace(ID,n);await LD(t,o)}),d0=(e,t,n)=>{let r=Vt.join(Wf,t),o=e.indexOf(r);if(o!==-1){let i=e.substring(o+r.length+1);return Vt.join(n,i)}return""};var Ic=async()=>await $D(),HD=async()=>{let e=await Ic(),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"')},VD=async(e,t=Rc)=>{let n=`./${e}`;console.log(`Scaffolding your new extension named: ${e}...`);let r=await Ic();await PD(e,n,t,r),console.log(`Done! Check out ${n}/README.md for steps on how to develop your extension.`)},GD=()=>kD(Uf,Ea,AD),KD=async e=>{let{config:t,filepath:n}=await Sc(Uf,Ea),r=UD.join(n,"..",t.publicDir,_D),i=(await Ti([],!0)).extensionTemplateDomain||"webflow-ext.com",s=t.apiVersion==="2"?"template/v2":"template",a=Object.keys(t.featureFlags||{}).map(h=>t.featureFlags?.[h]===!0?`ff_on=${h}`:`ff_off=${h}`).join("&"),l=a?`&${a}`:"",d=await(await(0,jD.default)(`https://${i}/${s}?name=${t.name}${l}`)).text(),p=new ND.Server((h,g)=>{if(h.url==="/"){BD.promises.readFile(r,{encoding:"utf-8"}).catch(y=>{WD.program.error(y.message)}).then(y=>{let b=d.replace("{{ui}}",y);return g.writeHead(200,{"Content-Length":Buffer.byteLength(b),"Content-Type":"text/html"}),g.end(b)});return}if(h.url==="/__webflow")return g.writeHead(200,{"Content-Length":Buffer.byteLength(Hf(t)),"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}),g.end(Hf(t));(0,MD.default)(h,g,{public:t.publicDir,cleanUrls:!1,directoryListing:!1})}),m=p0(e);p.listen(m),console.log(TD(`Serving your extension at http://localhost:${m}`)+`
|
|
47
|
+
`)},p0=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 JD=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(HD),t.command("init").description("Bootstrap a Designer Extension.").argument("[projectName]","What is your Designer Extension's name?").argument("[scaffoldName]","Which project template do you want to use?").action(async(n,r)=>{let o=await Ic(),i=Object.keys(o),s=await Ke({message:"What would you like to name your Designer Extension?",default:n,validate:l=>l.trim()===""?"The Designer Extension name cannot be empty.":!0});if(s===null)throw new f("When --no-input mode is enabled please provide the [projectName] argument.");let a=await Be({message:"Which project template would you like to use?",choices:i.map(l=>({name:l,value:l})),default:r||"default"});await VD(s,a)}),t.command("bundle").description("Prepare package that can be uploaded to Webflow.").action(GD),t.command("serve").description("Serve your extension locally.").argument("[port]","The port to serve your extension on").action(KD)};var qf=w(require("process"));A();De();Me();var qD=w(require("fs"));C();async function Pc(e){let{authToken:t,siteId:n}=e||{},{path:r,isUserDefined:o}=ln(),i=qD.existsSync(r),s=!1;try{let{manifest:a}=ne();s=!0,o&&u.info(`Using manifest file: ${r}`);try{let l=Xs(a,"devlink");if(!t||!n)throw new Error(`Missing Site ID or API token. Make sure you have WEBFLOW_API_TOKEN and WEBFLOW_SITE_ID set in your environment variables, or pass them as arguments --site and --api-token.
|
|
43
48
|
|
|
44
49
|
To set up your credentials, run:
|
|
45
|
-
webflow auth login`);return
|
|
50
|
+
webflow auth login`);return zD(l?.relativeHrefRoot),{...l,host:$(),authToken:t,siteId:n,cssModules:!!l?.cssModules,components:Tc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(l){throw new f(l,{prefix:`Failed to read devlink config from manifest file: ${r}
|
|
46
51
|
`})}}catch(a){if(o||i||s){let l=o?`The manifest file specified via --manifest flag was not found or is invalid: ${r}
|
|
47
52
|
`:`Your manifest file exists but is invalid or missing required properties: ${r}
|
|
48
|
-
`;throw new f(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),n||a.push("siteId");let l=await
|
|
53
|
+
`;throw new f(a,{prefix:l})}}try{let a=[];t||a.push("authToken"),n||a.push("siteId");let l=await Ti(a);return zD(l?.relativeHrefRoot),{...l,host:l.host||$(),cssModules:!!l?.cssModules,components:Tc(l?.components),fileExtensions:l?.fileExtensions,...e}}catch(a){throw a instanceof Error&&a.message.includes(".webflowrc")&&(a.message=`No configuration file found. Please create either:
|
|
49
54
|
- webflow.json with a "devlink" section, or
|
|
50
55
|
- .webflowrc file
|
|
51
|
-
in your project root.`),new f(a)}}function
|
|
56
|
+
in your project root.`),new f(a)}}function zD(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 Tc(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(t=>`^${t}$`).join("|")}Gf();lt();C();var Pi=class extends Error{};function h0(e){try{let t=JSON.parse(e);if(t.msg&&typeof t.msg=="string")return t.msg}catch{}return null}async function y0(e){switch(e.status){case 400:{let t=await e.text(),n=h0(t);throw new Pi(n||"Bad request: The server rejected the request due to invalid input. Please check your configuration and try again.")}case 401:throw new Pi("Your access token is invalid for the provided siteId. Double check your configs in your .webflowrc configuration file.");case 404:throw new Pi("`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 Pi(`Something went wrong (HTTP ${e.status}).`)}}async function w0(e){try{let{siteId:t,host:n,authToken:r,...o}=e,i=await G(`${n}/devlink/${t}`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(o),timeout:6e4});return i.ok?await i.json():y0(i)}catch(t){throw new f(t,{skipLogging:!0})}}async function Kf(e){try{let t=await w0(e);if(!t.files||!Array.isArray(t.files))throw new f("Invalid response format from V1 API: expected 'files' array");let n=t.metadata?.exportCoverage==="full";return await Oc(t.files,e.rootDir,n),{messages:t.messages}}catch(t){throw t instanceof f?t:new f(t,{skipLogging:!0})}}var co=w(require("process"));A();Me();lt();var Jf=class{config;error;constructor(t,n){this.config=t,this.error=n}stripPII(t=""){return t.replace(/\/(.*)webflow-cli/gi,"/REDACTED_PII/webflow-cli/").replace(/\/(.*)node_modules/gi,"/REDACTED_PII/node_modules")}sendTelemetry(){let t=this.config,n=this.error;G(`${t.host}/devlink/${t.siteId}/telemetry`,{headers:{Authorization:`Bearer ${t.authToken}`,"Content-Type":"application/json"},method:"post",body:JSON.stringify({cause:n.cause,message:n.message,name:n.name,stack:this.stripPII(n.stack),platform:co.default.platform,node:co.default.version})})}async storeChoice(t){try{return xe({devlink:{allowTelemetry:t}})}catch{let r=await Ti();await FD({...r,allowTelemetry:t})}}async prompt(){let t=this.config;u.error(this.error),t.allowTelemetry===!0?this.sendTelemetry():t.allowTelemetry===void 0&&(await this.storeChoice(!0),this.sendTelemetry())}};function Lc(e){return async function(n){co.default.removeListener("uncaughtException",Lc),co.default.removeListener("unhandledRejection",Lc);let r=await Pc(e);if(!r)return;await new Jf(r,n).prompt()}}function XD(e){co.default.on("uncaughtException",Lc(e)),co.default.on("unhandledRejection",Lc(e))}X();A();q();Me();zf();async function YD(e,t){let n=Date.now(),{manifest:r}=ne(),{accessToken:o,siteId:i}=await ze(r,{site:t?.site,apiToken:t?.apiToken}),s={...o?{authToken:o}:{},...i?{siteId:i}:{},...e&&e.length>0?{components:Tc(e),overwriteModule:!1}:{overwriteModule:!0}};XD(s);let a=await Pc(s);if(!a)return qf.default.exit();let l;try{l=F.forDevlinkSync(a)}catch(d){u.debug(`Failed to initialize telemetry: ${d}`)}await l?.sendUsage("devlink_sync_start",{specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot});let c=u.spinner(`Exporting components into ${a.rootDir}`);try{let{messages:d}=await Kf(a);c.succeed(`Successfully exported components into ${a.rootDir} folder`),Nc(d);let p=Date.now()-n;await l?.sendUsage("devlink_sync_success",{duration:p,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot})}catch(d){let p=d instanceof Error?d.message:String(d);c.fail(`Failed to export components: ${p}`);let m=Date.now()-n;throw await l?.sendError(d instanceof Error?d:new Error(String(d)),"devlink_sync_failure",{duration:m,specificComponents:e&&e.length>0,componentCount:e?.length||0,cssModules:a.cssModules,overwriteModule:a.overwriteModule,relativeHrefRoot:a.relativeHrefRoot,configOverrides:Object.keys(s),argv:qf.default.argv.slice(2)}),d}}Vc();var Rr=require("commander");var fo=require("path"),Ui=require("@webflow/data-types");De();var Gc=require("fs"),rm=w(require("md5"));function Sa(e,t){try{let n=(0,Gc.statSync)(e),r=(0,Gc.readFileSync)(e);return{value:r,meta:{title:e.replace(/^.*[\\\/]/,""),fileHash:(0,rm.default)(r),size:n.size,...t||{}}}}catch{throw new Error(`File '${e}' not found`)}}function xa(e,t,n){try{let r=new Blob([e]).size,o=Buffer.from(e,"utf-8");return{value:o,meta:{title:t.replace(/^.*[\\\/]/,""),fileHash:(0,rm.default)(o),size:r,...n}}}catch{throw new Error(`Error parsing '${t}' inline file`)}}var wk=w(require("node-fetch")),bk=w(require("form-data"));async function Ca(e,t){let n={...t.fields,file:e.value},r=new bk.default;Object.entries(n).forEach(([i,s])=>{r.append(i,s)});let o=await(0,wk.default)("https://"+t.fields.bucket+".s3.amazonaws.com",{method:"POST",body:r});F0(o)}function F0(e){switch(e.status){case 200:case 201:return;case 403:throw new Error("Unauthorized. Please check your AWS access key");default:throw new Error(`Something went wrong when uploading the file: ${e.statusText}`)}}A();Me();X();De();lt();pe();function _0({apiToken:e=process.env.WEBFLOW_API_TOKEN??process.env.WEBFLOW_WORKSPACE_API_TOKEN??process.env.WEBFLOW_SITE_API_TOKEN,siteId:t=process.env.WEBFLOW_SITE_ID,libraryTarget:n=process.env.WEBFLOW_LIBRARY_TARGET}){if(!e)throw new Error("No API token provided");if(n==="site"){if(!t)throw new Error("No site provided");return{baseUrl:`${$()}/v2/sites/${t}`,authToken:e}}return{baseUrl:`${$()}/v2/workspaces`,authToken:e}}function A0(e){if(e)return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)))}async function R0(e){if(e.ok)return;if(e.status===401||e.status===403)throw new Error(`Your API token is invalid or not authorized to perform this action. Run ${J("webflow auth login --force")} to generate a new token.`);if(e.status===404)throw new Error("Code components are rolling out in phases. Check back soon for access.");let t=await e.json();throw new Error(t.message||e.statusText)}async function Fr({endpoint:e,method:t="GET",body:n,options:r}){let{baseUrl:o,authToken:i}=_0(r),s=`${o.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`,a=await G(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:A0(n)});return await R0(a),a.json()}async function om({options:e}){return(await Fr({endpoint:"/code_libraries",options:e})).payload.workspaces[0]}async function im({name:e,description:t,slug:n,options:r}){return(await Fr({method:"POST",endpoint:"/code_library/init",body:{name:e,description:t,slug:n},options:r})).payload}async function sm({resourceId:e,files:t,options:n}){return(await Fr({method:"POST",endpoint:`/code_library/${e}/files`,body:{files:t},options:n})).payload}async function am({resourceId:e,codeModule:t,components:n,options:r}){return(await Fr({method:"POST",endpoint:`/code_library/${e}/share`,body:{codeModule:t,components:n},options:r})).payload}var Ni=require("path"),uE=w(require("webpack-merge")),po=require("@webflow/data-types");De();A();var Ek=require("memfs/lib/volume"),Fa=require("@webflow/data-types");var _n="./tmp_entry",Dk="components";function Kc(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+|[^\p{L}\p{N}]/gu," ").toLowerCase().replace(new RegExp("(?:^|\\s)(\\p{L})","gu"),(t,n)=>n.toUpperCase()).replace(/\s+/g,"")}function I0(e){let t=Kc(e);return/^[a-zA-Z]/.test(t.charAt(0))?t:"_"+t}function kk(e,t){let n=e.map(({name:l,path:c,isDefaultExport:d})=>d?`import ${l} from "${c}";`:`import { ${l} } from "${c}";`).join(`
|
|
52
57
|
`),r=e.filter(l=>l.type==="internal").map(({name:l,exportKey:c})=>`${c}: ${l}`).join(", "),o=e.filter(l=>l.type==="component").map(({name:l,exportKey:c})=>`"${c}": ${l}`).join(", "),i=`env: "${t}"`,s=r,a=o?`components: { ${o} }`:void 0;return`${n}
|
|
53
58
|
|
|
54
|
-
export default { ${[i,s,a].filter(Boolean).join(", ")} };`}function qD(e,t,n,r){let o={},i=`${xn}/Client.js`,s=`${xn}/Server.js`;o[i]=JD([{name:"ClientRenderer",path:e.client,exportKey:"Renderer",type:"internal"}],ua.Environment.Client);let a={},l=p=>{let d=fR(p);return a[d]?(a[d]+=1,`${d}${a[d]}`):(a[d]=1,d)};o[s]=JD([{name:"ServerRenderer",path:e.server,exportKey:"Renderer",type:"internal"},...Object.entries(t).filter(([p])=>n[p]?.ssr??!0).map(([p,d])=>{let m=l(p),h=d.startsWith(xn)?d.replace(`${xn}/`,"./"):d;return{name:m,path:h,exportKey:p,isDefaultExport:!0,type:"component"}})],ua.Environment.Server);let c={[ua.Environment.Client]:i,[ua.Environment.Server]:s};return{entryPointsVolume:zD.Volume.fromJSON(o,r),paths:c}}var Nk=require("memfs/lib/volume");var ek=w(require("archiver")),Ei=require("path");De();var da=require("@webflow/data-types");De();A();var vr=e=>e.endsWith("/")||/%2F$/i.test(e)?e:`${e}/`;var XD=2;function YD(e){let t={type:da.ModuleLoader.FEDERATION,version:XD,entry:Kp,renderer:zs,components:e};return{title:Js,content:JSON.stringify(t)}}function ZD(e){let t={type:da.ModuleLoader.SSR,version:XD,entry:gi,components:e};return{title:Js,content:JSON.stringify(t)}}function QD(e){let t=`/${da.Environment.Client}/${Kp}`;try{if(e.existsSync(t)){let n=e.readFileSync(t,"utf8"),r=JSON.parse(n.toString()),o="publicPath"in r.metaData?r.metaData.publicPath:null;if(!o)throw new Error("Public path not found in module federation manifest");return r.exposes.reduce((i,s)=>{let a=s.name;return a===zs||(i[a]={css:[]},s.assets.css.sync.forEach(l=>{i[a].css.push(`${vr(o)}${l}`)})),i},{})}}catch(n){u.error(n,{prefix:"Failed to extract components metadata from MF manifest:"})}return{}}var Fc=require("@webflow/data-types"),mR=/\.css$/i;async function tk(e,t,n){let r=!1;return new Promise(async(o,i)=>{e.length===0&&i(new Error("No assets to bundle"));let s=`/${Fc.Environment.Server}/${qs}`,a=(0,ek.default)("tar",{gzip:!1}),l=t.createWriteStream(s);a.on("error",d=>(r=!0,i(d))),l.on("close",()=>{if(!r)try{let d={type:"asset",name:qs,info:{},size:a.pointer(),emitted:!0,comparedForEmit:!1,cached:!1};return e.forEach(m=>{let h=(0,Ei.resolve)((0,Ei.join)(`/${Fc.Environment.Server}`,m.name));t.existsSync(h)&&t.rmSync(h)}),o([d])}catch(d){return i(d)}finally{r=!0}}),a.pipe(l);let{title:c,content:p}=ZD(n);a.append(p,{name:c}),e.forEach(d=>{if(!mR.test(d.name))try{let m=(0,Ei.resolve)((0,Ei.join)(`/${Fc.Environment.Server}`,d.name)),h=t.readFileSync(m,"utf8");a.append(h,{name:d.name})}catch(m){return r=!0,i(m)}}),await a.finalize()})}var nk=require("@webflow/data-types");async function rk(e,t,n){let{title:r,content:o}=YD(n);await t.promises.writeFile(`/${nk.Environment.Client}/${r}`,o);let i={type:"asset",name:r,info:{},size:o.length,emitted:!0,comparedForEmit:!1,cached:!1};return e.filter(s=>s.name!=="mf-stats.json").concat([i])}var Ak=require("@rspack/core"),Rk=w(require("fork-ts-checker-webpack-plugin")),Ik=require("ts-checker-rspack-plugin"),Tk=w(require("mini-css-extract-plugin")),Pk=require("@webflow/data-types");var ik=require("webpack"),Vf=w(require("mini-css-extract-plugin")),sk=w(require("tsconfig-paths-webpack-plugin")),ak=require("tsconfig-paths"),Gf=require("@webflow/data-types"),lk=require("path");De();var ok=w(require("postcss-selector-parser")),Hf=()=>({postcssPlugin:"CSSinShadowDOM",Once(e){e.walkRules(t=>{t.selector=(0,ok.default)(n=>{n.walkPseudos(r=>{r.value===":root"&&(r.value=":host")})}).processSync(t.selector)})}});Hf.postcss=!0;Hf.postcssPlugin="CSSinShadowDOM";var _c=Hf;function gR(e){let t=(0,ak.loadConfig)(e);return t.resultType==="success"?t.configFileAbsolutePath:void 0}function ck({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i,projectDir:s}){let a={mode:n,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Vf.default.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[_c]}}}]},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Vf.default({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:{plugins:[(()=>{let l=gR(s);return l?new sk.default({context:s,configFile:l}):null})()].filter(Boolean)},performance:{hints:!1}};if(t===Gf.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,lk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Gf.Environment.Server)return{...a,plugins:[...a.plugins||[],new ik.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:gi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var uk=require("@module-federation/enhanced"),Kf=require("@webflow/data-types");function dk({libraryName:e,env:t,exposes:n}){if(t===Kf.Environment.Client)return{plugins:[new uk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===Kf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}function pk(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,use:[{ident:"babel-loader",loader:require.resolve("babel-loader"),options:{presets:[require.resolve("@babel/preset-env"),[require.resolve("@babel/preset-react"),{runtime:"automatic"}],require.resolve("@babel/preset-typescript")]}}]}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}function Ac(){return{module:{rules:[{test:/\.(js|ts)x?$/,exclude:/node_modules/,loader:"builtin:swc-loader",options:{jsc:{parser:{syntax:"typescript",tsx:!0},transform:{react:{runtime:"automatic",development:!1,refresh:!1}}}}}]},resolve:{extensions:[".tsx",".ts",".jsx",".js",".json"]}}}var Rc=require("@rspack/core"),fk=require("tsconfig-paths"),Jf=require("@webflow/data-types"),mk=require("path");De();function hR(e){let t=(0,fk.loadConfig)(e);if(t.resultType==="success")return t.configFileAbsolutePath}function gk({entry:e,env:t,mode:n="production",publicPath:r,libraryName:o,outputPath:i,projectDir:s}){let a={mode:n,context:s,module:{rules:[{test:/\.css$/i,use:[{ident:"mini-css-extract-loader",loader:Rc.rspack.CssExtractRspackPlugin.loader},{ident:"css-loader",loader:require.resolve("css-loader"),options:{importLoaders:1}},{ident:"postcss-loader",loader:require.resolve("postcss-loader"),options:{postcssOptions:{plugins:[_c]}}}],type:"javascript/auto"},{test:/\.(png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"[hash]-[name][ext]"}}]},plugins:[new Rc.rspack.CssExtractRspackPlugin({filename:"[contenthash].css",chunkFilename:"[contenthash].css",runtime:!1})],resolve:(()=>{let l=hR(s);return l?{tsConfig:{configFile:l}}:{}})(),performance:{hints:!1}};if(t===Jf.Environment.Client)return{...a,entry:()=>({}),output:{path:i?(0,mk.join)(s,i,t):"/",publicPath:r,clean:!0,uniqueName:o},target:"web"};if(t===Jf.Environment.Server)return{...a,plugins:[...Array.isArray(a.plugins)?a.plugins:[],new Rc.rspack.optimize.LimitChunkCountPlugin({maxChunks:1})],entry:e,output:{filename:gi,library:{type:"commonjs2"}},optimization:{splitChunks:!1},target:"async-node"};throw new Error(`Unknown environment ${t}`)}var hk=require("@module-federation/enhanced/rspack"),zf=require("@webflow/data-types");function yk({libraryName:e,env:t,exposes:n}){if(t===zf.Environment.Client)return{plugins:[new hk.ModuleFederationPlugin({name:e,filename:"remoteEntry.js",exposes:n,dts:!1,experiments:{optimization:{disableSnapshot:!0}}})]};if(t===zf.Environment.Server)return{};throw new Error(`Unknown environment ${t}`)}var wR=w(require("fs")),wk=require("unionfs"),bk=require("webpack");function yR(e){return{name:e.name,size:e.size,emitted:e.emitted,info:e.info}}function Ic(e){let t=e.toJson();return{hasErrors:()=>e.hasErrors(),hasWarnings:()=>e.hasWarnings(),toString:n=>e.toString(n),toJson:()=>({...t,assets:(t.assets??[]).map(yR)})}}async function Dk({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((s,a)=>(s.use(a),s),new wk.Union().use(wR));return new Promise((s,a)=>{let l=(0,bk.webpack)(e);l.inputFileSystem=i,n&&(l.outputFileSystem=n),r&&(l.outputPath=r),l.run((c,p)=>{l.close(d=>{c||d?a(c||d):p?p.hasErrors()||o&&p.hasWarnings()?a(new Error(p.toString("errors-warnings"))):s(Ic(p)):a(new Error("Webpack stats are undefined"))})})})}var bR=w(require("fs")),qf=w(require("webpack-merge")),kk=require("memfs"),Ek=require("unionfs"),vk=require("@rspack/core");async function Tc({config:e,sourceVolumes:t=[],outputVolume:n,outputPath:r,failOnWarnings:o=!0}){let i=t.reduce((a,l)=>(a.use(l),a),new Ek.Union().use(bR)),s=e;return t.length>0&&(s=(0,qf.default)(s,{experiments:{...e.experiments,useInputFileSystem:[/./]}})),n&&(s=(0,qf.default)(s,{output:{clean:!1,...r&&{path:r}}})),new Promise((a,l)=>{let c=(0,vk.rspack)(s);c.inputFileSystem=i,n&&(c.outputFileSystem=(0,kk.createFsFromVolume)(n)),r&&(c.outputPath=r),c.run((p,d)=>{c.close(m=>{p||m?l(p||m):d?d.hasErrors()||o&&d.hasWarnings()?l(new Error(d.toString("errors-warnings"))):a(Ic(d)):l(new Error("Rspack stats are undefined"))})})})}var xk=require("@module-federation/enhanced");var vi=w(require("webpack-merge"));A();function Sr(e){return e!==null&&typeof e=="object"&&"constructor"in e?e.constructor.name??"":""}function Sk(e,t){let n=Object.entries(e).filter(([r])=>!t.includes(r));return Object.fromEntries(n)}function DR(e,t){return e instanceof t||Sr(e)==="ModuleFederationPlugin"}function $c(e){let{deduplicatePluginNames:t,ModuleFederationPluginClass:n,getPluginOptions:r,filterOverridePlugins:o}=e;return function(s,a,l){let c=["entry","output","target"],p=kR(s),d=Array.isArray(l)?Pc(...l.map(p)):Pc(p(l));Object.keys(d).some(H=>c.includes(H))&&u.warn(`Cannot override blocked properties: ${c.join(", ")}`);let h={...Sk(d,[...c,"ModuleFederationPlugin","module","plugins"]),module:Sk(d.module??{},["rules"])},g=(0,vi.default)(a,h),y=d.plugins??[];o&&(y=y.filter(o));let b=a.plugins??[],_=(0,vi.mergeWithCustomize)({customizeArray:(0,vi.unique)("plugins",t,H=>Sr(H))})({plugins:y},{plugins:b}).plugins,v=d?.ModuleFederationPlugin?.shared,x=_?.map(H=>{if(DR(H,n)){let B=r(H);return new n({...B,...v?{shared:v}:{}})}return H});g.plugins=x;let O=d.module?.rules;if(O&&typeof O=="function"){let H=a.module?.rules??[];g.module={...g.module??{},rules:O(H)}}return g}}function Pc(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={};for(let n of e){let{module:r,ModuleFederationPlugin:o,plugins:i,...s}=n;if(t={...t,...s},r){let{rules:a,...l}=r;if(t.module={...t.module,...l},a){let c=t.module?.rules;c?t.module.rules=p=>{let d=c(p);return a(d)}:t.module.rules=a}}o?.shared&&(t.ModuleFederationPlugin={shared:{...t.ModuleFederationPlugin?.shared,...o.shared}}),i&&(t.plugins=[...t.plugins??[],...i])}return t}function kR(e){return t=>typeof t=="function"?t(e):t}var ER=$c({deduplicatePluginNames:["ModuleFederationPlugin","MiniCssExtractPlugin"],ModuleFederationPluginClass:xk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{}});function Ck(e,t,n){return ER(e,t,n)}var Fk=require("@module-federation/enhanced/rspack");var vR=$c({deduplicatePluginNames:["ModuleFederationPlugin","CssExtractRspackPlugin"],ModuleFederationPluginClass:Fk.ModuleFederationPlugin,getPluginOptions:e=>e._options??{},filterOverridePlugins:e=>Sr(e)!=="MiniCssExtractPlugin"});function _k(e,t,n){return vR(e,t,n)}var Xf={[Pk.Framework.React]:{generateWebpackBundlerConfig:pk,generateRspackBundlerConfig:Ac}},SR={webpack:{generateBaseConfig:ck,getFrameworkConfig:(e,t)=>Xf[e].generateWebpackBundlerConfig(t),generateFederationConfig:dk,mergeConfigs:(e,t,n)=>Ck(e,t,n),bundle:e=>Dk({...e,config:e.config}),typeCheckerPlugin:Rk.default,hashFunction:"md5",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Sr(t)==="MiniCssExtractPlugin"?new Tk.default({filename:"[name].[contenthash].css"}):t)})},rspack:{generateBaseConfig:gk,getFrameworkConfig:(e,t)=>Xf[e].generateRspackBundlerConfig(t),generateFederationConfig:yk,mergeConfigs:(e,t,n)=>_k(e,t,n),bundle:e=>Tc({...e,config:e.config}),typeCheckerPlugin:Ik.TsCheckerRspackPlugin,hashFunction:"md4",replaceCssPlugin:e=>({...e,plugins:e.plugins?.map(t=>Sr(t)==="CssExtractRspackPlugin"?new Ak.CssExtractRspackPlugin({filename:"[name].[contenthash].css"}):t)})}},Si=e=>SR[e],$k=e=>!!Xf[e];var Ok={colors:!0,chunks:!1,modules:!1,chunkModules:!1,reasons:!1,errorDetails:!1,assetsSpace:1/0,warnings:!1,assets:!0,entrypoints:!0,performance:!0};async function Oc(e){let t=e.bundler??"webpack";u.debug("Generating entry points...");let{entryPointsVolume:n,paths:r}=qD(e.renderer,e.componentsFiles,e.componentsOptions,e.projectDir),o=Nk.Volume.fromJSON({"/Server":null,"/Client":null});u.debug("Generating bundling config...");let i=e.overrideConfig??{};Object.keys(i).length&&u.debug("Found bundle config overrides. Merging...");let s=Si(t),a=b=>{let S=xR({env:b,mode:e.dev?"development":"production",framework:e.framework,publicPath:e.publicPath,components:e.componentsFiles,entryPaths:r,libraryName:e.libraryIdentifier,bundler:t,projectDir:e.projectDir}),_=s.mergeConfigs(b,S,i);return e?.debugBundler&&(u.info(`${t} config for env ${b}:`),u.dir(_)),_},l={sourceVolumes:[...e.sourceVolumes,n],outputVolume:o,failOnWarnings:e.failOnWarnings},[c,p]=await Promise.all([s.bundle({...l,config:a(lo.Environment.Server),outputPath:`/${lo.Environment.Server}`}),s.bundle({...l,config:a(lo.Environment.Client),outputPath:`/${lo.Environment.Client}`})]);e?.debugBundler&&(u.debug(o.toTree()),u.debug(`Server Bundler Stats: ${c.toString(Ok)}`),u.debug(`Client Bundler Stats: ${p.toString(Ok)}`));let d=QD(o);u.debug("Packaging server bundle...");let m=await tk(c.toJson().assets||[],o,d);u.debug("Packaging client bundle...");let h=await rk(p.toJson().assets||[],o,d),g=b=>S=>[S,b];return{outputFiles:[...m.map(g(lo.Environment.Server)),...h.map(g(lo.Environment.Client))],outputVolume:o}}function xR({env:e,mode:t="production",framework:n,publicPath:r,components:o,entryPaths:i,libraryName:s,outputPath:a,bundler:l="webpack",projectDir:c}){if(!$k(n))throw new Error(`Unknown framework: ${n}`);let p=Object.entries({[zs]:i[e],...o}).reduce((y,[b,S])=>{let _=(0,xi.isAbsolute)(S)?S:(0,xi.join)(c,S);return{...y,[`./${b}`]:`./${(0,xi.relative)(c,_)}`}},{}),d=Si(l),m=d.generateBaseConfig({entry:i[e],env:e,mode:t,libraryName:s,publicPath:r,outputPath:a,projectDir:c}),h=d.getFrameworkConfig(n,e),g=d.generateFederationConfig({exposes:p,env:e,libraryName:s});return(0,Lk.default)(m,h,g)}var Bk=w(require("path")),Zf=require("memfs/lib/volume"),Qf=w(require("webpack-merge")),Uk=w(require("webpack-node-externals")),Vt=require("@webflow/data-types");var CR=w(require("fs")),Ci=require("path"),Fi=require("webpack");function FR(e,t,n=CR){let r=(0,Ci.join)(t,"node_modules",e);for(;r!==(0,Ci.dirname)(r)&&r!=="node_modules";){let o=(0,Ci.join)(r,"package.json");if(n.existsSync(o))try{let{name:i,version:s}=JSON.parse(n.readFileSync(o,"utf8"));return`${i}@${s}`}catch{return null}r=(0,Ci.dirname)(r)}return null}var Lc=class{apply(t){let n=t.context;t.hooks.compilation.tap("ProcessSourceMapsPlugin",function(r){r.hooks.processAssets.tap({name:"ProcessSourceMapsPlugin",stage:Fi.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE},function(){try{let o=r.getAssets(),i={};Object.values(o).forEach(({name:s,source:a})=>{if(!s.endsWith(".map"))return;let[l,c,p]=s.split("."),d=i[l]?.sources??{},m=i[l]?.dependencies??new Set;JSON.parse(a.source().toString()).sources.forEach(g=>{if(g.startsWith("external")){let y=g.match(/^external \S+ "(.+)"$/)?.[1];if(!y)throw new Error(`Could not extract package name from ${g}`);let b=FR(y,n,r.inputFileSystem);if(!b)throw new Error(`Could not find package information for ${y}`);b&&m.add(b)}}),i[l]={sources:{...d,[`./${l}.${p}`]:c},dependencies:m},r.deleteAsset(s)}),Object.entries(i).forEach(([s,{sources:a,dependencies:l}])=>{r.emitAsset(`${s}.js.map`,new Fi.sources.RawSource(JSON.stringify({sources:a,dependencies:[...l]})))})}catch(o){r.errors.push(new Fi.WebpackError(`[ProcessSourceMapsPlugin] Could not process source maps: ${o instanceof Error?o.stack:String(o)}`))}})})}};var jk=w(require("module")),Mk=require("jsdom"),Yf="__webflowCliImportModuleWindow__";function _R(e){let n=/^(?:\ufeff?\s*)(?:'use strict'|"use strict");?\s*(?:\r?\n|\r)?/.exec(e),r=!!n,o=`module[${JSON.stringify(Yf)}]`,i=[];r||i.push('"use strict";'),i.push(`var __wfW = ${o};`,'if (__wfW == null) { throw new ReferenceError("Webflow CLI internal: missing JSDOM window on module"); }',"var window = __wfW;","var document = __wfW.document;","var navigator = __wfW.navigator;","var HTMLElement = __wfW.HTMLElement;","var localStorage = __wfW.localStorage;","var sessionStorage = __wfW.sessionStorage;","var requestAnimationFrame = __wfW.requestAnimationFrame.bind(__wfW);","var cancelAnimationFrame = __wfW.cancelAnimationFrame.bind(__wfW);","var getComputedStyle = __wfW.getComputedStyle.bind(__wfW);","var performance = __wfW.performance;","");let s=i.join(`
|
|
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(`
|
|
55
60
|
`)+`
|
|
56
|
-
`;return n?e.slice(0,n[0].length)+s+e.slice(n[0].length):s+e}function
|
|
57
|
-
`)}function
|
|
58
|
-
`)}async function
|
|
61
|
+
`;return n?e.slice(0,n[0].length)+s+e.slice(n[0].length):s+e}function Aa(e,t){let n=e.readFileSync(t,"utf-8"),o=new fE.JSDOM("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/",pretendToBeVisual:!0}).window,i=K0(n),s=new pE.default(t,module);Object.defineProperty(s,hm,{value:o,enumerable:!1,configurable:!0,writable:!1});try{return s._compile(i,t),s}finally{Reflect.deleteProperty(s,hm),o.close()}}function J0(e,t){let n=`/${t}.js`,r=Aa(e,n),o=r.exports.default||r.exports;if(o&&typeof o=="object")try{return(0,Gt.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 z0({declarations:e,sources:t,overrideConfig:n={},performTypeCheck:r,bundler:o="webpack",projectDir:i}){let s=new ym.Volume,a=Li(o),l=(0,wm.default)(a.generateBaseConfig({entry:e,env:Gt.Environment.Client,publicPath:"/",libraryName:"metadata",projectDir:i}),a.getFrameworkConfig(Gt.Framework.React,Gt.Environment.Client),{entry:e,mode:"development",output:{path:"/",library:{type:"commonjs2"}},target:"node",plugins:r?[new a.typeCheckerPlugin]:[]}),c=a.mergeConfigs(Gt.Environment.Client,l,n);return await a.bundle({outputPath:"/",config:c,sourceVolumes:t?[t]:[],outputVolume:s,failOnWarnings:!1}),s}async function q0({declarations:e,sources:t,overrideConfig:n={},bundler:r,projectDir:o}){let i=new ym.Volume,s=Li(r),a=(0,wm.default)(s.generateBaseConfig({entry:e,env:Gt.Environment.Client,publicPath:"/",libraryName:"source-maps",projectDir:o}),s.getFrameworkConfig(Gt.Framework.React,Gt.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 nu],externals:[(0,gE.default)()]}),l=s.mergeConfigs(Gt.Environment.Client,a,n);return l=s.replaceCssPlugin(l),await s.bundle({outputPath:"/",config:l,sourceVolumes:t?[t]:[],outputVolume:i,failOnWarnings:!1}),i}function X0(e){return Object.entries(e.toJSON()).reduce((t,[n,r])=>{if(n.endsWith(".map")&&r?.length){let o=mE.default.basename(n).split(".")[0];t[o]=r}return t},{})}async function ru({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r=!1,skipSourceMaps:o=!1,bundler:i="webpack",projectDir:s}){let[a,l]=await Promise.all([z0({declarations:e,sources:t,overrideConfig:n,performTypeCheck:r,bundler:i,projectDir:s}),o||i==="rspack"?Promise.resolve(null):q0({declarations:e,sources:t,overrideConfig:n,bundler:i,projectDir:s})]),{metadata:c,options:d}=Object.keys(e).reduce((m,h)=>{let g=J0(a,h);return m.metadata[h]=g,m.options[h]=g.options||{},m},{metadata:{},options:{}});return{sourceMaps:l?X0(l):{},metadata:c,options:d}}function hE(e,{framework:t,sourceMaps:n}){return Object.fromEntries(Object.keys(e).map(r=>[r,{...e[r],id:r,framework:t,exportPath:"default",hash:n[r]}]))}Oe();var wE=w(require("md5"));be();pe();M();var bm=" ",bE=`${bm}${nc} `;function Y0(e){return e==="added"?` ${J("(Added)")}`:e==="removed"?` ${le("(Removed)")}`:e==="changed"?` ${je("(Changed)")}`:""}function yE(e){if(!e)return"";let t=JSON.parse(e);return(0,wE.default)(JSON.stringify([...Object.values(t.sources),...t.dependencies.filter(n=>!n.includes("@webflow/data-types")&&!n.includes("@webflow/react"))].sort()))}function Z0({componentsMetadata:e,latestVersion:t,sourceMaps:n}){let r=t.resource.codeLibraryResource.manifest.components.reduce((s,a)=>(s[a.id]=a,s),{}),o={};return Object.entries(r).forEach(([s,a])=>{if(!e[s])o[s]={component:a,status:"removed"};else{let l=e[s],c=yE(n[s]),d=a.displayName&&l.displayName!==a.displayName,p=c&&a.hash&&c!==yE(a.hash),m=d||p;o[s]={component:l,status:m?"changed":"unchanged",previousName:d?a.displayName:void 0}}}),Object.entries(e).forEach(([s,a])=>{r[s]||(o[s]={component:a,status:"added"})}),Object.values(o).map(({component:s,status:a,previousName:l})=>{let c=s.displayName??"Unknown Component",d=l?`${l} ${nt} ${c}`:c;return`${I(`${bE}${d}`)}${Y0(a)}`}).sort().join(`
|
|
62
|
+
`)}function Q0({componentsMetadata:e}){return Object.values(e).map(n=>`${I(bE+(n.displayName??"Unknown Component"))}`).sort().join(`
|
|
63
|
+
`)}async function DE({libraryConfig:e,componentsMetadata:t,existingCodeLibraries:n,sourceMaps:r,workspaceInfo:o}){if(V())return Promise.resolve(!0);let i=e.id?n.find(({profile:d})=>d.slug===e.id):null,s=i&&i.profile.status==="ACTIVE",a=s?Z0({componentsMetadata:t,latestVersion:i,sourceMaps:r}):Q0({componentsMetadata:t}),l=s?`Ready to update ${je(e.name)} on ${op(o.name)}?`:`Ready to share ${je(e.name)} with ${op(o.name)}?`;return await $e({message:`${l}
|
|
59
64
|
|
|
60
|
-
${
|
|
65
|
+
${bm}${I("Code components:")}
|
|
61
66
|
${a}
|
|
62
67
|
|
|
63
|
-
${
|
|
68
|
+
${bm}Confirm to proceed`})}var ou=require("path"),vE=require("memfs/lib/volume");var kE=w(require("fast-glob")),eI=e=>{let t=e.split("/");return t[t.length-1]},tI=e=>eI(e).split(".")[0];async function EE(e,t){return(await kE.default.glob(e,{absolute:!0,...t||{}})).reduce((r,o)=>{let i=tI(o);if(r[i])throw new Error(`Duplicate component '${i}' found. Already declared at ${r[i]}, but also found at ${o}.`);return{...r,[i]:o}},{})}function Tt(e){return e.replace(/\\/g,"/")}async function iu(e,t){let n=await EE(e.components,{cwd:(0,ou.dirname)(e.manifestPath),ignore:["**/dist/**","**/node_modules/**",e.globals,e.bundleConfig].filter(i=>i!=null)});if(!Object.keys(n).length)throw new Error("No declaration files found");let{componentsFiles:r,componentsVolume:o}=nI(n,e.renderer.client,e.globals,t);return{componentsFiles:r,componentsVolume:o}}function nI(e,t,n,r){let o={},i={};return Object.entries(e).forEach(([s,a])=>{let l=(0,ou.extname)(a),c=`${_n}/${Dk}/${s}${l}`;o[s]=c,i[c]=rI(t,a,n)}),{componentsFiles:o,componentsVolume:vE.Volume.fromJSON(i,r)}}function rI(e,t,n){let r=JSON.stringify(Tt(t)),o=JSON.stringify(Tt(e));if(!n)return`
|
|
64
69
|
import componentDefinition from ${r};
|
|
65
70
|
export default {...componentDefinition};
|
|
66
|
-
`.trim();let i=JSON.stringify(
|
|
71
|
+
`.trim();let i=JSON.stringify(Tt(n));return`
|
|
67
72
|
import { applyDecorators } from ${o};
|
|
68
73
|
import componentDefinition from ${r};
|
|
69
74
|
const globals = require(${i}) || {};
|
|
@@ -82,56 +87,51 @@ if (componentDefinition?.component) {
|
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
export default decoratedDefinition;
|
|
85
|
-
`.trim()}q();
|
|
90
|
+
`.trim()}q();Mc();var au=require("path");var SE=require("@webflow/data-types"),su={renderer:{client:"@webflow/react",server:"@webflow/react/server"},components:["**/*.webflow.@(js|jsx|mjs|ts|tsx)"],framework:SE.Framework.React};var Yn=require("path"),Bi=require("fs");Oe();A();Me();be();C();pe();M();function xE(e,t){let n={...e};if(e.globals){let r=(0,Yn.resolve)(t,e.globals);if(!(0,Bi.existsSync)(r))throw new Error(`Globals file not found: ${e.globals}
|
|
86
91
|
Resolved path: ${r}
|
|
87
|
-
Please ensure the file exists or remove the 'globals' field from your manifest.`);n.globals=
|
|
92
|
+
Please ensure the file exists or remove the 'globals' field from your manifest.`);n.globals=Tt(r)}if(e.bundleConfig){let r=(0,Yn.resolve)(t,e.bundleConfig);if(!(0,Bi.existsSync)(r))throw new Error(`Bundle config file not found: ${e.bundleConfig}
|
|
88
93
|
Resolved path: ${r}
|
|
89
|
-
Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);n.bundleConfig=
|
|
94
|
+
Please ensure the file exists or remove the 'bundleConfig' field from your manifest.`);n.bundleConfig=Tt(r)}if(typeof e.renderer=="string"){let r=(0,Yn.resolve)(t,e.renderer);(0,Bi.existsSync)(r)&&(n.renderer=Tt(r))}else if(typeof e.renderer=="object"&&typeof n.renderer=="object"){if(typeof e.renderer.client=="string"){let r=(0,Yn.resolve)(t,e.renderer.client);(0,Bi.existsSync)(r)&&(n.renderer={...n.renderer,client:Tt(r)})}if(typeof e.renderer.server=="string"){let r=(0,Yn.resolve)(t,e.renderer.server);(0,Bi.existsSync)(r)&&(n.renderer={...n.renderer,server:Tt(r)})}}return n}async function oI({initialData:e}){let t=await Ke({message:"Enter a name for your code library",validate:o=>o.trim()===""?"The library name cannot be empty.":!0,default:e?.name});if(t==null)throw new f("When --no-input mode is enabled please provide a name in your library manifest");let n=await Ke({message:"Enter a description for your code library",default:e?.description??""});if(!await $e({message:"Is the code (including 3rd party packages) you are uploading to Webflow trusted and secure?"}))throw new Error("Code library is not trusted and secure");return{name:t,description:n}}async function iI({existingCodeLibraries:e}){let t={name:"[Create new code library]",value:null},r=[...e].sort((i,s)=>{let a=i.resource.codeLibraryResource.manifest.name??"",l=s.resource.codeLibraryResource.manifest.name??"",c=a.localeCompare(l,void 0,{sensitivity:"base"});return c!==0?c:i.profile.slug.localeCompare(s.profile.slug,void 0,{sensitivity:"base"})}).map(({resource:i,profile:s})=>{let a=`${i.codeLibraryResource.manifest.name} (${s.slug})`;s.status==="ARCHIVED"&&(a+=` ${le("(Unshared)")}`);let l={id:s.slug,name:i.codeLibraryResource.manifest.name,description:i.codeLibraryResource.manifest.description};return{name:a,value:l}});return await sc({message:"Select an existing code library (or create new):",source:i=>{if(!i)return[t,...r];let s=i.toLowerCase(),a=r.filter(l=>{let c=l.value?.id??"",d=l.value?.name??"",p=l.value?.description??"";return c.toLowerCase().includes(s)||d.toLowerCase().includes(s)||p.toLowerCase().includes(s)});return[t,...a]},pageSize:15})}async function Dm({initialData:e,existingCodeLibraries:t}){let n,r={components:su.components},o=t.length>0?await iI({existingCodeLibraries:t}):null;if(o)n={...r,...o,...e,id:o.id};else{let a=await oI({initialData:e});n={...r,...e,...a}}let{path:i}=ln(),s=xE(n,(0,Yn.dirname)(i));return xe({library:s}),u.info(`${P} Library configuration updated in webflow.json`),{libraryManifest:s,manifestPath:i}}async function CE({existingCodeLibraries:e}){let t=u.spinner("Looking for webflow.json manifest");try{let{manifest:n,manifestPath:r}=ne(),o=Xs(n,"library");if(!o.id){if(an())return t.succeed(),Dm({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&&an())return t.succeed(),Dm({initialData:o,existingCodeLibraries:e});i||(i=o.id),t.succeed();let s=xE({...o,name:i},(0,Yn.dirname)(r));return Promise.resolve({libraryManifest:s,manifestPath:r})}catch(n){if(n instanceof to&&an())return t.info(n.message),Dm({existingCodeLibraries:e});throw t.fail(),n}}var km=require("memfs/lib/volume"),AE=w(require("webpack-merge"));var RE="/client-renderer.js",IE="/server-renderer.js",FE=`${_n}/test-renderers${RE}`,_E=`${_n}/test-renderers${IE}`,sI=new Set(["@webflow/react"]),aI=new Set(["@webflow/react/server","@webflow/emotion-utils/server","@webflow/styled-components-utils/server"]);async function TE(e,t){if(!e.client||!e.server)throw new Error("Invalid renderer configuration. Both client and server renderers must be specified.");if(sI.has(e.client)&&aI.has(e.server))return;let n=await uI(e,t);lI(e.client,n),cI(e.server,n)}function lI(e,t){let n=Aa(t,RE);if(typeof n.exports.ClientRenderer!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'ClientRenderer' export.`);if(typeof n.exports.applyDecorators!="function")throw new Error(`Invalid client renderer: ${e} does not have a valid 'applyDecorators' export.`);let r=()=>null,o=n.exports.ClientRenderer(r),i=["mount","hydrate","render","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid client renderer: ${e} ClientRenderer must return an object with a '${s}' function.`)}function cI(e,t){let n=Aa(t,IE);if(typeof n.exports.ServerRenderer!="function")throw new Error(`Invalid server renderer: ${e} does not have a valid 'ServerRenderer' export.`);let r=()=>null,o=n.exports.ServerRenderer(r),i=["renderToStream","renderToString","prerenderToString","createSlot"];for(let s of i)if(typeof o[s]!="function")throw new Error(`Invalid server renderer: ${e} ServerRenderer must return an object with a '${s}' function.`)}async function uI(e,t){let n=new km.Volume,r=Tt(e.client),o=Tt(e.server),i={[FE]:`
|
|
90
95
|
export * from "${r}";
|
|
91
|
-
`,[
|
|
96
|
+
`,[_E]:`
|
|
92
97
|
export * from "${o}";
|
|
93
|
-
`},s=(0,
|
|
98
|
+
`},s=(0,AE.default)(qc(),{context:t,entry:{"client-renderer":FE,"server-renderer":_E},mode:"development",output:{path:"/",filename:"[name].js",library:{type:"commonjs2"}},target:"node"});return await Zc({config:s,sourceVolumes:[km.Volume.fromJSON(i,t)],outputVolume:n,failOnWarnings:!1}),n}async function lu({existingCodeLibraries:e}){let{libraryManifest:t,manifestPath:n}=await CE({existingCodeLibraries:e}),r=(0,au.resolve)((0,au.dirname)(n)),{renderer:o,...i}=su,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 TE(s,r),{...i,...t,renderer:s,manifestPath:n}}C();M();async function dI(e,t){let{trackPerformance:n,libraryConfig:r,projectDir:o}=e;return await n("collect_metadata",async()=>{let{componentsFiles:i,componentsVolume:s}=await iu(r,o);u.debug(`Components: ${JSON.stringify(i,null,2)}`);let{sourceMaps:a,metadata:l,options:c}=await ru({declarations:i,sources:s,overrideConfig:e.overrideConfig,performTypeCheck:jc(i,t,o),bundler:t?.bundler,projectDir:o});return u.debug(`Metadata: ${JSON.stringify(l,null,2)}`),u.debug(`Source Maps:
|
|
94
99
|
|
|
95
|
-
${Object.entries(a).reduce((
|
|
100
|
+
${Object.entries(a).reduce((d,[p,m])=>(d+=`${p}: ${JSON.stringify(JSON.parse(m),null,2)}
|
|
96
101
|
|
|
97
|
-
`,
|
|
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:
|
|
98
103
|
|
|
99
104
|
${Object.entries(c).reduce((g,[y,b])=>(g+=`${y}: ${JSON.stringify(JSON.parse(b),null,2)}
|
|
100
105
|
|
|
101
|
-
`,g),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:h}=await
|
|
102
|
-
`);return`${o}
|
|
103
|
-
${r}
|
|
104
|
-
${i}`}function Ri(e){return e?`
|
|
105
|
-
|
|
106
|
-
More: pass --cursor ${e}`:""}var aE=["id","name","description","siteId","appPath","createdAt","siteName","shortName"],lE=["id","url","lastPublished","fullSiteCompiledAt"],cE=["id","branch","mount","deployUrl","latestDeploymentStatus","lastDeploymentSucceededAt","lastVariableModifiedAt","createdAt","updatedAt"],Vc="id,name,siteId,createdAt",am="id,name,description,siteId,appPath,createdAt",Gc="id,url,lastPublished",Kc="id,branch,deployUrl,latestDeploymentStatus,createdAt",tI=new Set(["createdAt","updatedAt","lastPublished","fullSiteCompiledAt","lastDeploymentSucceededAt","lastVariableModifiedAt","buildStartedAt","buildFinishedAt","deployFinishedAt","buildRunningAt","deployStartedAt","buildFailedAt","deployFailedAt"]);function nI(e,t){return e==null||e===""?I("\u2014"):tI.has(t)?new Date(String(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):String(e).replace(/\s*[\r\n]+\s*/g," ")}function ma(e,t,n){if(e.length===0)return I(n);let r=t.map(i=>se(i)),o=e.map(i=>t.map(s=>nI(i[s],s)));return qe(r,o)}var Jc=ut(aE),uE=ut(lE),dE=ut(cE);function xr(){return aE}function ga(){return lE}function ha(){return cE}function zc(e,t=Vc.split(",")){return ma(e,t,"No apps found.")}function pE(e,t=Gc.split(",")){return ma(e,t,"No domains found.")}function fE(e,t=Kc.split(",")){return ma(e,t,"No environments found.")}function mE(e){return e.siteName?`Permanently delete app "${e.name}" (attached to site "${e.siteName}", ${e.id}). This cannot be undone.`:`Archive standalone app "${e.name}" (${e.id}).`}var rI=["success","failed","canceled","unstaged"],qc=5,Xc=600;function gE(e){return rI.includes(e)}var hE=["id","status","sourceType","commitHash","commitMessage","buildStartedAt","buildFinishedAt","deployFinishedAt","framework"],ya="id,status,sourceType,commitHash,buildStartedAt",Yc=ut(hE);function Cr(){return hE}function wa(e,t=ya.split(",")){return ma(e,t,"No deployments found.")}Xl();var lm=()=>new ye.Option("--no-input","Avoid prompting or doing anything interactive. Use this for CI/CD pipelines. Auto-enabled when CI=true, when stdout or stdin is not a TTY, or when a coding agent's execution environment is detected."),cm=()=>new ye.Option("--region <region>",`Webflow region to target: ${Ks.join(", ")}. US and EU are fully isolated stacks with separate accounts. Falls back to WEBFLOW_REGION, then webflow.json, then "us".`).choices(Ks),yE=()=>new ye.Option("--input","Force interactive mode, overriding the automatic no-input detection."),um=()=>new ye.Option("--manifest <path>","Path to a manifest.json file or directory containing webflow.json. Default: ./webflow.json"),dm=()=>new ye.Option("--skip-update-check","Skip checking for @webflow packages updates"),pm=()=>new ye.Option("--verbose","Display more information for debugging purposes."),qn=()=>new ye.Option("--api-token <token>","API token. Default: value set in WEBFLOW_API_TOKEN env variable."),Tt=()=>new ye.Option("-s, --site <site-id>","Site ID. Default: value set in webflow.json config."),Ii=e=>{if(e.trim()==="")throw new ye.InvalidArgumentError("must be a non-empty value.");return e},Zc=(e,t)=>`Supplying multiple filters combines them with AND (all must match), so ${t} plus a non-matching --q returns an empty page \u2014 that means nothing matched all filters, not that the ${e} is absent.`,Qc=e=>new ye.Option("--q <text>",`Case-insensitive substring (contains) match on ${e}. Use it to discover matches; it never searches ids or variable values. For an exact single-item lookup, prefer the exact filter instead.`).argParser(Ii),ne=()=>new ye.Option("--json","Output as JSON"),ba=()=>new ye.Option("--app-id <id>","Cloud app ID. Default: value set in webflow.json (cloud.app_id)."),Da=()=>new ye.Option("--environment-id <id>","Environment ID. Default: value set in webflow.json (cloud.environment_id)."),fm=()=>new ye.Option("--secret","Mark the variable(s) as secret. Secret values are encrypted and never displayed."),Ae=()=>new ye.Option("--dry-run","Preview without executing"),Ti=()=>new ye.Option("-y, --yes","Skip confirmation prompt"),Pi=()=>new ye.Option("--order <dir>","Sort direction: asc or desc").default("asc"),eu=()=>new ye.Option("-a, --agent <ids>",'Target coding agent, repeatable and comma-separated (e.g. --agent claude-code,cursor). Use "all" for every supported agent.').argParser((e,t)=>[...t??[],e]),ka=()=>new ye.Option("-g, --global","Operate on the per-user (home directory) install"),Ea=()=>new ye.Option("-p, --project","Operate on the current project's install"),He=e=>new ye.Option("--fields <fields>",`Comma-separated fields to display (${e.join(", ")})`),$i=e=>new ye.Option("--sort-by <field>",`Sort by: ${e.join(", ")}`),tu=()=>new ye.Option("--limit <n>","Maximum number of items to return (default 100)").default("100").argParser(parseInt),nu=()=>new ye.Option("--offset <n>","Number of items to skip (default 0)").default("0").argParser(parseInt),oI=100,ru=e=>{let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new ye.InvalidArgumentError("must be a positive integer.");return t},mm=()=>new ye.Option("--limit <n>","Max log lines to return (default: 100)").default(oI).argParser(ru),iI=20,wE=()=>new ye.Option("--limit <n>","Max deployments to return, most recent first (default: 20)").default(iI).argParser(ru),bE=e=>{let t=Number(e);if(!Number.isInteger(t))throw new ye.InvalidArgumentError("must be an integer number of seconds.");return t},DE=()=>new ye.Option("--interval <seconds>","Seconds between deployment status polls (minimum 5; lower values are raised to 5)").default(qc).argParser(bE),kE=()=>new ye.Option("--timeout <seconds>","Max seconds to keep polling before giving up (maximum 1800; higher values are capped at 1800)").default(Xc).argParser(bE),va=e=>async(t,n)=>{let o={...n.parent?.opts()||{},...t};await e(o)};pe();var sI=`${le("[Deprecated]")} The 'library' commands will be removed in the next major release.`,aI=()=>{u.warn(`${re} ${le("webflow library share")} is deprecated and will be removed in the next major release.
|
|
106
|
+
`,g),"")}`)),t.succeed(),t=u.spinner("Generating library bundle");let{outputFiles:m,outputVolume:h}=await tu({libraryIdentifier:o,renderer:n.renderer,framework:n.framework,publicPath:_r(e.publicPath||yI),sourceVolumes:[a],componentsFiles:s,componentsOptions:p,debugBundler:e?.debugBundler,dev:e?.dev,overrideConfig:l,failOnWarnings:!e.force,bundler:e.bundler,projectDir:i});t.succeed(),t=u.spinner("Writing to disk"),m.forEach(([g,y])=>{let b=(0,An.join)(`/${y}`,`${g.name}`),S=xa(h.readFileSync(b,"utf8").toString(),b,{bundleEnvironment:y}),_=(0,An.join)(i,e.outputPath||hI);cu.default.existsSync((0,An.join)(_,`${y}`))||cu.default.mkdirSync((0,An.join)(_,`${y}`),{recursive:!0}),cu.default.writeFileSync((0,An.join)(_,y,g.name),S.value.toString())}),t.succeed(),u.success("Code Library bundled successfully!")}catch(n){throw t?.fail(),new f(n)}}A();M();var Ra=w(require("fs-extra")),Sm=w(require("path"));A();M();function wI(){try{if(!Ra.default.existsSync(Rt))return null;let e=Ra.default.readdirSync(Rt).filter(t=>t.endsWith(".log")).map(t=>({name:t,path:Sm.default.join(Rt,t),time:Ra.default.statSync(Sm.default.join(Rt,t)).mtime.getTime()})).sort((t,n)=>n.time-t.time);if(e.length===0)return null;for(let t of e)try{let r=Ra.default.readFileSync(t.path,"utf8").match(/Command: (.+)/);if(r){let o=r[1];if(!/^(log|library\s+log)(\s|$)/.test(o))return t.path}}catch{continue}return null}catch{return null}}async function xm(){let e=wI();e&&u.info(`${wi} Latest log: ${e}`),u.info(`${wi} All logs: ${Rt}`)}async function PE(e){e.command("log").description("Display the logs directory and path to the latest log file, if available.").action(xm)}pe();var bI=`${le("[Deprecated]")} The 'library' commands will be removed in the next major release.`,DI=()=>{u.warn(`${Q} ${le("webflow library share")} is deprecated and will be removed in the next major release.
|
|
107
107
|
Use ${J("webflow devlink import")} instead.
|
|
108
|
-
`)},
|
|
108
|
+
`)},kI=()=>{u.warn(`${Q} ${le("webflow library bundle")} is deprecated and will be removed in the next major release.
|
|
109
109
|
Use ${J("webflow devlink bundle")} instead.
|
|
110
|
-
`)},
|
|
110
|
+
`)},EI=()=>{u.warn(`${Q} ${le("webflow library log")} is deprecated and will be removed in the next major release.
|
|
111
111
|
Use ${J("webflow log")} instead.
|
|
112
|
-
`)},uI="Import a library of Code Components into your Webflow Workspace.",dI="Bundle a library of Code Components for local development.",EE=()=>new Fr.Option("-f, --force","Force the bundler to finish compiling, even if there are warnings or type errors."),vE=()=>new Fr.Option("--debug-bundler","Display final bundler configurations for debugging purposes."),SE=()=>new Fr.Option("--dev","Bundle in development mode for debugging purposes."),xE=()=>new Fr.Option("--bundler <engine>","Bundler to use: webpack or rspack (experimental). Default: webpack").choices(["webpack","rspack"]).default("webpack").hideHelp(),pI=()=>new Fr.Option("--library-id <id>","Set the library identifier to use for the bundle.").hideHelp(),fI=()=>new Fr.Option("--public-path <path>","Set the public path for the bundle."),mI=()=>new Fr.Option("--output-path <path>","Override the output path for the bundle. Default is './dist'");function gm(e,t){return e.command(t).description(uI).addOption(qn()).addOption(EE()).addOption(vE()).addOption(SE()).addOption(xE()).action(va(rm))}function hm(e,t){return e.command(t).description(dI).addOption(pI()).addOption(fI()).addOption(mI()).addOption(EE()).addOption(vE()).addOption(SE()).addOption(xE()).action(va(om))}var CE=e=>{let t=e.command("library").description(sI);gm(t,"share").description(`${le("[Deprecated]")} Use 'webflow devlink import' instead.`).hook("preAction",aI),hm(t,"bundle").description(`${le("[Deprecated]")} Use 'webflow devlink bundle' instead.`).hook("preAction",lI),t.command("log").description(`${le("[Deprecated]")} Use 'webflow log' instead.`).hook("preAction",cI).action(sm)};pe();var FE=e=>{let t=e.command("devlink").description("CLI for managing your Webflow Components.");t.command("sync").description(`${le("[Deprecated]")} Use 'webflow devlink export' instead. Sync your Webflow components to your filesystem.`).argument("[components...]","A list of components to sync. If none is provided, all components will be synced.").addOption(qn()).addOption(Tt()).action(vD),gm(t,"import"),hm(t,"bundle"),t.command("export").description("Export Webflow Components from your Webflow Site.").addOption(qn()).addOption(Tt()).action(va(vc))};var Zn=w(require("fs")),Gt=w(require("path"));A();q();var Fe={New:"new",Existing:"existing"},_E="cli",Xn=3,Yn=39,ou="astro",AE="cloud-scaffolds";var RE="package.json",uo="webflow.json",iu="wf-placeholder-name",IE="CLOUD_MOUNT_PATH",TE="gitignore";function ym(e){return!e.siteId}var Sa=async(e,t,n=ou,r,o,i)=>{try{let s,a;if("content"in r){let l=r.content;s=l.files,a=c=>Gt.relative(l.extractionRoot,c).replace(/\\/g,"/")}else{let c=r[n];if(!c)throw new Error(`Scaffold "${n}" not found`);s=c;let p=Gt.join(AE,n);a=d=>d.split(p)[1]?.substring(1).replace(/\\/g,"/")??""}for(let l of s)try{let c=Gt.join(e,a(l)),p=l.includes("next.config.ts"),d=l.includes("astro.config.mjs"),m=p||d;if(l.includes(uo)&&Zn.existsSync(c))continue;if(l.includes(RE)||l.includes(uo)){let g=(await Zn.promises.readFile(l,"utf8")).replace(iu,e);await su(c,g)}else if(m){let h=await Zn.promises.readFile(l,"utf8");await su(c,h.replace(IE,t))}else if(Gt.basename(c).toLowerCase()===TE){let h=await Zn.promises.readFile(l,"utf8"),g=Gt.join(Gt.dirname(c),".gitignore");await su(g,h)}else{let h=await Zn.promises.readFile(l);await su(c,h)}}catch(c){u.error(`Error processing file ${l}: ${c}`)}if(o&&i)try{Gn({siteId:o,apiToken:i,directory:e})}catch(l){u.error(`Error creating .env file: ${l}`)}}catch(s){throw u.error(`Error applying scaffold: ${s}`),s}};var su=async(e,t)=>{try{await Zn.promises.mkdir(Gt.dirname(e),{recursive:!0}),await Zn.promises.writeFile(e,t)}catch(n){throw u.error(`Error writing file ${e}: ${n}`),n}};var _r=w(require("fs")),PE=w(require("fs-extra")),Ar=w(require("path")),Em=w(require("os")),$E=w(require("tar"));var tt=class extends Error{constructor(n,r,o){super(n);this.scaffoldId=r;this.supportedIds=o;this.name="ScaffoldError"}};var xa={"astro-minimal":{id:"astro-minimal",name:"Astro",source:{type:"github",repo:"Webflow-Examples/hello-world-astro",ref:"v3"}},"nextjs-minimal":{id:"nextjs-minimal",name:"Next.js",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs",ref:"v1"}},astro:{id:"astro",name:"Astro (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-astro-devlink",ref:"v3"}},nextjs:{id:"nextjs",name:"Next.js (site-attached)",source:{type:"github",repo:"Webflow-Examples/hello-world-nextjs-devlink",ref:"v1"}}};function Ca(e){let t=xa[e];if(!t){let n=Object.keys(xa);throw new tt(`Unsupported framework: "${e}". Supported: ${n.join(", ")}`,e,n)}return t}function wm(){return Object.keys(xa)}function bm(){return[...new Set(wm().map(e=>e.replace(/-minimal$/,"")))]}function Dm(){return["astro","nextjs"]}function km(e){let n=`${e.replace(/-minimal$/,"")}-minimal`;if(!xa[n]){let r=wm();throw new tt(`No minimal scaffold for "${e}". Supported: ${r.join(", ")}`,n,r)}return n}A();Vn();var gI="https://github.com";async function vm(e){let t=e.endsWith("-minimal")?e:km(e);return au(t)}async function au(e){return Ca(e).source.type==="github"?hI(e):OE(e)}async function OE(e){let t=Ca(e);if(t.source.type!=="local")throw new tt(`Scaffold "${e}" does not have a local source`,e);let n=Ar.isAbsolute(t.source.path)?t.source.path:Ar.join(__dirname,t.source.path);if(!_r.existsSync(n))throw new tt(`Scaffold directory not found: ${n}`,e);let r=await Sm(n);return{scaffoldId:e,files:r,extractionRoot:n}}async function hI(e){let t=Ca(e);if(t.source.type!=="github")throw new tt(`Scaffold "${e}" does not have a GitHub source`,e);let n=(Je()?t.source.betaRef:void 0)??t.source.ref??"main",r=`${gI}/${t.source.repo}/archive/${n}.tar.gz`,o=await _r.promises.mkdtemp(Ar.join(Em.tmpdir(),`webflow-scaffold-${e}-`)),i=u.spinner(`Downloading scaffold (${t.source.repo}@${n})`);try{let s;try{s=await fetch(r,{redirect:"follow",headers:{"User-Agent":"webflow-cli"}})}catch(h){throw i.fail("Download failed"),new tt(`Failed to fetch scaffold from GitHub: ${h instanceof Error?h.message:String(h)}. Repo: ${t.source.repo}, ref: ${n}`,e)}if(!s.ok)throw i.fail(`GitHub returned ${s.status} ${s.statusText}`),new tt(`Failed to fetch scaffold from GitHub: ${s.status} ${s.statusText}. Repo: ${t.source.repo}, ref: ${n}`,e);let a=Buffer.from(await s.arrayBuffer());i.succeed("Downloaded scaffold");let l=u.spinner("Unpacking scaffold");try{await yI(a,o),l.succeed("Scaffold ready")}catch(h){throw l.fail("Unpack failed"),h}let c=await _r.promises.readdir(o),p=c[0];if(!p||c.length!==1)throw new tt(`Unexpected tarball structure for ${t.source.repo}`,e);let d=Ar.join(o,p),m=await Sm(d);return{scaffoldId:e,files:m,extractionRoot:d}}catch(s){try{PE.default.removeSync(o)}catch{}throw s instanceof tt?s:new tt(`Failed to fetch scaffold "${e}": ${s instanceof Error?s.message:String(s)}`,e)}}async function yI(e,t){let n=Ar.join(Em.tmpdir(),`webflow-scaffold-${Date.now()}.tar.gz`);await _r.promises.writeFile(n,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{await $E.extract({file:n,cwd:t})}finally{await _r.promises.unlink(n).catch(()=>{})}}async function Sm(e){let t=[],n=await _r.promises.readdir(e,{withFileTypes:!0});for(let r of n){let o=Ar.join(e,r.name);r.isDirectory()?t.push(...await Sm(o)):t.push(o)}return t}var Ym=w(require("fs-extra"));q();X();var oe=w(require("fs")),ue=w(require("path")),Wa=require("child_process"),Cv=w(require("tar"));var ft=w(require("fs")),dn=w(require("path"));var j={};Py(j,{BRAND:()=>HI,DIRTY:()=>po,EMPTY_PATH:()=>kI,INVALID:()=>Y,NEVER:()=>FT,OK:()=>dt,ParseStatus:()=>nt,Schema:()=>ae,ZodAny:()=>Tr,ZodArray:()=>nr,ZodBigInt:()=>mo,ZodBoolean:()=>go,ZodBranded:()=>_a,ZodCatch:()=>Co,ZodDate:()=>ho,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>uu,ZodEffects:()=>zt,ZodEnum:()=>vo,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>Q,ZodFunction:()=>pu,ZodIntersection:()=>Do,ZodIssueCode:()=>R,ZodLazy:()=>ko,ZodLiteral:()=>Eo,ZodMap:()=>Bi,ZodNaN:()=>Wi,ZodNativeEnum:()=>So,ZodNever:()=>ln,ZodNull:()=>wo,ZodNullable:()=>An,ZodNumber:()=>fo,ZodObject:()=>Dt,ZodOptional:()=>Kt,ZodParsedType:()=>W,ZodPipeline:()=>Aa,ZodPromise:()=>Pr,ZodReadonly:()=>Fo,ZodRecord:()=>du,ZodSchema:()=>ae,ZodSet:()=>Ui,ZodString:()=>Ir,ZodSymbol:()=>ji,ZodTransformer:()=>zt,ZodTuple:()=>_n,ZodType:()=>ae,ZodUndefined:()=>yo,ZodUnion:()=>bo,ZodUnknown:()=>tr,ZodVoid:()=>Mi,addIssueToContext:()=>N,any:()=>ZI,array:()=>nT,bigint:()=>JI,boolean:()=>KE,coerce:()=>CT,custom:()=>HE,date:()=>zI,datetimeRegex:()=>UE,defaultErrorMap:()=>Qn,discriminatedUnion:()=>sT,effect:()=>wT,enum:()=>gT,function:()=>pT,getErrorMap:()=>Oi,getParsedType:()=>Fn,instanceof:()=>GI,intersection:()=>aT,isAborted:()=>lu,isAsync:()=>Li,isDirty:()=>cu,isValid:()=>Rr,late:()=>VI,lazy:()=>fT,literal:()=>mT,makeIssue:()=>Fa,map:()=>uT,nan:()=>KI,nativeEnum:()=>hT,never:()=>eT,null:()=>YI,nullable:()=>DT,number:()=>GE,object:()=>rT,objectUtil:()=>xm,oboolean:()=>xT,onumber:()=>ST,optional:()=>bT,ostring:()=>vT,pipeline:()=>ET,preprocess:()=>kT,promise:()=>yT,quotelessJson:()=>wI,record:()=>cT,set:()=>dT,setErrorMap:()=>DI,strictObject:()=>oT,string:()=>VE,symbol:()=>qI,transformer:()=>wT,tuple:()=>lT,undefined:()=>XI,union:()=>iT,unknown:()=>QI,util:()=>de,void:()=>tT});var de;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(de||(de={}));var xm;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(xm||(xm={}));var W=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fn=e=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(e)?W.array:e===null?W.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?W.promise:typeof Map<"u"&&e instanceof Map?W.map:typeof Set<"u"&&e instanceof Set?W.set:typeof Date<"u"&&e instanceof Date?W.date:W.object;default:return W.unknown}};var R=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wI=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};bt.create=e=>new bt(e);var bI=(e,t)=>{let n;switch(e.code){case R.invalid_type:e.received===W.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,de.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(e.keys,", ")}`;break;case R.invalid_union:n="Invalid input";break;case R.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(e.options)}`;break;case R.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:n="Invalid function arguments";break;case R.invalid_return_type:n="Invalid function return type";break;case R.invalid_date:n="Invalid date";break;case R.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:de.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case R.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case R.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case R.custom:n="Invalid input";break;case R.invalid_intersection_types:n="Intersection results could not be merged";break;case R.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:n="Number must be finite";break;default:n=t.defaultError,de.assertNever(e)}return{message:n}},Qn=bI;var LE=Qn;function DI(e){LE=e}function Oi(){return LE}var Fa=e=>{let{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},kI=[];function N(e,t){let n=Oi(),r=Fa({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Qn?void 0:Qn].filter(o=>!!o)});e.common.issues.push(r)}var nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let o of n){if(o.status==="aborted")return Y;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let o of n){let i=await o.key,s=await o.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let o of n){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Y;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},Y=Object.freeze({status:"aborted"}),po=e=>({status:"dirty",value:e}),dt=e=>({status:"valid",value:e}),lu=e=>e.status==="aborted",cu=e=>e.status==="dirty",Rr=e=>e.status==="valid",Li=e=>typeof Promise<"u"&&e instanceof Promise;var K;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(K||(K={}));var Jt=class{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},NE=(e,t)=>{if(Rr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new bt(e.common.issues);return this._error=n,this._error}}};function ie(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:l}=e;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}var ae=class{get description(){return this._def.description}_getType(t){return Fn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Li(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},o=this._parseSync({data:t,path:r.path,parent:r});return NE(r,o)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Rr(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Rr(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Li(o)?o:Promise.resolve(o));return NE(r,i)}refine(t,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:R.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new zt({schema:this,typeName:Q.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Kt.create(this,this._def)}nullable(){return An.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nr.create(this)}promise(){return Pr.create(this,this._def)}or(t){return bo.create([this,t],this._def)}and(t){return Do.create(this,t,this._def)}transform(t){return new zt({...ie(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new xo({...ie(this._def),innerType:this,defaultValue:n,typeName:Q.ZodDefault})}brand(){return new _a({typeName:Q.ZodBranded,type:this,...ie(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Co({...ie(this._def),innerType:this,catchValue:n,typeName:Q.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Aa.create(this,t)}readonly(){return Fo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},EI=/^c[^\s-]{8,}$/i,vI=/^[0-9a-z]+$/,SI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,CI=/^[a-z0-9_-]{21}$/i,FI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_I=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,AI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cm,II=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,TI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,PI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$I=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,OI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ME="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",NI=new RegExp(`^${ME}$`);function BE(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function jI(e){return new RegExp(`^${BE(e)}$`)}function UE(e){let t=`${ME}T${BE(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function MI(e,t){return!!((t==="v4"||!t)&&II.test(e)||(t==="v6"||!t)&&PI.test(e))}function BI(e,t){if(!FI.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function UI(e,t){return!!((t==="v4"||!t)&&TI.test(e)||(t==="v6"||!t)&&$I.test(e))}var Ir=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==W.string){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_type,expected:W.string,received:i.parsedType}),Y}let r=new nt,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?N(o,{code:R.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&N(o,{code:R.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")AI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"email",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Cm||(Cm=new RegExp(RI,"u")),Cm.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"emoji",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")xI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"uuid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")CI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"nanoid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")EI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")vI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cuid2",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")SI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ulid",code:R.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),N(o,{validation:"url",code:R.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"regex",code:R.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?UE(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?NI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?jI(i).test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{code:R.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?_I.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"duration",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?MI(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"ip",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?BI(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"jwt",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?UI(t.data,i.version)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"cidr",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?OI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64",code:R.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?LI.test(t.data)||(o=this._getOrReturnCtx(t,o),N(o,{validation:"base64url",code:R.invalid_string,message:i.message}),r.dirty()):de.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:R.invalid_string,...K.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...K.errToObj(t)})}url(t){return this._addCheck({kind:"url",...K.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...K.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...K.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...K.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...K.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...K.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...K.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...K.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...K.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...K.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...K.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...K.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...K.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...K.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...K.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...K.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...K.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...K.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...K.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...K.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...K.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...K.errToObj(n)})}nonempty(t){return this.min(1,K.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ir.create=e=>new Ir({checks:[],typeName:Q.ZodString,coerce:e?.coerce??!1,...ie(e)});function WI(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var fo=class e extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==W.number){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_type,expected:W.number,received:i.parsedType}),Y}let r,o=new nt;for(let i of this._def.checks)i.kind==="int"?de.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{code:R.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?WI(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),N(r,{code:R.not_finite,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,K.toString(n))}gt(t,n){return this.setLimit("min",t,!1,K.toString(n))}lte(t,n){return this.setLimit("max",t,!0,K.toString(n))}lt(t,n){return this.setLimit("max",t,!1,K.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:K.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:K.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:K.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&de.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};fo.create=e=>new fo({checks:[],typeName:Q.ZodNumber,coerce:e?.coerce||!1,...ie(e)});var mo=class e extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==W.bigint)return this._getInvalidInput(t);let r,o=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),N(r,{code:R.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):de.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return N(n,{code:R.invalid_type,expected:W.bigint,received:n.parsedType}),Y}gte(t,n){return this.setLimit("min",t,!0,K.toString(n))}gt(t,n){return this.setLimit("min",t,!1,K.toString(n))}lte(t,n){return this.setLimit("max",t,!0,K.toString(n))}lt(t,n){return this.setLimit("max",t,!1,K.toString(n))}setLimit(t,n,r,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:K.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:K.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};mo.create=e=>new mo({checks:[],typeName:Q.ZodBigInt,coerce:e?.coerce??!1,...ie(e)});var go=class extends ae{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==W.boolean){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.boolean,received:r.parsedType}),Y}return dt(t.data)}};go.create=e=>new go({typeName:Q.ZodBoolean,coerce:e?.coerce||!1,...ie(e)});var ho=class e extends ae{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==W.date){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_type,expected:W.date,received:i.parsedType}),Y}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return N(i,{code:R.invalid_date}),Y}let r=new nt,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),N(o,{code:R.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):de.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:K.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:K.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};ho.create=e=>new ho({checks:[],coerce:e?.coerce||!1,typeName:Q.ZodDate,...ie(e)});var ji=class extends ae{_parse(t){if(this._getType(t)!==W.symbol){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.symbol,received:r.parsedType}),Y}return dt(t.data)}};ji.create=e=>new ji({typeName:Q.ZodSymbol,...ie(e)});var yo=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.undefined,received:r.parsedType}),Y}return dt(t.data)}};yo.create=e=>new yo({typeName:Q.ZodUndefined,...ie(e)});var wo=class extends ae{_parse(t){if(this._getType(t)!==W.null){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.null,received:r.parsedType}),Y}return dt(t.data)}};wo.create=e=>new wo({typeName:Q.ZodNull,...ie(e)});var Tr=class extends ae{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}};Tr.create=e=>new Tr({typeName:Q.ZodAny,...ie(e)});var tr=class extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}};tr.create=e=>new tr({typeName:Q.ZodUnknown,...ie(e)});var ln=class extends ae{_parse(t){let n=this._getOrReturnCtx(t);return N(n,{code:R.invalid_type,expected:W.never,received:n.parsedType}),Y}};ln.create=e=>new ln({typeName:Q.ZodNever,...ie(e)});var Mi=class extends ae{_parse(t){if(this._getType(t)!==W.undefined){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.void,received:r.parsedType}),Y}return dt(t.data)}};Mi.create=e=>new Mi({typeName:Q.ZodVoid,...ie(e)});var nr=class e extends ae{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==W.array)return N(n,{code:R.invalid_type,expected:W.array,received:n.parsedType}),Y;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(N(n,{code:s?R.too_big:R.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(N(n,{code:R.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(N(n,{code:R.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new Jt(n,s,n.path,a)))).then(s=>nt.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new Jt(n,s,n.path,a)));return nt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:K.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:K.toString(n)}})}nonempty(t){return this.min(1,t)}};nr.create=(e,t)=>new nr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...ie(t)});function Ni(e){if(e instanceof Dt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Kt.create(Ni(r))}return new Dt({...e._def,shape:()=>t})}else return e instanceof nr?new nr({...e._def,type:Ni(e.element)}):e instanceof Kt?Kt.create(Ni(e.unwrap())):e instanceof An?An.create(Ni(e.unwrap())):e instanceof _n?_n.create(e.items.map(t=>Ni(t))):e}var Dt=class e extends ae{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=de.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==W.object){let c=this._getOrReturnCtx(t);return N(c,{code:R.invalid_type,expected:W.object,received:c.parsedType}),Y}let{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ln&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let p=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:p._parse(new Jt(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof ln){let c=this._def.unknownKeys;if(c==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(c==="strict")a.length>0&&(N(o,{code:R.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let p of a){let d=o.data[p];l.push({key:{status:"valid",value:p},value:c._parse(new Jt(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let p of l){let d=await p.key,m=await p.value;c.push({key:d,value:m,alwaysSet:p.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(r,c)):nt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return K.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:K.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Q.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of de.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of de.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return Ni(this)}partial(t){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of de.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Kt;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return WE(de.objectKeys(this.shape))}};Dt.create=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strip",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});Dt.strictCreate=(e,t)=>new Dt({shape:()=>e,unknownKeys:"strict",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});Dt.lazycreate=(e,t)=>new Dt({shape:e,unknownKeys:"strip",catchall:ln.create(),typeName:Q.ZodObject,...ie(t)});var bo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new bt(a.ctx.common.issues));return N(n,{code:R.invalid_union,unionErrors:s}),Y}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},p=l._parseSync({data:n.data,path:n.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new bt(l));return N(n,{code:R.invalid_union,unionErrors:a}),Y}}get options(){return this._def.options}};bo.create=(e,t)=>new bo({options:e,typeName:Q.ZodUnion,...ie(t)});var er=e=>e instanceof ko?er(e.schema):e instanceof zt?er(e.innerType()):e instanceof Eo?[e.value]:e instanceof vo?e.options:e instanceof So?de.objectValues(e.enum):e instanceof xo?er(e._def.innerType):e instanceof yo?[void 0]:e instanceof wo?[null]:e instanceof Kt?[void 0,...er(e.unwrap())]:e instanceof An?[null,...er(e.unwrap())]:e instanceof _a||e instanceof Fo?er(e.unwrap()):e instanceof Co?er(e._def.innerType):[],uu=class e extends ae{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return N(n,{code:R.invalid_type,expected:W.object,received:n.parsedType}),Y;let r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(N(n,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let o=new Map;for(let i of n){let s=er(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:Q.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ie(r)})}};function Fm(e,t){let n=Fn(e),r=Fn(t);if(e===t)return{valid:!0,data:e};if(n===W.object&&r===W.object){let o=de.objectKeys(t),i=de.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let l=Fm(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===W.array&&r===W.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],l=Fm(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===W.date&&r===W.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Do=class extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(lu(i)||lu(s))return Y;let a=Fm(i.value,s.value);return a.valid?((cu(i)||cu(s))&&n.dirty(),{status:n.value,value:a.data}):(N(r,{code:R.invalid_intersection_types}),Y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Do.create=(e,t,n)=>new Do({left:e,right:t,typeName:Q.ZodIntersection,...ie(n)});var _n=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.array)return N(r,{code:R.invalid_type,expected:W.array,received:r.parsedType}),Y;if(r.data.length<this._def.items.length)return N(r,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&r.data.length>this._def.items.length&&(N(r,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Jt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>nt.mergeArray(n,s)):nt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};_n.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _n({items:e,typeName:Q.ZodTuple,rest:null,...ie(t)})};var du=class e extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.object)return N(r,{code:R.invalid_type,expected:W.object,received:r.parsedType}),Y;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in r.data)o.push({key:i._parse(new Jt(r,a,r.path,a)),value:s._parse(new Jt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?nt.mergeObjectAsync(n,o):nt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ae?new e({keyType:t,valueType:n,typeName:Q.ZodRecord,...ie(r)}):new e({keyType:Ir.create(),valueType:t,typeName:Q.ZodRecord,...ie(n)})}},Bi=class extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.map)return N(r,{code:R.invalid_type,expected:W.map,received:r.parsedType}),Y;let o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Jt(r,a,r.path,[c,"key"])),value:i._parse(new Jt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,p=await l.value;if(c.status==="aborted"||p.status==="aborted")return Y;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,p=l.value;if(c.status==="aborted"||p.status==="aborted")return Y;(c.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(c.value,p.value)}return{status:n.value,value:a}}}};Bi.create=(e,t,n)=>new Bi({valueType:t,keyType:e,typeName:Q.ZodMap,...ie(n)});var Ui=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==W.set)return N(r,{code:R.invalid_type,expected:W.set,received:r.parsedType}),Y;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(N(r,{code:R.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(N(r,{code:R.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let p of l){if(p.status==="aborted")return Y;p.status==="dirty"&&n.dirty(),c.add(p.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>i._parse(new Jt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:K.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Ui.create=(e,t)=>new Ui({valueType:e,minSize:null,maxSize:null,typeName:Q.ZodSet,...ie(t)});var pu=class e extends ae{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.function)return N(n,{code:R.invalid_type,expected:W.function,received:n.parsedType}),Y;function r(a,l){return Fa({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oi(),Qn].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:l}})}function o(a,l){return Fa({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oi(),Qn].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Pr){let a=this;return dt(async function(...l){let c=new bt([]),p=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),d=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(d,i).catch(h=>{throw c.addIssue(o(d,h)),c})})}else{let a=this;return dt(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new bt([r(l,c.error)]);let p=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(p,i);if(!d.success)throw new bt([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:_n.create(t).rest(tr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||_n.create([]).rest(tr.create()),returns:n||tr.create(),typeName:Q.ZodFunction,...ie(r)})}},ko=class extends ae{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ko.create=(e,t)=>new ko({getter:e,typeName:Q.ZodLazy,...ie(t)});var Eo=class extends ae{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return N(n,{received:n.data,code:R.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:t.data}}get value(){return this._def.value}};Eo.create=(e,t)=>new Eo({value:e,typeName:Q.ZodLiteral,...ie(t)});function WE(e,t){return new vo({values:e,typeName:Q.ZodEnum,...ie(t)})}var vo=class e extends ae{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{expected:de.joinValues(r),received:n.parsedType,code:R.invalid_type}),Y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return N(n,{received:n.data,code:R.invalid_enum_value,options:r}),Y}return dt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};vo.create=WE;var So=class extends ae{_parse(t){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==W.string&&r.parsedType!==W.number){let o=de.objectValues(n);return N(r,{expected:de.joinValues(o),received:r.parsedType,code:R.invalid_type}),Y}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=de.objectValues(n);return N(r,{received:r.data,code:R.invalid_enum_value,options:o}),Y}return dt(t.data)}get enum(){return this._def.values}};So.create=(e,t)=>new So({values:e,typeName:Q.ZodNativeEnum,...ie(t)});var Pr=class extends ae{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==W.promise&&n.common.async===!1)return N(n,{code:R.invalid_type,expected:W.promise,received:n.parsedType}),Y;let r=n.parsedType===W.promise?n.data:Promise.resolve(n.data);return dt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Pr.create=(e,t)=>new Pr({type:e,typeName:Q.ZodPromise,...ie(t)});var zt=class extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{N(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Y;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Y:l.status==="dirty"?po(l.value):n.value==="dirty"?po(l.value):l});{if(n.value==="aborted")return Y;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Y:a.status==="dirty"?po(a.value):n.value==="dirty"?po(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Y:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rr(s))return Y;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Rr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):Y);de.assertNever(o)}};zt.create=(e,t,n)=>new zt({schema:e,typeName:Q.ZodEffects,effect:t,...ie(n)});zt.createWithPreprocess=(e,t,n)=>new zt({schema:t,effect:{type:"preprocess",transform:e},typeName:Q.ZodEffects,...ie(n)});var Kt=class extends ae{_parse(t){return this._getType(t)===W.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Kt.create=(e,t)=>new Kt({innerType:e,typeName:Q.ZodOptional,...ie(t)});var An=class extends ae{_parse(t){return this._getType(t)===W.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};An.create=(e,t)=>new An({innerType:e,typeName:Q.ZodNullable,...ie(t)});var xo=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===W.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xo.create=(e,t)=>new xo({innerType:e,typeName:Q.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ie(t)});var Co=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Li(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Co.create=(e,t)=>new Co({innerType:e,typeName:Q.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ie(t)});var Wi=class extends ae{_parse(t){if(this._getType(t)!==W.nan){let r=this._getOrReturnCtx(t);return N(r,{code:R.invalid_type,expected:W.nan,received:r.parsedType}),Y}return{status:"valid",value:t.data}}};Wi.create=e=>new Wi({typeName:Q.ZodNaN,...ie(e)});var HI=Symbol("zod_brand"),_a=class extends ae{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Aa=class e extends ae{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Y:i.status==="dirty"?(n.dirty(),po(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Y:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:Q.ZodPipeline})}},Fo=class extends ae{_parse(t){let n=this._def.innerType._parse(t),r=o=>(Rr(o)&&(o.value=Object.freeze(o.value)),o);return Li(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Fo.create=(e,t)=>new Fo({innerType:e,typeName:Q.ZodReadonly,...ie(t)});function jE(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function HE(e,t={},n){return e?Tr.create().superRefine((r,o)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=jE(t,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=jE(t,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Tr.create()}var VI={object:Dt.lazycreate},Q;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Q||(Q={}));var GI=(e,t={message:`Input not instance of ${e.name}`})=>HE(n=>n instanceof e,t),VE=Ir.create,GE=fo.create,KI=Wi.create,JI=mo.create,KE=go.create,zI=ho.create,qI=ji.create,XI=yo.create,YI=wo.create,ZI=Tr.create,QI=tr.create,eT=ln.create,tT=Mi.create,nT=nr.create,rT=Dt.create,oT=Dt.strictCreate,iT=bo.create,sT=uu.create,aT=Do.create,lT=_n.create,cT=du.create,uT=Bi.create,dT=Ui.create,pT=pu.create,fT=ko.create,mT=Eo.create,gT=vo.create,hT=So.create,yT=Pr.create,wT=zt.create,bT=Kt.create,DT=An.create,kT=zt.createWithPreprocess,ET=Aa.create,vT=()=>VE().optional(),ST=()=>GE().optional(),xT=()=>KE().optional(),CT={string:(e=>Ir.create({...e,coerce:!0})),number:(e=>fo.create({...e,coerce:!0})),boolean:(e=>go.create({...e,coerce:!0})),bigint:(e=>mo.create({...e,coerce:!0})),date:(e=>ho.create({...e,coerce:!0}))};var FT=Y;function fu(e,t=!1){let n=e.length,r=0,o="",i=0,s=16,a=0,l=0,c=0,p=0,d=0;function m(v,x){let O=0,H=0;for(;O<v||!x;){let B=e.charCodeAt(r);if(B>=48&&B<=57)H=H*16+B-48;else if(B>=65&&B<=70)H=H*16+B-65+10;else if(B>=97&&B<=102)H=H*16+B-97+10;else break;r++,O++}return O<v&&(H=-1),H}function h(v){r=v,o="",i=0,s=16,d=0}function g(){let v=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Hi(e.charCodeAt(r)))for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;else return d=3,e.substring(v,r);let x=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Hi(e.charCodeAt(r))){for(r++;r<e.length&&Hi(e.charCodeAt(r));)r++;x=r}else d=3;return e.substring(v,x)}function y(){let v="",x=r;for(;;){if(r>=n){v+=e.substring(x,r),d=2;break}let O=e.charCodeAt(r);if(O===34){v+=e.substring(x,r),r++;break}if(O===92){if(v+=e.substring(x,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:v+='"';break;case 92:v+="\\";break;case 47:v+="/";break;case 98:v+="\b";break;case 102:v+="\f";break;case 110:v+=`
|
|
113
|
-
`;break;case 114:v+="\r";break;case 116:v+=" ";break;case 117:let B=m(4,!0);B>=0?v+=String.fromCharCode(B):
|
|
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&&!
|
|
115
|
-
`+" ".repeat(t)),"\r":new Array(
|
|
116
|
-
`+" ".repeat(t))}," ":{"\n":new Array(
|
|
117
|
-
`+" ".repeat(t)),"\r":new Array(
|
|
118
|
-
`+" ".repeat(t))}};var
|
|
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+=`
|
|
119
119
|
|
|
120
120
|
How to fix: ${this.remediation}`),this.documentationUrl&&(t+=`
|
|
121
121
|
|
|
122
|
-
Documentation: ${this.documentationUrl}`),t}},Re=class extends
|
|
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
123
|
|
|
124
|
-
Config file: ${this.configFile}`),t}},
|
|
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.
|
|
125
125
|
|
|
126
126
|
nvm install ${i}
|
|
127
|
-
nvm use ${i}`,documentationUrl:"https://nodejs.org/en/download/"});e.warn(`${s}. Build may fail or behave unexpectedly.`)}}var
|
|
128
|
-
`));let i=
|
|
129
|
-
`));let i=
|
|
130
|
-
`));let i=
|
|
131
|
-
`)):Ve.extname(o)!==".ts"&&(t.info(`writing clouduser.next.config.d.ts shim for ${Ve.basename(o)}`),
|
|
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
132
|
declare const config: UserNextConfig;
|
|
133
133
|
export default config;
|
|
134
|
-
`));let i=Ve.join(
|
|
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" />
|
|
135
135
|
|
|
136
136
|
interface Env {
|
|
137
137
|
ASSETS: Fetcher;
|
|
@@ -142,155 +142,155 @@ export default {
|
|
|
142
142
|
return env.ASSETS.fetch(request);
|
|
143
143
|
},
|
|
144
144
|
} satisfies ExportedHandler<Env>;
|
|
145
|
-
`)}async prepareConfig(){let{log:t,cwd:n,userEnv:r}=this.ctx,o=this.hasCustomWorkerEntry();
|
|
146
|
-
`));let s=Pt.join(
|
|
147
|
-
`)}function
|
|
148
|
-
${
|
|
149
|
-
${
|
|
150
|
-
${se(`${r}${o}`)}`)}function
|
|
151
|
-
${se(_t(`${r}${o}`))}`)}async function Fv(e=process.cwd(),t,n,r){let o=Ia(e),i=Ki(u,e),s={...r?{COSMIC_MOUNT_PATH:r}:{},...t?{COSMIC_DEPLOY_URL:t}:{},...n&&!t?{COSMIC_DEPLOY_URL:zT(n)}:{}},a={cwd:e,log:u,packageJson:o??{},userEnv:s},{isStatic:l}=Ua(e,o,i);if(l)return new un(a);if(!o)throw new Error("No package.json file found");return Om(a,i)}async function _v(e,t={}){let n=t.projectPath||process.cwd(),r=Date.now(),o=ue.join(n,".tmp",`webflow-build-${r}`),i=t.outputDir||ue.join(o,"output"),s=t.mountPath||"/app",a=Date.now(),l=Nm(n),c=t.telemetry,p=e.getBuildCommand(),d=e.getOutputDeployMetadata(),m=d.deploymentType==="static";await c?.sendUsage("cloud_build_start",{framework:e.info.name,buildCommand:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),oe.mkdirSync(o,{recursive:!0});try{or("\u{1F527}","Configure framework"),u.info(`Framework: ${e.info.displayName}`),u.info(`Mount path: ${s}`),u.info(`Deployment type: ${d.deploymentType}`);let h=e.getNodeVersionRequirement();h&&$r(u,h,e.info.displayName),u.info("Validating framework requirements..."),await e.validate(),m||(u.info("Installing framework dependencies..."),await e.installDependencies(),or("\u2699\uFE0F ","Configure wrangler"),await kv(e,n),u.info("Preparing framework configuration..."),await e.prepareConfig()),ku(u,n,e.info.name,e),m||(or("\u{1F4E6}","Install dependencies"),await JT(n,e.info.name,t.telemetry),Ev(n),or("\u{1F3D7}\uFE0F ","Build app"),u.info(`running ${p}...`),await qT(n,p,t.telemetry),await e.postBuild(),or("\u{1F9EA}","Wrangler dry-run"),await XT(n,i)),or("\u{1F4C1}","Copy assets"),await ZT(n,i,e,s),or("\u{1F381}","Create tarball");let g=await QT(i),y=Date.now()-a;return u.info(`${$} Build completed in ${(y/1e3).toFixed(1)}s`),await c?.sendUsage("cloud_build_success",{duration:y,framework:e.info.name,buildCommand:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),g}catch(h){let g=Date.now()-a;throw await c?.sendError(h instanceof Error?h:new Error(String(h)),"cloud_build_failure",{duration:g,framework:e.info.name,buildCommand:p,deploymentType:d.deploymentType,mountPath:s,cloudflareBindings:l}),h}}function Nm(e){let t=ue.join(e,"wrangler.json");if(!oe.existsSync(t))return{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0};try{let n=JSON.parse(oe.readFileSync(t,"utf8")),r=n.kv_namespaces||[],o=n.d1_databases||[],i=n.r2_buckets||[],s=n.vars||{};return{hasKV:r.length>0,hasD1:o.length>0,hasR2:i.length>0,hasVars:Object.keys(s).length>0,kvCount:r.length,d1Count:o.length,r2Count:i.length,varCount:Object.keys(s).length}}catch(n){return console.debug("Failed to parse wrangler.json for bindings detection:",n),{hasKV:!1,hasD1:!1,hasR2:!1,hasVars:!1,kvCount:0,d1Count:0,r2Count:0,varCount:0}}}function Av(e){try{let t=ue.dirname(e);t.includes(".tmp/webflow-build-")&&(or("\u{1F9F9}","Clean up build artifacts"),oe.rmSync(t,{recursive:!0,force:!0}))}catch(t){u.warn(`Warning: Failed to clean up build artifacts: ${t}`)}}function Rv(e,t){try{or("\u{1F9F9}","Revert framework configuration");let n=t.getUserConfigPatterns(),r=new Set;for(let s of n){let a=ue.extname(s).slice(1),l=ue.basename(s,`.${a}`);if(!r.has(l)){r.add(l);for(let c of["mjs","cjs","js","ts"]){let p=ue.join(e,`clouduser.${l}.${c}`),d=ue.join(e,`${l}.${c}`);if(oe.existsSync(p)){u.info(`restoring /${l}.${c} from /clouduser.${l}.${c}...`),oe.existsSync(d)&&oe.unlinkSync(d),oe.renameSync(p,d);break}}}}for(let s of[".jsonc",".json"]){let a=ue.join(e,`clouduser.wrangler${s}`);if(oe.existsSync(a)){u.info(`restoring user wrangler${s} from backup...`);let l=ue.join(e,"wrangler.json");oe.existsSync(l)&&oe.unlinkSync(l);let c=ue.join(e,`wrangler${s}`);oe.renameSync(a,c);break}}let o=ue.join(e,"clouduser");oe.existsSync(o)&&(u.info("cleaning up clouduser directory..."),oe.rmSync(o,{recursive:!0,force:!0}));for(let s of t.getAdditionalConfigFiles()){let a=ue.join(e,ue.basename(s));oe.existsSync(a)&&(u.info(`cleaning up additional config file ${a}...`),oe.unlinkSync(a))}let i=t.getWebflowLoader();if(i){let s=ue.join(e,i.destinationName);oe.existsSync(s)&&(u.info(`cleaning up ${i.destinationName}...`),oe.unlinkSync(s))}}catch(n){u.warn(`Warning: Failed to cleanup framework configuration: ${n}`)}}async function JT(e,t,n){let r=Date.now(),o=["--no-update-notifier","--no-progress"],i=ue.join(e,"package-lock.json");try{oe.existsSync(i)?(u.info("Running npm ci --include=dev..."),(0,Wa.execSync)(`npm ci --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"})):(u.info("Warning: No package-lock.json found, installing dependencies with npm install --include=dev"),(0,Wa.execSync)(`npm install --include=dev ${o.join(" ")}`,{cwd:e,stdio:"inherit"}));let s=Date.now()-r;await n?.sendUsage("cloud_install_dependencies_success",{duration:s,framework:t,hasPackageLock:oe.existsSync(i)})}catch(s){let a=Date.now()-r;throw await n?.sendError(s instanceof Error?s:new Error(String(s)),"cloud_install_dependencies_failure",{duration:a,framework:t,hasPackageLock:oe.existsSync(i)}),s}}function zT(e){let t="production",n;switch(t){case"development":n="wf-app-dev";break;case"acceptance":n="wf-app-acceptance";break;default:n="wf-app-prod"}return`https://${e}.${n}.cosmic.webflow.services`}async function qT(e,t,n){let r=Date.now();try{(0,Wa.execSync)(`npm exec -- ${t}`,{cwd:e,stdio:"inherit"});let o=Date.now()-r;await n?.sendUsage("cloud_build_command_success",{duration:o,buildCommand:t})}catch(o){let i=Date.now()-r;throw await n?.sendError(o instanceof Error?o:new Error(String(o)),"cloud_build_command_failure",{duration:i,buildCommand:t}),new Error(`Build command failed: ${t}`)}}async function XT(e,t){oe.mkdirSync(t,{recursive:!0});let n=ue.join(e,"wrangler.json"),r=ue.join(e,"wrangler.jsonc");if(!oe.existsSync(n)&&!oe.existsSync(r))throw new Error("Missing wrangler configuration: wrangler.json or wrangler.jsonc file is required");(0,Wa.execSync)(`npx wrangler@${KT} deploy --dry-run --outdir="${t}"`,{cwd:e,stdio:"inherit"})}function xv(e,t){let n=ue.join(e,"webflow.json");oe.existsSync(n)?(u.info("including webflow.json in output..."),oe.copyFileSync(n,ue.join(t,"webflow.json"))):u.warn("webflow.json not found at project root; deploy may fail framework detection")}function YT(e,t,n){let r=n.replace(/\/+$/,"").replace(/^\/+/,""),o=ue.join(t,"assets"),i=ue.join(o,r||"");oe.mkdirSync(i,{recursive:!0}),u.info(`copying static assets to output/assets/${r}...`);for(let s of oe.readdirSync(e))Or(u,ue.join(e,s),ue.join(i,s),{excludeFn:ja,followSymlinks:!1});for(let s of Na){let a=ue.join(e,s);oe.lstatSync(a,{throwIfNoEntry:!1})?.isFile()&&(u.info(`relocating ${s} to assets root...`),oe.copyFileSync(a,ue.join(o,s)))}}async function ZT(e,t,n,r){let o=n.getOutputDeployMetadata();if(o.deploymentType==="static"){YT(e,t,r),xv(e,t);return}let i=o.staticAssetsPath,s=o.staticAssetsExclude?.[0],a=o.assetsSourceSkipMountPath===!0,l=r.replace(/\/+$/,"").replace(/^\/+/,"");a?i=Sv(e,i,l):i=Rm(e,i,l,n.info.name,s);let c=ue.join(t,"assets",l||"");oe.mkdirSync(c,{recursive:!0});let p=ue.join(e,i);if(oe.existsSync(p)&&oe.statSync(p).isDirectory()){u.info(`copying assets from /${i} to output/assets...`);try{s?(u.info(`excluding ${s}`),Or(u,p,c,{exclude:s})):Or(u,p,c)}catch(m){u.error(m,{prefix:"Failed to copy assets:"})}}else u.info("No assets to copy or assets directory not found");xv(e,t);let d=null;for(let m of[".json",".jsonc"]){let h=ue.join(e,`clouduser.wrangler${m}`);if(oe.existsSync(h)){d=h;break}}if(d){u.info("including user wrangler config in output..."),oe.copyFileSync(d,ue.join(t,"clouduser.wrangler.json"));let m=ue.join(e,"clouduser","migrations");if(oe.existsSync(m)){u.info("copying migrations from clouduser/migrations to output/migrations...");let h=ue.join(t,"migrations");Or(u,m,h)}}}async function QT(e){let t=`${e}.tar.gz`;try{return await Cv.create({gzip:!0,file:t,cwd:ue.dirname(e)},[ue.basename(e)]),u.info(`Tarball created: ${t}`),t}catch(n){throw new f(n,{prefix:"Failed to create tarball:"})}}Me();De();A();var eP="DUPLICATE_ENVIRONMENT_MOUNT",tP="ENVIRONMENT_MOUNT_MISMATCH",nP="DUPLICATE_ENVIRONMENT_BRANCH",rP="INVALID_MOUNT_PATH_FORMAT",oP="INVALID_PROJECT_ID",iP="DUPLICATE_PROJECT_NAME",sP="MAX_PROJECTS_PER_SITE",Iv={[eP]:"An environment with this mount path already exists for this site. Please choose a different mount path.",[tP]:"This environment already exists with a different mount path. Please create a new environment or use the existing environment's mount path.",[nP]:"An environment with this branch already exists for this app.",[rP]:"Mount path format is invalid. It must start with a / and be followed by at least one character (e.g., /app).",[oP]:"Invalid app ID. This app may have been deleted or belongs to a different site. Please remove the 'app_id' field (or the legacy 'project_id' field) from your webflow.json and redeploy to create a new app.",[iP]:"An app with this name already exists on this site, usually because 'app_id' is missing from your webflow.json. To deploy to the existing app, provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json \u2014 you can find the ID in the Webflow Cloud dashboard.",[sP]:"This site has reached its limit of Cloud apps, so no new app can be created. Deploy to one of its existing apps, or delete an app you no longer need from the Webflow Cloud dashboard."};function Tv(e){let t={timestamp:new Date().toISOString()};if(e instanceof Error)t.code=e.name,t.msg=e.message,t.stack=e.stack;else if(typeof e=="object"&&e!==null){let i=e;t.code=typeof i.code=="string"?i.code:void 0,t.msg=typeof i.msg=="string"?i.msg:void 0,t.status=typeof i.status=="number"?i.status:void 0}let n=t.msg||"",r=t.status??t.code,o=typeof r=="number"?r:typeof r=="string"&&/^\d+$/.test(r)?Number(r):void 0;if(u.error(`Error Details: ${JSON.stringify({timestamp:t.timestamp,code:t.code,message:t.msg,status:t.status,stack:t.stack},null,2)}`),o===401)return"Your access token is expired or invalid. Run 'webflow auth login' to re-authenticate.";if(o===403)return"Your access token is missing required permissions. Run 'webflow auth login' to re-authenticate with the necessary scopes.";for(let i in Iv)if(n.includes(i))return Iv[i];return`An unknown error occurred. Error code: ${t.code||"N/A"}, Message: ${t.msg||"No message provided"}`}var es=w(require("fs")),Mm=require("child_process"),Ov=w(require("semver"));A();C();M();C();be();A();C();function Qi(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0})}var aP={siteId:{missingFlag:"siteId",flagHint:"--site",env:"WEBFLOW_SITE_ID",manifest:e=>e.siteId},appId:{missingFlag:"appId",flagHint:"--app-id",env:"WEBFLOW_APP_ID",manifest:e=>e.cloud?.app_id??e.cloud?.project_id},environmentId:{missingFlag:"environmentId",flagHint:"--environment-id",env:"WEBFLOW_APP_ENVIRONMENT_ID",manifest:e=>e.cloud?.environment_id},workspaceId:{missingFlag:"workspaceId",flagHint:"--workspace-id",env:"WEBFLOW_WORKSPACE_ID",manifest:e=>e.cloud?.workspace_id}};function jm(e){return typeof e=="string"&&e.trim()!==""}async function Po(e,t={}){let n=aP[e],{flagValue:r,manifest:o,flagName:i,prompt:s}=t,a=t.isNoInput??V(),l=t.json??et();if(jm(r))return Qi(r,e),r;let c=process.env[n.env];if(jm(c))return Qi(c,e),c;let p=n.manifest(o??{});if(jm(p))return l||u.info(`Using ${e} from webflow.json`),Qi(p,e),p;if(!a&&s){let m=await s();return Qi(m,e),m}let d=i??n.flagHint;throw new f(`Missing required ${e}. Pass ${d}, set ${n.env}, or add it to webflow.json.`,{isUserError:!0,missingFlag:n.missingFlag})}async function Lr(e,t={}){try{return await Po(e,t)}catch(n){if(n instanceof f&&n.missingFlag===e)return;throw n}}C();var lP=/[\x00-\x1f?#%/\\]/;function Nr(e,t){if(!e||e.trim()==="")throw new f(`Invalid ${t}: value is empty.`,{isUserError:!0});if(lP.test(e)||e.includes(".."))throw new f(`Invalid ${t}: "${e}" contains disallowed characters.`,{isUserError:!0})}function ve(e,t){Nr(e,t)}function cP(e){if(!e)return"unknown";let t=Ov.default.coerce(e)?.major;return t!==void 0?String(t):"unknown"}var Pv=104857600;function $v(e){if(e===0)return"0 B";let t=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function uP(){try{let e=(0,Mm.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(!/^[0-9a-f]{40}$/.test(e))throw new Error("Invalid commit hash format");try{return(0,Mm.execSync)("git status --porcelain --untracked-files=no",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0?`git@${e}+dirty`:`git@${e}`}catch{return`git@${e}`}}catch{return`noversion@${new Date().toISOString()}`}}async function Bm(e,t,n){let r=await fetch(`${P()}${t}`,{method:n.method,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:n.body?JSON.stringify(n.body):void 0});if(!r.ok){let o=await r.text(),i;try{i=JSON.parse(o)}catch{i={msg:o}}let s=Tv(i);throw new Error(s)}return r.json()}async function Lv(e,t,n,r){let{manifest:o}=ee(),i=o.cloud||{},s=i.framework,a=await Lr("appId",{flagValue:r?.appId,manifest:o});if(!s)throw new f("No framework specified in webflow.json. Please ensure your webflow.json has a cloud.framework property");let l=cP(i.framework_version),c=await dP({siteId:e.siteId,apiToken:e.accessToken,framework:s,frameworkVersion:l,mountPath:n,environment:t,projectId:a,projectName:r?.projectName,description:r?.description,directory:r?.directory,version:uP()});return!a&&c.project_id&&(xe({cloud:{...i,app_id:c.project_id}}),u.info(`${$} App ID updated in webflow.json`)),c}async function dP(e){let{siteId:t,framework:n,frameworkVersion:r,mountPath:o,environment:i,version:s,projectId:a,projectName:l,description:c,directory:p}=e,d={framework:n,framework_version:r,mount_path:o,environment:i,version:s};a&&(d.project_id=a),l&&(d.project_name=l),c&&(d.description=c),p&&(d.app_path=p);let m=t?`/cosmic/${t}/cli-deploy-init`:"/cosmic/cli-deploy-init";return Bm(e.apiToken,m,{method:"POST",body:d})}async function Nv(e,t){let{siteId:n,accessToken:r}=e,o=n?`/cosmic/${n}/cli-project-environments/${t}`:`/cosmic/cli-project-environments/${t}`;return Bm(r,o,{method:"GET"})}async function jv(e){let{siteId:t,accessToken:n}=e,r=t?`/cosmic/${t}/cli-projects`:"/cosmic/cli-projects";return Bm(n,r,{method:"GET"})}async function Mv(e,t){if(!es.existsSync(e))throw new Error(`Tarball not found at ${e}`);let n=es.statSync(e);if(n.size>Pv)throw new Error(`Build output is too large (${$v(n.size)}). Maximum allowed size is ${$v(Pv)}.`);let r=es.readFileSync(e),o=JSON.parse(t);if(!o.fields)throw new Error("Upload URL is missing fields property");let i=new FormData;Object.entries(o.fields).forEach(([l,c])=>{i.append(l,c)});let s=new Blob([r],{type:"application/gzip"});i.append("file",s,"output.tar.gz");let a=await fetch(o.url,{method:"POST",body:i});if(!a.ok){let l=await a.text();throw new f(l,{prefix:`${k} Upload failed with response:`})}}async function Bv(e,t){if(!e||e==="undefined")throw new f("Completion URL is undefined or invalid");let n=new URL(e);t&&n.searchParams.set("failed","true");let r=await fetch(n.toString(),{method:"GET"});if(!r.ok)throw new f(`Failed to trigger deployment: ${r.status} ${r.statusText}`)}var Uv=require("webflow-api");De();De();C();function Um(e){return new Uv.WebflowClient({accessToken:e,environment:{base:`${P()}/v2`,dataApi:`${P()}/v2`,contentDeliveryApi:`${mi()}/v2`}})}async function Ha(e,t){try{let r=await Um(e).sites.get(t);return{id:r.id||t,displayName:r.displayName||"Unknown Site",shortName:r.shortName||"unknown-site",customDomains:r.customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching site details:"})}}async function Wm(e,t){try{return{customDomains:(await Um(e).sites.getCustomDomain(t)).customDomains?.map(o=>({id:o.id||"",url:o.url||""}))||[]}}catch(n){throw new f(n,{prefix:"Error fetching custom domains:"})}}async function Hm(e){try{let t=await fetch(`https://${e}/manifest.json`);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(t){throw new f(t,{prefix:`Failed to fetch manifest from ${e}:`})}}function Vm(e,t,n){return e.cosmic&&Array.isArray(e.cosmic)?e.cosmic.some(r=>{if(r.mountPath!==t)return!1;if(!n)return!0;if(r.workerUrl)try{return new URL(r.workerUrl).hostname.split(".")[0]===n}catch{return!1}return!1}):!1}async function Wv(e,t,n){try{let r=Um(e),o=await Ha(e,t),i=[];if(n?.domains&&n.domains.length>0)for(let s of n.domains){let a=o.customDomains?.find(l=>l.url===s);a?.id&&i.push(a.id)}await r.sites.publish(t,{customDomains:i,publishToWebflowSubdomain:n?.publishToWebflowSubdomain??!0})}catch(r){throw new f(r,{prefix:"Error publishing site:"})}}Oe();A();async function Hv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)throw new Error("Site ID is required for mount path validation. Apps without a connected site skip this step.");let i=u.spinner("Validating mount path configuration");try{let s=await Ha(o,r),a=await Wm(o,r),l=[`${s.shortName}.webflow.io`,...a.customDomains?.map(g=>g.url)||[]],c=0;i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (0/${l.length})`);let p=l.map(async g=>{try{let y=await Hm(g),b=Array.isArray(y.cosmic)?y.cosmic.map(_=>_.mountPath).filter(_=>typeof _=="string"):[],S=Vm(y,t,n);return{domain:g,mountPaths:b,isValid:S===!0}}catch(y){return{domain:g,mountPaths:[],isValid:!1,error:y instanceof Error?y.message:String(y)}}finally{c++,i.update(`Validating ${l.length} domain(s) for mount path: ${t}... (${c}/${l.length})`)}}),d=await Promise.all(p),m=d.some(g=>!g.isValid),h=d.every(g=>g.isValid);return i.succeed("Mount path validation completed"),{isValid:h,domains:d,needsPublishing:m}}catch(s){throw i.fail("Mount path validation failed"),s}}async function Vv(e,t,n){let{siteId:r,accessToken:o}=e;if(!r)return[];try{let i=await Ha(o,r),s=await Wm(o,r),l=[`${i.shortName}.webflow.io`,...s.customDomains?.map(p=>p.url)||[]].map(async p=>{try{let d=await Hm(p),m=Vm(d,t,n);return{domain:p,isValid:m}}catch(d){return u.debug(`Could not verify mount path for ${p}: ${d}`),{domain:p,isValid:!1}}});return(await Promise.all(l)).filter(p=>p.isValid).map(p=>p.domain)}catch(i){return u.debug(`Error getting valid domains: ${i}`),[]}}function Gv(e,t){return e.map(n=>`${n.startsWith("localhost")||n.startsWith("127.0.0.1")?"http":"https"}://${n}${t}`)}async function Kv(e){let t=e.map(r=>({name:r,value:r,checked:!0})),n=await vn({message:"Select which domains you want to publish to update the mount path configuration:",choices:t,validate:r=>r.length===0?"Please select at least one domain to publish to.":!0});return n??[]}async function Jv(){return await $e({message:"The mount path doesn't match on some domains. Would you like to publish the site to update the configuration?",default:!0})}async function Gm(e,t){let{siteId:n,accessToken:r}=e;if(!n)throw new Error("Site ID is required to publish. Apps without a connected site do not use this.");let o=u.spinner(`Publishing site to ${t.length} domain(s)`);try{let s=`${(await Ha(r,n)).shortName}.webflow.io`,a=t.includes(s),l=t.filter(c=>c!==s);await Wv(r,n,{domains:l,publishToWebflowSubdomain:a}),o.succeed(`Site published successfully to selected domains: ${t.join(", ")}`)}catch{throw o.fail("Failed to publish site"),new Error("Failed to publish site")}}A();pe();var $o=w(require("path"));Me();De();be();var zv="apps";function Km(e){zv=e}function ts(){return zv}var xu=w(require("fs"));C();De();Oe();C();A();async function ns(e){let t=await fetch(`${P()}/v2/workspaces`,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!t.ok){let r=await t.text(),o={};try{o=JSON.parse(r)}catch{}throw t.status===403&&o.code==="missing_scopes"?new f(`Missing required scopes for workspace access.
|
|
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.
|
|
152
152
|
${o.message??""}
|
|
153
153
|
Re-run 'webflow auth login' to grant the necessary permissions.`):new f(`Failed to fetch workspaces: ${t.status} ${t.statusText}`+(o.message?`
|
|
154
|
-
${o.message}`:""))}return(await t.json()).workspaces}async function
|
|
154
|
+
${o.message}`:""))}return(await t.json()).workspaces}async function us(e){if(e.length===1)return e[0];let t=await Be({message:"Select the workspace for this app:",choices:e.map(n=>({name:n.name,value:n}))});return t||(u.warn(`Auto fallback to first workspace: ${e[0].name}`),e[0])}Vc();M();A();M();pe();async function og(e,t){u.warn(`${Q} ${le("webflow cloud create")} is deprecated and will be removed in the next major release.
|
|
155
155
|
Use ${J("webflow cloud init")} instead.
|
|
156
|
-
`);let{framework:n}=t;if(!(await
|
|
157
|
-
To list your Cloud apps, use ${J("webflow apps list")}.`:"";u.warn(`${
|
|
156
|
+
`);let{framework:n}=t;if(!(await ds()).find(i=>i===n)){u.error(`Framework ${n} not found`);return}await Ru(e,"/app",n,void 0,Fe.Existing,void 0)}A();pe();M();Kn();async function ig(){let e=Je()?"webflow apps init":"webflow cloud init",t=Je()?`
|
|
157
|
+
To list your Cloud apps, use ${J("webflow apps list")}.`:"";u.warn(`${Q} ${le("webflow cloud list")} is deprecated and will be removed in the next major release.
|
|
158
158
|
It lists scaffold templates, not your apps.
|
|
159
159
|
Use ${J(`${e} --framework`)} / ${J("--help")} for available templates.${t}
|
|
160
|
-
`);let n=await
|
|
160
|
+
`);let n=await ds();u.info("Available app templates:"),n.length>0?n.forEach(r=>u.info(`- ${r}`)):u.info("No templates found.")}q();C();be();Oe();A();M();var aS=w(require("path"));function Ur(e){if(!e||e.trim()==="")return"/";let t=aS.posix.normalize(e);return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.split("/").map((r,o)=>o===0?r:encodeURIComponent(r)).join("/"),t}function Ya(e){return!(!e||e.trim()===""||!e.startsWith("/")||e.includes(".."))}pe();A();M();function Za(e,t){u.warn(`${Q} ${le(e)} is deprecated; use ${J(t)} instead.`)}async function sg(e){if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");e.projectName!==void 0&&Za("--project-name","--app-name");let t=e.appName??e.projectName;if(e.workspaceId&&e.siteId)throw new f("--workspace-id and --site-id are mutually exclusive. Pass exactly one.");if(e.new&&e.siteId)throw new f("--new and --site-id are mutually exclusive. Use --site-id to connect to an existing site, or --new to create a standalone app.");let n=process.stdin.isTTY,r;n&&an()&&(r=await T());let o=!1;if(r&&!e.new&&!e.siteId)try{(await kr(r)).length===0&&(u.info(`${Ce} No existing Webflow sites in your workspace \u2014 starting a new app.`),o=!0)}catch(h){u.debug(`Skipped sites lookup in cloud init preflight: ${h}`)}let i=await ds(),s={};if(n&&an()){if(!e.new&&!o&&(s.initMode=await Be({message:"Where do you want to deploy this app?",choices:[{name:"New domain",value:Fe.New},{name:"Existing site",value:Fe.Existing}],default:Fe.New})),e?.framework||(s.scaffoldName=await Be({message:"Which framework would you like to use?",choices:i.map(g=>({name:g,value:g})),default:"astro"})),!t){let g=await Ke({message:"What would you like to name your app?",validate:y=>{let b=y.trim();return b===""?"App name cannot be empty":b.length<Zn||b.length>Qn?`App name must be between ${Zn} and ${Qn} characters`:!0}});if(g==null)throw new f("When --no-input mode is enabled please provide the --app-name option.");s.appName=g}let h=e.new||o||s.initMode===Fe.New;if(!e.mount&&!h){let g=await Ke({message:"What path do you want to use locally? (e.g., /app)",default:"/app"});s.mountPath=Ur(g)}}let a=t||s.appName,l=e.framework||s.scaffoldName,c=e.new||o?Fe.New:s.initMode??(e.siteId?Fe.Existing:V()?Fe.New:Fe.Existing),d=c===Fe.New?e.mount||s.mountPath||"/":e.mount||s.mountPath||"/app",p=e.siteId,m=Ur(d);if(!a||typeof a!="string"||a.trim()==="")throw new f("--app-name cannot be empty");if(a.length<Zn||a.length>Qn)throw new f(`--app-name must be between ${Zn} and ${Qn} characters`);if(!l)throw new f("--framework is required");if(!i.includes(l)){let h=i.join(`
|
|
161
161
|
- `);throw new f(`--framework "${l}" not found
|
|
162
162
|
|
|
163
163
|
Available frameworks:
|
|
164
|
-
- ${h}`)}if(typeof m!="string"||!
|
|
164
|
+
- ${h}`)}if(typeof m!="string"||!Ya(m))throw new f("Invalid mount path: "+m);if(c===Fe.Existing&&!p&&(!n||V()))throw new f("--site-id is required when connecting to an existing site in non-interactive mode.");await Ru(a,m,l,p,c,e.workspaceId)}var fS=w(require("path"));q();C();be();Oe();A();M();Me();X();var lS=require("crypto");De();C();async function cS(e){let{accessToken:t,workspaceId:n,displayName:r,description:o,appPath:i}=e,a={requestId:(0,lS.randomUUID)(),cloudApp:{displayName:r,description:o,appPath:i,source:{type:"CLI",cli:{sourceUrl:BE}}}},l=`${$()}/cosmic/workspaces/${n}/cloudApps`,c=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json","Accept-Version":"1.0.0"},body:JSON.stringify(a)});if(!c.ok){let d=await c.text();throw xP(c.status,c.statusText,d)}return c.json()}function xP(e,t,n){let r={};try{r=JSON.parse(n)}catch{}return e===403?r.publicErrorCode==="missing_scopes"?new f(`Missing required scopes to create a Cloud app.
|
|
165
165
|
${r.msg??""}
|
|
166
|
-
Re-run 'webflow auth login' to grant the necessary permissions.`):new f(r.msg??"You don't have permission to create apps in this workspace."):e===404?new f("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?r.publicErrorCode==="workspace_unhosted_project_limit"?new f(
|
|
166
|
+
Re-run 'webflow auth login' to grant the necessary permissions.`):new f(r.msg??"You don't have permission to create apps in this workspace."):e===404?new f("Cloud app creation is not available. The workspace may not exist or the feature is not enabled for your account."):e===409?r.publicErrorCode==="workspace_unhosted_project_limit"?new f(CP(r.planName,r.limit)):r.msg?.includes("No new sites can be created")?new f(`Failed to create app: your workspace has reached its app limit.
|
|
167
167
|
Upgrade your plan or remove unused apps to create a new one.`):new f(r.msg??"A Cloud app creation request is already being processed. Please wait and try again."):new f(`Failed to create app: ${e} ${t}`+(r.msg?`
|
|
168
|
-
${r.msg}`:""))}function
|
|
168
|
+
${r.msg}`:""))}function CP(e,t){let n="Upgrade your plan or remove unused apps to create a new one.",r=t===1?"Cloud app":"Cloud apps";return e&&typeof t=="number"&&t>0?`Your "${e}" workspace is limited to ${t} ${r}.
|
|
169
169
|
${n}`:typeof t=="number"&&t>0?`Your workspace is limited to ${t} ${r}.
|
|
170
170
|
${n}`:e?`Your "${e}" workspace has reached its Cloud app limit.
|
|
171
171
|
${n}`:`Failed to create app: your workspace has reached its app limit.
|
|
172
|
-
`+n}Me();C();be();Oe();q();async function
|
|
172
|
+
`+n}Me();C();be();Oe();q();async function pS(e={}){FP(e);let t=await _P(e,ne().manifest);return{credentials:t.credentials,workspaceId:t.workspaceId,manifest:ne().manifest}}function FP(e){if(e.siteId&&e.workspaceId)throw new f("--site-id and --workspace-id are mutually exclusive. Pass exactly one.")}async function _P(e,t){if(e.siteId)return uS(t,e.siteId);if(e.workspaceId)return dS(e.workspaceId);let n=await Mr("siteId",{manifest:t});if(n)return uS(t,n);let r=await Mr("workspaceId",{manifest:t});if(r)return dS(r);if(V()||!an())throw new f(`No identity configured for this app.
|
|
173
173
|
Pass one of:
|
|
174
174
|
--site-id <id> (deploy to an existing Webflow site)
|
|
175
175
|
--workspace-id <id> (create a new Cloud app)
|
|
176
|
-
Or run 'webflow cloud init' to scaffold a new app.`);return
|
|
177
|
-
Use --app-name to provide a valid name.`);let S=u.spinner("Creating Cloud app...");try{let v=await
|
|
178
|
-
No existing apps found. A new app will be created during deployment.`)}catch(b){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(b instanceof Error?b.message:String(b))}}if(!c&&!m&&(m=await Ke({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:b=>b.trim()===""?"App name cannot be empty":!0})),c)try{let S=(await
|
|
179
|
-
Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}return}try{let s=await
|
|
180
|
-
Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}},
|
|
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=r?.domainsOverride??await
|
|
176
|
+
Or run 'webflow cloud init' to scaffold a new app.`);return RP(t)}async function uS(e,t){return{credentials:await ze(e,{site:t})}}async function dS(e){let t=await T();return{workspaceId:e,credentials:{accessToken:t,siteId:""}}}async function AP(){let e=await T(),t=await cs(e);if(t.length===0)throw new Er("No workspaces found in your account. Please make sure you have at least one workspace.");let n=await us(t);return xe({cloud:{workspace_id:n.id}}),{workspaceId:n.id,credentials:{accessToken:e,siteId:""}}}async function RP(e){let t=await Be({message:"This app isn't initialized for Webflow Cloud. How would you like to deploy?",choices:[{name:"Create a new app",value:"standalone"},{name:"Attach to an existing Webflow site",value:"site-attached"},{name:"Cancel",value:"cancel"}]});if(t==="cancel"||!t)throw new f("Deploy cancelled.",{skipLogging:!0});return t==="standalone"?AP():{credentials:await ze(e,{})}}async function ag(e){try{if(e.appName!==void 0&&e.projectName!==void 0)throw new f("--app-name and --project-name are aliases of the same option. Pass exactly one (--app-name is preferred; --project-name is deprecated).");if(e.appId!==void 0&&e.projectId!==void 0)throw new f("--app-id and --project-id are aliases of the same option. Pass exactly one (--app-id is preferred; --project-id is deprecated).");e.projectName!==void 0&&Za("--project-name","--app-name"),e.projectId!==void 0&&Za("--project-id","--app-id");let t=e.appName??e.projectName,n=e.appId??e.projectId;if(e.directory)try{process.chdir(e.directory),u.info(`Changed directory to: ${e.directory}`)}catch(g){throw u.error(`Error: Could not change to directory ${e.directory}`),new f(g)}if(e.framework){if(!Ja.includes(e.framework))throw new f(`Framework "${e.framework}" is not supported. Allowed: ${Ja.join(", ")}.`);xe({cloud:{framework:e.framework}})}let r=await pS({siteId:e.siteId,workspaceId:e.workspaceId}),{workspaceId:o}=r,{credentials:i,manifest:s}=r,a=!!o;if(o){let g=fS.default.basename(process.cwd()).trim(),y=g.length>=Zn&&g.length<=Qn,b=t??(y?g:"Cloud App");if(b.length<Zn||b.length>Qn)throw new f(`App name must be between ${Zn} and ${Qn} characters (got ${b.length}).
|
|
177
|
+
Use --app-name to provide a valid name.`);let S=u.spinner("Creating Cloud app...");try{let v=await cS({accessToken:i.accessToken,workspaceId:o,displayName:b});S.succeed(`Cloud app created: ${v.cloudApp.displayName}`),xe({siteId:v.cloudApp.siteId,cloud:{...s.cloud,app_id:v.cloudApp.project.id,environment_id:v.cloudApp.environment.id}}),Jn({siteId:v.cloudApp.siteId,directory:"."}),process.env.WEBFLOW_SITE_ID=v.cloudApp.siteId,{manifest:s}=ne()}catch(v){throw S.fail("Failed to create app"),new f(v,{prefix:"Could not create app:"})}let _=s.siteId;if(!_)throw new f("Expected siteId in manifest after Cloud app creation.");i={accessToken:i.accessToken,siteId:_}}let l;try{l=F.forCloud({authToken:i.accessToken,siteId:i.siteId})}catch(g){u.debug(`Failed to initialize telemetry: ${g}`)}let c=await Mr("appId",{flagValue:n,manifest:s}),d,p,m=t,h=e.description;if(e.environment&&e.mount){if(d=e.environment,p=Ur(e.mount),!Ya(p))throw new f("Invalid mount path: "+p)}else{let g=[];if(!c){if(!m&&V())throw new f("When --no-input mode is enabled, provide --app-name to create an app, or provide --app-id, set WEBFLOW_APP_ID, or set cloud.app_id in webflow.json to deploy to an existing app.");try{let b=await Xv(i);if(b.projects.length>0){let S=await Be({message:"Select an app to deploy to:",choices:[...b.projects.map(_=>({name:`${_.name} (${_.description||"No description"})`,value:_.id})),{name:"Create new app",value:null}]});S?(c=S,xe({cloud:{app_id:S}}),u.info(`${P} App ID updated in webflow.json`)):u.info("Creating a new app will be handled during deployment.")}else u.info(`
|
|
178
|
+
No existing apps found. A new app will be created during deployment.`)}catch(b){u.warn("Could not fetch existing apps. A new app will be created during deployment."),u.warn(b instanceof Error?b.message:String(b))}}if(!c&&!m&&(m=await Ke({message:"What would you like to name your new app?",default:"New Webflow Cloud App",validate:b=>b.trim()===""?"App name cannot be empty":!0})),c)try{let S=(await qv(i,c)).environments.map(_=>({name:`${_.branch} (${_.mount})`,value:{branch:_.branch,mount:_.mount}}));g.push(...S)}catch(b){throw new f(b,{prefix:"Error fetching app environments:"})}g.push({name:"Create new environment",value:null});let y=await Be({message:"Select an environment to deploy to:",choices:g});if(y)d=y.branch,p=Ur(y.mount);else if(e.environment?d=e.environment:d=await Ke({message:"What environment would you like to deploy to?",default:"main",validate:b=>b.trim()===""?"Environment cannot be empty":!0}),e.mount)p=Ur(e.mount);else{let b=await Ke({message:"What path should this environment be mounted at? (e.g., /app)",default:"/app"});p=Ur(b)}}if(!Ya(p))throw new f("Invalid mount path: "+p);await mS(i,d,p,{projectName:m,description:h,directory:e.directory,skipMountPathCheck:a||e.skipMountPathCheck,autoPublish:e.autoPublish,telemetry:l,appId:c})}catch(t){throw new f(t,{prefix:"Error during deployment setup:"})}}var Qa=null;process.once("exit",()=>Qa?.());var gS=(e,t,n)=>t instanceof lo?"no-sites":t instanceof Er?"no-workspaces":e==="auth"?"auth":e==="workspaces"&&n===Fe.New?"no-workspaces":"unknown",ds=async()=>{try{let e=Rm(),t=Im();return[...new Set([...e,...t])]}catch(e){return u.error(e,{prefix:"Failed to get available scaffolds:"}),[]}},IP=async(e,t,n)=>{let r;if("content"in n)r=n.content.files;else{let l=n[t];if(!l)throw new Error(`Scaffold "${t}" not found`);r=l}let o=r.find(l=>l.includes(mo));if(!o)throw new Error(`No ${mo} found in scaffold "${t}"`);await Iu.promises.mkdir(e,{recursive:!0});let s=(await Iu.promises.readFile(o,"utf8")).replace(du,e),a=No.join(e,mo);await Iu.promises.writeFile(a,s,"utf8")},Ru=async(e,t,n=uu,r,o=Fe.Existing,i)=>{if(o===Fe.New){try{let s=await $m(n);await TP(e,t,s.scaffoldId,{content:s},n,i)}catch(s){if(s instanceof tt){let a=s.message;throw s.supportedIds?.length&&(a+=`
|
|
179
|
+
Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}return}try{let s=await fu(n);await PP(e,t,n,{content:s},r)}catch(s){if(s instanceof tt){let a=s.message;throw s.supportedIds?.length&&(a+=`
|
|
180
|
+
Available frameworks: ${s.supportedIds.join(", ")}`),new f(a)}throw s}},TP=async(e,t,n,r,o,i)=>{let s=`./${e}`,a="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,l=a?No.dirname(a.extractionRoot):null,c="auth",d=!1,p=!1,m=null;try{let h=Date.now(),g=await T();c="workspaces";let y;if(i)y={id:i};else{let _=await cs(g);if(_.length===0)throw new Er("No workspaces found in your account. Please make sure you have at least one workspace.");y=await us(_)}c="scaffold",await Ia(e,t,n,r,void 0,void 0),p=!0,process.chdir(s);let b=o??n;xe({cloud:{framework:b,workspace_id:y.id}}),Jn({apiToken:g,directory:"."}),process.env.WEBFLOW_API_TOKEN=g;let S=Date.now()-h;try{await F.forCloud({authToken:g}).sendUsage("project_init",{scaffold:b,scaffoldName:b,initMode:Fe.New,workspaceId:y.id,totalDuration:S,mountPath:t,namespace:ls()})}catch{}d=!0}catch(h){if(m=h,h instanceof f||h instanceof Error&&h.message.includes("OAuth")){try{await Ia(e,t,n,r),process.chdir(s),xe({cloud:{framework:o??n}}),Jn({directory:"."}),p=!0}catch{}throw u.error(h),new f(h,{skipLogging:!0})}throw h}finally{if(l)try{lg.default.removeSync(l)}catch{}if(d){let h=yS(e,Fe.New);Qa=()=>u.info(h)}else{let h=gS(c,m,Fe.New),g=wS(e,Fe.New,h,p);Qa=()=>u.info(g)}}},PP=async(e,t,n,r,o)=>{let i=`./${e}`,s=null,a=!1,l="content"in r&&typeof r.content=="object"&&"extractionRoot"in r.content?r.content:null,c=l?No.dirname(l.extractionRoot):null,d="auth",p=!1,m=!1,h=null;try{let g=Date.now();await IP(e,n,r),process.chdir(i);let{manifest:y}=ne(),b=await ze(y,{site:o}),S=b.accessToken,_=b.siteId;if(s=F.forCloud({authToken:S,siteId:_}),d="scaffold",await Ia(".",t,n,r,_,S),m=!0,d="devlink",_){u.info(`${Ce} Running devlink export to fetch your Webflow components`);try{await $P({site:_,apiToken:S}),a=!0}catch(x){uo(x)?u.info(`${Ce} Skipped component export \u2014 requires a paid Site or Workspace plan. Upgrade at https://webflow.com/pricing.`):u.error(x,{prefix:"Failed to run devlink export:"})}}let v=Date.now()-g;await s?.sendUsage("project_init",{scaffold:n,scaffoldName:n,devlinkSyncStatus:a,totalDuration:v,mountPath:t,namespace:ls()}),p=!0}catch(g){h=g,u.error(g);try{await Ia(".",t,n,r),m=!0}catch{}throw new f(g,{skipLogging:!0})}finally{if(c)try{lg.default.removeSync(c)}catch{}if(p){let g=yS(e,Fe.Existing);Qa=()=>u.info(g)}else{let g=gS(d,h,Fe.Existing),y=wS(e,Fe.Existing,g,m);Qa=()=>u.info(y)}}},$P=async e=>{let{exportComponents:t}=await Promise.resolve().then(()=>(Vc(),yk));await t({site:e.site,apiToken:e.apiToken,silentNotEntitled:!0})},OP=e=>{if(e?.skipMountPathCheck!==void 0)return e.skipMountPathCheck;try{let{manifest:t}=ne();return _m(t)?!0:t.cloud?.skipMountPathCheck===!0}catch{return!1}},LP=async(e,t,n,r)=>{u.info(je("Validating mount path configuration..."));let o=await tS(e,t,n);if(o.isValid)u.info(J("Mount path validation passed"));else if(u.info(I(`
|
|
181
|
+
Mount path validation results:`)),o.domains.forEach(i=>{let s=i.isValid?P:Q,a=i.isValid?J(`${i.domain} (mountPath: ${i.mountPaths[0]})`):le(`${i.domain} (no matching mountPath)`);u.info(`${s} ${a}`),i.error&&u.debug(` Error: ${i.error}`)}),o.needsPublishing)if(r){u.info("\u{1F680} Auto-publishing site to update mount path configuration...");let i=o.domains.filter(s=>!s.isValid).map(s=>s.domain);await ng(e,i)}else if(await iS()&&an()){let s=o.domains.filter(l=>!l.isValid).map(l=>l.domain),a=await oS(s);await ng(e,a)}else u.warn("\u26A0\uFE0F Continuing with deployment without publishing...")},NP=async(e,t,n,r)=>{Jm("\u{1F3D7}\uFE0F ","Building app");let o=await Bv(e,{mountPath:n,telemetry:r?.telemetry,deployUrl:t.deploy_url,environmentId:t.environment_id});Jm("\u{1F4E4}","Uploading build artifacts");let i=Date.now();await Yv(o,t.upload_url);let s=Date.now()-i;return u.info(`${P} Upload completed in ${(s/1e3).toFixed(1)}s`),o},jP=async(e,t,n,r)=>{u.success(`
|
|
182
|
+
\u{1F310} Your cloud app will soon be available at:`);try{let o=r?.domainsOverride??await nS(e,t,n),i=rS(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}`)}},MP=e=>{e.site_slug?u.success(`Visit your deployment:
|
|
183
183
|
|
|
184
|
-
${
|
|
185
|
-
Visit the webflow Cloud dashboard to view your deployment: https://webflow.com/dashboard/sites`)},
|
|
184
|
+
${xn()}/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`)},BP=async(e,t,n,r,o)=>{try{if(await Zv(t.completion_url,!!r),r)u.error(`
|
|
186
186
|
${k} Deployment failed due to build error.`);else{u.success(`
|
|
187
|
-
${
|
|
188
|
-
`)},
|
|
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}.
|
|
189
189
|
${s??""}
|
|
190
190
|
Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0});let a=r?`${r}: `:"",l=o&&e.status>=400&&e.status<500;return new f(`${a}${e.status} ${e.statusText}`+(s?`
|
|
191
|
-
${s}`:""),l?{isUserError:!0}:void 0)}async function
|
|
191
|
+
${s}`:""),l?{isUserError:!0}:void 0)}async function KP(e,t,n={}){let r=await G(fs(`${$()}/cosmic/apps`,{limit:$u,cursor:t,filters:n}),{headers:gt(e)});if(!r.ok)throw await Ct(r);return Mo(await r.json(),"apps")}async function Ou(e,t={}){return tl(n=>KP(e,n,t))}async function Lu(e,t){ve(t,"appId");let n=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}`,{headers:gt(e)});if(!n.ok)throw await Ct(n);return await n.json()}async function kS(e,t,n){ve(t,"appId");let r=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"PATCH",headers:{...gt(e),"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await Ct(r);return await r.json()}async function ES(e,t){ve(t,"appId");let n=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}`,{method:"DELETE",headers:gt(e)});if(!n.ok)throw await Ct(n);return await n.json()}async function vS(e,t,n={}){ve(t,"appId");let r=fs(`${$()}/cosmic/apps/${encodeURIComponent(t)}/domains`,{limit:n.limit,cursor:n.cursor}),o=await G(r,{headers:gt(e)});if(!o.ok)throw await Ct(o);let{items:i,nextCursor:s}=Mo(await o.json(),"customDomains");return{customDomains:i,nextCursor:s}}async function JP(e,t,n,r={}){let o=await G(fs(`${$()}/cosmic/apps/${encodeURIComponent(t)}/environments`,{limit:$u,cursor:n,filters:r}),{headers:gt(e)});if(!o.ok)throw await Ct(o);return Mo(await o.json(),"environments")}async function ms(e,t,n={}){return ve(t,"appId"),tl(r=>JP(e,t,r,n))}function SS(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 xS(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Br(r,"deploymentId");let i=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/buildLogs${SS(o)}`,{headers:gt(e)});if(!i.ok)throw await Ct(i);return await i.json()}async function CS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/logs${SS(r)}`,{headers:gt(e)});if(!o.ok)throw await Ct(o);return await o.json()}async function FS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(fs(`${$()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{limit:r.limit,cursor:r.cursor}),{headers:gt(e)});if(!o.ok)throw await Ct(o);let{items:i,nextCursor:s}=Mo(await o.json(),"deployments");return{deployments:i,nextCursor:s}}async function Nu(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Br(r,"deploymentId");let i=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}`,{headers:gt(e),signal:o.signal});if(!i.ok)throw await Ct(i);return await i.json()}async function _S(e,t,n,r,o={}){ve(t,"appId"),ve(n,"environmentId"),Br(r,"deploymentId");let i=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments/${encodeURIComponent(r)}/redeploy`,{method:"POST",headers:{...gt(e),"Content-Type":"application/json",...o.idempotencyKey?{"Idempotency-Key":o.idempotencyKey}:{}},body:JSON.stringify({})});if(!i.ok)throw await Ct(i);return await i.json()}async function AS(e,t,n,r={}){ve(t,"appId"),ve(n,"environmentId");let o=await G(`${$()}/cosmic/apps/${encodeURIComponent(t)}/environments/${encodeURIComponent(n)}/deployments`,{method:"POST",headers:{...gt(e),"Content-Type":"application/json",...r.idempotencyKey?{"Idempotency-Key":r.idempotencyKey}:{}},body:JSON.stringify({})});if(!o.ok)throw await Ct(o);return await o.json()}async function cg(e){let t=await T(),n=F.forApps({authToken:t}),r=Date.now();try{let o={siteId:e.site,name:e.name,q:e.q},i=ps(o),s=await Ou(t,o);if(await n.sendUsage("apps_list",{duration:Date.now()-r,count:s.length,filtered:i}),e.json){u.info(JSON.stringify(s,null,2));return}if(s.length===0){u.info(i?"No apps matched the given filters.":"No apps found.");return}let a=_e(e.fields,fc,vr());u.info(mc(s,a))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list apps:`}))}}q();C();A();M();X();Me();C();be();Oe();async function ju(e,t={}){let n=await Ou(e);if(n.length===0)throw new f("No apps found in this workspace.",{isUserError:!0});if(n.length===1)return n[0].id;if(V()||t.json){let o=n.map(i=>` ${i.id} (${i.name})`).join(`
|
|
192
192
|
`);throw new f(`This workspace has multiple apps. Pass the app id to choose one:
|
|
193
|
-
${o}`,{isUserError:!0,missingFlag:"appId"})}let r=await Be({message:"Select an app:",choices:n.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!r)throw new f("No app selected.",{isUserError:!0});return r}async function
|
|
194
|
-
`)}function
|
|
193
|
+
${o}`,{isUserError:!0,missingFlag:"appId"})}let r=await Be({message:"Select an app:",choices:n.map(o=>({name:`${o.name} (${o.id})`,value:o.id}))});if(!r)throw new f("No app selected.",{isUserError:!0});return r}async function Ln(e,t,n){let{manifest:r}=ne();return Lo("appId",{flagValue:t,manifest:r,isNoInput:!1,json:n.json,prompt:()=>ju(e,{json:n.json})})}async function ug(e,t){let n=await T(),r=await Ln(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await Lu(n,r);if(await o.sendUsage("apps_get",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}let a=_e(t.fields,fc,vr());u.info(mc([s],a))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_get",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app:`}))}}q();C();A();M();X();async function dg(e,t){let n=await T(),r=await Ln(n,e,t),o=F.forApps({authToken:n}),i=Date.now();try{let s=await vS(n,r,{limit:t.limit,cursor:t.cursor});if(await o.sendUsage("apps_domains",{duration:Date.now()-i,count:s.customDomains.length}),t.json){u.info(JSON.stringify(s,null,2));return}if(s.customDomains.length===0){u.info("No domains found.");return}let a=_e(t.fields,oD,pa());u.info(sD(s.customDomains,a)+Fi(s.nextCursor))}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_domains",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to get app domains:`}))}}q();C();A();M();X();async function pg(e,t){let n=await T(),r=await Ln(n,e,t),o=t.json?void 0:_e(t.fields,iD,fa()),i=F.forApps({authToken:n}),s=Date.now();try{let a={branch:t.branch,q:t.q},l=ps(a),c=await ms(n,r,a);if(await i.sendUsage("apps_environments_list",{duration:Date.now()-s,count:c.length,filtered:l}),t.json){u.info(JSON.stringify(c,null,2));return}if(c.length===0){u.info(l?"No environments matched the given filters.":"No environments found.");return}u.info(aD(c,o))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_environments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list app environments:`}))}}q();C();A();M();X();pe();var fg=["timestamp","message","phase"],nl="timestamp,message",Mu=dt(fg);function Wr(){return fg}function zP(e,t){return e==null||e===""?I("\u2014"):t==="timestamp"?new Date(String(e)).toLocaleString():String(e)}function qP(e,t=nl.split(",")){return e.map(n=>t.map(r=>zP(n[r],r)).join(" ")).join(`
|
|
194
|
+
`)}function Bu(e,t,n){return t.json?JSON.stringify({logs:e.logs,nextCursor:e.nextCursor},null,2):e.logs.length===0?"No logs found.":qP(e.logs,n)+Fi(e.nextCursor)}Me();C();be();Oe();async function RS(e,t,n={}){let r=await ms(e,t);if(r.length===0)throw new f("No environments found for this app.",{isUserError:!0});if(r.length===1)return r[0].id;if(V()||n.json){let i=r.map(s=>` ${s.id} (${s.branch})`).join(`
|
|
195
195
|
`);throw new f(`This app has multiple environments. Pass the environment id to choose one:
|
|
196
|
-
${i}`,{isUserError:!0,missingFlag:"environmentId"})}let o=await Be({message:"Select an environment:",choices:r.map(i=>({name:`${i.branch} (${i.id})`,value:i.id}))});if(!o)throw new f("No environment selected.",{isUserError:!0});return o}async function Xe(e,t){let{manifest:n}=ee(),r=await Po("appId",{flagValue:t.appId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>Tu(e,{json:t.json})}),o=await Po("environmentId",{flagValue:t.environmentId,manifest:n,isNoInput:!1,json:t.json,prompt:()=>wS(e,r,{json:t.json})});return{appId:r,envId:o}}async function rg(e,t){if(!e)throw new f("Missing deployment ID. Run 'webflow apps deployments list' to find one, then pass it as the argument.",{isUserError:!0,missingFlag:"depId"});let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json}),i=t.json?void 0:_e(t.fields,Pu,Mr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await fS(n,r,o,e,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_build",{duration:Date.now()-a,count:l.logs.length}),u.info($u(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_build",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read build logs:`}))}}q();C();A();M();X();async function og(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{environmentId:e,json:t.json}),i=t.json?void 0:_e(t.fields,Pu,Mr()),s=F.forApps({authToken:n}),a=Date.now();try{let l=await mS(n,r,o,{limit:t.limit,cursor:t.cursor,since:t.since,q:t.q});await s.sendUsage("apps_logs_runtime",{duration:Date.now()-a,count:l.logs.length}),u.info($u(l,t,i))}catch(l){throw l instanceof f&&l.isUserError?l:(await s.sendError(l instanceof Error?l:new Error(String(l)),"apps_logs_runtime",{duration:Date.now()-a}),new f(l,{prefix:`${k} Failed to read runtime logs:`}))}}q();C();A();M();X();async function ig(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=e.json?void 0:_e(e.fields,Yc,Cr()),i=F.forApps({authToken:t}),s=Date.now();try{let a=await gS(t,n,r,{limit:e.limit,cursor:e.cursor});if(await i.sendUsage("apps_deployments_list",{duration:Date.now()-s,count:a.deployments.length}),e.json){u.info(JSON.stringify(a,null,2));return}if(a.deployments.length===0){u.info("No deployments found.");return}u.info(wa(a.deployments,o)+Ri(a.nextCursor))}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_list",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to list deployments:`}))}}q();pe();C();be();A();M();X();var NP=5,bS=1800;function jP(e){return new Promise(t=>setTimeout(t,e))}async function DS(e,t,n,r,o={}){let i=Math.min(bS,Math.max(NP,o.interval??qc)),s=Math.min(bS,Math.max(1,o.timeout??Xc)),a=Date.now()+s*1e3,l,c,p=!1;for(;;){let d=new AbortController,m=setTimeout(()=>d.abort(),Math.max(0,a-Date.now())),h;try{h=await Iu(e,t,n,r,{signal:d.signal})}catch(b){if(d.signal.aborted){p=!0;break}throw b}finally{clearTimeout(m)}c=h;let g=h.status;if(gE(g))break;let y=a-Date.now();if(y<=0){p=!0;break}if(g!==l&&o.onStatusChange?.(l,g),l=g,await jP(Math.min(i*1e3,y)),Date.now()>=a){p=!0;break}}return{deployment:c,timedOut:p,timeoutSeconds:s}}async function sg(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json}),i=t.json?void 0:_e(t.fields,Yc,Cr()),s=F.forApps({authToken:n}),a=Date.now(),l=t.wait?"apps_deployments_watch":"apps_deployments_get";try{if(t.wait){let p=!t.json&&!V(),{deployment:d,timedOut:m,timeoutSeconds:h}=await DS(n,r,o,e,{interval:t.interval,timeout:t.timeout,onStatusChange:p?(y,b)=>u.info(I(y===void 0?b:`${y} \u2192 ${b}`)):void 0}),g=m?"timeout":d?.status??"unknown";if(await s.sendUsage("apps_deployments_watch",{duration:Date.now()-a,finalStatus:g}),process.exitCode=!m&&d?.status==="success"?0:1,t.json){u.info(JSON.stringify(d??null,null,2));return}d&&u.info(wa([d],i)),m&&u.warn(`Timed out after ${h}s waiting for a terminal status (last status: ${d?.status??"unknown"}).`);return}let c=await Iu(n,r,o,e);if(await s.sendUsage("apps_deployments_get",{duration:Date.now()-a}),t.json){u.info(JSON.stringify(c,null,2));return}u.info(wa([c],i))}catch(c){throw c instanceof f&&c.isUserError?c:(await s.sendError(c instanceof Error?c:new Error(String(c)),l,{duration:Date.now()-a}),new f(c,{prefix:`${k} Failed to ${t.wait?"watch":"get"} deployment:`}))}}q();pe();C();A();M();X();async function ag(e,t){let n=await T(),{appId:r,envId:o}=await Xe(n,{json:t.json});if(t.dryRun){ve(r,"appId"),ve(o,"environmentId"),Nr(e,"deploymentId"),t.json?u.info(JSON.stringify({deploymentId:e,appId:r,environmentId:o,dryRun:!0},null,2)):(u.info(`Would redeploy deployment ${e} (same commit) in app ${r}, environment ${o}.`),u.info("Dry run \u2014 no changes made."));return}let i=F.forApps({authToken:n,suppressCommand:!!t.idempotencyKey}),s=Date.now();try{let a=await hS(n,r,o,e,{idempotencyKey:t.idempotencyKey});if(await i.sendUsage("apps_deployments_redeploy",{duration:Date.now()-s}),t.json){u.info(JSON.stringify(a,null,2));return}let l=a.commitSha.slice(0,7);a.status==="queued"?u.info(`${$} Redeploy queued \u2014 commit ${l}`):u.info(`${Ce} Redeploy in progress \u2014 commit ${l} ${I("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_redeploy",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to redeploy deployment:`}))}}q();pe();C();var kS=require("child_process");function ES(){try{let e=(0,kS.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}A();M();X();function MP(e){let t=ES();e&&t&&e!==t&&u.warn(`This will rebuild \`${e}\`, you're currently on \`${t}\`.`)}async function BP(e,t,n){try{return(await as(e,t)).find(o=>o.id===n)}catch{return}}async function lg(e){let t=await T(),{appId:n,envId:r}=await Xe(t,{json:e.json}),o=await BP(t,n,r);if(MP(o?.branch),e.dryRun){ve(n,"appId"),ve(r,"environmentId"),e.json?u.info(JSON.stringify({appId:n,environmentId:r,branch:o?.branch??null,dryRun:!0},null,2)):(u.info(`Would trigger a build of ${o?.branch?`\`${o.branch}\` `:""}in app ${n}, environment ${r}.`),u.info("Dry run \u2014 no changes made."));return}let i=F.forApps({authToken:t,suppressCommand:!!e.idempotencyKey}),s=Date.now();try{let a=await yS(t,n,r,{idempotencyKey:e.idempotencyKey});if(await i.sendUsage("apps_deployments_trigger",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}a.status==="queued"?u.info(`${$} Trigger queued${o?.branch?` for \`${o.branch}\``:""}.`):a.status==="skipped"?u.info(`${Ce} Nothing to build \u2014 the branch has no commits yet. Push a commit and try again.`):u.info(`${Ce} Trigger in progress ${I("(processing \u2014 enqueue not confirmed)")}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await i.sendError(a instanceof Error?a:new Error(String(a)),"apps_deployments_trigger",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to trigger deployment:`}))}}q();C();A();M();X();async function cg(e,t){if(t.name===void 0&&t.description===void 0)throw new f("Provide --name or --description",{isUserError:!0});let n=await T(),r=await Pn(n,e,t);if(ve(r,"appId"),t.dryRun){u.info(`Dry run \u2014 would update app: ${r}`),t.name!==void 0&&u.info(` Name: ${t.name}`),t.description!==void 0&&u.info(` Description: ${t.description}`),u.info("Dry run complete \u2014 no changes made.");return}let o=F.forApps({authToken:n}),i=Date.now();try{let s=await cS(n,r,{name:t.name,description:t.description});if(await o.sendUsage("apps_update",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${$} App updated: ${s.id}`),s.name&&u.info(` Name: ${s.name}`),s.description!=null&&u.info(` Description: ${s.description}`)}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_update",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to update app:`}))}}q();C();be();Oe();A();M();X();async function ug(e,t){let n=await T(),r=await Pn(n,e,t);if(ve(r,"appId"),!t.dryRun&&!t.yes&&(V()||t.json))throw new f("Refusing to delete without confirmation. Pass --yes.",{isUserError:!0,missingFlag:"yes"});if(t.dryRun||!t.yes){let s=await Ru(n,r),a=mE(s);if(t.dryRun){u.info(`Dry run \u2014 would delete app ${r}`),u.info(` ${a}`),u.info("Dry run complete \u2014 no changes made.");return}if(!await $e({message:`${a} Continue?`})){u.info("Aborted.");return}}let o=F.forApps({authToken:n}),i=Date.now();try{let s=await uS(n,r);if(await o.sendUsage("apps_delete",{duration:Date.now()-i,dryRun:!1}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(s.message)}catch(s){throw s instanceof f&&s.isUserError?s:(await o.sendError(s instanceof Error?s:new Error(String(s)),"apps_delete",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to delete app:`}))}}q();C();A();M();X();De();C();lt();var ls=100;function dg(e,t){return`${P()}/cosmic/apps/${encodeURIComponent(e)}/environments/${encodeURIComponent(t)}/variables`}function pg(e,t){return xt(e,{scopeLabel:"Cloud app environment variables",fallbackPrefix:t,userErrorOn4xx:!0})}async function UP(e,t,n,r,o={}){let i=ss(dg(t,n),{limit:_u,cursor:r,filters:o}),s=await G(i,{headers:mt(e)});if(!s.ok)throw await pg(s,"Failed to list environment variables");return Lo(await s.json(),"variables")}async function fg(e,t,n,r={}){return za(o=>UP(e,t,n,o,r))}async function mg(e,t,n,r){let o=await G(`${dg(t,n)}/${encodeURIComponent(r)}`,{method:"DELETE",headers:mt(e)});if(!o.ok)throw await pg(o,"Failed to delete environment variable")}async function Xa(e,t,n,r,o){let i=Object.keys(r).length;if(i>ls)throw new f(`Cannot import more than ${ls} variables at once (received ${i}).`,{isUserError:!0});let s=await G(`${dg(t,n)}/bulk`,{method:"POST",headers:{...mt(e),"Content-Type":"application/json"},body:JSON.stringify({variables:r,overwriteExisting:o})});if(!s.ok)throw await pg(s,"Failed to import environment variables");return await s.json()}var vS=require("dotenv");pe();var SS=["key","isSecret","value","id","environmentId"],Ya=["key","isSecret"];function cs(){return SS}var gg=ut(SS);function WP(e,t){switch(t){case"value":return e.isSecret?I("(secret)"):e.value!==""?e.value:I("\u2014");case"isSecret":return e.isSecret?"yes":"no";default:return e[t]!==""?String(e[t]):I("\u2014")}}function hg(e,t=Ya){if(e.length===0)return I("No environment variables found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>WP(o,i)));return qe(n,r)}function yg(e){let t=e.split(/\r?\n/).map(n=>n.replace(/^\s*export\s+/,"")).join(`
|
|
197
|
-
`);return(0,vS.parse)(t)}async function wg(e){let t=await T(),n=F.forAppsEnvVars({authToken:t}),r=Date.now();try{let{appId:o,envId:i}=await Xe(t,e),s={key:e.key,q:e.q},a=is(s),l=await fg(t,o,i,s);if(await n.sendUsage("apps_env_vars_list",{duration:Date.now()-r,variableCount:l.length,filtered:a}),e.json){u.info(JSON.stringify(l,null,2));return}if(l.length===0){u.info(a?"No environment variables matched the given filters.":"No environment variables found.");return}let c=_e(e.fields,gg,cs());u.info(hg(l,c))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"apps_env_vars_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list environment variables:`}))}}q();C();A();M();X();C();be();Oe();A();M();async function xS(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e).toString("utf8").replace(/\r?\n$/,"")}function bg(e){u.warn(`${re} Passing a secret as a command-line argument exposes it in your shell history and process list. Pipe it via stdin (e.g. \`printf %s "$VALUE" | webflow apps env-vars set ${e} --secret\`) or omit the value to be prompted.`)}async function CS(e,t){if(e!==void 0)return t.secret&&!t.json&&bg(t.key),{value:e,source:"arg"};if(!process.stdin.isTTY){let n=await xS();if(n==="")throw new f(`No value for ${t.key} received on stdin.`,{isUserError:!0});return{value:n,source:"stdin"}}if(!V()){let n=t.secret?await Db({message:`Enter the value for ${t.key}:`}):await Ke({message:`Enter the value for ${t.key}:`});if(n===null||n==="")throw new f(`No value provided for ${t.key}.`,{isUserError:!0});return{value:n,source:"prompt"}}throw new f(`No value provided for ${t.key}. Pass it as an argument, pipe it via stdin, or run interactively (without --no-input).`,{isUserError:!0})}async function Dg(e,t,n){let r=n.secret?" (secret)":"",o=await T(),i=F.forAppsEnvVars({authToken:o}),s=Date.now(),{appId:a,envId:l}=await Xe(o,n);if(n.dryRun){t!==void 0&&n.secret&&!n.json&&bg(e),n.json?u.info(JSON.stringify({key:e,...n.secret?{isSecret:!0}:{},appId:a,environmentId:l,dryRun:!0},null,2)):(u.info(`Would set ${e}${r} on app ${a}, environment ${l}.`),u.info("Dry run \u2014 no changes made."));return}try{let{value:c,source:p}=await CS(t,{key:e,secret:n.secret,json:n.json}),d={[e]:{value:c,...n.secret?{isSecret:!0}:{}}},m=await Xa(o,a,l,d,!0),h=[...m.created,...m.updated,...m.skipped].find(y=>y.key===e);if(!h){let y=m.errors.find(b=>b.key===e);throw new f(y?`Failed to set ${e}: ${y.error}`:`Set did not apply to ${e}.`,{isUserError:!!y})}let g=h.isSecret;if(await i.sendUsage("apps_env_vars_set",{duration:Date.now()-s,mode:n.secret?"secret":"plain",valueSource:p}),n.json){u.info(JSON.stringify({key:e,isSecret:g,status:"set"},null,2));return}u.info(`${$} Set ${e}${g?" (secret)":""}`)}catch(c){throw c instanceof f&&c.isUserError?c:(await i.sendError(c instanceof Error?c:new Error(String(c)),"apps_env_vars_set",{duration:Date.now()-s}),new f(c,{prefix:`${k} Failed to set environment variable:`}))}}q();C();A();M();X();async function kg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await Xe(n,t);if(t.dryRun){t.json?u.info(JSON.stringify({key:e,appId:i,environmentId:s,dryRun:!0},null,2)):(u.info(`Would delete ${e} from app ${i}, environment ${s}.`),u.info("Dry run \u2014 no changes made."));return}try{if(await mg(n,i,s,e),await r.sendUsage("apps_env_vars_delete",{duration:Date.now()-o}),t.json){u.info(JSON.stringify({key:e,status:"deleted"},null,2));return}u.info(`${$} Deleted ${e}`)}catch(a){throw a instanceof f&&a.isUserError?a:(await r.sendError(a instanceof Error?a:new Error(String(a)),"apps_env_vars_delete",{duration:Date.now()-o}),new f(a,{prefix:`${k} Failed to delete environment variable:`}))}}var FS=require("fs"),_S=require("path");q();C();A();M();X();function Eg(e){return e.map(({id:t,environmentId:n,key:r,isSecret:o})=>({id:t,environmentId:n,key:r,isSecret:o}))}async function vg(e,t){let n=await T(),r=F.forAppsEnvVars({authToken:n}),o=Date.now(),{appId:i,envId:s}=await Xe(n,t),a;try{a=(0,FS.readFileSync)((0,_S.resolve)(e),"utf8")}catch{throw new f(`Could not read file: ${e}`,{isUserError:!0})}let l=yg(a),c=Object.keys(l);if(c.length===0)throw new f(`No variables found in ${e}.`,{isUserError:!0});if(c.length>ls)throw new f(`Cannot import more than ${ls} variables at once (${e} has ${c.length}).`,{isUserError:!0});let p={};for(let d of c)p[d]={value:l[d],...t.secret?{isSecret:!0}:{}};if(t.dryRun){if(t.json)u.info(JSON.stringify({appId:i,environmentId:s,secret:!!t.secret,variables:c,dryRun:!0},null,2));else{u.info(`Would import ${c.length} variable(s)${t.secret?" as secrets":""} into app ${i}, environment ${s}:`);for(let d of c)u.info(` ${d}=********`);u.info("Dry run \u2014 no changes made.")}return}try{let d=await Xa(n,i,s,p,!0);if(await r.sendUsage("apps_env_vars_import",{duration:Date.now()-o,variableCount:c.length,createdCount:d.created.length,updatedCount:d.updated.length,skippedCount:d.skipped.length,errorCount:d.errors.length,mode:t.secret?"secret":"plain"}),t.json)u.info(JSON.stringify({created:Eg(d.created),updated:Eg(d.updated),skipped:Eg(d.skipped),errors:d.errors},null,2));else{u.info(`${$} Imported: ${d.created.length} created, ${d.updated.length} updated, ${d.skipped.length} skipped, ${d.errors.length} failed`);for(let m of d.errors)u.warn(` ${m.key}: ${m.error}`)}if(d.errors.length>0)throw new f(`Import completed with ${d.errors.length} error(s).`,{isUserError:!0,skipLogging:!0})}catch(d){throw d instanceof f&&d.isUserError?d:(await r.sendError(d instanceof Error?d:new Error(String(d)),"apps_env_vars_import",{duration:Date.now()-o}),new f(d,{prefix:`${k} Failed to import environment variables:`}))}}Vn();var RS=e=>{let t=e.command("apps").description("Manage Webflow Cloud apps");Cu(t,{namespace:"apps"}),Fu(t,{namespace:"apps"}),t.command("list").description(`List all apps in your Webflow workspace. Optional filters: --site (exact site id), --name (exact, case-sensitive), and --q (case-insensitive substring on name). App names are unique only within a site, so pass --site AND --name together to resolve to at most one app; --site alone can match many apps and --name alone can match apps across sites. ${Zc("app","an exact filter")}`).option("-s, --site <site-id>","Filter apps to an exact Webflow site id. Combine with --name to resolve to at most one app. Does not default from webflow.json.",Ii).option("--name <name>","Filter apps by exact name (case-sensitive). Combine with --site to resolve to at most one app.",Ii).addOption(Qc("the app name")).addOption(ne()).addOption(He([...xr()]).default(Vc)).action(Zm),t.command("get").description("Get details for a specific app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(ne()).addOption(He([...xr()]).default(am)).action(Qm),t.command("domains").description("List domains and live URLs for an app").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(He([...ga()]).default(Gc)).addOption(ne()).option("--limit <n>","Max number of domains to return (server caps at 100)",ru).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(eg),Je()&&(t.command("update").description("Update an app's name or description. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--name <name>","New app name").option("--description <description>","New app description").addOption(ne()).addOption(Ae()).action(cg),t.command("delete").description("Delete (or archive) an app. Use --dry-run to preview.").argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").addOption(Ti()).addOption(ne()).addOption(Ae()).action(ug)),t.command("environments").description("Manage the environments of a Webflow Cloud app").command("list").description(`List the environments of an app. Optional filters: --branch (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on branch, for discovery). ${Zc("environment","--branch")}`).argument("[appId]","App ID (defaults to webflow.json or WEBFLOW_APP_ID)").option("--branch <branch>","Filter environments by exact branch name (case-sensitive) \u2014 resolves to at most one environment.",Ii).addOption(Qc("the environment branch")).addOption(He([...ha()]).default(Kc)).addOption(ne()).action(tg);let r=t.command("deployments").description("Inspect Webflow Cloud deployments");r.command("list").description("List the most recent deployments of an environment (newest first). Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").addOption(wE()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").addOption(ne()).addOption(He([...Cr()]).default(ya)).action(ig),r.command("get").description("Get details for a specific deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Pass --wait to poll until the deployment reaches a terminal status (exit 0 on success, 1 otherwise); --interval is floored at 5s and --timeout capped at 30min.").argument("<depId>","Deployment ID").addOption(new AS.Option("--wait","Poll until the deployment reaches a terminal status (success/failed/canceled/unstaged) or the timeout elapses, then exit 0 on success or 1 otherwise")).addOption(DE()).addOption(kE()).addOption(ne()).addOption(He([...Cr()]).default(ya)).action(sg),r.command("redeploy").description("Re-run a deployment at its SAME commit (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. To roll back, redeploy an earlier successful deployment's ID. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker. Use --dry-run to preview.").argument("<depId>","Deployment ID to re-run").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(ne()).addOption(Ae()).action(ag),r.command("trigger").description("Build a GitHub-connected environment's current HEAD on demand (enqueues a fresh build). Requires a GitHub-connected app \u2014 apps deployed from local files via `apps deploy` are not eligible. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker; builds whatever branch that environment is configured for. Warns (without blocking) if that branch differs from your current local branch. Use --dry-run to preview.").option("--idempotency-key <key>","Optional Idempotency-Key header to dedupe a retried enqueue").addOption(ne()).addOption(Ae()).action(lg);let o=t.command("logs").description("Read Webflow Cloud app logs");o.command("build").description("Read the build logs of a deployment. Resolves the app + environment from WEBFLOW_APP_ID / WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or an interactive picker.").argument("[depId]","Deployment ID (required) \u2014 run 'webflow apps deployments list' to find one").addOption(ne()).addOption(He([...Mr()]).default(qa)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(mm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(rg),o.command("runtime").description("Read the runtime logs of an environment. Resolves the app from WEBFLOW_APP_ID / webflow.json (or a picker); the environment from the [envId] argument, WEBFLOW_APP_ENVIRONMENT_ID, webflow.json, or a picker.").argument("[envId]","Environment ID (defaults to the only env; required if the app has several)").addOption(ne()).addOption(He([...Mr()]).default(qa)).option("--since <iso>","Only logs at or after this ISO datetime").option("--q <text>","Substring filter on the log message").addOption(mm()).option("--cursor <cursor>","Pagination cursor from a previous nextCursor").action(og);let i=t.command("env-vars").description("Manage Webflow Cloud app environment variables");i.command("list").description(`List environment variables for a Cloud app environment. Optional filters: --key (exact, case-sensitive; resolves to at most one) and --q (case-insensitive substring on key, for discovery \u2014 --q never searches values). ${Zc("variable","--key")} Secret values are never returned.`).addOption(ba()).addOption(Da()).option("--key <key>","Filter variables by exact key (case-sensitive) \u2014 resolves to at most one variable. Its value is never returned.",Ii).addOption(Qc("the variable key")).addOption(ne()).addOption(He([...cs()]).default(Ya.join(","))).action(wg),i.command("set").description("Create or update an environment variable. Use --secret to encrypt the value. Use --dry-run to preview.").argument("<key>","Variable name").argument("[value]","Variable value. Omit to read from piped stdin or be prompted (recommended for secrets, keeps them out of shell history).").addOption(ba()).addOption(Da()).addOption(fm()).addOption(Ae()).addOption(ne()).action(Dg),i.command("delete").description("Delete an environment variable. Use --dry-run to preview before executing.").argument("<key>","Variable name").addOption(ba()).addOption(Da()).addOption(Ae()).addOption(ne()).action(kg),i.command("import").description("Bulk import environment variables from a .env file. Use --secret to mark every key secret. Use --dry-run to preview.").argument("<file>","Path to a .env (KEY=value) file").addOption(ba()).addOption(Da()).addOption(fm()).addOption(Ae()).addOption(ne()).action(vg)};De();C();lt();C();function Z(e,t){if(!/^[a-f0-9]{24}$/.test(e))throw new f(`Invalid ${t}: "${e}" is not a valid resource ID.`,{isUserError:!0})}async function $n(e){try{let t=await e.json();return t.message??t.error??`${e.status} ${e.statusText}`}catch{return`${e.status} ${e.statusText}`}}async function IS(e,t){Z(t,"siteId");let n=await G(`${P()}/v2/sites/${t}/collections`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok){let o=await $n(n);throw n.status>=400&&n.status<500?new f(o,{isUserError:!0}):new f(`Failed to list collections: ${o}`)}return(await n.json()).collections??[]}async function TS(e,t){Z(t,"collectionId");let n=await G(`${P()}/v2/collections/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(n.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!n.ok)throw new f(`Failed to get collection: ${await $n(n)}`);let r=await n.json();return{...r,fields:r.fields??[]}}async function PS(e,t,n){Z(t,"siteId");let r={displayName:n.displayName,singularName:n.singularName};n.slug&&(r.slug=n.slug);let o=await G(`${P()}/v2/sites/${t}/collections`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!o.ok){let i=await $n(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create collection: ${i}`)}return await o.json()}async function $S(e,t,n){Z(t,"collectionId");let r=await G(`${P()}/v2/collections/${t}/fields`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({displayName:n.displayName,type:n.type,isRequired:n.isRequired??!1})});if(!r.ok){let o=await $n(r);throw r.status===404?new f(`Collection "${t}" not found`,{isUserError:!0}):r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to create field: ${o}`)}return await r.json()}async function Sg(e,t,n={}){Z(t,"collectionId");let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset)),n.cmsLocaleId&&r.set("cmsLocaleId",n.cmsLocaleId);let o=r.toString()?`?${r.toString()}`:"",i=await G(`${P()}/v2/collections/${t}/items${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Collection "${t}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to list items: ${await $n(i)}`);let s=await i.json();return{items:s.items??[],total:s.total??0,count:s.count??s.items?.length??0,limit:s.limit??n.limit??100,offset:s.offset??n.offset??0}}async function OS(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=r?`?cmsLocaleId=${encodeURIComponent(r)}`:"",i=await G(`${P()}/v2/collections/${t}/items/${n}${o}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(i.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!i.ok)throw new f(`Failed to get item: ${await $n(i)}`);return await i.json()}async function xg(e,t,n,r=!1){Z(t,"collectionId");let o=await G(`${P()}/v2/collections/${t}/items`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:n,isDraft:r})});if(!o.ok){let i=await $n(o);throw o.status>=400&&o.status<500?new f(i,{isUserError:!0}):new f(`Failed to create item: ${i}`)}return await o.json()}async function Cg(e,t,n,r){Z(t,"collectionId"),Z(n,"itemId");let o=await G(`${P()}/v2/collections/${t}/items/${n}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({fieldData:r})});if(o.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!o.ok)throw new f(`Failed to update item: ${await $n(o)}`);return await o.json()}async function LS(e,t,n){Z(t,"collectionId"),Z(n,"itemId");let r=await G(`${P()}/v2/collections/${t}/items/${n}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(r.status===404)throw new f(`Item "${n}" not found`,{isUserError:!0});if(!r.ok)throw new f(`Failed to delete item: ${await $n(r)}`)}async function NS(e,t,n){Z(t,"collectionId"),n.forEach(o=>Z(o,"itemId"));let r=await G(`${P()}/v2/collections/${t}/items/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({itemIds:n})});if(!r.ok){let o=await $n(r);throw r.status>=400&&r.status<500?new f(o,{isUserError:!0}):new f(`Failed to publish items: ${o}`)}return await r.json()}pe();q();Me();async function Ou(e){if(e.site)return{token:await T(),siteId:e.site};let{manifest:t}=ee(),n=await ze(t);return{token:n.accessToken,siteId:n.siteId}}function jS(e,t=["id","displayName","slug"]){if(e.length===0)return I("No collections found.");let n=["id","displayName","singularName","slug","lastUpdated"],r=Object.fromEntries(n.map(a=>[a.toLowerCase(),a])),o=t.map(a=>r[a.toLowerCase()]).filter(a=>a!=null);if(o.length===0)return Bt(`Invalid fields. Available: ${n.join(", ")}`);let i=o.map(a=>se(a)),s=e.map(a=>o.map(l=>{let c=a[l];return c?l==="lastUpdated"?new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):c:I("\u2014")}));return qe(i,s)}function MS(e){let t=[`${se("Collection:")} ${e.displayName}`,`${se("ID:")} ${e.id}`,`${se("Slug:")} ${e.slug}`,`${se("Singular:")} ${e.singularName}`,`${se("Updated:")} ${new Date(e.lastUpdated).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`,"",se("Fields:")];if(e.fields.length===0)return t.push(I(" No fields defined.")),t.join(`
|
|
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
198
|
`);let n=["NAME","SLUG","TYPE","REQUIRED"].map(o=>se(o)),r=e.fields.map(o=>[o.displayName,o.slug,o.type,o.isRequired?"yes":"no"]);return t.push(qe(n,r)),t.join(`
|
|
199
|
-
`)}function
|
|
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
|
|
201
|
-
Showing ${l}\u2013${c}${
|
|
202
|
-
`):"",s=r.map(l=>se(l)),a=e.map(l=>r.map(c=>{let
|
|
203
|
-
Supported types: png, jpg, jpeg, gif, svg, webp, avif (\u22644 MB); pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, odt, ods, odp, json, lottie (\u226410 MB)`).argument("<file>","Path to the file to upload (see supported types above)").addOption(
|
|
204
|
-
Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new f(`Failed to create site "${r}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new f("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??r,shortName:i.shortName??""}}function
|
|
205
|
-
Create the site in the Webflow dashboard: ${
|
|
206
|
-
then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await $e({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let r=await
|
|
199
|
+
`)}function ZS(e,t=["id","isDraft","lastUpdated"]){if(e.length===0)return I("No items found.");let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{if(i==="fieldData")return JSON.stringify(o.fieldData);if(i==="isDraft")return o.isDraft?le("draft"):J("live");if(i==="isArchived")return o.isArchived?I("archived"):"";if(i==="lastUpdated"||i==="lastPublished"||i==="createdOn"){let a=o[i];return a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):I("\u2014")}let s=o[i];return s==null?I("\u2014"):String(s)}));return qe(n,r)}C();A();M();function Wu(e,t,n="asc"){return[...e].sort((r,o)=>{let i=r[t],s=o[t];if(i==null&&s==null)return 0;if(i==null)return 1;if(s==null)return-1;let a=0;return typeof i=="string"&&typeof s=="string"?a=i.localeCompare(s):typeof i=="number"&&typeof s=="number"?a=i-s:a=String(i).localeCompare(String(s)),n==="desc"?-a:a})}X();async function jg(e){let{token:t,siteId:n}=await Uu(e),r=F.forCms({authToken:t,siteId:n}),o=Date.now();try{let i=await HS(t,n);if(await r.sendUsage("cms_collections_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No collections found.");return}let s=["displayName","slug","lastUpdated"];if(s.includes(e.sortBy)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${s.join(", ")}. Defaulting to displayName.`),e.sortBy="displayName"),!["asc","desc"].includes(e.order))throw new f(`Invalid --order "${e.order}". Valid values: asc, desc`,{isUserError:!0});let a=Wu(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(XS(a,l))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list collections:`})}}q();C();A();M();X();async function Mg(e,t){let n=await T(),r=F.forCms({authToken:n}),o=Date.now();try{let i=await VS(n,e);if(await r.sendUsage("cms_collections_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(YS(i))}catch(i){if(i instanceof f&&i.isUserError){u.info(`${k} ${i.message}`),process.exitCode=1;return}throw await r.sendError(i instanceof Error?i:new Error(String(i)),"cms_collections_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get collection:`})}}C();A();M();X();async function Bg(e){let t=e.singularName??e.name,n=e.slug??e.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(e.dryRun){u.info("Dry run \u2014 would create collection:"),u.info(JSON.stringify({displayName:e.name,singularName:t,slug:n},null,2)),u.info("Dry run complete \u2014 no changes made.");return}let{token:r,siteId:o}=await Uu(e),i=F.forCms({authToken:r,siteId:o}),s=Date.now();try{let a=await GS(r,o,{displayName:e.name,singularName:t,slug:n});if(await i.sendUsage("cms_collections_create",{duration:Date.now()-s}),e.json){u.info(JSON.stringify(a,null,2));return}u.info(`${P} Collection created: ${a.id}`),u.info(` Name: ${a.displayName}`),u.info(` Slug: ${a.slug}`),u.info(`
|
|
200
|
+
Next: add fields with "webflow cms fields create --collection ${a.id} --name <name> --type <type>"`)}catch(a){if(a instanceof f&&a.isUserError){u.info(`${k} ${a.message}`),process.exitCode=1;return}throw await i.sendError(a instanceof Error?a:new Error(String(a)),"cms_collections_create",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to create collection:`})}}q();C();A();M();X();async function 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
|
+
`):"",s=r.map(l=>se(l)),a=e.map(l=>r.map(c=>{let d=l[c];if(d==null||c==="size"&&d===0)return I("\u2014");if(c==="size")return n$(Number(d));if(c==="lastUpdated"){let m=new Date(String(d)),h=String(m.getMonth()+1).padStart(2,"0"),g=String(m.getDate()).padStart(2,"0"),y=String(m.getFullYear()).slice(-2),b=String(m.getHours()).padStart(2,"0"),S=String(m.getMinutes()).padStart(2,"0");return`${h}/${g}/${y} ${b}:${S}`}let p=String(d);return c==="displayName"&&p.length>40?I("\u2026")+p.slice(-39):p}));return i+qe(s,a)}function n$(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function nx(e){if(e.length===0)return I("No folders found.");let t=[...e].sort((o,i)=>o.displayName.localeCompare(i.displayName)),n=["id","displayName","assets","lastUpdated"].map(o=>se(o)),r=t.map(o=>[o.id,o.displayName,String(o.assets.length),new Date(o.lastUpdated).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]);return qe(n,r)}async function rx(e,t,n={}){if(Z(t,"siteId"),n.folderId){Z(n.folderId,"folderId");let a=await r$(e,n.folderId),l=new Set(a.assets);if(l.size===0)return{assets:[],pagination:{total:0,limit:0,offset:0}};let c=[],d=0,p=100;for(;;){let b=await G(`${$()}/v2/sites/${t}/assets?limit=${p}&offset=${d}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!b.ok)throw new f(`Failed to list assets: ${b.status} ${b.statusText}`);let S=await b.json(),_=S.assets??[];c.push(..._);let v=S.pagination?.total??0;if(d+=_.length,d>=v||_.length===0)break}let m=c.filter(b=>l.has(b.id)),h=n.offset??0,g=n.limit??m.length,y=m.slice(h,h+g);return{assets:y,pagination:{total:m.length,limit:y.length,offset:h}}}let r=new URLSearchParams;n.limit!=null&&r.set("limit",String(n.limit)),n.offset!=null&&r.set("offset",String(n.offset));let o=r.toString(),i=await G(`${$()}/v2/sites/${t}/assets${o?`?${o}`:""}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!i.ok)throw new f(`Failed to list assets: ${i.status} ${i.statusText}`);let s=await i.json();return{assets:s.assets??[],pagination:s.pagination??{total:0,limit:100,offset:0}}}async function ox(e,t,n,r,o){Z(t,"siteId"),o&&Z(o,"folderId");let i=Sa(n);Hu(i.meta.title,i.meta.size);let s=r??i.meta.title,a={fileName:i.meta.title,fileHash:i.meta.fileHash,displayName:s};o&&(a.parentFolder=o);let l=await G(`${$()}/v2/sites/${t}/assets`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(a)});if(!l.ok)throw new f(`Failed to initiate asset upload: ${l.status} ${l.statusText}`);let c=await l.json(),d={fields:c.uploadDetails,_id:c.id,s3Url:c.hostedUrl??"",url:c.uploadUrl??"",contentType:c.contentType??"",origFileName:c.originalFileName??i.meta.title,success_action_redirect:"",createdOn:"",updatedOn:""};try{await Ca(i,d)}catch(p){throw await G(`${$()}/v2/assets/${d._id}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}}).catch(()=>{}),p}return{id:d._id,hostedUrl:d.s3Url,displayName:s,originalFileName:i.meta.title}}async function ix(e,t,n){Z(t,"assetId");let r=await G(`${$()}/v2/assets/${t}`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new f(`Failed to update asset: ${r.status} ${r.statusText}`);return await r.json()}async function r$(e,t){Z(t,"folderId");let n=await G(`${$()}/v2/asset_folders/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get folder: ${n.status} ${n.statusText}`);return await n.json()}async function sx(e,t){Z(t,"siteId");let n=await G(`${$()}/v2/sites/${t}/asset_folders`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to list folders: ${n.status} ${n.statusText}`);return(await n.json()).assetFolders??[]}async function ax(e,t,n,r){Z(t,"siteId"),r&&Z(r,"parentFolderId");let o={displayName:n};r&&(o.parentFolder=r);let i=await G(`${$()}/v2/sites/${t}/asset_folders`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new f(`Failed to create folder: ${i.status} ${i.statusText}`);return await i.json()}async function qg(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ne(),s=await ze(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let{assets:i,pagination:s}=await rx(t,n,{limit:e.limit,offset:e.offset,folderId:e.folder});if(await r.sendUsage("assets_list",{duration:Date.now()-o,count:i.length}),i.length===0){u.info("No assets found.");return}let a=["displayName","originalFileName","contentType","size","lastUpdated"],l=e.sortBy;a.includes(l)||(u.warn(`Unknown --sort-by "${e.sortBy}". Valid fields: ${a.join(", ")}. Defaulting to displayName.`),l="displayName");let c=e.order;["asc","desc"].includes(e.order)||(u.warn(`Unknown --order "${e.order}". Valid values: asc, desc. Defaulting to asc.`),c="asc");let d=Wu(i,l,c);if(e.json){u.info(JSON.stringify({assets:d,pagination:s},null,2));return}let p=e.fields.split(",").map(h=>h.trim());u.info(tx(d,p));let m=(e.offset??0)+i.length;m<s.total&&u.info(I(`Showing ${m} of ${s.total} assets. Use --offset ${m} to see more.`))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list assets:`})}}q();C();A();M();Me();X();async function Xg(e,t){let n=Sa(e);if(Hu(n.meta.title,n.meta.size),t.dryRun){u.info(`Dry run \u2014 would upload: ${e} (validated)`),t.name&&u.info(` Display name: ${t.name}`),t.folder&&u.info(` Folder: ${t.folder}`),u.info("Dry run complete \u2014 no changes made.");return}let r,o;if(t.site)r=await T(),o=t.site;else{let{manifest:a}=ne(),l=await ze(a);r=l.accessToken,o=l.siteId}let i=F.forAssets({authToken:r,siteId:o}),s=Date.now();try{let a=await ox(r,o,e,t.name,t.folder);if(await i.sendUsage("assets_upload",{duration:Date.now()-s,dryRun:!1}),t.json){u.info(JSON.stringify(a,null,2));return}u.info(`${P} Asset uploaded: ${a.id}`),a.hostedUrl&&u.info(` URL: ${a.hostedUrl}`)}catch(a){throw await i.sendError(a instanceof Error?a:new Error(String(a)),"assets_upload",{duration:Date.now()-s}),new f(a,{prefix:`${k} Failed to upload asset:`})}}q();C();A();M();X();async function Yg(e,t){if(!t.altText&&!t.displayName)throw new f("Provide at least one of --alt-text or --display-name.",{isUserError:!0});if(t.dryRun){u.info(`Dry run \u2014 would update asset: ${e}`),t.altText&&u.info(` Alt text: ${t.altText}`),t.displayName&&u.info(` Display name: ${t.displayName}`),u.info("Dry run complete \u2014 no changes made.");return}let n=await T(),r=F.forAssets({authToken:n}),o=Date.now();try{let i=await ix(n,e,{altText:t.altText,displayName:t.displayName});if(await r.sendUsage("assets_update",{duration:Date.now()-o,dryRun:!1}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${P} Asset updated: ${i.id}`),i.displayName&&u.info(` Display name: ${i.displayName}`),i.altText&&u.info(` Alt text: ${i.altText}`)}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_update",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to update asset:`})}}q();C();A();M();Me();X();async function Zg(e){let t,n;if(e.site)t=await T(),n=e.site;else{let{manifest:i}=ne(),s=await ze(i);t=s.accessToken,n=s.siteId}let r=F.forAssets({authToken:t,siteId:n}),o=Date.now();try{let i=await sx(t,n);if(await r.sendUsage("assets_folders_list",{duration:Date.now()-o,count:i.length}),e.json){u.info(JSON.stringify(i,null,2));return}u.info(nx(i))}catch(i){throw await r.sendError(i instanceof Error?i:new Error(String(i)),"assets_folders_list",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to list folders:`})}}q();C();A();M();qs();X();async function Qg(e,t){let n,r;if(t.site)n=await T(),r=t.site;else{let{manifest:s}=ne(),a=await ze(s);n=a.accessToken,r=a.siteId}let o=F.forAssets({authToken:n,siteId:r}),i=Date.now();try{let s=await ax(n,r,e,t.parent);if(await o.sendUsage("assets_folders_create",{duration:Date.now()-i}),t.json){u.info(JSON.stringify(s,null,2));return}u.info(`${P} Folder created: ${s.id}`),u.info(` Name: ${s.displayName}`),s.parentFolder&&u.info(` Parent: ${s.parentFolder}`)}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"assets_folders_create",{duration:Date.now()-i}),new f(s,{prefix:`${k} Failed to create folder:`})}}var lx=e=>{let t=e.command("assets").description("Manage Webflow site assets");t.command("list").description("List all assets for a site").addOption(It()).option("--folder <folderId>","Filter by folder ID").addOption(ee()).addOption(He(["id","displayName","originalFileName","contentType","size","lastUpdated"]).default("id,displayName,lastUpdated,size")).addOption(kc()).addOption(Ec()).addOption(Ii(["displayName","originalFileName","contentType","size","lastUpdated"]).default("displayName")).addOption(Ri()).action(qg),t.command("upload").description(`Upload a file as an asset. Use --dry-run to preview before uploading.
|
|
203
|
+
Supported types: png, jpg, jpeg, gif, svg, webp, avif (\u22644 MB); pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, odt, ods, odp, json, lottie (\u226410 MB)`).argument("<file>","Path to the file to upload (see supported types above)").addOption(It()).option("--name <displayName>","Display name for the asset (defaults to filename)").option("--folder <folderId>","Upload into a folder").addOption(Ae()).addOption(ee()).action(Xg),t.command("update").description("Update an asset's metadata. Use --dry-run to preview.").argument("<assetId>","Asset ID to update").option("--alt-text <text>","Alt text for the asset").option("--display-name <name>","New display name for the asset").addOption(Ae()).addOption(ee()).action(Yg);let n=t.command("folders").description("Manage asset folders");n.command("list").description("List all asset folders for a site").addOption(It()).addOption(ee()).action(Zg),n.command("create").description("Create a new asset folder").argument("<name>","Display name for the folder").addOption(It()).option("--parent <folderId>","Parent folder ID (creates a nested folder)").addOption(ee()).action(Qg)};q();C();A();M();X();De();C();lt();async function cx(e,t){Z(t,"siteId");let n=await G(`${$()}/v2/sites/${t}`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get site: ${n.status} ${n.statusText}`);return await n.json()}async function ux(e){return el(`${$()}/v2/sites`,e,"sites","Failed to list sites")}async function dx(e,t){Z(t,"siteId");let n=await G(`${$()}/v2/sites/${t}/custom_domains`,{headers:{Authorization:`Bearer ${e}`,Accept:"application/json"}});if(!n.ok)throw new f(`Failed to get custom domains: ${n.status} ${n.statusText}`);return(await n.json()).customDomains??[]}async function px(e,t,n=[],r){Z(t,"siteId"),r&&Z(r,"pageId");let o=n.length>0?{customDomains:n}:{publishToWebflowSubdomain:!0};r&&(o.pageId=r);let i=await G(`${$()}/v2/sites/${t}/publish`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new f(`Failed to publish site: ${i.status} ${i.statusText}`);return await i.json()}C();pe();var eh=["id","displayName","shortName","lastPublished","lastUpdated","timeZone"],fx=dt(eh);function mx(){return eh}function gx(e,t=["id","displayName","lastPublished"]){if(e.length===0)return I("No sites found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${eh.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{let s=o[i];return s?i==="lastPublished"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:I("\u2014")}));return qe(n,r)}function hx(e){if(e.length===0)return I("No custom domains configured.");let t=[se("id"),se("url"),se("lastPublished")],n=e.map(r=>[r.id,r.url,r.lastPublished?new Date(r.lastPublished).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):I("\u2014")]);return qe(t,n)}async function th(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await ux(t);if(await n.sendUsage("sites_list",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No sites found.");return}let i=_e(e.fields,fx,mx());u.info(gx(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list sites:`}))}}q();C();A();M();X();async function nh(e,t){let n=await T(),r=F.forSites({authToken:n}),o=Date.now();try{let i=await cx(n,e);if(await r.sendUsage("sites_get",{duration:Date.now()-o}),t.json){u.info(JSON.stringify(i,null,2));return}u.info(`${i.displayName} (${i.id})`),u.info(` Short name: ${i.shortName}`),u.info(` Time zone: ${i.timeZone}`),i.lastPublished&&u.info(` Published: ${new Date(i.lastPublished).toLocaleString()}`),i.previewUrl&&u.info(` Preview: ${i.previewUrl}`)}catch(i){throw i instanceof f&&i.isUserError?i:(await r.sendError(i instanceof Error?i:new Error(String(i)),"sites_get",{duration:Date.now()-o}),new f(i,{prefix:`${k} Failed to get site:`}))}}q();C();A();M();X();async function rh(e){let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=await dx(t,e.site);if(await n.sendUsage("sites_domains",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}u.info(hx(o))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_domains",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to get custom domains:`}))}}q();C();A();M();X();async function oh(e){if(Z(e.site,"siteId"),e.dryRun){u.info(`Would publish ${e.page?`page ${e.page} on`:"site"} ${e.site}`),e.domains?u.info(` Custom domains: ${e.domains}`):u.info(" Domains: Webflow subdomain");return}let t=await T(),n=F.forSites({authToken:t}),r=Date.now();try{let o=e.domains?e.domains.split(",").map(l=>l.trim()):[],i=await px(t,e.site,o,e.page);if(await n.sendUsage("sites_publish",{duration:Date.now()-r,dryRun:!1,publishScope:i.publishScope}),e.json){u.info(JSON.stringify(i,null,2));return}let s=i.publishScope==="page"?"Page":"Site";u.info(`${P} ${s} published successfully`);let a=i.customDomains??[];a.length>0?a.forEach(l=>{let c=l.lastPublished?` (${new Date(l.lastPublished).toLocaleString()})`:"";u.info(` Live at: https://${l.url}${c}`)}):i.publishToWebflowSubdomain&&u.info(" Published to Webflow subdomain")}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"sites_publish",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to publish site:`}))}}q();q();De();C();be();Oe();A();M();Me();X();De();lt();C();var Vu="not_enterprise_plan_workspace";async function yx(e,t,n){Z(t,"workspaceId");let r=n.trim();if(!r)throw new f("Site name cannot be empty.",{isUserError:!0});let o=await G(`${$()}/v2/workspaces/${t}/sites`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({name:r})});if(!o.ok){let s=await o.text().catch(()=>""),a;try{a=JSON.parse(s).code}catch{}throw a===Vu?new f("Creating sites via the API requires an Enterprise workspace.",{isUserError:!0,code:Vu}):a==="missing_scopes"?new f(`Your token is missing the 'workspace:write' scope.
|
|
204
|
+
Re-run 'webflow auth login' to grant the necessary permissions.`,{isUserError:!0}):new f(`Failed to create site "${r}" (HTTP ${o.status}). ${s}`.trim(),{isUserError:o.status===400||o.status===403})}let i=await o.json();if(!i?.id)throw new f("Site creation returned an invalid response.");return{id:i.id,displayName:i.displayName??r,shortName:i.shortName??""}}function o$(e){xe({siteId:e.id});let{manifestPath:t}=ne();u.info(`${P} Set siteId to ${e.id} (${e.displayName}) in ${t}.`)}async function i$(e,t){let n=new Map;for(let i of t)i.workspaceId&&n.set(i.workspaceId,(n.get(i.workspaceId)??0)+1);let r=[...n.keys()];if(r.length===1)return r[0];if(r.length===0){let i=await cs(e);if(i.length===0)throw new f("Could not determine a workspace for this token.",{isUserError:!0});if(i.length===1)return i[0].id;if(V())throw new f(`This token can access ${i.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});return(await us(i)).id}if(V())throw new f(`This token's sites span ${r.length} workspaces, and creating a site needs an explicit one when prompts are unavailable. Create the site in the Webflow dashboard and bind to it with \`webflow sites init --site-id <siteId>\`.`,{isUserError:!0,missingFlag:"site-id"});let o=await Be({message:"Which workspace should the new site be created in?",choices:r.map(i=>({name:`${i} (${n.get(i)} site${n.get(i)===1?"":"s"})`,value:i}))});if(!o)throw new f("No workspace selected.",{isUserError:!0});return o}async function s$(e,t){if(u.warn(`${k} ${t.message}
|
|
205
|
+
Create the site in the Webflow dashboard: ${xn()}/dashboard
|
|
206
|
+
then bind this project to it with \`webflow sites init --site-id <id>\`.`),!await $e({message:"Bind this project to an existing Webflow site instead?",default:!1}))throw t;let r=await kr(e);if(r.length===0)throw new f("No existing sites are accessible with this token yet. Create one in the Webflow dashboard, then re-run `webflow sites init`.",{isUserError:!0});return{site:await Ci(r),created:!1}}async function a$(e,t,n){let r=await i$(e,t),o=n.name;if(o||(o=await Ke({message:"Name for the new site:",validate:s=>s.trim().length>0||"Site name cannot be empty."})??void 0),!o||!o.trim())throw new f("A site name is required. Pass --name <name> to skip the prompt.",{isUserError:!0});let i;try{i=await yx(e,r,o)}catch(s){if(s instanceof f&&s.code===Vu)return s$(e,s);throw s}return u.info(`${P} Created site ${i.displayName} (${i.id}).`),{site:i,created:!0}}async function Gu(e={}){let t=await T({apiToken:e.apiToken}),n=F.forSites({authToken:t}),r=Date.now(),o=!1;try{if(e.siteId&&(e.create||e.name))throw new f("--site-id and --create/--name are mutually exclusive. Bind to an existing site OR create a new one.",{isUserError:!0});let i=await kr(t),s;if(e.siteId){Z(e.siteId,"siteId");let a=i.find(l=>l.id===e.siteId);if(!a)throw new f(`Site "${e.siteId}" is not among the ${i.length} site(s) this token can access.`,{isUserError:!0});s=a}else{let a=!!(e.create||e.name);if(!a&&V())throw new f("`webflow sites init` needs an explicit target when prompts are unavailable. Pass --site-id <siteId> to bind, or --create --name <name> to create a new site.",{isUserError:!0,missingFlag:"site-id"});if(a||(i.length===0?(u.info("No sites are accessible with this token."),a=!0):a=await Be({message:"How do you want to connect this project?",choices:[{name:"Bind to an existing Webflow site",value:"bind"},{name:"Create a new Webflow site",value:"create"}],default:"bind"})==="create"),a){let l=await a$(t,i,e);s=l.site,o=l.created}else s=await Ci(i)}o$(s),await n.sendUsage("site_init",{duration:Date.now()-r,created:o})}catch(i){throw await n.sendError(i instanceof Error?i:new Error(String(i)),"site_init",{duration:Date.now()-r}),i instanceof f?i:new f(i,{prefix:`${k} Failed to initialize site:`})}}q();pe();C();A();M();X();De();lt();C();function l$(e){let t=e.trim();return t?` \u2014 ${t.slice(0,500)}`:""}async function c$(e,t){let n=await t.text(),r;try{r=JSON.parse(n)}catch{}throw t.status===404&&r?.error==="Not found"&&!r.code?new f(`Failed to ${e}: WFS Sync is not enabled on this environment (the server feature flag is off, or the host does not serve /api/ai/wfs).`,{isUserError:!0}):r?.code==="SCHEMA_STALE"?new f(`Failed to ${e}: the site's filesystem schema changed since the last pull. Run \`webflow sites pull\` and re-apply your changes.`,{isUserError:!0}):r?.code&&r.error?new f(`Failed to ${e}: ${r.error} (${r.code})`,{isUserError:t.status<500}):new f(`Failed to ${e}: ${t.status} ${t.statusText}${l$(n)}`)}async function wx(e,t,n,r){let o=await G(`${xn()}/api/ai/wfs/${t}`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});o.ok||await c$(e,o);let i=await o.json();if(!i||i.status!=="ok"||i.result==null)throw new f(`Invalid response from the WFS Sync API: expected an ok envelope${i?.error?` (${i.error})`:""}.`);return i.result}async function il(e,t,n){Z(t,"siteId");let r=await wx("pull the site files","pull",e,{siteId:t,...n?.pageIds&&n.pageIds.length>0?{pageIds:n.pageIds}:{},...n?.manifestOnly?{manifestOnly:!0}:{}});return{...r,pages:r.pages.map(o=>({...o,folderSegments:Array.isArray(o.folderSegments)?o.folderSegments:[]}))}}async function bx(e,t,n,r){Z(t,"siteId");let o=await wx("push the site files","push",e,{siteId:t,changes:n,...r?.conflictPolicy?{conflictPolicy:r.conflictPolicy}:{},...r?.schemaHash?{schemaHash:r.schemaHash}:{}});if(!Array.isArray(o.results))throw new f("Invalid response from the WFS Sync API: expected a `results` array.");return o}Me();q();C();var Ku=require("path");function ih(e){return e.split(Ku.sep).join("/").replace(/\\/g,"/")}function Bo(e){if(e===""||e.includes("\0")||(0,Ku.isAbsolute)(e))return!1;let t=ih(e);return t.startsWith("/")||/^[a-zA-Z]:/.test(t)?!1:!t.split("/").some(n=>n==="..")}var u$={pagesRoot:"src/pages",componentsRoot:"src/components",pagesShape:"flat",themeRoot:"src/theme"},Dx={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 d$(e){return e.endsWith("/")?e.slice(0,-1):e}function kx(e,t,n){let r=e.trim();if(!Bo(r))throw new f(`"site.layout.${t}" in ${n} must be a path inside the project ("src/components"), not "${e}".`,{isUserError:!0});let o=r.split("/").filter(i=>i!==""&&i!==".").join("/");if(o==="")throw new f(`"site.layout.${t}" in ${n} must name a directory inside the project, not "${e}".`,{isUserError:!0});return d$(o)}function p$(e,t,n){let r=e.split("/"),o=t.split("/"),i=[];for(let s=0;s<Math.min(r.length,o.length)-1&&r[s]===o[s];s++)i.push(r[s]);return i.length>0?`${i.join("/")}/${n}`:n}function f$(e,t){let n=e?.layout;if(!n)return u$;let r=n.preset?Dx[n.preset]:void 0;if(n.preset&&!r)throw new f(`Unknown "site.layout.preset" value "${n.preset}" in ${t}. Known presets: ${Object.keys(Dx).join(", ")}.`,{isUserError:!0});let o=n.pagesRoot??r?.pagesRoot,i=n.componentsRoot??r?.componentsRoot;if(!o||!i)throw new f(`"site.layout" in ${t} must specify both "pagesRoot" and "componentsRoot" (directly, or via a "preset" that provides them).`,{isUserError:!0});let s=n.pagesShape??r?.pagesShape??"flat",a=kx(o,"pagesRoot",t),l=kx(i,"componentsRoot",t);return{pagesRoot:a,componentsRoot:l,pagesShape:s,themeRoot:p$(a,l,"theme")}}function ys(e){let{manifest:t,manifestPath:n}=ne(),r=e?.trim();r&&Z(r,"site-id");let o=r||ao(t);if(!o||o.trim()==="")throw new f(`Missing "siteId" in ${n}. Run \`webflow sites init\` to select a site, set WEBFLOW_SITE_ID, or pass --site-id.`,{isUserError:!0});let i=f$(t.site,n);return{siteId:o,layout:i}}var ar=require("@babel/types");var Ex=require("@babel/parser");function Zt(e){try{return(0,Ex.parse)(e,{sourceType:"module",plugins:["typescript","jsx"]})}catch{return}}function*Hr(e){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let t of e)yield*Hr(t);return}if(typeof e.type=="string"){yield e;for(let[t,n]of Object.entries(e))t==="loc"||t==="leadingComments"||t==="trailingComments"||(yield*Hr(n))}}}function Vr(e,t){if(t.length===0)return e;let n=e;for(let{start:r,end:o,text:i}of[...t].sort((s,a)=>a.start-s.start))n=n.slice(0,r)+i+n.slice(o);return n}function vx(e){let t;for(let n of Hr(e.program))if((0,ar.isCallExpression)(n)&&(0,ar.isIdentifier)(n.callee,{name:"component"})&&(0,ar.isObjectExpression)(n.arguments[0])){let r=n.arguments[0];(t===void 0||(r.start??0)<(t.start??0))&&(t=r)}return t}function Sx(e){return e.properties.some(t=>(0,ar.isObjectProperty)(t)&&!t.computed&&(0,ar.isIdentifier)(t.key,{name:"id"}))}function xx(e,t){let n=Zt(e),r=n&&vx(n);if(!r||r.start==null||Sx(r))return;let o=r.start,i=e.slice(o+1);if(i.slice(0,i.includes(`
|
|
207
207
|
`)?i.indexOf(`
|
|
208
208
|
`):i.length).trim()===""){let l=i.split(`
|
|
209
|
-
`),c=" ";for(let
|
|
210
|
-
${c}id: ${t},`+e.slice(o+1)}let a=i.startsWith(" ")?"":" ";return e.slice(0,o+1)+` id: ${t},${a}`+e.slice(o+1)}function
|
|
209
|
+
`),c=" ";for(let d of l.slice(1))if(d.trim()!==""){c=d.match(/^\s*/)?.[0]??c;break}return e.slice(0,o+1)+`
|
|
210
|
+
${c}id: ${t},`+e.slice(o+1)}let a=i.startsWith(" ")?"":" ";return e.slice(0,o+1)+` id: ${t},${a}`+e.slice(o+1)}function Cx(e,t){return xx(e,`"${t}"`)}function Fx(e){return xx(e,"null")}function _x(e){let t=Zt(e),n=t&&vx(t);return n?Sx(n):!0}var Rx=require("crypto"),re=require("@babel/types");function Ax(e){return(0,Rx.createHash)("sha256").update(e,"utf8").digest("hex").slice(0,16)}var gn=e=>e.join(",");function Ix(e){let t=Zt(e),n=t&&ah(t);if(!n)return[];let r=[],o=s=>s.start!=null&&s.end!=null?e.slice(s.start,s.end):"";function i(s,a){let l=Tx(s);r.push({path:a,kind:"element",...l?{tag:l}:{},hash:Ax(o(s))});let c=0;for(let d of s.children){if(lh(d))continue;let p=ch(d)!==void 0,m=$x(d)!==void 0;if(p||m){r.push({path:[...a,c++],kind:"string",hash:Ax(o(d))});continue}(0,re.isJSXElement)(d)&&i(d,[...a,c++])}}return i(n,[]),r}function m$(e,t){let n=new Map,r=new Set,o=(l,c)=>l.kind===c.kind&&(l.tag===void 0||l.tag===c.tag),i=(l,c)=>{r.add(c),n.set(gn(l.path),c)},s=new Map(t.map(l=>[gn(l.path),l])),a=new Map;for(let l of t)l.hash!==void 0&&a.set(l.hash,[...a.get(l.hash)??[],l]);for(let l of e){let c=s.get(gn(l.path));c&&c.hash!==void 0&&c.hash===l.hash&&!r.has(c)&&o(c,l)&&i(l,c)}for(let l of e){if(n.has(gn(l.path)))continue;let c=(a.get(l.hash)??[]).find(d=>!r.has(d)&&o(d,l));c&&i(l,c)}for(let l of e){if(n.has(gn(l.path)))continue;let c=s.get(gn(l.path));c&&!r.has(c)&&o(c,l)&&i(l,c)}return n}function ah(e){for(let t of Hr(e.program)){if(!(0,re.isCallExpression)(t)||!((0,re.isIdentifier)(t.callee,{name:"page"})||(0,re.isIdentifier)(t.callee,{name:"component"})))continue;let n=t.arguments[t.arguments.length-1];if(!n||!(0,re.isArrowFunctionExpression)(n)&&!(0,re.isFunctionExpression)(n))continue;let{body:r}=n;if((0,re.isJSXElement)(r))return r;if((0,re.isBlockStatement)(r)){for(let o of r.body)if((0,re.isReturnStatement)(o)&&o.argument&&(0,re.isJSXElement)(o.argument))return o.argument}}}function Tx(e){let{name:t}=e.openingElement;if((0,re.isJSXIdentifier)(t))return t.name;if((0,re.isJSXMemberExpression)(t)){let n=t.object;if((0,re.isJSXIdentifier)(n))return`${n.name}.${t.property.name}`}}function lh(e){if(!(0,re.isJSXElement)(e))return!1;let t=e.openingElement.name;return(0,re.isJSXMemberExpression)(t)&&(0,re.isJSXIdentifier)(t.object,{name:"Basic"})&&(0,re.isJSXIdentifier)(t.property,{name:"String"})}function sh(e){for(let t of e.openingElement.attributes)if((0,re.isJSXAttribute)(t)&&(0,re.isJSXIdentifier)(t.name,{name:"uid"})&&(0,re.isStringLiteral)(t.value))return t.value.value}function g$(e){return e.replace(/^\s*\n\s*/,"").replace(/\s*\n\s*$/,"").replace(/\s*\n\s*/g," ")}function h$(e){let t=e.children.filter(r=>!((0,re.isJSXText)(r)&&r.value.trim()===""));if(t.length!==1)return;let[n]=t;if((0,re.isJSXText)(n))return g$(n.value);if((0,re.isJSXExpressionContainer)(n)&&(0,re.isStringLiteral)(n.expression))return n.expression.value}function ch(e){if(!(!(0,re.isJSXExpressionContainer)(e)||!(0,re.isStringLiteral)(e.expression)))return e.expression.value}function Px(e){return(0,re.isIdentifier)(e)}function y$(e){let t=e.children.filter(o=>!((0,re.isJSXText)(o)&&o.value.trim()===""));if(t.length!==1)return;let[n]=t;if(!(0,re.isJSXExpressionContainer)(n))return;let{expression:r}=n;if(Px(r)&&!(r.start==null||r.end==null))return{start:r.start,end:r.end}}function $x(e){if(!(0,re.isJSXExpressionContainer)(e))return;let{expression:t}=e;if(Px(t)&&!(t.start==null||t.end==null))return{start:t.start,end:t.end}}function w$(e,t){let r=t.openingElement.attributes.find(a=>(0,re.isJSXAttribute)(a)&&(0,re.isJSXIdentifier)(a.name,{name:"uid"})&&(0,re.isStringLiteral)(a.value));if(!r||r.start==null||r.end==null)return;let o=e.lastIndexOf(`
|
|
211
211
|
`,r.start-1)+1,i=e.indexOf(`
|
|
212
|
-
`,r.end),s=i===-1?e.length:i;return/^\s*$/.test(e.slice(o,r.start))&&/^\s*$/.test(e.slice(r.end,s))?{start:o,end:i===-1?e.length:i+1}:e[r.end]===" "?{start:r.start,end:r.end+1}:r.start>0&&e[r.start-1]===" "?{start:r.start-1,end:r.end}:{start:r.start,end:r.end}}function
|
|
213
|
-
`,"utf8")}for(let s of r){if(s in e.files)continue;let a=
|
|
214
|
-
`,"utf8")}function
|
|
215
|
-
`)}function y$(e,t,n,r){let o=new Map;for(let[i,s]of Object.entries(t.files))o.set(s.localPath??i,i);for(let i of e)o.set(n[i.path]??i.path,i.path);return e.map(i=>{let s=n[i.path]??i.path;if(i.content===void 0||!s.endsWith(".tsw"))return i;let a=zu(i.content,s,Ju(i.path),l=>o.get(l)??Vu(l,r.themeRoot)??Ox(l,r.componentsRoot));return{...i,content:a}})}function w$(e,t){let n=new Set,r=new Set;return{pushChanges:e.map(i=>{if(!i.path.endsWith(".tsw")||i.content===void 0)return i;let s=t.files[i.path]?.nodeIds??[],{desugared:a,hasNewNodes:l}=vx(i.content,s);l&&n.add(i.path);let c=t.files[i.path]?.styleIds??[],{desugared:p,hasNewStyles:d}=Fx(a,c);return d&&r.add(i.path),{...i,content:p}}),pathsWithNewNodes:n,pathsWithNewStyles:r}}function b$(e,t){let n=[],r=[];for(let o of e){let i=t.files[o.path]?.componentId;if(o.content===void 0){r.push(o);continue}if(i){let a=mx(o.content,i);if(a===void 0){n.push(o.path);continue}r.push({...o,content:a});continue}if(o.baseHash!==void 0){r.push(o);continue}let s=gx(o.content);r.push(s===void 0?o:{...o,content:s})}return{pushChanges:r,spliceFailures:n}}function D$(e,t,n,r){let o=y$(e,t,n,r),{pushChanges:i,pathsWithNewNodes:s,pathsWithNewStyles:a}=w$(o,t),{pushChanges:l,spliceFailures:c}=b$(i,t);return{pushChanges:l,pathsWithNewNodes:s,pathsWithNewStyles:a,spliceFailures:c}}async function k$(e,t,n,r,o){let i=[],s=!1,a=!1;for(let[l,c]of n.entries()){let p;try{p=await ax(e,t,c,{conflictPolicy:r,schemaHash:o})}catch(m){throw s&&u.warn(`${re} The push failed after ${l} of ${n.length} batches committed. Local sync state may be stale \u2014 run \`webflow sites pull\` before pushing again.`),m}o=p.schemaHash,i.push(...p.results);let d=p.results.some(m=>m.outcome==="conflict"||m.outcome==="error"||m.outcome==="skipped"||(m.rejected?.length??0)>0);if(p.results.some(m=>m.outcome==="committed")&&(s=!0),d&&l<n.length-1){a=!0;break}}return{results:i,schemaHash:o,aborted:a}}function E$(e){let t=[];for(let n of e)if(n.outcome==="committed")for(let[r,o]of Object.entries(n.createdComponents??{}))t.push({path:r,componentId:o,hash:n.hashes?.[r]});return t}function v$(e,t,n,r,o,i){let s={...e.files};for(let l of i)if(l.outcome==="committed")for(let[c,p]of Object.entries(l.hashes??{})){let d=r.get(c);if(!d||d.content===void 0)continue;let m=o[c]??s[c]?.localPath;s[c]={...s[c],serverHash:p,contentSha256:fn(d.content),...m?{localPath:m}:{}}}let a=E$(i);for(let{path:l,componentId:c,hash:p}of a){let d=r.get(l)?.content;if(d===void 0||p===void 0)continue;let m=o[l]??s[l]?.localPath;s[l]={...s[l],serverHash:p,contentSha256:fn(d),componentId:c,...m?{localPath:m}:{}}}return{lockfile:{siteId:e.siteId??t,schemaHash:n,files:s},created:a}}function S$(e,t){for(let{path:n,componentId:r}of e)u.info(`${$} Created component ${t(n)} (id ${r})`),u.info(I(" id tracked locally \u2014 it will be spliced into this file on future pushes without changing it on disk"))}async function x$(e,t,n,r,o,i){let s=new Set([...r,...o]),a=[...new Set(n.filter(c=>c.outcome==="committed"&&Object.keys(c.hashes??{}).some(p=>s.has(p))).map(c=>c.pageId))];if(a.length===0)return i;let l={...i.files};for(let c of Gu(a)){let p=await Za(e,t,{pageIds:c});for(let d of p.files){let m=l[d.path];if(!m)continue;let h={};if(r.has(d.path)){let{entries:g}=Uu(d.content);g.length>0&&(h.nodeIds=g)}if(o.has(d.path)){let{entries:g}=Wu(d.content);g.length>0&&(h.styleIds=g)}Object.keys(h).length>0&&(l[d.path]={...m,...h})}}return{...i,files:l}}function C$({missing:e,renameCandidates:t,unmappable:n,stale:r,orphanedUpstream:o},i){for(let s of e)u.warn(`${re} ${s} is tracked but missing on disk \u2014 deletions are not supported by the WFS Sync API; the file is skipped. Restore it with \`webflow sites pull\`.`);for(let{oldPath:s,newPath:a}of t){let l=s.startsWith(`${i.pagesRoot}/`),c=l?`Webflow doesn't support renaming a page's file directly: restore ${s}, then rename or move the page in the Designer instead, push, then \`webflow sites pull\` to get the file moved automatically.`:`Webflow doesn't support renaming a component's file directly: restore ${s}, edit its \`name:\` meta in place instead, push, then \`webflow sites pull\` to get the file moved automatically.`;u.warn(`${re} ${a} looks like ${s} renamed locally \u2014 skipped, since its content is byte-for-byte unchanged. ${c} (If you also edited the content before this push, this warning won't catch it \u2014 rename first, push, THEN make content edits, or the push may create a duplicate ${l?"page":"component"} instead of updating the original.)`)}for(let s of o)u.warn(`${re} ${s} was deleted or renamed in the Designer, but still has local edits \u2014 skipped. Pushing it would re-create it. Merge anything you need elsewhere, then delete it.`);for(let s of r)u.warn(`${re} ${s} is a leftover copy of a file that now lives elsewhere \u2014 skipped. Pushing it would overwrite the current version with this stale content. Delete it, or merge anything you still need into the tracked file first.`);for(let s of n){let a=s.startsWith(`${i.pagesRoot}/`);u.warn(a?`${re} ${s} doesn't match a tracked page \u2014 creating a page via push isn't supported yet. Create it in the Designer, then \`webflow sites pull\`.`:`${re} ${s} isn't a recognized component file (expected a .tsw file under ${i.componentsRoot}) \u2014 skipped.`)}}function F$(e){let t=Hu();if(t.kind==="missing")throw new f("No WFS sync state found (.webflow/wfs/). Run `webflow sites pull` first.",{isUserError:!0});if(t.kind==="corrupt")throw new f(`This project's sync state is unreadable (${t.reason}), so push can't tell which files are tracked. Run \`webflow sites pull\` to rebuild it (add --reset to discard it first).`,{isUserError:!0});if(t.corruptPaths.length>0)throw new f(`${t.corruptPaths.length} tracked file(s) have unreadable sync state (${t.corruptPaths.slice(0,3).join(", ")}${t.corruptPaths.length>3?", \u2026":""}). Pushing now would re-create them as new objects instead of updating them. Run \`webflow sites pull\` to rebuild the state first.`,{isUserError:!0});let n=t.lockfile;if(n.siteId!==void 0&&n.siteId!==e)throw new f(`This project's sync state was pulled from site ${n.siteId}, but push targets ${e}. Run \`webflow sites pull\` to sync against ${e} first (add --reset to discard the existing state).`,{isUserError:!0});return n}function _$(e,t,n,r){return JSON.stringify({dryRun:!0,siteId:e,changes:t.map(o=>({path:o.path,localPath:n[o.path]??o.path,isNew:o.baseHash===void 0})),...r.length>0?{blocked:r.map(o=>n[o]??o)}:{}},null,2)}function A$(e,t,n,r,o){let i=new Set(r),s=e.filter(a=>!i.has(a.path));u.info(`Would push ${s.length} file(s) to site ${o}:`);for(let a of s){let l=a.baseHash===void 0&&a.path.startsWith("site/components/")&&a.path.endsWith(".tsw")&&a.content!==void 0&&!hx(a.content),c=t.files[a.path]?.componentId,p=n[a.path]??a.path,d=l?I(" (new component \u2014 the platform will assign an id, tracked locally without changing this file)"):c?I(` (previously assigned id ${c} will be spliced in on push)`):a.baseHash?"":I(" (new)");u.info(` ${p}${d}`)}u.info("Dry run \u2014 no changes made.")}async function qu(e={}){let t=us(),n=F$(t.siteId),r=await Mx(n,t.layout,void 0,e.force),{changes:o,localPaths:i}=r;if(C$(r,t.layout),o.length===0){u.info(e.json?JSON.stringify({schemaHash:n.schemaHash,results:[]},null,2):"No local changes to push.");return}let s=await T({apiToken:e.apiToken}),a=F.forSites({authToken:s}),l=Date.now(),c=g$(n,i);try{let{pushChanges:p,pathsWithNewNodes:d,pathsWithNewStyles:m,spliceFailures:h}=D$(o,n,i,t.layout);for(let E of h)u.warn(`${re} ${c(E)} no longer matches the shape its assigned component id can be spliced into \u2014 run \`webflow sites pull\` to restore the canonical module before pushing this file again.`);if(e.dryRun){e.json?u.info(_$(t.siteId,o,i,h)):A$(o,n,i,h,t.siteId),await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,dryRun:!0});return}let g=Bx(p),{results:y,schemaHash:b,aborted:S}=await k$(s,t.siteId,g,e.force?"rebase":void 0,n.schemaHash),_=new Map(o.map(E=>[E.path,E])),{lockfile:v,created:x}=v$(n,t.siteId,b,_,i,y);Qa(v);let O=new Set(y.flatMap(E=>E.outcome==="committed"?Object.keys(E.hashes??{}):[])),H=new Set([...d].filter(E=>O.has(E))),B=new Set([...m].filter(E=>O.has(E)));if(H.size>0||B.size>0)try{Qa(await x$(s,t.siteId,y,H,B,v))}catch(E){u.warn(`${re} The push committed, but the follow-up fetch of newly created element/style ids failed (${E instanceof Error?E.message:String(E)}). Run \`webflow sites pull\` before pushing again \u2014 otherwise the new nodes are sent without ids and duplicated.`)}let we=y.filter(E=>E.outcome==="conflict"),Se=y.filter(E=>E.outcome==="error"),me=y.filter(E=>E.outcome==="skipped"),Ne=y.flatMap(E=>E.rejected??[]);if(e.json)u.info(JSON.stringify({schemaHash:b,results:y},null,2));else{S$(x,c);for(let U of y)u.info(h$(U,c));let E=y.filter(U=>U.outcome==="committed").length,z=x.length>0?` Created ${x.length} component(s) (ids tracked locally, not written to source).`:"";u.info(`Pushed ${o.length-h.length} file(s) across ${y.length} page group(s): ${E} committed, ${we.length} conflicted, ${Se.length} failed, ${me.length} skipped.${z}`),S&&u.warn(`${re} Remaining batches were not pushed because an earlier batch conflicted or failed.`)}if(we.length>0||Se.length>0||me.length>0||Ne.length>0||h.length>0)throw new f(`${re} Push finished with ${we.length} conflict(s), ${Se.length} error(s), ${me.length} skipped page(s), ${Ne.length} rejected file(s), ${h.length} file(s) that could not be sent. Resolve the issues above and try again.`,{isUserError:!0,skipLogging:!!e.json});await a.sendUsage("site_push",{duration:Date.now()-l,count:o.length,createdComponents:x.length,dryRun:!1})}catch(p){throw await a.sendError(p instanceof Error?p:new Error(String(p)),"site_push",{duration:Date.now()-l}),p instanceof f?p:new f(p,{prefix:`${k} Failed to push site files:`})}}var Bo=require("fs"),Ux=require("module"),Mo=require("path");q();pe();C();A();M();X();function R$(e,t,n,r){let o=n.get(e.path);if(o)return $x(o,t);let i=Lx(e.path,t);if(i)return i;let s=r?.files[e.path]?.localPath;return ih(e.path,t,s)??e.path}function I$(e,t,n){if(!Array.isArray(e)||e.length===0)return;let r=(0,Ux.createRequire)((0,Mo.join)(t,"package.json")),o=[];for(let i of e){if(typeof i!="string"){o.push(i);continue}try{o.push(r.resolve(i))}catch{u.debug(`Prettier plugin "${i}" from this project's config could not be resolved; formatting ${n} without it.`)}}return o}async function T$(e,t){try{let{format:n,resolveConfig:r}=await import("prettier"),o=await r(t,{editorconfig:!0}),i=I$(o?.plugins,process.cwd(),t);return await n(e,{...o,...i?{plugins:i}:{},filepath:t,parser:"babel-ts"})}catch(n){return u.debug(`Prettier could not format ${t}, writing it unformatted: ${n instanceof Error?n.message:String(n)}`),e}}function P$(e,t){if(t){Ix();return}let n=Hu();if(n.kind==="missing")return;if(n.kind==="corrupt")throw new f(`This project's sync state is unreadable (${n.reason}), so a pull can't tell which local files have changed since the last sync. Restore ${Wr}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});if(n.corruptPaths.length>0)throw new f(`${n.corruptPaths.length} tracked file(s) have unreadable sync state (${n.corruptPaths.slice(0,3).join(", ")}${n.corruptPaths.length>3?", \u2026":""}), so a pull can't tell whether their local copies changed. Restore ${Wr}/ from version control, or re-run with --reset to discard it and pull from scratch.`,{isUserError:!0});let r=n.lockfile;if(r?.siteId!==void 0&&r.siteId!==e&&Object.keys(r.files).length>0)throw new f(`This project's sync state was pulled from site ${r.siteId}, but this pull targets ${e}. Pulling a second site into the same project would leave \`webflow sites push\` (which always targets the site in webflow.json) applying it to the wrong one. Re-run with --reset to discard the existing state and pull ${e} from scratch.`,{isUserError:!0});return r}async function Xu(e={}){let t=us(e.siteId),n=P$(t.siteId,!!e.reset),r=await T({apiToken:e.apiToken}),o=F.forSites({authToken:r}),i=Date.now();try{let s=await Za(r,t.siteId,{manifestOnly:!0});if(s.useTsw===!1)throw new f("This site is served as a WFDL projection, which `webflow sites pull` doesn't support \u2014 it reads and writes `.tsw` modules. No files were written.",{isUserError:!0});let a=s.pages.map(E=>E.pageId);if(a.length===0){await o.sendUsage("site_pull",{duration:Date.now()-i,count:0}),u.info(e.json?JSON.stringify({schemaHash:s.schemaHash,pages:[],files:[]},null,2):"The site has no static pages to pull.");return}let l=new Map,c=s.schemaHash,p={},d=[];for(let E of Gu(a)){let z=await Za(r,t.siteId,{pageIds:E});c=z.schemaHash,p=z.componentIds??p,z.warnings&&d.push(...z.warnings);for(let U of z.files)l.set(U.path,U)}let m=[...l.values()].sort((E,z)=>E.path.localeCompare(z.path)),h=new Map(s.pages.map(E=>[E.path,E])),g=new Map;for(let E of m){let z=n?.files[E.path];if(!z)continue;let U=z.localPath??E.path,ge=Ku(U),ur=ge!==void 0&&fn(ge)!==z.contentSha256,dr=E.hash!==z.serverHash;ur&&dr&&g.set(E.path,U)}let y=!e.force,b=[...g.values()],S=process.cwd(),_=new Map(m.map(E=>[E.path,R$(E,t.layout,h,n)])),v=new Map;for(let[E,z]of _)v.set(z,[...v.get(z)??[],E]);let x=[...v.entries()].filter(([,E])=>E.length>1);if(x.length>0){let E=x.map(([z,U])=>`${z} \u2190 ${U.join(", ")}`).join("; ");throw new f(`Two or more files resolve to the same local path, so pulling would overwrite one with the other: ${E}. This usually means pages share a slug across Designer Page Folders without distinct folder segments. No files were written.`,{isUserError:!0})}let O={siteId:t.siteId,schemaHash:c,files:{}},H=new Set(_.values()),B=[],we=[],Se=[],me=[];for(let E of m){let z=n?.files[E.path];if(y&&g.has(E.path)){z&&(O.files[E.path]=z);continue}let U=_.get(E.path);Tx(U);let ge=(0,Mo.join)(S,U);(0,Bo.mkdirSync)((0,Mo.dirname)(ge),{recursive:!0});let ur=U.endsWith(".tsw")?zu(E.content,Ju(E.path),U,li=>_.get(li)??ih(li,t.layout,n?.files[li]?.localPath)):E.content,{sugared:dr,entries:J_}=Uu(ur),{sugared:Ay,entries:Ry}=Wu(dr),qd=U.endsWith(".tsw")?await T$(Ay,ge):Ay;(0,Bo.writeFileSync)(ge,qd,"utf8");let Iy=Qg(qd,J_);B.push(E);let Xr=z?z.localPath??E.path:void 0;if(z&&Xr&&Xr!==U&&!H.has(Xr)){let li=Ku(Xr);li===void 0||(fn(li)===z.contentSha256?((0,Bo.rmSync)((0,Mo.join)(S,Xr),{force:!0}),we.push({from:Xr,to:U})):Se.push({from:Xr,to:U}))}let Ty=p[E.path],Tl=h.get(E.path);O.files[E.path]={serverHash:E.hash,contentSha256:fn(qd),localPath:U,...Ty?{componentId:Ty}:{},...Iy.length>0?{nodeIds:Iy}:{},...Ry.length>0?{styleIds:Ry}:{},...Tl?{slug:Tl.slug,isDefault:Tl.isDefault,folderSegments:Tl.folderSegments}:{}}}let Ne=new Set(m.map(E=>E.path));for(let[E,z]of Object.entries(n?.files??{})){if(Ne.has(E))continue;let U=z.localPath??E;if(H.has(U))continue;let ge=Ku(U);ge!==void 0&&(fn(ge)===z.contentSha256?((0,Bo.rmSync)((0,Mo.join)(S,U),{force:!0}),me.push(U)):(Se.push({from:U,to:"(no longer on the site)"}),O.files[E]={...z,deletedUpstream:!0}))}if(Qa(O),e.json)u.info(JSON.stringify({schemaHash:c,pages:s.pages.map(({pageId:E,slug:z,title:U,path:ge,folderSegments:ur})=>({pageId:E,slug:z,title:U,path:ge,folderSegments:ur})),files:B.map(E=>({path:E.path,hash:E.hash,size:E.size,localPath:O.files[E.path]?.localPath})),...y&&b.length>0?{skipped:b}:{},...me.length>0?{removed:me}:{},...we.length>0?{relocated:we}:{},...Se.length>0?{orphaned:Se}:{}},null,2));else{for(let E of B){let z=h.get(E.path),U=O.files[E.path]?.localPath??E.path,ge=z?I(` (page, slug: "${z.slug}")`):"";u.info(`${$} ${U}${ge}`)}u.info(`Pulled ${B.length} file(s) across ${a.length} page(s).`);for(let E of me)u.info(I(` removed ${E} (no longer on the site)`));for(let{from:E,to:z}of we)u.info(I(` moved ${E} \u2192 ${z}`))}for(let E of b)u.warn(y?`${re} ${E} changed both locally and in the Designer since the last sync \u2014 left as-is, so your local edit is intact. Commit or move it, then pull again (or pull with --force to take the Designer's version).`:`${re} ${E} changed both locally and in the Designer since the last sync \u2014 the local edit was overwritten by --force; recover it from git if needed.`);for(let{from:E,to:z}of Se)u.warn(`${re} ${E} is now at ${z}, but the old file has local edits so it was left in place. \`sites push\` will skip it \u2014 merge anything you still need into ${z} and delete ${E}, since while it's there the two copies disagree.`);for(let{path:E,reason:z}of d){let U=O.files[E]?.localPath??E;u.warn(`${re} ${U}: ${z}`)}await o.sendUsage("site_pull",{duration:Date.now()-i,count:B.length,skipped:y?b.length:0})}catch(s){throw await o.sendError(s instanceof Error?s:new Error(String(s)),"site_pull",{duration:Date.now()-i}),s instanceof f?s:new f(s,{prefix:`${k} Failed to pull site files:`})}}Vn();var Wx=e=>{let t=e.command("sites").description("Manage Webflow sites");t.command("list").description("List all sites in your Webflow workspace").addOption(ne()).addOption(He(["id","displayName","shortName","lastPublished","lastUpdated","timeZone"]).default("id,displayName,lastPublished")).action(Vg),t.command("get").description("Get details for a specific site").argument("<siteId>","Site ID").addOption(ne()).action(Gg),t.command("domains").description("List custom domains configured for a site").requiredOption("--site <siteId>","Site ID").addOption(ne()).action(Kg),t.command("publish").description("Publish a Webflow site (defaults to Webflow subdomain)").requiredOption("--site <siteId>","Site ID to publish").option("--domains <domains>","Comma-separated custom domain IDs to publish to").option("--page <pageId>","Publish a single page instead of the whole site").addOption(Ae()).addOption(ne()).action(Jg),Je()&&(t.command("init").description("Bind this project to an existing Webflow site or create a new one, saving its ID as `siteId` in webflow.json.").addOption(qn()).option("--site-id <siteId>","Skip the interactive picker and bind to this site ID (CI/scripted setup).").option("--create","Create a new Webflow site instead of binding.").option("--name <name>","Name for the new site (implies --create; skips the prompt).").action(Mu),t.command("push").description("Push locally changed files to your Webflow Site. Use --dry-run to preview.").addOption(qn()).addOption(Ae()).addOption(ne()).option("--force","Skip conflict checks, overwrite upstream changes, and re-push every tracked file (not just locally changed ones).").action(qu),t.command("pull").description("Pull your Webflow Site's source files. Files edited both locally and in the Designer are left alone unless --force.").addOption(qn()).addOption(ne()).option("--site-id <siteId>","Pull from this site only, bypassing (and not modifying) the siteId in webflow.json. Needs --reset when the project is already synced with another site.").option("--force","Overwrite local files that changed both here and in the Designer since the last sync.").option("--reset","Discard the existing local sync state and pull from scratch.").action(Xu))};q();C();A();M();X();De();async function Hx(e,t){return Z(t,"siteId"),Ja(`${P()}/v2/sites/${t}/forms`,e,"forms","Failed to list forms")}async function Vx(e,t,n){return Z(t,"siteId"),Z(n,"formId"),Ja(`${P()}/v2/sites/${t}/forms/${n}/submissions`,e,"formSubmissions","Failed to list submissions")}C();pe();var ah=["id","displayName","name","slug","createdOn","lastUpdated"],Gx=ut(ah);function Kx(){return ah}function Jx(e,t=["id","displayName","slug"]){if(e.length===0)return I("No forms found.");if(t.length===0)throw new f(`No valid fields specified. Available: ${ah.join(", ")}`,{isUserError:!0});let n=t.map(o=>se(o)),r=e.map(o=>t.map(i=>{let s=o[i];return s?i==="createdOn"||i==="lastUpdated"?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):s:I("\u2014")}));return qe(n,r)}function zx(e){if(e.length===0)return I("No submissions found.");let t=Array.from(new Set(e.flatMap(o=>Object.keys(o.formResponse)))),n=["id","dateSubmitted",...t].map(o=>se(o)),r=e.map(o=>[o.id,new Date(o.dateSubmitted).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),...t.map(i=>{let s=o.formResponse[i];return s==null?I("\u2014"):typeof s=="object"?JSON.stringify(s):String(s)})]);return qe(n,r)}function qx(e){if(e.length===0)return"";let n=["id","formId","displayName","dateSubmitted",...Array.from(new Set(e.flatMap(i=>Object.keys(i.formResponse))))],r=i=>{let s=i==null?"":typeof i=="object"?JSON.stringify(i):String(i);return s.includes(",")||s.includes('"')||s.includes(`
|
|
212
|
+
`,r.end),s=i===-1?e.length:i;return/^\s*$/.test(e.slice(o,r.start))&&/^\s*$/.test(e.slice(r.end,s))?{start:o,end:i===-1?e.length:i+1}:e[r.end]===" "?{start:r.start,end:r.end+1}:r.start>0&&e[r.start-1]===" "?{start:r.start-1,end:r.end}:{start:r.start,end:r.end}}function Ju(e){let t=Zt(e),n=t&&ah(t);if(!n)return{sugared:e,entries:[]};let r=[],o=[];function i(l,c){let d=sh(l);if(d===void 0)return;let p=w$(e,l);if(!p)return;let m=Tx(l);r.push({path:c,uid:d,kind:"element",...m?{tag:m}:{}}),o.push({start:p.start,end:p.end,text:""})}function s(l,c){let d=0;for(let p of l.children){if(lh(p)){let m=sh(p);if(m===void 0||p.start==null||p.end==null)continue;let h=h$(p),g=h===void 0?y$(p):void 0;if(h===void 0&&g===void 0)continue;r.push({path:[...c,d++],uid:m,kind:"string"}),o.push({start:p.start,end:p.end,text:h!==void 0?`{${JSON.stringify(h)}}`:`{${e.slice(g.start,g.end)}}`});continue}if(ch(p)!==void 0){d++;continue}if((0,re.isJSXElement)(p)){let m=[...c,d++];i(p,m),s(p,m)}}}if(i(n,[]),s(n,[]),o.length===0)return{sugared:e,entries:[]};let a=Vr(e,o);return{sugared:a,entries:uh(a,r)}}function uh(e,t){if(t.length===0)return t;let n=new Map(Ix(e).map(r=>[gn(r.path),r.hash]));return t.map(r=>{let o=n.get(gn(r.path));return o?{...r,hash:o}:r})}function Ox(e,t){let n=Zt(e),r=n&&ah(n);if(!r)return{desugared:e,hasNewNodes:!1};let o=m$(Ix(e),t),i=[],s=!1;function a(c,d){if(sh(c)!==void 0)return;let p=o.get(gn(d));if(!p||p.kind!=="element"){s=!0;return}let m=c.openingElement.name.end;m!=null&&i.push({start:m,end:m,text:` uid=${JSON.stringify(p.uid)}`})}function l(c,d){let p=0;for(let m of c.children){if(lh(m))continue;let h=ch(m);if(h!==void 0){let y=[...d,p++];if(m.start==null||m.end==null)continue;let b=o.get(gn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${JSON.stringify(h)}}</Basic.String>`});continue}let g=$x(m);if(g!==void 0){let y=[...d,p++];if(m.start==null||m.end==null)continue;let b=o.get(gn(y));if(!b||b.kind!=="string"){s=!0;continue}i.push({start:m.start,end:m.end,text:`<Basic.String uid=${JSON.stringify(b.uid)}>{${e.slice(g.start,g.end)}}</Basic.String>`});continue}if((0,re.isJSXElement)(m)){let y=[...d,p++];a(m,y),l(m,y)}}}return a(r,[]),l(r,[]),{desugared:Vr(e,i),hasNewNodes:s}}var ht=require("@babel/types");function b$(e){if(!(0,ht.isVariableDeclarator)(e)||!(0,ht.isIdentifier)(e.id)||!e.init)return;let{init:t}=e;if(!(!(0,ht.isCallExpression)(t)||!(0,ht.isIdentifier)(t.callee,{name:"style"})))return{ident:e.id.name,call:t}}function Lx(e){let t=e.arguments[2];return t&&(0,ht.isObjectExpression)(t)?t:void 0}function Nx(e){for(let t of e.properties){if(!(0,ht.isObjectProperty)(t)||t.computed)continue;if(((0,ht.isIdentifier)(t.key,{name:"__wfId"})||(0,ht.isStringLiteral)(t.key)&&t.key.value==="__wfId")&&(0,ht.isStringLiteral)(t.value))return t}}function jx(e){let t=[];for(let n of Hr(e.program)){let r=b$(n);r&&t.push(r)}return t.sort((n,r)=>(n.call.start??0)-(r.call.start??0))}function zu(e){let t=Zt(e);if(!t)return{sugared:e,entries:[]};let n=[],r=[];for(let{ident:o,call:i}of jx(t)){let s=Lx(i);if(!s)continue;let a=Nx(s);if(!a||!(0,ht.isStringLiteral)(a.value))continue;let l=i.arguments[1];if(!(a.start==null||a.end==null))if(n.push({ident:o,wfId:a.value.value}),s.properties.length===1){if(l?.end==null||s.end==null)continue;r.push({start:l.end,end:s.end,text:""})}else{let c=s.properties[1];if(c?.start==null)continue;r.push({start:a.start,end:c.start,text:""})}}return r.length===0?{sugared:e,entries:[]}:{sugared:Vr(e,r),entries:n}}function Mx(e,t){let n=Zt(e);if(!n)return{desugared:e,hasNewStyles:!1};let r=new Map(t.map(s=>[s.ident,s])),o=[],i=!1;for(let{ident:s,call:a}of jx(n)){let l=Lx(a);if(l&&Nx(l))continue;let c=r.get(s);if(!c){i=!0;continue}let d=JSON.stringify(c.wfId);if(l){let p=l.properties[0];p?.start!=null?o.push({start:p.start,end:p.start,text:`__wfId: ${d}, `}):l.start!=null&&o.push({start:l.start+1,end:l.start+1,text:` __wfId: ${d} `})}else{let p=a.arguments[1];p?.end!=null&&o.push({start:p.end,end:p.end,text:`, { __wfId: ${d} }`})}}return{desugared:Vr(e,o),hasNewStyles:i}}var Kr=require("fs"),ws=require("path"),Xx=w(require("fast-glob"));C();var Bx=require("crypto"),yt=require("fs"),Uo=require("path");C();var Gr=".webflow/wfs";function hn(e){return(0,Bx.createHash)("sha256").update(e,"utf8").digest("hex")}function Ux(e){return(0,Uo.join)(e,Gr,"index.json")}function dh(e,t){return Bo(t)?(0,Uo.join)(e,Gr,`${t}.json`):void 0}function Wx(e){let t=Ux(e);if((0,yt.existsSync)(t))try{let n=JSON.parse((0,yt.readFileSync)(t,"utf8"));return!n||typeof n.schemaHash!="string"||!Array.isArray(n.files)?"corrupt":{...typeof n.siteId=="string"?{siteId:n.siteId}:{},schemaHash:n.schemaHash,files:n.files}}catch{return"corrupt"}}function qu(e=process.cwd()){let t=Wx(e);if(t===void 0)return{kind:"missing"};if(t==="corrupt")return{kind:"corrupt",reason:`${Gr}/index.json could not be read`};let n={},r=[];for(let{wirePath:o}of t.files){let i=dh(e,o);if(!i){r.push(o);continue}if(!(0,yt.existsSync)(i)){r.push(o);continue}try{let s=JSON.parse((0,yt.readFileSync)(i,"utf8"));if(s.localPath!==void 0&&!Bo(s.localPath)){r.push(o);continue}n[o]=s}catch{r.push(o)}}return{kind:"ok",lockfile:{...t.siteId?{siteId:t.siteId}:{},schemaHash:t.schemaHash,files:n},corruptPaths:r}}function sl(e,t=process.cwd()){let n=Wx(t),r=new Set(n&&n!=="corrupt"?n.files.map(s=>s.wirePath):[]);for(let s of Object.keys(e.files).sort()){let a=dh(t,s);if(!a)throw new f(`Refusing to write a lock entry outside ${Gr}: "${s}"`);(0,yt.mkdirSync)((0,Uo.dirname)(a),{recursive:!0}),(0,yt.writeFileSync)(a,`${JSON.stringify(e.files[s],null,2)}
|
|
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
|
+
`,"utf8")}function Hx(e=process.cwd()){(0,yt.rmSync)((0,Uo.join)(e,Gr),{recursive:!0,force:!0})}C();function Vx(e){if(!Bo(e))throw new f(`Refusing to write unsafe path from server: "${e}"`)}var D$=/^site\/pages\/([A-Za-z0-9_-]+)\.[A-Za-z0-9.]+$/;function al(e){return D$.exec(e)?.[1]}var Gx=/^site\/components\/(?:([^/]+)\/)?([^/]+)\.tsw$/;function k$(e){return Gx.exec(e)?.[2]}function E$(e){let t=Gx.exec(e);return t?t[1]??"":void 0}function fh(e,t=""){return t?`site/components/${t}/${e}.tsw`:`site/components/${e}.tsw`}function mh(e,t){return!e.startsWith(`${t}/`)||!e.endsWith(".tsw")?void 0:e.slice(e.lastIndexOf("/")+1).slice(0,-4)}function gh(e,t){let r=e.slice(t.length+1).split("/");if(r.length===1)return"";if(r.length===2)return r[0]}function Kx(e,t){if(t.pagesShape==="nested"){let r=e.isDefault?[]:[...e.folderSegments,e.slug];return r.length>0?`${t.pagesRoot}/${r.join("/")}/page.tsw`:`${t.pagesRoot}/page.tsw`}let n=e.isDefault?["index"]:[...e.folderSegments,e.slug];return`${t.pagesRoot}/${n.join("/")}.tsw`}function hh(e,t,n){if(n)return n;let r=k$(e);if(!r)return;let o=E$(e)??"";return o?`${t.componentsRoot}/${o}/${r}.tsw`:`${t.componentsRoot}/${r}.tsw`}function Jx(e,t){let n=mh(e,t);if(!n)return;let r=gh(e,t);if(r!==void 0)return fh(n,r)}var ph="site/theme/";function zx(e,t){if(e.startsWith(ph))return`${t.themeRoot}/${e.slice(ph.length)}`}function Xu(e,t){let n=`${t}/`;if(e.startsWith(n))return`${ph}${e.slice(n.length)}`}async function Yx(e,t,n=process.cwd(),r=!1){let o=[],i=[],s=[],a=[],l=[],c=[],d={},p=new Map,m=new Map;for(let[y,b]of Object.entries(e.files)){let S=b.localPath??y;p.set(y,S),m.set(S,y)}let h=new Set((await(0,Xx.default)([`${t.pagesRoot}/**/*.tsw`,`${t.componentsRoot}/**/*.tsw`,`${t.themeRoot}/*.tsw`,"site/**"],{cwd:n,onlyFiles:!0,dot:!1})).map(ih)),g=new Map;for(let y of Object.keys(e.files).sort()){let b=e.files[y],S=p.get(y);if(b.deletedUpstream){(0,Kr.existsSync)((0,ws.join)(n,S))&&c.push(S);continue}if(!(0,Kr.existsSync)((0,ws.join)(n,S))){i.push(S),g.set(b.contentSha256,S);continue}d[y]=S;let _=(0,Kr.readFileSync)((0,ws.join)(n,S),"utf8");(r||hn(_)!==b.contentSha256)&&o.push({path:y,content:_,baseHash:b.serverHash})}for(let y of[...h].sort()){if(m.has(y))continue;let b=(0,Kr.readFileSync)((0,ws.join)(n,y),"utf8"),S=g.get(hn(b));if(S!==void 0){s.push({oldPath:S,newPath:y});continue}let _=S$(y,t);if(_.kind==="unmappable"){a.push(y);continue}let{wirePath:v}=_,x=p.get(v);if(x!==void 0&&x!==y){l.push(y);continue}d[v]=y;let O=e.files[v];o.push(O?{path:v,content:b,baseHash:O.serverHash}:{path:v,content:b})}return{changes:o,missing:i,renameCandidates:s,unmappable:a,stale:l,orphanedUpstream:c,localPaths:d}}function S$(e,t){if(e.startsWith(`${t.componentsRoot}/`)){let r=mh(e,t.componentsRoot);if(!r)return{kind:"unmappable"};let o=gh(e,t.componentsRoot);return o===void 0?{kind:"unmappable"}:{kind:"component",wirePath:fh(r,o)}}let n=Xu(e,t.themeRoot);return n!==void 0?{kind:"theme",wirePath:n}:e.startsWith(`${t.pagesRoot}/`)?{kind:"unmappable"}:{kind:"global",wirePath:e}}function Yu(e){let t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20));return t}function Zx(e){let t=e.filter(a=>!al(a.path)),n=new Map;for(let a of e){let l=al(a.path);if(!l)continue;let c=n.get(l)??[];c.push(a),n.set(l,c)}let r=n.size>0?199:200;if(t.length>r)throw new f(`Too many changed site-global files to push in one request (${t.length} > ${r}). Run \`webflow sites push\` without --force to send only the files that changed, then use --force just for the ones that still conflict.`,{isUserError:!0});let o=[],i=[...t],s=0;for(let[,a]of n)!(s<20&&i.length+a.length<=200)&&(i.length>0||s>0)&&(o.push(i),i=[],s=0),i.push(...a),s+=1;return i.length>0&&o.push(i),o}function Zu(e,t=process.cwd()){let n=(0,ws.join)(t,e);if((0,Kr.existsSync)(n))return(0,Kr.readFileSync)(n,"utf8")}var x$="site/current-page.tsw";function Qu(e){return al(e)!==void 0?x$:e}function C$(e,t){let n=e.split("/").slice(0,-1);for(let r of t.split("/"))if(!(r===""||r===".")){if(r===".."){n.length>0&&n.pop();continue}n.push(r)}return n.join("/")}function F$(e,t){let n=e.split("/").slice(0,-1),r=t.split("/"),o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;let i=n.length-o,s=r.slice(o).join("/");return i>0?`${"../".repeat(i)}${s}`:`./${s}`}function ed(e,t,n,r){let o=Zt(e);if(!o)return e;let i=[];for(let s of o.program.body){if(s.type!=="ImportDeclaration")continue;let a=s.source;if(a.start==null||a.end==null)continue;let l=a.value;if(!l.endsWith(".tsw")||!l.startsWith("./")&&!l.startsWith("../"))continue;let c=r(C$(t,l));if(c===void 0)continue;let d=F$(n,c);if(d===l)continue;let p=e[a.start],m=p==="'"||p==='"'?`${p}${d}${p}`:JSON.stringify(d);i.push({start:a.start,end:a.end,text:m})}return Vr(e,i)}function _$(e,t){return n=>t[n]??e.files[n]?.localPath??n}function A$(e,t){let n=e.outcome==="committed"||e.outcome==="noop"?P:k,i=Object.keys(e.hashes??e.currentHashes??{}).map(t).find(a=>a.endsWith(".tsw"))??`page ${e.pageId}`,s=[`${n} ${i}: ${e.outcome}`];if(e.outcome==="conflict")for(let a of Object.keys(e.currentHashes??{}))s.push(I(` ${t(a)} changed upstream \u2014 run \`webflow sites pull\`, re-apply your edit, and push again (or push with --force to overwrite).`));e.outcome==="skipped"&&s.push(I(" an earlier change carrying site-global files failed to commit in this push, so this page was never attempted \u2014 resolve the issue above and push again.")),e.error&&s.push(I(` ${e.error}`));for(let a of e.rejected??[])s.push(` ${Q} ${t(a.path)} rejected (${a.code}): ${a.reason}`);return s.join(`
|
|
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
216
|
`)?`"${s.replace(/"/g,'""')}"`:s};return[n.join(","),...e.map(i=>n.map(s=>r(s==="id"?i.id:s==="formId"?i.formId:s==="displayName"?i.displayName:s==="dateSubmitted"?i.dateSubmitted:i.formResponse[s])).join(","))].join(`
|
|
217
|
-
`)}async function
|
|
217
|
+
`)}async function bh(e){Z(e.site,"siteId");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await tC(t,e.site);if(await n.sendUsage("forms_list",{duration:Date.now()-r,count:o.length}),e.json){u.info(JSON.stringify(o,null,2));return}if(o.length===0){u.info("No forms found.");return}let i=_e(e.fields,rC,oC());u.info(iC(o,i))}catch(o){throw o instanceof f&&o.isUserError?o:(await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_list",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to list forms:`}))}}var lC=w(require("fs"));q();C();A();M();X();async function Dh(e){Z(e.site,"siteId"),Z(e.form,"formId"),e.output&&e.json&&u.warn("--json is ignored when --output is set.");let t=await T(),n=F.forForms({authToken:t}),r=Date.now();try{let o=await nC(t,e.site,e.form);if(await n.sendUsage("forms_submissions",{duration:Date.now()-r,count:o.length}),o.length===0){u.info("No submissions found.");return}if(e.output){let i=aC(o);lC.default.writeFileSync(e.output,i,"utf8"),u.info(`${P} ${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(sC(o))}catch(o){throw await n.sendError(o instanceof Error?o:new Error(String(o)),"forms_submissions",{duration:Date.now()-r}),new f(o,{prefix:`${k} Failed to fetch submissions:`})}}var cC=e=>{let t=e.command("forms").description("Manage Webflow forms");t.command("list").description("List all forms for a site").addOption(It()).addOption(ee()).addOption(He(["id","displayName","name","slug","createdOn","lastUpdated"]).default("id,displayName,slug")).action(bh),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(Dh)};var jh=w(require("fs")),Mh=w(require("path"));A();var Ko=w(require("fs")),Go=w(require("path")),id=w(require("tar"));C();A();var Eh=w(require("fs")),Jr=w(require("path"));C();var J$=[/\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],z$=/[\r\n\u2028\u2029]+/g;function kh(e){if(e==null)return"";let t=String(e);for(let n of J$)t=t.replace(n,"");return t}function D(e){return kh(e).replace(z$," ").trim()}var uC={impl:Jr.default.posix,caseInsensitive:!1},vh={impl:Jr.default.win32,caseInsensitive:!0};function Vo(){let e=process.platform;return e==="win32"?vh:{impl:Jr.default.posix,caseInsensitive:e==="darwin"}}function rd(e,t){let n=t.impl.resolve(e);return t.caseInsensitive?n.toLowerCase():n}function zr(e){return typeof e!="string"||e.trim()===""||e.includes("\0")}function ot(e,t,n=Vo()){if(zr(e)||zr(t))return!1;let r=rd(e,n),o=rd(t,n);if(r===o)return!0;let i=n.impl.relative(r,o);return i===""?!0:n.impl.isAbsolute(i)?!1:!i.split(/[\\/]/).some(s=>s===".."||s==="")}async function od(e,t,n=Vo()){if(zr(e)||zr(t))return!1;let[r,o]=await Promise.all([yn(e),yn(t)]);return ot(r,o,n)}function Ue(e,t,n,r=Vo()){if(!ot(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside.
|
|
218
218
|
expected inside: ${D(e)}
|
|
219
219
|
resolved to: ${D(t)}
|
|
220
|
-
Please report this.`)}async function
|
|
220
|
+
Please report this.`)}async function bs(e,t,n,r=Vo()){if(!await od(e,t,r))throw new f(`Refusing to continue: ${n} resolves outside the directory it must stay inside once symlinks are followed.
|
|
221
221
|
expected inside: ${D(e)}
|
|
222
222
|
resolved to: ${D(t)}
|
|
223
|
-
Please report this.`)}function
|
|
224
|
-
${
|
|
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(`
|
|
225
225
|
`)}
|
|
226
|
-
Nothing was extracted. Please report this.`)}function
|
|
227
|
-
${
|
|
226
|
+
Nothing was extracted. Please report this.`)}function lO(e,t){return new f(`Refusing to continue: the downloaded archive changed while it was being read. ${t} ${t===1?"entry":"entries"} that passed validation would not have passed it on the second read.
|
|
227
|
+
${kC(e,t).join(`
|
|
228
228
|
`)}
|
|
229
|
-
The extracted directory cannot be trusted. Please retry.`)}function
|
|
229
|
+
The extracted directory cannot be trusted. Please retry.`)}function kC(e,t){let n=e.slice(0,xh),r=n.map(i=>` - "${D(i.entryPath)}": ${i.reason}`),o=t-n.length;return o>0&&r.push(` \u2026 and ${o} more.`),r}function EC(e,t){let n=e.slice(0,xh).map(o=>` - ${o.code}: ${o.message}`),r=t-Math.min(e.length,xh);return r>0&&n.push(` \u2026 and ${r} more.`),new f(`The downloaded archive could not be read safely and was rejected: ${t} ${t===1?"problem":"problems"} found.
|
|
230
230
|
${n.join(`
|
|
231
231
|
`)}
|
|
232
|
-
This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var
|
|
232
|
+
This usually means the download was corrupted \u2014 retrying often fixes it. If it persists, please report this.`)}var cO="webflow",_h="webflow-skills",he=`${cO}/${_h}`,Ge="main",sd=`plugins/${_h}`,lr=`${sd}/.claude-plugin/plugin.json`,Ah=[`${sd}/skills`,"skills"],vC=[`${sd}/skills`,`${sd}/.claude-plugin`];function SC(e){return`${_h}-${e}`}var Qt=/^[0-9a-f]{40}$/,ad=/^[A-Za-z0-9._/-]{1,255}$/,uO=["webflow-mcp","webflow-cli","webflow-code-component","webflow-university"];function xC(e){let t=e.split(":",1)[0];return uO.includes(t)}var $t="https://api.github.com",Jo="https://codeload.github.com";var CC="skills",ld="download-",cd="extract-";var ur=w(require("fs")),pd=w(require("path"));ea();C();A();C();function _C(e){let t=n=>Math.round(n*10)/10;return e>=1024*1024?`${t(e/(1024*1024))} MiB`:e>=1024?`${t(e/1024)} KiB`:`${e} bytes`}function wn(e){try{return new URL(e).hostname}catch{return e}}function dO(e){return new f(`Could not find ref "${D(e)}" in ${he}.
|
|
233
233
|
\u2022 The default branch is "${Ge}".
|
|
234
234
|
\u2022 This repo has no tags or releases yet, so "--ref v1.0.7" will not resolve.
|
|
235
|
-
\u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function
|
|
236
|
-
\u2022 Retry after ${
|
|
235
|
+
\u2022 Pass a branch name or a full 40-character commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function pO(e){if(!e)return"a few minutes";let t=Number(e);if(!Number.isFinite(t)||t<=0)return"a few minutes";let n=new Date(t*1e3);if(Number.isNaN(n.getTime()))return"a few minutes";let r=String(n.getHours()).padStart(2,"0"),o=String(n.getMinutes()).padStart(2,"0");return`${r}:${o} local time`}function fO(e){return new f(`GitHub API rate limit reached (60 requests/hour per IP for unauthenticated calls).
|
|
236
|
+
\u2022 Retry after ${pO(e)}.
|
|
237
237
|
\u2022 Or set GITHUB_TOKEN / GH_TOKEN in your environment to raise the limit to 5,000/hour.
|
|
238
|
-
\u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function
|
|
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
|
|
238
|
+
\u2022 Shared CI runners and corporate NAT hit this quickly.`,{isUserError:!0})}function mO(){return new f(`GitHub refused the request (403). This is a permission error, not a rate limit.
|
|
239
|
+
\u2022 If you are behind a proxy that filters ${wn($t)}, set HTTPS_PROXY.
|
|
240
|
+
\u2022 If GITHUB_TOKEN or GH_TOKEN is set, check that it is not expired or revoked.`,{isUserError:!0})}function gO(e,t){return new f(`${wn(e)} returned ${t} twice. This is usually transient \u2014 try again shortly.`)}function hO(e,t,n){return new f(`${wn(e)} returned an unexpected ${t} ${D(n)} response. Please report this if it persists.`)}function Es(e,t,n){let{status:r}=t;if(r===404)return dO(n??Ge);let o=t.headers.get("x-ratelimit-remaining");return r===429||r===403&&o==="0"?fO(t.headers.get("x-ratelimit-reset")):r===403?mO():r>=500?gO(e,r):hO(e,r,t.statusText)}function AC(e){let t=e?wn(e):"an unnamed host";return new f(`Refusing to follow a redirect to ${D(t)} while a GitHub token is attached, because the token would be re-sent to that host. Unset GITHUB_TOKEN / GH_TOKEN to retry unauthenticated, or report this if ${wn($t)} is genuinely redirecting.`,{isUserError:!0})}function FC(e,t){return new f(`Could not reach ${wn(e)}${t?` (${t})`:""}.
|
|
241
241
|
\u2022 Check your network connection.
|
|
242
242
|
\u2022 Behind a corporate proxy, set HTTPS_PROXY. Note that the CLI's HTTP client does not read proxy environment variables automatically.
|
|
243
|
-
\u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function
|
|
243
|
+
\u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function ud(e,t){return new f(`Timed out after ${Math.round(t/1e3)}s waiting for ${wn(e)}.
|
|
244
244
|
\u2022 Check your network connection, then retry.
|
|
245
245
|
\u2022 Behind a corporate proxy, set HTTPS_PROXY.
|
|
246
|
-
\u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function
|
|
247
|
-
\u2022 Retry without --ref to take the current "${Ge}".`,{isUserError:!0})}function
|
|
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 EC(e,t){let n=t.length===0?"nothing":t.map(r=>`"${D(r)}"`).join(", ");return new f(`The skills catalog archive did not have the expected layout: expected exactly one top-level directory named "${e}", found ${n}. Please report this.`)}var oO=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ECONNRESET","EHOSTUNREACH","ENETUNREACH","EPIPE","EPROTO","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","CERT_HAS_EXPIRED"]);function iO(e){if(typeof e!="object"||e===null)return;let t=e;if(typeof t.code=="string")return t.code;if(typeof t.errno=="string")return t.errno}function rl(e,t,n){if(n instanceof f)return n;let r=iO(n);if(r==="ENOSPC"||r==="EDQUOT"||r==="EFBIG")return tl("writing the skills catalog");if(r&&oO.has(r))return gC(e,r);let o=n?.type;if(o==="request-timeout")return od(e,t);if(o==="max-size")return id();let i=n instanceof Error?n.message:String(n);return/network timeout|timed? ?out/i.test(i)?od(e,t):/getaddrinfo|ENOTFOUND|EAI_AGAIN|ECONNREFUSED/i.test(i)?gC(e,""):new f(`Could not fetch the skills catalog from ${gn(e)}: ${D(i)}`)}function ys(){return sd.default.join(_b(),mC)}function Dh(e){if(!Zt.test(e))throw hs(e);return sd.default.join(ys(),e)}async function ol(){let e=ys();try{return await lr.default.promises.mkdir(e,{recursive:!0,mode:448}),await lr.default.promises.realpath(e)}catch(t){throw t.code==="ENOSPC"?tl("creating the skills cache directory"):new f(`Could not create the skills cache directory "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}async function kh(e){let t=Dh(e),n;try{n=await lr.default.promises.lstat(t)}catch(r){return r.code==="ENOENT"||u.debug(`Could not inspect skills cache entry: ${r instanceof Error?r.message:String(r)}`),null}if(n.isSymbolicLink())throw new f(`Refusing to use the skills cache: "${D(t)}" is a symbolic link, so reading it would install whatever it points at. Remove it and retry.`);return n.isDirectory()?t:(u.debug(`Skills cache entry for ${e} is not a directory; treating as a miss.`),null)}var aO=new Set(["EEXIST","ENOTEMPTY","EPERM","EACCES"]);async function lO(e){try{return(await lr.default.promises.lstat(e)).isDirectory()}catch{return!1}}async function Eh(e,t){let n=Dh(e),r=ys();await ps(r,n,"the skills cache entry"),await ps(r,t,"the extracted skills catalog being published");try{return await lr.default.promises.rename(t,n),{dir:n,published:!0}}catch(o){let i=o.code;if(i==="ENOSPC")throw tl("publishing the skills catalog to the cache");if(i!==void 0&&aO.has(i)&&await lO(n))return u.debug(`Skills cache entry for ${e} appeared concurrently; reusing it.`),{dir:n,published:!1};throw new f(`Could not publish the extracted skills catalog to the cache: ${o instanceof Error?o.message:String(o)}`)}}async function Go(e){await ps(ys(),e,"the skills cache path being removed");try{await lr.default.promises.rm(e,{recursive:!0,force:!0})}catch(t){u.debug(`Could not remove skills cache path "${D(e)}": ${t instanceof Error?t.message:String(t)}`)}}function cO(e){return Zt.test(e)||e.startsWith(nd)||e.startsWith(rd)}async function ad(e){let t=ys(),n;try{n=await lr.default.promises.readdir(t,{withFileTypes:!0})}catch(o){o.code!=="ENOENT"&&u.debug(`Skills cache sweep skipped: ${o instanceof Error?o.message:String(o)}`);return}let r=Date.now()-6048e5;for(let o of n){if(o.name===e||!cO(o.name))continue;let i=sd.default.join(t,o.name);try{if((await lr.default.promises.lstat(i)).mtimeMs>=r)continue;await Go(i),u.debug(`Swept stale skills cache entry "${o.name}".`)}catch(s){u.debug(`Skills cache sweep could not handle "${o.name}": ${s instanceof Error?s.message:String(s)}`)}}}var xh=w(require("fs")),vh=w(require("path")),xC=require("stream"),CC=require("stream/promises");lt();A();var uO="catalog.tar.gz",il=class extends Error{constructor(){super("skills catalog download exceeded its time budget"),this.name="DownloadDeadlineExceeded"}},ld=class extends Error{constructor(){super("skills catalog download exceeded its byte cap"),this.name="DownloadCapExceeded"}},Sh=class extends xC.Transform{constructor(n){super();this.cap=n}bytes=0;_transform(n,r,o){let i=Buffer.isBuffer(n)?n:Buffer.from(n);if(this.bytes+=i.length,this.bytes>this.cap){o(new ld);return}o(null,i)}};async function Ch(e){if(!Zt.test(e))throw hs(e);let t=await ol(),n=await xh.default.promises.mkdtemp(vh.default.join(t,nd)),r=vh.default.join(n,uO),o=`${Vo}/${he}/tar.gz/${e}`;try{let i=await dO(o,e),s=await pO(i,r);return u.debug(`Downloaded skills catalog ${e} (${s} bytes).`),{tarPath:r,downloadDir:n,bytes:s}}catch(i){throw await Go(n),rl(Vo,6e4,i)}}async function dO(e,t){let n=0;for(let r=0;r<2;r+=1){let o=await G(e,{headers:{Accept:"application/x-gzip"},timeout:6e4});if(o.ok){let i=Number(o.headers.get("content-length"));if(Number.isFinite(i)&&i>33554432)throw id();return o}if(o.status>=500&&r===0){n=o.status,u.debug(`codeload.github.com returned ${o.status}; retrying once in ${1e3}ms.`),await new Promise(i=>{setTimeout(i,1e3)});continue}throw o.status===404?wC(t):gs(Vo,o)}throw gs(Vo,{status:n||500,statusText:"Server Error",headers:{get:()=>null}})}async function pO(e,t){let n=e.body;if(!n)throw bC();let r=new Sh(33554432),o=setTimeout(()=>{n.destroy?.(new il),r.destroy(new il)},6e4);o.unref?.();try{await(0,CC.pipeline)(n,r,xh.default.createWriteStream(t,{mode:384}))}catch(i){throw SC(i,ld)?id():SC(i,il)?od(Vo,6e4):i}finally{clearTimeout(o)}return r.bytes}function SC(e,t){if(e instanceof t)return!0;if(e instanceof Error){if(e.name===t.name)return!0;let n=e.cause;if(n instanceof t||n instanceof Error&&n.name===t.name)return!0}return!1}lt();A();var fO=["GITHUB_TOKEN","GH_TOKEN"];function mO(){for(let e of fO){let t=(process.env[e]??"").trim();if(t!=="")return t}return null}function gO(e){if(e==="")throw ar(e,"it is empty");if(!td.test(e))throw ar(e,"refs may only contain letters, digits, '.', '_', '-' and '/', and must be at most 255 characters");if(e.startsWith("-"))throw ar(e,"it starts with '-'");if(e.includes(".."))throw ar(e,"it contains '..'");if(e.endsWith(".lock"))throw ar(e,"it ends with '.lock'");if(e.startsWith("/")||e.endsWith("/"))throw ar(e,"it starts or ends with '/'");if(e.includes("//"))throw ar(e,"it contains '//'");for(let t of e.split("/"))if(t.endsWith("."))throw ar(e,"a path component ends with '.'")}function hO(e){return e.split("/").map(encodeURIComponent).join("/")}function yO(e){return new Promise(t=>{setTimeout(t,e)})}async function ll(e=Ge){if(Zt.test(e))return u.debug(`Skills ref "${e}" is already a full commit SHA.`),{ref:e,commit:e,resolvedOffline:!0};gO(e);let t=mO(),n=`${$t}/repos/${he}/commits/${hO(e)}`;u.debug(`Resolving skills ref "${e}" via api.github.com (${t?"authenticated":"unauthenticated"}).`);let r=await wO(n,e,t),o=await DO(r);return u.debug(`Skills ref "${e}" resolved to ${o}.`),{ref:e,commit:o,resolvedOffline:!1}}async function wO(e,t,n){let r=null;for(let o=0;o<2;o+=1){let i;try{i=await G(e,{headers:{Accept:"application/vnd.github.sha",...n?{Authorization:`Bearer ${n}`}:{}},timeout:1e4,...n?{redirect:"manual"}:{}})}catch(s){throw rl($t,1e4,s)}if(n&&i.status>=300&&i.status<400)throw yC(i.headers.get("location"));if(i.ok)return i;if(i.status>=500&&(r=i.status,o===0)){u.debug(`api.github.com returned ${i.status}; retrying once in ${1e3}ms.`),await yO(1e3);continue}throw gs($t,i,t)}throw gs($t,{status:r??500,statusText:"Server Error",headers:{get:()=>null}},t)}var ud=class extends Error{constructor(){super("ref lookup response exceeded its byte cap"),this.name="RefResponseTooLarge"}};async function bO(e){let t=e.body;if(!t)return"";let n=[],r=0;for await(let o of t){let i=Buffer.isBuffer(o)?o:Buffer.from(o);if(r+=i.length,r>4096)throw new ud;n.push(i)}return Buffer.concat(n).toString("utf8")}async function DO(e){let t;try{t=await bO(e)}catch(r){throw r instanceof ud?kC():rl($t,1e4,r)}let n=t.trim();if(!Zt.test(n))throw DC();return n}async function ws(e={}){let t=await kO(e),{commit:n,ref:r}=t,o=await kh(n);if(o)return u.debug(`Using cached skills catalog for ${n}.`),await ad(n),{ref:r,commit:n,root:o,fromCache:!0,skippedEntries:[],downloadedBytes:0};let i=await EO(n);return await ad(n),{ref:r,commit:n,...i}}async function kO(e){if(e.commit!==void 0){if(!Zt.test(e.commit))throw hs(e.commit);return{ref:e.ref??e.commit,commit:e.commit,resolvedOffline:!0}}return ll(e.ref)}async function EO(e){let t=await ol(),n=await Ch(e),r=await Fh.default.promises.mkdtemp(_h.default.join(t,rd));try{let o=await oC(n.tarPath,r,{strip:0,containmentRoot:t,consumedSubtrees:dC,limits:{maxUnpackedBytes:26214400,maxFiles:2e3,maxEntryBytes:4194304}}),i=await vO(r,e),{dir:s,published:a}=await Eh(e,i);return u.debug(`Extracted skills catalog ${e}: ${o.fileCount} files, ${o.unpackedBytes} bytes, ${o.skipped.length} entries skipped${a?"":" (another process published first)"}.`),{root:s,fromCache:!1,skippedEntries:o.skipped,downloadedBytes:n.bytes}}finally{await Go(r),await Go(n.downloadDir)}}async function vO(e,t){let n=pC(t),r=await Fh.default.promises.readdir(e,{withFileTypes:!0}),o=r.filter(i=>i.isDirectory());if(r.length!==1||o.length!==1||o[0].name!==n)throw EC(n,r.map(i=>i.name));return _h.default.join(e,n)}var Ko=`https://github.com/${he}/issues`,Ot="SKILL.md",cl=new Set([".git","node_modules","__pycache__",".DS_Store"]),Jo=new Set([".git","node_modules","__pycache__"]),zo=new Set([".DS_Store","Thumbs.db"]),qo=8,dd=512,pd=128,RC=1024,IC=32,TC=256,PC=64,$C=64,Ah=/^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$/,OC=256,LC=4;var Rh=w(require("fs")),bs=w(require("path"));C();async function Ds(e){let t=bs.default.join(e,...sr.split("/"));Ue(e,t,"the catalog plugin manifest");let n;try{n=await Rh.default.promises.readFile(t,"utf8")}catch(i){if(!CO(i))throw new f(`Failed to read the catalog manifest at ${sr}: ${i instanceof Error?i.message:String(i)}`)}if(n===void 0)return{...await NC(e),version:"",source:"fallback"};let r=xO(n);if(r.skills===void 0)return{...await NC(e),version:r.version,source:"fallback"};let o=await SO(t,r.skills,e);if(!o)throw new f(`The catalog manifest at ${sr} declares its skills directory as "${D(r.skills)}", which does not exist in the downloaded catalog. This is a bug in ${he}. Please report it.`);return{version:r.version,skillsDir:o.skillsDir,source:"manifest",warnings:o.warnings}}async function SO(e,t,n){let r=bs.default.dirname(e),o=[{base:bs.default.dirname(r),relativeTo:"plugin root"},{base:r,relativeTo:"manifest directory"}];for(let[i,s]of o.entries()){let a=bs.default.resolve(s.base,t);if(Ue(n,a,"the catalog skills directory"),!!await jC(a))return{skillsDir:a,warnings:i===0?[]:[`The catalog manifest at ${sr} declares "skills": "${D(t)}", which only resolves relative to the ${s.relativeTo}. This means ${he} changed its layout; please report it at ${Ko}.`]}}}function xO(e){let t;try{t=JSON.parse(e)}catch(o){throw new f(`The catalog manifest at ${sr} is not valid JSON: ${o instanceof Error?o.message:String(o)}. This is a bug in ${he}. Please report it.`)}if(t===null||typeof t!="object"||Array.isArray(t))throw new f(`The catalog manifest at ${sr} is not a JSON object. This is a bug in ${he}. Please report it.`);let n=t,r=n.skills;if(r!==void 0&&(typeof r!="string"||r.trim()===""))throw new f(`The catalog manifest at ${sr} declares "skills" as ${FO(r)}, but it must be a non-empty string. This is a bug in ${he}. Please report it.`);return{version:typeof n.version=="string"?n.version.trim():"",skills:typeof r=="string"?r:void 0}}async function NC(e){for(let t of wh){let n=bs.default.join(e,...t.split("/"));if(Ue(e,n,"the catalog skills directory"),!!await jC(n))return{skillsDir:n,warnings:[`Catalog manifest not found \u2014 falling back to ${t}. This means ${he} changed its layout; please report it at ${Ko}.`]}}throw new f(`The downloaded catalog has no skills directory: ${sr} is absent and none of ${wh.join(", ")} exists. This is a bug in ${he}. Please report it.`)}async function jC(e){try{return(await Rh.default.promises.stat(e)).isDirectory()}catch{return!1}}function CO(e){return typeof e=="object"&&e!==null&&e.code==="ENOENT"}function FO(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="string"?"an empty string":typeof e=="object"?"an object":`a ${typeof e}`}var MC=require("yaml");var Lt=class extends Error{reason;constructor(t){super(t),this.name="SkillParseError",this.reason=t}},_O=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?([\s\S]*)$/,AO=/^\uFEFF/,RO="frontmatter delimiters found but not parseable (check for a byte-order mark or stray whitespace on the --- lines)",BC="\u2014 wrap the value in double quotes",IO={version:"1.2",logLevel:"silent",prettyErrors:!1,uniqueKeys:!0},TO=100,PO=j.object({name:j.string().trim().min(1).max(pd),description:j.string().trim().min(1).max(RC),"mcp-version":j.string().max(IC).optional(),compatibility:j.string().max(TC).optional(),license:j.string().max(PC).optional(),metadata:j.record(j.unknown()).optional()}).passthrough(),Ih=["name","description"];function Xo(e){let t=e.replace(AO,""),n=_O.exec(t);if(!n){if(t.trimStart().startsWith("---"))throw new Lt(RO);return{frontmatter:Th({}),body:t,raw:e}}let r=n[1]??"",o=n[2]??"",i=$O(r,1);return{frontmatter:Th(i),body:o,raw:e}}function $O(e,t){let n=(0,MC.parseDocument)(e,IO),[r]=n.errors;if(r)throw new Lt(OO(r,e,t));let o;try{o=n.toJS({maxAliasCount:TO})}catch(i){throw new Lt(`YAML parse error: ${i instanceof Error?i.message:String(i)}`)}if(o==null)return{};if(typeof o!="object"||Array.isArray(o)||o instanceof Date)throw new Lt(`frontmatter is not a YAML mapping (parsed as ${Ph(o)})`);return o}function OO(e,t,n){let r=e.pos?.[0],o="",i="";if(typeof r=="number"&&r>=0){let a=t.slice(0,r),l=a.split(`
|
|
246
|
+
\u2022 Already-installed skills are unaffected; "webflow skills list" works offline.`,{isUserError:!0})}function dd(){return new f(`The skills catalog download exceeded ${_C(33554432)}. This is unexpected for a documentation repository \u2014 please report it.`)}function RC(e){return new f(`Commit ${D(e)} of ${he} is no longer downloadable. It was resolvable a moment ago, so the branch was probably force-pushed.
|
|
247
|
+
\u2022 Retry without --ref to take the current "${Ge}".`,{isUserError:!0})}function IC(){return new f("The skills catalog download returned no response body. Please retry.")}function ll(e){return new f(`Ran out of disk space while ${e}. Free some space and retry.`,{isUserError:!0})}function TC(){return new f(`${wn($t)} answered the ref lookup with something that is not a 40-character commit SHA. Refusing to guess at what to install. Please report this if it persists.`)}function PC(){return new f(`${wn($t)} answered the ref lookup with more than ${_C(4096)}, so it is not the bare commit SHA this endpoint returns. Refusing to guess at what to install.
|
|
248
|
+
\u2022 If a proxy is intercepting ${wn($t)} and serving its own page, set HTTPS_PROXY to the proxy itself.`,{isUserError:!0})}function vs(e){return new f(`Expected a full 40-character commit SHA but got "${D(e)}".`,{isUserError:!0,missingFlag:"--ref"})}function cr(e,t){return new f(`Invalid --ref "${D(e)}": ${t}.
|
|
249
|
+
\u2022 Pass a branch name (e.g. "${Ge}") or a commit SHA.`,{isUserError:!0,missingFlag:"--ref"})}function $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
250
|
`).length,c=r-(a.lastIndexOf(`
|
|
251
|
-
`)+1)+1;o=` at line ${l+n}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${
|
|
251
|
+
`)+1)+1;o=` at line ${l+n}, column ${c}`,i=t.split(/\r?\n/)[l-1]??""}let s=i.includes(": ")?` ${ZC}`:"";return`YAML parse error: ${e.message}${o}${s}`}function Hh(e){if(e===null||typeof e!="object"||Array.isArray(e)||e instanceof Date)throw new Lt(`frontmatter is not a YAML mapping (parsed as ${Vh(e)})`);let t={...e},n=Wh.filter(i=>!(i in t)||t[i]===void 0);if(n.length>0)throw new Lt(`missing required frontmatter field(s): ${n.join(", ")}`);let r=Wh.filter(i=>{let s=t[i];return typeof s!="string"||s.trim()===""});if(r.length>0){let i=Wh.map(a=>Vh(t[a])).join(" and "),s=r.some(a=>XO(t[a]));throw new Lt(`frontmatter "name" and "description" must be non-empty strings (got ${i})${s?` ${ZC}`:""}`)}t.metadata=qO(t.metadata),t.metadata===void 0&&delete t.metadata;let o=KO.safeParse(t);if(!o.success){let[i]=o.error.issues,s=i?.path.join(".")||"frontmatter";throw new Lt(`frontmatter "${s}" is invalid: ${i?.message??"unknown error"}`)}return o.data}function qO(e){if(e!=null&&!(typeof e!="object"||Array.isArray(e)||e instanceof Date))return e}function XO(e){return!(e==null||typeof e=="string")}function Vh(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 Gh(e){let t=e.metadata;return t?t.internal===!0||t.experimental===!0:!1}function Kh(e){let t=e.metadata?.category;if(typeof t!="string")return;let n=t.trim();return n===""?void 0:n}var bd=w(require("path"));C();var YO=new Set(["con","prn","aux","nul",...Array.from({length:9},(e,t)=>`com${t+1}`),...Array.from({length:9},(e,t)=>`lpt${t+1}`)]),Jh="/webflow-skills-store";function _s(e){if(typeof e!="string")return;let t=QC(e.toLowerCase().replace(/[^a-z0-9._]+/g,"-")).slice(0,KC),n=QC(t);if(n&&!YO.has(n)&&ZO(n))return n}function QC(e){return e.replace(/^[.\-]+|[.\-]+$/g,"")}function ZO(e){return[uC,vh].every(n=>{let r=n.impl.join(Jh,e);return!ot(Jh,r,n)||n.impl.basename(r)!==e?!1:n.impl.dirname(r)===n.impl.normalize(Jh)})}function zh(e){return Bh.test(e)}var qr=e=>bd.default.posix.basename(bd.default.posix.dirname(e.split(bd.default.win32.sep).join("/")));function dr(e,t){let n=typeof e=="string"?e.trim():"",r=()=>({kind:"none",candidates:[...new Set(t.map(s=>s.dir))].sort()});if(n==="")return r();let o=[s=>s.name===n,s=>s.folderName===n,s=>s.dir===n],i=_s(n);i!==void 0&&o.push(s=>s.dir===i||_s(s.name)===i||_s(s.folderName)===i);for(let s of o){let a=t.filter(s);if(a.length===1)return{kind:"match",skill:a[0]};if(a.length>1)return{kind:"ambiguous",matches:a}}return r()}function eF(e){return tF(e,t=>t.dir)}function qh(e){let[t]=eF(e);if(!t)return;let n=t.skills.length,r=t.skills.map(o=>` "${D(o.name)}" (${D(o.skillPath)})`);throw new f(`${n===2?"Two":String(n)} skills resolve to the same install directory "${D(t.value)}":
|
|
252
252
|
${r.join(`
|
|
253
253
|
`)}
|
|
254
|
-
This is a bug in ${he}. Please report it.`)}function Mh(e){return HC(e,t=>t.name)}function Bh(e){let[t,...n]=e.skills;return`${e.skills.length} skills declare the frontmatter name "${D(e.value)}": ${e.skills.map(r=>D(r.skillPath)).join(", ")}. Using ${D(t?.skillPath??"")} and ignoring ${n.length===1?"the other":"the others"}. This is a bug in ${he}. Please report it.`}function HC(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r])}return[...n.entries()].filter(([,r])=>r.length>1).map(([r,o])=>({value:r,skills:o}))}var Es=w(require("fs")),Qt=w(require("path"));C();async function vs(e,t){Ue(t,e,"the catalog skills directory");let n=[],r=[],o=[],i=new Set,s=d=>(o.push(...d.warnings),d.kind==="skipped"?(r.push({skillPath:d.skillPath,reason:d.reason}),!1):(n.push(d.skill),!d.skill.internal));for(let d of await ul(e,"the catalog skills directory")){if(cl.has(d.name))continue;let m=Qt.default.join(e,d.name);if(!await Uh(m,d))continue;let h=await GC(m);if(h.kind!=="none"&&i.add(h.path),!(h.kind!=="none"&&s(await VC({skillDir:m,manifest:h,extractRoot:t}))))for(let g of await ul(m)){if(cl.has(g.name))continue;let y=Qt.default.join(m,g.name);if(!await Uh(y,g))continue;let b=await GC(y);b.kind!=="none"&&(i.add(b.path),s(await VC({skillDir:y,manifest:b,extractRoot:t,parentCategory:d.name})))}}let a=await UO(n),l=Mh(a),c=new Set;for(let d of l){o.push(Bh(d));for(let m of d.skills.slice(1))c.add(m.skillPath)}let p=a.filter(d=>!c.has(d.skillPath));jh(p),o.push(...await WO(e,t,i));for(let d of r)o.push(`Skipped ${d.skillPath} \u2014 ${d.reason}`);return r.length>0&&o.push(`${r.length} skill${r.length===1?" was":"s were"} skipped. ${r.length===1?"This is a defect":"These are defects"} in ${he} \u2014 please report ${r.length===1?"it":"them"} at ${Ko}.`),{skills:p,skipped:r,warnings:o}}async function VC(e){let{skillDir:t,manifest:n,extractRoot:r,parentCategory:o}=e,i=zC(r,n.path),s=[],a=g=>({kind:"skipped",skillPath:i,reason:D(g),warnings:s});if(n.kind==="symlink")return a(`${Ot} is a symbolic link; skill files must be regular files`);let l;try{l=await Es.default.promises.readFile(n.path,"utf8")}catch(g){return a(`failed to read file: ${g instanceof Error?g.message:String(g)}`)}let c;try{c=Xo(l).frontmatter}catch(g){if(g instanceof Lt)return a(g.reason);throw g}let p=D(c.name),d=D(c.description);if(p==="")return a(`frontmatter name "${D(c.name)}" cannot be used as a directory name`);let m=ks(p);if(m===void 0)return a(`frontmatter name "${p}" cannot be used as a directory name`);Nh(p)||s.push(`${i} declares a non-standard skill name "${p}"; it installs as "${m}". This is a bug in ${he}.`);let h=await BO(t,n.path);return h.symlink?a(`contains a symbolic link (${h.symlink}); skill files must be regular files`):(h.truncated&&s.push(`${i} sits in a directory with more than ${dd} files; only the first ${dd} are listed.`),{kind:"skill",warnings:s,skill:{name:p,dir:m,folderName:Kr(i),description:d,category:Oh(c)??o,internal:$h(c),path:t,skillPath:i,supplementaryFiles:h.files}})}async function GC(e){let t=Qt.default.join(e,Ot),n=await KC(t);if(n)return n;let r=Ot.toLowerCase();for(let o of await ul(e)){if(o.name===Ot||o.name.toLowerCase()!==r)continue;let i=await KC(Qt.default.join(e,o.name));if(i)return i}return{kind:"none"}}async function KC(e){try{let t=await Es.default.promises.lstat(e);if(t.isSymbolicLink())return{kind:"symlink",path:e};if(t.isFile())return{kind:"file",path:e}}catch{}}async function Uh(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await Es.default.promises.stat(e)).isDirectory()}catch{return!1}}async function ul(e,t){try{return(await Es.default.promises.readdir(e,{withFileTypes:!0})).sort((r,o)=>r.name<o.name?-1:r.name>o.name?1:0)}catch(n){if(!t)return[];throw new f(`Failed to read ${t} (${D(e)}): ${n instanceof Error?n.message:String(n)}`)}}async function BO(e,t){let n=[],r,o=!1,i=async(s,a)=>{if(!(a>qo||r!==void 0))for(let l of await ul(s)){if(r!==void 0)return;let c=Qt.default.join(s,l.name);if(l.isSymbolicLink()){r=JC(e,c);return}if(l.isDirectory()){if(Jo.has(l.name))continue;await i(c,a+1);continue}if(l.isFile()&&!zo.has(l.name)&&c!==t){if(n.length>=dd){o=!0;return}n.push(JC(e,c))}}};return await i(e,1),{files:n.sort(),symlink:r,truncated:o}}async function UO(e){let t=new Set,n=[];for(let r of e){let o;try{o=await Es.default.promises.realpath(r.path)}catch{o=Qt.default.resolve(r.path)}t.has(o)||(t.add(o),n.push(r))}return n}async function WO(e,t,n){let r=[],o=OC,i=async(s,a)=>{if(!(a>LC||o<=0)){o-=1;for(let l of await ul(s)){if(cl.has(l.name))continue;let c=Qt.default.join(s,l.name);if(l.isFile()&&l.name.toLowerCase()===Ot.toLowerCase()){n.has(c)||r.push(zC(t,c));continue}await Uh(c,l)&&await i(c,a+1)}}};return await i(e,1),r.length===0?[]:[`${r.length} ${Ot} file(s) in the catalog sit outside the layout this CLI reads (for example ${r[0]}) and were ignored. ${he} may have changed its layout; please report it at ${Ko}.`]}function zC(e,t){return Qt.default.relative(e,t).split(Qt.default.sep).join("/")}function JC(e,t){return Qt.default.relative(e,t).split(Qt.default.sep).join("/")}var hn=w(require("os")),On=w(require("path"));function Yo(e,t){let n=process.env[e]?.trim();return n||t}function qC(e){let t=process.env[e]?.trim();return t||void 0}var ce={home:()=>hn.default.homedir(),configHome:()=>Yo("XDG_CONFIG_HOME",On.default.join(hn.default.homedir(),".config")),hardcodedConfigHome:()=>On.default.join(hn.default.homedir(),".config"),claudeHome:()=>Yo("CLAUDE_CONFIG_DIR",On.default.join(hn.default.homedir(),".claude")),codexHome:()=>Yo("CODEX_HOME",On.default.join(hn.default.homedir(),".codex")),vibeHome:()=>Yo("VIBE_HOME",On.default.join(hn.default.homedir(),".vibe")),hermesHome:()=>Yo("HERMES_HOME",On.default.join(hn.default.homedir(),".hermes")),autohandHome:()=>Yo("AUTOHAND_HOME",On.default.join(hn.default.homedir(),".autohand")),grokHome:()=>Yo("GROK_HOME",On.default.join(hn.default.homedir(),".grok")),appData:()=>qC("APPDATA"),flatpakConfigHome:()=>qC("FLATPAK_XDG_CONFIG_HOME")};function yn(...e){return On.default.join(hn.default.homedir(),...e)}var sF=w(require("fs")),ke=w(require("path"));C();M();var Ct=w(require("path"));var Wh=[".openclaw",".clawdbot",".moltbot"];function XC(e,t){let n=Wh.find(r=>t(Ct.default.join(e,r)));return Ct.default.join(e,n??Wh[0],"skills")}function YC(e,t){return Wh.some(n=>t(Ct.default.join(e,n)))}function ZC(e,t,n=ce.appData(),r=ce.flatpakConfigHome()){return!!(t(Ct.default.join(e,"zed"))||n&&t(Ct.default.join(n,"Zed"))||r&&t(Ct.default.join(r,"zed")))}var VO="/Applications/ZCode.app";function QC(e,t){return t(Ct.default.join(e,".zcode"))||t(VO)}function eF(e,t){return t(Ct.default.join(e,"kimchi"))}var GO="/etc/codex";function tF(e,t){return t(e)||t(GO)}function nF(e,t){return t(Ct.default.join(e,".replit"))}function rF(e,t){return t(Ct.default.join(e,".promptscript"))||t(Ct.default.join(e,"promptscript.yaml"))}function oF(e,t,n){return n(Ct.default.join(t,"data","skills"))||n(Ct.default.join(e,".astrbot"))}function iF(){return!1}function KO(e){try{return sF.default.existsSync(e)}catch{return!1}}function fe(e,t,n){return{id:e,displayName:t,skillsDir:`${n}/skills`,globalSkillsDir:()=>yn(n,"skills"),detect:r=>r.pathExists(ke.default.join(r.homeDir,n)),sharedStore:!1}}function ot(e){return{id:e.id,displayName:e.displayName,skillsDir:e.project,globalSkillsDir:()=>yn(...e.global),detect:t=>t.pathExists(ke.default.join(t.homeDir,...e.probe)),sharedStore:e.sharedStore??!1,showInSharedPrompt:e.showInSharedPrompt,showInSharedList:e.showInSharedList}}var Qe=".agents/skills",dl=[fe("aider-desk","AiderDesk",".aider-desk"),{id:"amp",displayName:"Amp",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"amp")),sharedStore:!0},ot({id:"antigravity",displayName:"Antigravity",project:Qe,global:[".gemini","antigravity","skills"],probe:[".gemini","antigravity"],sharedStore:!0}),ot({id:"antigravity-cli",displayName:"Antigravity CLI",project:Qe,global:[".gemini","antigravity-cli","skills"],probe:[".gemini","antigravity-cli"],sharedStore:!0}),{id:"astrbot",displayName:"AstrBot",skillsDir:"data/skills",globalSkillsDir:()=>yn(".astrbot","data","skills"),detect:e=>oF(e.homeDir,e.cwd,e.pathExists),sharedStore:!1},{id:"autohand-code",displayName:"Autohand Code CLI",skillsDir:".autohand/skills",globalSkillsDir:()=>ke.default.join(ce.autohandHome(),"skills"),detect:e=>e.pathExists(ce.autohandHome()),sharedStore:!1},fe("augment","Augment",".augment"),fe("bob","IBM Bob",".bob"),{id:"claude-code",displayName:"Claude Code",skillsDir:".claude/skills",globalSkillsDir:()=>ke.default.join(ce.claudeHome(),"skills"),detect:e=>e.pathExists(ce.claudeHome()),sharedStore:!1},{id:"openclaw",displayName:"OpenClaw",skillsDir:"skills",globalSkillsDir:()=>XC(ce.home(),KO),detect:e=>YC(e.homeDir,e.pathExists),sharedStore:!1},ot({id:"cline",displayName:"Cline",project:Qe,global:[".agents","skills"],probe:[".cline"],sharedStore:!0}),fe("codearts-agent","CodeArts Agent",".codeartsdoer"),{id:"codebuddy",displayName:"CodeBuddy",skillsDir:".codebuddy/skills",globalSkillsDir:()=>yn(".codebuddy","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".codebuddy"))||e.pathExists(ke.default.join(e.homeDir,".codebuddy")),sharedStore:!1},fe("codemaker","Codemaker",".codemaker"),fe("codestudio","Code Studio",".codestudio"),{id:"codex",displayName:"Codex",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.codexHome(),"skills"),detect:e=>tF(ce.codexHome(),e.pathExists),sharedStore:!0},fe("command-code","Command Code",".commandcode"),{id:"continue",displayName:"Continue",skillsDir:".continue/skills",globalSkillsDir:()=>yn(".continue","skills"),detect:e=>e.pathExists(ke.default.join(e.cwd,".continue"))||e.pathExists(ke.default.join(e.homeDir,".continue")),sharedStore:!1},ot({id:"cortex",displayName:"Cortex Code",project:".cortex/skills",global:[".snowflake","cortex","skills"],probe:[".snowflake","cortex"]}),{id:"crush",displayName:"Crush",skillsDir:".crush/skills",globalSkillsDir:()=>ke.default.join(ce.hardcodedConfigHome(),"crush","skills"),detect:e=>e.pathExists(ke.default.join(ce.hardcodedConfigHome(),"crush")),sharedStore:!1},ot({id:"cursor",displayName:"Cursor",project:Qe,global:[".cursor","skills"],probe:[".cursor"],sharedStore:!0}),ot({id:"deepagents",displayName:"Deep Agents",project:Qe,global:[".deepagents","agent","skills"],probe:[".deepagents"],sharedStore:!0}),{id:"devin",displayName:"Devin for Terminal",skillsDir:".devin/skills",globalSkillsDir:()=>ke.default.join(ce.configHome(),"devin","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"devin")),sharedStore:!1},ot({id:"dexto",displayName:"Dexto",project:Qe,global:[".agents","skills"],probe:[".dexto"],sharedStore:!0,showInSharedPrompt:!1}),fe("droid","Droid",".factory"),ot({id:"firebender",displayName:"Firebender",project:Qe,global:[".firebender","skills"],probe:[".firebender"],sharedStore:!0,showInSharedPrompt:!1}),fe("forgecode","ForgeCode",".forge"),ot({id:"gemini-cli",displayName:"Gemini CLI",project:Qe,global:[".gemini","skills"],probe:[".gemini"],sharedStore:!0}),ot({id:"github-copilot",displayName:"GitHub Copilot",project:Qe,global:[".copilot","skills"],probe:[".copilot"],sharedStore:!0}),{id:"goose",displayName:"Goose",skillsDir:".goose/skills",globalSkillsDir:()=>ke.default.join(ce.configHome(),"goose","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"goose")),sharedStore:!1},{id:"grok",displayName:"Grok Build",skillsDir:".grok/skills",globalSkillsDir:()=>ke.default.join(ce.grokHome(),"skills"),detect:e=>e.pathExists(ce.grokHome()),sharedStore:!1},{id:"hermes-agent",displayName:"Hermes Agent",skillsDir:".hermes/skills",globalSkillsDir:()=>ke.default.join(ce.hermesHome(),"skills"),detect:e=>e.pathExists(ce.hermesHome()),sharedStore:!1},fe("inference-sh","inference.sh",".inferencesh"),{id:"jazz",displayName:"Jazz",skillsDir:".jazz/skills",globalSkillsDir:()=>yn(".jazz","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".jazz"))||e.pathExists(ke.default.join(e.cwd,".jazz")),sharedStore:!1},fe("junie","Junie",".junie"),fe("iflow-cli","iFlow CLI",".iflow"),fe("kilo","Kilo Code",".kilocode"),{id:"kimchi",displayName:"Kimchi",skillsDir:".kimchi/skills",globalSkillsDir:()=>ke.default.join(ce.hardcodedConfigHome(),"kimchi","harness","skills"),detect:e=>eF(ce.hardcodedConfigHome(),e.pathExists),sharedStore:!1},{id:"kimi-code-cli",displayName:"Kimi Code CLI",skillsDir:Qe,globalSkillsDir:()=>yn(".agents","skills"),detect:e=>e.pathExists(ke.default.join(e.homeDir,".kimi-code"))||e.pathExists(ke.default.join(e.homeDir,".kimi")),sharedStore:!0},fe("kiro-cli","Kiro CLI",".kiro"),fe("kode","Kode",".kode"),fe("lingma","Lingma",".lingma"),ot({id:"loaf",displayName:"Loaf",project:Qe,global:[".agents","skills"],probe:[".loaf"],sharedStore:!0,showInSharedPrompt:!1}),fe("mcpjam","MCPJam",".mcpjam"),{id:"mistral-vibe",displayName:"Mistral Vibe",skillsDir:".vibe/skills",globalSkillsDir:()=>ke.default.join(ce.vibeHome(),"skills"),detect:e=>e.pathExists(ce.vibeHome()),sharedStore:!1},fe("moxby","Moxby",".moxby"),fe("mux","Mux",".mux"),{id:"opencode",displayName:"OpenCode",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"opencode","skills"),detect:e=>e.pathExists(ke.default.join(e.configHome,"opencode")),sharedStore:!0},fe("openhands","OpenHands",".openhands"),fe("ona","Ona",".ona"),ot({id:"pi",displayName:"Pi",project:".pi/skills",global:[".pi","agent","skills"],probe:[".pi","agent"]}),fe("qoder","Qoder",".qoder"),ot({id:"qoder-cn",displayName:"Qoder CN",project:".qoder/skills",global:[".qoder-cn","skills"],probe:[".qoder-cn"]}),fe("qwen-code","Qwen Code",".qwen"),{id:"replit",displayName:"Replit",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:e=>nF(e.cwd,e.pathExists),sharedStore:!0,showInSharedList:!1},fe("reasonix","Reasonix",".reasonix"),fe("rovodev","Rovo Dev",".rovodev"),fe("roo","Roo Code",".roo"),ot({id:"tabnine-cli",displayName:"Tabnine CLI",project:".tabnine/agent/skills",global:[".tabnine","agent","skills"],probe:[".tabnine"]}),fe("terramind","Terramind",".terramind"),fe("tinycloud","Tinycloud",".tinycloud"),fe("trae","Trae",".trae"),ot({id:"trae-cn",displayName:"Trae CN",project:".trae/skills",global:[".trae-cn","skills"],probe:[".trae-cn"]}),ot({id:"warp",displayName:"Warp",project:Qe,global:[".agents","skills"],probe:[".warp"],sharedStore:!0}),ot({id:"windsurf",displayName:"Windsurf",project:".windsurf/skills",global:[".codeium","windsurf","skills"],probe:[".codeium","windsurf"]}),{id:"zed",displayName:"Zed",skillsDir:Qe,globalSkillsDir:()=>yn(".agents","skills"),detect:e=>ZC(e.configHome,e.pathExists),sharedStore:!0},{id:"zcode",displayName:"ZCode",skillsDir:".zcode/skills",globalSkillsDir:()=>yn(".zcode","skills"),detect:e=>QC(e.homeDir,e.pathExists),sharedStore:!1},fe("zencoder","Zencoder",".zencoder"),fe("zenflow","Zenflow",".zencoder"),fe("neovate","Neovate",".neovate"),fe("pochi","Pochi",".pochi"),{id:"promptscript",displayName:"PromptScript",skillsDir:Qe,globalSkillsDir:()=>{},detect:e=>rF(e.cwd,e.pathExists),sharedStore:!0,showInSharedPrompt:!1},fe("adal","AdaL",".adal"),{id:"universal",displayName:"Universal",skillsDir:Qe,globalSkillsDir:()=>ke.default.join(ce.configHome(),"agents","skills"),detect:iF,sharedStore:!0,showInSharedList:!1}],Hh=new Map(dl.map(e=>[e.id,e])),Zo=dl.map(e=>e.id);function pl(e){return Hh.has(e)}function Ln(e){return Hh.get(e)}function md(e){let t=Hh.get(e);if(t)return t;throw new f(`${k} Unknown agent: ${D(e)}
|
|
255
|
-
${
|
|
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
|
+
${ti.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}function kd(e,t){return t==="project"||e.globalSkillsDir()!==void 0}function Bn(e){return wl.filter(t=>kd(t,e))}var ty=w(require("path"));C();M();var Ed=".agents",vd="skills";function st(e,t){let n=e==="global"?ce.home():t;return ty.default.join(n,Ed,vd)}function Nt(e,t,n){if(t==="global")return e.globalSkillsDir()??null;let r=ty.default.resolve(n,...e.skillsDir.split("/"));return Ue(n,r,`${e.id} project skills directory`),r}function ny(e,t,n){return Ye(Nt(e,t,n),st(t,n))}var ry=w(require("fs")),bF=w(require("path"));function sL(e){try{return ry.default.existsSync(e)}catch{return!1}}function aL(e){try{let t=JSON.parse(ry.default.readFileSync(bF.default.join(e,"package.json"),"utf8"));return t===null||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function DF(e){return{homeDir:ce.home(),configHome:ce.configHome(),cwd:e,pathExists:sL,readPackageJson:aL}}async function Dl(e,t,n=DF(t)){return kF(Bn(e),n).map(r=>r.id)}function kF(e,t){return e.filter(n=>{try{return n.detect(t)}catch{return!1}})}var EF=w(require("fs")),vF=w(require("path"));C();be();Oe();A();M();var kl=[".git","package.json","webflow.json"];function El(e){for(let t of kl)try{if(EF.default.existsSync(vF.default.join(e,t)))return t}catch{}return null}function vl(e){return El(e)===null?"global":"project"}function SF(e){let t=El(e);return t?`Installing at project scope \u2014 ${t} found in this directory.`:`Installing at global scope \u2014 none of ${kl.join(", ")} found in this directory.`}async function Sd(e,t){if(e.global&&e.project)throw new f(`${k} Pass either --global or --project, not both.`,{isUserError:!0,missingFlag:"scope"});if(e.global)return"global";if(e.project)return"project";let n=vl(t);return e.yes||V()?(u.info(SF(t)),n):Be({message:"Where should these skills be installed?",default:n,choices:[{value:"project",name:"This project \u2014 skills live in the repository"},{value:"global",name:"Globally \u2014 skills available in every project"}]})}C();be();Oe();A();M();var Sl="all",tn="universal",lL=6,cL=20,uL=80;function Is(e){return(e??[]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(Boolean)}function dL(e,t){let n=Array.from({length:t.length+1},(r,o)=>o);for(let r=1;r<=e.length;r+=1){let o=[r];for(let i=1;i<=t.length;i+=1)o[i]=Math.min(n[i]+1,o[i-1]+1,n[i-1]+(e[r-1]===t[i-1]?0:1));n=o}return n[t.length]}function FF(e){let t=e.toLowerCase(),n=Math.max(1,Math.floor(t.length/3)),r=null,o=Number.POSITIVE_INFINITY;for(let i of ti){let s=dL(t,i);s<o&&(o=s,r=i)}return o<=n?r:null}function Ts(e){let t=e.filter(n=>!bl(n));if(t.length>0){let n=Array.from(new Set(t.map(o=>FF(o)).filter(o=>o!==null))),r=n.length>0?` Did you mean: ${n.join(", ")}?
|
|
256
256
|
`:"";throw new f(`${k} Unknown agent(s): ${t.map(o=>D(o)).join(", ")}
|
|
257
|
-
`+r+` ${
|
|
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 gL(e){let t=gl(e);return t!==null?`Using project scope \u2014 ${t} found in this directory.`:`Using global scope \u2014 none of ${ml.join(", ")} found in this directory.`}async function Sd(e,t,n){return!(e.global===!0||e.project===!0)&&(e.yes===!0||V())?(n||u.info(gL(t)),hl(t)):wd(e,t)}function Fs(e){return e==="locally-modified"||e==="unmanaged"}var ni=w(require("fs")),wn=w(require("path"));C();var ey=require("crypto"),_d=w(require("fs"));C();var ti=w(require("fs")),jn=w(require("path"));C();var Qh=2e3,OF=8;async function xd(e){let t=jn.default.resolve(e),n=[],r=[],o=async(i,s)=>{if(s>qo)throw new f(`Skill directory ${D(t)} nests deeper than ${qo} levels at ${D(i)}. Refusing to copy or hash a tree this deep.`);let a=await ti.default.promises.readdir(i,{withFileTypes:!0});a.sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0);for(let l of a){let c=jn.default.join(i,l.name);if(Ue(t,c,"a skill file"),l.isSymbolicLink()){r.push($F(t,c));continue}if(l.isDirectory()){if(Jo.has(l.name))continue;await o(c,s+1);continue}if(!l.isFile()||zo.has(l.name))continue;let p=await ti.default.promises.lstat(c);if(n.length>=Qh)throw new f(`Skill directory ${D(t)} contains more than ${Qh} files. Refusing to copy or hash it.`);let d=$F(t,c);n.push({rel:d,key:d.normalize("NFC"),abs:c,mode:p.mode&511,size:p.size})}};return await o(t,1),n.sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0),r.sort(),{files:n,symlinks:r}}function Cd(e,t){let[n]=t.symlinks;if(n!==void 0)throw new f(`Skill directory ${D(e)} contains a symbolic link ("${D(n)}"); skill files must be regular files. If this came from ${he}, please report it.`)}async function Fd(e,t){let n=jn.default.resolve(e),r=jn.default.resolve(t),o=await xd(n);Cd(n,o),await ti.default.promises.mkdir(r,{recursive:!0});let i=new Set;for(let a of o.files){let l=jn.default.dirname(jn.default.join(r,...a.rel.split("/")));l!==r&&i.add(l)}for(let a of[...i].sort())Ue(r,a,"a skill destination directory"),await ti.default.promises.mkdir(a,{recursive:!0});let s=0;return await hL(o.files,OF,async a=>{let l=jn.default.join(r,...a.rel.split("/"));Ue(r,l,"a skill destination file"),await ti.default.promises.copyFile(a.abs,l),await ti.default.promises.chmod(l,a.mode),s+=a.size}),{fileCount:o.files.length,byteCount:s}}function $F(e,t){return jn.default.relative(e,t).split(jn.default.sep).join("/")}async function hL(e,t,n){let r=0,o=Array.from({length:Math.max(1,Math.min(t,e.length))},async()=>{for(;r<e.length;){let i=e[r++];if(i===void 0)return;await n(i)}});await Promise.all(o)}var NF=1024*1024,jF=4294967295,ty=Buffer.from([0]);async function Ad(e){let t=await xd(e);Cd(e,t);let n=(0,ey.createHash)("sha256"),r=(0,ey.createHash)("sha256"),o=0;for(let i of t.files)await yL(n,i),wL(r,i),o+=i.size;return{contentHash:`sha256:${n.digest("hex")}`,modeHash:`sha256:${r.digest("hex")}`,fileCount:t.files.length,byteCount:o}}async function tn(e){try{return await Ad(e)}catch(t){if(kL(t))return null;throw t}}function jt(e,t,n=process.platform){return!e||!t||!e.contentHash||!t.contentHash||e.contentHash!==t.contentHash?!1:n==="win32"||!e.modeHash||!t.modeHash?!0:e.modeHash===t.modeHash}async function yL(e,t){if(t.size<=NF){let o=await _d.default.promises.readFile(t.abs);return LF(e,t,o.length),e.update(o),o.length}let n=await bL(t.abs);LF(e,t,n);let r=await DL(e,t.abs,n);if(r!==n)throw new f(`${D(t.abs)} changed while it was being hashed (${n} bytes, then ${r}). Re-run the command.`);return r}function LF(e,t,n){if(n>jF)throw new f(`${D(t.abs)} is ${n} bytes, which is too large to hash. Remove it from the skill folder and re-run.`);e.update(t.key,"utf8"),e.update(ty);let r=Buffer.alloc(4);r.writeUInt32BE(n,0),e.update(r)}function wL(e,t){e.update(t.key,"utf8"),e.update(ty),e.update((t.mode&73)!==0?"x":"-"),e.update(ty)}async function bL(e){let t=0;for await(let n of _d.default.createReadStream(e))t+=n.length;return t}async function DL(e,t,n){let r=0;for await(let o of _d.default.createReadStream(t)){let i=o;if(r+=i.length,r>n)return e.update(i.subarray(0,i.length-(r-n))),r;e.update(i)}return r}function kL(e){return qr(e)==="ENOENT"?!0:typeof e!="object"||e===null?!1:qr(e.cause)==="ENOENT"}function qr(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}var UF=require("crypto"),Ie=w(require("fs")),Ee=w(require("path"));C();A();var EL=/\.[0-9a-f]{6}\.tmp$/,WF=3600*1e3;async function ry(e,t=n=>n){let n=Ee.default.join(e,hd);for(let r of[n,Ee.default.join(n,yd)]){if(await HF(r)==="other")throw new f(`${D(t(r))} exists but is not a directory. The Webflow CLI needs it as the shared skills store. Remove or rename it, then re-run.`,{isUserError:!0});if(await Rd(e,r))throw new f(`${D(t(r))} resolves outside ${D(t(e))} once symlinks are followed. The Webflow CLI will not use it as the shared skills store. Remove or repoint it, then re-run.`,{isUserError:!0})}}async function Rd(e,t){if(!rt(e,t)||await oy(e,t)!==void 0)return!0;try{await Ie.default.promises.lstat(t)}catch{return!1}return!await Zu(e,t)}async function oy(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a;try{a=await Ie.default.promises.lstat(i)}catch{return}if(a.isSymbolicLink()&&!await Zu(n,i))return i}}async function Id(e,t){let n=Ee.default.resolve(e),r=Ee.default.relative(n,Ee.default.resolve(t));if(r===""||r.startsWith(".."))return;let o=r.split(Ee.default.sep).filter(s=>s!==""),i=n;for(let s of o.slice(0,-1)){i=Ee.default.join(i,s);let a=await HF(i);if(a==="absent")return;if(a==="other")return i}}async function kl(e,t={}){if(t.dryRun)return[];let n=t.maxAgeMs??WF,r=t.now??Date.now(),o=[],i;try{i=await Ie.default.promises.readdir(e,{withFileTypes:!0})}catch{return o}for(let s of i){if(!EL.test(s.name))continue;let a=Ee.default.join(e,s.name);try{Ue(e,a,"a stale staging directory");let l=await Ie.default.promises.lstat(a);if(r-l.mtimeMs<n)continue;await Ie.default.promises.rm(a,{recursive:!0,force:!0}),o.push(a)}catch(l){u.debug(`Could not sweep staging directory ${a}: ${l instanceof Error?l.message:String(l)}`)}}return o}async function Td(e){let{storeDir:t,slug:n,root:r,mode:o,agent:i,label:s}=e,a=e.platform??process.platform,l=Ee.default.resolve(e.linkPath),c={agent:i,label:s,path:l,canonicalPath:t,requestedMode:o},p=y=>({...c,success:!1,link:o,error:y});if(Ee.default.basename(l)!==n)return p(`Refusing to write ${D(l)}: its final component is not "${D(n)}".`);let d=y=>({...c,success:!1,link:o,skipped:!0,skipReason:"unsafe-destination",error:`Refusing to write ${D(l)} for ${D(s)}: ${y}`});if(!rt(r,l))return d(`it resolves outside ${D(r)}.`);let m=await oy(r,l);if(m!==void 0)return d(`${D(m)} is a symbolic link that leaves ${D(r)}.`);let h=await Id(r,l);if(h!==void 0)return p(`${D(h)} exists but is not a directory \u2014 remove or rename it, then re-run.`);if(Ye(t,l))return{...c,success:!0,link:"canonical"};let g=await xL(l,t);if(g&&o==="symlink")return{...c,success:!0,link:"symlink"};if(!g){let[y,b]=await Promise.all([mn(t),mn(l)]);if(Ye(y,b))return{...c,success:!0,link:"canonical"};if(Ye(await BF(t),await BF(l)))return{...c,success:!0,link:"canonical"};if(await fh(t,l))return{...c,success:!0,link:"canonical",skipped:!0,skipReason:"source-is-destination"}}if(o==="copy")try{return await MF(t,l,n),{...c,success:!0,link:"copy"}}catch(y){return{...c,success:!1,link:"copy",errno:qr(y),error:ny(y)}}try{if(await CL(l,n),await Ie.default.promises.mkdir(Ee.default.dirname(l),{recursive:!0}),a==="win32")await Ie.default.promises.symlink(Ee.default.resolve(t),l,"junction");else{let y=await mn(Ee.default.dirname(l));await Ie.default.promises.symlink(Ee.default.relative(y,t),l)}return{...c,success:!0,link:"symlink"}}catch(y){let b=qr(y);try{return await MF(t,l,n),{...c,success:!0,link:"copy",symlinkFailed:!0,errno:b}}catch(S){return{...c,success:!1,link:"copy",symlinkFailed:!0,errno:qr(S)??b,error:ny(S)}}}}async function El(e,t,n={}){if(Ue(e.storeBase,t.storePath,`the canonical store directory for "${t.name}"`),Ee.default.basename(t.storePath)!==t.dir)throw new f(`Refusing to write ${D(t.storePath)}: its final component is not "${D(t.dir)}". Please report this.`);let r={name:t.name,dir:t.dir,storePath:t.storePath};if(Fs(t.storeOverwrite)&&!e.force)return{...r,storeAction:"blocked",hashes:null,targets:[],success:!1,error:t.detail};let o,i,s;try{t.storeOverwrite==="adoptable"?(i="adopted",o=t.onDisk??t.upstream):t.upToDate?(i="unchanged",o=t.onDisk??t.upstream):await fh(t.sourceDir,t.storePath)?(i="unchanged",o=t.onDisk??t.upstream,s="the extracted source and the canonical store are the same directory; nothing to copy"):(o=await vL(t),i="written")}catch(l){return{...r,storeAction:"failed",hashes:null,targets:[],success:!1,error:ny(l)}}let a=[];for(let l of t.targets)a.push(await SL(e,t,l,n));return{...r,storeAction:i,hashes:o,targets:a,detail:s,success:a.every(l=>l.success)}}async function vL(e){await Ie.default.promises.mkdir(Ee.default.dirname(e.storePath),{recursive:!0});let t=sy(e.storePath);try{await Fd(e.sourceDir,t),await iy(e.storePath,e.dir),await Ie.default.promises.rename(t,e.storePath)}finally{await Ie.default.promises.rm(t,{recursive:!0,force:!0}).catch(()=>{})}return Ad(e.storePath)}async function SL(e,t,n,r){let o={agent:n.agent,label:n.label,path:n.path,canonicalPath:t.storePath,requestedMode:e.mode};return n.link==="canonical"?{...o,success:!0,link:"canonical"}:n.skipped?{...o,success:!0,link:n.link,skipped:!0,skipReason:n.skipReason,error:void 0}:n.blocked?{...o,success:!1,link:n.link,error:n.detail}:Td({storeDir:t.storePath,linkPath:n.path,slug:t.dir,root:e.root,mode:e.mode,agent:n.agent,label:n.label,platform:r.platform})}async function MF(e,t,n){await Ie.default.promises.mkdir(Ee.default.dirname(t),{recursive:!0});let r=sy(t);try{await Fd(e,r),await iy(t,n),await Ie.default.promises.rename(r,t)}finally{await Ie.default.promises.rm(r,{recursive:!0,force:!0}).catch(()=>{})}}async function xL(e,t){let n;try{n=await Ie.default.promises.lstat(e)}catch{return!1}if(!n.isSymbolicLink())return!1;let r=await Ie.default.promises.readlink(e).catch(()=>null);if(r===null)return!1;let o=Ee.default.resolve(Ee.default.dirname(e),r);if(Ye(o,t))return!0;let[i,s]=await Promise.all([mn(o),mn(t)]);return Ye(i,s)}async function CL(e,t){let n;try{n=await Ie.default.promises.lstat(e)}catch(r){qr(r)==="ELOOP"&&await Ie.default.promises.rm(e,{force:!0}).catch(()=>{});return}if(n.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await iy(e,t)}async function iy(e,t){if(Ee.default.basename(e)!==t)throw new f(`Refusing to delete ${D(e)}: its final component is not "${D(t)}". Please report this.`);let n;try{n=await Ie.default.promises.lstat(e)}catch{return}if(n.isSymbolicLink()){await Ie.default.promises.rm(e,{force:!0});return}await Ie.default.promises.rm(e,{recursive:!0,force:!0})}function sy(e){return`${e}.${(0,UF.randomBytes)(3).toString("hex")}.tmp`}async function BF(e){let t=Ee.default.resolve(e),n=await mn(Ee.default.dirname(t));return Ee.default.join(n,Ee.default.basename(t))}async function HF(e){let t;try{t=await Ie.default.promises.lstat(e)}catch{return"absent"}if(t.isDirectory())return"directory";if(!t.isSymbolicLink())return"other";try{return(await Ie.default.promises.stat(e)).isDirectory()?"directory":"other"}catch{return"other"}}function ny(e){let t=e instanceof Error?e.message:String(e);return D(t)}var FL=["CLAUDE_CONFIG_DIR","CODEX_HOME","XDG_CONFIG_HOME","FLATPAK_XDG_CONFIG_HOME","APPDATA","VIBE_HOME","HERMES_HOME","AUTOHAND_HOME","GROK_HOME"],_L=64;async function vl(e){let t=e.platform??process.platform,n=e.display??(c=>c),r=wn.default.resolve(e.root),o=it(e.scope,r),i=e.recorded??{},s=new Set(e.warnings??[]);await ry(r,n);let a=await AL({targets:e.targets,scope:e.scope,root:r,storeBase:o,display:n,warn:c=>s.add(c)});for(let c of await PL({groups:a,skills:e.skills,display:n}))s.add(c);let l=[];for(let c of e.skills)l.push(await TL({discovered:c,groups:a,storeBase:o,mode:e.mode,force:e.force,recorded:i[c.name]??null,platform:t,display:n}));return{scope:e.scope,root:r,storeBase:o,mode:e.mode,force:e.force,source:e.source,skills:l,warnings:[...s],blocked:l.filter(c=>c.blocked)}}async function AL(e){let{targets:t,scope:n,root:r,storeBase:o,display:i,warn:s}=e,a=new Map;for(let c of t){let p=Nt(c.agent,n,r);if(p===null){s(`${D(c.agent.displayName)} does not support ${n} installation and was skipped.`);continue}let d=a.get(p);d?(d.agents.push(c.agent),d.explicit=d.explicit||c.explicit):a.set(p,{agents:[c.agent],explicit:c.explicit})}let l=[];for(let[c,p]of a){let d=p.agents.slice().sort((g,y)=>g.id<y.id?-1:g.id>y.id?1:0);if(Ye(c,o)){l.push({dir:c,agents:d,canonical:!0});continue}if(await Rd(r,c)){let g=Pd(c),y=`${D(i(c))} resolves outside ${D(i(r))}`+(g?` (check $${g})`:"")+"; refusing to install there.";s(y),l.push({dir:c,agents:d,canonical:!1,skipReason:"unsafe-destination",detail:y});continue}let m=await Id(r,c);if(m!==void 0){let g=`${D(i(m))} exists but is not a directory \u2014 remove or rename it, then re-run.`;s(g),l.push({dir:c,agents:d,canonical:!1,skipReason:"path-conflict",detail:g});continue}if(!(p.explicit||await IL(p.agents,n,r,c))){l.push({dir:c,agents:d,canonical:!1,skipReason:"agent-dir-absent",detail:`config directory not present; the skill is still reachable via ${D(i(o))}`});continue}l.push({dir:c,agents:d,canonical:!1})}return l}function RL(e,t,n,r){if(t==="global")return wn.default.dirname(r);let[o]=e.skillsDir.split(/[\\/]/);return wn.default.join(n,o??e.skillsDir)}async function IL(e,t,n,r){for(let o of e)if(await $L(RL(o,t,n,r)))return!0;return!1}async function TL(e){let{discovered:t,groups:n,storeBase:r,mode:o,force:i,platform:s,display:a}=e,l=wn.default.join(r,t.dir),c=await OL(t.path),p=e.recorded?.contentHash?{contentHash:e.recorded.contentHash,modeHash:e.recorded.modeHash??""}:null,d=e.recorded!==null&&p===null,m=await GF({dest:l,storePath:l,recorded:p,recordedUnverifiable:d,upstream:c,platform:s}),h=[];for(let S of n){let _=S.canonical?l:wn.default.join(S.dir,t.dir),v=S.canonical?"canonical":o;if(S.canonical||S.skipReason!==void 0){h.push({agent:KF(S),agents:S.agents.map(H=>H.id),label:JF(S),path:_,link:v,overwrite:S.canonical?m.overwrite:"fresh",blocked:S.canonical?m.blocked:!1,skipped:!S.canonical,...S.skipReason!==void 0?{skipReason:S.skipReason}:{},...S.detail!==void 0?{detail:S.detail}:{}});continue}let x=await GF({dest:_,storePath:l,recorded:p,recordedUnverifiable:d,upstream:c,platform:s}),O=Fs(x.overwrite)&&!i;h.push({agent:KF(S),agents:S.agents.map(H=>H.id),label:JF(S),path:_,link:v,overwrite:x.overwrite,blocked:O,skipped:!1,...O?{detail:VF(x,_,a)}:{}})}let g=Fs(m.overwrite)&&!i,y=h.find(S=>S.blocked),b=g?VF(m,l,a):y?.detail;return{name:t.name,dir:t.dir,description:t.description,skillPath:t.skillPath,sourceDir:t.path,storePath:l,storeOverwrite:m.overwrite,upToDate:m.upToDate,targets:h,fileCount:c.fileCount,byteCount:c.byteCount,upstream:c,onDisk:m.onDisk,recorded:p,blocked:g||y!==void 0,...b!==void 0?{detail:b}:{}}}function VF(e,t,n){return e.problem===void 0?qF(e.overwrite,t,n):`${D(n(t))} could not be verified: ${e.problem} It was not installed by the Webflow CLI, or has been changed since. Re-run with --force to replace it.`}async function GF(e){let{dest:t,storePath:n,recorded:r,upstream:o,platform:i}=e,s=(c,p,d)=>({overwrite:c,upToDate:p,onDisk:d,blocked:!1}),a;try{a=await ni.default.promises.lstat(t)}catch{return s("fresh",!1,null)}if(a.isSymbolicLink()){let c=await ni.default.promises.readlink(t).catch(()=>null),p=c===null?null:wn.default.resolve(wn.default.dirname(t),c);return p!==null&&Ye(p,n)?s("managed-update",!1,null):s("unmanaged",!1,null)}if(!a.isDirectory())return s("unmanaged",!1,null);let l;try{l=await tn(t)}catch(c){return{overwrite:"unmanaged",upToDate:!1,onDisk:null,blocked:!1,problem:D(c instanceof Error?c.message:String(c))}}if(l===null)return s("fresh",!1,null);if(r===null&&e.recordedUnverifiable)return s("managed-update",!1,l);if(r!==null)return jt(l,r,i)?s("managed-update",jt(l,o,i),l):s("locally-modified",!1,l);if(jt(l,o,i)){let c=await zF(t);return c===void 0?s("adoptable",!0,l):{overwrite:"unmanaged",upToDate:!1,onDisk:l,blocked:!1,problem:`it matches the pinned upstream content but also contains "${D(c)}", which no Webflow CLI install writes.`}}return s("unmanaged",!1,l)}async function zF(e,t="",n=0){if(n>qo)return;let r;try{r=await ni.default.promises.readdir(e,{withFileTypes:!0})}catch{return}r.sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0);for(let o of r){let i=t===""?o.name:`${t}/${o.name}`;if(o.isDirectory()){if(Jo.has(o.name))return i;let s=await zF(wn.default.join(e,o.name),i,n+1);if(s!==void 0)return s;continue}if(!o.isFile()||zo.has(o.name))return i}}function qF(e,t,n=r=>r){let r=D(n(t));return e==="locally-modified"?`${r} was installed by the Webflow CLI and has been edited since. Re-run with --force to discard those edits and replace it.`:`${r} already exists, differs from the pinned upstream content, and was not installed by the Webflow CLI (no lockfile entry). It may be managed by another tool \u2014 the Claude Code plugin marketplace installs the same skills. Re-run with --force to take ownership and replace it.`}async function PL(e){let{groups:t,skills:n,display:r}=e,o=new Map(n.map(s=>[s.name,s.dir]));if(o.size===0)return[];let i=[];for(let s of t){if(s.skipReason!==void 0)continue;let a;try{a=await ni.default.promises.readdir(s.dir,{withFileTypes:!0})}catch{continue}a.sort((c,p)=>c.name<p.name?-1:c.name>p.name?1:0);let l=_L;for(let c of a){if(l<=0)break;if(!c.isDirectory()&&!c.isSymbolicLink())continue;l-=1;let p=wn.default.join(s.dir,c.name,Ot),d;try{d=Xo(await ni.default.promises.readFile(p,"utf8")).frontmatter.name}catch{continue}let m=o.get(d);m===void 0||m===c.name||i.push(`${D(r(s.dir))} already contains "${D(c.name)}", whose ${Ot} declares the name "${D(d)}" \u2014 the same skill this install writes to "${D(m)}". Your agent would load it twice; remove one of them.`)}}return i}function Pd(e){let t=wn.default.resolve(e);for(let n of FL){let r=process.env[n]?.trim();if(r&&rt(r,t))return n}}function KF(e){return e.agents[0]?.id??""}function JF(e){let t=e.agents.map(n=>n.displayName);return t.length<=2?t.join(", "):`${t[0]} +${t.length-1} more`}async function $L(e){try{return await ni.default.promises.lstat(e),!0}catch{return!1}}async function OL(e){let t=await tn(e);if(t!==null)return t;throw new f(`The extracted skill directory ${D(e)} is no longer present. Re-run the command.`)}var Mt=1,e_=/^sha256:[0-9a-f]{64}$/,ay=128,ly=1024,XF=256,LL=/[\x00-\x1f\x7f]/;function t_(e){return e.trim()===""?"must not be empty":e!==e.trim()?"must not have leading or trailing whitespace":e.length>ay?`must be at most ${ay} characters`:e.includes("/")||e.includes("\\")?"must be a single directory name, not a path":fs(e)}function $d(e){return e.trim()===""?"must not be empty":e.length>ly?`must be at most ${ly} characters`:fs(e)}function YF(e){return(t,n)=>{let r=e(t);r!==null&&n.addIssue({code:j.ZodIssueCode.custom,message:r})}}var n_=j.string().regex(Zt,"must be a 40-character lowercase commit SHA"),r_=j.string().regex(td,"is not a usable git ref for this repository"),ZF=j.string().regex(e_,'must look like "sha256:<64 lowercase hex>"'),NL=j.string().min(1,"must not be empty").max(pd).refine(e=>e.trim()!=="","must not be blank").refine(e=>!LL.test(e),"must not contain control characters"),QF=j.string().datetime({offset:!0}),o_=j.object({commit:n_,dir:j.string().superRefine(YF(t_)),skillPath:j.string().superRefine(YF($d)).optional(),contentHash:ZF.optional(),modeHash:ZF.optional(),ref:r_.optional(),agents:j.array(j.string().min(1).max(64)).default([]),mode:j.enum(["symlink","copy"]).default("symlink"),category:j.string().min(1).max(64).optional(),installedAt:QF.optional(),updatedAt:QF.optional()}).passthrough(),i_=j.object({repo:j.string().min(1).max(XF).default(he),ref:r_.default(Ge),commit:n_.optional(),pluginVersion:j.string().min(1).max(XF).optional()}).passthrough(),s_=j.object({lockfileVersion:j.number().int().min(0),source:i_.default({}),skills:j.record(NL,o_).default({})}).passthrough();function a_(e){return e.length===0?"the lockfile":e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`).join("")}function cy(e){let[t]=e.issues;return t?`${a_([...t.path])} ${t.message}`:"did not match the expected shape"}function Od(e){return s_.safeParse(e)}var Ld=w(require("path"));nc();C();var l_="webflow-skills-lock.json",c_="skills-lock.json";function ri(e){if(typeof e!="string"||e.trim()==="")throw new f("Refusing to resolve the skills lockfile: no project directory was provided. Please report this.");return Ld.default.join(Ld.default.resolve(e),l_)}function oi(){return Ld.default.join(tc(),c_)}function Sl(e,t){return e==="global"?oi():ri(t??"")}var d_=w(require("fs"));var jL=/^<{7}/m,ML=/^\uFEFF/;async function Mn(e){let t;try{t=await d_.default.promises.readFile(e,"utf8")}catch(c){return c.code==="ENOENT"?{kind:"absent",path:e}:{kind:"corrupt",path:e,reason:"unreadable",detail:BL(c)}}let n=t.replace(ML,"");if(jL.test(n))return{kind:"corrupt",path:e,reason:"merge-conflict",detail:"unresolved merge-conflict markers"};if(n.trim()==="")return{kind:"corrupt",path:e,reason:"invalid-json",detail:"the file is empty"};let r;try{r=JSON.parse(n)}catch(c){return{kind:"corrupt",path:e,reason:"invalid-json",detail:UL(c,n)}}if(r===null||typeof r!="object"||Array.isArray(r))return{kind:"corrupt",path:e,reason:"schema",detail:`the top level is ${u_(r)}, not an object`};let o=r,i=o.lockfileVersion;if(i!==void 0&&!Number.isInteger(i))return{kind:"corrupt",path:e,reason:"schema",detail:`lockfileVersion must be an integer (got ${u_(i)})`};let s=typeof i=="number"?i:0;if(s>Mt){let c=Od(o);return{kind:"too-new",path:e,version:s,lock:c.success?c.data:null}}let a=s<Mt?{...o,lockfileVersion:Mt}:o,l=Od(a);return l.success?s<Mt?{kind:"ok",lock:l.data,path:e,migratedFrom:s}:{kind:"ok",lock:l.data,path:e}:{kind:"corrupt",path:e,reason:"schema",detail:cy(l.error)}}function BL(e){let t=e.code,n=e instanceof Error?e.message:String(e);return t?`${{EACCES:"permission denied",EPERM:"operation not permitted",EISDIR:"the path is a directory, not a file",ELOOP:"too many symbolic links",ENOTDIR:"a parent path component is not a directory"}[t]??n} (${t})`:n}function UL(e,t){let n=e instanceof Error?e.message:String(e),r=/position (\d+)/.exec(n);if(!r)return n;let o=Number(r[1]);if(!Number.isFinite(o)||o<0)return n;let i=t.slice(0,o),s=i.split(`
|
|
257
|
+
`+r+` ${ti.length} agent ids are supported. See \`webflow skills install --help\`.`,{isUserError:!0,missingFlag:"agent"})}return e.map(n=>Mn(n))}function Cd(e,t){return Bn(e).filter(n=>ny(n,e,t))}function _F(e,t){return Cd(e,t).filter(n=>n.showInSharedList!==!1)}function AF(e,t){let r=e.filter(s=>s.showInSharedPrompt!==!1).slice(0,Math.max(0,t)),o=e.length-r.length,i=r.map(s=>s.displayName).join(", ");return o>0?`${i} +${o} more`:i}function RF(e,t,n=lL){return AF(_F(e,t),n)}function xF(e,t){let n=process.stdout.columns??uL,r=Math.max(20,n-t);return e.length<=r?e:`${e.slice(0,r-1)}\u2026`}function pL(e,t,n){return t==="project"?e.skillsDir:Nt(e,t,n)??""}function xd(e,...t){let n=new Set(t.flat());return Bn(e).filter(r=>n.has(r.id))}async function CF(e,t,n){let r=Cd(e,t),o=new Set(r.map(p=>p.id)),i=Bn(e).filter(p=>!o.has(p.id)),s=new Set(n),a=RF(e,t),l=st(e,t),c=[];r.length>0&&c.push({value:"",name:xF(`\u2022 ${a}`,6),description:`all read ${l} directly \u2014 no link needed`,disabled:" (always included)"});for(let p of i){let m=pL(p,e,t),h=s.has(p.id)?" (detected)":"";c.push({value:p.id,name:xF(`${p.displayName} ${m}${h}`,8),checked:s.has(p.id)})}let d=await Cn({message:r.length>0?"Select agents to install for (shared directory is always included)":"Select agents to install for",choices:c,pageSize:Math.min(cL,Math.max(4,c.length)),validate:p=>p.length>0||r.length>0?!0:"Select at least one agent, or press Ctrl-C to cancel."});return xd(e,r.map(p=>p.id),(d??[]).filter(Boolean))}async function xl(e){let{scope:t,cwd:n,options:r}=e,o=Is(r.agent),i=r.allAgents===!0||o.includes(Sl),s=o.filter(c=>c!==Sl),a=e.recordedAgents??[];if(a.length>0&&!i&&s.length===0){let c=a.filter(d=>bl(d));return{agents:xd(t,[...c]),detected:[],source:"restored",unknownRecorded:a.filter(d=>!bl(d))}}if(s.length>0&&!i){let c=Ts(s),d=c.filter(p=>!kd(p,t));if(d.length>0){let p=d.map(m=>m.displayName).join(", ");throw new f(`${k} ${p} does not support global skill installation \u2014 its skills live inside a project.
|
|
258
|
+
Re-run without --global, or from inside the project.`,{isUserError:!0,missingFlag:"global"})}return{agents:xd(t,c.map(p=>p.id)),detected:[],source:"explicit",unknownRecorded:[]}}if(i)return{agents:[...Bn(t)],detected:[],source:"all",unknownRecorded:[]};let l=e.detected!==void 0?[...e.detected]:await Dl(t,n);if(l.length===0){if(V()){u.info(`No coding agents detected \u2014 installing to the shared skills directory only (${st(t,n)}).`);let c=Mn(tn);return{agents:c?[c]:[],detected:l,source:"store-only",unknownRecorded:[]}}return{agents:await CF(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}return r.yes||V()?{agents:xd(t,Cd(t,n).map(c=>c.id),l),detected:l,source:"detected",unknownRecorded:[]}:{agents:await CF(t,n,l),detected:l,source:"prompt",unknownRecorded:[]}}var $F=w(require("os")),Xr=w(require("path"));pe();M();var Yr=1,fL=24,mL=100,OF=8,gL=5;function ni(e,t={}){if(e==="")return"";let n=Xr.default.resolve(e),r=Xr.default.resolve(t.cwd??process.cwd()),o=Xr.default.resolve(t.home??$F.default.homedir()),i=IF(r,n);if(i!==null)return D(i===""?".":`.${Xr.default.sep}${i}`);let s=IF(o,n);return s!==null?D(s===""?"~":`~${Xr.default.sep}${s}`):D(n)}function Fd(e={}){return t=>ni(t,e)}function IF(e,t){let n=Xr.default.relative(e,t);return n===""?"":n.startsWith("..")||Xr.default.isAbsolute(n)?null:n}var TF={"locally-modified":"locally-modified",unmanaged:"exists-without-lock-entry"};function iy(e){let{plan:t,materialized:n,dryRun:r}=e,o=[],i=[];for(let h of t.skills){let g=TF[h.storeOverwrite];g!==void 0&&!t.force&&o.push({name:h.name,dir:h.dir,overwrite:h.storeOverwrite,reason:g,requiredFlag:"--force",...h.detail!==void 0?{detail:h.detail}:{}});for(let y of h.targets){if(!y.blocked)continue;let b=TF[y.overwrite];b!==void 0&&o.push({name:h.name,dir:h.dir,agent:y.agent,overwrite:y.overwrite,reason:b,requiredFlag:"--force",...y.detail!==void 0?{detail:y.detail}:{}})}}let s=new Map;for(let h of t.skills)for(let g of h.targets){if(!g.blocked)continue;let y=s.get(h.name)??new Set;y.add(g.path),s.set(h.name,y)}let a=0,l=0,c=0,d=0,p=0,m=0;for(let h of n){if(h.storeAction==="written"&&(l+=1),h.storeAction==="failed"){i.push({name:h.name,message:h.error??"the canonical store could not be written"});continue}if(h.storeAction!=="blocked"){(h.storeAction==="written"||h.storeAction==="adopted"||h.storeAction==="unchanged")&&(a+=1);for(let g of h.targets){if(g.skipped===!0){m+=1;continue}if(!g.success){if(s.get(h.name)?.has(g.path))continue;i.push({name:h.name,agent:g.agent,...g.errno!==void 0?{errno:g.errno}:{},message:g.error??"the destination could not be written"});continue}g.link==="symlink"&&(c+=1),g.link==="copy"&&g.requestedMode==="copy"&&(d+=1),g.symlinkFailed===!0&&(p+=1)}}}return r&&(m=t.skills.reduce((h,g)=>h+g.targets.filter(y=>y.skipped).length,0)),{blocked:o,failures:i,summary:{requested:t.skills.length,installed:a,skipped:m,blocked:o.length,failed:i.length,storeWrites:l,symlinks:c,copies:d,symlinkFallbacks:p}}}function sy(e,t){let n=t.display??(o=>o),r=[];r.push(se(t.dryRun?"Installation plan (dry run)":"Installation plan")),r.push(` scope ${e.scope} (${n(e.root)})`),r.push(` source ${hL(e.source)}`),r.push(` store ${n(e.storeBase)}`),r.push(` mode ${e.mode}`);for(let o of e.skills)r.push(""),r.push(` ${D(o.dir)}`),r.push(` store ${n(o.storePath)}`),r.push(...yL(o,n)),o.blocked&&o.detail!==void 0&&r.push(` ${le("blocked")} ${o.detail}`);if(e.warnings.length>0){r.push("");for(let o of e.warnings)r.push(` ${le("\u26A0")} ${o}`)}return r.join(`
|
|
259
|
+
`)}function hL(e){let t=e.pluginVersion===""?"":` (v${e.pluginVersion})`;return`${e.repo}@${LF(e.commit)}${t}`}function LF(e){return e.slice(0,OF)}function yL(e,t){let n=[],r=e.targets.filter(s=>s.link==="canonical"),o=e.targets.filter(s=>!s.skipped&&s.link==="symlink"),i=e.targets.filter(s=>!s.skipped&&s.link==="copy");r.length>0&&n.push(` shared ${Cl(r)}`),o.length>0&&n.push(` symlink \u2192 ${PF(o,t)}`),i.length>0&&n.push(` copy \u2192 ${PF(i,t)}`);for(let s of e.targets)s.skipped&&s.link!=="canonical"&&n.push(` ${I("skipped")} ${s.label}${s.detail!==void 0?` \u2014 ${s.detail}`:""}`),s.overwrite!=="fresh"&&!s.skipped&&!s.blocked&&n.push(` overwrites ${s.label} ${I(`\u2190 existing ${s.overwrite} directory will be replaced`)}`);return n}function PF(e,t){if(e.length===1){let n=e[0];return`${n.label} (${t(n.path)})`}return Cl(e)}function Cl(e,t=gL){let n=e.map(r=>D(r.label));return n.length<=t?n.join(", "):`${n.slice(0,t).join(", ")} +${n.length-t} more`}function NF(e,t={}){let n=t.display??(i=>i),r=[],{summary:o}=e;r.push(J(`Installed ${o.installed} ${oy(o.installed,"skill")}`));for(let i of e.materialized){if(i.storeAction==="blocked"||i.storeAction==="failed")continue;r.push(` ${D(n(i.storePath))}`);let s=i.targets.filter(c=>c.success&&c.link==="canonical"),a=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="symlink"),l=i.targets.filter(c=>c.success&&c.skipped!==!0&&c.link==="copy");s.length>0&&r.push(` shared: ${Cl(s)}`),a.length>0&&r.push(` symlinked: ${Cl(a)}`),l.length>0&&r.push(` copied: ${Cl(l)}`),i.detail!==void 0&&r.push(` ${I(i.detail)}`)}if(o.symlinkFallbacks>0){let i=wL(e.materialized);r.push(`${le("\u26A0")} Symlinks failed for ${o.symlinkFallbacks} ${oy(o.symlinkFallbacks,"destination")}${i.length>0?` (${i.join(", ")})`:""}. Files were copied instead.`),r.push(" On Windows, enable Developer Mode in Settings, or pass --copy to make this the default and silence this warning.")}return r.push(...bL(e.blocked)),r.push(...DL(e.failures)),r.push(..._d(e.plan.warnings)),r.join(`
|
|
260
|
+
`)}function wL(e){let t=new Set;for(let n of e)for(let r of n.targets)r.symlinkFailed===!0&&r.errno!==void 0&&t.add(r.errno);return[...t].sort()}function bL(e){if(e.length===0)return[];let t=["",le(e.length===1?"1 destination needs --force and was left untouched:":`${e.length} destinations need --force and were left untouched:`)];for(let n of e){let r=n.agent===void 0?"shared store":D(n.agent);t.push(` \u2022 ${D(n.name)} (${r})`),n.detail!==void 0&&t.push(` ${n.detail}`)}return t}function DL(e){if(e.length===0)return[];let t=["",Bt(`${e.length} ${oy(e.length,"failure")}:`)];for(let n of e){let r=n.agent===void 0?"":` (${D(n.agent)})`;t.push(` \u2022 ${D(n.name)}${r}: ${D(n.message)}`)}return t}function _d(e){return e.length===0?[]:["",...e.map(t=>`${le("\u26A0")} ${t}`)]}function oy(e,t){return e===1?t:`${t}s`}function Ad(e){let{plan:t}=e,n=new Map(e.materialized.map(r=>[r.name,r]));return{kind:"skills.install",schemaVersion:Yr,dryRun:e.dryRun,restored:e.restored,scope:t.scope,root:t.root,store:t.storeBase,mode:t.mode,force:t.force,lockfile:e.lockfilePath,source:{...t.source,cacheHit:e.cacheHit},...e.extraSources!==void 0&&e.extraSources.length>0?{sources:[t.source,...e.extraSources]}:{},skills:t.skills.map(r=>kL(r,n.get(r.name))),blocked:e.blocked,failures:e.failures,summary:e.summary,warnings:t.warnings}}function kL(e,t){let n=new Map((t?.targets??[]).map(r=>[r.path,r]));return{name:e.name,dir:e.dir,description:e.description,skillPath:e.skillPath,storePath:e.storePath,storeOverwrite:e.storeOverwrite,storeAction:t?.storeAction??null,contentHash:t?.hashes?.contentHash??null,modeHash:t?.hashes?.modeHash??null,upToDate:e.upToDate,fileCount:e.fileCount,byteCount:e.byteCount,blocked:e.blocked,detail:e.detail??null,targets:e.targets.map(r=>EL(r,n.get(r.path)))}}function EL(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 ri=["name","dir","description","status","mode","agents","scope"],Fl="name,status,agents",Ps=["name","dir","status","scope"],vL={"up-to-date":J,modified:le,missing:Bt,unmanaged:I};function jF(e,t,n={}){let r=n.columns??process.stdout.columns??mL,o=e.map(l=>t.map(c=>SL(l,c))),i=t.indexOf("description");if(i!==-1){let l=t.reduce((d,p,m)=>{if(m===i)return d;let h=Math.max(p.length,...o.map(g=>g[m].length),0);return d+h+2},0),c=Math.max(fL,r-l-2);for(let d of o)d[i]=CL(d[i],c)}let s=t.map(l=>se(l)),a=o.map((l,c)=>l.map((d,p)=>t[p]==="status"?vL[e[c].status](d):d));return qe(s,a)}function SL(e,t){switch(t){case"name":return D(e.name);case"dir":return D(e.dir);case"description":return D(e.description);case"status":return e.statusDetail===void 0?e.status:`${e.status} (${e.statusDetail})`;case"mode":return e.mode;case"agents":return xL(e);case"scope":return e.scope}}var MF="shared";function xL(e){let t=[],n=0;for(let r of e.agents){let o=D(r.id);if(!r.present){t.push(`${o} (missing)`);continue}if(r.link==="canonical"){n+=1;continue}t.push(o)}return n>0?[MF,...t].join(", "):t.join(", ")}function BF(e,t={}){let n=t.display??(s=>s),r=new Set;for(let s of e)for(let a of s.agents)a.present&&a.link==="canonical"&&r.add(a.id);if(r.size===0)return"";let o=[...r].sort().join(", "),i=t.store===void 0?"":` = ${n(t.store)}`;return I(`${MF}${i}, read directly by ${r.size} agent${r.size===1?"":"s"}:
|
|
261
|
+
${o}`)}function CL(e,t){return e.length<=t?e:t<=1?"\u2026":`${e.slice(0,t-1)}\u2026`}function UF(e,t={}){let n=t.display??(l=>l),r=e.scope==="project"?"Project":"Global",o=e.source.commit,i=e.source.pluginVersion,s=o===void 0?"":` (pinned ${LF(o)}${i===void 0?"":`, v${i}`})`,a=e.scope==="global"?e.store:e.root;return se(`${r} skills \u2014 ${n(a)}${s}`)}function ay(e){let t={total:0,upToDate:0,modified:0,missing:0,unmanaged:0};for(let n of e)for(let r of n.skills)t.total+=1,r.status==="up-to-date"?t.upToDate+=1:r.status==="modified"?t.modified+=1:r.status==="missing"?t.missing+=1:t.unmanaged+=1;return t}function WF(e){return{kind:"skills.list",schemaVersion:Yr,scopes:e.inventories.map(t=>({scope:t.scope,root:t.root,store:t.store,lockfile:t.lockfile,source:t.source,skills:t.skills.map(n=>({name:n.name,dir:n.dir,description:n.description,skillPath:n.skillPath??null,storePath:n.storePath,recordedHash:n.recordedHash,onDiskHash:n.onDiskHash,status:n.status,statusDetail:n.statusDetail??null,mode:n.mode,commit:n.commit??null,ref:n.ref??null,category:n.category??null,agents:n.agents.map(r=>({id:r.id,label:r.label,path:r.path,link:r.link,present:r.present,diverged:r.diverged??!1}))}))})),summary:ay(e.inventories),warnings:[...e.warnings]}}var ly="No skills installed. Run `webflow skills install` to get started.";function HF(e,t){let n=t==="desc"?-1:1;return(r,o)=>{let i=String(r[e]??""),s=String(o[e]??"");return i===s?r.name<o.name?-1:r.name>o.name?1:0:(i<s?-1:1)*n}}function VF(e){let t=[],{summary:n}=e;if(e.cancelled===!0)return"Update cancelled \u2014 no changes made.";if(e.skills.length===0)return ly;if(e.source.upToDate)t.push(`${P} ${D(e.source.repo)}@${D(e.source.ref)} is still ${FL(e.source.resolvedCommit)} \u2014 all ${n.checked} skill${n.checked===1?"":"s"} up to date.`);else{let o=e.checkOnly?`${Ce} ${n.outdated+n.conflicts} of ${n.checked} skills would change.`:`${P} Updated ${n.updated} skill${n.updated===1?"":"s"}`+(n.blocked>0?`, skipped ${n.blocked}`:"")+(n.failed>0?`, ${n.failed} failed`:"");t.push(o)}let r=e.skills.filter(o=>!(e.source.upToDate&&o.state==="unchanged")).map(o=>[D(o.dir),o.action,o.detail?D(o.detail):""]);r.length>0&&t.push("",qe(["SKILL","ACTION","DETAIL"],r));for(let o of e.skills)for(let i of o.targets)i.action==="relinked"&&t.push(` ${e.checkOnly?"would-relink":"relinked"} ${D(i.label)}`),i.action==="unlinked"&&t.push(` unlinked ${D(i.label)} (config directory no longer present)`);for(let o of e.failures)t.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.checkOnly&&t.push("","Dry run complete \u2014 no changes made."),t.join(`
|
|
262
|
+
`)}function FL(e){return e===null?"unknown":e.slice(0,OF)}function cy(e,t,n={}){let r=i=>D((n.display??ni)(i)),o=[];o.push(`${n.dryRun?"Would remove":"Skills to remove"} ${e.length} skill${e.length===1?"":"s"} (${t} scope):`,"");for(let i of e){if(o.push(` ${D(i.name)} \u2192 ${D(i.dir)}`),!i.onDisk&&i.targets.length===0){o.push(" (lockfile entry only \u2014 no directory on disk; the stale entry will be removed)");continue}i.onDisk&&o.push(` ${r(i.storePath)} store (`+(i.storeWillBeDeleted?"delete":`keep \u2014 still referenced by ${i.keptBecause.map(s=>D(s)).join(", ")}`)+")");for(let s of i.targets)o.push(` ${r(s.path)} ${D(s.label)} (unlink)`)}return n.dryRun&&o.push("","Dry run complete \u2014 no changes made."),o.join(`
|
|
263
|
+
`)}function GF(e,t={}){let n=o=>D((t.display??ni)(o));if(e.skills.length===0)return"No skills removed.";let r=[];r.push(`${P} Removed ${e.summary.removed} skill${e.summary.removed===1?"":"s"}`+(e.summary.failed>0?`, ${e.summary.failed} failed`:""));for(let o of e.skills){let i=o.targets.filter(a=>a.action==="unlinked"),s=o.storeAction==="deleted"?"store directory deleted":o.storeAction==="kept"?`store kept \u2014 still used by ${o.keptBecause.map(a=>D(a)).join(", ")}`:o.storeAction==="failed"?"store could not be deleted":"no directory on disk";r.push(` ${D(o.name)} \u2014 unlinked from ${i.length} location${i.length===1?"":"s"}, ${s}`)}e.removedDirectories.length>0&&r.push(` removed empty directories: ${e.removedDirectories.map(o=>n(o)).join(", ")}`);for(let o of e.failures)r.push(`${k} ${D(o.name)}: ${D(o.message)}`);return e.lockfileDeleted?r.push(`${Ce} ${n(e.lockfile)} was empty and has been removed.`):e.lockfileEmpty&&r.push(`${Ce} ${n(e.lockfile)} is now empty \u2014 commit the change, or delete the file if you are done with Webflow skills in this project.`),r.join(`
|
|
264
|
+
`)}q();C();be();Oe();A();M();X();be();A();function _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(`
|
|
265
265
|
`).length,a=o-(i.lastIndexOf(`
|
|
266
|
-
`)+1)+1;return`${n.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function
|
|
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 Ne of b)u.info(
|
|
274
|
-
Available: ${n.candidates.map(r=>D(r)).join(", ")}`:""),{isUserError:!0})}var
|
|
266
|
+
`)+1)+1;return`${n.replace(/\s*in JSON at position \d+.*$/,"")} at line ${s}, column ${a}`}function E_(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 Tl(e,t){return e<t?-1:e>t?1:0}function Os(e){return[...new Set(e)].sort(Tl)}function Ls(e){return{lockfileVersion:Mt,source:{repo:he,ref:Ge,...e},skills:{}}}function En(e){return Object.keys(e.skills).sort(Tl)}function Hd(e){return Object.keys(e.skills).length===0}function Pl(e,t){return Object.prototype.hasOwnProperty.call(e.skills,t)?e.skills[t]:void 0}function ky(e,t){return{...e,skills:{...e.skills,...t}}}function Ey(e,t){return{...e,source:{...e.source,...t}}}function vy(e,t){let n=[],r=[],o={...e.skills};for(let i of t)Object.prototype.hasOwnProperty.call(o,i)?(delete o[i],n.push(i)):r.push(i);return{lock:{...e,skills:o},removed:n,missing:r}}function $l(e,t){return{...e,installedAt:t.existing?.installedAt??t.now,updatedAt:t.now}}function Sy(e){let{installedAt:t,updatedAt:n,...r}=e;return r}var x_=require("crypto"),Ns=w(require("fs")),_y=w(require("path"));A();var S_=w(require("path"));C();function Vd(e){return D(S_.default.basename(e))}function xy(e){return D(e)}function li(e){let t=Vd(e.path),n=D(e.detail);if(e.reason==="merge-conflict")return new f(`${t} contains unresolved merge-conflict markers. Resolve the conflict, then re-run.`,{isUserError:!0});if(e.reason==="unreadable")return new f(`Could not read ${t}: ${n}.
|
|
267
|
+
${xy(e.path)}`,{isUserError:!0});let r=e.reason==="invalid-json"?`${t} is not valid JSON: ${n}`:`${t} is not a valid lockfile: ${n}`;return new f(`${r}.
|
|
268
|
+
${xy(e.path)}
|
|
269
|
+
Fix the file and re-run. It is not read as empty on purpose \u2014 that would discard the record of every installed skill on the next write.`,{isUserError:!0})}function ci(e){return new f(`Your ${Vd(e.path)} was written by a newer Webflow CLI (lockfile version ${e.version}, this CLI supports ${Mt}). Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function Cy(e,t){return new f(`Refusing to write ${Vd(e)}: it is at lockfile version ${t} and this CLI supports ${Mt}. Writing it would drop fields a newer CLI recorded. Upgrade with 'npm i -g @webflow/webflow-cli'.`,{isUserError:!0})}function Fy(e,t){let n=D(t instanceof Error?t.message:String(t));return new f(`Could not write ${Vd(e)}: ${n}.
|
|
270
|
+
${xy(e)}
|
|
271
|
+
Your skills are on disk but are not recorded, so 'webflow skills update' and 'webflow skills remove' will not see them. Fix the problem and re-run the same install \u2014 it adopts the existing directories and does not need --force.`)}var C_=420,F_=448,__=8;function Gd(e){if(Array.isArray(e))return e.map(Gd);if(e!==null&&typeof e=="object"){let t=e;return Object.fromEntries(Object.keys(t).sort(Tl).map(n=>[n,Gd(t[n])]))}return e}function tN(e,t){let n={};for(let[r,o]of Object.entries(e.skills)){let i={...o,agents:Os(o.agents??[])};n[r]=t==="project"?Sy(i):i}return{...e,skills:n}}function A_(e,t){let n=tN(e,t.kind);return`${JSON.stringify(Gd(n),null,2)}
|
|
272
|
+
`}async function R_(e,t,n){if(t.lockfileVersion>Mt)throw Cy(e,t.lockfileVersion);let r=_y.default.resolve(e),o=_y.default.dirname(r),i=A_(t,n),s=`${r}.${(0,x_.randomBytes)(6).toString("hex")}.tmp`,a=!1;try{await Ns.default.promises.mkdir(o,{recursive:!0,mode:F_});let l=await Ns.default.promises.open(s,"wx",C_);try{await l.writeFile(i,"utf8");try{await l.sync()}catch{}}finally{await l.close()}await Ns.default.promises.rename(s,r),a=!0}catch(l){throw Fy(e,l)}finally{a||await Ns.default.promises.rm(s,{force:!0}).catch(()=>{})}}async function Ay(e){try{return await Ns.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 ui(e){let t=e.batchSize??__,n=e.lock,r=0,o=0,i=!1,s=async l=>{!i&&!l?.force||(await R_(e.path,n,{kind:e.kind}),r=0,i=!1,o+=1)},a=async()=>{r+=1,i=!0,r>=t&&await s()};return{get lock(){return n},get pendingCount(){return r},get flushCount(){return o},async record(l,c){n=ky(n,{[l]:c}),await a()},async forget(l){let c=vy(n,[l]);return n=c.lock,c.removed.length===0?!1:(await a(),!0)},updateSource(l){n=Ey(n,l),i=!0},flush:s}}var I_="skills_install";async function Jd(e,t){let n=Date.now(),r=Ht(),o=r?F.forSkills({authToken:r}):null;try{let i=await nN(e??[],t);await o?.sendUsage(I_,{duration:Date.now()-n,...i})}catch(i){throw await o?.sendError(i instanceof Error?i:new Error(String(i)),I_,{duration:Date.now()-n}),new f(i,{prefix:`${k} Failed to install skills:`,...i instanceof f&&i.missingFlag!==void 0?{missingFlag:i.missingFlag}:{}})}}async function nN(e,t){let n=t.json===!0||Ze(),r=t.dryRun===!0,o=process.cwd(),i=await Rd({global:t.global,project:t.project,yes:t.yes},o,n),s=t.global!==!0&&t.project!==!0,a=i==="global"?ce.home():o,l=Fd({cwd:o,home:ce.home()}),c=i==="global"?"global":"project",d=Il(c,a),p=await Wn(d);if(p.kind==="corrupt")throw li(p);if(p.kind==="too-new")throw ci(p);let m=p.kind==="ok"?p.lock:Ls({ref:t.ref??Ge}),h=En(m),g=e.length===0&&t.allSkills!==!0&&h.length>0&&(V()||t.yes===!0);await _l(st(i,a),{dryRun:r});let y=g?sN(m,h,t.ref):[null],b=[],S=[],_=!1,v=[],x=0,O=0;for(let me of y){let Ne=await rN({group:me,names:e,options:t,scope:i,root:a,lock:m,display:l,json:n});Ne!==null&&(b.push(Ne.plan),_=_||Ne.cacheHit,v=Ne.agents,x=Math.max(x,Ne.detectedCount),O+=Ne.duplicateNameWarnings)}if(b.length===0||b.every(me=>me.skills.length===0))return n?u.info(JSON.stringify(Ad(fN({plan:b[0]??null,scope:i,root:a,lockPath:d,dryRun:r,restore:g,cacheHit:_,options:t})),null,2)):u.info("No matching skills found in the catalog \u2014 nothing to install."),Kd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O});let H=b[0];if(r){let me=$_({plans:b,materialized:[],dryRun:!0,restore:g,cacheHit:_,lockPath:d});if(n)u.info(JSON.stringify(Ad(me),null,2));else{for(let Ne of b)u.info(sy(Ne,{dryRun:!0,display:l}));u.info("Dry run complete \u2014 no changes made.")}return Kd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O})}if(t.yes!==!0&&!V()&&n)throw new f(`Installation requires confirmation, and --json cannot prompt.
|
|
273
|
+
Pass --yes to confirm, or --dry-run to preview every path first.`,{isUserError:!0,missingFlag:"--yes"});if(t.yes!==!0&&!V()){for(let Ne of b)u.info(sy(Ne,{dryRun:!1,display:l}));if(!await $e({message:"Proceed with installation?",default:!0}))return u.info("Installation cancelled."),Kd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:[],agents:v,detectedCount:x,duplicateNameWarnings:O,cancelled:!0})}let B=ui({path:d,kind:c,lock:m}),we=new Date().toISOString();for(let me of b)for(let Ne of me.skills){let E=await Al(me,Ne);S.push(E);let z=pN({plan:me,skill:E,skillPath:Ne.skillPath,existing:Pl(B.lock,E.name),previousAgents:Pl(m,E.name)?.agents??[],restore:g,kind:c,now:we});z!==null&&await B.record(E.name,z)}B.updateSource({repo:H.source.repo,ref:H.source.ref,commit:H.source.commit,pluginVersion:H.source.pluginVersion}),await B.flush({force:!0});let Se=$_({plans:b,materialized:S,dryRun:!1,restore:g,cacheHit:_,lockPath:d});return n?u.info(JSON.stringify(Ad(Se),null,2)):(u.info(NF(Se,{display:l})),u.info(`Wrote ${l(d)}`+(c==="project"?" \u2014 commit it so teammates get the same skills.":"."))),(Se.failures.length>0||Se.summary.blocked>0&&Se.summary.installed===0)&&(process.exitCode=1),Kd({scope:i,scopeAutoDetected:s,options:t,dryRun:r,restore:g,cacheHit:_,plans:b,materialized:S,agents:v,detectedCount:x,duplicateNameWarnings:O})}async function rN(e){let{group:t,names:n,options:r,scope:o,root:i,lock:s,display:a}=e,l=await xs(t===null||t.commit===void 0?{ref:t?.ref??r.ref}:{commit:t.commit,ref:t.ref}),c=await Fs(l.root),d=await Rs(c.skillsDir,l.root),p=[...c.warnings,...d.warnings],m=await aN({discovered:d.skills,names:n,allSkills:r.allSkills===!0,restoreNames:t?.names,recordedNames:En(s),warn:v=>p.push(v)});if(m.length===0)return null;let h=t===null?void 0:Os(t.names.flatMap(v=>Pl(s,v)?.agents??[])),g=await oN({scope:o,root:i,options:r,json:e.json,...h!==void 0&&h.length>0?{recordedAgents:h}:{}});for(let v of g.unknownRecorded)p.push(`The lockfile records the agent "${D(v)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);let y=g.source==="explicit"||g.source==="prompt",b=g.agents.map(v=>({agent:v,explicit:y})),S={repo:he,ref:t?.ref??l.ref,commit:l.commit,pluginVersion:c.version},_=await Rl({scope:o,root:i,mode:t?.mode??(r.copy===!0?"copy":"symlink"),force:r.force===!0,source:S,skills:m,targets:b,recorded:s.skills,warnings:p,display:a});return{plan:_,cacheHit:l.fromCache,agents:g.agents,detectedCount:g.detected.length,duplicateNameWarnings:iN(_.warnings)}}async function oN(e){let{scope:t,root:n,options:r,json:o}=e,i={scope:t,cwd:n,options:{agent:r.agent,allAgents:r.allAgents,yes:r.yes},...e.recordedAgents!==void 0?{recordedAgents:e.recordedAgents}:{}},s=(r.agent?.length??0)>0||r.allAgents===!0||(e.recordedAgents?.length??0)>0;if(o&&!s){let a=await Dl(t,n);if(a.length===0){let l=Dd(tn);return{agents:l?[l]:[],detected:a,source:"store-only",unknownRecorded:[]}}return xl({...i,detected:a})}return xl(i)}function iN(e){return e.filter(t=>t.includes("would load it twice")).length}function sN(e,t,n){let r=new Map;for(let o of t){let i=e.skills[o],s=i.ref??e.source.ref,a=n===void 0?`${i.commit}|${i.mode}`:i.mode,l=r.get(a);if(l){l.names.push(o);continue}r.set(a,{...n===void 0?{commit:i.commit}:{},ref:n??s,mode:i.mode,names:[o]})}return[...r.values()]}async function aN(e){let{discovered:t,names:n,allSkills:r,restoreNames:o,recordedNames:i,warn:s}=e;if(o!==void 0){let c=[];for(let d of o){let p=t.find(m=>m.name===d);if(p===void 0){s(`${D(d)} is recorded in the lockfile but is no longer in the catalog at that commit; skipping it.`);continue}c.push(p)}return c}let a=t.filter(c=>!c.internal);if(r)return a;if(n.length>0)return n.map(c=>lN(c,t));if(a.length===1)return a;let l=a.filter(c=>i.includes(c.name));if(V())throw new f(`No skills were named. Pass skill names, or --all-skills to install every skill in the catalog (${a.length} available).`,{isUserError:!0,missingFlag:"all-skills"});return uN(a,l)}function lN(e,t){let n=dr(e,[...t]);if(n.kind==="match")return n.skill;throw n.kind==="ambiguous"?new f(`"${D(e)}" matches more than one skill: ${n.matches.map(r=>D(r.dir)).join(", ")}. Use the full name.`,{isUserError:!0}):new f(`No skill matches "${D(e)}".`+(n.candidates.length>0?`
|
|
274
|
+
Available: ${n.candidates.map(r=>D(r)).join(", ")}`:""),{isUserError:!0})}var cN=20,T_=60;async function uN(e,t){let n=new Set(t.map(s=>s.name)),r=[...e].sort((s,a)=>P_(s.category??"",a.category??"")||P_(s.name,a.name)),o=await Cn({message:"Select skills to install",pageSize:Math.min(cN,Math.max(4,r.length)),choices:r.map(s=>({value:s.name,name:`${D(s.name)} ${dN(D(s.description))}`,checked:n.has(s.name)})),validate:s=>s.length>0?!0:"Select at least one skill, or press Ctrl-C to cancel."}),i=new Set(o??[]);return r.filter(s=>i.has(s.name))}function P_(e,t){return e<t?-1:e>t?1:0}function dN(e){return e.length<=T_?e:`${e.slice(0,T_-1)}\u2026`}function pN(e){let{plan:t,skill:n,existing:r,restore:o,kind:i,now:s}=e;if(!(n.storeAction==="written"||n.storeAction==="adopted"||n.storeAction==="unchanged")||n.hashes===null)return null;let l=new Map(t.skills.find(p=>p.name===n.name)?.targets.map(p=>[p.path,p.agents])??[]),c=[];for(let p of n.targets)p.skipped===!0||!p.success||c.push(...l.get(p.path)??[p.agent]);o&&c.push(...e.previousAgents);let d={agents:Os(c),commit:t.source.commit,contentHash:n.hashes.contentHash,modeHash:n.hashes.modeHash,dir:n.dir,mode:t.mode,ref:t.source.ref,skillPath:e.skillPath};return i==="global"?$l(d,{...r?{existing:r}:{},now:s}):d}function $_(e){let{plans:t,materialized:n,dryRun:r,restore:o,cacheHit:i,lockPath:s}=e,l={...t[0],skills:t.flatMap(d=>d.skills),warnings:[...new Set(t.flatMap(d=>d.warnings))],blocked:t.flatMap(d=>d.blocked)},c=iy({plan:l,materialized:n,dryRun:r});return{plan:l,dryRun:r,restored:o,cacheHit:i,materialized:[...n],lockfilePath:s,...c,...t.length>1?{extraSources:t.slice(1).map(d=>d.source)}:{}}}function fN(e){let t={scope:e.scope,root:e.root,storeBase:"",mode:e.options.copy===!0?"copy":"symlink",force:e.options.force===!0,source:{repo:he,ref:e.options.ref??Ge,commit:"",pluginVersion:""},skills:[],warnings:[],blocked:[]};return{plan:e.plan??t,dryRun:e.dryRun,restored:e.restore,cacheHit:e.cacheHit,materialized:[],lockfilePath:e.lockPath,blocked:[],failures:[],summary:{requested:0,installed:0,skipped:0,blocked:0,failed:0,storeWrites:0,symlinks:0,copies:0,symlinkFallbacks:0}}}function Kd(e){let t=e.plans[0],n=e.plans.flatMap(i=>i.skills),r={};for(let i of n)r[i.storeOverwrite]=(r[i.storeOverwrite]??0)+1;let o=t?iy({plan:{...t,skills:n,blocked:[]},materialized:e.materialized,dryRun:e.dryRun}):null;return{count:o?.summary.installed??0,scope:e.scope,scopeAutoDetected:e.scopeAutoDetected,mode:t?.mode??(e.options.copy===!0?"copy":"symlink"),agentCount:e.agents.length,agentIds:e.agents.map(i=>i.id),detectedAgentCount:e.detectedCount,sharedDirTargetCount:n.reduce((i,s)=>i+s.targets.filter(a=>a.link==="canonical").length,0),symlinkFallbackCount:o?.summary.symlinkFallbacks??0,symlinkFallbackErrno:[...new Set(e.materialized.flatMap(i=>i.targets.filter(s=>s.symlinkFailed===!0).map(s=>s.errno??"unknown")))].sort(),skillNames:n.map(i=>i.name),refKind:mN(e.options.ref),commit:t?.source.commit??"",pluginVersion:t?.source.pluginVersion??"",cacheHit:e.cacheHit,dryRun:e.dryRun,forced:e.options.force===!0,overwriteClasses:r,blockedCount:o?.summary.blocked??0,skippedCount:o?.summary.skipped??0,warningCount:[...new Set(e.plans.flatMap(i=>i.warnings))].length,restored:e.restore,duplicateNameWarnings:e.duplicateNameWarnings,...e.cancelled===!0?{cancelled:!0}:{}}}function mN(e){return e===void 0||e===Ge?"default":/^[0-9a-f]{40}$/.test(e)?"sha":"branch"}q();C();be();A();M();X();var zd=w(require("fs")),js=w(require("path"));var gN=256;async function O_(e){let{scope:t,lock:n}=e,r=js.default.resolve(e.root),o=st(t,r),i=e.display??(d=>d),s=e.platform??process.platform,a=[],l=[],c=new Set;for(let d of Object.keys(n.skills).sort()){let p=n.skills[d];c.add(p.dir),l.push(await hN({name:d,entry:p,scope:t,root:r,store:o,platform:s,display:i,warn:m=>a.push(m)}))}return l.push(...await DN({scope:t,root:r,store:o,recordedDirs:c})),{scope:t,root:r,store:o,lockfile:e.lockfile,source:n.source,skills:l,warnings:a}}async function hN(e){let{name:t,entry:n,scope:r,root:o,store:i,platform:s,display:a,warn:l}=e,c=js.default.join(i,n.dir),d=wN(n),p=await nn(c),m={name:t,dir:n.dir,description:await kN(c),scope:r,status:"up-to-date",mode:n.mode,storePath:c,recordedHash:n.contentHash??null,onDiskHash:p?.contentHash??null,...n.skillPath!==void 0?{skillPath:n.skillPath}:{},...n.commit!==void 0?{commit:n.commit}:{},...n.ref!==void 0?{ref:n.ref}:{},...n.category!==void 0?{category:n.category}:{},agents:[]},h=[],g;for(let y of n.agents){let b=Mn(y);if(b===void 0){h.push({id:y,label:y,path:null,link:"missing",present:!1}),l(`${D(t)} records the agent "${D(y)}", which this CLI does not know. Upgrade with 'npm i -g @webflow/webflow-cli'.`);continue}let S=Nt(b,r,o);if(S===null){h.push({id:y,label:b.displayName,path:null,link:"missing",present:!1});continue}let _=js.default.join(S,n.dir);if(Ye(_,c)){h.push({id:y,label:b.displayName,path:_,link:"canonical",present:p!==null});continue}let v=await bN(_);if(v==="missing"){h.push({id:y,label:b.displayName,path:_,link:"missing",present:!1}),l(`${D(t)} is recorded for ${D(b.displayName)} but ${D(a(_))} is no longer present. Re-run \`webflow skills install\` to restore it.`);continue}let x=!1;if(n.mode==="copy"&&v==="copy"&&d!==null){let O=await nn(_);x=O===null||!jt(O,d,s),x&&g===void 0&&(g=b.displayName)}h.push({id:y,label:b.displayName,path:_,link:v,present:!0,...x?{diverged:!0}:{}})}return{...m,agents:h,...yN({onDisk:p,recorded:d,platform:s,divergedLabel:g})}}function yN(e){let{onDisk:t,recorded:n,platform:r,divergedLabel:o}=e;return t===null?{status:"missing"}:n!==null&&!jt(t,n,r)?{status:"modified"}:o!==void 0?{status:"modified",statusDetail:`${D(o)} copy diverges`}:{status:"up-to-date"}}function wN(e){return e.contentHash===void 0?null:{contentHash:e.contentHash,modeHash:e.modeHash??""}}async function bN(e){try{let t=await zd.default.promises.lstat(e);return t.isSymbolicLink()?"symlink":t.isDirectory()?"copy":"missing"}catch{return"missing"}}async function DN(e){let{scope:t,store:n,recordedDirs:r}=e,o;try{o=await zd.default.promises.readdir(n,{withFileTypes:!0})}catch{return[]}let i=[],s=gN;for(let a of[...o].sort((l,c)=>l.name<c.name?-1:l.name>c.name?1:0)){if(s<=0)break;if(!a.isDirectory()&&!a.isSymbolicLink()||r.has(a.name)||/\.[0-9a-f]{6}\.tmp$/.test(a.name))continue;s-=1;let l=js.default.join(n,a.name),c=await nn(l);if(c===null)continue;let d=await L_(l);d!==null&&xC(d.name)&&i.push({name:d.name,dir:a.name,description:d.description,scope:t,status:"unmanaged",mode:"symlink",storePath:l,recordedHash:null,onDiskHash:c.contentHash,agents:[]})}return i}async function kN(e){return(await L_(e))?.description??""}async function L_(e){try{let t=await zd.default.promises.readFile(js.default.join(e,Ot),"utf8"),n=Qo(t);return{name:n.frontmatter.name,description:n.frontmatter.description}}catch{return null}}var N_="skills_list",EN="name",vN=dt(ri);async function qd(e){let t=Date.now(),n=Ht(),r=n?F.forSkills({authToken:n}):null;try{let o=await SN(e);await r?.sendUsage(N_,{duration:Date.now()-t,...o})}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),N_,{duration:Date.now()-t}),new f(o,{prefix:`${k} Failed to list skills:`,...o instanceof f&&o.missingFlag!==void 0?{missingFlag:o.missingFlag}:{}})}}async function SN(e){let t=e.json===!0||Ze(),n=process.cwd(),r=Fd({cwd:n,home:ce.home()}),o=[],i=CN(e.fields,o),s=FN(e.sortBy),a=_N(e.order),l=AN(e.agent),c=xN(e),d=[],p=0;for(let g of c){let y=g==="global"?ce.home():n,b=Il(g==="global"?"global":"project",y),S=await Wn(b),_;if(S.kind==="ok")_=S.lock;else if(S.kind==="too-new")_=S.lock??Ls(),o.push(`${r(b)} was written by a newer Webflow CLI (lockfile version ${S.version}); some fields may be missing here. Upgrade with 'npm i -g @webflow/webflow-cli'.`);else if(S.kind==="corrupt"){o.push(`Skipped ${r(b)} \u2014 ${S.detail}. Fix the file and re-run.`);continue}else _=Ls();let v=await O_({scope:g,root:y,lockfile:b,lock:_,display:r});o.push(...v.warnings),p+=v.skills.length,l!==null&&(v.skills=v.skills.filter(x=>x.agents.some(O=>l.has(O.id)))),v.skills.sort(HF(s,a)),d.push(v)}let m=ay(d);if(t)return u.info(JSON.stringify(WF({inventories:d,warnings:o}),null,2)),Ry({inventories:d,summary:m,fields:i,json:t,agentFilter:l});if(m.total===0){u.info(l!==null&&p>0?`No skills are linked into ${[...l].sort().join(", ")}. ${p} ${p===1?"skill is":"skills are"} installed \u2014 run \`webflow skills list\` to see ${p===1?"it":"them"}.`:ly);for(let g of _d(o))u.info(g);return Ry({inventories:d,summary:m,fields:i,json:t,agentFilter:l})}let h=[];for(let g of d){if(g.skills.length===0)continue;let y=BF(g.skills,{store:g.store,display:r});h.push([UF(g,{display:r}),"",jF(g.skills,i),...y===""?[]:["",y]].join(`
|
|
275
275
|
`))}u.info(h.join(`
|
|
276
276
|
|
|
277
|
-
`));for(let g of
|
|
278
|
-
Remove those first, or run \`webflow skills remove ${D(E.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${k} Cannot remove skills:`})}let x=[];for(let E of _)x.push(await
|
|
279
|
-
It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${k} Refusing to remove an unmanaged skill directory:`})}async function
|
|
280
|
-
Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot remove skills:`}):await
|
|
281
|
-
`+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>D(l)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot remove skills:`})}async function
|
|
282
|
-
Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot remove skills:`});return u.info(
|
|
283
|
-
Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw
|
|
284
|
-
`+a.map(l=>` ${l.state.scope}: ${
|
|
277
|
+
`));for(let g of _d(o))u.info(g);return Ry({inventories:d,summary:m,fields:i,json:t,agentFilter:l})}function xN(e){if(e.global===!0&&e.project===!0)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope"});return e.global===!0?["global"]:e.project===!0?["project"]:["project","global"]}function CN(e,t){let n=(e??Fl).split(",").map(i=>i.trim()).filter(Boolean),{valid:r,invalid:o}=vN(n);if(r.length===0)throw new f(`No valid fields specified. Available: ${ri.join(", ")}`,{isUserError:!0,missingFlag:"fields"});return o.length>0&&t.push(`Unknown field(s): ${o.join(", ")}. Available: ${ri.join(", ")}`),r}function FN(e){if(e===void 0||e==="")return EN;let t=Ps.find(n=>n===e.trim().toLowerCase());if(t===void 0)throw new f(`Cannot sort by "${e}". Available: ${Ps.join(", ")}`,{isUserError:!0,missingFlag:"sort-by"});return t}function _N(e){let t=(e??"asc").trim().toLowerCase();if(t==="asc"||t==="desc")return t;throw new f(`Invalid --order "${e}". Use asc or desc.`,{isUserError:!0,missingFlag:"order"})}function AN(e){let t=Is(e);return t.length===0?null:new Set(Ts(t).map(n=>n.id))}function Ry(e){let t=new Set;for(let n of e.inventories)for(let r of n.skills)for(let o of r.agents)t.add(o.id);return{count:e.summary.total,scopes:e.inventories.map(n=>n.scope),statusCounts:{upToDate:e.summary.upToDate,modified:e.summary.modified,missing:e.summary.missing,unmanaged:e.summary.unmanaged},agentIds:[...t].sort(),json:e.json,fieldCount:e.fields.length,agentFiltered:e.agentFilter!==null}}var _t=w(require("fs")),Ol=w(require("os")),at=w(require("path"));q();C();be();Oe();A();M();X();async function Qd(e,t){let n=Date.now(),r=JN();try{let o=t.json===!0||Ze(),i=await RN(e,t,o);await r?.sendUsage("skills_remove",{duration:Date.now()-n,count:i.summary.requested,removed:i.summary.removed,storeDeleted:i.summary.storeDeleted,storeKept:i.summary.storeKept,failed:i.summary.failed,dryRun:i.dryRun,agentFiltered:i.agents!==null}),WN(i,o),i.failures.length>0&&(process.exitCode=1)}catch(o){throw await r?.sendError(o instanceof Error?o:new Error(String(o)),"skills_remove",{duration:Date.now()-n,dryRun:t.dryRun===!0}),o instanceof f?o:new f(o,{prefix:`${k} Failed to remove skills:`})}}async function RN(e,t,n){let r=process.cwd(),o=[],i=t.dryRun===!0,s=await Rd(t,r,n),a=s==="global"?Ol.default.homedir():r,l=st(s,a),c=s==="global"?ai():si(a),d=await Wn(c);if(d.kind==="corrupt")throw li(d);if(d.kind==="too-new")throw ci(d);let p=d.kind==="ok"?d.lock:{lockfileVersion:1,source:{repo:"",ref:"main"},skills:{}},m=Is(t.agent),g=m.length===0||m.includes(Sl)?null:Ts(m).map(E=>E.id),y=Bn(s),b=await IN({agents:y,scope:s,root:a,storeBase:l,warnings:o}),S=W_(b.dirNames,p),_=await PN({names:e,options:t,identities:S,scope:s,cwd:r,json:n,warnings:o});if(_.length===0)return U_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p});let v=new Set(g??[...ti,tn]);if(g?.includes(tn))for(let E of _){let z=(E.entry?.agents??[]).filter(U=>U!==tn&&!v.has(U));if(z.length>0)throw new f(`Cannot remove the shared store for "${D(E.name)}" while ${z.map(U=>D(U)).join(", ")} still link to it.
|
|
278
|
+
Remove those first, or run \`webflow skills remove ${D(E.dir)}\` with no --agent to remove everything.`,{isUserError:!0,missingFlag:"agent",prefix:`${k} Cannot remove skills:`})}let x=[];for(let E of _)x.push(await ON({identity:E,agents:g===null?y:y.filter(z=>g.includes(z.id)),allAgents:y,scope:s,root:a,storeBase:l,removalTargets:v}));if(i)return{...Iy({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p,plans:x}),skills:x.map(E=>GN(E,s)),summary:{requested:x.length,removed:0,storeDeleted:x.filter(E=>E.storeWillBeDeleted).length,storeKept:x.filter(E=>E.onDisk&&!E.storeWillBeDeleted).length,staleLockEntriesRemoved:x.filter(E=>!E.onDisk).length,failed:0},lockfileEmpty:VN(p,x),lockfileDeleted:!1};if(!await UN(x,s,t,n))return n||u.info("Removal cancelled \u2014 no changes made."),U_({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p});let O=new Set(b.skillDirs),H=ui({path:c,kind:s,lock:p}),B=[],we=[],Se=[];for(let E of x){let z=_.find(U=>U.dir===E.dir);we.push(await NN({plan:E,identity:z,scope:s,root:a,storeBase:l,knownDirs:O,writer:H,failures:B,removedDirectories:Se}))}await H.flush({force:!0});let me=Hd(H.lock),Ne=!1;return me&&s==="global"&&(Ne=await Ay(c)),{...Iy({scope:s,root:a,storeBase:l,lockPath:c,dryRun:i,filterIds:g,warnings:o,lock:p,plans:x}),skills:we,removedDirectories:Se,failures:B,summary:{requested:x.length,removed:we.filter(E=>E.success).length,storeDeleted:we.filter(E=>E.storeAction==="deleted").length,storeKept:we.filter(E=>E.storeAction==="kept").length,staleLockEntriesRemoved:we.filter(E=>E.storeAction==="absent"&&E.lockEntry==="removed").length,failed:B.length},lockfileEmpty:me,lockfileDeleted:Ne}}async function IN(e){let{agents:t,scope:n,root:r,storeBase:o,warnings:i}=e,s=new Set,a=new Set,l=c=>i.push(c);for(let c of[o,...Py(t,n,r,l)]){if(await KN(c)){i.push(`${Ll(c)} is a symbolic link, not a directory. Skills are not removed through one \u2014 repoint or replace it, then re-run.`);continue}a.add(c);let d;try{d=await _t.default.promises.readdir(c,{withFileTypes:!0})}catch(p){let m=p.code;m!=="ENOENT"&&m!=="ENOTDIR"&&i.push(`Could not read ${Ll(c)}: ${Ty(p)}`);continue}for(let p of d)(p.isDirectory()||p.isSymbolicLink())&&s.add(p.name)}return{dirNames:s,skillDirs:a}}function Py(e,t,n,r){let o=new Set;for(let i of e){try{let a=Nt(i,t,n);if(a!==null){if(ot(n,a))o.add(a);else if(r){let l=Md(a);r(`${Ll(a)} resolves outside ${Ll(n)}`+(l?` (check $${l})`:"")+"; refusing to remove anything there.")}}}catch{}let s=at.default.resolve(n,...i.skillsDir.split("/"));s.startsWith(at.default.resolve(n)+at.default.sep)&&o.add(s)}return[...o]}function W_(e,t){let n=new Map;for(let r of e)n.set(r,{name:r,dir:r,folderName:r,entry:null});for(let r of En(t)){let o=t.skills[r];n.set(o.dir,{name:r,dir:o.dir,folderName:o.skillPath?qr(o.skillPath):o.dir,entry:o})}return[...n.values()]}function Xd(e){return e.entry===null}function TN(e){return new f(`"${D(e.dir)}" has no entry in the Webflow skills lockfile, so it was not installed by the Webflow CLI.
|
|
279
|
+
It may belong to another tool, or be hand-written. Re-run with --force to delete it anyway.`,{isUserError:!0,missingFlag:"--force",prefix:`${k} Refusing to remove an unmanaged skill directory:`})}async function PN(e){let{names:t,options:n,identities:r,scope:o,cwd:i,json:s,warnings:a}=e,l=n.force===!0,c=r.filter(h=>!Xd(h)),d=r.filter(Xd);if(t.length>0){let h=[];for(let g of t){let y=dr(g,r);if(y.kind==="match"){if(!l&&Xd(y.skill))throw TN(y.skill);h.includes(y.skill)||h.push(y.skill);continue}throw y.kind==="ambiguous"?new f(`"${D(g)}" matches ${y.matches.length} installed skills: ${y.matches.map(b=>D(b.dir)).join(", ")}.
|
|
280
|
+
Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot remove skills:`}):await $N(g,y.candidates,o,i)}return h}if(n.all)return l?r:(j_(d,a),c);if(V()||s)throw new f("Specify skill names or pass --all.",{isUserError:!0,missingFlag:"all",prefix:`${k} Nothing to remove:`});let p=l?r:c;return l||j_(d,a),p.length===0?[]:await Cn({message:`Which skills should be removed (${o} scope)?`,choices:p.map(h=>({value:h,name:`${D(h.dir)}${Xd(h)?" (not in the lockfile)":""}`})),validate:h=>h.length>0?!0:"Select at least one skill."})??[]}function j_(e,t){e.length!==0&&t.push(`${e.length} skill ${e.length===1?"directory":"directories"} have no lockfile entry and were left untouched: ${e.map(n=>D(n.dir)).join(", ")}. Pass --force to remove them too.`)}async function $N(e,t,n,r){let o=n==="project"?"global":"project",i=o==="global"?Ol.default.homedir():r,s=o==="global"?ai():si(i),a=await Wn(s);if(a.kind==="ok"||a.kind==="too-new"){let l=(a.kind==="ok",a.lock);if(l!==null){let c=await _t.default.promises.readdir(st(o,i)).catch(()=>[]);if(dr(e,W_(c,l)).kind!=="none")return new f(`"${D(e)}" is not installed at ${n} scope (${Ll(n==="global"?Ol.default.homedir():r)}), but it IS installed ${o==="global"?"globally":"in this project"}. Re-run with --${o} to remove it.`,{isUserError:!0,missingFlag:o,prefix:`${k} Cannot remove skills:`})}}return new f(`"${D(e)}" is not installed at ${n} scope.
|
|
281
|
+
`+(t.length===0?" No skills are installed at this scope.":` Installed: ${t.map(l=>D(l)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot remove skills:`})}async function ON(e){let{identity:t,agents:n,scope:r,root:o,storeBase:i,removalTargets:s}=e,a=at.default.join(i,t.dir),l=new Map;for(let m of n)for(let h of Py([m],r,o)){let g=at.default.join(h,t.dir);if(Ye(g,a))continue;let y=l.get(g);if(y){y.agents.push(m.id);continue}await Zd(g)&&l.set(g,{agent:m.id,agents:[m.id],label:m.displayName,path:g})}let c=[...l.values()].sort((m,h)=>m.path<h.path?-1:m.path>h.path?1:0),{deleted:d,keptBecause:p}=await LN({identity:t,allAgents:e.allAgents,scope:r,root:o,storeBase:i,removalTargets:s});return{name:t.name,dir:t.dir,storePath:a,onDisk:await Zd(a),targets:c,storeWillBeDeleted:d,keptBecause:p}}async function LN(e){let{identity:t,removalTargets:n}=e,r=t.entry?.agents??[];if(r.length>0){let i=r.filter(s=>!n.has(s)).sort((s,a)=>s<a?-1:s>a?1:0);return{deleted:i.length===0,keptBecause:i}}let o=[];for(let i of e.allAgents)if(!n.has(i.id))for(let s of Py([i],e.scope,e.root)){let a=at.default.join(s,t.dir);if(!Ye(a,at.default.join(e.storeBase,t.dir))&&await Zd(a)){o.push(i.id);break}}return{deleted:o.length===0,keptBecause:o.sort()}}async function NN(e){let{plan:t,identity:n,scope:r,knownDirs:o,writer:i,failures:s}=e,a=[],l=!1;for(let p of t.targets){let m=await Zd(p.path);try{await M_({target:p.path,slug:t.dir,knownDirs:o,root:e.root}),await B_(p.path),a.push({...p,action:m?"unlinked":"absent",error:null})}catch(h){l=!0;let g=Ty(h);s.push({name:n.name,agent:p.agent,...Yd(h)!==void 0?{errno:Yd(h)}:{},message:g}),a.push({...p,action:"failed",error:g})}}let c=t.onDisk?"kept":"absent";if(t.storeWillBeDeleted&&t.onDisk)try{await M_({target:t.storePath,slug:t.dir,knownDirs:o,root:e.root}),await B_(t.storePath),c="deleted"}catch(p){l=!0,c="failed",s.push({name:n.name,...Yd(p)!==void 0?{errno:Yd(p)}:{},message:Ty(p)})}else t.storeWillBeDeleted&&!t.onDisk&&(c="absent");let d="absent";return!l&&n.entry!==null&&(t.keptBecause.length>0&&c!=="deleted"?(await i.record(n.name,{...n.entry,agents:t.keptBecause}),d="updated"):d=await i.forget(n.name)?"removed":"absent"),l||e.removedDirectories.push(...await MN({targets:t.targets,storeBase:e.storeBase,storeDeleted:c==="deleted"||c==="absent",root:e.root,scope:r})),{name:n.name,dir:t.dir,scope:r,storePath:t.storePath,storeAction:c,keptBecause:t.keptBecause,lockEntry:d,targets:a,success:!l,error:null}}async function M_(e){let{target:t,slug:n,knownDirs:r,root:o}=e;if(at.default.basename(t)!==n)throw new f(`Refusing to delete ${D(t)}: its final component is not "${D(n)}".`);let i=at.default.dirname(t),s;try{s=await _t.default.promises.realpath(i)}catch{throw new f(`Refusing to delete ${D(t)}: its parent directory ${D(i)} could not be resolved.`)}if(!await jN(r,s))throw new f(`Refusing to delete ${D(t)}: ${D(i)} is not a known skills directory.`);let l=await _t.default.promises.realpath(o).catch(()=>o);if(Ye(s,l))throw new f(`Refusing to delete ${D(t)}: ${D(i)} resolves to the scope root itself, not to a skills directory.`);Ue(l,at.default.join(s,at.default.basename(t)),"a skill directory being removed")}async function jN(e,t){for(let n of e){if(Ye(n,t))return!0;let r=await _t.default.promises.realpath(n).catch(()=>null);if(r!==null&&Ye(r,t))return!0}return!1}async function B_(e){let t=null;try{t=await _t.default.promises.lstat(e)}catch{t=null}if(t!==null&&t.isSymbolicLink()){await _t.default.promises.rm(e,{force:!0});return}await _t.default.promises.rm(e,{recursive:!0,force:!0})}async function MN(e){let t=[],n=new Set([e.root,Ol.default.homedir(),at.default.dirname(e.root)].map(o=>at.default.resolve(o))),r=[];for(let o of e.targets)r.push(at.default.dirname(o.path));e.storeDeleted&&r.push(e.storeBase,at.default.dirname(e.storeBase));for(let o of r){let i=at.default.resolve(o);if(!n.has(i)&&ot(e.root,i))try{let s=await _t.default.promises.realpath(i);if(n.has(s)||!await BN(e.root,s))continue;await _t.default.promises.rmdir(s),t.push(s)}catch{}}return t}async function BN(e,t){let n=await _t.default.promises.realpath(e).catch(()=>e);return ot(n,t)&&!Ye(n,t)}async function UN(e,t,n,r){if(n.yes)return!0;if(V()||r)throw new f(`Removal requires confirmation in non-interactive mode.
|
|
282
|
+
Pass --yes to confirm, or --dry-run to see exactly what would be deleted.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot remove skills:`});return u.info(cy(e,t)),$e({message:`Remove ${e.length} skill${e.length===1?"":"s"}?`,default:!1})}function WN(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${Q} ${D(n)}`);if(e.dryRun){u.info(cy(e.skills.map(n=>({name:n.name,dir:n.dir,storePath:n.storePath,onDisk:n.storeAction!=="absent",targets:n.targets,storeWillBeDeleted:n.storeAction==="deleted",keptBecause:n.keptBecause})),e.scope,{dryRun:!0}));return}u.info(GF(e))}function HN(e,t){let n=new Set;for(let o of e??[]){let i=t.skills[o.name]?.mode;i!==void 0&&n.add(i)}if(n.size!==1)return null;let[r]=[...n];return r==="copy"?"copy":"symlink"}function Iy(e){return{kind:"skills.remove",schemaVersion:Yr,dryRun:e.dryRun,scope:e.scope,root:e.root,store:e.storeBase,lockfile:e.lockPath,mode:HN(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 U_(e){return{...Iy(e),lockfileEmpty:Hd(e.lock)}}function VN(e,t){let n=new Set(t.filter(r=>r.keptBecause.length===0).map(r=>r.name));return En(e).every(r=>n.has(r))}function GN(e,t){return{name:e.name,dir:e.dir,scope:t,storePath:e.storePath,storeAction:e.onDisk?e.storeWillBeDeleted?"deleted":"kept":"absent",keptBecause:e.keptBecause,lockEntry:e.keptBecause.length>0?"updated":"removed",targets:e.targets.map(n=>({...n,action:"unlinked",error:null})),success:!0,error:null}}async function KN(e){try{return(await _t.default.promises.lstat(e)).isSymbolicLink()}catch{return!1}}async function Zd(e){try{return await _t.default.promises.lstat(e),!0}catch{return!1}}function Yd(e){let t=e?.code;return typeof t=="string"?t:void 0}function Ty(e){return D(e instanceof Error?e.message:String(e))}function JN(){let e=Ht();return e?F.forSkills({authToken:e}):null}function Ll(e){return ni(e)}var Ms=w(require("fs")),G_=w(require("os")),vn=w(require("path"));q();C();be();Oe();A();M();X();function K_(e){let{presence:t,upstream:n,local:r,force:o}=e;if(!e.hasSkillPath){if(!e.foundByName)return{guard:"G2",state:"untracked",action:"skipped",willWrite:!1,blocked:!1,reason:"tracking-unrepairable"};let c=r==="differs";return{guard:"G2",state:"untracked",action:"repaired",willWrite:r==="absent"||n==="differs"&&!c||o,blocked:!1,reason:c&&!o?"locally-modified":null}}if(r==="absent"&&t==="missing")return{guard:"G3",state:"stale-entry",action:"stale",willWrite:!1,blocked:!1,reason:"not-on-disk-and-removed-upstream"};if(r==="absent")return{guard:"G4",state:"missing",action:"reinstalled",willWrite:!0,blocked:!1,reason:"store-directory-missing"};if(t==="missing")return{guard:"G5",state:"removed-upstream",action:"orphaned",willWrite:!1,blocked:!1,reason:r==="differs"?"removed-upstream-and-locally-modified":"removed-upstream"};let i=t==="moved",s=i?"renamed-upstream":r==="differs"?n==="differs"?"conflict":"locally-modified":n==="differs"?"upstream-changed":"unchanged";if(r==="same")return i?{guard:"grid",state:s,action:n==="differs"?"moved+updated":"moved",willWrite:!0,blocked:!1,reason:"renamed-upstream"}:n==="differs"?{guard:"grid",state:s,action:"updated",willWrite:!0,blocked:!1,reason:null}:{guard:"grid",state:s,action:"unchanged",willWrite:!1,blocked:!1,reason:null};let a=i?n==="differs"?"moved-upstream-changed-upstream-and-locally-modified":"moved-upstream-and-locally-modified":n==="differs"?"locally-modified-and-upstream-changed":"locally-modified";if(o)return{guard:"grid",state:s,action:i?n==="differs"?"moved+updated":"moved":"updated",willWrite:!0,blocked:!1,reason:a};let l=!i&&n==="same";return{guard:"grid",state:s,action:l?"skipped":"blocked",willWrite:!1,blocked:!l,reason:a}}async function ep(e,t){let n=Date.now(),r=t.check===!0||t.dryRun===!0,o=t.force===!0;if(t.global&&t.project)throw new f("Pass either --global or --project, not both.",{isUserError:!0,missingFlag:"scope",prefix:`${k} Cannot update skills:`});let i=yj(),s=t.json===!0||Ze();try{let a=await zN({names:e,options:t,checkOnly:r,force:o,json:s});await i?.sendUsage("skills_update",{duration:Date.now()-n,count:a.summary.checked,updated:a.summary.updated,blocked:a.summary.blocked,failed:a.summary.failed,relinked:a.summary.relinked,checkOnly:r,force:o,scopeCount:a.scopes.length}),gj(a,s),(a.failures.length>0||!r&&a.summary.conflicts>0&&a.summary.updated===0)&&(process.exitCode=1)}catch(a){throw await i?.sendError(a instanceof Error?a:new Error(String(a)),"skills_update",{duration:Date.now()-n,checkOnly:r,force:o}),a instanceof f?a:new f(a,{prefix:`${k} Failed to update skills:`})}}async function zN(e){let{names:t,options:n,checkOnly:r,force:o,json:i}=e,s=[],a=process.cwd(),l=await qN(n,a,r,s);if(l.length===0)return Oy({checkOnly:r,force:o,warnings:s});let c=XN(l,t,n);if(c.length===0)return Oy({checkOnly:r,force:o,warnings:s,scopes:l.map(x=>x.scope)});let d=new Map;for(let{state:x,key:O}of c){let H=$y(n,x.lock,O);d.has(H)||d.set(H,(await gl(H)).commit)}let p=new Map;for(let{state:x,key:O}of c){let H=x.lock.skills[O];p.set(`${x.scope}\0${O}`,await ej(x,H))}let m=c.every(({state:x,key:O})=>{let H=x.lock.skills[O];return d.get($y(n,x.lock,O))===H.commit}),h=c.every(({state:x,key:O})=>p.get(`${x.scope}\0${O}`)!==null);if(m&&h&&n.ref===void 0&&!o)return mj({selected:c,states:l,localDigests:p,refs:d,options:n,checkOnly:r,force:o,warnings:s});let g=new Map;for(let x of new Set(d.values()))g.set(x,await QN(x,s));let y=[],b=[];for(let{state:x,key:O}of c){let H=x.lock.skills[O],B=$y(n,x.lock,O),we=d.get(B),Se=g.get(we);try{y.push(await tj({state:x,key:O,entry:H,ref:B,commit:we,catalog:Se,force:o,checkOnly:r,localDigest:p.get(`${x.scope}\0${O}`)??null,warnings:s}))}catch(me){b.push({name:O,errno:V_(me),message:Ly(me)})}}let S=y.filter(x=>x.localDrift==="differs"&&x.outcome.willWrite);if(!r&&S.length>0&&!await uj(S,n,i))return Oy({checkOnly:r,force:o,warnings:s,scopes:l.map(O=>O.scope),cancelled:!0});let _=new Map,v=[];if(!r)for(let x of l)x.readOnly||await _l(x.storeBase,{dryRun:!1});for(let x of y)try{v.push(await oj({candidate:x,checkOnly:r,force:o,options:n,writers:_,failures:b,warnings:s}))}catch(O){b.push({name:x.key,errno:V_(O),message:Ly(O)}),v.push(dj(x,Ly(O)))}if(n.ref!==void 0&&!r)for(let x of l)x.readOnly||J_(x,_);for(let[x,O]of _){let H=l.find(me=>me.scope===x),B=n.ref??H.lock.source.ref??Ge,we=d.get(B)??y.find(me=>me.scopeState.scope===x)?.commit,Se=Y_(g);O.updateSource({ref:B,...we!==void 0?{commit:we}:{},...Se!==void 0?{pluginVersion:Se}:{}}),await O.flush({force:!0})}return fj({reports:v,candidates:y,failures:b,states:l,refs:d,catalogs:g,options:n,checkOnly:r,force:o,warnings:s})}async function qN(e,t,n,r){let o=e.global?["global"]:e.project?["project"]:["project","global"],i=[];for(let s of o){let a=s==="global"?G_.default.homedir():t,l=s==="global"?ai():si(a),c=await Wn(l);if(c.kind!=="absent"){if(c.kind==="corrupt")throw li(c);if(c.kind==="too-new"){if(!n||c.lock===null)throw ci(c);r.push(`${jl(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&&r.push(`${jl(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:n})}}return i}function XN(e,t,n){if(t.length===0)return e.flatMap(s=>En(s.lock).map(a=>({state:s,key:a})));let r=n.global===!0||n.project===!0,o=[],i=new Set;for(let s of t){let a=[];for(let l of e){let c=dr(s,ZN(l.lock));if(c.kind==="ambiguous")throw new f(`"${D(s)}" matches ${c.matches.length} installed skills at ${l.scope} scope: ${c.matches.map(d=>D(d.name)).join(", ")}.
|
|
283
|
+
Name one of them exactly.`,{isUserError:!0,prefix:`${k} Cannot update skills:`});c.kind==="match"&&a.push({state:l,key:c.skill.name})}if(a.length===0)throw YN(s,e);if(a.length>1&&!r)throw new f(`"${D(s)}" is installed at more than one scope:
|
|
284
|
+
`+a.map(l=>` ${l.state.scope}: ${jl(l.state.lockPath)}`).join(`
|
|
285
285
|
`)+`
|
|
286
|
-
Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${k} Cannot update skills:`});for(let l of a){let c=`${l.state.scope}\0${l.key}`;i.has(c)||(i.add(c),o.push(l))}}return o}function
|
|
287
|
-
`+(n.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(n)].sort().map(r=>D(r)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot update skills:`})}function
|
|
286
|
+
Re-run with --project or --global.`,{isUserError:!0,missingFlag:"scope",prefix:`${k} Cannot update skills:`});for(let l of a){let c=`${l.state.scope}\0${l.key}`;i.has(c)||(i.add(c),o.push(l))}}return o}function YN(e,t){let n=t.flatMap(r=>En(r.lock).map(o=>r.lock.skills[o]?.dir??o));return new f(`"${D(e)}" is not installed.
|
|
287
|
+
`+(n.length===0?" No skills are recorded in any lockfile.":` Installed: ${[...new Set(n)].sort().map(r=>D(r)).join(", ")}`),{isUserError:!0,prefix:`${k} Cannot update skills:`})}function ZN(e){return En(e).map(t=>{let n=e.skills[t];return{name:t,dir:n.dir,folderName:n.skillPath?qr(n.skillPath):n.dir}})}function $y(e,t,n){return e.ref??t.skills[n]?.ref??t.source.ref??Ge}async function QN(e,t){let n=await xs({commit:e}),r=await Fs(n.root),o=await Rs(r.skillsDir,n.root);return t.push(...r.warnings,...o.warnings),{commit:e,root:n.root,pluginVersion:r.version,skills:o.skills}}async function ej(e,t){let n=vn.default.join(e.storeBase,t.dir),r=await nn(n);if(r===null)return null;if(t.mode!=="copy")return r;let o=jy(t);if(o===null)return r;for(let i of hj(t)){let s=Nt(i,e.scope,e.root);if(s===null)continue;let a=await nn(vn.default.join(s,t.dir));if(a!==null&&!jt(a,o))return a}return r}async function tj(e){let{state:t,key:n,entry:r,ref:o,commit:i,catalog:s,force:a,warnings:l}=e,c=jy(r),d=vn.default.join(t.storeBase,r.dir),p=nj(r,s,l,n),m=s.skills.find(we=>we.name===n)??null,h=p!==null?"exists":m!==null?"moved":"missing",g=h==="exists"?p:h==="moved"?m.path:null,y=g===null?null:await nn(g),b=e.localDigest===null?"absent":c===null||jt(e.localDigest,c)?"same":"differs",S=jt(y,c)?"same":"differs",_=K_({hasSkillPath:typeof r.skillPath=="string"&&r.skillPath!=="",foundByName:m!==null,presence:h,upstream:S,local:b,force:a}),v=h==="moved"&&m!==null?m.dir:r.dir,x=h==="exists"?r.skillPath:h==="moved"?m.skillPath:r.skillPath??null,{agents:O,dropped:H}=rj(t,r,l),B=g===null||x===null?null:{name:n,dir:v,folderName:qr(x),description:m?.description??"",...m?.category!==void 0?{category:m.category}:{},internal:m?.internal??!1,path:g,skillPath:x,supplementaryFiles:m?.supplementaryFiles??[]};return{scopeState:t,key:n,entry:r,dir:r.dir,newDir:v,storeDir:d,mode:r.mode,agents:O,droppedAgents:H,presence:h,upstreamDrift:S,localDrift:b,outcome:_,recorded:c,onDisk:e.localDigest,upstream:y,discovered:B,ref:o,commit:i,pluginVersion:s.pluginVersion,detail:pj(_,{key:n,storeDir:d,recordedSkillPath:r.skillPath??null,newSkillPath:x,checkOnly:e.checkOnly})}}function nj(e,t,n,r){let o=e.skillPath;if(typeof o!="string"||o==="")return null;let i=Bd(o);if(i!==null)return n.push(`The recorded path for "${D(r)}" ${i}; locating it by name instead.`),null;let s=vn.default.resolve(t.root,...o.split("/"));return Ue(t.root,s,"the recorded skill path"),Ms.default.existsSync(s)?vn.default.dirname(s):null}function rj(e,t,n){let r=[],o=[];for(let i of t.agents??[]){if(i===tn){r.push(i);continue}let s=Mn(i);if(s===void 0){r.push(i);continue}if(Nt(s,e.scope,e.root)===null){o.push(i),n.push(`${D(s.displayName)} does not support ${e.scope} scope; dropping it from the recorded placement.`);continue}r.push(i)}return{agents:r,dropped:o}}async function oj(e){let{candidate:t,checkOnly:n,force:r,options:o,writers:i,failures:s}=e,{outcome:a}=t;if(t.discovered===null)return Nl(t,n,[]);let l=await ij(t,r),c=new Set(t.droppedAgents);for(let g of l.targets)if(g.skipReason==="agent-dir-absent")for(let y of g.agents)c.add(y);e.warnings.push(...l.warnings);let d=t.agents.filter(g=>!c.has(g));if(d.length===0&&d.push(tn),n)return Nl(t,!0,l.targets.map(g=>Ny(g)),[...c]);let p,m=t.onDisk;if(a.willWrite){let g=await Al(l.plan,l.skill);if(p=g.targets.map((y,b)=>z_(y,l.targets[b])),m=g.hashes,!g.success||g.storeAction==="failed"){let y=g.error??"the skill could not be written to the store";s.push({name:t.key,errno:void 0,message:y});for(let b of g.targets)!b.success&&b.error&&s.push({name:t.key,agent:b.agent,...b.errno!==void 0?{errno:b.errno}:{},message:b.error});return{...Nl(t,!1,p,[...c]),state:"failed",action:"failed",detail:y}}t.newDir!==t.dir&&await aj(t,l.targets)}else{p=[];for(let g of l.targets)p.push(await sj(t,g))}let h=d.length!==(t.entry.agents??[]).length||d.some((g,y)=>(t.entry.agents??[])[y]!==g);return lj(t,a,h,o)&&!t.scopeState.readOnly&&await J_(t.scopeState,i).record(t.key,cj(t,m,a,o,d)),Nl(t,!1,p,[...c])}async function ij(e,t){let n={repo:e.scopeState.lock.source.repo,ref:e.ref,commit:e.commit,pluginVersion:e.pluginVersion},r=[];for(let s of e.agents){if(s===tn)continue;let a=Mn(s);a!==void 0&&r.push({agent:a,explicit:!1})}let o=await Rl({scope:e.scopeState.scope,root:e.scopeState.root,mode:e.mode,force:t,source:n,skills:[e.discovered],targets:r,recorded:e.scopeState.lock.skills,platform:process.platform,display:jl}),i=o.skills[0];return{plan:o,skill:i,targets:i.targets,warnings:o.warnings}}async function sj(e,t){if(t.skipped||t.link==="canonical")return Ny(t);if(t.overwrite!=="fresh")return{...Ny(t),action:"unchanged"};let n=await jd({storeDir:e.storeDir,linkPath:t.path,slug:e.dir,root:e.scopeState.root,mode:e.mode,agent:t.agent,label:t.label});return{...z_(n,t),action:n.success?"relinked":"failed"}}async function aj(e,t){let n=e.dir,r=e.scopeState.root,o=[e.scopeState.storeBase,...t.filter(i=>!i.skipped&&i.skipReason===void 0).map(i=>vn.default.dirname(i.path))];for(let i of new Set(o)){let s=vn.default.join(i,n);if(vn.default.basename(s)===n&&s!==vn.default.join(i,e.newDir))try{let a=await Ms.default.promises.realpath(i);if(!ot(r,a))continue;await bs(r,vn.default.join(a,n),"a renamed skill directory"),(await Ms.default.promises.lstat(s)).isSymbolicLink()?await Ms.default.promises.rm(s,{force:!0}):await Ms.default.promises.rm(s,{recursive:!0,force:!0})}catch{}}}function lj(e,t,n,r){return t.willWrite||t.guard==="G2"&&t.action==="repaired"||r.ref!==void 0&&r.ref!==e.entry.ref?!0:n}function cj(e,t,n,r,o){let i=n.willWrite,s={...e.entry,commit:i?e.commit:e.entry.commit,dir:i?e.newDir:e.entry.dir,agents:[...o],mode:e.mode,...e.discovered!==null?{skillPath:e.discovered.skillPath}:{},...r.ref!==void 0?{ref:r.ref}:{}};return i&&t!==null&&(s.contentHash=t.contentHash,s.modeHash=t.modeHash),e.scopeState.scope==="global"?$l(s,{existing:e.entry,now:new Date().toISOString()}):s}function J_(e,t){let n=t.get(e.scope);if(n)return n;let r=ui({path:e.lockPath,kind:e.scope,lock:e.lock});return t.set(e.scope,r),r}async function uj(e,t,n){if(t.yes)return!0;if(V()||n)throw new f(`--force would discard local changes to ${e.length} skill${e.length===1?"":"s"}:
|
|
288
288
|
`+e.map(r=>` ${D(r.key)}`).join(`
|
|
289
289
|
`)+`
|
|
290
|
-
Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let r of e)u.warn(` ${D(r.key)}`);return $e({message:"Discard local changes and replace with upstream?",default:!1})}function
|
|
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)?[
|
|
290
|
+
Pass --yes to confirm in non-interactive mode, or --check to preview.`,{isUserError:!0,missingFlag:"--yes",prefix:`${k} Cannot update skills:`});u.warn(`--force will discard local changes to ${e.length} skill${e.length===1?"":"s"}:`);for(let r of e)u.warn(` ${D(r.key)}`);return $e({message:"Discard local changes and replace with upstream?",default:!1})}function Nl(e,t,n,r=e.droppedAgents){return{name:e.key,dir:e.newDir,scope:e.scopeState.scope,guard:e.outcome.guard,state:e.outcome.state,action:q_(e.outcome.action,t),recordedHash:e.recorded?.contentHash??null,upstreamHash:e.upstream?.contentHash??null,onDiskHash:e.onDisk?.contentHash??null,agents:e.agents.filter(o=>!r.includes(o)),droppedAgents:r,reason:e.outcome.reason,detail:e.detail,fromCommit:e.entry.commit,toCommit:e.outcome.willWrite?e.commit:null,skillPath:e.discovered?.skillPath??e.entry.skillPath??null,targets:n}}function dj(e,t){return{...Nl(e,!1,[]),state:"failed",action:"failed",detail:t}}function Ny(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 z_(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 q_(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 pj(e,t){let n=D(t.key),{checkOnly:r}=t;switch(e.reason){case"tracking-unrepairable":return"update tracking is missing and no upstream skill declares this name; nothing was changed.";case"not-on-disk-and-removed-upstream":return`not on disk and no longer published upstream. Clear the entry with \`webflow skills remove ${n}\`.`;case"store-directory-missing":return r?"the store directory is missing and would be restored.":"the store directory was missing and has been restored.";case"removed-upstream":return`no longer published upstream. Your copy is untouched \u2014 remove it with \`webflow skills remove ${n}\`.`;case"removed-upstream-and-locally-modified":return`no longer published upstream (locally modified). Your copy is untouched \u2014 remove it with \`webflow skills remove ${n}\`.`;case"locally-modified":return e.willWrite?H_(r):"your edits are preserved. Re-run with --force to discard them.";case"locally-modified-and-upstream-changed":return e.willWrite?H_(r):`updating would discard your edits. Review ${jl(t.storeDir)}, then run \`webflow skills update ${n} --force\`.`;case"renamed-upstream":return t.recordedSkillPath&&t.newSkillPath?`${D(t.recordedSkillPath)} \u2192 ${D(t.newSkillPath)}`:"moved upstream.";case"moved-upstream-and-locally-modified":return e.willWrite?r?"moved upstream; local changes would be discarded.":"moved upstream; local changes were discarded.":"moved upstream AND locally modified. Re-run with --force.";case"moved-upstream-changed-upstream-and-locally-modified":return e.willWrite?r?"moved and changed upstream; local changes would be discarded.":"moved and changed upstream; local changes were discarded.":"moved upstream, changed upstream, AND locally modified. Re-run with --force.";default:return null}}function H_(e){return e?"local changes would be discarded and replaced with upstream.":"local changes were discarded and replaced with upstream."}function fj(e){let{reports:t,candidates:n,failures:r,states:o,refs:i,options:s}=e,a=o[0],l=s.ref??a?.lock.source.ref??Ge;return{kind:"skills.update",schemaVersion:Yr,checkOnly:e.checkOnly,force:e.force,scopes:o.map(c=>c.scope),source:{repo:a?.lock.source.repo??"",ref:l,recordedCommit:a?.lock.source.commit??null,resolvedCommit:i.get(l)??null,recordedPluginVersion:a?.lock.source.pluginVersion??null,resolvedPluginVersion:Y_(e.catalogs)??null,upToDate:!1},skills:t,blocked:n.filter(c=>c.outcome.blocked).map(c=>({name:c.key,dir:c.dir,scope:c.scopeState.scope,state:c.outcome.state,reason:c.outcome.reason,requiredFlag:"--force"})),failures:r,summary:X_(t,r,e.checkOnly),warnings:[...new Set(e.warnings)]}}function X_(e,t,n){let r=(...i)=>e.filter(s=>i.includes(s.state)).length,o=new Set(["updated","moved","moved+updated","reinstalled","repaired"]);return{checked:e.length,outdated:r("upstream-changed","renamed-upstream","missing","untracked"),unchanged:r("unchanged"),locallyModified:r("locally-modified"),conflicts:r("conflict"),removedUpstream:r("removed-upstream","stale-entry"),updated:n?0:e.filter(i=>o.has(i.action)).length,relinked:e.reduce((i,s)=>i+s.targets.filter(a=>a.action==="relinked").length,0),unlinked:e.reduce((i,s)=>i+s.droppedAgents.length,0),blocked:e.filter(i=>i.action==="blocked").length,failed:t.length}}function mj(e){let{selected:t,states:n,localDigests:r,refs:o,options:i}=e,s=n[0],a=i.ref??s?.lock.source.ref??Ge,l=t.map(({state:c,key:d})=>{let p=c.lock.skills[d],m=jy(p),h=r.get(`${c.scope}\0${d}`)??null,g=m!==null&&!jt(h,m);return{name:d,dir:p.dir,scope:c.scope,guard:"grid",state:g?"locally-modified":"unchanged",action:g?"skipped":"unchanged",recordedHash:m?.contentHash??null,upstreamHash:m?.contentHash??null,onDiskHash:h?.contentHash??null,agents:p.agents??[],droppedAgents:[],reason:g?"locally-modified":null,detail:g?"your edits are preserved. Re-run with --force to discard them.":null,fromCommit:p.commit,toCommit:null,skillPath:p.skillPath??null,targets:[]}});return{kind:"skills.update",schemaVersion:Yr,checkOnly:e.checkOnly,force:e.force,scopes:n.map(c=>c.scope),source:{repo:s?.lock.source.repo??"",ref:a,recordedCommit:s?.lock.source.commit??null,resolvedCommit:o.get(a)??null,recordedPluginVersion:s?.lock.source.pluginVersion??null,resolvedPluginVersion:s?.lock.source.pluginVersion??null,upToDate:!0},skills:l,blocked:[],failures:[],summary:X_(l,[],e.checkOnly),warnings:[...new Set(e.warnings)]}}function Oy(e){return{kind:"skills.update",schemaVersion:Yr,checkOnly:e.checkOnly,force:e.force,...e.cancelled===!0?{cancelled:!0}:{},scopes:e.scopes??[],source:{repo:"",ref:Ge,recordedCommit:null,resolvedCommit:null,recordedPluginVersion:null,resolvedPluginVersion:null,upToDate:!0},skills:[],blocked:[],failures:[],summary:{checked:0,outdated:0,unchanged:0,locallyModified:0,conflicts:0,removedUpstream:0,updated:0,relinked:0,unlinked:0,blocked:0,failed:0},warnings:[...new Set(e.warnings)]}}function gj(e,t){if(t){u.info(JSON.stringify(e,null,2));return}for(let n of e.warnings)u.warn(`${Q} ${D(n)}`);u.info(VF(e))}function jy(e){return typeof e.contentHash!="string"||e.contentHash===""?null:{contentHash:e.contentHash,modeHash:typeof e.modeHash=="string"?e.modeHash:""}}function hj(e){let t=[];for(let n of e.agents??[]){let r=Mn(n);r!==void 0&&t.push(r)}return t}function Y_(e){for(let t of e.values())if(t.pluginVersion!=="")return t.pluginVersion}function V_(e){let t=e?.code;return typeof t=="string"?t:void 0}function Ly(e){return D(e instanceof Error?e.message:String(e))}function yj(){let e=Ht();return e?F.forSkills({authToken:e}):null}function jl(e){return ni(e)}var Z_=e=>{let t=e.command("skills").description("Install and manage Webflow's first-party agent skills");t.command("install").description(`Install Webflow skills into your coding agents. Writes into your home directory for --global installs; use --dry-run to preview every path first.
|
|
291
|
+
With no names, restores from webflow-skills-lock.json when one exists.`).argument("[names...]","Skill names to install (default: choose interactively)").addOption(Dc()).option("--all-agents","Install for every supported agent").option("--all-skills","Install every skill in the catalog").addOption(wa()).addOption(ba()).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(Ai()).addOption(Ae()).addOption(ee()).action(Jd),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(wa()).addOption(ba()).option("--ref <branch|sha>","Re-pin to a different branch or commit SHA").option("--force","Overwrite skills that were modified locally").addOption(Ai()).addOption(Ae()).addOption(ee()).action(ep),t.command("list").description("List installed skills and the agents they are linked into").addOption(wa()).addOption(ba()).addOption(Dc()).addOption(He([...ri]).default(Fl)).addOption(Ii([...Ps]).default("name")).addOption(Ri()).addOption(ee()).action(qd),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(Dc()).option("--all","Remove every installed skill for the scope").addOption(wa()).addOption(ba()).option("--force","Also remove skill directories that have no lockfile entry (not installed by this CLI)").addOption(Ai()).addOption(Ae()).addOption(ee()).action(Qd)};var eA=w(tc());function My(e,t){t.forEach(n=>{e.addOption(n())}),e.commands.forEach(n=>My(n,t))}function tA(e){let t=eA.default.version;e.name("webflow").description("Webflow CLI").version(t,"-v, --version").configureHelp({formatHelp(n,r){return Q_.Help.prototype.formatHelp.call(this,n,r).split(`
|
|
292
|
+
`).flatMap(o=>o.startsWith("Usage:")?["",se(o)]:/^(Options:|Commands:|Arguments:)/.test(o)?[se(o)]:/^Webflow CLI$/.test(o)?[Ky(o)]:o.trim()===""?[o]:[I(o)]).map(o=>o.trim()===""?o:` ${o}`).join(`
|
|
293
293
|
`)+`
|
|
294
|
-
`}}).addOption(
|
|
295
|
-
`)}
|
|
294
|
+
`}}).addOption(_f()).addOption(dD()).addOption(Rf()).addOption(If()).addOption(Tf()).showHelpAfterError(),Je()&&e.addOption(Af()),e.hook("preAction",async(n,r)=>{let o=n.opts();if(o.input?n.getOptionValueSource("input")==="cli"&&Zw(!0):Yw(!0),r.opts().json&&eb(!0),Vn.start(),o.manifest&&tb(o.manifest),Je()){let i=yb(o.region);hb(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 F.promptForConsentIfNeeded()}catch(i){u.debug(`Failed to check telemetry preference: ${i}`)}try{!o.skipUpdateCheck&&!Ze()&&await new la().prompt()}catch(i){u.debug(`Failed to check for package updates: ${i}`)}}),e.hook("postAction",async()=>{Vn.displayGrouped(),Vn.stop()}),yD(e),QS(e),JD(e),ME(e),DS(e),Je()&&WS(e),jE(e),lx(e),eC(e),cC(e),Z_(e),PE(e),e.commands.forEach(n=>{My(n,[_f,Rf,...Je()?[Af]:[],If,Tf])})}A();C();be();var oA=new rA.Command;tA(oA);function wj(e){let t=e instanceof Error?e.message:String(e),n=e instanceof f?e.missingFlag:void 0,r=e instanceof f?e.prefix:void 0,o=r?bt(r).replace(/^[^\p{L}\p{N}]+/u,"").replace(/:\s*$/,""):void 0;Fb(e,{prefix:r});let i=JSON.stringify({error:{message:t,context:o,missingFlag:n}});nA.default.writeSync(1,`${i}
|
|
295
|
+
`)}oA.parseAsync().catch(e=>{if(!(e instanceof f&&e.skipLogging))if(Ze())wj(e);else if(e instanceof f)if(e.isUserError){let t=e.prefix?`${e.prefix} `:"";console.error(`${t}${e.message}`)}else u.error(e,{prefix:e.prefix});else u.error(e);process.exit(1)});
|
|
296
296
|
//# sourceMappingURL=index.js.map
|