@billgangcom/theme-lib 1.17.0 → 1.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6396,7 +6396,7 @@ const hR = pr(
6396
6396
  uc(
6397
6397
  (e, t) => ({
6398
6398
  pages: null,
6399
- currentPage: "home",
6399
+ currentPage: "/",
6400
6400
  setPages: (r) => e(() => ({ pages: r })),
6401
6401
  pageContext: {
6402
6402
  listings: null,
@@ -29357,38 +29357,39 @@ var AD = {
29357
29357
  ] });
29358
29358
  }, WR = QO;
29359
29359
  export {
29360
- VR as $,
29361
- R3 as A,
29360
+ $R as $,
29361
+ pR as A,
29362
29362
  W1 as B,
29363
29363
  AR as C,
29364
29364
  OR as D,
29365
- y4 as E,
29366
- b4 as F,
29367
- In as G,
29365
+ R3 as E,
29366
+ y4 as F,
29367
+ b4 as G,
29368
29368
  LR as H,
29369
29369
  qr as I,
29370
- oR as J,
29371
- xR as K,
29370
+ In as J,
29371
+ oR as K,
29372
29372
  DR as L,
29373
29373
  jR as M,
29374
- iR as N,
29375
- wm as O,
29374
+ xR as N,
29375
+ iR as O,
29376
29376
  ER as P,
29377
- at as Q,
29377
+ wm as Q,
29378
29378
  NR as R,
29379
29379
  wR as S,
29380
29380
  TR as T,
29381
- nc as U,
29382
- nR as V,
29383
- FR as W,
29384
- sR as X,
29385
- rR as Y,
29386
- BR as Z,
29387
- $R as _,
29381
+ at as U,
29382
+ nc as V,
29383
+ nR as W,
29384
+ rR as X,
29385
+ FR as Y,
29386
+ sR as Z,
29387
+ BR as _,
29388
29388
  bR as a,
29389
- UR as a0,
29390
- WR as a1,
29391
- HR as a2,
29389
+ VR as a0,
29390
+ UR as a1,
29391
+ WR as a2,
29392
+ HR as a3,
29392
29393
  CR as b,
29393
29394
  Cr as c,
29394
29395
  RR as d,
@@ -29407,11 +29408,11 @@ export {
29407
29408
  gR as q,
29408
29409
  lR as r,
29409
29410
  uR as s,
29410
- fR as t,
29411
+ wn as t,
29411
29412
  kR as u,
29412
29413
  Fl as v,
29413
- mR as w,
29414
- cR as x,
29415
- aR as y,
29416
- pR as z
29414
+ fR as w,
29415
+ mR as x,
29416
+ cR as y,
29417
+ aR as z
29417
29418
  };
@@ -1,5 +1 @@
1
- import { Page } from '@constants';
2
- export declare function getDynamicRoutes(pages: Record<string, Page> | null): {
3
- path: string;
4
- element: import("react/jsx-runtime").JSX.Element;
5
- }[];
1
+ export declare function DynamicRouteWrapper(): import("react/jsx-runtime").JSX.Element;
package/dist/ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./root-CQZ1839v.cjs"),h=require("react"),rt="_accordion_2tiiw_1",at="_header_2tiiw_9",lt="_icon_2tiiw_16",ut="_open_2tiiw_19",xt="_content_2tiiw_23",U={accordion:rt,header:at,icon:lt,open:ut,content:xt},dt=({title:l,content:n})=>{const[s,o]=h.useState(!1),[r,a]=h.useState(0),e=h.useRef(null),c=()=>{o(!s)};return h.useEffect(()=>{e.current&&a(s?e.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:U.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:U.header,onClick:c,children:[t.jsxRuntimeExports.jsx("h3",{children:l}),t.jsxRuntimeExports.jsx("div",{className:t.clx(U.icon,{[U.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:U.content,style:{height:`${r}px`},children:t.jsxRuntimeExports.jsx("p",{children:n})})]})},pt="_wrapper_1g82c_2",mt="_alignmentBlock_1g82c_8",jt="_title_1g82c_15",_t="_subtitle_1g82c_22",ht="_alignmentContent_1g82c_29",gt="_alignments_1g82c_35",bt="_alignment_1g82c_8",ft="_circle_1g82c_54",vt="_paddings_1g82c_61",Rt="_padding_1g82c_61",Et="_input_1g82c_79",O={wrapper:pt,alignmentBlock:mt,title:jt,subtitle:_t,alignmentContent:ht,alignments:gt,alignment:bt,circle:ft,paddings:vt,padding:Rt,input:Et},yt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],kt=["left","top","right","bottom"],It=l=>{const{alignment:n,padding:s,setPadding:o,setAlignment:r}=l;function a(){switch(n){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 e(c){switch(c){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:O.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:O.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:O.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:O.alignments,children:yt.map(c=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{r(c)},className:O.alignment,children:[c!==n&&t.jsxRuntimeExports.jsx("div",{className:O.circle}),c===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(),fill:"#FF3F19",width:22,height:22})]},c))}),t.jsxRuntimeExports.jsx("div",{className:O.paddings,children:kt.map(c=>t.jsxRuntimeExports.jsxs("label",{className:O.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(c),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(s[c]),onChange:x=>o({...s,[c]:Number(x)}),paddingless:!0,borderless:!0})]},c))})]})]})]})},$t="_subtitle_2zbxx_1",Nt="_header_2zbxx_8",Ct="_text_2zbxx_9",wt="_top_2zbxx_16",Bt="_itemsBlock_2zbxx_23",G={subtitle:$t,header:Nt,text:Ct,top:wt,itemsBlock:Bt},Pt="_typeTexts_3zlec_1",St="_block_3zlec_7",Tt="_active_3zlec_18",W={typeTexts:Pt,block:St,active:Tt},At=["bold","italic","underline","strike-through","code"],K=l=>{const{typesText:n,setTypesText:s}=l;function o(r){switch(r){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:W.typeTexts,children:At.map(r=>t.jsxRuntimeExports.jsx("div",{className:t.clx(W.block,{[W.active]:n.includes(r)}),onClick:()=>{const a=[...n];if(a.includes(r)){const e=a.filter(c=>c!==r);s(e)}else a.push(r),s(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:o(r),fill:n.includes(r)?"#252525":"#757575",width:20,height:20})},String(r)))})},Z=l=>{const{typesText:n,isActiveText:s,setIsActiveText:o,text:r,setText:a,setTypesText:e,title:c,subtitle:x="Items"}=l;return t.jsxRuntimeExports.jsxs("div",{className:G.text,children:[(c||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:G.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:G.title,children:c}),s!==void 0&&o&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:v=>o(v)})]}),t.jsxRuntimeExports.jsxs("div",{className:G.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:x}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:v=>a(v),value:r,maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:n,setTypesText:e})]})]})},Ot="_subtitle_11qr1_1",Dt="_header_11qr1_8",qt="_text_11qr1_9",Lt="_productsBlock_11qr1_10",Mt="_top_11qr1_22",Ht="_itemsBlock_11qr1_29",Vt="_typeTexts_11qr1_35",zt="_block_11qr1_41",Ft="_active_11qr1_52",Ut="_products_11qr1_10",Gt="_product_11qr1_10",Yt="_button_11qr1_70",Xt="_disabled_11qr1_80",Qt="_image_11qr1_84",Wt="_info_11qr1_91",Jt="_name_11qr1_102",Kt="_buttons_11qr1_106",Zt="_modal_11qr1_112",te="_link_11qr1_130",ee="_modalOptions_11qr1_136",$={subtitle:Ot,header:Dt,text:qt,productsBlock:Lt,top:Mt,itemsBlock:Ht,typeTexts:Vt,block:zt,active:Ft,products:Ut,product:Gt,button:Yt,disabled:Xt,image:Qt,info:Wt,name:Jt,buttons:Kt,modal:Zt,link:te,modalOptions:ee},se=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,modalOptions:r,setIsOpenModal:a}=l;return t.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:e=>{e.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),a(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:$.modalOptions,children:r.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:c=>{const x={...n,[e.field]:c};s(x)}},String(e.field));if(e.type==="text")return t.jsxRuntimeExports.jsx(Z,{typesText:n[e.field.type],setTypesText:c=>{const x={...n,[e.field.type]:c};s(x)},text:n[e.field.text]||"",setText:c=>{const x={...n,[e.field.text]:c};s(x)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field]:c};s(x)},value:n[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:$.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field.text]:c};s(x)},value:n[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!n[e.field.switch]||!1,label:e.switchLabel,onChange:c=>{const x={...n,[e.field.switch]:c};s(x)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(et,{items:n[e.field]||[],setItems:c=>{const x={...n,[e.field]:c};s(x)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:c=>{const x={...n,[e.field]:c};s(x)},label:e.label,value:n[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:n[e.field]})})})})]})},ne="_other_1wtgi_1",oe="_subtitle_1wtgi_7",ie="_items_1wtgi_14",J={other:ne,subtitle:oe,items:ie},tt=l=>{const{items:n,title:s="Other"}=l;return t.jsxRuntimeExports.jsxs("div",{className:J.other,children:[t.jsxRuntimeExports.jsx("h5",{className:J.subtitle,children:s}),t.jsxRuntimeExports.jsx("div",{className:J.items,children:n.map((o,r)=>t.jsxRuntimeExports.jsx(t.Switch,{current:o.isItem,onChange:a=>o.setIsItem(a),label:o.label,hasBackground:!0,paddingless:!1},r))})]})},ce=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${$.product} ${a?$.dragging:""}`,children:o})},et=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsPlaceholder:d="",itemsOptions:j,hasRangeSelector:N=!1,rangeSelectorOptions:B,modalOptions:y,addableOptions:z={},limit:T}=l,[q,L]=h.useState(null),[Q,X]=h.useState({top:0,left:0}),[p,R]=h.useState(!1),P=(u,C)=>{const S=[...o],[E]=S.splice(u,1);S.splice(C,0,E),r(S)};h.useEffect(()=>{const u=()=>{L(null),R(!1)};return document.body.addEventListener("click",u),L(null),R(!1),()=>{L(null),R(!1),document.body.removeEventListener("click",u)}},[]),h.useEffect(()=>{if(q){const u=[...o].map(C=>C.id===q.id?q:C);r(u)}},[q]);const k=(u,C)=>{u.stopPropagation(),R(!0);const S=u.target.getBoundingClientRect(),E=500,F=window.innerHeight;let D=S.top+window.scrollY;D+E>F&&(D=F-E-20),X({top:D-80,left:S.left-30}),L(C)};function H(u){if(m)return u?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${u[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const A=(u,C)=>{const S=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);L({...u,name:E}),r([...D])},value:u.name,options:j,leftAddon:H(u.images)}),i==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);r([...D])},value:u.name,placeholder:d}),i==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,images:E}:M);r([...D])}}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>k(E,u)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(E=>E.id!==u.id))})]})]});return v?t.jsxRuntimeExports.jsx(ce,{product:u,index:C,moveProduct:P,children:S},u.id):t.jsxRuntimeExports.jsx("div",{className:$.product,children:S},u.id)};return t.jsxRuntimeExports.jsxs("div",{className:$.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:$.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:u=>s==null?void 0:s(u)})]}),q&&x&&y&&p&&t.jsxRuntimeExports.jsx(se,{activeItem:q,setActiveItem:L,popupPosition:Q,modalOptions:y,setIsOpenModal:R}),N&&B&&t.jsxRuntimeExports.jsx(nt,{...B}),t.jsxRuntimeExports.jsxs("div",{className:$.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:$.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((u,C)=>A(u,C))}):o.map((u,C)=>A(u,C)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx($.button,{[$.disabled]:!!(T&&T<=o.length)}),size:"s",disabled:!!(T&&T<=o.length),onClick:()=>{const u=[...o];i==="select"?u.push({name:j[0]||`Product ${o.length+1}`,id:t.v4(),...z}):i==="input"?u.push({name:"",id:t.v4(),...z}):u.push({name:`Image ${o.length+1}`,id:t.v4(),...z}),r(u)},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(tt,{items:a})]})},re="_subtitle_41klp_1",ae="_header_41klp_8",le="_text_41klp_9",ue="_productsBlock_41klp_10",xe="_buttonsBlock_41klp_11",de="_top_41klp_21",pe="_itemsBlock_41klp_28",me="_typeTexts_41klp_34",je="_block_41klp_40",_e="_active_41klp_51",he="_products_41klp_10",ge="_product_41klp_10",be="_button_41klp_11",fe="_image_41klp_79",ve="_info_41klp_86",Re="_name_41klp_97",Ee="_buttons_41klp_11",ye="_modal_41klp_107",ke="_other_41klp_124",Ie="_options_41klp_130",V={subtitle:re,header:ae,text:le,productsBlock:ue,buttonsBlock:xe,top:de,itemsBlock:pe,typeTexts:me,block:je,active:_e,products:he,product:ge,button:be,image:fe,info:ve,name:Re,buttons:Ee,modal:ye,other:ke,options:Ie},$e=l=>{const{activeButton:n,setActiveButton:s,popupPosition:o}=l,[r,a]=h.useState(n.typesText),[e,c]=h.useState(n.destination),[x,v]=h.useState(n.link||""),[m,f]=h.useState(n.text||"");return h.useEffect(()=>{s({...n,...{text:m,link:x,destination:e,typesText:r}})},[r,e,x,m]),t.jsxRuntimeExports.jsxs("div",{className:V.modal,onClick:g=>{g.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:V.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:g=>c(g),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:g=>v(g),value:x,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:g=>f(g),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:r,setTypesText:a})]})]})},Ne="_subtitle_1y5sw_1",Ce="_header_1y5sw_8",we="_text_1y5sw_9",Be="_productsBlock_1y5sw_10",Pe="_buttonsBlock_1y5sw_11",Se="_top_1y5sw_22",Te="_itemsBlock_1y5sw_29",Ae="_typeTexts_1y5sw_35",Oe="_block_1y5sw_41",De="_active_1y5sw_52",qe="_products_1y5sw_10",Le="_product_1y5sw_10",Me="_button_1y5sw_11",He="_image_1y5sw_80",Ve="_info_1y5sw_87",ze="_name_1y5sw_98",Fe="_buttons_1y5sw_11",Ue="_modal_1y5sw_108",Ge="_other_1y5sw_125",Ye="_options_1y5sw_131",Y={subtitle:Ne,header:Ce,text:we,productsBlock:Be,buttonsBlock:Pe,top:Se,itemsBlock:Te,typeTexts:Ae,block:Oe,active:De,products:qe,product:Le,button:Me,image:He,info:Ve,name:ze,buttons:Fe,modal:Ue,other:Ge,options:Ye},st=l=>{const{buttons:n,setButtons:s,deletable:o=!0,addable:r=!0}=l,[a,e]=h.useState(null),[c,x]=h.useState({top:0,left:0});h.useEffect(()=>{const m=()=>{e(null)};return document.body.addEventListener("click",m),e(null),()=>{e(null),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(a){const m=[...n].map(f=>f.id===a.id?a:f);s(m)}},[a]);const v=(m,f)=>{m.stopPropagation();const g=m.target.getBoundingClientRect(),i=490,d=window.innerHeight;let j=g.top+window.scrollY;j+i>d&&(j=d-i-20),x({top:j,left:g.left-30}),e(f)};return t.jsxRuntimeExports.jsxs("div",{className:Y.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Y.subtitle,children:"Button Type"}),n.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Y.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const i=[...n].map(d=>d.id===m.id?{...m,type:f}:d);s(i)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Y.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{v(f,m)}}),o&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=n.filter(g=>g.id!==m.id);s(f)},width:20,height:20,fill:"#C12A2A"})]})]},m.id)),a&&t.jsxRuntimeExports.jsx($e,{activeButton:a,setActiveButton:e,popupPosition:c}),r&&t.jsxRuntimeExports.jsxs(t.Button,{className:Y.button,size:"s",onClick:()=>{const m=[...n];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),s(m)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Xe=l=>{const{isActiveButtons:n,setIsActiveButtons:s,buttons:o,setButtons:r}=l;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:V.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{className:V.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:a=>s(a)})]}),t.jsxRuntimeExports.jsx(st,{buttons:o,setButtons:r})]})})},Qe="_wrapper_tn7gb_1",We="_subtitle_tn7gb_7",Je="_content_tn7gb_14",Ke="_range_tn7gb_21",Ze="_track_tn7gb_26",ts="_progress_tn7gb_35",es="_dots_tn7gb_45",ss="_dot_tn7gb_45",ns="_active_tn7gb_62",os="_input_tn7gb_74",is="_countBlock_tn7gb_88",cs="_count_tn7gb_88",rs="_controls_tn7gb_103",as="_button_tn7gb_108",I={wrapper:Qe,subtitle:We,content:Je,range:Ke,track:Ze,progress:ts,dots:es,dot:ss,active:ns,input:os,countBlock:is,count:cs,controls:rs,button:as},nt=l=>{const{label:n,min:s=1,max:o=4,step:r=1,count:a,setCount:e}=l,[c,x]=h.useState(!1),v=Array.from({length:(o-s)/r+1}),m=(a-s)/(o-s)*100,f=()=>{a<o&&e(a+r)},g=()=>{a>s&&e(a-r)},i=d=>{const j=s+d*r;e(j)};return t.jsxRuntimeExports.jsxs("div",{className:I.wrapper,children:[n&&t.jsxRuntimeExports.jsx("h5",{className:I.subtitle,children:n}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsxs("div",{className:I.range,children:[t.jsxRuntimeExports.jsx("div",{className:I.track}),t.jsxRuntimeExports.jsx("div",{className:I.progress,style:{width:`${m}%`}}),t.jsxRuntimeExports.jsx("div",{className:I.dots,children:v.map((d,j)=>{const N=j<=(a-s)/r;return t.jsxRuntimeExports.jsx("button",{onClick:()=>i(j),className:t.clx(I.dot,{[I.active]:N,[I.inactive]:!N,[I.dragging]:c}),"aria-label":`Set value to ${s+j*r}`},j)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:s,max:o,step:r,value:a,onChange:d=>e(Number(d.target.value)),onMouseDown:()=>x(!0),onMouseUp:()=>x(!1),onTouchStart:()=>x(!0),onTouchEnd:()=>x(!1),className:I.input})]}),t.jsxRuntimeExports.jsxs("div",{className:I.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:s,max:o,paddingless:!0,onChange:d=>{const j=Number(d);j>o?e(o):j<s?e(s):e(j)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:I.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:f,disabled:a>=o,className:I.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:a<=s,className:I.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},ls="_subtitle_1nl8x_1",us="_header_1nl8x_8",xs="_text_1nl8x_9",ds="_productsBlock_1nl8x_10",ps="_top_1nl8x_22",ms="_itemsBlock_1nl8x_29",js="_typeTexts_1nl8x_35",_s="_block_1nl8x_41",hs="_active_1nl8x_52",gs="_products_1nl8x_10",bs="_product_1nl8x_10",fs="_button_1nl8x_70",vs="_image_1nl8x_80",Rs="_info_1nl8x_87",Es="_name_1nl8x_98",ys="_buttons_1nl8x_102",ks="_modal_1nl8x_108",Is="_link_1nl8x_126",$s="_modalOptions_1nl8x_132",w={subtitle:ls,header:us,text:xs,productsBlock:ds,top:ps,itemsBlock:ms,typeTexts:js,block:_s,active:hs,products:gs,product:bs,button:fs,image:vs,info:Rs,name:Es,buttons:ys,modal:ks,link:Is,modalOptions:$s},Ns=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,setIsOpenModal:r}=l;return t.jsxRuntimeExports.jsxs("div",{className:w.modal,onClick:a=>{a.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{r(!1),s(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:w.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:a=>{const e={...n,images:a,imagePath:a[0]};s(e)}})})]})},Cs=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${w.product} ${a?w.dragging:""}`,children:o})},ws=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsOptions:d}=l,[j,N]=h.useState(null),[B,y]=h.useState({top:0,left:0}),[z,T]=h.useState(!1),q=(p,R)=>{const P=[...o],[k]=P.splice(p,1);P.splice(R,0,k),r(P)};h.useEffect(()=>{const p=()=>{N(null),T(!1)};return document.body.addEventListener("click",p),N(null),T(!1),()=>{N(null),T(!1),document.body.removeEventListener("click",p)}},[]),h.useEffect(()=>{if(j){const p=[...o].map(R=>R.id===j.id?j:R);r(p)}},[j]);const L=(p,R)=>{p.stopPropagation();const P=p.target.getBoundingClientRect(),k=100,H=window.innerHeight;let A=P.top+window.scrollY;A+k>H&&(A=H-k-20),T(!0),y({top:A-80,left:P.left-30}),N(R)};function Q(p){if(m)return p?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${p}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=(p,R)=>{const P=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const H=[...o],A=Number(k.split(" ")[1]),u=d.find(E=>E.id===A);if(!u)return;const C={...u.productData.stats,newPrice:u.productData.minPrice.amount,oldPrice:u.productData.compareAtPrice.amount},S=H.map(E=>E.id===p.id?{...p,name:k,listingId:A,stats:C}:E);N({...p,name:k,listingId:A}),r([...S])},value:p.name,options:[...d.map(k=>`Product ${k.id}`)],leftAddon:Q(p.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:k=>L(k,p)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(k=>k.id!==p.id))})]})]});return v?t.jsxRuntimeExports.jsx(Cs,{product:p,index:R,moveProduct:q,children:P},p.id):t.jsxRuntimeExports.jsx("div",{className:w.product,children:P},p.id)};return t.jsxRuntimeExports.jsxs("div",{className:w.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:w.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:p=>s==null?void 0:s(p)})]}),z&&j&&t.jsxRuntimeExports.jsx(Ns,{activeItem:j,setActiveItem:N,setIsOpenModal:T,popupPosition:B}),t.jsxRuntimeExports.jsxs("div",{className:w.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:w.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((p,R)=>X(p,R))}):o.map((p,R)=>X(p,R)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:w.button,size:"s",onClick:()=>{const p=[...o],R=d[0].id;p.push({name:`Product ${R}`,id:t.v4(),listingId:R,imagePath:"",images:[],stats:{...d[0].productData.stats,newPrice:d[0].productData.minPrice.amount,oldPrice:d[0].productData.compareAtPrice.amount}}),r(p)},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(tt,{items:a})]})},Bs="_options_163bj_1",Ps="_price_163bj_12",Ss="_oldPrice_163bj_18",Ts="_newPrice_163bj_26",As="_meta_163bj_33",Os="_info_163bj_39",Ds="_infoRight_163bj_46",qs="_buttons_163bj_52",Ls="_variants_163bj_59",Ms="_variant_163bj_59",Hs="_stock_163bj_74",Vs="_variantInfo_163bj_81",zs="_quantity_163bj_87",Fs="_count_163bj_93",Us="_button_163bj_52",Gs="_activeVariant_163bj_110",Ys="_chargeTypes_163bj_114",Xs="_charge_163bj_114",Qs="_chargeActive_163bj_131",b={options:Bs,price:Ps,oldPrice:Ss,newPrice:Ts,meta:As,info:Os,infoRight:Ds,buttons:qs,variants:Ls,variant:Ms,stock:Hs,variantInfo:Vs,quantity:zs,count:Fs,button:Us,activeVariant:Gs,chargeTypes:Ys,charge:Xs,chargeActive:Qs},Ws=l=>{const{variants:n}=l,[s,o]=h.useState(n[0]),r=t.useNavigate(),[a,e]=h.useState(1),{reset:c,addProductToCart:x,getProducts:v}=t.useCart();async function m(){await v(),await x({productId:l.id,productVariantId:s.id,quantity:a})}function f(){c(),m(),r("/checkout")}function g(i){if(i>=864e5){const y=Math.floor(i/864e5);return`${y} ${y===1?"day":"days"}`}else if(i>=36e5){const y=Math.floor(i/36e5);return`${y} ${y===1?"hour":"hours"}`}else if(i>=6e4){const y=Math.floor(i/6e4);return`${y} ${y===1?"minute":"minutes"}`}else{const y=Math.floor(i/1e3);return`${y} ${y===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:b.options,children:[t.jsxRuntimeExports.jsx("div",{className:b.chargeTypes,children:s.chargeTypes?s.chargeTypes.map(i=>t.jsxRuntimeExports.jsx("div",{children:i},i)):t.jsxRuntimeExports.jsx("div",{className:t.clx(b.charge,b.chargeActive),children:"One-Time"})}),t.jsxRuntimeExports.jsx("div",{className:b.variants,children:n.map(i=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(b.variant,{[b.activeVariant]:s.id===i.id}),onClick:()=>o(i),children:[t.jsxRuntimeExports.jsxs("div",{className:b.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:b.title,children:i.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",i.price.amount]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("span",{className:b.stock,children:[i.quantity.restrictions.max||0," in stock"]})})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:b.quantity,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{a>1?e(i=>i-1):e(1)},className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("div",{className:b.count,children:a}),t.jsxRuntimeExports.jsx("div",{onClick:()=>e(i=>i+1),className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:b.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:b.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:s.deliveryTime===0?"Instant":g(s.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:b.infoRight,children:s.compareAtPrice&&(s.compareAtPrice.amount||0)-(s.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:b.price,children:[t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]}),t.jsxRuntimeExports.jsxs("span",{className:b.oldPrice,children:["$ ",(s.compareAtPrice.amount||0)*a]})]}):t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>f(),children:"Buy Now"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>m(),children:"Add to Cart"})]})]})},Js="_button_1jgdy_1",Ks="_login_1jgdy_12",Zs="_signUp_1jgdy_16",tn="_buttons_1jgdy_21",en="_modal_1jgdy_28",sn="_info_1jgdy_44",nn="_top_1jgdy_50",on="_title_1jgdy_59",cn="_clear_1jgdy_65",rn="_activeClear_1jgdy_72",an="_count_1jgdy_76",ln="_cart_1jgdy_89",un="_empty_1jgdy_96",xn="_product_1jgdy_122",dn="_products_1jgdy_129",pn="_image_1jgdy_136",mn="_productInfo_1jgdy_142",jn="_content_1jgdy_148",_n="_name_1jgdy_154",hn="_price_1jgdy_160",gn="_productButtons_1jgdy_166",bn="_productButton_1jgdy_166",fn="_productCount_1jgdy_183",vn="_bottom_1jgdy_197",Rn="_subtotal_1jgdy_205",En="_block_1jgdy_211",yn="_shoppingCount_1jgdy_217",_={button:Js,login:Ks,signUp:Zs,buttons:tn,modal:en,info:sn,top:nn,title:on,clear:cn,activeClear:rn,count:an,cart:ln,empty:un,product:xn,products:dn,image:pn,productInfo:mn,content:jn,name:_n,price:hn,productButtons:gn,productButton:bn,productCount:fn,bottom:vn,subtotal:Rn,block:En,shoppingCount:yn},kn=l=>{const{shopping:n,signUp:s}=l,o=t.useNavigate();function r(a){o(a)}return t.jsxRuntimeExports.jsxs("div",{className:_.buttons,children:[n&&t.jsxRuntimeExports.jsx(ot,{}),t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login),onClick:()=>r("/customer-dash"),children:"Login"}),s&&t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login,_.signUp),onClick:()=>r("/customer-dash"),children:"Sign Up"})]})},ot=()=>{const[l,n]=h.useState(!1),{cart:s}=t.useCart();return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:_.button,onClick:o=>{o.stopPropagation(),n(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"#252525"}),s.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.shoppingCount,children:s.parts.length})]}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:n,children:t.jsxRuntimeExports.jsx(it,{})})]})},it=()=>{const{cart:l,reset:n,getProducts:s,getTotalAndDiscount:o,updateQuantityOfProduct:r}=t.useCart(),[a,e]=h.useState([]),c=t.useNavigate();function x(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].productVariantId}function v(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].quantity}function m(i){c(i)}function f(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity+1})}function g(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity-1})}return h.useEffect(()=>{(async()=>{const d=l.parts.map(B=>String(B.productId)),N=(await s([...d])).map(B=>({...B,activeVariantId:x(B),quantity:v(B)}));e(N)})()},[l]),t.jsxRuntimeExports.jsxs("div",{className:_.modal,onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:_.top,children:[t.jsxRuntimeExports.jsxs("div",{className:_.info,children:[t.jsxRuntimeExports.jsx("span",{className:_.title,children:"Cart"}),l.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.count,children:l.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(_.clear,{[_.activeClear]:l.parts.length>0}),disabled:l.parts.length===0,onClick:()=>n(),children:"Clear all"})]}),l.parts.length>0?t.jsxRuntimeExports.jsxs("div",{className:_.cart,children:[t.jsxRuntimeExports.jsx("div",{className:_.products,children:a.map(i=>t.jsxRuntimeExports.jsxs("div",{className:_.product,children:[t.jsxRuntimeExports.jsxs("div",{className:_.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:_.image}),t.jsxRuntimeExports.jsxs("div",{className:_.content,children:[t.jsxRuntimeExports.jsx("div",{className:_.name,children:i.name}),t.jsxRuntimeExports.jsxs("div",{className:_.price,children:["$",i.variants.find(d=>d.id===i.activeVariantId).price.amount*((i==null?void 0:i.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:_.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{i.quantity!==1&&g(i)},className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:_.productCount,children:i.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>f(i),className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},i.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",{children:["$",o().total]})]}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>m("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(ct,{})]})},ct=()=>t.jsxRuntimeExports.jsxs("div",{className:_.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"})}),t.jsxRuntimeExports.jsx("span",{children:"Your cart is empty"}),t.jsxRuntimeExports.jsx("span",{children:"Check out the store's products and add them here"})]});exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.Accordion=dt;exports.ButtonTypeSettings=st;exports.ButtonsSettings=Xe;exports.EmptyCart=ct;exports.HeaderButtons=kn;exports.ItemsSettings=et;exports.LayoutSettings=It;exports.ListingSelector=ws;exports.ProductOptions=Ws;exports.RangeSelector=nt;exports.ShoppingButton=ot;exports.ShoppingModalCart=it;exports.TextSettings=Z;exports.TypesText=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./root-CBo8978V.cjs"),h=require("react"),rt="_accordion_2tiiw_1",at="_header_2tiiw_9",lt="_icon_2tiiw_16",ut="_open_2tiiw_19",xt="_content_2tiiw_23",U={accordion:rt,header:at,icon:lt,open:ut,content:xt},dt=({title:l,content:n})=>{const[s,o]=h.useState(!1),[r,a]=h.useState(0),e=h.useRef(null),c=()=>{o(!s)};return h.useEffect(()=>{e.current&&a(s?e.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:U.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:U.header,onClick:c,children:[t.jsxRuntimeExports.jsx("h3",{children:l}),t.jsxRuntimeExports.jsx("div",{className:t.clx(U.icon,{[U.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:U.content,style:{height:`${r}px`},children:t.jsxRuntimeExports.jsx("p",{children:n})})]})},pt="_wrapper_1g82c_2",mt="_alignmentBlock_1g82c_8",jt="_title_1g82c_15",_t="_subtitle_1g82c_22",ht="_alignmentContent_1g82c_29",gt="_alignments_1g82c_35",bt="_alignment_1g82c_8",ft="_circle_1g82c_54",vt="_paddings_1g82c_61",Rt="_padding_1g82c_61",Et="_input_1g82c_79",O={wrapper:pt,alignmentBlock:mt,title:jt,subtitle:_t,alignmentContent:ht,alignments:gt,alignment:bt,circle:ft,paddings:vt,padding:Rt,input:Et},yt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],kt=["left","top","right","bottom"],It=l=>{const{alignment:n,padding:s,setPadding:o,setAlignment:r}=l;function a(){switch(n){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 e(c){switch(c){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:O.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:O.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:O.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:O.alignments,children:yt.map(c=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{r(c)},className:O.alignment,children:[c!==n&&t.jsxRuntimeExports.jsx("div",{className:O.circle}),c===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(),fill:"#FF3F19",width:22,height:22})]},c))}),t.jsxRuntimeExports.jsx("div",{className:O.paddings,children:kt.map(c=>t.jsxRuntimeExports.jsxs("label",{className:O.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(c),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(s[c]),onChange:x=>o({...s,[c]:Number(x)}),paddingless:!0,borderless:!0})]},c))})]})]})]})},$t="_subtitle_2zbxx_1",Nt="_header_2zbxx_8",Ct="_text_2zbxx_9",wt="_top_2zbxx_16",Bt="_itemsBlock_2zbxx_23",G={subtitle:$t,header:Nt,text:Ct,top:wt,itemsBlock:Bt},Pt="_typeTexts_3zlec_1",St="_block_3zlec_7",Tt="_active_3zlec_18",W={typeTexts:Pt,block:St,active:Tt},At=["bold","italic","underline","strike-through","code"],K=l=>{const{typesText:n,setTypesText:s}=l;function o(r){switch(r){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:W.typeTexts,children:At.map(r=>t.jsxRuntimeExports.jsx("div",{className:t.clx(W.block,{[W.active]:n.includes(r)}),onClick:()=>{const a=[...n];if(a.includes(r)){const e=a.filter(c=>c!==r);s(e)}else a.push(r),s(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:o(r),fill:n.includes(r)?"#252525":"#757575",width:20,height:20})},String(r)))})},Z=l=>{const{typesText:n,isActiveText:s,setIsActiveText:o,text:r,setText:a,setTypesText:e,title:c,subtitle:x="Items"}=l;return t.jsxRuntimeExports.jsxs("div",{className:G.text,children:[(c||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:G.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:G.title,children:c}),s!==void 0&&o&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:v=>o(v)})]}),t.jsxRuntimeExports.jsxs("div",{className:G.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:x}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:v=>a(v),value:r,maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:n,setTypesText:e})]})]})},Ot="_subtitle_11qr1_1",Dt="_header_11qr1_8",qt="_text_11qr1_9",Lt="_productsBlock_11qr1_10",Mt="_top_11qr1_22",Ht="_itemsBlock_11qr1_29",Vt="_typeTexts_11qr1_35",zt="_block_11qr1_41",Ft="_active_11qr1_52",Ut="_products_11qr1_10",Gt="_product_11qr1_10",Yt="_button_11qr1_70",Xt="_disabled_11qr1_80",Qt="_image_11qr1_84",Wt="_info_11qr1_91",Jt="_name_11qr1_102",Kt="_buttons_11qr1_106",Zt="_modal_11qr1_112",te="_link_11qr1_130",ee="_modalOptions_11qr1_136",$={subtitle:Ot,header:Dt,text:qt,productsBlock:Lt,top:Mt,itemsBlock:Ht,typeTexts:Vt,block:zt,active:Ft,products:Ut,product:Gt,button:Yt,disabled:Xt,image:Qt,info:Wt,name:Jt,buttons:Kt,modal:Zt,link:te,modalOptions:ee},se=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,modalOptions:r,setIsOpenModal:a}=l;return t.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:e=>{e.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),a(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:$.modalOptions,children:r.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:c=>{const x={...n,[e.field]:c};s(x)}},String(e.field));if(e.type==="text")return t.jsxRuntimeExports.jsx(Z,{typesText:n[e.field.type],setTypesText:c=>{const x={...n,[e.field.type]:c};s(x)},text:n[e.field.text]||"",setText:c=>{const x={...n,[e.field.text]:c};s(x)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field]:c};s(x)},value:n[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:$.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field.text]:c};s(x)},value:n[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!n[e.field.switch]||!1,label:e.switchLabel,onChange:c=>{const x={...n,[e.field.switch]:c};s(x)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(et,{items:n[e.field]||[],setItems:c=>{const x={...n,[e.field]:c};s(x)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:c=>{const x={...n,[e.field]:c};s(x)},label:e.label,value:n[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:n[e.field]})})})})]})},ne="_other_1wtgi_1",oe="_subtitle_1wtgi_7",ie="_items_1wtgi_14",J={other:ne,subtitle:oe,items:ie},tt=l=>{const{items:n,title:s="Other"}=l;return t.jsxRuntimeExports.jsxs("div",{className:J.other,children:[t.jsxRuntimeExports.jsx("h5",{className:J.subtitle,children:s}),t.jsxRuntimeExports.jsx("div",{className:J.items,children:n.map((o,r)=>t.jsxRuntimeExports.jsx(t.Switch,{current:o.isItem,onChange:a=>o.setIsItem(a),label:o.label,hasBackground:!0,paddingless:!1},r))})]})},ce=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${$.product} ${a?$.dragging:""}`,children:o})},et=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsPlaceholder:d="",itemsOptions:j,hasRangeSelector:N=!1,rangeSelectorOptions:B,modalOptions:y,addableOptions:z={},limit:T}=l,[q,L]=h.useState(null),[Q,X]=h.useState({top:0,left:0}),[p,R]=h.useState(!1),P=(u,C)=>{const S=[...o],[E]=S.splice(u,1);S.splice(C,0,E),r(S)};h.useEffect(()=>{const u=()=>{L(null),R(!1)};return document.body.addEventListener("click",u),L(null),R(!1),()=>{L(null),R(!1),document.body.removeEventListener("click",u)}},[]),h.useEffect(()=>{if(q){const u=[...o].map(C=>C.id===q.id?q:C);r(u)}},[q]);const k=(u,C)=>{u.stopPropagation(),R(!0);const S=u.target.getBoundingClientRect(),E=500,F=window.innerHeight;let D=S.top+window.scrollY;D+E>F&&(D=F-E-20),X({top:D-80,left:S.left-30}),L(C)};function H(u){if(m)return u?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${u[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const A=(u,C)=>{const S=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);L({...u,name:E}),r([...D])},value:u.name,options:j,leftAddon:H(u.images)}),i==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);r([...D])},value:u.name,placeholder:d}),i==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,images:E}:M);r([...D])}}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>k(E,u)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(E=>E.id!==u.id))})]})]});return v?t.jsxRuntimeExports.jsx(ce,{product:u,index:C,moveProduct:P,children:S},u.id):t.jsxRuntimeExports.jsx("div",{className:$.product,children:S},u.id)};return t.jsxRuntimeExports.jsxs("div",{className:$.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:$.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:u=>s==null?void 0:s(u)})]}),q&&x&&y&&p&&t.jsxRuntimeExports.jsx(se,{activeItem:q,setActiveItem:L,popupPosition:Q,modalOptions:y,setIsOpenModal:R}),N&&B&&t.jsxRuntimeExports.jsx(nt,{...B}),t.jsxRuntimeExports.jsxs("div",{className:$.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:$.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((u,C)=>A(u,C))}):o.map((u,C)=>A(u,C)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx($.button,{[$.disabled]:!!(T&&T<=o.length)}),size:"s",disabled:!!(T&&T<=o.length),onClick:()=>{const u=[...o];i==="select"?u.push({name:j[0]||`Product ${o.length+1}`,id:t.v4(),...z}):i==="input"?u.push({name:"",id:t.v4(),...z}):u.push({name:`Image ${o.length+1}`,id:t.v4(),...z}),r(u)},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(tt,{items:a})]})},re="_subtitle_41klp_1",ae="_header_41klp_8",le="_text_41klp_9",ue="_productsBlock_41klp_10",xe="_buttonsBlock_41klp_11",de="_top_41klp_21",pe="_itemsBlock_41klp_28",me="_typeTexts_41klp_34",je="_block_41klp_40",_e="_active_41klp_51",he="_products_41klp_10",ge="_product_41klp_10",be="_button_41klp_11",fe="_image_41klp_79",ve="_info_41klp_86",Re="_name_41klp_97",Ee="_buttons_41klp_11",ye="_modal_41klp_107",ke="_other_41klp_124",Ie="_options_41klp_130",V={subtitle:re,header:ae,text:le,productsBlock:ue,buttonsBlock:xe,top:de,itemsBlock:pe,typeTexts:me,block:je,active:_e,products:he,product:ge,button:be,image:fe,info:ve,name:Re,buttons:Ee,modal:ye,other:ke,options:Ie},$e=l=>{const{activeButton:n,setActiveButton:s,popupPosition:o}=l,[r,a]=h.useState(n.typesText),[e,c]=h.useState(n.destination),[x,v]=h.useState(n.link||""),[m,f]=h.useState(n.text||"");return h.useEffect(()=>{s({...n,...{text:m,link:x,destination:e,typesText:r}})},[r,e,x,m]),t.jsxRuntimeExports.jsxs("div",{className:V.modal,onClick:g=>{g.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:V.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:g=>c(g),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:g=>v(g),value:x,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:g=>f(g),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:r,setTypesText:a})]})]})},Ne="_subtitle_1y5sw_1",Ce="_header_1y5sw_8",we="_text_1y5sw_9",Be="_productsBlock_1y5sw_10",Pe="_buttonsBlock_1y5sw_11",Se="_top_1y5sw_22",Te="_itemsBlock_1y5sw_29",Ae="_typeTexts_1y5sw_35",Oe="_block_1y5sw_41",De="_active_1y5sw_52",qe="_products_1y5sw_10",Le="_product_1y5sw_10",Me="_button_1y5sw_11",He="_image_1y5sw_80",Ve="_info_1y5sw_87",ze="_name_1y5sw_98",Fe="_buttons_1y5sw_11",Ue="_modal_1y5sw_108",Ge="_other_1y5sw_125",Ye="_options_1y5sw_131",Y={subtitle:Ne,header:Ce,text:we,productsBlock:Be,buttonsBlock:Pe,top:Se,itemsBlock:Te,typeTexts:Ae,block:Oe,active:De,products:qe,product:Le,button:Me,image:He,info:Ve,name:ze,buttons:Fe,modal:Ue,other:Ge,options:Ye},st=l=>{const{buttons:n,setButtons:s,deletable:o=!0,addable:r=!0}=l,[a,e]=h.useState(null),[c,x]=h.useState({top:0,left:0});h.useEffect(()=>{const m=()=>{e(null)};return document.body.addEventListener("click",m),e(null),()=>{e(null),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(a){const m=[...n].map(f=>f.id===a.id?a:f);s(m)}},[a]);const v=(m,f)=>{m.stopPropagation();const g=m.target.getBoundingClientRect(),i=490,d=window.innerHeight;let j=g.top+window.scrollY;j+i>d&&(j=d-i-20),x({top:j,left:g.left-30}),e(f)};return t.jsxRuntimeExports.jsxs("div",{className:Y.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Y.subtitle,children:"Button Type"}),n.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Y.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const i=[...n].map(d=>d.id===m.id?{...m,type:f}:d);s(i)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Y.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{v(f,m)}}),o&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=n.filter(g=>g.id!==m.id);s(f)},width:20,height:20,fill:"#C12A2A"})]})]},m.id)),a&&t.jsxRuntimeExports.jsx($e,{activeButton:a,setActiveButton:e,popupPosition:c}),r&&t.jsxRuntimeExports.jsxs(t.Button,{className:Y.button,size:"s",onClick:()=>{const m=[...n];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),s(m)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Xe=l=>{const{isActiveButtons:n,setIsActiveButtons:s,buttons:o,setButtons:r}=l;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:V.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{className:V.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:a=>s(a)})]}),t.jsxRuntimeExports.jsx(st,{buttons:o,setButtons:r})]})})},Qe="_wrapper_tn7gb_1",We="_subtitle_tn7gb_7",Je="_content_tn7gb_14",Ke="_range_tn7gb_21",Ze="_track_tn7gb_26",ts="_progress_tn7gb_35",es="_dots_tn7gb_45",ss="_dot_tn7gb_45",ns="_active_tn7gb_62",os="_input_tn7gb_74",is="_countBlock_tn7gb_88",cs="_count_tn7gb_88",rs="_controls_tn7gb_103",as="_button_tn7gb_108",I={wrapper:Qe,subtitle:We,content:Je,range:Ke,track:Ze,progress:ts,dots:es,dot:ss,active:ns,input:os,countBlock:is,count:cs,controls:rs,button:as},nt=l=>{const{label:n,min:s=1,max:o=4,step:r=1,count:a,setCount:e}=l,[c,x]=h.useState(!1),v=Array.from({length:(o-s)/r+1}),m=(a-s)/(o-s)*100,f=()=>{a<o&&e(a+r)},g=()=>{a>s&&e(a-r)},i=d=>{const j=s+d*r;e(j)};return t.jsxRuntimeExports.jsxs("div",{className:I.wrapper,children:[n&&t.jsxRuntimeExports.jsx("h5",{className:I.subtitle,children:n}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsxs("div",{className:I.range,children:[t.jsxRuntimeExports.jsx("div",{className:I.track}),t.jsxRuntimeExports.jsx("div",{className:I.progress,style:{width:`${m}%`}}),t.jsxRuntimeExports.jsx("div",{className:I.dots,children:v.map((d,j)=>{const N=j<=(a-s)/r;return t.jsxRuntimeExports.jsx("button",{onClick:()=>i(j),className:t.clx(I.dot,{[I.active]:N,[I.inactive]:!N,[I.dragging]:c}),"aria-label":`Set value to ${s+j*r}`},j)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:s,max:o,step:r,value:a,onChange:d=>e(Number(d.target.value)),onMouseDown:()=>x(!0),onMouseUp:()=>x(!1),onTouchStart:()=>x(!0),onTouchEnd:()=>x(!1),className:I.input})]}),t.jsxRuntimeExports.jsxs("div",{className:I.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:s,max:o,paddingless:!0,onChange:d=>{const j=Number(d);j>o?e(o):j<s?e(s):e(j)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:I.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:f,disabled:a>=o,className:I.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:a<=s,className:I.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},ls="_subtitle_1nl8x_1",us="_header_1nl8x_8",xs="_text_1nl8x_9",ds="_productsBlock_1nl8x_10",ps="_top_1nl8x_22",ms="_itemsBlock_1nl8x_29",js="_typeTexts_1nl8x_35",_s="_block_1nl8x_41",hs="_active_1nl8x_52",gs="_products_1nl8x_10",bs="_product_1nl8x_10",fs="_button_1nl8x_70",vs="_image_1nl8x_80",Rs="_info_1nl8x_87",Es="_name_1nl8x_98",ys="_buttons_1nl8x_102",ks="_modal_1nl8x_108",Is="_link_1nl8x_126",$s="_modalOptions_1nl8x_132",w={subtitle:ls,header:us,text:xs,productsBlock:ds,top:ps,itemsBlock:ms,typeTexts:js,block:_s,active:hs,products:gs,product:bs,button:fs,image:vs,info:Rs,name:Es,buttons:ys,modal:ks,link:Is,modalOptions:$s},Ns=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,setIsOpenModal:r}=l;return t.jsxRuntimeExports.jsxs("div",{className:w.modal,onClick:a=>{a.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{r(!1),s(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:w.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:a=>{const e={...n,images:a,imagePath:a[0]};s(e)}})})]})},Cs=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${w.product} ${a?w.dragging:""}`,children:o})},ws=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsOptions:d}=l,[j,N]=h.useState(null),[B,y]=h.useState({top:0,left:0}),[z,T]=h.useState(!1),q=(p,R)=>{const P=[...o],[k]=P.splice(p,1);P.splice(R,0,k),r(P)};h.useEffect(()=>{const p=()=>{N(null),T(!1)};return document.body.addEventListener("click",p),N(null),T(!1),()=>{N(null),T(!1),document.body.removeEventListener("click",p)}},[]),h.useEffect(()=>{if(j){const p=[...o].map(R=>R.id===j.id?j:R);r(p)}},[j]);const L=(p,R)=>{p.stopPropagation();const P=p.target.getBoundingClientRect(),k=100,H=window.innerHeight;let A=P.top+window.scrollY;A+k>H&&(A=H-k-20),T(!0),y({top:A-80,left:P.left-30}),N(R)};function Q(p){if(m)return p?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${p}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=(p,R)=>{const P=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const H=[...o],A=Number(k.split(" ")[1]),u=d.find(E=>E.id===A);if(!u)return;const C={...u.productData.stats,newPrice:u.productData.minPrice.amount,oldPrice:u.productData.compareAtPrice.amount},S=H.map(E=>E.id===p.id?{...p,name:k,listingId:A,stats:C}:E);N({...p,name:k,listingId:A}),r([...S])},value:p.name,options:[...d.map(k=>`Product ${k.id}`)],leftAddon:Q(p.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:k=>L(k,p)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(k=>k.id!==p.id))})]})]});return v?t.jsxRuntimeExports.jsx(Cs,{product:p,index:R,moveProduct:q,children:P},p.id):t.jsxRuntimeExports.jsx("div",{className:w.product,children:P},p.id)};return t.jsxRuntimeExports.jsxs("div",{className:w.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:w.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:p=>s==null?void 0:s(p)})]}),z&&j&&t.jsxRuntimeExports.jsx(Ns,{activeItem:j,setActiveItem:N,setIsOpenModal:T,popupPosition:B}),t.jsxRuntimeExports.jsxs("div",{className:w.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:w.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((p,R)=>X(p,R))}):o.map((p,R)=>X(p,R)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:w.button,size:"s",onClick:()=>{const p=[...o],R=d[0].id;p.push({name:`Product ${R}`,id:t.v4(),listingId:R,imagePath:"",images:[],stats:{...d[0].productData.stats,newPrice:d[0].productData.minPrice.amount,oldPrice:d[0].productData.compareAtPrice.amount}}),r(p)},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(tt,{items:a})]})},Bs="_options_163bj_1",Ps="_price_163bj_12",Ss="_oldPrice_163bj_18",Ts="_newPrice_163bj_26",As="_meta_163bj_33",Os="_info_163bj_39",Ds="_infoRight_163bj_46",qs="_buttons_163bj_52",Ls="_variants_163bj_59",Ms="_variant_163bj_59",Hs="_stock_163bj_74",Vs="_variantInfo_163bj_81",zs="_quantity_163bj_87",Fs="_count_163bj_93",Us="_button_163bj_52",Gs="_activeVariant_163bj_110",Ys="_chargeTypes_163bj_114",Xs="_charge_163bj_114",Qs="_chargeActive_163bj_131",b={options:Bs,price:Ps,oldPrice:Ss,newPrice:Ts,meta:As,info:Os,infoRight:Ds,buttons:qs,variants:Ls,variant:Ms,stock:Hs,variantInfo:Vs,quantity:zs,count:Fs,button:Us,activeVariant:Gs,chargeTypes:Ys,charge:Xs,chargeActive:Qs},Ws=l=>{const{variants:n}=l,[s,o]=h.useState(n[0]),r=t.useNavigate(),[a,e]=h.useState(1),{reset:c,addProductToCart:x,getProducts:v}=t.useCart();async function m(){await v(),await x({productId:l.id,productVariantId:s.id,quantity:a})}function f(){c(),m(),r("/checkout")}function g(i){if(i>=864e5){const y=Math.floor(i/864e5);return`${y} ${y===1?"day":"days"}`}else if(i>=36e5){const y=Math.floor(i/36e5);return`${y} ${y===1?"hour":"hours"}`}else if(i>=6e4){const y=Math.floor(i/6e4);return`${y} ${y===1?"minute":"minutes"}`}else{const y=Math.floor(i/1e3);return`${y} ${y===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:b.options,children:[t.jsxRuntimeExports.jsx("div",{className:b.chargeTypes,children:s.chargeTypes?s.chargeTypes.map(i=>t.jsxRuntimeExports.jsx("div",{children:i},i)):t.jsxRuntimeExports.jsx("div",{className:t.clx(b.charge,b.chargeActive),children:"One-Time"})}),t.jsxRuntimeExports.jsx("div",{className:b.variants,children:n.map(i=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(b.variant,{[b.activeVariant]:s.id===i.id}),onClick:()=>o(i),children:[t.jsxRuntimeExports.jsxs("div",{className:b.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:b.title,children:i.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",i.price.amount]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("span",{className:b.stock,children:[i.quantity.restrictions.max||0," in stock"]})})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:b.quantity,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{a>1?e(i=>i-1):e(1)},className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("div",{className:b.count,children:a}),t.jsxRuntimeExports.jsx("div",{onClick:()=>e(i=>i+1),className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:b.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:b.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:s.deliveryTime===0?"Instant":g(s.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:b.infoRight,children:s.compareAtPrice&&(s.compareAtPrice.amount||0)-(s.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:b.price,children:[t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]}),t.jsxRuntimeExports.jsxs("span",{className:b.oldPrice,children:["$ ",(s.compareAtPrice.amount||0)*a]})]}):t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>f(),children:"Buy Now"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>m(),children:"Add to Cart"})]})]})},Js="_button_1jgdy_1",Ks="_login_1jgdy_12",Zs="_signUp_1jgdy_16",tn="_buttons_1jgdy_21",en="_modal_1jgdy_28",sn="_info_1jgdy_44",nn="_top_1jgdy_50",on="_title_1jgdy_59",cn="_clear_1jgdy_65",rn="_activeClear_1jgdy_72",an="_count_1jgdy_76",ln="_cart_1jgdy_89",un="_empty_1jgdy_96",xn="_product_1jgdy_122",dn="_products_1jgdy_129",pn="_image_1jgdy_136",mn="_productInfo_1jgdy_142",jn="_content_1jgdy_148",_n="_name_1jgdy_154",hn="_price_1jgdy_160",gn="_productButtons_1jgdy_166",bn="_productButton_1jgdy_166",fn="_productCount_1jgdy_183",vn="_bottom_1jgdy_197",Rn="_subtotal_1jgdy_205",En="_block_1jgdy_211",yn="_shoppingCount_1jgdy_217",_={button:Js,login:Ks,signUp:Zs,buttons:tn,modal:en,info:sn,top:nn,title:on,clear:cn,activeClear:rn,count:an,cart:ln,empty:un,product:xn,products:dn,image:pn,productInfo:mn,content:jn,name:_n,price:hn,productButtons:gn,productButton:bn,productCount:fn,bottom:vn,subtotal:Rn,block:En,shoppingCount:yn},kn=l=>{const{shopping:n,signUp:s}=l,o=t.useNavigate();function r(a){o(a)}return t.jsxRuntimeExports.jsxs("div",{className:_.buttons,children:[n&&t.jsxRuntimeExports.jsx(ot,{}),t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login),onClick:()=>r("/customer-dash"),children:"Login"}),s&&t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login,_.signUp),onClick:()=>r("/customer-dash"),children:"Sign Up"})]})},ot=()=>{const[l,n]=h.useState(!1),{cart:s}=t.useCart();return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:_.button,onClick:o=>{o.stopPropagation(),n(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"#252525"}),s.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.shoppingCount,children:s.parts.length})]}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:n,children:t.jsxRuntimeExports.jsx(it,{})})]})},it=()=>{const{cart:l,reset:n,getProducts:s,getTotalAndDiscount:o,updateQuantityOfProduct:r}=t.useCart(),[a,e]=h.useState([]),c=t.useNavigate();function x(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].productVariantId}function v(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].quantity}function m(i){c(i)}function f(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity+1})}function g(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity-1})}return h.useEffect(()=>{(async()=>{const d=l.parts.map(B=>String(B.productId)),N=(await s([...d])).map(B=>({...B,activeVariantId:x(B),quantity:v(B)}));e(N)})()},[l]),t.jsxRuntimeExports.jsxs("div",{className:_.modal,onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:_.top,children:[t.jsxRuntimeExports.jsxs("div",{className:_.info,children:[t.jsxRuntimeExports.jsx("span",{className:_.title,children:"Cart"}),l.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.count,children:l.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(_.clear,{[_.activeClear]:l.parts.length>0}),disabled:l.parts.length===0,onClick:()=>n(),children:"Clear all"})]}),l.parts.length>0?t.jsxRuntimeExports.jsxs("div",{className:_.cart,children:[t.jsxRuntimeExports.jsx("div",{className:_.products,children:a.map(i=>t.jsxRuntimeExports.jsxs("div",{className:_.product,children:[t.jsxRuntimeExports.jsxs("div",{className:_.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:_.image}),t.jsxRuntimeExports.jsxs("div",{className:_.content,children:[t.jsxRuntimeExports.jsx("div",{className:_.name,children:i.name}),t.jsxRuntimeExports.jsxs("div",{className:_.price,children:["$",i.variants.find(d=>d.id===i.activeVariantId).price.amount*((i==null?void 0:i.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:_.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{i.quantity!==1&&g(i)},className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:_.productCount,children:i.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>f(i),className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},i.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",{children:["$",o().total]})]}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>m("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(ct,{})]})},ct=()=>t.jsxRuntimeExports.jsxs("div",{className:_.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"})}),t.jsxRuntimeExports.jsx("span",{children:"Your cart is empty"}),t.jsxRuntimeExports.jsx("span",{children:"Check out the store's products and add them here"})]});exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.Accordion=dt;exports.ButtonTypeSettings=st;exports.ButtonsSettings=Xe;exports.EmptyCart=ct;exports.HeaderButtons=kn;exports.ItemsSettings=et;exports.LayoutSettings=It;exports.ListingSelector=ws;exports.ProductOptions=Ws;exports.RangeSelector=nt;exports.ShoppingButton=ot;exports.ShoppingModalCart=it;exports.TextSettings=Z;exports.TypesText=K;
package/dist/ui.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { j as t, c as H, I as x, a as G, S as z, T as lt, C as ot, b as Y, D as rt, H as dt, B as X, v as tt, u as ut, d as _t, e as it, f as at, M as mt } from "./root-_xH450tE.js";
2
- import { k as Gn, l as Yn, h as Xn, L as Qn, P as Wn, R as Jn, g as Kn, i as Zn } from "./root-_xH450tE.js";
1
+ import { j as t, c as H, I as x, a as G, S as z, T as lt, C as ot, b as Y, D as rt, H as dt, B as X, v as tt, u as ut, d as _t, e as it, f as at, M as mt } from "./root-CL1RHy-a.js";
2
+ import { k as Gn, l as Yn, h as Xn, L as Qn, P as Wn, R as Jn, g as Kn, i as Zn } from "./root-CL1RHy-a.js";
3
3
  import b from "react";
4
4
  const gt = "_accordion_2tiiw_1", xt = "_header_2tiiw_9", bt = "_icon_2tiiw_16", jt = "_open_2tiiw_19", ft = "_content_2tiiw_23", J = {
5
5
  accordion: gt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@billgangcom/theme-lib",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"