@lightspeed/crane 1.1.2 → 1.1.3
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/app.d.mts +20 -2
- package/dist/app.d.ts +20 -2
- package/dist/app.mjs +1 -1
- package/dist/cli.mjs +10 -23
- package/package.json +6 -5
- package/template/footers/example-footer/ExampleFooter.vue +6 -1
- package/template/footers/example-footer/assets/cart.svg +19 -0
- package/template/footers/example-footer/component/LegalLinks.vue +2 -2
- package/template/footers/example-footer/component/MadeWith.vue +23 -0
- package/template/footers/example-footer/component/ReportAbuse.vue +4 -3
- package/template/footers/example-footer/showcases/1.ts +1 -1
- package/template/headers/example-header/ExampleHeader.vue +17 -2
- package/template/headers/example-header/component/Account.vue +4 -4
- package/template/headers/example-header/component/Cart.vue +14 -33
- package/template/headers/example-header/settings/content.ts +1 -9
- package/template/headers/example-header/settings/design.ts +1 -23
- package/template/package.json +1 -1
- package/template/reference/sections/about-us/AboutUs.vue +73 -0
- package/template/reference/sections/about-us/assets/our_company_in_numbers.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_company_in_numbers_preview.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_team.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_team_preview.jpg +0 -0
- package/template/reference/sections/about-us/client.ts +6 -0
- package/template/reference/sections/about-us/component/Image.vue +94 -0
- package/template/reference/sections/about-us/component/Stats.vue +155 -0
- package/template/reference/sections/about-us/component/Title.vue +32 -0
- package/template/reference/sections/about-us/server.ts +6 -0
- package/template/reference/sections/about-us/settings/content.ts +64 -0
- package/template/reference/sections/about-us/settings/design.ts +74 -0
- package/template/reference/sections/about-us/settings/layout.ts +12 -0
- package/template/reference/sections/about-us/settings/translations.ts +151 -0
- package/template/reference/sections/about-us/showcases/1.ts +176 -0
- package/template/reference/sections/about-us/showcases/2.ts +160 -0
- package/template/reference/sections/about-us/showcases/translations.ts +259 -0
- package/template/reference/sections/about-us/type.ts +5 -0
- package/template/reference/sections/about-us/util/visibility-provider.ts +27 -0
- package/template/reference/sections/intro-slider/IntroSlider.vue +77 -0
- package/template/reference/sections/intro-slider/assets/bike_1.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_1@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_2.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_2@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_3.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_3@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_4.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_4@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_5.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_5@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_6.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_6@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_1.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_1@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_2.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_2@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_3.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_3@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_5.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_5@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_6.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_6@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/custom_section_showcase_1_preview.png +0 -0
- package/template/reference/sections/intro-slider/assets/custom_section_showcase_2_preview.png +0 -0
- package/template/reference/sections/intro-slider/client.ts +5 -0
- package/template/reference/sections/intro-slider/component/Slider.vue +235 -0
- package/template/reference/sections/intro-slider/component/Title.vue +106 -0
- package/template/reference/sections/intro-slider/entity/color.ts +4 -0
- package/template/reference/sections/intro-slider/server.ts +5 -0
- package/template/reference/sections/intro-slider/settings/content.ts +43 -0
- package/template/reference/sections/intro-slider/settings/design.ts +88 -0
- package/template/reference/sections/intro-slider/settings/layout.ts +12 -0
- package/template/reference/sections/intro-slider/settings/translations.ts +53 -0
- package/template/reference/sections/intro-slider/showcases/1.ts +274 -0
- package/template/reference/sections/intro-slider/showcases/2.ts +270 -0
- package/template/reference/sections/intro-slider/showcases/translations.ts +88 -0
- package/template/reference/sections/intro-slider/type.ts +5 -0
- package/template/reference/sections/tag-lines/TagLines.vue +158 -0
- package/template/reference/sections/tag-lines/assets/explore_our_holiday_gift_guide.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/fall_is_here.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/fall_is_here_preview.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/folding_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/hybrid_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/mountain_and_road_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/shop_chelsea_boots.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/sweater_weather.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/what_we_sell.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/what_we_sell_preview.jpg +0 -0
- package/template/reference/sections/tag-lines/client.ts +5 -0
- package/template/reference/sections/tag-lines/component/HighlightedText.vue +50 -0
- package/template/reference/sections/tag-lines/component/SectionImage.vue +78 -0
- package/template/reference/sections/tag-lines/component/Title.vue +51 -0
- package/template/reference/sections/tag-lines/composables/highlighted-text-image-list.ts +34 -0
- package/template/reference/sections/tag-lines/server.ts +5 -0
- package/template/reference/sections/tag-lines/settings/content.ts +37 -0
- package/template/reference/sections/tag-lines/settings/design.ts +81 -0
- package/template/reference/sections/tag-lines/settings/layout.ts +12 -0
- package/template/reference/sections/tag-lines/settings/translations.ts +61 -0
- package/template/reference/sections/tag-lines/showcases/1.ts +190 -0
- package/template/reference/sections/tag-lines/showcases/2.ts +190 -0
- package/template/reference/sections/tag-lines/showcases/translations.ts +49 -0
- package/template/reference/sections/tag-lines/type.ts +5 -0
- package/template/reference/shared/components/Button.vue +151 -0
- package/template/reference/shared/components/SectionWrapper.vue +26 -0
- package/template/reference/shared/components/Tagline.vue +45 -0
- package/template/reference/shared/utils/color.ts +16 -0
- package/template/reference/shared/utils/styles.ts +12 -0
- package/template/reference/templates/assets/reference_template_apparel_cover_image.jpg +0 -0
- package/template/reference/templates/assets/reference_template_bike_cover_image.jpg +0 -0
- package/template/reference/templates/reference-template-apparel.ts +44 -0
- package/template/reference/templates/reference-template-bike.ts +44 -0
- package/template/sections/example-section/ExampleSection.vue +8 -19
- package/template/sections/example-section/assets/bike_accessories_high.jpg +0 -0
- package/template/sections/example-section/assets/bike_accessories_low.jpg +0 -0
- package/template/sections/example-section/assets/bike_new_arrivals_high.jpg +0 -0
- package/template/sections/example-section/assets/bike_new_arrivals_low.jpg +0 -0
- package/template/sections/example-section/assets/custom_section_showcase_3_preview.jpg +0 -0
- package/template/sections/example-section/assets/fixed_gears_high.jpg +0 -0
- package/template/sections/example-section/assets/fixed_gears_low.jpg +0 -0
- package/template/sections/example-section/assets/repair_service_high.jpg +0 -0
- package/template/sections/example-section/assets/repair_service_low.jpg +0 -0
- package/template/sections/example-section/settings/translations.ts +39 -7
- package/template/sections/example-section/showcases/3.ts +198 -0
- package/template/sections/example-section/showcases/translations.ts +49 -1
- package/template/shared/{LanguageSelector.vue → components/LanguageSelector.vue} +1 -1
- package/template/shared/components/SectionWrapper.vue +26 -0
- package/template/templates/template.ts +2 -1
- package/types.d.ts +96 -70
package/dist/app.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ interface VueBaseProps<CONTENT, DESIGN> {
|
|
|
27
27
|
readonly content: Ref<CONTENT>;
|
|
28
28
|
readonly design: Ref<DESIGN>;
|
|
29
29
|
readonly defaults: Ref<Record<string, unknown>>;
|
|
30
|
-
readonly
|
|
30
|
+
readonly site: Ref<SiteContent>;
|
|
31
31
|
}
|
|
32
32
|
declare function useVueBaseProps<CONTENT, DESIGN>(): VueBaseProps<CONTENT, DESIGN>;
|
|
33
33
|
|
|
@@ -51,14 +51,26 @@ declare function useTextareaElementContent<CONTENT>(elementName: string, externa
|
|
|
51
51
|
|
|
52
52
|
interface ButtonContent {
|
|
53
53
|
title: string;
|
|
54
|
-
|
|
54
|
+
type: ActionLinkType;
|
|
55
|
+
link?: string;
|
|
56
|
+
email?: string;
|
|
57
|
+
phone?: string;
|
|
58
|
+
tileDivId?: string;
|
|
59
|
+
pageId?: string;
|
|
60
|
+
pageUrl?: string;
|
|
55
61
|
hasTitle: boolean;
|
|
56
62
|
hasLink: boolean;
|
|
57
63
|
performAction: () => void;
|
|
58
64
|
}
|
|
59
65
|
declare function useButtonElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>): {
|
|
60
66
|
title: string | undefined;
|
|
67
|
+
type: ActionLinkType | undefined;
|
|
61
68
|
link: string | undefined;
|
|
69
|
+
email: string | undefined;
|
|
70
|
+
phone: string | undefined;
|
|
71
|
+
tileDivId: string | null;
|
|
72
|
+
pageId: string | undefined;
|
|
73
|
+
pageUrl: string | undefined;
|
|
62
74
|
hasTitle: boolean;
|
|
63
75
|
hasLink: boolean;
|
|
64
76
|
performAction: (() => void) | undefined;
|
|
@@ -158,7 +170,13 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
158
170
|
value: string | undefined;
|
|
159
171
|
} | {
|
|
160
172
|
title: string | undefined;
|
|
173
|
+
type: ActionLinkType | undefined;
|
|
161
174
|
link: string | undefined;
|
|
175
|
+
email: string | undefined;
|
|
176
|
+
phone: string | undefined;
|
|
177
|
+
tileDivId: string | null;
|
|
178
|
+
pageId: string | undefined;
|
|
179
|
+
pageUrl: string | undefined;
|
|
162
180
|
hasTitle: boolean;
|
|
163
181
|
hasLink: boolean;
|
|
164
182
|
performAction: (() => void) | undefined;
|
package/dist/app.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface VueBaseProps<CONTENT, DESIGN> {
|
|
|
27
27
|
readonly content: Ref<CONTENT>;
|
|
28
28
|
readonly design: Ref<DESIGN>;
|
|
29
29
|
readonly defaults: Ref<Record<string, unknown>>;
|
|
30
|
-
readonly
|
|
30
|
+
readonly site: Ref<SiteContent>;
|
|
31
31
|
}
|
|
32
32
|
declare function useVueBaseProps<CONTENT, DESIGN>(): VueBaseProps<CONTENT, DESIGN>;
|
|
33
33
|
|
|
@@ -51,14 +51,26 @@ declare function useTextareaElementContent<CONTENT>(elementName: string, externa
|
|
|
51
51
|
|
|
52
52
|
interface ButtonContent {
|
|
53
53
|
title: string;
|
|
54
|
-
|
|
54
|
+
type: ActionLinkType;
|
|
55
|
+
link?: string;
|
|
56
|
+
email?: string;
|
|
57
|
+
phone?: string;
|
|
58
|
+
tileDivId?: string;
|
|
59
|
+
pageId?: string;
|
|
60
|
+
pageUrl?: string;
|
|
55
61
|
hasTitle: boolean;
|
|
56
62
|
hasLink: boolean;
|
|
57
63
|
performAction: () => void;
|
|
58
64
|
}
|
|
59
65
|
declare function useButtonElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>): {
|
|
60
66
|
title: string | undefined;
|
|
67
|
+
type: ActionLinkType | undefined;
|
|
61
68
|
link: string | undefined;
|
|
69
|
+
email: string | undefined;
|
|
70
|
+
phone: string | undefined;
|
|
71
|
+
tileDivId: string | null;
|
|
72
|
+
pageId: string | undefined;
|
|
73
|
+
pageUrl: string | undefined;
|
|
62
74
|
hasTitle: boolean;
|
|
63
75
|
hasLink: boolean;
|
|
64
76
|
performAction: (() => void) | undefined;
|
|
@@ -158,7 +170,13 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
158
170
|
value: string | undefined;
|
|
159
171
|
} | {
|
|
160
172
|
title: string | undefined;
|
|
173
|
+
type: ActionLinkType | undefined;
|
|
161
174
|
link: string | undefined;
|
|
175
|
+
email: string | undefined;
|
|
176
|
+
phone: string | undefined;
|
|
177
|
+
tileDivId: string | null;
|
|
178
|
+
pageId: string | undefined;
|
|
179
|
+
pageUrl: string | undefined;
|
|
162
180
|
hasTitle: boolean;
|
|
163
181
|
hasLink: boolean;
|
|
164
182
|
performAction: (() => void) | undefined;
|
package/dist/app.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentInstance as z,ref as m,computed as r,reactive as d,createSSRApp as $}from"vue";import{renderToString as D}from"vue/server-renderer";const x=new Map;function s(){const e=(i,l,a,v,f,u)=>{x.set(i._uid,{context:m(l),content:m(a),design:m(v),defaults:m(f),externalContent:m(u)})},n=(i,l,a,v,f)=>{const u=x.get(i._uid);u!==void 0&&(u.content.value=l,u.design.value=a,u.defaults.value=v,u.externalContent.value=f)},t=z()?.appContext.app._uid??-1,o=x.get(t);return{init:e,update:n,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,externalContent:o?.externalContent}}function _(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return N(o,e)}function N(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not inputbox`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value);return d({hasContent:o,value:i})}function h(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return B(o,e)}function B(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not textarea`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value);return d({hasContent:o,value:i})}const b={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE"};function M(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function K(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function P(e){if("pageUrl"in e)return e.pageUrl;switch(K(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}const y=(e,n)=>{if(!e||n)return;const{type:t,link:o,email:i,phone:l}=e,a=P(e);switch(t){case b.HYPER_LINK:if(o)return()=>window.open(o,"_blank");break;case b.GO_TO_STORE:case b.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case b.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case b.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case b.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const v=M(e);document.getElementById(`tile-${v}`)?.scrollIntoView()};break;case b.GO_TO_PAGE:if(a)return()=>window.open(a,"_self");break;default:console.error(`Unknown type of ActionLink: ${t}`)}};function U(e){return"title"in e&&"type"in e}function O(e,n){const t=s(),o=r(()=>!!t.externalContent?.value?.isPreviewMode),i=r(()=>n!==void 0?n:t.content.value!==void 0?t.content.value:{});return X(i,e,o.value)}function X(e,n,t){const o=r(()=>{const u=e.value[n];if(u!==void 0){if(U(u))return u;throw new Error(`Element ${n} is not action link`)}}),i=r(()=>o.value?.title),l=r(()=>o.value?.link),a=r(()=>!!i.value),v=r(()=>!!l.value),f=y(o.value,t);return d({title:i,link:l,hasTitle:a,hasLink:v,performAction:f})}function F(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function E(e,n){const t=new RegExp(/^https?:\/\//);return e!=null&&t.test(e)?e:`${n}/${e}`}function L(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return V(o,e)}function V(e,n){const t=r(()=>{const u=e.value[n];if(u!==void 0){if(F(u))return u;throw new Error(`Element ${n} is not image`)}}),o=r(()=>t.value===void 0?"":s().context.value.imageBuckets?.[t.value?.bucket]),i=r(()=>t.value!==void 0),l=r(()=>E(t.value?.set?.["cropped-webp-100x200"]?.url,o.value)),a=r(()=>E(t.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),v=r(()=>E(t.value?.set?.["webp-200x200"]?.url,o.value)),f=r(()=>E(t.value?.set?.["webp-2000x2000"]?.url,o.value));return d({hasContent:i,lowResolutionMobileImage:l,highResolutionMobileImage:a,lowResolutionDesktopImage:v,highResolutionDesktopImage:f})}function H(e){return"enabled"in e}function k(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return W(o,e)}function W(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(H(l))return l;throw new Error(`Element ${n} is not toggle`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value?.enabled);return d({hasContent:o,value:i})}function R(e,n){const t=s(),o=r(()=>n!==void 0?n:t.content.value);return Y(o,e)}function Y(e,n){const t=r(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not selectbox`)}}),o=r(()=>t.value!==void 0),i=r(()=>t.value);return d({hasContent:o,value:i})}function j(e){return e!==null&&"items"in e}function A(e){const n=s(),t=r(()=>{const a=n.content.value[e];if(a!==void 0){if(j(a))return a;throw new Error(`Element ${e} is not an menu`)}}),o=r(()=>!!n.externalContent?.value?.isPreviewMode),i=r(()=>t.value!==void 0),l=r(()=>t.value?.items?t.value.items.map(a=>({...a,performAction:y(a,o.value)})):[]);return d({hasContent:i,items:l})}const J="menu";function q(){return A(J)}var G=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(G||{});function Q(e){if(typeof e!="object"||e===null)return!1;const n=e;return Array.isArray(n.cards)&&n.cards.every(t=>typeof t.settings=="object"&&t.settings!==null)}function Z(e){const n=s(),t=r(()=>{const l=n.content.value[e];if(l!==void 0){if(Q(l))return l;throw new Error(`Element ${e} is not of DECK type`)}}),o=r(()=>t.value!==void 0&&t.value.cards.length>0),i=r(()=>t.value?.cards);return d({hasContent:o,cards:i,getReactiveRef:ee})}function ee(e,n,t){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const o=e.settings[t];if(o===void 0)return o;switch(n){case"TEXTAREA":return h(t,e.settings);case"INPUTBOX":return _(t,e.settings);case"SELECTBOX":return R(t,e.settings);case"IMAGE":return L(t,e.settings);case"TOGGLE":return k(t,e.settings);case"BUTTON":return O(t,e.settings);default:return}}function te(e){return"type"in e&&("text"in e||"image"in e)}function w(e,n){const t=new RegExp(/^https?:\/\//);return e!==void 0&&t.test(e)?e:`${n}/${e}`}function ne(){const e=s(),n=r(()=>{const a=e.content.value.logo;if(a!==void 0){if(te(a))return a;throw new Error("Element logo is not LOGO")}}),t=r(()=>n.value?.type),o=r(()=>n.value?.text),i=r(()=>n.value?.image===void 0?"":e.context.value.imageBuckets?.[n.value.image.bucket]),l=r(()=>({lowResolutionMobileImage:w(n.value?.image?.set?.["cropped-webp-100x200"]?.url,i.value),highResolutionMobileImage:w(n.value?.image?.set?.["cropped-webp-1000x2000"]?.url,i.value),lowResolutionDesktopImage:w(n.value?.image?.set?.["webp-200x200"]?.url,i.value),highResolutionDesktopImage:w(n.value?.image?.set?.["webp-2000x2000"]?.url,i.value)}));return d({type:t,text:o,image:l})}function T(e,n){if(n===void 0)return;if(!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.fontFamily[t]}function I(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.textSize[t]}function p(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.color[t]}function oe(e){const n=s(),t=r(()=>{const u=n.design.value[e],c=n.defaults.value[e],g=n.context.value.globalDesign;return{font:u?.font?.replaceAll("_"," ")??T(g,c?.font),size:u?.size??I(g,c?.size),bold:u?.bold??c?.bold,italic:u?.italic??c?.italic,color:u?.color??p(g,c?.color),visible:u?.visible??c?.visible??!1}}),o=r(()=>t.value?.font),i=r(()=>t.value?.size),l=r(()=>t.value?.bold),a=r(()=>t.value?.italic),v=r(()=>t.value?.color),f=r(()=>t.value?.visible);return d({font:o,size:i,bold:l,italic:a,color:v,visible:f})}function re(e){const n=s(),t=r(()=>{const c=n.design.value[e],g=n.defaults.value[e],C=n.context.value.globalDesign;return{font:c?.font?.replaceAll("_"," ")??T(C,g?.font),size:c?.size??I(C,g?.size),bold:c?.bold??g?.bold,italic:c?.italic??g?.italic,color:c?.color??p(C,g?.color),visible:c?.visible??g?.visible??!1,whiteSpace:"pre-wrap"}}),o=r(()=>t.value?.font),i=r(()=>t.value?.size),l=r(()=>t.value?.bold),a=r(()=>t.value?.italic),v=r(()=>t.value?.color),f=r(()=>t.value?.visible),u=r(()=>t.value?.whiteSpace);return d({font:o,size:i,bold:l,italic:a,color:v,visible:f,whiteSpace:u})}function ie(e){const n=s(),t=r(()=>{const u=n.design.value[e],c=n.defaults.value[e],g=n.context.value.globalDesign;return{appearance:u?.appearance??c?.appearance,font:u?.font??T(g,c?.font),size:u?.size??c?.size,style:u?.style??c?.style,color:u?.color??p(g,c?.color),visible:u?.visible??c?.visible??!1}}),o=r(()=>t.value?.appearance),i=r(()=>t.value?.font),l=r(()=>t.value?.size),a=r(()=>t.value?.style),v=r(()=>t.value?.color),f=r(()=>t.value?.visible);return d({appearance:o,font:i,size:l,style:a,color:v,visible:f})}function le(e){const n=s(),t=r(()=>{const l=n.design.value[e],a=n.defaults.value[e],v=n.context.value.globalDesign;return{overlay:{type:l?.overlay?.type??a?.overlay?.type,solid:{color:l?.overlay?.solid?.color??p(v,a?.overlay?.solid?.color)},gradient:{fromColor:l?.overlay?.gradient?.fromColor??p(v,a?.overlay?.gradient?.fromColor),toColor:l?.overlay?.gradient?.toColor??p(v,a?.overlay?.gradient?.toColor)}},visible:l?.visible??a?.visible??!1}}),o=r(()=>t.value?.overlay),i=r(()=>t.value?.visible);return d({overlay:o,visible:i})}function ae(e){const n=s(),t=r(()=>{const i=n.design.value[e],l=n.defaults.value[e];return{enabled:i?.enabled??l?.enabled}}),o=r(()=>t.value?.enabled);return d({enabled:o})}function ue(e){const n=s(),t=r(()=>{const i=n.design.value[e],l=n.defaults.value[e];return{value:i?.value??l?.value}}),o=r(()=>t.value?.value);return d({value:o})}function se(e){const n=s(),t=r(()=>{const i=n.design.value[e],l=n.defaults.value[e],a=n.context.value.globalDesign;return{background:{type:i?.background?.type??l?.background?.type,solid:{color:i?.background?.solid?.color??p(a,l?.background?.solid?.color)},gradient:{fromColor:i?.background?.gradient?.fromColor??p(a,l?.background?.gradient?.fromColor),toColor:i?.background?.gradient?.toColor??p(a,l?.background?.gradient?.toColor)}}}}),o=r(()=>t.value?.background);return d({background:o})}function ce(){const e=s(),n=r(()=>e.design.value.layout),t=r(()=>n.value);return d({layout:t})}function ve(e,n){return{visible:n?.visible??!1,width:n?.width??1,color:p(e,n?.color)}}function de(){const e=s();return r(()=>{const n=e.design.value.logo,t=e.defaults.value.logo,o=e.context.value.globalDesign;return{font:n?.font?.replaceAll("_"," ")??T(o,t?.font),size:n?.size??I(o,t?.size),bold:n?.bold??t?.bold,italic:n?.italic??t?.italic,color:n?.color??p(o,t?.color),visible:n?.visible??t?.visible??!1,spacing:n?.spacing??t?.spacing??0,capitalization:n?.capitalization??t?.capitalization??"none",frame:n?.frame??ve(o,t?.frame)}})}function S(e){return{app:$(e)}}function fe(e,n){return{init:()=>{const{app:t}=S(e);return n?.init?.(t),{render:async(o,i)=>(s().init(t,o,i.content,i.design,i.defaults,i.externalContent),n?.render?.(t,o,i),{html:await D(t,{context:o}),state:{context:o,data:i}})}}}}function ge(e,n){return{init:()=>{const{app:t}=S(e);return n?.init?.(t),{mount:(o,i)=>{s().init(t,i.context,i.data.content,i.data.design,i.data.defaults,i.data.externalContent),n?.mount?.(t,o,i),t.mount(o)},update:o=>{s().update(t,o.data.content,o.data.design,o.data.defaults,o.data.externalContent),n?.update?.(t,o)},unmount:()=>{n?.unmount?.(t),t.unmount()}}}}}function pe(){return globalThis.window.instantsite}export{G as EditorTypes,ge as createVueClientApp,fe as createVueServerApp,se as useBackgroundElementDesign,O as useButtonElementContent,ie as useButtonElementDesign,Z as useDeckElementContent,L as useImageElementContent,le as useImageElementDesign,_ as useInputboxElementContent,pe as useInstantsiteJsApi,ce as useLayoutElementDesign,ne as useLogoElementContent,de as useLogoElementDesign,A as useMenuElementContent,q as useNavigationMenuElementContent,R as useSelectboxElementContent,ue as useSelectboxElementDesign,oe as useTextElementDesign,h as useTextareaElementContent,re as useTextareaElementDesign,k as useToggleElementContent,ae as useToggleElementDesign,s as useVueBaseProps};
|
|
1
|
+
import{getCurrentInstance as N,ref as E,computed as i,reactive as d,createSSRApp as B}from"vue";import{renderToString as M}from"vue/server-renderer";const y=new Map;function s(){const e=(r,l,a,v,g,u)=>{y.set(r._uid,{context:E(l),content:E(a),design:E(v),defaults:E(g),site:E(u?.site??{})})},n=(r,l,a,v,g)=>{const u=y.get(r._uid);u!==void 0&&(u.content.value=l,u.design.value=a,u.defaults.value=v,u.site.value=g.site??{})},t=N()?.appContext.app._uid??-1,o=y.get(t);return{init:e,update:n,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,site:o?.site}}function O(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return K(o,e)}function K(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not inputbox`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value);return d({hasContent:o,value:r})}function C(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return P(o,e)}function P(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not textarea`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value);return d({hasContent:o,value:r})}const b={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE"};function U(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function X(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function F(e){if("pageUrl"in e)return e.pageUrl;switch(X(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}const x=(e,n)=>{if(!e||n)return;const{type:t,link:o,email:r,phone:l}=e,a=F(e);switch(t){case b.HYPER_LINK:if(o)return()=>window.open(o,"_blank");break;case b.GO_TO_STORE:case b.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case b.MAIL_LINK:if(r)return()=>window.open(`mailto:${r}`,"_self");break;case b.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case b.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const v=U(e);document.getElementById(`tile-${v}`)?.scrollIntoView()};break;case b.GO_TO_PAGE:if(a)return()=>window.open(a,"_self");break;default:console.error(`Unknown type of ActionLink: ${t}`)}};function V(e){return"title"in e&&"type"in e}function H(e,n,t){const o=i(()=>{const _=e.value[n];if(_!==void 0){if(V(_))return _;throw new Error(`Element ${n} is not action link`)}}),r=i(()=>o.value?.title),l=i(()=>o.value?.type),a=i(()=>o.value?.link),v=i(()=>o.value?.email),g=i(()=>o.value?.phone),u=i(()=>o.value?.tileId?`tile-${o.value?.tileId}`:null),c=i(()=>o.value?.type==="GO_TO_STORE_LINK"?"products":o.value?.pageId),f=i(()=>o.value?.pageUrl),m=i(()=>!!r.value),$=i(()=>!!a.value),D=x(o.value,t);return d({title:r,type:l,link:a,email:v,phone:g,tileDivId:u,pageId:c,pageUrl:f,hasTitle:m,hasLink:$,performAction:D})}function L(e,n){const t=s(),o=i(()=>!!t.site?.value?.isPreviewMode),r=i(()=>n!==void 0?n:t.content.value!==void 0?t.content.value:{});return H(r,e,o.value)}function W(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function w(e,n){const t=new RegExp(/^https?:\/\//);return e!=null&&t.test(e)?e:`${n}/${e}`}function k(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return Y(o,e)}function Y(e,n){const t=i(()=>{const u=e.value[n];if(u!==void 0){if(W(u))return u;throw new Error(`Element ${n} is not image`)}}),o=i(()=>t.value===void 0?"":s().context.value.imageBuckets?.[t.value?.bucket]),r=i(()=>t.value!==void 0),l=i(()=>w(t.value?.set?.["cropped-webp-100x200"]?.url,o.value)),a=i(()=>w(t.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),v=i(()=>w(t.value?.set?.["webp-200x200"]?.url,o.value)),g=i(()=>w(t.value?.set?.["webp-2000x2000"]?.url,o.value));return d({hasContent:r,lowResolutionMobileImage:l,highResolutionMobileImage:a,lowResolutionDesktopImage:v,highResolutionDesktopImage:g})}function j(e){return"enabled"in e}function R(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return J(o,e)}function J(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(j(l))return l;throw new Error(`Element ${n} is not toggle`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value?.enabled);return d({hasContent:o,value:r})}function A(e,n){const t=s(),o=i(()=>n!==void 0?n:t.content.value);return q(o,e)}function q(e,n){const t=i(()=>{const l=e.value[n];if(l!==void 0){if(typeof l=="string")return l;throw new Error(`Element ${n} is not selectbox`)}}),o=i(()=>t.value!==void 0),r=i(()=>t.value);return d({hasContent:o,value:r})}function Q(e){return e!==null&&"items"in e}function G(e){const n=s(),t=i(()=>{const a=n.content.value[e];if(a!==void 0){if(Q(a))return a;throw new Error(`Element ${e} is not an menu`)}}),o=i(()=>!!n.site?.value?.isPreviewMode),r=i(()=>t.value!==void 0),l=i(()=>t.value?.items?t.value.items.map(a=>({...a,performAction:x(a,o.value)})):[]);return d({hasContent:r,items:l})}const Z="menu";function ee(){return G(Z)}var S=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(S||{});function te(e){if(typeof e!="object"||e===null)return!1;const n=e;return Array.isArray(n.cards)&&n.cards.every(t=>typeof t.settings=="object"&&t.settings!==null)}function ne(e){const n=s(),t=i(()=>{const l=n.content.value[e];if(l!==void 0){if(te(l))return l;throw new Error(`Element ${e} is not of DECK type`)}}),o=i(()=>t.value!==void 0&&t.value.cards.length>0),r=i(()=>t.value?.cards);return d({hasContent:o,cards:r,getReactiveRef:oe})}function oe(e,n,t){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const o=e.settings[t];if(o===void 0)return o;switch(n){case"TEXTAREA":return C(t,e.settings);case"INPUTBOX":return O(t,e.settings);case"SELECTBOX":return A(t,e.settings);case"IMAGE":return k(t,e.settings);case"TOGGLE":return R(t,e.settings);case"BUTTON":return L(t,e.settings);default:return}}function ie(e){return"type"in e&&("text"in e||"image"in e)}function T(e,n){const t=new RegExp(/^https?:\/\//);return e!==void 0&&t.test(e)?e:`${n}/${e}`}function re(){const e=s(),n=i(()=>{const a=e.content.value.logo;if(a!==void 0){if(ie(a))return a;throw new Error("Element logo is not LOGO")}}),t=i(()=>n.value?.type),o=i(()=>n.value?.text),r=i(()=>n.value?.image===void 0?"":e.context.value.imageBuckets?.[n.value.image.bucket]),l=i(()=>({lowResolutionMobileImage:T(n.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:T(n.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:T(n.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:T(n.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return d({type:t,text:o,image:l})}function I(e,n){if(n===void 0)return;if(!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.fontFamily[t]}function h(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.textSize[t]}function p(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.color[t]}function le(e){const n=s(),t=i(()=>{const u=n.design.value[e],c=n.defaults.value[e],f=n.context.value.globalDesign;return{font:u?.font?.replaceAll("_"," ")??I(f,c?.font),size:u?.size??h(f,c?.size),bold:u?.bold??c?.bold,italic:u?.italic??c?.italic,color:u?.color??p(f,c?.color),visible:u?.visible??c?.visible??!1}}),o=i(()=>t.value?.font),r=i(()=>t.value?.size),l=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({font:o,size:r,bold:l,italic:a,color:v,visible:g})}function ae(e){const n=s(),t=i(()=>{const c=n.design.value[e],f=n.defaults.value[e],m=n.context.value.globalDesign;return{font:c?.font?.replaceAll("_"," ")??I(m,f?.font),size:c?.size??h(m,f?.size),bold:c?.bold??f?.bold,italic:c?.italic??f?.italic,color:c?.color??p(m,f?.color),visible:c?.visible??f?.visible??!1,whiteSpace:"pre-wrap"}}),o=i(()=>t.value?.font),r=i(()=>t.value?.size),l=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible),u=i(()=>t.value?.whiteSpace);return d({font:o,size:r,bold:l,italic:a,color:v,visible:g,whiteSpace:u})}function ue(e){const n=s(),t=i(()=>{const u=n.design.value[e],c=n.defaults.value[e],f=n.context.value.globalDesign;return{appearance:u?.appearance??c?.appearance,font:u?.font??I(f,c?.font),size:u?.size??c?.size,style:u?.style??c?.style,color:u?.color??p(f,c?.color),visible:u?.visible??c?.visible??!1}}),o=i(()=>t.value?.appearance),r=i(()=>t.value?.font),l=i(()=>t.value?.size),a=i(()=>t.value?.style),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({appearance:o,font:r,size:l,style:a,color:v,visible:g})}function se(e){const n=s(),t=i(()=>{const l=n.design.value[e],a=n.defaults.value[e],v=n.context.value.globalDesign;return{overlay:{type:l?.overlay?.type??a?.overlay?.type,solid:{color:l?.overlay?.solid?.color??p(v,a?.overlay?.solid?.color)},gradient:{fromColor:l?.overlay?.gradient?.fromColor??p(v,a?.overlay?.gradient?.fromColor),toColor:l?.overlay?.gradient?.toColor??p(v,a?.overlay?.gradient?.toColor)}},visible:l?.visible??a?.visible??!1}}),o=i(()=>t.value?.overlay),r=i(()=>t.value?.visible);return d({overlay:o,visible:r})}function ce(e){const n=s(),t=i(()=>{const r=n.design.value[e],l=n.defaults.value[e];return{enabled:r?.enabled??l?.enabled}}),o=i(()=>t.value?.enabled);return d({enabled:o})}function ve(e){const n=s(),t=i(()=>{const r=n.design.value[e],l=n.defaults.value[e];return{value:r?.value??l?.value}}),o=i(()=>t.value?.value);return d({value:o})}function de(e){const n=s(),t=i(()=>{const r=n.design.value[e],l=n.defaults.value[e],a=n.context.value.globalDesign;return{background:{type:r?.background?.type??l?.background?.type,solid:{color:r?.background?.solid?.color??p(a,l?.background?.solid?.color)},gradient:{fromColor:r?.background?.gradient?.fromColor??p(a,l?.background?.gradient?.fromColor),toColor:r?.background?.gradient?.toColor??p(a,l?.background?.gradient?.toColor)}}}}),o=i(()=>t.value?.background);return d({background:o})}function fe(){const e=s(),n=i(()=>e.design.value.layout),t=i(()=>n.value);return d({layout:t})}function ge(e,n){return{visible:n?.visible??!1,width:n?.width??1,color:p(e,n?.color)}}function pe(){const e=s();return i(()=>{const n=e.design.value.logo,t=e.defaults.value.logo,o=e.context.value.globalDesign;return{font:n?.font?.replaceAll("_"," ")??I(o,t?.font),size:n?.size??h(o,t?.size),bold:n?.bold??t?.bold,italic:n?.italic??t?.italic,color:n?.color??p(o,t?.color),visible:n?.visible??t?.visible??!1,spacing:n?.spacing??t?.spacing??0,capitalization:n?.capitalization??t?.capitalization??"none",frame:n?.frame??ge(o,t?.frame)}})}function z(e){return{app:B(e)}}function be(e,n){return{init:()=>{const{app:t}=z(e);return n?.init?.(t),{render:async(o,r)=>(s().init(t,o,r.content,r.design,r.defaults,r.externalContent),n?.render?.(t,o,r),{html:await M(t,{context:o}),state:{context:o,data:r}})}}}}function me(e,n){return{init:()=>{const{app:t}=z(e);return n?.init?.(t),{mount:(o,r)=>{s().init(t,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent),n?.mount?.(t,o,r),t.mount(o)},update:o=>{s().update(t,o.data.content,o.data.design,o.data.defaults,o.data.externalContent),n?.update?.(t,o)},unmount:()=>{n?.unmount?.(t),t.unmount()}}}}}function Ee(){return globalThis.window.instantsite}export{S as EditorTypes,me as createVueClientApp,be as createVueServerApp,de as useBackgroundElementDesign,L as useButtonElementContent,ue as useButtonElementDesign,ne as useDeckElementContent,k as useImageElementContent,se as useImageElementDesign,O as useInputboxElementContent,Ee as useInstantsiteJsApi,fe as useLayoutElementDesign,re as useLogoElementContent,pe as useLogoElementDesign,G as useMenuElementContent,ee as useNavigationMenuElementContent,A as useSelectboxElementContent,ve as useSelectboxElementDesign,le as useTextElementDesign,C as useTextareaElementContent,ae as useTextareaElementDesign,R as useToggleElementContent,ce as useToggleElementDesign,s as useVueBaseProps};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
`),b.info(`App ${e} created`)}catch(t){b.error(`Error while creating app: ${t.message}`),D.exit(1)}}async function st(e){try{const t=e,s=D.cwd(),r=k.join(s,"sections",t);A.existsSync(r)?(b.error(`Section with the name: ${e} already exists. If you'd like to override it, delete previous version first`),D.exit(1)):A.mkdirSync(r);const n=k.resolve(V(import.meta.url),"../..","template/sections/example-section");A.readdirSync(n).forEach(async o=>oe(r,n,o)),b.info(`Section ${e} created`)}catch(t){b.error(`Error while creating section: ${t.message}`),D.exit(1)}}async function ot(e,t=!1){try{const s=D.cwd(),r=k.join(s,"templates"),n={"template.ts":`${e}.ts`};A.existsSync(r)?A.existsSync(k.join(r,`${e}.ts`))&&(b.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),D.exit(1)):A.mkdirSync(r);const o=k.resolve(V(import.meta.url),"../..","template/templates");if(A.readdirSync(o).forEach(async i=>oe(r,o,i,n)),t){const i={headers:k.resolve(V(import.meta.url),"../..","template/headers"),footers:k.resolve(V(import.meta.url),"../..","template/footers")};["headers","footers"].forEach(c=>{const a=k.join(s,c);if(!A.existsSync(a)){A.mkdirSync(a);const p=i[c];A.readdirSync(p).forEach(async u=>oe(a,p,u))}})}b.info(`Template descriptor file [${e}.ts] has been created`)}catch(s){b.error(`Error while creating template descriptors: ${s.message}`),D.exit(1)}}var j=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.TemplateAsset=6]="TemplateAsset",e))(j||{}),I=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e))(I||{});function rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}},Ce,it;function Pn(){return it||(it=1,Ce={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),Ce}var Oe,at;function ct(){if(at)return Oe;at=1;const e=Pn(),t={};for(const n of Object.keys(e))t[e[n]]=n;const s={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Oe=s;for(const n of Object.keys(s)){if(!("channels"in s[n]))throw new Error("missing channels property: "+n);if(!("labels"in s[n]))throw new Error("missing channel labels property: "+n);if(s[n].labels.length!==s[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:o,labels:i}=s[n];delete s[n].channels,delete s[n].labels,Object.defineProperty(s[n],"channels",{value:o}),Object.defineProperty(s[n],"labels",{value:i})}s.rgb.hsl=function(n){const o=n[0]/255,i=n[1]/255,c=n[2]/255,a=Math.min(o,i,c),p=Math.max(o,i,c),u=p-a;let l,f;p===a?l=0:o===p?l=(i-c)/u:i===p?l=2+(c-o)/u:c===p&&(l=4+(o-i)/u),l=Math.min(l*60,360),l<0&&(l+=360);const d=(a+p)/2;return p===a?f=0:d<=.5?f=u/(p+a):f=u/(2-p-a),[l,f*100,d*100]},s.rgb.hsv=function(n){let o,i,c,a,p;const u=n[0]/255,l=n[1]/255,f=n[2]/255,d=Math.max(u,l,f),m=d-Math.min(u,l,f),h=function(g){return(d-g)/6/m+1/2};return m===0?(a=0,p=0):(p=m/d,o=h(u),i=h(l),c=h(f),u===d?a=c-i:l===d?a=1/3+o-c:f===d&&(a=2/3+i-o),a<0?a+=1:a>1&&(a-=1)),[a*360,p*100,d*100]},s.rgb.hwb=function(n){const o=n[0],i=n[1];let c=n[2];const a=s.rgb.hsl(n)[0],p=1/255*Math.min(o,Math.min(i,c));return c=1-1/255*Math.max(o,Math.max(i,c)),[a,p*100,c*100]},s.rgb.cmyk=function(n){const o=n[0]/255,i=n[1]/255,c=n[2]/255,a=Math.min(1-o,1-i,1-c),p=(1-o-a)/(1-a)||0,u=(1-i-a)/(1-a)||0,l=(1-c-a)/(1-a)||0;return[p*100,u*100,l*100,a*100]};function r(n,o){return(n[0]-o[0])**2+(n[1]-o[1])**2+(n[2]-o[2])**2}return s.rgb.keyword=function(n){const o=t[n];if(o)return o;let i=1/0,c;for(const a of Object.keys(e)){const p=e[a],u=r(n,p);u<i&&(i=u,c=a)}return c},s.keyword.rgb=function(n){return e[n]},s.rgb.xyz=function(n){let o=n[0]/255,i=n[1]/255,c=n[2]/255;o=o>.04045?((o+.055)/1.055)**2.4:o/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,c=c>.04045?((c+.055)/1.055)**2.4:c/12.92;const a=o*.4124+i*.3576+c*.1805,p=o*.2126+i*.7152+c*.0722,u=o*.0193+i*.1192+c*.9505;return[a*100,p*100,u*100]},s.rgb.lab=function(n){const o=s.rgb.xyz(n);let i=o[0],c=o[1],a=o[2];i/=95.047,c/=100,a/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,c=c>.008856?c**(1/3):7.787*c+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;const p=116*c-16,u=500*(i-c),l=200*(c-a);return[p,u,l]},s.hsl.rgb=function(n){const o=n[0]/360,i=n[1]/100,c=n[2]/100;let a,p,u;if(i===0)return u=c*255,[u,u,u];c<.5?a=c*(1+i):a=c+i-c*i;const l=2*c-a,f=[0,0,0];for(let d=0;d<3;d++)p=o+1/3*-(d-1),p<0&&p++,p>1&&p--,6*p<1?u=l+(a-l)*6*p:2*p<1?u=a:3*p<2?u=l+(a-l)*(2/3-p)*6:u=l,f[d]=u*255;return f},s.hsl.hsv=function(n){const o=n[0];let i=n[1]/100,c=n[2]/100,a=i;const p=Math.max(c,.01);c*=2,i*=c<=1?c:2-c,a*=p<=1?p:2-p;const u=(c+i)/2,l=c===0?2*a/(p+a):2*i/(c+i);return[o,l*100,u*100]},s.hsv.rgb=function(n){const o=n[0]/60,i=n[1]/100;let c=n[2]/100;const a=Math.floor(o)%6,p=o-Math.floor(o),u=255*c*(1-i),l=255*c*(1-i*p),f=255*c*(1-i*(1-p));switch(c*=255,a){case 0:return[c,f,u];case 1:return[l,c,u];case 2:return[u,c,f];case 3:return[u,l,c];case 4:return[f,u,c];case 5:return[c,u,l]}},s.hsv.hsl=function(n){const o=n[0],i=n[1]/100,c=n[2]/100,a=Math.max(c,.01);let p,u;u=(2-i)*c;const l=(2-i)*a;return p=i*a,p/=l<=1?l:2-l,p=p||0,u/=2,[o,p*100,u*100]},s.hwb.rgb=function(n){const o=n[0]/360;let i=n[1]/100,c=n[2]/100;const a=i+c;let p;a>1&&(i/=a,c/=a);const u=Math.floor(6*o),l=1-c;p=6*o-u,u&1&&(p=1-p);const f=i+p*(l-i);let d,m,h;switch(u){default:case 6:case 0:d=l,m=f,h=i;break;case 1:d=f,m=l,h=i;break;case 2:d=i,m=l,h=f;break;case 3:d=i,m=f,h=l;break;case 4:d=f,m=i,h=l;break;case 5:d=l,m=i,h=f;break}return[d*255,m*255,h*255]},s.cmyk.rgb=function(n){const o=n[0]/100,i=n[1]/100,c=n[2]/100,a=n[3]/100,p=1-Math.min(1,o*(1-a)+a),u=1-Math.min(1,i*(1-a)+a),l=1-Math.min(1,c*(1-a)+a);return[p*255,u*255,l*255]},s.xyz.rgb=function(n){const o=n[0]/100,i=n[1]/100,c=n[2]/100;let a,p,u;return a=o*3.2406+i*-1.5372+c*-.4986,p=o*-.9689+i*1.8758+c*.0415,u=o*.0557+i*-.204+c*1.057,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,p=p>.0031308?1.055*p**(1/2.4)-.055:p*12.92,u=u>.0031308?1.055*u**(1/2.4)-.055:u*12.92,a=Math.min(Math.max(0,a),1),p=Math.min(Math.max(0,p),1),u=Math.min(Math.max(0,u),1),[a*255,p*255,u*255]},s.xyz.lab=function(n){let o=n[0],i=n[1],c=n[2];o/=95.047,i/=100,c/=108.883,o=o>.008856?o**(1/3):7.787*o+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,c=c>.008856?c**(1/3):7.787*c+16/116;const a=116*i-16,p=500*(o-i),u=200*(i-c);return[a,p,u]},s.lab.xyz=function(n){const o=n[0],i=n[1],c=n[2];let a,p,u;p=(o+16)/116,a=i/500+p,u=p-c/200;const l=p**3,f=a**3,d=u**3;return p=l>.008856?l:(p-16/116)/7.787,a=f>.008856?f:(a-16/116)/7.787,u=d>.008856?d:(u-16/116)/7.787,a*=95.047,p*=100,u*=108.883,[a,p,u]},s.lab.lch=function(n){const o=n[0],i=n[1],c=n[2];let a;a=Math.atan2(c,i)*360/2/Math.PI,a<0&&(a+=360);const u=Math.sqrt(i*i+c*c);return[o,u,a]},s.lch.lab=function(n){const o=n[0],i=n[1],a=n[2]/360*2*Math.PI,p=i*Math.cos(a),u=i*Math.sin(a);return[o,p,u]},s.rgb.ansi16=function(n,o=null){const[i,c,a]=n;let p=o===null?s.rgb.hsv(n)[2]:o;if(p=Math.round(p/50),p===0)return 30;let u=30+(Math.round(a/255)<<2|Math.round(c/255)<<1|Math.round(i/255));return p===2&&(u+=60),u},s.hsv.ansi16=function(n){return s.rgb.ansi16(s.hsv.rgb(n),n[2])},s.rgb.ansi256=function(n){const o=n[0],i=n[1],c=n[2];return o===i&&i===c?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(i/255*5)+Math.round(c/255*5)},s.ansi16.rgb=function(n){let o=n%10;if(o===0||o===7)return n>50&&(o+=3.5),o=o/10.5*255,[o,o,o];const i=(~~(n>50)+1)*.5,c=(o&1)*i*255,a=(o>>1&1)*i*255,p=(o>>2&1)*i*255;return[c,a,p]},s.ansi256.rgb=function(n){if(n>=232){const p=(n-232)*10+8;return[p,p,p]}n-=16;let o;const i=Math.floor(n/36)/5*255,c=Math.floor((o=n%36)/6)/5*255,a=o%6/5*255;return[i,c,a]},s.rgb.hex=function(n){const i=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(i.length)+i},s.hex.rgb=function(n){const o=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!o)return[0,0,0];let i=o[0];o[0].length===3&&(i=i.split("").map(l=>l+l).join(""));const c=parseInt(i,16),a=c>>16&255,p=c>>8&255,u=c&255;return[a,p,u]},s.rgb.hcg=function(n){const o=n[0]/255,i=n[1]/255,c=n[2]/255,a=Math.max(Math.max(o,i),c),p=Math.min(Math.min(o,i),c),u=a-p;let l,f;return u<1?l=p/(1-u):l=0,u<=0?f=0:a===o?f=(i-c)/u%6:a===i?f=2+(c-o)/u:f=4+(o-i)/u,f/=6,f%=1,[f*360,u*100,l*100]},s.hsl.hcg=function(n){const o=n[1]/100,i=n[2]/100,c=i<.5?2*o*i:2*o*(1-i);let a=0;return c<1&&(a=(i-.5*c)/(1-c)),[n[0],c*100,a*100]},s.hsv.hcg=function(n){const o=n[1]/100,i=n[2]/100,c=o*i;let a=0;return c<1&&(a=(i-c)/(1-c)),[n[0],c*100,a*100]},s.hcg.rgb=function(n){const o=n[0]/360,i=n[1]/100,c=n[2]/100;if(i===0)return[c*255,c*255,c*255];const a=[0,0,0],p=o%1*6,u=p%1,l=1-u;let f=0;switch(Math.floor(p)){case 0:a[0]=1,a[1]=u,a[2]=0;break;case 1:a[0]=l,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=u;break;case 3:a[0]=0,a[1]=l,a[2]=1;break;case 4:a[0]=u,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=l}return f=(1-i)*c,[(i*a[0]+f)*255,(i*a[1]+f)*255,(i*a[2]+f)*255]},s.hcg.hsv=function(n){const o=n[1]/100,i=n[2]/100,c=o+i*(1-o);let a=0;return c>0&&(a=o/c),[n[0],a*100,c*100]},s.hcg.hsl=function(n){const o=n[1]/100,c=n[2]/100*(1-o)+.5*o;let a=0;return c>0&&c<.5?a=o/(2*c):c>=.5&&c<1&&(a=o/(2*(1-c))),[n[0],a*100,c*100]},s.hcg.hwb=function(n){const o=n[1]/100,i=n[2]/100,c=o+i*(1-o);return[n[0],(c-o)*100,(1-c)*100]},s.hwb.hcg=function(n){const o=n[1]/100,c=1-n[2]/100,a=c-o;let p=0;return a<1&&(p=(c-a)/(1-a)),[n[0],a*100,p*100]},s.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]},s.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]},s.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]},s.gray.hsl=function(n){return[0,0,n[0]]},s.gray.hsv=s.gray.hsl,s.gray.hwb=function(n){return[0,100,n[0]]},s.gray.cmyk=function(n){return[0,0,0,n[0]]},s.gray.lab=function(n){return[n[0],0,0]},s.gray.hex=function(n){const o=Math.round(n[0]/100*255)&255,c=((o<<16)+(o<<8)+o).toString(16).toUpperCase();return"000000".substring(c.length)+c},s.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]},Oe}var we,lt;function Un(){if(lt)return we;lt=1;const e=ct();function t(){const o={},i=Object.keys(e);for(let c=i.length,a=0;a<c;a++)o[i[a]]={distance:-1,parent:null};return o}function s(o){const i=t(),c=[o];for(i[o].distance=0;c.length;){const a=c.pop(),p=Object.keys(e[a]);for(let u=p.length,l=0;l<u;l++){const f=p[l],d=i[f];d.distance===-1&&(d.distance=i[a].distance+1,d.parent=a,c.unshift(f))}}return i}function r(o,i){return function(c){return i(o(c))}}function n(o,i){const c=[i[o].parent,o];let a=e[i[o].parent][o],p=i[o].parent;for(;i[p].parent;)c.unshift(i[p].parent),a=r(e[i[p].parent][p],a),p=i[p].parent;return a.conversion=c,a}return we=function(o){const i=s(o),c={},a=Object.keys(i);for(let p=a.length,u=0;u<p;u++){const l=a[u];i[l].parent!==null&&(c[l]=n(l,i))}return c},we}var ve,pt;function Xn(){if(pt)return ve;pt=1;const e=ct(),t=Un(),s={},r=Object.keys(e);function n(i){const c=function(...a){const p=a[0];return p==null?p:(p.length>1&&(a=p),i(a))};return"conversion"in i&&(c.conversion=i.conversion),c}function o(i){const c=function(...a){const p=a[0];if(p==null)return p;p.length>1&&(a=p);const u=i(a);if(typeof u=="object")for(let l=u.length,f=0;f<l;f++)u[f]=Math.round(u[f]);return u};return"conversion"in i&&(c.conversion=i.conversion),c}return r.forEach(i=>{s[i]={},Object.defineProperty(s[i],"channels",{value:e[i].channels}),Object.defineProperty(s[i],"labels",{value:e[i].labels});const c=t(i);Object.keys(c).forEach(p=>{const u=c[p];s[i][p]=o(u),s[i][p].raw=n(u)})}),ve=s,ve}Ee.exports,function(e){const t=(u,l)=>(...f)=>`\x1B[${u(...f)+l}m`,s=(u,l)=>(...f)=>{const d=u(...f);return`\x1B[${38+l};5;${d}m`},r=(u,l)=>(...f)=>{const d=u(...f);return`\x1B[${38+l};2;${d[0]};${d[1]};${d[2]}m`},n=u=>u,o=(u,l,f)=>[u,l,f],i=(u,l,f)=>{Object.defineProperty(u,l,{get:()=>{const d=f();return Object.defineProperty(u,l,{value:d,enumerable:!0,configurable:!0}),d},enumerable:!0,configurable:!0})};let c;const a=(u,l,f,d)=>{c===void 0&&(c=Xn());const m=d?10:0,h={};for(const[g,y]of Object.entries(c)){const $=g==="ansi16"?"ansi":g;g===l?h[$]=u(f,m):typeof y=="object"&&(h[$]=u(y[l],m))}return h};function p(){const u=new Map,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};l.color.gray=l.color.blackBright,l.bgColor.bgGray=l.bgColor.bgBlackBright,l.color.grey=l.color.blackBright,l.bgColor.bgGrey=l.bgColor.bgBlackBright;for(const[f,d]of Object.entries(l)){for(const[m,h]of Object.entries(d))l[m]={open:`\x1B[${h[0]}m`,close:`\x1B[${h[1]}m`},d[m]=l[m],u.set(h[0],h[1]);Object.defineProperty(l,f,{value:d,enumerable:!1})}return Object.defineProperty(l,"codes",{value:u,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",i(l.color,"ansi",()=>a(t,"ansi16",n,!1)),i(l.color,"ansi256",()=>a(s,"ansi256",n,!1)),i(l.color,"ansi16m",()=>a(r,"rgb",o,!1)),i(l.bgColor,"ansi",()=>a(t,"ansi16",n,!0)),i(l.bgColor,"ansi256",()=>a(s,"ansi256",n,!0)),i(l.bgColor,"ansi16m",()=>a(r,"rgb",o,!0)),l}Object.defineProperty(e,"exports",{enumerable:!0,get:p})}(Ee);var zn=Ee.exports,qn=(e,t=process.argv)=>{const s=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(s+e),n=t.indexOf("--");return r!==-1&&(n===-1||r<n)};const Kn=In,ut=Je,x=qn,{env:w}=process;let B;x("no-color")||x("no-colors")||x("color=false")||x("color=never")?B=0:(x("color")||x("colors")||x("color=true")||x("color=always"))&&(B=1),"FORCE_COLOR"in w&&(w.FORCE_COLOR==="true"?B=1:w.FORCE_COLOR==="false"?B=0:B=w.FORCE_COLOR.length===0?1:Math.min(parseInt(w.FORCE_COLOR,10),3));function $e(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Te(e,t){if(B===0)return 0;if(x("color=16m")||x("color=full")||x("color=truecolor"))return 3;if(x("color=256"))return 2;if(e&&!t&&B===void 0)return 0;const s=B||0;if(w.TERM==="dumb")return s;if(process.platform==="win32"){const r=Kn.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in w)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in w)||w.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in w)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(w.TEAMCITY_VERSION)?1:0;if(w.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in w){const r=parseInt((w.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(w.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(w.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(w.TERM)||"COLORTERM"in w?1:s}function Hn(e){const t=Te(e,e&&e.isTTY);return $e(t)}var ft={supportsColor:Hn,stdout:$e(Te(!0,ut.isatty(1))),stderr:$e(Te(!0,ut.isatty(2)))};const Vn=(e,t,s)=>{let r=e.indexOf(t);if(r===-1)return e;const n=t.length;let o=0,i="";do i+=e.substr(o,r-o)+t+s,o=r+n,r=e.indexOf(t,o);while(r!==-1);return i+=e.substr(o),i},Jn=(e,t,s,r)=>{let n=0,o="";do{const i=e[r-1]==="\r";o+=e.substr(n,(i?r-1:r)-n)+t+(i?`\r
|
|
3
|
-
|
|
4
|
-
`)
|
|
5
|
-
|
|
6
|
-
`
|
|
7
|
-
`)
|
|
8
|
-
`).
|
|
9
|
-
|
|
10
|
-
`)
|
|
11
|
-
`).map(d=>d.trim()).join(" ")},l.O=function(f){return this.inspectOpts.colors=this.useColors,r.inspect(f,this.inspectOpts)}}(ue,ue.exports)),ue.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?xe.exports=rs():xe.exports=is();var as=xe.exports;const cs=rt(as),ls=e=>typeof e=="function",ps=e=>Object.prototype.toString.call(e)==="[object RegExp]";function $t(e,t){let s=[];try{de.existsSync(e)&&(de.lstatSync(e).isDirectory()?de.readdirSync(e).forEach(function(o){const i=$t(te.join(e,"/",o),t);s=s.concat(i)}):t!==void 0||s.push(e))}catch(r){throw r}return s}const Le=cs.debug("vite-plugin-compression"),us=/\.(js|mjs|json|css|html)$/i,Tt=new Map;function fs(e={}){let t,s;const r={name:"vite:compression"},{disable:n=!1,filter:o=us,verbose:i=!0,threshold:c=1025,compressionOptions:a={},deleteOriginFile:p=!1,success:u=()=>{}}=e;let{ext:l=""}=e;const{algorithm:f="gzip"}=e;return f==="gzip"&&!l&&(l=".gz"),f==="brotliCompress"&&!l&&(l=".br"),n?r:(Le("plugin options:",e),{...r,apply:"build",enforce:"post",configResolved(d){s=d,t=te.isAbsolute(s.build.outDir)?s.build.outDir:te.join(s.root,s.build.outDir),Le("resolvedConfig:",d)},async closeBundle(){let d=$t(t)||[];if(Le("files:",d),!d.length)return;d=ds(d,o);const m=ms(f,a),h=new Map,g=d.map(async y=>{const{mtimeMs:$,size:R}=await se.stat(y);if($<=(Tt.get(y)||0)||R<c)return;let M=await se.readFile(y);p&&se.remove(y);try{M=await hs(M,f,m)}catch{s.logger.error("compress error:"+y)}const U=M.byteLength,fe=ys(y,l);h.set(y,{size:U/1024,oldSize:R/1024,cname:fe}),await se.writeFile(fe,M),Tt.set(y,Date.now())});return Promise.all(g).then(()=>{i&&(gs(s,h,f),u())})}})}function ds(e,t){if(t){const s=ps(t),r=ls(t);e=e.filter(n=>s?t.test(n):r?t(n):!0)}return e}function ms(e="",t={}){return{...{gzip:{level:G.constants.Z_BEST_COMPRESSION},deflate:{level:G.constants.Z_BEST_COMPRESSION},deflateRaw:{level:G.constants.Z_BEST_COMPRESSION},brotliCompress:{params:{[G.constants.BROTLI_PARAM_QUALITY]:G.constants.BROTLI_MAX_QUALITY,[G.constants.BROTLI_PARAM_MODE]:G.constants.BROTLI_MODE_TEXT}}}[e],...t}}function hs(e,t,s={}){return new Promise((r,n)=>{G[t](e,s,(o,i)=>o?n(o):r(i))})}function ys(e,t){const s=t.startsWith(".")?t:`.${t}`;return`${e}${s}`}function gs(e,t,s){e.logger.info(`
|
|
12
|
-
${le.cyan("\u2728 [vite-plugin-compression]:algorithm="+s)} - compressed file successfully: `);const r=Array.from(t.keys(),o=>o.length),n=Math.max(...r);t.forEach((o,i)=>{const{size:c,oldSize:a,cname:p}=o,u=ze(p).replace(ze(`${e.build.outDir}/`),""),l=`${a.toFixed(2)}kb / ${s}: ${c.toFixed(2)}kb`;e.logger.info(le.dim(te.basename(e.build.outDir)+"/")+le.blueBright(u)+" ".repeat(2+n-i.length)+" "+le.dim(l))}),e.logger.info(`
|
|
13
|
-
`)}const bs=()=>fs({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),jt=()=>{const e=process.env.npm_lifecycle_event;return Ln({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},Es={[I.Server]:[Ve(),me(),bs()],[I.Client]:[Ve(),me(),jt(),xn({vue:"EcVue"})],[I.Misc]:[me(),jt()]},v={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function Cs(e){return L(`${he}/${e}`)?"HEADER":L(`${ye}/${e}`)?"FOOTER":"SECTION"}const At={"process.env":{NODE_ENV:"production"}},Os=[...He,...He.map(e=>`node:${e}`)],ws=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],_={[j.Server]:{pluginType:I.Server,define:At,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${v[t].dist}/${e}/js/main/server`,externalOption:[...Os],entryFileNames:"server.js",inlineDynamicImports:!0},[j.Client]:{pluginType:I.Client,define:At,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",inlineDynamicImports:!0},[j.SectionSetting]:{pluginType:I.Misc,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[j.SectionShowcase]:{pluginType:I.Misc,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[j.SectionAsset]:{pluginType:I.Misc,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[j.TemplateDescriptor]:{pluginType:I.Misc,ssr:!1,outDir:()=>`./${z}/js`,entryFileNames:`[name]${X}.mjs`},[j.TemplateAsset]:{pluginType:I.Misc,ssr:!1,outDir:()=>`./${z}/assets`,assetFileNames:"[name].[ext]"}};function vs(e){switch(typeof e){case"string":return[C(process.cwd(),e)];case"object":return e.map(t=>C(process.cwd(),t));default:return[]}}function $s(e,t){const{externalOption:s}=_[e];return t?.externalizeVue&&e===j.Server?[...s??[],...ws]:s}function St(e,t,s,r,n){const o=_[s].define,i=_[s].ssrOptions,c=_[s].entryFileNames,a=_[s].chunkFileNames,p=_[s].assetFileNames,u=_[s].inlineDynamicImports,l=$s(s,n);return{plugins:Es[_[s].pluginType],...o!=null&&{define:o},...i!=null&&{ssr:i},resolve:{alias:{"@":"/src"}},build:{ssr:_[s].ssr,outDir:_[s].outDir(e,r),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...l!=null&&{external:l},preserveEntrySignatures:"strict",input:vs(t),output:{validate:!0,inlineDynamicImports:u,...c!=null&&{entryFileNames:c},...a!=null&&{chunkFileNames:a},...p!=null&&{assetFileNames:p}}}}}}const Nt="https://json-schema.org/draft/2020-12/schema",kt="https://lightspeedhq.com/template.schema.json",xt="Custom Template",It="A custom template enclosing the necessary custom and default blocks",Ft="object",Lt={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)company\\.site($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},_t=["metadata","sections"],Ts={$schema:Nt,$id:kt,title:xt,description:It,type:Ft,properties:Lt,required:_t},Rt={__proto__:null,$id:kt,$schema:Nt,default:Ts,description:It,properties:Lt,required:_t,title:xt,type:Ft},Mt="https://json-schema.org/draft/2020-12/schema",Dt="https://lightspeedhq.com/template-default.schema.json",Gt="Default Section",Bt="Default section for a Custom Template",Pt="object",Ut={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"}},required:["type","id"],additionalProperties:!1}},js={$schema:Mt,$id:Dt,title:Gt,description:Bt,type:Pt,$defs:Ut},As={__proto__:null,$defs:Ut,$id:Dt,$schema:Mt,default:js,description:Bt,title:Gt,type:Pt},Xt="https://json-schema.org/draft/2020-12/schema",zt="https://lightspeedhq.com/template-custom.schema.json",qt="Custom Section",Kt="Custom section for a Custom Template",Ht="object",Vt={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{type:"object",description:"Overrides for the showcase",properties:{content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}}]}},minProperties:1},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",type:"string"}},required:["content","design"]}},required:["type","id"],additionalProperties:!1}},Ss={$schema:Xt,$id:zt,title:qt,description:Kt,type:Ht,$defs:Vt},Ns={__proto__:null,$defs:Vt,$id:zt,$schema:Xt,default:Ss,description:Kt,title:qt,type:Ht},Jt="https://json-schema.org/draft/2020-12/schema",Wt="https://lightspeedhq.com/template-custom-content.schema.json",Yt="Custom Section :: Content Configuration",Zt="Content tab configuration of a Custom Section for a Custom Template",Qt="object",en={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","MENU","NAVIGATION_MENU","LOGO"]},text:{type:"string"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","MENU","NAVIGATION_MENU","LOGO"]},text:{type:"string"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","MENU","NAVIGATION_MENU","LOGO"]},title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","MENU","NAVIGATION_MENU","LOGO"]},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","MENU","NAVIGATION_MENU","LOGO"]},enabled:{type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","MENU","NAVIGATION_MENU","LOGO"]},value:{type:"string"}},required:["type"],additionalProperties:!1},logo:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","LOGO"]},logoType:{description:"Type of the logo content",type:"string",enum:["TEXT","IMAGE"]},text:{description:"Logo content text",type:"string"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","MENU","NAVIGATION_MENU","LOGO"]}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK","LOGO"]},cards:{description:"Cards of the content configuration element",type:"array",items:{type:"object",required:["settings"]},properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}}}}}},ks={$schema:Jt,$id:Wt,title:Yt,description:Zt,type:Qt,$defs:en},xs={__proto__:null,$defs:en,$id:Wt,$schema:Jt,default:ks,description:Zt,title:Yt,type:Qt},tn="https://json-schema.org/draft/2020-12/schema",nn="https://lightspeedhq.com/template-custom-design.schema.json",sn="Custom Section :: Design Configuration",on="Design tab configuration of a Custom Section for a Custom Template",rn="object",an={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]},font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]},style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string"}}}},logo:{type:"object",properties:{type:{description:"Type of the logo",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]},font:{description:"Default font for the text logo",type:"string"},size:{description:"Default size for the text logo",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text logo",type:"boolean"},italic:{description:"Default italic style for the text logo",type:"boolean"},color:{description:"Default color for the text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the logo",type:"boolean"},spacing:{description:"Default spacing size for the text logo",type:"integer",minimum:1,exclusiveMaximum:10},capitalization:{description:"Default capitalization style for the text logo",type:"string",enum:["none","all","small"]},frame:{description:"Default frame for the text logo",type:"object",properties:{visible:{description:"Default visibility for the frame on text logo",type:"boolean"},width:{description:"Default width size for the frame on text logo",type:"integer",minimum:1,exclusiveMaximum:50},color:{description:"Default color for the frame on text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},required:["visible","width","color"],additionalProperties:!1}},additionalProperties:!1}},Is={$schema:tn,$id:nn,title:sn,description:on,type:rn,$defs:an},Fs={__proto__:null,$defs:an,$id:nn,$schema:tn,default:Is,description:on,title:sn,type:rn};function Ls(e){return Object.entries(v).find(t=>t[1].source===e)?.[0]}async function _s(){const e=await T("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const s=Nn(t).split(kn),r=s.pop()??"default",n=s.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const o=await T(`**/${r}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await T(`**/${r}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await T(`**/${r}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await T(`**/${r}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),p=await T(`**/${r}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await T(`**/${r}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${r}/showcases/translations.{js,ts}`]}),l=await T(`**/${r}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await T(`**/${r}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:r,type:Ls(n),serverEntrypoint:t,clientEntrypoint:o.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:a.at(0),settingsTranslationsEntrypoint:p.at(0),showcasesEntrypoints:u,showcasesTranslationsEntrypoint:l.at(0),assetsEntrypoints:f}}))}async function Rs(){const e=await T("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await T("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{templates:e,assets:t}}async function _e(e,t){try{const s=C(Ue.cwd(),t?`${e}${X}.mjs`:`${e}.mjs`);return(await import(P(s).href)).default}catch{throw new Error(`File [${e}${X}.mjs] is either invalid or undefined`)}}async function Ms(){let e=new _n({allErrors:!0,schemas:[Rt,As,Ns,xs,Fs]});return Rn(e),e.compile(Rt)}async function Ds(e,t,s,r){if(e(t)&&r===void 0)new Promise(n=>{vn(`${s}${X}.mjs`,`${s}.mjs`,function(o){o&&n(o)})});else throw new Promise(n=>{$n(`${s}${X}.mjs`,function(o){o&&n(o)})}),new Error(`Invalid file [${ne(s).name}].
|
|
14
|
-
Note: Errors regarding failingKeyword: "then" can sometimes be false negatives. Please focus on fixing other errors first!
|
|
15
|
-
Errors: ${JSON.stringify([...e.errors??[],...r??[]],null,2)}`)}async function Gs(e){const t=[];for(const s of e.sections){const r=e.sections.indexOf(s);if(r===0){const n=s.id==="header"&&s.type==="default",o=L(`${he}/${s.id}`);!n&&!o&&t.push({instancePath:`/sections/${r}/id`,message:"The first section must be a `header`"})}else if(r===e.sections.length-1){const n=s.id==="footer"&&s.type==="default",o=L(`${ye}/${s.id}`);!n&&!o&&t.push({instancePath:`/sections/${r}/id`,message:"The last section must be a `footer`"})}else if(s.type==="custom")if(!L(`${S}/${s.id}`))t.push({instancePath:`/sections/${r}/id`,message:"Custom section must have a corresponding block defined"});else{if(s.content!==void 0)if(!L(`${S}/${s.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${r}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const n=await _e(`${S}/${s.id}/js/settings/content`,!1),o=new Set(Object.keys(n));Object.keys(s.content).every(i=>o.has(i))||t.push({instancePath:`/sections/${r}/content`,message:"Content descriptor must be a subset of the default content descriptor"})}if(s.design!==void 0)if(!L(`${S}/${s.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${r}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const n=await _e(`${S}/${s.id}/js/settings/design`,!1),o=new Set(Object.keys(n));Object.keys(s.design).every(i=>o.has(i))||t.push({instancePath:`/sections/${r}/design`,message:"Design descriptor must be a subset of the default design descriptor"})}s.showcase_id!==void 0&&(L(`${S}/${s.id}/js/showcases/${s.showcase_id}.mjs`)||t.push({instancePath:`/sections/${r}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified"}))}}return t.length===0?void 0:t}function Bs(e){const t=e.reduce((s,r)=>{const n=Tn(r);return n.size>et&&(s[r]=Qe(n.size)),s},{});if(Object.keys(t).length!==0){const s=Math.max(...Object.keys(t).map(r=>r.length));b.error(`Size of individual assets must not exceed threshold [${Qe(et)}]!`);for(let r in t)b.error(`File: ${r}`.padEnd(s+10)+`| ${t[r]}`);throw new Error("Invalid asset file size")}}function Ps(){return jn.rm("dist",{recursive:!0,force:!0})}async function Us(e){async function t(s,r,n,o="SECTION"){r.length!==0&&await qe({configFile:!1,...Ke(St(s,r,n,o,e))})}try{const[s,r]=await Promise.all([_s(),Rs(),Ps()]),n=s.map(o=>({name:o.name,type:o.type,serverEntrypoint:o.serverEntrypoint,clientEntrypoint:[o.clientEntrypoint].filter(ge).flat(),settingsEntryPoints:[o.contentSettingsEntrypoint,o.designSettingsEntrypoint,o.layoutSettingsEntrypoint,o.settingsTranslationsEntrypoint].filter(ge),showcaseEntryPoints:[...o.showcasesEntrypoints??[],o.showcasesTranslationsEntrypoint].filter(ge),assetsEntrypoints:o.assetsEntrypoints??[]}));for(const o of n)Bs(o.assetsEntrypoints),await Promise.all([qe({configFile:!1,...Ke(St(o.name,o.serverEntrypoint,j.Server,o.type,e))}),t(o.name,o.clientEntrypoint,j.Client,o.type),t(o.name,o.settingsEntryPoints,j.SectionSetting,o.type),t(o.name,o.showcaseEntryPoints,j.SectionShowcase,o.type),t(o.name,o.assetsEntrypoints,j.SectionAsset,o.type)]);if(r.templates.length!==0){const[o]=await Promise.all([Ms(),t(void 0,r.assets,j.TemplateAsset),t(void 0,r.templates,j.TemplateDescriptor)]);for(const i of r.templates){const c=`${z}/js/${ne(i).name}`,a=await _e(c,!0);await Ds(o,a,c,await Gs(a))}}b.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy")}catch(s){b.error(`Error while building: ${s.message}`),Ue.exit(1)}}function Re(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function F(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Bn(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function cn(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}const Xs={COLOR:"COLOR",GRADIENT:"GRADIENT"};function zs(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Xs)}`)}}function qs(e){const t=e.style,s=e.color,r=Array.isArray(s)?s:[s,s];return e.background={type:zs(t),solid:{color:F(r.at(0))},gradient:{fromColor:F(r.at(0)),toColor:F(r.at(1))}},e.style=void 0,e.color=void 0,e}const Ks={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function Hs(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(Ks)}`)}}const Vs={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function Js(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(Vs)}`)}}const Ws={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Ys(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(Ws)}`)}}function Zs(e){const t=e.appearance;t!==void 0&&(e.appearance=Hs(t));const s=e.size;s!==void 0&&(e.size=Js(s));const r=e.shape;r!==void 0&&(e.style=Ys(r),e.shape=void 0);const n=e.font;e.font=Re(n);const o=e.color;return e.color=F(o),e}const Qs={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function eo(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(Qs)}`)}}function to(e){const t=e.overlay,s=e.color,r=Array.isArray(s)?s:[s,s];return e.overlay={type:eo(t),solid:{color:F(r.at(0))},gradient:{fromColor:F(r.at(0)),toColor:F(r.at(1))}},e.color=void 0,e}function no(e){const t=e.font;e.font=Re(t);const s=e.color;e.color=F(s);const r=e.size;return e.size=cn(r),e}function so(e){const t=e.color;return e.color=F(t),e}function oo(e){const t=e.font;e.font=Re(t);const s=e.color;e.color=F(s);const r=e.size;if(e.size=cn(r),e.frame!==void 0){const n=e.frame.color;e.frame.color=F(n)}return e}function Me(e,t){switch(e){case"TEXT":{no(t);break}case"BUTTON":{Zs(t);break}case"IMAGE":{to(t);break}case"BACKGROUND":{qs(t);break}case"COLOR_PICKER":{so(t);break}case"LOGO":{oo(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function ro(e){Object.keys(e).forEach(t=>{const s=e[t],r=s.type;Me(r,s.defaults)})}function io(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(Me(t.type,t.defaults),t.defaults.type=t.type)})}function ln(e){Object.keys(e).forEach(t=>{const s=e[t],r=s.type;Me(r,s)})}const ao=200;var N=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientAsset=2]="ClientAsset",e[e.Asset=3]="Asset",e[e.TemplateAsset=4]="TemplateAsset",e[e.Dependency=5]="Dependency",e))(N||{});const K={[N.Server]:{type:"server_js_compressed",isSingleton:!0,toPath:(e,t)=>`${v[t].dist}/${e}/js/main/server/`,fileName:"server.js.gz"},[N.Client]:{type:"client_js",isSingleton:!1,toPath:(e,t)=>`${v[t].dist}/${e}/js/main/client/`,fileName:"client.js"},[N.ClientAsset]:{type:"assets",isSingleton:!1,toPath:(e,t)=>`${v[t].dist}/${e}/js/main/client/assets/`,fileName:"*"},[N.Asset]:{type:"assets",isSingleton:!1,toPath:(e,t)=>`${v[t].dist}/${e}/assets/`,fileName:"*"},[N.TemplateAsset]:{type:"template_assets",isSingleton:!1,toPath:()=>`${z}/assets/`,fileName:"*"},[N.Dependency]:{type:"dependencies",isSingleton:!0,toPath:()=>{},fileName:"package.json"}},co="https://blockbuster.ecwid.com",lo="/api/v1/custom-apps/resources/sections/upload",po="/api/v1/custom-apps/resources/templates/upload",uo="/api/v1/custom-apps/manifests/sections",fo="/api/v1/custom-apps/manifests/templates",mo=5,ho=3;async function yo(){const e=await We(C(E.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function go(){const e=C(E.cwd(),"package.json"),t=await We(e),s=JSON.parse(t.toString());if(bo(s))return s;throw new Error(`Package file located at path: ${e} does not contain a version field`)}function bo(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Eo(e){const t=Dn(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,An(C(E.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
16
|
-
`)}async function Co(e,t,s=S){try{const r=C(E.cwd(),`${s}/${e}/js/settings/content.mjs`),n=(await import(P(r).href)).default;return W(n,t),n}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Oo(e,t,s=S){try{const r=C(E.cwd(),`${s}/${e}/js/settings/design.mjs`),n=(await import(P(r).href)).default;return ro(n),W(n,t),n}catch(r){const n=r;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function wo(e,t,s=S){try{const r=await T("*.mjs",{cwd:C(E.cwd(),`${s}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(r.map(async n=>{const o=C(E.cwd(),`${s}/${e}/js/showcases/${n}`),i=(await import(P(o).href)).default;return ln(i.design),W(i,t),i}))}catch(r){throw new Error(`Showcases is invalid or undefined. Error ${r}`)}}async function vo(e,t=S){try{const s=C(E.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!L(s))return[];const r=(await import(P(s).href)).default;return r.forEach(n=>io(n.selectedDesignSettings)),r}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function $o(e,t=S){return await un(`${t}/${e}/js/settings/translations.mjs`)}async function pn(e,t=S){return await un(`${t}/${e}/js/showcases/translations.mjs`)}async function un(e){const t=C(E.cwd(),e),s=(await import(P(t).href)).default;return jo(s)}function W(e,t){if(e&&typeof e=="object"){const s=e;for(const r in s){const n=s[r];typeof n=="string"&&n.startsWith("$")&&(s[r]=To(t,n)),typeof n=="object"&&W(n,t)}}}function To(e,t){if(!t)return;const s=e[t];return s===void 0?{en:t}:s}function jo(e){const t={};for(const s in e){const r=e[s];for(const n in r){const o=t[n],i=r[n];if(o===void 0){const c={};c[s]=i,t[n]=c}else o[s]=i}}return t}async function De(e,t){const s=await $o(e,v[t].dist),r=await pn(e,v[t].dist),n=await Co(e,s,v[t].dist),o=await Oo(e,s,v[t].dist),i=await wo(e,r,v[t].dist),c=await vo(e,v[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:o,layouts:c,showcases:i}}async function Ao(){const e=await T("*/",{cwd:C(E.cwd(),`${S}/`)}),t=await T("*/",{cwd:C(E.cwd(),`${he}/`)}),s=await T("*/",{cwd:C(E.cwd(),`${ye}/`)});return Promise.all([...e.map(async r=>De(r,"SECTION")),...t.map(async r=>De(r,"HEADER")),...s.map(async r=>De(r,"FOOTER"))])}async function So(e){try{return(await import(P(C(E.cwd(),e)).href)).default}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function No(){const e=await T(`${z}/js/**.mjs`,{ignore:[`${z}/js/**${X}.mjs`]});return Promise.all(e.map(async t=>{const s=await So(t),r=s.sections.filter(n=>n.type==="custom");for(const n of r){const o=Cs(n.id),i=await pn(n.id,v[o].dist);n.showcase_overrides!==void 0&&(W(n.showcase_overrides,i),ln(n.showcase_overrides.design))}return{id:`${ne(E.cwd()).name.replace(/[^a-zA-Z0-9]/g,"_")}_${ne(t).name}`,descriptor:s}}))}function ko(e,t){const s=e.pathContext,r=s.toPath(e.currentSection,t),n=r===void 0?Xe(s.fileName):Xe(s.fileName,{cwd:C(E.cwd(),r),ignore:s.ignore});return s.isSingleton?n.splice(0):n}function xo(e){return e instanceof Ye&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function fn(e,t){return e<ho&&xo(t)}async function dn(e){await new Promise(t=>{setTimeout(t,2**e*500)})}function mn(e,t,s,r){const n=e.config.app.templates.length>0?po:lo;return e.config.axios.post(n,{file:Sn(C(E.cwd(),s!==void 0?s+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.pathContext.type!=="dependencies"&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`}}).then(o=>({status:o.status})).catch(async o=>fn(r,o)?(await dn(r),mn(e,t,s,r+1)):{status:o.response?.status,message:o.message})}function H(e,t="SECTION"){const s=ko(e,t),r=e.pathContext.toPath(e.currentSection,t);return s.map(n=>mn(e,n,r,0))}function Io(e){return[...e.app.sections.flatMap(t=>[...H({config:e,currentSection:t.id,pathContext:K[N.Server]},t.type),...H({config:e,currentSection:t.id,pathContext:K[N.Client]},t.type),...H({config:e,currentSection:t.id,pathContext:K[N.ClientAsset]},t.type),...H({config:e,currentSection:t.id,pathContext:K[N.Asset]},t.type)]),...H({config:e,pathContext:K[N.Dependency]}),...H({config:e,pathContext:K[N.TemplateAsset]})]}function Fo(e){return e.includes(`
|
|
17
|
-
`)}function Lo(e,t,s){return e.split(`
|
|
18
|
-
`).map((r,n)=>n>=s?t+r:r).join(`
|
|
19
|
-
`)}function hn(e,t){const s=[];if(e instanceof Ye){e.response?.status!==void 0&&s.push(` HTTP Status Code: ${e.response.status}`);const o=e.response?.data;if(o?.errorCode&&s.push(` Error Code: ${o.errorCode}`),o?.errorMessage){const i=Fo(o.errorMessage)?Lo(o.errorMessage," ",1):o.errorMessage;s.push(` Error Message: ${i}`)}}const r=s.length>0?s.join(`
|
|
20
|
-
`):e?.message??"Unknown error";if(!t||t.length===0)return r;const n=s.length>0?`
|
|
21
|
-
`:" ";return`${t}${n}${r}`}async function yn(e,t=0){const s=e.app.templates.length>0?fo:uo;return e.axios.post(s,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,compressionEnabled:!0},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async r=>{if(fn(t,r))return await dn(t),yn(e,t+1);throw r})}async function _o(e){try{L(C(E.cwd(),S))||(b.error(`Distribution folder [${S}] not found, please execute the build command first.`),E.exit(1));const t=e??co;b.info("Custom application deployment :: Started");const s=Mn.create({baseURL:t});Gn(s,mo),b.info("Loading configuration files ...");const r=await Promise.all([yo(),go(),Ao(),No()]).then(([c,a,p,u])=>({axios:s,app:{crane:c,packageJson:a,sections:p,templates:u}}));b.info("Uploading asset files ...");let n=tt();const o=await Promise.all(Io(r)).finally(()=>{be(n)});o.every(c=>c.status===ao)||(o.map(c=>c.message).filter((c,a,p)=>p.indexOf(c)===a).forEach(c=>b.error(`Error while uploading asset files: ${c}`)),E.exit(1)),b.info("Uploading manifest files ..."),n=tt(),await yn(r).catch(c=>{be(n),b.error(hn(c,"Error while deploying manifest file:")),E.exit(1)}).finally(()=>{be(n)});const i=r.app.sections.map(c=>c.id);b.info(`Custom application deployment :: Successful
|
|
22
|
-
Current app version: ${r.app.packageJson.version}
|
|
23
|
-
Deployed sections: ${i.join(", ")}`),await Eo(r.app.packageJson),r.app.templates.length>0&&b.info(`Deployed templates: ${r.app.templates.map(c=>c.id).join(", ")}`)}catch(t){b.error(hn(t,"Error while deploying:")),E.exit(1)}}const Ro="1.1.2",O=En("crane");async function Ge(e,t,s,r){const n=`You can use ${t} to directly specify the name of the ${e}.`;console.log(n);const o=await Cn({type:"text",name:"name",message:`Please specify a name for your ${e}:`});return o.name?e==="template"?s(o.name,r):s(o.name):(console.log("Please provide a name for the template."),O.outputHelp())}function Be(e){return e&&(typeof e!="string"||e.trim().length===0)}function Mo(){O.command("init","Initialize a new resource in the form of a directory.").option("--app <name>","Creates an app folder inside your current directory.").option("--section <name>","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--template <name>","Creates the directory and files necessary to build a custom template inside your app folder.").option("--custom-headers-footers","Creates the directories and files necessary to build a custom header and footer inside your app folder.").action(e=>e.app?nt(e.app):e.section?st(e.section):e.template?ot(e.template,e.customHeadersFooters):O.outputHelp()),O.command("build","Builds your resource code").option("--externalize-vue","Externalize @vue core libraries to reduce the bundle size").action(Us),O.command("deploy","Deploys your resource code into Ecwid"),O.on("command:*",()=>{console.error("Invalid command: %s",O.args.join(" ")),O.outputHelp(),process.exit(1)}),O.on("command:init",()=>{const e=O.options.section,t=O.options.app,s=O.options.template,r=O.options.customHeadersFooters||!1;Be(t)?Ge("app",Z("init --app <name>"),nt):Be(e)?Ge("section",Z("init --section <name>"),st):Be(s)&&Ge("template",Z("init --template <name>"),ot,r)}),O.on("command:deploy",()=>_o(O.options.url)),O.help(),O.usage("<action> <resource>"),O.version(Ro),O.parse()}try{Mo()}catch(e){console.error(e)}
|
|
1
|
+
import io from"cac";import{red as ao,yellow as po,green as N}from"kolorist";import ne from"prompts";import b from"node:fs";import w from"node:path";import T from"node:process";import{fileURLToPath as R}from"node:url";import*as X from"fs";import D,{existsSync as O,rename as co,unlink as lo,statSync as fo,promises as uo,writeFileSync as yo,createReadStream as mo}from"fs";import*as z from"path";import S,{resolve as f,parse as x,dirname as go,sep as ho}from"path";import{glob as m,globSync as re}from"glob";import{build as ie,defineConfig as ae}from"vite";import{builtinModules as pe}from"module";import ce from"@vitejs/plugin-vue";import K from"vite-tsconfig-paths";import{viteExternalsPlugin as $o}from"vite-plugin-externals";import bo from"vite-plugin-compression";import To from"vite-plugin-checker";import Eo from"ajv/dist/2020.js";import jo from"ajv-formats";import*as l from"process";import wo from"process";import{pathToFileURL as _}from"url";import{readFile as le}from"fs/promises";import Oo,{AxiosError as de}from"axios";import{inc as So}from"semver";import{ConcurrencyManager as vo}from"axios-concurrency";import Ao from"tinycolor2";import Co from"cli-progress";function fe(e,t){X.statSync(e).isDirectory()?(X.mkdirSync(t,{recursive:!0}),X.readdirSync(e).forEach(o=>{const s=z.resolve(e,o),n=z.resolve(t,o);fe(s,n)})):X.copyFileSync(e,t)}function I(e,t,o,s){const n=z.join(e,s?.[o]??o);fe(z.join(t,o),n)}function V(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,n=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**r).toFixed(s))} ${n[r]}`}const p={error:e=>console.log(ao(e)),warn:e=>console.log(po(e)),info:e=>console.log(N(e))},L="_temp",g="dist/sections",J="dist/headers",Z="dist/footers",P="dist/templates",ue=2*1024*1024;function W(e){return!!e}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}async function Do(e){try{const t=e,o=T.cwd(),s=w.join(o,t),n=["templates","headers","footers","reference"],r={_gitignore:".gitignore"};b.existsSync(s)?(p.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(s);const i=w.resolve(R(import.meta.url),"../..","template");b.readdirSync(i).filter(c=>c!=="package.json").filter(c=>!n.includes(c)).forEach(async c=>I(s,i,c,r));const a=JSON.parse(b.readFileSync(w.join(i,"package.json"),"utf-8"));a.name=e;const y=w.join(s,"package.json");b.writeFileSync(y,`${JSON.stringify(a,null,2)}
|
|
2
|
+
`),p.info(`App ${e} created`)}catch(t){p.error(`Error while creating app: ${t.message}`),T.exit(1)}}function Y(e,t,o,s){try{const n=T.cwd(),r=S.join(n,t);D.existsSync(r)||D.mkdirSync(r);const i=S.join(n,t,o);D.existsSync(i)?(p.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):D.mkdirSync(i);const a=S.resolve(R(import.meta.url),"../..",e);D.readdirSync(a).forEach(async y=>I(i,a,y)),p.info(`${s} ${o} created`)}catch(n){p.error(`Error while creating ${s}: ${n.message}`),T.exit(1)}}function me(e){const t=T.cwd(),o=S.resolve(R(import.meta.url),"../..",`template/${e}`),s=S.join(t,e);D.existsSync(s)||(D.mkdirSync(s),D.readdirSync(o).forEach(async n=>I(s,o,n)))}async function Io(e){Y("template/sections/example-section","sections",e,"Section")}async function _o(e,t=!1){try{const o=T.cwd(),s=w.join(o,"templates"),n={"template.ts":`${e}.ts`};b.existsSync(s)?b.existsSync(w.join(s,`${e}.ts`))&&(p.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(s);const r=w.resolve(R(import.meta.url),"../..","template/templates");b.readdirSync(r).forEach(async i=>I(s,r,i,n)),t&&(me("headers"),me("footers")),p.info(`Template descriptor file [${e}.ts] has been created`)}catch(o){p.error(`Error while creating template descriptors: ${o.message}`),T.exit(1)}}async function No(){try{const e=T.cwd(),t=w.resolve(R(import.meta.url),"../../","template/reference"),o=b.readdirSync(t);let s=!1;for(const n of o){const r=w.join(t,n),i=w.join(e,n);b.existsSync(i)||b.mkdirSync(i,{recursive:!0});const a=b.readdirSync(r),y=b.readdirSync(i);if(n==="shared"){a.forEach(c=>{I(i,r,c)});continue}for(const c of a){if(c==="assets"){I(i,r,c);continue}if(y.includes(c)){const{name:A}=await ne({type:"text",name:"name",message:`The "${c}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});A?(I(i,r,c,{[c]:A}),s=!0):p.info(`Skipped: ${c}`)}else I(i,r,c)}}p.info("Reference templates have been added to the app"),s&&p.warn("Some files or folders were renamed to avoid conflicts. Temlate files may need to be updated to reflect these changes.")}catch(e){p.error(`Error while creating template descriptors: ${e.message}`),T.exit(1)}}var h=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.TemplateAsset=6]="TemplateAsset",e))(h||{}),E=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e))(E||{});const xo=()=>bo({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),ge=()=>{const e=process.env.npm_lifecycle_event;return To({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},Lo="/* EXTERNAL_IMPORTS_START */",Po="/* EXTERNAL_IMPORTS_END */",ko=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const o of Object.keys(t)){const s=t[o];if(s.type==="chunk"){const n=/import.*\?commonjs-external["'];/g,r=s.code.match(n);if(r!==null){const i=r.join(""),a=Lo+i+Po,y=s.code.replace(n,"");s.code=a+y}}}}}),Ro={[E.Server]:[ce(),K(),ko(),xo()],[E.Client]:[ce(),K(),ge(),$o({vue:"EcVue"})],[E.Misc]:[K(),ge()]};var Q=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(Q||{});const u={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function G(e){return O(`${J}/${e}`)?"HEADER":O(`${Z}/${e}`)?"FOOTER":"SECTION"}function Go(e){const t=G(e);return u[t].dist}const he={"process.env":{NODE_ENV:"production"}},Fo=[...pe,...pe.map(e=>`node:${e}`)],Bo=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],v={[h.Server]:{pluginType:E.Server,define:he,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/server`,externalOption:[...Fo,...Bo],entryFileNames:"server.js",inlineDynamicImports:!0},[h.Client]:{pluginType:E.Client,define:he,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1},[h.SectionSetting]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[h.SectionShowcase]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[h.SectionAsset]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[h.TemplateDescriptor]:{pluginType:E.Misc,ssr:!1,outDir:()=>`./${P}/js`,entryFileNames:`[name]${L}.mjs`},[h.TemplateAsset]:{pluginType:E.Misc,ssr:!1,outDir:()=>`./${P}/assets`,assetFileNames:"[name].[ext]"}};function Mo(e){switch(typeof e){case"string":return[f(process.cwd(),e)];case"object":return e.map(t=>f(process.cwd(),t));default:return[]}}function $e(e,t,o,s){const n=v[o].define,r=v[o].ssrOptions,i=v[o].entryFileNames,a=v[o].chunkFileNames,y=v[o].assetFileNames,c=v[o].inlineDynamicImports,A=v[o].externalOption;return{plugins:Ro[v[o].pluginType],...n!=null&&{define:n},...r!=null&&{ssr:r},resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:v[o].ssr,outDir:v[o].outDir(e,s),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...A!=null&&{external:A},preserveEntrySignatures:"strict",input:Mo(t),output:{validate:!0,inlineDynamicImports:c,...i!=null&&{entryFileNames:i},...a!=null&&{chunkFileNames:a},...y!=null&&{assetFileNames:y}}}}}}const be="https://json-schema.org/draft/2020-12/schema",Te="https://lightspeedhq.com/template-default.schema.json",Ee="Default Section",je="Default section for a Custom Template",we="object",Oe={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"},showcase_id:{description:"Showcase id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}},qo={$schema:be,$id:Te,title:Ee,description:je,type:we,$defs:Oe},Uo={__proto__:null,$defs:Oe,$id:Te,$schema:be,default:qo,description:je,title:Ee,type:we},Se="https://json-schema.org/draft/2020-12/schema",ve="https://lightspeedhq.com/template-custom.schema.json",Ae="Custom Section",Ce="Custom section for a Custom Template",De="object",Ie={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"custom"},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{$ref:"showcase_overrides.schema.json"}},required:["type","id"],additionalProperties:!1}},Xo={$schema:Se,$id:ve,title:Ae,description:Ce,type:De,$defs:Ie},zo={__proto__:null,$defs:Ie,$id:ve,$schema:Se,default:Xo,description:Ce,title:Ae,type:De},_e="https://json-schema.org/draft/2020-12/schema",Ne="https://lightspeedhq.com/template-custom-content.schema.json",xe="Custom Section :: Content Configuration",Le="Content tab configuration of a Custom Section for a Custom Template",Pe="object",ke={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"IMAGE"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TOGGLE"},enabled:{type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"SELECTBOX"},value:{type:"string"}},required:["type"],additionalProperties:!1},logo:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"LOGO"},logoType:{description:"Type of the logo content",type:"string",enum:["TEXT","IMAGE"]},text:{description:"Logo content text",type:"string"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"MENU"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"DECK"},cards:{type:"array",items:{type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}},required:["settings"]}}},required:["type","cards"]}},Ho={$schema:_e,$id:Ne,title:xe,description:Le,type:Pe,$defs:ke},Ko={__proto__:null,$defs:ke,$id:Ne,$schema:_e,default:Ho,description:Le,title:xe,type:Pe},Re="https://json-schema.org/draft/2020-12/schema",Ge="https://lightspeedhq.com/template-custom-design.schema.json",Fe="Custom Section :: Design Configuration",Be="Design tab configuration of a Custom Section for a Custom Template",Me="object",qe={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",const:"TEXT"},font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",const:"BUTTON"},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",const:"IMAGE"},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",const:"TOGGLE"},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",const:"SELECTBOX"},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string"}}}},logo:{type:"object",properties:{type:{description:"Type of the logo",type:"string",const:"LOGO"},font:{description:"Default font for the text logo",type:"string"},size:{description:"Default size for the text logo",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text logo",type:"boolean"},italic:{description:"Default italic style for the text logo",type:"boolean"},color:{description:"Default color for the text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the logo",type:"boolean"},spacing:{description:"Default spacing size for the text logo",type:"integer",minimum:1,exclusiveMaximum:10},capitalization:{description:"Default capitalization style for the text logo",type:"string",enum:["none","all","small"]},frame:{description:"Default frame for the text logo",type:"object",properties:{visible:{description:"Default visibility for the frame on text logo",type:"boolean"},width:{description:"Default width size for the frame on text logo",type:"integer",minimum:1,exclusiveMaximum:50},color:{description:"Default color for the frame on text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},required:["visible","width","color"],additionalProperties:!1}},additionalProperties:!1}},Vo={$schema:Re,$id:Ge,title:Fe,description:Be,type:Me,$defs:qe},Jo={__proto__:null,$defs:qe,$id:Ge,$schema:Re,default:Vo,description:Be,title:Fe,type:Me},Ue="https://json-schema.org/draft/2020-12/schema",Xe="https://lightspeedhq.com/section-content.schema.json",ze="Custom Section - Content",He="The content of a custom section",Ke="object",Ve={"^.*$":{type:"object",properties:{type:{type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","INFO","DECK","MENU","NAVIGATION_MENU","LOGO"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"#/$defs/Deck"}},{if:{properties:{type:{const:"MENU"}}},then:{$ref:"#/$defs/Menu"}},{if:{properties:{type:{const:"NAVIGATION_MENU"}}},then:{$ref:"#/$defs/NavigationMenu"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}}]}},Je={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},defaults:{$ref:"#/$defs/ImageDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},placeholder:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label","placeholder","description","options"]},Menu:{type:"object",properties:{type:{const:"MENU"},label:{type:"string"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{type:"string"},description:{type:"string"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},InputboxDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["title"]},ImageDefaults:{type:"object",properties:{imageData:{$ref:"section-commons.schema.json#/$defs/Image"}}},ToggleDefaults:{type:"object",properties:{enabled:{type:"boolean"}}},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}}},InfoDefaults:{type:"object",properties:{text:{type:"object",additionalProperties:{type:"string"}},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{type:"string"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{type:"string"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{type:"string"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{cards:{description:"Cards of the content configuration element",type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/ButtonDefaults"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}}]}},minProperties:1}}}}}},Ze=!1,Zo={$schema:Ue,$id:Xe,title:ze,description:He,type:Ke,patternProperties:Ve,$defs:Je,additionalProperties:Ze},We={__proto__:null,$defs:Je,$id:Xe,$schema:Ue,additionalProperties:Ze,default:Zo,description:He,patternProperties:Ve,title:ze,type:Ke},Ye="https://json-schema.org/draft/2020-12/schema",Qe="https://lightspeedhq.com/sections/section-translation.schema.json",et="Custom Section - Translations",tt="The translation of the section's labels",ot="object",st={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},nt=!1,Wo={$schema:Ye,$id:Qe,title:et,description:tt,type:ot,patternProperties:st,additionalProperties:nt},rt={__proto__:null,$id:Qe,$schema:Ye,additionalProperties:nt,default:Wo,description:tt,patternProperties:st,title:et,type:ot},it="https://json-schema.org/draft/2020-12/schema",at="https://lightspeedhq.com/section-design.schema.json",pt="Custom Section - Design",ct="The design of a custom section",lt="object",dt={"^.*$":{type:"object",properties:{type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO"]}},required:["type"],allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"#/$defs/Text"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"#/$defs/Background"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"COLOR"}}},then:{$ref:"#/$defs/Color"}},{if:{properties:{type:{const:"RATING"}}},then:{$ref:"#/$defs/Rating"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"SOCIAL_PROFILES"}}},then:{$ref:"#/$defs/SocialProfile"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}}]}},ft={Text:{type:"object",properties:{type:{const:"TEXT"},label:{type:"string"},sizes:{type:"array",items:{type:"integer"}},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/TextDesignDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ImageDesignDefaults"}},required:["type","label"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAutoColor:{type:["boolean","null"]},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ButtonDesignDefaults"}},required:["type","label"]},Background:{type:"object",properties:{type:{const:"BACKGROUND"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/BackgroundDesignDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{type:"string"},description:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ColorPickerDefaults"}},required:["type","label"]},Rating:{type:"object",properties:{type:{const:"RATING"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/RatingDefaults"}},required:["type","label"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SocialProfilesDefaults"}},required:["type","label"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},sizes:{type:"array",items:{type:"integer"}},defaults:{$ref:"#/$defs/LogoDesignDefaults"}},required:["type"]},TextDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{type:"integer"},{type:"string"}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{type:"string"},visible:{type:"boolean"}},required:[]},ImageDesignDefaults:{type:"object",properties:{overlay:{type:"string"},visible:{type:"boolean"}},required:[]},ButtonDesignDefaults:{type:"object",properties:{appearance:{type:"string",enum:["SOLID","OUTLINE","TEXT"]},font:{type:"string"},size:{type:"string",enum:["SMALL","MEDIUM","LARGE"]},style:{type:"string",enum:["round-corner","rectangle","pill"]},color:{type:"string"},visible:{type:"boolean"}},required:[]},BackgroundDesignDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Background"}},required:[]},ToggleDesignDefaults:{type:"object",properties:{enabled:{type:"boolean"}},required:[]},ColorPickerDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Color"}},required:[]},RatingDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},style:{type:"string"}},required:[]},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}},required:[]},SocialProfilesDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},appearance:{type:"string"}},required:[]},LogoDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{type:"integer"},{type:"string"}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{type:"string"},visible:{type:"boolean"}},required:[]},SelectboxOption:{type:"object",properties:{value:{type:"string"},label:{type:"string"}},required:[]}},Yo={$schema:it,$id:at,title:pt,description:ct,type:lt,patternProperties:dt,$defs:ft},ut={__proto__:null,$defs:ft,$id:at,$schema:it,default:Yo,description:ct,patternProperties:dt,title:pt,type:lt},yt="https://json-schema.org/draft/2020-12/schema",mt="https://lightspeedhq.com/section-commons.schema.json",gt="Custom Section - Content",ht="The content of a custom section",$t="object",bt={Image:{type:"object",properties:{set:{type:"object",additionalProperties:{$ref:"#/$defs/ImageInfo"}},borderInfo:{$ref:"#/$defs/BorderInfo"},bucket:{type:"string"}},required:["set"]},ImageInfo:{type:"object",properties:{url:{type:"string"},width:{type:"integer",minimum:0},height:{type:"integer",minimum:0}}},BorderInfo:{type:"object",properties:{homogeneity:{type:"boolean"},color:{$ref:"#/$defs/RGBA"}}},RGBA:{type:"object",properties:{r:{type:"integer",minimum:0,maximum:255},g:{type:"integer",minimum:0,maximum:255},b:{type:"integer",minimum:0,maximum:255},a:{type:"number",format:"double",minimum:0,maximum:1}},required:["r","g","b","a"]},HSL:{type:"object",properties:{h:{type:"number",format:"double"},s:{type:"number",format:"double"},l:{type:"number",format:"double"},a:{type:"number",format:"double"}},required:["h","s","l","a"]},Overlay:{type:"object",properties:{type:{type:"string",enum:["solid","gradient","none"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Solid:{type:"object",properties:{color:{$ref:"#/$defs/Color"}}},Gradient:{type:"object",properties:{fromColor:{$ref:"#/$defs/Color"},toColor:{$ref:"#/$defs/Color"}}},Background:{type:"object",properties:{type:{type:"string",enum:["solid","gradient"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Color:{type:"object",properties:{raw:{type:"string"},hex:{type:"string"},auto:{type:"boolean"},rgba:{$ref:"#/$defs/RGBA"},hsl:{$ref:"#/$defs/HSL"}}}},Tt=!1,Qo={$schema:yt,$id:mt,title:gt,description:ht,type:$t,$defs:bt,additionalProperties:Tt},es={__proto__:null,$defs:bt,$id:mt,$schema:yt,additionalProperties:Tt,default:Qo,description:ht,title:gt,type:$t},Et="https://json-schema.org/draft/2020-12/schema",jt="https://lightspeedhq.com/section-showcase.schema.json",wt="Custom Section - Showcase settings",Ot="The setting of a showcase",St="object",vt=["showcaseId","previewImage"],At={showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}},ts={$schema:Et,$id:jt,title:wt,description:Ot,type:St,required:vt,properties:At},Ct={__proto__:null,$id:jt,$schema:Et,default:ts,description:Ot,properties:At,required:vt,title:wt,type:St},Dt="https://json-schema.org/draft/2020-12/schema",It="https://lightspeedhq.com/template.schema.json",_t="Custom Template",Nt="A custom template enclosing the necessary custom and default blocks",xt="object",Lt={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)company\\.site($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},Pt=["metadata","sections"],os={$schema:Dt,$id:It,title:_t,description:Nt,type:xt,properties:Lt,required:Pt},kt={__proto__:null,$id:It,$schema:Dt,default:os,description:Nt,properties:Lt,required:Pt,title:_t,type:xt},Rt="https://json-schema.org/draft/2020-12/schema",Gt="https://lightspeedhq.com/showcase_overrides.schema.json",Ft="Showcase overrides",Bt="Overrides for the showcase",Mt="object",qt={content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK","MENU","NAVIGATION_MENU"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}}]}},minProperties:1},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",type:"string"}},ss={$schema:Rt,$id:Gt,title:Ft,description:Bt,type:Mt,properties:qt},ns={__proto__:null,$id:Gt,$schema:Rt,default:ss,description:Bt,properties:qt,title:Ft,type:Mt};var F=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(F||{});const rs={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},is={logo:{type:"LOGO",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function Ut(e){switch(e){case Q.HEADER:return rs;default:return{}}}function Xt(e){switch(e){case Q.HEADER:return is;default:return{}}}function as({validationType:e,sectionType:t}){switch(e){case F.CONTENT:return Ut(t);case F.DESIGN:return Xt(t);default:return{}}}function ps(e){return Object.keys(e).length===0}function cs({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const r=t[s];n.type!==r.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${r.type}".`})}),o}function ls({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function ds({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const r=ls({type:n.type,mandatorySettings:t});r&&s!==r&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${r}".`})}),o}function fs({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function us({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:r})=>r),n=Object.values(e).map(({type:r})=>r);return new Set(n.filter(r=>s.includes(r))).forEach(r=>{if(n.filter(i=>i===r).length>1){const i=fs({type:r,mandatorySettings:t});o.push({instancePath:i,keyword:"duplicate-type",message:`Editor type "${r}" can only be used once.`})}}),o}function ys(e,t){const{sectionSettings:o,sectionType:s}=t,n=as({validationType:e,sectionType:s});return n===void 0||ps(n)?[]:[...cs({sectionSettings:o,mandatorySettings:n}),...ds({sectionSettings:o,mandatorySettings:n}),...us({sectionSettings:o,mandatorySettings:n})]}const B=[es,ut,We,Ct,kt,Uo,zo,Ko,Jo,ns];function M(e,t){const o=new Eo({allErrors:!0,schemas:e});return jo(o),o.compile(t)}function ms(){return M(B,kt)}function zt(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const gs=e=>(()=>{const t=Go(e.name),o=t.split("/").pop()?.toLowerCase();return[{source:`./${o}/${e.name}/settings/content.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/content`),ajv:M(B,We),validationType:F.CONTENT,sectionName:e.name},{source:`./${o}/${e.name}/settings/design.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/design`),ajv:M(B,ut),validationType:F.DESIGN,sectionName:e.name},{source:`./${o}/${e.name}/settings/translations.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/translations`),ajv:M(B,rt)},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${x(s).name}.ts`,dist:S.resolve(`${t}/${e.name}/js/showcases/${x(s).name}`),ajv:M(B,s.indexOf("translations")===-1?Ct:rt)}))]})();function hs(e){const t=n=>{const r=(n??"").split("/").filter(i=>i.length>0);return r.length===0?"$":`$${r.map(i=>`.${i}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const r=e[n];o=Math.max(o,Math.max(...r.map(i=>t(i.instancePath).length))),s=Math.max(s,Math.max(...r.map(i=>i.message.length)))}),Object.keys(e).forEach(n=>{const r=e[n].filter((i,a,y)=>a===y.findIndex(c=>`${i.instancePath}${i.message}${i.keyword}`==`${c.instancePath}${c.message}${c.keyword}`));p.error(n),r.filter(i=>i.keyword!=="if").forEach(i=>{p.error(`${t(i.instancePath).padEnd(o," ")} | ${i.message.padEnd(s," ")} | ${i.keyword||"-"}`)})})}async function H(e,t){try{const o=f(wo.cwd(),t?`${e}${L}.mjs`:`${e}.mjs`);return(await import(_(o).href)).default}catch{throw new Error(`File [${e}${L}.mjs] is either invalid or undefined`)}}function $s(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=G(o);return[...ys(s,{sectionSettings:t,sectionType:n})]}async function bs(e){const t=await H(e.dist,!1),o={},s=[];e.ajv(t)||s.push(...zt(e.ajv.errors??[]));const n=$s(e,t);return n.length>0&&s.push(...n),s.length>0&&(o[e.source]=s),o}function Ts(e){const t=e.reduce((o,s)=>{const n=fo(s);return n.size>ue&&(o[s]=V(n.size)),o},{});if(Object.keys(t).length!==0){const o=Math.max(...Object.keys(t).map(s=>s.length));p.error(`Size of individual assets must not exceed threshold [${V(ue)}]!`);for(const s in t)p.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Es(e,t,o,s){const n={};return e(t)&&s===void 0?co(`${o}${L}.mjs`,`${o}.mjs`,()=>{}):(lo(`${o}${L}.mjs`,()=>{}),n[S.resolve(`./templates/${x(o).name}.ts`)]=[...zt(e.errors??[]),...s??[]]),n}async function js(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0){const n=o.id==="header"&&o.type==="default",r=O(`${J}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a `header`",keyword:"required"})}else if(s===e.sections.length-1){const n=o.id==="footer"&&o.type==="default",r=O(`${Z}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a `footer`",keyword:"required"})}else if(o.type==="custom")if(!O(`${g}/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"});else{if(o.content!==void 0)if(!O(`${g}/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${g}/${o.id}/js/settings/content`,!1),r=new Set(Object.keys(n));Object.keys(o.content).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}if(o.design!==void 0)if(!O(`${g}/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${g}/${o.id}/js/settings/design`,!1),r=new Set(Object.keys(n));Object.keys(o.design).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}o.showcase_id!==void 0&&(O(`${g}/${o.id}/js/showcases/${o.showcase_id}.mjs`)||t.push({instancePath:`/sections/${s}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}}return t.length===0?void 0:t}function ws(e){return Object.entries(u).find(t=>t[1].source===e)?.[0]}async function Os(){const e=await m("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const o=go(t).split(ho),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const r=await m(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await m(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await m(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await m(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await m(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),A=await m(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),no=await m(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),ro=await m(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:ws(n),serverEntrypoint:t,clientEntrypoint:r.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:a.at(0),layoutSettingsEntrypoint:y.at(0),settingsTranslationsEntrypoint:c.at(0),showcasesEntrypoints:A,showcasesTranslationsEntrypoint:no.at(0),assetsEntrypoints:ro}}))}async function Ss(){const e=await m("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await m("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{templates:e,assets:t}}async function k(e,t,o,s="SECTION"){t.length!==0&&await ie({configFile:!1,...ae($e(e,t,o,s))})}function vs(){return uo.rm("dist",{recursive:!0,force:!0})}async function As(e){return Ts(e.assetEntryPoints),await ie({configFile:!1,...ae($e(e.name,e.serverEntrypoint,h.Server,e.type))}),await k(e.name,e.clientEntrypoint,h.Client,e.type),await k(e.name,e.settingsEntryPoints,h.SectionSetting,e.type),await k(e.name,e.showcaseEntryPoints,h.SectionShowcase,e.type),await k(e.name,e.assetEntryPoints,h.SectionAsset,e.type),await gs(e).reduce(async(t,o)=>{const s=await t,n=await bs(o);return{...s,...n}},Promise.resolve({}))}async function Cs(e){return e.reduce(async(t,o)=>{const s=await t,n=await As(o);return{...s,...n}},Promise.resolve({}))}async function Ds(){const e=await Ss();if(e.templates.length===0)return{};const t=await ms();return await k(void 0,e.assets,h.TemplateAsset),await k(void 0,e.templates,h.TemplateDescriptor),e.templates.reduce(async(o,s)=>{const n=await o,r=`${P}/js/${x(s).name}`,i=await H(r,!0);return{...n,...Es(t,i,r,await js(i))}},Promise.resolve({}))}async function Is(){await vs();try{const e=await Os().then(o=>o.map(s=>({name:s.name,type:s.type,serverEntrypoint:s.serverEntrypoint,clientEntrypoint:[s.clientEntrypoint].filter(W).flat(),settingsEntryPoints:[s.contentSettingsEntrypoint,s.designSettingsEntrypoint,s.layoutSettingsEntrypoint,s.settingsTranslationsEntrypoint].filter(W),showcaseEntryPoints:[...s.showcasesEntrypoints??[],s.showcasesTranslationsEntrypoint].filter(W),assetEntryPoints:s.assetsEntrypoints??[]}))),t={...await Cs(e),...await Ds()};Object.keys(t).length===0?p.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy"):(p.error("Error during build:"),hs(t))}catch(e){p.error(`Error while building: ${e.message}`),process.exit(1)}}function ee(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],r=t[s];return ye(n)&&ye(r)?o[s]=ee(n,r):o[s]=n,o},{...t})}function _s({contentSettings:e,sectionType:t}){const o=Ut(t);return ee(e,o)}function Ns({designSettings:e,sectionType:t}){const o=Xt(t);return ee(e,o)}function te(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function j(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Ao(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Ht(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}const xs={COLOR:"COLOR",GRADIENT:"GRADIENT"};function Ls(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(xs)}`)}}function Ps(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:Ls(t),solid:{color:j(s.at(0))},gradient:{fromColor:j(s.at(0)),toColor:j(s.at(1))}},e.style=void 0,e.color=void 0,e}const ks={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function Rs(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(ks)}`)}}const Gs={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function Fs(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(Gs)}`)}}const Bs={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Ms(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(Bs)}`)}}function qs(e){const t=e.appearance;t!==void 0&&(e.appearance=Rs(t));const o=e.size;o!==void 0&&(e.size=Fs(o));const s=e.shape;s!==void 0&&(e.style=Ms(s),e.shape=void 0);const n=e.font;e.font=te(n);const r=e.color;return e.color=j(r),e}const Us={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function Xs(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(Us)}`)}}function zs(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:Xs(t),solid:{color:j(s.at(0))},gradient:{fromColor:j(s.at(0)),toColor:j(s.at(1))}},e.color=void 0,e}function Hs(e){const t=e.font;e.font=te(t);const o=e.color;e.color=j(o);const s=e.size;return e.size=Ht(s),e}function Ks(e){const t=e.color;return e.color=j(t),e}function Vs(e){const t=e.font;e.font=te(t);const o=e.color;e.color=j(o);const s=e.size;if(e.size=Ht(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=j(n)}return e}function oe(e,t){switch(e){case"TEXT":{Hs(t);break}case"BUTTON":{qs(t);break}case"IMAGE":{zs(t);break}case"BACKGROUND":{Ps(t);break}case"COLOR_PICKER":{Ks(t);break}case"LOGO":{Vs(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function Js(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;oe(s,o.defaults)})}function Zs(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(oe(t.type,t.defaults),t.defaults.type=t.type)})}function Kt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;oe(s,o)})}const Ws=200;var $=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e))($||{});const Vt={[$.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/server/`},[$.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/`},[$.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/chunks/`,fileName:"*"},[$.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/assets/`},[$.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/assets/`},[$.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${P}/assets/`},[$.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}}},Ys=e=>`\x1B[32m${e}\x1B[0m`,Qs=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:r}=e,i=(Date.now()-n)/1e3;o.value+=r-s.value,s.value=r,t.update({speed:`${V(o.value/i,2)}/s`})},en=()=>new Co.SingleBar({format:`|${Ys("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}),tn="https://blockbuster.ecwid.com",on="/api/v1/custom-apps/resources/sections/upload",sn="/api/v1/custom-apps/resources/templates/upload",nn="/api/v1/custom-apps/manifests/sections",rn="/api/v1/custom-apps/manifests/templates",an=5,pn=3,cn=[$.Server,$.Client,$.ClientChunks,$.ClientAsset,$.Asset],ln=[$.Dependency,$.TemplateAsset],dn={value:0},C=en();let Jt=Date.now();async function fn(){const e=await le(f(l.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function un(){const e=f(l.cwd(),"package.json"),t=await le(e),o=JSON.parse(t.toString());if(yn(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}function yn(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function mn(e){const t=So(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,yo(f(l.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
3
|
+
`)}async function gn(e,t,o=g){try{const s=f(l.cwd(),`${o}/${e}/js/settings/content.mjs`),n=(await import(_(s).href)).default,r=G(e),i=_s({contentSettings:n,sectionType:r});return q(i,t),i}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function hn(e,t,o=g){try{const s=f(l.cwd(),`${o}/${e}/js/settings/design.mjs`),n=(await import(_(s).href)).default,r=G(e),i=Ns({designSettings:n,sectionType:r});return Js(i),q(i,t),i}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function $n(e,t,o=g){try{const s=await m("*.mjs",{cwd:f(l.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const r=f(l.cwd(),`${o}/${e}/js/showcases/${n}`),i=(await import(_(r).href)).default;return Kt(i.design),q(i,t),i}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function bn(e,t=g){try{const o=f(l.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!O(o))return[];const s=(await import(_(o).href)).default;return s.forEach(n=>Zs(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function Tn(e,t=g){return await Wt(`${t}/${e}/js/settings/translations.mjs`)}async function Zt(e,t=g){return await Wt(`${t}/${e}/js/showcases/translations.mjs`)}async function Wt(e){const t=f(l.cwd(),e),o=(await import(_(t).href)).default;return jn(o)}function q(e,t){if(e&&typeof e=="object"){const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&(o[s]=En(t,n)),typeof n=="object"&&q(n,t)}}}function En(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function jn(e){const t={};for(const o in e){const s=e[o];for(const n in s){const r=t[n],i=s[n];if(r===void 0){const a={};a[o]=i,t[n]=a}else r[o]=i}}return t}async function se(e,t){const o=await Tn(e,u[t].dist),s=await Zt(e,u[t].dist),n=await gn(e,o,u[t].dist),r=await hn(e,o,u[t].dist),i=await $n(e,s,u[t].dist),a=await bn(e,u[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:r,layouts:a,showcases:i}}async function wn(){const e=await m("*/",{cwd:f(l.cwd(),`${g}/`)}),t=await m("*/",{cwd:f(l.cwd(),`${J}/`)}),o=await m("*/",{cwd:f(l.cwd(),`${Z}/`)});return Promise.all([...e.map(async s=>se(s,"SECTION")),...t.map(async s=>se(s,"HEADER")),...o.map(async s=>se(s,"FOOTER"))])}async function On(e){try{return(await import(_(f(l.cwd(),e)).href)).default}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function Sn(){const e=await m(`${P}/js/**.mjs`,{ignore:[`${P}/js/**${L}.mjs`]});return Promise.all(e.map(async t=>{const o=await On(t),s=o.sections.filter(n=>n.type==="custom");for(const n of s){const r=G(n.id),i=await Zt(n.id,u[r].dist);n.showcase_overrides!==void 0&&(q(n.showcase_overrides,i),Kt(n.showcase_overrides.design))}return{id:`${x(l.cwd()).name.replace(/[^a-zA-Z0-9]/g,"_")}_${x(t).name}`,descriptor:o}}))}function Yt(e,t,o){const s=e.pathContext,n=s.toPath(e.currentSection,o),r=n===void 0?re(s.fileName):re(s.fileName,{cwd:f(l.cwd(),n),ignore:s.ignore});return(s.isSingleton?r.splice(0):r).map(i=>({url:i,subType:o,context:e}))}function Qt(e,t,o,s){const n={value:0},r=e.config.app.templates.length>0?sn:on;return e.config.axios.post(r,{file:mo(f(l.cwd(),o!==void 0?o+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.pathContext.type!=="dependencies"&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:i=>Qs(i,C,dn,n,Jt)}).then(i=>(C.increment(),{status:i.status})).catch(async i=>eo(s,i)?(await to(s),Qt(e,t,o,s+1)):(C.increment(),{status:i.response?.status,message:i.message}))}function vn(e){return C.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath(o.currentSection,t.subType);return Qt(o,t.url,s,0)})}function An(e){const t=e.app.sections.flatMap(s=>cn.flatMap(n=>{const r={config:e,currentSection:s.id,pathContext:Vt[n]};return Yt(r,n,s.type)})),o=ln.flatMap(s=>Yt({config:e,pathContext:Vt[s]},s,"SECTION"));return vn([...t,...o])}function Cn(e){return e instanceof de&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function eo(e,t){return e<pn&&Cn(t)}async function to(e){await new Promise(t=>{setTimeout(t,2**e*500)})}function Dn(e){return e.includes(`
|
|
4
|
+
`)}function In(e,t,o){return e.split(`
|
|
5
|
+
`).map((s,n)=>n>=o?t+s:s).join(`
|
|
6
|
+
`)}function oo(e,t){const o=[];if(e instanceof de){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const r=e.response?.data;if(r?.errorCode&&o.push(` Error Code: ${r.errorCode}`),r?.errorMessage){const i=Dn(r.errorMessage)?In(r.errorMessage," ",1):r.errorMessage;o.push(` Error Message: ${i}`)}}const s=o.length>0?o.join(`
|
|
7
|
+
`):e?.message??"Unknown error";if(!t||t.length===0)return s;const n=o.length>0?`
|
|
8
|
+
`:" ";return`${t}${n}${s}`}async function so(e,t=0){const o=e.app.templates.length>0?rn:nn;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:e.app.packageJson.dependencies.vue},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async s=>{if(eo(t,s))return await to(t),so(e,t+1);throw s})}async function _n(e){try{O(f(l.cwd(),g))||(p.error(`Distribution folder [${g}] not found, please execute the build command first.`),l.exit(1));const t=e??tn;p.info("Custom application deployment :: Started");const o=Oo.create({baseURL:t});vo(o,an),p.info("Loading configuration files ...");const s=await Promise.all([fn(),un(),wn(),Sn()]).then(([a,y,c,A])=>({axios:o,app:{crane:a,packageJson:y,sections:c,templates:A}}));p.info("Uploading files ..."),Jt=Date.now();const n=await Promise.all(An(s));n.every(a=>a.status===Ws)||(C.stop(),n.map(a=>a.message).filter((a,y,c)=>c.indexOf(a)===y).forEach(a=>p.error(`Error while uploading asset files: ${a}`)),l.exit(1)),C.update({speed:"N/A",status:"Finalising deployment"}),await so(s).catch(a=>{C.stop(),p.error(oo(a,"Error while deploying manifest file:")),l.exit(1)}).finally(()=>{C.increment(),C.stop()});const r=s.app.sections.map(a=>a.id),i=s.app.packageJson.version;p.info(`Custom application deployment :: Successful
|
|
9
|
+
Current app version: ${i}
|
|
10
|
+
Deployed sections: ${r.join(", ")}`),await mn(s.app.packageJson),s.app.templates.length>0&&p.info(`Deployed templates: ${s.app.templates.map(a=>a.id).join(", ")}`)}catch(t){p.error(oo(t,"Error while deploying:")),l.exit(1)}}const Nn="1.1.3";async function xn(e){Y("template/headers/example-header","headers",e,"Header")}async function Ln(e){Y("template/footers/example-footer","footers",e,"Footer")}const d=io("crane");async function Pn(e,t,o,s){const n=`You can use ${t} to directly specify the name of the ${e}.`;console.log(n);const r=await ne({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(r.name)return e==="template"?o(r.name,s):o(r.name);console.log("Please provide a name for the template."),d.outputHelp()}function kn(e){return typeof e=="number"?!1:!(typeof e=="string"&&e.trim().length!==0)}async function U(e,t,o,s,n){s&&(kn(s)?await Pn(e,t,o):await o(s,n))}function Rn(){d.command("init","Initialize a new resource in the form of a directory.").option("--app <name>","Creates an app folder inside your current directory.").option("--section <name>","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header <name>","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer <name>","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template <name>","Creates the directory and files necessary to build a custom template inside your app folder.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").option("--custom-headers-footers","Creates the directories and files necessary to build a custom header and footer inside your app folder."),d.command("build","Builds your resource code").action(Is),d.command("deploy","Deploys your resource code into Ecwid"),d.on("command:*",()=>{console.error("Invalid command: %s",d.args.join(" ")),d.outputHelp(),process.exit(1)}),d.on("command:init",async()=>{const e=d.options.section,t=d.options.header,o=d.options.footer,s=d.options.app,n=d.options.template,r=d.options.referenceTemplate,i=d.options.customHeadersFooters||!1;await U("app",N("init --app <name>"),Do,s),await U("section",N("init --section <name>"),Io,e),await U("header",N("init --header <name>"),xn,t),await U("footer",N("init --footer <name>"),Ln,o),await U("template",N("init --template <name>"),_o,n,i),r&&No()}),d.on("command:deploy",()=>_n(d.options.url)),d.help(),d.usage("<action> <resource>"),d.version(Nn),d.parse()}try{Rn()}catch(e){console.error(e)}
|