Files

6 lines
40 KiB
JavaScript
Raw Permalink Normal View History

2026-08-29 21:22:26 -05:00
/*! This file is auto-generated */
"use strict";var wp;(wp||={}).richText=(()=>{var Cr=Object.create;var gt=Object.defineProperty;var Lr=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames;var _r=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ot=(e,t)=>{for(var r in t)gt(e,r,{get:t[r],enumerable:!0})},Zt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Rr(t))!Sr.call(e,o)&&o!==r&&gt(e,o,{get:()=>t[o],enumerable:!(n=Lr(t,o))||n.enumerable});return e};var b=(e,t,r)=>(r=e!=null?Cr(_r(e)):{},Zt(t||!e||!e.__esModule?gt(r,"default",{value:e,enumerable:!0}):r,e)),Or=e=>Zt(gt({},"__esModule",{value:!0}),e);var V=$((Rn,Yt)=>{Yt.exports=window.wp.data});var ne=$((Bn,re)=>{re.exports=window.wp.escapeHtml});var xe=$((jo,we)=>{we.exports=window.wp.a11y});var Fe=$((Uo,Te)=>{Te.exports=window.wp.i18n});var Le=$((Jo,Ce)=>{Ce.exports=window.wp.privateApis});var Y=$((Qo,Se)=>{Se.exports=window.wp.element});var Nt=$((Io,Oe)=>{Oe.exports=window.wp.compose});var qt=$((ti,De)=>{De.exports=window.wp.deprecated});var Xt=$((mi,Ze)=>{Ze.exports=window.wp.keycodes});var br=$((Ji,Er)=>{Er.exports=window.wp.dom});var Cn={};Ot(Cn,{RichTextData:()=>j,__experimentalRichText:()=>An,__unstableCreateElement:()=>B,__unstableToDom:()=>jt,__unstableUseRichText:()=>hr,applyFormat:()=>vt,concat:()=>fe,create:()=>C,getActiveFormat:()=>ot,getActiveFormats:()=>X,getActiveObject:()=>me,getTextContent:()=>nt,insert:()=>at,insertObject:()=>ge,isCollapsed:()=>Z,isEmpty:()=>le,join:()=>pe,privateApis:()=>Gt,registerFormatType:()=>de,remove:()=>wt,removeFormat:()=>st,replace:()=>he,slice:()=>xt,split:()=>ye,store:()=>F,toHTMLString:()=>G,toggleFormat:()=>Ne,unregisterFormatType:()=>Ae,useAnchor:()=>Tr,useAnchorRef:()=>vr});var yt=b(V(),1);var Qt=b(V(),1);function Dr(e={},t){switch(t.type){case"ADD_FORMAT_TYPES":return{...e,...t.formatTypes.reduce((r,n)=>({...r,[n.name]:n}),{})};case"REMOVE_FORMAT_TYPES":return Object.fromEntries(Object.entries(e).filter(([r])=>!t.names.includes(r)))}return e}var It=(0,Qt.combineReducers)({formatTypes:Dr});var Mt={};Ot(Mt,{getFormatType:()=>Mr,getFormatTypeForBareElement:()=>Hr,getFormatTypeForClassName:()=>kr,getFormatTypes:()=>Dt});var te=b(V(),1),Dt=(0,te.createSelector)(e=>Object.values(e.formatTypes),e=>[e.formatTypes]);function Mr(e,t){return e.formatTypes[t]}function Hr(e,t){let r=Dt(e);return r.find(({className:n,tagName:o})=>n===null&&t===o)||r.find(({className:n,tagName:o})=>n===null&&o==="*")}function kr(e,t){return Dt(e).find(({className:r})=>r===null?!1:` ${t} `.indexOf(` ${r} `)>=0)}var Ht={};Ot(Ht,{addFormatTypes:()=>Pr,removeFormatTypes:()=>$r});function Pr(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Array.isArray(e)?e:[e]}}function $r(e){return{type:"REMOVE_FORMAT_TYPES",names:Array.isArray(e)?e:[e]}}var Vr="core/rich-text",F=(0,yt.createReduxStore)(Vr,{reducer:It,selectors:Mt,actions:Ht});(0,yt.register)(F);function tt(e,t){if(e===t)return!0;if(!e||!t||e.type!==t.type)return!1;let r=e.attributes,n=t.attributes;if(r===n)return!0;if(!r||!n)return!1;let o=Object.keys(r),s=Object.keys(n);if(o.length!==s.length)return!1;let a=o.length;for(let i=0;i<a;i++){let c=o[i];if(r[c]!==n[c])return!1}return!0}function _(e){let t=e.formats.slice();return t.forEach((r,n)=>{let o=t[n-1];if(o){let s=r.slice();s.forEach((a,i)=>{let c=o[i];tt(a,c)&&(s[i]=c)}),t[n]=s}}),{...e,formats:t}}function ee(e,t,r){return e=e.slice(),e[t]=r,e}function vt(e,t,r=e.start,n=e.end){let{formats:o,activeFormats:s}=e,a=o.slice();if(r===n){let i=a[r]?.find(({type:c})=>c===t.type);if(i){let c=a[r].indexOf(i);for(;a[r]&&a[r][c]===i;)a[r]=ee(a[r],c,t),r--;for(n++;a[n]&&a[n][c]===i;)a[n]=ee(a[n],c,t),n++}}else{let i=1/0;for(let c=r;c<n;c++)if(a[c]){a[c]=a[c].filter(({type:f})=>f!==t.type);let u=a[c].length;u<i&&(i=u)}else a[c]=[],i=0;for(let c=r;c<n;c++)a[c].splice(i,0,t)}return _({...e,formats:a,activeFormats:[...s?.filter(({type:i})=>i!==t.type)||[],t]})}var Pt=b(V(),1);function B({implementation:e},t){return B.body||(B.body=e.createHTMLDocument("").body),B.body.innerHTML=t,B.body}var R
`),O=w[T],p=o(L);if(O&&O.forEach((D,P)=>{if(p&&q&&Br(O,q,P)){p=o(p);return}let{type:Q,tagName:I,attributes:St,unregisteredAttributes:ht}=D,Fr=l&&D===U,Nr=s(p),Ar=n(Nr,Et({type:Q,tagName:I,attributes:St,unregisteredAttributes:ht,boundaryClass:Fr,isEditableTree:l}));a(p)&&i(p).length===0&&c(p),p=n(Ar,"")}),T===0&&(f&&v===0&&f(L,p),m&&x===0&&m(L,p)),E===R){let D=d[T];if(!D)continue;let{type:P,attributes:Q,innerHTML:I}=D,St=kt(P);if(l&&P==="#comment")p=n(s(p),{type:"span",attributes:{contenteditable:"false","data-rich-text-comment":Q["data-rich-text-comment"]}}),n(n(p,{type:"span"}),Q["data-rich-text-comment"].trim());else if(!l&&P==="script")p=n(s(p),Et({type:"script",isEditableTree:l})),n(p,{html:decodeURIComponent(Q["data-rich-text-script"])});else if(St?.contentEditable===!1){if(I||l){if(p=s(p),l){let ht={contenteditable:"false","data-rich-text-bogus":!0};v===T&&x===T+1&&(ht["data-rich-text-format-boundary"]=!0),p=n(p,{type:"span",attributes:ht}),l&&T+1===h.length&&n(s(p),mt)}p=n(p,Et({...D,isEditableTree:l})),I&&n(p,{html:I})}}else p=n(s(p),Et({...D,object:!0,isEditableTree:l}));p=n(s(p),"")}else!t&&E===`
`?(p=n(s(p),{type:"br",attributes:l?{"data-rich-text-line-break":"true"}:void 0,object:!0}),p=n(s(p),"")):a(p)?u(p,E):p=n(s(p),E);f&&v===T+1&&f(L,p),m&&x===T+1&&m(L,p),A&&T===h.length&&(n(s(p),mt),y&&h.length===0&&n(s(p),{type:"span",attributes:{"data-rich-text-placeholder":y,style:"pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;"}})),q=O,W=E}return L}function G({value:e,preserveWhiteSpace:t}){let r=bt({value:e,preserveWhiteSpace:t,createEmpty:jr,append:qr,getLastChild:Ur,getParent:Kr,isText:zr,getText:Xr,remove:Gr,appendText:Wr});return se(r.children)}function jr(){return{}}function Ur({children:e}){return e&&e[e.length-1]}function qr(e,t){return typeof t=="string"&&(t={text:t}),t.parent=e,e.children=e.children||[],e.children.push(t),t}function Wr(e,t){e.text+=t}function Kr({parent:e}){return e}function zr({text:e}){return typeof e=="string"}function Xr({text:e}){return e}function Gr(e){let t=e.parent.children.indexOf(e);return t!==-1&&e.parent.children.splice(t,1),e}function Jr({type:e,attributes:t,object:r,children:n}){if(e==="#comment")return`<!--${t["data-rich-text-comment"]}-->`;let o="";for(let s in t)(0,rt.isValidAttributeName)(s)&&(o+=` ${s}="${(0,rt.escapeAttribute)(t[s])}"`);return r?`<${e}${o}>`:`<${e}${o}>${se(n)}</${e}>`}function se(e=[]){return e.map(t=>t.html!==void 0?t.html:t.text===void 0?Jr(t):(0,rt.escapeEditableHTML)(t.text)).join("")}function nt({text:e}){return e.replace(R,"")}function et(){return{formats:[],replacements:[],text:""}}function Zr({tagName:e,attributes:t}){let r;if(t&&t.class&&(r=(0,Pt.select)(F).getFormatTypeForClassName(t.class),r&&(t.class=` ${t.class} `.replace(` ${r.className} `," ").trim(),t.class||delete t.class)),r||(r=(0,Pt.select)(F).getFormatTypeForBareElement(e)),!r)return t?{type:e,attributes:t}:{type:e};if(r.__experimentalCreatePrepareEditableTree&&!r.__experimentalCreateOnChangeEditableValue)return null;if(!t)return{formatType:r,type:r.name,tagName:e};let n={},o={},s={...t};for(let a in r.attributes){let i=r.attributes[a];n[a]=s[i],delete s[i],typeof n[a]>"u"&&delete n[a]}for(let a in s)o[a]=t[a];return r.contentEditable===!1&&delete o.contenteditable,{formatType:r,type:r.name,tagName:e,attributes:n,unregisteredAttributes:o}}var j=class lt{#t;static empty(){return new lt}static fromPlainText(t){return new lt(C({text:t}))}static fromHTMLString(t){return new lt(C({html:t}))}static fromHTMLElement(t,r={}){let{preserveWhiteSpace:n=!1}=r,o=n?t:ce(t),s=new lt(C({element:o}));return Object.defineProperty(s,"originalHTML",{value:t.innerHTML}),s}constructor(t=et()){this.#t=t}toPlainText(){return nt(this.#t)}toHTMLString({preserveWhiteSpace:t}={}){return this.originalHTML||G({value:this.#t,preserveWhiteSpace:t})}valueOf(){return this.toHTMLString()}toString(){return this.toHTMLString()}toJSON(){return this.toHTMLString()}get length(){return this.text.length}get formats(){return this.#t.formats}get replacements(){return this.#t.replacements}get text(){return this.#t.text}};for(let e of Object.getOwnPropertyNames(String.prototype))j.prototype.hasOwnProperty(e)||Object.defineProperty(j.prototype,e,{value(...t){return this.toHTMLString()[e](...t)}});function C({element:e,text:t,html:r,range:n,__unstableIsEditableTree:o}={}){return r instanceof j?{text:r.text,formats:r.formats,replacements:r.replacements}:typeof t=="string"&&t.length>0?{formats:Array(t.length),replacements:Array(t.length),text:t}:(typeof r=="string"&&r.length>0&&(e=B(document,r)),typeof e!="object"?et():ue({element:e,range:n,isEditableTree:o}))}function J(e,t,r,n){if(!r)return;let{parentNode:o}=t,{startContainer:s,startOffset:a,endContainer:i,endOffset:c}=r,u=e.text.length;n.start!==void 0?e.start=u+n.start:t===s&&t.nodeType===t.TEXT_NODE?e.start=u+a:o===s&&t===s.childNodes[a]?e.start=u:o===s&&t===s.childNodes[a-1]?e.start=u+n.text.length:t===s&&(e.start=u),n.end!==void 0?e.end=u+n.end:t===i&&t.nodeType===t.TEXT_NODE?e.end=u+c:o===i&&t===i.childNodes[c-1]?e.end=u+n.text.length:o===i&&t===i.childNodes[c]?e.end=u:t===i&&(e.end=u+c)}function Yr(e,t,r){if(!t)retur
`}));continue}let u=Zr({tagName:c,attributes:Ir({element:i})});if(u?.formatType?.contentEditable===!1){delete u.formatType,J(n,i,t,et()),K(n,{formats:[,],replacements:[{...u,innerHTML:i.innerHTML}],text:R});continue}u&&delete u.formatType;let f=ue({element:i,range:t,isEditableTree:r});if(J(n,i,t,f),!u||i.getAttribute("data-rich-text-placeholder")||i.getAttribute("data-rich-text-bogus"))K(n,f);else if(f.text.length===0)u.attributes&&K(n,{formats:[,],replacements:[u],text:R});else{let m=function(l){if(m.formats===l)return m.newFormats;let y=l?[u,...l]:[u];return m.formats=l,m.newFormats=y,y};var s=m;m.newFormats=[u],K(n,{...f,formats:Array.from(f.formats,m)})}}return n}function Ir({element:e}){if(!e.hasAttributes())return;let t=e.attributes.length,r;for(let n=0;n<t;n++){let{name:o,value:s}=e.attributes[n];if(o.indexOf("data-rich-text-")===0)continue;let a=/^on/i.test(o)?"data-disable-rich-text-"+o:o;r=r||{},r[a]=s}return r}function K(e,t){return e.formats=e.formats.concat(t.formats),e.replacements=e.replacements.concat(t.replacements),e.text+=t.text,e}function fe(...e){return _(e.reduce(K,C()))}function ot(e,t){return X(e).find(({type:r})=>r===t)}function me({start:e,end:t,replacements:r,text:n}){if(!(e+1!==t||n[e]!==R))return r[e]}function Z({start:e,end:t}){if(!(e===void 0||t===void 0))return e===t}function le({text:e}){return e.length===0}function pe(e,t=""){return typeof t=="string"&&(t=C({text:t})),_(e.reduce((r,{formats:n,replacements:o,text:s})=>({formats:r.formats.concat(t.formats,n),replacements:r.replacements.concat(t.replacements,o),text:r.text+t.text+s})))}var it=b(V(),1);function de(e,t){if(t={name:e,...t},typeof t.name!="string"){window.console.error("Format names must be strings.");return}if(!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(t.name)){window.console.error("Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format");return}if((0,it.select)(F).getFormatType(t.name)){window.console.error('Format "'+t.name+'" is already registered.');return}if(typeof t.tagName!="string"||t.tagName===""){window.console.error("Format tag names must be a string.");return}if((typeof t.className!="string"||t.className==="")&&t.className!==null){window.console.error("Format class names must be a string, or null to handle bare elements.");return}if(!/^[_a-zA-Z]+[a-zA-Z0-9_-]*$/.test(t.className)){window.console.error("A class name must begin with a letter, followed by any number of hyphens, underscores, letters, or numbers.");return}if(t.className===null){let r=(0,it.select)(F).getFormatTypeForBareElement(t.tagName);if(r&&r.name!=="core/unknown"){window.console.error(`Format "${r.name}" is already registered to handle bare tag name "${t.tagName}".`);return}}else{let r=(0,it.select)(F).getFormatTypeForClassName(t.className);if(r){window.console.error(`Format "${r.name}" is already registered to handle class name "${t.className}".`);return}}if(!("title"in t)||t.title===""){window.console.error('The format "'+t.name+'" must have a title.');return}if("keywords"in t&&t.keywords.length>3){window.console.error('The format "'+t.name+'" can have a maximum of 3 keywords.');return}if(typeof t.title!="string"){window.console.error("Format titles must be strings.");return}return(0,it.dispatch)(F).addFormatTypes(t),t}function st(e,t,r=e.start,n=e.end){let{formats:o,activeFormats:s}=e,a=o.slice();if(r===n){let i=a[r]?.find(({type:c})=>c===t);if(i){for(;a[r]?.find(c=>c===i);)$t(a,r,t),r--;for(n++;a[n]?.find(c=>c===i);)$t(a,n,t),n++}}else for(let i=r;i<n;i++)a[i]&&$t(a,i,t);return _({...e,formats:a,activeFormats:s?.filter(({type:i})=>i!==t)||[]})}function $t(e,t,r){let n=e[t].filter(({type:o})=>o!==r);n.length?e[t]=n:delete e[t]}function at(e,t,r=e.start,n=e.end){let{formats:o,replacements:s,text:a}=e;typeof t=="string"&&(t=C({text:t}));let i=r+t.text.length;return _({formats:o.slice(0,r).concat(t.formats,o.slice(n)),replacements:s.slice(0,r).concat(t.replacements,s.slice(n)),text:a.slice(0,r)+t.text+a.slice(n),start:i,end:i})}function wt