10 lines
55 KiB
JavaScript

/* !
* Tiny Accessibility Checker Plugin
*
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 8.3.0-112
*/
!function(){"use strict";const e=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=n=e,(o=String).prototype.isPrototypeOf(r)||n.constructor?.name===o.name)?"string":t;var r,n,o})(t)===e,t=e=>t=>typeof t===e,r=e("string"),n=e("object"),o=e("array"),a=t("boolean"),i=e=>undefined===e;const s=e=>null==e,l=e=>!s(e),c=t("function"),d=t("number"),u=()=>{},p=e=>()=>e,m=e=>e;function h(e,...t){return(...r)=>{const n=t.concat(r);return e.apply(null,n)}}const g=e=>e(),y=p(!1),v=p(!0);class f{tag;value;static singletonNone=new f(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new f(!0,e)}static none(){return f.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?f.some(e(this.value)):f.none()}bind(e){return this.tag?e(this.value):f.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:f.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return l(e)?f.some(e):f.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}const w=Array.prototype.slice,b=Array.prototype.indexOf,x=Array.prototype.push,k=(e,t)=>((e,t)=>b.call(e,t))(e,t)>-1,C=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(t(e[r],r))return!0;return!1},S=(e,t)=>{const r=e.length,n=new Array(r);for(let o=0;o<r;o++){const r=e[o];n[o]=t(r,o)}return n},A=(e,t)=>{for(let r=0,n=e.length;r<n;r++)t(e[r],r)},T=(e,t)=>{const r=[];for(let n=0,o=e.length;n<o;n++){const o=e[n];t(o,n)&&r.push(o)}return r},D=(e,t,r)=>(A(e,((e,n)=>{r=t(r,e,n)})),r),I=(e,t,r)=>{for(let n=0,o=e.length;n<o;n++){const o=e[n];if(t(o,n))return f.some(o);if(r(o,n))break}return f.none()},$=(e,t)=>I(e,t,y),_=(e,t)=>(e=>{const t=[];for(let r=0,n=e.length;r<n;++r){if(!o(e[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+e);x.apply(t,e[r])}return t})(S(e,t)),R=e=>{const t=w.call(e,0);return t.reverse(),t},E=Object.keys,N=Object.hasOwnProperty,P=(e,t)=>{const r=E(e);for(let n=0,o=r.length;n<o;n++){const o=r[n];t(e[o],o)}},L=(e,t)=>M(e,((e,r)=>({k:r,v:t(e,r)}))),M=(e,t)=>{const r={};return P(e,((e,n)=>{const o=t(e,n);r[o.k]=o.v})),r},O=e=>(t,r)=>{e[r]=t},H=(e,t)=>N.call(e,t),W=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},q=e=>{const t=t=>t(e),r=p(e),n=()=>o,o={tag:!0,inner:e,fold:(t,r)=>r(e),isValue:v,isError:y,map:t=>B.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:r,or:n,getOrThunk:r,orThunk:n,getOrDie:r,each:t=>{t(e)},toOptional:()=>f.some(e)};return o},G=e=>{const t=()=>r,r={tag:!1,inner:e,fold:(t,r)=>t(e),isValue:y,isError:v,map:t,mapError:t=>B.error(t(e)),bind:t,exists:y,forall:v,getOr:m,or:m,getOrThunk:g,orThunk:g,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:u,toOptional:f.none};var n;return r},B={value:q,error:G,fromOption:(e,t)=>e.fold((()=>G(t)),q)},V="undefined"!=typeof window?window:Function("return this;")();let j=0;const z=(e,t,r)=>e.isSome()&&t.isSome()?f.some(r(e.getOrDie(),t.getOrDie())):f.none(),U=(e,t)=>((e,t)=>{let r=null!=t?t:V;for(let t=0;t<e.length&&null!=r;++t)r=r[e[t]];return r})(e.split("."),t),F=()=>{const e=(e=>{const t=W(f.none()),r=()=>t.get().each(e);return{clear:()=>{r(),t.set(f.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{r(),t.set(f.some(e))}}})(u);return{...e,on:t=>e.get().each(t)}},K=e=>e.length>0,Z=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Q=(e,t)=>{const r=(t||document).createElement(e);return Z(r)},X=Z,Y=(e,t)=>{const r=e.dom;if(1!==r.nodeType)return!1;{const e=r;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},J=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,ee=(e,t)=>e.dom===t.dom,te=Object.getPrototypeOf,re=e=>{const t=U("ownerDocument.defaultView",e);return n(e)&&((e=>((e,t)=>{const r=((e,t)=>U(e,t))(e,t);if(null==r)throw new Error(e+" not available on this browser");return r})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(te(e).constructor.name))},ne=e=>t=>(e=>e.dom.nodeType)(t)===e,oe=e=>ae(e)&&re(e.dom),ae=ne(1),ie=ne(3),se=ne(11),le=e=>t=>ae(t)&&t.dom.nodeName.toLowerCase()===e,ce=e=>X(e.dom.ownerDocument),de=e=>f.from(e.dom.parentNode).map(X),ue=e=>f.from(e.dom.previousSibling).map(X),pe=e=>R(((e,t)=>{const r=[],n=e=>(r.push(e),t(e));let o=t(e);do{o=o.bind(n)}while(o.isSome());return r})(e,ue)),me=e=>S(e.dom.childNodes,X),he=e=>(e=>{const t=e.dom.childNodes;return f.from(t[0]).map(X)})(e),ge=e=>X(e.dom.host),ye=e=>{const t=X((e=>{if(l(e.target)){const t=X(e.target);if(ae(t)&&l(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return(e=>0<e.length?f.some(e[0]):f.none())(t)}}return f.from(e.target)})(e).getOr(e.target)),r=()=>e.stopPropagation(),n=()=>e.preventDefault(),o=(a=n,i=r,(...e)=>a(i.apply(null,e)));var a,i;return((e,t,r,n,o,a,i)=>({target:e,x:t,y:r,stop:n,prevent:o,kill:a,raw:i}))(t,e.clientX,e.clientY,r,n,o,e)},ve=(e,t,r,n)=>{e.dom.removeEventListener(t,r,n)},fe=v,we=(e,t,r)=>((e,t,r,n)=>((e,t,r,n,o)=>{const a=((e,t)=>r=>{e(r)&&t(ye(r))})(r,n);return e.dom.addEventListener(t,a,o),{unbind:h(ve,e,t,a,o)}})(e,t,r,n,!1))(e,t,fe,r),be=(e,t)=>{de(e).each((r=>{r.dom.insertBefore(t.dom,e.dom)}))},xe=(e,t)=>{const r=(e=>f.from(e.dom.nextSibling).map(X))(e);r.fold((()=>{de(e).each((e=>{ke(e,t)}))}),(e=>{be(e,t)}))},ke=(e,t)=>{e.dom.appendChild(t.dom)},Ce=(e,t)=>{A(t,(t=>{ke(e,t)}))},Se=(e,t,n)=>{((e,t,n)=>{if(!(r(n)||a(n)||d(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")})(e.dom,t,n)},Ae=(e,t)=>{const r=e.dom.getAttribute(t);return null===r?void 0:r},Te=(e,t)=>f.from(Ae(e,t)),De=(e,t)=>{e.dom.removeAttribute(t)},Ie=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},$e=e=>{const t=me(e);var r,n;t.length>0&&(r=e,A(n=t,((e,t)=>{const o=0===t?r:n[t-1];xe(o,e)}))),Ie(e)},_e=e=>(e=>X(e.dom.cloneNode(!0)))(e),Re=e=>e.dom.innerHTML,Ee=e=>{const t=ie(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const r=t.ownerDocument;return(e=>{const t=(e=>X(e.dom.getRootNode()))(e);return se(r=t)&&l(r.dom.host)?f.some(t):f.none();var r})(X(t)).fold((()=>r.body.contains(t)),(n=Ee,o=ge,e=>n(o(e))));var n,o},Ne=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return X(t)},Pe=(e,t)=>{const r=e.dom,n=window.getComputedStyle(r).getPropertyValue(t);return""!==n||Ee(e)?n:Le(r,t)},Le=(e,t)=>(e=>void 0!==e.style&&c(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"",Me=(e=>{const t=t=>e(t)?f.from(t.dom.nodeValue):f.none();return{get:r=>{if(!e(r))throw new Error("Can only get text value of a text node");return t(r).getOr("")},getOption:t,set:(t,r)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=r}}})(ie),Oe=(e,t,r)=>{let n=e.dom;const o=c(r)?r:y;for(;n.parentNode;){n=n.parentNode;const e=X(n);if(t(e))return f.some(e);if(o(e))break}return f.none()},He=(e,t)=>$(e.dom.childNodes,(e=>t(X(e)))).map(X),We=(e,t,r)=>Oe(e,(e=>Y(e,t)),r),qe=(e,t)=>He(e,(e=>Y(e,t))),Ge=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return J(r)?f.none():f.from(r.querySelector(e)).map(X)})(t,e),Be=(e,t,r)=>((e,t,r,n,o)=>e(r,n)?f.some(r):c(o)&&o(r)?f.none():t(r,n,o))(((e,t)=>Y(e,t)),We,e,t,r),Ve=(e,t=!1)=>{return Ee(e)?e.dom.isContentEditable:(r=e,Be(r,"[contenteditable]")).fold(p(t),(e=>"true"===je(e)));var r},je=e=>e.dom.contentEditable,ze=e=>e.dom.textContent,Ue=(e,t)=>(e=>T(me(e),(e=>Y(e,t))))(e),Fe=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return J(r)?[]:S(r.querySelectorAll(e),X)})(t,e),Ke=(e,t)=>Ge(e,t).isSome(),Ze=(e,t)=>{const{type:r,message:n}=t;e.notificationManager.open({type:r,text:n})},Qe=e=>{(e=>{switch(e){case"error":return console.error;case"info":return console.info;case"warn":return console.warn;default:return console.log}})(e.type)(e.message)},Xe=(e,t)=>{const{protect:r,allowList:n=[],blockList:o=[]}=null!=e?e:{};let a;return a=l(r)?r:n.length>0||o.length>0||t,{protect:a,allowList:n,blockList:o}},Ye=e=>{const{protect:t,allowList:r,blockList:n}=null!=e?e:{};return e=>{const o=e.toLowerCase();return r.length>0?!C(r,(e=>e.toLowerCase()===o)):n.length>0?C(n,(e=>e.toLowerCase()===o)):t}},Je=e=>{const t=Ye(e);return(e,r)=>{const n=((e,t)=>`${e}:${t}`)(r,e.toLowerCase());return t(n)}},et=(e,t,r,n)=>{const o=Reflect.get(e,"on"),a={protectedEventHandlers:[],cleanupScheduled:!1},i=(e,t)=>{n&&console.log(`[EventsProxy] ${e}`,t||"")},s=t=>{"invalid"===t&&a.protectedEventHandlers.length>0&&(i("Removing event handlers",a.protectedEventHandlers),A(a.protectedEventHandlers,(t=>{e.off(t.name,t.callback)})),a.protectedEventHandlers=[])},l=t.onStatusChange(s);return e.on("remove",l),(n,l,c)=>{i(`Adding event listener: ${n}`,{shouldProtect:r(n)});const d=((e,n)=>{const o=r(e),i=t.getStatus(),s=o&&"invalid"===i?u:n;return o&&a.protectedEventHandlers.push({name:e,callback:s}),s})(n,l);return a.cleanupScheduled||(a.cleanupScheduled=!0,window.setTimeout((()=>{s(t.getStatus()),a.cleanupScheduled=!1}),0)),Reflect.apply(o,e,[n,d,c])}},tt=(e,t,r)=>n=>{const o="invalid"!==t.getStatus()&&l(r)?r(n):u,a=((e,t,r)=>{const n=e=>{"invalid"===e&&r.setEnabled(!1)},o=()=>n(t.getStatus());n(t.getStatus()),e.on("NodeChange",o);const a=t.onStatusChange(n);return()=>{e.off("NodeChange",o),a()}})(e,t,n);return e=>{null==o||o(e),a()}},rt=(e,t,r)=>(...n)=>{var o;return"invalid"===e.getStatus()?r:null!==(o=null==t?void 0:t(...n))&&void 0!==o?o:r},nt=(e,t)=>rt(e,t,Promise.resolve([])),ot=(e,t)=>rt(e,t,[]),at=(e,t)=>rt(e,t,!1),it=(e,t,n,o)=>{const a=t=>{const{command:a,value:i}=t,s=f.from(i).filter(r).map((e=>e.toLowerCase())),l=a.toLowerCase()===o.toLowerCase(),c=s.exists((e=>n.has(e))),d=s.exists((t=>t===e.queryCommandValue(o)));l&&c&&!d&&t.preventDefault()},i=t.onStatusChange((t=>{if("invalid"===t){e.on("BeforeExecCommand",a);const t=()=>{const t=e.queryCommandValue(o);n.has(t.toLowerCase())&&e.execCommand(o,!1,t)};e.initialized?t():e.on("init",t)}}));e.on("remove",(()=>{i(),e.off("BeforeExecCommand",a)}))},st=(e,t,n,o,a,i=!1)=>{const s=new Set,l=new Set,c=(e,t)=>{i&&console.log(`[UiProxy] ${e}`,t||"")};((e,t,r)=>{it(e,t,r,"ToggleView")})(e,n,s),((e,t,r)=>{it(e,t,r,"ToggleSidebar")})(e,n,l);const d=(t,r,i,s)=>{const l=a(t,i);return c(`${s}: ${t}`,{spec:r,context:o,shouldProtect:l}),l?{...r,onSetup:tt(e,n,r.onSetup)}:r};return new Proxy(t,{get:(e,t,i)=>{const u=Reflect.get(e,t,i);if(!r(t))return u;switch(t){case"addButton":case"addGroupToolbarButton":case"addToggleButton":case"addMenuButton":case"addSplitButton":return(...r)=>{const[n,o,...a]=r,i=d(n,o,"button",String(t));return Reflect.apply(u,e,[n,i,...a])};case"addMenuItem":case"addToggleMenuItem":case"addNestedMenuItem":return(...r)=>{const[n,o,...a]=r,i=d(n,o,"menuitem",String(t));return Reflect.apply(u,e,[n,i,...a])};case"addAutocompleter":return(...r)=>{const[i,s,...l]=r,d=a(i,"autocompleter");if(c(`${String(t)}: ${i}`,{spec:s,context:o,shouldProtect:d}),d){const t={...s,fetch:nt(n,s.fetch)};return Reflect.apply(u,e,[i,t,...l])}return Reflect.apply(u,e,[i,s,...l])};case"addSidebar":return(...r)=>{const[n,i,...s]=r,d=a(n,"sidebar");if(c(`${String(t)}: ${n}`,{spec:i,context:o,shouldProtect:d}),d){l.add(n.toLowerCase());const t={...i};return Reflect.apply(u,e,[n,t,...s])}return Reflect.apply(u,e,[n,i,...s])};case"addView":return(...r)=>{const[n,i,...l]=r,d=a(n,"view");if(c(`${String(t)}: ${n}`,{spec:i,context:o,shouldProtect:d}),d){s.add(n.toLowerCase());const t={...i};return Reflect.apply(u,e,[n,t,...l])}return Reflect.apply(u,e,[n,i,...l])};case"addContextMenu":return(...r)=>{const[i,s,...l]=r,d=a(i,"contextmenu");if(c(`${String(t)}: ${i}`,{spec:s,context:o,shouldProtect:d}),d){const t={...s,update:ot(n,s.update)};return Reflect.apply(u,e,[i,t,...l])}return Reflect.apply(u,e,[i,s,...l])};case"addContextToolbar":case"addContextForm":return(...r)=>{const[i,s,...l]=r,d=a(i,"contexttoolbar");if(c(`${String(t)}: ${i}`,{spec:s,context:o,shouldProtect:d}),d){const t={...s,predicate:at(n,s.predicate)};return Reflect.apply(u,e,[i,t,...l])}return Reflect.apply(u,e,[i,s,...l])};case"addIcon":case"getAll":case"addContext":return u}}})},lt=new Set(["addCommand","addCommands","addQueryStateHandler","addQueryValueHandler"]),ct=e=>(t,r)=>{e&&console.log(`[EditorProxy] ${t}`,r||"")},dt=(e,t)=>{const{statusProvider:r,uiContext:n,protection:o,debug:a=!1}=t,{events:i,commands:s,ui:l}=o;ct(a)("Creating enhanced editor with options:",{hasStatusProvider:!!r,uiContext:n,debug:a,protection:o});const{editorUiProxy:d,editorCommandsProxy:p,editorEventListenerProxy:m}=((e,t,r,n,o,a,i)=>{const s=a.protect?{...e.ui,registry:st(e,e.ui.registry,t,r,Je(a),i)}:e.ui,l=n.protect?((e,t,r,n,o)=>{const a={protectedCommands:[],cleanupScheduled:!1},i=(e,t)=>{o&&console.log(`[CommandsProxy] ${e}`,t||"")},s=(e,t)=>{const o=n(e),i=r.getStatus();return o&&a.protectedCommands.push(e),o&&"invalid"===i?u:t},l=t=>{"invalid"===t&&a.protectedCommands.length>0&&(i("Removing commands",a.protectedCommands),A(a.protectedCommands,(t=>{e.editorCommands.removeCommand(t)})),a.protectedCommands=[])},c=()=>{a.cleanupScheduled||(a.cleanupScheduled=!0,window.setTimeout((()=>{l(r.getStatus()),a.cleanupScheduled=!1}),0))},d=r.onStatusChange(l);return e.on("remove",d),new Proxy(t,{get:(e,r,o)=>{if(i(`Accessing property: ${String(r)}`),"addCommand"===r){const a=Reflect.get(e,r,o);return(e,r,...o)=>{i(`Adding command: ${e}`,{shouldProtect:n(e)});const l=s(e,r);return c(),Reflect.apply(a,t,[e,l,...o])}}if("addCommands"===r){const n=Reflect.get(e,r,o);return(e,r="exec")=>{i(`Adding commands (${r})`,{commandCount:Object.keys(e).length,willApplyEnforcement:"exec"===r});const o="exec"!==r?e:L(e,((e,t)=>s(t,e)));return c(),Reflect.apply(n,t,[o,r])}}return Reflect.get(e,r,o)}})})(e,e.editorCommands,t,Ye(n),i):e.editorCommands;return{editorUiProxy:s,editorCommandsProxy:l,editorEventListenerProxy:o.protect?et(e,t,Ye(o),i):e.on.bind(e)}})(e,r,n||"",s,i,l,a),h=((e,t,r,n)=>(o,a,i)=>{const s=String(a);if("on"===a)return ct(n)("on intercepted"),r;if(lt.has(s))return ct(n)(`${s} intercepted`),t[s].bind(t);if("editorCommands"===a)return ct(n)("editorCommands accessed"),t;if("ui"===a)return ct(n)("ui accessed"),e;const l=Reflect.get(o,a,i);return c(l)?l.bind(o):l})(d,p,m,a);return new Proxy(e,{get:h,set:(e,t,r,n)=>Reflect.set(e,t,r,n),has:(e,t)=>Reflect.has(e,t),ownKeys:e=>Reflect.ownKeys(e),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e,t),defineProperty:(e,t,r)=>Reflect.defineProperty(e,t,r),deleteProperty:(e,t)=>Reflect.deleteProperty(e,t),isExtensible:e=>Reflect.isExtensible(e),preventExtensions:e=>Reflect.preventExtensions(e),getPrototypeOf:e=>Reflect.getPrototypeOf(e),setPrototypeOf:(e,t)=>Reflect.setPrototypeOf(e,t)})},ut=e=>parseInt(e,10),pt=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},mt=(e,t,r)=>({major:e,minor:t,patch:r}),ht=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?mt(ut(t[1]),ut(t[2]),ut(t[3])):mt(0,0,0)},gt=(e,t)=>!!e&&-1===((e,t)=>{const r=pt(e.major,t.major);if(0!==r)return r;const n=pt(e.minor,t.minor);if(0!==n)return n;const o=pt(e.patch,t.patch);return 0!==o?o:0})((e=>ht((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),ht(t)),yt=ht("8.3.0"),vt=`${yt.major}.${yt.minor}.0`,ft=`${yt.major+1}.0.0`,wt=(e,t)=>{const{setup:r,protection:n}=t;return(o,a)=>{if(!((e,t)=>gt(e,vt)?(console.error(`The "${t}" plugin requires at least version ${vt} of TinyMCE.`),!1):!!gt(e,ft)||(console.error(`The "${t}" plugin requires at least version ${vt} of TinyMCE but less than ${ft}.`),!1))(tinymce,e)||((e,t)=>!!(e=>{var t;const r=null===(t=e.options.get("license_key"))||void 0===t?void 0:t.toLowerCase(),n=e.options.get("online_license_key");return s(n)&&"gpl"===r})(e)&&(((e,t)=>{const{console:r,editor:n}=t;l(n)&&(e._skinLoaded?Ze(e,n):e.on("SkinLoaded",(()=>{Ze(e,n)}))),l(r)&&Qe(r)})(e,{console:{type:"error",message:[`The "${t}" plugin requires a valid TinyMCE license key.`,"Read more: https://www.tiny.cloud/docs/tinymce/latest/license-key/"].join(" ")}}),!0))(o,e))return{};const i=(e=>{const{protect:t=!0,events:r,commands:n,ui:o,api:a}=null!=e?e:{};return{protect:t,events:Xe(r,false),commands:Xe(n,true),ui:Xe(o,true),api:Xe(a,true)}})(n),d=((e="pre-validation")=>{const t=W(e),r=new Set;let n=!1;const{enableLogging:o=!1}={},a=(e,...t)=>{o&&console.log(`[StatusProvider] ${e}`,...t)};return{setStatus:e=>{const n=t.get();if(n===e)return a("Status unchanged:",e),!1;t.set(e),a("Status changed:",n,"->",e);const o={currentStatus:e,previousStatus:n},i=Array.from(r);return A(i,(e=>{e(o.currentStatus,o.previousStatus)})),!0},onStatusChange:e=>(r.add(e),a("Callback registered, total listeners:",r.size),()=>{r.delete(e)&&a("Callback unregistered, remaining listeners:",r.size)}),getStatus:t.get,hasListeners:()=>r.size>0,destroy:()=>{n||(a("Destroying StatusProvider, clearing",r.size,"listeners"),r.clear(),n=!0)}}})(),u=((e,t,r)=>{const n=`commercial-license-${t}`;return e.ui.registry.addContext(n,(()=>"invalid"!==r.getStatus()&&!e.mode.isReadOnly())),e.licenseKeyManager.validate({plugin:t}).then((e=>{r.setStatus(e?"valid":"invalid")}),(e=>{console.error(e),console.error(`An unknown error occurred when trying to validate "${t}" plugin.`),r.setStatus("invalid")})),{ui:{context:n}}})(o,e,d),p=i.protect?dt(o,{statusProvider:d,uiContext:u.ui.context,debug:t.debug||!1,protection:i}):o,m=((e,t)=>({pluginCode:e,enforcer:{isInvalid:()=>"invalid"===t.getStatus(),onInvalid:e=>t.onStatusChange(((t,r)=>{"invalid"===t&&e(t,r)}))}}))(e,d);return((e,t,r,n)=>{if(t.protect&&t.api.protect&&l(e)){const a=Ye(t.api);return(o=e=>"invalid"===r.getStatus()&&a(e),(e,t)=>L(e,((e,r)=>c(e)?(...n)=>{if(o(r.toLowerCase())){const e=`Method "${l(t)?`${t}.`:""}${r}" is not available due to license key restrictions.`,n=new Error(e);throw console.error(e),n}return e(...n)}:e)))(e,n)}var o;return e})(r(p,a,m),i,d,e)}},bt=p("html4"),xt=p("html5"),kt=p("a"),Ct=p("aa"),St=p("aaa"),At=e=>t=>t.options.get(e),Tt=At("a11ychecker_level"),Dt=At("a11ychecker_html_version"),It=At("a11ychecker_issue_url_callback"),$t=At("a11ychecker_filter_issue"),_t=At("a11ychecker_alt_text_max_length"),Rt=e=>{var t;return null!==(t=e.options.get("a11ychecker_allow_decorative_images"))&&void 0!==t?t:e.options.get("a11y_advanced_options")},Et={"a11y.d1.description":"This paragraph looks like a heading. If it is a heading, please select a heading level.","a11y.d1.repair.block.h1":"Heading 1","a11y.d1.repair.block.h2":"Heading 2","a11y.d1.repair.block.h3":"Heading 3","a11y.d1.repair.block.h4":"Heading 4","a11y.d1.repair.block.h5":"Heading 5","a11y.d1.repair.block.h6":"Heading 6","a11y.d1.repair.info":"Select a heading level","a11y.d2.description":"Headings must be applied in sequential order. For example: Heading 1 should be followed by Heading 2, not Heading 3.","a11y.d3.description":"Adjacent links with the same URL should be merged into one link","a11y.d4.description":"The selected text appears to be a list. Lists should be formatted using a list tag.","a11y.d5a.description":"Large text must have a contrast ratio of at least 3:1","a11y.d5b.description":"Text must have a contrast ratio of at least 4.5:1","a11y.d5c.description":"Text must have a contrast ratio of at least 7:1","a11y.h93.description":"ID attribute must be unique","a11y.h93.repair.info":"Make ID unique","a11y.h93.repair.deduplicate.others":"Keep this ID and remove all others","a11y.h93.repair.deduplicate.this":"Remove this ID","a11y.h93.repair.deduplicate.all":"Remove all IDs","a11y.i1.description":"Image must be marked as decorative or have an alternative text description","a11y.i1.description.conflicting":"This image has conflicting information. Either remove the text description to make it decorative, or remove the decorative marking.","a11y.i1.description.decorativeNotAllowed":"Decorative images are not allowed. Please add a text description.","a11y.i1.description.incompleteNoDecorative":"Image needs a text description","a11y.i1.repair.info":"Add a text description","a11y.i1.repair.info.decorativeNotAllowed":"Add a text description for this image","a11y.i1.repair.errors.duplicate":"Text description should not be the image filename","a11y.i1.repair.errors.empty":"Text description cannot be empty","a11y.i1.repair.errors.emptyNoDecorative":"Text description cannot be empty","a11y.i1.repair.info.decorativeAllowed":"Or add a text description","a11y.i1.repair.checkboxlabel":"Mark as decorative","a11y.i1.repair.checkboxtext":"This image is decorative","a11y.i2.description":"Image needs a text description","a11y.i2.repair.info":"Add a text description for this image","a11y.i2.repair.errors.empty":"Text description cannot be empty","a11y.i3.description":"Text description should describe the image, not the filename","a11y.i3.repair.info":"Replace filename with a meaningful description","a11y.i4.description":"Text description is too long","a11y.i4.repair.info":"Shorten the text description","a11y.i4.repair.errors.empty":"Text description cannot be empty","a11y.i4.repair.error":"{0} characters (maximum {1} allowed)","a11y.t1.description":"Tables must have captions","a11y.t1.repair.errors.duplicate":"Table caption cannot be the same as the table summary","a11y.t1.repair.errors.empty":"Caption cannot be empty","a11y.t1.repair.info":"Provide caption","a11y.t2.description":"Complex tables should have summaries","a11y.t2.repair.errors.duplicate":"Table summary cannot be the same as the table caption","a11y.t2.repair.errors.empty":"Summary cannot be empty","a11y.t2.repair.info":"Provide table summary","a11y.t3.description":"Table caption and summary cannot have the same value","a11y.t4a.description":"Table elements must contain TR and TD tags","a11y.t4b.description":"Tables must have at least one header cell","a11y.t4b.repair.info":"Choose table header","a11y.t4c.description":"Table headers must be applied to a row or a column","a11y.t4c.repair.header.col":"Header column","a11y.t4c.repair.header.row":"Header row","a11y.t4c.repair.info":"Select header scope","a11y.t4c.repair.scope.col":"Column","a11y.t4c.repair.scope.colgroup":"Column group","a11y.t4c.repair.scope.row":"Row","a11y.t4c.repair.scope.rowgroup":"Row group","a11y.widget.counter":"Issue {0} of {1}","a11y.widget.ignore":"Ignore","a11y.widget.issue.none":"No accessibility issues detected","a11y.widget.next":"Next issue","a11y.widget.previous":"Previous issue","a11y.widget.legacyrepair":"Repair issue","a11y.widget.repair":"Repair","a11y.widget.title":"Accessibility Checker","a11y.widget.help.title":"Click for more info","a11y.control.tooltip":"Accessibility checker","a11y.control.menutext":"Accessibility checker...","a11y.issue.dialog.tagname.Text":"Text","a11y.issue.dialog.tagname.Image":"Image","a11y.issue.dialog.tagname.Table":"Table","a11y.issue.dialog.tagname.Link":"Link",error:"Error",warning:"Warning",info:"Info",success:"Success",solution:"Solution",moreInfo:"More info",quotation:'"{0}"'},Nt=e=>Et[e],Pt=e=>{const t=tinymce.util.I18n;return Array.isArray(e)?t.translate([Nt(e[0]),...e.slice(1)]):t.translate(Nt(e))},Lt=(()=>{const e="ephox-foam".replace(/\./g,"-");return{resolve:t=>e+"-"+t}})().resolve,Mt=(e,t,r)=>{Se(e,t,r)},Ot=(e,t,r)=>{De(e,t),De(e,r)},Ht=e=>{const t=e.editor;return{start:t=>{((e,t,r,n,o,a)=>{A(e,(e=>{const r=((e,t,r,n)=>{switch(e){case"info":return f.some(t);case"warning":return f.some(r);case"error":return f.some(n);default:return f.none()}})(e.severity,n,o,a).toArray().concat([t]);A(r,(t=>{Se(e.element,t,1)}))})),f.from(e[0]).each((e=>{Mt(e.element,r,e.severity)}))})(t,e.violation,e.current,e.info,e.warn,e.error)},moveTo:(r,n)=>{((e,t,r,n)=>{const o=Fe(e,"["+t+"]");A(o,(e=>{De(e,t)})),Mt(r,t,n)})(X(t.getBody()),e.current,r,n)},stop:()=>{((e,t,r,n,o,a)=>{const i=Fe(e,"["+t+"]");A(i,(e=>{A([t,r,n,o,a],(t=>{De(e,t)})),Ot(e,t,r)}))})(X(t.getBody()),e.violation,e.current,e.info,e.warn,e.error)},exclude:t=>{Ot(t,e.violation,e.current)}}},Wt="data-"+Lt("a11y-current-violation"),qt="data-"+Lt("a11y-violation"),Gt="data-"+Lt("a11y-severity-info"),Bt="data-"+Lt("a11y-severity-warn"),Vt="data-"+Lt("a11y-severity-error"),jt="data-"+Lt("accessibility-ignore"),zt=p(jt),Ut=e=>{const t=(e=>Oe(e,oe).exists(Ve))(e);return t&&oe(e)&&Ve(e)},Ft=(e,t)=>T(e.querySelectorAll(t),(e=>Ut(X(e)))),Kt=e=>Te(e,"aria-labelledby").filter((e=>""!==e.trim())).isSome(),Zt=e=>{const t=Te(e,"alt"),r=Te(e,"role"),n=Te(e,"aria-label"),o=Te(e,"aria-labelledby"),a=Te(e,"title"),i=t.isSome(),s=t.exists((e=>""===e.trim())),l=t.exists((e=>e.trim().length>0)),c=r.exists((e=>{const t=e.toLowerCase();return"presentation"===t||"none"===t})),d=i&&!s&&t.exists((e=>e.trim().length>0)),u=n.exists((e=>e.trim().length>0)),p=Kt(e),m=a.exists((e=>e.trim().length>0)),h=d||u||p||m,g=i||n.isSome()||o.isSome()||a.isSome()||c,y=i&&s||c,v=h&&!y,f=r.exists((e=>""===e.trim())),w=a.exists((e=>e.trim().length>0)),b=y&&(n.isSome()||o.isSome()||w);return{isDecorativePattern:y,isInformativePattern:v,hasConflictingSignals:c&&(l||u||p)||f||b,hasAnyAccessibilityAttribute:g,hasValidTextAlternative:h,isEmpty:!g}},Qt=e=>e.hasConflictingSignals?"mixed_signals":e.isDecorativePattern?"decorative":e.isInformativePattern?"informative":(e.isEmpty,"incomplete");class Xt{constructor(){this.cache=new Map}getAnalysis(e){const t=e.dom;return this.cache.has(t)||this.cache.set(t,Zt(e)),this.cache.get(t)}getIntent(e){const t=this.getAnalysis(e);return Qt(t)}clear(){this.cache.clear()}}const Yt=(e,t,r,n)=>_(t,(t=>["I1","I2","I3","I4"].includes(t.id)?t.check(e,n,r)?[{rule:t,element:e}]:[]:t.check(e,n)?[{rule:t,element:e}]:[])),Jt=(e,t)=>{var r,n;let o=[];const a=new Xt,s=(e=>{const t=[],r=[];for(let o=0,a=e.length;o<a;o++){const a=e[o];(n=a,n.walkable?t:r).push(a)}var n;return{pass:t,fail:r}})(e.rules),l=i(e.ignoreSelectors)?[]:e.ignoreSelectors,c=s.pass,d=s.fail,u=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);for(;u.nextNode();){const t=X(u.currentNode);if(!C(l,(e=>Y(t,e)))&&oe(t)&&Ut(t)){const n={allowDecorative:e.allowDecorative,intentCache:a,altTextMaxLength:e.altTextMaxLength},i=Yt(t.dom,c,n,null!==(r=e.ignoreSelectors)&&void 0!==r?r:[]);o=o.concat(i)}}const p=((e,t,r)=>_(t,(t=>S(t.check(e,r),(e=>({rule:t,element:e}))))))(t,d,null!==(n=e.ignoreSelectors)&&void 0!==n?n:[]);o=o.concat(p),o.sort(((e,t)=>((e,t)=>e===t?0:((e,t)=>((e,t,r)=>!!(e.compareDocumentPosition(t)&r))(e,t,Node.DOCUMENT_POSITION_PRECEDING))(e,t)?1:-1)(e.element,t.element)));const m=(e=>{const t=new Map;A(e,(e=>{var r;const n=e.element;t.has(n)||t.set(n,[]),null===(r=t.get(n))||void 0===r||r.push(e)}));const r=[],n=["I1","I2","I3","I4"];return t.forEach((e=>{let t=null;for(const r of n)if(C(e,(e=>e.rule.id===r))){t=r;break}if(t){const o=T(e,(e=>!n.includes(e.rule.id)||e.rule.id===t));r.push(...o)}else r.push(...e)})),r})(o);return a.clear(),m},er=p("error"),tr=p("warning"),rr=(e,t)=>{const r=e;return r.matches?r.matches(t):r.webkitMatchesSelector?r.webkitMatchesSelector(t):r.mozMatchesSelector?r.mozMatchesSelector(t):!!r.msMatchesSelector&&r.msMatchesSelector(t)},nr=(e,t)=>ir(e,t).isSome(),or=(e,t)=>((e,t)=>C(t,(t=>Y(e,t))))(e,t)?he(e).bind((e=>or(e,t))):f.some(e),ar=e=>{return(t=e,Me.getOption(t)).filter((e=>K(e.trim())));var t},ir=(e,t)=>He(e,(e=>ar(e).orThunk((()=>{const r=or(e,t).getOr(e);return ar(r)})).isSome())),sr="strong,b",lr=(e,t,r)=>ir(e,r).fold((()=>((e,t)=>{for(let r=0,n=e.length;r<n;++r)if(!0!==t(e[r]))return!1;return!0})(me(e),(e=>lr(e,t,r)))),(e=>((e,t)=>We(e,sr,(e=>ee(e,t))).isSome())(e,t))),cr={id:"D1",wcag:"1.3.1",severity:tr(),desckey:"a11y.d1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H42.html",walkable:!0,check:(e,t)=>{const r=X(e);return!(!rr(e,"p")||!Ke(r,sr))&&lr(r,r,t)},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},dr={id:"D2",wcag:"1.3.1",severity:er(),desckey:"a11y.d2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G141.html",walkable:!1,check:e=>{const t=Ft(e,"h1,h2,h3,h4,h5,h6");let r;const n=[];return A(t,(e=>{const t=parseInt(e.tagName.slice(1),10);r&&t-r>1&&n.push(e),r=t})),n},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},ur={id:"D3",wcag:"2.4.4",severity:er(),desckey:"a11y.d3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H2.html",walkable:!1,check:e=>{const t=X(e),r=Fe(t,"a + a"),n=T(r,(e=>{const t=R(pe(e));return I(t,le("a"),(e=>{return!(ie(t=e)&&(r=(e=>Me.get(e))(t).replace(/[\u200B-\u200D\uFEFF]/g,""),!K(r)));var t,r})).exists((t=>t.dom.href===e.dom.href))&&Ut(e)}));return S(n,(e=>e.dom))},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},pr=(e,t)=>{const r=e.nodeName,n=((e,t)=>{let r=e.nextSibling;for(;null!==r&&(t&&"#text"===r.nodeName||"BR"===r.nodeName);)r=r.nextSibling;return r})(e,t);return null!==n&&n.nodeName===r&&n},mr=(e,t,r)=>{const n=[];if(t(e)){n.push(e);let o=pr(e,r);for(;!1!==o&&t(o);)n.push(o),o=pr(o,r)}return n},hr=(e,t)=>{let r=-1;for(let n=0;n<e.length;n++)if(e[n]===t){r=n;break}return r},gr=(e,t)=>{const r=Ft(e,"p,h1,h2,h3,h4,h5,h6"),n=[];let o=0;for(;o<r.length;){const e=r[o],a=mr(e,t,!0);if(a.length>1){n.push(e);const t=a[a.length-1],i=hr(r,t);o=-1===i?o+1:i}else l(e.firstChild)?(mr(e.firstChild,t,!1).length>1&&n.push(e),o++):o++}return n},yr=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}([a-z1-9]|i+)\s{0,}[.)-]/gim))},vr={id:"D4o",wcag:"1.3.1",severity:er(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>gr(e,yr),levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},fr=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}(\*|-)\s{0,}/gim))},wr={id:"D4u",wcag:"1.3.1",severity:er(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>gr(e,fr),levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},br=(e,t,r,n)=>({red:e,green:t,blue:r,alpha:n}),xr=e=>{const t=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=e.red/255,n=e.green/255,o=e.blue/255;return.2126*t(r)+.7152*t(n)+.0722*t(o)},kr=(e,t)=>{const r=e.alpha+t.alpha*(1-e.alpha),n=(e.red*e.alpha+t.red*t.alpha*(1-e.alpha))/r,o=(e.green*e.alpha+t.green*t.alpha*(1-e.alpha))/r,a=(e.blue*e.alpha+t.blue*t.alpha*(1-e.alpha))/r;return br(Math.ceil(n),Math.ceil(o),Math.ceil(a),r)},Cr=e=>{const t=(e,t,r,n)=>{const o=parseInt(e,10),a=parseInt(t,10),i=parseInt(r,10),s=parseFloat(n);return f.some(br(o,a,i,s))};if("transparent"===e)return t("0","0","0","0");const r=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/.exec(e);if(null!==r)return t(r[1],r[2],r[3],"1");const n=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/.exec(e);return null!==n?t(n[1],n[2],n[3],n[4]):f.none()},Sr=(e,t)=>{const r=parseFloat(Pe(e,"opacity"));return r<1?br(t.red,t.green,t.blue,t.alpha*r):t},Ar=(e,t)=>Tr(e).filter((e=>e<t)).isSome(),Tr=e=>{const t=(e=>{const t=ce(e),r=Ne(t),n=[e].concat(((e,t)=>{const r=c(t)?t:y;let n=e.dom;const o=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=X(e);if(o.push(t),!0===r(t))break;n=e}return o})(e,(e=>ee(e,r)))),o=D(n,((e,t)=>{if(1===e.alpha)return e;const r=Pe(t,"background-color");return Cr(r).bind((r=>{const n=Sr(t,r);return n.alpha>0?f.some(kr(e,n)):f.none()})).getOr(e)}),br(0,0,0,0));return o.alpha<1?kr(o,br(255,255,255,1)):o})(e);return((e,t)=>{const r=Pe(e,"color");return Cr(r).bind((r=>{const n=Sr(e,r),o=n.alpha<1?kr(n,t):n;return f.some(o)}))})(e,t).map((e=>{const r=xr(t);return((e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05))(xr(e),r)}))},Dr={id:"D5c",wcag:"1.4.3",severity:er(),desckey:"a11y.d5c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G17.html",walkable:!0,check:(e,t)=>{const r=X(e);return nr(r,t)&&Ar(r,7)},levels:[St()],htmlversions:[bt(),xt()]},Ir=e=>{const t=Pe(e,"font-size"),r=new RegExp(".*px").test(t),n=/(\d*\.?\d*)(.*)/.exec(t);return r&&null!==n?f.some(Number(n[1])):f.none()},$r=e=>{const t=(e=>{const t=Pe(e,"font-weight");return!("bold"!==t&&"bolder"!==t)||!!/^[0-9]*$/.test(r=t)&&parseInt(r,10)>=700;var r})(e),r=ce(e),n=Ne(r),o=Ir(n);return Ir(e).fold(y,(e=>o.fold((()=>e>=24||t&&e>=19),(r=>e>=1.5*r||t&&e>=1.2*r))))},_r={id:"D5a",wcag:"1.4.3",severity:er(),desckey:"a11y.d5a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G145.html",walkable:!0,check:(e,t)=>{const r=X(e);return nr(r,t)&&$r(r)&&Ar(r,3)},levels:[Ct()],htmlversions:[bt(),xt()]},Rr={id:"D5b",wcag:"1.4.3",severity:er(),desckey:"a11y.d5b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G18.html",walkable:!0,check:(e,t)=>{const r=X(e);return nr(r,t)&&!$r(r)&&Ar(r,4.5)},levels:[Ct()],htmlversions:[bt(),xt()]},Er={id:"H93",wcag:"4.1.1",severity:er(),desckey:"a11y.h93.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H93.html",walkable:!1,check:e=>{const t=X(e),r=Fe(t,"*[id]"),n=D(r,((e,t)=>{const r=Ae(t,"id");if(void 0!==r&&Ut(t)){if(H(e.problems,r))return e;if(H(e.ids,r)){const t=e.ids[r];return{...e,problems:{...e.problems,[r]:t}}}return{...e,ids:{...e.ids,[r]:t.dom}}}return e}),{ids:{},problems:{}});return((e,t)=>{const r=[];return P(e,((e,n)=>{r.push(t(e,n))})),r})(n.problems,m)},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Nr=le("img"),Pr=(e,t)=>{var r,n,o;if(null==e||null==t||""===e.trim()||""===t.trim())return!1;const a=e.match(/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g);let i=null!==(o=null===(n=(null!==(r=null==a?void 0:a[0])&&void 0!==r?r:e).split("/").pop())||void 0===n?void 0:n.split("?")[0])&&void 0!==o?o:"";try{i=decodeURIComponent(i)}catch(e){console.error("Error decoding filename",e)}if(i.toLowerCase()===t.toLowerCase())return!0;const s=i.split(".").slice(0,-1).join(".");return!(!s||s.toLowerCase()!==t.toLowerCase())},Lr=e=>{const t=X(e);return Nr(t)?f.some(t):f.none()},Mr=(e,t)=>t?t.getIntent(e):Qt(Zt(e)),Or=(e,t,r)=>!!t&&"decorative"===Mr(e,r),Hr=e=>e.trim().length>0,Wr=e=>Te(e,"alt").filter(Hr).orThunk((()=>Te(e,"aria-label").filter(Hr))).orThunk((()=>Te(e,"title").filter(Hr))).getOr(""),qr={id:"I1",wcag:"1.1.1",severity:er(),desckey:"a11y.i1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:(e,t,r)=>Lr(e).filter((e=>{const t=Mr(e,null==r?void 0:r.intentCache);return"mixed_signals"===t||"incomplete"===t||!(null==r?void 0:r.allowDecorative)&&"decorative"===t})).isSome(),getDescriptionKey:(e,t)=>{const r=X(e),n=Qt(Zt(r)),o=null!=t&&t;return"mixed_signals"===n?o?"a11y.i1.description.conflicting":"a11y.i1.description.decorativeNotAllowed":o||"decorative"!==n?"incomplete"!==n||o?"a11y.i1.description":"a11y.i1.description.incompleteNoDecorative":"a11y.i1.description.decorativeNotAllowed"},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Gr={id:"I2",wcag:"1.1.1",severity:er(),desckey:"a11y.i2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/failures/F65.html",walkable:!0,check:(e,t,r)=>Lr(e).filter((e=>{if("decorative"===Mr(e,null==r?void 0:r.intentCache))return!1;if(!(e=>{const t=e.dom;return!(!t||!t.hasAttribute)&&t.hasAttribute("alt")})(e))return!0;const t=Te(e,"alt").exists((e=>e.trim().length>0)),n=Kt(e),o=Te(e,"aria-label").exists((e=>e.trim().length>0)),a=Te(e,"title").exists((e=>e.trim().length>0));return!(t||n||o||a)})).isSome(),levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Br={id:"I3",wcag:"1.1.1",severity:er(),desckey:"a11y.i3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:(e,t,r)=>Lr(e).filter((e=>{if(Or(e,null==r?void 0:r.allowDecorative,null==r?void 0:r.intentCache))return!1;const t=Te(e,"src"),n=Te(e,"alt");return z(t,n,((e,t)=>Pr(e,t))).getOr(!1)})).isSome(),levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Vr={id:"I4",wcag:"N/A",severity:tr(),desckey:"a11y.i4.description",url:"",walkable:!0,check:(e,t,r)=>Lr(e).filter((e=>{var t;if(Or(e,null==r?void 0:r.allowDecorative,null==r?void 0:r.intentCache))return!1;const n=Te(e,"alt"),o=null!==(t=null==r?void 0:r.altTextMaxLength)&&void 0!==t?t:150;return n.exists((e=>e.trim().length>o))})).isSome(),levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},jr={id:"T1",wcag:"1.3.1",severity:er(),desckey:"a11y.t1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H39.html",walkable:!0,check:e=>{if(rr(e,"table")){const t=e.querySelector("caption");return!t||rr(t,":empty")}return!1},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},zr={id:"T2",wcag:"1.3.1",severity:tr(),desckey:"a11y.t2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>rr(e,"table")&&l(e.querySelector("[rowspan]")||e.querySelector("[colspan]"))&&!e.hasAttribute("summary"),levels:[kt(),Ct(),St()],htmlversions:[bt()]},Ur={id:"T3",wcag:"1.3.1",severity:er(),desckey:"a11y.t3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>{if(rr(e,"table")&&e.hasAttribute("summary")){const t=e.querySelectorAll("caption");return t.length>0&&e.getAttribute("summary")===t[0].innerHTML}return!1},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Fr={id:"T4b",wcag:"1.3.1",severity:er(),desckey:"a11y.t4b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>"table"===e.nodeName.toLowerCase()&&0===e.querySelectorAll("th").length,levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Kr={id:"T4c",wcag:"1.3.1",severity:er(),desckey:"a11y.t4c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H63.html",walkable:!0,check:e=>{return!("th"!==e.nodeName.toLowerCase()||(t=e).hasAttribute("scope")&&/row|col|rowgroup|colgroup/i.test(t.getAttribute("scope")));var t},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Zr=(e,t)=>0===e.querySelectorAll(t).length,Qr={id:"T4a",wcag:"1.3.1",severity:er(),desckey:"a11y.t4a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>{return"table"===e.nodeName.toLowerCase()&&(Zr(t=e,"tr")||Zr(t,"td"));var t},levels:[kt(),Ct(),St()],htmlversions:[bt(),xt()]},Xr=e=>{var t;const r=null===(t=e.caption)||void 0===t?void 0:t.innerHTML,n=r?`${r}`:"",o=e.rows,a=o.length,i=o[0],s=i?i.cells.length:0;return K(n)?`${n}. ${a}x${s}`:`${a}x${s}`},Yr=e=>({id:e.id.toUpperCase(),severity:e.severity,url:e.url,description:Pt(e.description),element:e.element.dom,contentID:e.contentId}),Jr=e=>{const t=(e=>{const t=(e=>{const t=e.options.get("a11ychecker_ignored_rules");return _(tinymce.explode(t),(e=>e.length>0?[e.toUpperCase()]:[]))})(e),r=Tt(e),n=Dt(e);return{rules:T([cr,dr,ur,vr,wr,_r,Rr,Dr,qr,Gr,Br,Vr,Er,jr,zr,Ur,Kr,Qr,Fr],(e=>!k(t,e.id.toUpperCase())&&k(e.levels,r)&&k(e.htmlversions,n))),allowDecorative:Rt(e),altTextMaxLength:_t(e),ignoreSelectors:["img[data-mce-placeholder]","[data-mce-bogus=all] *","[data-mce-bogus]","[data-mce-mergetag-affix]"]}})(e);(e=>{e.on("init",(()=>{A([jt,qt,Gt,Bt,Vt,Wt],(t=>{e.serializer.addTempAttr(t)}))}))})(e);const r=W(!1),n=(e=>Ht({editor:e,violation:qt,current:Wt,info:Gt,warn:Bt,error:Vt}))(e),o=zt();let a=[],i=0;const s=()=>{const r=Jt(t,e.getBody()),n=((e,t)=>S(t,(t=>{const r=t.rule,n=t.element,o=r.id.toUpperCase(),a=l(r.getDescriptionKey)?r.getDescriptionKey(n,Rt(e)):r.desckey,i=(e=>{const{tagName:t,value:r}=(t=>{const r=t.localName;if("img"===r){const t=e.getAttribute("src")||"";return{tagName:"a11y.issue.dialog.tagname.Image",value:t.startsWith("data:image")?t:t.split("/").pop()||"unknown_image"}}return"table"===r?{tagName:"a11y.issue.dialog.tagname.Table",value:Xr(t)}:"th"===r?{tagName:"a11y.issue.dialog.tagname.Table",value:Xr(t.closest("table"))}:"a"===r?{tagName:"a11y.issue.dialog.tagname.Link",value:e.getAttribute("href")||""}:{tagName:"a11y.issue.dialog.tagname.Text",value:e.textContent||""}})(e),n=(e=>{const t={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[<>"']/g,(e=>t[e]))})(r.length>30?`${r.substring(0,30)}...`:r);return r?`<div id="accessibility-issue__contentID"><span>${Pt(t)}:&nbsp;</span><span>${Pt(["quotation",n])}</span></div>`:`<div id="accessibility-issue__contentID">${Pt(t)}</div>`})(n);return{id:o,description:a,element:X(n),url:r.url,severity:r.severity,contentId:i}})))(e,r);return T(n,(t=>{const r=(a=t.element,Te(a,o).map((e=>e.split(" "))).getOr([])),n=$t(e);var a;return!k(r,t.id)&&n(Yr(t))}))},c=t=>(i+=t,i=i<0?i+a.length:i%a.length,n.moveTo(a[i].element,a[i].severity),e.selection.scrollIntoView(a[i].element.dom),{summaryLabel:Pt(["a11y.widget.counter",i+1,a.length]),issue:a[i],index:i+1}),d=()=>a.length>0?f.some(c(0)):f.none(),u=()=>{r.set(!0),a=s(),i=0},p=()=>{n.stop(),r.set(!1),i=0,a=[]};return{scan:()=>((e=>{e.dispatch("A11ycheckStart")})(e),u(),n.start(a),d()),stepIssue:c,getIssues:()=>a.slice(0),getCurrent:d,getReport:()=>{const e=r.get();try{return e||u(),S(a,Yr)}finally{e||p()}},resolveCurrent:t=>(t&&(((e,t,r)=>{const n=Te(e,t).map((e=>e.concat(" ",r))).getOr(r);Se(e,t,n)})(a[i].element,o,a[i].id),(e=>{e.dispatch("A11ycheckIgnore")})(e)),a=s(),d()),clear:p,isAuditing:()=>r.get()}},en=(e,t)=>{const r=t.ui.registry.getAll().icons;return f.from(r[e]).orThunk((()=>f.from(r["temporary-placeholder"]))).getOr("!not found!")},tn={success:"checkmark",info:"info",warning:"notice",error:"warning"},rn=(e,t,r,n,o,a,i,s)=>{const c=Pt(r),d=Pt(t),u=tn[r],p=s?`${(e=>{const t=(new Date).getTime(),r=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return j++,e+"_"+r+j+String(t)})("announcement-live-region")}`:"announcement-live-region",m=`<div class="accessibility-issue__description" ><div aria-live="polite" aria-atomic="true" role="alert" class="accessbility-sr-only" id="${p}"></div><div><div><div class="tox-icon accessibility-issue__icon">${en(u,e)}</div><h2>${c.toUpperCase()}</h2></div>${a||""}<p>${d}</p></div><div id="accessibility-issue__document">`+((e,t,r)=>{const n=Pt("a11y.widget.help.title"),o=Pt("moreInfo");return"help"===e?`<a href="${r}" data-mce-tooltip="${n}" class="tox-button--more-info-a11ychecker-link" target="_blank" data-alloy-tabstop="true" tabindex="-1">${o}</a>`:`<div class="tox-icon">${en(e,t)}</div>`})(n,e,i)+"</div></div>";return setTimeout((()=>{const e=document.getElementById(p);if(l(e)){const t=o?`${o}, `:"",r=a?`: ${a}`:"";e.innerHTML=`${t}${c}${r}, ${d}`}}),100),m},nn=(e,t,r,n)=>({type:"listbox",label:t,name:e,items:S(r,(e=>({text:n(e.text),value:e.value})))}),on=(e,t)=>({type:"input",name:e,label:t}),an=(e,t,r)=>({type:"label",label:t,items:[{type:"checkbox",name:e,label:r}]}),sn=(e,t)=>({title:Pt("a11y.widget.title"),body:{type:"panel",items:[{type:"panel",classes:["tox-accessibility-issue","accessibility-issue--success"],items:[{type:"htmlpanel",html:rn(e,"a11y.widget.issue.none","success","checkmark"),presets:"presentation"}]}]},buttons:[{type:"submit",name:"ok",text:"OK",primary:!0}],onSubmit:e=>e.close(),onClose:t}),ln=(e,t,r)=>{e.redial(t),e.focus(r)};var cn;!function(e){e.Next="next",e.Prev="prev",e.Ignore="ignore",e.Ok="ok",e.Repair="repair"}(cn||(cn={}));const dn=({issue:e,summaryLabel:t},r,n,o,a,i)=>{const s=It(a),l=e=>dn(e,r,n,f.none(),a,i),c=o=>(s,{name:c})=>{if(c===cn.Next||c===cn.Prev){const e=r.stepIssue(c===cn.Next?1:-1);ln(s,l(e),c)}else c===cn.Ignore?r.resolveCurrent(!0).fold((()=>ln(s,sn(a,i),cn.Ok)),(e=>ln(s,l(e),cn.Ignore))):c===cn.Repair&&((o,s)=>{const c=s=>{ln(o,dn({issue:e,summaryLabel:t},r,n,f.some(s),a,i),cn.Repair)},d=()=>r.resolveCurrent(!1).fold((()=>r.scan().fold((()=>ln(o,sn(a,i),cn.Ok)),(e=>ln(o,l(e),cn.Ignore)))),(e=>ln(o,l(e),cn.Ignore)));s.each((t=>{t.repair(e.element,e.id,((e,t)=>{const r={},n={};return((e,t,r,n)=>{P(e,((e,o)=>{(t(e,o)?r:n)(e,o)}))})(e,t,O(r),O(n)),{t:r,f:n}})(o.getData(),((t,r)=>{return n=r,""===(o=e.id)||n.length>=o.length&&n.substr(0,0+o.length)===o;var n,o})).t,(e=>e.fold(c,d)))}))})(s,o)},d=t=>r=>t.each((t=>{t.onChange.each((t=>t(r,r.getData(),e))),t.shouldDisableRepair.each((t=>{const n=t(r.getData(),e);r.setEnabled(cn.Repair,!n)}))})),u=(r,n,o)=>{const l="warning"===(u=e.severity)?"warn":u;var u;const p=n.map((()=>({type:"panel",classes:["accessibility-issue__repair"],items:[{type:"panel",classes:["accessibility-issue__header"],items:[{type:"htmlpanel",html:`<h2 id="accessibility-issue__subheader">${Pt("solution")}</h1>`,presets:"presentation"}]},...n.map((e=>e.items)).getOr([])]}))).toArray();return{title:Pt("a11y.widget.title"),body:{type:"panel",classes:["tox-accessibility-issue",`accessibility-issue--${l}`],items:[{type:"panel",classes:["accessibility-issue__header"],items:[{type:"htmlpanel",html:`<h2 id="accessibility-issue__subheader">${t}</h1>`,presets:"presentation"},{type:"button",name:cn.Prev,text:Pt("a11y.widget.previous"),icon:"action-prev",borderless:!0},{type:"button",name:cn.Next,text:Pt("a11y.widget.next"),icon:"action-next",borderless:!0}]},{type:"htmlpanel",html:rn(a,e.description,e.severity,"help",t,e.contentId,s(e.id),!0),presets:"presentation"},...p]},buttons:[{type:"custom",name:cn.Ignore,text:Pt("a11y.widget.ignore")},{type:"custom",name:cn.Repair,text:Pt("a11y.widget.repair"),enabled:!o,primary:!0}],initialData:{...n.map((e=>e.initialData)).getOr({})},onAction:c(r),onChange:d(r),onClose:i}};return n(e.id).fold((()=>u(f.none(),f.none(),!0)),(t=>{const r=((e,t,r)=>{const n=t.element;return r.fold((()=>e.ui.map((e=>e(t.id,n)))),(r=>e.ui.map((e=>{const o=e(t.id,n);return{items:o.items.concat([(a=r.errorMessage,{type:"htmlpanel",html:`<div class="tox-form__group--error">${a}</div>`})]),initialData:{...o.initialData,...r.repairErrorData}};var a}))))})(t,e,o),n=z(t.shouldDisableRepair,r,((t,r)=>t(r.initialData,e))).getOr(!1);return u(f.some(t),r,n)}))},un=(e,t,r)=>B.error({errorMessage:t(e),repairErrorData:r}),pn=(e,t,r,n,o,a)=>0===t.trim().length?un(n,a,{}):mn(e,t,r,o,a),mn=(e,t,r,n,o)=>t===r?un(n,o,{}):B.value(e),hn=(e,t,r,n,o,a,i,s=150)=>((e,t,r,n,o)=>{const a=Te(e,"src").getOr(""),i=r[`${t}_textinput`];return r[`${t}_checkbox`]?gn(e):((e,t,r,n)=>0===t.trim().length?un(r,n,{}):B.value(e))(e,i,n.emptyMessage,o).bind((e=>((e,t,r,n,o)=>Pr(r,t)?un(n,o,{}):B.value(e))(e,i,a,n.clashMessage,o).bind((e=>n.lengthCheck?((e,t,r,n,o,a)=>{const i=`${t}_textinput`;return r.length>a?un([n,r.length,a],o,{[i]:r}):B.value(e)})(e,t,i,n.lengthCheck.errorMessage,o,n.lengthCheck.maxLength).map((()=>vn(e,i))):B.value(vn(e,i))))))})(e,t,r,{emptyMessage:n,clashMessage:o,lengthCheck:{errorMessage:a,maxLength:s}},i),gn=e=>(Se(e,"alt",""),Se(e,"role","presentation"),De(e,"title"),De(e,"aria-label"),De(e,"aria-labelledby"),De(e,"aria-describedby"),B.value(e)),yn=e=>{Te(e,"role").exists((e=>{const t=e.trim().toLowerCase();return"presentation"===t||"none"===t||""===t}))&&De(e,"role")},vn=(e,t)=>(Se(e,"alt",t),yn(e),e),fn=(e,t,r,n,o,a)=>{const i=Ae(e,"summary");return pn(e,r[t],i,n,o,a).map((n=>{const o=qe(e,"caption").fold((()=>Q("caption")),(e=>{var t;return(t=e).dom.textContent="",A(me(t),(e=>{Ie(e)})),e}));return((e,t)=>{e.dom.textContent=t})(o,r[t]),((e,t)=>{he(e).fold((()=>{ke(e,t)}),(r=>{e.dom.insertBefore(t.dom,r.dom)}))})(n,o),n}))},wn=e=>`${e}_checkbox`,bn=e=>`${e}_textinput`,xn=(e,t)=>{const r=on(bn(t),Pt(e?"a11y.i1.repair.info.decorativeAllowed":"a11y.i1.repair.info"));return e?[an(wn(t),Pt("a11y.i1.repair.checkboxlabel"),Pt("a11y.i1.repair.checkboxtext")),r]:[r]},kn=(e,t,r)=>{const n=Wr(e),o=t?{[wn(r)]:!1}:{};return{[bn(r)]:n,...o}},Cn=e=>e?f.some(((e,t)=>{var r;const n=null===(r=Ae(t.element,"role"))||void 0===r?void 0:r.toLowerCase().trim(),o="presentation"===n||"none"===n,a=""===n,i=Te(t.element,"alt").exists((e=>e.trim().length>0));return!(o&&i||a)&&((e,t)=>{const r=t.id,n=!0===e[wn(r)],o=e[bn(r)].length>0;return!n&&!o})(e,t)})):f.none(),Sn=e=>e?f.some(((e,t,r)=>{var n;const o=null===(n=Ae(r.element,"role"))||void 0===n?void 0:n.toLowerCase().trim(),a="presentation"===o||"none"===o,i=""===o,s=Te(r.element,"alt").exists((e=>e.trim().length>0));a&&s||i?e.setEnabled(cn.Repair,!0):((e,t,r)=>{const n=r.id,o=wn(n),a=bn(n);!0===t[o]?(e.setEnabled(a,!1),e.setEnabled(cn.Repair,!0)):(e.setEnabled(a,!0),t[a].length>0?(e.setEnabled(cn.Repair,!0),e.setEnabled(o,!0)):(e.setEnabled(o,!0),e.setEnabled(cn.Repair,!1)))})(e,t,r)})):f.none(),An=()=>Fe(Ne(X(document)),".tox-dialog"),Tn=(e,t)=>{const r=F(),n=F(),o=()=>{(e=>{e.dispatch("A11ycheckStop")})(e),n.get().each((e=>e.unbind())),n.clear(),r.clear(),t.clear()},a=()=>{const a=((e,t,r,n,o)=>t.scan().fold((()=>e(sn(n,o))),(a=>e(dn(a,t,r,f.none(),n,o)))))((t=>{const r=An(),o=e.windowManager.open(t,{inline:"toolbar"});var a,i;return(a=r,i=An(),$(i,(e=>!C(a,(t=>ee(t,e)))))).each((t=>{(t=>{n.set(we(t,"click",(t=>{Be(t.target,"a.tox-button--more-info-a11ychecker-link").each((t=>{(e=>{e.dispatch("A11ycheckShowDetails")})(e)}))})))})(t)})),o}),t,(e=>{const t=Rt(e),r=_t(e),n=(t,r)=>{e.undoManager.transact((()=>{const n=r();n.isValue()&&(e=>{e.dispatch("A11ycheckRepair")})(e),t(n)}))},o={H93:f.some({ui:f.some(((e,t)=>({items:[nn(e,Pt("a11y.h93.repair.info"),[{text:"a11y.h93.repair.deduplicate.others",value:"others"},{text:"a11y.h93.repair.deduplicate.this",value:"this"},{text:"a11y.h93.repair.deduplicate.all",value:"all"}],Pt)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{n(a,(()=>((e,t,r,n)=>{const o=r[t],a="all"===o||"this"===o;if("all"===o||"others"===o){const t=Ae(e,"id"),r=n.getBody(),o=X(r),a=Fe(o,`*[id="${t}"]`),i=T(a,(t=>!ee(t,e)));A(i,(e=>{De(e,"id")}))}return a&&De(e,"id"),B.value(e)})(t,r,o,e)))},shouldDisableRepair:f.none(),onChange:f.none()}),I1:f.some({ui:f.some(((e,r)=>{const n=Zt(r),o=Qt(n);return t||"decorative"!==o?{items:xn(t,e),initialData:kn(r,t,e)}:{items:[on(`${e}_textinput`,Pt("a11y.i1.repair.info.decorativeNotAllowed"))],initialData:{[`${e}_textinput`]:Wr(r)}}})),repair:(e,o,a,i)=>{const s=Zt(e),l=Qt(s);if("mixed_signals"===l){const t=a[wn(o)];n(i,(()=>t?gn(e):hn(e,o,a,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate","a11y.i4.repair.error",Pt,r).map((e=>{return yn(t=e),t;var t}))))}else n(i,t||"decorative"!==l?()=>hn(e,o,a,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate","a11y.i4.repair.error",Pt,r):()=>hn(e,o,a,"a11y.i1.repair.errors.emptyNoDecorative","a11y.i1.repair.errors.duplicate","a11y.i4.repair.error",Pt,r).map((e=>(yn(e),e))))},shouldDisableRepair:Cn(t),onChange:Sn(t)}),T1:f.some({ui:f.some(((e,t)=>({items:[on(e,Pt("a11y.t1.repair.info"))],initialData:{[e]:""}}))),repair:(e,t,r,o)=>{n(o,(()=>fn(e,t,r,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",Pt)))},shouldDisableRepair:f.none(),onChange:f.none()}),T2:f.some({ui:f.some(((e,t)=>({items:[on(e,Pt("a11y.t2.repair.info"))],initialData:{[e]:""}}))),repair:(e,t,r,o)=>{n(o,(()=>((e,t,r,n,o,a)=>{const i=Ge(e,"caption").filter(oe).map(ze).getOr("");return pn(e,r[t],i,"a11y.t2.repair.errors.empty","a11y.t2.repair.errors.duplicate",a).map((n=>(Se(e,"summary",r[t]),n)))})(e,t,r,0,0,Pt)))},shouldDisableRepair:f.none(),onChange:f.none()}),T3:f.some({ui:f.some(((e,t)=>{const r=qe(t,"caption").fold(p(""),Re);return{items:[on(e,Pt("a11y.t1.repair.info"))],initialData:{[e]:r}}})),repair:(e,t,r,o)=>{n(o,(()=>fn(e,t,r,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",Pt)))},shouldDisableRepair:f.none(),onChange:f.none()}),T4A:f.none(),T4B:f.some({ui:f.some(((e,t)=>({items:[nn(e,Pt("a11y.t4b.repair.info"),[{text:"a11y.t4c.repair.header.row",value:"row"},{text:"a11y.t4c.repair.header.col",value:"col"}],Pt)],initialData:{[e]:""}}))),repair:(e,t,r,o)=>{n(o,(()=>((e,t,r)=>{let n=[];if("row"===r[t]){const t=X(e.dom.rows[0]);n=Ue(t,"td")}else"col"===r[t]&&A(e.dom.rows,(e=>{qe(X(e),"td").each((e=>{n.push(e)}))}));return A(n,(e=>{const t=Q("th");A(e.dom.attributes,(r=>{Te(e,r.name).each((e=>Se(t,r.name,e)))})),t.dom.innerHTML=e.dom.innerHTML,xe(e,t),Ie(e)})),B.value(e)})(e,t,r)))},shouldDisableRepair:f.some(((e,t)=>!Ke(t.element,"td"))),onChange:f.none()}),T4C:f.some({ui:f.some(((e,t)=>({items:[nn(e,Pt("a11y.t4c.repair.info"),[{text:"a11y.t4c.repair.scope.row",value:"row"},{text:"a11y.t4c.repair.scope.col",value:"col"},{text:"a11y.t4c.repair.scope.rowgroup",value:"rowgroup"},{text:"a11y.t4c.repair.scope.colgroup",value:"colgroup"}],Pt)],initialData:{[e]:""}}))),repair:(e,t,r,o)=>{n(o,(()=>((e,t,r)=>(Se(e,"scope",r[t]),B.value(e)))(e,t,r)))},shouldDisableRepair:f.none(),onChange:f.none()}),D1:f.some({ui:f.some(((e,t)=>({items:[nn(e,Pt("a11y.d1.repair.info"),[{text:"a11y.d1.repair.block.h1",value:"h1"},{text:"a11y.d1.repair.block.h2",value:"h2"},{text:"a11y.d1.repair.block.h3",value:"h3"},{text:"a11y.d1.repair.block.h4",value:"h4"},{text:"a11y.d1.repair.block.h5",value:"h5"},{text:"a11y.d1.repair.block.h6",value:"h6"}],Pt)],initialData:{[e]:""}}))),repair:(e,t,r,o)=>{n(o,(()=>((e,t,r)=>{const n=ce(e),o=Q(r[t],n.dom),a=me(e),i=S(a,_e);Ce(o,i);const s=Fe(o,"b,strong");return A(s,$e),be(e,o),Ie(e),B.value(o)})(e,t,r)))},shouldDisableRepair:f.none(),onChange:f.none()}),D2:f.none(),D3:f.some({ui:f.none(),repair:(e,t,r,o)=>{n(o,(()=>(e=>{const t=R(pe(e));return $(t,le("a")).fold((()=>B.error({errorMessage:"Failed to find previous link",repairErrorData:{}})),(r=>{for(const e of t){if(ee(e,r))break;ie(e)&&Ie(e)}const n=me(e);return Ce(r,n),Ie(e),B.value(r)}))})(e)))},shouldDisableRepair:f.none(),onChange:f.none()}),I2:f.some({ui:f.some(((e,t)=>({items:[on(`${e}_textinput`,Pt("a11y.i2.repair.info"))],initialData:{[`${e}_textinput`]:Wr(t)}}))),repair:(e,t,o,a)=>{n(a,(()=>hn(e,t,o,"a11y.i2.repair.errors.empty","a11y.i1.repair.errors.duplicate","a11y.i4.repair.error",Pt,r)))},shouldDisableRepair:f.none(),onChange:f.none()}),I3:f.some({ui:f.some(((e,t)=>({items:[on(`${e}_textinput`,Pt("a11y.i3.repair.info"))],initialData:{[`${e}_textinput`]:Wr(t)}}))),repair:(e,t,o,a)=>{n(a,(()=>hn(e,t,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate","a11y.i4.repair.error",Pt,r)))},shouldDisableRepair:f.none(),onChange:f.none()}),I4:f.some({ui:f.some(((e,t)=>({items:[on(`${e}_textinput`,Pt("a11y.i4.repair.info"))],initialData:{[`${e}_textinput`]:Wr(t)}}))),repair:(e,t,o,a)=>{n(a,(()=>hn(e,t,o,"a11y.i4.repair.errors.empty","a11y.i1.repair.errors.duplicate","a11y.i4.repair.error",Pt,r)))},shouldDisableRepair:f.none(),onChange:f.none()})};return e=>o.hasOwnProperty(e)?o[e]:f.none()})(e),e,o);r.set(a)},i=e=>e.close();return e.ui.registry.addButton("a11ycheck",{tooltip:Pt("a11y.control.tooltip"),icon:"accessibility-check",onAction:a}),e.ui.registry.addMenuItem("a11ycheck",{icon:"accessibility-check",text:Pt("a11y.control.menutext"),onAction:a}),()=>r.get().fold(a,i)};((e,t)=>{const{i18n:r=!0}=t;r&&tinymce.PluginManager.requireLangPack(e,"ar,bg-BG,ca,cs,da,de,el,es,eu,fa,fi,fr-FR,he-IL,hi,hr,hu-HU,id,it,ja,kk,ko-KR,ms,nb-NO,nl,pl,pt-BR,pt-PT,ro,ru,sk,sl-SI,sv-SE,th-TH,tr,uk,vi,zh-CN,zh-TW"),tinymce.PluginManager.add(e,wt(e,t))})("a11ychecker",{setup:e=>{(e=>{const t=e.options.register;t("a11ychecker_allow_decorative_images",{processor:"boolean"});const n=[kt(),Ct(),St()];t("a11ychecker_level",{processor:e=>r(e)&&k(n,e),default:Ct()});const o=[bt(),xt()];t("a11ychecker_html_version",{processor:e=>r(e)&&k(o,e),default:xt()}),t("a11ychecker_issue_url_callback",{processor:"function",default:e=>`https://www.tiny.cloud/docs/tinymce/${tinymce.majorVersion}/a11ychecker/#${e}`}),t("a11ychecker_ignored_rules",{processor:"string",default:""}),t("a11ychecker_filter_issue",{processor:"function",default:v}),t("a11ychecker_alt_text_max_length",{processor:"number",default:150})})(e);const t=Jr(e),n=Tn(e,t);return{getReport:t.getReport,toggleaudit:n}}})}();