@gem-sdk/core 17.0.0-staging.36 → 17.0.0-staging.42

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.
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");require("zustand");var i=require("../contexts/BuilderPreviewContext.js"),r=require("../contexts/PageContext.js"),o=require("./theme-section/CreateThemeSection.js"),l=require("./toolbar/Tooltip.js"),n=require("./toolbar/SectionErrorBanner.js"),a=require("./theme-section/ThemeSectionStatus.js"),s=require("./resize/Resize.js"),d=require("../hooks/useToolbarPostPurchase.js"),u=require("./constant.js"),C=require("./ai-generator/AIContentGenerator.js"),c=require("./ai-generator/AIGenContentLoading.js"),h=require("./InteractionSuffix.js"),p=require("@gem-sdk/core"),g=require("./upgrade-element/UpgradeElement.js");require("swr"),require("../graphql/queries/collection-detail-filter.generated.js"),require("../graphql/queries/collection.generated.js"),require("../graphql/queries/collections.generated.js"),require("../graphql/queries/published-theme-pages.generated.js"),require("../graphql/queries/store-property.generated.js"),require("../graphql/queries/preview-page.generated.js"),require("../graphql/queries/published-shop-metas.generated.js"),require("../graphql/queries/shop-shopify.generated.js"),require("../graphql/queries/articles.generated.js"),require("../graphql/queries/blogs.generated.js"),require("../graphql/queries/products-with-selling-plans.generated.js"),require("../graphql/queries/product-variant-with-selling-plans.generated.js"),require("../graphql/queries/product-variants.generated.js"),require("../graphql/queries/product-little-detail.generated.js"),require("../graphql/queries/product-medias.generated.js"),require("../graphql/queries/productsV2.generated.js"),require("../helpers/convert.js"),require("crc-32");var m=require("../contexts/ShopContext.js");require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("swr/infinite"),require("vanilla-lazyload"),require("../hooks/useCartUI.js"),require("../graphql/queries/product-value-label.generated.js"),require("../hooks/useStickyStore.js"),require("../types/builder.js"),require("../types/custom.js"),require("../types/animations.js");const f=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},v=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t};var x=t.memo(x=>{let{t:b}=p.useI18nStore(),j=x.isThemeSection,w=!!x.isShopifySection,S=m.useShopStore(e=>e.storefrontUrl),q=m.useShopStore(e=>e.pageType),M=i.useBuilderPreviewStore(e=>e.getParents),L=i.useBuilderPreviewStore(e=>e.getItem("ROOT")),y=i.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[Z,P]=t.useState(null),[E,R]=t.useState(!1),[H,V]=t.useState(!1),[T,B]=t.useState([]),[A,k]=t.useState("top"),[I,F]=t.useState(!1),[$,G]=t.useState(!1),[U,D]=t.useState(""),[O,N]=t.useState(""),[_,z]=t.useState({width:"",text:""}),[W,J]=t.useState(!1),K=i.useBuilderPreviewStore(e=>e.errorSectionList),Q=t.useMemo(()=>{if(!K)return null;let e=K?.find(e=>e.uid===x.uid);return e},[K,x.uid]),X=r.usePageStore(e=>e.interactionData),Y=t.useMemo(()=>"POST_PURCHASE"===q,[q]),{checkDisableDelete:ee,getTooltipText:et,checkDisableDuplicate:ei}=d.usePostPurchase(x.uid,x.tag||""),er=["ProductTitle","ProductDescription","ProductPrice"],eo=["ArticleTitle","ArticleContent","ArticleImage","ArticleAuthor","ArticleCategory","ArticleDate","ArticleExcerpt","ArticleTags"],el=[...er,...eo],en=(e,t)=>{let i=T.length,r=e.getBoundingClientRect(),o=t.getBoundingClientRect();return r.top-o.top<36*i},ea=(e,t)=>{let i=t||e;if(e&&!v(e))return f(e)&&en(t,e)?e:e.parentElement?ea(e.parentElement,i):void 0},es=t.useCallback(()=>L?.childrens?.length||0,[L?.childrens?.length]),ed=t.useCallback(()=>{if("Section"==x.tag)return"bottom";let e=document.body.querySelector("#storefront")?.querySelector('[data-toolbar-active="true"]');if(e){let t=e.getBoundingClientRect();t.top<60?k("bottom"):k("top")}},[x.tag]),eu=t.useMemo(()=>S?S.match(/^(?:https?:\/\/)?([^/]+)\.myshopify\.com/)?.[1]:"",[S]),eC=t.useMemo(()=>`https://admin.shopify.com/store/${eu}`,[eu]),ec=t.useMemo(()=>U?`${eC}/products/${U}`:"",[eC,U]),eh=t.useMemo(()=>O?`${eC}/articles/${O.replace("gid://shopify/Article/","")}`:"",[O,eC]),ep=t.useMemo(()=>X?.isSelectOnPage,[X?.isSelectOnPage]),eg=t.useMemo(()=>X?.settingType,[X?.settingType]),em=t.useMemo(()=>X?.item?.targets?.find(e=>e.uid===x.uid&&e?.type!=="PAGE")&&"TARGET"===eg,[X?.item?.targets,x.uid,eg]),ef=t.useMemo(()=>X?.item?.self?.uid===x.uid&&X?.item?.self.type!=="PAGE"&&"TRIGGER"===eg,[X?.item?.self?.type,X?.item?.self?.uid,x.uid,eg]),ev=t.useMemo(()=>!em&&!ef,[em,ef]),ex=t.useMemo(()=>I||w,[I,w]),eb=t.useMemo(()=>W||w||es()>25&&"Section"===x.tag||!!Q,[es,W,w,x.tag,Q]),ej=t.useCallback(e=>{let t=e.detail;if(t?.articleId&&N(t.articleId),t?.productId&&D(t.productId),t?.componentUid==x.uid){G(!0),ed(),Y&&(F(ee()),z(et()),J(ei()));let e=M(x.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&y||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);B(e)}else G(!1),B([]),R(!1)},[x.uid,Y,M,ee,et,ei,y,ed]),ew=i.useBuilderPreviewStore(e=>e.dismissPublishError),eS=t.useCallback(()=>{ew(x.uid)},[ew,x.uid]),eq=t.useCallback(()=>"Section"!==x.tag?-1:L?.childrens?.length?L.childrens.findIndex(e=>e==x.uid):-1,[L?.childrens,x.uid,x.tag]),eM=t.useMemo(()=>eq()>=25,[eq]),eL=t.useMemo(()=>!!Q||eM,[Q,eM]);if(t.useEffect(()=>(window.addEventListener("editor:active-component",ej),()=>{window.removeEventListener("editor:active-component",ej)}),[ej]),"section"===x.type||x.editorConfigs?.toolbar?.hide)return null;let ey=e=>{let t=e?.childrens?.length??0;if("Row"===e.label){let e=1===t?b("Row {colNumber} col",{colNumber:t}):b("Row {colNumber} cols",{colNumber:t});return e}return b(e.label)},eZ=e=>{if(!T.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(E)V(!1),R(!1);else{let e=ea(i,i);if(e)V(!0);else{let e=i.getBoundingClientRect();e.top<36*T.length?V(!0):V(!1)}R(!0)}let r=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!E}});window.dispatchEvent(r)},eP=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:x.uid,isThemeSection:j,isShopifySection:w}});return window.dispatchEvent(t),!1},eE=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:x.uid,isThemeSection:j,isShopifySection:w}});return window.dispatchEvent(t),!1},eR=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:x.uid}});return window.dispatchEvent(t),!1},eH=()=>{P(null),window.removeEventListener("editor:close-add-section-popup",eH)},eV=(e,t)=>{if(e.preventDefault(),e.stopPropagation(),es()>=25)return!1;let i=e.target;if(i){P(t);let e=i.getBoundingClientRect(),r=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:x.uid,position:t,top:e.top+e.height/2}});window.dispatchEvent(r),window.addEventListener("editor:close-add-section-popup",eH)}return!1},eT="Section"===x.tag&&!x.isThemeSection&&"STATIC"!==q&&"POST_PURCHASE"!==q&&!x.isShopifySection&&25>eq()&&!Q;return e.jsxs(e.Fragment,{children:[!("Section"==x.tag&&y)&&e.jsxs("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==x.tag,"data-toolbar-theme-section":"Section"==x.tag&&!!j||y,"data-toolbar-shopify-section":"Section"==x.tag&&!!w,"data-toolbar-limit":eq()>=25||!!Q,children:[e.jsxs("div",{"data-toolbar-show-parent":!0,onClick:e=>eZ(e),"aria-hidden":"true",children:[ef&&e.jsx("div",{className:"gp-hidden gp-w-[12px] interaction-use-custom-element",children:e.jsx("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.36799 0.430523C4.51596 0.205675 4.76709 0.0703125 5.03626 0.0703125H9.88576C10.2042 0.0703125 10.395 0.424378 10.2198 0.69034L8.36968 3.4992C8.28209 3.63218 8.37747 3.80922 8.53671 3.80922H10.749C11.1111 3.80922 11.2869 4.25204 11.0233 4.50036L3.03971 12.0217C2.7572 12.2878 2.29932 12.0361 2.37262 11.655L3.27994 6.93698C3.30366 6.81364 3.20915 6.69921 3.08354 6.69921H0.984651C0.66625 6.69921 0.475479 6.34529 0.650515 6.07932L4.36799 0.430523Z",fill:"#F9F9F9"})})}),em&&e.jsx("div",{className:"gp-hidden gp-w-[14px] interaction-use-custom-element",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.32785 3.66159C7.87459 3.58351 8.25451 3.077 8.17643 2.53026C8.09836 1.98353 7.59184 1.6036 7.0451 1.68168C3.92866 2.12673 1.5332 4.80488 1.5332 8.04424C1.5332 11.594 4.41085 14.4716 7.9606 14.4716C11.1706 14.4716 13.8294 12.1194 14.3105 9.04446C14.3959 8.49881 14.0227 7.98727 13.4771 7.9019C12.9314 7.81654 12.4199 8.18967 12.3345 8.73531C12.0034 10.852 10.1702 12.4716 7.9606 12.4716C5.51541 12.4716 3.5332 10.4894 3.5332 8.04424C3.5332 5.81431 5.18273 3.96793 7.32785 3.66159ZM10.3432 1.97548C10.6232 1.69551 11.102 1.83654 11.1855 2.22355L11.6106 4.19339C11.6313 4.28936 11.7063 4.36432 11.8023 4.38503L13.7721 4.81013C14.1591 4.89365 14.3001 5.37247 14.0202 5.65243L12.3432 7.32945C12.1244 7.54819 11.8168 7.65338 11.5099 7.61436L10.1528 7.44178C9.84592 7.40276 9.53827 7.50795 9.31953 7.72669L8.66719 8.37903C8.35477 8.69145 7.86633 8.70954 7.57623 8.41943C7.28613 8.12933 7.30421 7.64089 7.61663 7.32847L8.26898 6.67613C8.48771 6.45739 8.5929 6.14974 8.55388 5.84287L8.38131 4.48575C8.34228 4.17888 8.44748 3.87123 8.66621 3.6525L10.3432 1.97548ZM8.19853 5.1916C8.35319 5.72179 8.04877 6.27697 7.51858 6.43163C6.83078 6.63226 6.32988 7.2683 6.32988 8.01873C6.32988 8.9316 7.06991 9.67164 7.98279 9.67164C8.73014 9.67164 9.36406 9.17486 9.56743 8.49131C9.72492 7.96195 10.2817 7.6605 10.8111 7.81799C11.3404 7.97548 11.6419 8.53227 11.4844 9.06163C11.0356 10.57 9.63916 11.6716 7.98279 11.6716C5.96535 11.6716 4.32988 10.0362 4.32988 8.01873C4.32988 6.35558 5.44054 4.95445 6.95851 4.51165C7.4887 4.35699 8.04387 4.66141 8.19853 5.1916Z",fill:"#F9F9F9"})})}),$&&ev&&e.jsx("div",{"data-toolbar-icon-drag":!0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),e.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==x.tag?e.jsxs("div",{"data-toolbar-name":!0,children:[(()=>{if(w)return x.name?.includes("Shopify section:")?`${b("Shopify section")}: ${x.name.replace("Shopify section:","")}`:`${b("Shopify section")}: ${x.name}`;let e=x.name&&x.name===`Section ${x.uid}`;return es()>=20?`${e?b("Section"):x?.name} ${eq()+1}/25`:e?`${b("Section")} ${eq()+1}`:x?.name})(),$&&w&&!x.isShopifyVisibility&&e.jsxs("svg",{"data-toolbar-visibility":!0,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.1252 9.99773C13.1243 8.27226 11.7248 6.87423 9.99935 6.87506C8.27386 6.87561 6.87518 8.27455 6.87518 10.0001C6.87518 11.7259 8.27429 13.1251 10.0002 13.1251C11.7257 13.1251 13.125 11.727 13.1252 10.0011V9.99773ZM9.99985 8.12506C11.035 8.12451 11.8746 8.96322 11.8752 9.99839V10.0004C11.8752 11.0357 11.0359 11.8751 10.0002 11.8751C8.96465 11.8751 8.12518 11.0356 8.12518 10.0001C8.12518 8.96472 8.96451 8.12533 9.99985 8.12506Z",fill:"#F9F9F9"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99885 4.37593C5.66421 4.37604 2.80603 7.64523 1.79548 9.00983C1.35636 9.60279 1.35918 10.4 1.80012 10.9902C2.81706 12.3514 5.69374 15.6241 9.99886 15.6241C14.3806 15.6241 17.2194 12.3452 18.2168 10.9808C18.6473 10.392 18.6442 9.60472 18.211 9.01902C17.2056 7.65938 14.3429 4.37583 9.99885 4.37593ZM2.80002 9.75374C3.77049 8.44326 6.30207 5.62602 9.99888 5.62593C13.7041 5.62585 16.24 8.45598 17.206 9.76225C17.3146 9.9091 17.3149 10.0965 17.2077 10.2431C16.254 11.5477 13.7416 14.3741 9.99886 14.3741C6.33149 14.3741 3.78173 11.5541 2.80152 10.242C2.69021 10.0931 2.69001 9.90229 2.80002 9.75374Z",fill:"#F9F9F9"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0763 3.26988C18.3415 3.58809 18.2985 4.06101 17.9803 4.32619L2.98032 16.8262C2.66211 17.0914 2.18919 17.0484 1.92402 16.7302C1.65884 16.412 1.70184 15.939 2.02004 15.6739L17.02 3.17385C17.3383 2.90868 17.8112 2.95167 18.0763 3.26988Z",fill:"#F9F9F9"})]})]}):e.jsx("div",{"data-toolbar-name":!0,children:b(x.customLabel||x.label)}),$&&"Section"!==x.tag&&T.length>0&&e.jsx("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":E,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),$&&E&&T.map((t,i)=>e.jsxs("div",{"data-toolbar-parent":!0,"data-component-tag":t.tag,"data-parent-uid":t.uid,"data-toolbar-theme-section":y,"data-toolbar-parent-revert":H,style:{top:H?`${36*(i+1)}px`:`${-36*(i+1)}px`},children:[e.jsx("div",{"data-toolbar-icon-drag":!0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),e.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),e.jsx("div",{"data-toolbar-name":!0,children:ey(t)})]},t.uid)),$&&!ep&&e.jsxs(e.Fragment,{children:[e.jsx(g.default,{...x}),eT&&e.jsx(o.CreateThemeSection,{...x}),(()=>{let{isShopifySection:e,tag:t}=x;return!e&&(!j||!!y)&&u.ableGenerateContentElements.includes(t)&&!Q})()&&e.jsx(C.AIContentGenerator,{...x}),"Sticky"==x.tag&&e.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>eR(e),"aria-hidden":"true",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),el.includes(x.tag)&&e.jsx(l.default,{"data-toolbar-title":!0,enable:!0,"data-toolbar-disable":!1,text:b("Edit content in Shopify"),position:"top",onClick:()=>{if(eo.includes(x.tag)){window.open(eh,"_blank");return}if(er.includes(x.tag)){window.open(ec,"_blank");return}window.open(eC,"_blank")},"aria-hidden":"true",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",fill:"currentColor"}),e.jsx("path",{d:"M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",fill:"currentColor"}),e.jsx("path",{d:"M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",fill:"currentColor"}),e.jsx("path",{d:"M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",fill:"currentColor"})]})}),e.jsx(l.default,{enable:"Section"==x.tag&&es()>=25||w,text:w?b("Disabled. Please edit in Shopify Editor"):b("Page has reached Shopify’s 25 section-limit"),position:"bottom",width:"200px","data-toolbar-duplicate":!0,"data-toolbar-disable":eb,onClick:eb?void 0:e=>eE(e),"aria-hidden":"true",className:eb?"!gp-cursor-not-allowed":"",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),e.jsx(l.default,{"data-toolbar-delete":!0,onClick:e=>ex?null:eP(e),enable:ex,"data-toolbar-disable":ex,text:w?b("Disabled. Please edit in Shopify Editor"):_.text,width:_.width,position:w?"bottom":A,"aria-hidden":"true",className:ex?"!gp-cursor-not-allowed":"",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),e.jsx(h.InteractionSuffix,{uid:x.uid})]},x.uid),"STATIC"!==q&&"POST_PURCHASE"!==q&&25>eq()&&e.jsx(a.ThemeSectionStatusWrapper,{...x}),e.jsx("div",{"data-outline":!0,"data-outline-section":"Section"==x.tag,"data-outline-theme-section":"Section"==x.tag&&!!j||y,"data-outline-shopify-section":"Section"==x.tag&&!!w,"data-outline-limit":eL,"data-outline-error":!!Q},"outline-"+x.uid),"Section"==x.tag&&!y&&e.jsxs(e.Fragment,{children:[e.jsx(l.default,{enable:es()>=25,text:b("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":es()>=25,"data-toolbar-add-open":"above"==Z,onClick:e=>eV(e,"above"),"aria-hidden":"true",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),e.jsx(l.default,{enable:es()>=25,text:b("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":es()>=25,"data-toolbar-add-open":"below"==Z,onClick:e=>eV(e,"below"),"aria-hidden":"true",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),Q&&e.jsx(n.SectionErrorBanner,{errorSectionInfo:Q,onDismiss:eS}),u.ableGenerateContentElements.includes(x.tag)&&$&&e.jsx(c.AIGenContentLoading,{...x}),$&&e.jsx(s.default,{...x})]})});exports.default=x;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");require("zustand");var i=require("../contexts/BuilderPreviewContext.js"),r=require("../contexts/PageContext.js"),o=require("./theme-section/CreateThemeSection.js"),l=require("./toolbar/Tooltip.js"),n=require("./toolbar/SectionErrorBanner.js"),a=require("./theme-section/ThemeSectionStatus.js"),s=require("./resize/Resize.js"),d=require("../hooks/useToolbarPostPurchase.js"),u=require("./constant.js"),C=require("./ai-generator/AIContentGenerator.js"),c=require("./ai-generator/AIGenContentLoading.js"),h=require("./InteractionSuffix.js"),p=require("@gem-sdk/core"),g=require("./upgrade-element/UpgradeElement.js");require("swr"),require("../graphql/queries/collection-detail-filter.generated.js"),require("../graphql/queries/collection.generated.js"),require("../graphql/queries/collections.generated.js"),require("../graphql/queries/published-theme-pages.generated.js"),require("../graphql/queries/store-property.generated.js"),require("../graphql/queries/preview-page.generated.js"),require("../graphql/queries/published-shop-metas.generated.js"),require("../graphql/queries/shop-shopify.generated.js"),require("../graphql/queries/articles.generated.js"),require("../graphql/queries/blogs.generated.js"),require("../graphql/queries/products-with-selling-plans.generated.js"),require("../graphql/queries/product-variant-with-selling-plans.generated.js"),require("../graphql/queries/product-variants.generated.js"),require("../graphql/queries/product-little-detail.generated.js"),require("../graphql/queries/product-medias.generated.js"),require("../graphql/queries/productsV2.generated.js"),require("../helpers/convert.js"),require("crc-32");var m=require("../contexts/ShopContext.js");require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("swr/infinite"),require("vanilla-lazyload"),require("../hooks/useCartUI.js"),require("../graphql/queries/product-value-label.generated.js"),require("../hooks/useStickyStore.js"),require("../types/builder.js"),require("../types/custom.js"),require("../types/animations.js");const f=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},x=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t};var b=t.memo(b=>{let{t:j}=p.useI18nStore(),v=b.isThemeSection,w=!!b.isShopifySection,S=m.useShopStore(e=>e.storefrontUrl),q=m.useShopStore(e=>e.pageType),M=i.useBuilderPreviewStore(e=>e.getParents),L=i.useBuilderPreviewStore(e=>e.getItem("ROOT")),y=i.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[Z,P]=t.useState(null),[R,E]=t.useState(!1),[H,V]=t.useState(!1),[T,B]=t.useState([]),[A,k]=t.useState("top"),[I,F]=t.useState(!1),[$,D]=t.useState(!1),[G,U]=t.useState(""),[O,N]=t.useState(""),[_,z]=t.useState({width:"",text:""}),[W,J]=t.useState(!1),K=i.useBuilderPreviewStore(e=>e.errorSectionList),Q=t.useMemo(()=>{if(!K)return null;let e=K?.find(e=>e.uid===b.uid);return e},[K,b.uid]),X=r.usePageStore(e=>e.interactionData),Y=t.useMemo(()=>"POST_PURCHASE"===q,[q]),{checkDisableDelete:ee,getTooltipText:et,checkDisableDuplicate:ei}=d.usePostPurchase(b.uid,b.tag||""),er=["ProductTitle","ProductDescription","ProductPrice"],eo=["ArticleTitle","ArticleContent","ArticleImage","ArticleAuthor","ArticleCategory","ArticleDate","ArticleExcerpt","ArticleTags"],el=[...er,...eo],en=(e,t)=>{let i=T.length,r=e.getBoundingClientRect(),o=t.getBoundingClientRect();return r.top-o.top<36*i},ea=(e,t)=>{let i=t||e;if(e&&!x(e))return f(e)&&en(t,e)?e:e.parentElement?ea(e.parentElement,i):void 0},es=t.useCallback(()=>L?.childrens?.length||0,[L?.childrens?.length]),ed=t.useCallback(()=>{if("Section"==b.tag)return"bottom";let e=document.body.querySelector("#storefront")?.querySelector('[data-toolbar-active="true"]');if(e){let t=e.getBoundingClientRect();t.top<60?k("bottom"):k("top")}},[b.tag]),eu=t.useMemo(()=>S?S.match(/^(?:https?:\/\/)?([^/]+)\.myshopify\.com/)?.[1]:"",[S]),eC=t.useMemo(()=>`https://admin.shopify.com/store/${eu}`,[eu]),ec=t.useMemo(()=>G?`${eC}/products/${G}`:"",[eC,G]),eh=t.useMemo(()=>O?`${eC}/articles/${O.replace("gid://shopify/Article/","")}`:"",[O,eC]),ep=t.useMemo(()=>X?.isSelectOnPage,[X?.isSelectOnPage]),eg=t.useMemo(()=>X?.settingType,[X?.settingType]),em=t.useMemo(()=>X?.item?.targets?.find(e=>e.uid===b.uid&&e?.type!=="PAGE")&&"TARGET"===eg,[X?.item?.targets,b.uid,eg]),ef=t.useMemo(()=>X?.item?.self?.uid===b.uid&&X?.item?.self.type!=="PAGE"&&"TRIGGER"===eg,[X?.item?.self?.type,X?.item?.self?.uid,b.uid,eg]),ex=t.useMemo(()=>!em&&!ef,[em,ef]),eb=t.useMemo(()=>I||w,[I,w]),ej=t.useMemo(()=>W||w||es()>25&&"Section"===b.tag||!!Q,[es,W,w,b.tag,Q]),ev=i.useBuilderPreviewStore(e=>e.activeComponentDetail),ew=t.useCallback(e=>{if(e?.articleId&&N(e.articleId),e?.productId&&U(e.productId),e?.componentUid==b.uid){D(!0),ed(),Y&&(F(ee()),z(et()),J(ei()));let e=M(b.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&y||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);B(e)}else D(!1),B([]),E(!1)},[b.uid,Y,M,ee,et,ei,y,ed]),eS=i.useBuilderPreviewStore(e=>e.dismissPublishError),eq=t.useCallback(()=>{eS(b.uid)},[eS,b.uid]),eM=t.useCallback(()=>"Section"!==b.tag?-1:L?.childrens?.length?L.childrens.findIndex(e=>e==b.uid):-1,[L?.childrens,b.uid,b.tag]),eL=t.useMemo(()=>eM()>=25,[eM]),ey=t.useMemo(()=>!!Q||eL,[Q,eL]);if(t.useEffect(()=>{ew(ev)},[ev]),"section"===b.type||b.editorConfigs?.toolbar?.hide)return null;let eZ=e=>{let t=e?.childrens?.length??0;if("Row"===e.label){let e=1===t?j("Row {colNumber} col",{colNumber:t}):j("Row {colNumber} cols",{colNumber:t});return e}return j(e.label)},eP=e=>{if(!T.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(R)V(!1),E(!1);else{let e=ea(i,i);if(e)V(!0);else{let e=i.getBoundingClientRect();e.top<36*T.length?V(!0):V(!1)}E(!0)}let r=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!R}});window.dispatchEvent(r)},eR=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:b.uid,isThemeSection:v,isShopifySection:w}});return window.dispatchEvent(t),!1},eE=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:b.uid,isThemeSection:v,isShopifySection:w}});return window.dispatchEvent(t),!1},eH=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:b.uid}});return window.dispatchEvent(t),!1},eV=()=>{P(null),window.removeEventListener("editor:close-add-section-popup",eV)},eT=(e,t)=>{if(e.preventDefault(),e.stopPropagation(),es()>=25)return!1;let i=e.target;if(i){P(t);let e=i.getBoundingClientRect(),r=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:b.uid,position:t,top:e.top+e.height/2}});window.dispatchEvent(r),window.addEventListener("editor:close-add-section-popup",eV)}return!1},eB="Section"===b.tag&&!b.isThemeSection&&"STATIC"!==q&&"POST_PURCHASE"!==q&&!b.isShopifySection&&25>eM()&&!Q;return e.jsxs(e.Fragment,{children:[!("Section"==b.tag&&y)&&e.jsxs("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==b.tag,"data-toolbar-theme-section":"Section"==b.tag&&!!v||y,"data-toolbar-shopify-section":"Section"==b.tag&&!!w,"data-toolbar-limit":eM()>=25||!!Q,children:[e.jsxs("div",{"data-toolbar-show-parent":!0,onClick:e=>eP(e),"aria-hidden":"true",children:[ef&&e.jsx("div",{className:"gp-hidden gp-w-[12px] interaction-use-custom-element",children:e.jsx("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.36799 0.430523C4.51596 0.205675 4.76709 0.0703125 5.03626 0.0703125H9.88576C10.2042 0.0703125 10.395 0.424378 10.2198 0.69034L8.36968 3.4992C8.28209 3.63218 8.37747 3.80922 8.53671 3.80922H10.749C11.1111 3.80922 11.2869 4.25204 11.0233 4.50036L3.03971 12.0217C2.7572 12.2878 2.29932 12.0361 2.37262 11.655L3.27994 6.93698C3.30366 6.81364 3.20915 6.69921 3.08354 6.69921H0.984651C0.66625 6.69921 0.475479 6.34529 0.650515 6.07932L4.36799 0.430523Z",fill:"#F9F9F9"})})}),em&&e.jsx("div",{className:"gp-hidden gp-w-[14px] interaction-use-custom-element",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.32785 3.66159C7.87459 3.58351 8.25451 3.077 8.17643 2.53026C8.09836 1.98353 7.59184 1.6036 7.0451 1.68168C3.92866 2.12673 1.5332 4.80488 1.5332 8.04424C1.5332 11.594 4.41085 14.4716 7.9606 14.4716C11.1706 14.4716 13.8294 12.1194 14.3105 9.04446C14.3959 8.49881 14.0227 7.98727 13.4771 7.9019C12.9314 7.81654 12.4199 8.18967 12.3345 8.73531C12.0034 10.852 10.1702 12.4716 7.9606 12.4716C5.51541 12.4716 3.5332 10.4894 3.5332 8.04424C3.5332 5.81431 5.18273 3.96793 7.32785 3.66159ZM10.3432 1.97548C10.6232 1.69551 11.102 1.83654 11.1855 2.22355L11.6106 4.19339C11.6313 4.28936 11.7063 4.36432 11.8023 4.38503L13.7721 4.81013C14.1591 4.89365 14.3001 5.37247 14.0202 5.65243L12.3432 7.32945C12.1244 7.54819 11.8168 7.65338 11.5099 7.61436L10.1528 7.44178C9.84592 7.40276 9.53827 7.50795 9.31953 7.72669L8.66719 8.37903C8.35477 8.69145 7.86633 8.70954 7.57623 8.41943C7.28613 8.12933 7.30421 7.64089 7.61663 7.32847L8.26898 6.67613C8.48771 6.45739 8.5929 6.14974 8.55388 5.84287L8.38131 4.48575C8.34228 4.17888 8.44748 3.87123 8.66621 3.6525L10.3432 1.97548ZM8.19853 5.1916C8.35319 5.72179 8.04877 6.27697 7.51858 6.43163C6.83078 6.63226 6.32988 7.2683 6.32988 8.01873C6.32988 8.9316 7.06991 9.67164 7.98279 9.67164C8.73014 9.67164 9.36406 9.17486 9.56743 8.49131C9.72492 7.96195 10.2817 7.6605 10.8111 7.81799C11.3404 7.97548 11.6419 8.53227 11.4844 9.06163C11.0356 10.57 9.63916 11.6716 7.98279 11.6716C5.96535 11.6716 4.32988 10.0362 4.32988 8.01873C4.32988 6.35558 5.44054 4.95445 6.95851 4.51165C7.4887 4.35699 8.04387 4.66141 8.19853 5.1916Z",fill:"#F9F9F9"})})}),$&&ex&&e.jsx("div",{"data-toolbar-icon-drag":!0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),e.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==b.tag?e.jsxs("div",{"data-toolbar-name":!0,children:[(()=>{if(w)return b.name?.includes("Shopify section:")?`${j("Shopify section")}: ${b.name.replace("Shopify section:","")}`:`${j("Shopify section")}: ${b.name}`;let e=b.name&&b.name===`Section ${b.uid}`;return es()>=20?`${e?j("Section"):b?.name} ${eM()+1}/25`:e?`${j("Section")} ${eM()+1}`:b?.name})(),$&&w&&!b.isShopifyVisibility&&e.jsxs("svg",{"data-toolbar-visibility":!0,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.1252 9.99773C13.1243 8.27226 11.7248 6.87423 9.99935 6.87506C8.27386 6.87561 6.87518 8.27455 6.87518 10.0001C6.87518 11.7259 8.27429 13.1251 10.0002 13.1251C11.7257 13.1251 13.125 11.727 13.1252 10.0011V9.99773ZM9.99985 8.12506C11.035 8.12451 11.8746 8.96322 11.8752 9.99839V10.0004C11.8752 11.0357 11.0359 11.8751 10.0002 11.8751C8.96465 11.8751 8.12518 11.0356 8.12518 10.0001C8.12518 8.96472 8.96451 8.12533 9.99985 8.12506Z",fill:"#F9F9F9"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99885 4.37593C5.66421 4.37604 2.80603 7.64523 1.79548 9.00983C1.35636 9.60279 1.35918 10.4 1.80012 10.9902C2.81706 12.3514 5.69374 15.6241 9.99886 15.6241C14.3806 15.6241 17.2194 12.3452 18.2168 10.9808C18.6473 10.392 18.6442 9.60472 18.211 9.01902C17.2056 7.65938 14.3429 4.37583 9.99885 4.37593ZM2.80002 9.75374C3.77049 8.44326 6.30207 5.62602 9.99888 5.62593C13.7041 5.62585 16.24 8.45598 17.206 9.76225C17.3146 9.9091 17.3149 10.0965 17.2077 10.2431C16.254 11.5477 13.7416 14.3741 9.99886 14.3741C6.33149 14.3741 3.78173 11.5541 2.80152 10.242C2.69021 10.0931 2.69001 9.90229 2.80002 9.75374Z",fill:"#F9F9F9"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0763 3.26988C18.3415 3.58809 18.2985 4.06101 17.9803 4.32619L2.98032 16.8262C2.66211 17.0914 2.18919 17.0484 1.92402 16.7302C1.65884 16.412 1.70184 15.939 2.02004 15.6739L17.02 3.17385C17.3383 2.90868 17.8112 2.95167 18.0763 3.26988Z",fill:"#F9F9F9"})]})]}):e.jsx("div",{"data-toolbar-name":!0,children:j(b.customLabel||b.label)}),$&&"Section"!==b.tag&&T.length>0&&e.jsx("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":R,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),$&&R&&T.map((t,i)=>e.jsxs("div",{"data-toolbar-parent":!0,"data-component-tag":t.tag,"data-parent-uid":t.uid,"data-toolbar-theme-section":y,"data-toolbar-parent-revert":H,style:{top:H?`${36*(i+1)}px`:`${-36*(i+1)}px`},children:[e.jsx("div",{"data-toolbar-icon-drag":!0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),e.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),e.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),e.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),e.jsx("div",{"data-toolbar-name":!0,children:eZ(t)})]},t.uid)),$&&!ep&&e.jsxs(e.Fragment,{children:[e.jsx(g.default,{...b}),eB&&e.jsx(o.CreateThemeSection,{...b}),(()=>{let{isShopifySection:e,tag:t}=b;return!e&&(!v||!!y)&&u.ableGenerateContentElements.includes(t)&&!Q})()&&e.jsx(C.AIContentGenerator,{...b}),"Sticky"==b.tag&&e.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>eH(e),"aria-hidden":"true",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),el.includes(b.tag)&&e.jsx(l.default,{"data-toolbar-title":!0,enable:!0,"data-toolbar-disable":!1,text:j("Edit content in Shopify"),position:"top",onClick:()=>{if(eo.includes(b.tag)){window.open(eh,"_blank");return}if(er.includes(b.tag)){window.open(ec,"_blank");return}window.open(eC,"_blank")},"aria-hidden":"true",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",fill:"currentColor"}),e.jsx("path",{d:"M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",fill:"currentColor"}),e.jsx("path",{d:"M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",fill:"currentColor"}),e.jsx("path",{d:"M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",fill:"currentColor"})]})}),e.jsx(l.default,{enable:"Section"==b.tag&&es()>=25||w,text:w?j("Disabled. Please edit in Shopify Editor"):j("Page has reached Shopify’s 25 section-limit"),position:"bottom",width:"200px","data-toolbar-duplicate":!0,"data-toolbar-disable":ej,onClick:ej?void 0:e=>eE(e),"aria-hidden":"true",className:ej?"!gp-cursor-not-allowed":"",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),e.jsx(l.default,{"data-toolbar-delete":!0,onClick:e=>eb?null:eR(e),enable:eb,"data-toolbar-disable":eb,text:w?j("Disabled. Please edit in Shopify Editor"):_.text,width:_.width,position:w?"bottom":A,"aria-hidden":"true",className:eb?"!gp-cursor-not-allowed":"",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),e.jsx(h.InteractionSuffix,{uid:b.uid})]},b.uid),"STATIC"!==q&&"POST_PURCHASE"!==q&&25>eM()&&e.jsx(a.ThemeSectionStatusWrapper,{...b}),e.jsx("div",{"data-outline":!0,"data-outline-section":"Section"==b.tag,"data-outline-theme-section":"Section"==b.tag&&!!v||y,"data-outline-shopify-section":"Section"==b.tag&&!!w,"data-outline-limit":ey,"data-outline-error":!!Q},"outline-"+b.uid),"Section"==b.tag&&!y&&e.jsxs(e.Fragment,{children:[e.jsx(l.default,{enable:es()>=25,text:j("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":es()>=25,"data-toolbar-add-open":"above"==Z,onClick:e=>eT(e,"above"),"aria-hidden":"true",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),e.jsx(l.default,{enable:es()>=25,text:j("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":es()>=25,"data-toolbar-add-open":"below"==Z,onClick:e=>eT(e,"below"),"aria-hidden":"true",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),Q&&e.jsx(n.SectionErrorBanner,{errorSectionInfo:Q,onDismiss:eq}),u.ableGenerateContentElements.includes(b.tag)&&$&&e.jsx(c.AIGenContentLoading,{...b}),$&&e.jsx(s.default,{...b})]})});exports.default=b;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react");require("zustand");var s=require("../../contexts/PageContext.js");require("react-transition-group"),require("../constant.js"),require("swr"),require("swr/infinite"),require("../../graphql/queries/productsV2.generated.js"),require("../../graphql/queries/product-little-detail.generated.js"),require("../../graphql/queries/product-medias.generated.js"),require("../../graphql/queries/product-variants.generated.js"),require("classnames"),require("dayjs"),require("@gem-sdk/core");var i=require("./UpgradeButton.js");require("../../graphql/queries/collection-detail-filter.generated.js"),require("../../graphql/queries/collection.generated.js"),require("../../graphql/queries/collections.generated.js"),require("../../graphql/queries/published-theme-pages.generated.js"),require("../../graphql/queries/store-property.generated.js"),require("../../graphql/queries/preview-page.generated.js"),require("../../graphql/queries/published-shop-metas.generated.js"),require("../../graphql/queries/shop-shopify.generated.js"),require("../../graphql/queries/articles.generated.js"),require("../../graphql/queries/blogs.generated.js"),require("../../graphql/queries/products-with-selling-plans.generated.js"),require("../../graphql/queries/product-variant-with-selling-plans.generated.js"),require("../../helpers/convert.js"),require("crc-32"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js"),require("../../graphql/queries/product-value-label.generated.js"),require("../../hooks/useStickyStore.js"),require("../../types/builder.js"),require("../../types/custom.js"),require("../../types/animations.js"),exports.default=({tag:t,uid:u})=>{let a=s.usePageStore(e=>e.oldElements),q=s.usePageStore(e=>e.updatedElements),l=s.usePageStore(e=>e.updatingElements),o=r.useMemo(()=>!!u&&(a?.some(e=>e.uid===u)??!1),[a,u]),n=r.useMemo(()=>q?.some(e=>e.uid===u),[q,u]),d=r.useMemo(()=>l?.some(e=>e.uid===u),[l,u]),p=r.useCallback(e=>{n||(e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("editor:toolbar:upgrade-old-element",{bubbles:!0,detail:{componentUid:u,fromTag:t}})))},[n,t,u]);return t&&u&&(o||n)?e.jsx(i.default,{isLoading:d,isUpdated:n,onUpgrade:p}):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react");require("zustand");var s=require("../../contexts/PageContext.js");require("react-transition-group"),require("../constant.js"),require("swr"),require("swr/infinite"),require("../../graphql/queries/productsV2.generated.js"),require("../../graphql/queries/product-little-detail.generated.js"),require("../../graphql/queries/product-medias.generated.js"),require("../../graphql/queries/product-variants.generated.js");var i=require("../../hooks/shop.js");require("classnames"),require("dayjs"),require("@gem-sdk/core");var t=require("./UpgradeButton.js");require("../../graphql/queries/collection-detail-filter.generated.js"),require("../../graphql/queries/collection.generated.js"),require("../../graphql/queries/collections.generated.js"),require("../../graphql/queries/published-theme-pages.generated.js"),require("../../graphql/queries/store-property.generated.js"),require("../../graphql/queries/preview-page.generated.js"),require("../../graphql/queries/published-shop-metas.generated.js"),require("../../graphql/queries/shop-shopify.generated.js"),require("../../graphql/queries/articles.generated.js"),require("../../graphql/queries/blogs.generated.js"),require("../../graphql/queries/products-with-selling-plans.generated.js"),require("../../graphql/queries/product-variant-with-selling-plans.generated.js"),require("../../helpers/convert.js"),require("crc-32"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js"),require("../../graphql/queries/product-value-label.generated.js"),require("../../hooks/useStickyStore.js"),require("../../types/builder.js"),require("../../types/custom.js"),require("../../types/animations.js");const u=["THEME_SECTION"];exports.default=({tag:a,uid:q})=>{let o=s.usePageStore(e=>e.oldElements),l=s.usePageStore(e=>e.updatedElements),n=s.usePageStore(e=>e.updatingElements),d=i.usePageType(),p=r.useMemo(()=>!u.some(e=>e.includes(d)),[d]),g=r.useMemo(()=>!!q&&(o?.some(e=>e.uid===q)??!1),[o,q]),c=r.useMemo(()=>l?.some(e=>e.uid===q),[l,q]),h=r.useMemo(()=>n?.some(e=>e.uid===q),[n,q]),j=r.useCallback(e=>{c||(e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("editor:toolbar:upgrade-old-element",{bubbles:!0,detail:{componentUid:q,fromTag:a}})))},[c,a,q]);return a&&q&&p&&(g||c)?e.jsx(t.default,{isLoading:h,isUpdated:c,onUpgrade:j}):null};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),i=require("zustand"),s=require("../helpers/clone-deep.js"),r=require("../helpers/normalize-builder-data.js"),n=require("./types/builderPreviewContext.js");function l(e,t,i){let s=e.splice(t,1)[0];void 0!==s&&e.splice(i,0,s)}const d=t.createContext(null),a={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},c=(e,t,d)=>i.createStore((i,c)=>({state:e,loaded:!1,isThemeSectionEditor:!!d,pageName:t,dynamicProduct:null,dynamicCollection:null,errorSectionList:null,addItem:e=>{let{position:t,data:n}=e,l=c().state,d=Date.now();if("section"===e.type){if(!Array.isArray(n)){let e=n.uid,r=l.ROOT;r.childrens?r.childrens.splice(t??0,0,e):r.childrens=[e],r.dateModified=d,i({state:{...l,[e]:{uid:e,type:"section",label:n.label},ROOT:s.cloneDeep(r)}})}}else{let{id:n,data:a}=e,c=n?l[n]??l.ROOT:l.ROOT;if("section"===c.type)return;if(Array.isArray(a)){let e=a.map(e=>e.uid),n=a.reduceRight((e,t)=>{let i=r.normalizeBuilderData(t);return{...e,...i}},{});c.dateModified=d,c.childrens=c.childrens??[],c.childrens.splice(t??0,0,...e),i({state:{...l,...n,[c.uid]:s.cloneDeep(c)}})}else{let e=r.normalizeBuilderData(a);c.dateModified=d,c.childrens=c.childrens??[],c.childrens.splice(t??0,0,a.uid),i({state:{...l,...e,[c.uid]:s.cloneDeep(c)}})}}},changeItemProp:(e,t,s)=>{if(!s||!["setting","style","advanced"].includes(s))return;let r=c().state,n=r[e];if(n?.type!=="section"&&n){let l=Date.now();switch(n.dateModified=l,s){case"setting":i({state:{...r,[e]:{...n,settings:{...n.settings,...t}}}});break;case"style":i({state:{...r,[e]:{...n,styles:{...n.styles,...t}}}});break;case"advanced":i({state:{...r,[e]:{...n,advanced:{...n.advanced,...t}}}})}}},forceChangeItemProp:(e,t,s)=>{if(!s||!["setting","style","advanced"].includes(s))return;let r=c().state,n=r[e];if(n?.type!=="section"&&n){let l=Date.now();switch(n.dateModified=l,s){case"setting":i({state:{...r,[e]:{...n,settings:t}}});break;case"style":i({state:{...r,[e]:{...n,styles:t}}});break;case"advanced":i({state:{...r,[e]:{...n,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:s,group:r})=>{if(!r||!["setting","style","advanced"].includes(r))return;let n=c().state,l=n[e];if(l?.type!=="section"&&l){let d={style:l.styles??{},advanced:l.advanced??{},setting:l.settings??{}};void 0===s?(console.warn("Data is undefined"),delete d[r][t]):d[r][t]=s,i({state:{...n,[e]:{...l,settings:{...d.setting},styles:{...d.style},advanced:{...d.advanced}}}})}},getItem:e=>c().state[e],getState:()=>c().state,removeItem:e=>{if("ROOT"===e)i({state:{ROOT:a}});else{let t=c().state;!function e(t,i){let s=i[t];s&&(delete i[t],"section"!==s.type&&s.childrens?.map(t=>e(t,i)))}(e,t);let r=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(r){let n=Date.now(),[l,d]=r;if("section"===d.type)return;d.childrens=d.childrens?.filter(t=>t!==e),d.dateModified=n,i({state:{...t,[l]:s.cloneDeep(d)}})}}},moveItem:(e,t,r)=>{let n=c().state,d=n[e],a=n[t];if(d&&a&&"section"!==a.type){if("section"===d.type){let t=n.ROOT;if(!t.childrens)return;let d=t.childrens.findIndex(t=>t===e);l(t.childrens,d,r??0),i({state:{...n,ROOT:s.cloneDeep(t)}})}else{let c=Object.entries(n).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(d&&c){let o=Date.now(),[,u]=c;if("section"===u.type)return;if(u.dateModified=o,t===u.uid&&u.childrens){let t=u.childrens.findIndex(t=>t===e);u.childrens&&t!==r&&(l(u.childrens,t,r??0),i({state:{...n,[u.uid]:s.cloneDeep(u)}}))}else u.childrens=u.childrens?.filter(t=>t!==e),a&&(a.dateModified=o,a.childrens=a.childrens??[],a.childrens.splice(r??0,0,d.uid),i({state:{...n,[a.uid]:s.cloneDeep(a),[u.uid]:s.cloneDeep(u)}}))}}}},forceChangeState:e=>{i({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),s=e.reduceRight((e,t)=>{let i=r.normalizeBuilderData(t);return{...e,...i}},{});i({loaded:!0,state:{ROOT:{...a,childrens:t},...s}})}else{let t=r.normalizeBuilderData(e);i({loaded:!0,state:{ROOT:{...a,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let r=c().state,n=r.ROOT;n.childrens||(n.childrens=[]),n.childrens.splice(t??0,0,e.uid),i({state:{...r,ROOT:s.cloneDeep(n)}})},getParents:(e,t)=>{let i=c().state,s=[],r=0,n=e;for(;!t||!(r>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(n));if(!e)break;let[,t]=e;if(!t)break;s.push(t),n=t.uid,r++}return s},updateItemName:(e,t)=>{let r=c().state,n=r[e];n&&(n.name=t,i({state:{...r,[e]:s.cloneDeep(n)}}))},updateItemAttribute:(e,t,s)=>{if(!s||!n.UPDATABLE_ITEM_ATTRS.includes(s))return;let r=c().state,l=r[e];if(l){if("section"!==l.type){let e=Date.now();l.dateModified=e}let n={...l,[s]:t};i({state:{...r,[e]:n}})}},updateAllItemAttribute:(e,t)=>{if("tag"!==e)return;let s=c().state,r={};for(let{uid:i,value:n}of t){let t=s[i];if(!t)continue;let l={...t,..."section"!==t.type&&{dateModified:Date.now()},[e]:n};r[i]=l}Object.keys(r).length>0&&i({state:{...s,...r}})},dismissPublishError:e=>{let t=c().errorSectionList;if(!Array.isArray(t))return;let s=t.map(t=>t.uid===e?{...t,isDismissed:!0}:t);i({errorSectionList:s})},setErrorSectionList:e=>i({errorSectionList:e})}));exports.BuilderPreviewProvider=({children:i,state:s,isThemeSectionEditor:r,pageName:n,lazy:l,...a})=>{let o=l?t.Suspense:t.Fragment,u=t.useMemo(()=>c(s,n,r),[s,r,n]);return e.jsx(o,{children:e.jsx(d.Provider,{...a,value:u,children:i})})},exports.useBuilderPreviewStore=(e,s)=>{let r=t.useContext(d);if(!r)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return i.useStore(r,e,s)};
2
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),i=require("zustand"),s=require("../helpers/clone-deep.js"),n=require("../helpers/normalize-builder-data.js"),r=require("./types/builderPreviewContext.js");function l(e,t,i){let s=e.splice(t,1)[0];void 0!==s&&e.splice(i,0,s)}const d=t.createContext(null),a={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},c=(e,t,d)=>i.createStore((i,c)=>({state:e,loaded:!1,isThemeSectionEditor:!!d,pageName:t,dynamicProduct:null,dynamicCollection:null,errorSectionList:null,activeComponentDetail:null,addItem:e=>{let{position:t,data:r}=e,l=c().state,d=Date.now();if("section"===e.type){if(!Array.isArray(r)){let e=r.uid,n=l.ROOT;n.childrens?n.childrens.splice(t??0,0,e):n.childrens=[e],n.dateModified=d,i({state:{...l,[e]:{uid:e,type:"section",label:r.label},ROOT:s.cloneDeep(n)}})}}else{let{id:r,data:a}=e,c=r?l[r]??l.ROOT:l.ROOT;if("section"===c.type)return;if(Array.isArray(a)){let e=a.map(e=>e.uid),r=a.reduceRight((e,t)=>{let i=n.normalizeBuilderData(t);return{...e,...i}},{});c.dateModified=d,c.childrens=c.childrens??[],c.childrens.splice(t??0,0,...e),i({state:{...l,...r,[c.uid]:s.cloneDeep(c)}})}else{let e=n.normalizeBuilderData(a);c.dateModified=d,c.childrens=c.childrens??[],c.childrens.splice(t??0,0,a.uid),i({state:{...l,...e,[c.uid]:s.cloneDeep(c)}})}}},changeItemProp:(e,t,s)=>{if(!s||!["setting","style","advanced"].includes(s))return;let n=c().state,r=n[e];if(r?.type!=="section"&&r){let l=Date.now();switch(r.dateModified=l,s){case"setting":i({state:{...n,[e]:{...r,settings:{...r.settings,...t}}}});break;case"style":i({state:{...n,[e]:{...r,styles:{...r.styles,...t}}}});break;case"advanced":i({state:{...n,[e]:{...r,advanced:{...r.advanced,...t}}}})}}},forceChangeItemProp:(e,t,s)=>{if(!s||!["setting","style","advanced"].includes(s))return;let n=c().state,r=n[e];if(r?.type!=="section"&&r){let l=Date.now();switch(r.dateModified=l,s){case"setting":i({state:{...n,[e]:{...r,settings:t}}});break;case"style":i({state:{...n,[e]:{...r,styles:t}}});break;case"advanced":i({state:{...n,[e]:{...r,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:s,group:n})=>{if(!n||!["setting","style","advanced"].includes(n))return;let r=c().state,l=r[e];if(l?.type!=="section"&&l){let d={style:l.styles??{},advanced:l.advanced??{},setting:l.settings??{}};void 0===s?(console.warn("Data is undefined"),delete d[n][t]):d[n][t]=s,i({state:{...r,[e]:{...l,settings:{...d.setting},styles:{...d.style},advanced:{...d.advanced}}}})}},getItem:e=>c().state[e],getState:()=>c().state,removeItem:e=>{if("ROOT"===e)i({state:{ROOT:a}});else{let t=c().state;!function e(t,i){let s=i[t];s&&(delete i[t],"section"!==s.type&&s.childrens?.map(t=>e(t,i)))}(e,t);let n=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(n){let r=Date.now(),[l,d]=n;if("section"===d.type)return;d.childrens=d.childrens?.filter(t=>t!==e),d.dateModified=r,i({state:{...t,[l]:s.cloneDeep(d)}})}}},moveItem:(e,t,n)=>{let r=c().state,d=r[e],a=r[t];if(d&&a&&"section"!==a.type){if("section"===d.type){let t=r.ROOT;if(!t.childrens)return;let d=t.childrens.findIndex(t=>t===e);l(t.childrens,d,n??0),i({state:{...r,ROOT:s.cloneDeep(t)}})}else{let c=Object.entries(r).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(d&&c){let o=Date.now(),[,u]=c;if("section"===u.type)return;if(u.dateModified=o,t===u.uid&&u.childrens){let t=u.childrens.findIndex(t=>t===e);u.childrens&&t!==n&&(l(u.childrens,t,n??0),i({state:{...r,[u.uid]:s.cloneDeep(u)}}))}else u.childrens=u.childrens?.filter(t=>t!==e),a&&(a.dateModified=o,a.childrens=a.childrens??[],a.childrens.splice(n??0,0,d.uid),i({state:{...r,[a.uid]:s.cloneDeep(a),[u.uid]:s.cloneDeep(u)}}))}}}},forceChangeState:e=>{i({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),s=e.reduceRight((e,t)=>{let i=n.normalizeBuilderData(t);return{...e,...i}},{});i({loaded:!0,state:{ROOT:{...a,childrens:t},...s}})}else{let t=n.normalizeBuilderData(e);i({loaded:!0,state:{ROOT:{...a,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let n=c().state,r=n.ROOT;r.childrens||(r.childrens=[]),r.childrens.splice(t??0,0,e.uid),i({state:{...n,ROOT:s.cloneDeep(r)}})},getParents:(e,t)=>{let i=c().state,s=[],n=0,r=e;for(;!t||!(n>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(r));if(!e)break;let[,t]=e;if(!t)break;s.push(t),r=t.uid,n++}return s},updateItemName:(e,t)=>{let n=c().state,r=n[e];r&&(r.name=t,i({state:{...n,[e]:s.cloneDeep(r)}}))},updateItemAttribute:(e,t,s)=>{if(!s||!r.UPDATABLE_ITEM_ATTRS.includes(s))return;let n=c().state,l=n[e];if(l){if("section"!==l.type){let e=Date.now();l.dateModified=e}let r={...l,[s]:t};i({state:{...n,[e]:r}})}},updateAllItemAttribute:(e,t)=>{if("tag"!==e)return;let s=c().state,n={};for(let{uid:i,value:r}of t){let t=s[i];if(!t)continue;let l={...t,..."section"!==t.type&&{dateModified:Date.now()},[e]:r};n[i]=l}Object.keys(n).length>0&&i({state:{...s,...n}})},dismissPublishError:e=>{let t=c().errorSectionList;if(!Array.isArray(t))return;let s=t.map(t=>t.uid===e?{...t,isDismissed:!0}:t);i({errorSectionList:s})},setErrorSectionList:e=>i({errorSectionList:e}),setActiveComponentDetail:e=>i({activeComponentDetail:e})}));exports.BuilderPreviewProvider=({children:i,state:s,isThemeSectionEditor:n,pageName:r,lazy:l,...a})=>{let o=l?t.Suspense:t.Fragment,u=t.useMemo(()=>c(s,r,n),[s,n,r]);return t.useEffect(()=>{let e=e=>{let t=e.detail??null;u.getState().setActiveComponentDetail(t)};return window.addEventListener("editor:active-component",e),()=>{window.removeEventListener("editor:active-component",e)}},[u]),e.jsx(o,{children:e.jsx(d.Provider,{...a,value:u,children:i})})},exports.useBuilderPreviewStore=(e,s)=>{let n=t.useContext(d);if(!n)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return i.useStore(n,e,s)};
@@ -1 +1 @@
1
- "use strict";var e=require("./get-resonsive-value.js"),t=require("./builder.js");const l=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),a=(e,t,l)=>l?`${t?.[e]}${l}`:t?.[e]==="default"?"1200px":t?.[e],s=(e,t,l)=>{if(l)return`${t?.[e]}${l}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}};exports.makeAspectRatio=(t,l,a)=>{let s={};return["desktop","mobile","tablet"].forEach(o=>{let i=e.getResponsiveValueByScreen(t,o);"none"!==i&&(s={...s,[o]:"custom"!==i?i:`${e.getResponsiveValueByScreen(l,"desktop")}/${e.getResponsiveValueByScreen(a,"desktop")}`})}),s},exports.makeGlobalSizeHeightResponsive=e=>{let l=e?.desktop?.height,a=e?.tablet?.height,s=e?.mobile?.height,o={};return t.isSafeValue(l)&&(o["--h"]=l),t.isSafeValue(a)&&a!==l&&(o["--h-tablet"]=a),t.isSafeValue(s)&&s!==a&&(o["--h-mobile"]=s),o},exports.makeGlobalSizeWidthResponsive=e=>{let l=e?.desktop?.width,a=e?.tablet?.width,s=e?.mobile?.width,o={};return t.isSafeValue(l)&&(o["--w"]=l),t.isSafeValue(a)&&a!==l&&(o["--w-tablet"]=a),t.isSafeValue(s)&&s!==a&&(o["--w-mobile"]=s),o},exports.makeHeight=(e,l)=>{let a=(e,t,l)=>{let a=t?.[e],s=l?.[e];return s?"auto":!1===s?a??a:a},s=a("desktop",e,l),o=a("tablet",e,l),i=a("mobile",e,l),r={};return t.isSafeValue(s)&&(r.desktop=s),t.isSafeValue(o)&&o!==s&&(r.tablet=o),t.isSafeValue(i)&&i!==o&&(r.mobile=i),r},exports.makeLineClamp=(l,a)=>{let s=(t,l,a)=>{let s=e.getResponsiveValueByScreen(l,t),o=e.getResponsiveValueByScreen(a,t);return 0===s?"0":o||void 0===o?s:"unset"},o=s("desktop",l,a),i=s("tablet",l,a),r=s("mobile",l,a),u={};return t.isSafeValue(o)&&(u.desktop=o),t.isSafeValue(i)&&i!==o&&(u.tablet=i),t.isSafeValue(r)&&r!==i&&(u.mobile=r),u},exports.makeStyle=e=>l(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),exports.makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),exports.makeStyleResponsive=(e,l,a)=>{let s=a&&t.isSafeValue(l?.desktop)?`${l?.desktop}${a}`:l?.desktop,o=a&&t.isSafeValue(l?.tablet)?`${l?.tablet}${a}`:l?.tablet,i=a&&t.isSafeValue(l?.mobile)?`${l?.mobile}${a}`:l?.mobile,r={};return s&&(r[`--${e}`]=s),o&&o!==s&&(r[`--${e}-tablet`]=o),i&&i!==o&&(r[`--${e}-mobile`]=i),r},exports.makeStyleResponsiveByScreen=(t,l,a)=>({[`--${t}`]:a?`${e.getResponsiveValueByScreen(l,"desktop")}${a}`:e.getResponsiveValueByScreen(l,"desktop"),[`--${t}-tablet`]:a?`${e.getResponsiveValueByScreen(l,"tablet")}${a}`:e.getResponsiveValueByScreen(l,"tablet"),[`--${t}-mobile`]:a?`${e.getResponsiveValueByScreen(l,"mobile")}${a}`:e.getResponsiveValueByScreen(l,"mobile")}),exports.makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},exports.makeStyleResponsiveWidth=(e,l)=>{let s=a("desktop",e,l),o=a("tablet",e,l),i=a("mobile",e,l),r={};return t.isSafeValue(s)&&(r["--w"]=s),t.isSafeValue(o)&&o!==s&&(r["--w-tablet"]=o),t.isSafeValue(i)&&i!==o&&(r["--w-mobile"]=i),r},exports.makeStyleResponsiveWidthWithoutAuto=(e,l)=>{let a=s("desktop",e,l),o=s("tablet",e,l),i=s("mobile",e,l),r={};return t.isSafeValue(a)&&(r["--w"]=a),t.isSafeValue(o)&&o!==a&&(r["--w-tablet"]=o),t.isSafeValue(i)&&i!==o&&(r["--w-mobile"]=i),r},exports.makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},exports.makeWidth=(l,a)=>{let s=(t,l,a)=>{let s=e.getResponsiveValueByScreen(l,t),o=a?.[t]===void 0?a?.desktop:a?.[t];return o?"100%":!1===o?s??s:s||"auto"},o=s("desktop",l,a),i=s("tablet",l,a),r=s("mobile",l,a),u={};return t.isSafeValue(o)&&(u.desktop=o),t.isSafeValue(i)&&i!==o&&(u.tablet=i),t.isSafeValue(r)&&r!==i&&(u.mobile=r),u},exports.removeNullUndefined=l;
1
+ "use strict";var e=require("./get-resonsive-value.js");const t=e=>Object.entries(e).reduce((e,[t,o])=>null==o?e:{...e,[t]:o},{}),o=(e,t,o)=>o?`${t?.[e]}${o}`:t?.[e]==="default"?"1200px":t?.[e],l=(e,t,o)=>{if(o)return`${t?.[e]}${o}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}};exports.makeAspectRatio=(t,o,l)=>{let s={};return["desktop","mobile","tablet"].forEach(a=>{let i=e.getResponsiveValueByScreen(t,a);"none"!==i&&(s={...s,[a]:"custom"!==i?i:`${e.getResponsiveValueByScreen(o,"desktop")}/${e.getResponsiveValueByScreen(l,"desktop")}`})}),s},exports.makeGlobalSizeHeightResponsive=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),exports.makeGlobalSizeWidthResponsive=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),exports.makeHeight=(e,t)=>{let o=(e,t,o)=>{let l=t?.[e],s=o?.[e];return s?"auto":!1===s?l??l:l};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},exports.makeLineClamp=(t,o)=>{let l=(t,o,l)=>{let s=e.getResponsiveValueByScreen(o,t),a=e.getResponsiveValueByScreen(l,t);return 0===s?"0":a||void 0===a?s:"unset"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},exports.makeStyle=e=>t(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),exports.makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),exports.makeStyleResponsive=(e,t,o)=>({[`--${e}`]:o?`${t?.desktop}${o}`:t?.desktop,[`--${e}-tablet`]:o?`${t?.tablet}${o}`:t?.tablet,[`--${e}-mobile`]:o?`${t?.mobile}${o}`:t?.mobile}),exports.makeStyleResponsiveByScreen=(t,o,l)=>({[`--${t}`]:l?`${e.getResponsiveValueByScreen(o,"desktop")}${l}`:e.getResponsiveValueByScreen(o,"desktop"),[`--${t}-tablet`]:l?`${e.getResponsiveValueByScreen(o,"tablet")}${l}`:e.getResponsiveValueByScreen(o,"tablet"),[`--${t}-mobile`]:l?`${e.getResponsiveValueByScreen(o,"mobile")}${l}`:e.getResponsiveValueByScreen(o,"mobile")}),exports.makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},exports.makeStyleResponsiveWidth=(e,t)=>({"--w":o("desktop",e,t),"--w-tablet":o("tablet",e,t),"--w-mobile":o("mobile",e,t)}),exports.makeStyleResponsiveWidthWithoutAuto=(e,t)=>({"--w":l("desktop",e,t),"--w-tablet":l("tablet",e,t),"--w-mobile":l("mobile",e,t)}),exports.makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},exports.makeWidth=(t,o)=>{let l=(t,o,l)=>{let s=e.getResponsiveValueByScreen(o,t),a=l?.[t]===void 0?l?.desktop:l?.[t];return a?"100%":!1===a?s??s:s||"auto"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},exports.removeNullUndefined=t;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsxs as e,Fragment as t,jsx as i}from"react/jsx-runtime";import{memo as o,useState as r,useMemo as l,useCallback as n,useEffect as a}from"react";import"zustand";import{useBuilderPreviewStore as d}from"../contexts/BuilderPreviewContext.js";import{usePageStore as s}from"../contexts/PageContext.js";import{CreateThemeSection as C}from"./theme-section/CreateThemeSection.js";import p from"./toolbar/Tooltip.js";import{SectionErrorBanner as c}from"./toolbar/SectionErrorBanner.js";import{ThemeSectionStatusWrapper as u}from"./theme-section/ThemeSectionStatus.js";import h from"./resize/Resize.js";import{usePostPurchase as m}from"../hooks/useToolbarPostPurchase.js";import{ableGenerateContentElements as g}from"./constant.js";import{AIContentGenerator as f}from"./ai-generator/AIContentGenerator.js";import{AIGenContentLoading as v}from"./ai-generator/AIGenContentLoading.js";import{InteractionSuffix as b}from"./InteractionSuffix.js";import{useI18nStore as w}from"@gem-sdk/core";import S from"./upgrade-element/UpgradeElement.js";import"swr";import"../graphql/queries/collection-detail-filter.generated.js";import"../graphql/queries/collection.generated.js";import"../graphql/queries/collections.generated.js";import"../graphql/queries/published-theme-pages.generated.js";import"../graphql/queries/store-property.generated.js";import"../graphql/queries/preview-page.generated.js";import"../graphql/queries/published-shop-metas.generated.js";import"../graphql/queries/shop-shopify.generated.js";import"../graphql/queries/articles.generated.js";import"../graphql/queries/blogs.generated.js";import"../graphql/queries/products-with-selling-plans.generated.js";import"../graphql/queries/product-variant-with-selling-plans.generated.js";import"../graphql/queries/product-variants.generated.js";import"../graphql/queries/product-little-detail.generated.js";import"../graphql/queries/product-medias.generated.js";import"../graphql/queries/productsV2.generated.js";import"../helpers/convert.js";import"crc-32";import{useShopStore as L}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"../graphql/queries/product-value-label.generated.js";import"../hooks/useStickyStore.js";import"../types/builder.js";import"../types/custom.js";import"../types/animations.js";let y=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},x=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t};var M=o(o=>{let{t:M}=w(),Z=o.isThemeSection,j=!!o.isShopifySection,q=L(e=>e.storefrontUrl),R=L(e=>e.pageType),H=d(e=>e.getParents),E=d(e=>e.getItem("ROOT")),V=d(e=>e.isThemeSectionEditor),[P,T]=r(null),[A,B]=r(!1),[k,$]=r(!1),[F,I]=r([]),[U,D]=r("top"),[O,N]=r(!1),[G,z]=r(!1),[_,J]=r(""),[K,Q]=r(""),[W,X]=r({width:"",text:""}),[Y,ee]=r(!1),et=d(e=>e.errorSectionList),ei=l(()=>{if(!et)return null;let e=et?.find(e=>e.uid===o.uid);return e},[et,o.uid]),eo=s(e=>e.interactionData),er=l(()=>"POST_PURCHASE"===R,[R]),{checkDisableDelete:el,getTooltipText:en,checkDisableDuplicate:ea}=m(o.uid,o.tag||""),ed=["ProductTitle","ProductDescription","ProductPrice"],es=["ArticleTitle","ArticleContent","ArticleImage","ArticleAuthor","ArticleCategory","ArticleDate","ArticleExcerpt","ArticleTags"],eC=[...ed,...es],ep=(e,t)=>{let i=F.length,o=e.getBoundingClientRect(),r=t.getBoundingClientRect();return o.top-r.top<36*i},ec=(e,t)=>{let i=t||e;if(e&&!x(e))return y(e)&&ep(t,e)?e:e.parentElement?ec(e.parentElement,i):void 0},eu=n(()=>E?.childrens?.length||0,[E?.childrens?.length]),eh=n(()=>{if("Section"==o.tag)return"bottom";let e=document.body.querySelector("#storefront")?.querySelector('[data-toolbar-active="true"]');if(e){let t=e.getBoundingClientRect();t.top<60?D("bottom"):D("top")}},[o.tag]),em=l(()=>q?q.match(/^(?:https?:\/\/)?([^/]+)\.myshopify\.com/)?.[1]:"",[q]),eg=l(()=>`https://admin.shopify.com/store/${em}`,[em]),ef=l(()=>_?`${eg}/products/${_}`:"",[eg,_]),ev=l(()=>K?`${eg}/articles/${K.replace("gid://shopify/Article/","")}`:"",[K,eg]),eb=l(()=>eo?.isSelectOnPage,[eo?.isSelectOnPage]),ew=l(()=>eo?.settingType,[eo?.settingType]),eS=l(()=>eo?.item?.targets?.find(e=>e.uid===o.uid&&e?.type!=="PAGE")&&"TARGET"===ew,[eo?.item?.targets,o.uid,ew]),eL=l(()=>eo?.item?.self?.uid===o.uid&&eo?.item?.self.type!=="PAGE"&&"TRIGGER"===ew,[eo?.item?.self?.type,eo?.item?.self?.uid,o.uid,ew]),ey=l(()=>!eS&&!eL,[eS,eL]),ex=l(()=>O||j,[O,j]),eM=l(()=>Y||j||eu()>25&&"Section"===o.tag||!!ei,[eu,Y,j,o.tag,ei]),eZ=n(e=>{let t=e.detail;if(t?.articleId&&Q(t.articleId),t?.productId&&J(t.productId),t?.componentUid==o.uid){z(!0),eh(),er&&(N(el()),X(en()),ee(ea()));let e=H(o.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&V||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);I(e)}else z(!1),I([]),B(!1)},[o.uid,er,H,el,en,ea,V,eh]),ej=d(e=>e.dismissPublishError),eq=n(()=>{ej(o.uid)},[ej,o.uid]),eR=n(()=>"Section"!==o.tag?-1:E?.childrens?.length?E.childrens.findIndex(e=>e==o.uid):-1,[E?.childrens,o.uid,o.tag]),eH=l(()=>eR()>=25,[eR]),eE=l(()=>!!ei||eH,[ei,eH]);if(a(()=>(window.addEventListener("editor:active-component",eZ),()=>{window.removeEventListener("editor:active-component",eZ)}),[eZ]),"section"===o.type||o.editorConfigs?.toolbar?.hide)return null;let eV=e=>{let t=e?.childrens?.length??0;if("Row"===e.label){let e=1===t?M("Row {colNumber} col",{colNumber:t}):M("Row {colNumber} cols",{colNumber:t});return e}return M(e.label)},eP=e=>{if(!F.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(A)$(!1),B(!1);else{let e=ec(i,i);if(e)$(!0);else{let e=i.getBoundingClientRect();e.top<36*F.length?$(!0):$(!1)}B(!0)}let o=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!A}});window.dispatchEvent(o)},eT=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:o.uid,isThemeSection:Z,isShopifySection:j}});return window.dispatchEvent(t),!1},eA=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:o.uid,isThemeSection:Z,isShopifySection:j}});return window.dispatchEvent(t),!1},eB=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:o.uid}});return window.dispatchEvent(t),!1},ek=()=>{T(null),window.removeEventListener("editor:close-add-section-popup",ek)},e$=(e,t)=>{if(e.preventDefault(),e.stopPropagation(),eu()>=25)return!1;let i=e.target;if(i){T(t);let e=i.getBoundingClientRect(),r=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:o.uid,position:t,top:e.top+e.height/2}});window.dispatchEvent(r),window.addEventListener("editor:close-add-section-popup",ek)}return!1},eF="Section"===o.tag&&!o.isThemeSection&&"STATIC"!==R&&"POST_PURCHASE"!==R&&!o.isShopifySection&&25>eR()&&!ei;return e(t,{children:[!("Section"==o.tag&&V)&&e("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==o.tag,"data-toolbar-theme-section":"Section"==o.tag&&!!Z||V,"data-toolbar-shopify-section":"Section"==o.tag&&!!j,"data-toolbar-limit":eR()>=25||!!ei,children:[e("div",{"data-toolbar-show-parent":!0,onClick:e=>eP(e),"aria-hidden":"true",children:[eL&&i("div",{className:"gp-hidden gp-w-[12px] interaction-use-custom-element",children:i("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.36799 0.430523C4.51596 0.205675 4.76709 0.0703125 5.03626 0.0703125H9.88576C10.2042 0.0703125 10.395 0.424378 10.2198 0.69034L8.36968 3.4992C8.28209 3.63218 8.37747 3.80922 8.53671 3.80922H10.749C11.1111 3.80922 11.2869 4.25204 11.0233 4.50036L3.03971 12.0217C2.7572 12.2878 2.29932 12.0361 2.37262 11.655L3.27994 6.93698C3.30366 6.81364 3.20915 6.69921 3.08354 6.69921H0.984651C0.66625 6.69921 0.475479 6.34529 0.650515 6.07932L4.36799 0.430523Z",fill:"#F9F9F9"})})}),eS&&i("div",{className:"gp-hidden gp-w-[14px] interaction-use-custom-element",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.32785 3.66159C7.87459 3.58351 8.25451 3.077 8.17643 2.53026C8.09836 1.98353 7.59184 1.6036 7.0451 1.68168C3.92866 2.12673 1.5332 4.80488 1.5332 8.04424C1.5332 11.594 4.41085 14.4716 7.9606 14.4716C11.1706 14.4716 13.8294 12.1194 14.3105 9.04446C14.3959 8.49881 14.0227 7.98727 13.4771 7.9019C12.9314 7.81654 12.4199 8.18967 12.3345 8.73531C12.0034 10.852 10.1702 12.4716 7.9606 12.4716C5.51541 12.4716 3.5332 10.4894 3.5332 8.04424C3.5332 5.81431 5.18273 3.96793 7.32785 3.66159ZM10.3432 1.97548C10.6232 1.69551 11.102 1.83654 11.1855 2.22355L11.6106 4.19339C11.6313 4.28936 11.7063 4.36432 11.8023 4.38503L13.7721 4.81013C14.1591 4.89365 14.3001 5.37247 14.0202 5.65243L12.3432 7.32945C12.1244 7.54819 11.8168 7.65338 11.5099 7.61436L10.1528 7.44178C9.84592 7.40276 9.53827 7.50795 9.31953 7.72669L8.66719 8.37903C8.35477 8.69145 7.86633 8.70954 7.57623 8.41943C7.28613 8.12933 7.30421 7.64089 7.61663 7.32847L8.26898 6.67613C8.48771 6.45739 8.5929 6.14974 8.55388 5.84287L8.38131 4.48575C8.34228 4.17888 8.44748 3.87123 8.66621 3.6525L10.3432 1.97548ZM8.19853 5.1916C8.35319 5.72179 8.04877 6.27697 7.51858 6.43163C6.83078 6.63226 6.32988 7.2683 6.32988 8.01873C6.32988 8.9316 7.06991 9.67164 7.98279 9.67164C8.73014 9.67164 9.36406 9.17486 9.56743 8.49131C9.72492 7.96195 10.2817 7.6605 10.8111 7.81799C11.3404 7.97548 11.6419 8.53227 11.4844 9.06163C11.0356 10.57 9.63916 11.6716 7.98279 11.6716C5.96535 11.6716 4.32988 10.0362 4.32988 8.01873C4.32988 6.35558 5.44054 4.95445 6.95851 4.51165C7.4887 4.35699 8.04387 4.66141 8.19853 5.1916Z",fill:"#F9F9F9"})})}),G&&ey&&i("div",{"data-toolbar-icon-drag":!0,children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[i("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),i("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),i("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),i("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),i("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),i("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==o.tag?e("div",{"data-toolbar-name":!0,children:[(()=>{if(j)return o.name?.includes("Shopify section:")?`${M("Shopify section")}: ${o.name.replace("Shopify section:","")}`:`${M("Shopify section")}: ${o.name}`;let e=o.name&&o.name===`Section ${o.uid}`;return eu()>=20?`${e?M("Section"):o?.name} ${eR()+1}/25`:e?`${M("Section")} ${eR()+1}`:o?.name})(),G&&j&&!o.isShopifyVisibility&&e("svg",{"data-toolbar-visibility":!0,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.1252 9.99773C13.1243 8.27226 11.7248 6.87423 9.99935 6.87506C8.27386 6.87561 6.87518 8.27455 6.87518 10.0001C6.87518 11.7259 8.27429 13.1251 10.0002 13.1251C11.7257 13.1251 13.125 11.727 13.1252 10.0011V9.99773ZM9.99985 8.12506C11.035 8.12451 11.8746 8.96322 11.8752 9.99839V10.0004C11.8752 11.0357 11.0359 11.8751 10.0002 11.8751C8.96465 11.8751 8.12518 11.0356 8.12518 10.0001C8.12518 8.96472 8.96451 8.12533 9.99985 8.12506Z",fill:"#F9F9F9"}),i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99885 4.37593C5.66421 4.37604 2.80603 7.64523 1.79548 9.00983C1.35636 9.60279 1.35918 10.4 1.80012 10.9902C2.81706 12.3514 5.69374 15.6241 9.99886 15.6241C14.3806 15.6241 17.2194 12.3452 18.2168 10.9808C18.6473 10.392 18.6442 9.60472 18.211 9.01902C17.2056 7.65938 14.3429 4.37583 9.99885 4.37593ZM2.80002 9.75374C3.77049 8.44326 6.30207 5.62602 9.99888 5.62593C13.7041 5.62585 16.24 8.45598 17.206 9.76225C17.3146 9.9091 17.3149 10.0965 17.2077 10.2431C16.254 11.5477 13.7416 14.3741 9.99886 14.3741C6.33149 14.3741 3.78173 11.5541 2.80152 10.242C2.69021 10.0931 2.69001 9.90229 2.80002 9.75374Z",fill:"#F9F9F9"}),i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0763 3.26988C18.3415 3.58809 18.2985 4.06101 17.9803 4.32619L2.98032 16.8262C2.66211 17.0914 2.18919 17.0484 1.92402 16.7302C1.65884 16.412 1.70184 15.939 2.02004 15.6739L17.02 3.17385C17.3383 2.90868 17.8112 2.95167 18.0763 3.26988Z",fill:"#F9F9F9"})]})]}):i("div",{"data-toolbar-name":!0,children:M(o.customLabel||o.label)}),G&&"Section"!==o.tag&&F.length>0&&i("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":A,children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),G&&A&&F.map((t,o)=>e("div",{"data-toolbar-parent":!0,"data-component-tag":t.tag,"data-parent-uid":t.uid,"data-toolbar-theme-section":V,"data-toolbar-parent-revert":k,style:{top:k?`${36*(o+1)}px`:`${-36*(o+1)}px`},children:[i("div",{"data-toolbar-icon-drag":!0,children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[i("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),i("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),i("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),i("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),i("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),i("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),i("div",{"data-toolbar-name":!0,children:eV(t)})]},t.uid)),G&&!eb&&e(t,{children:[i(S,{...o}),eF&&i(C,{...o}),(()=>{let{isShopifySection:e,tag:t}=o;return!e&&(!Z||!!V)&&g.includes(t)&&!ei})()&&i(f,{...o}),"Sticky"==o.tag&&i("div",{"data-toolbar-zoom-out":!0,onClick:e=>eB(e),"aria-hidden":"true",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),eC.includes(o.tag)&&i(p,{"data-toolbar-title":!0,enable:!0,"data-toolbar-disable":!1,text:M("Edit content in Shopify"),position:"top",onClick:()=>{if(es.includes(o.tag)){window.open(ev,"_blank");return}if(ed.includes(o.tag)){window.open(ef,"_blank");return}window.open(eg,"_blank")},"aria-hidden":"true",children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",fill:"currentColor"}),i("path",{d:"M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",fill:"currentColor"}),i("path",{d:"M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",fill:"currentColor"}),i("path",{d:"M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",fill:"currentColor"})]})}),i(p,{enable:"Section"==o.tag&&eu()>=25||j,text:j?M("Disabled. Please edit in Shopify Editor"):M("Page has reached Shopify’s 25 section-limit"),position:"bottom",width:"200px","data-toolbar-duplicate":!0,"data-toolbar-disable":eM,onClick:eM?void 0:e=>eA(e),"aria-hidden":"true",className:eM?"!gp-cursor-not-allowed":"",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),i(p,{"data-toolbar-delete":!0,onClick:e=>ex?null:eT(e),enable:ex,"data-toolbar-disable":ex,text:j?M("Disabled. Please edit in Shopify Editor"):W.text,width:W.width,position:j?"bottom":U,"aria-hidden":"true",className:ex?"!gp-cursor-not-allowed":"",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),i(b,{uid:o.uid})]},o.uid),"STATIC"!==R&&"POST_PURCHASE"!==R&&25>eR()&&i(u,{...o}),i("div",{"data-outline":!0,"data-outline-section":"Section"==o.tag,"data-outline-theme-section":"Section"==o.tag&&!!Z||V,"data-outline-shopify-section":"Section"==o.tag&&!!j,"data-outline-limit":eE,"data-outline-error":!!ei},"outline-"+o.uid),"Section"==o.tag&&!V&&e(t,{children:[i(p,{enable:eu()>=25,text:M("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":eu()>=25,"data-toolbar-add-open":"above"==P,onClick:e=>e$(e,"above"),"aria-hidden":"true",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),i(p,{enable:eu()>=25,text:M("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":eu()>=25,"data-toolbar-add-open":"below"==P,onClick:e=>e$(e,"below"),"aria-hidden":"true",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),ei&&i(c,{errorSectionInfo:ei,onDismiss:eq}),g.includes(o.tag)&&G&&i(v,{...o}),G&&i(h,{...o})]})});export{M as default};
2
+ import{jsxs as e,Fragment as t,jsx as i}from"react/jsx-runtime";import{memo as o,useState as r,useMemo as l,useCallback as n,useEffect as a}from"react";import"zustand";import{useBuilderPreviewStore as d}from"../contexts/BuilderPreviewContext.js";import{usePageStore as C}from"../contexts/PageContext.js";import{CreateThemeSection as s}from"./theme-section/CreateThemeSection.js";import p from"./toolbar/Tooltip.js";import{SectionErrorBanner as c}from"./toolbar/SectionErrorBanner.js";import{ThemeSectionStatusWrapper as u}from"./theme-section/ThemeSectionStatus.js";import h from"./resize/Resize.js";import{usePostPurchase as g}from"../hooks/useToolbarPostPurchase.js";import{ableGenerateContentElements as m}from"./constant.js";import{AIContentGenerator as f}from"./ai-generator/AIContentGenerator.js";import{AIGenContentLoading as b}from"./ai-generator/AIGenContentLoading.js";import{InteractionSuffix as v}from"./InteractionSuffix.js";import{useI18nStore as w}from"@gem-sdk/core";import S from"./upgrade-element/UpgradeElement.js";import"swr";import"../graphql/queries/collection-detail-filter.generated.js";import"../graphql/queries/collection.generated.js";import"../graphql/queries/collections.generated.js";import"../graphql/queries/published-theme-pages.generated.js";import"../graphql/queries/store-property.generated.js";import"../graphql/queries/preview-page.generated.js";import"../graphql/queries/published-shop-metas.generated.js";import"../graphql/queries/shop-shopify.generated.js";import"../graphql/queries/articles.generated.js";import"../graphql/queries/blogs.generated.js";import"../graphql/queries/products-with-selling-plans.generated.js";import"../graphql/queries/product-variant-with-selling-plans.generated.js";import"../graphql/queries/product-variants.generated.js";import"../graphql/queries/product-little-detail.generated.js";import"../graphql/queries/product-medias.generated.js";import"../graphql/queries/productsV2.generated.js";import"../helpers/convert.js";import"crc-32";import{useShopStore as L}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"../graphql/queries/product-value-label.generated.js";import"../hooks/useStickyStore.js";import"../types/builder.js";import"../types/custom.js";import"../types/animations.js";let y=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},x=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t};var M=o(o=>{let{t:M}=w(),Z=o.isThemeSection,j=!!o.isShopifySection,q=L(e=>e.storefrontUrl),R=L(e=>e.pageType),H=d(e=>e.getParents),V=d(e=>e.getItem("ROOT")),P=d(e=>e.isThemeSectionEditor),[E,T]=r(null),[A,B]=r(!1),[k,$]=r(!1),[F,I]=r([]),[D,U]=r("top"),[O,N]=r(!1),[G,z]=r(!1),[_,J]=r(""),[K,Q]=r(""),[W,X]=r({width:"",text:""}),[Y,ee]=r(!1),et=d(e=>e.errorSectionList),ei=l(()=>{if(!et)return null;let e=et?.find(e=>e.uid===o.uid);return e},[et,o.uid]),eo=C(e=>e.interactionData),er=l(()=>"POST_PURCHASE"===R,[R]),{checkDisableDelete:el,getTooltipText:en,checkDisableDuplicate:ea}=g(o.uid,o.tag||""),ed=["ProductTitle","ProductDescription","ProductPrice"],eC=["ArticleTitle","ArticleContent","ArticleImage","ArticleAuthor","ArticleCategory","ArticleDate","ArticleExcerpt","ArticleTags"],es=[...ed,...eC],ep=(e,t)=>{let i=F.length,o=e.getBoundingClientRect(),r=t.getBoundingClientRect();return o.top-r.top<36*i},ec=(e,t)=>{let i=t||e;if(e&&!x(e))return y(e)&&ep(t,e)?e:e.parentElement?ec(e.parentElement,i):void 0},eu=n(()=>V?.childrens?.length||0,[V?.childrens?.length]),eh=n(()=>{if("Section"==o.tag)return"bottom";let e=document.body.querySelector("#storefront")?.querySelector('[data-toolbar-active="true"]');if(e){let t=e.getBoundingClientRect();t.top<60?U("bottom"):U("top")}},[o.tag]),eg=l(()=>q?q.match(/^(?:https?:\/\/)?([^/]+)\.myshopify\.com/)?.[1]:"",[q]),em=l(()=>`https://admin.shopify.com/store/${eg}`,[eg]),ef=l(()=>_?`${em}/products/${_}`:"",[em,_]),eb=l(()=>K?`${em}/articles/${K.replace("gid://shopify/Article/","")}`:"",[K,em]),ev=l(()=>eo?.isSelectOnPage,[eo?.isSelectOnPage]),ew=l(()=>eo?.settingType,[eo?.settingType]),eS=l(()=>eo?.item?.targets?.find(e=>e.uid===o.uid&&e?.type!=="PAGE")&&"TARGET"===ew,[eo?.item?.targets,o.uid,ew]),eL=l(()=>eo?.item?.self?.uid===o.uid&&eo?.item?.self.type!=="PAGE"&&"TRIGGER"===ew,[eo?.item?.self?.type,eo?.item?.self?.uid,o.uid,ew]),ey=l(()=>!eS&&!eL,[eS,eL]),ex=l(()=>O||j,[O,j]),eM=l(()=>Y||j||eu()>25&&"Section"===o.tag||!!ei,[eu,Y,j,o.tag,ei]),eZ=d(e=>e.activeComponentDetail),ej=n(e=>{if(e?.articleId&&Q(e.articleId),e?.productId&&J(e.productId),e?.componentUid==o.uid){z(!0),eh(),er&&(N(el()),X(en()),ee(ea()));let e=H(o.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&P||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);I(e)}else z(!1),I([]),B(!1)},[o.uid,er,H,el,en,ea,P,eh]),eq=d(e=>e.dismissPublishError),eR=n(()=>{eq(o.uid)},[eq,o.uid]),eH=n(()=>"Section"!==o.tag?-1:V?.childrens?.length?V.childrens.findIndex(e=>e==o.uid):-1,[V?.childrens,o.uid,o.tag]),eV=l(()=>eH()>=25,[eH]),eP=l(()=>!!ei||eV,[ei,eV]);if(a(()=>{ej(eZ)},[eZ]),"section"===o.type||o.editorConfigs?.toolbar?.hide)return null;let eE=e=>{let t=e?.childrens?.length??0;if("Row"===e.label){let e=1===t?M("Row {colNumber} col",{colNumber:t}):M("Row {colNumber} cols",{colNumber:t});return e}return M(e.label)},eT=e=>{if(!F.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(A)$(!1),B(!1);else{let e=ec(i,i);if(e)$(!0);else{let e=i.getBoundingClientRect();e.top<36*F.length?$(!0):$(!1)}B(!0)}let o=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!A}});window.dispatchEvent(o)},eA=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:o.uid,isThemeSection:Z,isShopifySection:j}});return window.dispatchEvent(t),!1},eB=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:o.uid,isThemeSection:Z,isShopifySection:j}});return window.dispatchEvent(t),!1},ek=e=>{e.preventDefault(),e.stopPropagation();let t=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:o.uid}});return window.dispatchEvent(t),!1},e$=()=>{T(null),window.removeEventListener("editor:close-add-section-popup",e$)},eF=(e,t)=>{if(e.preventDefault(),e.stopPropagation(),eu()>=25)return!1;let i=e.target;if(i){T(t);let e=i.getBoundingClientRect(),r=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:o.uid,position:t,top:e.top+e.height/2}});window.dispatchEvent(r),window.addEventListener("editor:close-add-section-popup",e$)}return!1},eI="Section"===o.tag&&!o.isThemeSection&&"STATIC"!==R&&"POST_PURCHASE"!==R&&!o.isShopifySection&&25>eH()&&!ei;return e(t,{children:[!("Section"==o.tag&&P)&&e("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==o.tag,"data-toolbar-theme-section":"Section"==o.tag&&!!Z||P,"data-toolbar-shopify-section":"Section"==o.tag&&!!j,"data-toolbar-limit":eH()>=25||!!ei,children:[e("div",{"data-toolbar-show-parent":!0,onClick:e=>eT(e),"aria-hidden":"true",children:[eL&&i("div",{className:"gp-hidden gp-w-[12px] interaction-use-custom-element",children:i("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.36799 0.430523C4.51596 0.205675 4.76709 0.0703125 5.03626 0.0703125H9.88576C10.2042 0.0703125 10.395 0.424378 10.2198 0.69034L8.36968 3.4992C8.28209 3.63218 8.37747 3.80922 8.53671 3.80922H10.749C11.1111 3.80922 11.2869 4.25204 11.0233 4.50036L3.03971 12.0217C2.7572 12.2878 2.29932 12.0361 2.37262 11.655L3.27994 6.93698C3.30366 6.81364 3.20915 6.69921 3.08354 6.69921H0.984651C0.66625 6.69921 0.475479 6.34529 0.650515 6.07932L4.36799 0.430523Z",fill:"#F9F9F9"})})}),eS&&i("div",{className:"gp-hidden gp-w-[14px] interaction-use-custom-element",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.32785 3.66159C7.87459 3.58351 8.25451 3.077 8.17643 2.53026C8.09836 1.98353 7.59184 1.6036 7.0451 1.68168C3.92866 2.12673 1.5332 4.80488 1.5332 8.04424C1.5332 11.594 4.41085 14.4716 7.9606 14.4716C11.1706 14.4716 13.8294 12.1194 14.3105 9.04446C14.3959 8.49881 14.0227 7.98727 13.4771 7.9019C12.9314 7.81654 12.4199 8.18967 12.3345 8.73531C12.0034 10.852 10.1702 12.4716 7.9606 12.4716C5.51541 12.4716 3.5332 10.4894 3.5332 8.04424C3.5332 5.81431 5.18273 3.96793 7.32785 3.66159ZM10.3432 1.97548C10.6232 1.69551 11.102 1.83654 11.1855 2.22355L11.6106 4.19339C11.6313 4.28936 11.7063 4.36432 11.8023 4.38503L13.7721 4.81013C14.1591 4.89365 14.3001 5.37247 14.0202 5.65243L12.3432 7.32945C12.1244 7.54819 11.8168 7.65338 11.5099 7.61436L10.1528 7.44178C9.84592 7.40276 9.53827 7.50795 9.31953 7.72669L8.66719 8.37903C8.35477 8.69145 7.86633 8.70954 7.57623 8.41943C7.28613 8.12933 7.30421 7.64089 7.61663 7.32847L8.26898 6.67613C8.48771 6.45739 8.5929 6.14974 8.55388 5.84287L8.38131 4.48575C8.34228 4.17888 8.44748 3.87123 8.66621 3.6525L10.3432 1.97548ZM8.19853 5.1916C8.35319 5.72179 8.04877 6.27697 7.51858 6.43163C6.83078 6.63226 6.32988 7.2683 6.32988 8.01873C6.32988 8.9316 7.06991 9.67164 7.98279 9.67164C8.73014 9.67164 9.36406 9.17486 9.56743 8.49131C9.72492 7.96195 10.2817 7.6605 10.8111 7.81799C11.3404 7.97548 11.6419 8.53227 11.4844 9.06163C11.0356 10.57 9.63916 11.6716 7.98279 11.6716C5.96535 11.6716 4.32988 10.0362 4.32988 8.01873C4.32988 6.35558 5.44054 4.95445 6.95851 4.51165C7.4887 4.35699 8.04387 4.66141 8.19853 5.1916Z",fill:"#F9F9F9"})})}),G&&ey&&i("div",{"data-toolbar-icon-drag":!0,children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[i("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),i("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),i("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),i("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),i("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),i("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==o.tag?e("div",{"data-toolbar-name":!0,children:[(()=>{if(j)return o.name?.includes("Shopify section:")?`${M("Shopify section")}: ${o.name.replace("Shopify section:","")}`:`${M("Shopify section")}: ${o.name}`;let e=o.name&&o.name===`Section ${o.uid}`;return eu()>=20?`${e?M("Section"):o?.name} ${eH()+1}/25`:e?`${M("Section")} ${eH()+1}`:o?.name})(),G&&j&&!o.isShopifyVisibility&&e("svg",{"data-toolbar-visibility":!0,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.1252 9.99773C13.1243 8.27226 11.7248 6.87423 9.99935 6.87506C8.27386 6.87561 6.87518 8.27455 6.87518 10.0001C6.87518 11.7259 8.27429 13.1251 10.0002 13.1251C11.7257 13.1251 13.125 11.727 13.1252 10.0011V9.99773ZM9.99985 8.12506C11.035 8.12451 11.8746 8.96322 11.8752 9.99839V10.0004C11.8752 11.0357 11.0359 11.8751 10.0002 11.8751C8.96465 11.8751 8.12518 11.0356 8.12518 10.0001C8.12518 8.96472 8.96451 8.12533 9.99985 8.12506Z",fill:"#F9F9F9"}),i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99885 4.37593C5.66421 4.37604 2.80603 7.64523 1.79548 9.00983C1.35636 9.60279 1.35918 10.4 1.80012 10.9902C2.81706 12.3514 5.69374 15.6241 9.99886 15.6241C14.3806 15.6241 17.2194 12.3452 18.2168 10.9808C18.6473 10.392 18.6442 9.60472 18.211 9.01902C17.2056 7.65938 14.3429 4.37583 9.99885 4.37593ZM2.80002 9.75374C3.77049 8.44326 6.30207 5.62602 9.99888 5.62593C13.7041 5.62585 16.24 8.45598 17.206 9.76225C17.3146 9.9091 17.3149 10.0965 17.2077 10.2431C16.254 11.5477 13.7416 14.3741 9.99886 14.3741C6.33149 14.3741 3.78173 11.5541 2.80152 10.242C2.69021 10.0931 2.69001 9.90229 2.80002 9.75374Z",fill:"#F9F9F9"}),i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0763 3.26988C18.3415 3.58809 18.2985 4.06101 17.9803 4.32619L2.98032 16.8262C2.66211 17.0914 2.18919 17.0484 1.92402 16.7302C1.65884 16.412 1.70184 15.939 2.02004 15.6739L17.02 3.17385C17.3383 2.90868 17.8112 2.95167 18.0763 3.26988Z",fill:"#F9F9F9"})]})]}):i("div",{"data-toolbar-name":!0,children:M(o.customLabel||o.label)}),G&&"Section"!==o.tag&&F.length>0&&i("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":A,children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),G&&A&&F.map((t,o)=>e("div",{"data-toolbar-parent":!0,"data-component-tag":t.tag,"data-parent-uid":t.uid,"data-toolbar-theme-section":P,"data-toolbar-parent-revert":k,style:{top:k?`${36*(o+1)}px`:`${-36*(o+1)}px`},children:[i("div",{"data-toolbar-icon-drag":!0,children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[i("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),i("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),i("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),i("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),i("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),i("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),i("div",{"data-toolbar-name":!0,children:eE(t)})]},t.uid)),G&&!ev&&e(t,{children:[i(S,{...o}),eI&&i(s,{...o}),(()=>{let{isShopifySection:e,tag:t}=o;return!e&&(!Z||!!P)&&m.includes(t)&&!ei})()&&i(f,{...o}),"Sticky"==o.tag&&i("div",{"data-toolbar-zoom-out":!0,onClick:e=>ek(e),"aria-hidden":"true",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),es.includes(o.tag)&&i(p,{"data-toolbar-title":!0,enable:!0,"data-toolbar-disable":!1,text:M("Edit content in Shopify"),position:"top",onClick:()=>{if(eC.includes(o.tag)){window.open(eb,"_blank");return}if(ed.includes(o.tag)){window.open(ef,"_blank");return}window.open(em,"_blank")},"aria-hidden":"true",children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",fill:"currentColor"}),i("path",{d:"M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",fill:"currentColor"}),i("path",{d:"M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",fill:"currentColor"}),i("path",{d:"M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",fill:"currentColor"})]})}),i(p,{enable:"Section"==o.tag&&eu()>=25||j,text:j?M("Disabled. Please edit in Shopify Editor"):M("Page has reached Shopify’s 25 section-limit"),position:"bottom",width:"200px","data-toolbar-duplicate":!0,"data-toolbar-disable":eM,onClick:eM?void 0:e=>eB(e),"aria-hidden":"true",className:eM?"!gp-cursor-not-allowed":"",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),i(p,{"data-toolbar-delete":!0,onClick:e=>ex?null:eA(e),enable:ex,"data-toolbar-disable":ex,text:j?M("Disabled. Please edit in Shopify Editor"):W.text,width:W.width,position:j?"bottom":D,"aria-hidden":"true",className:ex?"!gp-cursor-not-allowed":"",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),i(v,{uid:o.uid})]},o.uid),"STATIC"!==R&&"POST_PURCHASE"!==R&&25>eH()&&i(u,{...o}),i("div",{"data-outline":!0,"data-outline-section":"Section"==o.tag,"data-outline-theme-section":"Section"==o.tag&&!!Z||P,"data-outline-shopify-section":"Section"==o.tag&&!!j,"data-outline-limit":eP,"data-outline-error":!!ei},"outline-"+o.uid),"Section"==o.tag&&!P&&e(t,{children:[i(p,{enable:eu()>=25,text:M("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":eu()>=25,"data-toolbar-add-open":"above"==E,onClick:e=>eF(e,"above"),"aria-hidden":"true",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),i(p,{enable:eu()>=25,text:M("Page has reached Shopify’s 25 section-limit"),position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":eu()>=25,"data-toolbar-add-open":"below"==E,onClick:e=>eF(e,"below"),"aria-hidden":"true",children:i("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),ei&&i(c,{errorSectionInfo:ei,onDismiss:eR}),m.includes(o.tag)&&G&&i(b,{...o}),G&&i(h,{...o})]})});export{M as default};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useMemo as r,useCallback as t}from"react";import"zustand";import{usePageStore as i}from"../../contexts/PageContext.js";import"react-transition-group";import"../constant.js";import"swr";import"swr/infinite";import"../../graphql/queries/productsV2.generated.js";import"../../graphql/queries/product-little-detail.generated.js";import"../../graphql/queries/product-medias.generated.js";import"../../graphql/queries/product-variants.generated.js";import"classnames";import"dayjs";import"@gem-sdk/core";import s from"./UpgradeButton.js";import"../../graphql/queries/collection-detail-filter.generated.js";import"../../graphql/queries/collection.generated.js";import"../../graphql/queries/collections.generated.js";import"../../graphql/queries/published-theme-pages.generated.js";import"../../graphql/queries/store-property.generated.js";import"../../graphql/queries/preview-page.generated.js";import"../../graphql/queries/published-shop-metas.generated.js";import"../../graphql/queries/shop-shopify.generated.js";import"../../graphql/queries/articles.generated.js";import"../../graphql/queries/blogs.generated.js";import"../../graphql/queries/products-with-selling-plans.generated.js";import"../../graphql/queries/product-variant-with-selling-plans.generated.js";import"../../helpers/convert.js";import"crc-32";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"../../graphql/queries/product-value-label.generated.js";import"../../hooks/useStickyStore.js";import"../../types/builder.js";import"../../types/custom.js";import"../../types/animations.js";let o=({tag:o,uid:p})=>{let a=i(e=>e.oldElements),l=i(e=>e.updatedElements),m=i(e=>e.updatingElements),n=r(()=>!!p&&(a?.some(e=>e.uid===p)??!1),[a,p]),d=r(()=>l?.some(e=>e.uid===p),[l,p]),g=r(()=>m?.some(e=>e.uid===p),[m,p]),u=t(e=>{d||(e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("editor:toolbar:upgrade-old-element",{bubbles:!0,detail:{componentUid:p,fromTag:o}})))},[d,o,p]);return o&&p&&(n||d)?e(s,{isLoading:g,isUpdated:d,onUpgrade:u}):null};export{o as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as r,useCallback as t}from"react";import"zustand";import{usePageStore as o}from"../../contexts/PageContext.js";import"react-transition-group";import"../constant.js";import"swr";import"swr/infinite";import"../../graphql/queries/productsV2.generated.js";import"../../graphql/queries/product-little-detail.generated.js";import"../../graphql/queries/product-medias.generated.js";import"../../graphql/queries/product-variants.generated.js";import{usePageType as s}from"../../hooks/shop.js";import"classnames";import"dayjs";import"@gem-sdk/core";import i from"./UpgradeButton.js";import"../../graphql/queries/collection-detail-filter.generated.js";import"../../graphql/queries/collection.generated.js";import"../../graphql/queries/collections.generated.js";import"../../graphql/queries/published-theme-pages.generated.js";import"../../graphql/queries/store-property.generated.js";import"../../graphql/queries/preview-page.generated.js";import"../../graphql/queries/published-shop-metas.generated.js";import"../../graphql/queries/shop-shopify.generated.js";import"../../graphql/queries/articles.generated.js";import"../../graphql/queries/blogs.generated.js";import"../../graphql/queries/products-with-selling-plans.generated.js";import"../../graphql/queries/product-variant-with-selling-plans.generated.js";import"../../helpers/convert.js";import"crc-32";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"../../graphql/queries/product-value-label.generated.js";import"../../hooks/useStickyStore.js";import"../../types/builder.js";import"../../types/custom.js";import"../../types/animations.js";let p=["THEME_SECTION"],a=({tag:a,uid:m})=>{let l=o(e=>e.oldElements),n=o(e=>e.updatedElements),d=o(e=>e.updatingElements),g=s(),u=r(()=>!p.some(e=>e.includes(g)),[g]),q=r(()=>!!m&&(l?.some(e=>e.uid===m)??!1),[l,m]),h=r(()=>n?.some(e=>e.uid===m),[n,m]),c=r(()=>d?.some(e=>e.uid===m),[d,m]),j=t(e=>{h||(e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("editor:toolbar:upgrade-old-element",{bubbles:!0,detail:{componentUid:m,fromTag:a}})))},[h,a,m]);return a&&m&&u&&(q||h)?e(i,{isLoading:c,isUpdated:h,onUpgrade:j}):null};export{a as default};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e}from"react/jsx-runtime";import{useContext as t,createContext as i,useMemo as s,Suspense as r,Fragment as d}from"react";import{useStore as n,createStore as l}from"zustand";import{cloneDeep as a}from"../helpers/clone-deep.js";import{normalizeBuilderData as c}from"../helpers/normalize-builder-data.js";import{UPDATABLE_ITEM_ATTRS as o}from"./types/builderPreviewContext.js";function u(e,t,i){let s=e.splice(t,1)[0];void 0!==s&&e.splice(i,0,s)}let f=i(null),h={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},p=(e,t,i)=>l((s,r)=>({state:e,loaded:!1,isThemeSectionEditor:!!i,pageName:t,dynamicProduct:null,dynamicCollection:null,errorSectionList:null,addItem:e=>{let{position:t,data:i}=e,d=r().state,n=Date.now();if("section"===e.type){if(!Array.isArray(i)){let e=i.uid,r=d.ROOT;r.childrens?r.childrens.splice(t??0,0,e):r.childrens=[e],r.dateModified=n,s({state:{...d,[e]:{uid:e,type:"section",label:i.label},ROOT:a(r)}})}}else{let{id:i,data:r}=e,l=i?d[i]??d.ROOT:d.ROOT;if("section"===l.type)return;if(Array.isArray(r)){let e=r.map(e=>e.uid),i=r.reduceRight((e,t)=>{let i=c(t);return{...e,...i}},{});l.dateModified=n,l.childrens=l.childrens??[],l.childrens.splice(t??0,0,...e),s({state:{...d,...i,[l.uid]:a(l)}})}else{let e=c(r);l.dateModified=n,l.childrens=l.childrens??[],l.childrens.splice(t??0,0,r.uid),s({state:{...d,...e,[l.uid]:a(l)}})}}},changeItemProp:(e,t,i)=>{if(!i||!["setting","style","advanced"].includes(i))return;let d=r().state,n=d[e];if(n?.type!=="section"&&n){let r=Date.now();switch(n.dateModified=r,i){case"setting":s({state:{...d,[e]:{...n,settings:{...n.settings,...t}}}});break;case"style":s({state:{...d,[e]:{...n,styles:{...n.styles,...t}}}});break;case"advanced":s({state:{...d,[e]:{...n,advanced:{...n.advanced,...t}}}})}}},forceChangeItemProp:(e,t,i)=>{if(!i||!["setting","style","advanced"].includes(i))return;let d=r().state,n=d[e];if(n?.type!=="section"&&n){let r=Date.now();switch(n.dateModified=r,i){case"setting":s({state:{...d,[e]:{...n,settings:t}}});break;case"style":s({state:{...d,[e]:{...n,styles:t}}});break;case"advanced":s({state:{...d,[e]:{...n,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:i,group:d})=>{if(!d||!["setting","style","advanced"].includes(d))return;let n=r().state,l=n[e];if(l?.type!=="section"&&l){let r={style:l.styles??{},advanced:l.advanced??{},setting:l.settings??{}};void 0===i?(console.warn("Data is undefined"),delete r[d][t]):r[d][t]=i,s({state:{...n,[e]:{...l,settings:{...r.setting},styles:{...r.style},advanced:{...r.advanced}}}})}},getItem:e=>r().state[e],getState:()=>r().state,removeItem:e=>{if("ROOT"===e)s({state:{ROOT:h}});else{let t=r().state;!function e(t,i){let s=i[t];s&&(delete i[t],"section"!==s.type&&s.childrens?.map(t=>e(t,i)))}(e,t);let i=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(i){let r=Date.now(),[d,n]=i;if("section"===n.type)return;n.childrens=n.childrens?.filter(t=>t!==e),n.dateModified=r,s({state:{...t,[d]:a(n)}})}}},moveItem:(e,t,i)=>{let d=r().state,n=d[e],l=d[t];if(n&&l&&"section"!==l.type){if("section"===n.type){let t=d.ROOT;if(!t.childrens)return;let r=t.childrens.findIndex(t=>t===e);u(t.childrens,r,i??0),s({state:{...d,ROOT:a(t)}})}else{let r=Object.entries(d).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(n&&r){let c=Date.now(),[,o]=r;if("section"===o.type)return;if(o.dateModified=c,t===o.uid&&o.childrens){let t=o.childrens.findIndex(t=>t===e);o.childrens&&t!==i&&(u(o.childrens,t,i??0),s({state:{...d,[o.uid]:a(o)}}))}else o.childrens=o.childrens?.filter(t=>t!==e),l&&(l.dateModified=c,l.childrens=l.childrens??[],l.childrens.splice(i??0,0,n.uid),s({state:{...d,[l.uid]:a(l),[o.uid]:a(o)}}))}}}},forceChangeState:e=>{s({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),i=e.reduceRight((e,t)=>{let i=c(t);return{...e,...i}},{});s({loaded:!0,state:{ROOT:{...h,childrens:t},...i}})}else{let t=c(e);s({loaded:!0,state:{ROOT:{...h,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let i=r().state,d=i.ROOT;d.childrens||(d.childrens=[]),d.childrens.splice(t??0,0,e.uid),s({state:{...i,ROOT:a(d)}})},getParents:(e,t)=>{let i=r().state,s=[],d=0,n=e;for(;!t||!(d>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(n));if(!e)break;let[,t]=e;if(!t)break;s.push(t),n=t.uid,d++}return s},updateItemName:(e,t)=>{let i=r().state,d=i[e];d&&(d.name=t,s({state:{...i,[e]:a(d)}}))},updateItemAttribute:(e,t,i)=>{if(!i||!o.includes(i))return;let d=r().state,n=d[e];if(n){if("section"!==n.type){let e=Date.now();n.dateModified=e}let r={...n,[i]:t};s({state:{...d,[e]:r}})}},updateAllItemAttribute:(e,t)=>{if("tag"!==e)return;let i=r().state,d={};for(let{uid:s,value:r}of t){let t=i[s];if(!t)continue;let n={...t,..."section"!==t.type&&{dateModified:Date.now()},[e]:r};d[s]=n}Object.keys(d).length>0&&s({state:{...i,...d}})},dismissPublishError:e=>{let t=r().errorSectionList;if(!Array.isArray(t))return;let i=t.map(t=>t.uid===e?{...t,isDismissed:!0}:t);s({errorSectionList:i})},setErrorSectionList:e=>s({errorSectionList:e})})),y=({children:t,state:i,isThemeSectionEditor:n,pageName:l,lazy:a,...c})=>{let o=a?r:d,u=s(()=>p(i,l,n),[i,n,l]);return e(o,{children:e(f.Provider,{...c,value:u,children:t})})},m=(e,i)=>{let s=t(f);if(!s)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return n(s,e,i)};export{y as BuilderPreviewProvider,m as useBuilderPreviewStore};
2
+ import{jsx as e}from"react/jsx-runtime";import{useContext as t,createContext as i,useMemo as s,useEffect as r,Suspense as n,Fragment as d}from"react";import{useStore as l,createStore as a}from"zustand";import{cloneDeep as c}from"../helpers/clone-deep.js";import{normalizeBuilderData as o}from"../helpers/normalize-builder-data.js";import{UPDATABLE_ITEM_ATTRS as u}from"./types/builderPreviewContext.js";function f(e,t,i){let s=e.splice(t,1)[0];void 0!==s&&e.splice(i,0,s)}let p=i(null),h={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},m=(e,t,i)=>a((s,r)=>({state:e,loaded:!1,isThemeSectionEditor:!!i,pageName:t,dynamicProduct:null,dynamicCollection:null,errorSectionList:null,activeComponentDetail:null,addItem:e=>{let{position:t,data:i}=e,n=r().state,d=Date.now();if("section"===e.type){if(!Array.isArray(i)){let e=i.uid,r=n.ROOT;r.childrens?r.childrens.splice(t??0,0,e):r.childrens=[e],r.dateModified=d,s({state:{...n,[e]:{uid:e,type:"section",label:i.label},ROOT:c(r)}})}}else{let{id:i,data:r}=e,l=i?n[i]??n.ROOT:n.ROOT;if("section"===l.type)return;if(Array.isArray(r)){let e=r.map(e=>e.uid),i=r.reduceRight((e,t)=>{let i=o(t);return{...e,...i}},{});l.dateModified=d,l.childrens=l.childrens??[],l.childrens.splice(t??0,0,...e),s({state:{...n,...i,[l.uid]:c(l)}})}else{let e=o(r);l.dateModified=d,l.childrens=l.childrens??[],l.childrens.splice(t??0,0,r.uid),s({state:{...n,...e,[l.uid]:c(l)}})}}},changeItemProp:(e,t,i)=>{if(!i||!["setting","style","advanced"].includes(i))return;let n=r().state,d=n[e];if(d?.type!=="section"&&d){let r=Date.now();switch(d.dateModified=r,i){case"setting":s({state:{...n,[e]:{...d,settings:{...d.settings,...t}}}});break;case"style":s({state:{...n,[e]:{...d,styles:{...d.styles,...t}}}});break;case"advanced":s({state:{...n,[e]:{...d,advanced:{...d.advanced,...t}}}})}}},forceChangeItemProp:(e,t,i)=>{if(!i||!["setting","style","advanced"].includes(i))return;let n=r().state,d=n[e];if(d?.type!=="section"&&d){let r=Date.now();switch(d.dateModified=r,i){case"setting":s({state:{...n,[e]:{...d,settings:t}}});break;case"style":s({state:{...n,[e]:{...d,styles:t}}});break;case"advanced":s({state:{...n,[e]:{...d,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:i,group:n})=>{if(!n||!["setting","style","advanced"].includes(n))return;let d=r().state,l=d[e];if(l?.type!=="section"&&l){let r={style:l.styles??{},advanced:l.advanced??{},setting:l.settings??{}};void 0===i?(console.warn("Data is undefined"),delete r[n][t]):r[n][t]=i,s({state:{...d,[e]:{...l,settings:{...r.setting},styles:{...r.style},advanced:{...r.advanced}}}})}},getItem:e=>r().state[e],getState:()=>r().state,removeItem:e=>{if("ROOT"===e)s({state:{ROOT:h}});else{let t=r().state;!function e(t,i){let s=i[t];s&&(delete i[t],"section"!==s.type&&s.childrens?.map(t=>e(t,i)))}(e,t);let i=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(i){let r=Date.now(),[n,d]=i;if("section"===d.type)return;d.childrens=d.childrens?.filter(t=>t!==e),d.dateModified=r,s({state:{...t,[n]:c(d)}})}}},moveItem:(e,t,i)=>{let n=r().state,d=n[e],l=n[t];if(d&&l&&"section"!==l.type){if("section"===d.type){let t=n.ROOT;if(!t.childrens)return;let r=t.childrens.findIndex(t=>t===e);f(t.childrens,r,i??0),s({state:{...n,ROOT:c(t)}})}else{let r=Object.entries(n).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(d&&r){let a=Date.now(),[,o]=r;if("section"===o.type)return;if(o.dateModified=a,t===o.uid&&o.childrens){let t=o.childrens.findIndex(t=>t===e);o.childrens&&t!==i&&(f(o.childrens,t,i??0),s({state:{...n,[o.uid]:c(o)}}))}else o.childrens=o.childrens?.filter(t=>t!==e),l&&(l.dateModified=a,l.childrens=l.childrens??[],l.childrens.splice(i??0,0,d.uid),s({state:{...n,[l.uid]:c(l),[o.uid]:c(o)}}))}}}},forceChangeState:e=>{s({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),i=e.reduceRight((e,t)=>{let i=o(t);return{...e,...i}},{});s({loaded:!0,state:{ROOT:{...h,childrens:t},...i}})}else{let t=o(e);s({loaded:!0,state:{ROOT:{...h,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let i=r().state,n=i.ROOT;n.childrens||(n.childrens=[]),n.childrens.splice(t??0,0,e.uid),s({state:{...i,ROOT:c(n)}})},getParents:(e,t)=>{let i=r().state,s=[],n=0,d=e;for(;!t||!(n>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(d));if(!e)break;let[,t]=e;if(!t)break;s.push(t),d=t.uid,n++}return s},updateItemName:(e,t)=>{let i=r().state,n=i[e];n&&(n.name=t,s({state:{...i,[e]:c(n)}}))},updateItemAttribute:(e,t,i)=>{if(!i||!u.includes(i))return;let n=r().state,d=n[e];if(d){if("section"!==d.type){let e=Date.now();d.dateModified=e}let r={...d,[i]:t};s({state:{...n,[e]:r}})}},updateAllItemAttribute:(e,t)=>{if("tag"!==e)return;let i=r().state,n={};for(let{uid:s,value:r}of t){let t=i[s];if(!t)continue;let d={...t,..."section"!==t.type&&{dateModified:Date.now()},[e]:r};n[s]=d}Object.keys(n).length>0&&s({state:{...i,...n}})},dismissPublishError:e=>{let t=r().errorSectionList;if(!Array.isArray(t))return;let i=t.map(t=>t.uid===e?{...t,isDismissed:!0}:t);s({errorSectionList:i})},setErrorSectionList:e=>s({errorSectionList:e}),setActiveComponentDetail:e=>s({activeComponentDetail:e})})),y=({children:t,state:i,isThemeSectionEditor:l,pageName:a,lazy:c,...o})=>{let u=c?n:d,f=s(()=>m(i,a,l),[i,l,a]);return r(()=>{let e=e=>{let t=e.detail??null;f.getState().setActiveComponentDetail(t)};return window.addEventListener("editor:active-component",e),()=>{window.removeEventListener("editor:active-component",e)}},[f]),e(u,{children:e(p.Provider,{...o,value:f,children:t})})},v=(e,i)=>{let s=t(p);if(!s)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return l(s,e,i)};export{y as BuilderPreviewProvider,v as useBuilderPreviewStore};
@@ -1 +1 @@
1
- import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";import{isSafeValue as t}from"./builder.js";let l=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),o=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),b=e=>l(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),i=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},a=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},r=(e,l,o)=>{let b=o&&t(l?.desktop)?`${l?.desktop}${o}`:l?.desktop,i=o&&t(l?.tablet)?`${l?.tablet}${o}`:l?.tablet,a=o&&t(l?.mobile)?`${l?.mobile}${o}`:l?.mobile,r={};return b&&(r[`--${e}`]=b),i&&i!==b&&(r[`--${e}-tablet`]=i),a&&a!==i&&(r[`--${e}-mobile`]=a),r},s=(t,l,o)=>({[`--${t}`]:o?`${e(l,"desktop")}${o}`:e(l,"desktop"),[`--${t}-tablet`]:o?`${e(l,"tablet")}${o}`:e(l,"tablet"),[`--${t}-mobile`]:o?`${e(l,"mobile")}${o}`:e(l,"mobile")}),m=(l,o)=>{let b=(t,l,o)=>{let b=e(l,t),i=o?.[t]===void 0?o?.desktop:o?.[t];return i?"100%":!1===i?b??b:b||"auto"},i=b("desktop",l,o),a=b("tablet",l,o),r=b("mobile",l,o),s={};return t(i)&&(s.desktop=i),t(a)&&a!==i&&(s.tablet=a),t(r)&&r!==a&&(s.mobile=r),s},$=e=>{let l=e?.desktop?.width,o=e?.tablet?.width,b=e?.mobile?.width,i={};return t(l)&&(i["--w"]=l),t(o)&&o!==l&&(i["--w-tablet"]=o),t(b)&&b!==o&&(i["--w-mobile"]=b),i},u=e=>{let l=e?.desktop?.height,o=e?.tablet?.height,b=e?.mobile?.height,i={};return t(l)&&(i["--h"]=l),t(o)&&o!==l&&(i["--h-tablet"]=o),t(b)&&b!==o&&(i["--h-mobile"]=b),i},n=(e,l)=>{let o=(e,t,l)=>{let o=t?.[e],b=l?.[e];return b?"auto":!1===b?o??o:o},b=o("desktop",e,l),i=o("tablet",e,l),a=o("mobile",e,l),r={};return t(b)&&(r.desktop=b),t(i)&&i!==b&&(r.tablet=i),t(a)&&a!==i&&(r.mobile=a),r},d=(t,l,o)=>{let b={};return["desktop","mobile","tablet"].forEach(i=>{let a=e(t,i);"none"!==a&&(b={...b,[i]:"custom"!==a?a:`${e(l,"desktop")}/${e(o,"desktop")}`})}),b},p=(l,o)=>{let b=(t,l,o)=>{let b=e(l,t),i=e(o,t);return 0===b?"0":i||void 0===i?b:"unset"},i=b("desktop",l,o),a=b("tablet",l,o),r=b("mobile",l,o),s={};return t(i)&&(s.desktop=i),t(a)&&a!==i&&(s.tablet=a),t(r)&&r!==a&&(s.mobile=r),s},k=(e,t,l)=>l?`${t?.[e]}${l}`:t?.[e]==="default"?"1200px":t?.[e],h=(e,l)=>{let o=k("desktop",e,l),b=k("tablet",e,l),i=k("mobile",e,l),a={};return t(o)&&(a["--w"]=o),t(b)&&b!==o&&(a["--w-tablet"]=b),t(i)&&i!==b&&(a["--w-mobile"]=i),a},v=(e,t,l)=>{if(l)return`${t?.[e]}${l}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}},c=(e,l)=>{let o=v("desktop",e,l),b=v("tablet",e,l),i=v("mobile",e,l),a={};return t(o)&&(a["--w"]=o),t(b)&&b!==o&&(a["--w-tablet"]=b),t(i)&&i!==b&&(a["--w-mobile"]=i),a};export{d as makeAspectRatio,u as makeGlobalSizeHeightResponsive,$ as makeGlobalSizeWidthResponsive,n as makeHeight,p as makeLineClamp,b as makeStyle,o as makeStyleKey,r as makeStyleResponsive,s as makeStyleResponsiveByScreen,a as makeStyleResponsiveState,h as makeStyleResponsiveWidth,c as makeStyleResponsiveWidthWithoutAuto,i as makeStyleState,m as makeWidth,l as removeNullUndefined};
1
+ import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";let t=e=>Object.entries(e).reduce((e,[t,o])=>null==o?e:{...e,[t]:o},{}),o=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),l=e=>t(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),a=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},b=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},i=(e,t,o)=>({[`--${e}`]:o?`${t?.desktop}${o}`:t?.desktop,[`--${e}-tablet`]:o?`${t?.tablet}${o}`:t?.tablet,[`--${e}-mobile`]:o?`${t?.mobile}${o}`:t?.mobile}),s=(t,o,l)=>({[`--${t}`]:l?`${e(o,"desktop")}${l}`:e(o,"desktop"),[`--${t}-tablet`]:l?`${e(o,"tablet")}${l}`:e(o,"tablet"),[`--${t}-mobile`]:l?`${e(o,"mobile")}${l}`:e(o,"mobile")}),m=(t,o)=>{let l=(t,o,l)=>{let a=e(o,t),b=l?.[t]===void 0?l?.desktop:l?.[t];return b?"100%":!1===b?a??a:a||"auto"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},r=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),$=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),d=(e,t)=>{let o=(e,t,o)=>{let l=t?.[e],a=o?.[e];return a?"auto":!1===a?l??l:l};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},p=(t,o,l)=>{let a={};return["desktop","mobile","tablet"].forEach(b=>{let i=e(t,b);"none"!==i&&(a={...a,[b]:"custom"!==i?i:`${e(o,"desktop")}/${e(l,"desktop")}`})}),a},u=(t,o)=>{let l=(t,o,l)=>{let a=e(o,t),b=e(l,t);return 0===a?"0":b||void 0===b?a:"unset"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},k=(e,t,o)=>o?`${t?.[e]}${o}`:t?.[e]==="default"?"1200px":t?.[e],n=(e,t)=>({"--w":k("desktop",e,t),"--w-tablet":k("tablet",e,t),"--w-mobile":k("mobile",e,t)}),h=(e,t,o)=>{if(o)return`${t?.[e]}${o}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}},v=(e,t)=>({"--w":h("desktop",e,t),"--w-tablet":h("tablet",e,t),"--w-mobile":h("mobile",e,t)});export{p as makeAspectRatio,$ as makeGlobalSizeHeightResponsive,r as makeGlobalSizeWidthResponsive,d as makeHeight,u as makeLineClamp,l as makeStyle,o as makeStyleKey,i as makeStyleResponsive,s as makeStyleResponsiveByScreen,b as makeStyleResponsiveState,n as makeStyleResponsiveWidth,v as makeStyleResponsiveWidthWithoutAuto,a as makeStyleState,m as makeWidth,t as removeNullUndefined};
@@ -42763,9 +42763,15 @@ type PublishErrorSectionListEventDetail = {
42763
42763
  uid: string;
42764
42764
  type: ErrorSectionType;
42765
42765
  }[] | null;
42766
+ type ActiveComponentDetail = {
42767
+ componentUid?: string;
42768
+ productId?: string;
42769
+ articleId?: string;
42770
+ } | null;
42766
42771
  type BuilderPreviewContextProps = {
42767
42772
  state: BuilderState;
42768
42773
  errorSectionList: ErrorSectionInfo[] | null;
42774
+ activeComponentDetail: ActiveComponentDetail;
42769
42775
  loaded?: boolean;
42770
42776
  pageName?: string;
42771
42777
  isThemeSectionEditor?: boolean;
@@ -42799,6 +42805,7 @@ type BuilderPreviewContextProps = {
42799
42805
  }[]) => void;
42800
42806
  dismissPublishError: (uid: string) => void;
42801
42807
  setErrorSectionList: (list: PublishErrorSectionListEventDetail) => void;
42808
+ setActiveComponentDetail: (detail: ActiveComponentDetail) => void;
42802
42809
  };
42803
42810
  type BuilderPreviewProviderProps = Pick<BuilderPreviewContextProps, 'state'> & {
42804
42811
  children: React.ReactNode;
@@ -44054,8 +44061,16 @@ declare const makeStyleResponsiveState: <T extends ShortHandProperty, K>(name: T
44054
44061
  declare const makeStyleResponsive: <T extends ShortHandProperty, K>(name: T, value?: ObjectDevices<K>, unit?: string) => Record<ResponsiveKey<T>, K>;
44055
44062
  declare const makeStyleResponsiveByScreen: <T extends ShortHandProperty, K>(name: T, value?: ObjectDevices<K>, unit?: string) => Record<ResponsiveKey<T>, K>;
44056
44063
  declare const makeWidth: (widthValue?: ObjectDevices<string | number>, fullWidthValue?: ObjectDevices<boolean>) => ObjectDevices<string | number>;
44057
- declare const makeGlobalSizeWidthResponsive: (globalSize?: ObjectDevices<SizeSettingGlobal>) => Record<string, string | undefined>;
44058
- declare const makeGlobalSizeHeightResponsive: (globalSize?: ObjectDevices<SizeSettingGlobal>) => Record<string, string | undefined>;
44064
+ declare const makeGlobalSizeWidthResponsive: (globalSize?: ObjectDevices<SizeSettingGlobal>) => {
44065
+ '--w': string | undefined;
44066
+ '--w-tablet': string | undefined;
44067
+ '--w-mobile': string | undefined;
44068
+ };
44069
+ declare const makeGlobalSizeHeightResponsive: (globalSize?: ObjectDevices<SizeSettingGlobal>) => {
44070
+ '--h': string | undefined;
44071
+ '--h-tablet': string | undefined;
44072
+ '--h-mobile': string | undefined;
44073
+ };
44059
44074
  declare const makeHeight: (heighValue?: ObjectDevices<string | number>, autoHeight?: ObjectDevices<boolean>) => ObjectDevices<string | number | undefined>;
44060
44075
  declare const makeAspectRatio: (aspectRatio?: ObjectDevices<string>, aspectWidth?: ObjectDevices<string | number>, aspectHeight?: ObjectDevices<string | number>) => ObjectDevices<string>;
44061
44076
  declare const makeLineClamp: (lineClampValue?: ObjectDevices<number>, hasLineClampValue?: ObjectDevices<boolean>) => ObjectDevices<string | number | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "17.0.0-staging.36",
3
+ "version": "17.0.0-staging.42",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@gem-sdk/adapter-shopify": "17.0.0-staging.26",
32
- "@gem-sdk/styles": "17.0.0-staging.30",
32
+ "@gem-sdk/styles": "17.0.0-staging.40",
33
33
  "@types/classnames": "^2.3.1"
34
34
  },
35
35
  "dependencies": {
@@ -1 +0,0 @@
1
- "use strict";exports.isSafeValue=t=>null!=t&&!("string"==typeof t&&""===t.trim());
@@ -1 +0,0 @@
1
- let e=e=>null!=e&&!("string"==typeof e&&""===e.trim());export{e as isSafeValue};