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