WordPress/wp-includes/js/dist/format-library.min.js
noisysocks 351400af80 Editor: Update @wordpress npm packages
Update @wordpress npm packages to the latest published versions. This means that
the block editor includes functionality that exists in Gutenberg 9.9.

Fixes #52334.

Built from https://develop.svn.wordpress.org/trunk@50137


git-svn-id: http://core.svn.wordpress.org/trunk@49816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 05:17:13 +00:00

2 lines
22 KiB
JavaScript

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.formatLibrary=function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=466)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},11:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(38);var c=r(31),o=r(39);function a(e,t){return Object(n.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,c=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){c=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(c)throw o}}return r}}(e,t)||Object(c.a)(e,t)||Object(o.a)()}},13:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(44);function c(e,t){if(null==e)return{};var r,c,o=Object(n.a)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(c=0;c<a.length;c++)r=a[c],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}},138:function(e,t,r){"use strict";var n=r(5),c=r(13),o=r(0);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.icon,r=e.size,i=void 0===r?24:r,l=Object(c.a)(e,["icon","size"]);return Object(o.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){Object(n.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:i,height:i},l))}},192:function(e,t,r){"use strict";var n=r(0),c=r(7),o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"}));t.a=o},2:function(e,t){e.exports=window.lodash},21:function(e,t){e.exports=window.wp.richText},220:function(e,t,r){"use strict";var n=r(0),c=r(7),o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(n.createElement)(c.Path,{d:"M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z"}));t.a=o},222:function(e,t,r){"use strict";var n=r(0),c=r(7),o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(n.createElement)(c.Path,{d:"M13.23 15h1.9L11 4H9L5 15h1.88l1.07-3h4.18zm-1.53-4.54H8.51L10 5.6z"}));t.a=o},223:function(e,t,r){"use strict";var n=r(0),c=r(7),o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"}));t.a=o},24:function(e,t,r){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}r.d(t,"a",(function(){return n}))},3:function(e,t){e.exports=window.wp.components},305:function(e,t,r){"use strict";var n=r(0),c=r(7),o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"}));t.a=o},31:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(24);function c(e,t){if(e){if("string"==typeof e)return Object(n.a)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(e,t):void 0}}},319:function(e,t,r){"use strict";var n=r(0),c=r(7),o=Object(n.createElement)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(c.Path,{d:"M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 13h8v-1.5H8V13z"}));t.a=o},32:function(e,t){e.exports=window.wp.url},320:function(e,t,r){"use strict";var n=r(0),c=r(7),o=Object(n.createElement)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(c.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"}));t.a=o},38:function(e,t,r){"use strict";function n(e){if(Array.isArray(e))return e}r.d(t,"a",(function(){return n}))},39:function(e,t,r){"use strict";function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}r.d(t,"a",(function(){return n}))},4:function(e,t){e.exports=window.wp.data},44:function(e,t,r){"use strict";function n(e,t){if(null==e)return{};var r,n,c={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(c[r]=e[r]);return c}r.d(t,"a",(function(){return n}))},466:function(e,t,r){"use strict";r.r(t);var n=r(13),c=r(21),o=r(0),a=r(1),i=r(6),l=r(7),u=Object(o.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(l.Path,{d:"M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"})),s=Object(a.__)("Bold"),b={name:"core/bold",title:s,tagName:"strong",className:null,edit:function(e){var t=e.isActive,r=e.value,n=e.onChange,a=e.onFocus;function l(){n(Object(c.toggleFormat)(r,{type:"core/bold"}))}return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.RichTextShortcut,{type:"primary",character:"b",onUse:l}),Object(o.createElement)(i.RichTextToolbarButton,{name:"bold",icon:u,title:s,onClick:function(){l(),a()},isActive:t,shortcutType:"primary",shortcutCharacter:"b"}),Object(o.createElement)(i.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:l}))}},m=r(320),p=Object(a.__)("Inline code"),O={name:"core/code",title:p,tagName:"code",className:null,__unstableInputRule:function(e){var t=e,r=t.start,n=t.text;if("`"!==n.slice(r-1,r))return e;var o=n.slice(0,r-1).lastIndexOf("`");if(-1===o)return e;var a=o,i=r-2;return a===i?e:(e=Object(c.remove)(e,a,a+1),e=Object(c.remove)(e,i,i+1),e=Object(c.applyFormat)(e,{type:"core/code"},a,i))},edit:function(e){var t=e.value,r=e.onChange,n=e.onFocus,a=e.isActive;return Object(o.createElement)(i.RichTextToolbarButton,{icon:m.a,title:p,onClick:function(){r(Object(c.toggleFormat)(t,{type:"core/code"})),n()},isActive:a})}},f=r(5),v=r(11),j=r(3),h=r(220);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){Object(f.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var y=["image"],w=Object(a.__)("Inline image"),E={name:"core/image",title:w,keywords:[Object(a.__)("photo"),Object(a.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function(e){var t=e.value,r=e.onChange,n=e.onFocus,a=e.isObjectActive,l=e.activeObjectAttributes,u=e.contentRef,s=Object(o.useState)(!1),b=Object(v.a)(s,2),m=b[0],p=b[1];function O(){p(!1)}return Object(o.createElement)(i.MediaUploadCheck,null,Object(o.createElement)(i.RichTextToolbarButton,{icon:Object(o.createElement)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(j.Path,{d:"M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z"})),title:w,onClick:function(){p(!0)},isActive:a}),m&&Object(o.createElement)(i.MediaUpload,{allowedTypes:y,onSelect:function(e){var o=e.id,a=e.url,i=e.alt,l=e.width;O(),r(Object(c.insertObject)(t,{type:"core/image",attributes:{className:"wp-image-".concat(o),style:"width: ".concat(Math.min(l,150),"px;"),url:a,alt:i}})),n()},onClose:O,render:function(e){return(0,e.open)(),null}}),a&&Object(o.createElement)(x,{value:t,onChange:r,activeObjectAttributes:l,contentRef:u}))}};function x(e){var t=e.value,r=e.onChange,n=e.activeObjectAttributes,i=e.contentRef,l=n.style,u=Object(o.useState)(null==l?void 0:l.replace(/\D/g,"")),s=Object(v.a)(u,2),b=s[0],m=s[1],p=Object(c.useAnchorRef)({ref:i,value:t,settings:E});return Object(o.createElement)(j.Popover,{position:"bottom center",focusOnMount:!1,anchorRef:p,className:"block-editor-format-toolbar__image-popover"},Object(o.createElement)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:function(e){var c=t.replacements.slice();c[t.start]={type:"core/image",attributes:g(g({},n),{},{style:"width: ".concat(b,"px;")})},r(g(g({},t),{},{replacements:c})),e.preventDefault()}},Object(o.createElement)(j.TextControl,{className:"block-editor-format-toolbar__image-container-value",type:"number",label:Object(a.__)("Width"),value:b,min:1,onChange:function(e){return m(e)}}),Object(o.createElement)(j.Button,{icon:h.a,label:Object(a.__)("Apply"),type:"submit"})))}var _=Object(o.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(l.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"})),k=Object(a.__)("Italic"),C={name:"core/italic",title:k,tagName:"em",className:null,edit:function(e){var t=e.isActive,r=e.value,n=e.onChange,a=e.onFocus;function l(){n(Object(c.toggleFormat)(r,{type:"core/italic"}))}return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.RichTextShortcut,{type:"primary",character:"i",onUse:l}),Object(o.createElement)(i.RichTextToolbarButton,{name:"italic",icon:_,title:k,onClick:function(){l(),a()},isActive:t,shortcutType:"primary",shortcutCharacter:"i"}),Object(o.createElement)(i.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:l}))}},P=r(32),S=r(64),T=r(223),A=r(192),F=r(48),R=r(2);function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){Object(f.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var V=Object(j.withSpokenMessages)((function(e){var t=e.isActive,r=e.activeAttributes,n=e.addingLink,l=e.value,u=e.onChange,s=e.speak,b=e.stopAddingLink,m=e.contentRef,p=Object(o.useState)(),O=Object(v.a)(p,2),f=O[0],h=O[1],d=M({url:r.url,type:r.type,id:r.id,opensInNewTab:"_blank"===r.target},f),g=Object(c.useAnchorRef)({ref:m,value:l,settings:B}),y=Object(o.useRef)(!!n&&"firstElement");return Object(o.createElement)(j.Popover,{anchorRef:g,focusOnMount:y.current,onClose:b,position:"bottom center"},Object(o.createElement)(i.__experimentalLinkControl,{value:d,onChange:function(e){e=M(M({},f),e);var r=d.opensInNewTab!==e.opensInNewTab&&d.url===e.url,n=r&&void 0===e.url;if(h(n?e:void 0),!n){var o=Object(P.prependHTTP)(e.url),i=function(e){var t=e.url,r=e.type,n=e.id,c=e.opensInNewWindow,o={type:"core/link",attributes:{url:t}};return r&&(o.attributes.type=r),n&&(o.attributes.id=n),c&&(o.attributes.target="_blank",o.attributes.rel="noreferrer noopener"),o}({url:o,type:e.type,id:void 0!==e.id&&null!==e.id?String(e.id):void 0,opensInNewWindow:e.opensInNewTab});if(Object(c.isCollapsed)(l)&&!t){var m=e.title||o,p=Object(c.applyFormat)(Object(c.create)({text:m}),i,0,m.length);u(Object(c.insert)(l,p))}else{var O=Object(c.applyFormat)(l,i);O.start=O.end,O.activeFormats=[],u(O)}r||b(),!function(e){if(!e)return!1;var t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){var r=Object(P.getProtocol)(t);if(!Object(P.isValidProtocol)(r))return!1;if(Object(R.startsWith)(r,"http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;var n=Object(P.getAuthority)(t);if(!Object(P.isValidAuthority)(n))return!1;var c=Object(P.getPath)(t);if(c&&!Object(P.isValidPath)(c))return!1;var o=Object(P.getQueryString)(t);if(o&&!Object(P.isValidQueryString)(o))return!1;var a=Object(P.getFragment)(t);if(a&&!Object(P.isValidFragment)(a))return!1}return!(Object(R.startsWith)(t,"#")&&!Object(P.isValidFragment)(t))}(o)?s(Object(a.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive"):s(t?Object(a.__)("Link edited."):Object(a.__)("Link inserted."),"assertive")}},forceIsEditingLink:n}))})),z=Object(a.__)("Link");var B={name:"core/link",title:z,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",target:"target"},__unstablePasteRule:function(e,t){var r=t.html,n=t.plainText;if(Object(c.isCollapsed)(e))return e;var o=(r||n).replace(/<[^>]+>/g,"").trim();return Object(P.isURL)(o)?(window.console.log("Created link:\n\n",o),Object(c.applyFormat)(e,{type:"core/link",attributes:{url:Object(S.decodeEntities)(o)}})):e},edit:function(e){var t=e.isActive,r=e.activeAttributes,n=e.value,l=e.onChange,u=e.onFocus,s=e.contentRef,b=Object(o.useState)(!1),m=Object(v.a)(b,2),p=m[0],O=m[1];function f(){var e=Object(c.getTextContent)(Object(c.slice)(n));e&&Object(P.isURL)(e)?l(Object(c.applyFormat)(n,{type:"core/link",attributes:{url:e}})):e&&Object(P.isEmail)(e)?l(Object(c.applyFormat)(n,{type:"core/link",attributes:{url:"mailto:".concat(e)}})):O(!0)}function j(){l(Object(c.removeFormat)(n,"core/link")),Object(F.speak)(Object(a.__)("Link removed."),"assertive")}return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.RichTextShortcut,{type:"primary",character:"k",onUse:f}),Object(o.createElement)(i.RichTextShortcut,{type:"primaryShift",character:"k",onUse:j}),t&&Object(o.createElement)(i.RichTextToolbarButton,{name:"link",icon:T.a,title:Object(a.__)("Unlink"),onClick:j,isActive:t,shortcutType:"primaryShift",shortcutCharacter:"k"}),!t&&Object(o.createElement)(i.RichTextToolbarButton,{name:"link",icon:A.a,title:z,onClick:f,isActive:t,shortcutType:"primary",shortcutCharacter:"k"}),(p||t)&&Object(o.createElement)(V,{addingLink:p,stopAddingLink:function(){O(!1),u()},isActive:t,activeAttributes:r,value:n,onChange:l,contentRef:s}))}},H=r(305),L=Object(a.__)("Strikethrough"),I={name:"core/strikethrough",title:L,tagName:"s",className:null,edit:function(e){var t=e.isActive,r=e.value,n=e.onChange,a=e.onFocus;return Object(o.createElement)(i.RichTextToolbarButton,{icon:H.a,title:L,onClick:function(){n(Object(c.toggleFormat)(r,{type:"core/strikethrough"})),a()},isActive:t})}},U={name:"core/underline",title:Object(a.__)("Underline"),tagName:"span",className:null,attributes:{style:"style"},edit:function(e){var t=e.value,r=e.onChange,n=function(){r(Object(c.toggleFormat)(t,{type:"core/underline",attributes:{style:"text-decoration: underline;"}}))};return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.RichTextShortcut,{type:"primary",character:"u",onUse:n}),Object(o.createElement)(i.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:n}))}},D=r(138),G=r(222),W=r(4);function Q(e,t,r){var n=Object(c.getActiveFormat)(t,e);if(n){var o=n.attributes.style;if(o)return o.replace(new RegExp("^color:\\s*"),"");var a=n.attributes.class;if(a){var l=a.replace(/.*has-([^\s]*)-color.*/,"$1");return Object(i.getColorObjectByAttributeValues)(r,l).color}}}var $=function(e){var t=e.name,r=e.value,n=e.onChange,a=Object(W.useSelect)((function(e){var t=e("core/block-editor").getSettings;return Object(R.get)(t(),["colors"],[])})),l=Object(o.useCallback)((function(e){if(e){var o=Object(i.getColorObjectByColorValue)(a,e);n(Object(c.applyFormat)(r,{type:t,attributes:o?{class:Object(i.getColorClassName)("color",o.slug)}:{style:"color:".concat(e)}}))}else n(Object(c.removeFormat)(r,t))}),[a,n]),u=Object(o.useMemo)((function(){return Q(t,r,a)}),[t,r,a]);return Object(o.createElement)(i.ColorPalette,{value:u,onChange:l})};function K(e){var t=e.name,r=e.value,n=e.onChange,a=e.onClose,l=e.contentRef,u=Object(c.useAnchorRef)({ref:l,value:r,settings:X});return Object(o.createElement)(i.URLPopover,{value:r,onClose:a,className:"components-inline-color-popover",anchorRef:u},Object(o.createElement)($,{name:t,value:r,onChange:n}))}var q=Object(a.__)("Text color"),J=[];var X={name:"core/text-color",title:q,tagName:"span",className:"has-inline-color",attributes:{style:"style",class:"class"},edit:function(e){var t=e.value,r=e.onChange,n=e.isActive,a=e.activeAttributes,l=e.contentRef,u=Object(i.__experimentalUseEditorFeature)("color.custom"),s=Object(i.__experimentalUseEditorFeature)("color.palette")||J,b=Object(o.useState)(!1),m=Object(v.a)(b,2),p=m[0],O=m[1],f=Object(o.useCallback)((function(){return O(!0)}),[O]),j=Object(o.useCallback)((function(){return O(!1)}),[O]),h=Object(o.useMemo)((function(){var e=Q("core/text-color",t,s);if(e)return{backgroundColor:e}}),[t,s]),d=!Object(R.isEmpty)(s)||!u;return d||n?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.RichTextToolbarButton,{key:n?"text-color":"text-color-not-active",className:"format-library-text-color-button",name:n?"text-color":void 0,icon:Object(o.createElement)(o.Fragment,null,Object(o.createElement)(D.a,{icon:G.a}),n&&Object(o.createElement)("span",{className:"format-library-text-color-button__indicator",style:h})),title:q,onClick:d?f:function(){return r(Object(c.removeFormat)(t,"core/text-color"))}}),p&&Object(o.createElement)(K,{name:"core/text-color",onClose:j,activeAttributes:a,value:t,onChange:function(){r.apply(void 0,arguments),j()},contentRef:l})):null}},Y=Object(o.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(l.Path,{d:"M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"})),Z=Object(a.__)("Subscript"),ee={name:"core/subscript",title:Z,tagName:"sub",className:null,edit:function(e){var t=e.isActive,r=e.value,n=e.onChange,a=e.onFocus;return Object(o.createElement)(i.RichTextToolbarButton,{icon:Y,title:Z,onClick:function(){n(Object(c.toggleFormat)(r,{type:"core/subscript"})),a()},isActive:t})}},te=Object(o.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(l.Path,{d:"M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"})),re=Object(a.__)("Superscript"),ne={name:"core/superscript",title:re,tagName:"sup",className:null,edit:function(e){var t=e.isActive,r=e.value,n=e.onChange,a=e.onFocus;return Object(o.createElement)(i.RichTextToolbarButton,{icon:te,title:re,onClick:function(){n(Object(c.toggleFormat)(r,{type:"core/superscript"})),a()},isActive:t})}},ce=r(319),oe=Object(a.__)("Keyboard input");[b,O,E,C,B,I,U,X,ee,ne,{name:"core/keyboard",title:oe,tagName:"kbd",className:null,edit:function(e){var t=e.isActive,r=e.value,n=e.onChange,a=e.onFocus;return Object(o.createElement)(i.RichTextToolbarButton,{icon:ce.a,title:oe,onClick:function(){n(Object(c.toggleFormat)(r,{type:"core/keyboard"})),a()},isActive:t})}}].forEach((function(e){var t=e.name,r=Object(n.a)(e,["name"]);return Object(c.registerFormatType)(t,r)}))},48:function(e,t){e.exports=window.wp.a11y},5:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return n}))},6:function(e,t){e.exports=window.wp.blockEditor},64:function(e,t){e.exports=window.wp.htmlEntities},7:function(e,t){e.exports=window.wp.primitives}});