@wix/cli-app 1.0.89 → 1.1.1

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.
Files changed (65) hide show
  1. package/build/CreateVersionCommand-M57PLQFO.js +4 -0
  2. package/build/CreateVersionCommand-M57PLQFO.js.map +1 -0
  3. package/build/DevCommand-HBIIRNKJ.js +4 -0
  4. package/build/DevCommand-HBIIRNKJ.js.map +1 -0
  5. package/build/PreviewCommand-ISSV3BOT.js +4 -0
  6. package/build/PreviewCommand-ISSV3BOT.js.map +1 -0
  7. package/build/ServeCommand-PBWWH7JV.js +4 -0
  8. package/build/ServeCommand-PBWWH7JV.js.map +1 -0
  9. package/build/SiteIdProvider-OORASSSR.js +4 -0
  10. package/build/SiteIdProvider-OORASSSR.js.map +1 -0
  11. package/build/build-2RGFEOAH.js +4 -0
  12. package/build/build-2RGFEOAH.js.map +1 -0
  13. package/build/chunk-52CFCSNQ.js +65 -0
  14. package/build/chunk-52CFCSNQ.js.map +1 -0
  15. package/build/chunk-5CJ7KYIU.js +4 -0
  16. package/build/chunk-5CJ7KYIU.js.map +1 -0
  17. package/build/chunk-6G7R73WW.js +4 -0
  18. package/build/chunk-6G7R73WW.js.map +1 -0
  19. package/build/chunk-AWOTQVII.js +4 -0
  20. package/build/chunk-AWOTQVII.js.map +1 -0
  21. package/build/chunk-BNCDZAQC.js +4 -0
  22. package/build/chunk-BNCDZAQC.js.map +1 -0
  23. package/build/chunk-BOTVIAFU.js +4 -0
  24. package/build/chunk-BOTVIAFU.js.map +1 -0
  25. package/build/chunk-DUZ55BRL.js +126 -0
  26. package/build/chunk-DUZ55BRL.js.map +1 -0
  27. package/build/chunk-FGP4AKBM.js +4 -0
  28. package/build/chunk-FGP4AKBM.js.map +1 -0
  29. package/build/chunk-FJCAYHQL.js +23 -0
  30. package/build/chunk-FJCAYHQL.js.map +1 -0
  31. package/build/{chunk-QL6NVRGD.js → chunk-HFDLXX7R.js} +3 -5
  32. package/build/{chunk-QL6NVRGD.js.map → chunk-HFDLXX7R.js.map} +1 -1
  33. package/build/chunk-IJ6QC2OQ.js +4 -0
  34. package/build/chunk-IJ6QC2OQ.js.map +1 -0
  35. package/build/chunk-JDGDMH7E.js +4 -0
  36. package/build/chunk-JDGDMH7E.js.map +1 -0
  37. package/build/chunk-JI4J5GCL.js +4 -0
  38. package/build/chunk-JI4J5GCL.js.map +1 -0
  39. package/build/chunk-JZEMYLWD.js +11 -0
  40. package/build/chunk-JZEMYLWD.js.map +1 -0
  41. package/build/chunk-L4IT3FJC.js +4 -0
  42. package/build/chunk-L4IT3FJC.js.map +1 -0
  43. package/build/chunk-LHKDRLTT.js +4 -0
  44. package/build/chunk-LHKDRLTT.js.map +1 -0
  45. package/build/chunk-RGPGMVHK.js +7 -0
  46. package/build/chunk-RGPGMVHK.js.map +1 -0
  47. package/build/chunk-S7NF452E.js +4 -0
  48. package/build/chunk-S7NF452E.js.map +1 -0
  49. package/build/chunk-U6YFRFIX.js +106 -0
  50. package/build/chunk-U6YFRFIX.js.map +1 -0
  51. package/build/chunk-XVSH4K7G.js +4 -0
  52. package/build/chunk-XVSH4K7G.js.map +1 -0
  53. package/build/chunk-ZVAVQTPJ.js +24 -0
  54. package/build/chunk-ZVAVQTPJ.js.map +1 -0
  55. package/build/{devtools-BEX4ITW5.js → devtools-D522YHXH.js} +4 -6
  56. package/build/{devtools-BEX4ITW5.js.map → devtools-D522YHXH.js.map} +1 -1
  57. package/build/index.js +3 -335
  58. package/build/index.js.map +1 -1
  59. package/build/preview-3532IXSY.js +4 -0
  60. package/build/preview-3532IXSY.js.map +1 -0
  61. package/build/render-command-3GYMO4L2.js +4 -0
  62. package/build/render-command-3GYMO4L2.js.map +1 -0
  63. package/build/types.impl-HD4UTKFC.js +4 -0
  64. package/build/types.impl-HD4UTKFC.js.map +1 -0
  65. package/package.json +7 -6
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{a as ve}from"./chunk-AWOTQVII.js";import{b as de}from"./chunk-JZEMYLWD.js";import{b as j,d as le,e as _e,f as ue}from"./chunk-6G7R73WW.js";import{a as U}from"./chunk-5CJ7KYIU.js";import{A as z,B as R,C as B,F as x,G as h,I as ne,Q as me,a as re,b as oe,c as P,d as G,e as C,f as u,n as pe,o as se,u as I,v as M,w as O,x as ie,z as A}from"./chunk-U6YFRFIX.js";import{B as ce,S as W,a as D,c as f,d as g,h as c,i as L}from"./chunk-52CFCSNQ.js";import{e as y,h as p}from"./chunk-HFDLXX7R.js";p();var ae=y(D(),1);import $,{useCallback as mt}from"react";p();var Y=y(D(),1);import k from"react";p();p();var nt=y(D(),1);import q,{useState as Ot}from"react";p();p();p();var fe={actionConfig:"_actionSPIConfig"},ge={icon:"_commonImage"},he={requiredSettings:"google.protobuf.FieldMask",adminConfigurableSettings:"google.protobuf.FieldMask"};var Se={expectedInputs:"_expectedInputs"};var Ae={urlExpirationDate:"google.protobuf.Timestamp"},Pe={compData:"_componentData"},Ce={widgetComponentData:"_widgetComponentData",widgetOutOfIframeData:"_widgetOutOfIframeComponentData",studioWidgetComponentData:"_studioWidgetComponentData",shippingLabelCarrier:"_shippingLabelCarrierSpiConfig",fictionalShippingProvider:"_shippingProviderConfig",automationsActionProvider:"_actionProviderSPIConfig",identityAuthenticator:"_authenticatorConfig",multilingualTranslationSchema:"_multilingualTranslationSchema"},dt={},ct={};var Re={presetsEditorPresence:"_presetEditorPresence"},ye={expectedStartInputs:"_predefinedExpectedInput",expectedVerifyInputs:"_predefinedExpectedInput"};var lt={dateCreated:"google.protobuf.Timestamp",components:"_component"},vt={};var _t={dateCreated:"google.protobuf.Timestamp",components:"_component"};var ut={},ft={apps:"_getAppInfoResponse"};var De={urlExpirationDate:"google.protobuf.Timestamp"};var xe={referenceData:"_schema"},qe={width:"DOUBLE",length:"DOUBLE",height:"google.protobuf.DoubleValue"},be={dimension:"_packageDimension",image:"_image"};var we={configuration:"_predefinedExpectedInputConfiguration"},Ie={textInput:"_adminConfigurableTextInput"},Oe={wixMediaThumbnail:"_commonImage"};var Te={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp"};var Ne={packageTypes:"_packageType"},Ee={shippingPrice:"DOUBLE"},Je={widgetDisplay:"_widgetDisplay",editorPresence:"_editorPresence"};var Fe={widgetDisplay:"_widgetDisplay"},ke={price:"google.protobuf.FloatValue"},Le={widgetData:"_widgetComponentData"};function T(t){var e={"api._api_base_domain_":[{srcPath:"/app-service-webapp",destPath:""}],"dev._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"editor._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"blocks._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"create.editorx":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"bo._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""},{srcPath:"/app-service-webapp",destPath:"/api"}],"manage._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"www._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}]};return G(Object.assign(t,{domainToMappings:e}))}function Ge(t){var e=u(dt,{}),a=e.toJSON,r=e.fromJSON,i=u(ct,{}).fromJSON;function o(n){var m=n.host,s=a(t),d={entityFqdn:"wix.devcenter.apps.v1.app",method:"POST",methodFqn:"com.wixpress.appservice.api.Apps.Create",url:T({protoPath:"/v1/apps",data:s,host:m}),data:s,transformResponse:i};return d}return o.fromReq=r,o.__isAmbassador=!0,o}function Me(t){var e=u(vt,{}),a=e.toJSON,r=e.fromJSON,i=u(_t,{_actionProviderSPIConfig:fe,_actionSPIConfig:ge,_adminConfigurableTextInput:he,_authenticatorConfig:Se,_commonImage:Ae,_component:Pe,_componentData:Ce,_editorPresence:Re,_expectedInputs:ye,_image:De,_multilingualTranslationSchema:xe,_packageDimension:qe,_packageType:be,_predefinedExpectedInput:we,_predefinedExpectedInputConfiguration:Ie,_presetEditorPresence:Oe,_schema:Te,_shippingLabelCarrierSpiConfig:Ne,_shippingProviderConfig:Ee,_studioWidgetComponentData:Je,_widgetComponentData:Fe,_widgetDisplay:ke,_widgetOutOfIframeComponentData:Le}).fromJSON;function o(n){var m=n.host,s=a(t),d={entityFqdn:"wix.devcenter.apps.v1.app",method:"GET",methodFqn:"com.wixpress.appservice.api.Apps.GetAppSnapshot",url:T({protoPath:"/v1/apps/{appId}",data:s,host:m}),params:C(s),transformResponse:i,fallback:[{method:"GET",url:T({protoPath:"/v1/apps/{appId}",data:s,host:m}),params:C(s)}]};return d}return o.fromReq=r,o.__isAmbassador=!0,o}function ze(t){var e=u(ut,{}),a=e.toJSON,r=e.fromJSON,i=u(ft,{_actionProviderSPIConfig:fe,_actionSPIConfig:ge,_adminConfigurableTextInput:he,_authenticatorConfig:Se,_commonImage:Ae,_component:Pe,_componentData:Ce,_editorPresence:Re,_expectedInputs:ye,_getAppInfoResponse:lt,_image:De,_multilingualTranslationSchema:xe,_packageDimension:qe,_packageType:be,_predefinedExpectedInput:we,_predefinedExpectedInputConfiguration:Ie,_presetEditorPresence:Oe,_schema:Te,_shippingLabelCarrierSpiConfig:Ne,_shippingProviderConfig:Ee,_studioWidgetComponentData:Je,_widgetComponentData:Fe,_widgetDisplay:ke,_widgetOutOfIframeComponentData:Le}).fromJSON;function o(n){var m=n.host,s=a(t),d={entityFqdn:"wix.devcenter.apps.v1.app",method:"GET",methodFqn:"com.wixpress.appservice.api.Apps.GetDeveloperApps",url:T({protoPath:"/v1/apps",data:s,host:m}),params:C(s),transformResponse:i,fallback:[{method:"GET",url:T({protoPath:"/v1/apps",data:s,host:m}),params:C(s)}]};return d}return o.fromReq=r,o.__isAmbassador=!0,o}p();var gt={},ht={};var St={},At={},Pt={},Ct={};function Q(t){var e={"api._api_base_domain_":[{srcPath:"/development-sites-manager",destPath:""}],"manage._base_domain_":[{srcPath:"/development-sites-manager",destPath:""},{srcPath:"/_api/development-sites-manager",destPath:""}],"bo._base_domain_":[{srcPath:"/development-sites-manager",destPath:""}],"www.wixapps.net":[{srcPath:"/development-sites-manager/v1/development-sites",destPath:""}],"dev._base_domain_":[{srcPath:"/development-sites-manager",destPath:""}],"www.wixapis.com":[{srcPath:"/development-sites-manager/v1/development-sites",destPath:""}]};return G(Object.assign(t,{domainToMappings:e}))}function Be(t){var e=u(gt,{}),a=e.toJSON,r=e.fromJSON,i=u(ht,{}).fromJSON;function o(n){var m=n.host,s=a(t),d={method:"POST",url:Q({protoPath:"/v1/development-sites",data:s,host:m}),data:s,transformResponse:i};return d}return o.fromReq=r,o}function We(t){var e=u(Pt,{}),a=e.toJSON,r=e.fromJSON,i=u(Ct,{}).fromJSON;function o(n){var m=n.host,s=a(t),d={method:"GET",url:Q({protoPath:"/v1/development-sites",data:s,host:m}),params:C(s),transformResponse:i};return d}return o.fromReq=r,o}function Ue(t){var e=u(St,{}),a=e.toJSON,r=e.fromJSON,i=u(At,{}).fromJSON;function o(n){var m=n.host,s=a(t),d={method:"GET",url:Q({protoPath:"/v1/development-sites-limit",data:s,host:m}),params:C(s),transformResponse:i};return d}return o.fromReq=r,o}p();var je=c.object({appId:c.string()}),He=c.object({latestVersion:c.string()}),Ve=c.object({developmentSite:c.object({id:c.string(),siteName:c.string()})}),Ke=c.object({developmentSites:c.array(c.object({}))}),Ye=c.object({limit:c.number()}),Rt=c.object({name:c.string(),appId:c.string()}),$e=c.object({apps:c.array(Rt)});var yt="a573279f-ae6f-46d1-8556-7c93ae9b2c84",H=class{constructor(e){this.httpClient=e;let{minRetryTimeout:a}=L();this.retryOptions={retries:3,minTimeout:a,maxTimeout:3*1e3}}retryOptions;createApp=async e=>{try{let{data:a}=await P(()=>this.httpClient.request(Ge(e)),this.retryOptions);return je.parse(a)}catch(a){throw new f({code:g.FailedToCreateDevCenterApp(),cause:a})}};getAppSnapshot=async e=>{let{data:a}=await P(()=>this.httpClient.request(Me(e)),this.retryOptions);return He.parse(a)};createDevSite=async e=>{try{let{data:a}=await P(()=>this.httpClient.request(Be({templateId:yt})),this.retryOptions),{id:r}=Ve.parse(a).developmentSite;return await P(async()=>{let o=await e.getSite(r);if(!o)throw new f({code:g.SiteNotFound(),info:{id:r}});return o},this.retryOptions)}catch(a){throw new f({code:g.FailedToCreateDevelopmentSite(),cause:a})}};getDevSitesCount=async()=>{try{let{data:e}=await P(()=>this.httpClient.request(We({})),this.retryOptions);return Ke.parse(e).developmentSites.length}catch(e){throw new f({code:g.FailedToGetDevelopmentSites(),cause:e})}};getDeveloperApps=async()=>{try{let{data:e}=await P(()=>this.httpClient.request(ze({})),this.retryOptions);return $e.parse(e).apps}catch(e){throw new f({code:g.FailedToGetDeveloperApps(),cause:e})}};getDevSitesLimit=async()=>{try{let{data:e}=await P(()=>this.httpClient.request(Ue({})),this.retryOptions);return Ye.parse(e).limit}catch(e){throw new f({code:g.FailedToGetDevelopmentSitesLimit(),cause:e})}}};p();import{useMemo as Dt}from"react";function N(){let t=U({type:"backoffice"});return Dt(()=>new H(t),[t])}p();var Xe=y(D(),1);import Qe from"react";var Ze=({onSubmit:t,onError:e,sites:a})=>{let{t:r}=h(),{getDevSitesCount:i,getDevSitesLimit:o}=N(),{status:n}=R(()=>Promise.all([i(),o()]),[],{onError:e});return(0,Xe.match)(n,{Error:()=>null,Loading:()=>Qe.createElement(A,{text:r("general.loading")}),Success:({result:[m,s]})=>{let d=m>=s,_=a.length===0;return Qe.createElement(M,{label:r("site_type_select.label"),options:[{availability:_?I.Disabled({reason:r("site_type_select.no_sites")}):I.Enabled(),title:r("site_type_select.pick_existing_site"),value:"select-existing-site"},{title:r("site_type_select.create_new_dev_site"),value:"create-dev-site",availability:d?I.Disabled({reason:r("site_type_select.create_new_dev_site.disabled",{limit:s})}):I.Enabled()}],onSubmit:({value:S})=>t(S)})}})};p();var at=y(D(),1);import w from"react";p();import X from"react";p();p();import{useMemo as xt}from"react";p();p();var et=c.record(c.object({appDefinitionId:c.string().optional(),permissions:c.object({revoked:c.boolean()}).optional()}));var V=class{constructor(e){this.httpClient=e}isAppInstalled=async({metaSiteId:e,appId:a})=>{try{let{data:r}=await this.httpClient.request({url:`/_api/msm/v1/meta-site/editor-client-spec-map/${e}`}),i=et.parse(r);return Object.values(i).some(n=>n.appDefinitionId===a&&!n.permissions?.revoked)}catch(r){throw new f({code:g.FailedToCheckIfAppInstalled(),cause:r})}}};function E(){let t=U({type:"general"});return xt(()=>new V(t),[t])}var b=y(D(),1);p();import J from"react";var tt=({siteId:t,appId:e})=>(pe(async(a,r)=>{r.return&&await me(`https://manage.wix.com/installer/install?metaSiteId=${t}&appId=${e}&platform=cli&version=latest`)}),J.createElement(J.Fragment,null,J.createElement(x,{i18nKey:"install_app_on_site.warning"}),J.createElement(x,{i18nKey:"install_app_on_site.warning.instructions",components:[J.createElement(ie,{value:"enter"})]})));var Z=(0,b.variant)({Success:{},Canceled:{}});function qt(t){return t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"}var K=({appId:t,site:e,onSubmit:a,onError:r})=>{let{isAppInstalled:i}=E(),{status:o}=R(async({signal:n})=>{let{appInstallationPollInterval:m}=L();try{return await oe(()=>i({metaSiteId:e.id,appId:t}),{interval:m??2e3,timeout:{milliseconds:60*1e3*2,signal:n}}),Z.Success()}catch(s){if(s instanceof re)throw new f({code:g.SiteSelectorTimedout(),cause:s});if(qt(s))return Z.Canceled();throw s}},[],{onError:r,onSuccess:n=>{(0,b.isType)(n,Z.Success)&&a()}});return(0,b.match)(o,{Error:()=>null,Loading:()=>X.createElement(tt,{siteId:e.id,appId:t}),Success:()=>X.createElement(O,{type:"success"},X.createElement(x,{i18nKey:"install_app_on_site.finished_successfully"}))})};var rt=({status:t,appId:e,onSubmit:a,onError:r})=>{let{t:i}=h();return(0,at.match)(t,{NotRequested:()=>null,Error:()=>null,Loading:()=>w.createElement(A,{text:i("create_dev_site.loading")}),Success:({result:o})=>w.createElement(w.Fragment,null,w.createElement(x,{i18nKey:"create_dev_site.success",components:[w.createElement(se,{skin:"success",bold:!0})],values:{name:o.displayName}}),w.createElement(K,{appId:e,site:o,onSubmit:()=>a(o),onError:r}))})};var ot={"general.loading":"Loading...","site_type_select.label":"Select Development Site","site_type_select.create_new_dev_site":"Create a new Development Site","site_type_select.create_new_dev_site.disabled":"You have reached the maximum number of {limit} Development Sites","site_type_select.pick_existing_site":"Pick an existing site","site_type_select.no_sites":"No sites found","create_dev_site.loading":"Creating your new Development Site...","create_dev_site.success":"Development Site <0>{name}</0> created successfully! \u{1F680}","site_list_select.label":"Select Site","install_app_on_site.warning":"Your new application needs to be installed on the selected Development Site","install_app_on_site.warning.instructions":"Press <0/> to install the application in your browser","install_app_on_site.finished_successfully":"App installed on Development Site."};p();import F,{useState as It}from"react";var st=y(D(),1);p();import wt from"react";var pt=({onSubmit:t,sites:e})=>{let{t:a}=h();return wt.createElement(M,{label:a("site_list_select.label"),options:e.map(r=>({key:r.id,title:r.displayName,description:r.viewUrl,value:r})),onSubmit:({value:r})=>t(r)})};var it=({sites:t,appId:e,onSubmit:a,onError:r})=>{let{t:i}=h(),{isAppInstalled:o}=E(),[n,m]=It(null),s=B((_,S)=>o({metaSiteId:S.id,appId:e}),{onError:r});async function d(_){await s.execute(_)?a(_):m(_)}return F.createElement(F.Fragment,null,F.createElement(pt,{onSubmit:d,sites:t}),(0,st.isType)(s.status,"Loading")&&F.createElement(A,{text:i("general.loading")}),n&&F.createElement(K,{appId:e,site:n,onSubmit:()=>a(n),onError:r}))};var ee=({appId:t,onSubmit:e,onError:a})=>{let{t:r}=h(),[i,o]=Ot(null),{createDevSite:n}=N(),m=j(),{status:s}=R(()=>m.querySites({query:{cursorPaging:{limit:100}}}),[],{onError:a}),d=B(()=>n(m),{onError:a});function _(S){o(S),S==="create-dev-site"&&d.execute()}return q.createElement(ne,{messages:ot},(0,nt.match)(s,{Error:()=>null,Loading:()=>q.createElement(A,{text:r("general.loading")}),Success:({result:S})=>q.createElement(q.Fragment,null,q.createElement(Ze,{onSubmit:_,onError:a,sites:S}),i==="create-dev-site"&&q.createElement(rt,{status:d.status,appId:t,onSubmit:e,onError:a}),i==="select-existing-site"&&q.createElement(it,{sites:S,appId:t,onSubmit:e,onError:a}))}))};var te=({state:t,onSubmit:e})=>{let a=z(),{t:r}=h(),{model:i}=W();return k.createElement(k.Fragment,null,(0,Y.match)(t,{NotConfigured:(0,Y.constant)(k.createElement(O,{type:"insight"},r("general.no_site_id_configured"))),NotFound:({id:o})=>k.createElement(O,{type:"error"},r("general.site_id_not_found",{id:o}))}),k.createElement(ee,{appId:i.config.appId,onSubmit:e,onError:a}))};var Wr=({children:t})=>{let e=z(),{model:{projectFolder:a}}=W(),r=de(),i=j(),{status:o,merge:n}=R(async()=>ue({projectFolder:a,siteListClient:i,writeDebugLog:r}),[]),m=mt(async d=>{try{await le(a,{siteId:d.id}),n({result:_e.Resolved({site:d})})}catch{throw new f({code:g.FailedToSaveDevelopmentSite({path:ce})})}},[n,a]),s=mt(d=>m(d).catch(e),[e,m]);return(0,ae.match)(o,{Error:()=>null,Loading:()=>$.createElement(A,null),Success:({result:d})=>(0,ae.match)(d,{NotConfigured:_=>$.createElement(te,{state:_,onSubmit:s}),NotFound:_=>$.createElement(te,{state:_,onSubmit:s}),Resolved:({site:_})=>$.createElement(ve.Provider,{value:{site:_,setSite:m}},typeof t=="function"?t(_):t)})})};export{N as a,ee as b,Wr as c};
4
+ //# sourceMappingURL=chunk-XVSH4K7G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/site-id/SiteIdProvider.tsx","../src/site-id/ResolveSiteId.tsx","../../cli-site-selector/src/index.ts","../../cli-site-selector/src/SiteSelector.tsx","../../dev-center-client/src/index.ts","../../dev-center-client/src/dev-center-client.ts","../../../node_modules/@wix/ambassador-devcenter-apps-v1-app/http.impl.ts","../../../node_modules/@wix/ambassador-devcenter-dsm-v1-development-site/http.impl.ts","../../dev-center-client/src/schemas.ts","../../dev-center-client/src/useDevCenterClient.ts","../../cli-site-selector/src/SiteTypeSelect.tsx","../../cli-site-selector/src/CreateDevSite.tsx","../../cli-site-selector/src/WaitForAppToBeInstalled.tsx","../../metasite-manager-client/src/index.ts","../../metasite-manager-client/src/useMetasiteManagerClient.ts","../../metasite-manager-client/src/metasite-manager-client.ts","../../metasite-manager-client/src/schemas.ts","../../cli-site-selector/src/OpenBrowser.tsx","../../cli-site-selector/src/messages.json","../../cli-site-selector/src/SelectExistingSite.tsx","../../cli-site-selector/src/SiteListSelect.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useCallback } from 'react';\nimport { match } from 'variant';\nimport { useDebugLog } from '@wix/cli-debug-log';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { APP_CONFIG_PATH } from '@wix/cli-app-definitions';\nimport { useAsync, useExit, Spinner } from '@wix/cli-ui-kit';\nimport { type Site, useSiteListClient } from '@wix/site-list-client';\nimport { saveAppConfig } from '../files/app.config.js';\nimport { useProjectModel } from '../model.js';\nimport { ResolveSiteId } from './ResolveSiteId.js';\nimport { SiteIdContext } from './context.js';\nimport { SiteIdState } from './site-id-state.js';\nimport { resolveConfiguredSite } from './resolve-configured-site.js';\n\nexport const SiteIdProvider: FC<{\n children: ReactNode | ((site: Site) => ReactNode);\n}> = ({ children }) => {\n const exit = useExit();\n const {\n model: { projectFolder },\n } = useProjectModel();\n const writeDebugLog = useDebugLog();\n const siteListClient = useSiteListClient();\n\n const { status, merge } = useAsync(\n async () =>\n resolveConfiguredSite({\n projectFolder,\n siteListClient,\n writeDebugLog,\n }),\n []\n );\n\n const setSite = useCallback(\n async (site: Site) => {\n try {\n await saveAppConfig(projectFolder, { siteId: site.id });\n merge({ result: SiteIdState.Resolved({ site }) });\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToSaveDevelopmentSite({\n path: APP_CONFIG_PATH,\n }),\n });\n }\n },\n [merge, projectFolder]\n );\n\n const handleResolveSiteId = useCallback(\n (site: Site) => setSite(site).catch(exit),\n [exit, setSite]\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner />,\n Success: ({ result: state }) => {\n return match(state, {\n NotConfigured: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n NotFound: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n Resolved: ({ site }) => (\n <SiteIdContext.Provider value={{ site, setSite }}>\n {typeof children === 'function' ? children(site) : children}\n </SiteIdContext.Provider>\n ),\n });\n },\n });\n};\n","import React, { type FC } from 'react';\nimport { match, constant } from 'variant';\nimport type { Site } from '@wix/site-list-client';\nimport { Alert, useExit } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { SiteSelector } from '@wix/cli-site-selector';\nimport { useProjectModel } from '../model.js';\nimport type { SiteIdState } from './site-id-state.js';\n\ninterface Props {\n state: SiteIdState<'NotConfigured' | 'NotFound'>;\n onSubmit: (site: Site) => void;\n}\n\nexport const ResolveSiteId: FC<Props> = ({ state, onSubmit }) => {\n const exit = useExit();\n const { t } = useTranslation();\n const { model } = useProjectModel();\n\n return (\n <>\n {match(state, {\n NotConfigured: constant(\n <Alert type=\"insight\">{t('general.no_site_id_configured')}</Alert>\n ),\n NotFound: ({ id }) => (\n <Alert type=\"error\">{t('general.site_id_not_found', { id })}</Alert>\n ),\n })}\n <SiteSelector\n appId={model.config.appId}\n onSubmit={onSubmit}\n onError={exit}\n />\n </>\n );\n};\n","export { SiteSelector } from './SiteSelector.js';\n","import React, { type FC, useState } from 'react';\nimport { match } from 'variant';\nimport { I18nProvider, useTranslation } from '@wix/cli-i18n';\nimport type { Site } from '@wix/site-list-client';\nimport { Spinner, useAsync, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport { useSiteListClient } from '@wix/site-list-client';\nimport { SiteTypeSelect, type SiteType } from './SiteTypeSelect.js';\nimport { CreateDevSite } from './CreateDevSite.js';\nimport messages from './messages.json';\nimport { SelectExistingSite } from './SelectExistingSite.js';\n\ninterface Props {\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SiteSelector: FC<Props> = ({ appId, onSubmit, onError }) => {\n const { t } = useTranslation();\n const [siteType, setSiteType] = useState<SiteType | null>(null);\n const { createDevSite } = useDevCenterClient();\n const siteListClient = useSiteListClient();\n\n const { status } = useAsync(\n () =>\n siteListClient.querySites({\n query: {\n cursorPaging: {\n limit: 100,\n },\n },\n }),\n [],\n {\n onError,\n }\n );\n\n const createSite = useAsyncCallback(() => createDevSite(siteListClient), {\n onError,\n });\n\n function handleSelectSiteType(siteType: SiteType) {\n setSiteType(siteType);\n if (siteType === 'create-dev-site') {\n createSite.execute();\n }\n }\n\n return (\n <I18nProvider messages={messages}>\n {match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('general.loading')} />,\n Success: ({ result: sites }) => (\n <>\n <SiteTypeSelect\n onSubmit={handleSelectSiteType}\n onError={onError}\n sites={sites}\n />\n {siteType === 'create-dev-site' && (\n <CreateDevSite\n status={createSite.status}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n {siteType === 'select-existing-site' && (\n <SelectExistingSite\n sites={sites}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n </>\n ),\n })}\n </I18nProvider>\n );\n};\n","export { DevCenterClient } from './dev-center-client.js';\nexport type { DeveloperApp } from './schemas.js';\nexport { useDevCenterClient } from './useDevCenterClient.js';\n","import { getTestOverrides } from '@wix/cli-test-overrides';\nimport pRetry, { type Options } from 'p-retry';\nimport { type HttpClient } from '@wix/cli-http-client';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type {\n GetAppRequest,\n CreateAppRequest,\n} from '@wix/ambassador-devcenter-apps-v1-app/types';\nimport {\n getAppSnapshot,\n create as createApp,\n getDeveloperApps,\n} from '@wix/ambassador-devcenter-apps-v1-app/http';\nimport {\n getDevelopmentSites,\n createDevelopmentSite,\n getDevelopmentSitesLimit,\n} from '@wix/ambassador-devcenter-dsm-v1-development-site/http';\nimport type { SiteListClient } from '@wix/site-list-client';\nimport {\n createAppSchema,\n appSnapshotSchema,\n createDevelopmentSiteSchema,\n getDevelopmentSitesLimitSchema,\n getDevelopmentSitesSchema,\n getDeveloperAppsSchema,\n} from './schemas.js';\n\nconst EMPTY_SITE_TEMPLATE = 'a573279f-ae6f-46d1-8556-7c93ae9b2c84';\n\nexport class DevCenterClient {\n private readonly retryOptions: Options;\n\n constructor(private readonly httpClient: HttpClient) {\n const { minRetryTimeout } = getTestOverrides();\n\n this.retryOptions = {\n retries: 3,\n minTimeout: minRetryTimeout,\n maxTimeout: 3 * 1000,\n };\n }\n\n createApp = async (opts: CreateAppRequest) => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(createApp(opts)),\n this.retryOptions\n );\n\n return createAppSchema.parse(data);\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCreateDevCenterApp(),\n cause: e,\n });\n }\n };\n\n getAppSnapshot = async (req: GetAppRequest) => {\n const { data } = await pRetry(\n () => this.httpClient.request(getAppSnapshot(req)),\n this.retryOptions\n );\n\n return appSnapshotSchema.parse(data);\n };\n\n createDevSite = async (siteListClient: SiteListClient) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n createDevelopmentSite({\n templateId: EMPTY_SITE_TEMPLATE,\n })\n ),\n this.retryOptions\n );\n\n const { id } = createDevelopmentSiteSchema.parse(data).developmentSite;\n\n // 'createDevSite' is missing displayName and viewUrl\n const site = await pRetry(async () => {\n const site = await siteListClient.getSite(id);\n if (!site) {\n throw new CliError({\n code: CliErrorCode.SiteNotFound(),\n info: { id },\n });\n }\n return site;\n }, this.retryOptions);\n\n return site;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCreateDevelopmentSite(),\n cause: e,\n });\n }\n };\n\n getDevSitesCount = async () => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(getDevelopmentSites({})),\n this.retryOptions\n );\n\n return getDevelopmentSitesSchema.parse(data).developmentSites.length;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetDevelopmentSites(),\n cause: e,\n });\n }\n };\n\n getDeveloperApps = async () => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(getDeveloperApps({})),\n this.retryOptions\n );\n\n return getDeveloperAppsSchema.parse(data).apps;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetDeveloperApps(),\n cause: e,\n });\n }\n };\n\n getDevSitesLimit = async () => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(getDevelopmentSitesLimit({})),\n this.retryOptions\n );\n\n return getDevelopmentSitesLimitSchema.parse(data).limit;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetDevelopmentSitesLimit(),\n cause: e,\n });\n }\n };\n}\n",null,null,"import { z } from 'zod';\n\nexport const createAppSchema = z.object({\n appId: z.string(),\n});\n\nexport const appSnapshotSchema = z.object({\n latestVersion: z.string(),\n});\n\nexport const createDevelopmentSiteSchema = z.object({\n developmentSite: z.object({\n id: z.string(),\n siteName: z.string(),\n }),\n});\n\nexport const getDevelopmentSitesSchema = z.object({\n developmentSites: z.array(z.object({})),\n});\n\nexport const getDevelopmentSitesLimitSchema = z.object({\n limit: z.number(),\n});\n\nexport const developerAppSchema = z.object({\n name: z.string(),\n appId: z.string(),\n});\n\nexport const getDeveloperAppsSchema = z.object({\n apps: z.array(developerAppSchema),\n});\n\nexport type DeveloperApp = z.TypeOf<typeof developerAppSchema>;\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { DevCenterClient } from './dev-center-client.js';\n\nexport function useDevCenterClient(): DevCenterClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new DevCenterClient(httpClient), [httpClient]);\n}\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport {\n Spinner,\n SelectInput,\n useAsync,\n SelectOptionAvailability,\n} from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport type { Site } from '@wix/site-list-client';\n\nexport type SiteType = 'create-dev-site' | 'select-existing-site';\ninterface Props {\n onSubmit: (siteType: SiteType) => void;\n onError: (error: unknown) => void;\n sites: Site[];\n}\n\nexport const SiteTypeSelect: FC<Props> = ({ onSubmit, onError, sites }) => {\n const { t } = useTranslation();\n const { getDevSitesCount, getDevSitesLimit } = useDevCenterClient();\n const { status } = useAsync(\n () => Promise.all([getDevSitesCount(), getDevSitesLimit()]),\n [],\n { onError }\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('general.loading')} />,\n Success: ({ result: [devSitesCount, devSitesLimit] }) => {\n const isDevSitesLimitReached = devSitesCount >= devSitesLimit;\n const userHasNoSites = sites.length === 0;\n\n return (\n <SelectInput<SiteType>\n label={t('site_type_select.label')}\n options={[\n {\n availability: userHasNoSites\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.no_sites'),\n })\n : SelectOptionAvailability.Enabled(),\n title: t('site_type_select.pick_existing_site'),\n value: 'select-existing-site',\n },\n {\n title: t('site_type_select.create_new_dev_site'),\n value: 'create-dev-site',\n availability: isDevSitesLimitReached\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.create_new_dev_site.disabled', {\n limit: devSitesLimit,\n }),\n })\n : SelectOptionAvailability.Enabled(),\n },\n ]}\n onSubmit={({ value }) => onSubmit(value)}\n />\n );\n },\n });\n};\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport type { AsyncCallbackStatus } from '@wix/cli-ui-kit';\nimport { Text, Spinner } from '@wix/cli-ui-kit';\nimport type { Site } from '@wix/site-list-client';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\n\ninterface Props {\n status: AsyncCallbackStatus<Site>;\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const CreateDevSite: FC<Props> = ({\n status,\n appId,\n onSubmit,\n onError,\n}) => {\n const { t } = useTranslation();\n\n return match(status, {\n NotRequested: () => null,\n Error: () => null,\n Loading: () => <Spinner text={t('create_dev_site.loading')} />,\n Success: ({ result }) => (\n <>\n <Trans\n i18nKey=\"create_dev_site.success\"\n components={[<Text skin=\"success\" bold />]}\n values={{ name: result.displayName }}\n />\n <WaitForAppToBeInstalled\n appId={appId}\n site={result}\n onSubmit={() => onSubmit(result)}\n onError={onError}\n />\n </>\n ),\n });\n};\n","import pWaitFor, { TimeoutError } from 'p-wait-for';\nimport React, { type FC } from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { Alert, useAsync } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport { isType, match, variant } from 'variant';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { Site } from '@wix/site-list-client';\nimport { OpenBrowser } from './OpenBrowser.js';\n\ninterface Props {\n site: Site;\n appId: string;\n onSubmit: () => void;\n onError: (error: unknown) => void;\n}\n\nexport const AppInstallData = variant({\n Success: {},\n Canceled: {},\n});\n\nfunction isAbortError(error: unknown) {\n return (\n error &&\n typeof error === 'object' &&\n 'name' in error &&\n error.name === 'AbortError'\n );\n}\n\nexport const WaitForAppToBeInstalled: FC<Props> = ({\n appId,\n site,\n onSubmit,\n onError,\n}) => {\n const { isAppInstalled } = useMetasiteManagerClient();\n\n const { status } = useAsync(\n async ({ signal }) => {\n const { appInstallationPollInterval } = getTestOverrides();\n\n try {\n await pWaitFor(() => isAppInstalled({ metaSiteId: site.id, appId }), {\n interval: appInstallationPollInterval ?? 2000,\n timeout: {\n milliseconds: 60 * 1000 * 2,\n signal,\n },\n });\n\n return AppInstallData.Success();\n } catch (error) {\n if (error instanceof TimeoutError) {\n throw new CliError({\n code: CliErrorCode.SiteSelectorTimedout(),\n cause: error,\n });\n }\n\n if (isAbortError(error)) {\n return AppInstallData.Canceled();\n }\n\n throw error;\n }\n },\n [],\n {\n onError,\n onSuccess: (result) => {\n if (isType(result, AppInstallData.Success)) {\n onSubmit();\n }\n },\n }\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <OpenBrowser siteId={site.id} appId={appId} />,\n Success: () => (\n <Alert type=\"success\">\n <Trans i18nKey=\"install_app_on_site.finished_successfully\" />\n </Alert>\n ),\n });\n};\n","export { useMetasiteManagerClient } from './useMetasiteManagerClient.js';\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { MetasiteManagerClient } from './metasite-manager-client.js';\n\nexport function useMetasiteManagerClient(): MetasiteManagerClient {\n const httpClient = useHttpClient({ type: 'general' });\n return useMemo(() => new MetasiteManagerClient(httpClient), [httpClient]);\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport { clientSpecMapSchema } from './schemas.js';\n\nexport class MetasiteManagerClient {\n constructor(private readonly httpClient: HttpClient) {}\n\n public isAppInstalled = async ({\n metaSiteId,\n appId,\n }: {\n metaSiteId: string;\n appId: string;\n }) => {\n try {\n const { data } = await this.httpClient.request({\n url: `/_api/msm/v1/meta-site/editor-client-spec-map/${metaSiteId}`,\n });\n\n const clientSpecMap = clientSpecMapSchema.parse(data);\n\n const isInstalled = Object.values(clientSpecMap).some(\n (spec) => spec.appDefinitionId === appId && !spec.permissions?.revoked\n );\n\n return isInstalled;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCheckIfAppInstalled(),\n cause: e,\n });\n }\n };\n}\n","import { z } from 'zod';\n\nexport const clientSpecMapSchema = z.record(\n z.object({\n appDefinitionId: z.string().optional(),\n permissions: z.object({ revoked: z.boolean() }).optional(),\n })\n);\n\nexport type ClientSpecMap = z.TypeOf<typeof clientSpecMapSchema>;\n","import React, { type FC } from 'react';\nimport { Key, useInput } from '@wix/cli-ui-kit';\nimport { Trans } from '@wix/cli-i18n';\nimport { openBrowser } from '@wix/user-browser';\n\ninterface Props {\n siteId: string;\n appId: string;\n}\n\nexport const OpenBrowser: FC<Props> = ({ siteId, appId }) => {\n useInput(async (input, key) => {\n if (key.return) {\n await openBrowser(\n `https://manage.wix.com/installer/install?metaSiteId=${siteId}&appId=${appId}&platform=cli&version=latest`\n );\n }\n });\n\n return (\n <>\n <Trans i18nKey=\"install_app_on_site.warning\" />\n <Trans\n i18nKey=\"install_app_on_site.warning.instructions\"\n components={[<Key value=\"enter\" />]}\n />\n </>\n );\n};\n","{\n \"general.loading\": \"Loading...\",\n \"site_type_select.label\": \"Select Development Site\",\n \"site_type_select.create_new_dev_site\": \"Create a new Development Site\",\n \"site_type_select.create_new_dev_site.disabled\": \"You have reached the maximum number of {limit} Development Sites\",\n \"site_type_select.pick_existing_site\": \"Pick an existing site\",\n \"site_type_select.no_sites\": \"No sites found\",\n \"create_dev_site.loading\": \"Creating your new Development Site...\",\n \"create_dev_site.success\": \"Development Site <0>{name}</0> created successfully! 🚀\",\n \"site_list_select.label\": \"Select Site\",\n \"install_app_on_site.warning\": \"Your new application needs to be installed on the selected Development Site\",\n \"install_app_on_site.warning.instructions\": \"Press <0/> to install the application in your browser\",\n \"install_app_on_site.finished_successfully\": \"App installed on Development Site.\"\n}\n","import React, { useState } from 'react';\nimport { Spinner, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport type { Site } from '@wix/site-list-client';\nimport { isType } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\nimport { SiteListSelect } from './SiteListSelect.js';\n\ninterface Props {\n sites: Site[];\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SelectExistingSite = ({\n sites,\n appId,\n onSubmit,\n onError,\n}: Props) => {\n const { t } = useTranslation();\n const { isAppInstalled } = useMetasiteManagerClient();\n const [siteToInstallAppOn, setSiteToInstallAppOn] = useState<Site | null>(\n null\n );\n const checkAppInstalled = useAsyncCallback(\n (_, site: Site) => isAppInstalled({ metaSiteId: site.id, appId }),\n {\n onError,\n }\n );\n\n async function handleSelectSite(site: Site) {\n const isInstalled = await checkAppInstalled.execute(site);\n if (isInstalled) {\n onSubmit(site);\n } else {\n setSiteToInstallAppOn(site);\n }\n }\n\n return (\n <>\n <SiteListSelect onSubmit={handleSelectSite} sites={sites} />\n {isType(checkAppInstalled.status, 'Loading') && (\n <Spinner text={t('general.loading')} />\n )}\n {siteToInstallAppOn && (\n <WaitForAppToBeInstalled\n appId={appId}\n site={siteToInstallAppOn}\n onSubmit={() => onSubmit(siteToInstallAppOn)}\n onError={onError}\n />\n )}\n </>\n );\n};\n","import React, { type FC } from 'react';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { SelectInput } from '@wix/cli-ui-kit';\nimport { type Site } from '@wix/site-list-client';\n\ninterface Props {\n onSubmit: (site: Site) => void;\n sites: Site[];\n}\n\nexport const SiteListSelect: FC<Props> = ({ onSubmit, sites }) => {\n const { t } = useTranslation();\n\n return (\n <SelectInput<Site>\n label={t('site_list_select.label')}\n options={sites.map((site) => ({\n key: site.id,\n title: site.displayName,\n description: site.viewUrl,\n value: site,\n }))}\n onSubmit={({ value }) => onSubmit(value)}\n />\n );\n};\n"],"mappings":";;gfAAAA,IACA,IAAAC,GAAsB,SADtB,OAAOC,GAAkC,eAAAC,OAAmB,QCA5DC,IACA,IAAAC,EAAgC,SADhC,OAAOC,MAAwB,QCA/BC,ICAAC,IACA,IAAAC,GAAsB,SADtB,OAAOC,GAAkB,YAAAC,OAAgB,QCAzCC,ICAAC,ICsDAC,IAKA,IAAMC,GAA2B,CAAE,aAAc,kBAAkB,EAC7DC,GAAmB,CAAE,KAAM,cAAc,EACzC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AEhE,SAAU,CAAC,CAAE,KAAAN,CAAK,IAChBO,EAAA,cAACK,GAAc,SAAd,CAAuB,MAAO,CAAE,KAAAZ,EAAM,QAAAF,CAAQ,GAC5C,OAAOb,GAAa,WAAaA,EAASe,CAAI,EAAIf,CACrD,CAEJ,CAAC,CAEL,CAAC,CACH","names":["init_esm_shims","import_variant","React","useCallback","init_esm_shims","import_variant","React","init_esm_shims","init_esm_shims","import_variant","React","useState","init_esm_shims","init_esm_shims","init_esm_shims","_actionProviderSPIConfig","_actionSPIConfig","_adminConfigurableTextInput","_authenticatorConfig","_commonImage","_component","_componentData","_createAppRequest","_createAppResponse","_editorPresence","_expectedInputs","_getAppInfoResponse","_getAppRequest","_getAppSnapshotResponse","_getDeveloperAppsRequest","_getDeveloperAppsResponse","_image","_multilingualTranslationSchema","_packageDimension","_packageType","_predefinedExpectedInput","_predefinedExpectedInputConfiguration","_presetEditorPresence","_schema","_shippingLabelCarrierSpiConfig","_shippingProviderConfig","_studioWidgetComponentData","_widgetComponentData","_widgetDisplay","_widgetOutOfIframeComponentData","resolveComWixpressAppserviceApiAppsUrl","opts","domainToMappings","resolveUrl","create","payload","_a","serializer","_createAppRequest","toReq","fromReq","fromRes","_createAppResponse","__create","host","serializedData","metadata","resolveComWixpressAppserviceApiAppsUrl","getAppSnapshot","payload","_a","serializer","_getAppRequest","toReq","fromReq","fromRes","_getAppSnapshotResponse","_actionProviderSPIConfig","_actionSPIConfig","_adminConfigurableTextInput","_authenticatorConfig","_commonImage","_component","_componentData","_editorPresence","_expectedInputs","_image","_multilingualTranslationSchema","_packageDimension","_packageType","_predefinedExpectedInput","_predefinedExpectedInputConfiguration","_presetEditorPresence","_schema","_shippingLabelCarrierSpiConfig","_shippingProviderConfig","_studioWidgetComponentData","_widgetComponentData","_widgetDisplay","_widgetOutOfIframeComponentData","__getAppSnapshot","host","serializedData","metadata","resolveComWixpressAppserviceApiAppsUrl","toURLSearchParams","getDeveloperApps","payload","_a","serializer","_getDeveloperAppsRequest","toReq","fromReq","fromRes","_getDeveloperAppsResponse","_actionProviderSPIConfig","_actionSPIConfig","_adminConfigurableTextInput","_authenticatorConfig","_commonImage","_component","_componentData","_editorPresence","_expectedInputs","_getAppInfoResponse","_image","_multilingualTranslationSchema","_packageDimension","_packageType","_predefinedExpectedInput","_predefinedExpectedInputConfiguration","_presetEditorPresence","_schema","_shippingLabelCarrierSpiConfig","_shippingProviderConfig","_studioWidgetComponentData","_widgetComponentData","_widgetDisplay","_widgetOutOfIframeComponentData","__getDeveloperApps","host","serializedData","metadata","resolveComWixpressAppserviceApiAppsUrl","toURLSearchParams","init_esm_shims","_createDevelopmentSiteRequest","_createDevelopmentSiteResponse","_getDevelopmentSitesLimitRequest","_getDevelopmentSitesLimitResponse","_getDevelopmentSitesRequest","_getDevelopmentSitesResponse","resolveComWixpressDevcenterDsmDevelopmentSitesManagerUrl","opts","domainToMappings","resolveUrl","createDevelopmentSite","payload","_a","serializer","_createDevelopmentSiteRequest","toReq","fromReq","fromRes","_createDevelopmentSiteResponse","__createDevelopmentSite","host","serializedData","metadata","resolveComWixpressDevcenterDsmDevelopmentSitesManagerUrl","getDevelopmentSites","_getDevelopmentSitesRequest","_getDevelopmentSitesResponse","__getDevelopmentSites","toURLSearchParams","getDevelopmentSitesLimit","_getDevelopmentSitesLimitRequest","_getDevelopmentSitesLimitResponse","__getDevelopmentSitesLimit","init_esm_shims","createAppSchema","z","appSnapshotSchema","createDevelopmentSiteSchema","getDevelopmentSitesSchema","getDevelopmentSitesLimitSchema","developerAppSchema","getDeveloperAppsSchema","EMPTY_SITE_TEMPLATE","DevCenterClient","httpClient","minRetryTimeout","getTestOverrides","opts","data","pRetry","create","createAppSchema","e","CliError","CliErrorCode","req","getAppSnapshot","appSnapshotSchema","siteListClient","createDevelopmentSite","id","createDevelopmentSiteSchema","site","getDevelopmentSites","getDevelopmentSitesSchema","getDeveloperApps","getDeveloperAppsSchema","getDevelopmentSitesLimit","getDevelopmentSitesLimitSchema","init_esm_shims","useMemo","useDevCenterClient","httpClient","useHttpClient","useMemo","DevCenterClient","init_esm_shims","import_variant","React","SiteTypeSelect","onSubmit","onError","sites","t","useTranslation","getDevSitesCount","getDevSitesLimit","useDevCenterClient","status","useAsync","React","Spinner","devSitesCount","devSitesLimit","isDevSitesLimitReached","userHasNoSites","SelectInput","SelectOptionAvailability","value","init_esm_shims","import_variant","React","init_esm_shims","React","init_esm_shims","init_esm_shims","useMemo","init_esm_shims","init_esm_shims","clientSpecMapSchema","z","MetasiteManagerClient","httpClient","metaSiteId","appId","data","clientSpecMap","clientSpecMapSchema","spec","e","CliError","CliErrorCode","useMetasiteManagerClient","httpClient","useHttpClient","useMemo","MetasiteManagerClient","import_variant","init_esm_shims","React","OpenBrowser","siteId","appId","use_input_default","input","key","openBrowser","React","Trans","Key","AppInstallData","isAbortError","error","WaitForAppToBeInstalled","appId","site","onSubmit","onError","isAppInstalled","useMetasiteManagerClient","status","useAsync","signal","appInstallationPollInterval","getTestOverrides","pWaitFor","TimeoutError","CliError","CliErrorCode","result","React","OpenBrowser","Alert","Trans","CreateDevSite","status","appId","onSubmit","onError","t","useTranslation","React","Spinner","result","Trans","Text","WaitForAppToBeInstalled","messages_default","init_esm_shims","React","useState","import_variant","init_esm_shims","React","SiteListSelect","onSubmit","sites","t","useTranslation","React","SelectInput","site","value","SelectExistingSite","sites","appId","onSubmit","onError","t","useTranslation","isAppInstalled","useMetasiteManagerClient","siteToInstallAppOn","setSiteToInstallAppOn","useState","checkAppInstalled","useAsyncCallback","site","handleSelectSite","React","SiteListSelect","Spinner","WaitForAppToBeInstalled","SiteSelector","appId","onSubmit","onError","t","useTranslation","siteType","setSiteType","useState","createDevSite","useDevCenterClient","siteListClient","useSiteListClient","status","useAsync","createSite","useAsyncCallback","handleSelectSiteType","React","I18nProvider","messages_default","Spinner","sites","SiteTypeSelect","CreateDevSite","SelectExistingSite","ResolveSiteId","state","onSubmit","exit","useExit","t","useTranslation","model","useProjectModel","React","Alert","id","SiteSelector","SiteIdProvider","children","exit","useExit","projectFolder","useProjectModel","writeDebugLog","useDebugLog","siteListClient","useSiteListClient","status","merge","useAsync","resolveConfiguredSite","setSite","useCallback","site","saveAppConfig","SiteIdState","CliError","CliErrorCode","APP_CONFIG_PATH","handleResolveSiteId","React","Spinner","state","variant","ResolveSiteId","SiteIdContext"]}
@@ -0,0 +1,24 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{h as v}from"./chunk-52CFCSNQ.js";import{a as $,c as E,e as he,h as m}from"./chunk-HFDLXX7R.js";var H=E(D=>{"use strict";m();var V=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},k=class extends V{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};D.CommanderError=V;D.InvalidArgumentError=k});var S=E(P=>{"use strict";m();var{InvalidArgumentError:ue}=H(),N=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ue(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ce(l){let e=l.name()+(l.variadic===!0?"...":"");return l.required?"<"+e+">":"["+e+"]"}P.Argument=N;P.humanReadableArgName=ce});var q=E(B=>{"use strict";m();var{humanReadableArgName:pe}=S(),I=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden);if(e._hasImplicitHelpCommand()){let[,i,n]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=e.createCommand(i).helpOption(!1);s.description(e._helpCommandDescription),n&&s.arguments(n),t.push(s)}return this.sortSubcommands&&t.sort((i,n)=>i.name().localeCompare(n.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),n=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(i||n){let s;i?n?s=e.createOption(e._helpFlags,e._helpDescription):s=e.createOption(e._helpShortFlag,e._helpDescription):s=e.createOption(e._helpLongFlag,e._helpDescription),t.push(s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>pe(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function a(d,w){if(w){let F=`${d.padEnd(i+r)}${w}`;return t.wrap(F,n-s,i+r)}return d}function o(d){return d.join(`
4
+ `).replace(/^/gm," ".repeat(s))}let h=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(h=h.concat([t.wrap(u,n,0),""]));let c=t.visibleArguments(e).map(d=>a(t.argumentTerm(d),t.argumentDescription(d)));c.length>0&&(h=h.concat(["Arguments:",o(c),""]));let f=t.visibleOptions(e).map(d=>a(t.optionTerm(d),t.optionDescription(d)));if(f.length>0&&(h=h.concat(["Options:",o(f),""])),this.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(w=>a(t.optionTerm(w),t.optionDescription(w)));d.length>0&&(h=h.concat(["Global Options:",o(d),""]))}let x=t.visibleCommands(e).map(d=>a(t.subcommandTerm(d),t.subcommandDescription(d)));return x.length>0&&(h=h.concat(["Commands:",o(x),""])),h.join(`
5
+ `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",r=new RegExp(`[\\n][${s}]+`);if(e.match(r))return e;let a=t-i;if(a<n)return e;let o=e.slice(0,i),h=e.slice(i).replace(`\r
6
+ `,`
7
+ `),u=" ".repeat(i),f="\\s\u200B",x=new RegExp(`
8
+ |.{1,${a-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),d=h.match(x)||[];return o+d.map((w,F)=>w===`
9
+ `?"":(F>0?u:"")+w.trimEnd()).join(`
10
+ `)}};B.Help=I});var M=E(y=>{"use strict";m();var{InvalidArgumentError:me}=H(),T=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=J(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new me(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return de(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},W=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return t.negate===(s===e)}};function de(l){return l.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function J(l){let e,t,i=l.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}y.Option=T;y.splitOptionFlags=J;y.DualOptions=W});var z=E(K=>{"use strict";m();function fe(l,e){if(Math.abs(l.length-e.length)>3)return Math.max(l.length,e.length);let t=[];for(let i=0;i<=l.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=l.length;n++){let s=1;l[n-1]===e[i-1]?s=0:s=1,t[n][i]=Math.min(t[n-1][i]+1,t[n][i-1]+1,t[n-1][i-1]+s),n>1&&i>1&&l[n-1]===e[i-2]&&l[n-2]===e[i-1]&&(t[n][i]=Math.min(t[n][i],t[n-2][i-2]+1))}return t[l.length][e.length]}function ge(l,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=l.startsWith("--");t&&(l=l.slice(2),e=e.map(r=>r.slice(2)));let i=[],n=3,s=.4;return e.forEach(r=>{if(r.length<=1)return;let a=fe(l,r),o=Math.max(l.length,r.length);(o-a)/o>s&&(a<n?(n=a,i=[r]):a===n&&i.push(r))}),i.sort((r,a)=>r.localeCompare(a)),t&&(i=i.map(r=>`--${r}`)),i.length>1?`
11
+ (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
12
+ (Did you mean ${i[0]}?)`:""}K.suggestSimilar=ge});var te=E(ee=>{"use strict";m();var _e=$("events").EventEmitter,L=$("child_process"),b=$("path"),j=$("fs"),p=$("process"),{Argument:Oe,humanReadableArgName:Ae}=S(),{CommanderError:U}=H(),{Help:Ce}=q(),{Option:Y,splitOptionFlags:be,DualOptions:we}=M(),{suggestSimilar:Q}=z(),G=class l extends _e{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>p.stdout.write(t),writeErr:t=>p.stderr.write(t),getOutHelpWidth:()=>p.stdout.isTTY?p.stdout.columns:void 0,getErrHelpWidth:()=>p.stderr.isTTY?p.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let n=t,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,r,a]=e.match(/([^ ]+) *(.*)/),o=this.createCommand(r);return n&&(o.description(n),o._executableHandler=!0),s.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(s.noHelp||s.hidden),o._executableFile=s.executableFile||null,a&&o.arguments(a),this.commands.push(o),o.parent=this,o.copyInheritedSettings(this),n?this:o}createCommand(e){return new l(e)}createHelp(){return Object.assign(new Ce,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
13
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new Oe(e,t)}argument(e,t,i,n){let s=this.createArgument(e,t);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}addHelpCommand(e,t){return e===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof e=="string"&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
14
+ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new U(e,t,i)),p.exit(e)}action(e){let t=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new Y(e,t)}_callParseArg(e,t,i,n){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${n} ${s.message}`;this.error(r,{exitCode:s.exitCode,code:s.code})}throw s}}addOption(e){let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");this.options.push(e);let n=(s,r,a)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let o=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,o,r):s!==null&&e.variadic&&(s=e._concatValue(s,o)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,a)};return this.on("option:"+t,s=>{let r=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let r=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,r,"env")}),this}_optionEx(e,t,i,n,s){if(typeof t=="object"&&t instanceof Y)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,i);if(r.makeOptionMandatory(!!e.mandatory),typeof n=="function")r.default(s).argParser(n);else if(n instanceof RegExp){let a=n;n=(o,h)=>{let u=a.exec(o);return u?u[0]:h},r.default(s).argParser(n)}else r.default(n);return this.addOption(r)}option(e,t,i,n){return this._optionEx({},e,t,i,n)}requiredOption(e,t,i,n){return this._optionEx({mandatory:!0},e,t,i,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");t=t||{},e===void 0&&(e=p.argv,p.versions&&p.versions.electron&&(t.from="electron")),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":p.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,c){let f=b.resolve(u,c);if(j.existsSync(f))return f;if(n.includes(b.extname(c)))return;let x=n.find(d=>j.existsSync(`${f}${d}`));if(x)return`${f}${x}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=j.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=b.resolve(b.dirname(u),a)}if(a){let u=s(a,r);if(!u&&!e._executableFile&&this._scriptPath){let c=b.basename(this._scriptPath,b.extname(this._scriptPath));c!==this._name&&(u=s(a,`${c}-${e._name}`))}r=u||r}i=n.includes(b.extname(r));let o;p.platform!=="win32"?i?(t.unshift(r),t=Z(p.execArgv).concat(t),o=L.spawn(p.argv[0],t,{stdio:"inherit"})):o=L.spawn(r,t,{stdio:"inherit"}):(t.unshift(r),t=Z(p.execArgv).concat(t),o=L.spawn(p.execPath,t,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{p.on(c,()=>{o.killed===!1&&o.exitCode===null&&o.kill(c)})});let h=this._exitCallback;h?o.on("close",()=>{h(new U(p.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):o.on("close",p.exit.bind(p)),o.on("error",u=>{if(u.code==="ENOENT"){let c=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${r}' does not exist
15
+ - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
+ - ${c}`;throw new Error(f)}else if(u.code==="EACCES")throw new Error(`'${r}' not executable`);if(!h)p.exit(1);else{let c=new U(1,"commander.executeSubCommandAsync","(error)");c.nestedError=u,h(c)}}),this.runningCommand=o}_dispatchSubcommand(e,t,i){let n=this._findCommand(e);n||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(i));else return n._parseCommand(t,i)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,n,s)=>{let r=n;if(n!==null&&i.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;r=this._callParseArg(i,n,s,a)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((r,a)=>e(i,a,r),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=e(i,s,i.defaultValue))),t[n]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(r=>{n.push({hookedCommand:s,callback:r})})}),t==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let n=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,t))}),n}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return X(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),X(this,i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=e.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],n=t,s=e.slice();function r(o){return o.length>1&&o[0]==="-"}let a=null;for(;s.length;){let o=s.shift();if(o==="--"){n===i&&n.push(o),n.push(...s);break}if(a&&!r(o)){this.emit(`option:${a.name()}`,o);continue}if(a=null,r(o)){let h=this._findOption(o);if(h){if(h.required){let u=s.shift();u===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,u)}else if(h.optional){let u=null;s.length>0&&!r(s[0])&&(u=s.shift()),this.emit(`option:${h.name()}`,u)}else this.emit(`option:${h.name()}`);a=h.variadic?h:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let h=this._findOption(`-${o[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,o.slice(2)):(this.emit(`option:${h.name()}`),s.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let h=o.indexOf("="),u=this._findOption(o.slice(0,h));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,o.slice(h+1));continue}}if(r(o)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(o)){t.push(o),s.length>0&&i.push(...s);break}else if(o===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(o),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){i.push(o),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){n.push(o),s.length>0&&n.push(...s);break}n.push(o)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let n=this.options[i].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
18
+ `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
+ `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
+ `),this.outputHelp({error:!0}));let i=t||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in p.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,p.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new we(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=r=>{let a=r.attributeName(),o=this.getOptionValue(a),h=this.options.find(c=>c.negate&&a===c.attributeName()),u=this.options.find(c=>!c.negate&&a===c.attributeName());return h&&(h.presetArg===void 0&&o===!1||h.presetArg!==void 0&&o===h.presetArg)?h:u||r},n=r=>{let a=i(r),o=a.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let r=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);n=n.concat(r),s=s.parent}while(s&&!s._enablePositionalOptions);t=Q(e,n)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),t=Q(e,n)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let n=this.createOption(t,i);return this._versionOptionName=n.attributeName(),this.options.push(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>Ae(i));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=b.basename(e,b.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=n=>this._outputConfiguration.writeErr(n):i=n=>this._outputConfiguration.writeOut(n),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let n=this.helpInformation(i);if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._helpLongFlag&&this.emit(this._helpLongFlag),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,t){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;let i=be(this._helpFlags);return this._helpShortFlag=i.shortFlag,this._helpLongFlag=i.longFlag,this}help(e){this.outputHelp(e);let t=p.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
+ Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,s=>{let r;typeof t=="function"?r=t({error:s.error,command:s.command}):r=t,r&&s.write(`${r}
23
+ `)}),this}};function X(l,e){l._hasHelpOption&&e.find(i=>i===l._helpLongFlag||i===l._helpShortFlag)&&(l.outputHelp(),l._exit(0,"commander.helpDisplayed","(outputHelp)"))}function Z(l){return l.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],n=s[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}ee.Command=G});var re=E((_,se)=>{"use strict";m();var{Argument:Ee}=S(),{Command:ie}=te(),{CommanderError:xe,InvalidArgumentError:ne}=H(),{Help:$e}=q(),{Option:ve}=M();_=se.exports=new ie;_.program=_;_.Command=ie;_.Option=ve;_.Argument=Ee;_.Help=$e;_.CommanderError=xe;_.InvalidArgumentError=ne;_.InvalidOptionArgumentError=ne});var ae=E((g,oe)=>{"use strict";m();var O=re();g=oe.exports={};g.program=new O.Command;g.Argument=O.Argument;g.Command=O.Command;g.CommanderError=O.CommanderError;g.Help=O.Help;g.InvalidArgumentError=O.InvalidArgumentError;g.InvalidOptionArgumentError=O.InvalidArgumentError;g.Option=O.Option;g.createCommand=l=>new O.Command(l);g.createOption=(l,e)=>new O.Option(l,e);g.createArgument=(l,e)=>new O.Argument(l,e)});m();m();m();var le=he(ae(),1),{program:Ue,createCommand:Ge,createArgument:Re,createOption:Be,CommanderError:Je,InvalidArgumentError:R,InvalidOptionArgumentError:Ke,Command:ze,Argument:Ye,Option:Qe,Help:Xe}=le.default;function He(l){let e=v.union([v.string().uuid(),v.literal("current")]).transform(t=>t==="current"?void 0:t).safeParse(l);if(e.success)return e.data;throw new R('Value must be a valid GUID or "current"')}function Ve(l){let e=v.string().url().safeParse(l);if(e.success)return e.data;throw new R("Value must be a valid URL")}export{Ge as a,R as b,Qe as c,He as d,Ve as e};
24
+ //# sourceMappingURL=chunk-ZVAVQTPJ.js.map