D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
tvinntxo
/
www
/
wp-includes
/
js
/
dist
/
Filename :
format-library.min.js
back
Copy
/*! This file is auto-generated */ (()=>{"use strict";var e,t,n={3533:e=>{e.exports=window.wp.latexToMathml}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);a.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var i=2&o&&n;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((e=>s[e]=()=>n[e]));return s.default=()=>n,a.d(r,s),r},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};const r=window.wp.richText,s=window.ReactJSXRuntime,i=window.wp.i18n,l=window.wp.blockEditor,c=window.wp.primitives;var u=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.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"})});const h="core/bold",p=(0,i.__)("Bold"),m={name:h,title:p,tagName:"strong",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function a(){n((0,r.toggleFormat)(t,{type:h,title:p}))}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"b",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{name:"bold",icon:u,title:p,onClick:function(){n((0,r.toggleFormat)(t,{type:h})),o()},isActive:e,shortcutType:"primary",shortcutCharacter:"b"}),(0,s.jsx)(l.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:a})]})}};var d=(0,s.jsx)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(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"})});const g="core/code",x=(0,i.__)("Inline code"),v={name:g,title:x,tagName:"code",className:null,__unstableInputRule(e){const{start:t,text:n}=e;if("`"!==n[t-1])return e;if(t-2<0)return e;const o=n.lastIndexOf("`",t-2);if(-1===o)return e;const a=o,s=t-2;return a===s?e:(e=(0,r.remove)(e,a,a+1),e=(0,r.remove)(e,s,s+1),e=(0,r.applyFormat)(e,{type:g},a,s))},edit({value:e,onChange:t,onFocus:n,isActive:o}){function a(){t((0,r.toggleFormat)(e,{type:g,title:x})),n()}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"access",character:"x",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{icon:d,title:x,onClick:a,isActive:o,role:"menuitemcheckbox"})]})}},f=window.wp.components,b=window.wp.element,_=["image"],w="core/image",y=(0,i.__)("Inline image");function j(e){if(!e?.className)return;const[,t]=e.className.match(/wp-image-(\d+)/)??[];return t?parseInt(t,10):void 0}const C={name:w,title:y,keywords:[(0,i.__)("photo"),(0,i.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function({value:e,onChange:t,onFocus:n,isObjectActive:o,activeObjectAttributes:a,contentRef:c}){return(0,s.jsxs)(l.MediaUploadCheck,{children:[(0,s.jsx)(l.MediaUpload,{allowedTypes:_,value:j(a),onSelect:({id:o,url:a,alt:s,width:i})=>{t((0,r.insertObject)(e,{type:w,attributes:{className:`wp-image-${o}`,style:`width: ${Math.min(i,150)}px;`,url:a,alt:s}})),n()},render:({open:e})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:(0,s.jsx)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(f.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:o?(0,i.__)("Replace image"):y,onClick:e,isActive:o})}),o&&(0,s.jsx)(k,{value:e,onChange:t,activeObjectAttributes:a,contentRef:c})]})}};function k({value:e,onChange:t,activeObjectAttributes:n,contentRef:o}){const{style:a,alt:l}=n,c=a?.replace(/\D/g,""),[u,h]=(0,b.useState)(c),[p,m]=(0,b.useState)(l),d=u!==c||p!==l,g=(0,r.useAnchor)({editableContentElement:o.current,settings:C});return(0,s.jsx)(f.Popover,{placement:"bottom",focusOnMount:!1,anchor:g,className:"block-editor-format-toolbar__image-popover",children:(0,s.jsx)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:o=>{const a=e.replacements.slice();a[e.start]={type:w,attributes:{...n,style:u?`width: ${u}px;`:"",alt:p}},t({...e,replacements:a}),o.preventDefault()},children:(0,s.jsxs)(f.__experimentalVStack,{spacing:4,children:[(0,s.jsx)(f.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,i.__)("Width"),value:u,min:1,onChange:e=>{h(e)}}),(0,s.jsx)(f.TextareaControl,{label:(0,i.__)("Alternative text"),__nextHasNoMarginBottom:!0,value:p,onChange:e=>{m(e)},help:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.ExternalLink,{href:(0,i.__)("https://www.w3.org/WAI/tutorials/images/decision-tree/"),children:(0,i.__)("Describe the purpose of the image.")}),(0,s.jsx)("br",{}),(0,i.__)("Leave empty if decorative.")]})}),(0,s.jsx)(f.__experimentalHStack,{justify:"right",children:(0,s.jsx)(f.Button,{disabled:!d,accessibleWhenDisabled:!0,variant:"primary",type:"submit",size:"compact",children:(0,i.__)("Apply")})})]})})})}var S=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"})});const T="core/italic",A=(0,i.__)("Italic"),N={name:T,title:A,tagName:"em",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function a(){n((0,r.toggleFormat)(t,{type:T,title:A}))}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"i",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{name:"italic",icon:S,title:A,onClick:function(){n((0,r.toggleFormat)(t,{type:T})),o()},isActive:e,shortcutType:"primary",shortcutCharacter:"i"}),(0,s.jsx)(l.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:a})]})}},F=window.wp.url,M=window.wp.htmlEntities;var R=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})});const V=window.wp.a11y,P=window.wp.data;function B(e){if(!e)return!1;const t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){const e=(0,F.getProtocol)(t);if(!(0,F.isValidProtocol)(e))return!1;if(e.startsWith("http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;const n=(0,F.getAuthority)(t);if(!(0,F.isValidAuthority)(n))return!1;const o=(0,F.getPath)(t);if(o&&!(0,F.isValidPath)(o))return!1;const a=(0,F.getQueryString)(t);if(a&&!(0,F.isValidQueryString)(a))return!1;const r=(0,F.getFragment)(t);if(r&&!(0,F.isValidFragment)(r))return!1}return!(t.startsWith("#")&&!(0,F.isValidFragment)(t))}function L(e,t,n=e.start,o=e.end){const a={start:null,end:null},{formats:r}=e;let s,i;if(!r?.length)return a;const l=r.slice(),c=l[n]?.find((({type:e})=>e===t.type)),u=l[o]?.find((({type:e})=>e===t.type)),h=l[o-1]?.find((({type:e})=>e===t.type));if(c)s=c,i=n;else if(u)s=u,i=o;else{if(!h)return a;s=h,i=o-1}const p=l[i].indexOf(s),m=[l,i,s,p];return{start:n=(n=H(...m))<0?0:n,end:o=z(...m)}}function O(e,t,n,o,a){let r=t;const s={forwards:1,backwards:-1}[a]||1,i=-1*s;for(;e[r]&&e[r][o]===n;)r+=s;return r+=i,r}const I=(e,...t)=>(...n)=>e(...n,...t),H=I(O,"backwards"),z=I(O,"forwards"),E=window.wp.compose,U=({setting:e,value:t,onChange:n})=>{const o=!!t&&t?.cssClasses?.length>0,[a,r]=(0,b.useState)(o),l=`css-classes-setting-${(0,E.useInstanceId)(U)}`,c=o=>{const a="string"==typeof o?o.replace(/,/g," ").replace(/\s+/g," ").trim():o;n({...t,[e.id]:a})};return(0,s.jsxs)("fieldset",{children:[(0,s.jsx)(f.VisuallyHidden,{as:"legend",children:e.title}),(0,s.jsxs)(f.__experimentalVStack,{spacing:3,children:[(0,s.jsx)(f.CheckboxControl,{__nextHasNoMarginBottom:!0,label:e.title,onChange:()=>{a?(o&&c(""),r(!1)):r(!0)},checked:a||o,"aria-expanded":a,"aria-controls":a?l:void 0}),a&&(0,s.jsx)("div",{id:l,children:(0,s.jsx)(f.__experimentalInputControl,{label:(0,i.__)("CSS classes"),value:t?.cssClasses,onChange:c,help:(0,i.__)("Separate multiple classes with spaces."),__unstableInputWidth:"100%",__next40pxDefaultSize:!0})})]})]})};var D=U;const G=[...l.LinkControl.DEFAULT_LINK_SETTINGS,{id:"nofollow",title:(0,i.__)("Mark as nofollow")},{id:"cssClasses",title:(0,i.__)("Additional CSS class(es)"),render:(e,t,n)=>(0,s.jsx)(D,{setting:e,value:t,onChange:n})}];var W=function({isActive:e,activeAttributes:t,value:n,onChange:o,onFocusOutside:a,stopAddingLink:c,contentRef:u,focusOnMount:h}){const p=function(e,t){let n=e.start,o=e.end;if(t){const t=L(e,{type:"core/link"});n=t.start,o=t.end+1}return(0,r.slice)(e,n,o)}(n,e).text,{selectionChange:m}=(0,P.useDispatch)(l.store),{createPageEntity:d,userCanCreatePages:g,selectionStart:x}=(0,P.useSelect)((e=>{const{getSettings:t,getSelectionStart:n}=e(l.store),o=t();return{createPageEntity:o.__experimentalCreatePageEntity,userCanCreatePages:o.__experimentalUserCanCreatePages,selectionStart:n()}}),[]),v=(0,b.useMemo)((()=>({url:t.url,type:t.type,id:t.id,opensInNewTab:"_blank"===t.target,nofollow:t.rel?.includes("nofollow"),title:p,cssClasses:t.class})),[t.class,t.id,t.rel,t.target,t.type,t.url,p]),_=(0,r.useAnchor)({editableContentElement:u.current,settings:{...K,isActive:e}});return(0,s.jsx)(f.Popover,{anchor:_,animate:!1,onClose:c,onFocusOutside:a,placement:"bottom",offset:8,shift:!0,focusOnMount:h,constrainTabbing:!0,children:(0,s.jsx)(l.LinkControl,{value:v,onChange:function(t){const a=v?.url,s=!a;t={...v,...t};const l=(0,F.prependHTTP)(t.url),u=function({url:e,type:t,id:n,opensInNewWindow:o,nofollow:a,cssClasses:r}){const s={type:"core/link",attributes:{url:e}};t&&(s.attributes.type=t),n&&(s.attributes.id=n),o&&(s.attributes.target="_blank",s.attributes.rel=s.attributes.rel?s.attributes.rel+" noreferrer noopener":"noreferrer noopener"),a&&(s.attributes.rel=s.attributes.rel?s.attributes.rel+" nofollow":"nofollow");const i=r?.trim();return i?.length&&(s.attributes.class=i),s}({url:l,type:t.type,id:void 0!==t.id&&null!==t.id?String(t.id):void 0,opensInNewWindow:t.opensInNewTab,nofollow:t.nofollow,cssClasses:t.cssClasses}),h=t.title||l;let d;if((0,r.isCollapsed)(n)&&!e){const e=(0,r.insert)(n,h);return d=(0,r.applyFormat)(e,u,n.start,n.start+h.length),o(d),c(),void m({clientId:x.clientId,identifier:x.attributeKey,start:n.start+h.length+1})}if(h===p)d=(0,r.applyFormat)(n,u);else{d=(0,r.create)({text:h}),d=(0,r.applyFormat)(d,u,0,h.length);const e=L(n,{type:"core/link"}),[t,o]=(0,r.split)(n,e.start,e.start),a=(0,r.replace)(o,p,d);d=(0,r.concat)(t,a)}o(d),s||c(),B(l)?e?(0,V.speak)((0,i.__)("Link edited."),"assertive"):(0,V.speak)((0,i.__)("Link inserted."),"assertive"):(0,V.speak)((0,i.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")},onRemove:function(){const e=(0,r.removeFormat)(n,"core/link");o(e),c(),(0,V.speak)((0,i.__)("Link removed."),"assertive")},hasRichPreviews:!0,createSuggestion:d&&async function(e){const t=await d({title:e,status:"draft"});return{id:t.id,type:t.type,title:t.title.rendered,url:t.link,kind:"post-type"}},withCreateSuggestion:g,createSuggestionButtonText:function(e){return(0,b.createInterpolateElement)((0,i.sprintf)((0,i.__)("Create page: <mark>%s</mark>"),e),{mark:(0,s.jsx)("mark",{})})},hasTextControl:!0,settings:G,showInitialSuggestions:!0,suggestionsQuery:{initialSuggestionsSearchOptions:{type:"post",subtype:"page",perPage:20}}})})};const Z="core/link",$=(0,i.__)("Link");const K={name:Z,title:$,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",_id:"id",target:"target",rel:"rel",class:"class"},__unstablePasteRule(e,{html:t,plainText:n}){const o=(t||n).replace(/<[^>]+>/g,"").trim();if(!(0,F.isURL)(o)||!/^https?:/.test(o))return e;window.console.log("Created link:\n\n",o);const a={type:Z,attributes:{url:(0,M.decodeEntities)(o)}};return(0,r.isCollapsed)(e)?(0,r.insert)(e,(0,r.applyFormat)((0,r.create)({text:n}),a,0,n.length)):(0,r.applyFormat)(e,a)},edit:function({isActive:e,activeAttributes:t,value:n,onChange:o,onFocus:a,contentRef:c}){const[u,h]=(0,b.useState)(!1),[p,m]=(0,b.useState)(null);function d(t){const a=(0,r.getTextContent)((0,r.slice)(n));!e&&a&&(0,F.isURL)(a)&&B(a)?o((0,r.applyFormat)(n,{type:Z,attributes:{url:a}})):!e&&a&&(0,F.isEmail)(a)?o((0,r.applyFormat)(n,{type:Z,attributes:{url:`mailto:${a}`}})):!e&&a&&(0,F.isPhoneNumber)(a)?o((0,r.applyFormat)(n,{type:Z,attributes:{url:`tel:${a.replace(/\D/g,"")}`}})):(t&&m({el:t,action:null}),h(!0))}(0,b.useEffect)((()=>{e||h(!1)}),[e]),(0,b.useLayoutEffect)((()=>{const t=c.current;if(t)return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)};function n(t){const n=t.target.closest("[contenteditable] a");n&&e&&(h(!0),m({el:n,action:"click"}))}}),[c,e]);const g=!("A"===p?.el?.tagName&&"click"===p?.action),x=!(0,r.isCollapsed)(n);return(0,s.jsxs)(s.Fragment,{children:[x&&(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"k",onUse:d}),(0,s.jsx)(l.RichTextShortcut,{type:"primaryShift",character:"k",onUse:function(){o((0,r.removeFormat)(n,Z)),(0,V.speak)((0,i.__)("Link removed."),"assertive")}}),(0,s.jsx)(l.RichTextToolbarButton,{name:"link",icon:R,title:e?(0,i.__)("Link"):$,onClick:e=>{d(e.currentTarget)},isActive:e||u,shortcutType:"primary",shortcutCharacter:"k","aria-haspopup":"true","aria-expanded":u}),u&&(0,s.jsx)(W,{stopAddingLink:function(){h(!1),"BUTTON"===p?.el?.tagName?p.el.focus():a(),m(null)},onFocusOutside:function(){h(!1),m(null)},isActive:e,activeAttributes:t,value:n,onChange:o,contentRef:c,focusOnMount:!!g&&"firstElement"})]})}};var Q=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(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"})});const X="core/strikethrough",J=(0,i.__)("Strikethrough"),q={name:X,title:J,tagName:"s",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){function a(){n((0,r.toggleFormat)(t,{type:X,title:J})),o()}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"access",character:"d",onUse:a}),(0,s.jsx)(l.RichTextToolbarButton,{icon:Q,title:J,onClick:a,isActive:e,role:"menuitemcheckbox"})]})}},Y="core/underline",ee=(0,i.__)("Underline"),te={name:Y,title:ee,tagName:"span",className:null,attributes:{style:"style"},edit({value:e,onChange:t}){const n=()=>{t((0,r.toggleFormat)(e,{type:Y,attributes:{style:"text-decoration: underline;"},title:ee}))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextShortcut,{type:"primary",character:"u",onUse:n}),(0,s.jsx)(l.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:n})]})}};var ne=(0,b.forwardRef)((({icon:e,size:t=24,...n},o)=>(0,b.cloneElement)(e,{width:t,height:t,...n,ref:o}))),oe=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"})}),ae=(0,s.jsx)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(c.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"})});const re=window.wp.privateApis,{lock:se,unlock:ie}=(0,re.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/format-library"),{Tabs:le}=ie(f.privateApis),ce=[{name:"color",title:(0,i.__)("Text")},{name:"backgroundColor",title:(0,i.__)("Background")}];function ue(e=""){return e.split(";").reduce(((e,t)=>{if(t){const[n,o]=t.split(":");"color"===n&&(e.color=o),"background-color"===n&&o!==ge&&(e.backgroundColor=o)}return e}),{})}function he(e="",t){return e.split(" ").reduce(((e,n)=>{if(n.startsWith("has-")&&n.endsWith("-color")){const o=n.replace(/^has-/,"").replace(/-color$/,""),a=(0,l.getColorObjectByAttributeValues)(t,o);e.color=a.color}return e}),{})}function pe(e,t,n){const o=(0,r.getActiveFormat)(e,t);return o?{...ue(o.attributes.style),...he(o.attributes.class,n)}:{}}function me({name:e,property:t,value:n,onChange:o}){const a=(0,P.useSelect)((e=>{const{getSettings:t}=e(l.store);return t().colors??[]}),[]),i=(0,b.useMemo)((()=>pe(n,e,a)),[e,n,a]);return(0,s.jsx)(l.ColorPalette,{value:i[t],onChange:s=>{o(function(e,t,n,o){const{color:a,backgroundColor:s}={...pe(e,t,n),...o};if(!a&&!s)return(0,r.removeFormat)(e,t);const i=[],c=[],u={};if(s?i.push(["background-color",s].join(":")):i.push(["background-color",ge].join(":")),a){const e=(0,l.getColorObjectByColorValue)(n,a);e?c.push((0,l.getColorClassName)("color",e.slug)):i.push(["color",a].join(":"))}return i.length&&(u.style=i.join(";")),c.length&&(u.class=c.join(" ")),(0,r.applyFormat)(e,{type:t,attributes:u})}(n,e,a,{[t]:s}))},enableAlpha:!0,__experimentalIsRenderedInSidebar:!0})}function de({name:e,value:t,onChange:n,onClose:o,contentRef:a,isActive:i}){const l=(0,r.useAnchor)({editableContentElement:a.current,settings:{..._e,isActive:i}});return(0,s.jsx)(f.Popover,{onClose:o,className:"format-library__inline-color-popover",anchor:l,children:(0,s.jsxs)(le,{children:[(0,s.jsx)(le.TabList,{children:ce.map((e=>(0,s.jsx)(le.Tab,{tabId:e.name,children:e.title},e.name)))}),ce.map((o=>(0,s.jsx)(le.TabPanel,{tabId:o.name,focusable:!1,children:(0,s.jsx)(me,{name:e,property:o.name,value:t,onChange:n})},o.name)))]})})}const ge="rgba(0, 0, 0, 0)",xe="core/text-color",ve=(0,i.__)("Highlight"),fe=[];function be(e,t){const{ownerDocument:n}=e,{defaultView:o}=n,a=o.getComputedStyle(e).getPropertyValue(t);return"background-color"===t&&a===ge&&e.parentElement?be(e.parentElement,t):a}const _e={name:xe,title:ve,tagName:"mark",className:"has-inline-color",attributes:{style:"style",class:"class"},edit:function({value:e,onChange:t,isActive:n,activeAttributes:o,contentRef:a}){const[i,c=fe]=(0,l.useSettings)("color.custom","color.palette"),[u,h]=(0,b.useState)(!1),p=(0,b.useMemo)((()=>function(e,{color:t,backgroundColor:n}){if(t||n)return{color:t||be(e,"color"),backgroundColor:n===ge?be(e,"background-color"):n}}(a.current,pe(e,xe,c))),[a,e,c]),m=!!c.length||i;return m||n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextToolbarButton,{className:"format-library-text-color-button",isActive:n,icon:(0,s.jsx)(ne,{icon:Object.keys(o).length?oe:ae,style:p}),title:ve,onClick:m?()=>h(!0):()=>t((0,r.removeFormat)(e,xe)),role:"menuitemcheckbox"}),u&&(0,s.jsx)(de,{name:xe,onClose:()=>h(!1),activeAttributes:o,value:e,onChange:t,contentRef:a,isActive:n})]}):null}};var we=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.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"})});const ye="core/subscript",je=(0,i.__)("Subscript"),Ce={name:ye,title:je,tagName:"sub",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:we,title:je,onClick:function(){n((0,r.toggleFormat)(t,{type:ye,title:je})),o()},isActive:e,role:"menuitemcheckbox"})};var ke=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.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"})});const Se="core/superscript",Te=(0,i.__)("Superscript"),Ae={name:Se,title:Te,tagName:"sup",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:ke,title:Te,onClick:function(){n((0,r.toggleFormat)(t,{type:Se,title:Te})),o()},isActive:e,role:"menuitemcheckbox"})};var Ne=(0,s.jsx)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(c.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})});const Fe="core/keyboard",Me=(0,i.__)("Keyboard input"),Re={name:Fe,title:Me,tagName:"kbd",className:null,edit:({isActive:e,value:t,onChange:n,onFocus:o})=>(0,s.jsx)(l.RichTextToolbarButton,{icon:Ne,title:Me,onClick:function(){n((0,r.toggleFormat)(t,{type:Fe,title:Me})),o()},isActive:e,role:"menuitemcheckbox"})};var Ve=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z"})});const Pe="core/unknown",Be=(0,i.__)("Clear Unknown Formatting");const Le={name:Pe,title:Be,tagName:"*",className:null,edit({isActive:e,value:t,onChange:n,onFocus:o}){if(!e&&!function(e){return!(0,r.isCollapsed)(e)&&(0,r.slice)(e).formats.some((e=>e.some((e=>e.type===Pe))))}(t))return null;return(0,s.jsx)(l.RichTextToolbarButton,{name:"unknown",icon:Ve,title:Be,onClick:function(){n((0,r.removeFormat)(t,Pe)),o()},isActive:!0})}};var Oe=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"})});const Ie="core/language",He=(0,i.__)("Language"),ze={name:Ie,tagName:"bdo",className:null,edit:function({isActive:e,value:t,onChange:n,contentRef:o}){const[a,i]=(0,b.useState)(!1),c=()=>{i((e=>!e))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextToolbarButton,{icon:Oe,label:He,title:He,onClick:()=>{e?n((0,r.removeFormat)(t,Ie)):c()},isActive:e,role:"menuitemcheckbox"}),a&&(0,s.jsx)(Ee,{value:t,onChange:n,onClose:c,contentRef:o})]})},title:He};function Ee({value:e,contentRef:t,onChange:n,onClose:o}){const a=(0,r.useAnchor)({editableContentElement:t.current,settings:ze}),[l,c]=(0,b.useState)(""),[u,h]=(0,b.useState)("ltr");return(0,s.jsx)(f.Popover,{className:"block-editor-format-toolbar__language-popover",anchor:a,onClose:o,children:(0,s.jsxs)(f.__experimentalVStack,{as:"form",spacing:4,className:"block-editor-format-toolbar__language-container-content",onSubmit:t=>{t.preventDefault(),n((0,r.applyFormat)(e,{type:Ie,attributes:{lang:l,dir:u}})),o()},children:[(0,s.jsx)(f.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:He,value:l,onChange:e=>c(e),help:(0,i.__)('A valid language attribute, like "en" or "fr".')}),(0,s.jsx)(f.SelectControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,i.__)("Text direction"),value:u,options:[{label:(0,i.__)("Left to right"),value:"ltr"},{label:(0,i.__)("Right to left"),value:"rtl"}],onChange:e=>h(e)}),(0,s.jsx)(f.__experimentalHStack,{alignment:"right",children:(0,s.jsx)(f.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",text:(0,i.__)("Apply")})})]})})}var Ue=(0,s.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(c.Path,{d:"M11.2 6.8c-.7 0-1.4.5-1.6 1.1l-2.8 7.5-1.2-1.8c-.1-.2-.4-.3-.6-.3H3v1.5h1.6l1.2 1.8c.6.9 1.9.7 2.2-.3l2.9-7.9s.1-.2.2-.2h7.8V6.7h-7.8Zm5.3 3.4-1.9 1.9-1.9-1.9-1.1 1.1 1.9 1.9-1.9 1.9 1.1 1.1 1.9-1.9 1.9 1.9 1.1-1.1-1.9-1.9 1.9-1.9-1.1-1.1Z"})});const{Badge:De}=ie(f.privateApis),Ge="core/math",We=(0,i.__)("Math");function Ze({value:e,onChange:t,activeAttributes:n,contentRef:o,latexToMathML:a}){const[l,c]=(0,b.useState)(n?.["data-latex"]||""),[u,h]=(0,b.useState)(null),p=(0,r.useAnchor)({editableContentElement:o.current,settings:$e});return(0,s.jsx)(f.Popover,{placement:"bottom-start",offset:8,focusOnMount:!1,anchor:p,className:"block-editor-format-toolbar__math-popover",children:(0,s.jsx)("div",{style:{minWidth:"300px",padding:"4px"},children:(0,s.jsxs)(f.__experimentalVStack,{spacing:1,children:[(0,s.jsx)(f.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,hideLabelFromVision:!0,label:(0,i.__)("LaTeX math syntax"),value:l,onChange:n=>{let o="";if(c(n),n)try{o=a(n,{displayMode:!1}),h(null)}catch(e){return h(e.message),void(0,V.speak)(e.message)}const r=e.replacements.slice();r[e.start]={type:Ge,attributes:{"data-latex":n},innerHTML:o},t({...e,replacements:r})},placeholder:(0,i.__)("e.g., x^2, \\frac{a}{b}"),autoComplete:"off",className:"block-editor-format-toolbar__math-input"}),u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(De,{intent:"error",className:"wp-block-math__error",children:u}),(0,s.jsx)("style",{children:".wp-block-math__error .components-badge__content{white-space:normal}"})]})]})})})}const $e={name:Ge,title:We,tagName:"math",className:null,attributes:{"data-latex":"data-latex"},contentEditable:!1,edit:function({value:e,onChange:t,onFocus:n,isObjectActive:o,activeObjectAttributes:i,contentRef:c}){const[u,h]=(0,b.useState)();return(0,b.useEffect)((()=>{Promise.resolve().then(a.t.bind(a,3533,23)).then((e=>{h((()=>e.default))}))}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.RichTextToolbarButton,{icon:Ue,title:We,onClick:()=>{const o=(0,r.insertObject)(e,{type:Ge,attributes:{"data-latex":""},innerHTML:""});o.start=o.end-1,t(o),n()},isActive:o}),o&&(0,s.jsx)(Ze,{value:e,onChange:t,activeAttributes:i,contentRef:c,latexToMathML:u})]})}},Ke=(0,i.__)("Non breaking space");[m,v,C,N,K,q,te,_e,Ce,Ae,Re,Le,ze,$e,{name:"core/non-breaking-space",title:Ke,tagName:"nbsp",className:null,edit:({value:e,onChange:t})=>(0,s.jsx)(l.RichTextShortcut,{type:"primaryShift",character:" ",onUse:function(){t((0,r.insert)(e," "))}})}].forEach((({name:e,...t})=>(0,r.registerFormatType)(e,t))),(window.wp=window.wp||{}).formatLibrary={}})();