@billgangcom/theme-lib 1.66.4 → 1.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-Bt0EfByO.cjs"),j=require("react"),ct="_wrapper_kh9z8_2",lt="_block_kh9z8_8",dt="_title_kh9z8_16",ut="_subtitle_kh9z8_23",xt="_alignmentContent_kh9z8_30",pt="_alignments_kh9z8_39",mt="_alignment_kh9z8_30",ht="_circle_kh9z8_64",jt="_paddings_kh9z8_71",_t="_padding_kh9z8_71",gt="_active_kh9z8_97",ft="_input_kh9z8_104",V={wrapper:ct,block:lt,title:dt,subtitle:ut,alignmentContent:xt,alignments:pt,alignment:mt,circle:ht,paddings:jt,padding:_t,active:gt,input:ft},Et=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Rt=["left","top","right","bottom"],vt=r=>{const{alignment:i,padding:o,setPadding:s,setAlignment:e,isAlignment:l=!0,isPadding:c=!0}=r;function p(u){switch(u){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 m(u){switch(u){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[h,S]=j.useState(null),[f,n]=j.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:V.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:V.title,children:"Layout (for Desktop version)"}),t.jsxRuntimeExports.jsxs("div",{className:V.alignmentContent,children:[l&&t.jsxRuntimeExports.jsxs("div",{className:V.block,children:[t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsx("div",{className:V.alignments,children:Et.map(u=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{e(u)},className:V.alignment,onMouseEnter:()=>{S(u)},onMouseLeave:()=>{S(null)},children:[u!==i&&h!==u&&t.jsxRuntimeExports.jsx("div",{className:V.circle}),u!==i&&h===u&&t.jsxRuntimeExports.jsx(t.Icon,{name:p(h),fill:"#c2c2c2",width:22,height:22}),u===i&&t.jsxRuntimeExports.jsx(t.Icon,{name:p(i),fill:"#FF3F19",width:22,height:22})]},u))})]}),c&&t.jsxRuntimeExports.jsxs("div",{className:V.block,children:[t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:"Paddings"}),t.jsxRuntimeExports.jsx("div",{className:V.paddings,children:Rt.map(u=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(V.padding,{[V.active]:f===u}),onFocus:()=>{n(u)},onBlur:()=>{n(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:m(u),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(o[u]),onChange:a=>s({...o,[u]:Math.min(Number(a),999)}),max:999,paddingless:!0,borderless:!0})]},u))})]})]})]})},yt="_title_82zux_1",bt="_subtitle_82zux_5",It="_header_82zux_12",St="_text_82zux_13",Nt="_productsBlock_82zux_14",$t="_top_82zux_26",Ct="_itemsBlock_82zux_35",kt="_typeTexts_82zux_41",qt="_block_82zux_48",wt="_active_82zux_61",Bt="_products_82zux_14",Pt="_product_82zux_14",Tt="_button_82zux_80",Mt="_disabled_82zux_91",At="_image_82zux_95",Ot="_info_82zux_102",Lt="_name_82zux_114",Dt="_buttons_82zux_118",zt="_modal_82zux_125",Ft="_link_82zux_145",Ut="_modalOptions_82zux_151",Vt="_addButton_82zux_157",Ht="_deleteButton_82zux_179",H={title:yt,subtitle:bt,header:It,text:St,productsBlock:Nt,top:$t,itemsBlock:Ct,typeTexts:kt,block:qt,active:wt,products:Bt,product:Pt,button:Tt,disabled:Mt,image:At,info:Ot,name:Lt,buttons:Dt,modal:zt,link:Ft,modalOptions:Ut,addButton:Vt,deleteButton:Ht};function Yt({id:r,children:i}){const{attributes:o,listeners:s,setNodeRef:e,transform:l,transition:c,isDragging:p}=t.useSortable({id:r}),m={transform:t.CSS.Transform.toString(l),transition:c};return t.jsxRuntimeExports.jsx("div",{ref:e,style:m,className:`${H.product} ${p?H.dragging:""}`,...o,...s,children:i})}const Wt=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,other:l,tags:c,title:p,subtitle:m,draggable:h=!1,withImage:S=!1,addable:f=!0,itemsOptions:n,hasRangeSelector:u=!1,rangeSelectorOptions:a,limit:w,autoScrollInterval:_,deletable:y,aspectRatio:b,setAspectRatio:T}=r,L=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),A=x=>{const{active:I,over:N}=x;if(N&&I.id!==N.id){const R=s.findIndex(B=>B===I.id),C=s.findIndex(B=>B===N.id);if(R!==-1&&C!==-1){const B=[...s],[g]=B.splice(R,1);B.splice(C,0,g),e(B)}}};function E(x){if(S)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 D=(x,I=!1)=>{const N=n.find(C=>C.id===x);if(!N)return;const R=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:C=>{const B=[...s],g=n.find(d=>d.name===C);if(!g)return;const P=g.id,z=B.map(d=>d===x?P:d);e([...z])},value:N.name,options:n.filter(C=>!s.find(B=>B===C.id)).map(C=>C.name),leftAddonOptions:n.map(C=>({value:C.name,addon:E(C.images)}))}),I&&t.jsxRuntimeExports.jsx("div",{className:H.buttons,children:t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>e(s.filter(C=>C!==x))})})})]});return h?t.jsxRuntimeExports.jsx(Yt,{id:x,children:R},t.v4()):t.jsxRuntimeExports.jsx("div",{className:H.product,children:R},t.v4())};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(p||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[p&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:p}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:x=>o==null?void 0:o(x)})]}),u&&a&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...a}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[m&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:m}),h?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:L,onDragEnd:A,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s,strategy:t.verticalListSortingStrategy,children:s.map(x=>D(x,y))})}):s.map(x=>D(x,y)),f&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(H.button,{[H.disabled]:!!(w&&w<=s.length||s.length===n.length)}),size:"s",disabled:!!(w&&w<=s.length||s.length===n.length),onClick:()=>{const x=[...s];let I=null;if(n){for(let N=0;N<n.length;N++)if(!s.find(R=>R===n[N].id)){I=n[N];break}}x.push((I==null?void 0:I.id)||n[0].id),e(x)},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})]})})})]}),b&&T&&t.jsxRuntimeExports.jsx(t.Select,{value:b,label:"Aspect Ratio",options:Object.keys(t.aspectRatio),onChange:x=>T(x),leftAddonOptions:t.aspectRatioOptions}),c!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{tagsTitle:"Tags",items:c}),l!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:l}),_!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(_.scrollInterval),onChange:x=>_.setScrollInterval(Number(x)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Gt="_title_roi3a_1",Xt="_subtitle_roi3a_5",Qt="_header_roi3a_12",Jt="_text_roi3a_13",Kt="_productsBlock_roi3a_14",Zt="_top_roi3a_26",te="_itemsBlock_roi3a_35",ee="_typeTexts_roi3a_41",se="_block_roi3a_48",ne="_active_roi3a_61",ie="_products_roi3a_14",oe="_product_roi3a_14",ae="_button_roi3a_80",re="_disabled_roi3a_91",ce="_image_roi3a_95",le="_info_roi3a_102",de="_name_roi3a_114",ue="_buttons_roi3a_118",xe="_modal_roi3a_125",pe="_link_roi3a_145",me="_modalOptions_roi3a_151",he="_addButton_roi3a_164",je="_deleteButton_roi3a_179",_e="_closeIcon_roi3a_191",F={title:Gt,subtitle:Xt,header:Qt,text:Jt,productsBlock:Kt,top:Zt,itemsBlock:te,typeTexts:ee,block:se,active:ne,products:ie,product:oe,button:ae,disabled:re,image:ce,info:le,name:de,buttons:ue,modal:xe,link:pe,modalOptions:me,addButton:he,deleteButton:je,closeIcon:_e};function ge({product:r,children:i}){const{attributes:o,listeners:s,setNodeRef:e,transform:l,transition:c,isDragging:p}=t.useSortable({id:r.id}),m={transform:t.CSS.Transform.toString(l),transition:c};return t.jsxRuntimeExports.jsx("div",{ref:e,style:m,className:`${F.product} ${p?F.dragging:""}`,...o,...s,children:i})}const fe=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,title:l,subtitle:c,editable:p=!0,draggable:m=!1,deletable:h=!0,addable:S=!0,itemsType:f,itemsOptions:n,addableOptions:u={},limit:a}=r,[w,_]=j.useState(null),[y,b]=j.useState(null),T=j.useRef(null),L=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{if(w){const x=[...s].map(I=>I.id===w.id?w:I);e(x)}},[w]),j.useEffect(()=>{T.current&&y&&(T.current.getBoundingClientRect().height,y.top)},[T.current,y]);const A=(x,I)=>{x.stopPropagation();const N=x.target.getBoundingClientRect();b({top:N.top+window.scrollY,left:N.left-30}),_(I)},E=x=>{const{active:I,over:N}=x;if(N&&I.id!==N.id){const R=s.findIndex(B=>B.id===I.id),C=s.findIndex(B=>B.id===N.id);if(R!==-1&&C!==-1){const B=[...s],[g]=B.splice(R,1);B.splice(C,0,g),e(B)}}},D=(x,I)=>{const N=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[m&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),f==="select"&&n&&t.jsxRuntimeExports.jsx(t.Select,{onChange:R=>{const C=[...s],B=n.find(P=>P.name===R);if(!B)return;const g=C.map(P=>P.id===x.id?{...B,name:{"en-US":R}}:P);_({...x,name:{"en-US":R}}),e([...g])},value:x.name,options:n.filter(R=>!s.find(C=>C.name===R.name)).map(R=>R.name)}),t.jsxRuntimeExports.jsxs("div",{className:F.buttons,children:[p&&t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:R=>A(R,x)})}),h&&t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>e(s.filter(R=>R.id!==x.id))})})]})]});return m?t.jsxRuntimeExports.jsx(ge,{product:x,index:I,children:N},x.id):t.jsxRuntimeExports.jsx("div",{className:F.product,children:N},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:F.productsBlock,children:[(l||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[l&&t.jsxRuntimeExports.jsx("h3",{className:F.title,children:l}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:x=>o==null?void 0:o(x)})]}),t.jsxRuntimeExports.jsxs("div",{className:F.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:c}),m?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:L,onDragEnd:E,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(x=>x.id),strategy:t.verticalListSortingStrategy,children:s.map((x,I)=>D(x,I))})}):s.map((x,I)=>D(x,I)),S&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(F.button,{[F.disabled]:!!(a&&a<=s.length||s.length===(n==null?void 0:n.length))}),size:"s",disabled:!!(a&&a<=s.length||s.length===(n==null?void 0:n.length)),onClick:()=>{const x=[...s];let I=null;if(n){for(let N=0;N<n.length;N++)if(!s.find(R=>R.id===n[N].id)){I=n[N];break}}f==="select"&&n&&x.push({name:I?I.name:n[0].name,id:(I==null?void 0:I.id)||n[0].id,...u}),e(x)},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})]})})})]})]})};function Ee(r){const{product:i,children:o}=r,{attributes:s,listeners:e,setNodeRef:l,transform:c,transition:p,isDragging:m}=t.useSortable({id:i.id}),h={transform:t.CSS.Transform.toString(c),transition:p};return t.jsxRuntimeExports.jsx("div",{ref:l,style:h,className:`${t.styles.product} ${m?t.styles.dragging:""}`,...s,...e,children:o})}const Re=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,other:l,title:c,subtitle:p,editable:m=!0,draggable:h=!1,deletable:S=!0,addable:f=!0,itemsType:n,itemsPlaceholder:u="",itemsOptions:a,hasRangeSelector:w=!1,rangeSelectorOptions:_,modalOptions:y,addableOptions:b={},limit:T}=r,[L,A]=j.useState(null),[E,D]=j.useState({top:0,left:0}),[x,I]=j.useState(null),N=j.useRef(null),[R,C]=j.useState(!1),B=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{const d=()=>{A(null),C(!1)};return document.body.addEventListener("click",d),A(null),C(!1),()=>{A(null),C(!1),document.body.removeEventListener("click",d)}},[]),j.useEffect(()=>{if(L){const d=[...s].map(q=>q.id===L.id?L:q);e(d)}},[L]),j.useEffect(()=>{if(N.current&&x){const d=N.current.getBoundingClientRect().height,q=window.innerHeight;let v=x.top;v+d>q+window.scrollY-200&&(v=q+window.scrollY-d-200),v<0&&(v=10),D({top:v,left:x.left})}},[N.current,x]);const g=(d,q)=>{d.stopPropagation();const v=d.target.getBoundingClientRect();I({top:v.top+window.scrollY,left:v.left-30}),A(q),C(!0)},P=d=>{const{active:q,over:v}=d;if(v&&q.id!==v.id){const M=s.findIndex(O=>O.id===q.id),W=s.findIndex(O=>O.id===v.id);if(M!==-1&&W!==-1){const O=[...s],[Y]=O.splice(M,1);O.splice(W,0,Y),e(O)}}},z=d=>{var v;const q=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),n==="select"&&a&&t.jsxRuntimeExports.jsx(t.Select,{onChange:M=>{const O=[...s].map(Y=>Y.id===d.id?{...d,name:{"en-US":M}}:Y);A({...d,name:{"en-US":M}}),e([...O])},value:d.name["en-US"],options:a.filter(M=>!s.find(W=>W.name["en-US"]===M))}),n==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:M=>{const O=[...s].map(Y=>Y.id===d.id?{...d,name:{"en-US":M}}:Y);e([...O])},value:d.name["en-US"],placeholder:u}),n==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:M=>{const O=[...s].map(Y=>Y.id===d.id?{...d,images:M}:Y);e([...O])},activeImage:(v=s.find(M=>M.id===d.id))==null?void 0:v.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.buttons,children:[m&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:M=>g(M,d)})}),S&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>e(s.filter(M=>M.id!==d.id))})})]})]});return h?t.jsxRuntimeExports.jsx(Ee,{product:d,children:q},d.id):t.jsxRuntimeExports.jsx("div",{className:t.styles.product,children:q},d.id)};return t.jsxRuntimeExports.jsxs("div",{className:t.styles.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:t.styles.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:d=>o==null?void 0:o(d)})]}),L&&m&&y&&R&&t.jsxRuntimeExports.jsx(t.ItemPopup,{ref:N,activeItem:L,setActiveItem:A,popupPosition:E,modalOptions:y,setIsOpenModal:C}),w&&_&&t.jsxRuntimeExports.jsx(t.RangeSelector,{..._}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.products,children:[p&&t.jsxRuntimeExports.jsx("h5",{className:t.styles.subtitle,children:p}),h?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:B,onDragEnd:P,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(d=>d.id),strategy:t.verticalListSortingStrategy,children:s.map(d=>z(d))})}):s.map(d=>z(d)),f&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(t.styles.button,{[t.styles.disabled]:!!(T&&T<=s.length)}),size:"s",disabled:!!(T&&T<=s.length),onClick:()=>{const d=[...s];let q=null;if(a){for(let v=0;v<a.length;v++)if(!s.find(M=>M.name["en-US"]===a[v])){q=a[v];break}}n==="select"&&a?d.push({name:{"en-US":q||a[0]},id:t.v4(),...b,maxSymbols:100}):n==="input"?d.push({name:{"en-US":""},id:t.v4(),...b,maxSymbols:100}):d.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),...b,maxSymbols:100}),e(d)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),l!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:l})]})},ve="_subtitle_jql1y_1",ye="_header_jql1y_8",be="_text_jql1y_9",Ie="_productsBlock_jql1y_10",Se="_buttonsBlock_jql1y_11",Ne="_top_jql1y_23",$e="_itemsBlock_jql1y_32",Ce="_typeTexts_jql1y_38",ke="_block_jql1y_45",qe="_active_jql1y_58",we="_products_jql1y_10",Be="_product_jql1y_10",Pe="_button_jql1y_11",Te="_image_jql1y_88",Me="_info_jql1y_95",Ae="_name_jql1y_107",Oe="_buttons_jql1y_11",Le="_modal_jql1y_118",De="_other_jql1y_138",ze="_options_jql1y_144",Fe="_addButton_jql1y_150",Ue="_deleteButton_jql1y_165",G={subtitle:ve,header:ye,text:be,productsBlock:Ie,buttonsBlock:Se,top:Ne,itemsBlock:$e,typeTexts:Ce,block:ke,active:qe,products:we,product:Be,button:Pe,image:Te,info:Me,name:Ae,buttons:Oe,modal:Le,other:De,options:ze,addButton:Fe,deleteButton:Ue},et=r=>{const{buttons:i,setButtons:o,deletable:s=!0,addable:e=!0,editableLink:l=!0}=r,{pages:c}=t.usePagesStore(),[p,m]=j.useState(null),[h,S]=j.useState({top:0,left:0}),[f,n]=j.useState(null),u=j.useRef(null);j.useEffect(()=>{if(p){const _=[...i].map(y=>y.id===p.id?p:y);o(_)}},[p]),j.useEffect(()=>{if(u.current&&f){const _=u.current.getBoundingClientRect().height,y=window.innerHeight;let b=f.top;b+_>y+window.scrollY-200&&(b=y+window.scrollY-_-200),b<0&&(b=10),S({top:b,left:f.left})}},[u.current,f]);const a=(_,y)=>{_.stopPropagation();const b=_.target.getBoundingClientRect();n({top:b.top+window.scrollY-70,left:b.left-(e?30:65)}),m(y)},w=(_,y)=>{const b=[...i],T={..._,id:Math.random().toString(36).substr(2,9)};b.splice(y+1,0,T),o(b)};return t.jsxRuntimeExports.jsxs("div",{className:G.products,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:"Button Type"}),i.map((_,y)=>t.jsxRuntimeExports.jsxs("div",{className:G.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:b=>{const L=[...i].map(A=>A.id===_.id?{..._,type:b}:A);o(L)},value:_.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:G.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:G.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{w(_,y)}})}),t.jsxRuntimeExports.jsx("div",{className:G.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:b=>{a(b,_)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:G.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const b=i.filter(T=>T.id!==_.id);o(b)},width:20,height:20,fill:"#C12A2A"})})]})]},_.id)),p&&t.jsxRuntimeExports.jsx(t.ButtonPopup,{ref:u,activeButton:p,setActiveButton:m,popupPosition:h,editableLink:l}),e&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:G.button,size:"s",onClick:()=>{const _=[...i];l?_.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Button Name"},destination:"Go to Page",page:c?Object.values(c)[0].path:"/",openInNewTab:!1}):_.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Create Ticket"},destination:"Go to Page",page:c?Object.values(c)[0].path:"/",openInNewTab:!1}),o(_)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:G.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},Ve=r=>{const{isActiveButtons:i,setIsActiveButtons:o,buttons:s,setButtons:e,editableLink:l=!0,addable:c=!0,deletable:p=!0}=r;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.top,children:[t.jsxRuntimeExports.jsx("h3",{className:t.styles$1.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:m=>o(m)})]}),i&&t.jsxRuntimeExports.jsx(et,{buttons:s,setButtons:e,editableLink:l,addable:c,deletable:p})]})})};function He(r){const{product:i,children:o}=r,{attributes:s,listeners:e,setNodeRef:l,transform:c,transition:p,isDragging:m}=t.useSortable({id:String(i.listingId)}),h={transform:t.CSS.Transform.toString(c),transition:p};return t.jsxRuntimeExports.jsx("div",{ref:l,style:h,className:`${t.styles$2.product} ${m?t.styles$2.dragging:""}`,...s,...e,children:o})}const Ye=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,other:l,title:c,subtitle:p,editable:m=!0,draggable:h=!1,withImage:S=!1,deletable:f=!0,addable:n=!0,itemsType:u,itemsOptions:a,limit:w,aspectRatio:_,setAspectRatio:y}=r,[b,T]=j.useState(null),[L,A]=j.useState({top:0,left:0}),[E,D]=j.useState(!1),x=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{const g=()=>{T(null),D(!1)};return document.body.addEventListener("click",g),T(null),D(!1),()=>{T(null),D(!1),document.body.removeEventListener("click",g)}},[]),j.useEffect(()=>{if(b){const g=[...s].map(P=>P.listingId===b.listingId?b:P);e(g)}},[b]);const I=(g,P)=>{g.stopPropagation();const z=g.target.getBoundingClientRect(),d=100,q=window.innerHeight;let v=z.top+window.scrollY;v+d>q&&(v=q-d-20),D(!0),A({top:v-80,left:z.left-30}),T(P)};function N(g){if(S)return g?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${g}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const R=g=>{const{active:P,over:z}=g;if(z&&P.id!==z.id){const d=s.findIndex(v=>String(v.listingId)===P.id),q=s.findIndex(v=>String(v.listingId)===z.id);if(d!==-1&&q!==-1){const v=[...s],[M]=v.splice(d,1);v.splice(q,0,M),e(v)}}},C=g=>{const P=a.find(d=>g.listingId===d.id);if(!P)return null;const z=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),u==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:d=>{const q=[...s],v=a.find(O=>O.productData.name===d);if(!v)return;const M={listingId:v.id,image:v.productData.images.length>0?v.productData.images[0].cfId:""},W=q.map(O=>O.listingId===g.listingId?M:O);T(M),e([...W])},value:P.productData.name,options:[...a.filter(d=>!s.find(q=>q.listingId===d.id)).map(d=>d.productData.name)],leftAddonOptions:a.map(d=>{var q;return{value:d.productData.name,addon:N(((q=d.productData.images[0])==null?void 0:q.cfId)||"")}})}),t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.buttons,children:[m&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:d=>I(d,g)})}),f&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>e(s.filter(d=>d!==g))})})]})]});return h?t.jsxRuntimeExports.jsx(He,{product:g,children:z},g.listingId):t.jsxRuntimeExports.jsx("div",{className:t.styles$2.product,children:z},g.listingId)},B=j.useRef(null);return t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.productsBlock,children:[(c||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:t.styles$2.title,children:c}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:g=>o==null?void 0:o(g)})]}),E&&b&&t.jsxRuntimeExports.jsx(t.ListingPopup,{ref:B,activeItem:b,setActiveItem:T,setIsOpenModal:D,popupPosition:L,itemsOptions:a}),i&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.products,children:[p&&t.jsxRuntimeExports.jsx("h5",{className:t.styles$2.subtitle,children:p}),h?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:x,onDragEnd:R,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(g=>String(g.listingId)),strategy:t.verticalListSortingStrategy,children:s.map(g=>C(g))})}):s.map(g=>C(g)),n&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.styles$2.button,size:"s",onClick:()=>{const g=[...s];for(let P=0;P<a.length;P++)if(!s.find(z=>z.listingId===a[P].id)){g.push({listingId:a[P].id,image:a[P].productData.images.length>0?a[P].productData.images[0].cfId:""});break}e(g)},disabled:s.length===(w||a.length),style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),_&&y&&t.jsxRuntimeExports.jsx(t.Select,{value:_,options:Object.keys(t.aspectRatio),onChange:g=>y(g),leftAddonOptions:t.aspectRatioOptions}),i&&l!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:l})]})},We="_options_1aiq8_1",Ge="_price_1aiq8_18",Xe="_oldPrice_1aiq8_25",Qe="_newPrice_1aiq8_33",Je="_animate_1aiq8_40",Ke="_appearAndBounce_1aiq8_1",Ze="_meta_1aiq8_58",ts="_info_1aiq8_64",es="_infoRight_1aiq8_72",ss="_buttons_1aiq8_79",ns="_variants_1aiq8_86",is="_variant_1aiq8_86",os="_stock_1aiq8_104",as="_variantInfo_1aiq8_111",rs="_quantity_1aiq8_117",cs="_count_1aiq8_124",ls="_focused_1aiq8_141",ds="_button_1aiq8_79",us="_activeVariant_1aiq8_167",xs="_chargeTypes_1aiq8_171",ps="_charge_1aiq8_171",ms="_chargeActive_1aiq8_196",hs="_title_1aiq8_204",k={options:We,price:Ge,oldPrice:Xe,newPrice:Qe,animate:Je,appearAndBounce:Ke,meta:Ze,info:ts,infoRight:es,buttons:ss,variants:ns,variant:is,stock:os,variantInfo:as,quantity:rs,count:cs,focused:ls,button:ds,activeVariant:us,chargeTypes:xs,charge:ps,chargeActive:ms,title:hs};var K=(r=>(r.ONE_TIME="One-Time",r.RECURRING="Subscribe & Save",r))(K||{});const st=r=>{var L,A;const{product:i,setIsOpen:o}=r,{variants:s}=i,[e,l]=j.useState(s[0]),[c,p]=j.useState(e.chargeTypes?e.chargeTypes[0]:"ONE_TIME"),m=t.useNavigate(),[h,S]=j.useState(1),{reset:f,addProductToCart:n,addProducts:u}=t.di(),[a,w]=j.useState(!1),{pageContext:_}=t.usePagesStore();j.useEffect(()=>{w(!0);const E=setTimeout(()=>w(!1),600);return()=>clearTimeout(E)},[h]);async function y(){await u((_==null?void 0:_.products)||[]),await n({productId:i.id,productVariantId:e.id,quantity:h}),o==null||o(!1)}function b(){f(),y(),m("/checkout")}function T(E){if(E>=864e5){const R=Math.floor(E/864e5);return`${R} ${R===1?"day":"days"}`}else if(E>=36e5){const R=Math.floor(E/36e5);return`${R} ${R===1?"hour":"hours"}`}else if(E>=6e4){const R=Math.floor(E/6e4);return`${R} ${R===1?"minute":"minutes"}`}else{const R=Math.floor(E/1e3);return`${R} ${R===1?"second":"seconds"}`}}return j.useEffect(()=>{e.quantity&&e.quantity.available===0&&S(0)},[e.quantity.available]),t.jsxRuntimeExports.jsxs("div",{className:k.options,children:[e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:k.chargeTypes,children:e.chargeTypes.map(E=>t.jsxRuntimeExports.jsx("div",{className:t.clx(k.charge,{[k.chargeActive]:c===E}),onClick:()=>p(E),children:K[E]},E))}),t.jsxRuntimeExports.jsx("div",{className:k.variants,children:s.map(E=>{var D,x;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(k.variant,{[k.activeVariant]:e.id===E.id}),onClick:()=>l(E),children:[t.jsxRuntimeExports.jsxs("div",{className:k.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:k.title,children:t.splitTextIntoSpans(E.name)}),t.jsxRuntimeExports.jsxs("span",{children:["$",c==="ONE_TIME"?E.price.amount:E.subscriptionSettings?E.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:c==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:k.stock,children:[(D=E.quantity.restrictions)!=null&&D.max||E.quantity.available!==void 0?((x=E.quantity.restrictions)==null?void 0:x.max)||E.quantity.available:"∞"," ","in stock"]})})]},E.id)})}),c==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:k.quantity,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{h>1?S(E=>E-1):S(1)},className:k.button,disabled:e.quantity.available&&e.quantity.restrictions&&h<=e.quantity.restrictions.min||e.quantity.available===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(t.Input$1,{type:"number",value:String(h),onChange:E=>S(Number(E)),max:((L=e.quantity.restrictions)==null?void 0:L.max)||e.quantity.available||Number.POSITIVE_INFINITY,min:((A=e.quantity.restrictions)==null?void 0:A.min)||0,centered:!0,disabled:e.quantity&&e.quantity.available===0||Object.keys(e.quantity.restrictions||{}).length!==0&&h>=e.quantity.restrictions.max}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{S(E=>E+1)},className:k.button,disabled:!!(e.quantity.available&&e.quantity.restrictions&&h>=e.quantity.restrictions.max||e.quantity.available===0),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":T(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:k.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:k.infoRight,children:c==="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]:a}),children:["$ ",(e.price.amount||0)*h]}),t.jsxRuntimeExports.jsxs("span",{className:k.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*h]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(k.newPrice,{[k.animate]:a}),children:["$ ",(e.price.amount||0)*h]}):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]:a}),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]:a}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:k.buttons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>b(),disabled:e.quantity&&e.quantity.available===0,children:c==="ONE_TIME"?"Buy Now":"Subscribe Now"}),c==="ONE_TIME"&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>y(),disabled:e.quantity&&e.quantity.available===0,children:"Add to Cart"})]})]})},js="_button_14q75_1",_s="_login_14q75_14",gs="_signUp_14q75_18",fs="_buttons_14q75_23",Es="_modal_14q75_32",Rs="_closing_14q75_64",vs="_info_14q75_113",ys="_top_14q75_120",bs="_title_14q75_131",Is="_clear_14q75_138",Ss="_activeClear_14q75_145",Ns="_count_14q75_149",$s="_cart_14q75_164",Cs="_empty_14q75_172",ks="_product_14q75_198",qs="_products_14q75_207",ws="_image_14q75_215",Bs="_productInfo_14q75_230",Ps="_content_14q75_237",Ts="_name_14q75_243",Ms="_price_14q75_249",As="_productButtons_14q75_255",Os="_productButton_14q75_255",Ls="_productCount_14q75_272",Ds="_bottom_14q75_289",zs="_subtotal_14q75_297",Fs="_block_14q75_305",Us="_shoppingCount_14q75_312",Vs="_total_14q75_332",Hs="_link_14q75_338",Ys="_userInfo_14q75_345",Ws="_pagesMobileModal_14q75_356",Gs="_pagesMobileModalContent_14q75_370",Xs="_pagesMobileModalHeader_14q75_376",Qs="_pagesMobileModalFooter_14q75_386",$={button:js,login:_s,signUp:gs,buttons:fs,modal:Es,"slide-in-fade":"_slide-in-fade_14q75_1","mobile-slide-in-fade":"_mobile-slide-in-fade_14q75_1",closing:Rs,"mobile-slide-out-fade":"_mobile-slide-out-fade_14q75_1","slide-out-fade":"_slide-out-fade_14q75_1",info:vs,top:ys,title:bs,clear:Is,activeClear:Ss,count:Ns,cart:$s,empty:Cs,product:ks,products:qs,image:ws,productInfo:Bs,content:Ps,name:Ts,price:Ms,productButtons:As,productButton:Os,productCount:Ls,bottom:Ds,subtotal:zs,block:Fs,shoppingCount:Us,total:Vs,link:Hs,userInfo:Ys,pagesMobileModal:Ws,pagesMobileModalContent:Gs,pagesMobileModalHeader:Xs,pagesMobileModalFooter:Qs},Js=r=>{const{shopping:i,signUp:o,isShowUserInfo:s=!0}=r;return t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[i&&t.jsxRuntimeExports.jsx(nt,{}),s&&t.jsxRuntimeExports.jsx(tt,{signUp:o})]})},nt=()=>{const[r,i]=j.useState(!1),[o,s]=j.useState([]),{cart:e}=t.di(),{pageContext:l}=t.usePagesStore();function c(n){if(n.variants.length>0){for(let u=0;u<e.parts.length;u++)for(let a=0;a<n.variants.length;a++)if(n.variants[a]&&e.parts[u].productVariantId===n.variants[a].id)return e.parts[u].productVariantId}return n.variants[0].id}function p(n){for(let u=0;u<e.parts.length;u++)for(let a=0;a<n.variants.length;a++)if(n.variants[a]&&e.parts[u].productVariantId===n.variants[a].id)return e.parts[u].quantity}j.useEffect(()=>{(async()=>{var _;const u=e.parts.map(y=>String(y.productId)),w=(((_=l==null?void 0:l.products)==null?void 0:_.filter(y=>u.includes(String(y.id))))||[]).map(y=>({...y,activeVariantId:c(y),quantity:p(y)}));s(w)})()},[e.parts]);function m(n){var u;return!n||!(n!=null&&n.variants)?!1:(u=n.variants.find(a=>a.id===n.activeVariantId))==null?void 0:u.subscriptionSettings}const h=e.parts.length>0&&o.length>0&&!m(o[0]),[S,f]=j.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",style:{padding:10,position:"relative"},onClick:n=>{n.stopPropagation(),window.location.pathname.includes("/admin/builder")||(i(!0),f(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-primary)"}),h&&t.jsxRuntimeExports.jsx("div",{className:$.shoppingCount,children:e.parts.length})]}),r&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>{f(!1),setTimeout(()=>{i(!1)},300)},withAnimation:!1,children:t.jsxRuntimeExports.jsx(it,{activeProducts:o,isCartNotEmpty:h,isOpen:S})})]})},it=r=>{const{activeProducts:i,isCartNotEmpty:o,isOpen:s}=r,{cart:e,reset:l,getTotalAndDiscount:c,updateQuantityOfProduct:p}=t.di(),m=t.useNavigate();function h(n){m(n)}function S(n){n.quantity&&p({productId:n.id,productVariantId:n.activeVariantId,quantity:n.quantity+1})}function f(n){n.quantity&&p({productId:n.id,productVariantId:n.activeVariantId,quantity:n.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx($.modal,{[$.closing]:!s}),onClick:n=>n.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsxs("div",{className:$.info,children:[t.jsxRuntimeExports.jsx("span",{className:$.title,children:"Cart"}),o&&t.jsxRuntimeExports.jsx("div",{className:$.count,children:e.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx($.clear,{[$.activeClear]:o}),disabled:!o,onClick:l,children:"Clear all"})]}),o?t.jsxRuntimeExports.jsxs("div",{className:$.cart,children:[t.jsxRuntimeExports.jsx("div",{className:$.products,children:i.map(n=>t.jsxRuntimeExports.jsxs("div",{className:$.product,children:[t.jsxRuntimeExports.jsxs("div",{className:$.productInfo,children:[n.images.length>0?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${n.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:$.image}):t.jsxRuntimeExports.jsx("div",{className:$.image,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsxs("div",{className:$.content,children:[t.jsxRuntimeExports.jsx("div",{className:$.name,children:t.splitTextIntoSpans(n.name)}),t.jsxRuntimeExports.jsxs("div",{className:$.price,children:["$",n.variants.find(u=>u.id===n.activeVariantId).price.amount*((n==null?void 0:n.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:$.productButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{n.quantity!==1&&f(n)},className:$.productButton,disabled:n.quantity===1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:$.productCount,children:n.quantity}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>S(n),className:$.productButton,disabled:n.quantity===n.variants.find(u=>u.id===n.activeVariantId).quantity.available,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},n.id))}),t.jsxRuntimeExports.jsxs("div",{className:$.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:$.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:$.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:$.total,children:["$",c().total]})]}),t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>h("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(ot,{})]})},ot=()=>t.jsxRuntimeExports.jsxs("div",{className:$.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-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:$.link,children:"view products"})]})]}),tt=({signUp:r,close:i})=>{const o=JSON.parse(localStorage.getItem("token")||"{}"),{data:s}=o,e=t.useNavigate();function l(m){window.location.pathname.includes("/admin/builder")||e(m)}if(!s)return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{l("/customer-dash"),i==null||i()},type:"Secondary",style:{padding:10},children:"Login"}),r&&t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{l("/customer-dash"),i==null||i()},type:"Primary",style:{padding:10,whiteSpace:"nowrap"},children:"Sign Up"})]});const[c,p]=j.useState("test-email@gmail.com");return j.useEffect(()=>{(async()=>{const h=t.jwtDecode(s);p(h.email)})()},[s]),t.jsxRuntimeExports.jsx("div",{className:$.userInfo,onClick:()=>{l("/customer-dash"),i==null||i()},children:t.jsxRuntimeExports.jsx("div",{children:c||"test-email@gmail.com"})})},at=({children:r,logo:i,setIsOpen:o,signUp:s})=>{const{setIsOpen:e}=t.useModalStore(),l=()=>{e(!1),setTimeout(()=>{o(!1),e(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:$.pagesMobileModal,onClick:c=>c.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:$.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:i}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:l,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"var(--text-primary)"})})]}),t.jsxRuntimeExports.jsx("div",{className:$.pagesMobileModalContent,children:r}),t.jsxRuntimeExports.jsx("div",{className:$.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(tt,{signUp:s,close:l})})]})},Ks=({children:r,logo:i,signUp:o})=>{const[s,e]=j.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(rt,{setIsOpenModal:e}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>e(!1),hasPadding:!1,children:t.jsxRuntimeExports.jsx(at,{logo:i,setIsOpen:e,signUp:o,children:r})})]})},rt=r=>{const{setIsOpenModal:i}=r;return t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{padding:10},onClick:o=>{o.stopPropagation(),window.location.pathname.includes("/admin/builder")||i(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List",fill:"var(--text-primary)"})})},Zs="_share_10urc_1",tn="_modal_10urc_9",en="_header_10urc_21",sn="_socials_10urc_31",nn="_social_10urc_31",on="_copy_10urc_41",an="_title_10urc_48",rn="_copyWrapper_10urc_54",cn="_copyText_10urc_63",ln="_copyTextMobile_10urc_76",dn="_copyTextMiniMobile_10urc_95",X={share:Zs,modal:tn,header:en,socials:sn,social:nn,copy:on,title:an,copyWrapper:rn,copyText:cn,copyTextMobile:ln,copyTextMiniMobile:dn},un=({title:r="Copy Product Link"})=>{const{isOpenModal:i,setIsOpenModal:o}=t.useShareLinkStore();function s(){o(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{className:X.share,onClick:e=>{e.stopPropagation(),s()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),i&&t.jsxRuntimeExports.jsx(t.Modal,{close:o,children:t.jsxRuntimeExports.jsx(xn,{title:r})})]})},xn=({title:r="Copy Product Link"})=>{const{setIsOpenModal:i}=t.useShareLinkStore(),{notification:o,setNotification:s}=t.useNotificationStore(),{setIsOpen:e}=t.useModalStore(),l=window.location.href;function c(){navigator.clipboard.writeText(l),s({message:"Link copied to clipboard",status:"success"})}function p(){e(!1),setTimeout(()=>{i(!1),e(!0)},300)}function m(h,S){return h.length>S?h.slice(0,S)+"...":h}return t.jsxRuntimeExports.jsxs("div",{className:X.modal,onClick:h=>h.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:X.header,children:[t.jsxRuntimeExports.jsx("div",{className:X.title,children:r}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:p,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:X.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",onClick:c,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:X.copyText,children:m(l,100)}),t.jsxRuntimeExports.jsx("div",{className:X.copyTextMobile,children:m(l,40)}),t.jsxRuntimeExports.jsx("div",{className:X.copyTextMiniMobile,children:m(l,20)})]}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:c,children:o?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},pn="_accordion_1s1lq_1",mn="_header_1s1lq_9",hn="_icon_1s1lq_18",jn="_open_1s1lq_21",_n="_content_1s1lq_25",J={accordion:pn,header:mn,icon:hn,open:jn,content:_n},gn=({title:r,content:i,defaultOpen:o=!1})=>{const[s,e]=j.useState(o),[l,c]=j.useState(0),p=j.useRef(null),m=()=>{e(!s)};return j.useEffect(()=>{p.current&&c(s?p.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:J.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:J.header,onClick:m,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:r}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.icon,{[J.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:p,className:J.content,style:{height:`${l}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:i})})]})},fn=({children:r,path:i,className:o,target:s="_self",id:e})=>{if(window.location.pathname.includes("/admin/builder"))return t.jsxRuntimeExports.jsx("div",{className:o,role:"link",style:{cursor:"pointer"},id:e,children:r});const l=t.useNavigate(),c=/^https?:\/\//.test(i),p=m=>{c||s==="_blank"?s==="_blank"?window.open(i,"_blank"):window.open(i,"_self"):(m.preventDefault(),l(i))};return t.jsxRuntimeExports.jsx("div",{onClick:p,className:o,role:"link",style:{cursor:"pointer"},id:e,children:r})},En="_buttonsBlock_1b2rb_1",Rn="_slideUp_1b2rb_1",vn={buttonsBlock:En,slideUp:Rn},yn=r=>{var h,S;const{setIsOpen:i,setModalType:o,productId:s}=r,{cart:e}=t.di(),{pageContext:l}=t.usePagesStore(),c=(h=l==null?void 0:l.listings)==null?void 0:h.find(f=>f.id===s);if(!c)return null;const p=(S=l==null?void 0:l.products)==null?void 0:S.find(f=>f.uniquePath===c.productData.uniquePath);if(!p)return null;const m=e.parts.find(f=>f.productId===p.id);return t.jsxRuntimeExports.jsxs("div",{className:vn.buttonsBlock,onClick:f=>f.stopPropagation(),children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{width:"100%"},onClick:()=>{o("Add To Cart"),i(!0)},children:m?"Add More":"Add To Cart"}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>{o("Buy Now"),i(!0)},children:"Buy"})]})},bn="_wrapper_27wzz_1",In="_logo_27wzz_8",Sn="_info_27wzz_12",Z={wrapper:bn,logo:In,info:Sn},Nn=({date:r})=>{const{general:i}=t.useGeneralStore();if(!i)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});function o(s){const e=new Date(s),l={month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return e.toLocaleDateString("en-US",l)}return t.jsxRuntimeExports.jsxs("div",{className:Z.wrapper,children:[t.jsxRuntimeExports.jsx("div",{className:Z.logo,children:i.info.logo?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.info.logo.cfId}/w=500,h=500`,alt:"image",style:{objectFit:"contain",width:"48px",height:"48px"}}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:48,height:48})}),t.jsxRuntimeExports.jsxs("div",{className:Z.info,children:[t.jsxRuntimeExports.jsx("h3",{id:"h4",children:i.info.name}),t.jsxRuntimeExports.jsx("p",{id:"p",children:o(r)})]})]})},$n="_options_puxd1_1",Cn="_price_puxd1_12",kn="_oldPrice_puxd1_19",qn="_newPrice_puxd1_27",wn="_animate_puxd1_34",Bn="_appearAndBounce_puxd1_1",Pn="_meta_puxd1_52",Tn="_info_puxd1_58",Mn="_infoRight_puxd1_66",An="_buttons_puxd1_73",On="_variants_puxd1_80",Ln="_variant_puxd1_80",Dn="_stock_puxd1_98",zn="_variantInfo_puxd1_105",Fn="_quantity_puxd1_111",Un="_count_puxd1_118",Vn="_focused_puxd1_135",Hn="_button_puxd1_73",Yn="_activeVariant_puxd1_161",Wn="_chargeTypes_puxd1_165",Gn="_charge_puxd1_165",Xn="_chargeActive_puxd1_190",Qn="_title_puxd1_198",Jn="_modal_puxd1_204",Kn="_header_puxd1_224",Zn="_productOptions_puxd1_232",ti="_loading_puxd1_236",U={options:$n,price:Cn,oldPrice:kn,newPrice:qn,animate:wn,appearAndBounce:Bn,meta:Pn,info:Tn,infoRight:Mn,buttons:An,variants:On,variant:Ln,stock:Dn,variantInfo:zn,quantity:Fn,count:Un,focused:Vn,button:Hn,activeVariant:Yn,chargeTypes:Wn,charge:Gn,chargeActive:Xn,title:Qn,modal:Jn,header:Kn,productOptions:Zn,loading:ti},ei=r=>{var f;const{pageContext:i,setPageContext:o}=t.usePagesStore(),s=(f=i==null?void 0:i.listings)==null?void 0:f.find(n=>n.id===r.productId),[e,l]=j.useState(!0),[c,p]=j.useState(null),m=(c==null?void 0:c.variants[0])||null,[h,S]=j.useState(m!=null&&m.chargeTypes&&m.chargeTypes.length>1?m.chargeTypes[0]:"ONE_TIME");if(j.useEffect(()=>{(async()=>{l(!0);const u=await t.getDynamicPage(encodeURIComponent(`/product/${s.productData.uniquePath}`));o({...i,products:[...(i==null?void 0:i.products)||[],...(u==null?void 0:u.data.products)||[]]}),p(u==null?void 0:u.data.products[0]),l(!1)})()},[]),e)return t.jsxRuntimeExports.jsx("div",{className:U.modal,onClick:n=>n.stopPropagation(),children:t.jsxRuntimeExports.jsx("div",{className:U.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})})});if(!c){r.setIsOpen(!1);return}if(!m){r.setIsOpen(!1);return}return t.jsxRuntimeExports.jsxs("div",{className:U.modal,onClick:n=>n.stopPropagation(),children:[r.type==="Add To Cart"&&!e&&t.jsxRuntimeExports.jsx(si,{variants:c.variants,activeVariant:m,activeChargeType:h,setActiveChargeType:S,productId:c.id,setIsOpen:r.setIsOpen}),r.type==="Buy Now"&&!e&&t.jsxRuntimeExports.jsx(ni,{product:c,setIsOpen:r.setIsOpen})]})},si=r=>{const{variants:i,activeChargeType:o,setActiveChargeType:s,activeVariant:e,productId:l,setIsOpen:c}=r,{cart:p,addProductToCart:m,addProducts:h,updateQuantityOfProduct:S}=t.di(),{setNotification:f}=t.useNotificationStore(),{pageContext:n}=t.usePagesStore();async function u(a){const w=p.parts.find(_=>_.productId===r.productId&&_.productVariantId===a);w?S({productId:l,productVariantId:a,quantity:w.quantity+1}):(n!=null&&n.products&&await h(n.products),await m({productId:l,productVariantId:a,quantity:1})),f({message:"Product added to cart",status:"success"})}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:U.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",children:"Choose a variant"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:()=>c(!1)})]}),e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:U.chargeTypes,children:e.chargeTypes.map(a=>t.jsxRuntimeExports.jsx("div",{className:t.clx(U.charge,{[U.chargeActive]:o===a}),onClick:()=>s(a),children:K[a]},a))}),t.jsxRuntimeExports.jsx("div",{className:U.variants,children:i.map(a=>{var w,_;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(U.variant),onClick:()=>{u(a.id),c(!1)},children:[t.jsxRuntimeExports.jsxs("div",{className:U.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:U.title,children:a.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",o==="ONE_TIME"?a.price.amount:a.subscriptionSettings?a.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:U.stock,children:[(w=a.quantity.restrictions)!=null&&w.max||a.quantity.available!==void 0?((_=a.quantity.restrictions)==null?void 0:_.max)||a.quantity.available:"∞"," ","in stock"]})})]},a.id)})})]})},ni=r=>{const{product:i,setIsOpen:o}=r;return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:U.header,children:[t.jsxRuntimeExports.jsxs("div",{id:"h3",children:["Buy ",t.splitTextIntoSpans(i.name)]}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:()=>o(!1),style:{minWidth:24,minHeight:24}})]}),t.jsxRuntimeExports.jsx("div",{className:U.productOptions,children:t.jsxRuntimeExports.jsx(st,{product:i,setIsOpen:o})})]})},ii="_wrapper_1efqk_1",oi="_label_1efqk_10",ai="_contentBorder_1efqk_19",ri="_contentField_1efqk_23",ci="_textarea_1efqk_27",li="_length_1efqk_42",Q={wrapper:ii,label:oi,contentBorder:ai,contentField:ri,textarea:ci,length:li},di=r=>{const{onChange:i,label:o,value:s,maxLength:e,placeholder:l="Type something...",type:c="text"}=r,[p,m]=j.useState(s.length),{themeSettings:h}=t.useThemeSettingsStore();function S(f){return c==="number"?f.replace(/[^\d\n]+/g,""):f}return t.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,children:[o&&t.jsxRuntimeExports.jsx("label",{className:Q.label,htmlFor:o,children:o}),t.jsxRuntimeExports.jsx("textarea",{id:o,value:s,onChange:f=>{const n=S(f.target.value);m(n.length),i(n)},placeholder:l,className:t.clx(Q.textarea,{[Q.contentBorder]:h.inputs.border.active,[Q.contentField]:h.inputs.field.active}),maxLength:e}),e&&t.jsxRuntimeExports.jsxs("div",{className:Q.length,children:[p,"/",e]})]})};exports.Button=t.Button$1;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.InputUI=t.Input$1;exports.ItemsSettings=t.ItemsSettings;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.RangeSelector=t.RangeSelector;exports.Select=t.Select;exports.SelectInfiniteList=t.SelectInfiniteList;exports.Switch=t.Switch;exports.TextSettings=t.TextSettings;exports.TextareaSettings=t.Textarea;exports.TypesText=t.TypesText;exports.Accordion=gn;exports.BurgerMenuButton=rt;exports.ButtonTypeSettings=et;exports.ButtonsSettings=Ve;exports.CategorySettings=Wt;exports.ChargeTypes=K;exports.EmptyCart=ot;exports.FormSettings=Re;exports.HeaderButtons=Js;exports.LayoutSettings=vt;exports.Link=fn;exports.ListingSelector=Ye;exports.MetaInfoPost=Nn;exports.PagesMobileMenu=Ks;exports.PagesMobileModal=at;exports.PagesSettings=fe;exports.ProductCardButtons=yn;exports.ProductCardModal=ei;exports.ProductOptions=st;exports.ShareLink=un;exports.ShoppingButton=nt;exports.ShoppingModalCart=it;exports.TextareaUI=di;exports.UserInfo=tt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-D2oguEHB.cjs"),_=require("react"),ct="_wrapper_kh9z8_2",lt="_block_kh9z8_8",dt="_title_kh9z8_16",ut="_subtitle_kh9z8_23",xt="_alignmentContent_kh9z8_30",pt="_alignments_kh9z8_39",mt="_alignment_kh9z8_30",ht="_circle_kh9z8_64",jt="_paddings_kh9z8_71",_t="_padding_kh9z8_71",gt="_active_kh9z8_97",ft="_input_kh9z8_104",U={wrapper:ct,block:lt,title:dt,subtitle:ut,alignmentContent:xt,alignments:pt,alignment:mt,circle:ht,paddings:jt,padding:_t,active:gt,input:ft},Et=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Rt=["left","top","right","bottom"],vt=r=>{const{alignment:i,padding:o,setPadding:s,setAlignment:e,isAlignment:a=!0,isPadding:u=!0}=r;function x(d){switch(d){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 h(d){switch(d){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[p,b]=_.useState(null),[R,n]=_.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:U.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:U.title,children:"Layout (for Desktop version)"}),t.jsxRuntimeExports.jsxs("div",{className:U.alignmentContent,children:[a&&t.jsxRuntimeExports.jsxs("div",{className:U.block,children:[t.jsxRuntimeExports.jsx("h5",{className:U.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsx("div",{className:U.alignments,children:Et.map(d=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{e(d)},className:U.alignment,onMouseEnter:()=>{b(d)},onMouseLeave:()=>{b(null)},children:[d!==i&&p!==d&&t.jsxRuntimeExports.jsx("div",{className:U.circle}),d!==i&&p===d&&t.jsxRuntimeExports.jsx(t.Icon,{name:x(p),fill:"#c2c2c2",width:22,height:22}),d===i&&t.jsxRuntimeExports.jsx(t.Icon,{name:x(i),fill:"#FF3F19",width:22,height:22})]},d))})]}),u&&t.jsxRuntimeExports.jsxs("div",{className:U.block,children:[t.jsxRuntimeExports.jsx("h5",{className:U.subtitle,children:"Paddings"}),t.jsxRuntimeExports.jsx("div",{className:U.paddings,children:Rt.map(d=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(U.padding,{[U.active]:R===d}),onFocus:()=>{n(d)},onBlur:()=>{n(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:h(d),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(o[d]),onChange:c=>s({...o,[d]:Math.min(Number(c),999)}),max:999,paddingless:!0,borderless:!0})]},d))})]})]})]})},yt="_title_82zux_1",bt="_subtitle_82zux_5",It="_header_82zux_12",St="_text_82zux_13",Nt="_productsBlock_82zux_14",$t="_top_82zux_26",Ct="_itemsBlock_82zux_35",kt="_typeTexts_82zux_41",qt="_block_82zux_48",Bt="_active_82zux_61",wt="_products_82zux_14",Pt="_product_82zux_14",Tt="_button_82zux_80",Mt="_disabled_82zux_91",At="_image_82zux_95",Ot="_info_82zux_102",Lt="_name_82zux_114",Dt="_buttons_82zux_118",zt="_modal_82zux_125",Ft="_link_82zux_145",Ut="_modalOptions_82zux_151",Vt="_addButton_82zux_157",Ht="_deleteButton_82zux_179",V={title:yt,subtitle:bt,header:It,text:St,productsBlock:Nt,top:$t,itemsBlock:Ct,typeTexts:kt,block:qt,active:Bt,products:wt,product:Pt,button:Tt,disabled:Mt,image:At,info:Ot,name:Lt,buttons:Dt,modal:zt,link:Ft,modalOptions:Ut,addButton:Vt,deleteButton:Ht};function Yt({id:r,children:i}){const{attributes:o,listeners:s,setNodeRef:e,transform:a,transition:u,isDragging:x}=t.useSortable({id:r}),h={transform:t.CSS.Transform.toString(a),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:e,style:h,className:`${V.product} ${x?V.dragging:""}`,...o,...s,children:i})}const Wt=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,other:a,tags:u,title:x,subtitle:h,draggable:p=!1,withImage:b=!1,addable:R=!0,itemsOptions:n,hasRangeSelector:d=!1,rangeSelectorOptions:c,limit:q,autoScrollInterval:j,deletable:B,aspectRatio:y,setAspectRatio:w}=r,g=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),A=m=>{const{active:f,over:S}=m;if(S&&f.id!==S.id){const k=s.findIndex(P=>P===f.id),N=s.findIndex(P=>P===S.id);if(k!==-1&&N!==-1){const P=[...s],[E]=P.splice(k,1);P.splice(N,0,E),e(P)}}};function H(m){if(b)return m?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${m[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const D=(m,f=!1)=>{const S=n.find(N=>N.id===m);if(!S)return;const k=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[p&&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 P=[...s],E=n.find(l=>l.name===N);if(!E)return;const T=E.id,L=P.map(l=>l===m?T:l);e([...L])},value:S.name,options:n.filter(N=>!s.find(P=>P===N.id)).map(N=>N.name),leftAddonOptions:n.map(N=>({value:N.name,addon:H(N.images)}))}),f&&t.jsxRuntimeExports.jsx("div",{className:V.buttons,children:t.jsxRuntimeExports.jsx("div",{className:V.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>e(s.filter(N=>N!==m))})})})]});return p?t.jsxRuntimeExports.jsx(Yt,{id:m,children:k},t.v4()):t.jsxRuntimeExports.jsx("div",{className:V.product,children:k},t.v4())};return t.jsxRuntimeExports.jsxs("div",{className:V.productsBlock,children:[(x||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[x&&t.jsxRuntimeExports.jsx("h3",{className:V.title,children:x}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:m=>o==null?void 0:o(m)})]}),d&&c&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...c}),t.jsxRuntimeExports.jsxs("div",{className:V.products,children:[h&&t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:h}),p?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:g,onDragEnd:A,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s,strategy:t.verticalListSortingStrategy,children:s.map(m=>D(m,B))})}):s.map(m=>D(m,B)),R&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(V.button,{[V.disabled]:!!(q&&q<=s.length||s.length===n.length)}),size:"s",disabled:!!(q&&q<=s.length||s.length===n.length),onClick:()=>{const m=[...s];let f=null;if(n){for(let S=0;S<n.length;S++)if(!s.find(k=>k===n[S].id)){f=n[S];break}}m.push((f==null?void 0:f.id)||n[0].id),e(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:V.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),y&&w&&t.jsxRuntimeExports.jsx(t.Select,{value:y,label:"Aspect Ratio",options:Object.keys(t.aspectRatio),onChange:m=>w(m),leftAddonOptions:t.aspectRatioOptions}),u!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{tagsTitle:"Tags",items:u}),a!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:a}),j!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(j.scrollInterval),onChange:m=>j.setScrollInterval(Number(m)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Gt="_title_roi3a_1",Xt="_subtitle_roi3a_5",Qt="_header_roi3a_12",Jt="_text_roi3a_13",Kt="_productsBlock_roi3a_14",Zt="_top_roi3a_26",te="_itemsBlock_roi3a_35",ee="_typeTexts_roi3a_41",se="_block_roi3a_48",ne="_active_roi3a_61",ie="_products_roi3a_14",oe="_product_roi3a_14",ae="_button_roi3a_80",re="_disabled_roi3a_91",ce="_image_roi3a_95",le="_info_roi3a_102",de="_name_roi3a_114",ue="_buttons_roi3a_118",xe="_modal_roi3a_125",pe="_link_roi3a_145",me="_modalOptions_roi3a_151",he="_addButton_roi3a_164",je="_deleteButton_roi3a_179",_e="_closeIcon_roi3a_191",z={title:Gt,subtitle:Xt,header:Qt,text:Jt,productsBlock:Kt,top:Zt,itemsBlock:te,typeTexts:ee,block:se,active:ne,products:ie,product:oe,button:ae,disabled:re,image:ce,info:le,name:de,buttons:ue,modal:xe,link:pe,modalOptions:me,addButton:he,deleteButton:je,closeIcon:_e};function ge({product:r,children:i}){const{attributes:o,listeners:s,setNodeRef:e,transform:a,transition:u,isDragging:x}=t.useSortable({id:r.id}),h={transform:t.CSS.Transform.toString(a),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:e,style:h,className:`${z.product} ${x?z.dragging:""}`,...o,...s,children:i})}const fe=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,title:a,subtitle:u,editable:x=!0,draggable:h=!1,deletable:p=!0,addable:b=!0,itemsType:R,itemsOptions:n,addableOptions:d={},limit:c}=r,[q,j]=_.useState(null),[B,y]=_.useState(null),w=_.useRef(null),g=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));_.useEffect(()=>{if(q){const m=[...s].map(f=>f.id===q.id?q:f);e(m)}},[q]),_.useEffect(()=>{w.current&&B&&(w.current.getBoundingClientRect().height,B.top)},[w.current,B]);const A=(m,f)=>{m.stopPropagation();const S=m.target.getBoundingClientRect();y({top:S.top+window.scrollY,left:S.left-30}),j(f)},H=m=>{const{active:f,over:S}=m;if(S&&f.id!==S.id){const k=s.findIndex(P=>P.id===f.id),N=s.findIndex(P=>P.id===S.id);if(k!==-1&&N!==-1){const P=[...s],[E]=P.splice(k,1);P.splice(N,0,E),e(P)}}},D=(m,f)=>{const S=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),R==="select"&&n&&t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const N=[...s],P=n.find(T=>T.name===k);if(!P)return;const E=N.map(T=>T.id===m.id?{...P,name:{"en-US":k}}:T);j({...m,name:{"en-US":k}}),e([...E])},value:m.name,options:n.filter(k=>!s.find(N=>N.name===k.name)).map(k=>k.name)}),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[x&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:k=>A(k,m)})}),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:()=>e(s.filter(k=>k.id!==m.id))})})]})]});return h?t.jsxRuntimeExports.jsx(ge,{product:m,index:f,children:S},m.id):t.jsxRuntimeExports.jsx("div",{className:z.product,children:S},m.id)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(a||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[a&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:a}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:m=>o==null?void 0:o(m)})]}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[u&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:u}),h?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:g,onDragEnd:H,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(m=>m.id),strategy:t.verticalListSortingStrategy,children:s.map((m,f)=>D(m,f))})}):s.map((m,f)=>D(m,f)),b&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(z.button,{[z.disabled]:!!(c&&c<=s.length||s.length===(n==null?void 0:n.length))}),size:"s",disabled:!!(c&&c<=s.length||s.length===(n==null?void 0:n.length)),onClick:()=>{const m=[...s];let f=null;if(n){for(let S=0;S<n.length;S++)if(!s.find(k=>k.id===n[S].id)){f=n[S];break}}R==="select"&&n&&m.push({name:f?f.name:n[0].name,id:(f==null?void 0:f.id)||n[0].id,...d}),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})]})})})]})]})};function Ee(r){const{product:i,children:o}=r,{attributes:s,listeners:e,setNodeRef:a,transform:u,transition:x,isDragging:h}=t.useSortable({id:i.id}),p={transform:t.CSS.Transform.toString(u),transition:x};return t.jsxRuntimeExports.jsx("div",{ref:a,style:p,className:`${t.styles.product} ${h?t.styles.dragging:""}`,...s,...e,children:o})}const Re=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,other:a,title:u,subtitle:x,editable:h=!0,draggable:p=!1,deletable:b=!0,addable:R=!0,itemsType:n,itemsPlaceholder:d="",itemsOptions:c,hasRangeSelector:q=!1,rangeSelectorOptions:j,modalOptions:B,addableOptions:y={},limit:w}=r,[g,A]=_.useState(null),[H,D]=_.useState({top:0,left:0}),[m,f]=_.useState(null),S=_.useRef(null),[k,N]=_.useState(!1),P=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));_.useEffect(()=>{const l=()=>{A(null),N(!1)};return document.body.addEventListener("click",l),A(null),N(!1),()=>{A(null),N(!1),document.body.removeEventListener("click",l)}},[]),_.useEffect(()=>{if(g){const l=[...s].map(C=>C.id===g.id?g:C);e(l)}},[g]),_.useEffect(()=>{if(S.current&&m){const l=S.current.getBoundingClientRect().height,C=window.innerHeight;let v=m.top;v+l>C+window.scrollY-200&&(v=C+window.scrollY-l-200),v<0&&(v=10),D({top:v,left:m.left})}},[S.current,m]);const E=(l,C)=>{l.stopPropagation();const v=l.target.getBoundingClientRect();f({top:v.top+window.scrollY,left:v.left-30}),A(C),N(!0)},T=l=>{const{active:C,over:v}=l;if(v&&C.id!==v.id){const M=s.findIndex(O=>O.id===C.id),W=s.findIndex(O=>O.id===v.id);if(M!==-1&&W!==-1){const O=[...s],[Y]=O.splice(M,1);O.splice(W,0,Y),e(O)}}},L=l=>{var v;const C=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[p&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),n==="select"&&c&&t.jsxRuntimeExports.jsx(t.Select,{onChange:M=>{const O=[...s].map(Y=>Y.id===l.id?{...l,name:{"en-US":M}}:Y);A({...l,name:{"en-US":M}}),e([...O])},value:l.name["en-US"],options:c.filter(M=>!s.find(W=>W.name["en-US"]===M))}),n==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:M=>{const O=[...s].map(Y=>Y.id===l.id?{...l,name:{"en-US":M}}:Y);e([...O])},value:l.name["en-US"],placeholder:d}),n==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:M=>{const O=[...s].map(Y=>Y.id===l.id?{...l,images:M}:Y);e([...O])},activeImage:(v=s.find(M=>M.id===l.id))==null?void 0:v.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.buttons,children:[h&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:M=>E(M,l)})}),b&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>e(s.filter(M=>M.id!==l.id))})})]})]});return p?t.jsxRuntimeExports.jsx(Ee,{product:l,children:C},l.id):t.jsxRuntimeExports.jsx("div",{className:t.styles.product,children:C},l.id)};return t.jsxRuntimeExports.jsxs("div",{className:t.styles.productsBlock,children:[(u||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles.top,children:[u&&t.jsxRuntimeExports.jsx("h3",{className:t.styles.title,children:u}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:l=>o==null?void 0:o(l)})]}),g&&h&&B&&k&&t.jsxRuntimeExports.jsx(t.ItemPopup,{ref:S,activeItem:g,setActiveItem:A,popupPosition:H,modalOptions:B,setIsOpenModal:N}),q&&j&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...j}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.products,children:[x&&t.jsxRuntimeExports.jsx("h5",{className:t.styles.subtitle,children:x}),p?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:P,onDragEnd:T,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(l=>l.id),strategy:t.verticalListSortingStrategy,children:s.map(l=>L(l))})}):s.map(l=>L(l)),R&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(t.styles.button,{[t.styles.disabled]:!!(w&&w<=s.length)}),size:"s",disabled:!!(w&&w<=s.length),onClick:()=>{const l=[...s];let C=null;if(c){for(let v=0;v<c.length;v++)if(!s.find(M=>M.name["en-US"]===c[v])){C=c[v];break}}n==="select"&&c?l.push({name:{"en-US":C||c[0]},id:t.v4(),...y,maxSymbols:100}):n==="input"?l.push({name:{"en-US":""},id:t.v4(),...y,maxSymbols:100}):l.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),...y,maxSymbols:100}),e(l)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles.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(t.OtherAndTagsSettings,{otherTitle:"Other",items:a})]})},ve="_subtitle_jql1y_1",ye="_header_jql1y_8",be="_text_jql1y_9",Ie="_productsBlock_jql1y_10",Se="_buttonsBlock_jql1y_11",Ne="_top_jql1y_23",$e="_itemsBlock_jql1y_32",Ce="_typeTexts_jql1y_38",ke="_block_jql1y_45",qe="_active_jql1y_58",Be="_products_jql1y_10",we="_product_jql1y_10",Pe="_button_jql1y_11",Te="_image_jql1y_88",Me="_info_jql1y_95",Ae="_name_jql1y_107",Oe="_buttons_jql1y_11",Le="_modal_jql1y_118",De="_other_jql1y_138",ze="_options_jql1y_144",Fe="_addButton_jql1y_150",Ue="_deleteButton_jql1y_165",G={subtitle:ve,header:ye,text:be,productsBlock:Ie,buttonsBlock:Se,top:Ne,itemsBlock:$e,typeTexts:Ce,block:ke,active:qe,products:Be,product:we,button:Pe,image:Te,info:Me,name:Ae,buttons:Oe,modal:Le,other:De,options:ze,addButton:Fe,deleteButton:Ue},et=r=>{const{buttons:i,setButtons:o,deletable:s=!0,addable:e=!0,editableLink:a=!0}=r,{pages:u}=t.usePagesStore(),[x,h]=_.useState(null),[p,b]=_.useState({top:0,left:0}),[R,n]=_.useState(null),d=_.useRef(null);_.useEffect(()=>{if(x){const j=[...i].map(B=>B.id===x.id?x:B);o(j)}},[x]),_.useEffect(()=>{if(d.current&&R){const j=d.current.getBoundingClientRect().height,B=window.innerHeight;let y=R.top;y+j>B+window.scrollY-200&&(y=B+window.scrollY-j-200),y<0&&(y=10),b({top:y,left:R.left})}},[d.current,R]);const c=(j,B)=>{j.stopPropagation();const y=j.target.getBoundingClientRect();n({top:y.top+window.scrollY-70,left:y.left-(e?30:65)}),h(B)},q=(j,B)=>{const y=[...i],w={...j,id:Math.random().toString(36).substr(2,9)};y.splice(B+1,0,w),o(y)};return t.jsxRuntimeExports.jsxs("div",{className:G.products,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:"Button Type"}),i.map((j,B)=>t.jsxRuntimeExports.jsxs("div",{className:G.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:y=>{const g=[...i].map(A=>A.id===j.id?{...j,type:y}:A);o(g)},value:j.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:G.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:G.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{q(j,B)}})}),t.jsxRuntimeExports.jsx("div",{className:G.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:y=>{c(y,j)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:G.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const y=i.filter(w=>w.id!==j.id);o(y)},width:20,height:20,fill:"#C12A2A"})})]})]},j.id)),x&&t.jsxRuntimeExports.jsx(t.ButtonPopup,{ref:d,activeButton:x,setActiveButton:h,popupPosition:p,editableLink:a}),e&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:G.button,size:"s",onClick:()=>{const j=[...i];a?j.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Button Name"},destination:"Go to Page",page:u?Object.values(u)[0].path:"/",openInNewTab:!1}):j.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Create Ticket"},destination:"Go to Page",page:u?Object.values(u)[0].path:"/",openInNewTab:!1}),o(j)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:G.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},Ve=r=>{const{isActiveButtons:i,setIsActiveButtons:o,buttons:s,setButtons:e,editableLink:a=!0,addable:u=!0,deletable:x=!0}=r;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.top,children:[t.jsxRuntimeExports.jsx("h3",{className:t.styles$1.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:h=>o(h)})]}),i&&t.jsxRuntimeExports.jsx(et,{buttons:s,setButtons:e,editableLink:a,addable:u,deletable:x})]})})};function He(r){const{product:i,children:o}=r,{attributes:s,listeners:e,setNodeRef:a,transform:u,transition:x,isDragging:h}=t.useSortable({id:String(i.listingId)}),p={transform:t.CSS.Transform.toString(u),transition:x};return t.jsxRuntimeExports.jsx("div",{ref:a,style:p,className:`${t.styles$2.product} ${h?t.styles$2.dragging:""}`,...s,...e,children:o})}const Ye=r=>{const{isActiveItems:i,setIsActiveItems:o,items:s,setItems:e,other:a,title:u,subtitle:x,editable:h=!0,draggable:p=!1,withImage:b=!1,deletable:R=!0,addable:n=!0,itemsType:d,itemsOptions:c,limit:q,aspectRatio:j,setAspectRatio:B}=r,[y,w]=_.useState(null),[g,A]=_.useState({top:0,left:0}),[H,D]=_.useState(!1),m=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));_.useEffect(()=>{const E=()=>{w(null),D(!1)};return document.body.addEventListener("click",E),w(null),D(!1),()=>{w(null),D(!1),document.body.removeEventListener("click",E)}},[]),_.useEffect(()=>{if(y){const E=[...s].map(T=>T.listingId===y.listingId?y:T);e(E)}},[y]);const f=(E,T)=>{E.stopPropagation();const L=E.target.getBoundingClientRect(),l=100,C=window.innerHeight;let v=L.top+window.scrollY;v+l>C&&(v=C-l-20),D(!0),A({top:v-80,left:L.left-30}),w(T)};function S(E){if(b)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 k=E=>{const{active:T,over:L}=E;if(L&&T.id!==L.id){const l=s.findIndex(v=>String(v.listingId)===T.id),C=s.findIndex(v=>String(v.listingId)===L.id);if(l!==-1&&C!==-1){const v=[...s],[M]=v.splice(l,1);v.splice(C,0,M),e(v)}}},N=E=>{const T=c.find(l=>E.listingId===l.id);if(!T)return null;const L=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[p&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),d==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:l=>{const C=[...s],v=c.find(O=>O.productData.name===l);if(!v)return;const M={listingId:v.id,image:v.productData.images.length>0?v.productData.images[0].cfId:""},W=C.map(O=>O.listingId===E.listingId?M:O);w(M),e([...W])},value:T.productData.name,options:[...c.filter(l=>!s.find(C=>C.listingId===l.id)).map(l=>l.productData.name)],leftAddonOptions:c.map(l=>{var C;return{value:l.productData.name,addon:S(((C=l.productData.images[0])==null?void 0:C.cfId)||"")}})}),t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.buttons,children:[h&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:l=>f(l,E)})}),R&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>e(s.filter(l=>l!==E))})})]})]});return p?t.jsxRuntimeExports.jsx(He,{product:E,children:L},E.listingId):t.jsxRuntimeExports.jsx("div",{className:t.styles$2.product,children:L},E.listingId)},P=_.useRef(null);return t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.productsBlock,children:[(u||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.top,children:[u&&t.jsxRuntimeExports.jsx("h3",{className:t.styles$2.title,children:u}),i!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:E=>o==null?void 0:o(E)})]}),H&&y&&t.jsxRuntimeExports.jsx(t.ListingPopup,{ref:P,activeItem:y,setActiveItem:w,setIsOpenModal:D,popupPosition:g,itemsOptions:c}),i&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.products,children:[x&&t.jsxRuntimeExports.jsx("h5",{className:t.styles$2.subtitle,children:x}),p?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:m,onDragEnd:k,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(E=>String(E.listingId)),strategy:t.verticalListSortingStrategy,children:s.map(E=>N(E))})}):s.map(E=>N(E)),n&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.styles$2.button,size:"s",onClick:()=>{const E=[...s];for(let T=0;T<c.length;T++)if(!s.find(L=>L.listingId===c[T].id)){E.push({listingId:c[T].id,image:c[T].productData.images.length>0?c[T].productData.images[0].cfId:""});break}e(E)},disabled:s.length===(q||c.length),style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),j&&B&&t.jsxRuntimeExports.jsx(t.Select,{value:j,options:Object.keys(t.aspectRatio),onChange:E=>B(E),leftAddonOptions:t.aspectRatioOptions}),i&&a!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:a})]})},We="_options_1aiq8_1",Ge="_price_1aiq8_18",Xe="_oldPrice_1aiq8_25",Qe="_newPrice_1aiq8_33",Je="_animate_1aiq8_40",Ke="_appearAndBounce_1aiq8_1",Ze="_meta_1aiq8_58",ts="_info_1aiq8_64",es="_infoRight_1aiq8_72",ss="_buttons_1aiq8_79",ns="_variants_1aiq8_86",is="_variant_1aiq8_86",os="_stock_1aiq8_104",as="_variantInfo_1aiq8_111",rs="_quantity_1aiq8_117",cs="_count_1aiq8_124",ls="_focused_1aiq8_141",ds="_button_1aiq8_79",us="_activeVariant_1aiq8_167",xs="_chargeTypes_1aiq8_171",ps="_charge_1aiq8_171",ms="_chargeActive_1aiq8_196",hs="_title_1aiq8_204",$={options:We,price:Ge,oldPrice:Xe,newPrice:Qe,animate:Je,appearAndBounce:Ke,meta:Ze,info:ts,infoRight:es,buttons:ss,variants:ns,variant:is,stock:os,variantInfo:as,quantity:rs,count:cs,focused:ls,button:ds,activeVariant:us,chargeTypes:xs,charge:ps,chargeActive:ms,title:hs};var K=(r=>(r.ONE_TIME="One-Time",r.RECURRING="Subscribe & Save",r))(K||{});const st=r=>{var y,w;const{product:i,setIsOpen:o}=r,{variants:s}=i,[e,a]=_.useState(s[0]),[u,x]=_.useState(e.chargeTypes?e.chargeTypes[0]:"ONE_TIME"),h=t.useNavigate(),[p,b]=_.useState(1),{reset:R,addProductToCart:n}=t.di(),[d,c]=_.useState(!1);_.useEffect(()=>{c(!0);const g=setTimeout(()=>c(!1),600);return()=>clearTimeout(g)},[p]);async function q(){await n({productId:i.id,productVariantId:e.id,quantity:p}),o==null||o(!1)}function j(){R(),q(),h("/checkout")}function B(g){if(g>=864e5){const f=Math.floor(g/864e5);return`${f} ${f===1?"day":"days"}`}else if(g>=36e5){const f=Math.floor(g/36e5);return`${f} ${f===1?"hour":"hours"}`}else if(g>=6e4){const f=Math.floor(g/6e4);return`${f} ${f===1?"minute":"minutes"}`}else{const f=Math.floor(g/1e3);return`${f} ${f===1?"second":"seconds"}`}}return _.useEffect(()=>{e.quantity&&e.quantity.available===0?b(0):b(1)},[e.quantity.available]),t.jsxRuntimeExports.jsxs("div",{className:$.options,children:[e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:$.chargeTypes,children:e.chargeTypes.map(g=>t.jsxRuntimeExports.jsx("div",{className:t.clx($.charge,{[$.chargeActive]:u===g}),onClick:()=>x(g),children:K[g]},g))}),t.jsxRuntimeExports.jsx("div",{className:$.variants,children:s.map(g=>{var A,H;return t.jsxRuntimeExports.jsxs("div",{className:t.clx($.variant,{[$.activeVariant]:e.id===g.id}),onClick:()=>a(g),children:[t.jsxRuntimeExports.jsxs("div",{className:$.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:$.title,children:t.splitTextIntoSpans(g.name)}),t.jsxRuntimeExports.jsxs("span",{children:["$",u==="ONE_TIME"?g.price.amount:g.subscriptionSettings?g.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:u==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:$.stock,children:[(A=g.quantity.restrictions)!=null&&A.max||g.quantity.available!==void 0?((H=g.quantity.restrictions)==null?void 0:H.max)||g.quantity.available:"∞"," ","in stock"]})})]},g.id)})}),u==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:$.quantity,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{p>1?b(g=>g-1):b(1)},className:$.button,disabled:e.quantity.available&&e.quantity.restrictions&&p<=e.quantity.restrictions.min||e.quantity.available===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(t.Input$1,{type:"number",value:String(p),onChange:g=>b(Number(g)),max:((y=e.quantity.restrictions)==null?void 0:y.max)||e.quantity.available||Number.POSITIVE_INFINITY,min:((w=e.quantity.restrictions)==null?void 0:w.min)||0,centered:!0,disabled:e.quantity&&e.quantity.available===0||Object.keys(e.quantity.restrictions||{}).length!==0&&p>=e.quantity.restrictions.max}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{b(g=>g+1)},className:$.button,disabled:!!(e.quantity.available&&e.quantity.restrictions&&p>=e.quantity.restrictions.max||e.quantity.available===0),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:$.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:$.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:$.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":B(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:$.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:$.infoRight,children:u==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:$.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx($.newPrice,{[$.animate]:d}),children:["$ ",(e.price.amount||0)*p]}),t.jsxRuntimeExports.jsxs("span",{className:$.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*p]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx($.newPrice,{[$.animate]:d}),children:["$ ",(e.price.amount||0)*p]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:$.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx($.newPrice,{[$.animate]:d}),children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:$.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:t.clx($.newPrice,{[$.animate]:d}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>j(),disabled:e.quantity&&e.quantity.available===0,children:u==="ONE_TIME"?"Buy Now":"Subscribe Now"}),u==="ONE_TIME"&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>q(),disabled:e.quantity&&e.quantity.available===0,children:"Add to Cart"})]})]})},js="_button_14q75_1",_s="_login_14q75_14",gs="_signUp_14q75_18",fs="_buttons_14q75_23",Es="_modal_14q75_32",Rs="_closing_14q75_64",vs="_info_14q75_113",ys="_top_14q75_120",bs="_title_14q75_131",Is="_clear_14q75_138",Ss="_activeClear_14q75_145",Ns="_count_14q75_149",$s="_cart_14q75_164",Cs="_empty_14q75_172",ks="_product_14q75_198",qs="_products_14q75_207",Bs="_image_14q75_215",ws="_productInfo_14q75_230",Ps="_content_14q75_237",Ts="_name_14q75_243",Ms="_price_14q75_249",As="_productButtons_14q75_255",Os="_productButton_14q75_255",Ls="_productCount_14q75_272",Ds="_bottom_14q75_289",zs="_subtotal_14q75_297",Fs="_block_14q75_305",Us="_shoppingCount_14q75_312",Vs="_total_14q75_332",Hs="_link_14q75_338",Ys="_userInfo_14q75_345",Ws="_pagesMobileModal_14q75_356",Gs="_pagesMobileModalContent_14q75_370",Xs="_pagesMobileModalHeader_14q75_376",Qs="_pagesMobileModalFooter_14q75_386",I={button:js,login:_s,signUp:gs,buttons:fs,modal:Es,"slide-in-fade":"_slide-in-fade_14q75_1","mobile-slide-in-fade":"_mobile-slide-in-fade_14q75_1",closing:Rs,"mobile-slide-out-fade":"_mobile-slide-out-fade_14q75_1","slide-out-fade":"_slide-out-fade_14q75_1",info:vs,top:ys,title:bs,clear:Is,activeClear:Ss,count:Ns,cart:$s,empty:Cs,product:ks,products:qs,image:Bs,productInfo:ws,content:Ps,name:Ts,price:Ms,productButtons:As,productButton:Os,productCount:Ls,bottom:Ds,subtotal:zs,block:Fs,shoppingCount:Us,total:Vs,link:Hs,userInfo:Ys,pagesMobileModal:Ws,pagesMobileModalContent:Gs,pagesMobileModalHeader:Xs,pagesMobileModalFooter:Qs},Js=r=>{const{shopping:i,signUp:o,isShowUserInfo:s=!0}=r;return t.jsxRuntimeExports.jsxs("div",{className:I.buttons,children:[i&&t.jsxRuntimeExports.jsx(nt,{}),s&&t.jsxRuntimeExports.jsx(tt,{signUp:o})]})},nt=()=>{const[r,i]=_.useState(!1),[o,s]=_.useState([]),{cart:e,products:a}=t.di();function u(n){if(n.variants.length>0){for(let d=0;d<e.parts.length;d++)for(let c=0;c<n.variants.length;c++)if(n.variants[c]&&e.parts[d].productVariantId===n.variants[c].id)return e.parts[d].productVariantId}return n.variants[0].id}function x(n){for(let d=0;d<e.parts.length;d++)for(let c=0;c<n.variants.length;c++)if(n.variants[c]&&e.parts[d].productVariantId===n.variants[c].id)return e.parts[d].quantity}_.useEffect(()=>{(async()=>{const d=e.parts.map(j=>String(j.productId)),q=(a.filter(j=>d.includes(String(j.id)))||[]).map(j=>({...j,activeVariantId:u(j),quantity:x(j)}));s(q)})()},[e.parts]);function h(n){var d;return!n||!(n!=null&&n.variants)?!1:(d=n.variants.find(c=>c.id===n.activeVariantId))==null?void 0:d.subscriptionSettings}const p=e.parts.length>0&&o.length>0&&!h(o[0]),[b,R]=_.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",style:{padding:10,position:"relative"},onClick:n=>{n.stopPropagation(),window.location.pathname.includes("/admin/builder")||(i(!0),R(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-primary)"}),p&&t.jsxRuntimeExports.jsx("div",{className:I.shoppingCount,children:e.parts.length})]}),r&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>{R(!1),setTimeout(()=>{i(!1)},300)},withAnimation:!1,children:t.jsxRuntimeExports.jsx(it,{activeProducts:o,isCartNotEmpty:p,isOpen:b})})]})},it=r=>{const{activeProducts:i,isCartNotEmpty:o,isOpen:s}=r,{cart:e,reset:a,getTotalAndDiscount:u,updateQuantityOfProduct:x}=t.di(),h=t.useNavigate();function p(n){h(n)}function b(n){n.quantity&&x({productId:n.id,productVariantId:n.activeVariantId,quantity:n.quantity+1})}function R(n){n.quantity&&x({productId:n.id,productVariantId:n.activeVariantId,quantity:n.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(I.modal,{[I.closing]:!s}),onClick:n=>n.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"}),o&&t.jsxRuntimeExports.jsx("div",{className:I.count,children:e.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(I.clear,{[I.activeClear]:o}),disabled:!o,onClick:a,children:"Clear all"})]}),o?t.jsxRuntimeExports.jsxs("div",{className:I.cart,children:[t.jsxRuntimeExports.jsx("div",{className:I.products,children:[...new Map(i.map(n=>[n.id,n])).values()].map(n=>t.jsxRuntimeExports.jsxs("div",{className:I.product,children:[t.jsxRuntimeExports.jsxs("div",{className:I.productInfo,children:[n.images.length>0?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${n.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:I.image}):t.jsxRuntimeExports.jsx("div",{className:I.image,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsx("div",{className:I.name,children:t.splitTextIntoSpans(n.name)}),t.jsxRuntimeExports.jsxs("div",{className:I.price,children:["$",n.variants.find(d=>d.id===n.activeVariantId).price.amount*((n==null?void 0:n.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.productButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{n.quantity!==1&&R(n)},className:I.productButton,disabled:n.quantity===1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:I.productCount,children:n.quantity}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>b(n),className:I.productButton,disabled:n.quantity===n.variants.find(d=>d.id===n.activeVariantId).quantity.available,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},n.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:["$",u().total]})]}),t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>p("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(ot,{})]})},ot=()=>t.jsxRuntimeExports.jsxs("div",{className:I.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-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"})]})]}),tt=({signUp:r,close:i})=>{const o=JSON.parse(localStorage.getItem("token")||"{}"),{data:s}=o,e=t.useNavigate();function a(h){window.location.pathname.includes("/admin/builder")||e(h)}if(!s)return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{a("/customer-dash"),i==null||i()},type:"Secondary",style:{padding:10},children:"Login"}),r&&t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{a("/customer-dash"),i==null||i()},type:"Primary",style:{padding:10,whiteSpace:"nowrap"},children:"Sign Up"})]});const[u,x]=_.useState("test-email@gmail.com");return _.useEffect(()=>{(async()=>{const p=t.jwtDecode(s);x(p.email)})()},[s]),t.jsxRuntimeExports.jsx("div",{className:I.userInfo,onClick:()=>{a("/customer-dash"),i==null||i()},children:t.jsxRuntimeExports.jsx("div",{children:u||"test-email@gmail.com"})})},at=({children:r,logo:i,setIsOpen:o,signUp:s})=>{const{setIsOpen:e}=t.useModalStore(),a=()=>{e(!1),setTimeout(()=>{o(!1),e(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:I.pagesMobileModal,onClick:u=>u.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:I.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:i}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:a,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"var(--text-primary)"})})]}),t.jsxRuntimeExports.jsx("div",{className:I.pagesMobileModalContent,children:r}),t.jsxRuntimeExports.jsx("div",{className:I.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(tt,{signUp:s,close:a})})]})},Ks=({children:r,logo:i,signUp:o})=>{const[s,e]=_.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(rt,{setIsOpenModal:e}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>e(!1),hasPadding:!1,children:t.jsxRuntimeExports.jsx(at,{logo:i,setIsOpen:e,signUp:o,children:r})})]})},rt=r=>{const{setIsOpenModal:i}=r;return t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{padding:10},onClick:o=>{o.stopPropagation(),window.location.pathname.includes("/admin/builder")||i(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List",fill:"var(--text-primary)"})})},Zs="_share_10urc_1",tn="_modal_10urc_9",en="_header_10urc_21",sn="_socials_10urc_31",nn="_social_10urc_31",on="_copy_10urc_41",an="_title_10urc_48",rn="_copyWrapper_10urc_54",cn="_copyText_10urc_63",ln="_copyTextMobile_10urc_76",dn="_copyTextMiniMobile_10urc_95",X={share:Zs,modal:tn,header:en,socials:sn,social:nn,copy:on,title:an,copyWrapper:rn,copyText:cn,copyTextMobile:ln,copyTextMiniMobile:dn},un=({title:r="Copy Product Link"})=>{const{isOpenModal:i,setIsOpenModal:o}=t.useShareLinkStore();function s(){o(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{className:X.share,onClick:e=>{e.stopPropagation(),s()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),i&&t.jsxRuntimeExports.jsx(t.Modal,{close:o,children:t.jsxRuntimeExports.jsx(xn,{title:r})})]})},xn=({title:r="Copy Product Link"})=>{const{setIsOpenModal:i}=t.useShareLinkStore(),{notification:o,setNotification:s}=t.useNotificationStore(),{setIsOpen:e}=t.useModalStore(),a=window.location.href;function u(){navigator.clipboard.writeText(a),s({message:"Link copied to clipboard",status:"success"})}function x(){e(!1),setTimeout(()=>{i(!1),e(!0)},300)}function h(p,b){return p.length>b?p.slice(0,b)+"...":p}return t.jsxRuntimeExports.jsxs("div",{className:X.modal,onClick:p=>p.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:X.header,children:[t.jsxRuntimeExports.jsx("div",{className:X.title,children:r}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:x,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:X.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",onClick:u,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:X.copyText,children:h(a,100)}),t.jsxRuntimeExports.jsx("div",{className:X.copyTextMobile,children:h(a,40)}),t.jsxRuntimeExports.jsx("div",{className:X.copyTextMiniMobile,children:h(a,20)})]}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:u,children:o?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},pn="_accordion_1s1lq_1",mn="_header_1s1lq_9",hn="_icon_1s1lq_18",jn="_open_1s1lq_21",_n="_content_1s1lq_25",J={accordion:pn,header:mn,icon:hn,open:jn,content:_n},gn=({title:r,content:i,defaultOpen:o=!1})=>{const[s,e]=_.useState(o),[a,u]=_.useState(0),x=_.useRef(null),h=()=>{e(!s)};return _.useEffect(()=>{x.current&&u(s?x.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:J.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:J.header,onClick:h,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:r}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.icon,{[J.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:x,className:J.content,style:{height:`${a}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:i})})]})},fn=({children:r,path:i,className:o,target:s="_self",id:e})=>{if(window.location.pathname.includes("/admin/builder"))return t.jsxRuntimeExports.jsx("div",{className:o,role:"link",style:{cursor:"pointer"},id:e,children:r});const a=t.useNavigate(),u=/^https?:\/\//.test(i),x=h=>{u||s==="_blank"?s==="_blank"?window.open(i,"_blank"):window.open(i,"_self"):(h.preventDefault(),a(i))};return t.jsxRuntimeExports.jsx("div",{onClick:x,className:o,role:"link",style:{cursor:"pointer"},id:e,children:r})},En="_buttonsBlock_1b2rb_1",Rn="_slideUp_1b2rb_1",vn={buttonsBlock:En,slideUp:Rn},yn=r=>{var p,b;const{setIsOpen:i,setModalType:o,productId:s}=r,{cart:e}=t.di(),{pageContext:a}=t.usePagesStore(),u=(p=a==null?void 0:a.listings)==null?void 0:p.find(R=>R.id===s);if(!u)return null;const x=(b=a==null?void 0:a.products)==null?void 0:b.find(R=>R.uniquePath===u.productData.uniquePath);if(!x)return null;const h=e.parts.find(R=>R.productId===x.id);return t.jsxRuntimeExports.jsxs("div",{className:vn.buttonsBlock,onClick:R=>R.stopPropagation(),children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{width:"100%"},onClick:()=>{o("Add To Cart"),i(!0)},children:h?"Add More":"Add To Cart"}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>{o("Buy Now"),i(!0)},children:"Buy"})]})},bn="_wrapper_27wzz_1",In="_logo_27wzz_8",Sn="_info_27wzz_12",Z={wrapper:bn,logo:In,info:Sn},Nn=({date:r})=>{const{general:i}=t.useGeneralStore();if(!i)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});function o(s){const e=new Date(s),a={month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return e.toLocaleDateString("en-US",a)}return t.jsxRuntimeExports.jsxs("div",{className:Z.wrapper,children:[t.jsxRuntimeExports.jsx("div",{className:Z.logo,children:i.info.logo?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.info.logo.cfId}/w=500,h=500`,alt:"image",style:{objectFit:"contain",width:"48px",height:"48px"}}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:48,height:48})}),t.jsxRuntimeExports.jsxs("div",{className:Z.info,children:[t.jsxRuntimeExports.jsx("h3",{id:"h4",children:i.info.name}),t.jsxRuntimeExports.jsx("p",{id:"p",children:o(r)})]})]})},$n="_options_puxd1_1",Cn="_price_puxd1_12",kn="_oldPrice_puxd1_19",qn="_newPrice_puxd1_27",Bn="_animate_puxd1_34",wn="_appearAndBounce_puxd1_1",Pn="_meta_puxd1_52",Tn="_info_puxd1_58",Mn="_infoRight_puxd1_66",An="_buttons_puxd1_73",On="_variants_puxd1_80",Ln="_variant_puxd1_80",Dn="_stock_puxd1_98",zn="_variantInfo_puxd1_105",Fn="_quantity_puxd1_111",Un="_count_puxd1_118",Vn="_focused_puxd1_135",Hn="_button_puxd1_73",Yn="_activeVariant_puxd1_161",Wn="_chargeTypes_puxd1_165",Gn="_charge_puxd1_165",Xn="_chargeActive_puxd1_190",Qn="_title_puxd1_198",Jn="_modal_puxd1_204",Kn="_header_puxd1_224",Zn="_productOptions_puxd1_232",ti="_loading_puxd1_236",F={options:$n,price:Cn,oldPrice:kn,newPrice:qn,animate:Bn,appearAndBounce:wn,meta:Pn,info:Tn,infoRight:Mn,buttons:An,variants:On,variant:Ln,stock:Dn,variantInfo:zn,quantity:Fn,count:Un,focused:Vn,button:Hn,activeVariant:Yn,chargeTypes:Wn,charge:Gn,chargeActive:Xn,title:Qn,modal:Jn,header:Kn,productOptions:Zn,loading:ti},ei=r=>{var R;const{pageContext:i}=t.usePagesStore(),o=(R=i==null?void 0:i.listings)==null?void 0:R.find(n=>n.id===r.productId),[s,e]=_.useState(!0),[a,u]=_.useState(null),x=(a==null?void 0:a.variants[0])||null,[h,p]=_.useState(x!=null&&x.chargeTypes&&x.chargeTypes.length>1?x.chargeTypes[0]:"ONE_TIME"),{addProducts:b}=t.di();if(_.useEffect(()=>{(async()=>{e(!0);const d=await t.getDynamicPage(encodeURIComponent(`/product/${o.productData.uniquePath}`));b(d==null?void 0:d.data.products),u(d==null?void 0:d.data.products[0]),e(!1)})()},[]),s)return t.jsxRuntimeExports.jsx("div",{className:F.modal,onClick:n=>n.stopPropagation(),children:t.jsxRuntimeExports.jsx("div",{className:F.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})})});if(!a){r.setIsOpen(!1);return}if(!x){r.setIsOpen(!1);return}return t.jsxRuntimeExports.jsxs("div",{className:F.modal,onClick:n=>n.stopPropagation(),children:[r.type==="Add To Cart"&&!s&&t.jsxRuntimeExports.jsx(si,{variants:a.variants,activeVariant:x,activeChargeType:h,setActiveChargeType:p,productId:a.id,setIsOpen:r.setIsOpen}),r.type==="Buy Now"&&!s&&t.jsxRuntimeExports.jsx(ni,{product:a,setIsOpen:r.setIsOpen})]})},si=r=>{const{variants:i,activeChargeType:o,setActiveChargeType:s,activeVariant:e,productId:a,setIsOpen:u}=r,{cart:x,addProductToCart:h,addProducts:p,updateQuantityOfProduct:b}=t.di(),{setNotification:R}=t.useNotificationStore(),{pageContext:n}=t.usePagesStore();async function d(c){const q=x.parts.find(j=>j.productId===r.productId&&j.productVariantId===c);q?b({productId:a,productVariantId:c,quantity:q.quantity+1}):(n!=null&&n.products&&await p(n.products),await h({productId:a,productVariantId:c,quantity:1})),R({message:"Product added to cart",status:"success"})}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:F.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",children:"Choose a variant"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:()=>u(!1)})]}),e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:F.chargeTypes,children:e.chargeTypes.map(c=>t.jsxRuntimeExports.jsx("div",{className:t.clx(F.charge,{[F.chargeActive]:o===c}),onClick:()=>s(c),children:K[c]},c))}),t.jsxRuntimeExports.jsx("div",{className:F.variants,children:i.map(c=>{var q,j;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(F.variant),onClick:()=>{d(c.id),u(!1)},children:[t.jsxRuntimeExports.jsxs("div",{className:F.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:F.title,children:c.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",o==="ONE_TIME"?c.price.amount:c.subscriptionSettings?c.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:o==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:F.stock,children:[(q=c.quantity.restrictions)!=null&&q.max||c.quantity.available!==void 0?((j=c.quantity.restrictions)==null?void 0:j.max)||c.quantity.available:"∞"," ","in stock"]})})]},c.id)})})]})},ni=r=>{const{product:i,setIsOpen:o}=r;return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:F.header,children:[t.jsxRuntimeExports.jsxs("div",{id:"h3",children:["Buy ",t.splitTextIntoSpans(i.name)]}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:()=>o(!1),style:{minWidth:24,minHeight:24}})]}),t.jsxRuntimeExports.jsx("div",{className:F.productOptions,children:t.jsxRuntimeExports.jsx(st,{product:i,setIsOpen:o})})]})},ii="_wrapper_1efqk_1",oi="_label_1efqk_10",ai="_contentBorder_1efqk_19",ri="_contentField_1efqk_23",ci="_textarea_1efqk_27",li="_length_1efqk_42",Q={wrapper:ii,label:oi,contentBorder:ai,contentField:ri,textarea:ci,length:li},di=r=>{const{onChange:i,label:o,value:s,maxLength:e,placeholder:a="Type something...",type:u="text"}=r,[x,h]=_.useState(s.length),{themeSettings:p}=t.useThemeSettingsStore();function b(R){return u==="number"?R.replace(/[^\d\n]+/g,""):R}return t.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,children:[o&&t.jsxRuntimeExports.jsx("label",{className:Q.label,htmlFor:o,children:o}),t.jsxRuntimeExports.jsx("textarea",{id:o,value:s,onChange:R=>{const n=b(R.target.value);h(n.length),i(n)},placeholder:a,className:t.clx(Q.textarea,{[Q.contentBorder]:p.inputs.border.active,[Q.contentField]:p.inputs.field.active}),maxLength:e}),e&&t.jsxRuntimeExports.jsxs("div",{className:Q.length,children:[x,"/",e]})]})};exports.Button=t.Button$1;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.InputUI=t.Input$1;exports.ItemsSettings=t.ItemsSettings;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.RangeSelector=t.RangeSelector;exports.Select=t.Select;exports.SelectInfiniteList=t.SelectInfiniteList;exports.Switch=t.Switch;exports.TextSettings=t.TextSettings;exports.TextareaSettings=t.Textarea;exports.TypesText=t.TypesText;exports.Accordion=gn;exports.BurgerMenuButton=rt;exports.ButtonTypeSettings=et;exports.ButtonsSettings=Ve;exports.CategorySettings=Wt;exports.ChargeTypes=K;exports.EmptyCart=ot;exports.FormSettings=Re;exports.HeaderButtons=Js;exports.LayoutSettings=vt;exports.Link=fn;exports.ListingSelector=Ye;exports.MetaInfoPost=Nn;exports.PagesMobileMenu=Ks;exports.PagesMobileModal=at;exports.PagesSettings=fe;exports.ProductCardButtons=yn;exports.ProductCardModal=ei;exports.ProductOptions=st;exports.ShareLink=un;exports.ShoppingButton=nt;exports.ShoppingModalCart=it;exports.TextareaUI=di;exports.UserInfo=tt;