@billgangcom/theme-lib 1.44.0 → 1.44.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./builder.cjs.js");exports.App=e.App;exports.ColorVariables=e.ColorVariables;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./builder.cjs.js"),o=require("./index-X-Olyqgp.cjs");exports.App=e.App;exports.ColorVariables=e.ColorVariables;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;exports.splitTextIntoSpans=o.splitTextIntoSpans;
package/dist/index.es.js CHANGED
@@ -1,7 +1,9 @@
1
- import { App as e, ColorVariables as r, hotReload as l, iconNames as p } from "./builder.es.js";
1
+ import { App as e, ColorVariables as p, hotReload as r, iconNames as s } from "./builder.es.js";
2
+ import { s as l } from "./index-CbgVRiD5.js";
2
3
  export {
3
4
  e as App,
4
- r as ColorVariables,
5
- l as hotReload,
6
- p as iconNames
5
+ p as ColorVariables,
6
+ r as hotReload,
7
+ s as iconNames,
8
+ l as splitTextIntoSpans
7
9
  };
@@ -9,7 +9,9 @@ export interface ButtonType {
9
9
  typesText: TextType[];
10
10
  destination: Destination;
11
11
  link?: string;
12
- text: string;
12
+ text: {
13
+ 'en-US': string;
14
+ };
13
15
  page: string;
14
16
  openInNewTab: boolean;
15
17
  }
@@ -48,9 +48,13 @@ interface ImageProps<T extends ItemBase> extends CommomPropsBase<T> {
48
48
  itemsOptions?: never;
49
49
  }
50
50
  type Props<T extends ItemBase> = SelectProps<T> | InputProps<T> | ImageProps<T>;
