????JFIF??x?x????'403WebShell
403Webshell
Server IP : 104.21.80.1  /  Your IP : 216.73.216.145
Web Server : LiteSpeed
System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : tempvsty ( 647)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/tempvsty/buyeaa.com/wp-content/plugins/woocommerce/assets/client/blocks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tempvsty/buyeaa.com/wp-content/plugins/woocommerce/assets/client/blocks/product-collection.js
(()=>{var e,t,o,r={5074:(e,t,o)=>{"use strict";const r=window.wp.blocks,c=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"woocommerce/product-collection","title":"Product Collection","description":"Display a collection of products from your store.","category":"woocommerce","keywords":["WooCommerce","Products (Beta)","all products","by category","by tag","by attribute"],"textdomain":"woocommerce","attributes":{"queryId":{"type":"number"},"query":{"type":"object"},"tagName":{"type":"string"},"displayLayout":{"type":"object"},"dimensions":{"type":"object"},"convertedFromProducts":{"type":"boolean","default":false},"collection":{"type":"string"},"hideControls":{"default":[],"type":"array"},"queryContextIncludes":{"type":"array"},"forcePageReload":{"type":"boolean","default":false},"__privatePreviewState":{"type":"object"}},"providesContext":{"queryId":"queryId","query":"query","displayLayout":"displayLayout","dimensions":"dimensions","queryContextIncludes":"queryContextIncludes","collection":"collection","__privateProductCollectionPreviewState":"__privatePreviewState"},"usesContext":["templateSlug","postId"],"supports":{"align":["wide","full"],"anchor":true,"html":false,"__experimentalLayout":true,"interactivity":true},"editorStyle":"file:../woocommerce/product-collection-editor.css","style":"file:../woocommerce/product-collection-style.css"}'),n=window.wp.blockEditor;var s=o(6087);const l=window.wp.data,a=window.wp.coreData;let i=function(e){return e.Product="product",e.Archive="archive",e.Cart="cart",e.Order="order",e.Site="site",e}({});const d="single-product",u="taxonomy-product_cat",m="taxonomy-product_tag",p=async(e,t,o,r)=>{var c;r((c=await(0,l.resolveSelect)(a.store).getEntityRecords(e,t,{_fields:["id"],slug:o}))&&c.length&&c[0]?.id?c[0].id:null)},_=(e,t={})=>({type:e,sourceData:t}),h=window.wp.components;let g=function(e){return e.COLLECTION_PICKER="collection_chooser",e.PRODUCT_REFERENCE_PICKER="product_context_picker",e.VALID_WITH_PREVIEW="uses_reference_preview_mode",e.VALID="valid",e.DELETED_PRODUCT_REFERENCE="deleted_product_reference",e}({}),w=function(e){return e.GRID="flex",e.STACK="list",e}({}),x=function(e){return e.FILL="fill",e.FIXED="fixed",e}({}),b=function(e){return e.IN="in",e.NOT_IN="not-in",e}({}),y=function(e){return e.PRODUCT_CATALOG="woocommerce/product-collection/product-catalog",e.BEST_SELLERS="woocommerce/product-collection/best-sellers",e.FEATURED="woocommerce/product-collection/featured",e.NEW_ARRIVALS="woocommerce/product-collection/new-arrivals",e.ON_SALE="woocommerce/product-collection/on-sale",e.TOP_RATED="woocommerce/product-collection/top-rated",e.HAND_PICKED="woocommerce/product-collection/hand-picked",e.RELATED="woocommerce/product-collection/related",e.UPSELLS="woocommerce/product-collection/upsells",e.CROSS_SELLS="woocommerce/product-collection/cross-sells",e}({}),f=function(e){return e.ATTRIBUTES="attributes",e.CREATED="created",e.FEATURED="featured",e.HAND_PICKED="hand-picked",e.INHERIT="inherit",e.KEYWORD="keyword",e.ON_SALE="on-sale",e.ORDER="order",e.DEFAULT_ORDER="default-order",e.STOCK_STATUS="stock-status",e.TAXONOMY="taxonomy",e.PRICE_RANGE="price-range",e.FILTERABLE="filterable",e.PRODUCTS_PER_PAGE="products-per-page",e.MAX_PAGES_TO_SHOW="max-pages-to-show",e.OFFSET="offset",e.RELATED_BY="related-by",e}({});var C=o(7723),v=o(1244),k=o.n(v);k()("wc-admin:tracks:stats");const S=k()("wc-admin:tracks");function j(e,t){if(S("recordevent %s %o","wcadmin_"+e,t,{_tqk:window._tkq,shouldRecord:!!window._tkq&&!!window.wcTracks&&!!window.wcTracks.isEnabled}),!window.wcTracks||"function"!=typeof window.wcTracks.recordEvent)return!1;window.wcTracks.recordEvent(e,t)}var E=o(9491);const R=window.wc.wcBlocksRegistry;var A=o(4530),P=o(8226);const I=window.wc.wcSettings;let T=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});const O=`${c.name}/product-title`,L=(0,I.getSetting)("stockStatusOptions",[]),N=(0,I.getSetting)("hideOutOfStockItems",!1),D=()=>N?Object.keys(function(e,t){const{[t]:o,...r}=e;return r}(L,"outofstock")):Object.keys(L),B={perPage:9,pages:0,offset:0,postType:"product",order:"asc",orderBy:"title",search:"",exclude:[],inherit:!1,taxQuery:{},isProductCollectionBlock:!0,featured:!1,woocommerceOnSale:!1,woocommerceStockStatus:D(),woocommerceAttributes:[],woocommerceHandPickedProducts:[],timeFrame:void 0,priceRange:void 0,filterable:!1,relatedBy:{categories:!0,tags:!0}},F={query:B,tagName:"div",displayLayout:{type:w.GRID,columns:3,shrinkColumns:!0},dimensions:{widthType:x.FILL},queryContextIncludes:["collection"],forcePageReload:!1},q={woocommerceOnSale:B.woocommerceOnSale,woocommerceStockStatus:B.woocommerceStockStatus,woocommerceAttributes:B.woocommerceAttributes,woocommerceHandPickedProducts:B.woocommerceHandPickedProducts,taxQuery:B.taxQuery,featured:B.featured,timeFrame:B.timeFrame,priceRange:B.priceRange},M=["woocommerce/product-template",{},[["woocommerce/product-image",{imageSizing:T.THUMBNAIL}],["core/post-title",{textAlign:"center",level:2,fontSize:"medium",style:{spacing:{margin:{bottom:"0.75rem",top:"0"}},typography:{lineHeight:"1.4"}},isLink:!0,__woocommerceNamespace:O}],["woocommerce/product-price",{textAlign:"center",fontSize:"small"}],["woocommerce/product-button",{textAlign:"center",fontSize:"small"}]]],V="core/query-pagination",H=[M,[V,{layout:{type:"flex",justifyContent:"center"}}],["woocommerce/product-collection-no-results"]];var U=o(790);const $={name:y.BEST_SELLERS,title:(0,C.__)("Best Sellers","woocommerce"),icon:(0,U.jsx)(A.A,{icon:P.A}),description:(0,C.__)("Recommend your best-selling products.","woocommerce"),keywords:["best selling"],scope:["inserter","block"],attributes:{displayLayout:{type:"flex",columns:5,shrinkColumns:!0},query:{orderBy:"popularity",order:"desc",perPage:5,pages:1},hideControls:[f.ORDER,f.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("Best selling products","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]};var G=o(3255);const Q={name:y.CROSS_SELLS,title:(0,C.__)("Cross-Sells","woocommerce"),icon:(0,U.jsx)(A.A,{icon:G.A}),description:(0,C.__)("By suggesting complementary products in the cart using cross-sells, you can significantly increase the average order value.","woocommerce"),keywords:["boost","promotion"],scope:["inserter","block"],usesReference:["product","cart","order"],attributes:{displayLayout:{type:"flex",columns:4,shrinkColumns:!0},query:{perPage:8,pages:1},hideControls:[f.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("You may be interested in…","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]};var W=o(3129);const K={name:y.FEATURED,title:(0,C.__)("Featured Products","woocommerce"),icon:(0,U.jsx)(A.A,{icon:W.A}),description:(0,C.__)("Showcase your featured products.","woocommerce"),keywords:[],scope:["inserter","block"],attributes:{displayLayout:{type:"flex",columns:5,shrinkColumns:!0},query:{featured:!0,perPage:5,pages:1},hideControls:[f.FEATURED,f.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("Featured products","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]};var Z=o(5573);const z=(0,U.jsxs)(Z.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,U.jsx)(Z.Path,{d:"M8.85074 4.8213L7.64702 3.92627L5.56365 6.72818L4.44959 5.89735L3.55286 7.0998L5.87107 8.82862L8.85074 4.8213Z",fill:"currentColor"}),(0,U.jsx)(Z.Path,{d:"M20 7.75004H11.1111V6.25004H20V7.75004Z",fill:"currentColor"}),(0,U.jsx)(Z.Path,{d:"M20 12.75H11.1111V11.25H20V12.75Z",fill:"currentColor"}),(0,U.jsx)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 14C7.10457 14 8 13.1046 8 12C8 10.8955 7.10457 10 6 10C4.89543 10 4 10.8955 4 12C4 13.1046 4.89543 14 6 14ZM6 13C6.55229 13 7 12.5523 7 12C7 11.4478 6.55229 11 6 11C5.44772 11 5 11.4478 5 12C5 12.5523 5.44772 13 6 13Z",fill:"currentColor"}),(0,U.jsx)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M8 17C8 18.1046 7.10457 19 6 19C4.89543 19 4 18.1046 4 17C4 15.8955 4.89543 15 6 15C7.10457 15 8 15.8955 8 17ZM7 17C7 17.5523 6.55229 18 6 18C5.44772 18 5 17.5523 5 17C5 16.4478 5.44772 16 6 16C6.55229 16 7 16.4478 7 17Z",fill:"currentColor"}),(0,U.jsx)(Z.Path,{d:"M11.1111 17.75H20V16.25H11.1111V17.75Z",fill:"currentColor"})]}),Y={name:y.HAND_PICKED,title:(0,C.__)("Hand-Picked Products","woocommerce"),icon:(0,U.jsx)(A.A,{icon:z}),description:(0,C.__)("Select specific products to recommend to customers.","woocommerce"),keywords:["specific","choose","recommend","handpicked","hand picked"],scope:["inserter","block"],attributes:{displayLayout:{type:"flex",columns:5,shrinkColumns:!0},query:{orderBy:"post__in"},hideControls:[f.HAND_PICKED,f.FILTERABLE,f.ORDER]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("Recommended products","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M,["core/query-pagination",{layout:{type:"flex",justifyContent:"center"}}]]};var X=o(3174);const J={name:y.NEW_ARRIVALS,title:(0,C.__)("New Arrivals","woocommerce"),icon:(0,U.jsx)(A.A,{icon:X.A}),description:(0,C.__)("Recommend your newest products.","woocommerce"),keywords:["newest"],scope:["inserter","block"],attributes:{displayLayout:{type:"flex",columns:5,shrinkColumns:!0},query:{orderBy:"date",order:"desc",perPage:5,pages:1,timeFrame:{operator:b.IN,value:"-7 days"}},hideControls:[f.ORDER,f.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("New arrivals","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]};var ee=o(9771);const te={name:y.ON_SALE,title:(0,C.__)("On Sale Products","woocommerce"),icon:(0,U.jsx)(A.A,{icon:ee.A}),description:(0,C.__)("Highlight products that are currently on sale.","woocommerce"),keywords:["discount","promotion","onsale"],scope:["inserter","block"],attributes:{displayLayout:{type:"flex",columns:5,shrinkColumns:!0},query:{woocommerceOnSale:!0,perPage:5,pages:1},hideControls:[f.ON_SALE,f.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("On sale products","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]};var oe=o(5350);const re={name:y.PRODUCT_CATALOG,title:(0,C.__)("Product Catalog","woocommerce"),icon:(0,U.jsx)(A.A,{icon:oe.A}),description:"Display all products in your catalog. Results can (change to) match the current template, page, or search term.",keywords:["all products"],scope:[],innerBlocks:H},ce={name:y.RELATED,title:(0,C.__)("Related Products","woocommerce"),icon:(0,U.jsx)(A.A,{icon:oe.A}),description:(0,C.__)("Recommend products like this one.","woocommerce"),keywords:[],scope:["inserter","block"],usesReference:["product"],attributes:{displayLayout:{type:w.GRID,columns:4,shrinkColumns:!0},query:{perPage:4,pages:1}},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("Related Products","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]};var ne=o(2108);const se={name:y.TOP_RATED,title:(0,C.__)("Top Rated Products","woocommerce"),icon:(0,U.jsx)(A.A,{icon:ne.A}),description:(0,C.__)("Recommend products with the highest review ratings.","woocommerce"),keywords:[],scope:["inserter","block"],attributes:{displayLayout:{type:"flex",columns:5,shrinkColumns:!0},query:{orderBy:"rating",order:"desc",perPage:5,pages:1},hideControls:[f.ORDER,f.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("Top rated products","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]};var le=o(4807);const ae=[re,K,J,te,$,se,Y,ce,{name:y.UPSELLS,title:(0,C.__)("Upsells","woocommerce"),icon:(0,U.jsx)(A.A,{icon:le.A}),description:(0,C.__)("Upsells are typically products that are extra profitable or better quality or more expensive. Experiment with combinations to boost sales.","woocommerce"),keywords:["boost","promotion"],scope:["inserter","block"],usesReference:["product","cart","order"],attributes:{displayLayout:{type:"flex",columns:4,shrinkColumns:!0},query:{perPage:8,pages:1},hideControls:[f.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"center",level:2,content:(0,C.__)("You may also like","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],M]},Q],ie=e=>e?(0,l.select)(r.store).getBlockVariations(c.name).find((({name:t})=>t===e)):null,de=window.wp.hooks,ue=window.wp.url,me=window.wp.apiFetch;var pe=o.n(me);const _e=(0,I.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),he=_e.pluginUrl+"assets/images/",ge=(_e.pluginUrl,I.STORE_PAGES.shop,I.STORE_PAGES.checkout,I.STORE_PAGES.checkout,I.STORE_PAGES.privacy,I.STORE_PAGES.privacy,I.STORE_PAGES.terms,I.STORE_PAGES.terms,I.STORE_PAGES.cart,I.STORE_PAGES.cart,I.STORE_PAGES.myaccount?.permalink?I.STORE_PAGES.myaccount.permalink:(0,I.getSetting)("wpLoginUrl","/wp-login.php"),(0,I.getSetting)("localPickupEnabled",!1),(0,I.getSetting)("shippingMethodsExist",!1),(0,I.getSetting)("shippingEnabled",!0),(0,I.getSetting)("countries",{})),we=(0,I.getSetting)("countryData",{}),xe={...Object.fromEntries(Object.keys(we).filter((e=>!0===we[e].allowBilling)).map((e=>[e,ge[e]||""]))),...Object.fromEntries(Object.keys(we).filter((e=>!0===we[e].allowShipping)).map((e=>[e,ge[e]||""])))},be=(Object.fromEntries(Object.keys(xe).map((e=>[e,we[e].states||{}]))),Object.fromEntries(Object.keys(xe).map((e=>[e,we[e].locale||{}]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),ye=((0,I.getSetting)("addressFieldsLocations",be).address,(0,I.getSetting)("addressFieldsLocations",be).contact,(0,I.getSetting)("addressFieldsLocations",be).order,(0,I.getSetting)("additionalOrderFields",{}),(0,I.getSetting)("additionalContactFields",{}),(0,I.getSetting)("additionalAddressFields",{}),(e,t)=>{const o=new Map;return e.filter((e=>{const r=t(e);return!o.has(r)&&(o.set(r,e),!0)}))}),fe=({selected:e=[],search:t="",queryArgs:o={}})=>{const r=(({selected:e=[],search:t="",queryArgs:o={}})=>{const r=_e.productCount>100,c={per_page:r?100:0,catalog_visibility:"any",search:t,orderby:"title",order:"asc"},n=[(0,ue.addQueryArgs)("/wc/store/v1/products",{...c,...o})];return r&&e.length&&n.push((0,ue.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:0})),n})({selected:e,search:t,queryArgs:o});return Promise.all(r.map((e=>pe()({path:e})))).then((e=>{const t=e.flat(),o=ye(t,(e=>e.id));return o.map((e=>({...e,parent:0})))})).catch((e=>{throw e}))},Ce=e=>pe()({path:`wc/store/v1/products/attributes/${e}/terms`});function ve(e,t){const{query:o}=e.attributes;e.setAttributes({query:{...o,...t}})}const ke=()=>{const e=(0,l.select)("core/edit-site")?.getEditedPostId();return!!e&&["woocommerce/woocommerce//archive-product","woocommerce/woocommerce//taxonomy-product_attribute","woocommerce/woocommerce//product-search-results","//taxonomy-product_cat","//taxonomy-product_tag"].some((t=>e.includes(t)))},Se=e=>{const{getBlocksByName:t,getBlock:o}=(0,l.select)(n.store);return!t("woocommerce/product-collection").find((t=>{const r=o(t);return r.attributes?.query?.[e]}))};function je(){return!!ke()&&Se("inherit")}function Ee(){return!ke()&&Se("filterable")}const Re=()=>F.displayLayout,Ae=(e,t,o)=>{const n=ie(e);n&&o(t,n.name===y.PRODUCT_CATALOG?(0,r.createBlock)(c.name,{...F,query:{...F.query,inherit:je(),filterable:Ee()}},(0,r.createBlocksFromInnerBlocksTemplate)(H)):(0,r.createBlock)(c.name,n.attributes,(0,r.createBlocksFromInnerBlocksTemplate)(n.innerBlocks)))},Pe=({title:e,icon:t,description:o,onClick:r})=>(0,U.jsx)(h.Tooltip,{text:o,placement:"top",children:(0,U.jsxs)(h.Button,{className:"wc-blocks-product-collection__collection-button",onClick:r,children:[(0,U.jsx)("div",{className:"wc-blocks-product-collection__collection-button-icon",children:(0,U.jsx)(h.Icon,{icon:t})}),(0,U.jsx)("p",{className:"wc-blocks-product-collection__collection-button-title",children:e})]})}),Ie=e=>{const{description:t,onClick:o}=e;return(0,U.jsxs)("div",{className:"wc-blocks-product-collection__collections-create",children:[(0,U.jsx)("span",{children:(0,C.__)("or","woocommerce")}),(0,U.jsx)(h.Tooltip,{text:t,placement:"top",children:(0,U.jsx)(h.Button,{onClick:o,children:(0,C.__)("create your own","woocommerce")})})]})},Te=e=>{const{onCollectionClick:t,catalogVariation:o,collectionVariations:r}=e;return(0,U.jsxs)("div",{className:"wc-blocks-product-collection__collections-grid",children:[(0,U.jsx)("div",{className:"wc-blocks-product-collection__collections-section",children:r.map((({name:e,title:o,icon:r,description:c})=>(0,U.jsx)(Pe,{title:o,description:c,icon:r,onClick:()=>t(e)},e)))}),(0,U.jsx)(Ie,{title:o.title,description:o.description,icon:o.icon,onClick:()=>t(o.name)})]})},Oe=e=>{const{onCollectionClick:t,catalogVariation:o,collectionVariations:r}=e;return(0,U.jsxs)("div",{className:"wc-blocks-product-collection__collections-dropdown",children:[(0,U.jsx)(h.Dropdown,{className:"wc-blocks-product-collection__collections-dropdown-toggle",contentClassName:"wc-blocks-product-collection__collections-dropdown-content",renderToggle:({isOpen:e,onToggle:t})=>(0,U.jsx)(h.Button,{variant:"secondary",onClick:t,"aria-expanded":e,children:(0,C.__)("Choose collection","woocommerce")}),renderContent:()=>(0,U.jsx)(U.Fragment,{children:r.map((({name:e,title:o,icon:r,description:c})=>(0,U.jsx)(Pe,{title:o,description:c,icon:r,onClick:()=>t(e)},e)))})}),(0,U.jsx)(Ie,{title:o.title,description:o.description,icon:o.icon,onClick:()=>t(o.name)})]})},Le=e=>{const t=(0,l.useSelect)((e=>{const{getBlockVariations:t}=e(r.store);return t(c.name)}),[]),o=(0,s.useMemo)((()=>t.find((({name:e})=>e===y.PRODUCT_CATALOG))),[t]),n=(0,s.useMemo)((()=>t.filter((({name:e,scope:t})=>e!==y.PRODUCT_CATALOG&&(void 0===t||t?.includes("block"))))),[t]),[a,{width:i}]=(0,E.useResizeObserver)();let d;return d=null!==i&&i>=600?Te:Oe,(0,U.jsxs)(U.Fragment,{children:[a,!!i&&(0,U.jsx)(d,{...e,catalogVariation:o,collectionVariations:n})]})},Ne=e=>{const t=(0,n.useBlockProps)(),{clientId:o,tracksLocation:r}=e,{replaceBlock:c}=(0,l.useDispatch)(n.store);return(0,U.jsx)("div",{...t,children:(0,U.jsx)(h.Placeholder,{className:"wc-blocks-product-collection__placeholder",instructions:(0,C.__)("What products do you want to show?","woocommerce"),children:(0,U.jsx)(Le,{onCollectionClick:e=>{j("blocks_product_collection_collection_chosen_from_placeholder",{collection:e,location:r}),Ae(e,o,c)}})})})};var De=o(1824),Be=o.n(De);const Fe="wc-blocks_upgraded-products-to-product-collection",qe=()=>({status:"notseen",time:Date.now(),displayCount:0}),Me=window.wc.wcTypes,Ve=e=>"woocommerce/product-collection"===e.name&&e.attributes.convertedFromProducts,He=(e,t)=>{let o=[];return e.forEach((e=>{t(e)&&(o=[...o,e.clientId]),o=[...o,...He(e.innerBlocks,t)]})),o},Ue=(0,I.getSettingWithCoercion)("postTemplateHasSupportForGridView",!1,Me.isBoolean),$e=()=>{const e=window.localStorage.getItem(Fe);return e?JSON.parse(e):qe()},Ge=e=>{window.localStorage.setItem(Fe,JSON.stringify(e))},Qe=e=>"flex"===e?"grid":"list"===e?"default":"grid",We=e=>{const{type:t,columns:o}=e;return{type:Qe(t),columnCount:o}},Ke=(e,t)=>{const o=e.map((e=>{const{name:o,attributes:c}=e,n=Ke(e.innerBlocks);return(({name:e})=>"woocommerce/product-template"===e)(e)?((e,t,o)=>(0,r.createBlock)("core/post-template",{className:"products-block-post-template",layout:Ue?We(o):void 0,__woocommerceNamespace:"woocommerce/product-query/product-template",...e.attributes},t))(e,n,t):(({name:e,attributes:t})=>"core/post-title"===e&&"woocommerce/product-collection/product-title"===t.__woocommerceNamespace)(e)?((e,t)=>{const{__woocommerceNamespace:o,...c}=e.attributes;return(0,r.createBlock)("core/post-title",{__woocommerceNamespace:"woocommerce/product-collection/product-title",...c},t)})(e,n):(({name:e,attributes:t})=>"core/post-excerpt"===e&&"woocommerce/product-collection/product-summary"===t.__woocommerceNamespace)(e)?((e,t)=>{const{__woocommerceNamespace:o,...c}=e.attributes;return(0,r.createBlock)("core/post-excerpt",{__woocommerceNamespace:"woocommerce/product-collection/product-summary",...c},t)})(e,n):(0,r.createBlock)(o,c,n)}));return o},Ze=e=>{const t=(0,l.select)("core/block-editor").getBlock(e),o=(e=>{const t=(0,l.select)("core/block-editor").getBlockRootClientId(e)||void 0;return(0,l.select)("core/block-editor").canInsertBlockType("core/query",t)})(e);if(t&&o){const{attributes:o={},innerBlocks:c=[]}=t,{displayLayout:n,...s}=o,a=(e=>{const{query:t,...o}=e,{woocommerceAttributes:r,woocommerceStockStatus:c,woocommerceOnSale:n,woocommerceHandPickedProducts:s,taxQuery:l,isProductCollectionBlock:a,...i}=t,d={...i};return s&&(d.include=s),n&&(d.__woocommerceOnSale=n),l&&(d.taxQuery=l),{...o,namespace:"woocommerce/product-query",query:{__woocommerceAttributes:r||[],__woocommerceStockStatus:c||[],...d}}})(Ue?s:o),i=Ke(c,n),d=(0,r.createBlock)("core/query",a,i);return(0,l.dispatch)("core/block-editor").replaceBlock(e,d),!0}return!1},ze=()=>{var e;Ge({status:"reverted",time:Date.now()}),(e=(0,l.select)("core/block-editor").getBlocks(),He(e,Ve)).map(Ze)},Ye=window.wc.customerEffortScore,Xe=({size:e=12})=>(0,U.jsx)(Z.SVG,{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,U.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.45865 9.08341L1.6665 9.87639L1.6665 1.66675L10.3332 1.66675L10.3332 9.08341L2.45865 9.08341ZM2.87317 10.0834L10.6665 10.0834C11.0347 10.0834 11.3332 9.78494 11.3332 9.41675L11.3332 1.33342C11.3332 0.965226 11.0347 0.666748 10.6665 0.666748H1.33317C0.964982 0.666748 0.666504 0.965225 0.666504 1.33341V11.0166C0.666504 11.2116 0.773993 11.3907 0.946074 11.4825C1.15124 11.5919 1.40385 11.5543 1.56818 11.3898L2.87317 10.0834ZM8.6665 4.66673H3.33317V3.66673H8.6665V4.66673ZM3.33317 7.33339H6.6665V6.33339H3.33317V7.33339Z",fill:"currentColor"})}),Je=({blockName:e,title:t=(0,C.__)("Share your experience","woocommerce"),firstQuestion:o=(0,C.sprintf)(/* translators: %s is the block name. */ /* translators: %s is the block name. */
(0,C.__)("It was easy for me to accomplish what I wanted with the %s.","woocommerce"),e),feedbackLabel:r=(0,C.sprintf)(/* translators: %s is the block name. */ /* translators: %s is the block name. */
(0,C.__)("How can we improve the %s block for you? (Optional)","woocommerce"),e),feedbackPlaceholder:c=(0,C.__)("What did you try to build using this block? What did and didn't work?","woocommerce"),emailLabel:n=(0,C.__)("Email address (Optional)","woocommerce"),emailHelp:s=(0,C.__)("Share if you would like to discuss your experience or participate in future research.","woocommerce"),buttonText:l=(0,C.__)("Help us improve","woocommerce"),submitLabel:a=(0,C.__)("🙏🏻 Thanks for sharing — we're on it!","woocommerce"),wrapper:i,wrapperProps:d={}})=>{const{showCesModal:u}=(0,Ye.useCustomerEffortScoreModal)();if(!window.wcTracks?.isEnabled)return null;const m=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ye.CustomerEffortScoreModalContainer,{}),(0,U.jsx)(h.Button,{variant:"tertiary",icon:(0,U.jsx)(Xe,{}),iconSize:12,onClick:()=>{u({action:`${e.toLowerCase().replace(/\s+/g,"_")}_block_feedback`,title:t,firstQuestion:o,showDescription:!1,onsubmitLabel:a,getExtraFieldsToBeShown:(e,t,o)=>(0,U.jsxs)("div",{children:[(0,U.jsx)(h.TextareaControl,{label:r,value:e.feedback_comment||"",onChange:o=>t({...e,feedback_comment:o}),placeholder:c}),(0,U.jsx)(h.TextControl,{label:n,type:"email",value:e.email||"",onChange:o=>t({...e,email:o}),help:o?.email?(0,U.jsx)("span",{className:"woocommerce-customer-effort-score__errors",children:(0,U.jsx)("p",{children:o.email})}):s})]}),validateExtraFields:({email:e=""})=>{const t={};return e.length>0&&!(0,ue.isEmail)(e)&&(t.email=(0,C.__)("Please enter a valid email address.","woocommerce")),t}},{blockName:e,shouldShowComments:()=>!1},{},{})},className:"wc-block-editor__feedback-button",children:l})]});return i?(0,U.jsx)(i,{...d,children:m}):m},et=window.wp.editor;var tt=function(e){return e.SINGLE_PRODUCT="single-product",e.PRODUCT_CATALOG="product-catalog",e.PRODUCT_ARCHIVE="product-archive",e.ORDER_CONFIRMATION="order-confirmation",e.CART="cart",e.CHECKOUT="checkout",e.POST="post",e.PAGE="page",e.OTHER="other",e}(tt||{});const ot={"single-product":tt.SINGLE_PRODUCT,"archive-product":tt.PRODUCT_CATALOG,"taxonomy-product_cat":tt.PRODUCT_ARCHIVE,"taxonomy-product_tag":tt.PRODUCT_ARCHIVE,"taxonomy-product_attribute":tt.PRODUCT_ARCHIVE,"product-search-results":tt.PRODUCT_ARCHIVE,"order-confirmation":tt.ORDER_CONFIRMATION,"page-cart":tt.CART,"page-checkout":tt.CHECKOUT},rt=e=>{const t=(0,l.useSelect)((e=>e(et.store).getCurrentPostType()),[]);if(t===tt.PAGE||t===tt.POST)return t;if(!e)return tt.OTHER;return ot[e]||(e.includes("single-product")?tt.SINGLE_PRODUCT:e.includes("taxonomy-product_cat")||e.includes("taxonomy-product_tag")?tt.PRODUCT_ARCHIVE:tt.OTHER)};var ct=o(4921);function nt({children:e,className:t,actionLabel:o,onActionClick:r,...c}){return(0,U.jsx)(h.Notice,{...c,className:(0,ct.$)("wc-block-editor-components-upgrade-downgrade-notice",t),actions:[{label:o,onClick:r,noDefaultClasses:!0,variant:"link"}],children:(0,U.jsx)("div",{className:"wc-block-editor-components-upgrade-downgrade-notice__text",children:e})})}o(9969);const st=(0,s.createInterpolateElement)((0,C.__)("Products (Beta) block was upgraded to <strongText />, an updated version with new features and simplified settings.","woocommerce"),{strongText:(0,U.jsx)("strong",{children:(0,C.__)("Product Collection","woocommerce")})}),lt=(0,C.__)("Revert to Products (Beta)","woocommerce"),at=({revertMigration:e})=>{const[t,o]=((e,t)=>{const[o,r]=(0,s.useState)((()=>{const o=window.localStorage.getItem(e);if(o)try{return JSON.parse(o)}catch{console.error(`Value for key '${e}' could not be retrieved from localStorage because it can't be parsed.`)}return t}));return(0,s.useEffect)((()=>{try{window.localStorage.setItem(e,JSON.stringify(o))}catch{console.error(`Value for key '${e}' could not be saved in localStorage because it can't be converted into a string.`)}}),[e,o]),[o,r]})(Fe,qe()),r=(0,s.useRef)(!0),{status:c}=t;return(0,s.useEffect)((()=>()=>{r.current&&((()=>{const e=$e(),t=(0,Me.isNumber)(e.displayCount)?e.displayCount+1:0;Ge({...e,displayCount:t})})(),r.current=!1)}),[r]),"notseen"===c?(0,U.jsx)(nt,{actionLabel:lt,onActionClick:()=>{e(),j("blocks_product_collection_migration_between_products_beta",{transform_to:"products_beta"})},onRemove:()=>{o({status:"seen",time:Date.now()})},children:st}):null},it=(0,C.__)("Columns","woocommerce"),dt=(0,C.__)("Responsive","woocommerce"),ut=(0,C.__)("Automatically adjust the number of columns to better fit smaller screens.","woocommerce"),mt=e=>{const{type:t,columns:o,shrinkColumns:r}=e.displayLayout,c="flex"===t,n=Re(),s=()=>{e.setAttributes({displayLayout:n})};return c?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h.__experimentalToolsPanelItem,{label:it,hasValue:()=>n?.columns!==o,isShownByDefault:!0,onDeselect:s,children:(0,U.jsx)(h.RangeControl,{__next40pxDefaultSize:!0,label:it,onChange:t=>e.setAttributes({displayLayout:{...e.displayLayout,columns:t}}),value:o,min:2,max:Math.max(6,o)})}),(0,U.jsx)(h.__experimentalToolsPanelItem,{label:dt,hasValue:()=>n?.shrinkColumns!==r,isShownByDefault:!0,onDeselect:s,children:(0,U.jsx)(h.ToggleControl,{checked:!!r,label:dt,help:ut,onChange:t=>{e.setAttributes({displayLayout:{...e.displayLayout,shrinkColumns:t}})}})})]}):null},pt=(0,C.__)("Query type","woocommerce"),_t=(0,C.__)("Default","woocommerce"),ht=(0,C.__)("Custom","woocommerce"),gt=(0,C.__)("Display products based on the current template and allow shoppers to filter.","woocommerce"),wt=(0,C.__)("Show products based on specific criteria and allow shoppers to filter.","woocommerce"),xt=(0,C.__)("Show a list of products based on fixed criteria.","woocommerce"),bt=({setQueryAttribute:e,trackInteraction:t,query:o})=>{const r=o?.inherit,c=function(e,t){const o=(0,s.useRef)();return(0,s.useEffect)((()=>{o.current===e||t&&!t(e,o.current)||(o.current=e)}),[e,t]),o.current}(o,(e=>!1===e?.inherit)),n=(0,s.useMemo)((()=>je()),[]);return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:pt,hasValue:()=>r!==n,isShownByDefault:!0,onDeselect:()=>{e({inherit:n}),t(f.INHERIT)},children:(0,U.jsxs)(h.__experimentalToggleGroupControl,{className:"wc-block-product-collection__inherit-query-control",isBlock:!0,label:pt,help:r?gt:xt,value:r?"default":"custom",onChange:o=>{e("default"===o?{...B,inherit:!0}:{...B,...c,inherit:!1}),t(f.INHERIT)},children:[(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:"default",label:_t}),(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:"custom",label:ht})]})})},yt=({setQueryAttribute:e,trackInteraction:t,query:o})=>{const r=o?.filterable,c=(0,s.useMemo)((()=>Ee()),[]);return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:pt,hasValue:()=>r!==c,isShownByDefault:!0,onDeselect:()=>{e({filterable:c}),t(f.FILTERABLE)},children:(0,U.jsxs)(h.__experimentalToggleGroupControl,{className:"wc-block-product-collection__inherit-query-control",isBlock:!0,label:pt,help:r?wt:xt,value:r?"default":"custom",onChange:o=>{e({filterable:"default"===o}),t(f.FILTERABLE)},children:[(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:"default",label:_t}),(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:"custom",label:ht})]})})},ft=({hasValue:e=()=>!0,orderOptions:t,onChange:o,onDeselect:r=()=>{},selectedValue:c,label:n,help:s})=>(0,U.jsx)(h.__experimentalToolsPanelItem,{label:n||(0,C.__)("Order by","woocommerce"),hasValue:e,isShownByDefault:!0,onDeselect:r,resetAllFilter:r,children:(0,U.jsx)(h.SelectControl,{value:c,options:t,label:n||(0,C.__)("Order by","woocommerce"),onChange:o,help:s})}),Ct=[{label:(0,C.__)("Newest to oldest","woocommerce"),value:"date"},{label:(0,C.__)("Price, high to low","woocommerce"),value:"price-desc"},{label:(0,C.__)("Price, low to high","woocommerce"),value:"price"},{label:(0,C.__)("Sales, high to low","woocommerce"),value:"popularity"},{label:(0,C.__)("Rating, high to low","woocommerce"),value:"rating"},{value:"menu_order",label:(0,C.__)("Manual (menu order)","woocommerce")}],vt=({trackInteraction:e})=>{const t=(0,l.select)("core").getEditedEntityRecord("root","site"),[o,r]=(0,s.useState)(t.woocommerce_default_catalog_orderby||"menu_order");return(0,U.jsx)(ft,{label:(0,C.__)("Default sort by","woocommerce"),selectedValue:o,orderOptions:Ct,onChange:t=>{r(t),(0,l.dispatch)(a.store).editEntityRecord("root","site",void 0,{woocommerce_default_catalog_orderby:t}),e(f.DEFAULT_ORDER)},help:(0,C.__)("All Product Collection blocks using the Default Query will sync to this sort order.","woocommerce")})},kt=[{label:(0,C.__)("A → Z","woocommerce"),value:"title/asc"},{label:(0,C.__)("Z → A","woocommerce"),value:"title/desc"},{label:(0,C.__)("Newest to oldest","woocommerce"),value:"date/desc"},{label:(0,C.__)("Oldest to newest","woocommerce"),value:"date/asc"},{label:(0,C.__)("Price, high to low","woocommerce"),value:"price/desc"},{label:(0,C.__)("Price, low to high","woocommerce"),value:"price/asc"},{label:(0,C.__)("Sales, high to low","woocommerce"),value:"sales/desc"},{label:(0,C.__)("Sales, low to high","woocommerce"),value:"sales/asc"},{value:"rating/desc",label:(0,C.__)("Rating, high to low","woocommerce")},{value:"rating/asc",label:(0,C.__)("Rating, low to high","woocommerce")},{value:"menu_order/asc",label:(0,C.__)("Manual (menu order)","woocommerce")},{value:"random",label:(0,C.__)("Random","woocommerce")}],St=e=>{const{query:t,trackInteraction:o,setQueryAttribute:r}=e,{order:c,orderBy:n}=t;let s=c?`${n}/${c}`:n;return"popularity"===n&&(s=`sales/${c}`),(0,U.jsx)(ft,{selectedValue:s,hasValue:()=>c!==B.order||n!==B.orderBy,orderOptions:kt,onChange:e=>{const[t,c]=e.split("/");r({orderBy:t,order:c||void 0}),o(f.ORDER)},onDeselect:()=>{r({orderBy:B.orderBy}),o(f.ORDER)},help:(0,C.__)("Set the products order in this collection.","woocommerce")})},jt=e=>{const{query:t,trackInteraction:o,setQueryAttribute:r}=e,c=()=>{r({woocommerceOnSale:q.woocommerceOnSale}),o(f.ON_SALE)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("On Sale","woocommerce"),hasValue:()=>!0===t.woocommerceOnSale,isShownByDefault:!0,onDeselect:c,resetAllFilter:c,children:(0,U.jsx)(h.ToggleControl,{label:(0,C.__)("Show only products on sale","woocommerce"),checked:t.woocommerceOnSale||!1,onChange:e=>{r({woocommerceOnSale:e}),o(f.ON_SALE)}})})};function Et(e){const t="string"==typeof e?e:e.value;return Object.entries(L).find((([,e])=>e===t))?.[0]}const Rt=e=>{const{query:t,trackInteraction:o,setQueryAttribute:r}=e,c=()=>{r({woocommerceStockStatus:q.woocommerceStockStatus}),o(f.STOCK_STATUS)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Stock Status","woocommerce"),hasValue:()=>!Be()(t.woocommerceStockStatus,D()),onDeselect:c,resetAllFilter:c,isShownByDefault:!0,children:(0,U.jsx)(h.FormTokenField,{label:(0,C.__)("Stock Status","woocommerce"),onChange:e=>{const t=e.map(Et).filter(Boolean);r({woocommerceStockStatus:t}),o(f.STOCK_STATUS)},suggestions:Object.values(L),validateInput:e=>Object.values(L).includes(e),value:t?.woocommerceStockStatus?.map((e=>L[e]))||[],__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1})})},At=e=>{const{query:t,trackInteraction:o,setQueryAttribute:r}=e,[c,n]=(0,s.useState)(t.search),l=(0,E.useDebounce)((()=>{t.search!==c&&(r({search:c}),o(f.KEYWORD))}),250);(0,s.useEffect)((()=>(l(),l.cancel)),[c,l]);const a=()=>{n(""),o(f.KEYWORD)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{hasValue:()=>!!c,label:(0,C.__)("Keyword","woocommerce"),onDeselect:a,resetAllFilter:a,children:(0,U.jsx)(h.TextControl,{label:(0,C.__)("Keyword","woocommerce"),value:c,onChange:n})})};function Pt(e,t,o){const r=new Set(t.map((e=>e[o])));return e.filter((e=>!r.has(e[o])))}const It=window.wp.htmlEntities,Tt={clear:(0,C.__)("Clear all selected items","woocommerce"),noItems:(0,C.__)("No items found.","woocommerce"),
/* Translators: %s search term */
noResults:(0,C.__)("No results for %s","woocommerce"),search:(0,C.__)("Search for items","woocommerce"),selected:e=>(0,C.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */
(0,C._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,C.__)("Search results updated.","woocommerce")},Ot=(e,t=e)=>{const o=e.reduce(((e,t)=>{const o=t.parent||0;return e[o]||(e[o]=[]),e[o].push(t),e}),{}),r=t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{});const c=["0"],n=(e={})=>e.parent?[...n(r[e.parent]),e.name]:e.name?[e.name]:[],s=e=>e.map((e=>{const t=o[e.id];return c.push(""+e.id),{...e,breadcrumbs:n(r[e.parent]),children:t&&t.length?s(t):[]}})),l=s(o[0]||[]);return Object.entries(o).forEach((([e,t])=>{c.includes(e)||l.push(...s(t||[]))})),l},Lt=(e,t)=>{if(!t)return e;const o=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(o).map(((e,t)=>o.test(e)?(0,U.jsx)("strong",{children:e},t):(0,U.jsx)(s.Fragment,{children:e},t)))},Nt=({label:e})=>(0,U.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),Dt=e=>{const{item:t,search:o}=e,r=t.breadcrumbs&&t.breadcrumbs.length;return(0,U.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[r?(0,U.jsx)("span",{className:"woocommerce-search-list__item-prefix",children:(c=t.breadcrumbs,1===c.length?c.slice(0,1).toString():2===c.length?c.slice(0,1).toString()+" › "+c.slice(-1).toString():c.slice(0,1).toString()+" … "+c.slice(-1).toString())}):null,(0,U.jsx)("span",{className:"woocommerce-search-list__item-name",children:Lt((0,It.decodeEntities)(t.name),o)})]});var c},Bt=({countLabel:e,className:t,depth:o=0,controlId:r="",item:c,isSelected:n,isSingle:l,onSelect:a,search:i="",selected:d,useExpandedPanelId:u,...m})=>{const[p,_]=u,g=null!=e&&void 0!==c.count&&null!==c.count,w=!!c.breadcrumbs?.length,x=!!c.children?.length,b=p===c.id,y=(0,ct.A)(["woocommerce-search-list__item",`depth-${o}`,t],{"has-breadcrumbs":w,"has-children":x,"has-count":g,"is-expanded":b,"is-radio-button":l});(0,s.useEffect)((()=>{x&&n&&_(c.id)}),[c,x,n,_]);const f=m.name||`search-list-item-${r}`,C=`${f}-${c.id}`,v=(0,s.useCallback)((()=>{_(b?-1:Number(c.id))}),[b,c.id,_]);return x?(0,U.jsx)("div",{className:y,onClick:v,onKeyDown:e=>"Enter"===e.key||" "===e.key?v():null,role:"treeitem",tabIndex:0,children:l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("input",{type:"radio",id:C,name:f,value:c.value,onChange:a(c),onClick:e=>e.stopPropagation(),checked:n,className:"woocommerce-search-list__item-input",...m}),(0,U.jsx)(Dt,{item:c,search:i}),g?(0,U.jsx)(Nt,{label:e||c.count}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:n,...!n&&c.children.some((e=>d.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:Lt((0,It.decodeEntities)(c.name),i),onChange:()=>{n?a(Pt(d,c.children,"id"))():a(function(e,t){const o=Pt(t,e,"id");return[...e,...o]}(d,c.children))()},onClick:e=>e.stopPropagation()}),g?(0,U.jsx)(Nt,{label:e||c.count}):null]})}):(0,U.jsxs)("label",{htmlFor:C,className:y,children:[l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("input",{...m,type:"radio",id:C,name:f,value:c.value,onChange:a(c),checked:n,className:"woocommerce-search-list__item-input"}),(0,U.jsx)(Dt,{item:c,search:i})]}):(0,U.jsx)(h.CheckboxControl,{...m,id:C,name:f,className:"woocommerce-search-list__item-input",value:(0,It.decodeEntities)(c.value),label:Lt((0,It.decodeEntities)(c.name),i),onChange:a(c),checked:n}),g?(0,U.jsx)(Nt,{label:e||c.count}):null]})},Ft=Bt;var qt=o(2624),Mt=o(3028);o(5022);const Vt=({id:e,label:t,popoverContents:o,remove:r,screenReaderLabel:c,className:n=""})=>{const[l,a]=(0,s.useState)(!1),i=(0,E.useInstanceId)(Vt);if(c=c||t,!t)return null;t=(0,It.decodeEntities)(t);const d=(0,ct.A)("woocommerce-tag",n,{"has-remove":!!r}),u=`woocommerce-tag__label-${i}`,m=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"screen-reader-text",children:c}),(0,U.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,U.jsxs)("span",{className:d,children:[o?(0,U.jsx)(h.Button,{className:"woocommerce-tag__text",id:u,onClick:()=>a(!0),children:m}):(0,U.jsx)("span",{className:"woocommerce-tag__text",id:u,children:m}),o&&l&&(0,U.jsx)(h.Popover,{onClose:()=>a(!1),children:o}),r&&(0,U.jsx)(h.Button,{className:"woocommerce-tag__remove",onClick:r(e),label:(0,C.sprintf)(
// Translators: %s label.
// Translators: %s label.
(0,C.__)("Remove %s","woocommerce"),t),"aria-describedby":u,children:(0,U.jsx)(A.A,{icon:Mt.A,size:20,className:"clear-icon",role:"img"})})]})},Ht=Vt;o(1939);const Ut=e=>(0,U.jsx)(Ft,{...e}),$t=e=>{const{list:t,selected:o,renderItem:r,depth:c=0,onSelect:n,instanceId:l,isSingle:a,search:i,useExpandedPanelId:d}=e,[u]=d;return t?(0,U.jsx)(U.Fragment,{children:t.map((t=>{const m=t.children?.length&&!a?t.children.every((({id:e})=>o.find((t=>t.id===e)))):!!o.find((({id:e})=>e===t.id)),p=t.children?.length&&u===t.id;return(0,U.jsxs)(s.Fragment,{children:[(0,U.jsx)("li",{children:r({item:t,isSelected:m,onSelect:n,isSingle:a,selected:o,search:i,depth:c,useExpandedPanelId:d,controlId:l})}),p?(0,U.jsx)($t,{...e,list:t.children,depth:c+1}):null]},t.id)}))}):null},Gt=({isLoading:e,isSingle:t,selected:o,messages:r,onChange:c,onRemove:n})=>{if(e||t||!o)return null;const s=o.length;return(0,U.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,U.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,U.jsx)("strong",{children:r.selected(s)}),s>0?(0,U.jsx)(h.Button,{variant:"link",isDestructive:!0,onClick:()=>c([]),"aria-label":r.clear,children:(0,C.__)("Clear all","woocommerce")}):null]}),s>0?(0,U.jsx)("ul",{children:o.map(((e,t)=>(0,U.jsx)("li",{children:(0,U.jsx)(Ht,{label:e.name,id:e.id,remove:n})},t)))}):null]})},Qt=({filteredList:e,search:t,onSelect:o,instanceId:r,useExpandedPanelId:c,...n})=>{const{messages:s,renderItem:l,selected:a,isSingle:i}=n,d=l||Ut;return 0===e.length?(0,U.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,U.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,U.jsx)(A.A,{icon:qt.A,role:"img"})}),(0,U.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,C.sprintf)(s.noResults,t):s.noItems})]}):(0,U.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,U.jsx)($t,{useExpandedPanelId:c,list:e,selected:a,renderItem:d,onSelect:o,instanceId:r,isSingle:i,search:t})})},Wt=e=>{const{className:t="",isCompact:o,isHierarchical:r,isLoading:c,isSingle:n,list:l,messages:a=Tt,onChange:i,onSearch:d,selected:u,type:m="text",debouncedSpeak:p}=e,[_,g]=(0,s.useState)(""),w=(0,s.useState)(-1),x=(0,E.useInstanceId)(Wt),b=(0,s.useMemo)((()=>({...Tt,...a})),[a]),y=(0,s.useMemo)((()=>((e,t,o)=>{if(!t)return o?Ot(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),c=e.map((e=>!!r.test(e.name)&&e)).filter(Boolean);return o?Ot(c,e):c})(l,_,r)),[l,_,r]);(0,s.useEffect)((()=>{p&&p(b.updated)}),[p,b]),(0,s.useEffect)((()=>{"function"==typeof d&&d(_)}),[_,d]);const f=(0,s.useCallback)((e=>()=>{n&&i([]);const t=u.findIndex((({id:t})=>t===e));i([...u.slice(0,t),...u.slice(t+1)])}),[n,u,i]),v=(0,s.useCallback)((e=>()=>{Array.isArray(e)?i(e):-1===u.findIndex((({id:t})=>t===e.id))?i(n?[e]:[...u,e]):f(e.id)()}),[n,f,i,u]),k=(0,s.useCallback)((e=>{const[t]=u.filter((t=>!e.find((e=>t.id===e.id))));f(t.id)()}),[f,u]);return(0,U.jsxs)("div",{className:(0,ct.A)("woocommerce-search-list",t,{"is-compact":o,"is-loading":c,"is-token":"token"===m}),children:["text"===m&&(0,U.jsx)(Gt,{...e,onRemove:f,messages:b}),(0,U.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===m?(0,U.jsx)(h.TextControl,{label:b.search,type:"search",value:_,onChange:e=>g(e)}):(0,U.jsx)(h.FormTokenField,{disabled:c,label:b.search,onChange:k,onInputChange:e=>g(e),suggestions:[],__experimentalValidateInput:()=>!1,value:c?[(0,C.__)("Loading…","woocommerce")]:u.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})}),c?(0,U.jsx)("div",{className:"woocommerce-search-list__list",children:(0,U.jsx)(h.Spinner,{})}):(0,U.jsx)(Qt,{...e,search:_,filteredList:y,messages:b,onSelect:v,instanceId:x,useExpandedPanelId:w})]})},Kt=((0,h.withSpokenMessages)(Wt),async e=>{if(!("json"in e))return{code:e.code||"",message:e.message,type:e.type||"general"};try{const t=await e.json();return{code:t.code||"",message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}});const Zt=window.wp.escapeHtml,zt=({message:e,type:t})=>e?"general"===t?(0,U.jsxs)("span",{children:[(0,C.__)("The following error was returned","woocommerce"),(0,U.jsx)("br",{}),(0,U.jsx)("code",{children:(0,Zt.escapeHTML)(e)})]}):"api"===t?(0,U.jsxs)("span",{children:[(0,C.__)("The following error was returned from the API","woocommerce"),(0,U.jsx)("br",{}),(0,U.jsx)("code",{children:(0,Zt.escapeHTML)(e)})]}):e:(0,C.__)("An error has prevented the block from being updated.","woocommerce"),Yt=({error:e})=>(0,U.jsx)("div",{className:"wc-block-error-message",children:zt(e)});var Xt=o(1609);const Jt=({className:e,item:t,isSelected:o,isLoading:r,onSelect:c,disabled:n,...s})=>(0,U.jsxs)(U.Fragment,{children:[(0,Xt.createElement)(Bt,{...s,key:t.id,className:e,isSelected:o,item:t,onSelect:c,disabled:n}),o&&r&&(0,U.jsx)("div",{className:(0,ct.A)("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active"),children:(0,U.jsx)(h.Spinner,{})},"loading")]}),eo=((0,I.getSetting)("attributes",[]).reduce(((e,t)=>{const o=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label,orderby:r.attribute_orderby}:null;var r;return o&&o.id&&e.push(o),e}),[]),e=>{const{count:t,id:o,name:r,parent:c}=e;return{count:t,id:o,name:r,parent:c,breadcrumbs:[],children:[],value:(0,Me.isAttributeTerm)(e)?e.attr_slug:""}});o(2663);const to=(0,E.withInstanceId)((({onChange:e,onOperatorChange:t,instanceId:o,isCompact:r=!1,messages:c={},operator:n="any",selected:l,type:a="text"})=>{const{errorLoadingAttributes:i,isLoadingAttributes:d,productsAttributes:u}=function(e){const[t,o]=(0,s.useState)(null),[r,c]=(0,s.useState)(!1),[n,l]=(0,s.useState)([]),a=(0,s.useRef)(!1);return(0,s.useEffect)((()=>{if(e&&!r&&!a.current)return async function(){c(!0);try{const e=await pe()({path:"wc/store/v1/products/attributes"}),t=[];for(const o of e){const e=await Ce(o.id);t.push({...o,parent:0,terms:e.map((e=>({...e,attr_slug:o.taxonomy,parent:o.id})))})}l(t),a.current=!0}catch(e){e instanceof Error&&o(await Kt(e))}finally{c(!1)}}(),()=>{a.current=!0}}),[r,e]),{errorLoadingAttributes:t,isLoadingAttributes:r,productsAttributes:n}}(!0),m=u.reduce(((e,t)=>{const{terms:o,...r}=t;return[...e,eo(r),...o.map(eo)]}),[]);return c={clear:(0,C.__)("Clear all product attributes","woocommerce"),noItems:(0,C.__)("Your store doesn't have any product attributes.","woocommerce"),search:(0,C.__)("Search for product attributes","woocommerce"),selected:e=>(0,C.sprintf)(/* translators: %d is the count of attributes selected. */ /* translators: %d is the count of attributes selected. */
(0,C._n)("%d attribute selected","%d attributes selected",e,"woocommerce"),e),updated:(0,C.__)("Product attribute search results updated.","woocommerce"),...c},i?(0,U.jsx)(Yt,{error:i}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Wt,{className:"woocommerce-product-attributes",isCompact:r,isHierarchical:!0,isLoading:d,isSingle:!1,list:m,messages:c,onChange:e,renderItem:e=>{const{item:t,search:r,depth:c=0}=e,n=t.count||0,s=["woocommerce-product-attributes__item","woocommerce-search-list__item",{"is-searching":r.length>0,"is-skip-level":0===c&&0!==t.parent}];if(!t.breadcrumbs.length)return(0,U.jsx)(Jt,{...e,className:(0,ct.A)(s),item:t,isLoading:d,disabled:0===t.count,name:`attributes-${o}`,countLabel:(0,C.sprintf)(/* translators: %d is the count of terms. */ /* translators: %d is the count of terms. */
(0,C._n)("%d term","%d terms",n,"woocommerce"),n),"aria-label":(0,C.sprintf)(/* translators: %1$s is the item name, %2$d is the count of terms for the item. */ /* translators: %1$s is the item name, %2$d is the count of terms for the item. */
(0,C._n)("%1$s, has %2$d term","%1$s, has %2$d terms",n,"woocommerce"),t.name,n)});const l=`${t.breadcrumbs[0]}: ${t.name}`;return(0,U.jsx)(Bt,{...e,name:`terms-${o}`,className:(0,ct.A)(...s,"has-count"),countLabel:(0,C.sprintf)(/* translators: %d is the count of products. */ /* translators: %d is the count of products. */
(0,C._n)("%d product","%d products",n,"woocommerce"),n),"aria-label":(0,C.sprintf)(/* translators: %1$s is the attribute name, %2$d is the count of products for that attribute. */ /* translators: %1$s is the attribute name, %2$d is the count of products for that attribute. */
(0,C._n)("%1$s, has %2$d product","%1$s, has %2$d products",n,"woocommerce"),l,n)})},selected:l.map((({id:e})=>m.find((t=>t.id===e)))).filter(Boolean),type:a}),!!t&&(0,U.jsx)("div",{hidden:l.length<2,children:(0,U.jsx)(h.SelectControl,{className:"woocommerce-product-attributes__operator",label:(0,C.__)("Display products matching","woocommerce"),help:(0,C.__)("Pick at least two attributes to use this setting.","woocommerce"),value:n,onChange:t,options:[{label:(0,C.__)("Any selected attributes","woocommerce"),value:"any"},{label:(0,C.__)("All selected attributes","woocommerce"),value:"all"}]})})]})})),oo=`${I.ADMIN_URL}edit.php?post_type=product&page=product_attributes`,ro=({query:e,trackInteraction:t,setQueryAttribute:o})=>{const r=e.woocommerceAttributes||[],c=r?.map((({termId:e})=>({id:e}))),n=()=>{o({woocommerceAttributes:q.woocommerceAttributes}),t(f.ATTRIBUTES)};return(0,U.jsxs)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Product Attributes","woocommerce"),hasValue:()=>!!r?.length,onDeselect:n,resetAllFilter:n,children:[(0,U.jsx)(to,{messages:{search:(0,C.__)("Attributes","woocommerce")},selected:c||[],onChange:e=>{const r=e.map((({id:e,value:t})=>({termId:e,taxonomy:t})));o({woocommerceAttributes:r}),t(f.ATTRIBUTES)},operator:"any",isCompact:!0,type:"token"}),(0,U.jsx)(h.ExternalLink,{className:"wc-block-editor-product-collection-panel__manage-attributes-link",href:oo,children:(0,C.__)("Manage attributes","woocommerce")})]})},co={_fields:"id,name",order:"asc",orderby:"name",context:"view"},no=e=>{var t;const o=e.match(/^(?:(.+) )?\(#(\d+)\)$/);return!!o&&{name:null!==(t=o[1])&&void 0!==t?t:"",id:parseInt(o[2],10)}},so=({taxonomy:e,termIds:t,onChange:o})=>{const{existingTerms:r,isLoadingExistingTerms:c}=(0,l.useSelect)((o=>{if(!t||!t.length)return{existingTerms:[],isLoadingExistingTerms:!1};const{getEntityRecords:r,hasFinishedResolution:c}=o("core"),n=["taxonomy",e.slug,{...co,include:t}];return{existingTerms:r(...n),isLoadingExistingTerms:!c("getEntityRecords",n)}}),[e,t]),[n,a]=(0,s.useState)(""),{searchTerms:i}=(0,l.useSelect)((o=>{if(n.length<=1)return{searchTerms:[]};const{getEntityRecords:r}=o("core");return{searchTerms:r("taxonomy",e.slug,{...co,exclude:t,search:n})}}),[e,t,n]),d=(0,E.useDebounce)(a,250),u=new Set,m=new Set,p=e=>(u.has(e.name)&&m.add(e.name),u.add(e.name),(e=>`${e.name} (#${e.id})`)(e)),_=r?r.map(p):[],g=i?i.map(p):[];if(r&&t.length!==r.length){const e=r.reduce(((e,t)=>(e[t.id]=t,e)),{});t.forEach((t=>{e[t]||_.push(`(#${t})`)}))}return(0,U.jsx)("div",{className:"wc-block-editor-product-collection-inspector__taxonomy-control",children:(0,U.jsx)(h.FormTokenField,{label:e.name,value:_,onInputChange:d,onChange:e=>{const t=[];e.forEach((e=>{const o=no(e);o&&t.push(o.id)})),o(t)},suggestions:g,disabled:c,displayTransform:e=>{const t=no(e);return t&&(e=t.name?m.has(t.name)?`${t.name} (#${t.id})`:t.name:`(#${t.id} ${(0,C.__)("Missing","woocommerce")})`),(0,It.decodeEntities)(e)||""},__experimentalShowHowTo:!1})})},lo=function({setQueryAttribute:e,trackInteraction:t,query:o}){const{taxQuery:r}=o,c=(()=>{const e=(0,l.useSelect)((e=>{const{getTaxonomies:t}=e(a.store);return t({type:"product",per_page:-1})}),[]);return(0,s.useMemo)((()=>e?.filter((({visibility:e})=>!!e?.publicly_queryable))),[e])})();if(!c||0===c.length)return null;const n=e=>e?e.split(" ").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" "):"";return(0,U.jsx)(U.Fragment,{children:c.map((o=>{const{slug:c,name:s}=o,l=r?.[c]||[],a=o=>{e({taxQuery:{...r,[c]:o}}),t(`${f.TAXONOMY}__${c}`)},i=()=>{a([]),t(`${f.TAXONOMY}__${c}`)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:n(s),hasValue:()=>l.length,onDeselect:i,resetAllFilter:i,children:(0,U.jsx)(so,{taxonomy:o,termIds:l,onChange:a},c)},c)}))})},ao=({query:e,trackInteraction:t,setQueryAttribute:o})=>{const r=(_e.productCount||0)>100,c=e.woocommerceHandPickedProducts,[n,l]=(0,s.useState)(""),{productsMap:a,productsList:i,productsLoaded:d}=function(e,t,o=[]){const[r,c]=(0,s.useState)(new Map),[n,l]=(0,s.useState)([]),[a,i]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{const r={selected:e?o.map(Number):[],queryArgs:e?{search:t,per_page:40}:{per_page:0}};fe(r).then((e=>{const t=new Map;e.forEach((e=>{t.set(e.id,e),t.set(e.name,e)})),l(e),c(t),i(!0)}))}),[e,t,o]),{productsMap:r,productsList:n,productsLoaded:a}}(r,n,c),u=(0,E.useDebounce)(l,250),m=(0,s.useMemo)((()=>c?.length&&a.size?c.filter((e=>!!a.get(Number(e)))):c||[]),[c,a]);(0,s.useEffect)((()=>{m.length!==c.length&&o({woocommerceHandPickedProducts:m})}),[m,c,o]);const p=(0,s.useCallback)((e=>{const r=e.reduce(((e,t)=>{const o=a.get(t)||a.get(Number(t));return o&&e.add(String(o.id)),e}),new Set);o({woocommerceHandPickedProducts:Array.from(r)}),t(f.HAND_PICKED)}),[o,t,a]),_=(0,s.useMemo)((()=>i.filter((e=>!m?.includes(String(e.id)))).map((e=>e.name))),[i,m]);return(0,U.jsx)(h.FormTokenField,{displayTransform:e=>{const t=Number(e);if(Number.isNaN(t))return(0,It.decodeEntities)(e)||"";const o=a.get(t);return(0,It.decodeEntities)(o?.name)||""},label:(0,C.__)("Hand-Picked","woocommerce"),onChange:p,onInputChange:r?u:void 0,suggestions:_,__experimentalValidateInput:e=>a.has(e),value:d?m||[]:[(0,C.__)("Loading…","woocommerce")],__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,placeholder:(0,C.__)("Search for products to display…","woocommerce")})},io=({query:e,trackInteraction:t,setQueryAttribute:o})=>{const r=e.woocommerceHandPickedProducts,c=()=>{o({woocommerceHandPickedProducts:q.woocommerceHandPickedProducts}),t(f.HAND_PICKED)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Hand-Picked","woocommerce"),hasValue:()=>!!r?.length,onDeselect:c,resetAllFilter:c,children:(0,U.jsx)(ao,{query:e,trackInteraction:t,setQueryAttribute:o})})},uo=e=>{switch(e){case w.GRID:return(0,C.__)("Display products using rows and columns.","woocommerce");case w.STACK:return(0,C.__)("Display products in a single column.","woocommerce");default:return""}},mo=w.GRID,po=e=>{const{type:t,columns:o,shrinkColumns:r}=e.displayLayout,c=t=>{e.setAttributes({displayLayout:{type:t,columns:o,shrinkColumns:r}})};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Layout","woocommerce"),hasValue:()=>t!==mo,isShownByDefault:!0,onDeselect:()=>{c(w.GRID)},children:(0,U.jsxs)(h.__experimentalToggleGroupControl,{label:(0,C.__)("Layout","woocommerce"),isBlock:!0,onChange:e=>{c(e)},help:uo(t),value:t,children:[(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:w.STACK,label:(0,C.__)("Stack","woocommerce")}),(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:w.GRID,label:(0,C.__)("Grid","woocommerce")})]})})},_o=e=>{const{query:t,trackInteraction:o,setQueryAttribute:r}=e,c=()=>{r({featured:q.featured}),o(f.FEATURED)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Featured","woocommerce"),hasValue:()=>!0===t.featured,onDeselect:c,resetAllFilter:c,children:(0,U.jsx)(h.BaseControl,{id:"product-collection-featured-products-control",label:(0,C.__)("Featured","woocommerce"),children:(0,U.jsx)(h.ToggleControl,{label:(0,C.__)("Show only featured products","woocommerce"),checked:t.featured||!1,onChange:e=>{r({featured:e}),o(f.FEATURED)}})})})},ho=e=>{const{query:t,trackInteraction:o,setQueryAttribute:r}=e,{timeFrame:c}=t,n=()=>{r({timeFrame:q.timeFrame}),o(f.CREATED)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Created","woocommerce"),hasValue:()=>c?.operator&&c?.value,onDeselect:n,resetAllFilter:n,children:(0,U.jsxs)(h.Flex,{direction:"column",gap:3,children:[(0,U.jsx)(h.FlexItem,{children:(0,U.jsxs)(h.__experimentalToggleGroupControl,{label:(0,C.__)("Created","woocommerce"),isBlock:!0,onChange:e=>{r({timeFrame:{...c,operator:e}}),o(f.CREATED)},value:c?.operator||b.IN,children:[(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:b.IN,label:(0,C._x)("Within","Product Collection query operator","woocommerce")}),(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:b.NOT_IN,label:(0,C._x)("Before","Product Collection query operator","woocommerce")})]})}),(0,U.jsx)(h.FlexItem,{children:(0,U.jsx)(h.RadioControl,{onChange:e=>{r({timeFrame:{operator:b.IN,...c,value:e}}),o(f.CREATED)},options:[{label:"last 24 hours",value:"-1 day"},{label:"last 7 days",value:"-7 days"},{label:"last 30 days",value:"-30 days"},{label:"last 3 months",value:"-3 months"}],selected:c?.value})})]})})},go=window.wc.priceFormat,wo=({value:e,onChange:t,label:o})=>{const[r,c]=(0,s.useState)(`${e||""}`),n=(0,go.getCurrency)(),l=((e="",t)=>{const o=e.replace(new RegExp(`[^0-9\\${t.decimalSeparator||""}]`,"g"),"").replace(new RegExp(`\\${t.decimalSeparator}`,"g"),"."),r=Number(o);if(""!==o&&!isNaN(r))return r<0?0:r})(r,n),a=((e,t)=>{if(void 0===e||isNaN(e))return;let o=((e,t)=>{const o=Math.pow(10,t.minorUnit),r=""+Math.round(e*o)/o;let[c,n]=r.split(".");return t.thousandSeparator&&(c=c.replace(/\B(?=(\d{3})+(?!\d))/g,t.thousandSeparator)),n?`${c}${t.decimalSeparator||"."}${n}`:c})(e,t);return t?.prefix&&(o=`${t.prefix}${o}`),t?.suffix&&(o=`${o}${t.suffix}`),o})(l,n);return(0,U.jsx)(h.__experimentalInputControl,{value:a,onChange:e=>{c(e)},onBlur:()=>{t(l)},onKeyDown:e=>{"Enter"===e.key&&t(l)},label:o,prefix:(0,U.jsx)(h.__experimentalInputControlPrefixWrapper,{children:o}),placeholder:(0,C.__)("Auto","woocommerce"),hideLabelFromVision:!0,type:"text",style:{textAlign:"right"},__next40pxDefaultSize:!0})},xo=e=>{const{query:t,trackInteraction:o,setQueryAttribute:r}=e,c=t.priceRange,n=()=>{r({priceRange:q.priceRange}),o(f.PRICE_RANGE)};return(0,U.jsxs)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Price Range","woocommerce"),hasValue:()=>void 0!==c?.min||void 0!==c?.max,onDeselect:n,resetAllFilter:n,className:"wc-block-product-price-range-control",children:[(0,U.jsx)(h.BaseControl.VisualLabel,{children:(0,C.__)("PRICE RANGE","woocommerce")}),(0,U.jsxs)(h.__experimentalHStack,{spacing:"2",children:[(0,U.jsx)(wo,{label:(0,C.__)("MIN","woocommerce"),value:c?.min,onChange:e=>{r({priceRange:{min:0===e?void 0:e,max:c?.max}}),o(f.PRICE_RANGE)}}),(0,U.jsx)(wo,{label:(0,C.__)("MAX","woocommerce"),value:c?.max,onChange:e=>{const t=0===e?void 0:e;r({priceRange:{min:c?.min,max:t}}),o(f.PRICE_RANGE)}})]})]})};var bo=o(4347);var yo=o(923),fo=o.n(yo);const Co=(0,E.createHigherOrderComponent)((e=>{class t extends s.Component{state={error:null,loading:!1,variations:{}};componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:o,showVariations:r}=this.props;r&&(!fo()(e.selected,o)||e.isLoading&&!t)&&this.loadVariations()}loadVariations=()=>{const{products:e}=this.props,{loading:t,variations:o}=this.state;if(t)return;const r=this.getExpandedProduct();if(!r||o[r])return;const c=e.find((e=>e.id===r));var n;c?.variations&&0!==c.variations.length?(this.setState({loading:!0}),(n=r,pe()({path:(0,ue.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:n})})).then((e=>{const t=e.map((e=>({...e,parent:r})));this.setState({variations:{...this.state.variations,[r]:t},loading:!1,error:null})})).catch((async e=>{const t=await Kt(e);this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:t})}))):this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:null})};isProductId(e){const{products:t}=this.props;return t.some((t=>t.id===e))}findParentProduct(e){const{products:t}=this.props,o=t.filter((t=>t.variations&&t.variations.find((({id:t})=>t===e))));return o[0]?.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:o}=this.props;if(!o)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:!this.prevSelectedItem||e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:o}=this.props,{error:r,loading:c,variations:n}=this.state;return(0,U.jsx)(e,{...this.props,error:r||t,expandedProduct:this.getExpandedProduct(),isLoading:o,variations:n,variationsLoading:c})}}return t}),"withProductVariations"),vo=e=>{const{id:t,name:o,parent:r}=e;return{id:t,name:o,parent:r,breadcrumbs:[],children:[],details:e,value:e.slug}};o(5653);const ko={list:(0,C.__)("Products","woocommerce"),noItems:(0,C.__)("Your store doesn't have any products.","woocommerce"),search:(0,C.__)("Search for a product to display","woocommerce"),updated:(0,C.__)("Product search results updated.","woocommerce")},So=(e=>t=>{let{selected:o}=t;o=void 0===o?null:o;const r=null===o;return Array.isArray(o)?(0,U.jsx)(e,{...t}):(0,U.jsx)(e,{...t,selected:r?[]:[o]})})((Io=Co((0,E.withInstanceId)((e=>{const{expandedProduct:t=null,error:o,instanceId:r,isCompact:c=!1,isLoading:n,onChange:s,onSearch:l,products:a,renderItem:i,selected:d=[],showVariations:u=!1,variations:m,variationsLoading:p}=e;if(o)return(0,U.jsx)(Yt,{error:o});const _=[...a,...m&&t&&m[t]?m[t]:[]].map(vo);return(0,U.jsx)(Wt,{className:"woocommerce-products",list:_,isCompact:c,isLoading:n,isSingle:!0,selected:_.filter((({id:e})=>d.includes(Number(e)))),onChange:s,renderItem:i||(u?e=>{const{item:t,search:o,depth:c=0,isSelected:s,onSelect:l}=e,a=t.details?.variations&&Array.isArray(t.details.variations)?t.details.variations.length:0,i=(0,ct.A)("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${c}`,"has-count",{"is-searching":o.length>0,"is-skip-level":0===c&&0!==t.parent,"is-variable":a>0});if(!t.breadcrumbs.length){const o=t.details?.variations&&t.details.variations.length>0;return(0,U.jsx)(Jt,{...e,className:(0,ct.A)(i,{"is-selected":s}),isSelected:s,item:t,onSelect:()=>()=>{l(t)()},isLoading:n||p,countLabel:o?(0,C.sprintf)(/* translators: %1$d is the number of variations of a product product. */ /* translators: %1$d is the number of variations of a product product. */
(0,C.__)("%1$d variations","woocommerce"),t.details?.variations.length):null,name:`products-${r}`,"aria-label":o?(0,C.sprintf)(/* translators: %1$s is the product name, %2$d is the number of variations of that product. */ /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
(0,C._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.details?.variations?.length,"woocommerce"),t.name,t.details?.variations.length):void 0})}const d=(0,Me.isEmpty)(t.details?.variation)?e:{...e,item:{...e.item,name:t.details?.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.details?.variation}`};return(0,U.jsx)(Bt,{...d,className:i,name:`variations-${r}`})}:void 0),onSearch:l,messages:{...ko,...e.messages},isHierarchical:!0})}))),({selected:e,...t})=>{const[o,r]=(0,s.useState)(!0),[c,n]=(0,s.useState)(null),[l,a]=(0,s.useState)([]),i=_e.productCount>100,d=async e=>{const t=await Kt(e);n(t),r(!1)},u=(0,s.useRef)(e);(0,s.useEffect)((()=>{fe({selected:u.current}).then((e=>{a(e),r(!1)})).catch(d)}),[u]);const m=(0,bo.YQ)((t=>{fe({selected:e,search:t}).then((e=>{a(e),r(!1)})).catch(d)}),400),p=(0,s.useCallback)((e=>{r(!0),m(e)}),[r,m]);return(0,U.jsx)(Io,{...t,selected:e,error:c,products:l,isLoading:o,onSearch:i?p:null})})),jo="product",Eo="cart",Ro="order",Ao=({isOpen:e,onToggle:t,product:o,isLoading:r})=>{if(r&&!o)return(0,U.jsx)(h.Spinner,{});const c=!o,n=c||!o?.images?.[0]?.src,s=n?`${he}/blocks/product-collection/placeholder.svg`:o.images[0].src,l=n?"":o?.name;return(0,U.jsx)(h.Button,{className:"wc-block-product-collection-linked-product-control__button",onClick:t,"aria-expanded":e,disabled:r,children:(0,U.jsxs)(h.Flex,{direction:"row",expanded:!0,justify:"flex-start",children:[(0,U.jsx)(h.FlexItem,{className:"wc-block-product-collection-linked-product-control__image-container",children:(0,U.jsx)("img",{src:s,alt:l})}),(0,U.jsx)(h.Flex,{direction:"column",align:"flex-start",gap:1,className:"wc-block-product-collection-linked-product-control__content",children:c?(0,U.jsx)(h.FlexItem,{children:(0,U.jsx)(h.__experimentalText,{color:"inherit",lineHeight:1,children:(0,C.__)("Select product","woocommerce")})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h.FlexItem,{children:(0,U.jsx)(h.__experimentalText,{color:"inherit",lineHeight:1,children:o?.name?(0,It.decodeEntities)(o.name):""})}),(0,U.jsx)(h.FlexItem,{children:(0,U.jsx)(h.__experimentalText,{color:"inherit",lineHeight:1,children:o?.sku})})]})})]})})},Po=({query:e,setAttributes:t,setIsDropdownOpen:o})=>(0,U.jsx)(So,{selected:e?.productReference,onChange:(r=[])=>{var c;const n=null!==(c=r[0]?.id)&&void 0!==c?c:null;null!==n&&(t({query:{...e,productReference:n}}),o(!1))},messages:{search:(0,C.__)("Select a product","woocommerce")}});var Io,To=function(e){return e.CURRENT_PRODUCT="CURRENT_PRODUCT",e.SPECIFIC_PRODUCT="SPECIFIC_PRODUCT",e}(To||{});const Oo=({query:e,setAttributes:t,location:o,usesReference:r})=>{const c=o.type===jo,n=!!r?.includes(jo),l=o.type===Eo,a=!!r?.includes(Eo),i=o.type===Ro,d=!!r?.includes(Ro),{productReference:u}=e,{product:m,isLoading:p}=(e=>{const[t,o]=(0,s.useState)(null),[r,c]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{(async()=>{if(e){c(!0);try{const t=await(e=>pe()({path:`/wc/store/v1/products/${e}`}))(e);o(t)}catch(e){o(null)}finally{c(!1)}}else o(null),c(!1)})()}),[e]),{product:t,isLoading:r}})(u),[_,g]=(0,s.useState)(!1),[w,x]=(0,s.useState)((c||l||i)&&(0,Me.isEmpty)(u)?To.CURRENT_PRODUCT:To.SPECIFIC_PRODUCT),b=(0,s.useRef)(void 0),y=c&&n||l&&a||i&&d,f=y?w===To.SPECIFIC_PRODUCT:!(0,Me.isEmpty)(u);if(!y&&!f||!(n||a||d))return null;const v=w===To.CURRENT_PRODUCT?(0,C.__)("Linked products will be pulled from the product a shopper is currently viewing","woocommerce"):(0,C.__)("Select a product to pull the linked products from","woocommerce"),k=((e,t,o)=>e===Eo&&t?(0,C.__)("From products in the cart","woocommerce"):e===Ro&&o?(0,C.__)("From products in the order","woocommerce"):(0,C.__)("From the current product","woocommerce"))(o.type,a,d);return(0,U.jsxs)(h.PanelBody,{title:(0,C.__)("Linked Product","woocommerce"),children:[y&&(0,U.jsx)(h.PanelRow,{children:(0,U.jsx)(h.RadioControl,{className:"wc-block-product-collection-product-reference-radio",label:(0,C.__)("Products to show","woocommerce"),help:v,selected:w,options:[{label:k,value:To.CURRENT_PRODUCT},{label:(0,C.__)("From a specific product","woocommerce"),value:To.SPECIFIC_PRODUCT}],onChange:o=>{if(o===To.CURRENT_PRODUCT){const{productReference:o,...r}=e;b.current=o,t({query:r})}else t({query:b.current?{...e,productReference:b.current}:e});x(o)}})}),f&&(0,U.jsx)(h.PanelRow,{children:(0,U.jsx)(h.Dropdown,{className:"wc-block-product-collection-linked-product-control",contentClassName:"wc-block-product-collection-linked-product__popover-content",popoverProps:{placement:"left-start"},renderToggle:({isOpen:e,onToggle:t})=>(0,U.jsx)(Ao,{isOpen:e,onToggle:t,product:m,isLoading:p}),renderContent:()=>(0,U.jsx)(Po,{query:e,setAttributes:t,setIsDropdownOpen:g}),open:_,onToggle:()=>g(!_)})})]})},Lo=({dimensions:e,setAttributes:t})=>{const{widthType:o,fixedWidth:r=""}=e;return(0,U.jsxs)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Width","woocommerce"),hasValue:()=>o!==x.FILL,isShownByDefault:!0,children:[(0,U.jsxs)(h.__experimentalToggleGroupControl,{label:(0,C.__)("Width","woocommerce"),value:o,help:(c=o,c===x.FILL?(0,C.__)("Stretch to fill available space.","woocommerce"):(0,C.__)("Specify a fixed width.","woocommerce")),onChange:o=>(o=>{t({dimensions:{...e,widthType:o}})})(o),isBlock:!0,children:[(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:x.FILL,label:(0,C.__)("Fill","woocommerce")}),(0,U.jsx)(h.__experimentalToggleGroupControlOption,{value:x.FIXED,label:(0,C.__)("Fixed","woocommerce")})]}),o===x.FIXED&&(0,U.jsx)(h.__experimentalUnitControl,{onChange:o=>{t({dimensions:{...e,fixedWidth:o}})},value:r})]});var c},No=({query:e,setQueryAttribute:t,trackInteraction:o})=>{const r=e?.relatedBy,c=(e,c)=>{const n={...r,[c]:e};t({relatedBy:n}),o(f.RELATED_BY)};return(0,U.jsx)(h.PanelBody,{title:(0,C.__)("Related by","woocommerce"),children:(0,U.jsxs)("div",{className:"wc-block-editor-product-collection-inspector-controls__relate-by",children:[(0,U.jsx)(h.CheckboxControl,{label:(0,C.__)("Categories","woocommerce"),checked:r?.categories,onChange:e=>{c(e,"categories")}}),(0,U.jsx)(h.CheckboxControl,{label:(0,C.__)("Tags","woocommerce"),checked:r?.tags,onChange:e=>{c(e,"tags")}})]})})},Do=({query:e,setQueryAttribute:t,trackInteraction:o})=>{const r=()=>{t({perPage:B.perPage}),o(f.PRODUCTS_PER_PAGE)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Products per page","woocommerce"),isShownByDefault:!0,hasValue:()=>e.perPage!==B.perPage,onDeselect:r,resetAllFilter:r,children:(0,U.jsx)(h.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,C.__)("Products per page","woocommerce"),min:1,max:100,onChange:e=>{isNaN(e)||e<1||e>100||(t({perPage:e}),o(f.PRODUCTS_PER_PAGE))},value:e.perPage||B.perPage})})},Bo=({query:e,setQueryAttribute:t,trackInteraction:o})=>{const r=()=>{t({offset:B.offset}),o(f.OFFSET)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Offset","woocommerce"),hasValue:()=>e.offset!==B.offset,onDeselect:r,resetAllFilter:r,children:(0,U.jsx)(h.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,C.__)("Offset","woocommerce"),value:e.offset,min:0,onChange:e=>{isNaN(e)||e<0||e>100||(t({offset:e}),o(f.OFFSET))}})})},Fo=({query:e,setQueryAttribute:t,trackInteraction:o})=>{const r=()=>{t({pages:B.pages}),o(f.MAX_PAGES_TO_SHOW)};return(0,U.jsx)(h.__experimentalToolsPanelItem,{label:(0,C.__)("Max pages to show","woocommerce"),hasValue:()=>e.pages!==B.pages,onDeselect:r,resetAllFilter:r,children:(0,U.jsx)(h.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,C.__)("Max pages to show","woocommerce"),value:e.pages,min:0,onChange:e=>{isNaN(e)||e<0||(t({pages:e}),o(f.MAX_PAGES_TO_SHOW))},help:(0,C.__)("Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).","woocommerce")})})},qo=e=>{const{attributes:t,context:o,setAttributes:r}=e,{query:l,hideControls:a,dimensions:i,displayLayout:d}=t,u=rt(o.templateSlug),m=e=>j("blocks_product_collection_inspector_control_clicked",{collection:t.collection,location:u,filter:e}),p=l?.inherit||!1,_=(e=>t=>!e.includes(t))(a),g="product-catalog"===u||"product-archive"===u,w=!1===p,x=g&&_(f.INHERIT),b=!g&&_(f.FILTERABLE),y=w&&_(f.ORDER),v=!w,k=w&&_(f.OFFSET),S=w&&_(f.MAX_PAGES_TO_SHOW),E=w&&_(f.PRODUCTS_PER_PAGE),R=_(f.ON_SALE),A=_(f.STOCK_STATUS),P=_(f.HAND_PICKED),I=_(f.KEYWORD),T=_(f.ATTRIBUTES),O=_(f.TAXONOMY),L=_(f.FEATURED),N=_(f.CREATED),D=_(f.PRICE_RANGE),q={setAttributes:r,displayLayout:d},M={setAttributes:r,dimensions:i},V={setQueryAttribute:(0,s.useMemo)((()=>ve.bind(null,e)),[e]),trackInteraction:m,query:l};return(0,U.jsxs)(n.InspectorControls,{children:[(0,U.jsx)(Oo,{query:e.attributes.query,setAttributes:e.setAttributes,usesReference:e.usesReference,location:e.location}),(0,U.jsxs)(h.__experimentalToolsPanel,{label:(0,C.__)("Settings","woocommerce"),resetAll:()=>{const t=(o=e.attributes,{displayLayout:Re(),query:(r=o.query,{...r,orderBy:B.orderBy,order:B.order,inherit:je(),filterable:Ee(),perPage:B.perPage,offset:B.offset,pages:B.pages}),dimensions:F.dimensions});var o,r;e.setAttributes(t)},className:"wc-block-editor-product-collection__settings_panel",children:[x&&(0,U.jsx)(bt,{...V}),b&&(0,U.jsx)(yt,{...V}),y&&(0,U.jsx)(St,{...V}),v&&(0,U.jsx)(vt,{trackInteraction:m}),(0,U.jsx)(po,{...q}),(0,U.jsx)(Lo,{...M}),E&&(0,U.jsx)(Do,{...V}),(0,U.jsx)(mt,{...q}),k&&(0,U.jsx)(Bo,{...V}),S&&(0,U.jsx)(Fo,{...V})]}),w?(0,U.jsxs)(h.__experimentalToolsPanel,{label:(0,C.__)("Filters","woocommerce"),resetAll:e=>{e.forEach((e=>{e()}))},className:"wc-block-editor-product-collection-inspector-toolspanel__filters",children:[R&&(0,U.jsx)(jt,{...V}),A&&(0,U.jsx)(Rt,{...V}),P&&(0,U.jsx)(io,{...V}),I&&(0,U.jsx)(At,{...V}),T&&(0,U.jsx)(ro,{...V}),O&&(0,U.jsx)(lo,{...V}),L&&(0,U.jsx)(_o,{...V}),N&&(0,U.jsx)(ho,{...V}),D&&(0,U.jsx)(xo,{...V})]}):null,(0,U.jsx)(Je,{blockName:`${c.title} block`,wrapper:h.PanelBody})]})},Mo=e=>e===c.name,Vo=e=>{const t=e+2592e5;return Date.now()<t},Ho=(e=0)=>e<=4,Uo=e=>{const t=(0,s.useMemo)((()=>ve.bind(null,e)),[e]),o=rt(e.context.templateSlug),r={setQueryAttribute:t,trackInteraction:t=>j("blocks_product_collection_inspector_control_clicked",{collection:e.attributes.collection,location:o,filter:t}),query:e.attributes.query};return(0,U.jsxs)(n.InspectorControls,{children:["woocommerce/product-collection/hand-picked"===e.attributes.collection&&(0,U.jsx)(h.PanelBody,{children:(0,U.jsx)(ao,{...r})}),"woocommerce/product-collection/related"===e.attributes.collection&&(0,U.jsx)(No,{...r})]})};(0,de.addFilter)("editor.BlockEdit",c.name,(e=>t=>Mo(t.name)&&t.isSelected?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Uo,{...t}),(0,U.jsx)(e,{...t})]}):(0,U.jsx)(e,{...t}))),(0,de.addFilter)("editor.BlockEdit",c.name,(e=>t=>{if(!Mo(t.name))return(0,U.jsx)(e,{...t});const o=(e=>{const{attributes:t}=e,{convertedFromProducts:o}=t,{status:r,time:c,displayCount:n}=$e();return o&&"notseen"===r&&Vo(c)&&Ho(n)})(t),r=(e=>{const{attributes:t}=e,{convertedFromProducts:o}=t,{status:r,time:c,displayCount:n}=$e();return o&&("seen"===r||!Vo(c)||!Ho(n))})(t);return r&&t.setAttributes({convertedFromProducts:!1}),(0,U.jsxs)(U.Fragment,{children:[o&&(0,U.jsx)(n.InspectorControls,{children:(0,U.jsx)(at,{revertMigration:ze})}),(0,U.jsx)(e,{...t})]})}));const $o=(0,C.__)("Enable to enforce full page reload on certain interactions, like using paginations controls.","woocommerce"),Go=(0,C.__)("Browsing between pages requires a full page reload.","woocommerce"),Qo=(0,C.__)("Reload full page can't be disabled because there are incompatible blocks inside the Product Collection block.","woocommerce"),Wo=e=>{const{clientId:t,forcePageReload:o,setAttributes:c}=e,a=(e=>(0,l.useSelect)((t=>{const{getClientIdsOfDescendants:o,getBlockName:c}=t(n.store);return o(e).find((e=>!(e=>{const t=Object.is((0,r.getBlockSupport)(e,"interactivity"),!0),o=(0,r.getBlockSupport)(e,"interactivity.clientNavigation");return t||o})(c(e))))||!1}),[e]))(t);(0,s.useEffect)((()=>{!o&&a&&c({forcePageReload:!0})}),[o,a,c]);let i=$o;return o&&(i=Go),a&&(i=Qo),(0,U.jsx)(h.ToggleControl,{label:(0,C.__)("Reload full page","woocommerce"),help:i,checked:o,onChange:()=>c({forcePageReload:!o}),disabled:a})};function Ko(e){const{clientId:t,attributes:o,setAttributes:r}=e,{forcePageReload:c}=o;return(0,U.jsx)(n.InspectorAdvancedControls,{children:(0,U.jsx)(Wo,{clientId:t,forcePageReload:c,setAttributes:r})})}var Zo=o(8940),zo=o(9264);const Yo=e=>{const{type:t,columns:o,shrinkColumns:r}=e.displayLayout,c=t=>{e.setAttributes({displayLayout:t})},n=[{icon:Zo.A,title:(0,C.__)("List view","woocommerce"),onClick:()=>c({type:w.STACK,columns:o,shrinkColumns:r}),isActive:t===w.STACK},{icon:zo.A,title:(0,C.__)("Grid view","woocommerce"),onClick:()=>c({type:w.GRID,columns:o,shrinkColumns:r}),isActive:t===w.GRID}];return(0,U.jsx)(h.ToolbarGroup,{controls:n})},Xo=e=>(0,U.jsx)(h.ToolbarGroup,{children:(0,U.jsx)(h.ToolbarButton,{onClick:e.openCollectionSelectionModal,children:(0,C.__)("Choose collection","woocommerce")})});function Jo(e){const{attributes:t,openCollectionSelectionModal:o,setAttributes:r}=e,{query:c,displayLayout:s}=t,l=ie(e.attributes.collection),a=l?.scope?.includes("block")||void 0===l?.scope;return(0,U.jsxs)(n.BlockControls,{children:[a&&(0,U.jsx)(Xo,{openCollectionSelectionModal:o}),!c.inherit&&(0,U.jsx)(Yo,{displayLayout:s,setAttributes:r})]})}const er=({preview:{setPreviewState:e,initialPreviewState:t}={},...o})=>{const r=(0,s.useRef)(!1),{clientId:c,attributes:a,setAttributes:d,location:u,isUsingReferencePreviewMode:m}=o;(({setPreviewState:e,location:t,attributes:o,setAttributes:r,isUsingReferencePreviewMode:c})=>{const n=e=>{r({__privatePreviewState:{...o.__privatePreviewState,...e}})},l=((e,t)=>t?e.type===i.Product?(0,C.__)("Actual products will vary depending on the product being viewed.","woocommerce"):(0,C.__)("Actual products will vary depending on the page being viewed.","woocommerce"):"")(t,c);(0,s.useLayoutEffect)((()=>{c&&r({__privatePreviewState:{isPreview:l.length>0,previewMessage:l}})}),[r,l,c]),(0,s.useLayoutEffect)((()=>{if(!e&&!c)return;const r=e?.({setState:n,location:t,attributes:o});return r||void 0}),[e]);const a=t.type===i.Archive?t.sourceData?.termId:null;(0,s.useLayoutEffect)((()=>{if(!e&&!c){const e=t.type===i.Archive&&null===a;r({__privatePreviewState:{isPreview:!!e&&!!o?.query?.inherit,previewMessage:(0,C.__)("Actual products will vary depending on the page being viewed.","woocommerce")}})}}),[o?.query?.inherit,l,a,t.type,r,e,c])})({setPreviewState:e,setAttributes:d,location:u,attributes:a,isUsingReferencePreviewMode:m});const p=(0,n.useBlockProps)(),_=(0,n.useInnerBlocksProps)(p,{template:H}),g=((e,t,o)=>{const r=(0,E.useInstanceId)(o),{getBlockParentsByBlockName:c}=(0,l.useSelect)(n.store);let a=r;return(0,s.useMemo)((()=>c(e,"core/block")),[c,e]).length>0&&(a=t.queryId),a})(c,a,er),w={...F,query:{...F.query,inherit:je(),filterable:Ee()},...a,queryId:g,...!!a.collection&&t&&{__privatePreviewState:t}};let b={};return x.FIXED===a?.dimensions?.widthType&&a?.dimensions?.fixedWidth&&(b={maxWidth:a.dimensions.fixedWidth,margin:"0 auto"}),(0,s.useEffect)((()=>{d(w),r.current=!0}),[]),r.current=r.current||Be()(a,w),r.current?(0,U.jsxs)("div",{...p,children:[a.__privatePreviewState?.isPreview&&o.isSelected&&(0,U.jsx)(h.Button,{variant:"primary",size:"small",showTooltip:!0,label:a.__privatePreviewState?.previewMessage,className:"wc-block-product-collection__preview-button","data-testid":"product-collection-preview-button",children:"Preview"}),(0,U.jsx)(qo,{...o}),(0,U.jsx)(Ko,{...o}),(0,U.jsx)(Jo,{...o}),(0,U.jsx)("div",{..._,style:b})]}):null},tr=er,or=e=>{const{clientId:t,attributes:o,tracksLocation:r,closePatternSelectionModal:c}=e,{collection:a}=o,{replaceBlock:i}=(0,l.useDispatch)(n.store),[d,u]=(0,s.useState)(a),m=e=>{j("blocks_product_collection_collection_replaced_from_placeholder",{action:e,location:r}),c()};return(0,U.jsx)(h.Modal,{overlayClassName:"wc-blocks-product-collection__modal",title:(0,C.__)("What products do you want to show?","woocommerce"),onRequestClose:()=>m("close"),size:"large",children:(0,U.jsxs)("div",{className:"wc-blocks-product-collection__content",children:[(0,U.jsx)(Le,{chosenCollection:d,onCollectionClick:u}),(0,U.jsxs)("div",{className:"wc-blocks-product-collection__footer",children:[(0,U.jsx)(h.Button,{variant:"tertiary",onClick:()=>m("cancel"),children:(0,C.__)("Cancel","woocommerce")}),(0,U.jsx)(h.Button,{variant:"primary",onClick:()=>{d&&(j("blocks_product_collection_collection_replaced_from_placeholder",{from:a,to:d,location:r}),Ae(d,t,i))},children:(0,C.__)("Continue","woocommerce")})]})]})})},rr=e=>{const t=(0,n.useBlockProps)(),{attributes:o,isDeletedProductReference:r}=e,c=ie(o.collection);if(!c)return null;const l=r?(0,C.__)("Previously selected product is no longer available.","woocommerce"):(0,s.createInterpolateElement)((0,C.sprintf)(/* translators: %s: collection title */ /* translators: %s: collection title */
(0,C.__)("<strong>%s</strong> requires a product to be selected in order to display associated items.","woocommerce"),c.title),{strong:(0,U.jsx)("strong",{})});return(0,U.jsx)("div",{...t,children:(0,U.jsxs)(h.Placeholder,{className:"wc-blocks-product-collection__editor-product-picker",children:[(0,U.jsxs)(h.__experimentalHStack,{alignment:"center",children:[(0,U.jsx)(A.A,{icon:qt.A,className:"wc-blocks-product-collection__info-icon"}),(0,U.jsx)(h.__experimentalText,{children:l})]}),(0,U.jsx)(So,{selected:o.query?.productReference,onChange:(t=[])=>{var r;null!==(null!==(r=t[0]?.id)&&void 0!==r?r:null)&&e.setAttributes({query:{...o.query,productReference:t[0].id}})},messages:{search:(0,C.__)("Select a product","woocommerce")}})]})})};var cr=o(7715);function nr(e,{blockDescription:t,blockIcon:o,blockTitle:c,variationName:n,scope:s}){(0,r.registerBlockVariation)(e,{description:t,name:n,title:c,isActive:e=>e.__woocommerceNamespace===n,icon:{src:o},attributes:{__woocommerceNamespace:n},scope:s})}const sr=(0,C.__)("Product Summary","woocommerce"),lr=(A.A,cr.A,(0,C.__)("Display a short description about a product.","woocommerce")),ar=`${c.name}/product-summary`;var ir=o(8992);const dr=JSON.parse('{"title":"Product Title","description":"Display the title of a product."}'),ur=`${c.name}/product-title`;(0,r.registerBlockType)(c,{icon:()=>(0,U.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,U.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 11H5C4.72386 11 4.5 11.2239 4.5 11.5V17.5C4.5 17.7761 4.72386 18 5 18H19C19.2761 18 19.5 17.7761 19.5 17.5V11.5C19.5 11.2239 19.2761 11 19 11ZM5 9.5H19C20.1046 9.5 21 10.3954 21 11.5V17.5C21 18.6046 20.1046 19.5 19 19.5H5C3.89543 19.5 3 18.6046 3 17.5V11.5C3 10.3954 3.89543 9.5 5 9.5Z",fill:"currentColor"}),(0,U.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 7.5C18 7.77614 17.7761 8 17.5 8L6.5 8C6.22386 8 6 7.77614 6 7.5V7.5C6 7.22386 6.22386 7 6.5 7L17.5 7C17.7761 7 18 7.22386 18 7.5V7.5Z",fill:"currentColor"}),(0,U.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 5C16 5.27614 15.7761 5.5 15.5 5.5L8.5 5.5C8.22386 5.5 8 5.27614 8 5V5C8 4.72386 8.22386 4.5 8.5 4.5L15.5 4.5C15.7761 4.5 16 4.72386 16 5V5Z",fill:"currentColor"})]}),edit:e=>{const{clientId:t,attributes:o,context:r}=e,c=((e,t)=>{const o=e.templateSlug||"",r=e.postId||null,c=(e=>t=>e.replace(`${t}-`,""))(o),a=(e=>t=>e.includes(t)&&e!==t)(o),h=a(d),g=a(u),w=a(m),[x,b]=(0,s.useState)(null),[y,f]=(0,s.useState)(null),[C,v]=(0,s.useState)(null);(0,s.useEffect)((()=>{if(h){const e=c(d);p("postType","product",e,b)}if(g){const e=c(u);p("taxonomy","product_cat",e,f)}if(w){const e=c(m);p("taxonomy","product_tag",e,v)}}),[h,g,w,c]);const{isInSingleProductBlock:k,isInSomeCartCheckoutBlock:S}=(0,l.useSelect)((e=>{const{getBlockParentsByBlockName:o}=e(n.store),r=e=>o(t,e).length>0;return{isInSingleProductBlock:r(["woocommerce/single-product"]),isInSomeCartCheckoutBlock:r(["woocommerce/cart","woocommerce/checkout","woocommerce/mini-cart-contents"])}}),[t]);if(k)return _(i.Product,{productId:r});if(S)return _(i.Cart);if(h)return _(i.Product,{productId:x});const j=(e=>t=>e===t)(o);if(j(d))return _(i.Product,{productId:null});if(g)return _(i.Archive,{taxonomy:"product_cat",termId:y});if(w)return _(i.Archive,{taxonomy:"product_tag",termId:C});if(j(u))return _(i.Archive,{taxonomy:"product_cat",termId:null});if(j(m))return _(i.Archive,{taxonomy:"product_tag",termId:null});if(j("taxonomy-product_attribute"))return _(i.Archive,{taxonomy:null,termId:null});if("page-cart"===o||"page-checkout"===o)return _(i.Cart);const E=j("order-confirmation");return _(E?i.Order:i.Site)})(r,t),w=rt(r.templateSlug),[x,b]=(0,s.useState)(!1),y=(0,l.useSelect)((e=>!!e(n.store).getBlocks(t).length),[t]),{productCollectionUIStateInEditor:f,isLoading:C}=(({location:e,usesReference:t,attributes:o,hasInnerBlocks:r})=>{const c=o.query?.productReference,{product:n,hasResolved:d}=(0,l.useSelect)((e=>{if(!c)return{product:null,hasResolved:!0};const{getEntityRecord:t,hasFinishedResolution:o}=e(a.store),r=["postType","product",c];return{product:t(...r),hasResolved:o("getEntityRecord",r)}}),[c]);return{productCollectionUIStateInEditor:(0,s.useMemo)((()=>{var s;const l=t?.includes(e.type),a=!!o.collection,d=t?.includes("product"),u=null!==(null!==(s=o.query?.productReference)&&void 0!==s?s:null);if(a&&d&&!l&&!u)return g.PRODUCT_REFERENCE_PICKER;if(a&&d&&!l&&u&&c&&(void 0===n||"trash"===n?.status))return g.DELETED_PRODUCT_REFERENCE;if(l){var m,p;const t=e.type===i.Archive&&null!==(null!==(m=e.sourceData?.termId)&&void 0!==m?m:null),o=e.type===i.Product&&null!==(null!==(p=e.sourceData?.productId)&&void 0!==p?p:null);if(!t&&!o&&!c)return g.VALID_WITH_PREVIEW}return r||a?g.VALID:g.COLLECTION_PICKER}),[e.type,e.sourceData?.termId,e.sourceData?.productId,t,o.collection,c,n,r,o.query?.productReference]),isLoading:!d}})({location:c,attributes:o,hasInnerBlocks:y,usesReference:e.usesReference});if(C)return(0,U.jsx)(h.Flex,{justify:"center",align:"center",children:(0,U.jsx)(h.Spinner,{})});const v={...e,openCollectionSelectionModal:()=>b(!0),location:c,isUsingReferencePreviewMode:f===g.VALID_WITH_PREVIEW};return(0,U.jsxs)(U.Fragment,{children:[(()=>{switch(f){case g.COLLECTION_PICKER:return(0,U.jsx)(Ne,{...e,tracksLocation:w});case g.PRODUCT_REFERENCE_PICKER:return(0,U.jsx)(rr,{...e,isDeletedProductReference:!1});case g.DELETED_PRODUCT_REFERENCE:return(0,U.jsx)(rr,{...e,isDeletedProductReference:!0});case g.VALID:case g.VALID_WITH_PREVIEW:return(0,U.jsx)(tr,{...v});default:return(0,U.jsx)(Ne,{...e,tracksLocation:w})}})(),x&&(0,U.jsx)(or,{clientId:t,attributes:o,tracksLocation:w,closePatternSelectionModal:()=>b(!1)})]})},save:function({attributes:{tagName:e="div"}}){const t=n.useBlockProps.save(),o=n.useInnerBlocksProps.save(t);return(0,U.jsx)(e,{...o})}}),nr("core/post-excerpt",{blockDescription:lr,blockIcon:(0,U.jsx)(h.Icon,{icon:cr.A}),blockTitle:sr,variationName:ar,scope:[]}),nr("core/post-title",{blockDescription:dr.description,blockIcon:(0,U.jsx)(h.Icon,{icon:ir.A}),blockTitle:dr.title,variationName:ur,scope:["block","inserter"]}),ae.forEach((e=>(0,R.__experimentalRegisterProductCollection)(e))),(0,de.addFilter)("blocks.registerBlockType","woocommerce/add-product-collection-block-to-parent-array-of-pagination-block",((e,t)=>t!==V?e:e?.ancestor?{...e,ancestor:[...e.ancestor,c.name]}:e?.parent?{...e,parent:[...e.parent,c.name]}:e))},2663:()=>{},5653:()=>{},1939:()=>{},5022:()=>{},9969:()=>{},1609:e=>{"use strict";e.exports=window.React},790:e=>{"use strict";e.exports=window.ReactJSXRuntime},9491:e=>{"use strict";e.exports=window.wp.compose},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},923:e=>{"use strict";e.exports=window.wp.isShallowEqual},5573:e=>{"use strict";e.exports=window.wp.primitives}},c={};function n(e){var t=c[e];if(void 0!==t)return t.exports;var o=c[e]={exports:{}};return r[e].call(o.exports,o,o.exports,n),o.exports}n.m=r,e=[],n.O=(t,o,r,c)=>{if(!o){var s=1/0;for(d=0;d<e.length;d++){for(var[o,r,c]=e[d],l=!0,a=0;a<o.length;a++)(!1&c||s>=c)&&Object.keys(n.O).every((e=>n.O[e](o[a])))?o.splice(a--,1):(l=!1,c<s&&(s=c));if(l){e.splice(d--,1);var i=r();void 0!==i&&(t=i)}}return t}c=c||0;for(var d=e.length;d>0&&e[d-1][2]>c;d--)e[d]=e[d-1];e[d]=[o,r,c]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var c=Object.create(null);n.r(c);var s={};t=t||[null,o({}),o([]),o(o)];for(var l=2&r&&e;"object"==typeof l&&!~t.indexOf(l);l=o(l))Object.getOwnPropertyNames(l).forEach((t=>s[t]=()=>e[t]));return s.default=()=>e,n.d(c,s),c},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.j=5201,(()=>{var e={5201:0};n.O.j=t=>0===e[t];var t=(t,o)=>{var r,c,[s,l,a]=o,i=0;if(s.some((t=>0!==e[t]))){for(r in l)n.o(l,r)&&(n.m[r]=l[r]);if(a)var d=a(n)}for(t&&t(o);i<s.length;i++)c=s[i],n.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return n.O(d)},o=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var s=n.O(void 0,[94],(()=>n(5074)));s=n.O(s),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-collection"]=s})();

Youez - 2016 - github.com/yon3zu
LinuXploit