whoami7 - Manager
:
/
home
/
dataiclx
/
www
/
wp-content
/
plugins
/
woocommerce
/
assets
/
client
/
blocks
/
Upload File:
files >> /home/dataiclx/www/wp-content/plugins/woocommerce/assets/client/blocks/featured-product.js
(()=>{var e,t,o,r={9235:(e,t,o)=>{"use strict";var r=o(4530),i=o(2108),a=(o(6388),o(210),o(6087)),s=o(9491);const n=window.wp.url,c=window.wp.apiFetch;var l=o.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",{}),({selected:e=[],search:t="",queryArgs:o={}})=>{const r=(({selected:e=[],search:t="",queryArgs:o={}})=>{const r=u.productCount>100&&e.length>0,i=[(0,n.addQueryArgs)("/wc/store/v1/products",{per_page:100,catalog_visibility:"any",search:t,orderby:"title",order:"asc",exclude:r?e:[],...o})];if(r){const t=Math.ceil(e.length/100);for(let o=1;o<=t;o++)i.push((0,n.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:100,page:o}))}return i})({selected:e,search:t,queryArgs:o});return Promise.all(r.map((e=>l()({path:e})))).then((e=>[...new Map(e.flatMap((e=>e.map((e=>[e.id,{...e,parent:0}]))))).values()]))}),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 w=o(790);const f=(0,s.createHigherOrderComponent)((e=>class extends a.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:o,product:r}=this.state;return(0,w.jsx)(e,{...this.props,error:t,getProduct:this.loadProduct,isLoading:o,product:r})}}),"withProduct"),v=window.wp.components;var y=o(7723);const S=window.wp.blockEditor;var j=o(3462);const k=e=>{const{id:t,name:o,parent:r}=e;return{id:t,name:o,parent:r,breadcrumbs:[],children:[],details:e,value:e.slug}},I=e=>{const{id:t,name:o,parent:r,count:i}=e;return{id:t,name:o,parent:r,count:i,breadcrumbs:[],children:[],details:e,value:e.slug}},C=`${JSON.parse('{"name":"woocommerce/product-collection"}').name}/product-title`,E="woocommerce/featured-category",P="woocommerce/featured-product",A=e=>[["woocommerce/category-title",{level:2,textAlign:"center"}],["woocommerce/category-description",{textAlign:"center"}],["core/buttons",{layout:{type:"flex",justifyContent:"center"}},[["core/button",{text:(0,y.__)("Shop now","woocommerce"),url:e.permalink}]]]],N=e=>[["core/post-title",{isLink:!0,level:2,textAlign:"center",__woocommerceNamespace:C}],["woocommerce/product-summary",{showDescriptionIfEmpty:!0,style:{typography:{textAlign:"center"}},summaryLength:80}],["woocommerce/product-price",{style:{spacing:{padding:{bottom:"16px"}}},textAlign:"center"}],["core/buttons",{layout:{type:"flex",justifyContent:"center"}},[["core/button",{text:(0,y.__)("Shop now","woocommerce"),url:e.permalink}]]]],R=window.wc.wcTypes;function L(e){return!!e&&(0,R.isNumber)(e.id)&&"string"==typeof e.src}function F({blockName:e,item:t,mediaId:o,mediaSrc:r}){const[i,s]=(0,a.useState)(0),[n,c]=(0,a.useState)(""),[l,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)({height:0,width:0}),g=(0,a.useRef)(null),p=(0,a.useRef)(null);return(0,a.useEffect)((()=>{var r,i;s(o||(e===P?(i=t)&&i.images&&i.images.length&&i.images[0].id||0:(r=t)&&L(r.image)?r.image.id:0))}),[e,t,o]),(0,a.useEffect)((()=>{var o,i;c(r||(e===P?(i=t)&&i.images&&i.images.length&&i.images[0].src||"":(o=t)&&L(o.image)?o.image.src:""))}),[e,t,r]),(0,a.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 o=e.naturalWidth,r=e.naturalHeight;null!==r&&null!==o&&m({height:r,width:o}),t.width=o,t.height=r;const i=t.getContext("2d",{willReadFrequently:!0});if(!i)return;i.drawImage(e,0,0,o,r);const a=i.getImageData(0,0,o,r).data,s=(()=>{for(let e=3;e<a.length;e+=4)if(a[e]<255)return!0;return!1})();l!==s&&d(s)}}else d(!0);return()=>{g.current&&(g.current.onload=null)}}),[n]),{backgroundImageId:i,backgroundImageSrc:n,isImageBgTransparent:l,originalImgDimension:u}}const O=({backgroundImageId:e,backgroundImageSrc:t,contentAlign:o,cropLabel:r,editLabel:i,editMode:a,isEditingImage:s,mediaSrc:n,setAttributes:c,setIsEditingImage:l,setEditMode:d})=>(0,w.jsxs)(S.BlockControls,{children:[(0,w.jsx)(S.AlignmentToolbar,{value:o,onChange:e=>{c({contentAlign:e})}}),(0,w.jsxs)(v.ToolbarGroup,{children:[t&&!s&&(0,w.jsx)(v.ToolbarButton,{onClick:()=>l(!0),icon:j.A,label:r}),(0,w.jsx)(S.MediaReplaceFlow,{mediaId:e,mediaURL:n,accept:"image/*",onSelect:e=>{c({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}),e&&n?(0,w.jsx)(v.ToolbarButton,{onClick:()=>c({mediaId:0,mediaSrc:""}),children:(0,y.__)("Reset","woocommerce")}):null]}),(0,w.jsx)(v.ToolbarGroup,{controls:[{icon:"edit",title:i,onClick:()=>d(!a),isActive:a}]})]}),T=({align:e,backgroundImageId:t,backgroundImageSize:o,backgroundImageSrc:r,containerRef:i,isEditingImage:s,setAttributes:n,setIsEditingImage:c})=>{const l=function(e,t){const[o,r]=(0,a.useState)(),i=(0,a.useCallback)((()=>{r(e.current?.clientWidth)}),[e]);return(0,a.useEffect)(i,[i,...t]),(0,a.useEffect)((()=>{if(!e.current)return;const{defaultView:t}=e.current.ownerDocument;return t?(t.addEventListener("resize",i),()=>{t.removeEventListener("resize",i)}):void 0}),[e,i]),o}(i,[e]);return"function"==typeof S.__experimentalImageEditingProvider?(0,w.jsx)(S.__experimentalImageEditingProvider,{id:t,url:r,naturalHeight:o.height||500,naturalWidth:o.width||500,onSaveImage:({id:e,url:t})=>{n({mediaId:e,mediaSrc:t})},isEditing:s,onFinishEditing:()=>c(!1),children:(0,w.jsx)(S.__experimentalImageEditor,{url:r,height:o.height||500,width:o.width||500})}):(0,w.jsx)(S.__experimentalImageEditor,{id:t,url:r,height:o.height||500,width:o.width||500,naturalHeight:o.height,naturalWidth:o.width,onSaveImage:({id:e,url:t})=>{n({mediaId:e,mediaSrc:t})},onFinishEditing:()=>c(!1),clientWidth:l})},B=({alt:e,backgroundColor:t,backgroundColorVisibilityStatus:o,backgroundImageSrc:r,clientId:i,dimRatio:a,focalPoint:s,hasParallax:n,imageFit:c,isRepeated:l,overlayColor:d,overlayGradient:u,setAttributes:m,setGradient:g})=>{const p="function"==typeof v.FocalPointPicker,h=!l&&!n,b=(0,S.__experimentalUseMultipleOriginColorsAndGradients)();return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(S.InspectorControls,{children:!!r&&(0,w.jsx)(w.Fragment,{children:p&&(0,w.jsxs)(v.PanelBody,{title:(0,y.__)("Media settings","woocommerce"),children:[(0,w.jsx)(v.ToggleControl,{label:(0,y.__)("Fixed background","woocommerce"),checked:n,onChange:()=>{m({hasParallax:!n})}}),(0,w.jsx)(v.ToggleControl,{label:(0,y.__)("Repeated background","woocommerce"),checked:l,onChange:()=>{m({isRepeated:!l})}}),!l&&(0,w.jsxs)(v.__experimentalToggleGroupControl,{help:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("span",{style:{display:"block",marginBottom:"1em"},children:(0,y.__)("Select “Cover” to have the image automatically fit its container.","woocommerce")}),(0,w.jsx)("span",{children:(0,y.__)("This may affect your ability to freely move the focal point of the image.","woocommerce")})]}),label:(0,y.__)("Image fit","woocommerce"),isBlock:!0,value:c,onChange:e=>m({imageFit:e}),children:[(0,w.jsx)(v.__experimentalToggleGroupControlOption,{label:(0,y.__)("None","woocommerce"),value:"none"}),(0,w.jsx)(v.__experimentalToggleGroupControlOption /* translators: "Cover" is a verb that indicates an image covering the entire container. */,{label:(0,y.__)("Cover","woocommerce"),value:"cover"})]}),(0,w.jsx)(v.FocalPointPicker,{label:(0,y.__)("Focal Point Picker","woocommerce"),url:r,value:s,onChange:e=>m({focalPoint:e})}),h&&(0,w.jsx)(v.TextareaControl,{label:(0,y.__)("Alt text (alternative text)","woocommerce"),value:e,onChange:e=>{m({alt:e})},help:(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(v.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree",children:(0,y.__)("Describe the purpose of the image","woocommerce")})})})]})})},"inspector"),b.hasColorsOrGradients&&(0,w.jsxs)(S.InspectorControls,{group:"color",children:[!!r&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(S.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{clearable:!0,colorValue:d,gradientValue:u,label:(0,y.__)("Overlay","woocommerce"),onColorChange:e=>m({overlayColor:e}),onGradientChange:e=>{g(e),m({overlayGradient:e})},isShownByDefault:!0,resetAllFilter:()=>({overlayColor:void 0,overlayGradient:void 0})}],panelId:i,...b}),(0,w.jsx)(v.__experimentalToolsPanelItem,{isShownByDefault:!0,hasValue:()=>50!==a,label:(0,y.__)("Overlay opacity","woocommerce"),onDeselect:()=>m({dimRatio:50}),panelId:i,resetAllFilter:()=>({dimRatio:50}),children:(0,w.jsx)(v.RangeControl,{required:!0,label:(0,y.__)("Overlay opacity","woocommerce"),max:100,min:0,onChange:e=>m({dimRatio:e}),step:10,value:a})})]}),!1===o?.isBackgroundVisible&&o?.message&&t&&(0,w.jsx)("div",{className:"image-bg-color-warning",children:(0,w.jsx)(v.Notice,{status:"warning",isDismissible:!1,children:o.message})})]})]})};var $=o(2098),M=o(4921);const D=window.wp.escapeHtml,V=({message:e,type:t})=>e?"general"===t?(0,w.jsxs)("span",{children:[(0,y.__)("The following error was returned","woocommerce"),(0,w.jsx)("br",{}),(0,w.jsx)("code",{children:(0,D.escapeHTML)(e)})]}):"api"===t?(0,w.jsxs)("span",{children:[(0,y.__)("The following error was returned from the API","woocommerce"),(0,w.jsx)("br",{}),(0,w.jsx)("code",{children:(0,D.escapeHTML)(e)})]}):e:(0,y.__)("An error has prevented the block from being updated.","woocommerce"),G=({error:e})=>(0,w.jsx)("div",{className:"wc-block-error-message",children:V(e)});o(3120);const z=({className:e="",error:t,isLoading:o=!1,onRetry:i})=>(0,w.jsxs)(v.Placeholder,{icon:(0,w.jsx)(r.A,{icon:$.A}),label:(0,y.__)("Sorry, an error occurred","woocommerce"),className:(0,M.A)("wc-block-api-error",e),children:[(0,w.jsx)(G,{error:t}),i&&(0,w.jsx)(w.Fragment,{children:o?(0,w.jsx)(v.Spinner,{}):(0,w.jsx)(v.Button,{variant:"secondary",onClick:i,children:(0,y.__)("Retry","woocommerce")})})]});function H(e){return e?`${Math.round(100*e.x)}% ${Math.round(100*e.y)}%`:""}function W(e){return`wc-block-${e.split("/")[1]}`}function U(e){return e===P?(0,y.__)("Previously selected product is no longer available","woocommerce"):(0,y.__)("Previously selected category is no longer available","woocommerce")}var q=o(2624);function J(e,t,o){const r=new Set(t.map((e=>e[o])));return e.filter((e=>!r.has(e[o])))}const Y=window.wp.htmlEntities,Q={clear:(0,y.__)("Clear all selected items","woocommerce"),noItems:(0,y.__)("No items found.","woocommerce"), /* Translators: %s search term */ noResults:(0,y.__)("No results for %s","woocommerce"),search:(0,y.__)("Search for items","woocommerce"),selected:e=>(0,y.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */ (0,y._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,y.__)("Search results updated.","woocommerce")},K=(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 i=["0"],a=(e={})=>e.parent?[...a(r[e.parent]),e.name]:e.name?[e.name]:[],s=e=>e.map((e=>{const t=o[e.id];return i.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}})),n=s(o[0]||[]);return Object.entries(o).forEach((([e,t])=>{i.includes(e)||n.push(...s(t||[]))})),n},X=(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,w.jsx)("strong",{children:e},t):(0,w.jsx)(a.Fragment,{children:e},t)))},Z=({label:e})=>(0,w.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),ee=e=>{const{item:t,search:o}=e,r=t.breadcrumbs&&t.breadcrumbs.length;return(0,w.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[r?(0,w.jsx)("span",{className:"woocommerce-search-list__item-prefix",children:(i=t.breadcrumbs,1===i.length?i.slice(0,1).toString():2===i.length?i.slice(0,1).toString()+" › "+i.slice(-1).toString():i.slice(0,1).toString()+" … "+i.slice(-1).toString())}):null,(0,w.jsx)("span",{className:"woocommerce-search-list__item-name",children:X((0,Y.decodeEntities)(t.name),o)})]});var i},te=({countLabel:e,className:t,depth:o=0,controlId:r="",item:i,isSelected:s,isSingle:n,onSelect:c,search:l="",selected:d,useExpandedPanelId:u,...m})=>{const[g,p]=u,h=null!=e&&void 0!==i.count&&null!==i.count,b=!!i.breadcrumbs?.length,_=!!i.children?.length,x=g===i.id,f=(0,M.A)(["woocommerce-search-list__item",`depth-${o}`,t],{"has-breadcrumbs":b,"has-children":_,"has-count":h,"is-expanded":x,"is-radio-button":n});(0,a.useEffect)((()=>{_&&s&&p(i.id)}),[i,_,s,p]);const y=m.name||`search-list-item-${r}`,S=`${y}-${i.id}`,j=(0,a.useCallback)((()=>{p(x?-1:Number(i.id))}),[x,i.id,p]);return _?(0,w.jsx)("div",{className:f,onClick:j,onKeyDown:e=>"Enter"===e.key||" "===e.key?j():null,role:"treeitem",tabIndex:0,children:n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("input",{type:"radio",id:S,name:y,value:i.value,onChange:c(i),onClick:e=>e.stopPropagation(),checked:s,className:"woocommerce-search-list__item-input",...m}),(0,w.jsx)(ee,{item:i,search:l}),h?(0,w.jsx)(Z,{label:e||i.count}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(v.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:s,...!s&&i.children.some((e=>d.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:X((0,Y.decodeEntities)(i.name),l),onChange:()=>{s?c(J(d,i.children,"id"))():c(function(e,t){const o=J(t,e,"id");return[...e,...o]}(d,i.children))()},onClick:e=>e.stopPropagation()}),h?(0,w.jsx)(Z,{label:e||i.count}):null]})}):(0,w.jsxs)("label",{htmlFor:S,className:f,children:[n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("input",{...m,type:"radio",id:S,name:y,value:i.value,onChange:c(i),checked:s,className:"woocommerce-search-list__item-input"}),(0,w.jsx)(ee,{item:i,search:l})]}):(0,w.jsx)(v.CheckboxControl,{...m,id:S,name:y,className:"woocommerce-search-list__item-input",value:(0,Y.decodeEntities)(i.value),label:X((0,Y.decodeEntities)(i.name),l),onChange:c(i),checked:s}),h?(0,w.jsx)(Z,{label:e||i.count}):null]})},oe=te;var re=o(3028);o(5022);const ie=({id:e,label:t,popoverContents:o,remove:i,screenReaderLabel:n,className:c=""})=>{const[l,d]=(0,a.useState)(!1),u=(0,s.useInstanceId)(ie);if(n=n||t,!t)return null;t=(0,Y.decodeEntities)(t);const m=(0,M.A)("woocommerce-tag",c,{"has-remove":!!i}),g=`woocommerce-tag__label-${u}`,p=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("span",{className:"screen-reader-text",children:n}),(0,w.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,w.jsxs)("span",{className:m,children:[o?(0,w.jsx)(v.Button,{className:"woocommerce-tag__text",id:g,onClick:()=>d(!0),children:p}):(0,w.jsx)("span",{className:"woocommerce-tag__text",id:g,children:p}),o&&l&&(0,w.jsx)(v.Popover,{onClose:()=>d(!1),children:o}),i&&(0,w.jsx)(v.Button,{className:"woocommerce-tag__remove",onClick:i(e),label:(0,y.sprintf)( // Translators: %s label. // Translators: %s label. (0,y.__)("Remove %s","woocommerce"),t),"aria-describedby":g,children:(0,w.jsx)(r.A,{icon:re.A,size:20,className:"clear-icon",role:"img"})})]})},ae=ie;o(1939);const se=e=>(0,w.jsx)(oe,{...e}),ne=e=>{const{list:t,selected:o,renderItem:r,depth:i=0,loadMoreChildrenText:s,onLoadMoreChildren:n,totalChildren:c,onSelect:l,instanceId:d,isSingle:u,search:m,useExpandedPanelId:g}=e,[p]=g;return t?(0,w.jsx)(w.Fragment,{children:t.map((t=>{var h;const b=null!==(h=t.children?.length)&&void 0!==h?h:0,_=b&&!u?t.children?.every((({id:e})=>o.find((t=>t.id===e)))):!!o.find((({id:e})=>e===t.id)),x=b&&p===t.id,f=c?.[t.id],v="number"==typeof f&&b<f;return(0,w.jsxs)(a.Fragment,{children:[(0,w.jsx)("li",{children:r({item:t,isSelected:_,onSelect:l,isSingle:u,selected:o,search:m,depth:i,useExpandedPanelId:g,controlId:d})}),x?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ne,{...e,list:t.children,depth:i+1}),n&&v?(0,w.jsx)("li",{children:(0,w.jsx)("button",{type:"button",className:"woocommerce-search-list__item woocommerce-search-list__item-load-more",onClick:()=>n(),children:s||(0,y.__)("Load more","woocommerce")})}):null]}):null]},t.id)}))}):null},ce=({isLoading:e,isSingle:t,selected:o,messages:r,onChange:i,onRemove:a})=>{if(e||t||!o)return null;const s=o.length;return(0,w.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,w.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,w.jsx)("strong",{children:r.selected(s)}),s>0?(0,w.jsx)(v.Button,{variant:"link",isDestructive:!0,onClick:()=>i([]),"aria-label":r.clear,children:(0,y.__)("Clear all","woocommerce")}):null]}),s>0?(0,w.jsx)("ul",{children:o.map(((e,t)=>(0,w.jsx)("li",{children:(0,w.jsx)(ae,{label:e.name,id:e.id,remove:a})},t)))}):null]})},le=({filteredList:e,search:t,onSelect:o,instanceId:i,useExpandedPanelId:a,...s})=>{const{messages:n,renderItem:c,selected:l,isSingle:d,loadMoreChildrenText:u,onLoadMoreChildren:m,totalChildren:g}=s,p=c||se;return 0===e.length?(0,w.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,w.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,w.jsx)(r.A,{icon:q.A,role:"img"})}),(0,w.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,y.sprintf)(n.noResults,t):n.noItems})]}):(0,w.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,w.jsx)(ne,{useExpandedPanelId:a,list:e,selected:l,renderItem:p,loadMoreChildrenText:u,onLoadMoreChildren:m,totalChildren:g,onSelect:o,instanceId:i,isSingle:d,search:t})})},de=e=>{const{className:t="",isCompact:o,isHierarchical:r,isLoading:i,isSingle:n,list:c,messages:l=Q,onChange:d,onSearch:u,selected:m,type:g="text",debouncedSpeak:p}=e,[h,b]=(0,a.useState)(""),_=(0,a.useState)(-1),x=(0,s.useInstanceId)(de),f=(0,a.useMemo)((()=>({...Q,...l})),[l]),S=(0,a.useMemo)((()=>((e,t,o)=>{if(!t)return o?K(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),i=e.map((e=>!!r.test(e.name)&&e)).filter(Boolean);return o?K(i,e):i})(c,h,r)),[c,h,r]);(0,a.useEffect)((()=>{p&&p(f.updated)}),[p,f]),(0,a.useEffect)((()=>{"function"==typeof u&&u(h)}),[h,u]);const j=(0,a.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,a.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,a.useCallback)((e=>{const[t]=m.filter((t=>!e.find((e=>t.id===e.id))));j(t.id)()}),[j,m]);return(0,w.jsxs)("div",{className:(0,M.A)("woocommerce-search-list",t,{"is-compact":o,"is-loading":i,"is-token":"token"===g}),children:["text"===g&&(0,w.jsx)(ce,{...e,onRemove:j,messages:f}),(0,w.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===g?(0,w.jsx)(v.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:f.search,type:"search",value:h,onChange:e=>b(e)}):(0,w.jsx)(v.FormTokenField,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,disabled:i,label:f.search,onChange:I,onInputChange:e=>b(e),suggestions:[],__experimentalValidateInput:()=>!1,value:i?[(0,y.__)("Loading…","woocommerce")]:m.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})}),i?(0,w.jsx)("div",{className:"woocommerce-search-list__list",children:(0,w.jsx)(v.Spinner,{})}):(0,w.jsx)(le,{...e,search:h,filteredList:S,messages:f,onSelect:k,instanceId:x,useExpandedPanelId:_})]})},ue=((0,v.withSpokenMessages)(de),e=>({selected:t,...o})=>{const[r,i]=(0,a.useState)(!0),[s,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),m=async e=>{const t=await x(e);c(t),i(!1)},g=(0,a.useRef)(t);return(0,a.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),i(!1)})).catch(m)}),[g]),(0,w.jsx)(e,{...o,selected:t,error:s,categories:d,isLoading:r})});o(6982);const me=ue((({categories:e=[],error:t=null,isLoading:o=!1,onChange:r,onOperatorChange:i,operator:a="any",selected:s,isCompact:n=!1,isSingle:c=!1,showReviewCount:l})=>{const d={clear:(0,y.__)("Clear all product categories","woocommerce"),list:(0,y.__)("Product Categories","woocommerce"),noItems:(0,y.__)("Your store doesn't have any product categories.","woocommerce"),search:(0,y.__)("Search for product categories","woocommerce"),selected:e=>(0,y.sprintf)(/* translators: %d is the count of selected categories. */ /* translators: %d is the count of selected categories. */ (0,y._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,y.__)("Category search results updated.","woocommerce")};if(t)return(0,w.jsx)(G,{error:t});const u=e.map(I);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(de,{className:"woocommerce-product-categories",list:u,isLoading:o,selected:u.filter((({id:e})=>s.includes(Number(e)))),onChange:r,renderItem:e=>{const{item:t,search:o,depth:r=0}=e,i=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,a=l?(0,y.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,y._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.details?.review_count||0,"woocommerce"),i,t.details?.review_count||0):(0,y.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,y._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.details?.count||0,"woocommerce"),i,t.details?.count||0),s=l?(0,y.sprintf)(/* translators: %d is the count of reviews. */ /* translators: %d is the count of reviews. */ (0,y._n)("%d review","%d reviews",t.details?.review_count||0,"woocommerce"),t.details?.review_count||0):(0,y.sprintf)(/* translators: %d is the count of products. */ /* translators: %d is the count of products. */ (0,y._n)("%d product","%d products",t.details?.count||0,"woocommerce"),t.details?.count||0);return(0,w.jsx)(te,{className:(0,M.A)("woocommerce-product-categories__item","has-count",{"is-searching":o.length>0,"is-skip-level":0===r&&0!==t.parent}),...e,countLabel:s,"aria-label":a})},messages:d,isCompact:n,isHierarchical:!0,isSingle:c}),!!i&&(0,w.jsx)("div",{hidden:s.length<2,children:(0,w.jsx)(v.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,y.__)("Display products matching","woocommerce"),help:(0,y.__)("Pick at least two categories to use this setting.","woocommerce"),value:a,onChange:i,options:[{label:(0,y.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,y.__)("All selected categories","woocommerce"),value:"all"}]})})]})}));var ge=o(4347);var pe=o(923),he=o.n(pe);const be=(0,s.createHigherOrderComponent)((e=>{class t extends a.Component{state={error:null,loading:!1,variations:{},totalVariations:{}};componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:o,showVariations:r}=this.props;r&&(!he()(e.selected,o)||e.isLoading&&!t)&&this.loadVariations()}loadVariations=({offset:e=0}={})=>{const{products:t}=this.props,{loading:o,variations:r,totalVariations:i}=this.state;if(o)return;const a=this.getExpandedProduct();if(!a)return;if(!e&&r?.[a])return;if(r?.[a]&&i?.[a]&&r[a].length>=i[a])return;const s=t.find((e=>e.id===a));if(!s?.variations||0===s.variations.length)return void this.setState({variations:{...this.state.variations,[a]:null},loading:!1,error:null});this.setState({loading:!0});const c=this.state.variations[a]||[];((e,t={})=>l()({path:(0,n.addQueryArgs)("wc/store/v1/products",{type:"variation",parent:e,orderby:"title",per_page:25,...t}),parse:!1}).then((e=>e.json().then((t=>{const o=e.headers.get("x-wp-total");return{variations:t,total:o?Number(o):null}})))))(a,{offset:e}).then((({variations:e,total:t})=>{const o=e.map((e=>({...e,parent:a})));this.setState({variations:{...this.state.variations,[a]:[...c,...o]},totalVariations:{...this.state.totalVariations,[a]:t},loading:!1,error:null})})).catch((async e=>{const t=await x(e);this.setState({variations:{...this.state.variations,[a]:null},totalVariations:{...this.state.totalVariations,[a]:null},loading:!1,error:t})}))};isProductId(e){const{products:t}=this.props;return t.some((t=>t.id===e))}findParentProduct(e){const{products:t}=this.props,o=t.filter((t=>t.variations&&t.variations.find((({id:t})=>t===e))));return o[0]?.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:o}=this.props;if(!o)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:!this.prevSelectedItem||e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:o}=this.props,{error:r,loading:i,variations:a,totalVariations:s}=this.state,n=this.getExpandedProduct(),c=n&&a[n]?.length||0;return(0,w.jsx)(e,{...this.props,error:r||t,onLoadMoreVariations:()=>this.loadVariations({offset:c}),expandedProduct:this.getExpandedProduct(),isLoading:o,totalVariations:s,variations:a,variationsLoading:i})}}return t}),"withProductVariations");var _e=o(1609);const xe=({className:e,item:t,isSelected:o,isLoading:r,onSelect:i,disabled:a,...s})=>(0,w.jsxs)(w.Fragment,{children:[(0,_e.createElement)(te,{...s,key:t.id,className:e,isSelected:o,item:t,onSelect:i,disabled:a}),o&&r&&(0,w.jsx)("div",{className:(0,M.A)("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active"),children:(0,w.jsx)(v.Spinner,{})},"loading")]});o(5653);const we={list:(0,y.__)("Products","woocommerce"),noItems:(0,y.__)("Your store doesn't have any products.","woocommerce"),search:(0,y.__)("Search for a product to display","woocommerce"),updated:(0,y.__)("Product search results updated.","woocommerce")},fe=(e=>t=>{let{selected:o}=t;o=void 0===o?null:o;const r=null===o;return Array.isArray(o)?(0,w.jsx)(e,{...t}):(0,w.jsx)(e,{...t,selected:r?[]:[o]})})((je=be((0,s.withInstanceId)((e=>{const{expandedProduct:t=null,error:o,instanceId:r,isCompact:i=!1,isLoading:a,onChange:s,onLoadMoreVariations:n,totalVariations:c,onSearch:l,products:d,renderItem:u,selected:m=[],showVariations:g=!1,variations:p,variationsLoading:h}=e;if(o)return(0,w.jsx)(G,{error:o});const b=[...d,...p&&t&&p[t]?p[t]:[]].map(k);return(0,w.jsx)(de,{className:"woocommerce-products",list:b,isCompact:i,isLoading:a,isSingle:!0,selected:b.filter((({id:e})=>m.includes(Number(e)))),onChange:s,loadMoreChildrenText:g?(0,y.__)("Load more variations","woocommerce"):void 0,onLoadMoreChildren:g?n:void 0,totalChildren:g?c:void 0,renderItem:u||(g?e=>{const{item:t,search:o,depth:i=0,isSelected:s,onSelect:n}=e,c=t.details?.variations&&Array.isArray(t.details.variations)?t.details.variations.length:0,l=(0,M.A)("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${i}`,"has-count",{"is-searching":o.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":c>0});if(!t.breadcrumbs.length){const o=t.details?.variations&&t.details.variations.length>0;return(0,w.jsx)(xe,{...e,className:(0,M.A)(l,{"is-selected":s}),isSelected:s,item:t,onSelect:()=>()=>{n(t)()},isLoading:a||h,countLabel:o?(0,y.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,y.__)("%1$d variations","woocommerce"),t.details?.variations.length):null,name:`products-${r}`,"aria-label":o?(0,y.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,y._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,R.isEmpty)(t.details?.variation)?e:{...e,item:{...e.item,name:t.details?.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.details?.variation}`};return(0,w.jsx)(te,{...d,className:l,name:`variations-${r}`})}:void 0),onSearch:l,messages:{...we,...e.messages},isHierarchical:!0})}))),({selected:e,...t})=>{const[o,r]=(0,a.useState)(!0),[i,s]=(0,a.useState)(null),[n,c]=(0,a.useState)([]),l=u.productCount>100,d=async e=>{const t=await x(e);s(t),r(!1)},m=(0,a.useRef)(e);(0,a.useEffect)((()=>{_({selected:m.current}).then((e=>{c(e),r(!1)})).catch(d)}),[m]);const g=(0,ge.YQ)((t=>{_({selected:e,search:t}).then((e=>{c(e),r(!1)})).catch(d)}),400),p=(0,a.useCallback)((e=>{r(!0),g(e)}),[r,g]);return(0,w.jsx)(je,{...t,selected:e,error:i,products:n,isLoading:o,onSearch:l?p:null})})),ve=window.wp.data,ye=window.wp.coreData,Se=window.wc.wcBlocksSharedContext;var je,ke=o(7356);const Ie=window.wp.styleEngine;function Ce(e={}){const t={};return(0,Ie.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function Ee(e,t){return e&&t?`has-${(0,ke.c)(t)}-${e}`:""}const Pe=e=>{const t=(e=>{const t=(0,R.isObject)(e)?e:{style:{}};let o=t.style;return(0,R.isString)(o)&&(o=JSON.parse(o)||{}),(0,R.isObject)(o)||(o={}),{...t,style:o}})(e),o=function(e){const{backgroundColor:t,textColor:o,gradient:r,style:i}=e,a=Ee("background-color",t),s=Ee("color",o),n=function(e){if(e)return`has-${e}-gradient-background`}(r),c=n||i?.color?.gradient;return{className:(0,M.A)(s,n,{[a]:!c&&!!a,"has-text-color":o||i?.color?.text,"has-background":t||i?.color?.background||r||i?.color?.gradient,"has-link-color":(0,R.isObject)(i?.elements?.link)?i?.elements?.link?.color:void 0}),style:Ce({color:i?.color||{}})}}(t),r=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:o}=e,r=t?Ee("border-color",t):"";return(0,M.A)({"has-border-color":!!t||!!o?.border?.color,[r]:!!r})}(e),style:Ce({border:t})}}(t),i=function(e){return{className:void 0,style:Ce({spacing:e.style?.spacing||{}})}}(t),a=(e=>{const t=(0,R.isObject)(e.style.typography)?e.style.typography:{},o=(0,R.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:o,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,M.A)(a.className,o.className,r.className,i.className),style:{...a.style,...o.style,...r.style,...i.style}}},Ae=({className:e="",onResize:t,...o})=>{const[r,i]=(0,a.useState)(!1),s=(0,M.A)(e,{"is-resizing":r}),n=(0,ge.dh)(((e,o,a,s)=>{r||i(!0),t?.(e,o,a,s)}),50,{leading:!0});return(0,w.jsx)(v.ResizableBox,{className:s,enable:{bottom:!0},onResize:n,onResizeStop:(...e)=>{t?.(...e),i(!1)},...o})},Ne={icon:i.A,label:(0,y.__)("Featured Product","woocommerce")},Re={...Ne,cropLabel:(0,y.__)("Edit product image","woocommerce"),editLabel:(0,y.__)("Edit selected product","woocommerce")},Le={...Ne,emptyMessage:(0,y.__)("No product is selected.","woocommerce"),noSelectionButtonLabel:(0,y.__)("Select a product","woocommerce")},Fe={...Ne,description:(0,y.__)("Highlight a product or variation.","woocommerce"),editLabel:(0,y.__)("Showing Featured Product block preview.","woocommerce")},Oe=(0,s.compose)([f,v.withSpokenMessages,e=>t=>{const[o,r]=(0,a.useState)(!1),{category:i,clientId:s,editMode:n,product:c}=t,l=i||c,d=l?.link||l?.permalink,u=(0,ve.useSelect)((e=>e("core/block-editor").getBlock(s)),[s]),m=e=>{if(!e)return;if("core/button"===e.name)return e;const t=e.innerBlocks||[];for(const e of t){const t=m(e);if(t)return t}},g=u?.innerBlocks?.[0],p=m(g),h=p?.clientId||"",b=(0,a.useMemo)((()=>p?.attributes||{}),[p]),{url:_}=b,{updateBlockAttributes:x}=(0,ve.useDispatch)("core/block-editor");return(0,a.useEffect)((()=>{o&&h&&!n&&d&&_&&d!==_&&(x(h,{url:d}),r(!1))}),[h,o,n,d,x,_]),(0,w.jsx)(e,{...t,triggerUrlUpdate:()=>r(!0)})},e=>t=>{const[o,r]=(0,a.useState)(!1),{isSelected:i}=t;return(0,a.useEffect)((()=>{r(!1)}),[i]),(0,w.jsx)(e,{...t,useEditingImage:[o,r]})},(({description:e,editLabel:t,icon:o,label:r})=>i=>s=>{const{attributes:n,debouncedSpeak:c,name:l,setAttributes:d,triggerUrlUpdate:u=()=>{},error:m}=s,g=W(l),[p,h]=(0,a.useState)(),b=l===P&&n.productId||l===E&&n.categoryId,[_,x]=(0,a.useState)(!b),f=l===P?n?.productId:n?.categoryId,{status:S,isDeleted:j,isLoading:k}=(({itemId:e,itemType:t})=>{const{product:o,isResolutionFinished:r}=(i=e,(0,ve.useSelect)((e=>{if(!i)return{product:void 0,isResolving:!1};const t="string"==typeof i?parseInt(i,10):i;return{product:e(ye.store).getEditedEntityRecord("root","product",t),isResolving:e(ye.store).isResolving("getEditedEntityRecord",["root","product",t]),isResolutionFinished:e(ye.store).hasFinishedResolution("getEditedEntityRecord",["root","product",t])}}),[i]));var i;return(0,ve.useSelect)((i=>{if(!e)return{status:null,isDeleted:!1,isLoading:!1};if(t===P){var a;const e=!r,t="trash"===o?.status||!e&&!o;return{status:null!==(a=o?.status)&&void 0!==a?a:null,isDeleted:t,isLoading:e}}if(t===E){const{getEntityRecords:t,hasFinishedResolution:o}=i(ye.store),r=["taxonomy","product_cat",{include:[e]}],a=t(...r),s=o("getEntityRecords",r),n=!a?.length;return{status:n?"deleted":null,isDeleted:n,isLoading:!s}}return{status:null,isDeleted:!0,isLoading:!1}}),[e,t,o,r])})({itemId:f,itemType:l});return(0,a.useEffect)((()=>{if(!k){const e=l===P&&"publish"!==S||j;e&&x(e)}}),[S,j,l,k]),_?(0,w.jsxs)(v.Placeholder,{icon:(0,w.jsx)(v.Icon,{icon:o}),label:r,className:g,children:[(0,w.jsxs)(v.__experimentalHStack,{alignment:"center",children:[j?(0,w.jsx)(v.Icon,{icon:q.A,className:"wc-blocks-featured-items__orange-info-icon"}):(0,w.jsx)(v.Icon,{icon:q.A}),(0,w.jsx)(v.__experimentalText,{children:j?U(l):e})]}),(0,w.jsxs)("div",{className:`${g}__selection`,children:[l===E&&(0,w.jsx)(me,{selected:p?.categoryId?[p.categoryId]:[],onChange:(e=[])=>{const t=e[0]?e[0].id:0;h({categoryId:t,mediaId:0,mediaSrc:""}),u()},isSingle:!0}),l===P&&(0,w.jsx)(fe,{selected:p?.productId?[p.productId]:[],showVariations:!0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;h({productId:t,mediaId:0,mediaSrc:""}),u()}}),(0,w.jsx)(v.Button,{variant:"primary",onClick:()=>{p&&(d(p),x(!1),c(t))},children:(0,y.__)("Done","woocommerce")})]})]}):(0,w.jsx)(i,{...s,isLoading:k,error:k?null:m,useEditMode:[_,x]})})(Fe),(({emptyMessage:e,icon:t,label:o,noSelectionButtonLabel:r})=>i=>s=>{const[n]=s.useEditingImage,[,c]=s.useEditMode,{attributes:l,category:d,isLoading:u,isSelected:m,name:g,product:p,setAttributes:h}=s,{mediaId:b,mediaSrc:_,isRepeated:x,imageFit:f}=l,j=d||p,[k,I]=(0,a.useState)({}),{backgroundImageSrc:C,isImageBgTransparent:E,originalImgDimension:P}=F({item:j,mediaId:b,mediaSrc:_,blockName:g}),R=(0,a.useRef)(null),[L,O]=(0,a.useState)({height:0,width:0});(0,a.useEffect)((()=>{const e=new ResizeObserver((e=>{O({height:e[0].contentRect.height,width:e[0].contentRect.width})}));if(!1===u){const t=R.current;if(!t)return;e.observe(t)}return()=>e.disconnect()}),[u]);const T=(0,a.useMemo)((()=>(({isImageBgTransparent:e,originalImgDimension:t,parentContainerDimension:o,isRepeated:r,imageFit:i})=>e?{isBackgroundVisible:!0,message:null}:e||!r&&"cover"!==i?!e&&t.height>=o.height&&t.width>=o.width?{isBackgroundVisible:!1,message:(0,y.__)("You've set background color to an opaque image, the background color cannot be seen.","woocommerce")}:(t.height<o.height||(t.width,o.width),{isBackgroundVisible:!0,message:null}):r?{isBackgroundVisible:!1,message:(0,y.__)("You’ve set a background color behind an image set to repeat, the background color cannot be seen.","woocommerce")}:{isBackgroundVisible:!1,message:(0,y.__)("You’ve set a background color behind an image set to cover, the background color cannot be seen.","woocommerce")})({isImageBgTransparent:E,originalImgDimension:P,parentContainerDimension:L,isRepeated:x,imageFit:f})),[L,P,x,f,E]),B=W(g),$=(0,a.useCallback)(((e,t,o)=>{h({minHeight:parseInt(o.style.height,10)})}),[h]),D=Pe(l);return n?(0,w.jsx)(i,{...s,backgroundImageSize:k,backgroundColorVisibilityStatus:T}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(i,{...s,backgroundImageSize:k,backgroundColorVisibilityStatus:T}),j?(()=>{const{contentAlign:e,dimRatio:t,focalPoint:o,hasParallax:r,minHeight:i,overlayColor:a,overlayGradient:s,style:n,textColor:c}=l,g=(0,M.A)(B,{"is-selected":m&&"preview"!==l.categoryId&&"preview"!==l.productId,"is-loading":!j&&u,"is-not-found":!j&&!u,"has-background-dim":0!==t,"is-repeated":x},0===(h=t)||50===h?null:"has-background-dim-"+10*Math.round(h/10),"center"!==e&&`has-${e}-content`,D.className);var h;const b={borderRadius:n?.border?.radius,color:c?`var(--wp--preset--color--${c})`:n?.color?.text,boxSizing:"border-box",minHeight:i,...D.style},_=!x&&!r,v=function({focalPoint:e,imageFit:t,isImgElement:o,isRepeated:r,url:i}){let a={};var s;return a=o?{...a,...(s=e,s?{objectPosition:H(s)}:{}),objectFit:t}:{...a,...i&&{backgroundImage:`url(${i})`},backgroundPosition:H(e),...!r&&{backgroundRepeat:"no-repeat",backgroundSize:"cover"===t?t:"auto"}},a}({focalPoint:o,imageFit:f,isImgElement:_,isRepeated:x,url:C}),y={background:s,backgroundColor:a};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ae,{enable:{bottom:!0},onResize:$,showHandle:m,style:{minHeight:i}}),(0,w.jsx)("div",{className:g,ref:R,style:b,children:(0,w.jsxs)("div",{className:`${B}__wrapper`,children:[(0,w.jsx)("div",{className:"background-dim__overlay",style:y}),C&&(_?(0,w.jsx)("img",{alt:j.name,className:`${B}__background-image`,src:C,style:v,onLoad:e=>{I({height:e.currentTarget?.naturalHeight,width:e.currentTarget?.naturalWidth})}}):(0,w.jsx)("div",{className:(0,M.A)(`${B}__background-image`,{"has-parallax":r}),style:v})),p?(0,w.jsx)(S.BlockContextProvider,{value:{postId:p.id,postType:"product"},children:(0,w.jsx)(Se.ProductDataContextProvider,{product:p,isLoading:u,children:(0,w.jsx)("div",{className:`${B}__inner-blocks`,children:(0,w.jsx)(S.InnerBlocks,{template:N(p),templateLock:!1})})})}):(0,w.jsx)(S.BlockContextProvider,{value:{termId:d.term_id,termTaxonomy:"product_cat"},children:(0,w.jsx)("div",{className:`${B}__inner-blocks`,children:(0,w.jsx)(S.InnerBlocks,{template:A(d),templateLock:!1})})})]})})]})})():(0,w.jsx)(v.Placeholder,{className:B,icon:(0,w.jsx)(v.Icon,{icon:t}),label:o,children:u?(0,w.jsx)(v.Spinner,{}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("p",{children:e}),(0,w.jsx)("div",{style:{flexBasis:"100%",height:"0"}}),(0,w.jsx)("button",{type:"button",className:"components-button is-secondary",onClick:()=>c(!0),children:r})]})})]})})(Le),e=>t=>{const{error:o,isLoading:r,name:i}=t,a=W(i),s=i===E?t.getCategory:t.getProduct;return o?(0,w.jsx)(z,{className:`${a}-error`,error:o,isLoading:r,onRetry:s}):(0,w.jsx)(e,{...t})},e=>t=>{const[o,r]=t.useEditingImage,i=(0,a.useRef)(null),{attributes:s,backgroundImageSize:n,name:c,setAttributes:l}=t,{mediaId:d,mediaSrc:u}=s,m=c===P?t.product:t.category,{backgroundImageId:g,backgroundImageSrc:p}=F({item:m,mediaId:d,mediaSrc:u,blockName:c});return o?(0,w.jsx)("div",{ref:i,children:(0,w.jsx)(T,{align:s.align,backgroundImageId:g,backgroundImageSize:n,backgroundImageSrc:p,containerRef:i,isEditingImage:o,setAttributes:l,setIsEditingImage:r})}):(0,w.jsx)(e,{...t})},e=>t=>{const{attributes:o,backgroundColorVisibilityStatus:r,clientId:i,name:a,setAttributes:s}=t,{alt:n,dimRatio:c,focalPoint:l,hasParallax:d,isRepeated:u,imageFit:m,mediaId:g,mediaSrc:p,overlayColor:h,overlayGradient:b,backgroundColor:_,style:x}=o,f=a===P?t.product:t.category,{setGradient:v}=(0,S.__experimentalUseGradient)({gradientAttribute:"overlayGradient",customGradientAttribute:"overlayGradient"}),{backgroundImageSrc:y}=F({item:f,mediaId:g,mediaSrc:p,blockName:a});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(B,{alt:n,backgroundImageSrc:y,dimRatio:c,focalPoint:l,hasParallax:d,isRepeated:u,imageFit:m,overlayColor:h,overlayGradient:b,setAttributes:s,setGradient:v,backgroundColorVisibilityStatus:r,backgroundColor:_||x?.color?.background,clientId:i}),(0,w.jsx)(e,{...t})]})},(({cropLabel:e,editLabel:t})=>o=>r=>{const[i,a]=r.useEditingImage,[s,n]=r.useEditMode,{attributes:c,category:l,name:d,product:u,setAttributes:m}=r,{contentAlign:g,mediaId:p,mediaSrc:h}=c,b=l||u,{backgroundImageId:_,backgroundImageSrc:x}=F({item:b,mediaId:p,mediaSrc:h,blockName:d});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(O,{backgroundImageId:_,backgroundImageSrc:x,contentAlign:g,cropLabel:e,editLabel:t,editMode:s,isEditingImage:i,mediaSrc:h,setAttributes:m,setIsEditingImage:a,setEditMode:n}),(0,w.jsx)(o,{...r})]})})(Re)])((()=>(0,w.jsx)(w.Fragment,{}))),Te=window.wp.blocks;function Be(e){return function(t){const o=(0,S.useBlockProps)(),{color:r,...i}=o.style;return(0,w.jsx)("div",{...o,style:i,children:(0,w.jsx)(e,{...t})})}}const $e={attributes:{productId:"preview",previewProduct:{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:(0,y.__)("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,y.__)("Add to cart","woocommerce"),description:(0,y.__)("Add to cart","woocommerce")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}}},Me=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,"filter":{"duotone":true},"color":{"background":true,"text":true},"spacing":{"padding":true,"__experimentalDefaultControls":{"padding":true},"__experimentalSkipSerialization":true},"__experimentalBorder":{"color":true,"radius":true,"width":true,"__experimentalDefaultControls":{"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},"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}},"selectors":{"filter":{"duotone":".wp-block-woocommerce-featured-product .wc-block-featured-product__background-image"}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}');!function(e,t,o,r){const i={attributes:{...o.attributes,minHeight:{type:"number",default:(0,d.getSetting)("defaultHeight",500)}},supports:{...o.supports,color:{background:o.supports?.color?.background,text:o.supports?.color?.text},spacing:{padding:o.supports?.spacing?.padding,__experimentalDefaultControls:{padding:o.supports?.spacing?.__experimentalDefaultControls},__experimentalSkipSerialization:o.supports?.spacing?.__experimentalSkipSerialization},__experimentalBorder:o?.supports?.__experimentalBorder}},a={attributes:{alt:"",contentAlign:"center",dimRatio:50,hasParallax:!1,isRepeated:!1,height:(0,d.getSetting)("defaultHeight",500),mediaSrc:"",overlayColor:"#000000",showDesc:!0}};(0,Te.registerBlockType)(o,{...i,example:{...a,...t},edit:Be(e),save:()=>(0,w.jsx)(S.InnerBlocks.Content,{}),...r})}(Oe,$e,Me,{deprecated:[{attributes:{...Me.attributes,showDesc:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0}},save:()=>(0,w.jsx)(S.InnerBlocks.Content,{}),isEligible:e=>"boolean"==typeof e.editMode,migrate:(e,t)=>{const{editMode:o,showDesc:r,showPrice:i,...a}=e;return!1!==i&&t.unshift((0,Te.createBlock)("woocommerce/product-price",{style:{spacing:{padding:{bottom:"16px"}}},textAlign:"center"})),!1!==r&&t.unshift((0,Te.createBlock)("woocommerce/product-summary",{showDescriptionIfEmpty:!0,summaryLength:80,style:{typography:{textAlign:"center"}}})),t.unshift((0,Te.createBlock)("core/post-title",{level:2,isLink:!1,textAlign:"center",__woocommerceNamespace:"woocommerce/product-collection/product-title"})),[a,t]}}],icon:{src:(0,w.jsx)(r.A,{icon:i.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}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var o=i[e]={exports:{}};return r[e](o,o.exports,a),o.exports}a.m=r,e=[],a.O=(t,o,r,i)=>{if(!o){var s=1/0;for(d=0;d<e.length;d++){for(var[o,r,i]=e[d],n=!0,c=0;c<o.length;c++)(!1&i||s>=i)&&Object.keys(a.O).every((e=>a.O[e](o[c])))?o.splice(c--,1):(n=!1,i<s&&(s=i));if(n){e.splice(d--,1);var l=r();void 0!==l&&(t=l)}}return t}i=i||0;for(var d=e.length;d>0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[o,r,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.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 i=Object.create(null);a.r(i);var s={};t=t||[null,o({}),o([]),o(o)];for(var n=2&r&&e;"object"==typeof n&&!~t.indexOf(n);n=o(n))Object.getOwnPropertyNames(n).forEach((t=>s[t]=()=>e[t]));return s.default=()=>e,a.d(i,s),i},a.d=(e,t)=>{for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.j=8931,(()=>{var e={8931:0};a.O.j=t=>0===e[t];var t=(t,o)=>{var r,i,[s,n,c]=o,l=0;if(s.some((t=>0!==e[t]))){for(r in n)a.o(n,r)&&(a.m[r]=n[r]);if(c)var d=c(a)}for(t&&t(o);l<s.length;l++)i=s[l],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(d)},o=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var s=a.O(void 0,[94],(()=>a(9235)));s=a.O(s),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["featured-product"]=s})();
Copyright ©2021 || Defacer Indonesia