13 lines
60 KiB
JavaScript
13 lines
60 KiB
JavaScript
|
(()=>{var e,t={9008:(e,t,r)=>{"use strict";r.r(t);var c=r(9196),o=r(5736),n=r(444);const a=(0,c.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,c.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));var i=r(1984);const s=window.wp.blocks,l=window.wc.wcSettings;var u,m,p,d,_,b,g,y,w,k;const h=(0,l.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),v=h.pluginUrl+"images/",E=(h.pluginUrl,h.buildPhase),f=(null===(u=l.STORE_PAGES.shop)||void 0===u||u.permalink,null===(m=l.STORE_PAGES.checkout)||void 0===m||m.id,null===(p=l.STORE_PAGES.checkout)||void 0===p||p.permalink,null===(d=l.STORE_PAGES.privacy)||void 0===d||d.permalink,null===(_=l.STORE_PAGES.privacy)||void 0===_||_.title,null===(b=l.STORE_PAGES.terms)||void 0===b||b.permalink,null===(g=l.STORE_PAGES.terms)||void 0===g||g.title,null===(y=l.STORE_PAGES.cart)||void 0===y||y.id,null===(w=l.STORE_PAGES.cart)||void 0===w||w.permalink,null!==(k=l.STORE_PAGES.myaccount)&&void 0!==k&&k.permalink?l.STORE_PAGES.myaccount.permalink:(0,l.getSetting)("wpLoginUrl","/wp-login.php"),(0,l.getSetting)("localPickupEnabled",!1),(0,l.getSetting)("countries",{})),C=(0,l.getSetting)("countryData",{}),x=(Object.fromEntries(Object.keys(C).filter((e=>!0===C[e].allowBilling)).map((e=>[e,f[e]||""]))),Object.fromEntries(Object.keys(C).filter((e=>!0===C[e].allowBilling)).map((e=>[e,C[e].states||[]]))),Object.fromEntries(Object.keys(C).filter((e=>!0===C[e].allowShipping)).map((e=>[e,f[e]||""]))),Object.fromEntries(Object.keys(C).filter((e=>!0===C[e].allowShipping)).map((e=>[e,C[e].states||[]]))),Object.fromEntries(Object.keys(C).map((e=>[e,C[e].locale||[]])))),P=()=>E>1,S=window.wp.blockEditor;var T=r(9307);const N=window.wp.data,B=(0,T.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),I=()=>(0,T.useContext)(B),R=({children:e,currentPostId:t=0,previewData:r={},currentView:o="",isPreview:n=!1})=>{const a=(0,N.useSelect)((e=>t||e("core/editor").getCurrentPostId()),[t]),i=(0,T.useCallback)((e=>r&&e in r?r[e]:{}),[r]),s={isEditor:!0,currentPostId:a,currentView:o,previewData:r,getPreviewData:i,isPreview:n};return(0,c.createElement)(B.Provider,{value:s},e)},A=window.wp.components,M=({clientId:e,registeredBlocks:t,defaultTemplate:r=[]})=>{const c=(0,T.useRef)(t),o=(0,T.useRef)(r),n=(0,N.useRegistry)(),{isPreview:a}=I();(0,T.useEffect)((()=>{let t=!1;if(a)return;const{replaceInnerBlocks:r}=(0,N.dispatch)("core/block-editor");return n.subscribe((()=>{if(!n.select("core/block-editor").getBlock(e))return;const a=n.select("core/block-editor").getBlocks(e);if(0===a.length&&o.current.length>0&&!t){const c=(0,s.createBlocksFromInnerBlocksTemplate)(o.current);if(0!==c.length)return t=!0,void r(e,c)}const i=c.current.map((e=>(0,s.getBlockType)(e))),l=((e,t)=>{const r=t.filter((e=>e&&(({attributes:e})=>{var t,r,c;return Boolean((null===(t=e.lock)||void 0===t?void 0:t.remove)||(null===(r=e.lock)||void 0===r||null===(c=r.default)||void 0===c?void 0:c.remove))})(e))),c=[];return r.forEach((t=>{if(void 0===t)return;const r=e.find((e=>e.name===t.name));r||c.push(t)})),c})(a,i);if(0===l.length)return;let u=-1;const m=l.map((e=>{const t=o.current.findIndex((([t])=>t===e.name)),r=(0,s.createBlock)(e.name);return-1===u&&(u=(({defaultTemplatePosition:e,innerBlocks:t,currentDefaultTemplate:r})=>{switch(e){case-1:return t.length;case 0:return 0;default:const c=r.current[e-1],o=t.findIndex((({name:e})=>e===c[0]));return-1===o?e:o+1}})({defaultTemplatePosition:t,innerBlocks:a,currentDefaultTemplate:o})),r}));n.batch((()=>{n.dispatch("core/block-editor").insertBlocks(m,u,e)}))}),"core/block-editor")}),[e,a,n])},L=({style:e})=>{const t=[{se
|
|||
|
(0,o.__)("%s (optional)","woocommerce"),e.label)),e.priority&&(X(e.priority)&&(t.index=e.priority),J(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},te=Object.entries(x).map((([e,t])=>[e,Object.entries(t).map((([e,t])=>[e,ee(t)])).reduce(((e,[t,r])=>(e[t]=r,e)),{})])).reduce(((e,[t,r])=>(e[t]=r,e)),{}),re=(window.wp.url,e=>{const t=((e,t,r="")=>{const c=r&&void 0!==te[r]?te[r]:{};return e.map((e=>({key:e,...l.defaultAddressFields[e]||{},...c[e]||{},...t[e]||{}}))).sort(((e,t)=>e.index-t.index))})(Object.keys(l.defaultAddressFields),{},e.country),r=Object.assign({},e);return t.forEach((({key:t="",hidden:c=!1})=>{c&&((e,t)=>e in t)(t,e)&&(r[t]="")})),r}),ce=window.CustomEvent||null,oe=(e,t,r=!1,c=!1)=>{if("function"!=typeof jQuery)return()=>{};const o=()=>{((e,{bubbles:t=!1,cancelable:r=!1,element:c,detail:o={}})=>{if(!ce)return;c||(c=document.body);const n=new ce(e,{bubbles:t,cancelable:r,detail:o});c.dispatchEvent(n)})(t,{bubbles:r,cancelable:c})};return jQuery(document).on(e,o),()=>jQuery(document).off(e,o)},ne=e=>{const t=null==e?void 0:e.detail;t&&t.preserveCartData||(0,N.dispatch)(Z.CART_STORE_KEY).invalidateResolutionForStore()},ae=e=>{(null!=e&&e.persisted||"back_forward"===(window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:""))&&(0,N.dispatch)(Z.CART_STORE_KEY).invalidateResolutionForStore()},ie=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},se={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},le={...se,email:""},ue={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:Z.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},me=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,(0,W.decodeEntities)(t)]))),pe={cartCoupons:Z.EMPTY_CART_COUPONS,cartItems:Z.EMPTY_CART_ITEMS,cartFees:Z.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:Z.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:Z.EMPTY_CART_ITEM_ERRORS,cartTotals:ue,cartIsLoading:!0,cartErrors:Z.EMPTY_CART_ERRORS,billingAddress:le,shippingAddress:se,shippingRates:Z.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentMethods:Z.EMPTY_PAYMENT_METHODS,paymentRequirements:Z.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},extensions:Z.EMPTY_EXTENSIONS},de=(e={shouldSelect:!0})=>{const{isEditor:t,previewData:r}=I(),c=null==r?void 0:r.previewCart,{shouldSelect:o}=e,n=(0,T.useRef)();(0,T.useEffect)((()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),(null===(e=window.wcBlocksStoreCartListeners)||void 0===e?void 0:e.count)>0)return void window.wcBlocksStoreCartListeners.count++;var e;document.body.addEventListener("wc-blocks_added_to_cart",ne),document.body.addEventListener("wc-blocks_removed_from_cart",ne),window.addEventListener("pageshow",ae);const t=oe("added_to_cart","wc-blocks_added_to_cart"),r=oe("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",ne),document.body.removeEventListener("wc-blocks_removed_from_cart",ne),window.removeEventListener("pageshow",ae),t(),r()}})(),ie)),[]);const a=(0,N.useSelect)(((e,{dispatch:r})=>{if(!o)return pe;if(t)return{cartCoupons:c.coupons,cartItems:c.items,crossSellsProducts:c.cross_sells,cartFees:c.fees,cartItemsCount:c.items_count,cartItemsWeight:c.items_weight,cartNeedsPayment:c.needs_payment,cartNeedsShipping:c.needs_shipping,cartItemErrors:Z.EMPTY_CART_ITEM_ERRORS,cartTotals:c.totals,cartIsLoading:!1,cartErrors:Z.
|
|||
|
(0,o._n)("(%d item)","(%d items)",t,"woocommerce"),t))},save:()=>(0,c.createElement)("div",{...S.useBlockProps.save()})});const _e={label:{type:"string",default:(0,o.__)("Your cart","woocommerce")}};(0,s.registerBlockType)("woocommerce/mini-cart-title-label-block",{icon:{src:(0,c.createElement)(i.Z,{icon:K.Z,className:"wc-block-editor-components-block-icon"})},attributes:_e,edit:({attributes:{label:e},setAttributes:t})=>{const r=(0,S.useBlockProps)();return(0,c.createElement)("span",{...r},(0,c.createElement)(S.RichText,{allowedFormats:[],value:e,onChange:e=>t({label:e})}))},save:()=>(0,c.createElement)("div",{...S.useBlockProps.save()})});var be=r(5186);(0,s.registerBlockType)("woocommerce/mini-cart-items-block",{icon:{src:(0,c.createElement)(i.Z,{icon:be.Z,className:"wc-block-editor-components-block-icon"})},edit:()=>{const e=(0,S.useBlockProps)({className:"wc-block-mini-cart__items"}),t=[["woocommerce/mini-cart-products-table-block",{}]].filter(Boolean);return(0,c.createElement)("div",{...e},(0,c.createElement)(S.InnerBlocks,{template:t,renderAppender:S.InnerBlocks.ButtonBlockAppender,templateLock:!1,allowedBlocks:F()}))},save:()=>(0,c.createElement)("div",{...S.useBlockProps.save()},(0,c.createElement)(S.InnerBlocks.Content,null))});var ge=r(8960),ye=r(5904),we=r(4697);const ke=["BUTTON","FIELDSET","INPUT","OPTGROUP","OPTION","SELECT","TEXTAREA","A"],he=({children:e,style:t={},...r})=>{const o=(0,T.useRef)(null),n=()=>{o.current&&ye.focus.focusable.find(o.current).forEach((e=>{ke.includes(e.nodeName)&&e.setAttribute("tabindex","-1"),e.hasAttribute("contenteditable")&&e.setAttribute("contenteditable","false")}))},a=(0,we.y1)(n,0,{leading:!0});return(0,T.useLayoutEffect)((()=>{let e;return n(),o.current&&(e=new window.MutationObserver(a),e.observe(o.current,{childList:!0,attributes:!0,subtree:!0})),()=>{e&&e.disconnect(),a.cancel()}}),[a]),(0,c.createElement)("div",{ref:o,"aria-disabled":"true",style:{userSelect:"none",pointerEvents:"none",cursor:"normal",...t},...r},e)};var ve=r(4184),Ee=r.n(ve),fe=r(5158),Ce=r(9630);r(4667);const xe=({className:e,quantity:t=1,minimum:r=1,maximum:n,onChange:a=(()=>{}),step:i=1,itemName:s="",disabled:l})=>{const u=Ee()("wc-block-components-quantity-selector",e),m=(0,T.useRef)(null),p=(0,T.useRef)(null),d=(0,T.useRef)(null),_=void 0!==n,b=!l&&t-i>=r,g=!l&&(!_||t+i<=n),y=(0,T.useCallback)((e=>{let t=e;_&&(t=Math.min(t,Math.floor(n/i)*i)),t=Math.max(t,Math.ceil(r/i)*i),t=Math.floor(t/i)*i,t!==e&&a(t)}),[_,n,r,a,i]),w=(0,we.y1)(y,300);(0,T.useLayoutEffect)((()=>{y(t)}),[t,y]);const k=(0,T.useCallback)((e=>{const r=void 0!==typeof e.key?"ArrowDown"===e.key:e.keyCode===Ce.DOWN,c=void 0!==typeof e.key?"ArrowUp"===e.key:e.keyCode===Ce.UP;r&&b&&(e.preventDefault(),a(t-i)),c&&g&&(e.preventDefault(),a(t+i))}),[t,a,g,b,i]);return(0,c.createElement)("div",{className:u},(0,c.createElement)("input",{ref:m,className:"wc-block-components-quantity-selector__input",disabled:l,type:"number",step:i,min:r,max:n,value:t,onKeyDown:k,onChange:e=>{let r=parseInt(e.target.value,10);r=isNaN(r)?t:r,r!==t&&(a(r),w(r))},"aria-label":(0,o.sprintf)(/* translators: %s refers to the item name in the cart. */
|
|||
|
(0,o.__)("Quantity of %s in your cart.","woocommerce"),s)}),(0,c.createElement)("button",{ref:p,"aria-label":(0,o.sprintf)(/* translators: %s refers to the item name in the cart. */
|
|||
|
(0,o.__)("Reduce quantity of %s","woocommerce"),s),className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--minus",disabled:!b,onClick:()=>{const e=t-i;a(e),(0,fe.speak)((0,o.sprintf)(/* translators: %s refers to the item's new quantity in the cart. */
|
|||
|
(0,o.__)("Quantity reduced to %s.","woocommerce"),e)),y(e)}},"-"),(0,c.createElement)("button",{ref:d,"aria-label":(0,o.sprintf)(/* translators: %s refers to the item's name in the cart. */
|
|||
|
(0,o.__)("Increase quantity of %s","woocommerce"),s),disabled:!g,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=t+i;a(e),(0,fe.speak)((0,o.sprintf)(/* translators: %s refers to the item's new quantity in the cart. */
|
|||
|
(0,o.__)("Quantity increased to %s.","woocommerce"),e)),y(e)}},"+"))},Pe=window.wc.blocksComponents,Se=window.wc.priceFormat;r(5138);const Te=({currency:e,maxPrice:t,minPrice:r,priceClassName:n,priceStyle:a={}})=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(/* translators: %1$s min price, %2$s max price */
|
|||
|
(0,o.__)("Price between %1$s and %2$s","woocommerce"),(0,Se.formatPrice)(r),(0,Se.formatPrice)(t))),(0,c.createElement)("span",{"aria-hidden":!0},(0,c.createElement)(Pe.FormattedMonetaryAmount,{className:Ee()("wc-block-components-product-price__value",n),currency:e,value:r,style:a})," — ",(0,c.createElement)(Pe.FormattedMonetaryAmount,{className:Ee()("wc-block-components-product-price__value",n),currency:e,value:t,style:a}))),Ne=({currency:e,regularPriceClassName:t,regularPriceStyle:r,regularPrice:n,priceClassName:a,priceStyle:i,price:s})=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Previous price:","woocommerce")),(0,c.createElement)(Pe.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,c.createElement)("del",{className:Ee()("wc-block-components-product-price__regular",t),style:r},e),value:n}),(0,c.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Discounted price:","woocommerce")),(0,c.createElement)(Pe.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,c.createElement)("ins",{className:Ee()("wc-block-components-product-price__value","is-discounted",a),style:i},e),value:s})),Be=({align:e,className:t,currency:r,format:o="<price/>",maxPrice:n,minPrice:a,price:i,priceClassName:s,priceStyle:l,regularPrice:u,regularPriceClassName:m,regularPriceStyle:p,style:d})=>{const _=Ee()(t,"price","wc-block-components-product-price",{[`wc-block-components-product-price--align-${e}`]:e});o.includes("<price/>")||(o="<price/>",console.error("Price formats need to include the `<price/>` tag."));const b=u&&i&&i<u;let g=(0,c.createElement)("span",{className:Ee()("wc-block-components-product-price__value",s)});return b?g=(0,c.createElement)(Ne,{currency:r,price:i,priceClassName:s,priceStyle:l,regularPrice:u,regularPriceClassName:m,regularPriceStyle:p}):void 0!==a&&void 0!==n?g=(0,c.createElement)(Te,{currency:r,maxPrice:n,minPrice:a,priceClassName:s,priceStyle:l}):i&&(g=(0,c.createElement)(Pe.FormattedMonetaryAmount,{className:Ee()("wc-block-components-product-price__value",s),currency:r,value:i,style:l})),(0,c.createElement)("span",{className:_,style:d},(0,T.createInterpolateElement)(o,{price:g}))};r(5641);const Ie=({className:e="",disabled:t=!1,name:r,permalink:o="",target:n,rel:a,style:i,onClick:s,...l})=>{const u=Ee()("wc-block-components-product-name",e);if(t){const e=l;return(0,c.createElement)("span",{className:u,...e,dangerouslySetInnerHTML:{__html:(0,W.decodeEntities)(r)}})}return(0,c.createElement)("a",{className:u,href:o,target:n,...l,dangerouslySetInnerHTML:{__html:(0,W.decodeEntities)(r)},style:i})},Re=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function Ae(e,t){return Re(e)&&t in e}const Me=window.wp.hooks;var Le=r(8508);r(6315);const Oe=({children:e,className:t})=>(0,c.createElement)("div",{className:Ee()("wc-block-components-product-badge",t)},e),De=()=>(0,c.createElement)(Oe,{className:"wc-block-components-product-backorder-badge"},(0,o.__)("Available on backorder","woocommerce")),qe=({image:e={},fallbackAlt:t=""})=>{const r=e.thumbnail?{src:e.thumbnail,alt:(0,W.decodeEntities)(e.alt)||t||"Product Image"}:{src:l.PLACEHOLDER_IMG_SRC,alt:""};return(0,c.createElement)("img",{...r,alt:r.alt})},je=({lowStockRemaining:e})=>e?(0,c.createElement)(Oe,{className:"wc-block-components-product-low-stock-badge"},(0,o.sprintf)(/* translators: %d stock amount (number of items in stock for product) */
|
|||
|
(0,o.__)("%d left in stock","woocommerce"),e)):null;var $e=r(9784);r(7984);const Fe=({details:e=[]})=>Array.isArray(e)?0===(e=e.filter((e=>!e.hidden))).length?null:(0,c.createElement)("ul",{className:"wc-block-components-product-details"},e.map((e=>{const t=(null==e?void 0:e.key)||e.name||"",r=(null==e?void 0:e.className)||(t?`wc-block-components-product-details__${(0,$e.o)(t)}`:"");return(0,c.createElement)("li",{key:t+(e.display||e.value),className:r},t&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"wc-block-components-product-details__name"},(0,W.decodeEntities)(t),":")," "),(0,c.createElement)("span",{className:"wc-block-components-product-details__value"},(0,W.decodeEntities)(e.display||e.value)))}))):null,Ve=window.wp.autop,Ye=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),Ue=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,ze=window.wp.wordcount,Ze=({source:e,maxLength:t=15,countType:r="words",className:o="",style:n={}})=>{const a=(0,T.useMemo)((()=>((e,t=15,r="words")=>{const c=(0,Ve.autop)(e);if((0,ze.count)(c,r)<=t)return c;const o=(e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)})(c);return(0,ze.count)(o,r)<=t?o:"words"===r?((e,t,r="…",c=!0)=>{const o=Ye(e),n=o.split(" ").splice(0,t).join(" ");return n===o?c?(0,Ve.autop)(o):o:c?(0,Ve.autop)(Ue(n,r)):Ue(n,r)})(o,t):((e,t,r=!0,c="…",o=!0)=>{const n=Ye(e),a=n.slice(0,t);if(a===n)return o?(0,Ve.autop)(n):n;if(r)return(0,Ve.autop)(Ue(a,c));const i=a.match(/([\s]+)/g),s=i?i.length:0,l=n.slice(0,t+s);return o?(0,Ve.autop)(Ue(l,c)):Ue(l,c)})(o,t,"characters_including_spaces"===r)})(e,t,r)),[e,t,r]);return(0,c.createElement)(T.RawHTML,{style:n,className:o},a)},He=({className:e,shortDescription:t="",fullDescription:r=""})=>{const o=t||r;return o?(0,c.createElement)(Ze,{className:e,source:o,maxLength:15,countType:h.wordCountType||"words"}):null};r(9889);const Ke=({shortDescription:e="",fullDescription:t="",itemData:r=[],variation:o=[]})=>(0,c.createElement)("div",{className:"wc-block-components-product-metadata"},(0,c.createElement)(He,{className:"wc-block-components-product-metadata__description",shortDescription:e,fullDescription:t}),(0,c.createElement)(Fe,{details:r}),(0,c.createElement)(Fe,{details:o.map((({attribute:e="",value:t})=>({key:e,value:t})))})),Ge=({currency:e,saleAmount:t,format:r="<price/>"})=>{if(!t||t<=0)return null;r.includes("<price/>")||(r="<price/>",console.error("Price formats need to include the `<price/>` tag."));const n=(0,o.sprintf)(/* translators: %s will be replaced by the discount amount */
|
|||
|
(0,o.__)("Save %s","woocommerce"),r);return(0,c.createElement)(Oe,{className:"wc-block-components-sale-badge"},(0,T.createInterpolateElement)(n,{price:(0,c.createElement)(Pe.FormattedMonetaryAmount,{currency:e,value:t})}))},Qe=(e,t)=>e.convertPrecision(t.minorUnit).getAmount(),We=e=>(0,V.mustContain)(e,"<price/>"),Xe=(0,T.forwardRef)((({lineItem:e,onRemove:t=(()=>{}),tabIndex:r},n)=>{const{name:a="",catalog_visibility:i="visible",short_description:s="",description:u="",low_stock_remaining:m=null,show_backorder_badge:p=!1,quantity_limits:d={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:_=!1,permalink:b="",images:g=[],variation:y=[],item_data:w=[],prices:k={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",price:"0",regular_price:"0",sale_price:"0",price_range:null,raw_prices:{precision:6,price:"0",regular_price:"0",sale_price:"0"}},totals:h={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",line_subtotal:"0",line_subtotal_tax:"0"},extensions:v}=e,{quantity:E,setItemQuantity:f,removeItem:C,isPendingDelete:x}=(e=>{const t={key:"",quantity:1};(e=>Re(e)&&Ae(e,"key")&&Ae(e,"quantity")&&J(e.key)&&X(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:r="",quantity:c=1}=t,{cartErrors:o}=de(),{__internalIncrementCalculating:n,__internalDecrementCalculating:a}=(0,N.useDispatch)(Z.CHECKOUT_STORE_KEY),[i,s]=(0,T.useState)(c),[l]=(0,we.Nr)(i,400),u=function(e,t){const r=(0,T.useRef)();return(0,T.useEffect)((()=>{r.current===e||(r.current=e)}),[e,t]),r.current}(l),{removeItemFromCart:m,changeCartItemQuantity:p}=(0,N.useDispatch)(Z.CART_STORE_KEY);(0,T.useEffect)((()=>s(c)),[c]);const d=(0,N.useSelect)((e=>{if(!r)return{quantity:!1,delete:!1};const t=e(Z.CART_STORE_KEY);return{quantity:t.isItemPendingQuantity(r),delete:t.isItemPendingDelete(r)}}),[r]),_=(0,T.useCallback)((()=>r?m(r).catch((e=>{(0,Z.processErrorResponse)(e)})):Promise.resolve(!1)),[r,m]);return(0,T.useEffect)((()=>{r&&X(u)&&Number.isFinite(u)&&u!==l&&p(r,l).catch((e=>{(0,Z.processErrorResponse)(e)}))}),[r,p,l,u]),(0,T.useEffect)((()=>(d.delete?n():a(),()=>{d.delete&&a()})),[a,n,d.delete]),(0,T.useEffect)((()=>(d.quantity||l!==i?n():a(),()=>{(d.quantity||l!==i)&&a()})),[n,a,d.quantity,l,i]),{isPendingDelete:d.delete,quantity:i,setItemQuantity:s,removeItem:_,cartItemQuantityErrors:o}})(e),{dispatchStoreEvent:P}={dispatchStoreEvent:(0,T.useCallback)(((e,t={})=>{try{(0,Me.doAction)(`experimental__woocommerce_blocks-${e}`,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:(0,T.useCallback)(((e,t={})=>{try{(0,Me.doAction)(`experimental__woocommerce_blocks-checkout-${e}`,{...t,storeCart:(0,N.select)("wc/store/cart").getCartData()})}catch(e){console.error(e)}}),[])},{receiveCart:S,...B}=de(),I=(0,T.useMemo)((()=>({context:"cart",cartItem:e,cart:B})),[e,B]),R=(0,Se.getCurrencyFromPriceResponse)(k),A=(0,V.applyCheckoutFilter)({filterName:"itemName",defaultValue:a,extensions:v,arg:I}),M=(0,Le.Z)({amount:parseInt(k.raw_prices.regular_price,10),precision:k.raw_prices.precision}),L=(0,Le.Z)({amount:parseInt(k.raw_prices.price,10),precision:k.raw_prices.precision}),O=M.subtract(L),D=O.multiply(E),q=(0,Se.getCurrencyFromPriceResponse)(h);let j=parseInt(h.line_subtotal,10);(0,l.getSetting)("displayCartPricesIncludingTax",!1)&&(j+=parseInt(h.line_subtotal_tax,10));const $=(0,Le.Z)({amount:j,precision:q.minorUnit}),F=g.length?g[0]:{},Y="hidden"===i||"search"===i,U=(0,V.applyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:v,arg:I}),z=(0,V.applyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:v,arg:I,validation:We}),H=(0,V.applyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:v,arg:I,validation:We}),K=(0,V.applyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:v,arg:I,validation:We}),G=(0,V.applyCheckoutFil
|
|||
|
(0,o.__)("Remove %s from cart","woocommerce"),A),onClick:()=>{t(),C(),P("cart-remove-item",{product:e,quantity:E}),(0,fe.speak)((0,o.sprintf)(/* translators: %s refers to the item name in the cart. */
|
|||
|
(0,o.__)("%s has been removed from your cart.","woocommerce"),A))},disabled:x},(0,o.__)("Remove item","woocommerce"))))),(0,c.createElement)("td",{className:"wc-block-cart-item__total"},(0,c.createElement)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper"},(0,c.createElement)(Be,{currency:q,format:z,price:$.getAmount()}),E>1&&(0,c.createElement)(Ge,{currency:R,saleAmount:Qe(D,R),format:K}))))}));r(6294);const Je=[...Array(3)].map(((_x,e)=>(0,c.createElement)(Xe,{lineItem:{},key:e}))),et=e=>{const t={};return e.forEach((({key:e})=>{t[e]=(0,T.createRef)()})),t},tt=({lineItems:e=[],isLoading:t=!1,className:r})=>{const n=(0,T.useRef)(null),a=(0,T.useRef)(et(e));(0,T.useEffect)((()=>{a.current=et(e)}),[e]);const i=e=>()=>{null!=a&&a.current&&e&&a.current[e].current instanceof HTMLElement?a.current[e].current.focus():n.current instanceof HTMLElement&&n.current.focus()},s=t?Je:e.map(((t,r)=>{const o=e.length>r+1?e[r+1].key:null;return(0,c.createElement)(Xe,{key:t.key,lineItem:t,onRemove:i(o),ref:a.current[t.key],tabIndex:-1})}));return(0,c.createElement)("table",{className:Ee()("wc-block-cart-items",r),ref:n,tabIndex:-1},(0,c.createElement)("thead",null,(0,c.createElement)("tr",{className:"wc-block-cart-items__header"},(0,c.createElement)("th",{className:"wc-block-cart-items__header-image"},(0,c.createElement)("span",null,(0,o.__)("Product","woocommerce"))),(0,c.createElement)("th",{className:"wc-block-cart-items__header-product"},(0,c.createElement)("span",null,(0,o.__)("Details","woocommerce"))),(0,c.createElement)("th",{className:"wc-block-cart-items__header-total"},(0,c.createElement)("span",null,(0,o.__)("Total","woocommerce"))))),(0,c.createElement)("tbody",null,s))},rt=({className:e})=>{const{cartItems:t,cartIsLoading:r}=de();return(0,c.createElement)("div",{className:Ee()(e,"wc-block-mini-cart__products-table")},(0,c.createElement)(tt,{lineItems:t,isLoading:r,className:"wc-block-mini-cart-items"}))};(0,s.registerBlockType)("woocommerce/mini-cart-products-table-block",{icon:(0,c.createElement)(i.Z,{icon:ge.Z,className:"wc-block-editor-components-block-icon"}),edit:()=>{const e=(0,S.useBlockProps)();return(0,c.createElement)("div",{...e},(0,c.createElement)(he,null,(0,c.createElement)(rt,{className:"is-mobile"})))},save:()=>(0,c.createElement)("div",{...S.useBlockProps.save()})});var ct=r(8214),ot=r(9127),nt=r.n(ot);function at(e){const t=(0,T.useRef)(e);return nt()(e,t.current)||(t.current=e),t.current}const it=window.wc.wcBlocksRegistry,st=e=>`wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${e}`,lt=({id:e,src:t=null,alt:r=""})=>t?(0,c.createElement)("img",{className:st(e),src:t,alt:r}):null,ut=[{id:"alipay",alt:"Alipay",src:v+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:v+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:v+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:v+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:v+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:v+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:v+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:v+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:v+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:v+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:v+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:v+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:v+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:v+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:v+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:v+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:v+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:v+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:v+"payment-methods/wechat.svg"}];r(9086);const mt=({icons:e=[],align:t="center",className:r})=>{const o=(e=>{const t={};return e.forEach((e=>{let r={};"string"==typeof e&&(r={id:e,alt:e,src:null}),"object"==typeof e&&(r=
|