File "index.min.js"

Full Path: /home/pumpbmko/public_html/wp-content/plugins/gutenberg/build/format-library/index.min.js
File size: 22.24 KB
MIME-type: text/plain
Charset: utf-8

(()=>{"use strict";var t={};(t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})(t);const e=window.wp.richText,n=window.wp.i18n,o=window.wp.blockEditor,r=window.wp.primitives,i=window.ReactJSXRuntime,a=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),l="core/bold",s=(0,n.__)("Bold"),c={name:l,title:s,tagName:"strong",className:null,edit({isActive:t,value:n,onChange:r,onFocus:c}){function u(){r((0,e.toggleFormat)(n,{type:l,title:s}))}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextShortcut,{type:"primary",character:"b",onUse:u}),(0,i.jsx)(o.RichTextToolbarButton,{name:"bold",icon:a,title:s,onClick:function(){r((0,e.toggleFormat)(n,{type:l})),c()},isActive:t,shortcutType:"primary",shortcutCharacter:"b"}),(0,i.jsx)(o.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:u})]})}},u=(0,i.jsx)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)(r.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"})}),h="core/code",m=(0,n.__)("Inline code"),p={name:h,title:m,tagName:"code",className:null,__unstableInputRule(t){const{start:n,text:o}=t;if("`"!==o[n-1])return t;if(n-2<0)return t;const r=o.lastIndexOf("`",n-2);if(-1===r)return t;const i=r,a=n-2;return i===a?t:(t=(0,e.remove)(t,i,i+1),t=(0,e.remove)(t,a,a+1),t=(0,e.applyFormat)(t,{type:h},i,a))},edit({value:t,onChange:n,onFocus:r,isActive:a}){function l(){n((0,e.toggleFormat)(t,{type:h,title:m})),r()}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextShortcut,{type:"access",character:"x",onUse:l}),(0,i.jsx)(o.RichTextToolbarButton,{icon:u,title:m,onClick:l,isActive:a,role:"menuitemcheckbox"})]})}},d=window.wp.components,g=window.wp.element,x=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)(r.Path,{d:"m6.734 16.106 2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.158 1.093-1.028-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"})}),v=["image"],b="core/image",f=(0,n.__)("Inline image"),w={name:b,title:f,keywords:[(0,n.__)("photo"),(0,n.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function({value:t,onChange:n,onFocus:r,isObjectActive:a,activeObjectAttributes:l,contentRef:s}){return(0,i.jsxs)(o.MediaUploadCheck,{children:[(0,i.jsx)(o.MediaUpload,{allowedTypes:v,onSelect:({id:o,url:i,alt:a,width:l})=>{n((0,e.insertObject)(t,{type:b,attributes:{className:`wp-image-${o}`,style:`width: ${Math.min(l,150)}px;`,url:i,alt:a}})),r()},render:({open:t})=>(0,i.jsx)(o.RichTextToolbarButton,{icon:(0,i.jsx)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(d.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:f,onClick:t,isActive:a})}),a&&(0,i.jsx)(y,{value:t,onChange:n,activeObjectAttributes:l,contentRef:s})]})}};function y({value:t,onChange:o,activeObjectAttributes:r,contentRef:a}){const{style:l}=r,[s,c]=(0,g.useState)(l?.replace(/\D/g,"")),u=(0,e.useAnchor)({editableContentElement:a.current,settings:w});return(0,i.jsx)(d.Popover,{placement:"bottom",focusOnMount:!1,anchor:u,className:"block-editor-format-toolbar__image-popover",children:(0,i.jsx)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:e=>{const n=t.replacements.slice();n[t.start]={type:b,attributes:{...r,style:s?`width: ${s}px;`:""}},o({...t,replacements:n}),e.preventDefault()},children:(0,i.jsxs)(d.__experimentalHStack,{alignment:"bottom",spacing:"0",children:[(0,i.jsx)(d.__experimentalNumberControl,{className:"block-editor-format-toolbar__image-container-value",label:(0,n.__)("Width"),value:s,min:1,onChange:t=>c(t)}),(0,i.jsx)(d.Button,{className:"block-editor-format-toolbar__image-container-button",icon:x,label:(0,n.__)("Apply"),type:"submit"})]})})})}const _=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"})}),j="core/italic",k=(0,n.__)("Italic"),C={name:j,title:k,tagName:"em",className:null,edit({isActive:t,value:n,onChange:r,onFocus:a}){function l(){r((0,e.toggleFormat)(n,{type:j,title:k}))}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextShortcut,{type:"primary",character:"i",onUse:l}),(0,i.jsx)(o.RichTextToolbarButton,{name:"italic",icon:_,title:k,onClick:function(){r((0,e.toggleFormat)(n,{type:j})),a()},isActive:t,shortcutType:"primary",shortcutCharacter:"i"}),(0,i.jsx)(o.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:l})]})}},T=window.wp.url,S=window.wp.htmlEntities,A=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),F=window.wp.a11y,N=window.wp.data;function R(t){if(!t)return!1;const e=t.trim();if(!e)return!1;if(/^\S+:/.test(e)){const t=(0,T.getProtocol)(e);if(!(0,T.isValidProtocol)(t))return!1;if(t.startsWith("http")&&!/^https?:\/\/[^\/\s]/i.test(e))return!1;const n=(0,T.getAuthority)(e);if(!(0,T.isValidAuthority)(n))return!1;const o=(0,T.getPath)(e);if(o&&!(0,T.isValidPath)(o))return!1;const r=(0,T.getQueryString)(e);if(r&&!(0,T.isValidQueryString)(r))return!1;const i=(0,T.getFragment)(e);if(i&&!(0,T.isValidFragment)(i))return!1}return!(e.startsWith("#")&&!(0,T.isValidFragment)(e))}function V(t,e,n=t.start,o=t.end){const r={start:null,end:null},{formats:i}=t;let a,l;if(!i?.length)return r;const s=i.slice(),c=s[n]?.find((({type:t})=>t===e.type)),u=s[o]?.find((({type:t})=>t===e.type)),h=s[o-1]?.find((({type:t})=>t===e.type));if(c)a=c,l=n;else if(u)a=u,l=o;else{if(!h)return r;a=h,l=o-1}const m=s[l].indexOf(a),p=[s,l,a,m];return{start:n=(n=B(...p))<0?0:n,end:o=L(...p)}}function P(t,e,n,o,r){let i=e;const a={forwards:1,backwards:-1}[r]||1,l=-1*a;for(;t[i]&&t[i][o]===n;)i+=a;return i+=l,i}const M=(t,...e)=>(...n)=>t(...n,...e),B=M(P,"backwards"),L=M(P,"forwards"),z=[...o.__experimentalLinkControl.DEFAULT_LINK_SETTINGS,{id:"nofollow",title:(0,n.__)("Mark as nofollow")}],I=function({isActive:t,activeAttributes:r,value:a,onChange:l,onFocusOutside:s,stopAddingLink:c,contentRef:u,focusOnMount:h}){const m=function(t,n){let o=t.start,r=t.end;if(n){const e=V(t,{type:"core/link"});o=e.start,r=e.end+1}return(0,e.slice)(t,o,r)}(a,t).text,{selectionChange:p}=(0,N.useDispatch)(o.store),{createPageEntity:x,userCanCreatePages:v,selectionStart:b}=(0,N.useSelect)((t=>{const{getSettings:e,getSelectionStart:n}=t(o.store),r=e();return{createPageEntity:r.__experimentalCreatePageEntity,userCanCreatePages:r.__experimentalUserCanCreatePages,selectionStart:n()}}),[]),f=(0,g.useMemo)((()=>({url:r.url,type:r.type,id:r.id,opensInNewTab:"_blank"===r.target,nofollow:r.rel?.includes("nofollow"),title:m})),[r.id,r.rel,r.target,r.type,r.url,m]),w=(0,e.useAnchor)({editableContentElement:u.current,settings:{...O,isActive:t}});return(0,i.jsx)(d.Popover,{anchor:w,animate:!1,onClose:c,onFocusOutside:s,placement:"bottom",offset:8,shift:!0,focusOnMount:h,constrainTabbing:!0,children:(0,i.jsx)(o.__experimentalLinkControl,{value:f,onChange:function(o){const r=f?.url,i=!r;o={...f,...o};const s=(0,T.prependHTTP)(o.url),u=function({url:t,type:e,id:n,opensInNewWindow:o,nofollow:r}){const i={type:"core/link",attributes:{url:t}};return e&&(i.attributes.type=e),n&&(i.attributes.id=n),o&&(i.attributes.target="_blank",i.attributes.rel=i.attributes.rel?i.attributes.rel+" noreferrer noopener":"noreferrer noopener"),r&&(i.attributes.rel=i.attributes.rel?i.attributes.rel+" nofollow":"nofollow"),i}({url:s,type:o.type,id:void 0!==o.id&&null!==o.id?String(o.id):void 0,opensInNewWindow:o.opensInNewTab,nofollow:o.nofollow}),h=o.title||s;let d;if((0,e.isCollapsed)(a)&&!t){const t=(0,e.insert)(a,h);return d=(0,e.applyFormat)(t,u,a.start,a.start+h.length),l(d),c(),void p({clientId:b.clientId,identifier:b.attributeKey,start:a.start+h.length+1})}if(h===m)d=(0,e.applyFormat)(a,u);else{d=(0,e.create)({text:h}),d=(0,e.applyFormat)(d,u,0,h.length);const t=V(a,{type:"core/link"}),[n,o]=(0,e.split)(a,t.start,t.start),r=(0,e.replace)(o,m,d);d=(0,e.concat)(n,r)}l(d),i||c(),R(s)?t?(0,F.speak)((0,n.__)("Link edited."),"assertive"):(0,F.speak)((0,n.__)("Link inserted."),"assertive"):(0,F.speak)((0,n.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")},onRemove:function(){const t=(0,e.removeFormat)(a,"core/link");l(t),c(),(0,F.speak)((0,n.__)("Link removed."),"assertive")},hasRichPreviews:!0,createSuggestion:x&&async function(t){const e=await x({title:t,status:"draft"});return{id:e.id,type:e.type,title:e.title.rendered,url:e.link,kind:"post-type"}},withCreateSuggestion:v,createSuggestionButtonText:function(t){return(0,g.createInterpolateElement)((0,n.sprintf)(/* translators: %s: search term. */ /* translators: %s: search term. */
(0,n.__)("Create page: <mark>%s</mark>"),t),{mark:(0,i.jsx)("mark",{})})},hasTextControl:!0,settings:z,showInitialSuggestions:!0,suggestionsQuery:{initialSuggestionsSearchOptions:{type:"post",subtype:"page",perPage:20}}})})},E="core/link",H=(0,n.__)("Link"),O={name:E,title:H,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",_id:"id",target:"target",rel:"rel"},__unstablePasteRule(t,{html:n,plainText:o}){const r=(n||o).replace(/<[^>]+>/g,"").trim();if(!(0,T.isURL)(r)||!/^https?:/.test(r))return t;window.console.log("Created link:\n\n",r);const i={type:E,attributes:{url:(0,S.decodeEntities)(r)}};return(0,e.isCollapsed)(t)?(0,e.insert)(t,(0,e.applyFormat)((0,e.create)({text:o}),i,0,o.length)):(0,e.applyFormat)(t,i)},edit:function({isActive:t,activeAttributes:r,value:a,onChange:l,onFocus:s,contentRef:c}){const[u,h]=(0,g.useState)(!1),[m,p]=(0,g.useState)(null);function d(n){const o=(0,e.getTextContent)((0,e.slice)(a));!t&&o&&(0,T.isURL)(o)&&R(o)?l((0,e.applyFormat)(a,{type:E,attributes:{url:o}})):!t&&o&&(0,T.isEmail)(o)?l((0,e.applyFormat)(a,{type:E,attributes:{url:`mailto:${o}`}})):(n&&p({el:n,action:null}),h(!0))}(0,g.useEffect)((()=>{t||h(!1)}),[t]),(0,g.useLayoutEffect)((()=>{const e=c.current;if(e)return e.addEventListener("click",n),()=>{e.removeEventListener("click",n)};function n(e){const n=e.target.closest("[contenteditable] a");n&&t&&(h(!0),p({el:n,action:"click"}))}}),[c,t]);const x=!("A"===m?.el?.tagName&&"click"===m?.action);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextShortcut,{type:"primary",character:"k",onUse:d}),(0,i.jsx)(o.RichTextShortcut,{type:"primaryShift",character:"k",onUse:function(){l((0,e.removeFormat)(a,E)),(0,F.speak)((0,n.__)("Link removed."),"assertive")}}),(0,i.jsx)(o.RichTextToolbarButton,{name:"link",icon:A,title:t?(0,n.__)("Link"):H,onClick:t=>{d(t.currentTarget)},isActive:t||u,shortcutType:"primary",shortcutCharacter:"k","aria-haspopup":"true","aria-expanded":u}),u&&(0,i.jsx)(I,{stopAddingLink:function(){h(!1),"BUTTON"===m?.el?.tagName?m.el.focus():s(),p(null)},onFocusOutside:function(){h(!1),p(null)},isActive:t,activeAttributes:r,value:a,onChange:l,contentRef:c,focusOnMount:!!x&&"firstElement"})]})}},U=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),G="core/strikethrough",W=(0,n.__)("Strikethrough"),Z={name:G,title:W,tagName:"s",className:null,edit({isActive:t,value:n,onChange:r,onFocus:a}){function l(){r((0,e.toggleFormat)(n,{type:G,title:W})),a()}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextShortcut,{type:"access",character:"d",onUse:l}),(0,i.jsx)(o.RichTextToolbarButton,{icon:U,title:W,onClick:l,isActive:t,role:"menuitemcheckbox"})]})}},D="core/underline",$=(0,n.__)("Underline"),K={name:D,title:$,tagName:"span",className:null,attributes:{style:"style"},edit({value:t,onChange:n}){const r=()=>{n((0,e.toggleFormat)(t,{type:D,attributes:{style:"text-decoration: underline;"},title:$}))};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextShortcut,{type:"primary",character:"u",onUse:r}),(0,i.jsx)(o.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:r})]})}},Q=(0,g.forwardRef)((function({icon:t,size:e=24,...n},o){return(0,g.cloneElement)(t,{width:e,height:e,...n,ref:o})})),J=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),X=(0,i.jsx)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)(r.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"})}),q=window.wp.privateApis,{lock:Y,unlock:tt}=(0,q.__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:et}=tt(d.privateApis),nt=[{name:"color",title:(0,n.__)("Text")},{name:"backgroundColor",title:(0,n.__)("Background")}];function ot(t=""){return t.split(";").reduce(((t,e)=>{if(e){const[n,o]=e.split(":");"color"===n&&(t.color=o),"background-color"===n&&o!==st&&(t.backgroundColor=o)}return t}),{})}function rt(t="",e){return t.split(" ").reduce(((t,n)=>{if(n.startsWith("has-")&&n.endsWith("-color")){const r=n.replace(/^has-/,"").replace(/-color$/,""),i=(0,o.getColorObjectByAttributeValues)(e,r);t.color=i.color}return t}),{})}function it(t,n,o){const r=(0,e.getActiveFormat)(t,n);return r?{...ot(r.attributes.style),...rt(r.attributes.class,o)}:{}}function at({name:t,property:n,value:r,onChange:a}){const l=(0,N.useSelect)((t=>{var e;const{getSettings:n}=t(o.store);return null!==(e=n().colors)&&void 0!==e?e:[]}),[]),s=(0,g.useMemo)((()=>it(r,t,l)),[t,r,l]);return(0,i.jsx)(o.ColorPalette,{value:s[n],onChange:i=>{a(function(t,n,r,i){const{color:a,backgroundColor:l}={...it(t,n,r),...i};if(!a&&!l)return(0,e.removeFormat)(t,n);const s=[],c=[],u={};if(l?s.push(["background-color",l].join(":")):s.push(["background-color",st].join(":")),a){const t=(0,o.getColorObjectByColorValue)(r,a);t?c.push((0,o.getColorClassName)("color",t.slug)):s.push(["color",a].join(":"))}return s.length&&(u.style=s.join(";")),c.length&&(u.class=c.join(" ")),(0,e.applyFormat)(t,{type:n,attributes:u})}(r,t,l,{[n]:i}))}})}function lt({name:t,value:n,onChange:o,onClose:r,contentRef:a,isActive:l}){const s=(0,e.useAnchor)({editableContentElement:a.current,settings:{...pt,isActive:l}});return(0,i.jsx)(d.Popover,{onClose:r,className:"format-library__inline-color-popover",anchor:s,children:(0,i.jsxs)(et,{children:[(0,i.jsx)(et.TabList,{children:nt.map((t=>(0,i.jsx)(et.Tab,{tabId:t.name,children:t.title},t.name)))}),nt.map((e=>(0,i.jsx)(et.TabPanel,{tabId:e.name,focusable:!1,children:(0,i.jsx)(at,{name:t,property:e.name,value:n,onChange:o})},e.name)))]})})}const st="rgba(0, 0, 0, 0)",ct="core/text-color",ut=(0,n.__)("Highlight"),ht=[];function mt(t,e){const{ownerDocument:n}=t,{defaultView:o}=n,r=o.getComputedStyle(t).getPropertyValue(e);return"background-color"===e&&r===st&&t.parentElement?mt(t.parentElement,e):r}const pt={name:ct,title:ut,tagName:"mark",className:"has-inline-color",attributes:{style:"style",class:"class"},edit:function({value:t,onChange:n,isActive:r,activeAttributes:a,contentRef:l}){const[s,c=ht]=(0,o.useSettings)("color.custom","color.palette"),[u,h]=(0,g.useState)(!1),m=(0,g.useMemo)((()=>function(t,{color:e,backgroundColor:n}){if(e||n)return{color:e||mt(t,"color"),backgroundColor:n===st?mt(t,"background-color"):n}}(l.current,it(t,ct,c))),[l,t,c]),p=c.length||!s;return p||r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextToolbarButton,{className:"format-library-text-color-button",isActive:r,icon:(0,i.jsx)(Q,{icon:Object.keys(a).length?J:X,style:m}),title:ut,onClick:p?()=>h(!0):()=>n((0,e.removeFormat)(t,ct)),role:"menuitemcheckbox"}),u&&(0,i.jsx)(lt,{name:ct,onClose:()=>h(!1),activeAttributes:a,value:t,onChange:n,contentRef:l,isActive:r})]}):null}},dt=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),gt="core/subscript",xt=(0,n.__)("Subscript"),vt={name:gt,title:xt,tagName:"sub",className:null,edit:({isActive:t,value:n,onChange:r,onFocus:a})=>(0,i.jsx)(o.RichTextToolbarButton,{icon:dt,title:xt,onClick:function(){r((0,e.toggleFormat)(n,{type:gt,title:xt})),a()},isActive:t,role:"menuitemcheckbox"})},bt=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),ft="core/superscript",wt=(0,n.__)("Superscript"),yt={name:ft,title:wt,tagName:"sup",className:null,edit:({isActive:t,value:n,onChange:r,onFocus:a})=>(0,i.jsx)(o.RichTextToolbarButton,{icon:bt,title:wt,onClick:function(){r((0,e.toggleFormat)(n,{type:ft,title:wt})),a()},isActive:t,role:"menuitemcheckbox"})},_t=(0,i.jsx)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)(r.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"})}),jt="core/keyboard",kt=(0,n.__)("Keyboard input"),Ct={name:jt,title:kt,tagName:"kbd",className:null,edit:({isActive:t,value:n,onChange:r,onFocus:a})=>(0,i.jsx)(o.RichTextToolbarButton,{icon:_t,title:kt,onClick:function(){r((0,e.toggleFormat)(n,{type:jt,title:kt})),a()},isActive:t,role:"menuitemcheckbox"})},Tt=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),St="core/unknown",At=(0,n.__)("Clear Unknown Formatting"),Ft={name:St,title:At,tagName:"*",className:null,edit:({isActive:t,value:n,onChange:r,onFocus:a})=>t||function(t){return!(0,e.isCollapsed)(t)&&(0,e.slice)(t).formats.some((t=>t.some((t=>t.type===St))))}(n)?(0,i.jsx)(o.RichTextToolbarButton,{name:"unknown",icon:Tt,title:At,onClick:function(){r((0,e.removeFormat)(n,St)),a()},isActive:!0}):null},Nt=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.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"})}),Rt="core/language",Vt=(0,n.__)("Language"),Pt={name:Rt,tagName:"bdo",className:null,edit:function({isActive:t,value:n,onChange:r,contentRef:a}){const[l,s]=(0,g.useState)(!1),c=()=>{s((t=>!t))};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.RichTextToolbarButton,{icon:Nt,label:Vt,title:Vt,onClick:()=>{t?r((0,e.removeFormat)(n,Rt)):c()},isActive:t,role:"menuitemcheckbox"}),l&&(0,i.jsx)(Mt,{value:n,onChange:r,onClose:c,contentRef:a})]})},title:Vt};function Mt({value:t,contentRef:o,onChange:r,onClose:a}){const l=(0,e.useAnchor)({editableContentElement:o.current,settings:Pt}),[s,c]=(0,g.useState)(""),[u,h]=(0,g.useState)("ltr");return(0,i.jsx)(d.Popover,{className:"block-editor-format-toolbar__language-popover",anchor:l,onClose:a,children:(0,i.jsxs)("form",{className:"block-editor-format-toolbar__language-container-content",onSubmit:n=>{n.preventDefault(),r((0,e.applyFormat)(t,{type:Rt,attributes:{lang:s,dir:u}})),a()},children:[(0,i.jsx)(d.TextControl,{label:Vt,value:s,onChange:t=>c(t),help:(0,n.__)('A valid language attribute, like "en" or "fr".')}),(0,i.jsx)(d.SelectControl,{label:(0,n.__)("Text direction"),value:u,options:[{label:(0,n.__)("Left to right"),value:"ltr"},{label:(0,n.__)("Right to left"),value:"rtl"}],onChange:t=>h(t)}),(0,i.jsx)(d.__experimentalHStack,{alignment:"right",children:(0,i.jsx)(d.Button,{variant:"primary",type:"submit",text:(0,n.__)("Apply")})})]})})}const Bt=(0,n.__)("Non breaking space");[c,p,w,C,O,Z,K,pt,vt,yt,Ct,Ft,Pt,{name:"core/non-breaking-space",title:Bt,tagName:"nbsp",className:null,edit:({value:t,onChange:n})=>(0,i.jsx)(o.RichTextShortcut,{type:"primaryShift",character:" ",onUse:function(){n((0,e.insert)(t," "))}})}].forEach((({name:t,...n})=>(0,e.registerFormatType)(t,n))),(window.wp=window.wp||{}).formatLibrary=t})();
//# sourceMappingURL=index.min.js.map