oont-contents/plugins/woocommerce/assets/client/blocks/legacy-template.js
2025-04-06 08:34:48 +02:00

7 lines
No EOL
27 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{var e,o,t,c={244:(e,o,t)=>{"use strict";t.r(o);var c={};t.r(c),t.d(c,{blockifyConfig:()=>_e,getDescription:()=>ge,isConversionPossible:()=>ke});var r={};t.r(r),t.d(r,{blockifyConfig:()=>ve,getDescription:()=>ye,isConversionPossible:()=>he});var l={};t.r(l),t.d(l,{blockifyConfig:()=>Pe,getDescription:()=>Ce,getSkeleton:()=>Se,isConversionPossible:()=>Be});var a=t(1609);const i=window.wp.blocks,n=window.wc.wcSettings;var s,m,d,p,u,w,k,g,_,f;const b=(0,n.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),h=b.pluginUrl+"assets/images/",y=(b.pluginUrl,null===(s=n.STORE_PAGES.shop)||void 0===s||s.permalink,null===(m=n.STORE_PAGES.checkout)||void 0===m||m.id,null===(d=n.STORE_PAGES.checkout)||void 0===d||d.permalink,null===(p=n.STORE_PAGES.privacy)||void 0===p||p.permalink,null===(u=n.STORE_PAGES.privacy)||void 0===u||u.title,null===(w=n.STORE_PAGES.terms)||void 0===w||w.permalink,null===(k=n.STORE_PAGES.terms)||void 0===k||k.title,null===(g=n.STORE_PAGES.cart)||void 0===g||g.id,null===(_=n.STORE_PAGES.cart)||void 0===_||_.permalink,null!==(f=n.STORE_PAGES.myaccount)&&void 0!==f&&f.permalink?n.STORE_PAGES.myaccount.permalink:(0,n.getSetting)("wpLoginUrl","/wp-login.php"),(0,n.getSetting)("localPickupEnabled",!1),(0,n.getSetting)("shippingMethodsExist",!1),(0,n.getSetting)("countries",{})),v=(0,n.getSetting)("countryData",{}),B=(Object.fromEntries(Object.keys(v).filter((e=>!0===v[e].allowBilling)).map((e=>[e,y[e]||""]))),Object.fromEntries(Object.keys(v).filter((e=>!0===v[e].allowBilling)).map((e=>[e,v[e].states||[]]))),Object.fromEntries(Object.keys(v).filter((e=>!0===v[e].allowShipping)).map((e=>[e,y[e]||""]))),Object.fromEntries(Object.keys(v).filter((e=>!0===v[e].allowShipping)).map((e=>[e,v[e].states||[]]))),Object.fromEntries(Object.keys(v).map((e=>[e,v[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),E=((0,n.getSetting)("addressFieldsLocations",B).address,(0,n.getSetting)("addressFieldsLocations",B).contact,(0,n.getSetting)("addressFieldsLocations",B).order,(0,n.getSetting)("additionalOrderFields",{}),(0,n.getSetting)("additionalContactFields",{}),(0,n.getSetting)("additionalAddressFields",{}),window.wp.blockEditor),C=window.wp.components;var S=t(7723),P=t(7104),T=t(885);const O=window.wp.data;var N=t(6087);const x=window.wp.notices,I=window.wp.coreData;var L=t(5573),A=t(851);const j=(0,a.createElement)((({className:e,...o})=>(0,a.createElement)(L.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 23 6",className:(0,A.A)("woo-icon",e),...o,width:46,height:12},(0,a.createElement)("g",{id:"surface1"},(0,a.createElement)("path",{style:{stroke:"none",fillRule:"evenodd",fill:"rgb(52.941179%,24.313726%,100%)",fillOpacity:1},d:"M 9.695312 0.0234375 C 9.15625 0.0234375 8.808594 0.199219 8.492188 0.789062 L 7.066406 3.480469 L 7.066406 1.089844 C 7.066406 0.375 6.726562 0.0234375 6.101562 0.0234375 C 5.472656 0.0234375 5.210938 0.238281 4.898438 0.839844 L 3.546875 3.480469 L 3.546875 1.113281 C 3.546875 0.351562 3.230469 0.0234375 2.46875 0.0234375 L 0.914062 0.0234375 C 0.324219 0.0234375 0 0.300781 0 0.800781 C 0 1.300781 0.3125 1.601562 0.890625 1.601562 L 1.527344 1.601562 L 1.527344 4.621094 C 1.527344 5.472656 2.105469 5.976562 2.929688 5.976562 C 3.757812 5.976562 4.132812 5.648438 4.546875 4.886719 L 5.449219 3.195312 L 5.449219 4.621094 C 5.449219 5.460938 6 5.976562 6.839844 5.976562 C 7.679688 5.976562 7.992188 5.6875 8.46875 4.886719 L 10.546875 1.378906 C 11 0.613281 10.6875 0.0234375 9.683594 0.0234375 C 9.683594 0.0234375 9.683594 0.0234375 9.695312 0.0234375 Z M 9.695312 0.0234375"}),(0,a.createElement)("path",{style:{stroke:"none",fillRule:"evenodd",fill:"rgb(52.941179%,24.313726%,100%)",fillOpacity:1},d:"M 13.605469 0.0234375 C 11.902344 0.0234375 10.609375 1.289062 10.609375 3.007812 C 10.609375 4.722656 11.914062 5.976562 13.605469 5.976562 C 15.296875 5.976562 16.585938 4.710938 16.597656 3.007812 C 16.597656 1.289062 15.296875 0.0234375 13.605469 0.0234375 Z M 13.605469 4.144531 C 12.964844 4.144531 12.527344 3.671875 12.527344 3.007812 C 12.527344 2.34375 12.964844 1.855469 13.605469 1.855469 C 14.242188 1.855469 14.683594 2.34375 14.683594 3.007812 C 14.683594 3.671875 14.257812 4.144531 13.605469 4.144531 Z M 13.605469 4.144531"}),(0,a.createElement)("path",{style:{stroke:"none",fillRule:"evenodd",fill:"rgb(52.941179%,24.313726%,100%)",fillOpacity:1},d:"M 20.007812 0.0234375 C 18.316406 0.0234375 17.011719 1.289062 17.011719 3.007812 C 17.011719 4.722656 18.316406 5.976562 20.007812 5.976562 C 21.695312 5.976562 23 4.710938 23 3.007812 C 23 1.300781 21.695312 0.0234375 20.007812 0.0234375 Z M 20.007812 4.144531 C 19.355469 4.144531 18.941406 3.671875 18.941406 3.007812 C 18.941406 2.34375 19.367188 1.855469 20.007812 1.855469 C 20.644531 1.855469 21.082031 2.34375 21.082031 3.007812 C 21.082031 3.671875 20.65625 4.144531 20.007812 4.144531 Z M 20.007812 4.144531"})))),null);t(4967),t(3803);const D="woocommerce/legacy-template",R="single-product",M="product-catalog",G="product-taxonomy",H="product-search-results",z="order-confirmation",F="archive-product",U={"single-product":{type:R,title:(0,S.__)("Product (Classic)","woocommerce"),description:(0,S.__)("Displays the PHP product page.","woocommerce"),placeholder:"single-product"},"archive-product":{type:M,title:(0,S.__)("Product Grid (Classic)","woocommerce"),description:(0,S.__)("Displays the PHP product grid page. ","woocommerce"),placeholder:F},"taxonomy-product_cat":{type:G,title:(0,S.__)("Product Category (Classic)","woocommerce"),description:(0,S.__)("Displays the PHP product category page.","woocommerce"),placeholder:F},"taxonomy-product_tag":{type:G,title:(0,S.__)("Product Tag (Classic)","woocommerce"),description:(0,S.__)("Displays the PHP product tag page.","woocommerce"),placeholder:F},"taxonomy-product_attribute":{type:G,title:(0,S.__)("Product Attribute (Classic)","woocommerce"),description:(0,S.__)("Displays the PHP product attribute page.","woocommerce"),placeholder:F},"taxonomy-product":{type:G,title:(0,S.__)("Product's Custom Taxonomy (Classic)","woocommerce"),description:(0,S.__)("Displays the PHP product's custom taxonomy page.","woocommerce"),placeholder:F},"product-search-results":{type:H,title:(0,S.__)("Product Search Results (Classic)","woocommerce"),description:(0,S.__)("Displays the PHP product search results.","woocommerce"),placeholder:F},"checkout-header":{type:"checkout-header",title:(0,S.__)("Checkout Header","woocommerce"),placeholder:"checkout-header"},"order-confirmation":{type:z,title:(0,S.__)("Order Confirmation Block","woocommerce"),placeholder:"fallback"}};function W(e,o){const t=Object.keys(o);let c=null;for(let r=0;t.length>r;r++){const l=o[e.substr(0,t[r].length)];if(l){c=l;break}}return c}const q=(e,o)=>{var t;const c="core/query-title",r=((null===(t=(0,i.getBlockType)(c))||void 0===t?void 0:t.variations)||[]).find((({name:o})=>o===e));if(!r)return null;const{attributes:l}=r,a={...l,...o,showPrefix:!1};return(0,i.createBlock)(c,a)},Y=(e,o)=>{var t;const c="core/group",r=((null===(t=(0,i.getBlockType)(c))||void 0===t?void 0:t.variations)||[]).find((({name:e})=>"group-row"===e));if(!r)return null;const{attributes:l}=r,a={...l,...o,layout:{...l.layout,justifyContent:"space-between"}};return(0,i.createBlock)(c,a,e)},$=JSON.parse('{"name":"woocommerce/product-collection"}');let V=function(e){return e.GRID="flex",e.STACK="list",e}({}),Z=function(e){return e.FILL="fill",e.FIXED="fixed",e}({}),J=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});const K=`${$.name}/product-title`,Q=(0,n.getSetting)("stockStatusOptions",[]),X={perPage:9,pages:0,offset:0,postType:"product",order:"asc",orderBy:"title",search:"",exclude:[],inherit:!1,taxQuery:{},isProductCollectionBlock:!0,featured:!1,woocommerceOnSale:!1,woocommerceStockStatus:(0,n.getSetting)("hideOutOfStockItems",!1)?Object.keys(function(e,o){const{[o]:t,...c}=e;return c}(Q,"outofstock")):Object.keys(Q),woocommerceAttributes:[],woocommerceHandPickedProducts:[],timeFrame:void 0,priceRange:void 0,filterable:!1,relatedBy:{categories:!0,tags:!0}},ee={query:X,tagName:"div",displayLayout:{type:V.GRID,columns:3,shrinkColumns:!0},dimensions:{widthType:Z.FILL},queryContextIncludes:["collection"],forcePageReload:!1},oe=["woocommerce/product-template",{},[["woocommerce/product-image",{imageSizing:J.THUMBNAIL}],["core/post-title",{textAlign:"center",level:3,fontSize:"medium",style:{spacing:{margin:{bottom:"0.75rem",top:"0"}}},isLink:!0,__woocommerceNamespace:K}],["woocommerce/product-price",{textAlign:"center",fontSize:"small"}],["woocommerce/product-button",{textAlign:"center",fontSize:"small"}]]],te=[oe,["core/query-pagination",{layout:{type:"flex",justifyContent:"center"}}],["woocommerce/product-collection-no-results"]],ce=e=>(0,i.createBlock)("woocommerce/product-collection",{...ee,...e,query:{...X,inherit:!0}},(0,i.createBlocksFromInnerBlocksTemplate)(te)),re=(e,o=!1)=>[(0,i.createBlock)("woocommerce/breadcrumbs",e),q("archive-title",e),o?(0,i.createBlock)("core/term-description",e):null,(0,i.createBlock)("woocommerce/store-notices",e),Y([(0,i.createBlock)("woocommerce/product-results-count"),(0,i.createBlock)("woocommerce/catalog-sorting")],e),ce(e)].filter(Boolean),le=()=>(0,n.isWpVersion)("6.1",">="),ae=(e,o)=>o?(e=>(0,S.sprintf)(/* translators: %s is the template title */ /* translators: %s is the template title */
(0,S.__)("Transform this template into multiple blocks so you can add, remove, reorder, and customize your %s template.","woocommerce"),e))(e):(e=>(0,S.sprintf)(/* translators: %s is the template title */ /* translators: %s is the template title */
(0,S.__)("This block serves as a placeholder for your %s. It will display the actual product image, title, price in your store. You can move this placeholder around and add more blocks around to customize the template.","woocommerce"),e))(e),ie=()=>(0,S.__)("Transform into blocks","woocommerce"),ne={isConversionPossible:le,getDescription:ae,blockifyConfig:{getButtonLabel:ie,onClickCallback:({clientId:e,attributes:o,getBlocks:t,replaceBlock:c,selectBlock:r})=>{c(e,re(o));const l=t().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));l&&r(l.clientId)},getBlockifiedTemplate:re}},se={isConversionPossible:le,getDescription:ae,blockifyConfig:{getButtonLabel:ie,onClickCallback:({clientId:e,attributes:o,getBlocks:t,replaceBlock:c,selectBlock:r})=>{c(e,re(o,!0));const l=t().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));l&&r(l.clientId)},getBlockifiedTemplate:e=>re(e,!0)}};var me=t(4478);const de=(0,S.__)("Product Title","woocommerce"),pe=((0,a.createElement)(P.A,{icon:me.A,className:"wc-block-editor-components-block-icon"}),(0,S.__)("Display the title of a product.","woocommerce")),ue="woocommerce/product-query/product-title";!function(e,{blockDescription:o,blockIcon:t,blockTitle:c,variationName:r,scope:l}){(0,i.registerBlockVariation)(e,{description:o,name:r,title:c,isActive:e=>e.__woocommerceNamespace===r,icon:{src:t},attributes:{__woocommerceNamespace:r},scope:l})}("core/post-title",{blockDescription:pe,blockIcon:(0,a.createElement)(C.Icon,{icon:me.A}),blockTitle:de,variationName:ue,scope:["block"]});const we=()=>[(0,i.createBlock)("woocommerce/breadcrumbs"),(0,i.createBlock)("woocommerce/store-notices"),(0,i.createBlock)("core/columns",{align:"wide"},[(0,i.createBlock)("core/column",{type:"constrained",justifyContent:"right",width:"512px"},[(0,i.createBlock)("woocommerce/product-image-gallery")]),(0,i.createBlock)("core/column",{},[(0,i.createBlock)("core/post-title",{__woocommerceNamespace:ue,level:1}),(0,i.createBlock)("woocommerce/product-rating"),(0,i.createBlock)("woocommerce/product-price",{fontSize:"large"}),(0,i.createBlock)("woocommerce/product-summary",{isDescendentOfSingleProductTemplate:!0}),(0,i.createBlock)("woocommerce/add-to-cart-form"),(0,i.createBlock)("woocommerce/product-meta")])]),(0,i.createBlock)("woocommerce/product-details",{align:"wide",className:"is-style-minimal"}),(0,i.createBlock)("core/heading",{align:"wide",level:2,content:(0,S.__)("Related Products","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}),(0,i.createBlock)("woocommerce/product-collection",{...ee,query:{...X,perPage:5,pages:1,woocommerceStockStatus:["instock","onbackorder"],filterable:!1},displayLayout:{type:"flex",columns:5,shrinkColumns:!0},collection:"woocommerce/product-collection/related",hideControls:["inherit"],align:"wide"},(0,i.createBlocksFromInnerBlocksTemplate)([oe]))].filter(Boolean),ke=()=>(0,n.isWpVersion)("6.1",">="),ge=(e,o)=>o?(e=>(0,S.sprintf)(/* translators: %s is the template title */ /* translators: %s is the template title */
(0,S.__)("Transform this template into multiple blocks so you can add, remove, reorder, and customize your %s template.","woocommerce"),e))(e):(e=>(0,S.sprintf)(/* translators: %s is the template title */ /* translators: %s is the template title */
(0,S.__)("This block serves as a placeholder for your %s. It will display the actual product image, title, price in your store. You can move this placeholder around and add more blocks around to customize the template.","woocommerce"),e))(e),_e={getButtonLabel:()=>(0,S.__)("Transform into blocks","woocommerce"),onClickCallback:({clientId:e,getBlocks:o,replaceBlock:t,selectBlock:c})=>{t(e,we());const r=o().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/breadcrumbs"===e.name))));r&&c(r.clientId)},getBlockifiedTemplate:we},fe=e=>{const o=((e,o)=>{const t=[(0,i.createBlock)("core/paragraph",{content:(0,S.__)("No products were found matching your selection.","woocommerce")}),(0,i.createBlock)("core/search",{buttonPosition:"button-outside",buttonText:(0,S.__)("Search","woocommerce"),buttonUseIcon:!1,showLabel:!1,placeholder:(0,S.__)("Search products…","woocommerce"),query:{post_type:"product"}})],c="woocommerce/product-collection-no-results",r=e.findIndex((e=>e[0]===c)),l={...e[r][1]||{},...o},a=[c,l,t];return[...e.slice(0,r),a,...e.slice(r+1)]})(te,e);return(0,i.createBlock)("woocommerce/product-collection",{...ee,...e,query:{...X,inherit:!0}},(0,i.createBlocksFromInnerBlocksTemplate)(o))},be=e=>[q("search-title",e),(0,i.createBlock)("woocommerce/store-notices",e),Y([(0,i.createBlock)("woocommerce/product-results-count"),(0,i.createBlock)("woocommerce/catalog-sorting")],e),fe(e)].filter(Boolean),he=()=>(0,n.isWpVersion)("6.1",">="),ye=(e,o)=>o?(e=>(0,S.sprintf)(/* translators: %s is the template title */ /* translators: %s is the template title */
(0,S.__)("Transform this template into multiple blocks so you can add, remove, reorder, and customize your %s template.","woocommerce"),e))(e):(e=>(0,S.sprintf)(/* translators: %s is the template title */ /* translators: %s is the template title */
(0,S.__)("This block serves as a placeholder for your %s. It will display the actual product image, title, price in your store. You can move this placeholder around and add more blocks around to customize the template.","woocommerce"),e))(e),ve={getButtonLabel:()=>(0,S.__)("Transform into blocks","woocommerce"),onClickCallback:({clientId:e,attributes:o,getBlocks:t,replaceBlock:c,selectBlock:r})=>{c(e,be(o));const l=t().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));l&&r(l.clientId)},getBlockifiedTemplate:be},Be=()=>!0,Ee=e=>[(0,i.createBlock)("woocommerce/order-confirmation-status",{...e,fontSize:"large"}),(0,i.createBlock)("woocommerce/order-confirmation-summary",e),(0,i.createBlock)("woocommerce/order-confirmation-totals-wrapper",e),(0,i.createBlock)("woocommerce/order-confirmation-downloads-wrapper",e),(0,i.createBlock)("core/columns",{...e,className:"wc-block-order-confirmation-address-wrapper"},[(0,i.createBlock)("core/column",e,[(0,i.createBlock)("woocommerce/order-confirmation-shipping-wrapper",e)]),(0,i.createBlock)("core/column",e,[(0,i.createBlock)("woocommerce/order-confirmation-billing-wrapper",e)])]),(0,i.createBlock)("woocommerce/order-confirmation-additional-fields-wrapper",e),(0,i.createBlock)("woocommerce/order-confirmation-additional-information",e)].filter(Boolean),Ce=()=>(0,S.__)("This block represents the classic template used to display the order confirmation. The actual rendered template may appear different from this placeholder.","woocommerce"),Se=()=>(0,a.createElement)("div",{className:"woocommerce-page"},(0,a.createElement)("div",{className:"woocommerce-order"},(0,a.createElement)("h1",null,(0,S.__)("Order received","woocommerce")),(0,a.createElement)("p",{className:"woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-confirmation"},(0,S.__)("Thank you. Your order has been received.","woocommerce")),(0,a.createElement)("ul",{className:"woocommerce-order-overview woocommerce-thankyou-order-details order_details"},(0,a.createElement)("li",{className:"woocommerce-order-overview__order order"},(0,S.__)("Order number","woocommerce"),":"," ",(0,a.createElement)("strong",null,"123")),(0,a.createElement)("li",{className:"woocommerce-order-overview__date date"},(0,S.__)("Date","woocommerce"),":"," ",(0,a.createElement)("strong",null,"May 25, 2023")),(0,a.createElement)("li",{className:"woocommerce-order-overview__email email"},(0,S.__)("Email","woocommerce"),":"," ",(0,a.createElement)("strong",null,"shopper@woocommerce.com")),(0,a.createElement)("li",{className:"woocommerce-order-overview__total total"},(0,S.__)("Total","woocommerce"),":"," ",(0,a.createElement)("strong",null,"$20.00"))),(0,a.createElement)("section",{className:"woocommerce-order-details"},(0,a.createElement)("h2",{className:"woocommerce-order-details__title"},(0,S.__)("Order details","woocommerce")),(0,a.createElement)("table",{className:"woocommerce-table woocommerce-table--order-details shop_table order_details"},(0,a.createElement)("thead",null,(0,a.createElement)("tr",null,(0,a.createElement)("th",{className:"woocommerce-table__product-name product-name"},(0,S.__)("Product","woocommerce")),(0,a.createElement)("th",{className:"woocommerce-table__product-table product-total"},(0,S.__)("Total","woocommerce")))),(0,a.createElement)("tbody",null,(0,a.createElement)("tr",{className:"woocommerce-table__line-item order_item"},(0,a.createElement)("td",{className:"woocommerce-table__product-name product-name"},"Sample Product"," ",(0,a.createElement)("strong",{className:"product-quantity"},"× 2")," "),(0,a.createElement)("td",{className:"woocommerce-table__product-total product-total"},"$20.00"))),(0,a.createElement)("tfoot",null,(0,a.createElement)("tr",null,(0,a.createElement)("th",{scope:"row"},(0,S.__)("Subtotal","woocommerce"),":"),(0,a.createElement)("td",null,"$20.00")),(0,a.createElement)("tr",null,(0,a.createElement)("th",{scope:"row"},(0,S.__)("Total","woocommerce"),":"),(0,a.createElement)("td",null,"$20.00"))))),(0,a.createElement)("section",{className:"woocommerce-customer-details"},(0,a.createElement)("section",{className:"woocommerce-columns woocommerce-columns--2 woocommerce-columns--addresses col2-set addresses"},(0,a.createElement)("div",{className:"woocommerce-column woocommerce-column--1 woocommerce-column--billing-address col-1"},(0,a.createElement)("h2",{className:"woocommerce-column__title"},(0,S.__)("Billing address","woocommerce")),(0,a.createElement)("address",null,"123 Main St",(0,a.createElement)("br",null),"New York, NY 10001",(0,a.createElement)("br",null),"United States (US)")),(0,a.createElement)("div",{className:"woocommerce-column woocommerce-column--2 woocommerce-column--shipping-address col-2"},(0,a.createElement)("h2",{className:"woocommerce-column__title"},(0,S.__)("Shipping address","woocommerce")),(0,a.createElement)("address",null,"123 Main St",(0,a.createElement)("br",null),"New York, NY 10001",(0,a.createElement)("br",null),"United States (US)")))))),Pe={getButtonLabel:()=>(0,S.__)("Transform into blocks","woocommerce"),onClickCallback:({clientId:e,attributes:o,getBlocks:t,replaceBlock:c,selectBlock:r})=>{c(e,Ee(o));const l=t().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));l&&r(l.clientId)},getBlockifiedTemplate:Ee},Te={[M]:ne,[G]:se,[R]:c,[H]:r,[z]:l,fallback:{isConversionPossible:()=>!1,getBlockifiedTemplate:()=>[],getDescription:()=>"",onClickCallback:()=>{}}},Oe=({blockifyConfig:e,clientId:o,attributes:t})=>{const{getButtonLabel:c,onClickCallback:r,getBlockifiedTemplate:l}=e,[n,s]=(0,N.useState)(!1),{replaceBlock:m,selectBlock:d,replaceBlocks:p}=(0,O.useDispatch)(E.store),{getBlocks:u}=(0,O.useSelect)((e=>({getBlocks:e(E.store).getBlocks})),[]),{createInfoNotice:w}=(0,O.useDispatch)(x.store);return(0,a.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-migration-button-container"},(0,a.createElement)(C.Button,{variant:"primary",onClick:()=>{r({clientId:o,getBlocks:u,attributes:t,replaceBlock:m,selectBlock:d}),w((0,S.__)("Template transformed into blocks!","woocommerce"),{actions:[{label:(0,S.__)("Undo","woocommerce"),onClick:()=>{const e=u().reduce(((e,o)=>"core/template-part"===o.name?e:[...e,o.clientId]),[]);p(e,(0,i.createBlock)("core/group",{layout:{inherit:!0,type:"constrained"}},[(0,i.createBlock)("woocommerce/legacy-template",{template:t.template})]))}}],type:"snackbar"})},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),text:c?c():""},n&&(0,a.createElement)(C.Popover,{resize:!1,placement:"right-end"},(0,a.createElement)("div",{style:{minWidth:"250px",width:"250px",maxWidth:"250px",minHeight:"300px",height:"300px",maxHeight:"300px",cursor:"pointer"}},(0,a.createElement)(E.BlockPreview,{blocks:l({...t,isPreview:!0}),viewportWidth:1200,additionalStyles:[{css:"body { padding: 20px !important; height: fit-content !important; overflow:hidden}"}]})))))},Ne=({clientId:e,attributes:o,setAttributes:t})=>{var c,r,l,i,n;const s=(0,E.useBlockProps)(),{editedPostId:m}=(0,O.useSelect)((e=>({editedPostId:e("core/edit-site").getEditedPostId()})),[]),d=(0,I.useEntityRecord)("postType","wp_template",m),p=W(o.template,U),u=null!==(c=null===(r=d.record)||void 0===r||null===(l=r.title.rendered)||void 0===l?void 0:l.toLowerCase())&&void 0!==c?c:o.template,w=null!==(i=null==p?void 0:p.placeholder)&&void 0!==i?i:"fallback",k=null!==(n=null==p?void 0:p.type)&&void 0!==n?n:"fallback";(0,N.useEffect)((()=>{var e;return t({template:o.template,align:null!==(e=o.align)&&void 0!==e?e:"wide"})}),[o.align,o.template,t]);const{isConversionPossible:g,getDescription:_,getSkeleton:f,blockifyConfig:b}=Te[k],y=f?f():(0,a.createElement)("img",{className:"wp-block-woocommerce-classic-template__placeholder-image",src:`${h}template-placeholders/${w}.svg`,alt:u}),v=g(),B=_(u,v);return(0,a.createElement)("div",{...s},(0,a.createElement)(C.Placeholder,{className:"wp-block-woocommerce-classic-template__placeholder"},(0,a.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-wireframe"},y),(0,a.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-copy"},(0,a.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-copy__icon-container"},(0,a.createElement)("span",{className:"woo-icon-wrapper"},(0,a.createElement)(P.A,{icon:j})," ",(0,S.__)("WooCommerce","woocommerce")),(0,a.createElement)("span",null,(0,S.__)("Classic Template Placeholder","woocommerce"))),(0,a.createElement)("p",{dangerouslySetInnerHTML:{__html:B}}),(0,a.createElement)("p",null,(0,S.__)("You cannot edit the content of this block. However, you can move it and place other blocks around it.","woocommerce")),v&&b&&(0,a.createElement)(Oe,{clientId:e,blockifyConfig:b,attributes:o}))))};let xe=null,Ie=!1,Le=!1;const Ae=({template:e,inserter:o})=>{Ie&&(0,i.unregisterBlockType)(D),Le=o,Ie=!0,(({template:e,inserter:o})=>{(0,i.registerBlockType)(D,{title:e&&U[e]?U[e].title:(0,S.__)("WooCommerce Classic Template","woocommerce"),icon:(0,a.createElement)(P.A,{icon:T.A,className:"wc-block-editor-components-block-icon"}),category:"woocommerce",apiVersion:3,keywords:[(0,S.__)("WooCommerce","woocommerce")],description:e&&U[e]?U[e].description:(0,S.__)("Renders classic WooCommerce PHP templates.","woocommerce"),supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1,inserter:o},attributes:{template:{type:"string",default:"any"},align:{type:"string",default:"wide"}},edit:({attributes:o,clientId:t,setAttributes:c})=>{const r=null!=e?e:o.template;return(0,a.createElement)(Ne,{attributes:{...o,template:r},setAttributes:c,clientId:t})},save:()=>null})})({template:e,inserter:o})};(0,O.subscribe)((()=>{var e,o;const t=null===(e=(0,O.select)(E.store))||void 0===e?void 0:e.getBlockCount(),c=null===(o=(0,O.select)("core/editor"))||void 0===o?void 0:o.getEditedPostSlug(),r=t&&t>0?c:null;if(Ie&&xe===r)return;if(xe=r,!r)return void(Ie||Ae({template:r,inserter:!1}));const l=!!W(r,U);l||!Le?!l||Le?l&&function(e,o){const t=W(o,U);return(null==e?void 0:e.title)!==(null==t?void 0:t.title)}((0,i.getBlockType)(D),r)&&Ae({template:r,inserter:!0}):Ae({template:r,inserter:!0}):Ae({template:r,inserter:!1})}),"core/blocks-editor")},4967:()=>{},3803:()=>{},1609:e=>{"use strict";e.exports=window.React},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},5573:e=>{"use strict";e.exports=window.wp.primitives}},r={};function l(e){var o=r[e];if(void 0!==o)return o.exports;var t=r[e]={exports:{}};return c[e].call(t.exports,t,t.exports,l),t.exports}l.m=c,e=[],l.O=(o,t,c,r)=>{if(!t){var a=1/0;for(m=0;m<e.length;m++){for(var[t,c,r]=e[m],i=!0,n=0;n<t.length;n++)(!1&r||a>=r)&&Object.keys(l.O).every((e=>l.O[e](t[n])))?t.splice(n--,1):(i=!1,r<a&&(a=r));if(i){e.splice(m--,1);var s=c();void 0!==s&&(o=s)}}return o}r=r||0;for(var m=e.length;m>0&&e[m-1][2]>r;m--)e[m]=e[m-1];e[m]=[t,c,r]},l.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return l.d(o,{a:o}),o},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,l.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var r=Object.create(null);l.r(r);var a={};o=o||[null,t({}),t([]),t(t)];for(var i=2&c&&e;"object"==typeof i&&!~o.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((o=>a[o]=()=>e[o]));return a.default=()=>e,l.d(r,a),r},l.d=(e,o)=>{for(var t in o)l.o(o,t)&&!l.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.j=2733,(()=>{var e={2733:0};l.O.j=o=>0===e[o];var o=(o,t)=>{var c,r,[a,i,n]=t,s=0;if(a.some((o=>0!==e[o]))){for(c in i)l.o(i,c)&&(l.m[c]=i[c]);if(n)var m=n(l)}for(o&&o(t);s<a.length;s++)r=a[s],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(m)},t=self.webpackChunkwebpackWcBlocksMainJsonp=self.webpackChunkwebpackWcBlocksMainJsonp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})();var a=l.O(void 0,[94],(()=>l(244)));a=l.O(a),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["legacy-template"]=a})();