51
- interface FormItem extends ItemBase {
52
- placeholder?: string;
53
- title?: string;
51
+ export interface FormItem extends ItemBase {
52
+ placeholder?: {
53
+ 'en-US': string;
54
+ };
55
+ title?: {
56
+ 'en-US': string;
57
+ };
54
58
  type?: 'String' | 'Number';
55
59
  maxSymbols: number;
56
60
  withTitle?: boolean;
@@ -3,7 +3,9 @@ import { ModalOption } from './popup';
3
3
  import { Other } from '../OtherSettings';
4
4
  export interface ItemBase {
5
5
  images: string[];
6
- name: string;
6
+ name: {
7
+ 'en-US': string;
8
+ };
7
9
  id: string;
8
10
  }
9
11
  interface CommomPropsBase<T extends ItemBase> {
@@ -11,6 +11,7 @@ interface TextOption<T> {
11
11
  field: {
12
12
  type: keyof T;
13
13
  text: keyof T;
14
+ typeFont: keyof T;
14
15
  };
15
16
  }
16
17
  interface InputOption<T> {
@@ -0,0 +1 @@
1
+ export declare const ProductCardButtons: () => import("react/jsx-runtime").JSX.Element;
@@ -14,6 +14,7 @@ export * from './ShareLink';
14
14
  export * from './Accordion';
15
15
  export * from './Button';
16
16
  export * from './Link';
17
+ export * from './ProductCardButtons';
17
18
  export * from '../builder/ui';
18
19
  export { Input as InputSettings } from '../builder/ui/Input';
19
20
  export { Input as InputUI } from './Input';
package/dist/ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-D-lLRh8K.cjs"),g=require("react");require("@phosphor-icons/react");const wt="_wrapper_1ibay_2",St="_alignmentBlock_1ibay_8",Ct="_title_1ibay_15",Bt="_subtitle_1ibay_22",Tt="_alignmentContent_1ibay_29",Pt="_alignments_1ibay_37",Mt="_alignment_1ibay_8",At="_circle_1ibay_60",Ot="_paddings_1ibay_67",qt="_padding_1ibay_67",Lt="_active_1ibay_91",Dt="_input_1ibay_98",X={wrapper:wt,alignmentBlock:St,title:Ct,subtitle:Bt,alignmentContent:Tt,alignments:Pt,alignment:Mt,circle:At,paddings:Ot,padding:qt,active:Lt,input:Dt},Ht=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],zt=["left","top","right","bottom"],Ft=d=>{const{alignment:i,padding:e,setPadding:s,setAlignment:o}=d;function a(p){switch(p){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(p){switch(p){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[l,n]=g.useState(null),[r,h]=g.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:X.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:X.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:X.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:X.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:X.alignments,children:Ht.map(p=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{o(p)},className:X.alignment,onMouseEnter:()=>{n(p)},onMouseLeave:()=>{n(null)},children:[p!==i&&l!==p&&t.jsxRuntimeExports.jsx("div",{className:X.circle}),p!==i&&l===p&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(l),fill:"#c2c2c2",width:22,height:22}),p===i&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(i),fill:"#FF3F19",width:22,height:22})]},p))}),t.jsxRuntimeExports.jsx("div",{className:X.paddings,children:zt.map(p=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(X.padding,{[X.active]:r===p}),onFocus:()=>{h(p)},onBlur:()=>{h(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:c(p),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(e[p]),onChange:_=>s({...e,[p]:Number(_)}),paddingless:!0,borderless:!0})]},p))})]})]})]})},Vt="_title_1jkiw_1",Ut="_subtitle_1jkiw_5",Yt="_header_1jkiw_12",Gt="_text_1jkiw_13",Xt="_top_1jkiw_20",Wt="_itemsBlock_1jkiw_29",rt={title:Vt,subtitle:Ut,header:Yt,text:Gt,top:Xt,itemsBlock:Wt},Jt="_typeTexts_167ez_1",Qt="_block_167ez_8",Kt="_active_167ez_25",_t={typeTexts:Jt,block:Qt,active:Kt},Zt=["bold","italic","underline","strike-through","code"],jt=d=>{const{typesText:i,setTypesText:e}=d;function s(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:_t.typeTexts,children:Zt.map(o=>t.jsxRuntimeExports.jsx("div",{className:t.clx(_t.block,{[_t.active]:i.includes(o)}),onClick:()=>{const a=[...i];if(a.includes(o)){const c=a.filter(l=>l!==o);e(c)}else a.push(o),e(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:s(o),fill:i.includes(o)?"#252525":"#757575",width:20,height:20})},String(o)))})},ct={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",p:"Paragraph"},gt=d=>{const{typesText:i,isActiveText:e,setIsActiveText:s,text:o,setText:a,setTypesText:c,title:l,subtitle:n="Items",typeFont:r,setTypeFont:h}=d;return t.jsxRuntimeExports.jsxs("div",{className:rt.text,children:[(l||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:rt.top,children:[l&&t.jsxRuntimeExports.jsx("h3",{className:rt.title,children:l}),e!==void 0&&s&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:p=>s(p)})]}),t.jsxRuntimeExports.jsxs("div",{className:rt.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:rt.subtitle,children:n}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:p=>a(p),value:o,maxLength:150}),t.jsxRuntimeExports.jsx(jt,{typesText:i,setTypesText:c}),t.jsxRuntimeExports.jsx(t.Select,{label:"Type Text",options:Object.values(ct).filter(p=>p!==ct[r]),onChange:p=>h(Object.keys(ct).find(_=>ct[_]===p)),value:ct[r]})]})]})},te="_title_xma5o_1",ee="_subtitle_xma5o_5",se="_header_xma5o_12",ne="_text_xma5o_13",oe="_productsBlock_xma5o_14",ie="_top_xma5o_26",ae="_itemsBlock_xma5o_35",re="_typeTexts_xma5o_41",ce="_block_xma5o_48",le="_active_xma5o_61",de="_products_xma5o_14",ue="_product_xma5o_14",xe="_button_xma5o_80",me="_disabled_xma5o_91",pe="_image_xma5o_95",_e="_info_xma5o_102",he="_name_xma5o_114",je="_buttons_xma5o_118",ge="_modal_xma5o_125",fe="_link_xma5o_145",ve="_modalOptions_xma5o_151",be="_addButton_xma5o_165",Ee="_deleteButton_xma5o_180",Re="_closeIcon_xma5o_192",q={title:te,subtitle:ee,header:se,text:ne,productsBlock:oe,top:ie,itemsBlock:ae,typeTexts:re,block:ce,active:le,products:de,product:ue,button:xe,disabled:me,image:pe,info:_e,name:he,buttons:je,modal:ge,link:fe,modalOptions:ve,addButton:be,deleteButton:Ee,closeIcon:Re},ye=g.forwardRef((d,i)=>{const{activeItem:e,setActiveItem:s,popupPosition:o,modalOptions:a,setIsOpenModal:c}=d;function l(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:i,className:q.modal,onClick:n=>{n.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:q.top,children:[t.jsxRuntimeExports.jsx("h3",{className:q.title,children:l(e.name,20)}),t.jsxRuntimeExports.jsx("div",{className:q.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{s(null),c(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:q.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:r=>{const h={...e,[n.field]:r};s(h)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(gt,{typesText:e[n.field.type],setTypesText:r=>{const h={...e,[n.field.type]:r};s(h)},text:e[n.field.text]||"",setText:r=>{const h={...e,[n.field.text]:r};s(h)},typeFont:e[n.field.type],setTypeFont:r=>{const h={...e,[n.field.type]:r};s(h)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field]:r};s(h)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:q.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field.text]:r};s(h)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:r=>{const h={...e,[n.field.switch]:r};s(h)}})]});if(n.type==="list")return t.jsxRuntimeExports.jsx(vt,{items:e[n.field]||[],setItems:r=>{const h={...e,[n.field]:r};s(h)},itemsType:"select",draggable:n.draggable||!1,itemsOptions:n.itemsOptions,deletable:n.deletable||!1,editable:!1,subtitle:n.label,addableOptions:n.addableOptions});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:r=>{const h={...e,[n.field]:r};s(h)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})}),Ie="_other_g74jx_1",ke="_subtitle_g74jx_7",Ne="_items_g74jx_14",ht={other:Ie,subtitle:ke,items:Ne},mt=d=>{const{items:i,title:e="Other"}=d;return t.jsxRuntimeExports.jsxs("div",{className:ht.other,children:[t.jsxRuntimeExports.jsx("h5",{className:ht.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:ht.items,children:i.map((s,o)=>t.jsxRuntimeExports.jsx(t.Switch,{current:s.isItem,onChange:a=>s.setIsItem(a),label:s.label,hasBackground:!0,paddingless:!1},o))})]})};function $e({product:d,children:i}){const{attributes:e,listeners:s,setNodeRef:o,transform:a,transition:c,isDragging:l}=t.useSortable({id:d.id}),n={transform:t.CSS.Transform.toString(a),transition:c};return t.jsxRuntimeExports.jsx("div",{ref:o,style:n,className:`${q.product} ${l?q.dragging:""}`,...e,...s,children:i})}const vt=d=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:l,editable:n=!0,draggable:r=!1,withImage:h=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsPlaceholder:f="",itemsOptions:u,hasRangeSelector:N=!1,rangeSelectorOptions:L,modalOptions:v,addableOptions:P={},limit:j,autoScrollInterval:y}=d,[z,M]=g.useState(null),[Y,O]=g.useState({top:0,left:0}),[E,B]=g.useState(null),T=g.useRef(null),[G,S]=g.useState(!1),D=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));g.useEffect(()=>{const x=()=>{M(null),S(!1)};return document.body.addEventListener("click",x),M(null),S(!1),()=>{M(null),S(!1),document.body.removeEventListener("click",x)}},[]),g.useEffect(()=>{if(z){const x=[...s].map(R=>R.id===z.id?z:R);o(x)}},[z]),g.useEffect(()=>{if(T.current&&E){const x=T.current.getBoundingClientRect().height,R=window.innerHeight;let $=E.top;$+x>R+window.scrollY-200&&($=R+window.scrollY-x-200),$<0&&($=10),O({top:$,left:E.left})}},[T.current,E]);const Q=(x,R)=>{x.stopPropagation();const $=x.target.getBoundingClientRect();B({top:$.top+window.scrollY,left:$.left-30}),M(R),S(!0)};function nt(x){if(h)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 b=x=>{const{active:R,over:$}=x;if($&&R.id!==$.id){const A=s.findIndex(w=>w.id===R.id),V=s.findIndex(w=>w.id===$.id);if(A!==-1&&V!==-1){const w=[...s],[ot]=w.splice(A,1);w.splice(V,0,ot),o(w)}}},C=(x,R)=>{var A,V;const $=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&u&&t.jsxRuntimeExports.jsx(t.Select,{onChange:w=>{const ot=[...s],at=u.find(ut=>ut.name===w);if(!at)return;const it=ot.map(ut=>ut.id===x.id?{...at,name:w}:ut);M({...x,name:w}),o([...it])},value:x.name,options:u.filter(w=>!s.find(ot=>ot.name===w.name)).map(w=>w.name),leftAddon:nt(x.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:w=>{const at=[...s].map(it=>it.id===x.id?{...x,name:w}:it);o([...at])},value:x.name,placeholder:f}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:w=>{const at=[...s].map(it=>it.id===x.id?{...x,images:w}:it);o([...at])},activeImage:(A=s.find(w=>w.id===x.id))!=null&&A.images?(V=s.find(w=>w.id===x.id))==null?void 0:V.images[0]:void 0}),t.jsxRuntimeExports.jsxs("div",{className:q.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:q.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:w=>Q(w,x)})}),p&&t.jsxRuntimeExports.jsx("div",{className:q.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(w=>w.id!==x.id))})})]})]});return r?t.jsxRuntimeExports.jsx($e,{product:x,index:R,children:$},x.id):t.jsxRuntimeExports.jsx("div",{className:q.product,children:$},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:q.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:q.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:q.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:x=>e==null?void 0:e(x)})]}),z&&n&&v&&G&&t.jsxRuntimeExports.jsx(ye,{ref:T,activeItem:z,setActiveItem:M,popupPosition:Y,modalOptions:v,setIsOpenModal:S}),N&&L&&t.jsxRuntimeExports.jsx(pt,{...L}),t.jsxRuntimeExports.jsxs("div",{className:q.products,children:[l&&t.jsxRuntimeExports.jsx("h5",{className:q.subtitle,children:l}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:D,onDragEnd:b,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(x=>x.id),strategy:t.verticalListSortingStrategy,children:s.map((x,R)=>C(x,R))})}):s.map((x,R)=>C(x,R)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(q.button,{[q.disabled]:!!(j&&j<=s.length||s.length===(u==null?void 0:u.length))}),size:"s",disabled:!!(j&&j<=s.length||s.length===(u==null?void 0:u.length)),onClick:()=>{const x=[...s];let R=null;if(u){for(let $=0;$<u.length;$++)if(!s.find(A=>A.id===u[$].id)){R=u[$];break}}m==="select"&&u?x.push({name:R?R.name:u[0].name,id:(R==null?void 0:R.id)||u[0].id,...P}):m==="input"?x.push({name:"",id:t.v4(),...P}):x.push({name:`Image ${s.length+1}`,id:t.v4(),...P}),o(x)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:q.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a}),y!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(y.scrollInterval),onChange:x=>y.setScrollInterval(Number(x)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},we="_title_82zux_1",Se="_subtitle_82zux_5",Ce="_header_82zux_12",Be="_text_82zux_13",Te="_productsBlock_82zux_14",Pe="_top_82zux_26",Me="_itemsBlock_82zux_35",Ae="_typeTexts_82zux_41",Oe="_block_82zux_48",qe="_active_82zux_61",Le="_products_82zux_14",De="_product_82zux_14",He="_button_82zux_80",ze="_disabled_82zux_91",Fe="_image_82zux_95",Ve="_info_82zux_102",Ue="_name_82zux_114",Ye="_buttons_82zux_118",Ge="_modal_82zux_125",Xe="_link_82zux_145",We="_modalOptions_82zux_151",Je="_addButton_82zux_157",Qe="_deleteButton_82zux_179",W={title:we,subtitle:Se,header:Ce,text:Be,productsBlock:Te,top:Pe,itemsBlock:Me,typeTexts:Ae,block:Oe,active:qe,products:Le,product:De,button:He,disabled:ze,image:Fe,info:Ve,name:Ue,buttons:Ye,modal:Ge,link:Xe,modalOptions:We,addButton:Je,deleteButton:Qe},Ke=d=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:l,draggable:n=!1,withImage:r=!1,addable:h=!0,itemsOptions:p,hasRangeSelector:_=!1,rangeSelectorOptions:m,limit:f,autoScrollInterval:u}=d;function N(v){if(r)return v?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${v[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const L=v=>{const P=p.find(y=>y.id===v);if(!P)return;const j=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[n&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:y=>{const z=[...s],M=p.find(E=>E.name===y);if(!M)return;const Y=M.id,O=z.map(E=>E===v?Y:E);o([...O])},value:P.name,options:p.filter(y=>!s.find(z=>z===y.id)).map(y=>y.name),leftAddon:N(P.images)}),t.jsxRuntimeExports.jsx("div",{className:W.buttons,children:t.jsxRuntimeExports.jsx("div",{className:W.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(y=>y!==v))})})})]});return t.jsxRuntimeExports.jsx("div",{className:W.product,children:j},v)};return t.jsxRuntimeExports.jsxs("div",{className:W.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:W.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:W.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:v=>e==null?void 0:e(v)})]}),_&&m&&t.jsxRuntimeExports.jsx(pt,{...m}),t.jsxRuntimeExports.jsxs("div",{className:W.products,children:[l&&t.jsxRuntimeExports.jsx("h5",{className:W.subtitle,children:l}),s.map(v=>L(v)),h&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(W.button,{[W.disabled]:!!(f&&f<=s.length||s.length===p.length)}),size:"s",disabled:!!(f&&f<=s.length||s.length===p.length),onClick:()=>{const v=[...s];let P=null;if(p){for(let j=0;j<p.length;j++)if(!s.find(y=>y===p[j].id)){P=p[j];break}}v.push((P==null?void 0:P.id)||p[0].id),o(v)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:W.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a}),u!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(u.scrollInterval),onChange:v=>u.setScrollInterval(Number(v)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Ze="_title_1vfw9_1",ts="_subtitle_1vfw9_5",es="_header_1vfw9_12",ss="_text_1vfw9_13",ns="_productsBlock_1vfw9_14",os="_top_1vfw9_26",is="_itemsBlock_1vfw9_35",as="_typeTexts_1vfw9_41",rs="_block_1vfw9_48",cs="_active_1vfw9_61",ls="_products_1vfw9_14",ds="_product_1vfw9_14",us="_button_1vfw9_80",xs="_disabled_1vfw9_91",ms="_image_1vfw9_95",ps="_info_1vfw9_102",_s="_name_1vfw9_114",hs="_buttons_1vfw9_118",js="_modal_1vfw9_125",gs="_link_1vfw9_145",fs="_modalOptions_1vfw9_151",vs="_addButton_1vfw9_164",bs="_deleteButton_1vfw9_179",Es="_closeIcon_1vfw9_191",H={title:Ze,subtitle:ts,header:es,text:ss,productsBlock:ns,top:os,itemsBlock:is,typeTexts:as,block:rs,active:cs,products:ls,product:ds,button:us,disabled:xs,image:ms,info:ps,name:_s,buttons:hs,modal:js,link:gs,modalOptions:fs,addButton:vs,deleteButton:bs,closeIcon:Es},Rs=g.forwardRef((d,i)=>{const{activeItem:e,setActiveItem:s,popupPosition:o,modalOptions:a,setIsOpenModal:c}=d;function l(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:i,className:H.modal,onClick:n=>{n.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:l(e.name,20)}),t.jsxRuntimeExports.jsx("div",{className:H.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),c(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:H.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:r=>{const h={...e,[n.field]:r};s(h)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(gt,{typesText:e[n.field.type],setTypesText:r=>{const h={...e,[n.field.type]:r};s(h)},text:e[n.field.text]||"",setText:r=>{const h={...e,[n.field.text]:r};s(h)},typeFont:e[n.field.type],setTypeFont:r=>{const h={...e,[n.field.type]:r};s(h)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field]:r};s(h)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:H.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:r=>{const h={...e,[n.field.text]:r};s(h)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:r=>{const h={...e,[n.field.switch]:r};s(h)}})]});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:r=>{const h={...e,[n.field]:r};s(h)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})});function ys(d){const{product:i,children:e}=d,{attributes:s,listeners:o,setNodeRef:a,transform:c,transition:l,isDragging:n}=t.useSortable({id:i.id}),r={transform:t.CSS.Transform.toString(c),transition:l};return t.jsxRuntimeExports.jsx("div",{ref:a,style:r,className:`${H.product} ${n?H.dragging:""}`,...s,...o,children:e})}const Is=d=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:l,editable:n=!0,draggable:r=!1,withImage:h=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsPlaceholder:f="",itemsOptions:u,hasRangeSelector:N=!1,rangeSelectorOptions:L,modalOptions:v,addableOptions:P={}}=d,[j,y]=g.useState(null),[z,M]=g.useState({top:0,left:0}),[Y,O]=g.useState(null),E=g.useRef(null),[B,T]=g.useState(!1),G=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));g.useEffect(()=>{const b=()=>{y(null),T(!1)};return document.body.addEventListener("click",b),y(null),T(!1),()=>{y(null),T(!1),document.body.removeEventListener("click",b)}},[]),g.useEffect(()=>{if(j){const b=[...s].map(C=>C.id===j.id?j:C);o(b)}},[j]),g.useEffect(()=>{if(E.current&&Y){const b=E.current.getBoundingClientRect().height,C=window.innerHeight;let x=Y.top;x+b>C+window.scrollY-200&&(x=C+window.scrollY-b-200),x<0&&(x=10),M({top:x,left:Y.left})}},[E.current,Y]);const S=(b,C)=>{b.stopPropagation();const x=b.target.getBoundingClientRect();O({top:x.top+window.scrollY,left:x.left-30}),y(C),T(!0)};function D(b){if(h)return b?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${b[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Q=b=>{const{active:C,over:x}=b;if(x&&C.id!==x.id){const R=s.findIndex(A=>A.id===C.id),$=s.findIndex(A=>A.id===x.id);if(R!==-1&&$!==-1){const A=[...s],[V]=A.splice(R,1);A.splice($,0,V),o(A)}}},nt=b=>{var x;const C=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&u&&t.jsxRuntimeExports.jsx(t.Select,{onChange:R=>{const A=[...s].map(V=>V.id===b.id?{...b,name:R}:V);y({...b,name:R}),o([...A])},value:b.name,options:u.filter(R=>!s.find($=>$.name===R)),leftAddon:D(b.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:R=>{const A=[...s].map(V=>V.id===b.id?{...b,name:R}:V);o([...A])},value:b.name,placeholder:f}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:R=>{const A=[...s].map(V=>V.id===b.id?{...b,images:R}:V);o([...A])},activeImage:(x=s.find(R=>R.id===b.id))==null?void 0:x.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:H.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:R=>S(R,b)})}),p&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(R=>R.id!==b.id))})})]})]});return r?t.jsxRuntimeExports.jsx(ys,{product:b,children:C},b.id):t.jsxRuntimeExports.jsx("div",{className:H.product,children:C},b.id)};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:b=>e==null?void 0:e(b)})]}),j&&n&&v&&B&&t.jsxRuntimeExports.jsx(Rs,{ref:E,activeItem:j,setActiveItem:y,popupPosition:z,modalOptions:v,setIsOpenModal:T}),N&&L&&t.jsxRuntimeExports.jsx(pt,{...L}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[l&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:l}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:G,onDragEnd:Q,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(b=>b.id),strategy:t.verticalListSortingStrategy,children:s.map(b=>nt(b))})}):s.map(b=>nt(b)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:H.button,size:"s",onClick:()=>{const b=[...s];let C=null;if(u){for(let x=0;x<u.length;x++)if(!s.find(R=>R.name===u[x])){C=u[x];break}}m==="select"&&u?b.push({name:C||u[0],id:t.v4(),...P,maxSymbols:100}):m==="input"?b.push({name:"",id:t.v4(),...P,maxSymbols:100}):b.push({name:`Image ${s.length+1}`,id:t.v4(),...P,maxSymbols:100}),o(b)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:H.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a})]})},ks="_title_bn7sv_1",Ns="_subtitle_bn7sv_5",$s="_header_bn7sv_12",ws="_text_bn7sv_13",Ss="_productsBlock_bn7sv_14",Cs="_buttonsBlock_bn7sv_15",Bs="_top_bn7sv_26",Ts="_itemsBlock_bn7sv_35",Ps="_typeTexts_bn7sv_41",Ms="_block_bn7sv_48",As="_active_bn7sv_60",Os="_products_bn7sv_14",qs="_product_bn7sv_14",Ls="_button_bn7sv_15",Ds="_image_bn7sv_90",Hs="_info_bn7sv_97",zs="_name_bn7sv_109",Fs="_buttons_bn7sv_15",Vs="_modal_bn7sv_120",Us="_other_bn7sv_139",Ys="_options_bn7sv_145",Gs="_closeIcon_bn7sv_153",st={title:ks,subtitle:Ns,header:$s,text:ws,productsBlock:Ss,buttonsBlock:Cs,top:Bs,itemsBlock:Ts,typeTexts:Ps,block:Ms,active:As,products:Os,product:qs,button:Ls,image:Ds,info:Hs,name:zs,buttons:Fs,modal:Vs,other:Us,options:Ys,closeIcon:Gs},Xs=g.forwardRef((d,i)=>{const{activeButton:e,setActiveButton:s,popupPosition:o}=d,[a,c]=g.useState(e.typesText),[l,n]=g.useState(e.destination),[r,h]=g.useState(e.page),[p,_]=g.useState(e.link||""),[m,f]=g.useState(e.text||""),[u,N]=g.useState(e.openInNewTab),{pages:L}=t.usePagesStore();return g.useEffect(()=>{s({...e,...{text:m,link:p,destination:l,typesText:a,page:r,openInNewTab:u}})},[a,l,p,m,r,u]),t.jsxRuntimeExports.jsxs("div",{className:st.modal,onClick:v=>{v.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},ref:i,children:[t.jsxRuntimeExports.jsxs("div",{className:st.top,children:[t.jsxRuntimeExports.jsx("h3",{className:st.title,children:e.type}),t.jsxRuntimeExports.jsx("div",{className:st.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})})]}),t.jsxRuntimeExports.jsxs("div",{className:st.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:v=>n(v),options:["Go to Page","Open Link"].filter(v=>v!==l),value:l}),l==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:v=>h(v),options:L?Object.values(L).filter(v=>v.name!==r).map(v=>v.name):[],value:r}):t.jsxRuntimeExports.jsx(t.Input,{onChange:v=>_(v),value:p,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:e.openInNewTab,label:"Open in new tab",onChange:v=>N(v)}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:v=>f(v),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(jt,{typesText:a,setTypesText:c})]})]})}),Ws="_subtitle_jql1y_1",Js="_header_jql1y_8",Qs="_text_jql1y_9",Ks="_productsBlock_jql1y_10",Zs="_buttonsBlock_jql1y_11",tn="_top_jql1y_23",en="_itemsBlock_jql1y_32",sn="_typeTexts_jql1y_38",nn="_block_jql1y_45",on="_active_jql1y_58",an="_products_jql1y_10",rn="_product_jql1y_10",cn="_button_jql1y_11",ln="_image_jql1y_88",dn="_info_jql1y_95",un="_name_jql1y_107",xn="_buttons_jql1y_11",mn="_modal_jql1y_118",pn="_other_jql1y_138",_n="_options_jql1y_144",hn="_addButton_jql1y_150",jn="_deleteButton_jql1y_165",Z={subtitle:Ws,header:Js,text:Qs,productsBlock:Ks,buttonsBlock:Zs,top:tn,itemsBlock:en,typeTexts:sn,block:nn,active:on,products:an,product:rn,button:cn,image:ln,info:dn,name:un,buttons:xn,modal:mn,other:pn,options:_n,addButton:hn,deleteButton:jn},bt=d=>{const{buttons:i,setButtons:e,deletable:s=!0,addable:o=!0}=d,[a,c]=g.useState(null),[l,n]=g.useState({top:0,left:0}),[r,h]=g.useState(null),p=g.useRef(null);g.useEffect(()=>{const m=()=>{c(null)};return document.body.addEventListener("click",m),c(null),()=>{c(null),document.body.removeEventListener("click",m)}},[]),g.useEffect(()=>{if(a){const m=[...i].map(f=>f.id===a.id?a:f);e(m)}},[a]),g.useEffect(()=>{if(p.current&&r){const m=p.current.getBoundingClientRect().height,f=window.innerHeight;let u=r.top;u+m>f+window.scrollY-200&&(u=f+window.scrollY-m-200),u<0&&(u=10),n({top:u,left:r.left})}},[p.current,r]);const _=(m,f)=>{m.stopPropagation();const u=m.target.getBoundingClientRect();h({top:u.top+window.scrollY,left:u.left-30}),c(f)};return t.jsxRuntimeExports.jsxs("div",{className:Z.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Z.subtitle,children:"Button Type"}),i.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Z.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const N=[...i].map(L=>L.id===m.id?{...m,type:f}:L);e(N)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Z.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:Z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{_(f,m)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:Z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=i.filter(u=>u.id!==m.id);e(f)},width:20,height:20,fill:"#C12A2A"})})]})]},m.id)),a&&t.jsxRuntimeExports.jsx(Xs,{ref:p,activeButton:a,setActiveButton:c,popupPosition:l}),o&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:Z.button,size:"s",onClick:()=>{const m=[...i];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:"Button Name",page:"home",openInNewTab:!0}),e(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:Z.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},gn=d=>{const{isActiveButtons:i,setIsActiveButtons:e,buttons:s,setButtons:o}=d;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:st.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:st.top,children:[t.jsxRuntimeExports.jsx("h3",{className:st.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:a=>e(a)})]}),t.jsxRuntimeExports.jsx(bt,{buttons:s,setButtons:o})]})})},fn="_wrapper_m18qi_1",vn="_subtitle_m18qi_7",bn="_content_m18qi_14",En="_range_m18qi_22",Rn="_track_m18qi_27",yn="_progress_m18qi_36",In="_dots_m18qi_46",kn="_dot_m18qi_46",Nn="_active_m18qi_65",$n="_input_m18qi_77",wn="_countBlock_m18qi_91",Sn="_count_m18qi_91",Cn="_controls_m18qi_107",Bn="_button_m18qi_113",U={wrapper:fn,subtitle:vn,content:bn,range:En,track:Rn,progress:yn,dots:In,dot:kn,active:Nn,input:$n,countBlock:wn,count:Sn,controls:Cn,button:Bn},pt=d=>{const{label:i,min:e=1,max:s=4,step:o=1,count:a,setCount:c}=d,[l,n]=g.useState(!1),r=Array.from({length:(s-e)/o+1}),h=(a-e)/(s-e)*100,p=()=>{a<s&&c(a+o)},_=()=>{a>e&&c(a-o)},m=f=>{const u=e+f*o;c(u)};return t.jsxRuntimeExports.jsxs("div",{className:U.wrapper,children:[i&&t.jsxRuntimeExports.jsx("h5",{className:U.subtitle,children:i}),t.jsxRuntimeExports.jsxs("div",{className:U.content,children:[t.jsxRuntimeExports.jsxs("div",{className:U.range,children:[t.jsxRuntimeExports.jsx("div",{className:U.track}),t.jsxRuntimeExports.jsx("div",{className:U.progress,style:{width:`${h}%`}}),t.jsxRuntimeExports.jsx("div",{className:U.dots,children:r.map((f,u)=>{const N=u<=(a-e)/o;return t.jsxRuntimeExports.jsx("button",{onClick:()=>m(u),className:t.clx(U.dot,{[U.active]:N,[U.inactive]:!N,[U.dragging]:l}),"aria-label":`Set value to ${e+u*o}`},u)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:s,step:o,value:a,onChange:f=>c(Number(f.target.value)),onMouseDown:()=>n(!0),onMouseUp:()=>n(!1),onTouchStart:()=>n(!0),onTouchEnd:()=>n(!1),className:U.input})]}),t.jsxRuntimeExports.jsxs("div",{className:U.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:s,paddingless:!0,onChange:f=>{const u=Number(f);u>s?c(s):u<e?c(e):c(u)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:U.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:p,disabled:a>=s,className:U.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:_,disabled:a<=e,className:U.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},Tn="_title_ix5ax_1",Pn="_subtitle_ix5ax_5",Mn="_header_ix5ax_12",An="_text_ix5ax_13",On="_productsBlock_ix5ax_14",qn="_top_ix5ax_26",Ln="_itemsBlock_ix5ax_35",Dn="_typeTexts_ix5ax_41",Hn="_block_ix5ax_48",zn="_active_ix5ax_61",Fn="_products_ix5ax_14",Vn="_product_ix5ax_14",Un="_button_ix5ax_80",Yn="_image_ix5ax_91",Gn="_info_ix5ax_98",Xn="_name_ix5ax_110",Wn="_buttons_ix5ax_114",Jn="_modal_ix5ax_121",Qn="_link_ix5ax_141",Kn="_modalOptions_ix5ax_147",Zn="_addButton_ix5ax_160",to="_deleteButton_ix5ax_175",eo="_closeIcon_ix5ax_187",F={title:Tn,subtitle:Pn,header:Mn,text:An,productsBlock:On,top:qn,itemsBlock:Ln,typeTexts:Dn,block:Hn,active:zn,products:Fn,product:Vn,button:Un,image:Yn,info:Gn,name:Xn,buttons:Wn,modal:Jn,link:Qn,modalOptions:Kn,addButton:Zn,deleteButton:to,closeIcon:eo},so=d=>{const{activeItem:i,setActiveItem:e,popupPosition:s,setIsOpenModal:o,itemsOptions:a}=d,c=a.find(n=>n.id===i.listingId);if(!c)return null;function l(n,r){return n.length>r?`${n.slice(0,r)}...`:n}return t.jsxRuntimeExports.jsxs("div",{className:F.modal,onClick:n=>{n.stopPropagation()},style:{top:`${s.top}px`,left:`${s.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[t.jsxRuntimeExports.jsx("h3",{children:l(c.productData.name,20)}),t.jsxRuntimeExports.jsx("div",{className:F.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{o(!1),e(null)}})})]}),t.jsxRuntimeExports.jsx("div",{className:F.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:n=>{const r={...i,image:n[0]};e(r)}})})]})};function no(d){const{product:i,children:e}=d,{attributes:s,listeners:o,setNodeRef:a,transform:c,transition:l,isDragging:n}=t.useSortable({id:String(i.listingId)}),r={transform:t.CSS.Transform.toString(c),transition:l};return t.jsxRuntimeExports.jsx("div",{ref:a,style:r,className:`${F.product} ${n?F.dragging:""}`,...s,...o,children:e})}const oo=d=>{const{isActiveItems:i,setIsActiveItems:e,items:s,setItems:o,other:a,title:c,subtitle:l,editable:n=!0,draggable:r=!1,withImage:h=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsOptions:f}=d,[u,N]=g.useState(null),[L,v]=g.useState({top:0,left:0}),[P,j]=g.useState(!1),y=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));g.useEffect(()=>{const E=()=>{N(null),j(!1)};return document.body.addEventListener("click",E),N(null),j(!1),()=>{N(null),j(!1),document.body.removeEventListener("click",E)}},[]),g.useEffect(()=>{if(u){const E=[...s].map(B=>B.listingId===u.listingId?u:B);o(E)}},[u]);const z=(E,B)=>{E.stopPropagation();const T=E.target.getBoundingClientRect(),G=100,S=window.innerHeight;let D=T.top+window.scrollY;D+G>S&&(D=S-G-20),j(!0),v({top:D-80,left:T.left-30}),N(B)};function M(E){if(h)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 Y=E=>{const{active:B,over:T}=E;if(T&&B.id!==T.id){const G=s.findIndex(D=>String(D.listingId)===B.id),S=s.findIndex(D=>String(D.listingId)===T.id);if(G!==-1&&S!==-1){const D=[...s],[Q]=D.splice(G,1);D.splice(S,0,Q),o(D)}}},O=(E,B)=>{const T=f.find(S=>E.listingId===S.id);if(!T)return null;const G=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),m==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:S=>{const D=[...s],Q=f.find(C=>C.productData.name===S);if(!Q)return;const nt={listingId:Q.id,image:Q.productData.images.length>0?Q.productData.images[0].cfId:""},b=D.map(C=>C.listingId===E.listingId?nt:C);N(nt),o([...b])},value:T.productData.name,options:[...f.filter(S=>!s.find(D=>D.listingId===S.id)).map(S=>S.productData.name)],leftAddon:M(E.image||T.productData.images.length>0&&T.productData.images[0].cfId||"")},B),t.jsxRuntimeExports.jsxs("div",{className:F.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:S=>z(S,E)})}),p&&t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>o(s.filter(S=>S!==E))})})]})]});return r?t.jsxRuntimeExports.jsx(no,{product:E,children:G},E.listingId):t.jsxRuntimeExports.jsx("div",{className:F.product,children:G},E.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:F.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:F.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:E=>e==null?void 0:e(E)})]}),P&&u&&t.jsxRuntimeExports.jsx(so,{activeItem:u,setActiveItem:N,setIsOpenModal:j,popupPosition:L,itemsOptions:f}),t.jsxRuntimeExports.jsxs("div",{className:F.products,children:[l&&t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:l}),r?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:y,onDragEnd:Y,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(E=>String(E.listingId)),strategy:t.verticalListSortingStrategy,children:s.map((E,B)=>O(E,B))})}):s.map((E,B)=>O(E,B)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:F.button,size:"s",onClick:()=>{const E=[...s];for(let B=0;B<f.length;B++)if(!s.find(T=>T.listingId===f[B].id)){E.push({listingId:f[B].id,image:f[B].productData.images.length>0?f[B].productData.images[0].cfId:""});break}o(E)},disabled:s.length===f.length,style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:F.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(mt,{items:a})]})},io="_options_6cemk_1",ao="_price_6cemk_12",ro="_oldPrice_6cemk_19",co="_newPrice_6cemk_27",lo="_animate_6cemk_34",uo="_appearAndBounce_6cemk_1",xo="_meta_6cemk_52",mo="_info_6cemk_58",po="_infoRight_6cemk_66",_o="_buttons_6cemk_73",ho="_variants_6cemk_80",jo="_variant_6cemk_80",go="_stock_6cemk_98",fo="_variantInfo_6cemk_105",vo="_quantity_6cemk_111",bo="_count_6cemk_118",Eo="_focused_6cemk_135",Ro="_button_6cemk_73",yo="_activeVariant_6cemk_161",Io="_chargeTypes_6cemk_165",ko="_charge_6cemk_165",No="_chargeActive_6cemk_190",$o="_title_6cemk_198",k={options:io,price:ao,oldPrice:ro,newPrice:co,animate:lo,appearAndBounce:uo,meta:xo,info:mo,infoRight:po,buttons:_o,variants:ho,variant:jo,stock:go,variantInfo:fo,quantity:vo,count:bo,focused:Eo,button:Ro,activeVariant:yo,chargeTypes:Io,charge:ko,chargeActive:No,title:$o},wo="_wrapper_p74l6_1",So="_label_p74l6_9",Co="_input_p74l6_18",Bo="_paddingless_p74l6_31",To="_content_p74l6_35",Po="_contentBorder_p74l6_48",Mo="_borderless_p74l6_53",Ao="_rightIcon_p74l6_58",K={wrapper:wo,label:So,input:Co,paddingless:Bo,content:To,contentBorder:Po,borderless:Mo,rightIcon:Ao},Et=d=>{const{onChange:i,style:e,label:s,value:o,type:a,min:c,max:l,placeholder:n,disabled:r=!1,required:h=!1,regex:p,paddingless:_=!1,borderless:m=!1,editable:f=!1,isSearch:u=!1,centered:N=!1}=d,{themeSettings:L}=t.useThemeSettingsStore(),{inputs:v}=L,[P,j]=g.useState(!1);function y(M){return Number(M)<0?String(c):M}function z(M){return!h||!p?!0:new RegExp(p).test(M)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[s&&t.jsxRuntimeExports.jsx("label",{className:K.label,htmlFor:s,children:s}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.content,{[K.contentBorder]:v.border.active}),style:{paddingRight:u?v.general.height+15:"auto",...e,background:v.field.active?v.field.color:"transparent"},children:[t.jsxRuntimeExports.jsx("input",{id:s,type:a||"text",onChange:M=>{if(a==="text")i(M.target.value);else{const Y=y(M.target.value);i(Y)}},value:o,autoComplete:"off",placeholder:n||"Type something...",className:t.clx(K.input,{[K.required]:P&&h&&!z(o),[K.paddingless]:_,[K.borderless]:m}),min:a==="number"?c:void 0,max:a==="number"?l:void 0,disabled:r,onFocus:()=>j(!0),style:{textAlign:N?"center":"left"}}),u&&t.jsxRuntimeExports.jsx("div",{className:K.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:v.general.height,height:v.general.height})}),f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},Oo="_button_85085_1",qo="_primary_85085_20",Lo="_primaryHovered_85085_30",Do="_secondary_85085_34",Ho="_secondaryHovered_85085_44",zo="_tertiary_85085_48",Fo="_tertiaryHovered_85085_58",Vo="_content_85085_62",tt={button:Oo,primary:qo,primaryHovered:Lo,secondary:Do,secondaryHovered:Ho,tertiary:zo,tertiaryHovered:Fo,content:Vo},J=d=>{const{children:i,onClick:e,style:s,className:o,disabled:a=!1,type:c="Primary"}=d,{themeSettings:l}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("button",{className:t.clx(tt.button,o,{[tt.primary]:c==="Primary",[tt.secondary]:c==="Secondary",[tt.tertiary]:c==="Tertiary",[tt.primaryHovered]:c==="Primary"&&!a&&l.buttons.primary.hover,[tt.secondaryHovered]:c==="Secondary"&&!a&&l.buttons.secondary.hover,[tt.tertiaryHovered]:c==="Tertiary"&&!a&&l.buttons.tertiary.hover}),onClick:e,style:{...s},disabled:a,children:c==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:tt.content,children:[i,t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"var(--icon-tertiary)",width:20,height:20})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:i})})};var Rt=(d=>(d.ONE_TIME="One-Time",d.RECURRING="Subscribe & Save",d))(Rt||{});const Uo=d=>{var v,P;const{variants:i}=d,[e,s]=g.useState(i[0]),[o,a]=g.useState(e.chargeTypes[0]),c=t.useNavigate(),[l,n]=g.useState(1),{reset:r,addProductToCart:h,getProducts:p}=t.useCart(),[_,m]=g.useState(!1);g.useEffect(()=>{m(!0);const j=setTimeout(()=>m(!1),600);return()=>clearTimeout(j)},[l]);async function f(){await p(),await h({productId:d.id,productVariantId:e.id,quantity:l})}function u(){r(),f(),c("/checkout")}function N(j){if(j>=864e5){const O=Math.floor(j/864e5);return`${O} ${O===1?"day":"days"}`}else if(j>=36e5){const O=Math.floor(j/36e5);return`${O} ${O===1?"hour":"hours"}`}else if(j>=6e4){const O=Math.floor(j/6e4);return`${O} ${O===1?"minute":"minutes"}`}else{const O=Math.floor(j/1e3);return`${O} ${O===1?"second":"seconds"}`}}function L(j,y){return j.length>y?j.slice(0,y)+"...":j}return t.jsxRuntimeExports.jsxs("div",{className:k.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:k.chargeTypes,children:e.chargeTypes.map(j=>t.jsxRuntimeExports.jsx("div",{className:t.clx(k.charge,{[k.chargeActive]:o===j}),onClick:()=>a(j),children:Rt[j]},j))}),t.jsxRuntimeExports.jsx("div",{className:k.variants,children:i.map(j=>{var y;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(k.variant,{[k.activeVariant]:e.id===j.id}),onClick:()=>s(j),children:[t.jsxRuntimeExports.jsxs("div",{className:k.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:k.title,children:L(j.name,15)}),t.jsxRuntimeExports.jsxs("span",{children:["$",o==="ONE_TIME"?j.price.amount:j.subscriptionSettings?j.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:k.stock,children:[((y=j.quantity.restrictions)==null?void 0:y.max)||j.quantity.available||0," in stock"]})})]},j.id)})}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:k.quantity,children:[t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:()=>{l>1?n(j=>j-1):n(1)},className:k.button,disabled:e.quantity.restrictions&&l<=e.quantity.restrictions.min,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(Et,{type:"number",value:String(l),onChange:j=>n(Number(j)),max:((v=e.quantity.restrictions)==null?void 0:v.max)||e.quantity.available||1/0,min:((P=e.quantity.restrictions)==null?void 0:P.min)||0,centered:!0}),t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:()=>{n(j=>j+1)},className:k.button,disabled:!!(e.quantity.restrictions&&l>=e.quantity.restrictions.max||e.quantity.available&&l>=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":N(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]:_}),children:["$ ",(e.price.amount||0)*l]}),t.jsxRuntimeExports.jsxs("span",{className:k.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*l]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:_}),children:["$ ",(e.price.amount||0)*l]}):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]:_}),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]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:k.buttons,children:[t.jsxRuntimeExports.jsx(J,{type:"Primary",onClick:()=>u(),children:o==="ONE_TIME"?"Buy Now":"Subscribe Now"}),o==="ONE_TIME"&&t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:()=>f(),children:"Add to Cart"})]})]})},Yo="_button_1tdo3_1",Go="_login_1tdo3_14",Xo="_signUp_1tdo3_18",Wo="_buttons_1tdo3_23",Jo="_modal_1tdo3_32",Qo="_closing_1tdo3_64",Ko="_info_1tdo3_113",Zo="_top_1tdo3_120",ti="_title_1tdo3_131",ei="_clear_1tdo3_138",si="_activeClear_1tdo3_145",ni="_count_1tdo3_149",oi="_cart_1tdo3_164",ii="_empty_1tdo3_172",ai="_product_1tdo3_198",ri="_products_1tdo3_207",ci="_image_1tdo3_215",li="_productInfo_1tdo3_221",di="_content_1tdo3_228",ui="_name_1tdo3_234",xi="_price_1tdo3_240",mi="_productButtons_1tdo3_246",pi="_productButton_1tdo3_246",_i="_productCount_1tdo3_266",hi="_bottom_1tdo3_282",ji="_subtotal_1tdo3_290",gi="_block_1tdo3_298",fi="_shoppingCount_1tdo3_305",vi="_total_1tdo3_325",bi="_link_1tdo3_331",Ei="_userInfo_1tdo3_338",Ri="_pagesMobileModal_1tdo3_349",yi="_pagesMobileModalContent_1tdo3_363",Ii="_pagesMobileModalHeader_1tdo3_369",ki="_pagesMobileModalFooter_1tdo3_379",I={button:Yo,login:Go,signUp:Xo,buttons:Wo,modal:Jo,"slide-in-fade":"_slide-in-fade_1tdo3_1","mobile-slide-in-fade":"_mobile-slide-in-fade_1tdo3_1",closing:Qo,"mobile-slide-out-fade":"_mobile-slide-out-fade_1tdo3_1","slide-out-fade":"_slide-out-fade_1tdo3_1",info:Ko,top:Zo,title:ti,clear:ei,activeClear:si,count:ni,cart:oi,empty:ii,product:ai,products:ri,image:ci,productInfo:li,content:di,name:ui,price:xi,productButtons:mi,productButton:pi,productCount:_i,bottom:hi,subtotal:ji,block:gi,shoppingCount:fi,total:vi,link:bi,userInfo:Ei,pagesMobileModal:Ri,pagesMobileModalContent:yi,pagesMobileModalHeader:Ii,pagesMobileModalFooter:ki};class dt extends Error{}dt.prototype.name="InvalidTokenError";function Ni(d){return decodeURIComponent(atob(d).replace(/(.)/g,(i,e)=>{let s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function $i(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 Ni(i)}catch{return atob(i)}}function wi(d,i){if(typeof d!="string")throw new dt("Invalid token specified: must be a string");i||(i={});const e=i.header===!0?0:1,s=d.split(".")[e];if(typeof s!="string")throw new dt(`Invalid token specified: missing part #${e+1}`);let o;try{o=$i(s)}catch(a){throw new dt(`Invalid token specified: invalid base64 for part #${e+1} (${a.message})`)}try{return JSON.parse(o)}catch(a){throw new dt(`Invalid token specified: invalid json for part #${e+1} (${a.message})`)}}const Si=d=>{const{shopping:i,signUp:e,isShowUserInfo:s=!0}=d;return t.jsxRuntimeExports.jsxs("div",{className:I.buttons,children:[i&&t.jsxRuntimeExports.jsx(yt,{}),s&&t.jsxRuntimeExports.jsx(ft,{signUp:e})]})},yt=()=>{const[d,i]=g.useState(!1),[e,s]=g.useState([]),{cart:o,getProducts:a}=t.useCart();function c(_){for(let m=0;m<o.parts.length;m++)for(let f=0;f<_.variants.length;f++)if(o.parts[m].productVariantId===_.variants[m].id)return o.parts[m].productVariantId}function l(_){for(let m=0;m<o.parts.length;m++)for(let f=0;f<_.variants.length;f++)if(o.parts[m].productVariantId===_.variants[m].id)return o.parts[m].quantity}g.useEffect(()=>{(async()=>{const m=o.parts.map(N=>String(N.productId)),u=(await a([...m])).map(N=>({...N,activeVariantId:c(N),quantity:l(N)}));s(u)})()},[o.parts.length]);function n(_){var m;return!_||!(_!=null&&_.variants)?!1:(m=_.variants.find(f=>f.id===_.activeVariantId))==null?void 0:m.subscriptionSettings}const r=o.parts.length>0&&e.length>0&&!n(e[0]),[h,p]=g.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(J,{type:"Secondary",style:{padding:10},onClick:_=>{_.stopPropagation(),window.location.pathname!=="/admin/builder"&&(i(!0),p(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),r&&t.jsxRuntimeExports.jsx("div",{className:I.shoppingCount,children:o.parts.length})]}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>{p(!1),setTimeout(()=>{i(!1)},300)},withAnimation:!1,children:t.jsxRuntimeExports.jsx(It,{activeProducts:e,isCartNotEmpty:r,isOpen:h})})]})},It=d=>{const{activeProducts:i,isCartNotEmpty:e,isOpen:s}=d,{cart:o,reset:a,getTotalAndDiscount:c,updateQuantityOfProduct:l}=t.useCart(),n=t.useNavigate();function r(_){n(_)}function h(_){l({productId:_.id,productVariantId:_.activeVariantId,quantity:_.quantity+1})}function p(_){l({productId:_.id,productVariantId:_.activeVariantId,quantity:_.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(I.modal,{[I.closing]:!s}),onClick:_=>_.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:I.top,children:[t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{className:I.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:I.count,children:o.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(I.clear,{[I.activeClear]:e}),disabled:!e,onClick:a,children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:I.cart,children:[t.jsxRuntimeExports.jsx("div",{className:I.products,children:i.map(_=>t.jsxRuntimeExports.jsxs("div",{className:I.product,children:[t.jsxRuntimeExports.jsxs("div",{className:I.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${_.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:I.image}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsx("div",{className:I.name,children:_.name}),t.jsxRuntimeExports.jsxs("div",{className:I.price,children:["$",_.variants.find(m=>m.id===_.activeVariantId).price.amount*((_==null?void 0:_.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{_.quantity!==1&&p(_)},className:I.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:I.productCount,children:_.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>h(_),className:I.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},_.id))}),t.jsxRuntimeExports.jsxs("div",{className:I.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:I.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:I.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:I.total,children:["$",c().total]})]}),t.jsxRuntimeExports.jsx(J,{onClick:()=>r("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(kt,{})]})},kt=()=>t.jsxRuntimeExports.jsxs("div",{className:I.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-secondary)"})}),t.jsxRuntimeExports.jsx("span",{children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:I.link,children:"view products"})]})]}),ft=({signUp:d})=>{const i=JSON.parse(localStorage.getItem("token")||"{}"),{data:e}=i,s=t.useNavigate();function o(l){s(l)}if(!e)return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(J,{onClick:()=>o("/customer-dash"),type:"Secondary",style:{padding:10},children:"Login"}),d&&t.jsxRuntimeExports.jsx(J,{onClick:()=>o("/customer-dash"),type:"Primary",style:{padding:10},children:"Sign Up"})]});const[a,c]=g.useState("test-email@gmail.com");return g.useEffect(()=>{(async()=>{const n=wi(e);c(n.email)})()},[e]),t.jsxRuntimeExports.jsx("div",{className:I.userInfo,onClick:()=>o("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:a||"test-email@gmail.com"})})},Nt=({children:d,logo:i,setIsOpen:e,signUp:s})=>{const{setIsOpen:o}=t.useModalStore(),a=()=>{o(!1),setTimeout(()=>{e(!1),o(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:I.pagesMobileModal,onClick:c=>c.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:I.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:i}),t.jsxRuntimeExports.jsx(J,{type:"Secondary",onClick:a,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"var(--icon-primary)"})})]}),t.jsxRuntimeExports.jsx("div",{className:I.pagesMobileModalContent,children:d}),t.jsxRuntimeExports.jsx("div",{className:I.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(ft,{signUp:s})})]})},Ci=({children:d,logo:i,signUp:e})=>{const[s,o]=g.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx($t,{setIsOpenModal:o}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>o(!1),children:t.jsxRuntimeExports.jsx(Nt,{logo:i,setIsOpen:o,signUp:e,children:d})})]})},$t=d=>{const{setIsOpenModal:i}=d;return t.jsxRuntimeExports.jsx(J,{type:"Secondary",style:{padding:10},onClick:e=>{e.stopPropagation(),i(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List",fill:"var(--icon-primary)"})})},Bi="_share_xddz7_1",Ti="_modal_xddz7_8",Pi="_header_xddz7_20",Mi="_socials_xddz7_30",Ai="_social_xddz7_30",Oi="_copy_xddz7_40",qi="_title_xddz7_47",Li="_copyWrapper_xddz7_53",Di="_copyText_xddz7_62",Hi="_copyTextMobile_xddz7_75",zi="_copyTextMiniMobile_xddz7_94",et={share:Bi,modal:Ti,header:Pi,socials:Mi,social:Ai,copy:Oi,title:qi,copyWrapper:Li,copyText:Di,copyTextMobile:Hi,copyTextMiniMobile:zi},Fi=()=>{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:et.share,onClick:s=>{s.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(Vi,{})})]})},Vi=()=>{const{setIsOpenModal:d}=t.useShareLinkStore(),{notification:i,setNotification:e}=t.useNotificationStore(),{setIsOpen:s}=t.useModalStore(),o=window.location.href;function a(){navigator.clipboard.writeText(o),e({message:"Link copied to clipboard",status:"success"})}function c(){s(!1),setTimeout(()=>{d(!1),s(!0)},300)}function l(n,r){return n.length>r?n.slice(0,r)+"...":n}return t.jsxRuntimeExports.jsxs("div",{className:et.modal,onClick:n=>n.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:et.header,children:[t.jsxRuntimeExports.jsx("div",{className:et.title,children:"Copy Product Link"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:c,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:et.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button,{type:"Secondary",onClick:a,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:et.copyText,children:l(o,100)}),t.jsxRuntimeExports.jsx("div",{className:et.copyTextMobile,children:l(o,40)}),t.jsxRuntimeExports.jsx("div",{className:et.copyTextMiniMobile,children:l(o,20)})]}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:a,children:i?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},Ui="_accordion_1s1lq_1",Yi="_header_1s1lq_9",Gi="_icon_1s1lq_18",Xi="_open_1s1lq_21",Wi="_content_1s1lq_25",lt={accordion:Ui,header:Yi,icon:Gi,open:Xi,content:Wi},Ji=({title:d,content:i,defaultOpen:e=!1})=>{const[s,o]=g.useState(e),[a,c]=g.useState(0),l=g.useRef(null),n=()=>{o(!s)};return g.useEffect(()=>{l.current&&c(s?l.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:lt.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:lt.header,onClick:n,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:d}),t.jsxRuntimeExports.jsx("div",{className:t.clx(lt.icon,{[lt.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:l,className:lt.content,style:{height:`${a}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:i})})]})},Qi=({children:d,path:i,className:e,target:s="_self",id:o})=>{const a=t.useNavigate(),c=/^https?:\/\//.test(i),l=n=>{c||s==="_blank"?s==="_blank"?window.open(i,"_blank"):window.location.href=i:(n.preventDefault(),a(i,{replace:!0}))};return t.jsxRuntimeExports.jsx("div",{onClick:l,className:e,role:"link",style:{cursor:"pointer"},id:o,children:d})},Ki="_wrapper_st58d_1",Zi="_label_st58d_10",ta="_textarea_st58d_18",ea="_length_st58d_33",xt={wrapper:Ki,label:Zi,textarea:ta,length:ea},sa=d=>{const{onChange:i,label:e,value:s,maxLength:o,placeholder:a="Type something..."}=d,[c,l]=g.useState(s.length);return t.jsxRuntimeExports.jsxs("div",{className:xt.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:xt.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:s,onChange:n=>{l(n.target.value.length),i(n.target.value)},placeholder:a,className:xt.textarea,maxLength:o}),o&&t.jsxRuntimeExports.jsxs("div",{className:xt.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=Ji;exports.BurgerMenuButton=$t;exports.Button=J;exports.ButtonTypeSettings=bt;exports.ButtonsSettings=gn;exports.CategorySettings=Ke;exports.EmptyCart=kt;exports.FormSettings=Is;exports.HeaderButtons=Si;exports.InputUI=Et;exports.ItemsSettings=vt;exports.LayoutSettings=Ft;exports.Link=Qi;exports.ListingSelector=oo;exports.PagesMobileMenu=Ci;exports.PagesMobileModal=Nt;exports.ProductOptions=Uo;exports.RangeSelector=pt;exports.ShareLink=Fi;exports.ShoppingButton=yt;exports.ShoppingModalCart=It;exports.TextSettings=gt;exports.TextareaUI=sa;exports.TypesText=jt;exports.UserInfo=ft;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-X-Olyqgp.cjs"),h=require("react");require("@phosphor-icons/react");const $t="_wrapper_1ibay_2",wt="_alignmentBlock_1ibay_8",Ct="_title_1ibay_15",Bt="_subtitle_1ibay_22",Tt="_alignmentContent_1ibay_29",Pt="_alignments_1ibay_37",Mt="_alignment_1ibay_8",At="_circle_1ibay_60",Ot="_paddings_1ibay_67",qt="_padding_1ibay_67",Lt="_active_1ibay_91",Ut="_input_1ibay_98",X={wrapper:$t,alignmentBlock:wt,title:Ct,subtitle:Bt,alignmentContent:Tt,alignments:Pt,alignment:Mt,circle:At,paddings:Ot,padding:qt,active:Lt,input:Ut},Dt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Ht=["left","top","right","bottom"],zt=d=>{const{alignment:a,padding:e,setPadding:s,setAlignment:n}=d;function r(p){switch(p){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 l(p){switch(p){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[o,i]=h.useState(null),[c,b]=h.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:X.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:X.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:X.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:X.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:X.alignments,children:Dt.map(p=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{n(p)},className:X.alignment,onMouseEnter:()=>{i(p)},onMouseLeave:()=>{i(null)},children:[p!==a&&o!==p&&t.jsxRuntimeExports.jsx("div",{className:X.circle}),p!==a&&o===p&&t.jsxRuntimeExports.jsx(t.Icon,{name:r(o),fill:"#c2c2c2",width:22,height:22}),p===a&&t.jsxRuntimeExports.jsx(t.Icon,{name:r(a),fill:"#FF3F19",width:22,height:22})]},p))}),t.jsxRuntimeExports.jsx("div",{className:X.paddings,children:Ht.map(p=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(X.padding,{[X.active]:c===p}),onFocus:()=>{b(p)},onBlur:()=>{b(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:l(p),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(e[p]),onChange:_=>s({...e,[p]:Number(_)}),paddingless:!0,borderless:!0})]},p))})]})]})]})},Ft="_title_1jkiw_1",Vt="_subtitle_1jkiw_5",Yt="_header_1jkiw_12",Gt="_text_1jkiw_13",Xt="_top_1jkiw_20",Wt="_itemsBlock_1jkiw_29",rt={title:Ft,subtitle:Vt,header:Yt,text:Gt,top:Xt,itemsBlock:Wt},Jt="_typeTexts_167ez_1",Qt="_block_167ez_8",Kt="_active_167ez_25",_t={typeTexts:Jt,block:Qt,active:Kt},Zt=["bold","italic","underline","strike-through","code"],jt=d=>{const{typesText:a,setTypesText:e}=d;function s(n){switch(n){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:_t.typeTexts,children:Zt.map(n=>t.jsxRuntimeExports.jsx("div",{className:t.clx(_t.block,{[_t.active]:a.includes(n)}),onClick:()=>{const r=[...a];if(r.includes(n)){const l=r.filter(o=>o!==n);e(l)}else r.push(n),e(r)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:s(n),fill:a.includes(n)?"#252525":"#757575",width:20,height:20})},String(n)))})},ct={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",p:"Paragraph"},gt=d=>{const{typesText:a,isActiveText:e,setIsActiveText:s,text:n,setText:r,setTypesText:l,title:o,subtitle:i="Items",typeFont:c,setTypeFont:b}=d;return t.jsxRuntimeExports.jsxs("div",{className:rt.text,children:[(o||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:rt.top,children:[o&&t.jsxRuntimeExports.jsx("h3",{className:rt.title,children:o}),e!==void 0&&s&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:p=>s(p)})]}),t.jsxRuntimeExports.jsxs("div",{className:rt.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:rt.subtitle,children:i}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:p=>r(p),value:n,maxLength:150}),t.jsxRuntimeExports.jsx(jt,{typesText:a,setTypesText:l}),t.jsxRuntimeExports.jsx(t.Select,{label:"Type Text",options:Object.values(ct).filter(p=>p!==ct[c]),onChange:p=>b(Object.keys(ct).find(_=>ct[_]===p)),value:ct[c]})]})]})},te="_title_roi3a_1",ee="_subtitle_roi3a_5",se="_header_roi3a_12",ne="_text_roi3a_13",ie="_productsBlock_roi3a_14",oe="_top_roi3a_26",ae="_itemsBlock_roi3a_35",re="_typeTexts_roi3a_41",ce="_block_roi3a_48",le="_active_roi3a_61",de="_products_roi3a_14",ue="_product_roi3a_14",xe="_button_roi3a_80",me="_disabled_roi3a_91",pe="_image_roi3a_95",_e="_info_roi3a_102",he="_name_roi3a_114",je="_buttons_roi3a_118",ge="_modal_roi3a_125",fe="_link_roi3a_145",be="_modalOptions_roi3a_151",ve="_addButton_roi3a_164",Ee="_deleteButton_roi3a_179",Re="_closeIcon_roi3a_191",L={title:te,subtitle:ee,header:se,text:ne,productsBlock:ie,top:oe,itemsBlock:ae,typeTexts:re,block:ce,active:le,products:de,product:ue,button:xe,disabled:me,image:pe,info:_e,name:he,buttons:je,modal:ge,link:fe,modalOptions:be,addButton:ve,deleteButton:Ee,closeIcon:Re},ye=h.forwardRef((d,a)=>{const{activeItem:e,setActiveItem:s,popupPosition:n,modalOptions:r,setIsOpenModal:l}=d;function o(i,c){return i.length>c?`${i.slice(0,c)}...`:i}return t.jsxRuntimeExports.jsxs("div",{ref:a,className:L.modal,onClick:i=>{i.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:L.top,children:[t.jsxRuntimeExports.jsx("h3",{className:L.title,children:o(e.name["en-US"],20)}),t.jsxRuntimeExports.jsx("div",{className:L.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{s(null),l(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:L.modalOptions,children:r.map(i=>{if(i.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[i.field],onChange:c=>{const b={...e,[i.field]:c};s(b)}},String(i.field));if(i.type==="text")return t.jsxRuntimeExports.jsx(gt,{typesText:e[i.field.type],setTypesText:c=>{const b={...e,[i.field.type]:c};s(b)},text:e[i.field.text]["en-US"]||"",setText:c=>{const b={...e,[i.field.text]:{"en-US":c}};s(b)},typeFont:e[i.field.typeFont],setTypeFont:c=>{const b={...e,[i.field.typeFont]:c};s(b)},subtitle:i.label});if(i.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const b={...e,[i.field]:c};s(b)},value:e[i.field]||"",label:i.label,placeholder:i.placeholder});if(i.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:L.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const b={...e,[i.field.text]:c};s(b)},value:e[i.field.text]||"",label:i.inputLabel,placeholder:i.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[i.field.switch]||!1,label:i.switchLabel,onChange:c=>{const b={...e,[i.field.switch]:c};s(b)}})]});if(i.type==="list")return t.jsxRuntimeExports.jsx(bt,{items:e[i.field]||[],setItems:c=>{const b={...e,[i.field]:c};s(b)},itemsType:"select",draggable:i.draggable||!1,itemsOptions:i.itemsOptions,deletable:i.deletable||!1,editable:!1,subtitle:i.label,addableOptions:i.addableOptions});if(i.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:i.itemsOptions,onChange:c=>{const b={...e,[i.field]:c};s(b)},label:i.label,value:e[i.field]||"String",leftAddon:i.leftAddon&&i.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[i.field]})})})})]})}),Ie="_other_g74jx_1",ke="_subtitle_g74jx_7",Se="_items_g74jx_14",ht={other:Ie,subtitle:ke,items:Se},mt=d=>{const{items:a,title:e="Other"}=d;return t.jsxRuntimeExports.jsxs("div",{className:ht.other,children:[t.jsxRuntimeExports.jsx("h5",{className:ht.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:ht.items,children:a.map((s,n)=>t.jsxRuntimeExports.jsx(t.Switch,{current:s.isItem,onChange:r=>s.setIsItem(r),label:s.label,hasBackground:!0,paddingless:!1},n))})]})};function Ne({product:d,children:a}){const{attributes:e,listeners:s,setNodeRef:n,transform:r,transition:l,isDragging:o}=t.useSortable({id:d.id}),i={transform:t.CSS.Transform.toString(r),transition:l};return t.jsxRuntimeExports.jsx("div",{ref:n,style:i,className:`${L.product} ${o?L.dragging:""}`,...e,...s,children:a})}const bt=d=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:n,other:r,title:l,subtitle:o,editable:i=!0,draggable:c=!1,withImage:b=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsPlaceholder:g="",itemsOptions:u,hasRangeSelector:S=!1,rangeSelectorOptions:q,modalOptions:R,addableOptions:j={},limit:k,autoScrollInterval:A}=d,[H,N]=h.useState(null),[C,Q]=h.useState({top:0,left:0}),[v,T]=h.useState(null),$=h.useRef(null),[G,P]=h.useState(!1),U=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const x=()=>{N(null),P(!1)};return document.body.addEventListener("click",x),N(null),P(!1),()=>{N(null),P(!1),document.body.removeEventListener("click",x)}},[]),h.useEffect(()=>{if(H){const x=[...s].map(E=>E.id===H.id?H:E);n(x)}},[H]),h.useEffect(()=>{if($.current&&v){const x=$.current.getBoundingClientRect().height,E=window.innerHeight;let w=v.top;w+x>E+window.scrollY-200&&(w=E+window.scrollY-x-200),w<0&&(w=10),Q({top:w,left:v.left})}},[$.current,v]);const J=(x,E)=>{x.stopPropagation();const w=x.target.getBoundingClientRect();T({top:w.top+window.scrollY,left:w.left-30}),N(E),P(!0)};function nt(x){if(b)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 f=x=>{const{active:E,over:w}=x;if(w&&E.id!==w.id){const O=s.findIndex(B=>B.id===E.id),F=s.findIndex(B=>B.id===w.id);if(O!==-1&&F!==-1){const B=[...s],[it]=B.splice(O,1);B.splice(F,0,it),n(B)}}},M=(x,E)=>{var O,F;const w=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})}),m==="select"&&u&&t.jsxRuntimeExports.jsx(t.Select,{onChange:B=>{const it=[...s],at=u.find(ut=>ut.name["en-US"]===B);if(!at)return;const ot=it.map(ut=>ut.id===x.id?{...at,name:{"en-US":B}}:ut);N({...x,name:{"en-US":B}}),n([...ot])},value:x.name["en-US"],options:u.filter(B=>!s.find(it=>it.name["en-US"]===B.name["en-US"])).map(B=>B.name["en-US"]),leftAddon:nt(x.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:B=>{const at=[...s].map(ot=>ot.id===x.id?{...x,name:{"en-US":B}}:ot);n([...at])},value:x.name["en-US"],placeholder:g}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:B=>{const at=[...s].map(ot=>ot.id===x.id?{...x,images:B}:ot);n([...at])},activeImage:(O=s.find(B=>B.id===x.id))!=null&&O.images?(F=s.find(B=>B.id===x.id))==null?void 0:F.images[0]:void 0}),t.jsxRuntimeExports.jsxs("div",{className:L.buttons,children:[i&&t.jsxRuntimeExports.jsx("div",{className:L.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:B=>J(B,x)})}),p&&t.jsxRuntimeExports.jsx("div",{className:L.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>n(s.filter(B=>B.id!==x.id))})})]})]});return c?t.jsxRuntimeExports.jsx(Ne,{product:x,index:E,children:w},x.id):t.jsxRuntimeExports.jsx("div",{className:L.product,children:w},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:L.productsBlock,children:[(l||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:L.top,children:[l&&t.jsxRuntimeExports.jsx("h3",{className:L.title,children:l}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:x=>e==null?void 0:e(x)})]}),H&&i&&R&&G&&t.jsxRuntimeExports.jsx(ye,{ref:$,activeItem:H,setActiveItem:N,popupPosition:C,modalOptions:R,setIsOpenModal:P}),S&&q&&t.jsxRuntimeExports.jsx(pt,{...q}),t.jsxRuntimeExports.jsxs("div",{className:L.products,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:L.subtitle,children:o}),c?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:U,onDragEnd:f,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(x=>x.id),strategy:t.verticalListSortingStrategy,children:s.map((x,E)=>M(x,E))})}):s.map((x,E)=>M(x,E)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(L.button,{[L.disabled]:!!(k&&k<=s.length||s.length===(u==null?void 0:u.length))}),size:"s",disabled:!!(k&&k<=s.length||s.length===(u==null?void 0:u.length)),onClick:()=>{const x=[...s];let E=null;if(u){for(let w=0;w<u.length;w++)if(!s.find(O=>O.id===u[w].id)){E=u[w];break}}m==="select"&&u?x.push({name:E?E.name:u[0].name,id:(E==null?void 0:E.id)||u[0].id,...j}):m==="input"?x.push({name:{"en-US":""},id:t.v4(),...j}):x.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),...j}),n(x)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:L.addButton,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(mt,{items:r}),A!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(A.scrollInterval),onChange:x=>A.setScrollInterval(Number(x)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},$e="_title_82zux_1",we="_subtitle_82zux_5",Ce="_header_82zux_12",Be="_text_82zux_13",Te="_productsBlock_82zux_14",Pe="_top_82zux_26",Me="_itemsBlock_82zux_35",Ae="_typeTexts_82zux_41",Oe="_block_82zux_48",qe="_active_82zux_61",Le="_products_82zux_14",Ue="_product_82zux_14",De="_button_82zux_80",He="_disabled_82zux_91",ze="_image_82zux_95",Fe="_info_82zux_102",Ve="_name_82zux_114",Ye="_buttons_82zux_118",Ge="_modal_82zux_125",Xe="_link_82zux_145",We="_modalOptions_82zux_151",Je="_addButton_82zux_157",Qe="_deleteButton_82zux_179",W={title:$e,subtitle:we,header:Ce,text:Be,productsBlock:Te,top:Pe,itemsBlock:Me,typeTexts:Ae,block:Oe,active:qe,products:Le,product:Ue,button:De,disabled:He,image:ze,info:Fe,name:Ve,buttons:Ye,modal:Ge,link:Xe,modalOptions:We,addButton:Je,deleteButton:Qe},Ke=d=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:n,other:r,title:l,subtitle:o,draggable:i=!1,withImage:c=!1,addable:b=!0,itemsOptions:p,hasRangeSelector:_=!1,rangeSelectorOptions:m,limit:g,autoScrollInterval:u,deletable:S}=d;function q(j){if(c)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 R=(j,k=!1)=>{const A=p.find(N=>N.id===j);if(!A)return;const H=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[i&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:N=>{const C=[...s],Q=p.find($=>$.name===N);if(!Q)return;const v=Q.id,T=C.map($=>$===j?v:$);n([...T])},value:A.name,options:p.filter(N=>!s.find(C=>C===N.id)).map(N=>N.name),leftAddon:q(A.images)}),k&&t.jsxRuntimeExports.jsx("div",{className:W.buttons,children:t.jsxRuntimeExports.jsx("div",{className:W.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>n(s.filter(N=>N!==j))})})})]});return t.jsxRuntimeExports.jsx("div",{className:W.product,children:H},j)};return t.jsxRuntimeExports.jsxs("div",{className:W.productsBlock,children:[(l||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:W.top,children:[l&&t.jsxRuntimeExports.jsx("h3",{className:W.title,children:l}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:j=>e==null?void 0:e(j)})]}),_&&m&&t.jsxRuntimeExports.jsx(pt,{...m}),t.jsxRuntimeExports.jsxs("div",{className:W.products,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:W.subtitle,children:o}),s.map(j=>R(j,S)),b&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(W.button,{[W.disabled]:!!(g&&g<=s.length||s.length===p.length)}),size:"s",disabled:!!(g&&g<=s.length||s.length===p.length),onClick:()=>{const j=[...s];let k=null;if(p){for(let A=0;A<p.length;A++)if(!s.find(H=>H===p[A].id)){k=p[A];break}}j.push((k==null?void 0:k.id)||p[0].id),n(j)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:W.addButton,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(mt,{items:r}),u!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(u.scrollInterval),onChange:j=>u.setScrollInterval(Number(j)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Ze="_title_1vfw9_1",ts="_subtitle_1vfw9_5",es="_header_1vfw9_12",ss="_text_1vfw9_13",ns="_productsBlock_1vfw9_14",is="_top_1vfw9_26",os="_itemsBlock_1vfw9_35",as="_typeTexts_1vfw9_41",rs="_block_1vfw9_48",cs="_active_1vfw9_61",ls="_products_1vfw9_14",ds="_product_1vfw9_14",us="_button_1vfw9_80",xs="_disabled_1vfw9_91",ms="_image_1vfw9_95",ps="_info_1vfw9_102",_s="_name_1vfw9_114",hs="_buttons_1vfw9_118",js="_modal_1vfw9_125",gs="_link_1vfw9_145",fs="_modalOptions_1vfw9_151",bs="_addButton_1vfw9_164",vs="_deleteButton_1vfw9_179",Es="_closeIcon_1vfw9_191",D={title:Ze,subtitle:ts,header:es,text:ss,productsBlock:ns,top:is,itemsBlock:os,typeTexts:as,block:rs,active:cs,products:ls,product:ds,button:us,disabled:xs,image:ms,info:ps,name:_s,buttons:hs,modal:js,link:gs,modalOptions:fs,addButton:bs,deleteButton:vs,closeIcon:Es},Rs=h.forwardRef((d,a)=>{const{activeItem:e,setActiveItem:s,popupPosition:n,modalOptions:r,setIsOpenModal:l}=d;return t.jsxRuntimeExports.jsxs("div",{ref:a,className:D.modal,onClick:o=>{o.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:D.top,children:[t.jsxRuntimeExports.jsx("h3",{className:D.title,children:e.name["en-US"]}),t.jsxRuntimeExports.jsx("div",{className:D.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),l(!1)}})})]}),t.jsxRuntimeExports.jsx("div",{className:D.modalOptions,children:r.map(o=>{if(o.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[o.field],onChange:i=>{const c={...e,[o.field]:i};s(c)}},String(o.field));if(o.type==="text")return t.jsxRuntimeExports.jsx(gt,{typesText:e[o.field.type],setTypesText:i=>{const c={...e,[o.field.type]:i};s(c)},text:e[o.field.text]["en-US"]||"",setText:i=>{const c={...e,[o.field.text]:{"en-US":i}};s(c)},typeFont:e[o.field.type],setTypeFont:i=>{const c={...e,[o.field.type]:i};s(c)},subtitle:o.label});if(o.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:i=>{const c={...e,[o.field]:i};s(c)},value:e[o.field]||"",label:o.label,placeholder:o.placeholder});if(o.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:D.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:i=>{const c={...e,[o.field.text]:i};s(c)},value:e[o.field.text]||"",label:o.inputLabel,placeholder:o.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[o.field.switch]||!1,label:o.switchLabel,onChange:i=>{const c={...e,[o.field.switch]:i};s(c)}})]});if(o.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:o.itemsOptions,onChange:i=>{const c={...e,[o.field]:i};s(c)},label:o.label,value:e[o.field]||"String",leftAddon:o.leftAddon&&o.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[o.field]})})})})]})});function ys(d){const{product:a,children:e}=d,{attributes:s,listeners:n,setNodeRef:r,transform:l,transition:o,isDragging:i}=t.useSortable({id:a.id}),c={transform:t.CSS.Transform.toString(l),transition:o};return t.jsxRuntimeExports.jsx("div",{ref:r,style:c,className:`${D.product} ${i?D.dragging:""}`,...s,...n,children:e})}const Is=d=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:n,other:r,title:l,subtitle:o,editable:i=!0,draggable:c=!1,withImage:b=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsPlaceholder:g="",itemsOptions:u,hasRangeSelector:S=!1,rangeSelectorOptions:q,modalOptions:R,addableOptions:j={}}=d,[k,A]=h.useState(null),[H,N]=h.useState({top:0,left:0}),[C,Q]=h.useState(null),v=h.useRef(null),[T,$]=h.useState(!1),G=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const f=()=>{A(null),$(!1)};return document.body.addEventListener("click",f),A(null),$(!1),()=>{A(null),$(!1),document.body.removeEventListener("click",f)}},[]),h.useEffect(()=>{if(k){const f=[...s].map(M=>M.id===k.id?k:M);n(f)}},[k]),h.useEffect(()=>{if(v.current&&C){const f=v.current.getBoundingClientRect().height,M=window.innerHeight;let x=C.top;x+f>M+window.scrollY-200&&(x=M+window.scrollY-f-200),x<0&&(x=10),N({top:x,left:C.left})}},[v.current,C]);const P=(f,M)=>{f.stopPropagation();const x=f.target.getBoundingClientRect();Q({top:x.top+window.scrollY,left:x.left-30}),A(M),$(!0)};function U(f){if(b)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 J=f=>{const{active:M,over:x}=f;if(x&&M.id!==x.id){const E=s.findIndex(O=>O.id===M.id),w=s.findIndex(O=>O.id===x.id);if(E!==-1&&w!==-1){const O=[...s],[F]=O.splice(E,1);O.splice(w,0,F),n(O)}}},nt=f=>{var x;const M=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})}),m==="select"&&u&&t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const O=[...s].map(F=>F.id===f.id?{...f,name:{"en-US":E}}:F);A({...f,name:{"en-US":E}}),n([...O])},value:f.name["en-US"],options:u.filter(E=>!s.find(w=>w.name["en-US"]===E)),leftAddon:U(f.images)}),m==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:E=>{const O=[...s].map(F=>F.id===f.id?{...f,name:{"en-US":E}}:F);n([...O])},value:f.name["en-US"],placeholder:g}),m==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:E=>{const O=[...s].map(F=>F.id===f.id?{...f,images:E}:F);n([...O])},activeImage:(x=s.find(E=>E.id===f.id))==null?void 0:x.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:D.buttons,children:[i&&t.jsxRuntimeExports.jsx("div",{className:D.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>P(E,f)})}),p&&t.jsxRuntimeExports.jsx("div",{className:D.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>n(s.filter(E=>E.id!==f.id))})})]})]});return c?t.jsxRuntimeExports.jsx(ys,{product:f,children:M},f.id):t.jsxRuntimeExports.jsx("div",{className:D.product,children:M},f.id)};return t.jsxRuntimeExports.jsxs("div",{className:D.productsBlock,children:[(l||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:D.top,children:[l&&t.jsxRuntimeExports.jsx("h3",{className:D.title,children:l}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:f=>e==null?void 0:e(f)})]}),k&&i&&R&&T&&t.jsxRuntimeExports.jsx(Rs,{ref:v,activeItem:k,setActiveItem:A,popupPosition:H,modalOptions:R,setIsOpenModal:$}),S&&q&&t.jsxRuntimeExports.jsx(pt,{...q}),t.jsxRuntimeExports.jsxs("div",{className:D.products,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:D.subtitle,children:o}),c?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:G,onDragEnd:J,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(f=>f.id),strategy:t.verticalListSortingStrategy,children:s.map(f=>nt(f))})}):s.map(f=>nt(f)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:D.button,size:"s",onClick:()=>{const f=[...s];let M=null;if(u){for(let x=0;x<u.length;x++)if(!s.find(E=>E.name["en-US"]===u[x])){M=u[x];break}}m==="select"&&u?f.push({name:{"en-US":M||u[0]},id:t.v4(),...j,maxSymbols:100}):m==="input"?f.push({name:{"en-US":""},id:t.v4(),...j,maxSymbols:100}):f.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),...j,maxSymbols:100}),n(f)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:D.addButton,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(mt,{items:r})]})},ks="_title_bn7sv_1",Ss="_subtitle_bn7sv_5",Ns="_header_bn7sv_12",$s="_text_bn7sv_13",ws="_productsBlock_bn7sv_14",Cs="_buttonsBlock_bn7sv_15",Bs="_top_bn7sv_26",Ts="_itemsBlock_bn7sv_35",Ps="_typeTexts_bn7sv_41",Ms="_block_bn7sv_48",As="_active_bn7sv_60",Os="_products_bn7sv_14",qs="_product_bn7sv_14",Ls="_button_bn7sv_15",Us="_image_bn7sv_90",Ds="_info_bn7sv_97",Hs="_name_bn7sv_109",zs="_buttons_bn7sv_15",Fs="_modal_bn7sv_120",Vs="_other_bn7sv_139",Ys="_options_bn7sv_145",Gs="_closeIcon_bn7sv_153",st={title:ks,subtitle:Ss,header:Ns,text:$s,productsBlock:ws,buttonsBlock:Cs,top:Bs,itemsBlock:Ts,typeTexts:Ps,block:Ms,active:As,products:Os,product:qs,button:Ls,image:Us,info:Ds,name:Hs,buttons:zs,modal:Fs,other:Vs,options:Ys,closeIcon:Gs},Xs=h.forwardRef((d,a)=>{const{activeButton:e,setActiveButton:s,popupPosition:n}=d,[r,l]=h.useState(e.typesText),[o,i]=h.useState(e.destination),[c,b]=h.useState(e.page),[p,_]=h.useState(e.link||""),[m,g]=h.useState(e.text||""),[u,S]=h.useState(e.openInNewTab),{pages:q}=t.usePagesStore();return h.useEffect(()=>{s({...e,...{text:m,link:p,destination:o,typesText:r,page:c,openInNewTab:u}})},[r,o,p,m,c,u]),t.jsxRuntimeExports.jsxs("div",{className:st.modal,onClick:R=>{R.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},ref:a,children:[t.jsxRuntimeExports.jsxs("div",{className:st.top,children:[t.jsxRuntimeExports.jsx("h3",{className:st.title,children:e.type}),t.jsxRuntimeExports.jsx("div",{className:st.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})})]}),t.jsxRuntimeExports.jsxs("div",{className:st.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:R=>i(R),options:["Go to Page","Open Link"].filter(R=>R!==o),value:o}),o==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:R=>b(R),options:q?Object.values(q).filter(R=>R.name!==c).map(R=>R.name):[],value:c}):t.jsxRuntimeExports.jsx(t.Input,{onChange:R=>_(R),value:p,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:e.openInNewTab,label:"Open in new tab",onChange:R=>S(R)}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:R=>g({"en-US":R}),value:m["en-US"],label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(jt,{typesText:r,setTypesText:l})]})]})}),Ws="_subtitle_jql1y_1",Js="_header_jql1y_8",Qs="_text_jql1y_9",Ks="_productsBlock_jql1y_10",Zs="_buttonsBlock_jql1y_11",tn="_top_jql1y_23",en="_itemsBlock_jql1y_32",sn="_typeTexts_jql1y_38",nn="_block_jql1y_45",on="_active_jql1y_58",an="_products_jql1y_10",rn="_product_jql1y_10",cn="_button_jql1y_11",ln="_image_jql1y_88",dn="_info_jql1y_95",un="_name_jql1y_107",xn="_buttons_jql1y_11",mn="_modal_jql1y_118",pn="_other_jql1y_138",_n="_options_jql1y_144",hn="_addButton_jql1y_150",jn="_deleteButton_jql1y_165",Z={subtitle:Ws,header:Js,text:Qs,productsBlock:Ks,buttonsBlock:Zs,top:tn,itemsBlock:en,typeTexts:sn,block:nn,active:on,products:an,product:rn,button:cn,image:ln,info:dn,name:un,buttons:xn,modal:mn,other:pn,options:_n,addButton:hn,deleteButton:jn},vt=d=>{const{buttons:a,setButtons:e,deletable:s=!0,addable:n=!0}=d,[r,l]=h.useState(null),[o,i]=h.useState({top:0,left:0}),[c,b]=h.useState(null),p=h.useRef(null);h.useEffect(()=>{const m=()=>{l(null)};return document.body.addEventListener("click",m),l(null),()=>{l(null),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(r){const m=[...a].map(g=>g.id===r.id?r:g);e(m)}},[r]),h.useEffect(()=>{if(p.current&&c){const m=p.current.getBoundingClientRect().height,g=window.innerHeight;let u=c.top;u+m>g+window.scrollY-200&&(u=g+window.scrollY-m-200),u<0&&(u=10),i({top:u,left:c.left})}},[p.current,c]);const _=(m,g)=>{m.stopPropagation();const u=m.target.getBoundingClientRect();b({top:u.top+window.scrollY,left:u.left-30}),l(g)};return t.jsxRuntimeExports.jsxs("div",{className:Z.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Z.subtitle,children:"Button Type"}),a.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Z.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:g=>{const S=[...a].map(q=>q.id===m.id?{...m,type:g}:q);e(S)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Z.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:Z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:g=>{_(g,m)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:Z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const g=a.filter(u=>u.id!==m.id);e(g)},width:20,height:20,fill:"#C12A2A"})})]})]},m.id)),r&&t.jsxRuntimeExports.jsx(Xs,{ref:p,activeButton:r,setActiveButton:l,popupPosition:o}),n&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:Z.button,size:"s",onClick:()=>{const m=[...a];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:{"en-US":"Button Name"},page:"home",openInNewTab:!0}),e(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:Z.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},gn=d=>{const{isActiveButtons:a,setIsActiveButtons:e,buttons:s,setButtons:n}=d;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:st.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:st.top,children:[t.jsxRuntimeExports.jsx("h3",{className:st.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:r=>e(r)})]}),t.jsxRuntimeExports.jsx(vt,{buttons:s,setButtons:n})]})})},fn="_wrapper_m18qi_1",bn="_subtitle_m18qi_7",vn="_content_m18qi_14",En="_range_m18qi_22",Rn="_track_m18qi_27",yn="_progress_m18qi_36",In="_dots_m18qi_46",kn="_dot_m18qi_46",Sn="_active_m18qi_65",Nn="_input_m18qi_77",$n="_countBlock_m18qi_91",wn="_count_m18qi_91",Cn="_controls_m18qi_107",Bn="_button_m18qi_113",V={wrapper:fn,subtitle:bn,content:vn,range:En,track:Rn,progress:yn,dots:In,dot:kn,active:Sn,input:Nn,countBlock:$n,count:wn,controls:Cn,button:Bn},pt=d=>{const{label:a,min:e=1,max:s=4,step:n=1,count:r,setCount:l}=d,[o,i]=h.useState(!1),c=Array.from({length:(s-e)/n+1}),b=(r-e)/(s-e)*100,p=()=>{r<s&&l(r+n)},_=()=>{r>e&&l(r-n)},m=g=>{const u=e+g*n;l(u)};return t.jsxRuntimeExports.jsxs("div",{className:V.wrapper,children:[a&&t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:a}),t.jsxRuntimeExports.jsxs("div",{className:V.content,children:[t.jsxRuntimeExports.jsxs("div",{className:V.range,children:[t.jsxRuntimeExports.jsx("div",{className:V.track}),t.jsxRuntimeExports.jsx("div",{className:V.progress,style:{width:`${b}%`}}),t.jsxRuntimeExports.jsx("div",{className:V.dots,children:c.map((g,u)=>{const S=u<=(r-e)/n;return t.jsxRuntimeExports.jsx("button",{onClick:()=>m(u),className:t.clx(V.dot,{[V.active]:S,[V.inactive]:!S,[V.dragging]:o}),"aria-label":`Set value to ${e+u*n}`},u)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:s,step:n,value:r,onChange:g=>l(Number(g.target.value)),onMouseDown:()=>i(!0),onMouseUp:()=>i(!1),onTouchStart:()=>i(!0),onTouchEnd:()=>i(!1),className:V.input})]}),t.jsxRuntimeExports.jsxs("div",{className:V.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:s,paddingless:!0,onChange:g=>{const u=Number(g);u>s?l(s):u<e?l(e):l(u)},value:String(r)}),t.jsxRuntimeExports.jsxs("div",{className:V.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:p,disabled:r>=s,className:V.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:_,disabled:r<=e,className:V.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},Tn="_title_ix5ax_1",Pn="_subtitle_ix5ax_5",Mn="_header_ix5ax_12",An="_text_ix5ax_13",On="_productsBlock_ix5ax_14",qn="_top_ix5ax_26",Ln="_itemsBlock_ix5ax_35",Un="_typeTexts_ix5ax_41",Dn="_block_ix5ax_48",Hn="_active_ix5ax_61",zn="_products_ix5ax_14",Fn="_product_ix5ax_14",Vn="_button_ix5ax_80",Yn="_image_ix5ax_91",Gn="_info_ix5ax_98",Xn="_name_ix5ax_110",Wn="_buttons_ix5ax_114",Jn="_modal_ix5ax_121",Qn="_link_ix5ax_141",Kn="_modalOptions_ix5ax_147",Zn="_addButton_ix5ax_160",ti="_deleteButton_ix5ax_175",ei="_closeIcon_ix5ax_187",z={title:Tn,subtitle:Pn,header:Mn,text:An,productsBlock:On,top:qn,itemsBlock:Ln,typeTexts:Un,block:Dn,active:Hn,products:zn,product:Fn,button:Vn,image:Yn,info:Gn,name:Xn,buttons:Wn,modal:Jn,link:Qn,modalOptions:Kn,addButton:Zn,deleteButton:ti,closeIcon:ei},si=d=>{const{activeItem:a,setActiveItem:e,popupPosition:s,setIsOpenModal:n,itemsOptions:r}=d,l=r.find(o=>o.id===a.listingId);return l?t.jsxRuntimeExports.jsxs("div",{className:z.modal,onClick:o=>{o.stopPropagation()},style:{top:`${s.top}px`,left:`${s.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[t.jsxRuntimeExports.jsx("h3",{children:t.splitTextIntoSpans(l.productData.name)}),t.jsxRuntimeExports.jsx("div",{className:z.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,onClick:()=>{n(!1),e(null)}})})]}),t.jsxRuntimeExports.jsx("div",{className:z.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:l.productData.images.length>0?l.productData.images[0].cfId:void 0,onChange:o=>{const i={...a,image:o[0]};e(i)}})})]}):null};function ni(d){const{product:a,children:e}=d,{attributes:s,listeners:n,setNodeRef:r,transform:l,transition:o,isDragging:i}=t.useSortable({id:String(a.listingId)}),c={transform:t.CSS.Transform.toString(l),transition:o};return t.jsxRuntimeExports.jsx("div",{ref:r,style:c,className:`${z.product} ${i?z.dragging:""}`,...s,...n,children:e})}const ii=d=>{const{isActiveItems:a,setIsActiveItems:e,items:s,setItems:n,other:r,title:l,subtitle:o,editable:i=!0,draggable:c=!1,withImage:b=!1,deletable:p=!0,addable:_=!0,itemsType:m,itemsOptions:g}=d,[u,S]=h.useState(null),[q,R]=h.useState({top:0,left:0}),[j,k]=h.useState(!1),A=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const v=()=>{S(null),k(!1)};return document.body.addEventListener("click",v),S(null),k(!1),()=>{S(null),k(!1),document.body.removeEventListener("click",v)}},[]),h.useEffect(()=>{if(u){const v=[...s].map(T=>T.listingId===u.listingId?u:T);n(v)}},[u]);const H=(v,T)=>{v.stopPropagation();const $=v.target.getBoundingClientRect(),G=100,P=window.innerHeight;let U=$.top+window.scrollY;U+G>P&&(U=P-G-20),k(!0),R({top:U-80,left:$.left-30}),S(T)};function N(v){if(b)return v?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${v}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const C=v=>{const{active:T,over:$}=v;if($&&T.id!==$.id){const G=s.findIndex(U=>String(U.listingId)===T.id),P=s.findIndex(U=>String(U.listingId)===$.id);if(G!==-1&&P!==-1){const U=[...s],[J]=U.splice(G,1);U.splice(P,0,J),n(U)}}},Q=(v,T)=>{const $=g.find(P=>v.listingId===P.id);if(!$)return null;const G=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})}),m==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:P=>{const U=[...s],J=g.find(M=>M.productData.name===P);if(!J)return;const nt={listingId:J.id,image:J.productData.images.length>0?J.productData.images[0].cfId:""},f=U.map(M=>M.listingId===v.listingId?nt:M);S(nt),n([...f])},value:$.productData.name,options:[...g.filter(P=>!s.find(U=>U.listingId===P.id)).map(P=>P.productData.name)],leftAddon:N(v.image||$.productData.images.length>0&&$.productData.images[0].cfId||"")},T),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[i&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:P=>H(P,v)})}),p&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>n(s.filter(P=>P!==v))})})]})]});return c?t.jsxRuntimeExports.jsx(ni,{product:v,children:G},v.listingId):t.jsxRuntimeExports.jsx("div",{className:z.product,children:G},v.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(l||a!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[l&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:l}),a!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:a,onChange:v=>e==null?void 0:e(v)})]}),j&&u&&t.jsxRuntimeExports.jsx(si,{activeItem:u,setActiveItem:S,setIsOpenModal:k,popupPosition:q,itemsOptions:g}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:o}),c?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:A,onDragEnd:C,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(v=>String(v.listingId)),strategy:t.verticalListSortingStrategy,children:s.map((v,T)=>Q(v,T))})}):s.map((v,T)=>Q(v,T)),_&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:z.button,size:"s",onClick:()=>{const v=[...s];for(let T=0;T<g.length;T++)if(!s.find($=>$.listingId===g[T].id)){v.push({listingId:g[T].id,image:g[T].productData.images.length>0?g[T].productData.images[0].cfId:""});break}n(v)},disabled:s.length===g.length,style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:z.addButton,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(mt,{items:r})]})},oi="_options_6cemk_1",ai="_price_6cemk_12",ri="_oldPrice_6cemk_19",ci="_newPrice_6cemk_27",li="_animate_6cemk_34",di="_appearAndBounce_6cemk_1",ui="_meta_6cemk_52",xi="_info_6cemk_58",mi="_infoRight_6cemk_66",pi="_buttons_6cemk_73",_i="_variants_6cemk_80",hi="_variant_6cemk_80",ji="_stock_6cemk_98",gi="_variantInfo_6cemk_105",fi="_quantity_6cemk_111",bi="_count_6cemk_118",vi="_focused_6cemk_135",Ei="_button_6cemk_73",Ri="_activeVariant_6cemk_161",yi="_chargeTypes_6cemk_165",Ii="_charge_6cemk_165",ki="_chargeActive_6cemk_190",Si="_title_6cemk_198",I={options:oi,price:ai,oldPrice:ri,newPrice:ci,animate:li,appearAndBounce:di,meta:ui,info:xi,infoRight:mi,buttons:pi,variants:_i,variant:hi,stock:ji,variantInfo:gi,quantity:fi,count:bi,focused:vi,button:Ei,activeVariant:Ri,chargeTypes:yi,charge:Ii,chargeActive:ki,title:Si},Ni="_wrapper_c1dht_1",$i="_label_c1dht_9",wi="_input_c1dht_18",Ci="_paddingless_c1dht_31",Bi="_content_c1dht_35",Ti="_contentBorder_c1dht_47",Pi="_borderless_c1dht_52",Mi="_rightIcon_c1dht_57",K={wrapper:Ni,label:$i,input:wi,paddingless:Ci,content:Bi,contentBorder:Ti,borderless:Pi,rightIcon:Mi},Et=d=>{const{onChange:a,style:e,label:s,value:n,type:r,min:l,max:o,placeholder:i,disabled:c=!1,required:b=!1,regex:p,paddingless:_=!1,borderless:m=!1,editable:g=!1,isSearch:u=!1,centered:S=!1}=d,{themeSettings:q}=t.useThemeSettingsStore(),{inputs:R}=q,[j,k]=h.useState(!1);function A(N){return Number(N)<0?String(l):N}function H(N){return!b||!p?!0:new RegExp(p).test(N)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[s&&t.jsxRuntimeExports.jsx("label",{className:K.label,htmlFor:s,children:s}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.content,{[K.contentBorder]:R.border.active}),style:{...e,background:R.field.active?R.field.color:"transparent",padding:u?`7px ${Number(R.general.size)+20}px 7px 11px`:"7px 11px"},children:[t.jsxRuntimeExports.jsx("input",{id:s,type:r||"text",onChange:N=>{if(r==="text")a(N.target.value);else{const C=A(N.target.value);a(C)}},value:n,autoComplete:"off",placeholder:i||"Type something...",className:t.clx(K.input,{[K.required]:j&&b&&!H(n),[K.paddingless]:_,[K.borderless]:m}),min:r==="number"?l:void 0,max:r==="number"?o:void 0,disabled:c,onFocus:()=>k(!0),style:{textAlign:S?"center":"left"}}),u&&t.jsxRuntimeExports.jsx("div",{className:K.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:R.general.size,height:R.general.size})}),g&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},Ai="_button_85085_1",Oi="_primary_85085_20",qi="_primaryHovered_85085_30",Li="_secondary_85085_34",Ui="_secondaryHovered_85085_44",Di="_tertiary_85085_48",Hi="_tertiaryHovered_85085_58",zi="_content_85085_62",tt={button:Ai,primary:Oi,primaryHovered:qi,secondary:Li,secondaryHovered:Ui,tertiary:Di,tertiaryHovered:Hi,content:zi},Y=d=>{const{children:a,onClick:e,style:s,className:n,disabled:r=!1,type:l="Primary"}=d,{themeSettings:o}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("button",{className:t.clx(tt.button,n,{[tt.primary]:l==="Primary",[tt.secondary]:l==="Secondary",[tt.tertiary]:l==="Tertiary",[tt.primaryHovered]:l==="Primary"&&!r&&o.buttons.primary.hover,[tt.secondaryHovered]:l==="Secondary"&&!r&&o.buttons.secondary.hover,[tt.tertiaryHovered]:l==="Tertiary"&&!r&&o.buttons.tertiary.hover}),onClick:e,style:{...s},disabled:r,children:l==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:tt.content,children:[a,t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"var(--icon-tertiary)",width:20,height:20})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:a})})};var Rt=(d=>(d.ONE_TIME="One-Time",d.RECURRING="Subscribe & Save",d))(Rt||{});const Fi=d=>{var q,R;const{variants:a}=d,[e,s]=h.useState(a[0]),[n,r]=h.useState(e.chargeTypes[0]),l=t.useNavigate(),[o,i]=h.useState(1),{reset:c,addProductToCart:b,getProducts:p}=t.useCart(),[_,m]=h.useState(!1);h.useEffect(()=>{m(!0);const j=setTimeout(()=>m(!1),600);return()=>clearTimeout(j)},[o]);async function g(){await p(),await b({productId:d.id,productVariantId:e.id,quantity:o})}function u(){c(),g(),l("/checkout")}function S(j){if(j>=864e5){const C=Math.floor(j/864e5);return`${C} ${C===1?"day":"days"}`}else if(j>=36e5){const C=Math.floor(j/36e5);return`${C} ${C===1?"hour":"hours"}`}else if(j>=6e4){const C=Math.floor(j/6e4);return`${C} ${C===1?"minute":"minutes"}`}else{const C=Math.floor(j/1e3);return`${C} ${C===1?"second":"seconds"}`}}return h.useEffect(()=>{(e.quantity.available===0||!e.quantity.available)&&i(0)},[e.quantity.available]),console.log(e.quantity),t.jsxRuntimeExports.jsxs("div",{className:I.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:I.chargeTypes,children:e.chargeTypes.map(j=>t.jsxRuntimeExports.jsx("div",{className:t.clx(I.charge,{[I.chargeActive]:n===j}),onClick:()=>r(j),children:Rt[j]},j))}),t.jsxRuntimeExports.jsx("div",{className:I.variants,children:a.map(j=>{var k;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(I.variant,{[I.activeVariant]:e.id===j.id}),onClick:()=>s(j),children:[t.jsxRuntimeExports.jsxs("div",{className:I.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:I.title,children:j.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",n==="ONE_TIME"?j.price.amount:j.subscriptionSettings?j.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:n==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:I.stock,children:[((k=j.quantity.restrictions)==null?void 0:k.max)||j.quantity.available||0," in stock"]})})]},j.id)})}),n==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:I.quantity,children:[t.jsxRuntimeExports.jsx(Y,{type:"Secondary",onClick:()=>{o>1?i(j=>j-1):i(1)},className:I.button,disabled:e.quantity.available===0||e.quantity.restrictions&&o<=e.quantity.restrictions.min||Object.keys(e.quantity.restrictions||{}).length===0&&!e.quantity.available,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(Et,{type:"number",value:String(o),onChange:j=>i(Number(j)),max:((q=e.quantity.restrictions)==null?void 0:q.max)||e.quantity.available||1/0,min:((R=e.quantity.restrictions)==null?void 0:R.min)||0,centered:!0,disabled:e.quantity.available===0||!e.quantity.available||Object.keys(e.quantity.restrictions||{}).length===0&&!e.quantity.available}),t.jsxRuntimeExports.jsx(Y,{type:"Secondary",onClick:()=>{i(j=>j+1)},className:I.button,disabled:!!(e.quantity.restrictions&&o>=e.quantity.restrictions.max||e.quantity.available!==void 0&&o>=e.quantity.available||Object.keys(e.quantity.restrictions||{}).length===0&&!e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:I.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:I.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":S(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:I.infoRight,children:n==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:I.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",(e.price.amount||0)*o]}),t.jsxRuntimeExports.jsxs("span",{className:I.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*o]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",(e.price.amount||0)*o]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:I.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:I.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.buttons,children:[t.jsxRuntimeExports.jsx(Y,{type:"Primary",onClick:()=>u(),disabled:e.quantity.available===0||!e.quantity.available||Object.keys(e.quantity.restrictions||{}).length===0&&!e.quantity.available,children:n==="ONE_TIME"?"Buy Now":"Subscribe Now"}),n==="ONE_TIME"&&t.jsxRuntimeExports.jsx(Y,{type:"Secondary",onClick:()=>g(),disabled:e.quantity.available===0||!e.quantity.available||Object.keys(e.quantity.restrictions||{}).length===0&&!e.quantity.available,children:"Add to Cart"})]})]})},Vi="_button_1tdo3_1",Yi="_login_1tdo3_14",Gi="_signUp_1tdo3_18",Xi="_buttons_1tdo3_23",Wi="_modal_1tdo3_32",Ji="_closing_1tdo3_64",Qi="_info_1tdo3_113",Ki="_top_1tdo3_120",Zi="_title_1tdo3_131",to="_clear_1tdo3_138",eo="_activeClear_1tdo3_145",so="_count_1tdo3_149",no="_cart_1tdo3_164",io="_empty_1tdo3_172",oo="_product_1tdo3_198",ao="_products_1tdo3_207",ro="_image_1tdo3_215",co="_productInfo_1tdo3_221",lo="_content_1tdo3_228",uo="_name_1tdo3_234",xo="_price_1tdo3_240",mo="_productButtons_1tdo3_246",po="_productButton_1tdo3_246",_o="_productCount_1tdo3_266",ho="_bottom_1tdo3_282",jo="_subtotal_1tdo3_290",go="_block_1tdo3_298",fo="_shoppingCount_1tdo3_305",bo="_total_1tdo3_325",vo="_link_1tdo3_331",Eo="_userInfo_1tdo3_338",Ro="_pagesMobileModal_1tdo3_349",yo="_pagesMobileModalContent_1tdo3_363",Io="_pagesMobileModalHeader_1tdo3_369",ko="_pagesMobileModalFooter_1tdo3_379",y={button:Vi,login:Yi,signUp:Gi,buttons:Xi,modal:Wi,"slide-in-fade":"_slide-in-fade_1tdo3_1","mobile-slide-in-fade":"_mobile-slide-in-fade_1tdo3_1",closing:Ji,"mobile-slide-out-fade":"_mobile-slide-out-fade_1tdo3_1","slide-out-fade":"_slide-out-fade_1tdo3_1",info:Qi,top:Ki,title:Zi,clear:to,activeClear:eo,count:so,cart:no,empty:io,product:oo,products:ao,image:ro,productInfo:co,content:lo,name:uo,price:xo,productButtons:mo,productButton:po,productCount:_o,bottom:ho,subtotal:jo,block:go,shoppingCount:fo,total:bo,link:vo,userInfo:Eo,pagesMobileModal:Ro,pagesMobileModalContent:yo,pagesMobileModalHeader:Io,pagesMobileModalFooter:ko};class dt extends Error{}dt.prototype.name="InvalidTokenError";function So(d){return decodeURIComponent(atob(d).replace(/(.)/g,(a,e)=>{let s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function No(d){let a=d.replace(/-/g,"+").replace(/_/g,"/");switch(a.length%4){case 0:break;case 2:a+="==";break;case 3:a+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return So(a)}catch{return atob(a)}}function $o(d,a){if(typeof d!="string")throw new dt("Invalid token specified: must be a string");a||(a={});const e=a.header===!0?0:1,s=d.split(".")[e];if(typeof s!="string")throw new dt(`Invalid token specified: missing part #${e+1}`);let n;try{n=No(s)}catch(r){throw new dt(`Invalid token specified: invalid base64 for part #${e+1} (${r.message})`)}try{return JSON.parse(n)}catch(r){throw new dt(`Invalid token specified: invalid json for part #${e+1} (${r.message})`)}}const wo=d=>{const{shopping:a,signUp:e,isShowUserInfo:s=!0}=d;return t.jsxRuntimeExports.jsxs("div",{className:y.buttons,children:[a&&t.jsxRuntimeExports.jsx(yt,{}),s&&t.jsxRuntimeExports.jsx(ft,{signUp:e})]})},yt=()=>{const[d,a]=h.useState(!1),[e,s]=h.useState([]),{cart:n,getProducts:r}=t.useCart();function l(_){for(let m=0;m<n.parts.length;m++)for(let g=0;g<_.variants.length;g++)if(n.parts[m].productVariantId===_.variants[m].id)return n.parts[m].productVariantId}function o(_){for(let m=0;m<n.parts.length;m++)for(let g=0;g<_.variants.length;g++)if(n.parts[m].productVariantId===_.variants[m].id)return n.parts[m].quantity}h.useEffect(()=>{(async()=>{const m=n.parts.map(S=>String(S.productId)),u=(await r([...m])).map(S=>({...S,activeVariantId:l(S),quantity:o(S)}));s(u)})()},[n.parts.length]);function i(_){var m;return!_||!(_!=null&&_.variants)?!1:(m=_.variants.find(g=>g.id===_.activeVariantId))==null?void 0:m.subscriptionSettings}const c=n.parts.length>0&&e.length>0&&!i(e[0]),[b,p]=h.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(Y,{type:"Secondary",style:{padding:10},onClick:_=>{_.stopPropagation(),window.location.pathname!=="/admin/builder"&&(a(!0),p(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),c&&t.jsxRuntimeExports.jsx("div",{className:y.shoppingCount,children:n.parts.length})]}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>{p(!1),setTimeout(()=>{a(!1)},300)},withAnimation:!1,children:t.jsxRuntimeExports.jsx(It,{activeProducts:e,isCartNotEmpty:c,isOpen:b})})]})},It=d=>{const{activeProducts:a,isCartNotEmpty:e,isOpen:s}=d,{cart:n,reset:r,getTotalAndDiscount:l,updateQuantityOfProduct:o}=t.useCart(),i=t.useNavigate();function c(_){i(_)}function b(_){o({productId:_.id,productVariantId:_.activeVariantId,quantity:_.quantity+1})}function p(_){o({productId:_.id,productVariantId:_.activeVariantId,quantity:_.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(y.modal,{[y.closing]:!s}),onClick:_=>_.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:y.top,children:[t.jsxRuntimeExports.jsxs("div",{className:y.info,children:[t.jsxRuntimeExports.jsx("span",{className:y.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:y.count,children:n.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(y.clear,{[y.activeClear]:e}),disabled:!e,onClick:r,children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:y.cart,children:[t.jsxRuntimeExports.jsx("div",{className:y.products,children:a.map(_=>t.jsxRuntimeExports.jsxs("div",{className:y.product,children:[t.jsxRuntimeExports.jsxs("div",{className:y.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${_.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:y.image}),t.jsxRuntimeExports.jsxs("div",{className:y.content,children:[t.jsxRuntimeExports.jsx("div",{className:y.name,children:_.name}),t.jsxRuntimeExports.jsxs("div",{className:y.price,children:["$",_.variants.find(m=>m.id===_.activeVariantId).price.amount*((_==null?void 0:_.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:y.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{_.quantity!==1&&p(_)},className:y.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:y.productCount,children:_.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>b(_),className:y.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},_.id))}),t.jsxRuntimeExports.jsxs("div",{className:y.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:y.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:y.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:y.total,children:["$",l().total]})]}),t.jsxRuntimeExports.jsx(Y,{onClick:()=>c("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(kt,{})]})},kt=()=>t.jsxRuntimeExports.jsxs("div",{className:y.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-secondary)"})}),t.jsxRuntimeExports.jsx("span",{children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:y.link,children:"view products"})]})]}),ft=({signUp:d})=>{const a=JSON.parse(localStorage.getItem("token")||"{}"),{data:e}=a,s=t.useNavigate();function n(o){s(o)}if(!e)return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Y,{onClick:()=>n("/customer-dash"),type:"Secondary",style:{padding:10},children:"Login"}),d&&t.jsxRuntimeExports.jsx(Y,{onClick:()=>n("/customer-dash"),type:"Primary",style:{padding:10},children:"Sign Up"})]});const[r,l]=h.useState("test-email@gmail.com");return h.useEffect(()=>{(async()=>{const i=$o(e);l(i.email)})()},[e]),t.jsxRuntimeExports.jsx("div",{className:y.userInfo,onClick:()=>n("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:r||"test-email@gmail.com"})})},St=({children:d,logo:a,setIsOpen:e,signUp:s})=>{const{setIsOpen:n}=t.useModalStore(),r=()=>{n(!1),setTimeout(()=>{e(!1),n(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:y.pagesMobileModal,onClick:l=>l.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:y.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:a}),t.jsxRuntimeExports.jsx(Y,{type:"Secondary",onClick:r,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"var(--icon-primary)"})})]}),t.jsxRuntimeExports.jsx("div",{className:y.pagesMobileModalContent,children:d}),t.jsxRuntimeExports.jsx("div",{className:y.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(ft,{signUp:s})})]})},Co=({children:d,logo:a,signUp:e})=>{const[s,n]=h.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Nt,{setIsOpenModal:n}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>n(!1),children:t.jsxRuntimeExports.jsx(St,{logo:a,setIsOpen:n,signUp:e,children:d})})]})},Nt=d=>{const{setIsOpenModal:a}=d;return t.jsxRuntimeExports.jsx(Y,{type:"Secondary",style:{padding:10},onClick:e=>{e.stopPropagation(),a(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List",fill:"var(--icon-primary)"})})},Bo="_share_xddz7_1",To="_modal_xddz7_8",Po="_header_xddz7_20",Mo="_socials_xddz7_30",Ao="_social_xddz7_30",Oo="_copy_xddz7_40",qo="_title_xddz7_47",Lo="_copyWrapper_xddz7_53",Uo="_copyText_xddz7_62",Do="_copyTextMobile_xddz7_75",Ho="_copyTextMiniMobile_xddz7_94",et={share:Bo,modal:To,header:Po,socials:Mo,social:Ao,copy:Oo,title:qo,copyWrapper:Lo,copyText:Uo,copyTextMobile:Do,copyTextMiniMobile:Ho},zo=()=>{const{isOpenModal:d,setIsOpenModal:a}=t.useShareLinkStore();function e(){a(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button,{className:et.share,onClick:s=>{s.stopPropagation(),e()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:a,children:t.jsxRuntimeExports.jsx(Fo,{})})]})},Fo=()=>{const{setIsOpenModal:d}=t.useShareLinkStore(),{notification:a,setNotification:e}=t.useNotificationStore(),{setIsOpen:s}=t.useModalStore(),n=window.location.href;function r(){navigator.clipboard.writeText(n),e({message:"Link copied to clipboard",status:"success"})}function l(){s(!1),setTimeout(()=>{d(!1),s(!0)},300)}function o(i,c){return i.length>c?i.slice(0,c)+"...":i}return t.jsxRuntimeExports.jsxs("div",{className:et.modal,onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:et.header,children:[t.jsxRuntimeExports.jsx("div",{className:et.title,children:"Copy Product Link"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:l,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:et.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button,{type:"Secondary",onClick:r,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:et.copyText,children:o(n,100)}),t.jsxRuntimeExports.jsx("div",{className:et.copyTextMobile,children:o(n,40)}),t.jsxRuntimeExports.jsx("div",{className:et.copyTextMiniMobile,children:o(n,20)})]}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:r,children:a?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},Vo="_accordion_1s1lq_1",Yo="_header_1s1lq_9",Go="_icon_1s1lq_18",Xo="_open_1s1lq_21",Wo="_content_1s1lq_25",lt={accordion:Vo,header:Yo,icon:Go,open:Xo,content:Wo},Jo=({title:d,content:a,defaultOpen:e=!1})=>{const[s,n]=h.useState(e),[r,l]=h.useState(0),o=h.useRef(null),i=()=>{n(!s)};return h.useEffect(()=>{o.current&&l(s?o.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:lt.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:lt.header,onClick:i,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:d}),t.jsxRuntimeExports.jsx("div",{className:t.clx(lt.icon,{[lt.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:o,className:lt.content,style:{height:`${r}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:a})})]})},Qo=({children:d,path:a,className:e,target:s="_self",id:n})=>{const r=t.useNavigate(),l=/^https?:\/\//.test(a),o=i=>{l||s==="_blank"?s==="_blank"?window.open(a,"_blank"):window.location.href=a:(i.preventDefault(),r(a,{replace:!0}))};return t.jsxRuntimeExports.jsx("div",{onClick:o,className:e,role:"link",style:{cursor:"pointer"},id:n,children:d})},Ko="_buttonsBlock_1b2rb_1",Zo="_slideUp_1b2rb_1",ta={buttonsBlock:Ko,slideUp:Zo},ea=()=>t.jsxRuntimeExports.jsxs("div",{className:ta.buttonsBlock,children:[t.jsxRuntimeExports.jsx(Y,{type:"Primary",style:{width:"100%"},onClick:()=>{console.log("add to cart")},children:"Add to Cart"}),t.jsxRuntimeExports.jsx(Y,{type:"Secondary",children:"Buy"})]}),sa="_wrapper_st58d_1",na="_label_st58d_10",ia="_textarea_st58d_18",oa="_length_st58d_33",xt={wrapper:sa,label:na,textarea:ia,length:oa},aa=d=>{const{onChange:a,label:e,value:s,maxLength:n,placeholder:r="Type something..."}=d,[l,o]=h.useState(s.length);return t.jsxRuntimeExports.jsxs("div",{className:xt.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:xt.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:s,onChange:i=>{o(i.target.value.length),a(i.target.value)},placeholder:r,className:xt.textarea,maxLength:n}),n&&t.jsxRuntimeExports.jsxs("div",{className:xt.length,children:[l,"/",n]})]})};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=Jo;exports.BurgerMenuButton=Nt;exports.Button=Y;exports.ButtonTypeSettings=vt;exports.ButtonsSettings=gn;exports.CategorySettings=Ke;exports.EmptyCart=kt;exports.FormSettings=Is;exports.HeaderButtons=wo;exports.InputUI=Et;exports.ItemsSettings=bt;exports.LayoutSettings=zt;exports.Link=Qo;exports.ListingSelector=ii;exports.PagesMobileMenu=Co;exports.PagesMobileModal=St;exports.ProductCardButtons=ea;exports.ProductOptions=Fi;exports.RangeSelector=pt;exports.ShareLink=zo;exports.ShoppingButton=yt;exports.ShoppingModalCart=It;exports.TextSettings=gt;exports.TextareaUI=aa;exports.TypesText=jt;exports.UserInfo=ft;