File: /var/www/html/sparkle/wp-content/plugins/woocommerce/assets/client/admin/product-editor/index.js
/*! For license information please see index.js.LICENSE.txt */
(()=>{var e={83849:(e,t)=>{var o;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)){if(o.length){var l=n.apply(null,o);l&&e.push(l)}}else if("object"===a)if(o.toString===Object.prototype.toString)for(var c in o)r.call(o,c)&&o[c]&&e.push(c);else e.push(o.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(o=function(){return n}.apply(t,[]))||(e.exports=o)}()},74944:function(e){e.exports=function(){"use strict";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,o=Object.isFrozen,r=Object.getPrototypeOf,n=Object.getOwnPropertyDescriptor,a=Object.freeze,l=Object.seal,c=Object.create,i="undefined"!=typeof Reflect&&Reflect,s=i.apply,m=i.construct;s||(s=function(e,t,o){return e.apply(t,o)}),a||(a=function(e){return e}),l||(l=function(e){return e}),m||(m=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}(t))))});var u,d=y(Array.prototype.forEach),p=y(Array.prototype.pop),_=y(Array.prototype.push),f=y(String.prototype.toLowerCase),h=y(String.prototype.match),g=y(String.prototype.replace),b=y(String.prototype.indexOf),w=y(String.prototype.trim),E=y(RegExp.prototype.test),v=(u=TypeError,function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return m(u,t)});function y(e){return function(t){for(var o=arguments.length,r=Array(o>1?o-1:0),n=1;n<o;n++)r[n-1]=arguments[n];return s(e,t,r)}}function k(e,r){t&&t(e,null);for(var n=r.length;n--;){var a=r[n];if("string"==typeof a){var l=f(a);l!==a&&(o(r)||(r[n]=l),a=l)}e[a]=!0}return e}function C(t){var o=c(null),r=void 0;for(r in t)s(e,t,[r])&&(o[r]=t[r]);return o}function S(e,t){for(;null!==e;){var o=n(e,t);if(o){if(o.get)return y(o.get);if("function"==typeof o.value)return y(o.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}var T=a(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),x=a(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),N=a(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=a(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),I=a(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),A=a(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),M=a(["#text"]),O=a(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),R=a(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),L=a(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),B=a(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),D=l(/\{\{[\s\S]*|[\s\S]*\}\}/gm),F=l(/<%[\s\S]*|[\s\S]*%>/gm),V=l(/^data-[\-\w.\u00B7-\uFFFF]/),H=l(/^aria-[\-\w]+$/),z=l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),U=l(/^(?:\w+script|data):/i),$=l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),j=l(/^html$/i),W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function G(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}var q=function(){return"undefined"==typeof window?null:window},Z=function(e,t){if("object"!==(void 0===e?"undefined":W(e))||"function"!=typeof e.createPolicy)return null;var o=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(o=t.currentScript.getAttribute(r));var n="dompurify"+(o?"#"+o:"");try{return e.createPolicy(n,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+n+" could not be created."),null}};return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q(),o=function(t){return e(t)};if(o.version="2.3.6",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;var r=t.document,n=t.document,l=t.DocumentFragment,c=t.HTMLTemplateElement,i=t.Node,s=t.Element,m=t.NodeFilter,u=t.NamedNodeMap,y=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,J=t.HTMLFormElement,K=t.DOMParser,Y=t.trustedTypes,X=s.prototype,Q=S(X,"cloneNode"),ee=S(X,"nextSibling"),te=S(X,"childNodes"),oe=S(X,"parentNode");if("function"==typeof c){var re=n.createElement("template");re.content&&re.content.ownerDocument&&(n=re.content.ownerDocument)}var ne=Z(Y,r),ae=ne?ne.createHTML(""):"",le=n,ce=le.implementation,ie=le.createNodeIterator,se=le.createDocumentFragment,me=le.getElementsByTagName,ue=r.importNode,de={};try{de=C(n).documentMode?n.documentMode:{}}catch(e){}var pe={};o.isSupported="function"==typeof oe&&ce&&void 0!==ce.createHTMLDocument&&9!==de;var _e=D,fe=F,he=V,ge=H,be=U,we=$,Ee=z,ve=null,ye=k({},[].concat(G(T),G(x),G(N),G(I),G(M))),ke=null,Ce=k({},[].concat(G(O),G(R),G(L),G(B))),Se=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,xe=null,Ne=!0,Pe=!0,Ie=!1,Ae=!1,Me=!1,Oe=!1,Re=!1,Le=!1,Be=!1,De=!1,Fe=!0,Ve=!0,He=!1,ze={},Ue=null,$e=k({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),je=null,We=k({},["audio","video","img","source","image","track"]),Ge=null,qe=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ze="http://www.w3.org/1998/Math/MathML",Je="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml",Ye=Ke,Xe=!1,Qe=void 0,et=["application/xhtml+xml","text/html"],tt="text/html",ot=void 0,rt=null,nt=n.createElement("form"),at=function(e){return e instanceof RegExp||e instanceof Function},lt=function(e){rt&&rt===e||(e&&"object"===(void 0===e?"undefined":W(e))||(e={}),e=C(e),ve="ALLOWED_TAGS"in e?k({},e.ALLOWED_TAGS):ye,ke="ALLOWED_ATTR"in e?k({},e.ALLOWED_ATTR):Ce,Ge="ADD_URI_SAFE_ATTR"in e?k(C(qe),e.ADD_URI_SAFE_ATTR):qe,je="ADD_DATA_URI_TAGS"in e?k(C(We),e.ADD_DATA_URI_TAGS):We,Ue="FORBID_CONTENTS"in e?k({},e.FORBID_CONTENTS):$e,Te="FORBID_TAGS"in e?k({},e.FORBID_TAGS):{},xe="FORBID_ATTR"in e?k({},e.FORBID_ATTR):{},ze="USE_PROFILES"in e&&e.USE_PROFILES,Ne=!1!==e.ALLOW_ARIA_ATTR,Pe=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.SAFE_FOR_TEMPLATES||!1,Me=e.WHOLE_DOCUMENT||!1,Le=e.RETURN_DOM||!1,Be=e.RETURN_DOM_FRAGMENT||!1,De=e.RETURN_TRUSTED_TYPE||!1,Re=e.FORCE_BODY||!1,Fe=!1!==e.SANITIZE_DOM,Ve=!1!==e.KEEP_CONTENT,He=e.IN_PLACE||!1,Ee=e.ALLOWED_URI_REGEXP||Ee,Ye=e.NAMESPACE||Ke,e.CUSTOM_ELEMENT_HANDLING&&at(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Se.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&at(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Se.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Se.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Qe=Qe=-1===et.indexOf(e.PARSER_MEDIA_TYPE)?tt:e.PARSER_MEDIA_TYPE,ot="application/xhtml+xml"===Qe?function(e){return e}:f,Ae&&(Pe=!1),Be&&(Le=!0),ze&&(ve=k({},[].concat(G(M))),ke=[],!0===ze.html&&(k(ve,T),k(ke,O)),!0===ze.svg&&(k(ve,x),k(ke,R),k(ke,B)),!0===ze.svgFilters&&(k(ve,N),k(ke,R),k(ke,B)),!0===ze.mathMl&&(k(ve,I),k(ke,L),k(ke,B))),e.ADD_TAGS&&(ve===ye&&(ve=C(ve)),k(ve,e.ADD_TAGS)),e.ADD_ATTR&&(ke===Ce&&(ke=C(ke)),k(ke,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&k(Ge,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(Ue===$e&&(Ue=C(Ue)),k(Ue,e.FORBID_CONTENTS)),Ve&&(ve["#text"]=!0),Me&&k(ve,["html","head","body"]),ve.table&&(k(ve,["tbody"]),delete Te.tbody),a&&a(e),rt=e)},ct=k({},["mi","mo","mn","ms","mtext"]),it=k({},["foreignobject","desc","title","annotation-xml"]),st=k({},x);k(st,N),k(st,P);var mt=k({},I);k(mt,A);var ut=function(e){var t=oe(e);t&&t.tagName||(t={namespaceURI:Ke,tagName:"template"});var o=f(e.tagName),r=f(t.tagName);if(e.namespaceURI===Je)return t.namespaceURI===Ke?"svg"===o:t.namespaceURI===Ze?"svg"===o&&("annotation-xml"===r||ct[r]):Boolean(st[o]);if(e.namespaceURI===Ze)return t.namespaceURI===Ke?"math"===o:t.namespaceURI===Je?"math"===o&&it[r]:Boolean(mt[o]);if(e.namespaceURI===Ke){if(t.namespaceURI===Je&&!it[r])return!1;if(t.namespaceURI===Ze&&!ct[r])return!1;var n=k({},["title","style","font","a","script"]);return!mt[o]&&(n[o]||!st[o])}return!1},dt=function(e){_(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ae}catch(t){e.remove()}}},pt=function(e,t){try{_(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){_(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!ke[e])if(Le||Be)try{dt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},_t=function(e){var t=void 0,o=void 0;if(Re)e="<remove></remove>"+e;else{var r=h(e,/^[\r\n\t ]+/);o=r&&r[0]}"application/xhtml+xml"===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var a=ne?ne.createHTML(e):e;if(Ye===Ke)try{t=(new K).parseFromString(a,Qe)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(Ye,"template",null);try{t.documentElement.innerHTML=Xe?"":a}catch(e){}}var l=t.body||t.documentElement;return e&&o&&l.insertBefore(n.createTextNode(o),l.childNodes[0]||null),Ye===Ke?me.call(t,Me?"html":"body")[0]:Me?t.documentElement:l},ft=function(e){return ie.call(e.ownerDocument||e,e,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT,null,!1)},ht=function(e){return e instanceof J&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof y)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},gt=function(e){return"object"===(void 0===i?"undefined":W(i))?e instanceof i:e&&"object"===(void 0===e?"undefined":W(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},bt=function(e,t,r){pe[e]&&d(pe[e],(function(e){e.call(o,t,r,rt)}))},wt=function(e){var t=void 0;if(bt("beforeSanitizeElements",e,null),ht(e))return dt(e),!0;if(h(e.nodeName,/[\u0080-\uFFFF]/))return dt(e),!0;var r=ot(e.nodeName);if(bt("uponSanitizeElement",e,{tagName:r,allowedTags:ve}),!gt(e.firstElementChild)&&(!gt(e.content)||!gt(e.content.firstElementChild))&&E(/<[/\w]/g,e.innerHTML)&&E(/<[/\w]/g,e.textContent))return dt(e),!0;if("select"===r&&E(/<template/i,e.innerHTML))return dt(e),!0;if(!ve[r]||Te[r]){if(!Te[r]&&vt(r)){if(Se.tagNameCheck instanceof RegExp&&E(Se.tagNameCheck,r))return!1;if(Se.tagNameCheck instanceof Function&&Se.tagNameCheck(r))return!1}if(Ve&&!Ue[r]){var n=oe(e)||e.parentNode,a=te(e)||e.childNodes;if(a&&n)for(var l=a.length-1;l>=0;--l)n.insertBefore(Q(a[l],!0),ee(e))}return dt(e),!0}return e instanceof s&&!ut(e)?(dt(e),!0):"noscript"!==r&&"noembed"!==r||!E(/<\/no(script|embed)/i,e.innerHTML)?(Ae&&3===e.nodeType&&(t=e.textContent,t=g(t,_e," "),t=g(t,fe," "),e.textContent!==t&&(_(o.removed,{element:e.cloneNode()}),e.textContent=t)),bt("afterSanitizeElements",e,null),!1):(dt(e),!0)},Et=function(e,t,o){if(Fe&&("id"===t||"name"===t)&&(o in n||o in nt))return!1;if(Pe&&!xe[t]&&E(he,t));else if(Ne&&E(ge,t));else if(!ke[t]||xe[t]){if(!(vt(e)&&(Se.tagNameCheck instanceof RegExp&&E(Se.tagNameCheck,e)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(e))&&(Se.attributeNameCheck instanceof RegExp&&E(Se.attributeNameCheck,t)||Se.attributeNameCheck instanceof Function&&Se.attributeNameCheck(t))||"is"===t&&Se.allowCustomizedBuiltInElements&&(Se.tagNameCheck instanceof RegExp&&E(Se.tagNameCheck,o)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(o))))return!1}else if(Ge[t]);else if(E(Ee,g(o,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==b(o,"data:")||!je[e])if(Ie&&!E(be,g(o,we,"")));else if(o)return!1;return!0},vt=function(e){return e.indexOf("-")>0},yt=function(e){var t=void 0,r=void 0,n=void 0,a=void 0;bt("beforeSanitizeAttributes",e,null);var l=e.attributes;if(l){var c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ke};for(a=l.length;a--;){var i=t=l[a],s=i.name,m=i.namespaceURI;if(r=w(t.value),n=ot(s),c.attrName=n,c.attrValue=r,c.keepAttr=!0,c.forceKeepAttr=void 0,bt("uponSanitizeAttribute",e,c),r=c.attrValue,!c.forceKeepAttr&&(pt(s,e),c.keepAttr))if(E(/\/>/i,r))pt(s,e);else{Ae&&(r=g(r,_e," "),r=g(r,fe," "));var u=ot(e.nodeName);if(Et(u,n,r))try{m?e.setAttributeNS(m,s,r):e.setAttribute(s,r),p(o.removed)}catch(e){}}}bt("afterSanitizeAttributes",e,null)}},kt=function e(t){var o=void 0,r=ft(t);for(bt("beforeSanitizeShadowDOM",t,null);o=r.nextNode();)bt("uponSanitizeShadowNode",o,null),wt(o)||(o.content instanceof l&&e(o.content),yt(o));bt("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e,n){var a=void 0,c=void 0,s=void 0,m=void 0,u=void 0;if((Xe=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!gt(e)){if("function"!=typeof e.toString)throw v("toString is not a function");if("string"!=typeof(e=e.toString()))throw v("dirty is not a string, aborting")}if(!o.isSupported){if("object"===W(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(gt(e))return t.toStaticHTML(e.outerHTML)}return e}if(Oe||lt(n),o.removed=[],"string"==typeof e&&(He=!1),He){if(e.nodeName){var d=ot(e.nodeName);if(!ve[d]||Te[d])throw v("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof i)1===(c=(a=_t("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===c.nodeName||"HTML"===c.nodeName?a=c:a.appendChild(c);else{if(!Le&&!Ae&&!Me&&-1===e.indexOf("<"))return ne&&De?ne.createHTML(e):e;if(!(a=_t(e)))return Le?null:De?ae:""}a&&Re&&dt(a.firstChild);for(var p=ft(He?e:a);s=p.nextNode();)3===s.nodeType&&s===m||wt(s)||(s.content instanceof l&&kt(s.content),yt(s),m=s);if(m=null,He)return e;if(Le){if(Be)for(u=se.call(a.ownerDocument);a.firstChild;)u.appendChild(a.firstChild);else u=a;return ke.shadowroot&&(u=ue.call(r,u,!0)),u}var _=Me?a.outerHTML:a.innerHTML;return Me&&ve["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&E(j,a.ownerDocument.doctype.name)&&(_="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+_),Ae&&(_=g(_,_e," "),_=g(_,fe," ")),ne&&De?ne.createHTML(_):_},o.setConfig=function(e){lt(e),Oe=!0},o.clearConfig=function(){rt=null,Oe=!1},o.isValidAttribute=function(e,t,o){rt||lt({});var r=ot(e),n=ot(t);return Et(r,n,o)},o.addHook=function(e,t){"function"==typeof t&&(pe[e]=pe[e]||[],_(pe[e],t))},o.removeHook=function(e){pe[e]&&p(pe[e])},o.removeHooks=function(e){pe[e]&&(pe[e]=[])},o.removeAllHooks=function(){pe={}},o}()}()},31772:(e,t,o)=>{"use strict";var r=o(25148);function n(){}function a(){}a.resetWarningCache=n,e.exports=function(){function e(e,t,o,n,a,l){if(l!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:n};return o.PropTypes=o,o}},7862:(e,t,o)=>{e.exports=o(31772)()},25148:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";o.r(r),o.d(r,{AUTO_DRAFT_NAME:()=>O,AddNewShippingClassModal:()=>Pr,DETAILS_SECTION_ID:()=>T,NEW_PRODUCT_MANAGEMENT_ENABLED_OPTION_NAME:()=>k,PRODUCT_STATUS_LABELS:()=>Zn,TAB_GENERAL_ID:()=>S,TRACKS_SOURCE:()=>x,__experimentalAttributeControl:()=>Mn,__experimentalAttributes:()=>Rn,__experimentalBlockIcon:()=>Wn,__experimentalDetailsCategoriesField:()=>te,__experimentalDetailsDescriptionField:()=>ne,__experimentalDetailsFeatureField:()=>V,__experimentalDetailsNameField:()=>D,__experimentalDetailsSummaryField:()=>re,__experimentalEditor:()=>pt,__experimentalInitBlocks:()=>jn,__experimentalProductFieldSection:()=>s,__experimentalProductMVPCESFooter:()=>Fe,__experimentalProductMVPFeedbackModal:()=>$e,__experimentalProductMVPFeedbackModalContainer:()=>je,__experimentalProductSectionLayout:()=>c,__experimentalShippingDimensionsImage:()=>Fr,__experimentalUseCurrencyInputProps:()=>Wo,__experimentalUseFeedbackBar:()=>Be,__experimentalUseProductHelper:()=>B,__experimentalUseVariationsOrder:()=>ma,__experimentalWooProductFieldItem:()=>f,__experimentalWooProductMoreMenuItem:()=>ce,__experimentalWooProductSectionItem:()=>h,__experimentalWooProductTabItem:()=>g,createOrderedChildren:()=>u,formatCurrencyDisplayValue:()=>jo,getCheckboxTracks:()=>F,getCurrencySymbolProps:()=>Gn,getDerivedProductType:()=>M,getHeaderTitle:()=>Ge,getProductStatus:()=>Jn,getProductStockStatus:()=>Qn,getProductStockStatusClass:()=>ea,getProductTitle:()=>ta,getProductVariationTitle:()=>oa,getTruncatedProductVariationTitle:()=>ra,initBlock:()=>ft,isValidEmail:()=>De,preventLeavingProductForm:()=>it,productApiFetchMiddleware:()=>la,sift:()=>On,sortFillsByOrder:()=>d,useValidation:()=>Io,useValidations:()=>Ye});var e={};o.r(e),o.d(e,{disableComplementaryArea:()=>Ce,enableComplementaryArea:()=>ke,pinItem:()=>Se,setFeatureDefaults:()=>Pe,setFeatureValue:()=>Ne,toggleFeature:()=>xe,unpinItem:()=>Te});var t={};o.r(t),o.d(t,{getActiveComplementaryArea:()=>Ie,isFeatureActive:()=>Me,isItemPinned:()=>Ae});var n={};o.r(n),o.d(n,{attributesInit:()=>Dn,initCategory:()=>wt,initCheckbox:()=>Tt,initCollapsible:()=>It,initConditional:()=>Rt,initDescription:()=>ko,initImages:()=>No,initInventoryQuantity:()=>pn,initLowStockQty:()=>Ro,initName:()=>Uo,initPricing:()=>Jo,initRadio:()=>tr,initRegularPrice:()=>lr,initSalePrice:()=>ur,initScheduleSale:()=>wr,initSection:()=>Cr,initShippingClass:()=>Br,initShippingDimensions:()=>Ur,initSku:()=>Fo,initSummary:()=>en,initTab:()=>cn,initToggle:()=>bn,initVariations:()=>$n});const a=window.wp.element,l=window.wc.components,c=e=>{let{title:t,description:o,className:r,children:n}=e;return(0,a.createElement)(l.FormSection,{title:t,description:o,className:r},a.Children.map(n,(e=>(0,a.isValidElement)(e)&&e.props.onChange?(0,a.createElement)("div",{className:"product-field-layout"},e):e)))},i=window.wp.components,s=e=>{let{id:t,title:o,description:r,className:n,children:s}=e;return(0,a.createElement)(c,{title:o,description:r,className:n},(0,a.createElement)(i.Card,null,(0,a.createElement)(i.CardBody,null,s,(0,a.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:t}))))},m=window.React;function u(e,t,o,r){const{children:n,props:l}=function(e,t,o,r){if("function"==typeof e)return{children:e({...o,order:t,...r}),props:{order:t,...r}};if((0,m.isValidElement)(e))return"function"==typeof(null==e?void 0:e.type)?{children:e,props:{...o,order:t,...r}}:{children:e,props:{order:t,...r}};throw Error("Invalid children type")}(e,t,o,r);return(0,a.cloneElement)(n,l)}const d=e=>{const t=[...e].sort(((e,t)=>e[0].props.order-t[0].props.order));return(0,a.createElement)(m.Fragment,null,t)},p=20,_=e=>{let{fieldName:t,sectionName:o,order:r,children:n}=e;const{registerFill:c,getFillHelpers:s}=(0,l.useSlotContext)(),m=`product_field/${o}/${t}`;return(0,a.useEffect)((()=>{c(m)}),[]),(0,a.createElement)(i.Fill,{name:`woocommerce_product_field_${o}`,key:m},(e=>u(n,r,{sectionName:o,...e,...s()},{_id:m})))},f=e=>{let{children:t,sections:o,id:r}=e;return(0,a.createElement)(a.Fragment,null,o.map((e=>{let{name:o,order:n=p}=e;return(0,a.createElement)(_,{fieldName:r,sectionName:o,order:n,key:o},t)})))};f.Slot=e=>{let{fillProps:t,section:o}=e;const{filterRegisteredFills:r}=(0,l.useSlotContext)();return(0,a.createElement)(i.Slot,{name:`woocommerce_product_field_${o}`,fillProps:t},(e=>{var t;return d?a.Children.map(null===(t=d(r(e)))||void 0===t?void 0:t.props.children,(e=>(0,a.createElement)("div",{className:"woocommerce-product-form__field"},e))):null}))};const h=e=>{let{children:t,tabs:o}=e;return(0,a.createElement)(a.Fragment,null,o.map((e=>{let{name:o,order:r}=e;return(0,a.createElement)(i.Fill,{name:`woocommerce_product_section_${o}`,key:o},(e=>u(t,r||20,{tabName:o,...e})))})))};h.Slot=e=>{let{fillProps:t,tab:o}=e;return(0,a.createElement)(i.Slot,{name:`woocommerce_product_section_${o}`,fillProps:t},(e=>d?d(e):null))};const g=e=>{let{children:t,tabProps:o,templates:r}=e;return r?(0,a.createElement)(a.Fragment,null,r.map((e=>(0,a.createElement)(i.Fill,{name:`woocommerce_product_tab_${e.name}`,key:e.name},(r=>u(t,e.order||20,{},{tabProps:o,templateName:e.name,order:e.order||20,...r})))))):(console.warn("WooProductTabItem fill is missing templates property."),null)};g.Slot=e=>{let{fillProps:t,template:o,children:r}=e;return(0,a.createElement)(i.Slot,{name:`woocommerce_product_tab_${o}`,fillProps:t},(e=>{const o=e.reduce(((e,o)=>{let{childrenMap:r,tabs:n}=e;var a;const l=o[0].props;if(l&&l.tabProps){r[l.tabProps.name]=o[0];const e="function"==typeof l.tabProps?l.tabProps(t):l.tabProps;n.push({...e,order:null!==(a=l.order)&&void 0!==a?a:20})}return{childrenMap:r,tabs:n}}),{childrenMap:{},tabs:[]}),n=o.tabs.sort(((e,t)=>e.order-t.order));return r(n,o.childrenMap)}))};const b=window.wp.data,w=window.wp.i18n,E=window.wp.url,v=window.wc.data,y="woocommerce_product_editor_show_feedback_bar",k="woocommerce_new_product_management_enabled",C="__ADD_NEW_SHIPPING_CLASS_OPTION__",S="tab/general",T=`${S}/details`,x="product-block-editor-v1",N=window.wc.tracks,P=e=>{let{product:t,permalinkPrefix:o,permalinkSuffix:r,onCancel:n,onSaved:l,saveHandler:c}=e;const{createNotice:s}=(0,b.useDispatch)("core/notices"),[m,u]=(0,a.useState)(!1),[d,p]=(0,a.useState)(t.slug||(0,E.cleanForSlug)(t.name)),_=o+(0,E.cleanForSlug)(d)+r;return(0,a.createElement)(i.Modal,{title:(0,w.__)("Edit product link","woocommerce"),onRequestClose:()=>n(),className:"woocommerce-product-link-edit-modal"},(0,a.createElement)("div",{className:"woocommerce-product-link-edit-modal__wrapper"},(0,a.createElement)("p",{className:"woocommerce-product-link-edit-modal__description"},(0,w.__)("Create a unique link for this product. Use simple, descriptive words and numbers. We'll replace spaces with hyphens (-).","woocommerce")),(0,a.createElement)(i.TextControl,{label:(0,w.__)("Product link","woocommerce"),name:"slug",value:d,onChange:p,hideLabelFromVision:!0,help:(0,a.createInterpolateElement)((0,w.__)("Preview: <link />","woocommerce"),{link:(0,a.createElement)("strong",null,_)})}),(0,a.createElement)("div",{className:"woocommerce-product-link-edit-modal__buttons"},(0,a.createElement)(i.Button,{isSecondary:!0,onClick:()=>n()},(0,w.__)("Cancel","woocommerce")),(0,a.createElement)(i.Button,{isPrimary:!0,isBusy:m,disabled:m||d===t.slug,onClick:async()=>{u(!0),await(async()=>{var e;(0,N.recordEvent)("product_update_slug",{source:x,product_id:t.id,product_type:t.type});const{slug:o,permalink:r}=null!==(e=await c(d))&&void 0!==e?e:{};o?s(o===(0,E.cleanForSlug)(d)?"success":"info",o===(0,E.cleanForSlug)(d)?(0,w.__)("Product link successfully updated.","woocommerce"):(0,w.__)("Product link already existed, updated to ","woocommerce")+r):s("error",(0,w.__)("Failed to update product link.","woocommerce")),l()})(),u(!1)}},(0,w.__)("Save","woocommerce")))))},I=window.wc.number,A=window.wc.currency,M=e=>{var t;return window.wcAdminFeatures["product-variation-management"]&&(null===(t=e.attributes)||void 0===t?void 0:t.find((e=>e.options.length&&e.variation)))?"variable":"simple"},O="AUTO-DRAFT";function R(e){return v.productReadOnlyProperties.forEach((t=>delete e[t])),e}function L(e,t){return"publish"===e&&t?[{label:(0,w.__)("View in store","woocommerce"),onClick:()=>{(0,N.recordEvent)("product_preview_changes",{source:x}),window.open(t,"_blank")}}]:[]}function B(){const{createProduct:e,updateProduct:t,deleteProduct:o}=(0,b.useDispatch)(v.PRODUCTS_STORE_NAME),{batchUpdateProductVariations:r,invalidateResolutionForStoreSelector:n}=(0,b.useDispatch)(v.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),{createNotice:l}=(0,b.useDispatch)("core/notices"),[c,i]=(0,a.useState)(!1),[s,m]=(0,a.useState)({draft:!1,publish:!1}),u=(0,a.useContext)(A.CurrencyContext),d=(0,a.useCallback)((async function(t,o){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return m({...s,[o]:!0}),e({...t,status:o,type:M(t)}).then((e=>{if(!r){const t="publish"===e.status?(0,w.__)("Product published.","woocommerce"):(0,w.__)("Product successfully created.","woocommerce");l("success",`🎉 ${t}`,{actions:L(e.status,e.permalink)})}return m({...s,[o]:!1}),e}),(e=>(r||l("error","publish"===o?(0,w.__)("Failed to publish product.","woocommerce"):(0,w.__)("Failed to create product.","woocommerce")),m({...s,[o]:!1}),e)))}),[s]);async function p(e,t){if(t)return r({product_id:e},{update:Object.values(t).flatMap(Object.entries).map((e=>{let[t,o]=e;return{id:t,menu_order:o}}))})}const _=(0,a.useCallback)((async function(e,o,r){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return m({...s,[r]:!0}),t(e,{...o,status:r,type:M(o)}).then((async e=>p(e.id,o.variationsOrder).then((()=>n("getProductVariations"))).then((()=>e)))).then((e=>{if(!a){const t="draft"===o.status&&"publish"===e.status?(0,w.__)("Product published.","woocommerce"):(0,w.__)("Product successfully updated.","woocommerce");l("success",`🎉 ${t}`,{actions:L(e.status,e.permalink)})}return m({...s,[r]:!1}),e}),(e=>(a||l("error",(0,w.__)("Failed to update product.","woocommerce")),m({...s,[r]:!1}),e)))}),[s]),f=(0,a.useCallback)((async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"draft";return d(R({...e,name:(e.name||O)+" - Copy"}),t)}),[]),h=(0,a.useCallback)((async e=>(i(!0),o(e).then((e=>{const t=(0,w.__)("Successfully moved product to Trash.","woocommerce");return l("success",`🎉 ${t}`),i(!1),e}),(e=>(l("error",(0,w.__)("Failed to move product to Trash.","woocommerce")),i(!1),e))))),[]),g=(0,a.useCallback)((e=>{if(!e.length)return"";const{getCurrencyConfig:t}=u,{decimalSeparator:o}=t(),r=new RegExp("[^-\\d\\%s]+".replace("%s",o),"g"),n=new RegExp("[%s](?=%s*[%s])".replaceAll("%s",o),"g");return e.replace(r,"").replace(n,"").replace(o,".")}),[u]),E=(0,a.useCallback)((e=>{const{getCurrencyConfig:t}=u,{decimalSeparator:o,thousandSeparator:r}=t();return I.numberFormat({decimalSeparator:o,thousandSeparator:r},e)}),[u]),y=(0,a.useCallback)((e=>{const{getCurrencyConfig:t}=u,{decimalSeparator:o,thousandSeparator:r}=t();return I.parseNumber({decimalSeparator:o,thousandSeparator:r},e)}),[u]);return{createProductWithStatus:d,updateProductWithStatus:_,copyProductWithStatus:f,deleteProductAndRedirect:h,sanitizePrice:g,formatNumber:E,parseNumber:y,isUpdatingDraft:s.draft,isUpdatingPublished:s.publish,isDeleting:c}}const D=e=>{let{}=e;const{updateProductWithStatus:t}=B(),[o,r]=(0,a.useState)(!1),{getInputProps:n,values:c,touched:s,errors:m,setValue:u,resetForm:d}=(0,l.useFormContext)(),{permalinkPrefix:p,permalinkSuffix:_}=(0,b.useSelect)((e=>{const{getPermalinkParts:t}=e(v.PRODUCTS_STORE_NAME);if(c.id){const e=t(c.id);return{permalinkPrefix:null==e?void 0:e.prefix,permalinkSuffix:null==e?void 0:e.suffix}}return{}}));return(0,a.createElement)("div",null,(0,a.createElement)(i.TextControl,{label:(0,a.createInterpolateElement)((0,w.__)("Name <required />","woocommerce"),{required:(0,a.createElement)("span",{className:"woocommerce-product-form__optional-input"},(0,w.__)("(required)","woocommerce"))}),name:"product-details-name",placeholder:(0,w.__)("e.g. 12 oz Coffee Mug","woocommerce"),...n("name",{onBlur:()=>{var e;!c.sku&&(null===(e=c.name)||void 0===e?void 0:e.length)&&u("sku",(0,E.cleanForSlug)(c.name))}})}),c.id&&!(Boolean(s.name)&&Boolean(m.name))&&p&&(0,a.createElement)("span",{className:"woocommerce-product-form__secondary-text product-details-section__product-link"},(0,w.__)("Product link","woocommerce"),": ",(0,a.createElement)("a",{href:c.permalink,target:"_blank",rel:"noreferrer"},p,c.slug||(0,E.cleanForSlug)(c.name),_),(0,a.createElement)(i.Button,{variant:"link",onClick:()=>r(!0)},(0,w.__)("Edit","woocommerce"))),o&&(0,a.createElement)(P,{permalinkPrefix:p||"",permalinkSuffix:_||"",product:c,onCancel:()=>r(!1),onSaved:()=>r(!1),saveHandler:async e=>{const o=await t(c.id,{slug:e},c.status,!0);if(o&&o.id)return d({...c,slug:o.slug,permalink:o.permalink},s,m),{slug:o.slug,permalink:o.permalink}}}))};function F(e){return{onChange:t=>{(0,N.recordEvent)(`product_checkbox_${e}`,{checked:t})}}}const V=()=>{const{getCheckboxControlProps:e}=(0,l.useFormContext)();return(0,a.createElement)(i.CheckboxControl,{label:(0,a.createElement)(a.Fragment,null,(0,w.__)("Feature this product","woocommerce"),(0,a.createElement)(l.__experimentalTooltip,{text:(0,a.createInterpolateElement)((0,w.__)("Include this product in a featured section on your website with a widget or shortcode. <moreLink />","woocommerce"),{moreLink:(0,a.createElement)(l.Link,{href:"https://woocommerce.com/document/woocommerce-shortcodes/#products",target:"_blank",type:"external",onClick:()=>(0,N.recordEvent)("add_product_learn_more",{category:"product-details"})},(0,w.__)("Learn more","woocommerce"))})})),...e("featured",F("featured"))})},H=window.lodash,z={};function U(e,t){e[t.parentID]&&(e[t.parentID].isOpen=!0,0!==e[t.parentID].parentID&&U(e,e[t.parentID]))}const $=e=>e.sort(((e,t)=>e.data.count===t.data.count?e.data.name.localeCompare(t.data.name):t.data.count-e.data.count));function j(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;for(const o of t)e.push(o.data),o.children.length>0&&(o.children=$(o.children),j(e,o.children));return e}async function W(e,t){const o={},r=[];for(const t of e)o[t.id]={data:t,children:[],parentID:t.parent,isOpen:!1};if(Object.keys(o).forEach((e=>{const n=o[parseInt(e,10)];if(0!==n.parentID)if(!o[n.parentID]&&z[n.parentID]&&(o[n.parentID]={data:z[n.parentID],children:[],parentID:z[n.parentID].parent,isOpen:!1}),o[n.parentID]){o[n.parentID].children.push(n),z[n.parentID]=o[n.parentID].data;const e=new RegExp((0,H.escapeRegExp)(t),"i");t.length>0&&e.test(n.data.name)&&U(o,n)}else r.push(n.parentID)})),r.length>0)return(0,b.resolveSelect)(v.EXPERIMENTAL_PRODUCT_CATEGORIES_STORE_NAME).getProductCategories({include:r}).then((o=>W([...o,...e],t)));const n=$(Object.values(o).filter((e=>0===e.parentID))),a=j([],n);return Promise.resolve([a,n,o])}const G={per_page:100},q=()=>{const e=(0,a.useRef)(""),{initialCategories:t,totalCount:o}=(0,b.useSelect)((e=>{const{getProductCategories:t,getProductCategoriesTotalCount:o}=e(v.EXPERIMENTAL_PRODUCT_CATEGORIES_STORE_NAME);return{initialCategories:t(G),totalCount:o(G)}})),[r,n]=(0,a.useState)(!0),[l,c]=(0,a.useState)([[],[],{}]),i=!t||t.length>0&&o>100;(0,a.useEffect)((()=>{t&&t.length>0&&(0===l[0].length||0===e.current.length)&&(n(!0),W([...t],"").then((e=>{c(e),n(!1)}),(()=>{n(!1)})))}),[t]);const s=(0,a.useCallback)((async o=>{if(e.current=o||"",!i&&t.length>0)return W([...t],o||"").then((e=>(c(e),e[1])));n(!0);try{const e=await(0,b.resolveSelect)(v.EXPERIMENTAL_PRODUCT_CATEGORIES_STORE_NAME).getProductCategories({search:o,per_page:100}),t=await W(e,o||"");return n(!1),c(t),t[1]}catch(e){return n(!1),[]}}),[t]),m=l[2];return{searchCategories:s,getFilteredItemsForSelectTree:(0,a.useCallback)(((e,t,o)=>{const r=new RegExp((0,H.escapeRegExp)(t),"i");return e.filter((e=>o.indexOf(e)<0&&(r.test(e.label)||m[+e.value]&&m[+e.value].isOpen)))}),[l]),categoriesSelectList:l[0],categories:l[1],isSearching:r,categoryTreeKeyValues:m}},Z=window.wp.compose,J=e=>{let{initialCategoryName:t,onCancel:o,onCreate:r}=e;const{categoriesSelectList:n,isSearching:c,searchCategories:s,getFilteredItemsForSelectTree:m}=q(),{createNotice:u}=(0,b.useDispatch)("core/notices"),[d,p]=(0,a.useState)(!1),{createProductCategory:_,invalidateResolutionForStoreSelector:f}=(0,b.useDispatch)(v.EXPERIMENTAL_PRODUCT_CATEGORIES_STORE_NAME),[h,g]=(0,a.useState)(t||""),[E,y]=(0,a.useState)(null),[k,C]=(0,a.useState)(""),S=(0,Z.useDebounce)(s,250);return(0,a.createElement)(i.Modal,{title:(0,w.__)("Create category","woocommerce"),onRequestClose:()=>o(),className:"woocommerce-create-new-category-modal"},(0,a.createElement)("div",{className:"woocommerce-create-new-category-modal__wrapper"},(0,a.createElement)(i.TextControl,{label:(0,w.__)("Name","woocommerce"),name:"Tops",value:h,onChange:g}),(0,a.createElement)(l.__experimentalSelectTreeControl,{label:(0,a.createInterpolateElement)((0,w.__)("Parent category <optional/>","woocommerce"),{optional:(0,a.createElement)("span",{className:"woocommerce-product-form__optional-input"},(0,w.__)("(optional)","woocommerce"))}),id:"parent-category-field",isLoading:c,items:m(Q(n),k,[]),shouldNotRecursivelySelect:!0,selected:E?Y(E):void 0,onSelect:e=>e&&y({id:+e.value,name:e.label,parent:e.parent?+e.parent:0}),onRemove:()=>y(null),onInputChange:e=>{S(e),C(e||"")},createValue:k}),(0,a.createElement)("div",{className:"woocommerce-create-new-category-modal__buttons"},(0,a.createElement)(i.Button,{isSecondary:!0,onClick:()=>o(),disabled:d},(0,w.__)("Cancel","woocommerce")),(0,a.createElement)(i.Button,{isPrimary:!0,disabled:0===h.length||d,isBusy:d,onClick:()=>{(async()=>{(0,N.recordEvent)("product_category_add",{source:x}),p(!0);try{const e=await _({name:h,parent:E?E.id:void 0});f("getProductCategories"),p(!1),r(e)}catch(e){u("error",(0,w.__)("Failed to create category.","woocommerce")),p(!1),o()}})()}},(0,w.__)("Save","woocommerce")))))};function K(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0;e.push({id:t.id,name:t.name,parent:t.parent});const r=void 0!==t.parent?t.parent:o[t.id].parentID;return r>0&&o[r]&&!e.find((e=>e.id===r))&&K(e,o[r].data,o),e}function Y(e){return e.parent?{value:String(e.id),label:e.name,parent:String(e.parent)}:{value:String(e.id),label:e.name}}function X(e){return{id:+e.value,name:e.label,parent:e.parent?+e.parent:0}}function Q(e){return e.map(Y)}const ee=e=>{let{label:t,placeholder:o,value:r=[],onChange:n}=e;const{isSearching:c,categoriesSelectList:i,categoryTreeKeyValues:s,searchCategories:m,getFilteredItemsForSelectTree:u}=q(),[d,p]=(0,a.useState)(!1),[_,f]=(0,a.useState)(""),h=e=>{f(e||""),m(e||"")},g=(0,a.useMemo)((()=>(0,H.debounce)(h,150)),[h]);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.__experimentalSelectTreeControl,{id:"category-field",multiple:!0,shouldNotRecursivelySelect:!0,createValue:_,label:t,isLoading:c,onInputChange:g,placeholder:0===r.length?o:"",onCreateNew:()=>{p(!0)},shouldShowCreateButton:e=>!e||-1===i.findIndex((t=>t.name===e)),items:u(Q(i),_,Q(r)),selected:Q(r),onSelect:e=>{if(Array.isArray(e)){const t=e.filter((e=>{let{value:t}=e;return!r.some((e=>e.id===+t))})).map(X);n([...r,...t])}},onRemove:e=>{const t=Array.isArray(e)?r.filter((t=>!e.some((e=>{let{value:o}=e;return t.id===+o})))):r.filter((t=>t.id!==+e.value));n(t)}}),d&&(0,a.createElement)(J,{initialCategoryName:_,onCancel:()=>p(!1),onCreate:e=>{n(K([...r],e,s)),p(!1),h("")}}))},te=()=>{const{getInputProps:e}=(0,l.useFormContext)();return(0,a.createElement)(ee,{label:(0,w.__)("Categories","woocommerce"),placeholder:(0,w.__)("Search or create category…","woocommerce"),...e("categories")})},oe=window.wp.blocks,re=()=>{const{setValue:e,values:t}=(0,l.useFormContext)(),[o,r]=(0,a.useState)((0,oe.parse)(t.short_description||""));return(0,a.createElement)(l.__experimentalRichTextEditor,{label:(0,w.__)("Summary","woocommerce"),blocks:o,onChange:t=>{r(t),o.length&&e("short_description",(0,oe.serialize)(t))},placeholder:(0,w.__)("Summarize this product in 1-2 short sentences. We'll show it at the top of the page.","woocommerce")})},ne=()=>{const{setValue:e,values:t}=(0,l.useFormContext)(),[o,r]=(0,a.useState)((0,oe.parse)(t.description||""));return(0,a.createElement)(l.__experimentalRichTextEditor,{label:(0,w.__)("Description","woocommerce"),blocks:o,onChange:t=>{r(t),o.length&&e("description",(0,oe.serialize)(t))},placeholder:(0,w.__)("Describe this product. What makes it unique? What are its most important features?","woocommerce")})},{Fill:ae,Slot:le}=(0,i.createSlotFill)("WooProductMoreMenuItem");ae.Slot=e=>{let{fillProps:t}=e;return(0,a.createElement)(le,{fillProps:t},(e=>(0,H.isEmpty)(e)?null:(0,a.createElement)(a.Fragment,null,e)))};const ce=ae,ie=window.wp.plugins,se=window.wc.adminLayout,me=window.wp.coreData,ue=window.wp.keyboardShortcuts,de=e=>{let{isActive:t}=e;return(0,a.useEffect)((()=>{let e=!1;return document.body.classList.contains("sticky-menu")&&(e=!0,document.body.classList.remove("sticky-menu")),()=>{e&&document.body.classList.add("sticky-menu")}}),[]),(0,a.useEffect)((()=>(t?document.body.classList.add("is-fullscreen-mode"):document.body.classList.remove("is-fullscreen-mode"),()=>{t&&document.body.classList.remove("is-fullscreen-mode")})),[t]),null};function pe(){return pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},pe.apply(this,arguments)}var _e=o(83849),fe=o.n(_e);const he=(0,a.forwardRef)((function(e,t){let{footer:o,header:r,sidebar:n,secondarySidebar:l,notices:c,content:s,drawer:m,actions:u,labels:d,className:p,shortcuts:_}=e;const f=(0,i.__unstableUseNavigateRegions)(_);!function(e){(0,a.useEffect)((()=>{const t=document&&document.querySelector(`html:not(.${e})`);if(t)return t.classList.toggle(e),()=>{t.classList.toggle(e)}}),[e])}("interface-interface-skeleton__html-container");const h={drawer:(0,w.__)("Drawer"),header:(0,w.__)("Header"),body:(0,w.__)("Content"),secondarySidebar:(0,w.__)("Block Library"),sidebar:(0,w.__)("Settings"),actions:(0,w.__)("Publish"),footer:(0,w.__)("Footer"),...d};return(0,a.createElement)("div",pe({},f,{ref:(0,Z.useMergeRefs)([t,f.ref]),className:fe()(p,"interface-interface-skeleton",f.className,!!o&&"has-footer")}),!!m&&(0,a.createElement)("div",{className:"interface-interface-skeleton__drawer",role:"region","aria-label":h.drawer,tabIndex:"-1"},m),(0,a.createElement)("div",{className:"interface-interface-skeleton__editor"},!!r&&(0,a.createElement)("div",{className:"interface-interface-skeleton__header",role:"region","aria-label":h.header,tabIndex:"-1"},r),(0,a.createElement)("div",{className:"interface-interface-skeleton__body"},!!l&&(0,a.createElement)("div",{className:"interface-interface-skeleton__secondary-sidebar",role:"region","aria-label":h.secondarySidebar,tabIndex:"-1"},l),!!c&&(0,a.createElement)("div",{className:"interface-interface-skeleton__notices"},c),(0,a.createElement)("div",{className:"interface-interface-skeleton__content",role:"region","aria-label":h.body,tabIndex:"-1"},s),!!n&&(0,a.createElement)("div",{className:"interface-interface-skeleton__sidebar",role:"region","aria-label":h.sidebar,tabIndex:"-1"},n),!!u&&(0,a.createElement)("div",{className:"interface-interface-skeleton__actions",role:"region","aria-label":h.actions,tabIndex:"-1"},u))),!!o&&(0,a.createElement)("div",{className:"interface-interface-skeleton__footer",role:"region","aria-label":h.footer,tabIndex:"-1"},o))})),ge=window.wp.primitives,be=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function we(e){let{as:t=i.DropdownMenu,className:o,label:r=(0,w.__)("Options"),popoverProps:n,toggleProps:l,children:c}=e;return(0,a.createElement)(t,{className:fe()("interface-more-menu-dropdown",o),icon:be,label:r,popoverProps:{position:"bottom left",...n,className:fe()("interface-more-menu-dropdown__content",null==n?void 0:n.className)},toggleProps:{tooltipPosition:"bottom",...l}},(e=>c(e)))}const Ee=window.wp.deprecated;var ve=o.n(Ee);const ye=window.wp.preferences,ke=(e,t)=>o=>{let{registry:r}=o;t&&r.dispatch(ye.store).set(e,"complementaryArea",t)},Ce=e=>t=>{let{registry:o}=t;o.dispatch(ye.store).set(e,"complementaryArea",null)},Se=(e,t)=>o=>{let{registry:r}=o;if(!t)return;const n=r.select(ye.store).get(e,"pinnedItems");!0!==(null==n?void 0:n[t])&&r.dispatch(ye.store).set(e,"pinnedItems",{...n,[t]:!0})},Te=(e,t)=>o=>{let{registry:r}=o;if(!t)return;const n=r.select(ye.store).get(e,"pinnedItems");r.dispatch(ye.store).set(e,"pinnedItems",{...n,[t]:!1})};function xe(e,t){return function(o){let{registry:r}=o;ve()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(ye.store).toggle(e,t)}}function Ne(e,t,o){return function(r){let{registry:n}=r;ve()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(ye.store).set(e,t,!!o)}}function Pe(e,t){return function(o){let{registry:r}=o;ve()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(ye.store).setDefaults(e,t)}}const Ie=(0,b.createRegistrySelector)((e=>(t,o)=>e(ye.store).get(o,"complementaryArea"))),Ae=(0,b.createRegistrySelector)((e=>(t,o,r)=>{var n;const a=e(ye.store).get(o,"pinnedItems");return null===(n=null==a?void 0:a[r])||void 0===n||n})),Me=(0,b.createRegistrySelector)((e=>(t,o,r)=>(ve()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(ye.store).get(o,r)))),Oe=(0,b.createReduxStore)("core/interface",{reducer:()=>{},actions:e,selectors:t});(0,b.register)(Oe);const Re=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),Le=window.wc.customerEffortScore,Be=()=>{const{updateOptions:e}=(0,b.useDispatch)(v.OPTIONS_STORE_NAME),{shouldShowFeedbackBar:t}=(0,b.useSelect)((e=>{var t;const{getOption:o,hasFinishedResolution:r}=e(v.OPTIONS_STORE_NAME),n=o(y);return{shouldShowFeedbackBar:!!r("getOption",[y])&&(null===(t=window.wcTracks)||void 0===t?void 0:t.isEnabled)&&"yes"===n}}),[]);return{shouldShowFeedbackBar:t,maybeShowFeedbackBar:async()=>{var t;const{showFeedbackBarOption:o}=await(async()=>{const{getOption:e}=(0,b.resolveSelect)(v.OPTIONS_STORE_NAME);return{showFeedbackBarOption:await e(y)}})();(null===(t=window.wcTracks)||void 0===t?void 0:t.isEnabled)&&"no"!==o&&e({[y]:"yes"})},hideFeedbackBar:()=>{e({[y]:"no"})}}},De=e=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase());function Fe(e){let{product:t}=e;const{hideFeedbackBar:o,shouldShowFeedbackBar:r}=Be(),{showCesModal:n,showProductMVPFeedbackModal:c}=(0,Le.useCustomerEffortScoreModal)(),s=()=>({product_type:t.type});return(0,a.createElement)(a.Fragment,null,r&&(0,a.createElement)("div",{className:"woocommerce-product-mvp-ces-footer"},(0,a.createElement)("div",{className:"woocommerce-product-mvp-ces-footer__body"},(0,a.createElement)(l.Pill,null,"Beta"),(0,a.createElement)("div",{className:"woocommerce-product-mvp-ces-footer__message"},(0,a.createInterpolateElement)((0,w.__)("How is your experience with the new product form? <span><shareButton>Share feedback</shareButton> or <turnOffButton>turn it off</turnOffButton></span>","woocommerce"),{span:(0,a.createElement)("span",{className:"woocommerce-product-mvp-ces-footer__message-buttons"}),shareButton:(0,a.createElement)(i.Button,{variant:"link",onClick:()=>{(0,N.recordEvent)("product_editor_feedback_bar_share_feedback_click",{...s()}),n({action:"product_editor",showDescription:!1,title:(0,w.__)("What do you think of the new product form?","woocommerce"),firstQuestion:(0,w.__)("The product editing screen is easy to use","woocommerce"),secondQuestion:(0,w.__)("Product form is easy to use","woocommerce"),onsubmitLabel:(0,w.__)("Thanks for the feedback — we'll put it to good use!","woocommerce"),shouldShowComments:()=>!1,getExtraFieldsToBeShown:(e,t,o)=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.BaseControl,{id:"feedback_additional_thoughts",className:"woocommerce-product-feedback__additional-thoughts",label:(0,a.createInterpolateElement)((0,w.__)("ADDITIONAL THOUGHTS <optional />","woocommerce"),{optional:(0,a.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,w.__)("(OPTIONAL)","woocommerce"))})},(0,a.createElement)(i.TextareaControl,{value:e.additional_thoughts||"",onChange:o=>t({...e,additional_thoughts:o}),help:(null==o?void 0:o.additional_thoughts)||""})),(0,a.createElement)(i.BaseControl,{id:"feedback_email",className:"woocommerce-product-feedback__email",label:(0,a.createInterpolateElement)((0,w.__)("YOUR EMAIL ADDRESS <optional />","woocommerce"),{optional:(0,a.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,w.__)("(OPTIONAL)","woocommerce"))})},(0,a.createElement)(i.TextControl,{value:e.email||"",onChange:o=>t({...e,email:o}),help:(null==o?void 0:o.email)||""}),(0,a.createElement)("span",null,(0,w.__)("In case you want to participate in further discussion and future user research.","woocommerce")))),validateExtraFields:e=>{let{email:t="",additional_thoughts:o=""}=e;const r={};return t.length>0&&!De(t)&&(r.email=(0,w.__)("Please enter a valid email address.","woocommerce")),(null==o?void 0:o.length)>500&&(r.additional_thoughts=(0,w.__)("Please enter no more than 500 characters.","woocommerce")),r}},{},{type:"snackbar"})}}),turnOffButton:(0,a.createElement)(i.Button,{onClick:()=>{(0,N.recordEvent)("product_editor_feedback_bar_turnoff_editor_click",{...s()}),o(),c()},variant:"link"})})),(0,a.createElement)(i.Button,{className:"woocommerce-product-mvp-ces-footer__close-button",icon:Re,label:(0,w.__)("Hide this message","woocommerce"),onClick:()=>{(0,N.recordEvent)("product_editor_feedback_bar_dismiss_click",{...s()}),o()}}))))}const Ve=window.wc.wcSettings;var He=o(7862),ze=o.n(He);const Ue=window.wc.experimental;function $e(e){let{recordScoreCallback:t,onCloseModal:o}=e;const[r,n]=(0,a.useState)(!1),[l,c]=(0,a.useState)(!1),[s,m]=(0,a.useState)(!1),[u,d]=(0,a.useState)(!1),[p,_]=(0,a.useState)(!1),f=[{key:"missing-features",label:(0,w.__)("Missing features","woocommerce"),checked:r,onChange:n},{key:"missing-plugins",label:(0,w.__)("Missing plugins","woocommerce"),checked:l,onChange:c},{key:"difficult-to-use",label:(0,w.__)("It's difficult to use","woocommerce"),checked:s,onChange:m},{key:"slow-buggy-or-broken",label:(0,w.__)("It's slow, buggy, or broken","woocommerce"),checked:u,onChange:d},{key:"other",label:(0,w.__)("Other (describe below)","woocommerce"),checked:p,onChange:_}],[h,g]=(0,a.useState)(""),[E,v]=(0,a.useState)(""),y=f.filter((e=>e.checked)).map((e=>e.key)),{createSuccessNotice:k}=(0,b.useDispatch)("core/notices"),C=(0,a.createElement)("span",{className:"woocommerce-product-mvp-feedback-modal__optional"},(0,w.__)("(optional)","woocommerce"));return(0,a.createElement)(Le.FeedbackModal,{title:(0,w.__)("Thanks for trying out the new product form!","woocommerce"),onSubmit:()=>{t(y,h,E),k((0,w.__)("Thanks for the feedback — we'll put it to good use!","woocommerce"))},onModalClose:o,isSubmitButtonDisabled:!y.length,submitButtonLabel:(0,w.__)("Send","woocommerce"),cancelButtonLabel:(0,w.__)("Skip","woocommerce"),className:"woocommerce-product-mvp-feedback-modal"},(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Ue.Text,{variant:"subtitle.small",as:"p",weight:"600",size:"14",lineHeight:"20px"}),(0,a.createElement)("fieldset",{className:"woocommerce-product-mvp-feedback-modal__reason"},(0,a.createElement)("legend",null,(0,w.__)("What made you turn off the new product form?","woocommerce")),(0,a.createElement)("div",{className:"woocommerce-product-mvp-feedback-modal__checkboxes"},f.map(((e,t)=>(0,a.createElement)(i.CheckboxControl,{key:t,label:e.label,name:e.key,checked:e.checked,onChange:e.onChange}))))),(0,a.createElement)("div",{className:"woocommerce-product-mvp-feedback-modal__comments"},(0,a.createElement)(i.TextareaControl,{label:(0,a.createInterpolateElement)((0,w.__)("Additional thoughts <optional/>","woocommerce"),{optional:C}),value:h,onChange:e=>g(e),rows:5})),(0,a.createElement)("div",{className:"woocommerce-product-mvp-feedback-modal__email"},(0,a.createElement)(i.TextControl,{label:(0,a.createInterpolateElement)((0,w.__)("Your email address <optional/>","woocommerce"),{optional:C}),value:E,onChange:e=>v(e),rows:5,help:(0,w.__)("In case you want to participate in further discussion and future user research.","woocommerce")}))))}$e.propTypes={recordScoreCallback:ze().func.isRequired,onCloseModal:ze().func};const je=e=>{let{productId:t}=e;const{values:o}=(0,l.useFormContext)(),{hideProductMVPFeedbackModal:r}=(0,b.useDispatch)(Le.STORE_KEY),{isProductMVPModalVisible:n}=(0,b.useSelect)((e=>{const{isProductMVPFeedbackModalVisible:t}=e(Le.STORE_KEY);return{isProductMVPModalVisible:t()}})),c=null!=t?t:o.id,{_feature_nonce:i}=(0,Ve.getSetting)("admin",{}),s=c?(0,Ve.getAdminLink)(`post.php?post=${c}&action=edit&product_block_editor=0&_feature_nonce=${i}`):(0,Ve.getAdminLink)(`post-new.php?post_type=product&product_block_editor=0&_feature_nonce=${i}`);return n?(0,a.createElement)($e,{recordScoreCallback:(e,t,o)=>{(0,N.recordEvent)("product_mvp_feedback",{action:"disable",checked:e,comments:t||"",email:o}),r(),window.location.href=`${s}&new-product-experience-disabled=true`},onCloseModal:()=>{(0,N.recordEvent)("product_mvp_feedback",{action:"disable",checked:"",comments:""}),r(),window.location.href=s}}):null};function We(e){let{product:t}=e;return(0,a.createElement)(se.WooFooterItem,null,(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Fe,{product:t}),(0,a.createElement)(je,{productId:t.id})))}const Ge=(e,t)=>Boolean(e)&&e!==t?e:t===O?(0,w.__)("Add new product","woocommerce"):t,qe=()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(we,{toggleProps:{onClick:()=>(0,N.recordEvent)("product_dropdown_click")},popoverProps:{className:"woocommerce-product-header__more-menu"}},(e=>{let{onClose:t}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ce.Slot,{fillProps:{onClose:t}}))}))),Ze=window.wc.navigation;function Je(e){switch(e.code){case"product_invalid_sku":return(0,w.__)("Invalid or duplicated SKU.","woocommerce");case"product_create_error":return(0,w.__)("Failed to create product.","woocommerce");case"product_publish_error":return(0,w.__)("Failed to publish product.","woocommerce");case"product_preview_error":return(0,w.__)("Failed to preview product.","woocommerce");default:return(0,w.__)("Failed to save product.","woocommerce")}}const Ke=(0,a.createContext)({errors:{},registerValidator:()=>()=>{},validateField:()=>Promise.resolve(void 0),validateAll:()=>Promise.resolve({})});function Ye(){const e=(0,a.useContext)(Ke),[t,o]=(0,a.useState)(!1);return{isValidating:t,validate:async()=>(o(!0),new Promise(((t,o)=>{e.validateAll().then((e=>{!function(e){return Object.values(e).some(Boolean)}(e)?t():o(e)})).catch((()=>{o(e.errors)}))})).finally((()=>{o(!1)})))}}function Xe(e){let{productStatus:t,...o}=e;const{createErrorNotice:r}=(0,b.useDispatch)("core/notices"),n=function(e){let{productStatus:t,disabled:o,onClick:r,onSaveSuccess:n,onSaveError:l,...c}=e;const i=(0,a.useRef)(),[s]=(0,me.useEntityProp)("postType","product","id"),[m]=(0,me.useEntityProp)("postType","product","permalink"),{hasEdits:u,isDisabled:d}=(0,b.useSelect)((e=>{const{hasEditsForEntityRecord:t,isSavingEntityRecord:o}=e("core");return{isDisabled:o("postType","product",s),hasEdits:t("postType","product",s)}}),[s]),{isValidating:p,validate:_}=Ye(),f=o||d||p,{editEntityRecord:h,saveEditedEntityRecord:g}=(0,b.useDispatch)("core");let E;return"string"==typeof m&&(E=new URL(m),E.searchParams.append("preview","true")),{"aria-label":(0,w.__)("Preview in new tab","woocommerce"),children:(0,w.__)("Preview","woocommerce"),target:"_blank",...c,ref(e){"function"==typeof c.ref&&c.ref(e),i.current=e},"aria-disabled":f,href:null==E?void 0:E.toString(),variant:"tertiary",onClick:async function(e){var o;if(f)return e.preventDefault();if(r&&r(e),u){e.preventDefault();try{await _(),"auto-draft"===t&&await h("postType","product",s,{status:"draft"});const e=await g("postType","product",s,{throwOnError:!0});null===(o=i.current)||void 0===o||o.click(),n&&n(e)}catch(e){if(l){let t=e;t.code||(t={code:"product_preview_error"}),l(t)}}}}}}({productStatus:t,...o,onClick(){(0,N.recordEvent)("product_preview_changes",{source:x})},onSaveSuccess(e){if("auto-draft"===t){const t=(0,Ze.getNewPath)({},`/product/${e.id}`);(0,Ze.navigateTo)({url:t})}},onSaveError(e){const t=Je(e);r(t)}});return(0,a.createElement)(i.Button,{...n})}function Qe(e,t){const{attributes:o,categories:r,cross_sell_ids:n,description:a,dimensions:l,downloadable:c,id:i,images:s,manage_stock:m,menu_order:u,purchase_note:d,reviews_allowed:p,sale_price:_,short_description:f,tags:h,type:g,upsell_ids:b,virtual:w,weight:E}=t,v={virtual:w,downloadable:c};(0,N.recordEvent)(e,{attributes:o.length?"yes":"no",categories:r.length?"yes":"no",cross_sells:n.length?"yes":"no",description:a.length?"yes":"no",dimensions:l.length.length||l.width.length||l.height.length?"yes":"no",enable_reviews:p?"yes":"no",is_downloadable:c?"yes":"no",is_virtual:w?"yes":"no",manage_stock:m?"yes":"no",menu_order:u?"yes":"no",product_id:i,product_gallery:s.length>1?"yes":"no",product_image:s.length?"yes":"no",product_type:g,product_type_options:Object.keys(v).filter((e=>v[e])).join(","),purchase_note:d.length?"yes":"no",sale_price:_.length?"yes":"no",short_description:f.length?"yes":"no",source:"product-blocks-editor-v1",tags:h.length?"yes":"no",upsells:b.length?"yes":"no",weight:E.length?"yes":"no"})}const et=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));function tt(e){let{productStatus:t,...o}=e;const{createSuccessNotice:r,createErrorNotice:n}=(0,b.useDispatch)("core/notices"),{maybeShowFeedbackBar:l}=Be(),c=function(e){let{productStatus:t,disabled:o,onClick:r,onSaveSuccess:n,onSaveError:l,...c}=e;const[s]=(0,me.useEntityProp)("postType","product","id"),{hasEdits:m,isDisabled:u}=(0,b.useSelect)((e=>{const{hasEditsForEntityRecord:t,isSavingEntityRecord:o}=e("core");return{isDisabled:o("postType","product",s),hasEdits:t("postType","product",s)}}),[s]),{isValidating:d,validate:p}=Ye(),_=o||u||"publish"!==t&&!m||d,{editEntityRecord:f,saveEditedEntityRecord:h}=(0,b.useDispatch)("core");let g;return g="publish"===t?(0,w.__)("Switch to draft","woocommerce"):m||"auto-draft"===t?(0,w.__)("Save draft","woocommerce"):(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.Icon,{icon:et}),(0,w.__)("Saved","woocommerce")),{children:g,...c,"aria-disabled":_,variant:"tertiary",onClick:async function(e){if(_)return e.preventDefault();r&&r(e);try{await p(),await f("postType","product",s,{status:"draft"});const e=await h("postType","product",s,{throwOnError:!0});n&&n(e)}catch(e){l&&l(e)}}}}({productStatus:t,...o,onSaveSuccess(e){if(Qe("product_edit",e),r((0,w.__)("Product saved as draft.","woocommerce")),l(),"auto-draft"===t){const t=(0,Ze.getNewPath)({},`/product/${e.id}`);(0,Ze.navigateTo)({url:t})}},onSaveError(e){const t=Je(e);n(t)}});return(0,a.createElement)(i.Button,{...c})}function ot(e){let{productStatus:t,...o}=e;const{createSuccessNotice:r,createErrorNotice:n}=(0,b.useDispatch)("core/notices"),{maybeShowFeedbackBar:l}=Be(),c=function(e){let{productStatus:t,disabled:o,onClick:r,onPublishSuccess:n,onPublishError:a,...l}=e;const{isValidating:c,validate:i}=Ye(),[s]=(0,me.useEntityProp)("postType","product","id"),{isSaving:m}=(0,b.useSelect)((e=>{const{isSavingEntityRecord:t}=e("core");return{isSaving:t("postType","product",s)}}),[s]),u=m||c,d="publish"===t,{editEntityRecord:p,saveEditedEntityRecord:_}=(0,b.useDispatch)("core");return{children:d?(0,w.__)("Update","woocommerce"):(0,w.__)("Add","woocommerce"),...l,isBusy:u,variant:"primary",onClick:async function(e){r&&r(e);try{await i(),d||await p("postType","product",s,{status:"publish"});const e=await _("postType","product",s,{throwOnError:!0});e&&n&&n(e)}catch(e){if(a){let t=e;t.code||(t={code:d?"product_publish_error":"product_create_error"}),a(t)}}}}}({productStatus:t,...o,onPublishSuccess(e){const o="publish"===t;o&&Qe("product_update",e);const n=o?(0,w.__)("Product updated.","woocommerce"):(0,w.__)("Product added.","woocommerce"),a={icon:"🎉",actions:[{label:(0,w.__)("View in store","woocommerce"),url:e.permalink,onClick(t){t.preventDefault(),window.open(e.permalink,"_blank")}}]};if(r(n,a),l(),"auto-draft"===t){const t=(0,Ze.getNewPath)({},`/product/${e.id}`);(0,Ze.navigateTo)({url:t})}},onPublishError(e){const t=Je(e);n(t)}});return(0,a.createElement)(i.Button,{...c})}const rt="woocommerce_product_tabs";function nt(e){let{onChange:t=(()=>{})}=e;const[o,r]=(0,a.useState)(null),n=(0,Ze.getQuery)(),[l]=(0,me.useEntityProp)("postType","product","id"),c=(0,b.useSelect)((e=>e("core").getEditedEntityRecord("postType","product",l)));return(0,a.useEffect)((()=>{t(o)}),[o]),(0,a.useEffect)((()=>{n.tab&&r(n.tab)}),[n.tab]),(0,a.createElement)(i.NavigableMenu,{role:"tablist",onNavigate:function(e,t){t.click()},className:"woocommerce-product-tabs",orientation:"horizontal"},(0,a.createElement)(i.Slot,{fillProps:{onClick:e=>{(0,Ze.navigateTo)({url:(0,Ze.getNewPath)({tab:e})}),(0,N.recordEvent)("product_tab_click",function(e,t){const o={product_tab:e,product_type:t.type,source:x};return"inventory"===e?{...o,is_store_stock_management_enabled:t.manage_stock}:o}(e,c))}},name:rt},(e=>d?(function(e){var t,n;if(!o)for(let o=0;o<e.length;o++){if(e[o][0].props.disabled)continue;const a=(null===(n=null===(t=e[o][0].props)||void 0===t?void 0:t.children)||void 0===n?void 0:n.key)||null;return void r(a)}}(e),d(e)):null)))}function at(e){let{onTabSelect:t}=e;const[o]=(0,me.useEntityProp)("postType","product","id"),r=(0,b.useSelect)((e=>{const{getEntityRecord:t}=e("core");return t("postType","product",o)}),[o]),[n]=(0,me.useEntityProp)("postType","product","name");return(0,a.createElement)("div",{className:"woocommerce-product-header",role:"region","aria-label":(0,w.__)("Product Editor top bar.","woocommerce"),tabIndex:-1},(0,a.createElement)("div",{className:"woocommerce-product-header__inner"},(0,a.createElement)("div",null),(0,a.createElement)("h1",{className:"woocommerce-product-header__title"},Ge(n,r.name)),(0,a.createElement)("div",{className:"woocommerce-product-header__actions"},(0,a.createElement)(tt,{productStatus:r.status}),(0,a.createElement)(Xe,{productStatus:r.status}),(0,a.createElement)(ot,{productStatus:r.status}),(0,a.createElement)(se.WooHeaderItem.Slot,{name:"product"}),(0,a.createElement)(qe,null))),(0,a.createElement)(nt,{onChange:t}))}const lt=window.wp.mediaUtils,ct=window.wp.blockEditor,it=(e,t)=>{const o=new URLSearchParams(e.search),r=new URLSearchParams(t.search);return o.delete("tab"),r.delete("tab"),o.toString()!==r.toString()};function st(e){return delete e.content,delete e.blocks,e}function mt(){const[e]=(0,me.useEntityProp)("postType","product","id"),{edits:t}=(0,b.useSelect)((t=>{const{getEntityRecordNonTransientEdits:o}=t("core");return{edits:st(o("postType","product",e))}}),[e]);return{hasEdit:function(e){return t.hasOwnProperty(e)},hasEdits:Object.keys(t).length>0}}function ut(e){let{context:t,settings:o,product:r}=e;!function(){const[e]=(0,me.useEntityProp)("postType","product","id"),{hasEdits:t}=mt(),{isSaving:o}=(0,b.useSelect)((t=>{const{isSavingEntityRecord:o}=t("core");return{isSaving:o("postType","product",e)}}),[e]);(0,Ze.useConfirmUnsavedChanges)(t||o,it)}();const n=(0,b.useSelect)((e=>{const{canUser:t}=e("core");return!1!==t("create","media","")}),[]),l=(0,a.useMemo)((()=>n?{...o,mediaUpload(e){let{onError:t,...r}=e;(0,lt.uploadMedia)({wpAllowedMimeTypes:(null==o?void 0:o.allowedMimeTypes)||void 0,onError:e=>{let{message:o}=e;return t(o)},...r})}}:o),[n,o]),[c,i,s]=(0,me.useEntityBlockEditor)("postType","product",{id:r.id});return(0,a.useLayoutEffect)((()=>{s((0,oe.synchronizeBlocksWithTemplate)([],null==o?void 0:o.template),{})}),[r.id]),c?(0,a.createElement)("div",{className:"woocommerce-product-block-editor"},(0,a.createElement)(ct.BlockContextProvider,{value:t},(0,a.createElement)(ct.BlockEditorProvider,{value:c,onInput:i,onChange:s,settings:l},(0,a.createElement)(ct.BlockEditorKeyboardShortcuts.Register,null),(0,a.createElement)(ct.BlockTools,null,(0,a.createElement)(ct.ObserveTyping,null,(0,a.createElement)(ct.BlockList,{className:"woocommerce-product-block-editor__block-list"})))))):null}function dt(e){let{initialValue:t,children:o}=e;const r=(0,a.useRef)({}),n=(0,a.useRef)({}),[l,c]=(0,a.useState)({});async function i(e){const o=r.current;return e in o?(0,o[e])(t).then((t=>(c((o=>({...o,[e]:t}))),t))):Promise.resolve(void 0)}return(0,a.createElement)(Ke.Provider,{value:{errors:l,registerValidator:function(e,t){return r.current={...r.current,[e]:t},t=>{n.current[e]=t}},validateField:i,validateAll:async function(){const e={},t=r.current;for(const o in t)e[o]=await i(o);c(e);const o=function(e,t){const o=Object.entries(e).filter((e=>{let[o,r]=e;return(null==r?void 0:r.closest('.is-selected[role="tabpanel"]'))&&Boolean(t[o])})),[r]=o.sort(((e,t)=>{let[,o]=e,[,r]=t;return o.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1})),[,n]=null!=r?r:[];return n}(n.current,e);return null==o||o.focus(),e}}},o)}function pt(e){let{product:t,settings:o}=e;const[r,n]=(0,a.useState)(null),l=(0,se.useExtendLayout)("product-block-editor");return(0,a.createElement)(se.LayoutContextProvider,{value:l},(0,a.createElement)(a.StrictMode,null,(0,a.createElement)(me.EntityProvider,{kind:"postType",type:"product",id:t.id},(0,a.createElement)(ue.ShortcutProvider,null,(0,a.createElement)(de,{isActive:!1}),(0,a.createElement)(i.SlotFillProvider,null,(0,a.createElement)(dt,{initialValue:t},(0,a.createElement)(he,{header:(0,a.createElement)(at,{onTabSelect:n}),content:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ut,{settings:o,product:t,context:{selectedTab:r,postType:"product",postId:t.id}}),(0,a.createElement)(ie.PluginArea,{scope:"woocommerce-product-block-editor"}))}),(0,a.createElement)(i.Popover.Slot,null)))),(0,a.createElement)(We,{product:t}))))}const _t=window.wp.blockLibrary;function ft(e){if(!e)return;const{metadata:t,settings:o,name:r}=e;return(0,oe.registerBlockType)({name:r,...t},o)}const ht=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-category-field","title":"Product Category","category":"widgets","description":"A field to select product categories.","keywords":["products","category"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"},"label":{"type":"string"},"placeholder":{"type":"string"}},"usesContext":["postType"],"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:gt}=ht,bt={example:{},edit:function(e){let{attributes:t,context:o}=e;const r=(0,ct.useBlockProps)(),{name:n,label:l,placeholder:c}=t,[i,s]=(0,me.useEntityProp)("postType",(null==o?void 0:o.postType)||"product",n||"categories");return(0,a.createElement)("div",{...r},(0,a.createElement)(ee,{label:l||(0,w.__)("Categories","woocommerce"),placeholder:c||(0,w.__)("Search or create category…","woocommerce"),onChange:s,value:i||[]}))}},wt=()=>ft({name:gt,metadata:ht,settings:bt});function Et(e){if(!e)return;const{metadata:t,settings:o,name:r}=e;return(0,oe.registerBlockType)({name:r,...t},o)}const vt=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-checkbox-field","title":"Product checkbox control","category":"woocommerce","description":"The product checkbox.","keywords":["products","checkbox","input"],"textdomain":"default","attributes":{"title":{"type":"string","__experimentalRole":"content"},"label":{"type":"string"},"property":{"type":"string"},"tooltip":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),yt=function(e){let{icon:t,size:o=24,...r}=e;return(0,a.cloneElement)(t,{width:o,height:o,...r})},kt=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"})),{name:Ct}=vt,St={example:{},edit:function(e){let{attributes:t}=e;const o=(0,ct.useBlockProps)({className:"woocommerce-product-form__checkbox"}),{property:r,title:n,label:l,tooltip:c}=t,[s,m]=(0,me.useEntityProp)("postType","product",r);return(0,a.createElement)("div",{...o},(0,a.createElement)("h4",null,n),(0,a.createElement)("div",{className:"woocommerce-product-form__checkbox-wrapper"},(0,a.createElement)(i.CheckboxControl,{label:l,checked:s,onChange:e=>m(e)}),c&&(0,a.createElement)(i.Tooltip,{text:(0,a.createElement)("span",null,c),position:"top center",className:"woocommerce-product-form__checkbox-tooltip",delay:0},(0,a.createElement)("span",{className:"woocommerce-product-form__checkbox-tooltip-icon"},(0,a.createElement)(yt,{icon:kt,size:21.94,fill:"#949494"})))))}},Tt=()=>Et({name:Ct,metadata:vt,settings:St}),xt=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-collapsible","title":"Collapsible","category":"widgets","description":"Container with collapsible inner blocks.","textdomain":"default","attributes":{"toggleText":{"type":"string","__experimentalRole":"content"},"initialCollapsed":{"type":"boolean"},"persistRender":{"type":"boolean"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}'),{name:Nt}=xt,Pt={example:{},edit:function(e){let{attributes:t}=e;const o=(0,ct.useBlockProps)(),{toggleText:r,initialCollapsed:n,persistRender:c=!0}=t;return(0,a.createElement)("div",{...o},(0,a.createElement)(l.CollapsibleContent,{toggleText:r,initialCollapsed:n,persistRender:c},(0,a.createElement)(ct.InnerBlocks,{templateLock:"all"})))}},It=()=>ft({name:Nt,metadata:xt,settings:Pt}),At=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/conditional","title":"Conditional","category":"widgets","description":"Container to only conditionally render inner blocks.","textdomain":"default","attributes":{"mustMatch":{"__experimentalRole":"content","type":"array","items":{"type":"object"},"default":[]}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}'),{name:Mt}=At,Ot={example:{},edit:function(e){let{attributes:t}=e;const o=(0,ct.useBlockProps)(),{mustMatch:r}=t,n=(0,me.useEntityId)("postType","product"),c=(0,b.useSelect)((e=>e("core").getEditedEntityRecord("postType","product",n))),i=(0,a.useMemo)((()=>{for(const[e,t]of Object.entries(r))if(!t.includes(c[e]))return!1;return!0}),[r,c]);return(0,a.createElement)("div",{...o},(0,a.createElement)(l.DisplayState,{state:i?"visible":"visually-hidden"},(0,a.createElement)(ct.InnerBlocks,{templateLock:"all"})))}},Rt=()=>ft({name:Mt,metadata:At,settings:Ot}),Lt=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-description-field","title":"Product description","category":"woocommerce","description":"The product description.","keywords":["products","description"],"textdomain":"default","attributes":{"__contentEditable":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}');var Bt=o(74944);const Dt=["a","b","em","i","strong","p","br"],Ft=["target","href","rel","name","download"];function Vt(e,t){const o=(null==t?void 0:t.tags)||Dt,r=(null==t?void 0:t.attr)||Ft;return{__html:(0,Bt.sanitize)(e,{ALLOWED_TAGS:o,ALLOWED_ATTR:r})}}const Ht=["a","b","em","i","strong","p","br","img","blockquote","cite","h1","h2","h3","h4","h5","h6","ul","li","ol","div"],zt=["target","href","rel","name","download","src","style","class"];function Ut(e){let{content:t}=e;const o=(0,b.useSelect)((e=>e(ct.store).getSettings()));return(0,a.createElement)("div",{className:"woocommerce-content-preview"},(0,a.createElement)(ct.__unstableIframe,{head:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ct.__unstableEditorStyles,{styles:null==o?void 0:o.styles}),(0,a.createElement)("style",null,"body {\n\t\t\t\t\t\t\t\t\toverflow: hidden;\n\t\t\t\t\t\t\t\t}")),className:"woocommerce-content-preview__iframe"},(0,a.createElement)("div",{className:"woocommerce-content-preview__content",dangerouslySetInnerHTML:Vt(t,{tags:Ht,attr:zt})})))}const $t=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"}));function jt(e){let{onClick:t}=e;return(0,a.createElement)(i.Button,{className:"woocommerce-iframe-editor__back-button",icon:$t,onClick:t},(0,w.__)("Back","woocommerce"))}function Wt(e){let{children:t,enableResizing:o,settings:r,...n}=e;const l=(0,ct.__unstableUseMouseMoveTypingReset)();return(0,a.createElement)(ct.__unstableIframe,{head:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ct.__unstableEditorStyles,{styles:null==r?void 0:r.styles}),(0,a.createElement)("style",null,".is-root-container {\n\t\t\t\t\t\t\t\tpadding: 36px;\n\t\t\t\t\t\t\t\tdisplay: flow-root;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbody { position: relative; }"),o&&(0,a.createElement)("style",null,".is-root-container { min-height: 0 !important; }")),ref:l,name:"editor-canvas",className:"edit-site-visual-editor__editor-canvas",...n},t)}const Gt=(0,a.createContext)({hasRedo:!1,hasUndo:!1,isDocumentOverviewOpened:!1,isInserterOpened:!1,isSidebarOpened:!0,redo:()=>{},setIsDocumentOverviewOpened:()=>{},setIsInserterOpened:()=>{},setIsSidebarOpened:()=>{},undo:()=>{}}),qt=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"})),Zt=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"})),Jt=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"})),Kt=(0,a.forwardRef)((function(e,t){const{hasRedo:o,redo:r}=(0,a.useContext)(Gt);return(0,a.createElement)(i.Button,{...e,ref:t,icon:(0,w.isRTL)()?Jt:Zt,label:(0,w.__)("Redo","woocommerce"),"aria-disabled":!o,onClick:o?r:void 0,className:"editor-history__redo"})})),Yt=(0,a.forwardRef)((function(e,t){const{hasUndo:o,undo:r}=(0,a.useContext)(Gt);return(0,a.createElement)(i.Button,{...e,ref:t,icon:(0,w.isRTL)()?Zt:Jt,label:(0,w.__)("Undo","woocommerce"),"aria-disabled":!o,onClick:o?r:void 0,className:"editor-history__undo"})})),Xt=(0,a.createElement)(ge.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(ge.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"})),Qt=(0,a.forwardRef)((function(e,t){const{isDocumentOverviewOpened:o,setIsDocumentOverviewOpened:r}=(0,a.useContext)(Gt);return(0,a.createElement)(i.Button,{...e,ref:t,icon:Xt,isPressed:o,label:(0,w.__)("Document overview","woocommerce"),onClick:function(){r(!o)},className:"document-overview"})})),eo=(0,a.createElement)("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"})),to=(0,a.forwardRef)((function(e,t){const{isSidebarOpened:o,setIsSidebarOpened:r}=(0,a.useContext)(Gt);return(0,a.createElement)(i.Button,{...e,ref:t,icon:eo,isPressed:o,label:(0,w.__)("Show/hide block inspector","woocommerce"),onClick:function(){r(!o)}})})),oo=()=>{const{createNotice:e}=(0,b.useDispatch)("core/notices"),{blocks:t}=(0,b.useSelect)((e=>{const{getBlocks:t}=e(ct.store);return{blocks:t()}}),[]),o=(0,Z.useCopyToClipboard)((()=>(0,oe.serialize)(t)),(()=>{e("success",(0,w.__)("All content copied.","woocommerce"))}));return(0,a.createElement)(i.MenuItem,{ref:o,role:"menuitem",onClick:()=>{(0,N.recordEvent)("product_iframe_editor_copy_all_content_menu_item_click")},disabled:!t.length},(0,w.__)("Copy all content","woocommerce"))},ro=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"})),no=()=>(0,a.createElement)(i.MenuItem,{role:"menuitem",icon:ro,href:(0,w.__)("https://wordpress.org/documentation/article/wordpress-block-editor/","woocommerce"),onClick:()=>{(0,N.recordEvent)("product_iframe_editor_help_menu_item_click")},target:"_blank",rel:"noopener noreferrer"},(0,w.__)("Help","woocommerce"),(0,a.createElement)(i.VisuallyHidden,{as:"span"},(0,w.__)("(opens in a new tab)","woocommerce"))),ao=()=>(0,a.createElement)(i.MenuGroup,{label:(0,w.__)("Tools","woocommerce")},(0,a.createElement)(oo,null),(0,a.createElement)(no,null)),lo=()=>(0,a.createElement)(we,null,(()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(ao,null))));function co(e){let{onSave:t=(()=>{}),onCancel:o=(()=>{})}=e;const{isInserterOpened:r,setIsInserterOpened:n}=(0,a.useContext)(Gt),l=(0,Z.useViewportMatch)("wide"),c=(0,Z.useViewportMatch)("medium"),s=(0,a.useRef)(null),{isInserterEnabled:m,isTextModeEnabled:u}=(0,b.useSelect)((e=>{const{hasInserterItems:t,getBlockRootClientId:o,getBlockSelectionEnd:r,__unstableGetEditorMode:n}=e(ct.store);return{isTextModeEnabled:"text"===n(),isInserterEnabled:t(o(r()))}}),[]),d=(0,w.__)("Document tools","woocommerce"),p=(0,a.useCallback)((()=>{var e;r?(null===(e=s.current)||void 0===e||e.focus(),n(!1)):n(!0)}),[r,n]);return(0,a.createElement)(ct.NavigableToolbar,{className:"woocommerce-iframe-editor__header-toolbar","aria-label":d},(0,a.createElement)("div",{className:"woocommerce-iframe-editor__header-toolbar-left"},(0,a.createElement)(i.ToolbarItem,{ref:s,as:i.Button,className:"woocommerce-iframe-editor__header-toolbar-inserter-toggle",variant:"primary",isPressed:r,onMouseDown:e=>{e.preventDefault()},onClick:p,disabled:!m,icon:qt,label:r?(0,w.__)("Close","woocommerce"):(0,w.__)("Add","woocommerce"),showTooltip:!0}),l&&(0,a.createElement)(a.Fragment,null,c&&(0,a.createElement)(i.ToolbarItem,{as:ct.ToolSelector,disabled:u}),(0,a.createElement)(i.ToolbarItem,{as:Yt}),(0,a.createElement)(i.ToolbarItem,{as:Kt}),(0,a.createElement)(i.ToolbarItem,{as:Qt}))),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__header-toolbar-right"},(0,a.createElement)(i.ToolbarItem,{as:i.Button,variant:"tertiary",className:"woocommerce-modal-actions__cancel-button",onClick:o,text:(0,w.__)("Cancel","woocommerce")}),(0,a.createElement)(i.ToolbarItem,{as:i.Button,variant:"primary",className:"woocommerce-modal-actions__done-button",onClick:t,text:(0,w.__)("Done","woocommerce")}),(0,a.createElement)(i.ToolbarItem,{as:to,className:"woocommerce-show-block-inspector-panel"}),(0,a.createElement)(i.ToolbarItem,{as:lo})))}const io=window.wp.keycodes;function so(e){let{direction:t,resizeWidthBy:o}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("button",{className:`resizable-editor__drag-handle is-${t}`,"aria-label":(0,w.__)("Drag to resize","woocommerce"),"aria-describedby":`resizable-editor__resize-help-${t}`,onKeyDown:function(e){const{keyCode:r}=e;"left"===t&&r===io.LEFT||"right"===t&&r===io.RIGHT?o(20):("left"===t&&r===io.RIGHT||"right"===t&&r===io.LEFT)&&o(-20)}}),(0,a.createElement)(i.VisuallyHidden,{id:`resizable-editor__resize-help-${t}`},(0,w.__)("Use left and right arrow keys to resize the canvas.","woocommerce")))}const mo={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};function uo(e){let{enableResizing:t,height:o,children:r}=e;const[n,l]=(0,a.useState)("100%"),c=(0,a.useRef)(),s=(0,a.useCallback)((e=>{c.current&&l(c.current.offsetWidth+e)}),[]);return(0,a.createElement)(i.ResizableBox,{ref:e=>{c.current=null==e?void 0:e.resizable},size:{width:t?n:"100%",height:t&&o?o:"100%"},onResizeStop:(e,t,o)=>{l(o.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",minHeight:o,enable:{right:t,left:t},showHandle:t,resizeRatio:2,handleComponent:{left:(0,a.createElement)(so,{direction:"left",resizeWidthBy:s}),right:(0,a.createElement)(so,{direction:"right",resizeWidthBy:s})},handleClasses:void 0,handleStyles:{left:mo,right:mo}},r)}const po=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function _o(){const{setIsInserterOpened:e}=(0,a.useContext)(Gt),t=(0,Z.useViewportMatch)("medium","<"),{rootClientId:o}=(0,b.useSelect)((e=>{const{getBlockRootClientId:t}=e(ct.store);return{rootClientId:t()}})),r=(0,a.useCallback)((()=>e(!1)),[e]),n=t?"div":i.VisuallyHidden,[l,c]=(0,Z.__experimentalUseDialog)({onClose:r,focusOnMount:!1}),s=(0,a.useRef)(null);return(0,a.useEffect)((()=>{var e;null===(e=s.current)||void 0===e||e.focusSearch()}),[]),(0,a.createElement)("div",{ref:l,...c,className:"woocommerce-iframe-editor__inserter-panel"},(0,a.createElement)(n,{className:"woocommerce-iframe-editor__inserter-panel-header"},(0,a.createElement)(i.Button,{icon:po,onClick:r,label:(0,w.__)("Close block inserter","woocommerce")})),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__inserter-panel-content"},(0,a.createElement)(ct.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:t,rootClientId:o,ref:s})))}function fo(){const{setIsDocumentOverviewOpened:e}=(0,a.useContext)(Gt),t=(0,Z.useFocusOnMount)("firstElement"),o=(0,Z.useFocusReturn)(),r=(0,Z.useFocusReturn)(),[n,l]=(0,a.useState)(null),[c,s]=(0,a.useState)("list-view"),m=(0,a.useRef)(null),u=(0,Z.useMergeRefs)([r,t,m,l]);return(0,a.createElement)("div",{className:"woocommerce-iframe-editor__document-overview-sidebar",onKeyDown:function(t){"Escape"!==t.code||t.defaultPrevented||(t.preventDefault(),e(!1))}},(0,a.createElement)(i.Button,{className:"woocommerce-iframe-editor__document-overview-sidebar-close-button",ref:o,icon:Re,label:(0,w.__)("Close","woocommerce"),onClick:()=>e(!1)}),(0,a.createElement)(i.TabPanel,{className:"woocommerce-iframe-editor__document-overview-sidebar-tab-panel",initialTabName:c,onSelect:s,tabs:[{name:"list-view",title:"List View",className:"woocommerce-iframe-editor__document-overview-sidebar-tab-item"}]},(e=>(0,a.createElement)("div",{className:"woocommerce-iframe-editor__document-overview-sidebar-tab-content",ref:u},"list-view"===e.name?(0,a.createElement)(ct.__experimentalListView,{dropZoneElement:n}):null))))}function ho(){const{isInserterOpened:e,isDocumentOverviewOpened:t}=(0,a.useContext)(Gt);return e?(0,a.createElement)(_o,null):t?(0,a.createElement)(fo,null):null}const go=50;function bo(e){let{maxHistory:t=go,setBlocks:o}=e;const[r,n]=(0,a.useState)([]),[l,c]=(0,a.useState)(0);return{appendEdit:function(e){const o=[...r.slice(0,l+1),e].slice(-1*t);n(o),c(o.length-1)},hasRedo:!!r.length&&l<r.length-1,hasUndo:!!r.length&&l>0,redo:function(){const e=Math.min(r.length-1,l+1);r[e]&&(o(r[e]),c(e))},undo:function(){const e=Math.max(0,l-1);r[e]&&(o(r[e]),c(e))}}}function wo(e){let{closeModal:t=(()=>{}),initialBlocks:o=[],onChange:r=(()=>{}),onClose:n,onInput:l=(()=>{}),settings:c}=e;const[s]=(0,Z.useResizeObserver)(),[m,u]=(0,a.useState)(o),[d,p]=(0,a.useState)(o),{appendEdit:_}=bo({setBlocks:u}),{appendEdit:f,hasRedo:h,hasUndo:g,redo:w,undo:E}=bo({setBlocks:p}),[v,y]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(!0),{clearSelectedBlock:x,updateSettings:N}=(0,b.useDispatch)(ct.store),P=(0,b.useSelect)((e=>e(ct.store).getSettings()),[]);(0,a.useEffect)((()=>{N(productBlockEditorSettings)}),[]);const I=c||P;return(0,a.createElement)("div",{className:"woocommerce-iframe-editor"},(0,a.createElement)(Gt.Provider,{value:{hasRedo:h,hasUndo:g,isInserterOpened:v,isDocumentOverviewOpened:k,redo:w,setIsInserterOpened:y,setIsDocumentOverviewOpened:C,undo:E,isSidebarOpened:S,setIsSidebarOpened:T}},(0,a.createElement)(ct.BlockEditorProvider,{settings:{...I,hasFixedToolbar:!0,templateLock:!1},value:m,onChange:e=>{f(e),p(e),r(e)},onInput:e=>{f(e),p(e),l(e)},useSubRegistry:!0},(0,a.createElement)(co,{onSave:()=>{_(d),u(d),r(d),t()},onCancel:()=>{_(m),u(m),r(m),p(m),t()}}),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__main"},(0,a.createElement)(ho,null),(0,a.createElement)(ct.BlockTools,{className:"woocommerce-iframe-editor__content",onClick:e=>{e.target===e.currentTarget&&x()}},(0,a.createElement)(ct.BlockEditorKeyboardShortcuts.Register,null),n&&(0,a.createElement)(jt,{onClick:()=>{setTimeout(n,550)}}),(0,a.createElement)(uo,{enableResizing:!0,height:"100%"},(0,a.createElement)(Wt,{enableResizing:!0,settings:I},s,(0,a.createElement)(ct.BlockList,{className:"edit-site-block-editor__block-list wp-site-blocks"})),(0,a.createElement)(i.Popover.Slot,null)),(0,a.createElement)("div",{className:"woocommerce-iframe-editor__content-inserter-clipper"})),S&&(0,a.createElement)("div",{className:"woocommerce-iframe-editor__sidebar"},(0,a.createElement)(ct.BlockInspector,null))))))}function Eo(e){let{initialBlocks:t,onChange:o,onClose:r,title:n}=e;const l=(0,Z.useDebounce)((e=>{o(e)}),250);function c(){const e=l.flush();e&&o(e),r()}return(0,a.createElement)(i.Modal,{className:"woocommerce-modal-editor",title:n,onRequestClose:c,shouldCloseOnClickOutside:!1},(0,a.createElement)(wo,{initialBlocks:t,onInput:l,onChange:l,closeModal:c}))}const{name:vo}=Lt,yo={example:{},edit:function(){const e=(0,ct.useBlockProps)(),[t,o]=(0,a.useState)(!1),[r,n]=(0,me.useEntityProp)("postType","product","description");return(0,a.createElement)("div",{...e},(0,a.createElement)(i.Button,{variant:"secondary",onClick:()=>{o(!0),(0,N.recordEvent)("product_add_description_click")}},r.length?(0,w.__)("Edit description","woocommerce"):(0,w.__)("Add description","woocommerce")),t&&(0,a.createElement)(Eo,{initialBlocks:(0,oe.parse)(r),onChange:e=>{const t=(0,oe.serialize)(function(e){if(1===e.length){const{content:t}=e[0].attributes;if(!t||!t.trim())return[]}return e}(e));n(t)},onClose:()=>o(!1),title:(0,w.__)("Edit description","woocommerce")}),!!r.length&&(0,a.createElement)(Ut,{content:r}))}},ko=()=>Et({name:vo,metadata:Lt,settings:yo}),Co=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-images-field","title":"Product images","category":"widgets","description":"The product images.","keywords":["products","image","images","gallery"],"textdomain":"default","attributes":{"mediaId":{"type":"number","__experimentalRole":"content"},"images":{"__experimentalRole":"content","type":"array","items":{"type":"number"},"default":[]}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),So=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z"})),{name:To}=Co,xo={example:{},edit:function(){const[e,t]=(0,me.useEntityProp)("postType","product","images"),[o,r]=(0,a.useState)(!1),[n,c]=(0,a.useState)(!1),[s,m]=(0,a.useState)(null),u=(0,ct.useBlockProps)({className:fe()({"has-images":e.length>0})}),d=()=>{r(!o)};return(0,a.createElement)("div",{...u},(0,a.createElement)("div",{className:"woocommerce-product-form__image-drop-zone"},o?(0,a.createElement)("div",{className:"woocommerce-product-form__remove-image-drop-zone"},(0,a.createElement)("span",null,(0,a.createElement)(yt,{icon:So,size:20,className:"icon-control"}),(0,w.__)("Drop here to remove","woocommerce")),(0,a.createElement)(i.DropZone,{onHTMLDrop:()=>c(!0),onDrop:()=>c(!0),label:(0,w.__)("Drop here to remove","woocommerce")})):(0,a.createElement)(l.MediaUploader,{multipleSelect:!0,onError:()=>null,onFileUploadChange:o=>{o[0].id&&((0,N.recordEvent)("product_images_add_via_file_upload_area"),t([...e,...o]))},onMediaGalleryOpen:()=>{(0,N.recordEvent)("product_images_media_gallery_open")},onSelect:o=>{const r=o.filter((t=>!e.find((e=>e.id===t.id))));r.length>0&&((0,N.recordEvent)("product_images_add_via_media_library"),t([...e,...r]))},onUpload:o=>{o[0].id&&((0,N.recordEvent)("product_images_add_via_drag_and_drop_upload"),t([...e,...o]))},label:""})),(0,a.createElement)(l.ImageGallery,{allowDragging:!1,onDragStart:t=>{var o;const{id:r,dataset:n}=t.target;if(r)m(parseInt(r,10));else{const t=null==n?void 0:n.index;t&&m(null===(o=e[parseInt(t,10)])||void 0===o?void 0:o.id)}d()},onDragEnd:()=>{n&&s&&((0,N.recordEvent)("product_images_remove_image_button_click"),t(e.filter((e=>e.id!==s))),c(!1),m(null)),d()},onOrderChange:o=>{const r=o.map((t=>e.find((e=>{var o;return e.id===parseInt(null===(o=null==t?void 0:t.props)||void 0===o?void 0:o.id,10)}))));(0,N.recordEvent)("product_images_change_image_order_via_image_gallery"),t(r)},onReplace:o=>{let{replaceIndex:r,media:n}=o;if(void 0===e.find((e=>n.id===e.id))){const o=[...e];o[r]=n,(0,N.recordEvent)("product_images_replace_image_button_click"),t(o)}},onSelectAsCover:()=>(0,N.recordEvent)("product_images_select_image_as_cover_button_click")},e.map((e=>(0,a.createElement)(l.ImageGalleryItem,{key:e.id||e.url,alt:e.alt,src:e.url||e.src,id:`${e.id}`})))))}},No=()=>ft({name:To,metadata:Co,settings:xo}),Po=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-inventory-email-field","title":"Stock level threshold","category":"widgets","description":"Stock management minimum quantity.","keywords":["products","inventory","email","minimum"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}');function Io(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=(0,a.useContext)(Ke),[n,l]=(0,a.useState)(!1),c=(0,a.useMemo)((()=>r.registerValidator(e,t)),[e,...o]);return{ref:c,error:r.errors[e],isValidating:n,validate:async()=>(l(!0),r.validateField(e).finally((()=>{l(!1)})))}}const{name:Ao,...Mo}=Po,Oo={example:{},edit:function(e){let{clientId:t}=e;const o=(0,ct.useBlockProps)(),r=(0,Ve.getSetting)("notifyLowStockAmount",2),[n,c]=(0,me.useEntityProp)("postType","product","low_stock_amount"),s=(0,Z.useInstanceId)(i.BaseControl,"low_stock_amount"),{ref:m,error:u,validate:d}=Io(`low_stock_amount-${t}`,(async function(){if(n&&n<0)return(0,w.__)("This field must be a positive number.","woocommerce")}),[n]);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{...o},(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(i.BaseControl,{id:s,label:(0,w.__)("Email me when stock reaches","woocommerce"),help:u||(0,a.createInterpolateElement)((0,w.__)("Make sure to enable notifications in <link>store settings.</link>","woocommerce"),{link:(0,a.createElement)(l.Link,{href:`${(0,Ve.getSetting)("adminUrl")}admin.php?page=wc-settings&tab=products§ion=inventory`,target:"_blank",type:"external"})}),className:u&&"has-error"},(0,a.createElement)(i.__experimentalInputControl,{id:s,ref:m,name:"low_stock_amount",placeholder:(0,w.sprintf)((0,w.__)("%d (store default)","woocommerce"),r),onChange:c,onBlur:d,value:n,type:"number",min:0}))),(0,a.createElement)("div",{className:"wp-block-column"}))))}};function Ro(){return ft({name:Ao,metadata:Mo,settings:Oo})}const Lo=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-sku-field","title":"Product text control","category":"woocommerce","description":"The product sku.","keywords":["products","sku"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:Bo}=Lo,Do={example:{},edit:function(){const e=(0,ct.useBlockProps)(),[t,o]=(0,me.useEntityProp)("postType","product","sku");return(0,a.createElement)("div",{...e},(0,a.createElement)(i.BaseControl,{id:"product_sku",className:"woocommerce-product-form_inventory-sku",label:(0,a.createInterpolateElement)((0,w.__)("Sku <description />","woocommerce"),{description:(0,a.createElement)("span",{className:"woocommerce-product-form__optional-input"},(0,w.__)("(STOCK KEEPING UNIT)","woocommerce"))})},(0,a.createElement)(i.__experimentalInputControl,{name:"woocommerce-product-sku",onChange:o,value:t||""})))}},Fo=()=>Et({name:Bo,metadata:Lo,settings:Do}),Vo=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-name-field","title":"Product name","category":"widgets","description":"The product name.","keywords":["products","name","title"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"},"autoFocus":{"type":"boolean","default":false}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:Ho}=Vo,zo={example:{},edit:function(e){let{attributes:t}=e;const o=(0,ct.useBlockProps)(),{editEntityRecord:r,saveEntityRecord:n}=(0,b.useDispatch)("core"),[l,c]=(0,a.useState)(!1),s=(0,me.useEntityId)("postType","product"),m=(0,b.useSelect)((e=>e("core").getEditedEntityRecord("postType","product",s))),[u,d]=(0,me.useEntityProp)("postType","product","sku"),[p,_]=(0,me.useEntityProp)("postType","product","name"),{permalinkPrefix:f,permalinkSuffix:h}=(0,b.useSelect)((e=>{const{getPermalinkParts:t}=e(v.PRODUCTS_STORE_NAME);if(s){const e=t(s);return{permalinkPrefix:null==e?void 0:e.prefix,permalinkSuffix:null==e?void 0:e.suffix}}return{}})),{ref:g,error:y,validate:k}=Io("name",(async function(){return p&&p!==O?p.length>120?(0,w.__)("Please enter a product name shorter than 120 characters.","woocommerce"):void 0:(0,w.__)("This field is required.","woocommerce")}),[p]),C=null!=y?y:s&&["publish","draft"].includes(m.status)&&f&&(0,a.createElement)("span",{className:"woocommerce-product-form__secondary-text product-details-section__product-link"},(0,w.__)("Product link","woocommerce"),": ",(0,a.createElement)("a",{href:m.permalink,target:"_blank",rel:"noreferrer"},f,m.slug||(0,E.cleanForSlug)(p),h),(0,a.createElement)(i.Button,{variant:"link",onClick:()=>c(!0)},(0,w.__)("Edit","woocommerce"))),S=(0,Z.useInstanceId)(i.BaseControl,"product_name");return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{...o},(0,a.createElement)(i.BaseControl,{id:S,label:(0,a.createInterpolateElement)((0,w.__)("Name <required />","woocommerce"),{required:(0,a.createElement)("span",{className:"woocommerce-product-form__required-input"},(0,w.__)("*","woocommerce"))}),className:fe()({"has-error":y}),help:C},(0,a.createElement)(i.__experimentalInputControl,{id:S,ref:g,name:"name",autoFocus:t.autoFocus,placeholder:(0,w.__)("e.g. 12 oz Coffee Mug","woocommerce"),onChange:_,value:p&&p!==O?p:"",autoComplete:"off","data-1p-ignore":!0,onBlur:()=>{u||y||d((0,E.cleanForSlug)(p)),k()}})),l&&(0,a.createElement)(P,{permalinkPrefix:f||"",permalinkSuffix:h||"",product:m,onCancel:()=>c(!1),onSaved:()=>c(!1),saveHandler:async e=>{const{slug:t,permalink:o}=await n("postType","product",{id:m.id,slug:e});if(t&&o)return r("postType","product",m.id,{slug:t,permalink:o}),{slug:t,permalink:o}}})))}},Uo=()=>ft({name:Ho,metadata:Vo,settings:zo}),$o=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-pricing-field","description":"A product price block with currency display.","title":"Product pricing","category":"widgets","keywords":["products","price"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"},"label":{"type":"string"},"help":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),jo=(e,t,o)=>{const{decimalSeparator:r,thousandSeparator:n}=t,a=new RegExp("[^-0-9%s1%s2]".replace("%s1",r).replace("%s2",n),"g");return void 0===e?e:o(e).replace(a,"")},Wo=e=>{let{value:t,onChange:o,onFocus:r,onKeyUp:n}=e;const{sanitizePrice:l}=B(),c=(0,a.useContext)(A.CurrencyContext),{getCurrencyConfig:i,formatAmount:s}=c,m=i();return{prefix:m.symbol,className:"components-currency-control",value:jo(String(t),m,s),sanitize:e=>l(String(e)),onFocus(e){setTimeout((function(e){e.select()}),0,e.currentTarget),r&&r(e)},onKeyUp(e){const r=Number.parseFloat(l(t||"0")),a=Number(e.currentTarget.step||"1");"ArrowUp"===e.code&&o(String(r+a)),"ArrowDown"===e.code&&o(String(r-a)),n&&n(e)},onChange(e){const t=l(e);o&&o(t)}}},{name:Go,...qo}=$o,Zo={example:{},edit:function(e){let{attributes:t}=e;const o=(0,ct.useBlockProps)(),{name:r,label:n,help:c}=t,[s,m]=(0,me.useEntityProp)("postType","product",r),u=Wo({value:s,onChange:m}),d=c?(0,a.createInterpolateElement)(c,{PricingTab:(0,a.createElement)(l.Link,{href:(0,Ze.getNewPath)({tab:"pricing"}),onClick:()=>{(0,N.recordEvent)("product_pricing_help_click")}})}):null,p=(0,Z.useInstanceId)(i.BaseControl,"wp-block-woocommerce-product-pricing-field");return(0,a.createElement)("div",{...o},(0,a.createElement)(i.BaseControl,{id:p,help:d},(0,a.createElement)(i.__experimentalInputControl,{...u,id:p,name:r,label:n||(0,w.__)("Price","woocommerce")})))}};function Jo(){return ft({name:Go,metadata:qo,settings:Zo})}const Ko=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-radio-field","title":"Product radio control","category":"woocommerce","description":"The product radio.","keywords":["products","radio","input"],"textdomain":"default","attributes":{"title":{"type":"string"},"description":{"type":"string"},"property":{"type":"string"},"options":{"type":"array","items":{"type":"object"},"default":[],"__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false}}');function Yo(e){let{title:t,description:o,className:r,...n}=e;return(0,a.createElement)(i.RadioControl,{...n,className:fe()(r,"woocommerce-radio-field"),label:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:"woocommerce-radio-field__title"},t),o&&(0,a.createElement)("span",{className:"woocommerce-radio-field__description",dangerouslySetInnerHTML:Vt(o)}))})}const{name:Xo,...Qo}=Ko,er={example:{},edit:function(e){let{attributes:t}=e;const o=(0,ct.useBlockProps)(),{description:r,options:n,property:l,title:c}=t,[i,s]=(0,me.useEntityProp)("postType","product",l);return(0,a.createElement)("div",{...o},(0,a.createElement)(Yo,{title:c,description:r,selected:i,options:n,onChange:e=>s(e||"")}))}};function tr(){return ft({name:Xo,metadata:Qo,settings:er})}const or=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-regular-price-field","description":"A product price block with currency display.","title":"Product regular price","category":"widgets","keywords":["products","price"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"help":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:rr,...nr}=or,ar={example:{},edit:function(e){let{attributes:t,clientId:o}=e;const r=(0,ct.useBlockProps)(),{label:n,help:c}=t,[s,m]=(0,me.useEntityProp)("postType","product","regular_price"),[u]=(0,me.useEntityProp)("postType","product","sale_price"),d=Wo({value:s,onChange:m}),p=c?(0,a.createInterpolateElement)(c,{PricingTab:(0,a.createElement)(l.Link,{href:(0,Ze.getNewPath)({tab:"pricing"}),onClick:()=>{(0,N.recordEvent)("product_pricing_help_click")}})}):null,_=(0,Z.useInstanceId)(i.BaseControl,"wp-block-woocommerce-product-regular-price-field"),{ref:f,error:h,validate:g}=Io(`regular_price-${o}`,(async function(){const e=Number.parseFloat(s);if(e){if(e<0)return(0,w.__)("List price must be greater than or equals to zero.","woocommerce");if(u&&e<=Number.parseFloat(u))return(0,w.__)("List price must be greater than the sale price.","woocommerce")}}),[s,u]);return(0,a.createElement)("div",{...r},(0,a.createElement)(i.BaseControl,{id:_,help:h||p,className:fe()({"has-error":h})},(0,a.createElement)(i.__experimentalInputControl,{...d,id:_,name:"regular_price",ref:f,label:n,onBlur:g})))}};function lr(){return ft({name:rr,metadata:nr,settings:ar})}const cr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-sale-price-field","description":"A product price block with currency display.","title":"Product sale price","category":"widgets","keywords":["products","price"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"help":{"type":"string"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:ir,...sr}=cr,mr={example:{},edit:function(e){let{attributes:t,clientId:o}=e;const r=(0,ct.useBlockProps)(),{label:n,help:l}=t,[c]=(0,me.useEntityProp)("postType","product","regular_price"),[s,m]=(0,me.useEntityProp)("postType","product","sale_price"),u=Wo({value:s,onChange:m}),d=(0,Z.useInstanceId)(i.BaseControl,"wp-block-woocommerce-product-sale-price-field"),{ref:p,error:_,validate:f}=Io(`sale-price-${o}`,(async function(){if(s){if(Number.parseFloat(s)<0)return(0,w.__)("Sale price must be greater than or equals to zero.","woocommerce");const e=Number.parseFloat(c);if(!e||e<=Number.parseFloat(s))return(0,w.__)("Sale price must be lower than the list price.","woocommerce")}}),[c,s]);return(0,a.createElement)("div",{...r},(0,a.createElement)(i.BaseControl,{id:d,help:_||l,className:fe()({"has-error":_})},(0,a.createElement)(i.__experimentalInputControl,{...u,id:d,name:"sale_price",ref:p,label:n,onBlur:f})))}};function ur(){return ft({name:ir,metadata:sr,settings:mr})}const dr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-schedule-sale-fields","title":"Product schedule sale fields","category":"woocommerce","description":"The product schedule sale fields.","keywords":["products","schedule","sale"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),pr=window.moment;var _r=o.n(pr);const fr=window.wp.date,{name:hr,...gr}=dr,br={example:{},edit:function(e){let{clientId:t}=e;const o=(0,ct.useBlockProps)(),{hasEdit:r}=mt(),n=(0,fr.getSettings)().formats.datetime,[c,s]=(0,a.useState)(!1),[m]=(0,me.useEntityProp)("postType","product","sale_price"),u=Number.parseFloat(m||"0")>0,[d,p]=(0,me.useEntityProp)("postType","product","date_on_sale_from_gmt"),[_,f]=(0,me.useEntityProp)("postType","product","date_on_sale_to_gmt"),h=_r()().startOf("minute").toISOString();(0,a.useEffect)((()=>{r("sale_price")&&!u&&(s(!1),p(""),f(""))}),[u]),(0,a.useEffect)((()=>{(d||_)&&s(!0)}),[d,_]);const g=_r()(d,_r().ISO_8601,!0),b=_r()(_,_r().ISO_8601,!0),{ref:E,error:v,validate:y}=Io(`date_on_sale_from_gmt-${t}`,(async function(){if(c&&d){if(!g.isValid())return(0,w.__)("Please enter a valid date.","woocommerce");if(g.isAfter(b))return(0,w.__)("The start date of the sale must be before the end date.","woocommerce")}}),[c,d,g,b]),{ref:k,error:C,validate:S}=Io(`date_on_sale_to_gmt-${t}`,(async function(){if(c&&_){if(!b.isValid())return(0,w.__)("Please enter a valid date.","woocommerce");if(b.isBefore(g))return(0,w.__)("The end date of the sale must be after the start date.","woocommerce")}}),[c,d,g,b]);return(0,a.createElement)("div",{...o},(0,a.createElement)(i.ToggleControl,{label:(0,w.__)("Schedule sale","woocommerce"),checked:c,onChange:function(e){(0,N.recordEvent)("product_pricing_schedule_sale_toggle_click",{enabled:e}),s(e),e?(p(h),f("")):(p(""),f(""))},disabled:!u}),c&&(0,a.createElement)("div",{className:"wp-block-columns wp-block-woocommerce-product-schedule-sale-fields__content"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(l.DateTimePickerControl,{ref:E,label:(0,w.__)("From","woocommerce"),placeholder:(0,w.__)("Sale start date and time (optional)","woocommerce"),dateTimeFormat:n,currentDate:d,onChange:p,className:v&&"has-error",help:v,onBlur:y})),(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(l.DateTimePickerControl,{ref:k,label:(0,w.__)("To","woocommerce"),placeholder:(0,w.__)("Sale end date and time (optional)","woocommerce"),dateTimeFormat:n,currentDate:_,onChange:e=>f(_r()(e).startOf("minute").toISOString()),onBlur:S,className:C&&"has-error",help:C}))))}};function wr(){return ft({name:hr,metadata:gr,settings:br})}const Er=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-section","title":"Product section","category":"woocommerce","description":"The product section.","keywords":["products","section","group"],"textdomain":"default","attributes":{"title":{"type":"string"},"description":{"type":"string","__experimentalRole":"content"},"blockGap":{"type":"string","enum":["unit-30","unit-40"],"default":"unit-30"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:vr,...yr}=Er,kr={example:{},edit:function(e){let{attributes:t}=e;const{description:o,title:r,blockGap:n}=t,l=(0,ct.useBlockProps)(),c=(0,ct.useInnerBlocksProps)({className:fe()("wp-block-woocommerce-product-section__content",`wp-block-woocommerce-product-section__content--block-gap-${n}`)},{templateLock:"all"}),i=r?"fieldset":"div",s="fieldset"===i?"legend":"div";return(0,a.createElement)(i,{...l},r&&(0,a.createElement)(s,{className:"wp-block-woocommerce-product-section__heading"},(0,a.createElement)("h2",{className:"wp-block-woocommerce-product-section__heading-title"},r),o&&(0,a.createElement)("p",{className:"wp-block-woocommerce-product-section__heading-description",dangerouslySetInnerHTML:Vt(o)})),(0,a.createElement)("div",{...c}))}};function Cr(){return ft({name:vr,metadata:yr,settings:kr})}const Sr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-shipping-class-field","title":"Product shipping class field","category":"woocommerce","description":"The product shipping class field.","keywords":["products","shipping","class"],"textdomain":"default","attributes":{"title":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}');function Tr(e){let{onAdd:t,onCancel:o}=e;var r;const{errors:n,getInputProps:c,isValidForm:s}=(0,l.useFormContext)(),[m,u]=(0,a.useState)(!1);return(0,a.createElement)("div",{className:"woocommerce-add-new-shipping-class-modal__wrapper"},(0,a.createElement)(i.TextControl,{...c("name"),placeholder:(0,w.__)("e.g. Fragile products","woocommerce"),label:(0,a.createInterpolateElement)((0,w.__)("Name <required />","woocommerce"),{required:(0,a.createElement)("span",{className:"woocommerce-add-new-shipping-class-modal__optional-input"},(0,w.__)("(required)","woocommerce"))})}),(0,a.createElement)(i.TextControl,{...c("slug"),label:(0,w.__)("Slug","woocommerce")}),(0,a.createElement)(i.TextControl,{...c("description"),label:(0,w.__)("Description","woocommerce"),help:null!==(r=null==n?void 0:n.description)&&void 0!==r?r:(0,w.__)("Describe how you and other store administrators can use this shipping class.","woocommerce")}),(0,a.createElement)("div",{className:"woocommerce-add-new-shipping-class-modal__buttons"},(0,a.createElement)(i.Button,{isSecondary:!0,onClick:o},(0,w.__)("Cancel","woocommerce")),(0,a.createElement)(i.Button,{isPrimary:!0,isBusy:m,disabled:!s||m,onClick:function(){u(!0),t().then((()=>{u(!1),o()})).catch((()=>{u(!1)}))}},(0,w.__)("Add","woocommerce"))))}function xr(e){var t;const o={};return(null===(t=e.name)||void 0===t?void 0:t.length)||(o.name=(0,w.__)("The shipping class name is required.","woocommerce")),o}const Nr={name:"",slug:"",description:""};function Pr(e){let{shippingClass:t,onAdd:o,onCancel:r}=e;return(0,a.createElement)(i.Modal,{title:(0,w.__)("New shipping class","woocommerce"),className:"woocommerce-add-new-shipping-class-modal",onRequestClose:r},(0,a.createElement)(l.Form,{initialValues:null!=t?t:Nr,validate:xr,errors:{},onSubmit:o},(e=>(0,a.createElement)(Tr,{onAdd:e.handleSubmit,onCancel:r}))))}const Ir=[{value:"",label:(0,w.__)("No shipping class","woocommerce")},{value:C,label:(0,w.__)("Add new shipping class","woocommerce")}];function Ar(e){return e.map((e=>{let{slug:t,name:o}=e;return{value:t,label:o}}))}function Mr(e,t){const o=null==e?void 0:e.find((e=>{let{slug:t}=e;return"uncategorized"!==t}));if(o&&!(null==t?void 0:t.some((e=>{let{slug:t}=e;return t===o.slug}))))return{name:o.name,slug:o.slug}}const{name:Or,...Rr}=Sr,Lr={example:{},edit:function(e){let{}=e;const[t,o]=(0,a.useState)(!1),r=(0,ct.useBlockProps)(),{createProductShippingClass:n,invalidateResolution:c}=(0,b.useDispatch)(v.EXPERIMENTAL_PRODUCT_SHIPPING_CLASSES_STORE_NAME),{createErrorNotice:s}=(0,b.useDispatch)("core/notices"),[m]=(0,me.useEntityProp)("postType","product","categories"),[u,d]=(0,me.useEntityProp)("postType","product","shipping_class");function p(e){let t=(0,w.__)("We couldn’t add this shipping class. Try again in a few seconds.","woocommerce");throw"term_exists"===e.code&&(t=(0,w.__)("A shipping class with that slug already exists.","woocommerce")),s(t,{explicitDismiss:!0}),e}const{shippingClasses:_}=(0,b.useSelect)((e=>{var t;const{getProductShippingClasses:o}=e(v.EXPERIMENTAL_PRODUCT_SHIPPING_CLASSES_STORE_NAME);return{shippingClasses:null!==(t=o())&&void 0!==t?t:[]}}),[]),f=(0,Z.useInstanceId)(i.BaseControl,"wp-block-woocommerce-product-shipping-class-field");return(0,a.createElement)("div",{...r},(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(i.SelectControl,{id:f,name:"shipping_class",value:u,onChange:e=>{e!==C?d(e):o(!0)},label:(0,w.__)("Shipping class","woocommerce"),options:[...Ir,...Ar(null!=_?_:[])],help:(0,a.createInterpolateElement)((0,w.__)("Manage shipping classes and rates in <Link>global settings</Link>.","woocommerce"),{Link:(0,a.createElement)(l.Link,{href:(0,Ze.getNewPath)({tab:"shipping",section:"classes"},"",{},"wc-settings"),target:"_blank",type:"external",onClick:()=>{(0,N.recordEvent)("product_shipping_global_settings_link_click")}},(0,a.createElement)(a.Fragment,null))})})),(0,a.createElement)("div",{className:"wp-block-column"})),t&&(0,a.createElement)(Pr,{shippingClass:Mr(m,_),onAdd:e=>n(e).then((e=>((0,N.recordEvent)("product_new_shipping_class_modal_add_button_click"),c("getProductShippingClasses"),d(e.slug),e))).catch(p),onCancel:()=>o(!1)}))}};function Br(){return ft({name:Or,metadata:Rr,settings:Lr})}const Dr=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-shipping-dimensions-fields","title":"Product shipping dimensions fields","category":"woocommerce","description":"The product shipping dimensions fields.","keywords":["products","shipping","dimensions"],"textdomain":"default","attributes":{"__contentEditable":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}');function Fr(e){let{highlight:t,labels:o={},...r}=e;return(0,a.createElement)("svg",{width:"295",height:"195",viewBox:"0 0 295 195",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},(0,a.createElement)("path",{d:"M11.5664 134.604V35.3599C11.5664 33.9482 12.9862 32.9782 14.3014 33.4915L99.6373 66.7959C100.4 67.0935 100.905 67.8243 100.914 68.6426L102.037 171.578C102.052 173.027 100.574 174.014 99.2419 173.444L12.7831 136.448C12.0451 136.132 11.5664 135.407 11.5664 134.604Z",fill:"A"===t?"#F0F6FC":"#FFFFFF"}),(0,a.createElement)("path",{d:"M11.5664 134.603V35.3599C11.5664 33.9482 12.9862 32.9782 14.3014 33.4915L99.624 66.7908C100.393 67.0909 100.9 67.8314 100.901 68.6569L101.024 174.131L12.7844 136.447C12.0457 136.132 11.5664 135.406 11.5664 134.603Z",stroke:"#E0E0E0",strokeWidth:"2.00574"}),(0,a.createElement)("path",{d:"M1.25977 150.388L86.0112 188.183",stroke:"A"===t?"#006FAD":"#CCCCCC",strokeWidth:"1.50431",strokeMiterlimit:"16"}),(0,a.createElement)("path",{d:"M250.775 32.9793L100.9 66.9577V172.981C100.9 174.297 102.146 175.257 103.418 174.921L251.73 135.764C252.611 135.531 253.224 134.735 253.224 133.824V34.9354C253.224 33.6488 252.03 32.6948 250.775 32.9793Z",fill:"B"===t?"#F0F6FC":"#FFFFFF",stroke:"#E0E0E0",strokeWidth:"2.00574"}),(0,a.createElement)("path",{d:"M270.402 28.9875V132.064",stroke:"C"===t?"#006FAD":"#CCCCCC",strokeWidth:"1.50431",strokeMiterlimit:"16"}),(0,a.createElement)("path",{d:"M257.804 152.679L107.771 192.765",stroke:"B"===t?"#006FAD":"#CCCCCC",strokeWidth:"1.50431",strokeMiterlimit:"16"}),(0,a.createElement)("path",{d:"M13.1406 33.41L161.446 1.61817C161.808 1.54066 162.184 1.56462 162.533 1.68742L251.16 32.8868",stroke:"#E0E0E0",strokeWidth:"2.00574"}),o.C?(0,a.createElement)("text",{x:"280",y:"85",fontSize:11,fill:"C"===t?"#007CBA":"#949494"},o.C):(0,a.createElement)("path",{d:"M282.123 80.7892C282.123 79.5323 282.435 78.5405 283.058 77.8136C283.685 77.0867 284.537 76.7233 285.615 76.7233C286.467 76.7233 287.192 76.9739 287.79 77.4752C288.391 77.9729 288.741 78.6175 288.837 79.4088H287.639C287.525 78.9326 287.285 78.553 286.92 78.2701C286.558 77.9873 286.123 77.8458 285.615 77.8458C284.92 77.8458 284.368 78.1108 283.96 78.6407C283.556 79.1671 283.353 79.8833 283.353 80.7892C283.353 81.6915 283.556 82.4077 283.96 82.9376C284.368 83.464 284.922 83.7272 285.62 83.7272C286.132 83.7272 286.569 83.5983 286.93 83.3405C287.296 83.0826 287.532 82.7353 287.639 82.2985H288.837C288.73 83.0647 288.382 83.6824 287.795 84.1515C287.208 84.617 286.483 84.8497 285.62 84.8497C284.542 84.8497 283.69 84.4863 283.063 83.7594C282.437 83.0325 282.123 82.0424 282.123 80.7892Z",fill:"C"===t?"#007CBA":"#949494"}),o.B?(0,a.createElement)("text",{x:"188",y:"190",fontSize:11,fill:"B"===t?"#007CBA":"#949494"},o.B):(0,a.createElement)("path",{d:"M192.281 189.611V181.861H195.396C196.123 181.861 196.692 182.034 197.104 182.382C197.519 182.725 197.727 183.196 197.727 183.794C197.727 184.199 197.596 184.562 197.335 184.885C197.073 185.203 196.751 185.395 196.368 185.459V185.551C196.891 185.604 197.312 185.803 197.63 186.147C197.953 186.487 198.114 186.91 198.114 187.414C198.114 188.098 197.879 188.635 197.41 189.026C196.941 189.416 196.293 189.611 195.466 189.611H192.281ZM193.484 188.591H195.224C195.765 188.591 196.177 188.483 196.459 188.268C196.742 188.054 196.884 187.74 196.884 187.328C196.884 186.924 196.737 186.618 196.443 186.41C196.15 186.199 195.72 186.093 195.154 186.093H193.484V188.591ZM193.484 185.142H194.913C195.442 185.142 195.844 185.048 196.116 184.858C196.391 184.664 196.529 184.383 196.529 184.015C196.529 183.656 196.404 183.379 196.153 183.182C195.906 182.981 195.561 182.881 195.117 182.881H193.484V185.142Z",fill:"B"===t?"#007CBA":"#949494"}),o.A?(0,a.createElement)("text",{x:"18",y:"185",fontSize:11,fill:"A"===t?"#007CBA":"#949494"},o.A):(0,a.createElement)("path",{d:"M22.7694 185.149L25.5678 177.399H26.8622L29.6605 185.149H28.3822L27.6732 183.092H24.7191L24.0048 185.149H22.7694ZM25.0253 182.082H27.3671L26.2445 178.806H26.1532L25.0253 182.082Z",fill:"A"===t?"#007CBA":"#949494"}))}const{name:Vr,...Hr}=Dr,zr={example:{},edit:function(e){let{clientId:t}=e;var o,r,n;const l=(0,ct.useBlockProps)(),[c,s]=(0,me.useEntityProp)("postType","product","dimensions"),[m,u]=(0,me.useEntityProp)("postType","product","weight"),[d,p]=(0,a.useState)(),{formatNumber:_,parseNumber:f}=B(),{dimensionUnit:h,weightUnit:g}=(0,b.useSelect)((e=>{const{getOption:t}=e(v.OPTIONS_STORE_NAME);return{dimensionUnit:t("woocommerce_dimension_unit"),weightUnit:t("woocommerce_weight_unit")}}),[]);function E(e,t){return{name:`dimensions.${e}`,value:c?_(String(c[e])):void 0,onChange:t=>s({...null!=c?c:{},[e]:f(t)}),onFocus:()=>p(t),onBlur:()=>p(void 0),suffix:h}}const{ref:y,error:k,validate:C}=Io(`dimensions_width-${t}`,(async function(){if((null==c?void 0:c.width)&&+c.width<=0)return(0,w.__)("Width must be greater than zero.","woocommerce")}),[null==c?void 0:c.width]),{ref:S,error:T,validate:x}=Io(`dimensions_length-${t}`,(async function(){if((null==c?void 0:c.length)&&+c.length<=0)return(0,w.__)("Length must be greater than zero.","woocommerce")}),[null==c?void 0:c.length]),{ref:N,error:P,validate:I}=Io(`dimensions_height-${t}`,(async function(){if((null==c?void 0:c.height)&&+c.height<=0)return(0,w.__)("Height must be greater than zero.","woocommerce")}),[null==c?void 0:c.height]),{ref:A,error:M,validate:O}=Io(`weight-${t}`,(async function(){if(m&&+m<=0)return(0,w.__)("Weight must be greater than zero.","woocommerce")}),[m]),R={...E("width","A"),id:(0,Z.useInstanceId)(i.BaseControl,"product_shipping_dimensions_width"),ref:y,onBlur:C},L={...E("length","B"),id:(0,Z.useInstanceId)(i.BaseControl,"product_shipping_dimensions_length"),ref:S,onBlur:x},D={...E("height","C"),id:(0,Z.useInstanceId)(i.BaseControl,"product_shipping_dimensions_height"),ref:N,onBlur:I},F={id:(0,Z.useInstanceId)(i.BaseControl,"product_shipping_weight"),name:"weight",value:_(String(m)),onChange:e=>u(f(e)),suffix:g,ref:A,onBlur:O};return(0,a.createElement)("div",{...l},(0,a.createElement)("h4",null,(0,w.__)("Dimensions","woocommerce")),(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(i.BaseControl,{id:R.id,label:(0,a.createInterpolateElement)((0,w.__)("Width <Side />","woocommerce"),{Side:(0,a.createElement)("span",null,"A")}),className:fe()({"has-error":k}),help:k},(0,a.createElement)(i.__experimentalInputControl,{...R})),(0,a.createElement)(i.BaseControl,{id:L.id,label:(0,a.createInterpolateElement)((0,w.__)("Length <Side />","woocommerce"),{Side:(0,a.createElement)("span",null,"B")}),className:fe()({"has-error":T}),help:T},(0,a.createElement)(i.__experimentalInputControl,{...L})),(0,a.createElement)(i.BaseControl,{id:D.id,label:(0,a.createInterpolateElement)((0,w.__)("Height <Side />","woocommerce"),{Side:(0,a.createElement)("span",null,"C")}),className:fe()({"has-error":P}),help:P},(0,a.createElement)(i.__experimentalInputControl,{...D})),(0,a.createElement)(i.BaseControl,{id:F.id,label:(0,w.__)("Weight","woocommerce"),className:fe()({"has-error":M}),help:M},(0,a.createElement)(i.__experimentalInputControl,{...F}))),(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(Fr,{highlight:d,className:"wp-block-woocommerce-product-shipping-dimensions-fields__dimensions-image",labels:{A:(null===(o=R.value)||void 0===o?void 0:o.length)?R.value:void 0,B:(null===(r=L.value)||void 0===r?void 0:r.length)?L.value:void 0,C:(null===(n=D.value)||void 0===n?void 0:n.length)?D.value:void 0}}))))}};function Ur(){return ft({name:Vr,metadata:Hr,settings:zr})}const $r=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-summary-field","title":"Product summary","category":"widgets","description":"The product summary.","keywords":["products","summary","excerpt"],"textdomain":"default","attributes":{"align":{"type":"string"},"allowedFormats":{"type":"array","default":["core/bold","core/code","core/italic","core/link","core/strikethrough","core/underline","core/text-color","core/subscript","core/superscript","core/unknown"]},"direction":{"type":"string","enum":["ltr","rtl"]},"label":{"type":"string"},"content":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"editorStyle":"file:./editor.css"}'),jr=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,a.createElement)(ge.Path,{d:"M5.52 2h7.43c.55 0 1 .45 1 1s-.45 1-1 1h-1v13c0 .55-.45 1-1 1s-1-.45-1-1V5c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55-.45 1-1 1s-1-.45-1-1v-5.96h-.43C3.02 11.04 1 9.02 1 6.52S3.02 2 5.52 2zM14 14l5-4-5-4v8z"}));function Wr(e){let{direction:t,onChange:o}=e;return(0,a.createElement)(a.Fragment,null,(0,w.isRTL)()&&(0,a.createElement)(i.ToolbarButton,{icon:jr,title:(0,w._x)("Left to right","editor button","woocommerce"),isActive:"ltr"===t,onClick:function(){"function"==typeof o&&o("ltr"===t?void 0:"ltr")}}))}const Gr=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"})),qr=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"})),Zr=(0,a.createElement)(ge.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"})),Jr=(0,a.createElement)(ge.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(ge.Path,{d:"M4 12.8h16v-1.5H4v1.5zm0 7h12.4v-1.5H4v1.5zM4 4.3v1.5h16V4.3H4z"})),Kr=[{icon:Gr,title:(0,w.__)("Align text left","woocommerce"),align:"left"},{icon:qr,title:(0,w.__)("Align text center","woocommerce"),align:"center"},{icon:Zr,title:(0,w.__)("Align text right","woocommerce"),align:"right"},{icon:Jr,title:(0,w.__)("Align text justify","woocommerce"),align:"justify"}],{name:Yr,...Xr}=$r,Qr={example:{},edit:function e(t){let{attributes:o,setAttributes:r}=t;const{align:n,allowedFormats:l,direction:c,label:s}=o,m=(0,ct.useBlockProps)({style:{direction:c}}),u=(0,Z.useInstanceId)(e,"wp-block-woocommerce-product-summary-field__content"),[d,p]=(0,me.useEntityProp)("postType","product","short_description"),{clearSelectedBlock:_}=(0,b.useDispatch)(ct.store);return(0,a.createElement)("div",{className:"wp-block wp-block-woocommerce-product-summary-field-wrapper"},(0,a.createElement)(ct.BlockControls,{group:"block"},(0,a.createElement)(ct.AlignmentControl,{alignmentControls:Kr,value:n,onChange:function(e){r({align:e})}}),(0,a.createElement)(Wr,{direction:c,onChange:function(e){r({direction:e})}})),(0,a.createElement)(i.BaseControl,{id:u.toString(),label:s||(0,w.__)("Summary","woocommerce"),help:(0,w.__)("Summarize this product in 1-2 short sentences. We'll show it at the top of the page.","woocommerce")},(0,a.createElement)("div",{...m},(0,a.createElement)(ct.RichText,{id:u.toString(),identifier:"content",tagName:"p",value:d,onChange:p,"data-empty":Boolean(d),className:fe()("components-summary-control",{[`has-text-align-${n}`]:n}),dir:c,allowedFormats:l,onBlur:function(e){var t;(null===(t=e.relatedTarget)||void 0===t?void 0:t.closest(".block-editor-block-contextual-toolbar"))||_()}}))))}};function en(){return ft({name:Yr,metadata:Xr,settings:Qr})}const tn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-tab","title":"Product tab","category":"woocommerce","description":"The product tab.","keywords":["products","tab","group"],"textdomain":"default","attributes":{"id":{"type":"string"},"title":{"type":"string"},"order":{"type":"number"}},"supports":{"align":false,"html":false,"multiple":true,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"usesContext":["selectedTab"],"editorStyle":"file:./editor.css","templateLock":"contentOnly"}'),on=100,rn=e=>{let{children:t}=e;return(0,a.createElement)(a.Fragment,null,t)};function nn(e){let{children:t,className:o,id:r,order:n=on,selected:l=!1}=e;const c=fe()("wp-block-woocommerce-product-tab__button",o,{"is-selected":l});return(0,a.createElement)(i.Fill,{name:rt},(e=>{const{onClick:o}=e;return(0,a.createElement)(rn,{order:n},(0,a.createElement)(i.Button,{key:r,className:c,onClick:()=>o(r),id:`woocommerce-product-tab__${r}`,"aria-controls":`woocommerce-product-tab__${r}-content`,"aria-selected":l},t))}))}const{name:an}=tn,ln={example:{},edit:function(e){let{attributes:t,context:o}=e;const r=(0,ct.useBlockProps)(),{id:n,title:l,order:c}=t,i=(null==o?void 0:o.selectedTab)===n,s=fe()("wp-block-woocommerce-product-tab__content",{"is-selected":i});return(0,a.createElement)("div",{...r},(0,a.createElement)(nn,{id:n,selected:i,order:c},l),(0,a.createElement)("div",{id:`woocommerce-product-tab__${n}-content`,"aria-labelledby":`woocommerce-product-tab__${n}`,role:"tabpanel",className:s},(0,a.createElement)(ct.InnerBlocks,{templateLock:"contentOnly"})))}},cn=()=>Et({name:an,metadata:tn,settings:ln}),sn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-inventory-quantity-field","title":"Product inventory quantity available","category":"woocommerce","description":"The product available quantity.","keywords":["products","quantity","inventory"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),{name:mn,...un}=sn,dn={example:{},edit:function(e){let{clientId:t}=e;const o=(0,ct.useBlockProps)(),[r]=(0,me.useEntityProp)("postType","product","manage_stock"),[n,l]=(0,me.useEntityProp)("postType","product","stock_quantity"),c=(0,Z.useInstanceId)(i.BaseControl,"product_stock_quantity"),{ref:s,error:m,validate:u}=Io(`stock_quantity-${t}`,(async function(){if(r&&n&&n<0)return(0,w.__)("Stock quantity must be a positive number.","woocommerce")}),[r,n]);return(0,a.useEffect)((()=>{r&&null===n&&l(1)}),[r,n]),(0,a.createElement)("div",{...o},(0,a.createElement)("div",{className:"wp-block-columns"},(0,a.createElement)("div",{className:"wp-block-column"},(0,a.createElement)(i.BaseControl,{id:c,className:m&&"has-error",help:null!=m?m:""},(0,a.createElement)(i.__experimentalInputControl,{id:c,name:"stock_quantity",ref:s,label:(0,w.__)("Available quantity","woocommerce"),value:n,onChange:l,onBlur:u,type:"number",min:0}))),(0,a.createElement)("div",{className:"wp-block-column"})))}};function pn(){return ft({name:mn,metadata:un,settings:dn})}const _n=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-toggle-field","title":"Product toggle control","category":"woocommerce","description":"The product toggle.","keywords":["products","radio","input"],"textdomain":"default","attributes":{"label":{"type":"string","__experimentalRole":"content"},"property":{"type":"string"},"disabled":{"type":"boolean","default":false}},"supports":{"align":false,"html":false,"multiple":true,"reusable":true,"inserter":false,"lock":false,"__experimentalToolbar":false}}'),{name:fn,...hn}=_n,gn={example:{},edit:function(e){let{attributes:t}=e;const o=(0,ct.useBlockProps)(),{label:r,property:n,disabled:l}=t,[c,s]=(0,me.useEntityProp)("postType","product",n);return(0,a.createElement)("div",{...o},(0,a.createElement)(i.ToggleControl,{label:r,checked:c,disabled:l,onChange:s}))}};function bn(){return ft({name:fn,metadata:hn,settings:gn})}const wn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-attributes-field","title":"Product attributes","category":"widgets","description":"The product attributes.","keywords":["products","attributes"],"textdomain":"default","attributes":{"name":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}'),En=e=>{let{initialAttributeTermName:t,attributeId:o,onCancel:r=(()=>{}),onCreated:n=(()=>{})}=e;const{createNotice:c}=(0,b.useDispatch)("core/notices"),[s,m]=(0,a.useState)(!1),{createProductAttributeTerm:u,invalidateResolutionForStoreSelector:d}=(0,b.useDispatch)(v.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME);return(0,a.createElement)(i.Modal,{title:(0,w.__)("Create attribute","woocommerce"),onRequestClose:e=>{e.stopPropagation(),r()},className:"woocommerce-create-attribute-term-modal"},(0,a.createElement)(l.Form,{initialValues:{name:t,slug:(0,E.cleanForSlug)(t)},validate:function(e){var t;const o={};return(null===(t=e.name)||void 0===t?void 0:t.length)||(o.name=(0,w.__)("The attribute term name is required.","woocommerce")),o},errors:{},onSubmit:async e=>{(0,N.recordEvent)("product_attribute_term_add",{source:x}),m(!0);try{const t=await u({...e,attribute_id:o});(0,N.recordEvent)("product_attribute_term_add_success",{source:x}),d("getProductAttributes"),m(!1),n(t)}catch(e){(0,N.recordEvent)("product_attribute_term_add_failed",{source:x}),c("error",(0,w.__)("Failed to create attribute term.","woocommerce")),m(!1),r()}}},(e=>{let{getInputProps:t,handleSubmit:o,isValidForm:n,setValue:l,values:c}=e;const m=t("name");return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(i.TextControl,{label:(0,w.__)("Name","woocommerce"),...m,onBlur:()=>{m.onBlur(),l("slug",(0,E.cleanForSlug)(c.name))}}),(0,a.createElement)(i.TextControl,{label:(0,w.__)("Slug","woocommerce"),...t("slug"),help:(0,w.__)("The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.","woocommerce")}),(0,a.createElement)(i.TextareaControl,{label:(0,w.__)("Description","woocommerce"),...t("description")}),(0,a.createElement)("div",{className:"woocommerce-create-attribute-term-modal__buttons"},(0,a.createElement)(i.Button,{isSecondary:!0,label:(0,w.__)("Cancel","woocommerce"),onClick:()=>r()},(0,w.__)("Cancel","woocommerce")),(0,a.createElement)(i.Button,{isPrimary:!0,isBusy:s,label:(0,w.__)("Add attribute","woocommerce"),disabled:!n||s,onClick:o},(0,w.__)("Add","woocommerce"))))})))};let vn=0;const yn=e=>{let{value:t=[],onChange:o,placeholder:r,disabled:n,attributeId:c,label:s=""}=e;const m=(0,a.useRef)("woocommerce-attribute-term-field-"+ ++vn),[u,d]=(0,a.useState)([]),[p,_]=(0,a.useState)(!1),[f,h]=(0,a.useState)(),g=(0,a.useCallback)((e=>(_(!0),(0,b.resolveSelect)(v.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME).getProductAttributeTerms({search:e||"",attribute_id:c}).then((e=>(d(e),_(!1),e)),(e=>(_(!1),e))))),[c]),E=(0,Z.useDebounce)(g,250);(0,a.useEffect)((()=>{n||void 0===c||u.length||g()}),[n,c]);const y=e=>{o(t.filter((t=>t.slug!==e.slug)))},k=e=>{-99!==e.id?t.find((t=>t.slug===e.slug))?y(e):o([...t,e]):h(e.name)},C=()=>{const e=document.querySelector("."+m.current+" .woocommerce-experimental-select-control__input");e&&setTimeout((()=>{e.focus()}),0)},S=(t||[]).map((e=>e.slug));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.__experimentalSelectControl,{items:u,multiple:!0,disabled:n||!c,label:s,getFilteredItems:(e,t)=>t.length>0&&!e.find((e=>e.name.toLowerCase()===t.toLowerCase()))?[...e,{id:-99,name:t}]:e,onInputChange:E,placeholder:r||"",getItemLabel:e=>(null==e?void 0:e.name)||"",getItemValue:e=>(null==e?void 0:e.slug)||"",stateReducer:(e,t)=>{const{changes:o,type:r}=t;switch(r){case l.selectControlStateChangeTypes.ControlledPropUpdatedSelectedItem:return{...o,inputValue:e.inputValue};case l.selectControlStateChangeTypes.ItemClick:return o.selectedItem&&-99===o.selectedItem.id?o:{...o,isOpen:!0,inputValue:e.inputValue,highlightedIndex:e.highlightedIndex};default:return o}},selected:t,onSelect:k,onRemove:y,className:"woocommerce-attribute-term-field "+m.current,__experimentalOpenMenuOnFocus:!0},(e=>{let{items:t,highlightedIndex:o,getItemProps:r,getMenuProps:n,isOpen:c}=e;return(0,a.createElement)(l.__experimentalSelectControlMenu,{isOpen:c,getMenuProps:n},[p?(0,a.createElement)("div",{key:"loading-spinner",className:"woocommerce-attribute-term-field__loading-spinner"},(0,a.createElement)(i.Spinner,null)):null,...t.map(((e,t)=>{const n=S.includes(e.slug);return(0,a.createElement)(l.__experimentalSelectControlMenuItem,{key:`${e.slug}`,index:t,isActive:o===t,item:e,getItemProps:r},-99!==e.id?(0,a.createElement)(i.CheckboxControl,{onChange:()=>null,checked:n,label:(0,a.createElement)("span",{style:{fontWeight:n?"bold":"normal"}},e.name)}):(0,a.createElement)("div",{className:"woocommerce-attribute-term-field__add-new"},(0,a.createElement)(i.Icon,{icon:qt,size:20,className:"woocommerce-attribute-term-field__add-new-icon"}),(0,a.createElement)("span",null,(0,w.sprintf)((0,w.__)('Create "%s"',"woocommerce"),e.name))))}))].filter((e=>null!==e)))})),f&&void 0!==c&&(0,a.createElement)(En,{initialAttributeTermName:f,onCancel:()=>{h(void 0),C()},attributeId:c,onCreated:e=>{k(e),h(void 0),C()}}))};function kn(e){return null!==e&&"object"==typeof e&&!!e.label}const Cn=e=>{let{value:t=[],onChange:o,placeholder:r,disabled:n,label:c}=e;const[s,m]=(0,a.useState)(t),u=e=>{o(t.filter((t=>t!==e)))};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.__experimentalSelectControl,{items:s,multiple:!0,disabled:n,label:c||"",placeholder:r||"",getItemLabel:e=>kn(e)?e.label:e||"",getItemValue:e=>kn(e)?e.id:e||"",getFilteredItems:(e,t)=>{const o=e.filter((e=>!t.length||!kn(e)&&e.toLowerCase().includes(t.toLowerCase())));return t.length>0&&!o.find((e=>!kn(e)&&e.toLowerCase()===t.toLowerCase()))?[...o,{id:"is-new",label:t}]:o},selected:t,onSelect:e=>{if(kn(e))return m([...s,e.label]),void o([...t,e.label]);t.includes(e)?u(e):o([...t,e])},onRemove:u,className:"woocommerce-attribute-term-field"},(e=>{let{items:o,highlightedIndex:r,getItemProps:n,getMenuProps:c,isOpen:s}=e;return(0,a.createElement)(l.__experimentalSelectControlMenu,{isOpen:s,getMenuProps:c},o.map(((e,o)=>(0,a.createElement)(l.__experimentalSelectControlMenuItem,{key:`${kn(e)?e.id:e}`,index:o,isActive:r===o,item:e,getItemProps:n},kn(e)?(0,a.createElement)("div",{className:"woocommerce-attribute-term-field__add-new"},(0,a.createElement)(i.Icon,{icon:qt,size:20,className:"woocommerce-attribute-term-field__add-new-icon"}),(0,a.createElement)("span",null,(0,w.sprintf)((0,w.__)('Create "%s"',"woocommerce"),e.label))):(0,a.createElement)(i.CheckboxControl,{onChange:()=>null,checked:t.includes(e),label:(0,a.createElement)("span",{style:{fontWeight:t.includes(e)?"bold":"normal"}},e)})))))})))},Sn=e=>{let{title:t=(0,w.__)("Edit attribute","woocommerce"),nameLabel:o=(0,w.__)("Name","woocommerce"),globalAttributeHelperMessage:r,customAttributeHelperMessage:n=(0,w.__)("Your customers will see this on the product page","woocommerce"),termsLabel:c=(0,w.__)("Values","woocommerce"),termsPlaceholder:s=(0,w.__)("Search or create value","woocommerce"),visibleLabel:m=(0,w.__)("Visible to customers","woocommerce"),visibleTooltip:u=(0,w.__)("Show or hide this attribute on the product page","woocommerce"),cancelAccessibleLabel:d=(0,w.__)("Cancel","woocommerce"),cancelLabel:p=(0,w.__)("Cancel","woocommerce"),updateAccessibleLabel:_=(0,w.__)("Edit attribute","woocommerce"),updateLabel:f=(0,w.__)("Update","woocommerce"),onCancel:h,onEdit:g,attribute:b}=e;const[E,v]=(0,a.useState)({...b}),y=0===(null==E?void 0:E.id);return(0,a.createElement)(i.Modal,{title:t,onRequestClose:()=>h(),className:"woocommerce-edit-attribute-modal"},(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__body"},(0,a.createElement)(i.TextControl,{label:o,disabled:!y,value:(null==E?void 0:E.name)?null==E?void 0:E.name:"",onChange:e=>v({...E,name:e})}),(0,a.createElement)("p",{className:"woocommerce-edit-attribute-modal__helper-text"},y?n:r),b.terms?(0,a.createElement)(yn,{label:c,placeholder:s,value:null==E?void 0:E.terms,attributeId:null==E?void 0:E.id,onChange:e=>{v({...E,terms:e})}}):(0,a.createElement)(Cn,{label:c,placeholder:s,disabled:!(null==b?void 0:b.name),value:null==E?void 0:E.options,onChange:e=>{v({...E,options:e})}}),(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__option-container"},(0,a.createElement)(i.CheckboxControl,{onChange:e=>v({...E,visible:e}),checked:null==E?void 0:E.visible,label:m}),(0,a.createElement)(l.__experimentalTooltip,{text:u}))),(0,a.createElement)("div",{className:"woocommerce-edit-attribute-modal__buttons"},(0,a.createElement)(i.Button,{isSecondary:!0,label:d,onClick:()=>h()},p),(0,a.createElement)(i.Button,{isPrimary:!0,label:_,onClick:()=>{g(E)}},f)))};function Tn(e){return 0!==e.id?e.id:e.name}const xn=e=>`${e.id}-${e.name}`,Nn=e=>{let{attribute:t,editLabel:o=(0,w.__)("edit","woocommerce"),removeLabel:r=(0,w.__)("Remove attribute","woocommerce"),onDragStart:n,onDragEnd:c,onEditClick:s,onRemoveClick:m}=e;return(0,a.createElement)(l.ListItem,{className:"woocommerce-attribute-list-item",onDragStart:n,onDragEnd:c},(0,a.createElement)("div",null,t.name),(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__options"},t.options.slice(0,2).map(((e,t)=>(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__option-chip",key:t},e))),t.options.length>2&&(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__option-chip"},(0,w.sprintf)((0,w.__)("+ %i more","woocommerce"),t.options.length-2))),(0,a.createElement)("div",{className:"woocommerce-attribute-list-item__actions"},"function"==typeof s&&(0,a.createElement)(i.Button,{variant:"tertiary",onClick:()=>s(t)},o),"function"==typeof m&&(0,a.createElement)(i.Button,{icon:Re,label:r,onClick:()=>m(t)})))};function Pn(e){return-99===e.id}const In=e=>{let{value:t=null,onChange:o,placeholder:r,label:n,disabled:c,ignoredAttributeIds:s=[]}=e;const{attributes:m,isLoading:u}=(0,b.useSelect)((e=>{const{getProductAttributes:t,hasFinishedResolution:o}=e(v.EXPERIMENTAL_PRODUCT_ATTRIBUTES_STORE_NAME);return{isLoading:!o("getProductAttributes"),attributes:t()}}));return(0,a.createElement)(l.__experimentalSelectControl,{className:"woocommerce-attribute-input-field",items:m||[],label:n||"",disabled:c,getFilteredItems:(e,t)=>{const o=e.filter((e=>(e=>!s.length||!s.includes(e.id))(e)&&(e.name||"").toLowerCase().startsWith(t.toLowerCase())));return t.length>0&&!e.find((e=>e.name.toLowerCase()===t.toLowerCase()))?[...o,{id:-99,name:t}]:o},placeholder:r,getItemLabel:e=>(null==e?void 0:e.name)||"",getItemValue:e=>(null==e?void 0:e.id)||"",selected:t,onSelect:e=>{Pn(e)&&(0,N.recordEvent)("product_attribute_add_custom_attribute",{source:x}),o(Pn(e)?e.name:{id:e.id,name:e.name,options:[]})},onRemove:()=>o(),__experimentalOpenMenuOnFocus:!0},(e=>{let{items:t,highlightedIndex:o,getItemProps:r,getMenuProps:n,isOpen:c}=e;return(0,a.createElement)(l.__experimentalSelectControlMenu,{getMenuProps:n,isOpen:c},u?(0,a.createElement)(i.Spinner,null):t.map(((e,t)=>(0,a.createElement)(l.__experimentalSelectControlMenuItem,{key:e.id,index:t,isActive:o===t,item:e,getItemProps:r},Pn(e)?(0,a.createElement)("div",{className:"woocommerce-attribute-input-field__add-new"},(0,a.createElement)(i.Icon,{icon:qt,size:20,className:"woocommerce-attribute-input-field__add-new-icon"}),(0,a.createElement)("span",null,(0,w.sprintf)((0,w.__)('Create "%s"',"woocommerce"),e.name))):e.name))))}))},An=e=>{let{title:t=(0,w.__)("Add attributes","woocommerce"),notice:o=(0,w.__)("By default, attributes are filterable and visible on the product page. You can change these settings for each attribute separately later.","woocommerce"),attributeLabel:r=(0,w.__)("Attribute","woocommerce"),valueLabel:n=(0,w.__)("Values","woocommerce"),attributePlaceholder:c=(0,w.__)("Search or create attribute","woocommerce"),termPlaceholder:s=(0,w.__)("Search or create value","woocommerce"),removeLabel:m=(0,w.__)("Remove attribute","woocommerce"),addAnotherAccessibleLabel:u=(0,w.__)("Add another attribute","woocommerce"),addAnotherLabel:d=(0,w.__)("+ Add another","woocommerce"),cancelLabel:p=(0,w.__)("Cancel","woocommerce"),addAccessibleLabel:_=(0,w.__)("Add attributes","woocommerce"),addLabel:f=(0,w.__)("Add","woocommerce"),confirmMessage:h=(0,w.__)("You have some attributes added to the list, are you sure you want to cancel?","woocommerce"),confirmCancelLabel:g=(0,w.__)("No thanks","woocommerce"),confirmConfirmLabel:b=(0,w.__)("Yes please!","woocommerce"),onCancel:E,onAdd:v,selectedAttributeIds:y=[]}=e;const[k,C]=(0,a.useState)(!1),S=e=>{return(e=>0!==e.id)(e)?(t=e.terms)?t.map((e=>e.name)):[]:e.options;var t},T=e=>void 0===e.visible||e.visible,x=e=>{e.attributes.some((e=>null!==e&&(null==e?void 0:e.terms)&&(null==e?void 0:e.terms.length)>0))?C(!0):E()};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(l.Form,{initialValues:{attributes:[null]}},(e=>{let{values:l,setValue:h}=e;return(0,a.createElement)(i.Modal,{title:t,onRequestClose:e=>{e.isPropagationStopped()||x(l)},className:"woocommerce-new-attribute-modal"},(0,a.createElement)(i.Notice,{isDismissible:!1},(0,a.createElement)("p",null,o)),(0,a.createElement)("div",{className:"woocommerce-new-attribute-modal__body"},(0,a.createElement)("table",{className:"woocommerce-new-attribute-modal__table"},(0,a.createElement)("thead",null,(0,a.createElement)("tr",{className:"woocommerce-new-attribute-modal__table-header"},(0,a.createElement)("th",null,r),(0,a.createElement)("th",null,n))),(0,a.createElement)("tbody",null,l.attributes.map(((e,t)=>(0,a.createElement)("tr",{key:t,className:`woocommerce-new-attribute-modal__table-row woocommerce-new-attribute-modal__table-row-${t}`},(0,a.createElement)("td",{className:"woocommerce-new-attribute-modal__table-attribute-column"},(0,a.createElement)(In,{placeholder:c,value:e,label:r,onChange:e=>{h("attributes["+t+"]",e&&function(e){return"string"==typeof e?{id:0,name:e,options:[]}:e}(e)),e&&(e=>{setTimeout((()=>{const t=document.querySelector(".woocommerce-new-attribute-modal__table-row-"+e+" .woocommerce-new-attribute-modal__table-attribute-value-column .woocommerce-experimental-select-control__input");t&&t.focus()}),0)})(t)},ignoredAttributeIds:[...y,...l.attributes.map((e=>null==e?void 0:e.id)).filter((e=>void 0!==e))]})),(0,a.createElement)("td",{className:"woocommerce-new-attribute-modal__table-attribute-value-column"},null===e||0!==e.id?(0,a.createElement)(yn,{placeholder:s,disabled:!e||!e.id,attributeId:e?e.id:void 0,value:null===e?[]:e.terms,label:n,onChange:e=>h("attributes["+t+"].terms",e)}):(0,a.createElement)(Cn,{placeholder:s,disabled:!e.name,value:e.options,label:n,onChange:e=>h("attributes["+t+"].options",e)})),(0,a.createElement)("td",{className:"woocommerce-new-attribute-modal__table-attribute-trash-column"},(0,a.createElement)(i.Button,{icon:So,disabled:1===l.attributes.length&&null===l.attributes[0],label:m,onClick:()=>((e,t,o)=>{(0,N.recordEvent)("product_add_attributes_modal_remove_attribute_button_click"),t.attributes.length>1?o("attributes",t.attributes.filter(((t,o)=>o!==e))):o(`attributes[${e}]`,[null])})(t,l,h)})))))))),(0,a.createElement)("div",null,(0,a.createElement)(i.Button,{className:"woocommerce-new-attribute-modal__add-attribute",variant:"tertiary",label:u,onClick:()=>{(0,N.recordEvent)("product_add_attributes_modal_add_another_attribute_button_click"),((e,t)=>{var o;t("attributes",[...e.attributes,null]),o=e.attributes.length,setTimeout((()=>{const e=document.querySelector(`.woocommerce-new-attribute-modal__table-row-${o}`);null==e||e.scrollIntoView({behavior:"smooth"})}),0)})(l,h)}},d)),(0,a.createElement)("div",{className:"woocommerce-new-attribute-modal__buttons"},(0,a.createElement)(i.Button,{isSecondary:!0,label:p,onClick:()=>x(l)},p),(0,a.createElement)(i.Button,{isPrimary:!0,label:_,disabled:1===l.attributes.length&&null===l.attributes[0],onClick:()=>(e=>{const t=[];e.attributes.forEach((e=>{var o;null!==(o=e)&&o.name.length>0&&(e=>e.terms&&e.terms.length>0||e.options&&e.options.length>0)(o)&&t.push({...e,visible:T(e),options:S(e)})})),v(t)})(l)},f)))})),(0,a.createElement)(l.__experimentalSelectControlMenuSlot,null),k&&(0,a.createElement)(i.__experimentalConfirmDialog,{cancelButtonText:g,confirmButtonText:b,onCancel:()=>C(!1),onConfirm:E},h))},Mn=e=>{let{value:t,onAdd:o=(()=>{}),onChange:r,onEdit:n=(()=>{}),onNewModalCancel:c=(()=>{}),onNewModalClose:s=(()=>{}),onNewModalOpen:m=(()=>{}),onEditModalCancel:u=(()=>{}),onEditModalClose:d=(()=>{}),onEditModalOpen:p=(()=>{}),onRemove:_=(()=>{}),onRemoveCancel:f=(()=>{}),uiStrings:h={newAttributeModalTitle:void 0,emptyStateSubtitle:void 0,newAttributeListItemLabel:(0,w.__)("Add attributes","woocommerce"),globalAttributeHelperMessage:(0,w.__)("You can change the attribute's name in <link>Attributes</link>.","woocommerce")}}=e;const[g,b]=(0,a.useState)(!1),[E,v]=(0,a.useState)(null),y=e=>{r(e.map((e=>({...e,options:e.terms?e.terms.map((e=>e.name)):e.options,terms:void 0,visible:e.visible||!1}))))},k=()=>{b(!1),s()},C=e=>{v(null),d(e)},S=t.sort(((e,t)=>e.position-t.position)),T=t.reduce(((e,t)=>(e[Tn(t)]=t,e)),{}),x=t.find((e=>xn(e)===E));return(0,a.createElement)("div",{className:"woocommerce-attribute-field"},(0,a.createElement)(i.Button,{variant:"secondary",className:"woocommerce-add-attribute-list-item__add-button",onClick:()=>{b(!0),m(),(0,N.recordEvent)("product_add_attributes_click")}},h.newAttributeListItemLabel),Boolean(t.length)&&(0,a.createElement)(l.Sortable,{onOrderChange:e=>{const t=e.reduce(((e,t,o)=>{let{props:r}=t;return e[Tn(r.attribute)]=o,e}),{});r(function(e,t){return Object.keys(t).map((o=>isNaN(e[o])?{...t[o]}:{...t[o],position:e[o]}))}(t,T))}},S.map((e=>(0,a.createElement)(Nn,{attribute:e,key:xn(e),onEditClick:()=>{return v(xn(t=e)),void p(t);var t},onRemoveClick:()=>(e=>{if(window.confirm((0,w.__)("Remove this attribute?","woocommerce")))return y(t.filter((t=>xn(t)!==xn(e)))),void _(e);f(e)})(e)})))),g&&(0,a.createElement)(An,{title:h.newAttributeModalTitle,onCancel:()=>{k(),c()},onAdd:e=>{y([...t,...e.filter((e=>!t.find((t=>xn(e)===xn(t)))))]),o(e),k()},selectedAttributeIds:t.map((e=>e.id))}),(0,a.createElement)(l.__experimentalSelectControlMenuSlot,null),x&&(0,a.createElement)(Sn,{title:(0,w.sprintf)((0,w.__)("Edit %s","woocommerce"),x.name),globalAttributeHelperMessage:(0,a.createInterpolateElement)(h.globalAttributeHelperMessage,{link:(0,a.createElement)(l.Link,{href:(0,Ve.getAdminLink)("edit.php?post_type=product&page=product_attributes"),target:"_blank",type:"wp-admin"},(0,a.createElement)(a.Fragment,null))}),onCancel:()=>{C(x),u(x)},onEdit:e=>{(e=>{const o=t.map((t=>xn(t)===xn(e)?e:t));n(e),y(o),C(e)})(e)},attribute:x}))},On=(e,t)=>e.reduce(((e,o)=>(e[t(o)?0:1].push(o),e)),[[],[]]);const Rn=e=>{let{value:t,onChange:o,productId:r}=e;const{attributes:n,handleChange:l}=function(e){let{allAttributes:t=[],isVariationAttributes:o=!1,onChange:r,productId:n}=e;const l=()=>o?t.filter((e=>!!e.variation)):t.filter((e=>!e.variation)),[c,i]=(0,a.useState)(l()),[s,m]=On(c,(e=>0===e.id)),u=(0,a.useCallback)((e=>(0,b.resolveSelect)(v.EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME).getProductAttributeTerms({attribute_id:e,product:n}).then((e=>e),(e=>e))),[n]);return(0,a.useEffect)((()=>{l().length&&!c.length&&Promise.all(m.map((e=>u(e.id)))).then((e=>{i([...m.map(((t,o)=>{return r=t,n=e[o],{...r,terms:n.length>0?n:void 0,options:0===n.length?r.options:[]};var r,n})),...s])}))}),[t,c,u]),{attributes:c,handleChange:e=>{const n=e.map(((e,t)=>({...e,variation:o,position:c.length+t}))),a=o?t.filter((e=>!e.variation)):t.filter((e=>!!e.variation));i(n),r([...a,...n])},setAttributes:i}}({allAttributes:t,onChange:o,productId:r});return(0,a.createElement)(Mn,{value:n,onAdd:()=>{(0,N.recordEvent)("product_add_attributes_modal_add_button_click")},onChange:l,onNewModalCancel:()=>{(0,N.recordEvent)("product_add_attributes_modal_cancel_button_click")},onNewModalOpen:()=>{n.length?(0,N.recordEvent)("product_add_attribute_button"):(0,N.recordEvent)("product_add_first_attribute_button_click")},onRemove:()=>(0,N.recordEvent)("product_remove_attribute_confirmation_confirm_click"),onRemoveCancel:()=>(0,N.recordEvent)("product_remove_attribute_confirmation_cancel_click")})},{name:Ln}=wn,Bn={example:{},edit:function(){const[e,t]=(0,me.useEntityProp)("postType","product","attributes"),o=(0,me.useEntityId)("postType","product"),r=(0,ct.useBlockProps)();return(0,a.createElement)("div",{...r},(0,a.createElement)(Rn,{productId:o,value:e,onChange:t}))}},Dn=()=>ft({name:Ln,metadata:wn,settings:Bn}),Fn=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"woocommerce/product-variations-fields","title":"Product variations fields","category":"woocommerce","description":"The product variations.","keywords":["products","variations"],"textdomain":"default","attributes":{"description":{"type":"string","__experimentalRole":"content"}},"supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"__experimentalToolbar":false},"editorStyle":"file:./editor.css"}');function Vn(e){const t=(0,Z.useInstanceId)(i.G,"clip");return(0,a.createElement)(i.SVG,{width:"264",height:"167",...e,viewBox:"0 0 264 167",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(i.G,{clipPath:`url(#${t})`},(0,a.createElement)(i.Path,{d:"M38.5556 0.164185C11.3783 0.164185 -3.89877 21.4091 1.5234 37.3916C7.43365 54.8517 25.6968 71.9169 25.6968 85.7696H51.4188C51.4188 71.908 69.6821 54.8517 75.5923 37.3916C81.0145 21.4091 65.7463 0.164185 38.5556 0.164185Z",fill:"#F0F0F0"}),(0,a.createElement)(i.Path,{d:"M50.5063 48.3114C44.2189 48.3114 40.5228 52.5755 40.5228 59.1735V59.9899C40.079 59.9899 39.6176 59.9899 39.1827 59.9944H38.3486C37.7141 59.9944 37.3325 59.9944 36.5915 59.9944V59.1779C36.5915 52.5755 32.8953 48.3114 26.6124 48.3114C21.0127 48.3114 17.8047 50.4812 17.8047 54.2616C17.8047 57.0969 20.4936 59.0137 25.7915 59.9589C29.0306 60.5357 32.1721 60.6777 35.2781 60.7087V85.7652H36.6003V60.7176C37.3413 60.722 37.7185 60.722 38.3574 60.7176C38.9919 60.7176 39.7906 60.7176 40.5316 60.7176V85.7652H41.8539V60.7132C44.9554 60.6777 48.0969 60.5401 51.3405 59.9633C56.6384 59.0182 59.3273 57.1013 59.3273 54.266C59.3273 50.4856 56.1192 48.3158 50.5196 48.3158L50.5063 48.3114ZM35.2781 59.9855C32.2032 59.95 29.106 59.8124 25.9202 59.2445C21.0172 58.3704 19.6905 56.2938 19.6905 54.1329C19.6905 50.2682 23.5996 49.0347 26.6124 49.0347C32.2342 49.0347 35.2781 53.0148 35.2781 59.169V59.981V59.9855ZM51.1985 59.2445C48.0126 59.8124 44.9155 59.9544 41.845 59.9855V59.1735C41.845 53.0148 44.8889 49.0391 50.5107 49.0391C53.528 49.0391 57.4326 50.2726 57.4326 54.1373C57.4326 56.2982 56.1015 58.3704 51.2029 59.2489L51.1985 59.2445Z",fill:"white"}),(0,a.createElement)(i.Path,{d:"M38.5585 101.872C45.5248 101.872 51.4173 96.1613 51.4173 89.834H25.6953C25.6953 96.1613 31.5923 101.872 38.5585 101.872Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M57.2858 89.9271H19.832V85.7695H57.2858V89.9271Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M69.5768 106.602H7.63895L0.4375 167L15.2974 151.328H64.2566L69.5768 106.602Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M119.436 122.749C113.97 115.072 110.828 111.394 104.652 111.394C97.8809 111.394 94.908 119.061 98.9724 123.853C103.445 129.125 118.993 134.627 118.993 134.627C118.993 134.627 94.0694 129.923 84.9112 129.923C79.8573 129.923 74.6836 131.96 74.6836 139.135C74.6836 146.31 79.8617 148.346 84.9112 148.346C94.0694 148.346 118.993 143.643 118.993 143.643C118.993 143.643 103.445 149.145 98.9724 154.416C94.908 159.208 97.8764 166.876 104.652 166.876C110.828 166.876 113.97 163.197 119.436 155.521C121.287 152.921 130.707 139.135 130.707 139.135C130.707 139.135 121.287 125.349 119.436 122.749Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M94.2838 102.671L169.715 102.671V80.4849L94.2838 80.4849V102.671Z",fill:"#F0F0F0"}),(0,a.createElement)(i.Path,{d:"M169.712 0H94.2812V75.4311H169.712V0Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M147.619 49.6336C147.619 44.4156 144.429 39.4194 138.168 36.0116H157.66L139.472 6.00781H124.524L106.336 36.0116H125.828C119.567 39.4194 116.377 44.4156 116.377 49.6336C116.377 55.5394 121.005 61.4985 127.106 64.6888C118.667 62.9849 117.344 69.4232 117.344 69.4232H146.661C146.661 69.4232 145.338 62.9849 136.899 64.6888C143 61.4985 147.628 55.5394 147.628 49.6336H147.619Z",fill:"white"}),(0,a.createElement)(i.Path,{d:"M147.86 80.7911H94.2812V85.2283H147.86V80.7911Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M169.712 89.8473H94.2812V94.2844H169.712V89.8473Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M136.82 98.9034H94.2812V103.341H136.82V98.9034Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M219.52 167C229.042 167 235.063 158.538 235.063 151.457H203.977C203.977 158.538 209.998 167 219.52 167Z",fill:"#DDDDDD"}),(0,a.createElement)(i.Path,{d:"M219.516 58.2018C185.027 58.2018 168.143 86.1557 178.522 110.613C185.541 127.141 202.225 125.264 202.225 138.505H236.826C236.826 125.264 253.514 127.141 260.529 110.613C270.903 86.1557 254.006 58.2018 219.516 58.2018Z",fill:"#F0F0F0"}),(0,a.createElement)(i.Path,{d:"M219.52 167C228.9 167 234.882 158.787 235.059 151.776C235.059 151.67 235.059 142.707 235.059 142.6H203.973C203.973 142.685 203.973 151.63 203.973 151.719C204.115 158.742 210.105 167.004 219.511 167.004L219.52 167Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M240.248 142.596H198.801V138.505H240.248V142.596Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M240.248 149.074H198.801V144.983H240.248V149.074Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M169.656 125.371H142.133V152.894H169.656V125.371Z",fill:"#F0F0F0"}),(0,a.createElement)(i.Path,{d:"M155.015 146.194L162.181 139.587L147.445 139.663V138.571L162.154 138.647L155.015 132.067L155.676 131.228L163.982 139.055V139.184L155.676 147.033L155.015 146.194Z",fill:"#DDDDDD"}),(0,a.createElement)(i.Path,{d:"M22.0977 126.533L27.44 141.921L53.5835 112.729",stroke:"white",strokeMiterlimit:"10"}),(0,a.createElement)(i.Path,{d:"M232.227 110.138C232.227 102.307 227.559 97.4392 220.042 97.4126C220.042 97.4126 220.025 97.4126 220.016 97.4126C220.007 97.4126 219.998 97.4126 219.989 97.4126C212.473 97.4392 207.805 102.928 207.805 110.138C207.805 117.349 212.22 120.774 218.516 125.287C214.704 128.858 212.663 134.516 212.663 138.505H215.867C215.867 134.809 216.572 129.56 220.016 126.462C223.463 129.56 224.164 134.809 224.164 138.505H227.368C227.368 134.516 225.322 128.858 221.515 125.287C227.812 120.778 232.227 116.958 232.227 110.138ZM220.016 124.435C213.773 119.989 209.242 117.158 209.242 110.138C209.242 103.119 213.546 98.7216 220.016 98.7082C226.485 98.7216 230.789 103.354 230.789 110.138C230.789 116.222 226.259 119.989 220.016 124.435Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M250.84 40.1516C250.84 45.9864 246.155 50.7297 240.342 50.8184H199.862C193.97 50.8184 189.195 46.0441 189.195 40.1516C189.195 34.2591 193.97 29.4847 199.862 29.4847H240.36C246.164 29.4847 250.84 34.3256 250.84 40.1516Z",fill:"#F0F0F0"}),(0,a.createElement)(i.Path,{d:"M240.122 47.7347C244.31 47.7347 247.705 44.3396 247.705 40.1516C247.705 35.9636 244.31 32.5686 240.122 32.5686C235.934 32.5686 232.539 35.9636 232.539 40.1516C232.539 44.3396 235.934 47.7347 240.122 47.7347Z",fill:"#E0E0E0"}),(0,a.createElement)(i.Path,{d:"M131.996 6.00781H124.524L106.332 36.0116H125.824H138.168H157.661L139.468 6.00781H131.996Z",fill:"#F0F0F0"}),(0,a.createElement)(i.Path,{d:"M151.608 26.0281H112.384L106.332 36.0116L151.608 26.0281Z",fill:"white"}),(0,a.createElement)(i.Path,{d:"M145.555 16.0446H118.435L112.383 26.0281L145.555 16.0446Z",fill:"white"}),(0,a.createElement)(i.Path,{d:"M139.469 6.00781H124.525L118.438 16.0446L139.469 6.00781Z",fill:"white"}),(0,a.createElement)(i.Path,{d:"M57.4297 42.9647H87.8994",stroke:"#DDDDDD",strokeWidth:"0.71",strokeMiterlimit:"10"}),(0,a.createElement)(i.Path,{d:"M61.8945 32.1914L83.4412 53.7381",stroke:"#DDDDDD",strokeWidth:"0.71",strokeMiterlimit:"10"}),(0,a.createElement)(i.Path,{d:"M72.668 27.7321V58.2018",stroke:"#DDDDDD",strokeWidth:"0.71",strokeMiterlimit:"10"})),(0,a.createElement)("defs",null,(0,a.createElement)("clipPath",{id:t},(0,a.createElement)(i.Rect,{width:"263.121",height:"167",fill:"white",transform:"translate(0.4375)"}))))}const{name:Hn,...zn}=Fn,Un={example:{},edit:function(e){let{attributes:t}=e;const{description:o}=t,[r]=(0,me.useEntityProp)("postType","product","attributes"),n=function(e){return e.some((e=>{let{variation:t}=e;return t}))}(r),l=(0,ct.useBlockProps)({className:fe()({"wp-block-woocommerce-product-variations-fields--has-attributes":n})}),c=(0,ct.useInnerBlocksProps)({className:"wp-block-woocommerce-product-variations-fields__content"},{templateLock:"all"});return(0,a.createElement)("div",{...l},(0,a.createElement)("div",{className:"wp-block-woocommerce-product-variations-fields__heading"},(0,a.createElement)("div",{className:"wp-block-woocommerce-product-variations-fields__heading-image-container"},(0,a.createElement)(Vn,null)),(0,a.createElement)("p",{className:"wp-block-woocommerce-product-variations-fields__heading-description",dangerouslySetInnerHTML:Vt(o)}),(0,a.createElement)("div",{className:"wp-block-woocommerce-product-variations-fields__heading-actions"},(0,a.createElement)(i.Button,{variant:"primary","aria-disabled":"true"},(0,w.__)("Add variation options","woocommerce")))),(0,a.createElement)("div",{...c}))}};function $n(){return ft({name:Hn,metadata:zn,settings:Un})}function jn(){const e=(0,_t.__experimentalGetCoreBlocks)().filter((e=>!(0,oe.getBlockType)(e.name)));(0,_t.registerCoreBlocks)(e);const t=Object.values(n).map((e=>e())),o=[...e,...t];return function(){o.forEach((e=>e&&(0,oe.unregisterBlockType)(e.name)))}}function Wn(e){let{clientId:t}=e;const o=(0,b.useSelect)((e=>{const{getBlockAttributes:o,getBlockName:r}=e("core/block-editor"),n=o(t);if(null==n?void 0:n.icon)return n.icon;const{getBlockType:a}=e("core/blocks"),l=a(r(t));return null==l?void 0:l.icon}),[t]);if(!o)return null;if("object"==typeof o){const{src:e,...t}=o;if(/^<(.)+>$/.test(e)){const o=(0,a.createElement)(a.RawHTML,{"aria-hidden":"true",...t},e);return(0,a.createElement)(ct.BlockIcon,{icon:o,showColors:!0})}if(/^https?:\/\/(.)+/.test(e)){const o=(0,a.createElement)("img",{src:e,alt:"","aria-hidden":"true",...t,height:24,width:24});return(0,a.createElement)(ct.BlockIcon,{icon:o,showColors:!0})}}return(0,a.createElement)(ct.BlockIcon,{icon:o,showColors:!0})}const Gn=e=>{const{symbol:t,symbolPosition:o}=e;return{[o.includes("left")?"prefix":"suffix"]:t}};var qn;!function(e){e.unsaved="unsaved",e.draft="draft",e.instock="instock",e.outofstock="outofstock"}(qn||(qn={}));const Zn={[qn.unsaved]:(0,w.__)("Unsaved","woocommerce"),[qn.draft]:(0,w.__)("Draft","woocommerce"),[qn.instock]:(0,w.__)("In stock","woocommerce"),[qn.outofstock]:(0,w.__)("Out of stock","woocommerce")},Jn=e=>e?"draft"===e.status?qn.draft:"instock"===e.stock_status?qn.instock:qn.outofstock:qn.unsaved;var Kn,Yn;!function(e){e.instock="instock",e.onbackorder="onbackorder",e.outofstock="outofstock"}(Kn||(Kn={})),function(e){e.instock="green",e.onbackorder="yellow",e.outofstock="red"}(Yn||(Yn={}));const Xn={[Kn.instock]:(0,w.__)("In stock","woocommerce"),[Kn.onbackorder]:(0,w.__)("On backorder","woocommerce"),[Kn.outofstock]:(0,w.__)("Out of stock","woocommerce")},Qn=e=>e.manage_stock?e.stock_quantity||0:e.stock_status?Xn[e.stock_status]:Xn.instock,ea=e=>{if(e.manage_stock){const t=e.stock_quantity||0;return t>=10?Yn.instock:t<10&&t>2?Yn.onbackorder:Yn.outofstock}return e.stock_status?Yn[e.stock_status]:""},ta=(e,t,o)=>(null==e?void 0:e.length)?e:o&&o!==O?o:"simple"===t?(0,w.__)("New standard product","woocommerce"):(0,w.__)("New product","woocommerce"),oa=e=>{var t;return(null===(t=null==e?void 0:e.attributes)||void 0===t?void 0:t.length)?e.attributes.map((e=>e.option)).join(", "):"#"+e.id},ra=e=>{const t=oa(e);return t.length>32?t.substring(0,32)+"…":t},na=window.wp.apiFetch;var aa=o.n(na);const la=()=>{aa().use(((e,t)=>{const o=new RegExp("^/wp/v2/product");return e.path&&o.test(null==e?void 0:e.path)&&(()=>{const e=(0,Ze.getQuery)();return"wc-admin"===(null==e?void 0:e.page)&&["/add-product","/product/"].some((t=>{var o;return null===(o=null==e?void 0:e.path)||void 0===o?void 0:o.startsWith(t)}))})()&&(e.path=e.path.replace(o,"/wc/v3/products")),t(e)}))};function ca(e){return`${e.id}:${e.menu_order}`}function ia(e){let{key:t}=e;return"string"==typeof t?Number.parseInt(t.split(":")[1],10):Number.MAX_SAFE_INTEGER}function sa(e,t,o){let{variationsOrder:r}=o;if(!r||!r[t])return e;const n=r[t];return[...e].sort(((e,t)=>n[e.id]&&n[t.id]?n[e.id]-n[t.id]:0))}const ma=e=>{let{variations:t,currentPage:o}=e;const{setValue:r,values:n}=(0,l.useFormContext)();return{sortedVariations:sa(t,o,n),getVariationKey:ca,onOrderChange:function(e){const t=Math.min(...e.map(ia));r("variationsOrder",{...n.variationsOrder,[o]:e.reduce(((e,o,r)=>({...e,[function(e){let{key:t}=e;return"string"==typeof t?Number.parseInt(t.split(":")[0],10):0}(o)]:t+r})),{})})}}}})(),(window.wc=window.wc||{}).productEditor=r})();