@billgangcom/theme-lib 1.31.1 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,3 +4,4 @@ export * from './getDynamicRoutes';
4
4
  export * from './clearQueryParams';
5
5
  export * from './generateDynamicStyles';
6
6
  export * from './injectStylesToDOM';
7
+ export * from './setupDynamicFonts';
@@ -0,0 +1,2 @@
1
+ import { ThemeSettings } from '@constants';
2
+ export declare const setupDynamicFonts: (themeSettings: ThemeSettings) => void;
@@ -10,6 +10,8 @@ export interface ButtonType {
10
10
  destination: Destination;
11
11
  link?: string;
12
12
  text: string;
13
+ page: string;
14
+ openInNewTab: boolean;
13
15
  }
14
16
  interface Props {
15
17
  isActiveButtons: boolean;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Icon } from '../../builder/ui';
3
2
  interface Props {
4
3
  style?: React.CSSProperties;
5
4
  placeholder?: string;
@@ -18,4 +17,4 @@ interface Props {
18
17
  isSearch?: boolean;
19
18
  }
20
19
  export declare const Input: React.FC<Props>;
21
- export { Icon };
20
+ export {};
package/dist/ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-DWqm1Nf1.cjs"),_=require("react");require("@phosphor-icons/react");const vt="_wrapper_9rr5j_2",It="_alignmentBlock_9rr5j_8",yt="_title_9rr5j_15",kt="_subtitle_9rr5j_22",$t="_alignmentContent_9rr5j_29",Nt="_alignments_9rr5j_37",wt="_alignment_9rr5j_8",Ct="_circle_9rr5j_58",St="_paddings_9rr5j_65",Bt="_padding_9rr5j_65",Tt="_input_9rr5j_84",G={wrapper:vt,alignmentBlock:It,title:yt,subtitle:kt,alignmentContent:$t,alignments:Nt,alignment:wt,circle:Ct,paddings:St,padding:Bt,input:Tt},Pt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],qt=["left","top","right","bottom"],At=d=>{const{alignment:i,padding:e,setPadding:n,setAlignment:o}=d;function r(){switch(i){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function c(s){switch(s){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:G.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:G.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:G.alignments,children:Pt.map(s=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{o(s)},className:G.alignment,children:[s!==i&&t.jsxRuntimeExports.jsx("div",{className:G.circle}),s===i&&t.jsxRuntimeExports.jsx(t.Icon,{name:r(),fill:"#FF3F19",width:22,height:22})]},s))}),t.jsxRuntimeExports.jsx("div",{className:G.paddings,children:qt.map(s=>t.jsxRuntimeExports.jsxs("label",{className:G.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:c(s),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(e[s]),onChange:a=>n({...e,[s]:Number(a)}),paddingless:!0,borderless:!0})]},s))})]})]})]})},Ot="_title_18dz7_1",Dt="_subtitle_18dz7_5",Lt="_header_18dz7_12",zt="_text_18dz7_13",Mt="_top_18dz7_21",Ht="_itemsBlock_18dz7_30",st={title:Ot,subtitle:Dt,header:Lt,text:zt,top:Mt,itemsBlock:Ht},Ft="_typeTexts_rcw8p_1",Vt="_block_rcw8p_8",Ut="_active_rcw8p_21",ut={typeTexts:Ft,block:Vt,active:Ut},Yt=["bold","italic","underline","strike-through","code"],xt=d=>{const{typesText:i,setTypesText:e}=d;function n(o){switch(o){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:ut.typeTexts,children:Yt.map(o=>t.jsxRuntimeExports.jsx("div",{className:t.clx(ut.block,{[ut.active]:i.includes(o)}),onClick:()=>{const r=[...i];if(r.includes(o)){const c=r.filter(s=>s!==o);e(c)}else r.push(o),e(r)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:n(o),fill:i.includes(o)?"#252525":"#757575",width:20,height:20})},String(o)))})},mt=d=>{const{typesText:i,isActiveText:e,setIsActiveText:n,text:o,setText:r,setTypesText:c,title:s,subtitle:a="Items"}=d;return t.jsxRuntimeExports.jsxs("div",{className:st.text,children:[(s||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:st.top,children:[s&&t.jsxRuntimeExports.jsx("h3",{className:st.title,children:s}),e!==void 0&&n&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:u=>n(u)})]}),t.jsxRuntimeExports.jsxs("div",{className:st.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:st.subtitle,children:a}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:u=>r(u),value:o,maxLength:150}),t.jsxRuntimeExports.jsx(xt,{typesText:i,setTypesText:c})]})]})},Gt="_title_1tzq7_1",Wt="_subtitle_1tzq7_5",Xt="_header_1tzq7_12",Jt="_text_1tzq7_13",Qt="_productsBlock_1tzq7_14",Kt="_top_1tzq7_26",Zt="_itemsBlock_1tzq7_35",te="_typeTexts_1tzq7_41",ee="_block_1tzq7_48",se="_active_1tzq7_61",ne="_products_1tzq7_14",oe="_product_1tzq7_14",ie="_button_1tzq7_80",re="_disabled_1tzq7_91",ce="_image_1tzq7_95",ae="_info_1tzq7_102",le="_name_1tzq7_114",ue="_buttons_1tzq7_118",de="_modal_1tzq7_125",xe="_link_1tzq7_147",me="_modalOptions_1tzq7_153",L={title:Gt,subtitle:Wt,header:Xt,text:Jt,productsBlock:Qt,top:Kt,itemsBlock:Zt,typeTexts:te,block:ee,active:se,products:ne,product:oe,button:ie,disabled:re,image:ce,info:ae,name:le,buttons:ue,modal:de,link:xe,modalOptions:me},pe=_.forwardRef((d,i)=>{const{activeItem:e,setActiveItem:n,popupPosition:o,modalOptions:r,setIsOpenModal:c}=d;return console.log(e),t.jsxRuntimeExports.jsxs("div",{ref:i,className:L.modal,onClick:s=>{s.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:L.top,children:[t.jsxRuntimeExports.jsx("h3",{className:L.title,children:e.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{n(null),c(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:L.modalOptions,children:r.map(s=>{if(s.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[s.field],onChange:a=>{const u={...e,[s.field]:a};n(u)}},String(s.field));if(s.type==="text")return t.jsxRuntimeExports.jsx(mt,{typesText:e[s.field.type],setTypesText:a=>{const u={...e,[s.field.type]:a};n(u)},text:e[s.field.text]||"",setText:a=>{const u={...e,[s.field.text]:a};n(u)},subtitle:s.label});if(s.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:a=>{const u={...e,[s.field]:a};n(u)},value:e[s.field]||"",label:s.label,placeholder:s.placeholder});if(s.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:L.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:a=>{const u={...e,[s.field.text]:a};n(u)},value:e[s.field.text]||"",label:s.inputLabel,placeholder:s.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[s.field.switch]||!1,label:s.switchLabel,onChange:a=>{const u={...e,[s.field.switch]:a};n(u)}})]});if(s.type==="list")return t.jsxRuntimeExports.jsx(ht,{items:e[s.field]||[],setItems:a=>{const u={...e,[s.field]:a};n(u)},itemsType:"select",draggable:s.draggable||!1,itemsOptions:s.itemsOptions,deletable:s.deletable||!1,editable:!1,subtitle:s.label});if(s.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:s.itemsOptions,onChange:a=>{const u={...e,[s.field]:a};n(u)},label:s.label,value:e[s.field]||"String",leftAddon:s.leftAddon&&s.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[s.field]})})})})]})}),he="_other_g74jx_1",_e="_subtitle_g74jx_7",je="_items_g74jx_14",dt={other:he,subtitle:_e,items:je},at=d=>{const{items:i,title:e="Other"}=d;return t.jsxRuntimeExports.jsxs("div",{className:dt.other,children:[t.jsxRuntimeExports.jsx("h5",{className:dt.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:dt.items,children:i.map((n,o)=>t.jsxRuntimeExports.jsx(t.Switch,{current:n.isItem,onChange:r=>n.setIsItem(r),label:n.label,hasBackground:!0,paddingless:!1},o))})]})},ge=d=>{const{index:i,moveProduct:e,children:n}=d,[,o]=t.useDrop({accept:"product",hover(s){s.index!==i&&(e(s.index,i),s.index=i)}}),[{isDragging:r},c]=t.useDrag({type:"product",item:{index:i},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>c(o(s)),className:`${L.product} ${r?L.dragging:""}`,children:n})},ht=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:c,subtitle:s,editable:a=!0,draggable:u=!1,withImage:f=!1,deletable:l=!0,addable:k=!0,itemsType:p,itemsPlaceholder:h="",itemsOptions:m,hasRangeSelector:B=!1,rangeSelectorOptions:g,modalOptions:C,addableOptions:P={},limit:I,autoScrollInterval:$}=d,[S,H]=_.useState(null),[U,b]=_.useState({top:0,left:0}),[E,O]=_.useState(null),q=_.useRef(null),[A,z]=_.useState(!1),J=(x,y)=>{const R=[...n],[Y]=R.splice(x,1);R.splice(y,0,Y),o(R)};_.useEffect(()=>{const x=()=>{H(null),z(!1)};return document.body.addEventListener("click",x),H(null),z(!1),()=>{H(null),z(!1),document.body.removeEventListener("click",x)}},[]),_.useEffect(()=>{if(S){const x=[...n].map(y=>y.id===S.id?S:y);o(x)}},[S]),_.useEffect(()=>{if(q.current&&E){const x=q.current.getBoundingClientRect().height,y=window.innerHeight;let R=E.top;console.log(R,x,y,window.scrollY),R+x>y+window.scrollY&&(R=y+window.scrollY-x-200),R<0&&(R=10),b({top:R,left:E.left})}},[q.current,E]);const Z=(x,y)=>{x.stopPropagation();const R=x.target.getBoundingClientRect();O({top:R.top+window.scrollY,left:R.left-30}),H(y),z(!0)};function j(x){if(f)return x?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${x[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const N=(x,y)=>{var Y;const R=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),p==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:T=>{const et=[...n].map(Q=>Q.id===x.id?{...x,name:T}:Q);H({...x,name:T}),o([...et])},value:x.name,options:m.filter(T=>!n.find(F=>F.name===T.name)).map(T=>T.name),leftAddon:j(x.images)}),p==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:T=>{const et=[...n].map(Q=>Q.id===x.id?{...x,name:T}:Q);o([...et])},value:x.name,placeholder:h}),p==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:T=>{const et=[...n].map(Q=>Q.id===x.id?{...x,images:T}:Q);o([...et])},activeImage:(Y=n.find(T=>T.id===x.id))==null?void 0:Y.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:L.buttons,children:[a&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:T=>Z(T,x)}),l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter(T=>T.id!==x.id))})]})]});return u?t.jsxRuntimeExports.jsx(ge,{product:x,index:y,moveProduct:J,children:R},x.id):t.jsxRuntimeExports.jsx("div",{className:L.product,children:R},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:L.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:L.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:L.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:x=>e==null?void 0:e(x)})]}),S&&a&&C&&A&&t.jsxRuntimeExports.jsx(pe,{ref:q,activeItem:S,setActiveItem:H,popupPosition:U,modalOptions:C,setIsOpenModal:z}),B&&g&&t.jsxRuntimeExports.jsx(lt,{...g}),t.jsxRuntimeExports.jsxs("div",{className:L.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:L.subtitle,children:s}),u?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((x,y)=>N(x,y))}):n.map((x,y)=>N(x,y)),k&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx(L.button,{[L.disabled]:!!(I&&I<=n.length||n.length===(m==null?void 0:m.length))}),size:"s",disabled:!!(I&&I<=n.length||n.length===(m==null?void 0:m.length)),onClick:()=>{const x=[...n];let y=null;if(m){for(let R=0;R<m.length;R++)if(!n.find(Y=>Y.id===m[R].id)){y=m[R];break}}p==="select"?x.push({name:y?y.name:m[0].name,id:(y==null?void 0:y.id)||m[0].id,...P}):p==="input"?x.push({name:"",id:t.v4(),...P}):x.push({name:`Image ${n.length+1}`,id:t.v4(),...P}),o(x)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(at,{items:r}),$!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String($.scrollInterval),onChange:x=>$.setScrollInterval(Number(x)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},fe="_title_fyopx_1",be="_subtitle_fyopx_5",Ee="_header_fyopx_12",Re="_text_fyopx_13",ve="_productsBlock_fyopx_14",Ie="_top_fyopx_26",ye="_itemsBlock_fyopx_35",ke="_typeTexts_fyopx_41",$e="_block_fyopx_48",Ne="_active_fyopx_61",we="_products_fyopx_14",Ce="_product_fyopx_14",Se="_button_fyopx_80",Be="_disabled_fyopx_91",Te="_image_fyopx_95",Pe="_info_fyopx_102",qe="_name_fyopx_114",Ae="_buttons_fyopx_118",Oe="_modal_fyopx_125",De="_link_fyopx_145",Le="_modalOptions_fyopx_151",X={title:fe,subtitle:be,header:Ee,text:Re,productsBlock:ve,top:Ie,itemsBlock:ye,typeTexts:ke,block:$e,active:Ne,products:we,product:Ce,button:Se,disabled:Be,image:Te,info:Pe,name:qe,buttons:Ae,modal:Oe,link:De,modalOptions:Le},ze=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:c,subtitle:s,draggable:a=!1,withImage:u=!1,addable:f=!0,itemsOptions:l,hasRangeSelector:k=!1,rangeSelectorOptions:p,limit:h,autoScrollInterval:m}=d;function B(C){if(u)return C?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${C[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const g=C=>{const P=l.find($=>$.id===C);if(!P)return;const I=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[a&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:$=>{const S=[...n],H=l.find(E=>E.name===$);if(!H)return;const U=H.id,b=S.map(E=>E===C?U:E);o([...b])},value:P.name,options:l.filter($=>!n.find(S=>S===$.id)).map($=>$.name),leftAddon:B(P.images)}),t.jsxRuntimeExports.jsx("div",{className:X.buttons,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter($=>$!==C))})})]});return t.jsxRuntimeExports.jsx("div",{className:X.product,children:I},C)};return t.jsxRuntimeExports.jsxs("div",{className:X.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:X.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:X.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:C=>e==null?void 0:e(C)})]}),k&&p&&t.jsxRuntimeExports.jsx(lt,{...p}),t.jsxRuntimeExports.jsxs("div",{className:X.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:s}),n.map(C=>g(C)),f&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx(X.button,{[X.disabled]:!!(h&&h<=n.length||n.length===l.length)}),size:"s",disabled:!!(h&&h<=n.length||n.length===l.length),onClick:()=>{const C=[...n];let P=null;if(l){for(let I=0;I<l.length;I++)if(!n.find($=>$===l[I].id)){P=l[I];break}}C.push((P==null?void 0:P.id)||l[0].id),o(C)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(at,{items:r}),m!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(m.scrollInterval),onChange:C=>m.setScrollInterval(Number(C)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Me="_title_1tzq7_1",He="_subtitle_1tzq7_5",Fe="_header_1tzq7_12",Ve="_text_1tzq7_13",Ue="_productsBlock_1tzq7_14",Ye="_top_1tzq7_26",Ge="_itemsBlock_1tzq7_35",We="_typeTexts_1tzq7_41",Xe="_block_1tzq7_48",Je="_active_1tzq7_61",Qe="_products_1tzq7_14",Ke="_product_1tzq7_14",Ze="_button_1tzq7_80",ts="_disabled_1tzq7_91",es="_image_1tzq7_95",ss="_info_1tzq7_102",ns="_name_1tzq7_114",os="_buttons_1tzq7_118",is="_modal_1tzq7_125",rs="_link_1tzq7_147",cs="_modalOptions_1tzq7_153",M={title:Me,subtitle:He,header:Fe,text:Ve,productsBlock:Ue,top:Ye,itemsBlock:Ge,typeTexts:We,block:Xe,active:Je,products:Qe,product:Ke,button:Ze,disabled:ts,image:es,info:ss,name:ns,buttons:os,modal:is,link:rs,modalOptions:cs},as=_.forwardRef((d,i)=>{const{activeItem:e,setActiveItem:n,popupPosition:o,modalOptions:r,setIsOpenModal:c}=d;return console.log(e),t.jsxRuntimeExports.jsxs("div",{ref:i,className:M.modal,onClick:s=>{s.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:M.top,children:[t.jsxRuntimeExports.jsx("h3",{className:M.title,children:e.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{n(null),c(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:M.modalOptions,children:r.map(s=>{if(s.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[s.field],onChange:a=>{const u={...e,[s.field]:a};n(u)}},String(s.field));if(s.type==="text")return t.jsxRuntimeExports.jsx(mt,{typesText:e[s.field.type],setTypesText:a=>{const u={...e,[s.field.type]:a};n(u)},text:e[s.field.text]||"",setText:a=>{const u={...e,[s.field.text]:a};n(u)},subtitle:s.label});if(s.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:a=>{const u={...e,[s.field]:a};n(u)},value:e[s.field]||"",label:s.label,placeholder:s.placeholder});if(s.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:M.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:a=>{const u={...e,[s.field.text]:a};n(u)},value:e[s.field.text]||"",label:s.inputLabel,placeholder:s.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[s.field.switch]||!1,label:s.switchLabel,onChange:a=>{const u={...e,[s.field.switch]:a};n(u)}})]});if(s.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:s.itemsOptions,onChange:a=>{const u={...e,[s.field]:a};n(u)},label:s.label,value:e[s.field]||"String",leftAddon:s.leftAddon&&s.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[s.field]})})})})]})}),ls=d=>{const{index:i,moveProduct:e,children:n}=d,[,o]=t.useDrop({accept:"product",hover(s){s.index!==i&&(e(s.index,i),s.index=i)}}),[{isDragging:r},c]=t.useDrag({type:"product",item:{index:i},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>c(o(s)),className:`${M.product} ${r?M.dragging:""}`,children:n})},us=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:c,subtitle:s,editable:a=!0,draggable:u=!1,withImage:f=!1,deletable:l=!0,addable:k=!0,itemsType:p,itemsPlaceholder:h="",itemsOptions:m,hasRangeSelector:B=!1,rangeSelectorOptions:g,modalOptions:C,addableOptions:P={}}=d,[I,$]=_.useState(null),[S,H]=_.useState({top:0,left:0}),[U,b]=_.useState(null),E=_.useRef(null),[O,q]=_.useState(!1),A=(j,N)=>{const x=[...n],[y]=x.splice(j,1);x.splice(N,0,y),o(x)};_.useEffect(()=>{const j=()=>{$(null),q(!1)};return document.body.addEventListener("click",j),$(null),q(!1),()=>{$(null),q(!1),document.body.removeEventListener("click",j)}},[]),_.useEffect(()=>{if(I){const j=[...n].map(N=>N.id===I.id?I:N);o(j)}},[I]),_.useEffect(()=>{if(E.current&&U){const j=E.current.getBoundingClientRect().height,N=window.innerHeight;let x=U.top;console.log(x,j,N,window.scrollY),x+j>N+window.scrollY&&(x=N+window.scrollY-j-200),x<0&&(x=10),H({top:x,left:U.left})}},[E.current,U]);const z=(j,N)=>{j.stopPropagation();const x=j.target.getBoundingClientRect();b({top:x.top+window.scrollY,left:x.left-30}),$(N),q(!0)};function J(j){if(f)return j?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${j[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Z=(j,N)=>{var y;const x=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),p==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:R=>{const T=[...n].map(F=>F.id===j.id?{...j,name:R}:F);$({...j,name:R}),o([...T])},value:j.name,options:m.filter(R=>!n.find(Y=>Y.name===R)),leftAddon:J(j.images)}),p==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:R=>{const T=[...n].map(F=>F.id===j.id?{...j,name:R}:F);o([...T])},value:j.name,placeholder:h}),p==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:R=>{const T=[...n].map(F=>F.id===j.id?{...j,images:R}:F);o([...T])},activeImage:(y=n.find(R=>R.id===j.id))==null?void 0:y.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:M.buttons,children:[a&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:R=>z(R,j)}),l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter(R=>R.id!==j.id))})]})]});return u?t.jsxRuntimeExports.jsx(ls,{product:j,index:N,moveProduct:A,children:x},j.id):t.jsxRuntimeExports.jsx("div",{className:M.product,children:x},j.id)};return t.jsxRuntimeExports.jsxs("div",{className:M.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:M.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:M.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:j=>e==null?void 0:e(j)})]}),I&&a&&C&&O&&t.jsxRuntimeExports.jsx(as,{ref:E,activeItem:I,setActiveItem:$,popupPosition:S,modalOptions:C,setIsOpenModal:q}),B&&g&&t.jsxRuntimeExports.jsx(lt,{...g}),t.jsxRuntimeExports.jsxs("div",{className:M.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:M.subtitle,children:s}),u?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((j,N)=>Z(j,N))}):n.map((j,N)=>Z(j,N)),k&&t.jsxRuntimeExports.jsxs(t.Button,{className:M.button,size:"s",onClick:()=>{const j=[...n];let N=null;if(m){for(let x=0;x<m.length;x++)if(!n.find(y=>y.name===m[x])){N=m[x];break}}p==="select"?j.push({name:N||m[0],id:t.v4(),...P}):p==="input"?j.push({name:"",id:t.v4(),...P}):j.push({name:`Image ${n.length+1}`,id:t.v4(),...P}),o(j)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(at,{items:r})]})},ds="_title_dkxs6_1",xs="_subtitle_dkxs6_5",ms="_header_dkxs6_12",ps="_text_dkxs6_13",hs="_productsBlock_dkxs6_14",_s="_buttonsBlock_dkxs6_15",js="_top_dkxs6_26",gs="_itemsBlock_dkxs6_35",fs="_typeTexts_dkxs6_41",bs="_block_dkxs6_48",Es="_active_dkxs6_60",Rs="_products_dkxs6_14",vs="_product_dkxs6_14",Is="_button_dkxs6_15",ys="_image_dkxs6_90",ks="_info_dkxs6_97",$s="_name_dkxs6_109",Ns="_buttons_dkxs6_15",ws="_modal_dkxs6_120",Cs="_other_dkxs6_140",Ss="_options_dkxs6_146",tt={title:ds,subtitle:xs,header:ms,text:ps,productsBlock:hs,buttonsBlock:_s,top:js,itemsBlock:gs,typeTexts:fs,block:bs,active:Es,products:Rs,product:vs,button:Is,image:ys,info:ks,name:$s,buttons:Ns,modal:ws,other:Cs,options:Ss},Bs=_.forwardRef((d,i)=>{const{activeButton:e,setActiveButton:n,popupPosition:o}=d,[r,c]=_.useState(e.typesText),[s,a]=_.useState(e.destination),[u,f]=_.useState(e.link||""),[l,k]=_.useState(e.text||"");return _.useEffect(()=>{n({...e,...{text:l,link:u,destination:s,typesText:r}})},[r,s,u,l]),t.jsxRuntimeExports.jsxs("div",{className:tt.modal,onClick:p=>{p.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},ref:i,children:[t.jsxRuntimeExports.jsxs("div",{className:tt.top,children:[t.jsxRuntimeExports.jsx("h3",{className:tt.title,children:e.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>n(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:tt.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:p=>a(p),options:["Go to Page","Open Link"],value:s}),s==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:p=>f(p),value:u,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:p=>k(p),value:l,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(xt,{typesText:r,setTypesText:c})]})]})}),Ts="_subtitle_m8qel_1",Ps="_header_m8qel_8",qs="_text_m8qel_9",As="_productsBlock_m8qel_10",Os="_buttonsBlock_m8qel_11",Ds="_top_m8qel_23",Ls="_itemsBlock_m8qel_32",zs="_typeTexts_m8qel_38",Ms="_block_m8qel_45",Hs="_active_m8qel_58",Fs="_products_m8qel_10",Vs="_product_m8qel_10",Us="_button_m8qel_11",Ys="_image_m8qel_88",Gs="_info_m8qel_95",Ws="_name_m8qel_107",Xs="_buttons_m8qel_11",Js="_modal_m8qel_118",Qs="_other_m8qel_137",Ks="_options_m8qel_143",nt={subtitle:Ts,header:Ps,text:qs,productsBlock:As,buttonsBlock:Os,top:Ds,itemsBlock:Ls,typeTexts:zs,block:Ms,active:Hs,products:Fs,product:Vs,button:Us,image:Ys,info:Gs,name:Ws,buttons:Xs,modal:Js,other:Qs,options:Ks},_t=d=>{const{buttons:i,setButtons:e,deletable:n=!0,addable:o=!0}=d,[r,c]=_.useState(null),[s,a]=_.useState({top:0,left:0}),[u,f]=_.useState(null),l=_.useRef(null);_.useEffect(()=>{const p=()=>{c(null)};return document.body.addEventListener("click",p),c(null),()=>{c(null),document.body.removeEventListener("click",p)}},[]),_.useEffect(()=>{if(r){const p=[...i].map(h=>h.id===r.id?r:h);e(p)}},[r]),_.useEffect(()=>{if(l.current&&u){const p=l.current.getBoundingClientRect().height,h=window.innerHeight;let m=u.top;console.log(m,p,h,window.scrollY),m+p>h+window.scrollY&&(m=h+window.scrollY-p-200),m<0&&(m=10),a({top:m,left:u.left})}},[l.current,u]);const k=(p,h)=>{p.stopPropagation();const m=p.target.getBoundingClientRect();f({top:m.top+window.scrollY,left:m.left-30}),c(h)};return t.jsxRuntimeExports.jsxs("div",{className:nt.products,children:[t.jsxRuntimeExports.jsx("h5",{className:nt.subtitle,children:"Button Type"}),i.map(p=>t.jsxRuntimeExports.jsxs("div",{className:nt.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:h=>{const B=[...i].map(g=>g.id===p.id?{...p,type:h}:g);e(B)},value:p.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:nt.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:h=>{k(h,p)}}),n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const h=i.filter(m=>m.id!==p.id);e(h)},width:20,height:20,fill:"#C12A2A"})]})]},p.id)),r&&t.jsxRuntimeExports.jsx(Bs,{ref:l,activeButton:r,setActiveButton:c,popupPosition:s}),o&&t.jsxRuntimeExports.jsxs(t.Button,{className:nt.button,size:"s",onClick:()=>{const p=[...i];p.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:"Button Name"}),e(p)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Zs=d=>{const{isActiveButtons:i,setIsActiveButtons:e,buttons:n,setButtons:o}=d;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:tt.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:tt.top,children:[t.jsxRuntimeExports.jsx("h3",{className:tt.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:r=>e(r)})]}),t.jsxRuntimeExports.jsx(_t,{buttons:n,setButtons:o})]})})},tn="_wrapper_m18qi_1",en="_subtitle_m18qi_7",sn="_content_m18qi_14",nn="_range_m18qi_22",on="_track_m18qi_27",rn="_progress_m18qi_36",cn="_dots_m18qi_46",an="_dot_m18qi_46",ln="_active_m18qi_65",un="_input_m18qi_77",dn="_countBlock_m18qi_91",xn="_count_m18qi_91",mn="_controls_m18qi_107",pn="_button_m18qi_113",D={wrapper:tn,subtitle:en,content:sn,range:nn,track:on,progress:rn,dots:cn,dot:an,active:ln,input:un,countBlock:dn,count:xn,controls:mn,button:pn},lt=d=>{const{label:i,min:e=1,max:n=4,step:o=1,count:r,setCount:c}=d,[s,a]=_.useState(!1),u=Array.from({length:(n-e)/o+1}),f=(r-e)/(n-e)*100,l=()=>{r<n&&c(r+o)},k=()=>{r>e&&c(r-o)},p=h=>{const m=e+h*o;c(m)};return t.jsxRuntimeExports.jsxs("div",{className:D.wrapper,children:[i&&t.jsxRuntimeExports.jsx("h5",{className:D.subtitle,children:i}),t.jsxRuntimeExports.jsxs("div",{className:D.content,children:[t.jsxRuntimeExports.jsxs("div",{className:D.range,children:[t.jsxRuntimeExports.jsx("div",{className:D.track}),t.jsxRuntimeExports.jsx("div",{className:D.progress,style:{width:`${f}%`}}),t.jsxRuntimeExports.jsx("div",{className:D.dots,children:u.map((h,m)=>{const B=m<=(r-e)/o;return t.jsxRuntimeExports.jsx("button",{onClick:()=>p(m),className:t.clx(D.dot,{[D.active]:B,[D.inactive]:!B,[D.dragging]:s}),"aria-label":`Set value to ${e+m*o}`},m)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:n,step:o,value:r,onChange:h=>c(Number(h.target.value)),onMouseDown:()=>a(!0),onMouseUp:()=>a(!1),onTouchStart:()=>a(!0),onTouchEnd:()=>a(!1),className:D.input})]}),t.jsxRuntimeExports.jsxs("div",{className:D.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:n,paddingless:!0,onChange:h=>{const m=Number(h);m>n?c(n):m<e?c(e):c(m)},value:String(r)}),t.jsxRuntimeExports.jsxs("div",{className:D.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:l,disabled:r>=n,className:D.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:k,disabled:r<=e,className:D.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},hn="_title_1hw31_1",_n="_subtitle_1hw31_5",jn="_header_1hw31_12",gn="_text_1hw31_13",fn="_productsBlock_1hw31_14",bn="_top_1hw31_26",En="_itemsBlock_1hw31_35",Rn="_typeTexts_1hw31_41",vn="_block_1hw31_48",In="_active_1hw31_61",yn="_products_1hw31_14",kn="_product_1hw31_14",$n="_button_1hw31_80",Nn="_image_1hw31_91",wn="_info_1hw31_98",Cn="_name_1hw31_110",Sn="_buttons_1hw31_114",Bn="_modal_1hw31_121",Tn="_link_1hw31_141",Pn="_modalOptions_1hw31_147",V={title:hn,subtitle:_n,header:jn,text:gn,productsBlock:fn,top:bn,itemsBlock:En,typeTexts:Rn,block:vn,active:In,products:yn,product:kn,button:$n,image:Nn,info:wn,name:Cn,buttons:Sn,modal:Bn,link:Tn,modalOptions:Pn},qn=d=>{const{activeItem:i,setActiveItem:e,popupPosition:n,setIsOpenModal:o,itemsOptions:r}=d,c=r.find(a=>a.id===i.listingId);if(!c)return null;function s(a,u){return a.length>u?`${a.slice(0,u)}...`:a}return t.jsxRuntimeExports.jsxs("div",{className:V.modal,onClick:a=>{a.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s(c.productData.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{o(!1),e(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:V.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:c.productData.images.length>0?c.productData.images[0].cfId:void 0,onChange:a=>{const u={...i,image:a[0]};e(u)}})})]})},An=d=>{const{index:i,moveProduct:e,children:n}=d,[,o]=t.useDrop({accept:"product",hover(s){s.index!==i&&(e(s.index,i),s.index=i)}}),[{isDragging:r},c]=t.useDrag({type:"product",item:{index:i},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>c(o(s)),className:`${V.product} ${r?V.dragging:""}`,children:n})},On=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:c,subtitle:s,editable:a=!0,draggable:u=!1,withImage:f=!1,deletable:l=!0,addable:k=!0,itemsType:p,itemsOptions:h}=d,[m,B]=_.useState(null),[g,C]=_.useState({top:0,left:0}),[P,I]=_.useState(!1),$=(b,E)=>{const O=[...n],[q]=O.splice(b,1);O.splice(E,0,q),o(O)};_.useEffect(()=>{const b=()=>{B(null),I(!1)};return document.body.addEventListener("click",b),B(null),I(!1),()=>{B(null),I(!1),document.body.removeEventListener("click",b)}},[]),_.useEffect(()=>{if(m){const b=[...n].map(E=>E.listingId===m.listingId?m:E);o(b)}},[m]);const S=(b,E)=>{b.stopPropagation();const O=b.target.getBoundingClientRect(),q=100,A=window.innerHeight;let z=O.top+window.scrollY;z+q>A&&(z=A-q-20),I(!0),C({top:z-80,left:O.left-30}),B(E)};function H(b){if(f)return b?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${b}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const U=(b,E)=>{const O=h.find(A=>b.listingId===A.id);if(!O)return null;const q=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})},E),p==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:A=>{const z=[...n],J=h.find(N=>N.productData.name===A);if(!J)return;const Z={listingId:J.id,image:J.productData.images.length>0?J.productData.images[0].cfId:""},j=z.map(N=>N.listingId===b.listingId?Z:N);B(Z),o([...j])},value:O.productData.name,options:[...h.filter(A=>!n.find(z=>z.listingId===A.id)).map(A=>A.productData.name)],leftAddon:H(b.image||O.productData.images.length>0&&O.productData.images[0].cfId||"")},E),t.jsxRuntimeExports.jsxs("div",{className:V.buttons,children:[a&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:A=>S(A,b)}),l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter(A=>A!==b))})]})]});return u?t.jsxRuntimeExports.jsx(An,{product:b,index:E,moveProduct:$,children:q},b.listingId):t.jsxRuntimeExports.jsx("div",{className:V.product,children:q},b.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:V.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:V.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:b=>e==null?void 0:e(b)})]}),P&&m&&t.jsxRuntimeExports.jsx(qn,{activeItem:m,setActiveItem:B,setIsOpenModal:I,popupPosition:g,itemsOptions:h}),t.jsxRuntimeExports.jsxs("div",{className:V.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:s}),u?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((b,E)=>U(b,E))}):n.map((b,E)=>U(b,E)),k&&t.jsxRuntimeExports.jsxs(t.Button,{className:V.button,size:"s",onClick:()=>{const b=[...n];for(let E=0;E<h.length;E++)if(!n.find(O=>O.listingId===h[E].id)){b.push({listingId:h[E].id,image:h[E].productData.images.length>0?h[E].productData.images[0].cfId:""});break}o(b)},disabled:n.length===h.length,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(at,{items:r})]})},Dn="_options_1u21a_1",Ln="_price_1u21a_12",zn="_oldPrice_1u21a_19",Mn="_newPrice_1u21a_27",Hn="_meta_1u21a_34",Fn="_info_1u21a_40",Vn="_infoRight_1u21a_48",Un="_buttons_1u21a_55",Yn="_variants_1u21a_62",Gn="_variant_1u21a_62",Wn="_stock_1u21a_79",Xn="_variantInfo_1u21a_86",Jn="_quantity_1u21a_92",Qn="_count_1u21a_99",Kn="_button_1u21a_55",Zn="_activeVariant_1u21a_124",to="_chargeTypes_1u21a_128",eo="_charge_1u21a_128",so="_chargeActive_1u21a_149",no="_title_1u21a_154",w={options:Dn,price:Ln,oldPrice:zn,newPrice:Mn,meta:Hn,info:Fn,infoRight:Vn,buttons:Un,variants:Yn,variant:Gn,stock:Wn,variantInfo:Xn,quantity:Jn,count:Qn,button:Kn,activeVariant:Zn,chargeTypes:to,charge:eo,chargeActive:so,title:no};var jt=(d=>(d.ONE_TIME="One-Time",d.RECURRING="Subscribe & Save",d))(jt||{});const oo=d=>{var m,B;const{variants:i}=d,[e,n]=_.useState(i[0]),[o,r]=_.useState(e.chargeTypes[0]),c=t.useNavigate(),[s,a]=_.useState(1),{reset:u,addProductToCart:f,getProducts:l}=t.useCart();async function k(){await l(),await f({productId:d.id,productVariantId:e.id,quantity:s})}function p(){u(),k(),c("/checkout")}function h(g){if(g>=864e5){const S=Math.floor(g/864e5);return`${S} ${S===1?"day":"days"}`}else if(g>=36e5){const S=Math.floor(g/36e5);return`${S} ${S===1?"hour":"hours"}`}else if(g>=6e4){const S=Math.floor(g/6e4);return`${S} ${S===1?"minute":"minutes"}`}else{const S=Math.floor(g/1e3);return`${S} ${S===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:w.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:w.chargeTypes,children:e.chargeTypes.map(g=>t.jsxRuntimeExports.jsx("div",{className:t.clx(w.charge,{[w.chargeActive]:o===g}),onClick:()=>r(g),children:jt[g]},g))}),t.jsxRuntimeExports.jsx("div",{className:w.variants,children:i.map(g=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(w.variant,{[w.activeVariant]:e.id===g.id}),onClick:()=>n(g),children:[t.jsxRuntimeExports.jsxs("div",{className:w.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:w.title,children:g.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",o==="ONE_TIME"?g.price.amount:g.subscriptionSettings?g.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:w.stock,children:[g.quantity.restrictions?g.quantity.restrictions.max||0:"Stock Not Found"," ","in stock"]})})]},g.id))}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:w.quantity,children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>{s>1?a(g=>g-1):a(1)},className:w.button,disabled:e.quantity.restrictions&&s<=e.quantity.restrictions.min,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("input",{className:w.count,value:s,onChange:g=>a(Number(g.target.value)),max:((m=e.quantity.restrictions)==null?void 0:m.max)||1/0,min:((B=e.quantity.restrictions)==null?void 0:B.min)||0}),t.jsxRuntimeExports.jsx("button",{onClick:()=>{a(g=>g+1)},className:w.button,disabled:e.quantity.restrictions&&s>=e.quantity.restrictions.max,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:w.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:w.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:w.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:!e.deliveryTime||e.deliveryTime===0?"Instant":h(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:w.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:w.infoRight,children:o==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:w.price,children:[t.jsxRuntimeExports.jsxs("span",{className:w.newPrice,children:["$ ",(e.price.amount||0)*s]}),t.jsxRuntimeExports.jsxs("span",{className:w.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*s]})]}):t.jsxRuntimeExports.jsxs("span",{className:w.newPrice,children:["$ ",(e.price.amount||0)*s]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:w.price,children:[t.jsxRuntimeExports.jsxs("span",{className:w.newPrice,children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:w.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:w.newPrice,children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>p(),children:t.jsxRuntimeExports.jsx("span",{children:o==="ONE_TIME"?"Buy Now":"Subscribe Now"})}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>k(),children:"Add to Cart"})]})]})},io="_button_1x9be_1",ro="_login_1x9be_14",co="_signUp_1x9be_18",ao="_buttons_1x9be_23",lo="_modal_1x9be_32",uo="_info_1x9be_48",xo="_top_1x9be_55",mo="_title_1x9be_66",po="_clear_1x9be_72",ho="_activeClear_1x9be_79",_o="_count_1x9be_83",jo="_cart_1x9be_98",go="_empty_1x9be_106",fo="_product_1x9be_132",bo="_products_1x9be_141",Eo="_image_1x9be_149",Ro="_productInfo_1x9be_155",vo="_content_1x9be_162",Io="_name_1x9be_168",yo="_price_1x9be_174",ko="_productButtons_1x9be_180",$o="_productButton_1x9be_180",No="_productCount_1x9be_200",wo="_bottom_1x9be_216",Co="_subtotal_1x9be_224",So="_block_1x9be_232",Bo="_shoppingCount_1x9be_239",To="_total_1x9be_259",Po="_link_1x9be_265",qo="_userInfo_1x9be_272",v={button:io,login:ro,signUp:co,buttons:ao,modal:lo,info:uo,top:xo,title:mo,clear:po,activeClear:ho,count:_o,cart:jo,empty:go,product:fo,products:bo,image:Eo,productInfo:Ro,content:vo,name:Io,price:yo,productButtons:ko,productButton:$o,productCount:No,bottom:wo,subtotal:Co,block:So,shoppingCount:Bo,total:To,link:Po,userInfo:qo},Ao="_button_15mga_1",Oo="_primary_15mga_19",Do="_secondary_15mga_24",Lo="_tertiary_15mga_29",zo="_content_15mga_34",ot={button:Ao,primary:Oo,secondary:Do,tertiary:Lo,content:zo},gt=d=>{const{children:i,onClick:e,style:n,className:o,disabled:r=!1,type:c="Primary"}=d;return t.jsxRuntimeExports.jsx("button",{className:t.clx(ot.button,o,{[ot.primary]:c==="Primary",[ot.secondary]:c==="Secondary",[ot.tertiary]:c==="Tertiary"}),onClick:e,style:{...n},disabled:r,children:c==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:ot.content,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"#757575",width:20,height:20}),i]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:i})})};class rt extends Error{}rt.prototype.name="InvalidTokenError";function Mo(d){return decodeURIComponent(atob(d).replace(/(.)/g,(i,e)=>{let n=e.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function Ho(d){let i=d.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Mo(i)}catch{return atob(i)}}function Fo(d,i){if(typeof d!="string")throw new rt("Invalid token specified: must be a string");i||(i={});const e=i.header===!0?0:1,n=d.split(".")[e];if(typeof n!="string")throw new rt(`Invalid token specified: missing part #${e+1}`);let o;try{o=Ho(n)}catch(r){throw new rt(`Invalid token specified: invalid base64 for part #${e+1} (${r.message})`)}try{return JSON.parse(o)}catch(r){throw new rt(`Invalid token specified: invalid json for part #${e+1} (${r.message})`)}}const Vo=d=>{const{shopping:i,signUp:e}=d,n=t.useNavigate();function o(c){n(c)}const r=JSON.parse(localStorage.getItem("token")||"{}");return t.jsxRuntimeExports.jsxs("div",{className:v.buttons,children:[i&&t.jsxRuntimeExports.jsx(ft,{}),!r.data&&t.jsxRuntimeExports.jsx("div",{className:t.clx(v.button,v.login),onClick:()=>o("/customer-dash"),children:"Login"}),!r.data&&e&&t.jsxRuntimeExports.jsx("div",{className:t.clx(v.button,v.login,v.signUp),onClick:()=>o("/customer-dash"),children:"Sign Up"}),r.data&&t.jsxRuntimeExports.jsx(Rt,{token:r.data})]})},ft=()=>{const[d,i]=_.useState(!1),[e,n]=_.useState([]),{cart:o,getProducts:r}=t.useCart();function c(f){for(let l=0;l<o.parts.length;l++)for(let k=0;k<f.variants.length;k++)if(o.parts[l].productVariantId===f.variants[l].id)return o.parts[l].productVariantId}function s(f){for(let l=0;l<o.parts.length;l++)for(let k=0;k<f.variants.length;k++)if(o.parts[l].productVariantId===f.variants[l].id)return o.parts[l].quantity}_.useEffect(()=>{(async()=>{const l=o.parts.map(h=>String(h.productId)),p=(await r([...l])).map(h=>({...h,activeVariantId:c(h),quantity:s(h)}));n(p)})()},[o]);function a(f){var l;return!f||!(f!=null&&f.variants)?!1:(l=f.variants.find(k=>k.id===f.activeVariantId))==null?void 0:l.subscriptionSettings}const u=o.parts.length>0&&e.length>0&&!a(e[0]);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:v.button,onClick:f=>{f.stopPropagation(),i(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),u&&t.jsxRuntimeExports.jsx("div",{className:v.shoppingCount,children:o.parts.length})]}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:i,children:t.jsxRuntimeExports.jsx(bt,{activeProducts:e,isCartNotEmpty:u})})]})},bt=d=>{const{activeProducts:i,isCartNotEmpty:e}=d,{cart:n,reset:o,getTotalAndDiscount:r,updateQuantityOfProduct:c}=t.useCart(),s=t.useNavigate();function a(l){s(l)}function u(l){c({productId:l.id,productVariantId:l.activeVariantId,quantity:l.quantity+1})}function f(l){c({productId:l.id,productVariantId:l.activeVariantId,quantity:l.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:v.modal,onClick:l=>l.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:v.top,children:[t.jsxRuntimeExports.jsxs("div",{className:v.info,children:[t.jsxRuntimeExports.jsx("span",{className:v.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:v.count,children:n.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(v.clear,{[v.activeClear]:e}),disabled:!e,onClick:()=>o(),children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:v.cart,children:[t.jsxRuntimeExports.jsx("div",{className:v.products,children:i.map(l=>t.jsxRuntimeExports.jsxs("div",{className:v.product,children:[t.jsxRuntimeExports.jsxs("div",{className:v.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${l.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:v.image}),t.jsxRuntimeExports.jsxs("div",{className:v.content,children:[t.jsxRuntimeExports.jsx("div",{className:v.name,children:l.name}),t.jsxRuntimeExports.jsxs("div",{className:v.price,children:["$",l.variants.find(k=>k.id===l.activeVariantId).price.amount*((l==null?void 0:l.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:v.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{l.quantity!==1&&f(l)},className:v.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:v.productCount,children:l.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>u(l),className:v.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},l.id))}),t.jsxRuntimeExports.jsxs("div",{className:v.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:v.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:v.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsxs("div",{className:v.total,children:["$",r().total]})]}),t.jsxRuntimeExports.jsx(gt,{onClick:()=>a("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(Et,{})]})},Et=()=>t.jsxRuntimeExports.jsxs("div",{className:v.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"})}),t.jsxRuntimeExports.jsx("span",{children:"Your cart is empty"}),t.jsxRuntimeExports.jsxs("span",{children:["Check out the store's products and add them"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:v.link,children:"here"})]})]}),Rt=({token:d})=>{const[i,e]=_.useState("test-email@gmail.com"),n=t.useNavigate();_.useEffect(()=>{(async()=>{const c=Fo(d);e(c.email)})()},[d]);function o(r){n(r)}return t.jsxRuntimeExports.jsx("div",{className:v.userInfo,onClick:()=>o("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:i||"test-email@gmail.com"})})},Uo="_share_9g414_1",Yo="_modal_9g414_8",Go="_header_9g414_14",Wo="_socials_9g414_24",Xo="_social_9g414_24",Jo="_copy_9g414_34",Qo="_title_9g414_41",Ko="_copyWrapper_9g414_47",Zo="_copyText_9g414_56",W={share:Uo,modal:Yo,header:Go,socials:Wo,social:Xo,copy:Jo,title:Qo,copyWrapper:Ko,copyText:Zo},ti=()=>{const{isOpenModal:d,setIsOpenModal:i}=t.useShareLinkStore();function e(){i(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:W.share,onClick:n=>{n.stopPropagation(),e()},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575"})}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:i,children:t.jsxRuntimeExports.jsx(ei,{})})]})},pt={facebook:"FacebookLogo","x.com":"TwitterLogo",telegram:"TelegramLogo",instagram:"InstagramLogo",discord:"MessengerLogo",tiktok:"TiktokLogo"},ei=()=>{const{setIsOpenModal:d}=t.useShareLinkStore(),i=window.location.href;function e(){navigator.clipboard.writeText(i)}return t.jsxRuntimeExports.jsxs("div",{className:W.modal,onClick:n=>n.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:W.header,children:[t.jsxRuntimeExports.jsx("div",{className:W.title,children:"Share this Post"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:()=>d(!1)})]}),t.jsxRuntimeExports.jsx("div",{className:W.socials,children:Object.keys(pt).map(n=>t.jsxRuntimeExports.jsx("div",{className:W.social,children:t.jsxRuntimeExports.jsx(t.Icon,{name:pt[n]})}))}),t.jsxRuntimeExports.jsxs("div",{className:W.copyWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(W.copy,W.copyText),onClick:e,children:i}),t.jsxRuntimeExports.jsx("div",{onClick:e,className:W.copy,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},si="_accordion_9e4oa_1",ni="_header_9e4oa_9",oi="_icon_9e4oa_18",ii="_open_9e4oa_21",ri="_content_9e4oa_25",it={accordion:si,header:ni,icon:oi,open:ii,content:ri},ci=({title:d,content:i})=>{const[e,n]=_.useState(!1),[o,r]=_.useState(0),c=_.useRef(null),s=()=>{n(!e)};return _.useEffect(()=>{c.current&&r(e?c.current.scrollHeight:0)},[e]),t.jsxRuntimeExports.jsxs("div",{className:it.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:it.header,onClick:s,children:[t.jsxRuntimeExports.jsx("h3",{children:d}),t.jsxRuntimeExports.jsx("div",{className:t.clx(it.icon,{[it.open]:e}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:c,className:it.content,style:{height:`${o}px`},children:t.jsxRuntimeExports.jsx("p",{children:i})})]})},ai="_wrapper_a11w3_1",li="_label_a11w3_9",ui="_input_a11w3_17",di="_required_a11w3_40",xi="_paddingless_a11w3_44",mi="_content_a11w3_48",pi="_borderless_a11w3_56",hi="_rightIcon_a11w3_61",K={wrapper:ai,label:li,input:ui,required:di,paddingless:xi,content:mi,borderless:pi,rightIcon:hi},_i=d=>{const{onChange:i,style:e,label:n,value:o,type:r,min:c,max:s,placeholder:a,disabled:u=!1,required:f=!1,regex:l,paddingless:k=!1,borderless:p=!1,editable:h=!1,isSearch:m=!1}=d,[B,g]=_.useState(!1);function C(I){return Number(I)<0?String(c):I}function P(I){return!f||!l?!0:new RegExp(l).test(I)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[n&&t.jsxRuntimeExports.jsx("label",{className:K.label,htmlFor:n,children:n}),t.jsxRuntimeExports.jsxs("div",{className:K.content,children:[t.jsxRuntimeExports.jsx("input",{id:n,type:r||"text",onChange:I=>{if(r==="text")i(I.target.value);else{const $=C(I.target.value);i($)}},value:o,autoComplete:"off",placeholder:a||"Type something...",className:t.clx(K.input,{[K.required]:B&&f&&!P(o),[K.paddingless]:k,[K.borderless]:p}),min:r==="number"?c:void 0,max:r==="number"?s:void 0,disabled:u,onFocus:()=>g(!0),style:e}),m&&t.jsxRuntimeExports.jsx("div",{className:K.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:20,height:20})}),h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},ji="_wrapper_st58d_1",gi="_label_st58d_10",fi="_textarea_st58d_18",bi="_length_st58d_33",ct={wrapper:ji,label:gi,textarea:fi,length:bi},Ei=d=>{const{onChange:i,label:e,value:n,maxLength:o,placeholder:r="Type something..."}=d,[c,s]=_.useState(n.length);return t.jsxRuntimeExports.jsxs("div",{className:ct.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:ct.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:n,onChange:a=>{s(a.target.value.length),i(a.target.value)},placeholder:r,className:ct.textarea,maxLength:o}),o&&t.jsxRuntimeExports.jsxs("div",{className:ct.length,children:[c,"/",o]})]})};exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Select=t.Select;exports.Switch=t.Switch;exports.TextareaSettings=t.Textarea;exports.Accordion=ci;exports.Button=gt;exports.ButtonTypeSettings=_t;exports.ButtonsSettings=Zs;exports.CategorySettings=ze;exports.EmptyCart=Et;exports.FormSettings=us;exports.HeaderButtons=Vo;exports.InputUI=_i;exports.ItemsSettings=ht;exports.LayoutSettings=At;exports.ListingSelector=On;exports.ProductOptions=oo;exports.RangeSelector=lt;exports.ShareLink=ti;exports.ShoppingButton=ft;exports.ShoppingModalCart=bt;exports.TextSettings=mt;exports.TextareaUI=Ei;exports.TypesText=xt;exports.UserInfo=Rt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CZcNDk0w.cjs"),m=require("react");require("@phosphor-icons/react");const Rt="_wrapper_9rr5j_2",yt="_alignmentBlock_9rr5j_8",It="_title_9rr5j_15",kt="_subtitle_9rr5j_22",$t="_alignmentContent_9rr5j_29",wt="_alignments_9rr5j_37",Nt="_alignment_9rr5j_8",Ct="_circle_9rr5j_58",St="_paddings_9rr5j_65",Tt="_padding_9rr5j_65",Bt="_input_9rr5j_84",G={wrapper:Rt,alignmentBlock:yt,title:It,subtitle:kt,alignmentContent:$t,alignments:wt,alignment:Nt,circle:Ct,paddings:St,padding:Tt,input:Bt},Pt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],At=["left","top","right","bottom"],Ot=d=>{const{alignment:i,padding:e,setPadding:n,setAlignment:o}=d;function r(){switch(i){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function a(s){switch(s){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:G.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:G.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:G.alignments,children:Pt.map(s=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{o(s)},className:G.alignment,children:[s!==i&&t.jsxRuntimeExports.jsx("div",{className:G.circle}),s===i&&t.jsxRuntimeExports.jsx(t.Icon,{name:r(),fill:"#FF3F19",width:22,height:22})]},s))}),t.jsxRuntimeExports.jsx("div",{className:G.paddings,children:At.map(s=>t.jsxRuntimeExports.jsxs("label",{className:G.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:a(s),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(e[s]),onChange:c=>n({...e,[s]:Number(c)}),paddingless:!0,borderless:!0})]},s))})]})]})]})},qt="_title_18dz7_1",Dt="_subtitle_18dz7_5",Lt="_header_18dz7_12",Mt="_text_18dz7_13",Ht="_top_18dz7_21",Ft="_itemsBlock_18dz7_30",nt={title:qt,subtitle:Dt,header:Lt,text:Mt,top:Ht,itemsBlock:Ft},Vt="_typeTexts_rcw8p_1",Ut="_block_rcw8p_8",zt="_active_rcw8p_21",dt={typeTexts:Vt,block:Ut,active:zt},Yt=["bold","italic","underline","strike-through","code"],pt=d=>{const{typesText:i,setTypesText:e}=d;function n(o){switch(o){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:dt.typeTexts,children:Yt.map(o=>t.jsxRuntimeExports.jsx("div",{className:t.clx(dt.block,{[dt.active]:i.includes(o)}),onClick:()=>{const r=[...i];if(r.includes(o)){const a=r.filter(s=>s!==o);e(a)}else r.push(o),e(r)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:n(o),fill:i.includes(o)?"#252525":"#757575",width:20,height:20})},String(o)))})},mt=d=>{const{typesText:i,isActiveText:e,setIsActiveText:n,text:o,setText:r,setTypesText:a,title:s,subtitle:c="Items"}=d;return t.jsxRuntimeExports.jsxs("div",{className:nt.text,children:[(s||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:nt.top,children:[s&&t.jsxRuntimeExports.jsx("h3",{className:nt.title,children:s}),e!==void 0&&n&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:u=>n(u)})]}),t.jsxRuntimeExports.jsxs("div",{className:nt.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:nt.subtitle,children:c}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:u=>r(u),value:o,maxLength:150}),t.jsxRuntimeExports.jsx(pt,{typesText:i,setTypesText:a})]})]})},Gt="_title_fyopx_1",Wt="_subtitle_fyopx_5",Xt="_header_fyopx_12",Jt="_text_fyopx_13",Qt="_productsBlock_fyopx_14",Kt="_top_fyopx_26",Zt="_itemsBlock_fyopx_35",te="_typeTexts_fyopx_41",ee="_block_fyopx_48",se="_active_fyopx_61",ne="_products_fyopx_14",oe="_product_fyopx_14",ie="_button_fyopx_80",re="_disabled_fyopx_91",ae="_image_fyopx_95",ce="_info_fyopx_102",le="_name_fyopx_114",ue="_buttons_fyopx_118",de="_modal_fyopx_125",xe="_link_fyopx_145",pe="_modalOptions_fyopx_151",H={title:Gt,subtitle:Wt,header:Xt,text:Jt,productsBlock:Qt,top:Kt,itemsBlock:Zt,typeTexts:te,block:ee,active:se,products:ne,product:oe,button:ie,disabled:re,image:ae,info:ce,name:le,buttons:ue,modal:de,link:xe,modalOptions:pe},me=m.forwardRef((d,i)=>{const{activeItem:e,setActiveItem:n,popupPosition:o,modalOptions:r,setIsOpenModal:a}=d;return t.jsxRuntimeExports.jsxs("div",{ref:i,className:H.modal,onClick:s=>{s.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[t.jsxRuntimeExports.jsx("h3",{className:H.title,children:e.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{n(null),a(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:H.modalOptions,children:r.map(s=>{if(s.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[s.field],onChange:c=>{const u={...e,[s.field]:c};n(u)}},String(s.field));if(s.type==="text")return t.jsxRuntimeExports.jsx(mt,{typesText:e[s.field.type],setTypesText:c=>{const u={...e,[s.field.type]:c};n(u)},text:e[s.field.text]||"",setText:c=>{const u={...e,[s.field.text]:c};n(u)},subtitle:s.label});if(s.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const u={...e,[s.field]:c};n(u)},value:e[s.field]||"",label:s.label,placeholder:s.placeholder});if(s.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:H.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const u={...e,[s.field.text]:c};n(u)},value:e[s.field.text]||"",label:s.inputLabel,placeholder:s.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[s.field.switch]||!1,label:s.switchLabel,onChange:c=>{const u={...e,[s.field.switch]:c};n(u)}})]});if(s.type==="list")return t.jsxRuntimeExports.jsx(_t,{items:e[s.field]||[],setItems:c=>{const u={...e,[s.field]:c};n(u)},itemsType:"select",draggable:s.draggable||!1,itemsOptions:s.itemsOptions,deletable:s.deletable||!1,editable:!1,subtitle:s.label});if(s.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:s.itemsOptions,onChange:c=>{const u={...e,[s.field]:c};n(u)},label:s.label,value:e[s.field]||"String",leftAddon:s.leftAddon&&s.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[s.field]})})})})]})}),he="_other_g74jx_1",_e="_subtitle_g74jx_7",je="_items_g74jx_14",xt={other:he,subtitle:_e,items:je},lt=d=>{const{items:i,title:e="Other"}=d;return t.jsxRuntimeExports.jsxs("div",{className:xt.other,children:[t.jsxRuntimeExports.jsx("h5",{className:xt.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:xt.items,children:i.map((n,o)=>t.jsxRuntimeExports.jsx(t.Switch,{current:n.isItem,onChange:r=>n.setIsItem(r),label:n.label,hasBackground:!0,paddingless:!1},o))})]})},ge=d=>{const{index:i,moveProduct:e,children:n}=d,[,o]=t.useDrop({accept:"product",hover(s){s.index!==i&&(e(s.index,i),s.index=i)}}),[{isDragging:r},a]=t.useDrag({type:"product",item:{index:i},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>a(o(s)),className:`${H.product} ${r?H.dragging:""}`,children:n})},_t=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:a,subtitle:s,editable:c=!0,draggable:u=!1,withImage:R=!1,deletable:l=!0,addable:S=!0,itemsType:j,itemsPlaceholder:h="",itemsOptions:p,hasRangeSelector:B=!1,rangeSelectorOptions:P,modalOptions:g,addableOptions:A={},limit:$,autoScrollInterval:w}=d,[_,b]=m.useState(null),[L,E]=m.useState({top:0,left:0}),[v,I]=m.useState(null),O=m.useRef(null),[q,F]=m.useState(!1),J=(x,N)=>{const y=[...n],[Y]=y.splice(x,1);y.splice(N,0,Y),o(y)};m.useEffect(()=>{const x=()=>{b(null),F(!1)};return document.body.addEventListener("click",x),b(null),F(!1),()=>{b(null),F(!1),document.body.removeEventListener("click",x)}},[]),m.useEffect(()=>{if(_){const x=[...n].map(N=>N.id===_.id?_:N);o(x)}},[_]),m.useEffect(()=>{if(O.current&&v){const x=O.current.getBoundingClientRect().height,N=window.innerHeight;let y=v.top;y+x>N+window.scrollY&&(y=N+window.scrollY-x-200),y<0&&(y=10),E({top:y,left:v.left})}},[O.current,v]);const tt=(x,N)=>{x.stopPropagation();const y=x.target.getBoundingClientRect();I({top:y.top+window.scrollY,left:y.left-30}),b(N),F(!0)};function f(x){if(R)return x?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${x[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const T=(x,N)=>{var Y;const y=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),j==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:D=>{const st=[...n].map(Q=>Q.id===x.id?{...x,name:D}:Q);b({...x,name:D}),o([...st])},value:x.name,options:p.filter(D=>!n.find(U=>U.name===D.name)).map(D=>D.name),leftAddon:f(x.images)}),j==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:D=>{const st=[...n].map(Q=>Q.id===x.id?{...x,name:D}:Q);o([...st])},value:x.name,placeholder:h}),j==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:D=>{const st=[...n].map(Q=>Q.id===x.id?{...x,images:D}:Q);o([...st])},activeImage:(Y=n.find(D=>D.id===x.id))==null?void 0:Y.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:H.buttons,children:[c&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:D=>tt(D,x)}),l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter(D=>D.id!==x.id))})]})]});return u?t.jsxRuntimeExports.jsx(ge,{product:x,index:N,moveProduct:J,children:y},x.id):t.jsxRuntimeExports.jsx("div",{className:H.product,children:y},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(a||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[a&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:a}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:x=>e==null?void 0:e(x)})]}),_&&c&&g&&q&&t.jsxRuntimeExports.jsx(me,{ref:O,activeItem:_,setActiveItem:b,popupPosition:L,modalOptions:g,setIsOpenModal:F}),B&&P&&t.jsxRuntimeExports.jsx(ut,{...P}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:s}),u?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((x,N)=>T(x,N))}):n.map((x,N)=>T(x,N)),S&&t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:t.clx(H.button,{[H.disabled]:!!($&&$<=n.length||n.length===(p==null?void 0:p.length))}),size:"s",disabled:!!($&&$<=n.length||n.length===(p==null?void 0:p.length)),onClick:()=>{const x=[...n];let N=null;if(p){for(let y=0;y<p.length;y++)if(!n.find(Y=>Y.id===p[y].id)){N=p[y];break}}j==="select"?x.push({name:N?N.name:p[0].name,id:(N==null?void 0:N.id)||p[0].id,...A}):j==="input"?x.push({name:"",id:t.v4(),...A}):x.push({name:`Image ${n.length+1}`,id:t.v4(),...A}),o(x)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(lt,{items:r}),w!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(w.scrollInterval),onChange:x=>w.setScrollInterval(Number(x)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},fe="_title_fyopx_1",be="_subtitle_fyopx_5",ve="_header_fyopx_12",Ee="_text_fyopx_13",Re="_productsBlock_fyopx_14",ye="_top_fyopx_26",Ie="_itemsBlock_fyopx_35",ke="_typeTexts_fyopx_41",$e="_block_fyopx_48",we="_active_fyopx_61",Ne="_products_fyopx_14",Ce="_product_fyopx_14",Se="_button_fyopx_80",Te="_disabled_fyopx_91",Be="_image_fyopx_95",Pe="_info_fyopx_102",Ae="_name_fyopx_114",Oe="_buttons_fyopx_118",qe="_modal_fyopx_125",De="_link_fyopx_145",Le="_modalOptions_fyopx_151",X={title:fe,subtitle:be,header:ve,text:Ee,productsBlock:Re,top:ye,itemsBlock:Ie,typeTexts:ke,block:$e,active:we,products:Ne,product:Ce,button:Se,disabled:Te,image:Be,info:Pe,name:Ae,buttons:Oe,modal:qe,link:De,modalOptions:Le},Me=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:a,subtitle:s,draggable:c=!1,withImage:u=!1,addable:R=!0,itemsOptions:l,hasRangeSelector:S=!1,rangeSelectorOptions:j,limit:h,autoScrollInterval:p}=d;function B(g){if(u)return g?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${g[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const P=g=>{const A=l.find(w=>w.id===g);if(!A)return;const $=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[c&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:w=>{const _=[...n],b=l.find(v=>v.name===w);if(!b)return;const L=b.id,E=_.map(v=>v===g?L:v);o([...E])},value:A.name,options:l.filter(w=>!n.find(_=>_===w.id)).map(w=>w.name),leftAddon:B(A.images)}),t.jsxRuntimeExports.jsx("div",{className:X.buttons,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter(w=>w!==g))})})]});return t.jsxRuntimeExports.jsx("div",{className:X.product,children:$},g)};return t.jsxRuntimeExports.jsxs("div",{className:X.productsBlock,children:[(a||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:X.top,children:[a&&t.jsxRuntimeExports.jsx("h3",{className:X.title,children:a}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:g=>e==null?void 0:e(g)})]}),S&&j&&t.jsxRuntimeExports.jsx(ut,{...j}),t.jsxRuntimeExports.jsxs("div",{className:X.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:s}),n.map(g=>P(g)),R&&t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:t.clx(X.button,{[X.disabled]:!!(h&&h<=n.length||n.length===l.length)}),size:"s",disabled:!!(h&&h<=n.length||n.length===l.length),onClick:()=>{const g=[...n];let A=null;if(l){for(let $=0;$<l.length;$++)if(!n.find(w=>w===l[$].id)){A=l[$];break}}g.push((A==null?void 0:A.id)||l[0].id),o(g)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(lt,{items:r}),p!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(p.scrollInterval),onChange:g=>p.setScrollInterval(Number(g)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},He="_title_fyopx_1",Fe="_subtitle_fyopx_5",Ve="_header_fyopx_12",Ue="_text_fyopx_13",ze="_productsBlock_fyopx_14",Ye="_top_fyopx_26",Ge="_itemsBlock_fyopx_35",We="_typeTexts_fyopx_41",Xe="_block_fyopx_48",Je="_active_fyopx_61",Qe="_products_fyopx_14",Ke="_product_fyopx_14",Ze="_button_fyopx_80",ts="_disabled_fyopx_91",es="_image_fyopx_95",ss="_info_fyopx_102",ns="_name_fyopx_114",os="_buttons_fyopx_118",is="_modal_fyopx_125",rs="_link_fyopx_145",as="_modalOptions_fyopx_151",V={title:He,subtitle:Fe,header:Ve,text:Ue,productsBlock:ze,top:Ye,itemsBlock:Ge,typeTexts:We,block:Xe,active:Je,products:Qe,product:Ke,button:Ze,disabled:ts,image:es,info:ss,name:ns,buttons:os,modal:is,link:rs,modalOptions:as},cs=m.forwardRef((d,i)=>{const{activeItem:e,setActiveItem:n,popupPosition:o,modalOptions:r,setIsOpenModal:a}=d;return t.jsxRuntimeExports.jsxs("div",{ref:i,className:V.modal,onClick:s=>{s.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{className:V.title,children:e.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{n(null),a(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:V.modalOptions,children:r.map(s=>{if(s.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[s.field],onChange:c=>{const u={...e,[s.field]:c};n(u)}},String(s.field));if(s.type==="text")return t.jsxRuntimeExports.jsx(mt,{typesText:e[s.field.type],setTypesText:c=>{const u={...e,[s.field.type]:c};n(u)},text:e[s.field.text]||"",setText:c=>{const u={...e,[s.field.text]:c};n(u)},subtitle:s.label});if(s.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const u={...e,[s.field]:c};n(u)},value:e[s.field]||"",label:s.label,placeholder:s.placeholder});if(s.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:V.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const u={...e,[s.field.text]:c};n(u)},value:e[s.field.text]||"",label:s.inputLabel,placeholder:s.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[s.field.switch]||!1,label:s.switchLabel,onChange:c=>{const u={...e,[s.field.switch]:c};n(u)}})]});if(s.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:s.itemsOptions,onChange:c=>{const u={...e,[s.field]:c};n(u)},label:s.label,value:e[s.field]||"String",leftAddon:s.leftAddon&&s.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[s.field]})})})})]})}),ls=d=>{const{index:i,moveProduct:e,children:n}=d,[,o]=t.useDrop({accept:"product",hover(s){s.index!==i&&(e(s.index,i),s.index=i)}}),[{isDragging:r},a]=t.useDrag({type:"product",item:{index:i},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>a(o(s)),className:`${V.product} ${r?V.dragging:""}`,children:n})},us=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:a,subtitle:s,editable:c=!0,draggable:u=!1,withImage:R=!1,deletable:l=!0,addable:S=!0,itemsType:j,itemsPlaceholder:h="",itemsOptions:p,hasRangeSelector:B=!1,rangeSelectorOptions:P,modalOptions:g,addableOptions:A={}}=d,[$,w]=m.useState(null),[_,b]=m.useState({top:0,left:0}),[L,E]=m.useState(null),v=m.useRef(null),[I,O]=m.useState(!1),q=(f,T)=>{const x=[...n],[N]=x.splice(f,1);x.splice(T,0,N),o(x)};m.useEffect(()=>{const f=()=>{w(null),O(!1)};return document.body.addEventListener("click",f),w(null),O(!1),()=>{w(null),O(!1),document.body.removeEventListener("click",f)}},[]),m.useEffect(()=>{if($){const f=[...n].map(T=>T.id===$.id?$:T);o(f)}},[$]),m.useEffect(()=>{if(v.current&&L){const f=v.current.getBoundingClientRect().height,T=window.innerHeight;let x=L.top;x+f>T+window.scrollY&&(x=T+window.scrollY-f-200),x<0&&(x=10),b({top:x,left:L.left})}},[v.current,L]);const F=(f,T)=>{f.stopPropagation();const x=f.target.getBoundingClientRect();E({top:x.top+window.scrollY,left:x.left-30}),w(T),O(!0)};function J(f){if(R)return f?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${f[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const tt=(f,T)=>{var N;const x=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),j==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:y=>{const D=[...n].map(U=>U.id===f.id?{...f,name:y}:U);w({...f,name:y}),o([...D])},value:f.name,options:p.filter(y=>!n.find(Y=>Y.name===y)),leftAddon:J(f.images)}),j==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:y=>{const D=[...n].map(U=>U.id===f.id?{...f,name:y}:U);o([...D])},value:f.name,placeholder:h}),j==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:y=>{const D=[...n].map(U=>U.id===f.id?{...f,images:y}:U);o([...D])},activeImage:(N=n.find(y=>y.id===f.id))==null?void 0:N.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:V.buttons,children:[c&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:y=>F(y,f)}),l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter(y=>y.id!==f.id))})]})]});return u?t.jsxRuntimeExports.jsx(ls,{product:f,index:T,moveProduct:q,children:x},f.id):t.jsxRuntimeExports.jsx("div",{className:V.product,children:x},f.id)};return t.jsxRuntimeExports.jsxs("div",{className:V.productsBlock,children:[(a||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[a&&t.jsxRuntimeExports.jsx("h3",{className:V.title,children:a}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:f=>e==null?void 0:e(f)})]}),$&&c&&g&&I&&t.jsxRuntimeExports.jsx(cs,{ref:v,activeItem:$,setActiveItem:w,popupPosition:_,modalOptions:g,setIsOpenModal:O}),B&&P&&t.jsxRuntimeExports.jsx(ut,{...P}),t.jsxRuntimeExports.jsxs("div",{className:V.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:s}),u?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((f,T)=>tt(f,T))}):n.map((f,T)=>tt(f,T)),S&&t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:V.button,size:"s",onClick:()=>{const f=[...n];let T=null;if(p){for(let x=0;x<p.length;x++)if(!n.find(N=>N.name===p[x])){T=p[x];break}}j==="select"?f.push({name:T||p[0],id:t.v4(),...A}):j==="input"?f.push({name:"",id:t.v4(),...A}):f.push({name:`Image ${n.length+1}`,id:t.v4(),...A}),o(f)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(lt,{items:r})]})},ds="_title_dkxs6_1",xs="_subtitle_dkxs6_5",ps="_header_dkxs6_12",ms="_text_dkxs6_13",hs="_productsBlock_dkxs6_14",_s="_buttonsBlock_dkxs6_15",js="_top_dkxs6_26",gs="_itemsBlock_dkxs6_35",fs="_typeTexts_dkxs6_41",bs="_block_dkxs6_48",vs="_active_dkxs6_60",Es="_products_dkxs6_14",Rs="_product_dkxs6_14",ys="_button_dkxs6_15",Is="_image_dkxs6_90",ks="_info_dkxs6_97",$s="_name_dkxs6_109",ws="_buttons_dkxs6_15",Ns="_modal_dkxs6_120",Cs="_other_dkxs6_140",Ss="_options_dkxs6_146",et={title:ds,subtitle:xs,header:ps,text:ms,productsBlock:hs,buttonsBlock:_s,top:js,itemsBlock:gs,typeTexts:fs,block:bs,active:vs,products:Es,product:Rs,button:ys,image:Is,info:ks,name:$s,buttons:ws,modal:Ns,other:Cs,options:Ss},Ts=m.forwardRef((d,i)=>{const{activeButton:e,setActiveButton:n,popupPosition:o}=d,[r,a]=m.useState(e.typesText),[s,c]=m.useState(e.destination),[u,R]=m.useState(e.page),[l,S]=m.useState(e.link||""),[j,h]=m.useState(e.text||""),[p,B]=m.useState(e.openInNewTab),{pages:P}=t.usePagesStore();return m.useEffect(()=>{n({...e,...{text:j,link:l,destination:s,typesText:r,page:u,openInNewTab:p}})},[r,s,l,j,u,p]),t.jsxRuntimeExports.jsxs("div",{className:et.modal,onClick:g=>{g.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},ref:i,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:e.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>n(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:et.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:g=>c(g),options:["Go to Page","Open Link"].filter(g=>g!==s),value:s}),s==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:g=>R(g),options:P?Object.values(P).filter(g=>g.name!==u).map(g=>g.name):[],value:u}):t.jsxRuntimeExports.jsx(t.Input,{onChange:g=>S(g),value:l,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:e.openInNewTab,label:"Open in new tab",onChange:g=>B(g)}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:g=>h(g),value:j,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(pt,{typesText:r,setTypesText:a})]})]})}),Bs="_subtitle_m8qel_1",Ps="_header_m8qel_8",As="_text_m8qel_9",Os="_productsBlock_m8qel_10",qs="_buttonsBlock_m8qel_11",Ds="_top_m8qel_23",Ls="_itemsBlock_m8qel_32",Ms="_typeTexts_m8qel_38",Hs="_block_m8qel_45",Fs="_active_m8qel_58",Vs="_products_m8qel_10",Us="_product_m8qel_10",zs="_button_m8qel_11",Ys="_image_m8qel_88",Gs="_info_m8qel_95",Ws="_name_m8qel_107",Xs="_buttons_m8qel_11",Js="_modal_m8qel_118",Qs="_other_m8qel_137",Ks="_options_m8qel_143",ot={subtitle:Bs,header:Ps,text:As,productsBlock:Os,buttonsBlock:qs,top:Ds,itemsBlock:Ls,typeTexts:Ms,block:Hs,active:Fs,products:Vs,product:Us,button:zs,image:Ys,info:Gs,name:Ws,buttons:Xs,modal:Js,other:Qs,options:Ks},jt=d=>{const{buttons:i,setButtons:e,deletable:n=!0,addable:o=!0}=d,[r,a]=m.useState(null),[s,c]=m.useState({top:0,left:0}),[u,R]=m.useState(null),l=m.useRef(null);m.useEffect(()=>{const j=()=>{a(null)};return document.body.addEventListener("click",j),a(null),()=>{a(null),document.body.removeEventListener("click",j)}},[]),m.useEffect(()=>{if(r){const j=[...i].map(h=>h.id===r.id?r:h);e(j)}},[r]),m.useEffect(()=>{if(l.current&&u){const j=l.current.getBoundingClientRect().height,h=window.innerHeight;let p=u.top;p+j>h+window.scrollY&&(p=h+window.scrollY-j-200),p<0&&(p=10),c({top:p,left:u.left})}},[l.current,u]);const S=(j,h)=>{j.stopPropagation();const p=j.target.getBoundingClientRect();R({top:p.top+window.scrollY,left:p.left-30}),a(h)};return t.jsxRuntimeExports.jsxs("div",{className:ot.products,children:[t.jsxRuntimeExports.jsx("h5",{className:ot.subtitle,children:"Button Type"}),i.map(j=>t.jsxRuntimeExports.jsxs("div",{className:ot.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:h=>{const B=[...i].map(P=>P.id===j.id?{...j,type:h}:P);e(B)},value:j.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:ot.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:h=>{S(h,j)}}),n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const h=i.filter(p=>p.id!==j.id);e(h)},width:20,height:20,fill:"#C12A2A"})]})]},j.id)),r&&t.jsxRuntimeExports.jsx(Ts,{ref:l,activeButton:r,setActiveButton:a,popupPosition:s}),o&&t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:ot.button,size:"s",onClick:()=>{const j=[...i];j.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:"Button Name",page:"home",openInNewTab:!0}),e(j)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Zs=d=>{const{isActiveButtons:i,setIsActiveButtons:e,buttons:n,setButtons:o}=d;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:et.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:r=>e(r)})]}),t.jsxRuntimeExports.jsx(jt,{buttons:n,setButtons:o})]})})},tn="_wrapper_m18qi_1",en="_subtitle_m18qi_7",sn="_content_m18qi_14",nn="_range_m18qi_22",on="_track_m18qi_27",rn="_progress_m18qi_36",an="_dots_m18qi_46",cn="_dot_m18qi_46",ln="_active_m18qi_65",un="_input_m18qi_77",dn="_countBlock_m18qi_91",xn="_count_m18qi_91",pn="_controls_m18qi_107",mn="_button_m18qi_113",M={wrapper:tn,subtitle:en,content:sn,range:nn,track:on,progress:rn,dots:an,dot:cn,active:ln,input:un,countBlock:dn,count:xn,controls:pn,button:mn},ut=d=>{const{label:i,min:e=1,max:n=4,step:o=1,count:r,setCount:a}=d,[s,c]=m.useState(!1),u=Array.from({length:(n-e)/o+1}),R=(r-e)/(n-e)*100,l=()=>{r<n&&a(r+o)},S=()=>{r>e&&a(r-o)},j=h=>{const p=e+h*o;a(p)};return t.jsxRuntimeExports.jsxs("div",{className:M.wrapper,children:[i&&t.jsxRuntimeExports.jsx("h5",{className:M.subtitle,children:i}),t.jsxRuntimeExports.jsxs("div",{className:M.content,children:[t.jsxRuntimeExports.jsxs("div",{className:M.range,children:[t.jsxRuntimeExports.jsx("div",{className:M.track}),t.jsxRuntimeExports.jsx("div",{className:M.progress,style:{width:`${R}%`}}),t.jsxRuntimeExports.jsx("div",{className:M.dots,children:u.map((h,p)=>{const B=p<=(r-e)/o;return t.jsxRuntimeExports.jsx("button",{onClick:()=>j(p),className:t.clx(M.dot,{[M.active]:B,[M.inactive]:!B,[M.dragging]:s}),"aria-label":`Set value to ${e+p*o}`},p)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:n,step:o,value:r,onChange:h=>a(Number(h.target.value)),onMouseDown:()=>c(!0),onMouseUp:()=>c(!1),onTouchStart:()=>c(!0),onTouchEnd:()=>c(!1),className:M.input})]}),t.jsxRuntimeExports.jsxs("div",{className:M.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:n,paddingless:!0,onChange:h=>{const p=Number(h);p>n?a(n):p<e?a(e):a(p)},value:String(r)}),t.jsxRuntimeExports.jsxs("div",{className:M.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:l,disabled:r>=n,className:M.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:S,disabled:r<=e,className:M.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},hn="_title_1hw31_1",_n="_subtitle_1hw31_5",jn="_header_1hw31_12",gn="_text_1hw31_13",fn="_productsBlock_1hw31_14",bn="_top_1hw31_26",vn="_itemsBlock_1hw31_35",En="_typeTexts_1hw31_41",Rn="_block_1hw31_48",yn="_active_1hw31_61",In="_products_1hw31_14",kn="_product_1hw31_14",$n="_button_1hw31_80",wn="_image_1hw31_91",Nn="_info_1hw31_98",Cn="_name_1hw31_110",Sn="_buttons_1hw31_114",Tn="_modal_1hw31_121",Bn="_link_1hw31_141",Pn="_modalOptions_1hw31_147",z={title:hn,subtitle:_n,header:jn,text:gn,productsBlock:fn,top:bn,itemsBlock:vn,typeTexts:En,block:Rn,active:yn,products:In,product:kn,button:$n,image:wn,info:Nn,name:Cn,buttons:Sn,modal:Tn,link:Bn,modalOptions:Pn},An=d=>{const{activeItem:i,setActiveItem:e,popupPosition:n,setIsOpenModal:o,itemsOptions:r}=d,a=r.find(c=>c.id===i.listingId);if(!a)return null;function s(c,u){return c.length>u?`${c.slice(0,u)}...`:c}return t.jsxRuntimeExports.jsxs("div",{className:z.modal,onClick:c=>{c.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s(a.productData.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{o(!1),e(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:z.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:a.productData.images.length>0?a.productData.images[0].cfId:void 0,onChange:c=>{const u={...i,image:c[0]};e(u)}})})]})},On=d=>{const{index:i,moveProduct:e,children:n}=d,[,o]=t.useDrop({accept:"product",hover(s){s.index!==i&&(e(s.index,i),s.index=i)}}),[{isDragging:r},a]=t.useDrag({type:"product",item:{index:i},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>a(o(s)),className:`${z.product} ${r?z.dragging:""}`,children:n})},qn=d=>{const{isActiveItems:i,setIsActiveItems:e,items:n,setItems:o,other:r,title:a,subtitle:s,editable:c=!0,draggable:u=!1,withImage:R=!1,deletable:l=!0,addable:S=!0,itemsType:j,itemsOptions:h}=d,[p,B]=m.useState(null),[P,g]=m.useState({top:0,left:0}),[A,$]=m.useState(!1),w=(E,v)=>{const I=[...n],[O]=I.splice(E,1);I.splice(v,0,O),o(I)};m.useEffect(()=>{const E=()=>{B(null),$(!1)};return document.body.addEventListener("click",E),B(null),$(!1),()=>{B(null),$(!1),document.body.removeEventListener("click",E)}},[]),m.useEffect(()=>{if(p){const E=[...n].map(v=>v.listingId===p.listingId?p:v);o(E)}},[p]);const _=(E,v)=>{E.stopPropagation();const I=E.target.getBoundingClientRect(),O=100,q=window.innerHeight;let F=I.top+window.scrollY;F+O>q&&(F=q-O-20),$(!0),g({top:F-80,left:I.left-30}),B(v)};function b(E){if(R)return E?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${E}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const L=(E,v)=>{const I=h.find(q=>E.listingId===q.id);if(!I)return null;const O=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})},v),j==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:q=>{const F=[...n],J=h.find(T=>T.productData.name===q);if(!J)return;const tt={listingId:J.id,image:J.productData.images.length>0?J.productData.images[0].cfId:""},f=F.map(T=>T.listingId===E.listingId?tt:T);B(tt),o([...f])},value:I.productData.name,options:[...h.filter(q=>!n.find(F=>F.listingId===q.id)).map(q=>q.productData.name)],leftAddon:b(E.image||I.productData.images.length>0&&I.productData.images[0].cfId||"")},v),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[c&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:q=>_(q,E)}),l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(n.filter(q=>q!==E))})]})]});return u?t.jsxRuntimeExports.jsx(On,{product:E,index:v,moveProduct:w,children:O},E.listingId):t.jsxRuntimeExports.jsx("div",{className:z.product,children:O},E.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(a||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[a&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:a}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:E=>e==null?void 0:e(E)})]}),A&&p&&t.jsxRuntimeExports.jsx(An,{activeItem:p,setActiveItem:B,setIsOpenModal:$,popupPosition:P,itemsOptions:h}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:s}),u?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((E,v)=>L(E,v))}):n.map((E,v)=>L(E,v)),S&&t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:z.button,size:"s",onClick:()=>{const E=[...n];for(let v=0;v<h.length;v++)if(!n.find(I=>I.listingId===h[v].id)){E.push({listingId:h[v].id,image:h[v].productData.images.length>0?h[v].productData.images[0].cfId:""});break}o(E)},disabled:n.length===h.length,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(lt,{items:r})]})},Dn="_options_1w11v_1",Ln="_price_1w11v_12",Mn="_oldPrice_1w11v_19",Hn="_newPrice_1w11v_27",Fn="_animate_1w11v_34",Vn="_appearAndBounce_1w11v_1",Un="_meta_1w11v_52",zn="_info_1w11v_58",Yn="_infoRight_1w11v_66",Gn="_buttons_1w11v_73",Wn="_variants_1w11v_80",Xn="_variant_1w11v_80",Jn="_stock_1w11v_97",Qn="_variantInfo_1w11v_104",Kn="_quantity_1w11v_110",Zn="_count_1w11v_117",to="_focused_1w11v_134",eo="_button_1w11v_73",so="_activeVariant_1w11v_160",no="_chargeTypes_1w11v_164",oo="_charge_1w11v_164",io="_chargeActive_1w11v_185",ro="_title_1w11v_190",k={options:Dn,price:Ln,oldPrice:Mn,newPrice:Hn,animate:Fn,appearAndBounce:Vn,meta:Un,info:zn,infoRight:Yn,buttons:Gn,variants:Wn,variant:Xn,stock:Jn,variantInfo:Qn,quantity:Kn,count:Zn,focused:to,button:eo,activeVariant:so,chargeTypes:no,charge:oo,chargeActive:io,title:ro};var gt=(d=>(d.ONE_TIME="One-Time",d.RECURRING="Subscribe & Save",d))(gt||{});const ao=d=>{var $,w;const{variants:i}=d,[e,n]=m.useState(i[0]),[o,r]=m.useState(e.chargeTypes[0]),a=t.useNavigate(),[s,c]=m.useState(1),[u,R]=m.useState(!1),{reset:l,addProductToCart:S,getProducts:j}=t.useCart(),[h,p]=m.useState(!1);m.useEffect(()=>{p(!0);const _=setTimeout(()=>p(!1),600);return()=>clearTimeout(_)},[s]);async function B(){await j(),await S({productId:d.id,productVariantId:e.id,quantity:s})}function P(){l(),B(),a("/checkout")}function g(_){if(_>=864e5){const I=Math.floor(_/864e5);return`${I} ${I===1?"day":"days"}`}else if(_>=36e5){const I=Math.floor(_/36e5);return`${I} ${I===1?"hour":"hours"}`}else if(_>=6e4){const I=Math.floor(_/6e4);return`${I} ${I===1?"minute":"minutes"}`}else{const I=Math.floor(_/1e3);return`${I} ${I===1?"second":"seconds"}`}}function A(_,b){return _.length>b?_.slice(0,b)+"...":_}return t.jsxRuntimeExports.jsxs("div",{className:k.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:k.chargeTypes,children:e.chargeTypes.map(_=>t.jsxRuntimeExports.jsx("div",{className:t.clx(k.charge,{[k.chargeActive]:o===_}),onClick:()=>r(_),children:gt[_]},_))}),t.jsxRuntimeExports.jsx("div",{className:k.variants,children:i.map(_=>{var b;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(k.variant,{[k.activeVariant]:e.id===_.id}),onClick:()=>n(_),children:[t.jsxRuntimeExports.jsxs("div",{className:k.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:k.title,children:A(_.name,15)}),t.jsxRuntimeExports.jsxs("span",{children:["$",o==="ONE_TIME"?_.price.amount:_.subscriptionSettings?_.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:k.stock,children:[((b=_.quantity.restrictions)==null?void 0:b.max)||_.quantity.available||0," in stock"]})})]},_.id)})}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:k.quantity,children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>{s>1?c(_=>_-1):c(1)},className:k.button,disabled:e.quantity.restrictions&&s<=e.quantity.restrictions.min,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("label",{className:t.clx(k.count,{[k.focused]:u}),onFocus:()=>R(!0),onBlur:()=>R(!1),children:t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(s),onChange:_=>c(Number(_)),max:(($=e.quantity.restrictions)==null?void 0:$.max)||e.quantity.available||1/0,min:((w=e.quantity.restrictions)==null?void 0:w.min)||0,style:{backgroundColor:"transparent",border:"none",textAlign:"center"}})}),t.jsxRuntimeExports.jsx("button",{onClick:()=>{c(_=>_+1)},className:k.button,disabled:!!(e.quantity.restrictions&&s>=e.quantity.restrictions.max||e.quantity.available&&s>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:k.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:k.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:k.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:!e.deliveryTime||e.deliveryTime===0?"Instant":g(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:k.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:k.infoRight,children:o==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:k.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:h}),children:["$ ",(e.price.amount||0)*s]}),t.jsxRuntimeExports.jsxs("span",{className:k.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*s]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:h}),children:["$ ",(e.price.amount||0)*s]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:k.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:h}),children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:k.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:h}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:k.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>P(),children:t.jsxRuntimeExports.jsx("span",{children:o==="ONE_TIME"?"Buy Now":"Subscribe Now"})}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>B(),children:"Add to Cart"})]})]})},co="_button_1861a_1",lo="_login_1861a_14",uo="_signUp_1861a_18",xo="_buttons_1861a_23",po="_modal_1861a_32",mo="_info_1861a_60",ho="_top_1861a_67",_o="_title_1861a_78",jo="_clear_1861a_84",go="_activeClear_1861a_91",fo="_count_1861a_95",bo="_cart_1861a_110",vo="_empty_1861a_118",Eo="_product_1861a_144",Ro="_products_1861a_153",yo="_image_1861a_161",Io="_productInfo_1861a_167",ko="_content_1861a_174",$o="_name_1861a_180",wo="_price_1861a_186",No="_productButtons_1861a_192",Co="_productButton_1861a_192",So="_productCount_1861a_212",To="_bottom_1861a_228",Bo="_subtotal_1861a_236",Po="_block_1861a_244",Ao="_shoppingCount_1861a_251",Oo="_total_1861a_271",qo="_link_1861a_277",Do="_userInfo_1861a_284",C={button:co,login:lo,signUp:uo,buttons:xo,modal:po,info:mo,top:ho,title:_o,clear:jo,activeClear:go,count:fo,cart:bo,empty:vo,product:Eo,products:Ro,image:yo,productInfo:Io,content:ko,name:$o,price:wo,productButtons:No,productButton:Co,productCount:So,bottom:To,subtotal:Bo,block:Po,shoppingCount:Ao,total:Oo,link:qo,userInfo:Do},Lo="_button_bymeg_1",Mo="_primary_bymeg_19",Ho="_primaryHovered_bymeg_30",Fo="_secondary_bymeg_34",Vo="_secondaryHovered_bymeg_44",Uo="_tertiary_bymeg_48",zo="_tertiaryHovered_bymeg_58",Yo="_content_bymeg_62",K={button:Lo,primary:Mo,primaryHovered:Ho,secondary:Fo,secondaryHovered:Vo,tertiary:Uo,tertiaryHovered:zo,content:Yo},ct=d=>{const{children:i,onClick:e,style:n,className:o,disabled:r=!1,type:a="Primary"}=d,{themeSettings:s}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("button",{className:t.clx(K.button,o,{[K.primary]:a==="Primary",[K.secondary]:a==="Secondary",[K.tertiary]:a==="Tertiary",[K.primaryHovered]:a==="Primary"&&!r&&s.buttons.primary.hover,[K.secondaryHovered]:a==="Secondary"&&!r&&s.buttons.secondary.hover,[K.tertiaryHovered]:a==="Tertiary"&&!r&&s.buttons.tertiary.hover}),onClick:e,style:{...n},disabled:r,children:a==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:K.content,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"#757575",width:20,height:20}),i]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:i})})};class rt extends Error{}rt.prototype.name="InvalidTokenError";function Go(d){return decodeURIComponent(atob(d).replace(/(.)/g,(i,e)=>{let n=e.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function Wo(d){let i=d.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Go(i)}catch{return atob(i)}}function Xo(d,i){if(typeof d!="string")throw new rt("Invalid token specified: must be a string");i||(i={});const e=i.header===!0?0:1,n=d.split(".")[e];if(typeof n!="string")throw new rt(`Invalid token specified: missing part #${e+1}`);let o;try{o=Wo(n)}catch(r){throw new rt(`Invalid token specified: invalid base64 for part #${e+1} (${r.message})`)}try{return JSON.parse(o)}catch(r){throw new rt(`Invalid token specified: invalid json for part #${e+1} (${r.message})`)}}const Jo=d=>{const{shopping:i,signUp:e}=d,n=t.useNavigate();function o(a){n(a)}const r=JSON.parse(localStorage.getItem("token")||"{}");return t.jsxRuntimeExports.jsxs("div",{className:C.buttons,children:[i&&t.jsxRuntimeExports.jsx(ft,{}),!r.data&&t.jsxRuntimeExports.jsx(ct,{onClick:()=>o("/customer-dash"),type:"Secondary",style:{padding:10},children:"Login"}),!r.data&&e&&t.jsxRuntimeExports.jsx(ct,{onClick:()=>o("/customer-dash"),type:"Primary",style:{padding:10},children:"Sign Up"}),r.data&&t.jsxRuntimeExports.jsx(Et,{token:r.data})]})},ft=()=>{const[d,i]=m.useState(!1),[e,n]=m.useState([]),{cart:o,getProducts:r}=t.useCart();function a(R){for(let l=0;l<o.parts.length;l++)for(let S=0;S<R.variants.length;S++)if(o.parts[l].productVariantId===R.variants[l].id)return o.parts[l].productVariantId}function s(R){for(let l=0;l<o.parts.length;l++)for(let S=0;S<R.variants.length;S++)if(o.parts[l].productVariantId===R.variants[l].id)return o.parts[l].quantity}m.useEffect(()=>{(async()=>{const l=o.parts.map(h=>String(h.productId)),j=(await r([...l])).map(h=>({...h,activeVariantId:a(h),quantity:s(h)}));n(j)})()},[o]);function c(R){var l;return!R||!(R!=null&&R.variants)?!1:(l=R.variants.find(S=>S.id===R.activeVariantId))==null?void 0:l.subscriptionSettings}const u=o.parts.length>0&&e.length>0&&!c(e[0]);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:C.button,onClick:R=>{R.stopPropagation(),window.location.pathname!=="/admin/builder"&&i(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),u&&t.jsxRuntimeExports.jsx("div",{className:C.shoppingCount,children:o.parts.length})]}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:i,children:t.jsxRuntimeExports.jsx(bt,{activeProducts:e,isCartNotEmpty:u})})]})},bt=d=>{const{activeProducts:i,isCartNotEmpty:e}=d,{cart:n,reset:o,getTotalAndDiscount:r,updateQuantityOfProduct:a}=t.useCart(),s=t.useNavigate();function c(l){s(l)}function u(l){a({productId:l.id,productVariantId:l.activeVariantId,quantity:l.quantity+1})}function R(l){a({productId:l.id,productVariantId:l.activeVariantId,quantity:l.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:C.modal,onClick:l=>l.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:C.top,children:[t.jsxRuntimeExports.jsxs("div",{className:C.info,children:[t.jsxRuntimeExports.jsx("span",{className:C.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:C.count,children:n.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(C.clear,{[C.activeClear]:e}),disabled:!e,onClick:()=>o(),children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:C.cart,children:[t.jsxRuntimeExports.jsx("div",{className:C.products,children:i.map(l=>t.jsxRuntimeExports.jsxs("div",{className:C.product,children:[t.jsxRuntimeExports.jsxs("div",{className:C.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${l.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:C.image}),t.jsxRuntimeExports.jsxs("div",{className:C.content,children:[t.jsxRuntimeExports.jsx("div",{className:C.name,children:l.name}),t.jsxRuntimeExports.jsxs("div",{className:C.price,children:["$",l.variants.find(S=>S.id===l.activeVariantId).price.amount*((l==null?void 0:l.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:C.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{l.quantity!==1&&R(l)},className:C.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:C.productCount,children:l.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>u(l),className:C.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},l.id))}),t.jsxRuntimeExports.jsxs("div",{className:C.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:C.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:C.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsxs("div",{className:C.total,children:["$",r().total]})]}),t.jsxRuntimeExports.jsx(ct,{onClick:()=>c("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(vt,{})]})},vt=()=>t.jsxRuntimeExports.jsxs("div",{className:C.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"})}),t.jsxRuntimeExports.jsx("span",{children:"Your cart is empty"}),t.jsxRuntimeExports.jsxs("span",{children:["Check out the store's products and add them"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:C.link,children:"here"})]})]}),Et=({token:d})=>{const[i,e]=m.useState("test-email@gmail.com"),n=t.useNavigate();m.useEffect(()=>{(async()=>{const a=Xo(d);e(a.email)})()},[d]);function o(r){n(r)}return t.jsxRuntimeExports.jsx("div",{className:C.userInfo,onClick:()=>o("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:i||"test-email@gmail.com"})})},Qo="_share_9g414_1",Ko="_modal_9g414_8",Zo="_header_9g414_14",ti="_socials_9g414_24",ei="_social_9g414_24",si="_copy_9g414_34",ni="_title_9g414_41",oi="_copyWrapper_9g414_47",ii="_copyText_9g414_56",W={share:Qo,modal:Ko,header:Zo,socials:ti,social:ei,copy:si,title:ni,copyWrapper:oi,copyText:ii},ri=()=>{const{isOpenModal:d,setIsOpenModal:i}=t.useShareLinkStore();function e(){i(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button,{className:W.share,onClick:n=>{n.stopPropagation(),e()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:i,children:t.jsxRuntimeExports.jsx(ai,{})})]})},ht={facebook:"FacebookLogo","x.com":"TwitterLogo",telegram:"TelegramLogo",instagram:"InstagramLogo",discord:"MessengerLogo",tiktok:"TiktokLogo"},ai=()=>{const{setIsOpenModal:d}=t.useShareLinkStore(),{notification:i,setNotification:e}=t.useNotificationStore(),n=window.location.href;function o(){navigator.clipboard.writeText(n),e({message:"Link copied to clipboard",status:"success"})}return t.jsxRuntimeExports.jsxs("div",{className:W.modal,onClick:r=>r.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:W.header,children:[t.jsxRuntimeExports.jsx("div",{className:W.title,children:"Share this Post"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:()=>d(!1),hoverable:!0})]}),t.jsxRuntimeExports.jsx("div",{className:W.socials,children:Object.keys(ht).map(r=>t.jsxRuntimeExports.jsx("div",{className:W.social,children:t.jsxRuntimeExports.jsx(t.Icon,{name:ht[r]})}))}),t.jsxRuntimeExports.jsxs("div",{className:W.copyWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(W.copy,W.copyText),onClick:o,children:n}),t.jsxRuntimeExports.jsx("div",{onClick:o,className:W.copy,children:i?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},ci="_accordion_1s1lq_1",li="_header_1s1lq_9",ui="_icon_1s1lq_18",di="_open_1s1lq_21",xi="_content_1s1lq_25",it={accordion:ci,header:li,icon:ui,open:di,content:xi},pi=({title:d,content:i})=>{const[e,n]=m.useState(!1),[o,r]=m.useState(0),a=m.useRef(null),s=()=>{n(!e)};return m.useEffect(()=>{a.current&&r(e?a.current.scrollHeight:0)},[e]),t.jsxRuntimeExports.jsxs("div",{className:it.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:it.header,onClick:s,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:d}),t.jsxRuntimeExports.jsx("div",{className:t.clx(it.icon,{[it.open]:e}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:a,className:it.content,style:{height:`${o}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:i})})]})},mi="_wrapper_1r14x_1",hi="_label_1r14x_9",_i="_input_1r14x_18",ji="_required_1r14x_35",gi="_paddingless_1r14x_39",fi="_content_1r14x_43",bi="_borderless_1r14x_58",vi="_rightIcon_1r14x_63",Z={wrapper:mi,label:hi,input:_i,required:ji,paddingless:gi,content:fi,borderless:bi,rightIcon:vi},Ei=d=>{const{onChange:i,style:e,label:n,value:o,type:r,min:a,max:s,placeholder:c,disabled:u=!1,required:R=!1,regex:l,paddingless:S=!1,borderless:j=!1,editable:h=!1,isSearch:p=!1}=d,{themeSettings:B}=t.useThemeSettingsStore(),{inputs:P}=B,[g,A]=m.useState(!1);function $(b,L){if(b.startsWith("#")){let I,O,q;return b.length===7?(I=parseInt(b.slice(1,3),16),O=parseInt(b.slice(3,5),16),q=parseInt(b.slice(5,7),16)):b.length===4&&(I=parseInt(b[1]+b[1],16),O=parseInt(b[2]+b[2],16),q=parseInt(b[3]+b[3],16)),`rgba(${I}, ${O}, ${q}, ${L})`}const v={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#00ff00",blue:"#0000ff"}[b.toLowerCase()];return v?$(v,L):b}function w(b){return Number(b)<0?String(a):b}function _(b){return!R||!l?!0:new RegExp(l).test(b)}return t.jsxRuntimeExports.jsxs("div",{className:Z.wrapper,children:[n&&t.jsxRuntimeExports.jsx("label",{className:Z.label,htmlFor:n,children:n}),t.jsxRuntimeExports.jsxs("div",{className:Z.content,style:{paddingRight:P.general.height+15,...e,backgroundColor:$(P.field.color,P.field.opacity/100)},children:[t.jsxRuntimeExports.jsx("input",{id:n,type:r||"text",onChange:b=>{if(r==="text")i(b.target.value);else{const L=w(b.target.value);i(L)}},value:o,autoComplete:"off",placeholder:c||"Type something...",className:t.clx(Z.input,{[Z.required]:g&&R&&!_(o),[Z.paddingless]:S,[Z.borderless]:j}),min:r==="number"?a:void 0,max:r==="number"?s:void 0,disabled:u,onFocus:()=>A(!0)}),p&&t.jsxRuntimeExports.jsx("div",{className:Z.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:P.general.height,height:P.general.height})}),h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},Ri="_wrapper_st58d_1",yi="_label_st58d_10",Ii="_textarea_st58d_18",ki="_length_st58d_33",at={wrapper:Ri,label:yi,textarea:Ii,length:ki},$i=d=>{const{onChange:i,label:e,value:n,maxLength:o,placeholder:r="Type something..."}=d,[a,s]=m.useState(n.length);return t.jsxRuntimeExports.jsxs("div",{className:at.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:at.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:n,onChange:c=>{s(c.target.value.length),i(c.target.value)},placeholder:r,className:at.textarea,maxLength:o}),o&&t.jsxRuntimeExports.jsxs("div",{className:at.length,children:[a,"/",o]})]})};exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Select=t.Select;exports.Switch=t.Switch;exports.TextareaSettings=t.Textarea;exports.Accordion=pi;exports.Button=ct;exports.ButtonTypeSettings=jt;exports.ButtonsSettings=Zs;exports.CategorySettings=Me;exports.EmptyCart=vt;exports.FormSettings=us;exports.HeaderButtons=Jo;exports.InputUI=Ei;exports.ItemsSettings=_t;exports.LayoutSettings=Ot;exports.ListingSelector=qn;exports.ProductOptions=ao;exports.RangeSelector=ut;exports.ShareLink=ri;exports.ShoppingButton=ft;exports.ShoppingModalCart=bt;exports.TextSettings=mt;exports.TextareaUI=$i;exports.TypesText=pt;exports.UserInfo=Et;