uawdijnntqw1x1x1
IP : 216.73.216.109
Hostname : premium160.web-hosting.com
Kernel : Linux premium160.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
batcwwjx
/
www
/
wp-content
/
plugins
/
woocommerce
/
assets
/
client
/
blocks
/
featured-product.js
/
/
(()=>{var e,t,r,o={2195:(e,t,r)=>{"use strict";var o=r(4530),s=r(2108),i=(r(6388),r(210),r(6087)),a=r(9491);const n=window.wp.url,c=window.wp.apiFetch;var l=r.n(c);const d=window.wc.wcSettings,u=(0,d.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),m=u.pluginUrl+"assets/images/",g=(u.pluginUrl,d.STORE_PAGES.shop,d.STORE_PAGES.checkout,d.STORE_PAGES.checkout,d.STORE_PAGES.privacy,d.STORE_PAGES.privacy,d.STORE_PAGES.terms,d.STORE_PAGES.terms,d.STORE_PAGES.cart,d.STORE_PAGES.cart,d.STORE_PAGES.myaccount?.permalink?d.STORE_PAGES.myaccount.permalink:(0,d.getSetting)("wpLoginUrl","/wp-login.php"),(0,d.getSetting)("localPickupEnabled",!1),(0,d.getSetting)("shippingMethodsExist",!1),(0,d.getSetting)("shippingEnabled",!0),(0,d.getSetting)("countries",{})),p=(0,d.getSetting)("countryData",{}),h={...Object.fromEntries(Object.keys(p).filter((e=>!0===p[e].allowBilling)).map((e=>[e,g[e]||""]))),...Object.fromEntries(Object.keys(p).filter((e=>!0===p[e].allowShipping)).map((e=>[e,g[e]||""])))},b=(Object.fromEntries(Object.keys(h).map((e=>[e,p[e].states||{}]))),Object.fromEntries(Object.keys(h).map((e=>[e,p[e].locale||{}]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),_=((0,d.getSetting)("addressFieldsLocations",b).address,(0,d.getSetting)("addressFieldsLocations",b).contact,(0,d.getSetting)("addressFieldsLocations",b).order,(0,d.getSetting)("additionalOrderFields",{}),(0,d.getSetting)("additionalContactFields",{}),(0,d.getSetting)("additionalAddressFields",{}),(e,t)=>{const r=new Map;return e.filter((e=>{const o=t(e);return!r.has(o)&&(r.set(o,e),!0)}))}),w=({selected:e=[],search:t="",queryArgs:r={}})=>{const o=(({selected:e=[],search:t="",queryArgs:r={}})=>{const o=u.productCount>100,s={per_page:o?100:0,catalog_visibility:"any",search:t,orderby:"title",order:"asc"},i=[(0,n.addQueryArgs)("/wc/store/v1/products",{...s,...r})];return o&&e.length&&i.push((0,n.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:0})),i})({selected:e,search:t,queryArgs:r});return Promise.all(o.map((e=>l()({path:e})))).then((e=>{const t=e.flat(),r=_(t,(e=>e.id));return r.map((e=>({...e,parent:0})))})).catch((e=>{throw e}))},x=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"}}};var f=r(790);const v=(0,a.createHigherOrderComponent)((e=>class extends i.Component{state={error:null,loading:!1,product:"preview"===this.props.attributes.productId?this.props.attributes.previewProduct:null};componentDidMount(){this.loadProduct()}componentDidUpdate(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}loadProduct=()=>{const{productId:e}=this.props.attributes;"preview"!==e&&(e?(this.setState({loading:!0}),(e=>l()({path:`/wc/store/v1/products/${e}`}))(e).then((e=>{this.setState({product:e,loading:!1,error:null})})).catch((async e=>{const t=await x(e);this.setState({product:null,loading:!1,error:t})}))):this.setState({product:null,loading:!1,error:null}))};render(){const{error:t,loading:r,product:o}=this.state;return(0,f.jsx)(e,{...this.props,error:t,getProduct:this.loadProduct,isLoading:r,product:o})}}),"withProduct"),y=window.wp.components;var S=r(7723);const j=window.wp.blockEditor;var k=r(3462);const I=e=>{const{id:t,name:r,parent:o}=e;return{id:t,name:r,parent:o,breadcrumbs:[],children:[],details:e,value:e.slug}},C=e=>{const{id:t,name:r,parent:o,count:s}=e;return{id:t,name:r,parent:o,count:s,breadcrumbs:[],children:[],details:e,value:e.slug}},P="woocommerce/featured-category",E="woocommerce/featured-product",N=window.wc.wcTypes;function A(e){return!!e&&(0,N.isNumber)(e.id)&&"string"==typeof e.src}function R({blockName:e,item:t,mediaId:r,mediaSrc:o}){const[s,a]=(0,i.useState)(0),[n,c]=(0,i.useState)(""),[l,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)({height:0,width:0}),g=(0,i.useRef)(null),p=(0,i.useRef)(null);return(0,i.useEffect)((()=>{var o,s;a(r||(e===E?(s=t)&&s.images&&s.images.length&&s.images[0].id||0:(o=t)&&A(o.image)?o.image.id:0))}),[e,t,r]),(0,i.useEffect)((()=>{var r,s;c(o||(e===E?(s=t)&&s.images&&s.images.length&&s.images[0].src||"":(r=t)&&A(r.image)?r.image.src:""))}),[e,t,o]),(0,i.useEffect)((()=>{if(n){g.current||(g.current=new Image),p.current||(p.current=document.createElement("canvas"));const e=g.current,t=p.current;e.src=n,e.onload=()=>{const r=e.naturalWidth,o=e.naturalHeight;null!==o&&null!==r&&m({height:o,width:r}),t.width=r,t.height=o;const s=t.getContext("2d",{willReadFrequently:!0});if(!s)return;s.drawImage(e,0,0,r,o);const i=s.getImageData(0,0,r,o).data,a=(()=>{for(let e=3;e<i.length;e+=4)if(i[e]<255)return!0;return!1})();l!==a&&d(a)}}else d(!0);return()=>{g.current&&(g.current.onload=null)}}),[n]),{backgroundImageId:s,backgroundImageSrc:n,isImageBgTransparent:l,originalImgDimension:u}}const L=({backgroundImageId:e,backgroundImageSrc:t,contentAlign:r,cropLabel:o,editLabel:s,editMode:i,isEditingImage:a,mediaSrc:n,setAttributes:c,setIsEditingImage:l})=>(0,f.jsxs)(j.BlockControls,{children:[(0,f.jsx)(j.AlignmentToolbar,{value:r,onChange:e=>{c({contentAlign:e})}}),(0,f.jsxs)(y.ToolbarGroup,{children:[t&&!a&&(0,f.jsx)(y.ToolbarButton,{onClick:()=>l(!0),icon:k.A,label:o}),(0,f.jsx)(j.MediaReplaceFlow,{mediaId:e,mediaURL:n,accept:"image/*",onSelect:e=>{c({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}),e&&n?(0,f.jsx)(y.ToolbarButton,{onClick:()=>c({mediaId:0,mediaSrc:""}),children:(0,S.__)("Reset","woocommerce")}):null]}),(0,f.jsx)(y.ToolbarGroup,{controls:[{icon:"edit",title:s,onClick:()=>c({editMode:!i}),isActive:i}]})]}),F=({align:e,backgroundImageId:t,backgroundImageSize:r,backgroundImageSrc:o,containerRef:s,isEditingImage:a,setAttributes:n,setIsEditingImage:c})=>{const l=function(e,t){const[r,o]=(0,i.useState)(),s=(0,i.useCallback)((()=>{o(e.current?.clientWidth)}),[e]);return(0,i.useEffect)(s,[s,...t]),(0,i.useEffect)((()=>{if(!e.current)return;const{defaultView:t}=e.current.ownerDocument;return t?(t.addEventListener("resize",s),()=>{t.removeEventListener("resize",s)}):void 0}),[e,s]),r}(s,[e]);return"function"==typeof j.__experimentalImageEditingProvider?(0,f.jsx)(j.__experimentalImageEditingProvider,{id:t,url:o,naturalHeight:r.height||500,naturalWidth:r.width||500,onSaveImage:({id:e,url:t})=>{n({mediaId:e,mediaSrc:t})},isEditing:a,onFinishEditing:()=>c(!1),children:(0,f.jsx)(j.__experimentalImageEditor,{url:o,height:r.height||500,width:r.width||500})}):(0,f.jsx)(j.__experimentalImageEditor,{id:t,url:o,height:r.height||500,width:r.width||500,naturalHeight:r.height,naturalWidth:r.width,onSaveImage:({id:e,url:t})=>{n({mediaId:e,mediaSrc:t})},onFinishEditing:()=>c(!1),clientWidth:l})},T=({alt:e,backgroundImageSrc:t,contentPanel:r,dimRatio:o,focalPoint:s,hasParallax:i,imageFit:a,isRepeated:n,overlayColor:c,overlayGradient:l,setAttributes:d,setGradient:u,showDesc:m,backgroundColorVisibilityStatus:g,backgroundColor:p})=>{const h="function"==typeof y.FocalPointPicker,b=!n&&!i;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(j.InspectorControls,{children:[(0,f.jsxs)(y.PanelBody,{title:(0,S.__)("Content","woocommerce"),children:[(0,f.jsx)(y.ToggleControl,{label:(0,S.__)("Show description","woocommerce"),checked:m,onChange:()=>d({showDesc:!m})}),r]}),!!t&&(0,f.jsxs)(f.Fragment,{children:[h&&(0,f.jsxs)(y.PanelBody,{title:(0,S.__)("Media settings","woocommerce"),children:[(0,f.jsx)(y.ToggleControl,{label:(0,S.__)("Fixed background","woocommerce"),checked:i,onChange:()=>{d({hasParallax:!i})}}),(0,f.jsx)(y.ToggleControl,{label:(0,S.__)("Repeated background","woocommerce"),checked:n,onChange:()=>{d({isRepeated:!n})}}),!n&&(0,f.jsxs)(y.__experimentalToggleGroupControl,{help:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{style:{display:"block",marginBottom:"1em"},children:(0,S.__)("Select “Cover” to have the image automatically fit its container.","woocommerce")}),(0,f.jsx)("span",{children:(0,S.__)("This may affect your ability to freely move the focal point of the image.","woocommerce")})]}),label:(0,S.__)("Image fit","woocommerce"),isBlock:!0,value:a,onChange:e=>d({imageFit:e}),children:[(0,f.jsx)(y.__experimentalToggleGroupControlOption,{label:(0,S.__)("None","woocommerce"),value:"none"}),(0,f.jsx)(y.__experimentalToggleGroupControlOption /* translators: "Cover" is a verb that indicates an image covering the entire container. */,{label:(0,S.__)("Cover","woocommerce"),value:"cover"})]}),(0,f.jsx)(y.FocalPointPicker,{label:(0,S.__)("Focal Point Picker","woocommerce"),url:t,value:s,onChange:e=>d({focalPoint:e})}),b&&(0,f.jsx)(y.TextareaControl,{label:(0,S.__)("Alt text (alternative text)","woocommerce"),value:e,onChange:e=>{d({alt:e})},help:(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(y.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree",children:(0,S.__)("Describe the purpose of the image","woocommerce")})})})]}),(0,f.jsx)(j.__experimentalPanelColorGradientSettings,{__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0,title:(0,S.__)("Overlay","woocommerce"),initialOpen:!0,settings:[{colorValue:c,gradientValue:l,onColorChange:e=>d({overlayColor:e}),onGradientChange:e=>{u(e),d({overlayGradient:e})},label:(0,S.__)("Color","woocommerce")}],children:(0,f.jsx)(y.RangeControl,{label:(0,S.__)("Opacity","woocommerce"),value:o,onChange:e=>d({dimRatio:e}),min:0,max:100,step:10,required:!0})})]})]},"inspector"),(0,f.jsx)(j.InspectorControls,{group:"color",children:g&&!1===g.isBackgroundVisible&&g.message&&p&&(0,f.jsx)("div",{className:"image-bg-color-warning",children:(0,f.jsx)(y.Notice,{status:"warning",isDismissible:!1,children:g.message})})})]})};var O=r(2098),$=r(4921);const M=window.wp.escapeHtml,B=({message:e,type:t})=>e?"general"===t?(0,f.jsxs)("span",{children:[(0,S.__)("The following error was returned","woocommerce"),(0,f.jsx)("br",{}),(0,f.jsx)("code",{children:(0,M.escapeHTML)(e)})]}):"api"===t?(0,f.jsxs)("span",{children:[(0,S.__)("The following error was returned from the API","woocommerce"),(0,f.jsx)("br",{}),(0,f.jsx)("code",{children:(0,M.escapeHTML)(e)})]}):e:(0,S.__)("An error has prevented the block from being updated.","woocommerce"),D=({error:e})=>(0,f.jsx)("div",{className:"wc-block-error-message",children:B(e)});r(3120);const G=({className:e="",error:t,isLoading:r=!1,onRetry:s})=>(0,f.jsxs)(y.Placeholder,{icon:(0,f.jsx)(o.A,{icon:O.A}),label:(0,S.__)("Sorry, an error occurred","woocommerce"),className:(0,$.A)("wc-block-api-error",e),children:[(0,f.jsx)(D,{error:t}),s&&(0,f.jsx)(f.Fragment,{children:r?(0,f.jsx)(y.Spinner,{}):(0,f.jsx)(y.Button,{variant:"secondary",onClick:s,children:(0,S.__)("Retry","woocommerce")})})]});function H(e){return e?`${Math.round(100*e.x)}% ${Math.round(100*e.y)}%`:""}function z(e){return`wc-block-${e.split("/")[1]}`}function V(e){return e===E?(0,S.__)("Previously selected product is no longer available","woocommerce"):(0,S.__)("Previously selected category is no longer available","woocommerce")}var W=r(2624);function U(e,t,r){const o=new Set(t.map((e=>e[r])));return e.filter((e=>!o.has(e[r])))}const q=window.wp.htmlEntities,Y={clear:(0,S.__)("Clear all selected items","woocommerce"),noItems:(0,S.__)("No items found.","woocommerce"), /* Translators: %s search term */ noResults:(0,S.__)("No results for %s","woocommerce"),search:(0,S.__)("Search for items","woocommerce"),selected:e=>(0,S.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */ (0,S._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,S.__)("Search results updated.","woocommerce")},J=(e,t=e)=>{const r=e.reduce(((e,t)=>{const r=t.parent||0;return e[r]||(e[r]=[]),e[r].push(t),e}),{}),o=t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{});const s=["0"],i=(e={})=>e.parent?[...i(o[e.parent]),e.name]:e.name?[e.name]:[],a=e=>e.map((e=>{const t=r[e.id];return s.push(""+e.id),{...e,breadcrumbs:i(o[e.parent]),children:t&&t.length?a(t):[]}})),n=a(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{s.includes(e)||n.push(...a(t||[]))})),n},Q=(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,f.jsx)("strong",{children:e},t):(0,f.jsx)(i.Fragment,{children:e},t)))},K=({label:e})=>(0,f.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),X=e=>{const{item:t,search:r}=e,o=t.breadcrumbs&&t.breadcrumbs.length;return(0,f.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[o?(0,f.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,f.jsx)("span",{className:"woocommerce-search-list__item-name",children:Q((0,q.decodeEntities)(t.name),r)})]});var s},Z=({countLabel:e,className:t,depth:r=0,controlId:o="",item:s,isSelected:a,isSingle:n,onSelect:c,search:l="",selected:d,useExpandedPanelId:u,...m})=>{const[g,p]=u,h=null!=e&&void 0!==s.count&&null!==s.count,b=!!s.breadcrumbs?.length,_=!!s.children?.length,w=g===s.id,x=(0,$.A)(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":b,"has-children":_,"has-count":h,"is-expanded":w,"is-radio-button":n});(0,i.useEffect)((()=>{_&&a&&p(s.id)}),[s,_,a,p]);const v=m.name||`search-list-item-${o}`,S=`${v}-${s.id}`,j=(0,i.useCallback)((()=>{p(w?-1:Number(s.id))}),[w,s.id,p]);return _?(0,f.jsx)("div",{className:x,onClick:j,onKeyDown:e=>"Enter"===e.key||" "===e.key?j():null,role:"treeitem",tabIndex:0,children:n?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("input",{type:"radio",id:S,name:v,value:s.value,onChange:c(s),onClick:e=>e.stopPropagation(),checked:a,className:"woocommerce-search-list__item-input",...m}),(0,f.jsx)(X,{item:s,search:l}),h?(0,f.jsx)(K,{label:e||s.count}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(y.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:a,...!a&&s.children.some((e=>d.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:Q((0,q.decodeEntities)(s.name),l),onChange:()=>{a?c(U(d,s.children,"id"))():c(function(e,t){const r=U(t,e,"id");return[...e,...r]}(d,s.children))()},onClick:e=>e.stopPropagation()}),h?(0,f.jsx)(K,{label:e||s.count}):null]})}):(0,f.jsxs)("label",{htmlFor:S,className:x,children:[n?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("input",{...m,type:"radio",id:S,name:v,value:s.value,onChange:c(s),checked:a,className:"woocommerce-search-list__item-input"}),(0,f.jsx)(X,{item:s,search:l})]}):(0,f.jsx)(y.CheckboxControl,{...m,id:S,name:v,className:"woocommerce-search-list__item-input",value:(0,q.decodeEntities)(s.value),label:Q((0,q.decodeEntities)(s.name),l),onChange:c(s),checked:a}),h?(0,f.jsx)(K,{label:e||s.count}):null]})},ee=Z;var te=r(3028);r(5022);const re=({id:e,label:t,popoverContents:r,remove:s,screenReaderLabel:n,className:c=""})=>{const[l,d]=(0,i.useState)(!1),u=(0,a.useInstanceId)(re);if(n=n||t,!t)return null;t=(0,q.decodeEntities)(t);const m=(0,$.A)("woocommerce-tag",c,{"has-remove":!!s}),g=`woocommerce-tag__label-${u}`,p=(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{className:"screen-reader-text",children:n}),(0,f.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,f.jsxs)("span",{className:m,children:[r?(0,f.jsx)(y.Button,{className:"woocommerce-tag__text",id:g,onClick:()=>d(!0),children:p}):(0,f.jsx)("span",{className:"woocommerce-tag__text",id:g,children:p}),r&&l&&(0,f.jsx)(y.Popover,{onClose:()=>d(!1),children:r}),s&&(0,f.jsx)(y.Button,{className:"woocommerce-tag__remove",onClick:s(e),label:(0,S.sprintf)( // Translators: %s label. // Translators: %s label. (0,S.__)("Remove %s","woocommerce"),t),"aria-describedby":g,children:(0,f.jsx)(o.A,{icon:te.A,size:20,className:"clear-icon",role:"img"})})]})},oe=re;r(1939);const se=e=>(0,f.jsx)(ee,{...e}),ie=e=>{const{list:t,selected:r,renderItem:o,depth:s=0,onSelect:a,instanceId:n,isSingle:c,search:l,useExpandedPanelId:d}=e,[u]=d;return t?(0,f.jsx)(f.Fragment,{children:t.map((t=>{const m=t.children?.length&&!c?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),g=t.children?.length&&u===t.id;return(0,f.jsxs)(i.Fragment,{children:[(0,f.jsx)("li",{children:o({item:t,isSelected:m,onSelect:a,isSingle:c,selected:r,search:l,depth:s,useExpandedPanelId:d,controlId:n})}),g?(0,f.jsx)(ie,{...e,list:t.children,depth:s+1}):null]},t.id)}))}):null},ae=({isLoading:e,isSingle:t,selected:r,messages:o,onChange:s,onRemove:i})=>{if(e||t||!r)return null;const a=r.length;return(0,f.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,f.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,f.jsx)("strong",{children:o.selected(a)}),a>0?(0,f.jsx)(y.Button,{variant:"link",isDestructive:!0,onClick:()=>s([]),"aria-label":o.clear,children:(0,S.__)("Clear all","woocommerce")}):null]}),a>0?(0,f.jsx)("ul",{children:r.map(((e,t)=>(0,f.jsx)("li",{children:(0,f.jsx)(oe,{label:e.name,id:e.id,remove:i})},t)))}):null]})},ne=({filteredList:e,search:t,onSelect:r,instanceId:s,useExpandedPanelId:i,...a})=>{const{messages:n,renderItem:c,selected:l,isSingle:d}=a,u=c||se;return 0===e.length?(0,f.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,f.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,f.jsx)(o.A,{icon:W.A,role:"img"})}),(0,f.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,S.sprintf)(n.noResults,t):n.noItems})]}):(0,f.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,f.jsx)(ie,{useExpandedPanelId:i,list:e,selected:l,renderItem:u,onSelect:r,instanceId:s,isSingle:d,search:t})})},ce=e=>{const{className:t="",isCompact:r,isHierarchical:o,isLoading:s,isSingle:n,list:c,messages:l=Y,onChange:d,onSearch:u,selected:m,type:g="text",debouncedSpeak:p}=e,[h,b]=(0,i.useState)(""),_=(0,i.useState)(-1),w=(0,a.useInstanceId)(ce),x=(0,i.useMemo)((()=>({...Y,...l})),[l]),v=(0,i.useMemo)((()=>((e,t,r)=>{if(!t)return r?J(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),s=e.map((e=>!!o.test(e.name)&&e)).filter(Boolean);return r?J(s,e):s})(c,h,o)),[c,h,o]);(0,i.useEffect)((()=>{p&&p(x.updated)}),[p,x]),(0,i.useEffect)((()=>{"function"==typeof u&&u(h)}),[h,u]);const j=(0,i.useCallback)((e=>()=>{n&&d([]);const t=m.findIndex((({id:t})=>t===e));d([...m.slice(0,t),...m.slice(t+1)])}),[n,m,d]),k=(0,i.useCallback)((e=>()=>{Array.isArray(e)?d(e):-1===m.findIndex((({id:t})=>t===e.id))?d(n?[e]:[...m,e]):j(e.id)()}),[n,j,d,m]),I=(0,i.useCallback)((e=>{const[t]=m.filter((t=>!e.find((e=>t.id===e.id))));j(t.id)()}),[j,m]);return(0,f.jsxs)("div",{className:(0,$.A)("woocommerce-search-list",t,{"is-compact":r,"is-loading":s,"is-token":"token"===g}),children:["text"===g&&(0,f.jsx)(ae,{...e,onRemove:j,messages:x}),(0,f.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===g?(0,f.jsx)(y.TextControl,{label:x.search,type:"search",value:h,onChange:e=>b(e)}):(0,f.jsx)(y.FormTokenField,{disabled:s,label:x.search,onChange:I,onInputChange:e=>b(e),suggestions:[],__experimentalValidateInput:()=>!1,value:s?[(0,S.__)("Loading…","woocommerce")]:m.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})}),s?(0,f.jsx)("div",{className:"woocommerce-search-list__list",children:(0,f.jsx)(y.Spinner,{})}):(0,f.jsx)(ne,{...e,search:h,filteredList:v,messages:x,onSelect:k,instanceId:w,useExpandedPanelId:_})]})},le=((0,y.withSpokenMessages)(ce),e=>({selected:t,...r})=>{const[o,s]=(0,i.useState)(!0),[a,c]=(0,i.useState)(null),[d,u]=(0,i.useState)([]),m=async e=>{const t=await x(e);c(t),s(!1)},g=(0,i.useRef)(t);return(0,i.useEffect)((()=>{var e;(e={selected:g.current},l()({path:(0,n.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})})).then((e=>{u(e),s(!1)})).catch(m)}),[g]),(0,f.jsx)(e,{...r,selected:t,error:a,categories:d,isLoading:o})});r(6982);const de=le((({categories:e=[],error:t=null,isLoading:r=!1,onChange:o,onOperatorChange:s,operator:i="any",selected:a,isCompact:n=!1,isSingle:c=!1,showReviewCount:l})=>{const d={clear:(0,S.__)("Clear all product categories","woocommerce"),list:(0,S.__)("Product Categories","woocommerce"),noItems:(0,S.__)("Your store doesn't have any product categories.","woocommerce"),search:(0,S.__)("Search for product categories","woocommerce"),selected:e=>(0,S.sprintf)(/* translators: %d is the count of selected categories. */ /* translators: %d is the count of selected categories. */ (0,S._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,S.__)("Category search results updated.","woocommerce")};if(t)return(0,f.jsx)(D,{error:t});const u=e.map(C);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ce,{className:"woocommerce-product-categories",list:u,isLoading:r,selected:u.filter((({id:e})=>a.includes(Number(e)))),onChange:o,renderItem:e=>{const{item:t,search:r,depth:o=0}=e,s=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,i=l?(0,S.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,S._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,S.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,S._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.details?.count||0,"woocommerce"),s,t.details?.count||0),a=l?(0,S.sprintf)(/* translators: %d is the count of reviews. */ /* translators: %d is the count of reviews. */ (0,S._n)("%d review","%d reviews",t.details?.review_count||0,"woocommerce"),t.details?.review_count||0):(0,S.sprintf)(/* translators: %d is the count of products. */ /* translators: %d is the count of products. */ (0,S._n)("%d product","%d products",t.details?.count||0,"woocommerce"),t.details?.count||0);return(0,f.jsx)(Z,{className:(0,$.A)("woocommerce-product-categories__item","has-count",{"is-searching":r.length>0,"is-skip-level":0===o&&0!==t.parent}),...e,countLabel:a,"aria-label":i})},messages:d,isCompact:n,isHierarchical:!0,isSingle:c}),!!s&&(0,f.jsx)("div",{hidden:a.length<2,children:(0,f.jsx)(y.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,S.__)("Display products matching","woocommerce"),help:(0,S.__)("Pick at least two categories to use this setting.","woocommerce"),value:i,onChange:s,options:[{label:(0,S.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,S.__)("All selected categories","woocommerce"),value:"all"}]})})]})}));var ue=r(4347);var me=r(923),ge=r.n(me);const pe=(0,a.createHigherOrderComponent)((e=>{class t extends i.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:r,showVariations:o}=this.props;o&&(!ge()(e.selected,r)||e.isLoading&&!t)&&this.loadVariations()}loadVariations=()=>{const{products:e}=this.props,{loading:t,variations:r}=this.state;if(t)return;const o=this.getExpandedProduct();if(!o||r[o])return;const s=e.find((e=>e.id===o));var i;s?.variations&&0!==s.variations.length?(this.setState({loading:!0}),(i=o,l()({path:(0,n.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:i})})).then((e=>{const t=e.map((e=>({...e,parent:o})));this.setState({variations:{...this.state.variations,[o]:t},loading:!1,error:null})})).catch((async e=>{const t=await x(e);this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:t})}))):this.setState({variations:{...this.state.variations,[o]: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,r=t.filter((t=>t.variations&&t.variations.find((({id:t})=>t===e))));return r[0]?.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:r}=this.props;if(!r)return null;let o=t&&t.length?t[0]:null;return o?this.prevSelectedItem=o:!this.prevSelectedItem||e||this.isProductId(this.prevSelectedItem)||(o=this.prevSelectedItem),!e&&o?this.isProductId(o)?o:this.findParentProduct(o):null}render(){const{error:t,isLoading:r}=this.props,{error:o,loading:s,variations:i}=this.state;return(0,f.jsx)(e,{...this.props,error:o||t,expandedProduct:this.getExpandedProduct(),isLoading:r,variations:i,variationsLoading:s})}}return t}),"withProductVariations");var he=r(1609);const be=({className:e,item:t,isSelected:r,isLoading:o,onSelect:s,disabled:i,...a})=>(0,f.jsxs)(f.Fragment,{children:[(0,he.createElement)(Z,{...a,key:t.id,className:e,isSelected:r,item:t,onSelect:s,disabled:i}),r&&o&&(0,f.jsx)("div",{className:(0,$.A)("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active"),children:(0,f.jsx)(y.Spinner,{})},"loading")]});r(5653);const _e={list:(0,S.__)("Products","woocommerce"),noItems:(0,S.__)("Your store doesn't have any products.","woocommerce"),search:(0,S.__)("Search for a product to display","woocommerce"),updated:(0,S.__)("Product search results updated.","woocommerce")},we=(e=>t=>{let{selected:r}=t;r=void 0===r?null:r;const o=null===r;return Array.isArray(r)?(0,f.jsx)(e,{...t}):(0,f.jsx)(e,{...t,selected:o?[]:[r]})})((ve=pe((0,a.withInstanceId)((e=>{const{expandedProduct:t=null,error:r,instanceId:o,isCompact:s=!1,isLoading:i,onChange:a,onSearch:n,products:c,renderItem:l,selected:d=[],showVariations:u=!1,variations:m,variationsLoading:g}=e;if(r)return(0,f.jsx)(D,{error:r});const p=[...c,...m&&t&&m[t]?m[t]:[]].map(I);return(0,f.jsx)(ce,{className:"woocommerce-products",list:p,isCompact:s,isLoading:i,isSingle:!0,selected:p.filter((({id:e})=>d.includes(Number(e)))),onChange:a,renderItem:l||(u?e=>{const{item:t,search:r,depth:s=0,isSelected:a,onSelect:n}=e,c=t.details?.variations&&Array.isArray(t.details.variations)?t.details.variations.length:0,l=(0,$.A)("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${s}`,"has-count",{"is-searching":r.length>0,"is-skip-level":0===s&&0!==t.parent,"is-variable":c>0});if(!t.breadcrumbs.length){const r=t.details?.variations&&t.details.variations.length>0;return(0,f.jsx)(be,{...e,className:(0,$.A)(l,{"is-selected":a}),isSelected:a,item:t,onSelect:()=>()=>{n(t)()},isLoading:i||g,countLabel:r?(0,S.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,S.__)("%1$d variations","woocommerce"),t.details?.variations.length):null,name:`products-${o}`,"aria-label":r?(0,S.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,S._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,N.isEmpty)(t.details?.variation)?e:{...e,item:{...e.item,name:t.details?.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.details?.variation}`};return(0,f.jsx)(Z,{...d,className:l,name:`variations-${o}`})}:void 0),onSearch:n,messages:{..._e,...e.messages},isHierarchical:!0})}))),({selected:e,...t})=>{const[r,o]=(0,i.useState)(!0),[s,a]=(0,i.useState)(null),[n,c]=(0,i.useState)([]),l=u.productCount>100,d=async e=>{const t=await x(e);a(t),o(!1)},m=(0,i.useRef)(e);(0,i.useEffect)((()=>{w({selected:m.current}).then((e=>{c(e),o(!1)})).catch(d)}),[m]);const g=(0,ue.YQ)((t=>{w({selected:e,search:t}).then((e=>{c(e),o(!1)})).catch(d)}),400),p=(0,i.useCallback)((e=>{o(!0),g(e)}),[o,g]);return(0,f.jsx)(ve,{...t,selected:e,error:s,products:n,isLoading:r,onSearch:l?p:null})})),xe=window.wp.data,fe=window.wp.coreData;var ve,ye=r(7356);const Se=window.wp.styleEngine;function je(e={}){const t={};return(0,Se.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function ke(e,t){return e&&t?`has-${(0,ye.c)(t)}-${e}`:""}const Ie=e=>{const t=(e=>{const t=(0,N.isObject)(e)?e:{style:{}};let r=t.style;return(0,N.isString)(r)&&(r=JSON.parse(r)||{}),(0,N.isObject)(r)||(r={}),{...t,style:r}})(e),r=function(e){const{backgroundColor:t,textColor:r,gradient:o,style:s}=e,i=ke("background-color",t),a=ke("color",r),n=function(e){if(e)return`has-${e}-gradient-background`}(o),c=n||s?.color?.gradient;return{className:(0,$.A)(a,n,{[i]:!c&&!!i,"has-text-color":r||s?.color?.text,"has-background":t||s?.color?.background||o||s?.color?.gradient,"has-link-color":(0,N.isObject)(s?.elements?.link)?s?.elements?.link?.color:void 0}),style:je({color:s?.color||{}})}}(t),o=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:r}=e,o=t?ke("border-color",t):"";return(0,$.A)({"has-border-color":!!t||!!r?.border?.color,[o]:!!o})}(e),style:je({border:t})}}(t),s=function(e){return{className:void 0,style:je({spacing:e.style?.spacing||{}})}}(t),i=(e=>{const t=(0,N.isObject)(e.style.typography)?e.style.typography:{},r=(0,N.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:r,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}})(t);return{className:(0,$.A)(i.className,r.className,o.className,s.className),style:{...i.style,...r.style,...o.style,...s.style}}},Ce=window.wp.autop,Pe=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,Ee=(e,t,r=!0,o="…",s=!0)=>{const i=e.replace(/<\/?[a-z][^>]*?>/gi,""),a=i.slice(0,t);if(a===i)return s?(0,Ce.autop)(i):i;if(r)return(0,Ce.autop)(Pe(a,o));const n=a.match(/([\s]+)/g),c=n?n.length:0,l=i.slice(0,t+c);return s?(0,Ce.autop)(Pe(l,o)):Pe(l,o)},Ne=({itemId:e,linkText:t,permalink:r})=>{const o=(0,$.A)("wp-block-button__link","is-style-fill");return"preview"===e?(0,f.jsx)("div",{className:"wp-block-button aligncenter",style:{width:"100%"},children:(0,f.jsx)(j.RichText.Content,{tagName:"a",className:o,href:r,title:t,style:{backgroundColor:"vivid-green-cyan",borderRadius:"5px"},value:t,target:r})}):(0,f.jsx)(j.InnerBlocks,{template:[["core/buttons",{layout:{type:"flex",justifyContent:"center"}},[["core/button",{text:(0,S.__)("Shop now","woocommerce"),url:r}]]]],templateLock:"all"})},Ae=({className:e="",onResize:t,...r})=>{const[o,s]=(0,i.useState)(!1),a=(0,$.A)(e,{"is-resizing":o}),n=(0,ue.dh)(((e,r,i,a)=>{o||s(!0),t?.(e,r,i,a)}),50,{leading:!0});return(0,f.jsx)(y.ResizableBox,{className:a,enable:{bottom:!0},onResize:n,onResizeStop:(...e)=>{t?.(...e),s(!1)},...r})},Re={icon:s.A,label:(0,S.__)("Featured Product","woocommerce")},Le={...Re,cropLabel:(0,S.__)("Edit product image","woocommerce"),editLabel:(0,S.__)("Edit selected product","woocommerce")},Fe={...Re,emptyMessage:(0,S.__)("No product is selected.","woocommerce"),noSelectionButtonLabel:(0,S.__)("Select a product","woocommerce")},Te={...Re,description:(0,S.__)("Highlight a product or variation.","woocommerce"),editLabel:(0,S.__)("Showing Featured Product block preview.","woocommerce")},Oe=(0,a.compose)([v,y.withSpokenMessages,e=>t=>{const[r,o]=(0,i.useState)(!1),{attributes:s,category:a,clientId:n,product:c}=t,l=a||c,{editMode:d}=s,u=l?.link||l?.permalink,m=(0,xe.useSelect)((e=>e("core/block-editor").getBlock(n))),g=m?.innerBlocks[0]?.innerBlocks[0],p=g?.clientId||"",h=(0,i.useMemo)((()=>g?.attributes||{}),[g]),{url:b}=h,{updateBlockAttributes:_}=(0,xe.useDispatch)("core/block-editor");return(0,i.useEffect)((()=>{r&&p&&!d&&u&&b&&u!==b&&(_(p,{url:u}),o(!1))}),[p,r,d,u,_,b]),(0,f.jsx)(e,{...t,triggerUrlUpdate:()=>o(!0)})},e=>t=>{const[r,o]=(0,i.useState)(!1),{isSelected:s}=t;return(0,i.useEffect)((()=>{o(!1)}),[s]),(0,f.jsx)(e,{...t,useEditingImage:[r,o]})},(({description:e,editLabel:t,icon:r,label:o})=>s=>a=>{const{attributes:n,debouncedSpeak:c,name:l,setAttributes:d,triggerUrlUpdate:u=()=>{},error:m}=a,g=z(l),[p,h]=(0,i.useState)(),b=l===E?n?.productId:n?.categoryId,{status:_,isDeleted:w,isLoading:x}=(({itemId:e,itemType:t})=>{const{product:r,isResolutionFinished:o}=(s=e,(0,xe.useSelect)((e=>{if(!s)return{product:void 0,isResolving:!1};const t="string"==typeof s?parseInt(s,10):s;return{product:e(fe.store).getEditedEntityRecord("root","product",t),isResolving:e(fe.store).isResolving("getEditedEntityRecord",["root","product",t]),isResolutionFinished:e(fe.store).hasFinishedResolution("getEditedEntityRecord",["root","product",t])}}),[s]));var s;return(0,xe.useSelect)((s=>{if(!e)return{status:null,isDeleted:!1,isLoading:!1};if(t===E){var i;const e=!o,t="trash"===r?.status||!e&&!r;return{status:null!==(i=r?.status)&&void 0!==i?i:null,isDeleted:t,isLoading:e}}if(t===P){const{getEntityRecords:t,hasFinishedResolution:r}=s(fe.store),o=["taxonomy","product_cat",{include:[e]}],i=t(...o),a=r("getEntityRecords",o),n=!i?.length;return{status:n?"deleted":null,isDeleted:n,isLoading:!a}}return{status:null,isDeleted:!0,isLoading:!1}}),[e,t,r,o])})({itemId:b,itemType:l});return(0,i.useEffect)((()=>{if(!x){const e=l===E&&"publish"!==_||w;e&&d({editMode:e})}}),[_,w,l,d,x]),n.editMode?(0,f.jsxs)(y.Placeholder,{icon:(0,f.jsx)(y.Icon,{icon:r}),label:o,className:g,children:[(0,f.jsxs)(y.__experimentalHStack,{alignment:"center",children:[w?(0,f.jsx)(y.Icon,{icon:W.A,className:"wc-blocks-featured-items__orange-info-icon"}):(0,f.jsx)(y.Icon,{icon:W.A}),(0,f.jsx)(y.__experimentalText,{children:w?V(l):e})]}),(0,f.jsxs)("div",{className:`${g}__selection`,children:[l===P&&(0,f.jsx)(de,{selected:p?.categoryId?[p.categoryId]:[],onChange:(e=[])=>{const t=e[0]?e[0].id:0;h({categoryId:t,mediaId:0,mediaSrc:"",editMode:!1}),u()},isSingle:!0}),l===E&&(0,f.jsx)(we,{selected:p?.productId?[p.productId]:[],showVariations:!0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;h({productId:t,mediaId:0,mediaSrc:"",editMode:!1}),u()}}),(0,f.jsx)(y.Button,{variant:"primary",onClick:()=>{p&&(d(p),c(t))},children:(0,S.__)("Done","woocommerce")})]})]}):(0,f.jsx)(s,{...a,isLoading:x,error:x?null:m})})(Te),(({emptyMessage:e,icon:t,label:r,noSelectionButtonLabel:o})=>s=>a=>{const[n]=a.useEditingImage,{attributes:c,category:l,isLoading:d,isSelected:u,name:m,product:g,setAttributes:p}=a,{mediaId:h,mediaSrc:b,isRepeated:_,imageFit:w}=c,x=l||g,[v,j]=(0,i.useState)({}),{backgroundImageSrc:k,isImageBgTransparent:I,originalImgDimension:C}=R({item:x,mediaId:h,mediaSrc:b,blockName:m}),P=(0,i.useRef)(null),[E,A]=(0,i.useState)({height:0,width:0});(0,i.useEffect)((()=>{const e=new ResizeObserver((e=>{A({height:e[0].contentRect.height,width:e[0].contentRect.width})}));if(!1===d){const t=P.current;if(!t)return;e.observe(t)}return()=>e.disconnect()}),[d]);const L=(0,i.useMemo)((()=>(({isImageBgTransparent:e,originalImgDimension:t,parentContainerDimension:r,isRepeated:o,imageFit:s})=>e?{isBackgroundVisible:!0,message:null}:e||!o&&"cover"!==s?!e&&t.height>=r.height&&t.width>=r.width?{isBackgroundVisible:!1,message:(0,S.__)("You've set background color to an opaque image, the background color cannot be seen.","woocommerce")}:(t.height<r.height||(t.width,r.width),{isBackgroundVisible:!0,message:null}):o?{isBackgroundVisible:!1,message:(0,S.__)("You’ve set a background color behind an image set to repeat, the background color cannot be seen.","woocommerce")}:{isBackgroundVisible:!1,message:(0,S.__)("You’ve set a background color behind an image set to cover, the background color cannot be seen.","woocommerce")})({isImageBgTransparent:I,originalImgDimension:C,parentContainerDimension:E,isRepeated:_,imageFit:w})),[E,C,_,w,I]),F=z(m),T=(0,i.useCallback)(((e,t,r)=>{p({minHeight:parseInt(r.style.height,10)})}),[p]),O=()=>{const{categoryId:e,linkText:t,productId:r}=c;return(0,f.jsx)(Ne,{itemId:e||r,linkText:t,permalink:(l||g).permalink})},M=Ie(c);return n?(0,f.jsx)(s,{...a,backgroundImageSize:v,backgroundColorVisibilityStatus:L}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s,{...a,backgroundImageSize:v,backgroundColorVisibilityStatus:L}),x?(()=>{const{contentAlign:e,dimRatio:t,focalPoint:r,hasParallax:o,minHeight:s,overlayColor:i,overlayGradient:a,showDesc:n,showPrice:m,style:p,textColor:h}=c,b=(0,$.A)(F,{"is-selected":u&&"preview"!==c.categoryId&&"preview"!==c.productId,"is-loading":!x&&d,"is-not-found":!x&&!d,"has-background-dim":0!==t,"is-repeated":_},0===(v=t)||50===v?null:"has-background-dim-"+10*Math.round(v/10),"center"!==e&&`has-${e}-content`,M.className);var v;const y={borderRadius:p?.border?.radius,color:h?`var(--wp--preset--color--${h})`:p?.color?.text,boxSizing:"border-box",minHeight:s,...M.style},S=!_&&!o,I=function({focalPoint:e,imageFit:t,isImgElement:r,isRepeated:o,url:s}){let i={};var a;return i=r?{...i,...(a=e,a?{objectPosition:H(a)}:{}),objectFit:t}:{...i,...s&&{backgroundImage:`url(${s})`},backgroundPosition:H(e),...!o&&{backgroundRepeat:"no-repeat",backgroundSize:"cover"===t?t:"auto"}},i}({focalPoint:r,imageFit:w,isImgElement:S,isRepeated:_,url:k}),C={background:a,backgroundColor:i};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Ae,{enable:{bottom:!0},onResize:T,showHandle:u,style:{minHeight:s}}),(0,f.jsx)("div",{className:b,ref:P,style:y,children:(0,f.jsxs)("div",{className:`${F}__wrapper`,children:[(0,f.jsx)("div",{className:"background-dim__overlay",style:C}),k&&(S?(0,f.jsx)("img",{alt:x.name,className:`${F}__background-image`,src:k,style:I,onLoad:e=>{j({height:e.currentTarget?.naturalHeight,width:e.currentTarget?.naturalWidth})}}):(0,f.jsx)("div",{className:(0,$.A)(`${F}__background-image`,{"has-parallax":o}),style:I})),(0,f.jsx)("h2",{className:`${F}__title`,dangerouslySetInnerHTML:{__html:x.name}}),!(0,N.isEmpty)(g?.variation)&&(0,f.jsx)("h3",{className:`${F}__variation`,dangerouslySetInnerHTML:{__html:g.variation}}),n&&(0,f.jsx)("div",{className:`${F}__description`,dangerouslySetInnerHTML:{__html:l?.description||g?.short_description||(g?.description?.length>0?Ee(g.description,400):"")}}),m&&(0,f.jsx)("div",{className:`${F}__price`,dangerouslySetInnerHTML:{__html:g.price_html}}),(0,f.jsx)("div",{className:`${F}__link`,children:O()})]})})]})})():(0,f.jsx)(y.Placeholder,{className:F,icon:(0,f.jsx)(y.Icon,{icon:t}),label:r,children:d?(0,f.jsx)(y.Spinner,{}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{children:e}),(0,f.jsx)("div",{style:{flexBasis:"100%",height:"0"}}),(0,f.jsx)("button",{type:"button",className:"components-button is-secondary",onClick:()=>p({editMode:!0}),children:o})]})})]})})(Fe),e=>t=>{const{error:r,isLoading:o,name:s}=t,i=z(s),a=s===P?t.getCategory:t.getProduct;return r?(0,f.jsx)(G,{className:`${i}-error`,error:r,isLoading:o,onRetry:a}):(0,f.jsx)(e,{...t})},e=>t=>{const[r,o]=t.useEditingImage,s=(0,i.useRef)(null),{attributes:a,backgroundImageSize:n,name:c,setAttributes:l}=t,{mediaId:d,mediaSrc:u}=a,m=c===E?t.product:t.category,{backgroundImageId:g,backgroundImageSrc:p}=R({item:m,mediaId:d,mediaSrc:u,blockName:c});return r?(0,f.jsx)("div",{ref:s,children:(0,f.jsx)(F,{align:a.align,backgroundImageId:g,backgroundImageSize:n,backgroundImageSrc:p,containerRef:s,isEditingImage:r,setAttributes:l,setIsEditingImage:o})}):(0,f.jsx)(e,{...t})},e=>t=>{const{attributes:r,name:o,setAttributes:s,backgroundColorVisibilityStatus:i}=t,{alt:a,dimRatio:n,focalPoint:c,hasParallax:l,isRepeated:d,imageFit:u,mediaId:m,mediaSrc:g,overlayColor:p,overlayGradient:h,showDesc:b,showPrice:_,backgroundColor:w,style:x}=r,v=o===E?t.product:t.category,{setGradient:k}=(0,j.__experimentalUseGradient)({gradientAttribute:"overlayGradient",customGradientAttribute:"overlayGradient"}),I=o===E?(0,f.jsx)(y.ToggleControl,{label:(0,S.__)("Show price","woocommerce"),checked:_,onChange:()=>s({showPrice:!_})}):void 0,{backgroundImageSrc:C}=R({item:v,mediaId:m,mediaSrc:g,blockName:o});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(T,{alt:a,backgroundImageSrc:C,contentPanel:I,dimRatio:n,focalPoint:c,hasParallax:l,isRepeated:d,imageFit:u,overlayColor:p,overlayGradient:h,setAttributes:s,setGradient:k,showDesc:b,backgroundColorVisibilityStatus:i,backgroundColor:w||x?.color?.background}),(0,f.jsx)(e,{...t})]})},(({cropLabel:e,editLabel:t})=>r=>o=>{const[s,i]=o.useEditingImage,{attributes:a,category:n,name:c,product:l,setAttributes:d}=o,{contentAlign:u,editMode:m,mediaId:g,mediaSrc:p}=a,h=n||l,{backgroundImageId:b,backgroundImageSrc:_}=R({item:h,mediaId:g,mediaSrc:p,blockName:c});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(L,{backgroundImageId:b,backgroundImageSrc:_,contentAlign:u,cropLabel:e,editLabel:t,editMode:m,isEditingImage:s,mediaSrc:p,setAttributes:d,setIsEditingImage:i}),(0,f.jsx)(r,{...o})]})})(Le)])((()=>(0,f.jsx)(f.Fragment,{}))),$e=window.wp.blocks;function Me(e){return function(t){const r=(0,j.useBlockProps)(),{color:o,...s}=r.style;return(0,f.jsx)("div",{...r,style:s,children:(0,f.jsx)(e,{...t})})}}!function(e,t,r,o){const s={attributes:{...r.attributes,minHeight:{type:"number",default:(0,d.getSetting)("defaultHeight",500)}},supports:{...r.supports,color:{background:r.supports?.color?.background,text:r.supports?.color?.text},spacing:{padding:r.supports?.spacing?.padding,__experimentalDefaultControls:{padding:r.supports?.spacing?.__experimentalDefaultControls},__experimentalSkipSerialization:r.supports?.spacing?.__experimentalSkipSerialization},__experimentalBorder:r?.supports?.__experimentalBorder}},i={attributes:{alt:"",contentAlign:"center",dimRatio:50,editMode:!1,hasParallax:!1,isRepeated:!1,height:(0,d.getSetting)("defaultHeight",500),mediaSrc:"",overlayColor:"#000000",showDesc:!0}};(0,$e.registerBlockType)(r,{...s,example:{...i,...t},edit:Me(e),save:()=>(0,f.jsx)(j.InnerBlocks.Content,{}),...o})}(Oe,{attributes:{productId:"preview",previewProduct:{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:(0,S.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woocommerce"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:m+"previews/pennant.jpg",thumbnail:m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:(0,S.__)("Add to cart","woocommerce"),description:(0,S.__)("Add to cart","woocommerce")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0},editMode:!1}},JSON.parse('{"name":"woocommerce/featured-product","title":"Featured Product","description":"Highlight a product or variation.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"interactivity":{"clientNavigation":true},"align":["wide","full"],"ariaLabel":true,"html":false,"color":{"background":true,"text":true},"spacing":{"padding":true,"__experimentalDefaultControls":{"padding":true},"__experimentalSkipSerialization":true},"__experimentalBorder":{"color":true,"radius":true,"width":true,"__experimentalSkipSerialization":true},"multiple":true},"attributes":{"alt":{"type":"string","default":""},"contentAlign":{"type":"string","default":"center"},"dimRatio":{"type":"number","default":50},"editMode":{"type":"boolean","default":true},"focalPoint":{"type":"object","default":{"x":0.5,"y":0.5}},"imageFit":{"type":"string","default":"none"},"hasParallax":{"type":"boolean","default":false},"isRepeated":{"type":"boolean","default":false},"mediaId":{"type":"number","default":0},"mediaSrc":{"type":"string","default":""},"minHeight":{"type":"number","default":500},"linkText":{"type":"string","default":"Shop now"},"overlayColor":{"type":"string","default":"#000000"},"overlayGradient":{"type":"string"},"productId":{"type":"number"},"previewProduct":{"type":"object","default":null},"showDesc":{"type":"boolean","default":true},"showPrice":{"type":"boolean","default":true}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),{icon:{src:(0,f.jsx)(o.A,{icon:s.A,className:"wc-block-editor-components-block-icon"})}})},210:()=>{},6388:()=>{},3120:()=>{},6982:()=>{},5653:()=>{},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},923:e=>{"use strict";e.exports=window.wp.isShallowEqual},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 r=s[e]={exports:{}};return o[e].call(r.exports,r,r.exports,i),r.exports}i.m=o,e=[],i.O=(t,r,o,s)=>{if(!r){var a=1/0;for(d=0;d<e.length;d++){for(var[r,o,s]=e[d],n=!0,c=0;c<r.length;c++)(!1&s||a>=s)&&Object.keys(i.O).every((e=>i.O[e](r[c])))?r.splice(c--,1):(n=!1,s<a&&(a=s));if(n){e.splice(d--,1);var l=o();void 0!==l&&(t=l)}}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]=[r,o,s]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var s=Object.create(null);i.r(s);var a={};t=t||[null,r({}),r([]),r(r)];for(var n=2&o&&e;"object"==typeof n&&!~t.indexOf(n);n=r(n))Object.getOwnPropertyNames(n).forEach((t=>a[t]=()=>e[t]));return a.default=()=>e,i.d(s,a),s},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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=8931,(()=>{var e={8931:0};i.O.j=t=>0===e[t];var t=(t,r)=>{var o,s,[a,n,c]=r,l=0;if(a.some((t=>0!==e[t]))){for(o in n)i.o(n,o)&&(i.m[o]=n[o]);if(c)var d=c(i)}for(t&&t(r);l<a.length;l++)s=a[l],i.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return i.O(d)},r=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=i.O(void 0,[94],(()=>i(2195)));a=i.O(a),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["featured-product"]=a})();
/home/batcwwjx/www/wp-content/plugins/woocommerce/assets/client/blocks/featured-product.js