%PDF- %PDF-
Direktori : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/blocks/ |
Current File : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/blocks/product-on-sale.js |
(()=>{var e,t,r,l={9939:(e,t,r)=>{"use strict";r.r(t);var l=r(1609),o=r(7723);const c=window.wp.blocks;var n=r(7104),a=r(1173);const i=window.wp.components,s=window.wp.serverSideRender;var m=r.n(s);const d=(0,l.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},(0,l.createElement)("title",null,"Grid Block Preview"),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,l.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,l.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"})),u=window.wp.blockEditor,h=({onChange:e,settings:t})=>{const{image:r,button:c,price:n,rating:a,title:s}=t,m=!1!==r;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.ToggleControl,{label:(0,o.__)("Product image","woocommerce"),checked:m,onChange:()=>e({...t,image:!m})}),(0,l.createElement)(i.ToggleControl,{label:(0,o.__)("Product title","woocommerce"),checked:s,onChange:()=>e({...t,title:!s})}),(0,l.createElement)(i.ToggleControl,{label:(0,o.__)("Product price","woocommerce"),checked:n,onChange:()=>e({...t,price:!n})}),(0,l.createElement)(i.ToggleControl,{label:(0,o.__)("Product rating","woocommerce"),checked:a,onChange:()=>e({...t,rating:!a})}),(0,l.createElement)(i.ToggleControl,{label:(0,o.__)("Add to Cart button","woocommerce"),checked:c,onChange:()=>e({...t,button:!c})}))},E=(e,t,r)=>r?Math.min(e,t)===e?t:Math.max(e,r)===e?r:e:Math.max(e,t)===t?e:t,g=({columns:e,rows:t,setAttributes:r,alignButtons:c,minColumns:n=1,maxColumns:a=6,minRows:s=1,maxRows:m=6})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.RangeControl,{label:(0,o.__)("Columns","woocommerce"),value:e,onChange:e=>{const t=E(e,n,a);r({columns:Number.isNaN(t)?"":t})},min:n,max:a}),(0,l.createElement)(i.RangeControl,{label:(0,o.__)("Rows","woocommerce"),value:t,onChange:e=>{const t=E(e,s,m);r({rows:Number.isNaN(t)?"":t})},min:s,max:m}),(0,l.createElement)(i.ToggleControl,{label:(0,o.__)("Align the last block to the bottom","woocommerce"),help:c?(0,o.__)("Align the last block to the bottom.","woocommerce"):(0,o.__)("The last inner block will follow other content.","woocommerce"),checked:c,onChange:()=>r({alignButtons:!c})}));var w=r(851),p=r(6087);function _(e,t,r){const l=new Set(t.map((e=>e[r])));return e.filter((e=>!l.has(e[r])))}const f=window.wp.htmlEntities,b={clear:(0,o.__)("Clear all selected items","woocommerce"),noItems:(0,o.__)("No items found.","woocommerce"), /* Translators: %s search term */ noResults:(0,o.__)("No results for %s","woocommerce"),search:(0,o.__)("Search for items","woocommerce"),selected:e=>(0,o.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */ (0,o._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,o.__)("Search results updated.","woocommerce")},x=(e,t=e)=>{const r=e.reduce(((e,t)=>{const r=t.parent||0;return e[r]||(e[r]=[]),e[r].push(t),e}),{}),l=("id",t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{}));const o=["0"],c=(e={})=>e.parent?[...c(l[e.parent]),e.name]:e.name?[e.name]:[],n=e=>e.map((e=>{const t=r[e.id];return o.push(""+e.id),{...e,breadcrumbs:c(l[e.parent]),children:t&&t.length?n(t):[]}})),a=n(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{o.includes(e)||a.push(...n(t||[]))})),a},y=(e,t)=>{if(!t)return e;const r=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(r).map(((e,t)=>r.test(e)?(0,l.createElement)("strong",{key:t},e):(0,l.createElement)(p.Fragment,{key:t},e)))},v=({label:e})=>(0,l.createElement)("span",{className:"woocommerce-search-list__item-count"},e),k=e=>{const{item:t,search:r}=e,o=t.breadcrumbs&&t.breadcrumbs.length;return(0,l.createElement)("span",{className:"woocommerce-search-list__item-label"},o?(0,l.createElement)("span",{className:"woocommerce-search-list__item-prefix"},1===(c=t.breadcrumbs).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,l.createElement)("span",{className:"woocommerce-search-list__item-name"},y((0,f.decodeEntities)(t.name),r)));var c},C=({countLabel:e,className:t,depth:r=0,controlId:o="",item:c,isSelected:n,isSingle:a,onSelect:s,search:m="",selected:d,useExpandedPanelId:u,...h})=>{var E,g;const[b,x]=u,C=null!=e&&void 0!==c.count&&null!==c.count,S=!(null===(E=c.breadcrumbs)||void 0===E||!E.length),N=!(null===(g=c.children)||void 0===g||!g.length),O=b===c.id,P=(0,w.A)(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":S,"has-children":N,"has-count":C,"is-expanded":O,"is-radio-button":a});(0,p.useEffect)((()=>{N&&n&&x(c.id)}),[c,N,n,x]);const A=h.name||`search-list-item-${o}`,I=`${A}-${c.id}`,R=(0,p.useCallback)((()=>{x(O?-1:Number(c.id))}),[O,c.id,x]);return N?(0,l.createElement)("div",{className:P,onClick:R,onKeyDown:e=>"Enter"===e.key||" "===e.key?R():null,role:"treeitem",tabIndex:0},a?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("input",{type:"radio",id:I,name:A,value:c.value,onChange:s(c),onClick:e=>e.stopPropagation(),checked:n,className:"woocommerce-search-list__item-input",...h}),(0,l.createElement)(k,{item:c,search:m}),C?(0,l.createElement)(v,{label:e||c.count}):null):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(i.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:n,...!n&&c.children.some((e=>d.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:y((0,f.decodeEntities)(c.name),m),onChange:()=>{n?s(_(d,c.children,"id"))():s(function(e,t,r){const l=_(t,e,"id");return[...e,...l]}(d,c.children))()},onClick:e=>e.stopPropagation()}),C?(0,l.createElement)(v,{label:e||c.count}):null)):(0,l.createElement)("label",{htmlFor:I,className:P},a?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("input",{...h,type:"radio",id:I,name:A,value:c.value,onChange:s(c),checked:n,className:"woocommerce-search-list__item-input"}),(0,l.createElement)(k,{item:c,search:m})):(0,l.createElement)(i.CheckboxControl,{...h,id:I,name:A,className:"woocommerce-search-list__item-input",value:(0,f.decodeEntities)(c.value),label:y((0,f.decodeEntities)(c.name),m),onChange:s(c),checked:n}),C?(0,l.createElement)(v,{label:e||c.count}):null)},S=C;var N=r(2478),O=r(9491),P=r(2370);r(6636);const A=({id:e,label:t,popoverContents:r,remove:c,screenReaderLabel:a,className:s=""})=>{const[m,d]=(0,p.useState)(!1),u=(0,O.useInstanceId)(A);if(a=a||t,!t)return null;t=(0,f.decodeEntities)(t);const h=(0,w.A)("woocommerce-tag",s,{"has-remove":!!c}),E=`woocommerce-tag__label-${u}`,g=(0,l.createElement)(l.Fragment,null,(0,l.createElement)("span",{className:"screen-reader-text"},a),(0,l.createElement)("span",{"aria-hidden":"true"},t));return(0,l.createElement)("span",{className:h},r?(0,l.createElement)(i.Button,{className:"woocommerce-tag__text",id:E,onClick:()=>d(!0)},g):(0,l.createElement)("span",{className:"woocommerce-tag__text",id:E},g),r&&m&&(0,l.createElement)(i.Popover,{onClose:()=>d(!1)},r),c&&(0,l.createElement)(i.Button,{className:"woocommerce-tag__remove",onClick:c(e),label:(0,o.sprintf)( // Translators: %s label. // Translators: %s label. (0,o.__)("Remove %s","woocommerce"),t),"aria-describedby":E},(0,l.createElement)(n.A,{icon:P.A,size:20,className:"clear-icon",role:"img"})))},I=A;r(8137);const R=e=>(0,l.createElement)(S,{...e}),B=e=>{const{list:t,selected:r,renderItem:o,depth:c=0,onSelect:n,instanceId:a,isSingle:i,search:s,useExpandedPanelId:m}=e,[d]=m;return t?(0,l.createElement)(p.Fragment,null,t.map((t=>{var u,h;const E=null!==(u=t.children)&&void 0!==u&&u.length&&!i?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),g=(null===(h=t.children)||void 0===h?void 0:h.length)&&d===t.id;return(0,l.createElement)(p.Fragment,{key:t.id},(0,l.createElement)("li",null,o({item:t,isSelected:E,onSelect:n,isSingle:i,selected:r,search:s,depth:c,useExpandedPanelId:m,controlId:a})),g?(0,l.createElement)(B,{...e,list:t.children,depth:c+1}):null)}))):null},j=({isLoading:e,isSingle:t,selected:r,messages:c,onChange:n,onRemove:a})=>{if(e||t||!r)return null;const s=r.length;return(0,l.createElement)("div",{className:"woocommerce-search-list__selected"},(0,l.createElement)("div",{className:"woocommerce-search-list__selected-header"},(0,l.createElement)("strong",null,c.selected(s)),s>0?(0,l.createElement)(i.Button,{variant:"link",isDestructive:!0,onClick:()=>n([]),"aria-label":c.clear},(0,o.__)("Clear all","woocommerce")):null),s>0?(0,l.createElement)("ul",null,r.map(((e,t)=>(0,l.createElement)("li",{key:t},(0,l.createElement)(I,{label:e.name,id:e.id,remove:a}))))):null)},T=({filteredList:e,search:t,onSelect:r,instanceId:c,useExpandedPanelId:a,...i})=>{const{messages:s,renderItem:m,selected:d,isSingle:u}=i,h=m||R;return 0===e.length?(0,l.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},(0,l.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},(0,l.createElement)(n.A,{icon:N.A,role:"img"})),(0,l.createElement)("span",{className:"woocommerce-search-list__not-found-text"},t?(0,o.sprintf)(s.noResults,t):s.noItems)):(0,l.createElement)("ul",{className:"woocommerce-search-list__list"},(0,l.createElement)(B,{useExpandedPanelId:a,list:e,selected:d,renderItem:h,onSelect:r,instanceId:c,isSingle:u,search:t}))},$=e=>{const{className:t="",isCompact:r,isHierarchical:c,isLoading:n,isSingle:a,list:s,messages:m=b,onChange:d,onSearch:u,selected:h,type:E="text",debouncedSpeak:g}=e,[_,f]=(0,p.useState)(""),y=(0,p.useState)(-1),v=(0,O.useInstanceId)($),k=(0,p.useMemo)((()=>({...b,...m})),[m]),C=(0,p.useMemo)((()=>((e,t,r)=>{if(!t)return r?x(e):e;const l=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map((e=>!!l.test(e.name)&&e)).filter(Boolean);return r?x(o,e):o})(s,_,c)),[s,_,c]);(0,p.useEffect)((()=>{g&&g(k.updated)}),[g,k]),(0,p.useEffect)((()=>{"function"==typeof u&&u(_)}),[_,u]);const S=(0,p.useCallback)((e=>()=>{a&&d([]);const t=h.findIndex((({id:t})=>t===e));d([...h.slice(0,t),...h.slice(t+1)])}),[a,h,d]),N=(0,p.useCallback)((e=>()=>{Array.isArray(e)?d(e):-1===h.findIndex((({id:t})=>t===e.id))?d(a?[e]:[...h,e]):S(e.id)()}),[a,S,d,h]),P=(0,p.useCallback)((e=>{const[t]=h.filter((t=>!e.find((e=>t.id===e.id))));S(t.id)()}),[S,h]);return(0,l.createElement)("div",{className:(0,w.A)("woocommerce-search-list",t,{"is-compact":r,"is-loading":n,"is-token":"token"===E})},"text"===E&&(0,l.createElement)(j,{...e,onRemove:S,messages:k}),(0,l.createElement)("div",{className:"woocommerce-search-list__search"},"text"===E?(0,l.createElement)(i.TextControl,{label:k.search,type:"search",value:_,onChange:e=>f(e)}):(0,l.createElement)(i.FormTokenField,{disabled:n,label:k.search,onChange:P,onInputChange:e=>f(e),suggestions:[],__experimentalValidateInput:()=>!1,value:n?[(0,o.__)("Loading…","woocommerce")]:h.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})),n?(0,l.createElement)("div",{className:"woocommerce-search-list__list"},(0,l.createElement)(i.Spinner,null)):(0,l.createElement)(T,{...e,search:_,filteredList:C,messages:k,onSelect:N,instanceId:v,useExpandedPanelId:y}))},F=((0,i.withSpokenMessages)($),window.wp.url),M=window.wp.apiFetch;var L=r.n(M);const H=window.wc.wcSettings,D=window.wp.escapeHtml,V=({error:e})=>(0,l.createElement)("div",{className:"wc-block-error-message"},(({message:e,type:t})=>e?"general"===t?(0,l.createElement)("span",null,(0,o.__)("The following error was returned","woocommerce"),(0,l.createElement)("br",null),(0,l.createElement)("code",null,(0,D.escapeHTML)(e))):"api"===t?(0,l.createElement)("span",null,(0,o.__)("The following error was returned from the API","woocommerce"),(0,l.createElement)("br",null),(0,l.createElement)("code",null,(0,D.escapeHTML)(e))):e:(0,o.__)("An error has prevented the block from being updated.","woocommerce"))(e)),W=e=>{const{id:t,name:r,parent:l,count:o}=e;return{id:t,name:r,parent:l,count:o,breadcrumbs:[],children:[],details:e,value:e.slug}};r(6876);const J=(X=({categories:e=[],error:t=null,isLoading:r=!1,onChange:c,onOperatorChange:n,operator:a="any",selected:s,isCompact:m=!1,isSingle:d=!1,showReviewCount:u})=>{const h={clear:(0,o.__)("Clear all product categories","woocommerce"),list:(0,o.__)("Product Categories","woocommerce"),noItems:(0,o.__)("Your store doesn't have any product categories.","woocommerce"),search:(0,o.__)("Search for product categories","woocommerce"),selected:e=>(0,o.sprintf)(/* translators: %d is the count of selected categories. */ /* translators: %d is the count of selected categories. */ (0,o._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,o.__)("Category search results updated.","woocommerce")};if(t)return(0,l.createElement)(V,{error:t});const E=e.map(W);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)($,{className:"woocommerce-product-categories",list:E,isLoading:r,selected:E.filter((({id:e})=>s.includes(Number(e)))),onChange:c,renderItem:e=>{var t,r,c,n,a,i,s,m;const{item:d,search:h,depth:E=0}=e,g=d.breadcrumbs.length?`${d.breadcrumbs.join(", ")}, ${d.name}`:d.name,p=u?(0,o.sprintf)(/* translators: %1$s is the item name, %2$d is the count of reviews for the item. */ /* translators: %1$s is the item name, %2$d is the count of reviews for the item. */ (0,o._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",(null===(t=d.details)||void 0===t?void 0:t.review_count)||0,"woocommerce"),g,(null===(r=d.details)||void 0===r?void 0:r.review_count)||0):(0,o.sprintf)(/* translators: %1$s is the item name, %2$d is the count of products for the item. */ /* translators: %1$s is the item name, %2$d is the count of products for the item. */ (0,o._n)("%1$s, has %2$d product","%1$s, has %2$d products",(null===(c=d.details)||void 0===c?void 0:c.count)||0,"woocommerce"),g,(null===(n=d.details)||void 0===n?void 0:n.count)||0),_=u?(0,o.sprintf)(/* translators: %d is the count of reviews. */ /* translators: %d is the count of reviews. */ (0,o._n)("%d review","%d reviews",(null===(a=d.details)||void 0===a?void 0:a.review_count)||0,"woocommerce"),(null===(i=d.details)||void 0===i?void 0:i.review_count)||0):(0,o.sprintf)(/* translators: %d is the count of products. */ /* translators: %d is the count of products. */ (0,o._n)("%d product","%d products",(null===(s=d.details)||void 0===s?void 0:s.count)||0,"woocommerce"),(null===(m=d.details)||void 0===m?void 0:m.count)||0);return(0,l.createElement)(C,{className:(0,w.A)("woocommerce-product-categories__item","has-count",{"is-searching":h.length>0,"is-skip-level":0===E&&0!==d.parent}),...e,countLabel:_,"aria-label":p})},messages:h,isCompact:m,isHierarchical:!0,isSingle:d}),!!n&&(0,l.createElement)("div",{hidden:s.length<2},(0,l.createElement)(i.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,o.__)("Display products matching","woocommerce"),help:(0,o.__)("Pick at least two categories to use this setting.","woocommerce"),value:a,onChange:n,options:[{label:(0,o.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,o.__)("All selected categories","woocommerce"),value:"all"}]})))},({selected:e,...t})=>{const[r,o]=(0,p.useState)(!0),[c,n]=(0,p.useState)(null),[a,i]=(0,p.useState)([]),s=async e=>{const t=await(async e=>{if(!("json"in e))return{message:e.message,type:e.type||"general"};try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}})(e);n(t),o(!1)},m=(0,p.useRef)(e);return(0,p.useEffect)((()=>{var e;(e={selected:m.current},L()({path:(0,F.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})})).then((e=>{i(e),o(!1)})).catch(s)}),[m]),(0,l.createElement)(X,{...t,selected:e,error:c,categories:a,isLoading:r})}),z=({value:e,setAttributes:t})=>(0,l.createElement)(i.SelectControl,{label:(0,o.__)("Order products by","woocommerce"),value:e,options:[{label:(0,o.__)("Newness - newest first","woocommerce"),value:"date"},{label:(0,o.__)("Price - low to high","woocommerce"),value:"price_asc"},{label:(0,o.__)("Price - high to low","woocommerce"),value:"price_desc"},{label:(0,o.__)("Rating - highest first","woocommerce"),value:"rating"},{label:(0,o.__)("Sales - most first","woocommerce"),value:"popularity"},{label:(0,o.__)("Title - alphabetical","woocommerce"),value:"title"},{label:(0,o.__)("Menu Order","woocommerce"),value:"menu_order"}],onChange:e=>t({orderby:e})}),G=(0,H.getSetting)("hideOutOfStockItems",!1),K=(0,H.getSetting)("stockStatusOptions",{}),Q=({value:e,setAttributes:t})=>{const{outofstock:r,...c}=K,n=G?c:K,a=Object.entries(n).map((([e,t])=>({value:e,label:t}))).filter((e=>!!e.label)),s=Object.keys(n).filter((e=>!!e)),[m,d]=(0,p.useState)(e||s);(0,p.useEffect)((()=>{t({stockStatus:["",...m]})}),[m,t]);const u=(0,p.useCallback)((e=>{const t=m.includes(e),r=m.filter((t=>t!==e));t||(r.push(e),r.sort()),d(r)}),[m]);return(0,l.createElement)(l.Fragment,null,a.map((e=>{const t=m.includes(e.value)?/* translators: %s stock status. */ /* translators: %s stock status. */(0,o.__)('Stock status "%s" visible.',"woocommerce"):/* translators: %s stock status. */ /* translators: %s stock status. */(0,o.__)('Stock status "%s" hidden.',"woocommerce");return(0,l.createElement)(i.ToggleControl,{label:e.label,key:e.value,help:(0,o.sprintf)(t,e.label),checked:m.includes(e.value),onChange:()=>u(e.value)})})))},Y=e=>{const{attributes:t,setAttributes:r}=e,{categories:c,catOperator:n,columns:a,contentVisibility:s,rows:m,orderby:d,alignButtons:E,stockStatus:w}=t;return(0,l.createElement)(u.InspectorControls,{key:"inspector"},(0,l.createElement)(i.PanelBody,{title:(0,o.__)("Layout","woocommerce"),initialOpen:!0},(0,l.createElement)(g,{columns:a,rows:m,alignButtons:E,setAttributes:r,minColumns:(0,H.getSetting)("minColumns",1),maxColumns:(0,H.getSetting)("maxColumns",6),minRows:(0,H.getSetting)("minRows",1),maxRows:(0,H.getSetting)("maxRows",6)})),(0,l.createElement)(i.PanelBody,{title:(0,o.__)("Content","woocommerce"),initialOpen:!0},(0,l.createElement)(h,{settings:s,onChange:e=>r({contentVisibility:e})})),(0,l.createElement)(i.PanelBody,{title:(0,o.__)("Order By","woocommerce"),initialOpen:!1},(0,l.createElement)(z,{setAttributes:r,value:d})),(0,l.createElement)(i.PanelBody,{title:(0,o.__)("Filter by Product Category","woocommerce"),initialOpen:!1},(0,l.createElement)(J,{selected:c,onChange:(e=[])=>{const t=e.map((({id:e})=>e));r({categories:t})},operator:n,onOperatorChange:(e="any")=>r({catOperator:e})})),(0,l.createElement)(i.PanelBody,{title:(0,o.__)("Filter by stock status","woocommerce"),initialOpen:!1},(0,l.createElement)(Q,{setAttributes:r,value:w})))},q=()=>(0,l.createElement)(i.Placeholder,{icon:(0,l.createElement)(n.A,{icon:a.A}),label:(0,o.__)("On Sale Products","woocommerce"),className:"wc-block-product-on-sale"},(0,o.__)("This block shows on-sale products. There are currently no discounted products in your store.","woocommerce")),U=e=>{const{attributes:t,setAttributes:r,name:o}=e,c=(0,u.useBlockProps)();return t.isPreview?(0,l.createElement)("div",{...c},d):(0,l.createElement)("div",{...c},(0,l.createElement)(Y,{attributes:t,setAttributes:r}),(0,l.createElement)(i.Disabled,null,(0,l.createElement)(m(),{block:o,attributes:t,EmptyResponsePlaceholder:q})))};var X;r(6779);const Z={columns:{type:"number",default:(0,H.getSetting)("defaultColumns",3)},rows:{type:"number",default:(0,H.getSetting)("defaultRows",3)},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{image:!0,title:!0,price:!0,rating:!0,button:!0}},isPreview:{type:"boolean",default:!1},stockStatus:{type:"array",default:Object.keys((0,H.getSetting)("stockStatusOptions",[]))}};(0,c.registerBlockType)("woocommerce/product-on-sale",{title:(0,o.__)("On Sale Products","woocommerce"),apiVersion:3,icon:{src:(0,l.createElement)(n.A,{icon:a.A,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[(0,o.__)("WooCommerce","woocommerce")],description:(0,o.__)("Display a grid of products currently on sale.","woocommerce"),supports:{align:["wide","full"],html:!1},attributes:{...Z,orderby:{type:"string",default:"date"}},transforms:{from:[{type:"block",blocks:["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"].filter((e=>"woocommerce/product-on-sale"!==e)),transform:e=>(0,c.createBlock)("woocommerce/product-on-sale",e)}]},edit:e=>(0,l.createElement)(U,{...e}),save:()=>null})},6779:()=>{},6876:()=>{},8137:()=>{},6636:()=>{},1609:e=>{"use strict";e.exports=window.React},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},5573:e=>{"use strict";e.exports=window.wp.primitives}},o={};function c(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return l[e].call(r.exports,r,r.exports,c),r.exports}c.m=l,e=[],c.O=(t,r,l,o)=>{if(!r){var n=1/0;for(m=0;m<e.length;m++){for(var[r,l,o]=e[m],a=!0,i=0;i<r.length;i++)(!1&o||n>=o)&&Object.keys(c.O).every((e=>c.O[e](r[i])))?r.splice(i--,1):(a=!1,o<n&&(n=o));if(a){e.splice(m--,1);var s=l();void 0!==s&&(t=s)}}return t}o=o||0;for(var m=e.length;m>0&&e[m-1][2]>o;m--)e[m]=e[m-1];e[m]=[r,l,o]},c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,l){if(1&l&&(e=this(e)),8&l)return e;if("object"==typeof e&&e){if(4&l&&e.__esModule)return e;if(16&l&&"function"==typeof e.then)return e}var o=Object.create(null);c.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var a=2&l&&e;"object"==typeof a&&!~t.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,c.d(o,n),o},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.j=7686,(()=>{var e={7686:0};c.O.j=t=>0===e[t];var t=(t,r)=>{var l,o,[n,a,i]=r,s=0;if(n.some((t=>0!==e[t]))){for(l in a)c.o(a,l)&&(c.m[l]=a[l]);if(i)var m=i(c)}for(t&&t(r);s<n.length;s++)o=n[s],c.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return c.O(m)},r=self.webpackChunkwebpackWcBlocksMainJsonp=self.webpackChunkwebpackWcBlocksMainJsonp||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var n=c.O(void 0,[94],(()=>c(9939)));n=c.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["product-on-sale"]=n})();