12 lines
91 KiB
JavaScript
12 lines
91 KiB
JavaScript
/*!
|
|
* Tiny Advanced Typography plugin
|
|
*
|
|
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
|
|
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
|
|
*
|
|
* Version: 7.0.0-22
|
|
*/
|
|
|
|
!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},n=(e,t,n)=>({major:e,minor:t,patch:n}),r=t=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return r?n(e(r[1]),e(r[2]),e(r[3])):n(0,0,0)},o=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=r=e,(o=String).prototype.isPrototypeOf(n)||(null===(a=r.constructor)||void 0===a?void 0:a.name)===o.name)?"string":t;var n,r,o,a})(t)===e,a=e=>t=>typeof t===e,s=o("string"),i=o("array"),u=(null,e=>null===e);const l=a("boolean"),c=e=>!(e=>null==e)(e),p=a("function"),g=a("number"),h=()=>{},m=(e,t)=>(...n)=>e(t.apply(null,n)),d=e=>()=>e,f=e=>e,y=(e,t)=>e===t;function v(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}const b=d(!1),x=d(!0);class ${constructor(e,t){this.tag=e,this.value=t}static some(e){return new $(!0,e)}static none(){return $.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?$.some(e(this.value)):$.none()}bind(e){return this.tag?e(this.value):$.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:$.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(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?$.some(e):$.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()"}}$.singletonNone=new $(!1);const w=Array.prototype.slice,E=Array.prototype.indexOf,R=Array.prototype.push,T=(e,t)=>((e,t)=>E.call(e,t))(e,t)>-1,q=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},A=(e,t)=>{const n=e.length,r=new Array(n);for(let o=0;o<n;o++){const n=e[o];r[o]=t(n,o)}return r},S=(e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)},k=(e,t)=>{const n=[];for(let r=0,o=e.length;r<o;r++){const o=e[r];t(o,r)&&n.push(o)}return n},B=(e,t,n)=>(S(e,((e,r)=>{n=t(n,e,r)})),n),D=(e,t)=>((e,t,n)=>{for(let r=0,o=e.length;r<o;r++){const o=e[r];if(t(o,r))return $.some(o);if(n(o,r))break}return $.none()})(e,t,b),N=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return $.some(n);return $.none()},C=(e,t)=>(e=>{const t=[];for(let n=0,r=e.length;n<r;++n){if(!i(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);R.apply(t,e[n])}return t})(A(e,t)),L=(e,t)=>{for(let n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n))return!1;return!0},I=Object.keys,O=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},P={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return O(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return O(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return O(n)},fromDom:O,fromPoint:(e,t,n)=>$.from(e.dom.elementFromPoint(t,n)).map(O)};"undefined"!=typeof window?window:Function("return this;")();const z=e=>e.dom.nodeName.toLowerCase(),M=e=>e.dom.nodeType,j=e=>t=>M(t)===e,U=e=>8===M(e)||"#comment"===z(e),W=j(1),F=j(3),_=j(9),H=j(11),Q=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;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")}},V=(e,t)=>e.dom===t.dom,G=Q,K=e=>_(e)?e:P.fromDom(e.dom.ownerDocument),X=e=>$.from(e.dom.parentNode).map(P.fromDom),Z=e=>$.from(e.dom.parentElement).map(P.fromDom),Y=(e,t)=>{const n=p(t)?t:b;let r=e.dom;const o=[];for(;null!==r.parentNode&&void 0!==r.parentNode;){const e=r.parentNode,t=P.fromDom(e);if(o.push(t),!0===n(t))break;r=e}return o},J=e=>$.from(e.dom.previousSibling).map(P.fromDom),ee=e=>$.from(e.dom.nextSibling).map(P.fromDom),te=e=>A(e.dom.childNodes,P.fromDom),ne=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode)?e=>P.fromDom(e.dom.getRootNode()):K,re=e=>P.fromDom(e.dom.host),oe=e=>{const t=F(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=ne(e);return H(n=t)&&c(n.dom.host)?$.some(t):$.none();var n})(P.fromDom(t)).fold((()=>n.body.contains(t)),(r=oe,o=re,e=>r(o(e))));var r,o},ae=(e,t,n)=>{let r=e.dom;const o=p(n)?n:b;for(;r.parentNode;){r=r.parentNode;const e=P.fromDom(r);if(t(e))return $.some(e);if(o(e))break}return $.none()},se=(e,t,n)=>ae(e,(e=>Q(e,t)),n),ie=(e,t,n)=>((e,t,n,r,o)=>((e,t)=>Q(e,t))(n,r)?$.some(n):p(o)&&o(n)?$.none():t(n,r,o))(0,se,e,t,n),ue=e=>e.dom.contentEditable,le=(e,t,n)=>{if(!(s(n)||l(n)||g(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+"")},ce=(e,t,n)=>{le(e.dom,t,n)},pe=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},ge=(e,t)=>$.from(pe(e,t)),he=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},me=(e,t)=>{e.dom.removeAttribute(t)},de=(fe=/^\s+|\s+$/g,e=>e.replace(fe,""));var fe;const ye=e=>void 0!==e.style&&p(e.style.getPropertyValue),ve=(e,t,n)=>{((e,t,n)=>{if(!s(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);ye(e)&&e.style.setProperty(t,n)})(e.dom,t,n)},be=(e,t)=>{const n=e.dom,r=window.getComputedStyle(n).getPropertyValue(t);return""!==r||oe(e)?r:xe(n,t)},xe=(e,t)=>ye(e)?e.style.getPropertyValue(t):"",$e=(e,t)=>{const n=e.dom,r=xe(n,t);return $.from(r).filter((e=>e.length>0))},we=(e,t)=>{((e,t)=>{ye(e)&&e.style.removeProperty(t)})(e.dom,t),((e,t,n=y)=>e.exists((e=>n(e,t))))(ge(e,"style").map(de),"")&&me(e,"style")},Ee=(e,t)=>{X(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},Re=(e,t)=>{ee(e).fold((()=>{X(e).each((e=>{qe(e,t)}))}),(e=>{Ee(e,t)}))},Te=(e,t)=>{(e=>((e,t)=>{const n=e.dom.childNodes;return $.from(n[0]).map(P.fromDom)})(e))(e).fold((()=>{qe(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},qe=(e,t)=>{e.dom.appendChild(t.dom)},Ae=(e,t)=>{Ee(e,t),qe(t,e)},Se=(e,t)=>{S(t,((n,r)=>{const o=0===r?e:t[r-1];Re(o,n)}))},ke=(e,t)=>{S(t,(t=>{qe(e,t)}))},Be=(e,t)=>{let n=[];return S(te(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(Be(e,t))})),n},De=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Ne=e=>{const t=te(e);t.length>0&&Se(e,t),De(e)},Ce=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return 1!==(r=n).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?[]:A(n.querySelectorAll(e),P.fromDom);var r})(t,e),Le=((e,t)=>{const n=t=>e(t)?$.from(t.dom.nodeValue):$.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return n(t).getOr("")},getOption:n,set:(t,n)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=n}}})(F),Ie=e=>Le.get(e),Oe=(e,t)=>Le.set(e,t);var Pe=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],ze=()=>({up:d({selector:se,closest:ie,predicate:ae,all:Y}),down:d({selector:Ce,predicate:Be}),styles:d({get:be,getRaw:$e,set:ve,remove:we}),attrs:d({get:pe,set:ce,remove:me,copyTo:(e,t)=>{((e,t)=>{const n=e.dom;((e,t)=>{const n=I(e);for(let r=0,o=n.length;r<o;r++){const o=n[r];t(e[o],o)}})(t,((e,t)=>{le(n,t,e)}))})(t,B(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))}}),insert:d({before:Ee,after:Re,afterAll:Se,append:qe,appendAll:ke,prepend:Te,wrap:Ae}),remove:d({unwrap:Ne,remove:De}),create:d({nu:P.fromTag,clone:e=>P.fromDom(e.dom.cloneNode(!1)),text:P.fromText}),query:d({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:J,nextSibling:ee}),property:d({children:te,name:z,parent:X,document:e=>K(e).dom,isText:F,isComment:U,isElement:W,isSpecial:e=>{const t=z(e);return T(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>W(e)?ge(e,"lang"):$.none(),getText:Ie,setText:Oe,isBoundary:e=>!!W(e)&&("body"===z(e)||T(Pe,z(e))),isEmptyTag:e=>!!W(e)&&T(["br","img","hr","input"],z(e)),isNonEditable:e=>W(e)&&"false"===pe(e,"contenteditable")}),eq:V,is:G});const Me="[-'\\.\u2018\u2019\u2024\ufe52\uff07\uff0e]",je="[:\xb7\xb7\u05f4\u2027\ufe13\ufe55\uff1a]",Ue="[\xb1+*/,;;\u0589\u060c\u060d\u066c\u07f8\u2044\ufe10\ufe14\ufe50\ufe54\uff0c\uff1b]",We="[0-9\u0660-\u0669\u066b\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\uaa50-\uaa59\uabf0-\uabf9]",Fe="\\r",_e="\\n",He="[\v\f\x85\u2028\u2029]",Qe="[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f\u109a-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b6-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u192b\u1930-\u193b\u19b0-\u19c0\u19c8\u19c9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f\u1b00-\u1b04\u1b34-\u1b44\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1baa\u1be6-\u1bf3\u1c24-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe3-\uabea\uabec\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]",Ve="[\xad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200e\u200f\u202a-\u202e\u2060-\u2064\u206a-\u206f\ufeff\ufff9-\ufffb]",Ge="[\u3031-\u3035\u309b\u309c\u30a0-\u30fa\u30fc-\u30ff\u31f0-\u31ff\u32d0-\u32fe\u3300-\u3357\uff66-\uff9d]",Ke="[=_\u203f\u2040\u2054\ufe33\ufe34\ufe4d-\ufe4f\uff3f\u2200-\u22ff<>]",Xe="[~\u2116|!-*+-\\/:;?@\\[-`{}\xa1\xab\xb7\xbb\xbf;\xb7\u055a-\u055f\u0589\u058a\u05be\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1361-\u1368\u1400\u166d\u166e\u169b\u169c\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cd3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205e\u207d\u207e\u208d\u208e\u3008\u3009\u2768-\u2775\u27c5\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc\u29fd\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e2e\u2e30\u2e31\u3001-\u3003\u3008-\u3011\u3014-\u301f\u3030\u303d\u30a0\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uabeb\ufd3e\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a\uff1b\uff1f\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]",Ze=10,Ye=[new RegExp("[A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f3\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u10a0-\u10c5\u10d0-\u10fa\u10fc\u1100-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bc0-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u24b6-\u24e9\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2d00-\u2d25\u2d30-\u2d65\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u303b\u303c\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790\ua791\ua7a0-\ua7a9\ua7fa-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]"),new RegExp(Me),new RegExp(je),new RegExp(Ue),new RegExp(We),new RegExp(Fe),new RegExp(_e),new RegExp(He),new RegExp(Qe),new RegExp(Ve),new RegExp(Ge),new RegExp(Ke),new RegExp("@")],Je=new RegExp("^"+Xe+"$"),et=d("[^\\w'\\-\xad\\u0100-\\u017F\\u00C0-\\u00FF\ufeff\\u2018\\u2019]"),tt=(e,t,n,r)=>({term:()=>new RegExp(e,r.getOr("g")),prefix:t,suffix:n}),nt=tt,rt=et,ot=(e,t)=>N(e,(e=>e.start===t)),at=(e,t,n=0)=>B(e,((e,n)=>t(n,e.len).fold(d(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:n,list:[]}).list,st=(e,t,n)=>0===t.length?e:C(e,(e=>{const r=C(t,(t=>((e,t)=>t>=e.start&&t<=e.finish)(e,t)?[t-e.start]:[]));return r.length>0?((e,t,n)=>{return r=n(e,t),o=e.start,A(r,(e=>({...e,start:e.start+o,finish:e.finish+o})));var r,o})(e,r,n):[e]})),it=(e,t)=>{const n=t.term(),r=[];let o=n.exec(e);for(;o;){const a=o.index+t.prefix(o),s=o[0].length-t.prefix(o)-t.suffix(o);r.push({start:a,finish:a+s}),n.lastIndex=a+s,o=n.exec(e)}return r},ut=it,lt=(e,t)=>{const n=C(t,(t=>{const n=it(e,t.pattern);return A(n,(e=>({...t,...e})))}));return(e=>{const t=(e=>((e,t)=>{const n=w.call(e,0);return n.sort(((e,t)=>e.start-t.start)),n})(e))(e);return B(t,((e,t)=>{const n=q(e,(e=>t.start>=e.start&&t.finish<=e.finish));return N(e,(e=>t.start===e.start)).fold((()=>n?e:[...e,t]),(n=>t.finish>e[n].finish?[...e.slice(0,n),t]:e))}),[])})(n)},ct=(e,t)=>({element:e,offset:t}),pt=(e,t,n)=>({element:e,start:t,finish:n}),gt=e=>{if(!i(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],n={};return S(e,((r,o)=>{const a=I(r);if(1!==a.length)throw new Error("one and only one name per case");const s=a[0],u=r[s];if(void 0!==n[s])throw new Error("duplicate key detected:"+s);if("cata"===s)throw new Error("cannot have a case named cata (sorry)");if(!i(u))throw new Error("case arguments must be an array");t.push(s),n[s]=(...n)=>{const r=n.length;if(r!==u.length)throw new Error("Wrong number of arguments to case "+s+". Expected "+u.length+" ("+u+"), got "+r);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[o].apply(null,n)},match:e=>{const r=I(e);if(t.length!==r.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+r.join(","));if(!L(t,(e=>T(r,e))))throw new Error("Not all branches were specified when using match. Specified: "+r.join(", ")+"\nRequired: "+t.join(", "));return e[s].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:s,params:n})}}}})),n},ht=gt([{include:["item"]},{excludeWith:["item"]},{excludeWithout:["item"]}]),mt={include:ht.include,excludeWith:ht.excludeWith,excludeWithout:ht.excludeWithout,cata:(e,t,n,r)=>e.fold(t,n,r)},dt=gt([{boundary:["item","universe"]},{empty:["item","universe"]},{text:["item","universe"]},{nonEditable:["item","universe"]}]),ft=b,yt=x,vt=d(0),bt=d(1),xt=e=>({...e,isBoundary:()=>e.fold(yt,ft,ft,ft),toText:()=>e.fold($.none,$.none,(e=>$.some(e)),$.none),is:t=>e.fold(ft,ft,((e,n)=>n.eq(e,t)),ft),len:()=>e.fold(vt,bt,((e,t)=>t.property().getText(e).length),bt)}),$t={text:m(xt,dt.text),boundary:m(xt,dt.boundary),empty:m(xt,dt.empty),nonEditable:m(xt,dt.empty),cata:(e,t,n,r,o)=>e.fold(t,n,r,o)},wt=d([]),Et=(e,t,n)=>{if(e.property().isText(t))return[$t.text(t,e)];if(e.property().isEmptyTag(t))return[$t.empty(t,e)];if(e.property().isNonEditable(t))return[];if(e.property().isElement(t)){const r=e.property().children(t),o=e.property().isBoundary(t)?[$t.boundary(t,e)]:[],a=void 0!==n&&n(t)?[]:C(r,(t=>Et(e,t,n)));return o.concat(a).concat(o)}return[]},Rt=Et,Tt=(e,t,n)=>{const r=((e,t)=>{const n=[];let r=[];return S(e,(e=>{const o=t(e);mt.cata(o,(()=>{r.push(e)}),(()=>{r.length>0&&n.push(r),n.push([e]),r=[]}),(()=>{r.length>0&&n.push(r),r=[]}))})),r.length>0&&n.push(r),n})(C(t,(t=>Rt(e,t,n))),(e=>e.match({boundary:()=>mt.excludeWithout(e),empty:()=>mt.excludeWith(e),text:()=>mt.include(e),nonEditable:()=>mt.excludeWithout(e)})));return k(r,(e=>e.length>0))},qt=(e,t,n)=>{const r=C(n,(e=>[e.start,e.finish])),o=st(t,r,((t,n)=>((e,t,n)=>{const r=e.property().getText(t),o=k(((e,t)=>{if(0===t.length)return[e];const n=B(t,((t,n)=>{if(0===n)return t;const r=e.substring(t.prev,n);return{prev:n,values:t.values.concat([r])}}),{prev:0,values:[]}),r=t[t.length-1];return r<e.length?n.values.concat(e.substring(r)):n.values})(r,n),(e=>e.length>0));if(o.length<=1)return[pt(t,0,r.length)];e.property().setText(t,o[0]);const a=at(o.slice(1),((t,n)=>{const r=e.create().text(t),o=pt(r,n,n+t.length);return $.some(o)}),o[0].length),s=A(a,(e=>e.element));return e.insert().afterAll(t,s),[pt(t,0,o[0].length)].concat(a)})(e,t.element,n)));return A(n,(t=>{const n=((e,t,n)=>{const r=ot(e,t),o=ot(e,n);return r.bind((t=>{const r=o.getOr(((e,t)=>e[e.length-1]&&e[e.length-1].finish===t?e.length+1:-1)(e,n));return r>-1?$.some(e.slice(t,r)):$.none()})).getOr([])})(o,t.start,t.finish),r=A(n,(e=>e.element)),a=A(r,e.property().getText).join("");return{elements:r,word:t.word,exact:a}}))},At=(e,t,n,r)=>((e,t,n,r)=>{const o=Tt(e,t,r);return C(o,(t=>{const r=C(t,(e=>e.fold(wt,wt,(e=>[e]),wt))),o=A(r,e.property().getText).join(""),a=lt(o,n),s=((e,t)=>at(t,((t,n)=>{const r=n+e.property().getText(t).length;return $.from(pt(t,n,r))})))(e,r);return qt(e,s,a)}))})(e,t,A(n,(e=>((e,t)=>({word:e,pattern:t}))(e,(e=>{const t="((?:^'?)|(?:"+et()+"+'?))"+e+"((?:'?$)|(?:'?"+et()+"+))";return tt(t,(e=>e.length>1?e[1].length:0),(e=>e.length>2?e[2].length:0),$.none())})(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))))),r),St=ze(),kt=(e,t)=>{if(e.property().isText(t))return ct(t,e.property().getText(t).length);{const n=e.property().children(t);return n.length>0?kt(e,n[n.length-1]):ct(t,n.length)}},Bt=(e,t,n)=>{const r=e.property().children(t);return r.length>0&&n<r.length?Bt(e,r[n],0):r.length>0&&e.property().isElement(t)&&r.length===n?kt(e,r[r.length-1]):ct(t,n)},Dt=Bt,Nt=(e,t)=>v(e.eq,t),Ct=(e,t,n)=>{const r=((e,t,n,r=b)=>{const o=[t].concat(e.up().all(t)),a=[n].concat(e.up().all(n)),s=e=>N(e,r).fold((()=>e),(t=>e.slice(0,t+1))),i=s(o),u=s(a),l=D(i,(t=>q(u,Nt(e,t))));return{firstpath:i,secondpath:u,shared:l}})(e,t,n);return r.shared.bind((t=>((e,t,n,r)=>{const o=e.property().children(t);if(e.eq(t,n[0]))return $.some([n[0]]);if(e.eq(t,r[0]))return $.some([r[0]]);const a=n=>{const r=(e=>{const t=w.call(e,0);return t.reverse(),t})(n),a=N(r,Nt(e,t)).getOr(-1),s=a<r.length-1?r[a+1]:r[a];return N(o,Nt(e,s))},s=a(n),i=a(r);return s.bind((e=>i.map((t=>{const n=Math.min(e,t),r=Math.max(e,t);return o.slice(n,r+1)}))))})(e,t,r.firstpath,r.secondpath)))},Lt=(e,t)=>{const n=e.property();return n.getLanguage(t).orThunk((()=>((e,t)=>{for(let n=0;n<e.length;n++){const r=t(e[n],n);if(r.isSome())return r}return $.none()})(e.up().all(t,b),n.getLanguage)))},It=(e,t)=>({item:e,mode:t}),Ot=(e,t,n,r=Pt)=>e.property().parent(t).map((e=>It(e,r))),Pt=(e,t,n,r=zt)=>n.sibling(e,t).map((e=>It(e,r))),zt=(e,t,n,r=zt)=>{const o=e.property().children(t);return n.first(o).map((e=>It(e,r)))},Mt=[{current:Ot,next:Pt,fallback:$.none()},{current:Pt,next:zt,fallback:$.some(Ot)},{current:zt,next:zt,fallback:$.some(Pt)}],jt=(e,t,n,r,o=Mt)=>D(o,(e=>e.current===n)).bind((n=>n.current(e,t,r,n.next).orThunk((()=>n.fallback.bind((n=>jt(e,t,n,r))))))),Ut={left:()=>({sibling:(e,t)=>e.query().prevSibling(t),first:e=>e.length>0?$.some(e[e.length-1]):$.none()}),right:()=>({sibling:(e,t)=>e.query().nextSibling(t),first:e=>e.length>0?$.some(e[0]):$.none()})},Wt=()=>({left:Ut.left,right:Ut.right}),Ft=jt,_t=(e,t,n,r)=>({item:e,start:t,finish:n,text:r}),Ht=(e,t)=>({items:e,abort:t}),Qt=(e,t)=>{const n=e.property().getText(t);return _t(t,0,n.length,n)},Vt=(e,t,n)=>Ht([],!0),Gt=(e,t,n)=>Ht([],!1),Kt=(e,t,n)=>{const r=e.property().getText(t);return n(r).fold((()=>Ht([_t(t,0,r.length,r)],!1)),(e=>{const n=e[0]===e[1]?[]:[_t(t,e[0],e[1],r.substring(e[0],e[1]))];return Ht(n,!0)}))},Xt=Qt,Zt=(e,t)=>e.property().isText(t)?Qt(e,t):_t(t,0,0,""),Yt=(e,t,n,r)=>(e.property().isBoundary(t)||e.property().isEmptyTag(t)||r(e,t)?Vt:e.property().isText(t)?Kt:Gt)(e,t,n),Jt=new RegExp(rt()+"+","g"),en=d(0),tn=Wt(),nn=tn.left(),rn=tn.right(),on={left:{sibling:nn.sibling,first:nn.first,slicer:e=>(e=>{const t=ut(e,nt(rt(),en,en,$.none()));return $.from(t[t.length-1]).map((e=>e.start))})(e).map((t=>[t+1,e.length]))},right:{sibling:rn.sibling,first:rn.first,slicer:e=>(e=>{const t=e.search(Jt);return t>-1?$.some(t):$.none()})(e).map((e=>[0,e]))}},an=(e,t,n,r,o)=>{const a=Ft(e,t,n,r).map((t=>{const n=Yt(e,t.item,r.slicer,o),a=n.abort?[]:an(e,t.item,t.mode,r,o);return n.items.concat(a)})).getOr([]);return k(a,(e=>e.text.trim().length>0))},sn=(e,t,n,r)=>{const o=((e,t,n)=>an(e,t,Pt,on.left,n))(e,t,r),a=((e,t,n)=>an(e,t,Pt,on.right,n))(e,n,r);return{left:o.length>0?o[o.length-1]:Zt(e,t),right:a.length>0?a[a.length-1]:Zt(e,n),isEmpty:0===o.length&&0===a.length}},un=Ye,ln=e=>{let t=13;const n=un.length;for(let r=0;r<n;++r){const n=un[r];if(n&&n.test(e)){t=r;break}}return t},cn=(e,t)=>{const n=e[t],r=e[t+1];if(t<0||t>e.length-1&&0!==t)return!1;if(0===n&&0===r)return!1;const o=e[t+2];if(0===n&&(2===r||1===r||12===r)&&0===o)return!1;const a=e[t-1];return(2!==n&&1!==n&&12!==r||0!==r||0!==a)&&(4!==n&&0!==n||4!==r&&0!==r)&&(3!==n&&1!==n||4!==r||4!==a)&&(4!==n||3!==r&&1!==r||4!==o)&&(8!==n&&9!==n||0!==r&&4!==r&&r!==Ze&&8!==r&&9!==r)&&(8!==r&&(9!==r||0!==o&&4!==o&&o!==Ze&&8!==o&&9!==o)||0!==n&&4!==n&&n!==Ze&&8!==n&&9!==n)&&(5!==n||6!==r)&&(7===n||5===n||6===n||7===r||5===r||6===r||(n!==Ze||r!==Ze)&&(11!==r||0!==n&&4!==n&&n!==Ze&&11!==n)&&(11!==n||0!==r&&4!==r&&r!==Ze)&&12!==n)},pn=/^\s+$/,gn=Je,hn=e=>"http"===e||"https"===e,mn=(e,t)=>{const n=((e,t)=>{let n;for(n=t;n<e.length&&!pn.test(e[n]);n++);return n})(e,t+1);return"://"===e.slice(t+1,n).join("").substr(0,3)?n:t},dn=(e,t,n)=>({word:e,left:t,right:n}),fn=["'","\u2018","\u2019"],yn=C(fn,(e=>A(["twas"],(t=>e+t)))),vn=e=>T(fn,e),bn=e=>{const{words:t,indices:n}=((e,t,n)=>{n={includeWhitespace:!1,includePunctuation:!1,...n};const r=A(e,t);return((e,t,n,r)=>{const o=[],a=[];let s=[];for(let i=0;i<n.length;++i)if(s.push(e[i]),cn(n,i)){const n=t[i];if((r.includeWhitespace||!pn.test(n))&&(r.includePunctuation||!gn.test(n))){const n=i-s.length+1,r=i+1,u=t.slice(n,r).join("");if(hn(u)){const n=mn(t,i),o=e.slice(r,n);Array.prototype.push.apply(s,o),i=n}o.push(s),a.push({start:n,end:r})}s=[]}return{words:o,indices:a}})(e,r,(e=>{const t=(e=>{const t={};return n=>{if(t[n])return t[n];{const r=e(n);return t[n]=r,r}}})(ln);return A(e,t)})(r),n)})(e.split(""),f),r=e.length;return A(t,((t,o)=>{const a=n[o],s=a.start,i=a.end,u=t.join(""),l=s>0?$.some(e.charAt(s-1)):$.none(),c=i<r?$.some(e.charAt(i)):$.none();return(e=>{const t=(e=>{const t=e.word;return t.length>=2&&vn(t.charAt(t.length-1))&&!vn(t.charAt(t.length-2))?(e=>{const t=e.word;return dn(t.substring(0,t.length-1),e.left,$.some(t.charAt(t.length-1)))})(e):e})(e);return(e=>{const t=e.word,n=q(yn,(e=>t.indexOf(e)>-1))?2:1,r=t.substring(0,n);return L(r,vn)&&!vn(t.charAt(n))?(e=>{const t=e.word;return dn(t.substring(1),$.some(t.charAt(0)),e.right)})(e):e})(t)})(dn(u,l,c))}))},xn={...gt([{aboveView:["item"]},{inView:["item"]},{belowView:["item"]}]),cata:(e,t,n,r)=>e.fold(t,n,r)},$n=(e,t,n)=>e.property().isSpecial(n.item)||e.property().isNonEditable(n.item)?$.some({item:n.item,mode:Pt}):e.property().isBoundary(n.item)?xn.cata(t.assess(n.item),(()=>n.mode!==Ot?$.some({item:n.item,mode:Pt}):$.none()),(()=>$.some(n)),(()=>$.none())):$.some(n),wn=(e,t,n,r,o)=>{const a=e.property().getLanguage(o.item);e.property().isText(o.item)?t.addDetail(n(e,o.item)):e.property().isBoundary(o.item)?xn.cata(r.assess(o.item),h,(()=>(o.mode===zt?t.openBoundary(a,o.item):t.closeBoundary(a,o.item),$.some(o))),h):e.property().isEmptyTag(o.item)?t.addEmpty(o.item):o.mode===zt?t.openInline(a,o.item):t.closeInline(a,o.item)},En=(e,t,n,r,o,a)=>(e.eq(t,n)?$.some(t):e.property().parent(t)).map((s=>{const i=Lt(e,s).getOr(r);return((e,t,n,r,o,a)=>{const s=t=>!e.eq(t.item,n)||t.mode===zt&&!e.property().isText(t.item)&&0!==e.property().children(t.item).length,i=(e=>{let t=[];const n=[];let r=[],o=e;const a=e=>{e.each((e=>{t.push(e)}))},s=e=>{e.each((e=>{t=t.slice(0,t.length-1)}))},i=()=>{r.length>0&&n.push({lang:o,details:r})},u=e=>{i(),r=[],o=e},l=n=>n.or($.from(t[t.length-1])).getOr(e);return{openInline:(e,t)=>{const n=l(e);n!==o&&u(n),a(e)},closeInline:(e,t)=>{s(e)},addDetail:e=>{const t=l($.none());t!==o&&u(t),r.push(e)},addEmpty:e=>{const t=l($.none());u(t)},openBoundary:(e,t)=>{a(e);const n=l(e);u(n)},closeBoundary:(e,t)=>{s(e);const n=l(e);u(n)},done:()=>(i(),n.slice(0))}})(r);let u=$.some({item:t,mode:zt}).filter(s);for(;u.isSome();)u.each((t=>wn(e,i,o,a,t))),u=u.bind((t=>$n(e,a,t))).filter(s).bind((t=>Ft(e,t.item,t.mode,Wt().right()))).filter(s);return e.property().isText(n)&&i.addDetail(o(e,n)),i.done()})(e,t,n,i,o,a)})),Rn=(e,t,n,r,o,a)=>{const s=Ct(e,t,n).bind((t=>{if(0===t.length)return $.none();const n=t[0],s=t[t.length-1];return En(e,n,s,r,o,a)})).getOr([]);return((e,t)=>{const n=A(t,(e=>{const t=e.details,n=e.lang,r=A(t,(e=>e.text)).join(""),o=A(t,(e=>e.item));return{lang:n,words:bn(r),elements:o}}));return{zones:n}})(0,s)},Tn=(e,t)=>(n,r)=>n.eq(r,e.item)?e:n.eq(r,t.item)?t:Xt(n,r),qn=()=>({zones:[]}),An=(e,t,n,r)=>e.property().isBoundary(t)?((e,t,n,r,o)=>Rn(e,t,n,r,Xt,o))(e,t,t,n,r):e.property().isEmptyTag(t)?Sn():((e,t,n,r)=>{const o=((e,t)=>{const n=sn(e,t,t,b),r=n.isEmpty&&((e,t)=>!e.property().isText(t)&&0===e.down().predicate(t,e.property().isText).length)(e,t);return{left:n.left,right:n.right,isEmpty:r}})(e,t),a=Tn(o.left,o.right);return o.isEmpty?qn():Rn(e,o.left.item,o.right.item,n,a,r)})(e,t,n,r),Sn=qn,kn=e=>e.dom.textContent,Bn=e=>t=>t.options.get(e),Dn=e=>t=>$.from(t.options.get(e)),Nn={et:"Estonian",eo:"Esperanto","en-US":"English (US)","en-GB":"English (UK)",bg:"Bulgarian",be:"Belarusian",ca:"Catalan",cs:"Czech",ga:"Irish",da:"Danish",nl:"Dutch",fi:"Finnish",de:"German",el:"Greek",hu:"Hungarian",it:"Italian",lv:"Latvian",no:"Norwegian",pl:"Polish",ro:"Romanian",ru:"Russian",sk:"Slovak",sl:"Slovenian",sr:"Servian",es:"Spanish",sv:"Swedish",tr:"Turkish",uk:"Ukraninan"},Cn=I(Nn),Ln="en-US",In=e=>e in Nn,On=e=>i(e)?{value:e.filter((e=>s(e)&&In(e))),valid:!0}:{valid:!1,message:"Must be an array of strings."},Pn=Dn("typography_rules"),zn=Bn("typography_langs"),Mn=Dn("typography_ignore"),jn=Bn("typography_default_lang"),Un="tinymce-typography-lang",Wn=e=>{const t=$.from(tinymce.util.LocalStorage.getItem(Un)).getOr(jn(e));return((e,t)=>!!In(t)&&zn(e).includes(t))(e,t)?t:Ln},Fn=(e,t)=>{const n=P.fromDom(e.getBody()),r=e=>V(e,n),o=ie(t,"[lang]",r).filter((a=r,e=>!a(e))).bind((e=>ge(e,"lang"))).getOr(Wn(e));var a;return In(o)?o:Ln};
|
|
/*! typograf | © 2023 Denis Seleznev | MIT License | https://github.com/typograf/typograf */
|
|
var _n=function(){return _n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_n.apply(this,arguments)};function Hn(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Qn=[["iexcl",161],["cent",162],["pound",163],["curren",164],["yen",165],["brvbar",166],["sect",167],["uml",168],["copy",169],["ordf",170],["laquo",171],["not",172],["reg",174],["macr",175],["deg",176],["plusmn",177],["sup2",178],["sup3",179],["acute",180],["micro",181],["para",182],["middot",183],["cedil",184],["sup1",185],["ordm",186],["raquo",187],["frac14",188],["frac12",189],["frac34",190],["iquest",191],["Agrave",192],["Aacute",193],["Acirc",194],["Atilde",195],["Auml",196],["Aring",197],["AElig",198],["Ccedil",199],["Egrave",200],["Eacute",201],["Ecirc",202],["Euml",203],["Igrave",204],["Iacute",205],["Icirc",206],["Iuml",207],["ETH",208],["Ntilde",209],["Ograve",210],["Oacute",211],["Ocirc",212],["Otilde",213],["Ouml",214],["times",215],["Oslash",216],["Ugrave",217],["Uacute",218],["Ucirc",219],["Uuml",220],["Yacute",221],["THORN",222],["szlig",223],["agrave",224],["aacute",225],["acirc",226],["atilde",227],["auml",228],["aring",229],["aelig",230],["ccedil",231],["egrave",232],["eacute",233],["ecirc",234],["euml",235],["igrave",236],["iacute",237],["icirc",238],["iuml",239],["eth",240],["ntilde",241],["ograve",242],["oacute",243],["ocirc",244],["otilde",245],["ouml",246],["divide",247],["oslash",248],["ugrave",249],["uacute",250],["ucirc",251],["uuml",252],["yacute",253],["thorn",254],["yuml",255],["fnof",402],["Alpha",913],["Beta",914],["Gamma",915],["Delta",916],["Epsilon",917],["Zeta",918],["Eta",919],["Theta",920],["Iota",921],["Kappa",922],["Lambda",923],["Mu",924],["Nu",925],["Xi",926],["Omicron",927],["Pi",928],["Rho",929],["Sigma",931],["Tau",932],["Upsilon",933],["Phi",934],["Chi",935],["Psi",936],["Omega",937],["alpha",945],["beta",946],["gamma",947],["delta",948],["epsilon",949],["zeta",950],["eta",951],["theta",952],["iota",953],["kappa",954],["lambda",955],["mu",956],["nu",957],["xi",958],["omicron",959],["pi",960],["rho",961],["sigmaf",962],["sigma",963],["tau",964],["upsilon",965],["phi",966],["chi",967],["psi",968],["omega",969],["thetasym",977],["upsih",978],["piv",982],["bull",8226],["hellip",8230],["prime",8242],["Prime",8243],["oline",8254],["frasl",8260],["weierp",8472],["image",8465],["real",8476],["trade",8482],["alefsym",8501],["larr",8592],["uarr",8593],["rarr",8594],["darr",8595],["harr",8596],["crarr",8629],["lArr",8656],["uArr",8657],["rArr",8658],["dArr",8659],["hArr",8660],["forall",8704],["part",8706],["exist",8707],["empty",8709],["nabla",8711],["isin",8712],["notin",8713],["ni",8715],["prod",8719],["sum",8721],["minus",8722],["lowast",8727],["radic",8730],["prop",8733],["infin",8734],["ang",8736],["and",8743],["or",8744],["cap",8745],["cup",8746],["int",8747],["there4",8756],["sim",8764],["cong",8773],["asymp",8776],["ne",8800],["equiv",8801],["le",8804],["ge",8805],["sub",8834],["sup",8835],["nsub",8836],["sube",8838],["supe",8839],["oplus",8853],["otimes",8855],["perp",8869],["sdot",8901],["lceil",8968],["rceil",8969],["lfloor",8970],["rfloor",8971],["lang",9001],["rang",9002],["spades",9824],["clubs",9827],["hearts",9829],["diams",9830],["loz",9674],["OElig",338],["oelig",339],["Scaron",352],["scaron",353],["Yuml",376],["circ",710],["tilde",732],["ndash",8211],["mdash",8212],["lsquo",8216],["rsquo",8217],["sbquo",8218],["ldquo",8220],["rdquo",8221],["bdquo",8222],["dagger",8224],["Dagger",8225],["permil",8240],["lsaquo",8249],["rsaquo",8250],["euro",8364],["NestedGreaterGreater",8811],["NestedLessLess",8810]],Vn=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]],Gn=function(){function e(){var e=this;this.entities=this.prepareEntities(Hn(Hn([],Qn,!0),Vn,!0)),this.entitiesByName={},this.entitiesByNameEntity={},this.entitiesByDigitEntity={},this.entitiesByUtf={},this.entities.forEach((function(t){e.entitiesByName[t.name]=t,e.entitiesByNameEntity[t.nameEntity]=t,e.entitiesByDigitEntity[t.digitEntity]=t,e.entitiesByUtf[t.utf]=t})),this.invisibleEntities=this.prepareEntities(Vn)}return e.prototype.toUtf=function(e){var t=this;-1!==e.text.search(/&#/)&&(e.text=this.decHexToUtf(e.text)),-1!==e.text.search(/&[a-z]/i)&&(e.text=e.text.replace(/&[a-z\d]{2,31};/gi,(function(e){var n=t.entitiesByNameEntity[e];return n?n.utf:e})))},e.prototype.decHexToUtf=function(e){return e.replace(/&#(\d{1,6});/gi,(function(e,t){return String.fromCharCode(parseInt(t,10))})).replace(/&#x([\da-f]{1,6});/gi,(function(e,t){return String.fromCharCode(parseInt(t,16))}))},e.prototype.restore=function(e){var t=e.prefs.htmlEntity,n=t.type,r=this.entities;if("name"===n||"digit"===n){(t.onlyInvisible||t.list)&&(r=[],t.onlyInvisible&&(r=r.concat(this.invisibleEntities)),t.list&&(r=r.concat(this.prepareListParam(t.list))));var o="name"===n?"nameEntity":"digitEntity";e.text=this.restoreEntitiesByIndex(e.text,o,r)}},e.prototype.getByUtf=function(e,t){var n;switch(t){case"digit":n=this.entitiesByDigitEntity[e];break;case"name":n=this.entitiesByNameEntity[e];break;default:n=e}return n},e.prototype.prepareEntities=function(e){var t=[];return e.forEach((function(e){var n=e[0],r=e[1],o=String.fromCharCode(r);t.push({name:n,nameEntity:"&"+n+";",digitEntity:"&#"+r+";",utf:o,reName:new RegExp("&"+n+";","g"),reUtf:new RegExp(o,"g")})})),t},e.prototype.prepareListParam=function(e){var t=this,n=[];return e.forEach((function(e){var r=t.entitiesByName[e];r&&n.push(r)})),n},e.prototype.restoreEntitiesByIndex=function(e,t,n){return n.forEach((function(n){e=e.replace(n.reUtf,n[t])})),e},e}(),Kn=new Gn,Xn=[];function Zn(e){var t=(e||"").split("/")[0];t&&"common"!==t&&!Jn(t)&&(Xn.push(t),Xn.sort())}function Yn(){return Xn}function Jn(e){return"common"===e||-1!==Xn.indexOf(e)}function er(e,t){var n=e||t;return n?Array.isArray(n)?n:[n]:[]}function tr(e){if(!e.length)throw Error('Not defined the property "locale".');e.forEach((function(e){if(!Jn(e))throw Error('"'.concat(e,'" is not supported locale.'))}))}var nr={};function rr(e){return nr[e]}function or(e){Object.keys(e).forEach((function(t){Zn(t),nr[t]=e[t]}))}var ar=["a","abbr","acronym","b","bdo","big","br","button","cite","code","dfn","em","i","img","input","kbd","label","map","object","q","samp","script","select","small","span","strong","sub","sup","textarea","time","tt","var"],sr=new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),ir="\\d+([.,]\\d+)?",ur=/\d/;function lr(e){return e.search(ur)>-1}var cr="\uf000",pr="\uf001",gr=function(){function e(){this.groups=["own","html","url"],this.hidden={},this.counter=0;var e=[["\x3c!--","--\x3e"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach((function(t){e.push(["<".concat(t,"(\\s[^>]*?)?>"),"</".concat(t,">")])})),this.tags={own:[],html:e.map(this.prepareRegExp),url:[sr]}}return e.prototype.add=function(e){this.tags.own.push(this.prepareRegExp(e))},e.prototype.show=function(e,t){for(var n=new RegExp("\uf000tf\\d+\uf000","g"),r=new RegExp("\uf000tf\\d"),o=function(n){return e.safeTags.hidden[t][n]||n},a=0,s=this.tags[t].length;a<s&&(e.text=e.text.replace(n,o),-1!==e.text.search(r));a++);},e.prototype.hide=function(e,t){var n=this;e.safeTags.hidden[t]={};var r=this.pasteLabel.bind(this,e,t);this.tags[t].forEach((function(t){e.text=e.text.replace(n.prepareRegExp(t),r)}))},e.prototype.hideHTMLTags=function(e){if(e.isHTML){var t=this.pasteLabel.bind(this,e,"html");e.text=e.text.replace(/<\/?[a-z][^]*?>/gi,t).replace(/<\/?[a-z][^]*?>/gi,t).replace(/&[gl]t;/gi,t)}},e.prototype.getPrevLabel=function(e,t){for(var n=t-1;n>=0;n--)if(e[n]===cr)return e.slice(n,t+1);return""},e.prototype.getNextLabel=function(e,t){for(var n=t+1;n<e.length;n++)if(e[n]===cr)return e.slice(t,n+1);return""},e.prototype.getTagByLabel=function(e,t){var n=null;return this.groups.some((function(r){var o=e.safeTags.hidden[r][t];return void 0!==o&&(n={group:r,value:o}),n})),n},e.prototype.getTagInfo=function(e){if(!e)return null;var t={group:e.group};switch(e.group){case"html":t.name=e.value.split(/[<\s>]/)[1],t.isInline=ar.indexOf(t.name)>-1,t.isClosing=e.value.search(/^<\//)>-1;break;case"url":t.isInline=!0;break;case"own":t.isInline=!1}return t},e.prototype.pasteLabel=function(e,t,n){var r=e.safeTags,o="\uf000tf"+r.counter+cr;return r.hidden[t][o]=n,r.counter++,o},e.prototype.prepareRegExp=function(e){if(e instanceof RegExp)return e;var t=e[0],n=e[1],r=e[2];return new RegExp(t+(void 0===r?"[^]*?":r)+n,"gi")},e.prototype.getPrevTagInfo=function(e,t,n){var r=this.getPrevLabel(t,n-1);if(r){var o=this.getTagByLabel(e,r);if(o)return this.getTagInfo(o)}return null},e.prototype.getNextTagInfo=function(e,t,n){var r=this.getNextLabel(t,n+1);if(r){var o=this.getTagByLabel(e,r);if(o)return this.getTagInfo(o)}return null},e}();function hr(e,t){for(var n="";1==(1&t)&&(n+=e),0!=(t>>>=1);)e+=e;return n}function mr(e){return e.replace(/\u00A0/g," ")}function dr(e,t){for(var n=0;n<t.length;n++)e=e.replace(t[n][0],t[n][1]);return e}function fr(e){return-1!==e.search(/(<\/?[a-z]|<!|&[lg]t;)/i)}function yr(e){return"object"==typeof e?JSON.parse(JSON.stringify(e)):e}var vr={symbols:110,number:150,space:210,dash:310,punctuation:410,nbsp:510,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},br=0,xr="default",$r=[],wr=[];function Er(){var e=Hn([],$r,!0);return function(e){e.sort((function(e,t){return e.index>t.index?1:-1}))}(e),e}function Rr(){return Hn([],wr,!0)}function Tr(e){if("number"==typeof e.index)return e.index;var t=e.name.split("/")[1],n=vr[t];return void 0===n&&(n=br),"string"==typeof e.index?n+parseInt(e.index,10):n}function qr(e){var t=e.name.split("/"),n=t[0],r=t[1],o=t[2];return{name:e.name,shortName:o,handler:e.handler,queue:e.queue||xr,enabled:!0!==e.disabled,locale:n,group:r,index:Tr(e),settings:e.settings,live:e.live,htmlAttrs:e.htmlAttrs}}function Ar(e){return{type:(null==e?void 0:e.type)||"default",list:null==e?void 0:e.list,onlyInvisible:Boolean(null==e?void 0:e.onlyInvisible)}}function Sr(e){return e||"LF"}var kr=function(){function e(e){var t=this;this.rules=[],this.innerRules=[],this.rulesByQueues={},this.innerRulesByQueues={},this.separatePartsTags=["title","p","h[1-6]","select","legend"],this.prefs=function(e){return{locale:er(e.locale),lineEnding:Sr(e.lineEnding),live:Boolean(e.live),ruleFilter:e.ruleFilter,enableRule:e.enableRule,disableRule:e.disableRule,processingSeparateParts:e.processingSeparateParts,htmlEntity:Ar(e.htmlEntity)}}(e),tr(this.prefs.locale),this.safeTags=new gr,this.settings={},this.enabledRules={},this.innerRulesByQueues={},this.innerRules=Rr(),this.innerRules.forEach((function(e){t.innerRulesByQueues[e.queue]=t.innerRulesByQueues[e.queue]||[],t.innerRulesByQueues[e.queue].push(e)})),this.rulesByQueues={},this.rules=Er(),this.rules.forEach((function(e){t.prepareRuleSettings(e),t.rulesByQueues[e.queue]=t.rulesByQueues[e.queue]||[],t.rulesByQueues[e.queue].push(e)})),this.prefs.disableRule&&this.disableRule(this.prefs.disableRule),this.prefs.enableRule&&this.enableRule(this.prefs.enableRule)}return e.addRule=function(e){!function(e){var t=qr(e);Zn(t.locale),$r.push(t)}(e)},e.addRules=function(e){var t=this;e.forEach((function(e){t.addRule(e)}))},e.addInnerRule=function(e){!function(e){wr.push(qr(e))}(e)},e.addInnerRules=function(e){var t=this;e.forEach((function(e){t.addInnerRule(e)}))},e.getRule=function(e){var t=null;return Er().some((function(n){return n.name===e&&(t=n,!0)})),t},e.getRules=function(){return Er()},e.getInnerRules=function(){return Rr()},e.getLocales=function(){return Yn()},e.addLocale=function(e){Zn(e)},e.hasLocale=function(e){return Jn(e)},e.setData=function(e){or(e)},e.getData=function(e){return rr(e)},e.prototype.execute=function(e,t){if(!(e=""+e))return"";var n=function(e,t){var n=_n({},e);return t?("locale"in t&&(n.locale=er(t.locale)),"htmlEntity"in t&&(n.htmlEntity=Ar(t.htmlEntity)),"lineEnding"in t&&(n.lineEnding=Sr(t.lineEnding)),"processingSeparateParts"in t&&(n.processingSeparateParts=t.processingSeparateParts),"ruleFilter"in t&&(n.ruleFilter=t.ruleFilter),n):n}(this.prefs,t);tr(n.locale);var r=this.prepareContext(e,n);return this.process(r)},e.prototype.getSetting=function(e,t){return this.settings[e]&&this.settings[e][t]},e.prototype.setSetting=function(e,t,n){this.settings[e]=this.settings[e]||{},this.settings[e][t]=n},e.prototype.isEnabledRule=function(e){return!1!==this.enabledRules[e]},e.prototype.isDisabledRule=function(e){return!this.enabledRules[e]},e.prototype.enableRule=function(e){return this.enable(e,!0)},e.prototype.disableRule=function(e){return this.enable(e,!1)},e.prototype.addSafeTag=function(e,t,n){var r=e instanceof RegExp?e:[e,t,n];this.safeTags.add(r)},e.prototype.prepareContext=function(e,t){return{text:e,isHTML:fr(e),prefs:t,getData:function(e){return"char"===e?t.locale.map((function(t){return rr(t+"/"+e)})).join(""):rr(t.locale[0]+"/"+e)},safeTags:this.safeTags}},e.prototype.splitBySeparateParts=function(e){if(!e.isHTML||!1===e.prefs.processingSeparateParts)return[e.text];var t=[],n=new RegExp("<("+this.separatePartsTags.join("|")+")(\\s[^>]*?)?>[^]*?</\\1>","gi"),r=0;return e.text.replace(n,(function(n,o,a,s){return r!==s&&t.push((r?pr:"")+e.text.slice(r,s)+pr),t.push(n),r=s+n.length,n})),t.push(r?pr+e.text.slice(r,e.text.length):e.text),t},e.prototype.process=function(e){var t=this;e.text=e.text.replace(/\r\n?/g,"\n"),this.executeRules(e,"start"),this.safeTags.hide(e,"own"),this.executeRules(e,"hide-safe-tags-own"),this.safeTags.hide(e,"html"),this.executeRules(e,"hide-safe-tags-html");var n=e.isHTML,r=new RegExp(pr,"g");return e.text=this.splitBySeparateParts(e).map((function(n){return e.text=n,e.isHTML=fr(n),t.safeTags.hideHTMLTags(e),t.safeTags.hide(e,"url"),t.executeRules(e,"hide-safe-tags-url"),t.executeRules(e,"hide-safe-tags"),Kn.toUtf(e),e.prefs.live&&(e.text=mr(e.text)),t.executeRules(e,"utf"),t.executeRules(e),Kn.restore(e),t.executeRules(e,"html-entities"),t.safeTags.show(e,"url"),t.executeRules(e,"show-safe-tags-url"),e.text.replace(r,"")})).join(""),e.isHTML=n,this.safeTags.show(e,"html"),this.executeRules(e,"show-safe-tags-html"),this.safeTags.show(e,"own"),this.executeRules(e,"show-safe-tags-own"),this.executeRules(e,"end"),function(e,t){return"CRLF"===t?e.replace(/\n/g,"\r\n"):"CR"===t?e.replace(/\n/g,"\r"):e}(e.text,e.prefs.lineEnding)},e.prototype.executeRules=function(e,t){var n=this;void 0===t&&(t=xr);var r=this.rulesByQueues[t],o=this.innerRulesByQueues[t];o&&o.forEach((function(t){n.ruleIterator(e,t)})),r&&r.forEach((function(t){n.ruleIterator(e,t)}))},e.prototype.ruleIterator=function(e,t){if(!(!0===e.prefs.live&&!1===t.live||!1===e.prefs.live&&!0===t.live)&&("common"===t.locale||t.locale===e.prefs.locale[0])&&this.isEnabledRule(t.name)){if(e.prefs.ruleFilter&&!e.prefs.ruleFilter(t))return;this.onBeforeRule&&this.onBeforeRule(t.name,e),e.text=t.handler.call(this,e.text,this.settings[t.name],e),this.onAfterRule&&this.onAfterRule(t.name,e)}},e.prototype.prepareRuleSettings=function(e){this.settings[e.name]=yr(e.settings),this.enabledRules[e.name]=e.enabled},e.prototype.enable=function(e,t){var n=this;Array.isArray(e)?e.forEach((function(e){n.enableByMask(e,t)})):this.enableByMask(e,t)},e.prototype.enableByMask=function(e,t){var n=this;if(e)if(-1!==e.search(/\*/)){var r=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*"));this.rules.forEach((function(e){var o=e.name;r.test(o)&&(n.enabledRules[o]=t)}))}else this.enabledRules[e]=t},e.groups=[],e.titles={},e.version="7.3.0",e}();[{"common/char":"a-z","common/dash":"--?|\u2012|\u2013|\u2014","common/quote":'\xab\u2039\xbb\u203a\u201e\u201c\u201f\u201d"'},{"be/char":"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u044b\u044c\u044d\u044e\u044f\u0451\u0456\u045e\u0491","be/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"bg/char":"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044c\u044e\u044f","bg/quote":{left:"\u201e\u2019",right:"\u201c\u2019"}},{"ca/char":"abcdefghijlmnopqrstuvxyz\xe0\xe7\xe8\xe9\xed\xef\xf2\xf3\xfa\xfc","ca/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"cs/char":"a-z\xe1\xe9\xed\xf3\xfa\xfd\u010d\u010f\u011b\u0148\u0159\u0161\u0165\u016f\u017e","cs/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"da/char":"a-z\xe5\xe6\xf8","da/quote":{left:"\xbb\u203a",right:"\xab\u2039"}},{"de/char":"a-z\xdf\xe4\xf6\xfc","de/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"el/char":"\u0390\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03ca\u03cb\u03cc\u03cd\u03ce\u03f2\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d","el/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"en-GB/char":"a-z","en-GB/quote":{left:"\u2018\u201c",right:"\u2019\u201d"}},{"en-US/char":"a-z","en-US/quote":{left:"\u201c\u2018",right:"\u201d\u2019"},"en-US/shortWord":"a|an|and|as|at|bar|but|by|for|if|in|nor|not|of|off|on|or|out|per|pro|so|the|to|up|via|yet"},{"eo/char":"abcdefghijklmnoprstuvz\u0109\u011d\u0125\u0135\u015d\u016d","eo/quote":{left:"\u201c\u2018",right:"\u201d\u2019"}},{"es/char":"a-z\xe1\xe9\xed\xf1\xf3\xfa\xfc","es/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"et/char":"abdefghijklmnoprstuvz\xe4\xf5\xf6\xfc\u0161\u017e","et/quote":{left:"\u201e\xab",right:"\u201c\xbb"}},{"fi/char":"abcdefghijklmnopqrstuvy\xf6\xe4\xe5","fi/quote":{left:"\u201d\u2019",right:"\u201d\u2019"}},{"fr/char":"a-z\xe0\xe2\xe7\xe8\xe9\xea\xeb\xee\xef\xf4\xfb\xfc\u0153\xe6","fr/quote":{left:"\xab\u2039",right:"\xbb\u203a",spacing:!0}},{"ga/char":"abcdefghilmnoprstuvwxyz\xe1\xe9\xed\xf3\xfa","ga/quote":{left:"\u201c\u2018",right:"\u201d\u2019"}},{"hu/char":"a-z\xe1\xe4\xe9\xed\xf3\xf6\xfa\xfc\u0151\u0171","hu/quote":{left:"\u201e\xbb",right:"\u201d\xab"}},{"it/char":"a-z\xe0\xe9\xe8\xec\xf2\xf9","it/quote":{left:"\xab\u201c",right:"\xbb\u201d"}},{"lv/char":"abcdefghijklmnopqrstuvxz\xe6\u0153","lv/quote":{left:"\xab\u201e",right:"\xbb\u201c"}},{"nl/char":"a-z\xe4\xe7\xe8\xe9\xea\xeb\xee\xef\xf1\xf6\xfb\xfc","nl/quote":{left:"\u2018\u201c",right:"\u2019\u201d"}},{"no/char":"a-z\xe5\xe6\xe8\xe9\xea\xf2\xf3\xf4\xf8","no/quote":{left:"\xab\u2019",right:"\xbb\u2019"}},{"pl/char":"abcdefghijklmnoprstuvwxyz\xf3\u0105\u0107\u0119\u0142\u0144\u015b\u017a\u017c","pl/quote":{left:"\u201e\xab",right:"\u201d\xbb"}},{"ro/char":"abcdefghijklmnoprstuvxz\xee\u0103\u0219\u021b","ro/quote":{left:"\u201e\xab",right:"\u201d\xbb"}},{"ru/char":"\u0430-\u044f\u0451","ru/dashBefore":"(^| |\\n)","ru/dashAfter":"(?=[\xa0 ,.?:!]|$)","ru/dashAfterDe":"(?=[,.?:!]|[\xa0 ][^\u0410-\u042f\u0401]|$)","ru/l":"\u0430-\u044f\u0451a-z","ru/L":"\u0410-\u042f\u0401A-Z","ru/month":"\u044f\u043d\u0432\u0430\u0440\u044c|\u0444\u0435\u0432\u0440\u0430\u043b\u044c|\u043c\u0430\u0440\u0442|\u0430\u043f\u0440\u0435\u043b\u044c|\u043c\u0430\u0439|\u0438\u044e\u043d\u044c|\u0438\u044e\u043b\u044c|\u0430\u0432\u0433\u0443\u0441\u0442|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c|\u043e\u043a\u0442\u044f\u0431\u0440\u044c|\u043d\u043e\u044f\u0431\u0440\u044c|\u0434\u0435\u043a\u0430\u0431\u0440\u044c","ru/monthGenCase":"\u044f\u043d\u0432\u0430\u0440\u044f|\u0444\u0435\u0432\u0440\u0430\u043b\u044f|\u043c\u0430\u0440\u0442\u0430|\u0430\u043f\u0440\u0435\u043b\u044f|\u043c\u0430\u044f|\u0438\u044e\u043d\u044f|\u0438\u044e\u043b\u044f|\u0430\u0432\u0433\u0443\u0441\u0442\u0430|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f|\u043e\u043a\u0442\u044f\u0431\u0440\u044f|\u043d\u043e\u044f\u0431\u0440\u044f|\u0434\u0435\u043a\u0430\u0431\u0440\u044f","ru/monthPreCase":"\u044f\u043d\u0432\u0430\u0440\u0435|\u0444\u0435\u0432\u0440\u0430\u043b\u0435|\u043c\u0430\u0440\u0442\u0435|\u0430\u043f\u0440\u0435\u043b\u0435|\u043c\u0430\u0435|\u0438\u044e\u043d\u0435|\u0438\u044e\u043b\u0435|\u0430\u0432\u0433\u0443\u0441\u0442\u0435|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u0435|\u043e\u043a\u0442\u044f\u0431\u0440\u0435|\u043d\u043e\u044f\u0431\u0440\u0435|\u0434\u0435\u043a\u0430\u0431\u0440\u0435","ru/quote":{left:"\xab\u201e\u201a",right:"\xbb\u201c\u2018",removeDuplicateQuotes:!0},"ru/shortMonth":"\u044f\u043d\u0432|\u0444\u0435\u0432|\u043c\u0430\u0440|\u0430\u043f\u0440|\u043c\u0430[\u0435\u0439\u044f]|\u0438\u044e\u043d|\u0438\u044e\u043b|\u0430\u0432\u0433|\u0441\u0435\u043d|\u043e\u043a\u0442|\u043d\u043e\u044f|\u0434\u0435\u043a","ru/shortWord":"\u0430|\u0431\u044b|\u0432|\u0432\u043e|\u0434\u0430|\u0434\u043e|\u0436\u0435|\u0437\u0430|\u0438|\u0438\u0437|\u043a|\u043a\u043e|\u043b\u0438|\u043d\u0430|\u043d\u0435|\u043d\u0438|\u043d\u043e|\u043e|\u043e\u0431|\u043e\u0442|\u043f\u043e|\u0441|\u0441\u043e|\u0442\u043e|\u0443","ru/weekday":"\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a|\u0432\u0442\u043e\u0440\u043d\u0438\u043a|\u0441\u0440\u0435\u0434\u0430|\u0447\u0435\u0442\u0432\u0435\u0440\u0433|\u043f\u044f\u0442\u043d\u0438\u0446\u0430|\u0441\u0443\u0431\u0431\u043e\u0442\u0430|\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"},{"sk/char":"abcdefghijklmnoprstuvwxyz\xe1\xe4\xe9\xed\xf3\xf4\xfa\xfd\u010d\u010f\u013e\u0148\u0155\u0161\u0165\u017e","sk/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"sl/char":"a-z\u010d\u0161\u017e","sl/quote":{left:"\u201e\u201a",right:"\u201c\u2018"}},{"sr/char":"abcdefghijklmnoprstuvz\u0107\u010d\u0111\u0161\u017e","sr/quote":{left:"\u201e\u2019",right:"\u201d\u2019"}},{"sv/char":"a-z\xe4\xe5\xe9\xf6","sv/quote":{left:"\u201d\u2019",right:"\u201d\u2019"}},{"tr/char":"abcdefghijklmnoprstuvyz\xe2\xe7\xee\xf6\xfb\xfc\u011f\u0131\u015f","tr/quote":{left:"\u201c\u2018",right:"\u201d\u2019"}},{"uk/char":"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044c\u044e\u044f\u0454\u0456\u0457\u0491","uk/quote":{left:"\xab\u201e",right:"\xbb\u201c"}}].forEach((function(e){return or(e)}));var Br={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},Dr={name:"common/html/escape",index:"+100",queue:"end",handler:function(e){return e.replace(/[&<>"'/]/g,(function(e){return Br[e]}))},disabled:!0},Nr=new RegExp("<("+["address","article","aside","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"].join("|")+")[>\\s]"),Cr={name:"common/html/p",index:"+5",queue:"end",handler:function(e){var t=e.split("\n\n");return t.forEach((function(e,t,n){e.trim()&&(Nr.test(e)||(n[t]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1")))})),t.join("\n\n")},disabled:!0,htmlAttrs:!1},Lr={name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(e,t,n){var r=this,o=new RegExp("(^|\\s)("+t.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),a=yr(n.prefs);return a.ruleFilter=function(e){return!1!==e.htmlAttrs},e.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g,(function(e,t,n){return t+n.replace(o,(function(e,t,n,o){var s=o[0],i=o[o.length-1],u=o.slice(1,-1);return t+n+"="+s+r.execute(u,a)+i}))}))},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1},Ir={name:"common/html/url",queue:"end",handler:function(e,t,n){return n.isHTML?e:e.replace(sr,(function(e,t,n){n=n.replace(/([^/]+\/?)(\?|#)$/,"$1").replace(/^([^/]+)\/$/,"$1"),"http"===t?n=n.replace(/^([^/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===t&&(n=n.replace(/^([^/]+)(:443)([^\d]|\/|$)/,"$1$3"));var r=n,o=t+"://"+n,a='<a href="'+o+'">';return"http"===t||"https"===t?(r=r.replace(/^www\./,""),a+("http"===t?r:t+"://"+r)+"</a>"):a+o+"</a>"}))},disabled:!0,htmlAttrs:!1};kr.addRules([{name:"common/html/e-mail",queue:"end",handler:function(e,t,n){return n.isHTML?e:e.replace(/(^|[\s;(])([\w\-.]{2,64})@([\w\-.]{2,64})\.([a-z]{2,64})([)\s.,!?]|$)/gi,'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5')},disabled:!0,htmlAttrs:!1},Dr,{name:"common/html/nbr",index:"+10",queue:"end",handler:function(e){return e.replace(/([^\n>])\n(?=[^\n])/g,"$1<br/>\n")},disabled:!0,htmlAttrs:!1},Cr,Lr,{name:"common/html/quot",queue:"hide-safe-tags",handler:function(e){return e.replace(/"/g,'"')}},{name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0},Ir]);var Or={name:"common/nbsp/afterNumber",handler:function(e,t,n){var r="(^|\\s)(\\d{1,5}) (["+n.getData("char")+"]+)";return e.replace(new RegExp(r,"gi"),"$1$2\xa0$3")},disabled:!0},Pr={name:"common/nbsp/afterShortWord",handler:function(e,t,n){var r=t.lengthShortWord,o=t.useShortWordList,a=rr("common/quote"),s=n.getData("char"),i=n.getData("shortWord"),u=" \xa0(\uf000"+a,l="$1$2\xa0",c=new RegExp(o&&void 0!==i?"(^|["+u+"])("+i+") ":"(^|["+u+"])(["+s+"]{1,"+r+"}) ","gim");return e.replace(c,l).replace(c,l)},settings:{lengthShortWord:2,useShortWordList:!1}},zr={name:"common/nbsp/beforeShortLastNumber",handler:function(e,t,n){var r=n.getData("quote"),o=n.getData("char"),a=o.toUpperCase(),s=new RegExp("(["+o+a+"]) (?=\\d{1,"+t.lengthLastNumber+"}[-+\u2212%'\""+r.right+")]?([.!?\u2026]( ["+a+"]|$)|$))","gm");return e.replace(s,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}},Mr={name:"common/nbsp/beforeShortLastWord",handler:function(e,t,n){var r=n.getData("char"),o=r.toUpperCase(),a=new RegExp("(["+r+"\\d]) (["+r+o+"]{1,"+t.lengthLastWord+"}[.!?\u2026])( ["+o+"]|$)","g");return e.replace(a,"$1\xa0$2$3")},settings:{lengthLastWord:3}};function jr(e,t,n,r){return t+n.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+r}var Ur={name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,jr).replace(/(<nobr>)(.*?)(<\/nobr>)/g,jr)}},Wr={name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:mr,disabled:!0};kr.addRules([Or,{name:"common/nbsp/afterParagraphMark",handler:function(e){return e.replace(/\xb6 ?(?=\d)/g,"\xb6\xa0")}},{name:"common/nbsp/afterSectionMark",handler:function(e,t,n){var r=n.prefs.locale[0];return e.replace(/\xa7[ \u00A0\u2009]?(?=\d|I|V|X)/g,"ru"===r?"\xa7\u202f":"\xa7\xa0")}},Pr,zr,Mr,{name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}},Ur,Wr]);var Fr={name:"common/number/digitGrouping",index:"310",disabled:!0,handler:function(e,t){return e.replace(new RegExp("(^ ?|\\D |".concat(cr,")(\\d{1,3}([ \xa0\u202f\u2009]\\d{3})+)(?! ?[\\d-])"),"gm"),(function(e,n,r){return n+r.replace(/\s/g,t.space)})).replace(/(\d{5,}([.,]\d+)?)/g,(function(e,n){var r=n.match(/[.,]/),o=r?n.split(r):[n],a=o[0],s=o[1];return a=a.replace(/(\d)(?=(\d{3})+([^\d]|$))/g,"$1"+t.space),r?a+r+s:a}))},settings:{space:"\u202f"}},_r={name:"common/number/mathSigns",handler:function(e){return dr(e,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}};kr.addRules([Fr,{name:"common/number/fraction",handler:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1\xbd$2").replace(/(^|\D)1\/4(\D|$)/g,"$1\xbc$2").replace(/(^|\D)3\/4(\D|$)/g,"$1\xbe$2")}},_r,{name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}]);var Hr={name:"common/other/repeatWord",handler:function(e,t,n){var r=rr("common/quote"),o=n.getData("char"),a="[;:,.?! \n"+r+"]",s=new RegExp("("+a+"|^)(["+o+"]{"+t.min+",}) \\2("+a+"|$)","gi");return e.replace(s,"$1$2$3")},settings:{min:2},disabled:!0};kr.addRules([{name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}},Hr]);var Qr={name:"common/punctuation/apostrophe",handler:function(e,t,n){var r="(["+n.getData("char")+"])",o=new RegExp(r+"'"+r,"gi");return e.replace(o,"$1\u2019$2")}},Vr=function(){function e(){this.bufferQuotes={left:"\uf005\uf006\uf007",right:"\uf008\uf009\uf0a0"},this.beforeLeft=" \n\t\xa0[(",this.afterRight=" \n\t\xa0!?.:;#*,\u2026)\\]"}return e.prototype.process=function(e){var t=e.context.text;if(!this.count(t).total)return t;var n=e.settings,r=e.settings.left[0]===e.settings.right[0];return r&&(e.settings=yr(e.settings),e.settings.left=this.bufferQuotes.left.slice(0,e.settings.left.length),e.settings.right=this.bufferQuotes.right.slice(0,e.settings.right.length)),e.settings.spacing&&(t=this.removeSpacing(t,e.settings)),t=this.set(t,e),e.settings.spacing&&(t=this.setSpacing(t,e.settings)),e.settings.removeDuplicateQuotes&&(t=this.removeDuplicates(t,e.settings)),r&&(t=this.returnOriginalQuotes(t,n,e.settings),e.settings=n),t},e.prototype.returnOriginalQuotes=function(e,t,n){for(var r={},o=0;o<n.left.length;o++)r[n.left[o]]=t.left[o],r[n.right[o]]=t.right[o];return e.replace(new RegExp("["+n.left+n.right+"]","g"),(function(e){return r[e]}))},e.prototype.count=function(e){var t={total:0};return e.replace(new RegExp("["+rr("common/quote")+"]","g"),(function(e){return t[e]||(t[e]=0),t[e]++,t.total++,e})),t},e.prototype.removeDuplicates=function(e,t){var n=t.left[0],r=t.left[1]||n,o=t.right[0];return n!==r?e:e.replace(new RegExp(n+n,"g"),n).replace(new RegExp(o+o,"g"),o)},e.prototype.removeSpacing=function(e,t){for(var n=0,r=t.left.length;n<r;n++){var o=t.left[n],a=t.right[n];e=e.replace(new RegExp(o+"([ \u202f\xa0])","g"),o).replace(new RegExp("([ \u202f\xa0])"+a,"g"),a)}return e},e.prototype.setSpacing=function(e,t){for(var n=0,r=t.left.length;n<r;n++){var o=t.left[n],a=t.right[n];e=e.replace(new RegExp(o+"([^\u202f])","g"),o+"\u202f$1").replace(new RegExp("([^\u202f])"+a,"g"),"$1\u202f"+a)}return e},e.prototype.set=function(e,t){var n=rr("common/quote"),r=t.settings.left[0],o=t.settings.left[1]||r,a=t.settings.right[0],s=new RegExp("(^|["+this.beforeLeft+"])(["+n+"]+)(?=[^\\s\uf000])","gim"),i=new RegExp("([^\\s\uf000])(["+n+"]+)(?=["+this.afterRight+"]|$)","gim");return e=e.replace(s,(function(e,t,n){return t+hr(r,n.length)})).replace(i,(function(e,t,n){return t+hr(a,n.length)})),e=this.setAboveTags(e,t),r!==o&&(e=this.setInner(e,t.settings)),e},e.prototype.setAboveTags=function(e,t){var n=this,r=rr("common/quote"),o=t.settings.left[0],a=t.settings.right[0];return e.replace(new RegExp("(^|.)(["+r+"])(.|$)","gm"),(function(r,s,i,u,l){if(s!==cr&&u!==cr)return r;if(s===cr&&u===cr)return'"'===i?s+n.getAboveTwoTags(e,l+1,t)+u:r;if(s===cr){var c=n.afterRight.indexOf(u)>-1,p=t.safeTags.getPrevTagInfo(t.context,e,l-1);return c&&p&&"html"===p.group?s+(p.isClosing?a:o)+u:s+(!u||c?a:o)+u}var g=n.beforeLeft.indexOf(s)>-1,h=t.safeTags.getNextTagInfo(t.context,e,l+1);return g&&h&&"html"===h.group?s+(h.isClosing?a:o)+u:s+(!s||g?o:a)+u}))},e.prototype.getAboveTwoTags=function(e,t,n){var r=n.safeTags.getPrevTagInfo(n.context,e,t),o=n.safeTags.getNextTagInfo(n.context,e,t);if(r&&"html"===r.group){if(!r.isClosing)return n.settings.left[0];if(o&&o.isClosing&&r.isClosing)return n.settings.right[0]}return e[t]},e.prototype.setInner=function(e,t){for(var n=t.left[0],r=t.right[0],o=this.getMaxLevel(e,n,r,t.left.length),a=0,s="",i=0,u=e.length;i<u;i++){var l=e[i];l===n?(s+=t.left[a>o-1?o-1:a],++a>o&&(a=o)):l===r?(--a<0&&(a=0),s+=t.right[a]):('"'===l&&(a=0),s+=l)}return s},e.prototype.getMaxLevel=function(e,t,n,r){var o=this.count(e);return o[t]===o[n]?r:Math.min(r,2)},e}(),Gr=new Vr,Kr={};Yn().forEach((function(e){Kr[e]=yr(rr(e+"/quote"))}));var Xr={name:"common/punctuation/quote",handler:function(e,t,n){var r=t[n.prefs.locale[0]];return r?Gr.process({context:n,settings:r,safeTags:this.safeTags}):e},settings:Kr},Zr={name:"common/punctuation/quoteLink",queue:"show-safe-tags-html",index:"+5",handler:function(e,t,n){var r=this.getSetting("common/punctuation/quote",n.prefs.locale[0]),o=Kn.getByUtf(r.left[0]),a=Kn.getByUtf(r.right[0]),s=Kn.getByUtf(r.left[1]),i=Kn.getByUtf(r.right[1]);s=s?"|"+s:"",i=i?"|"+i:"";var u=new RegExp("(<[aA]\\s[^>]*?>)("+o+s+")([^]*?)("+a+i+")(</[aA]>)","g");return e.replace(u,"$2$1$3$5$4")}};kr.addRules([Qr,{name:"common/punctuation/delDoublePunctuation",handler:function(e){return e.replace(/(^|[^,]),,(?!,)/g,"$1,").replace(/(^|[^:])::(?!:)/g,"$1:").replace(/(^|[^!?.])\.\.(?!\.)/g,"$1.").replace(/(^|[^;]);;(?!;)/g,"$1;").replace(/(^|[^?])\?\?(?!\?)/g,"$1?")}},{name:"common/punctuation/hellip",handler:function(e,t,n){return"ru"===n.prefs.locale[0]?e.replace(/(^|[^.])\.{3,4}(?=[^.]|$)/g,"$1\u2026"):e.replace(/(^|[^.])\.{3}(\.?)(?=[^.]|$)/g,"$1\u2026$2")}},Xr,Zr]);var Yr={name:"common/space/beforeBracket",handler:function(e,t,n){var r=n.getData("char"),o=new RegExp("(["+r+".!?,;\u2026)])\\(","gi");return e.replace(o,"$1 (")}},Jr={name:"common/space/delRepeatN",index:"-1",handler:function(e,t){var n=t.maxConsecutiveLineBreaks,r=new RegExp("\n{".concat(n+1,",}"),"g"),o=hr("\n",n);return e.replace(r,o)},settings:{maxConsecutiveLineBreaks:2}},eo={name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}},to={name:"common/space/trimRight",index:"-3",live:!1,handler:String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}},no=new RegExp('(\\D):([^)",:.?\\s\\/\\\\\uf000])',"g"),ro={name:"common/space/afterColon",handler:function(e){return e.replace(no,"$1: $2")}},oo={name:"common/space/afterComma",handler:function(e,t,n){var r=n.getData("quote"),o="string"==typeof r?r:r.right;return e.replace(new RegExp('(.),([^)",:.?\\s\\/\\\\\uf000'+o+"])","g"),(function(e,t,n){return lr(t)&&lr(n)?e:t+", "+n}))}},ao=new RegExp("\\?([^).\u2026!;?\\s[\\])\uf000"+rr("common/quote")+"])","g"),so={name:"common/space/afterQuestionMark",handler:function(e){return e.replace(ao,"? $1")}},io=new RegExp("!([^).\u2026!;?\\s[\\])\uf000"+rr("common/quote")+"])","g"),uo={name:"common/space/afterExclamationMark",handler:function(e){return e.replace(io,"! $1")}},lo=new RegExp(";([^).\u2026!;?\\s[\\])\uf000"+rr("common/quote")+"])","g"),co={name:"common/space/afterSemicolon",handler:function(e){return e.replace(lo,"; $1")}};kr.addRules([ro,oo,so,uo,co,Yr,{name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}},{name:"common/space/delBeforeDot",handler:function(e){return e.replace(/(^|[^!?:;,.\u2026]) (\.|\.\.\.)(\s|$)/g,"$1$2$3")}},{name:"common/space/delBeforePercent",handler:function(e){return e.replace(/(\d)( |\u00A0)(%|\u2030|\u2031)/g,"$1$3")}},{name:"common/space/delBeforePunctuation",handler:function(e){return e.replace(/(^|[^!?:;,.\u2026]) ([!?:;,])(?!\))/g,"$1$2")}},{name:"common/space/delBetweenExclamationMarks",handler:function(e){return e.replace(/([!?]) (?=[!?])/g,"$1")}},{name:"common/space/delLeadingBlanks",handler:function(e){return e.replace(/^[ \t]+/gm,"")},disabled:!0},Jr,{name:"common/space/delRepeatSpace",index:"-1",handler:function(e){return e.replace(/([^\n \t])[ \t]{2,}(?![\n \t])/g,"$1 ")}},{name:"common/space/delTrailingBlanks",index:"-3",handler:function(e){return e.replace(/[ \t]+\n/g,"\n")}},{name:"common/space/insertFinalNewline",queue:"end",handler:function(e){return"\n"===e[e.length-1]?e:e+"\n"},live:!1,disabled:!0},{name:"common/space/replaceTab",index:"-5",handler:function(e){return e.replace(/\t/g," ")}},{name:"common/space/squareBracket",handler:function(e){return e.replace(/(\[) +/g,"[").replace(/ +\]/g,"]")}},eo,to]);var po={name:"common/symbols/arrow",handler:function(e){return dr(e,[[/(^|[^-])->(?!>)/g,"$1\u2192"],[/(^|[^<])<-(?!-)/g,"$1\u2190"]])}},go={name:"common/symbols/cf",handler:function(e){var t=new RegExp('(^|[\\s(\\[+\u2248\xb1\u2212\u2014\u2013\\-])(\\d+(?:[.,]\\d+)?)[ \xa0\u2009]?(C|F)([\\W\\s.,:!?")\\]]|$)',"mg");return e.replace(t,"$1$2\u2009\xb0$3$4")}},ho={name:"common/symbols/copy",handler:function(e){return dr(e,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}};kr.addRules([po,go,ho]);var mo={name:"en-US/dash/main",index:"-5",handler:function(e){var t=rr("common/dash"),n="[ ".concat("\xa0","]"),r="[ ".concat("\xa0","\n]"),o=new RegExp("".concat(n,"(").concat(t,")(").concat(r,")"),"g");return e.replace(o,"".concat("\xa0").concat("\u2014","$2"))}};kr.addRules([mo]);var fo={name:"ru/dash/centuries",handler:function(e,t){var n="("+rr("common/dash")+")",r=new RegExp("(X|I|V)[ |\xa0]?"+n+"[ |\xa0]?(X|I|V)","g");return e.replace(r,"$1"+t.dash+"$3")},settings:{dash:"\u2013"}},yo={name:"ru/dash/daysMonth",handler:function(e,t){var n=new RegExp("(^|\\s)([123]?\\d)("+rr("common/dash")+")([123]?\\d)[ \xa0]("+rr("ru/monthGenCase")+")","g");return e.replace(n,"$1$2"+t.dash+"$4\xa0$5")},settings:{dash:"\u2013"}},vo={name:"ru/dash/de",handler:function(e){var t=new RegExp("([a-\u044f\u0451]+) \u0434\u0435"+rr("ru/dashAfterDe"),"g");return e.replace(t,"$1-\u0434\u0435")},disabled:!0},bo={name:"ru/dash/decade",handler:function(e,t){var n=new RegExp("(^|\\s)(\\d{3}|\\d)0("+rr("common/dash")+")(\\d{3}|\\d)0(-\u0435[ \xa0])(?=\u0433\\.?[ \xa0]?\u0433|\u0433\u043e\u0434)","g");return e.replace(n,"$1$20"+t.dash+"$40$5")},settings:{dash:"\u2013"}},xo={name:"ru/dash/directSpeech",handler:function(e){var t=rr("common/dash"),n=new RegExp('(["\xbb\u2018\u201c,])[ |\xa0]?('.concat(t,")[ |\xa0]"),"g"),r=new RegExp("(^|".concat(cr,")(").concat(t,")( |\xa0)"),"gm"),o=new RegExp("([.\u2026?!])[ \xa0](".concat(t,")[ \xa0]"),"g");return e.replace(n,"$1\xa0\u2014 ").replace(r,"$1\u2014\xa0").replace(o,"$1 \u2014\xa0")}},$o={name:"ru/dash/izpod",handler:function(e){var t=new RegExp(rr("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+rr("ru/dashAfter"),"g");return e.replace(t,"$1$2\u0437-\u043f\u043e\u0434")}},wo={name:"ru/dash/izza",handler:function(e){var t=new RegExp(rr("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u0437\u0430"+rr("ru/dashAfter"),"g");return e.replace(t,"$1$2\u0437-\u0437\u0430")}},Eo={name:"ru/dash/ka",handler:function(e){var t=new RegExp("([a-\u044f\u0451]+) \u043a\u0430(\u0441\u044c)?"+rr("ru/dashAfter"),"g");return e.replace(t,"$1-\u043a\u0430$2")}},Ro={name:"ru/dash/koe",handler:function(e){var t=new RegExp(rr("ru/dashBefore")+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+rr("ru/dashAfter"),"g");return e.replace(t,"$1$2-$3")}},To={name:"ru/dash/main",index:"-5",handler:function(e){var t=rr("common/dash"),n=new RegExp("([ \xa0])("+t+")([ \xa0\\n])","g");return e.replace(n,"\xa0\u2014$3")}},qo={name:"ru/dash/month",handler:function(e,t){var n="("+rr("ru/month")+")",r="("+rr("ru/monthPreCase")+")",o=rr("common/dash"),a=new RegExp(n+" ?("+o+") ?"+n,"gi"),s=new RegExp(r+" ?("+o+") ?"+r,"gi"),i="$1"+t.dash+"$3";return e.replace(a,i).replace(s,i)},settings:{dash:"\u2013"}},Ao={name:"ru/dash/surname",handler:function(e){var t=new RegExp("([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)\\s-([\u0430-\u044f\u0451]{1,3})(?![^\u0430-\u044f\u0451]|$)","g");return e.replace(t,"$1\xa0\u2014$2")}},So={name:"ru/dash/taki",handler:function(e){var t=new RegExp("(\u0432\u0435\u0440\u043d\u043e|\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e|\u043e\u043f\u044f\u0442\u044c|\u043f\u0440\u044f\u043c\u043e|\u0442\u0430\u043a|\u0432\u0441[\u0435\u0451]|\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e|\u043d\u0435\u0443\u0436\u0435\u043b\u0438)\\s(\u0442\u0430\u043a\u0438)"+rr("ru/dashAfter"),"g");return e.replace(t,"$1-$2")}},ko={name:"ru/dash/time",handler:function(e,t){var n=new RegExp(rr("ru/dashBefore")+"(\\d?\\d:[0-5]\\d)"+rr("common/dash")+"(\\d?\\d:[0-5]\\d)"+rr("ru/dashAfter"),"g");return e.replace(n,"$1$2"+t.dash+"$3")},settings:{dash:"\u2013"}},Bo={name:"ru/dash/to",handler:function(e){var t=new RegExp("(^|[^\u0410-\u042f\u0401\u0430-\u044f\u0451\\w])([\u041e\u043e]\u0442\u043a\u0443\u0434\u0430|[\u041a\u043a]\u0443\u0434\u0430|[\u0413\u0433]\u0434\u0435|[\u041a\u043a]\u043e\u0433\u0434\u0430|[\u0417\u0437]\u0430\u0447\u0435\u043c|[\u041f\u043f]\u043e\u0447\u0435\u043c\u0443|[\u041a\u043a]\u0430\u043a|[\u041a\u043a]\u0430\u043a\u043e[\u0435\u0439\u043c]|[\u041a\u043a]\u0430\u043a\u0430\u044f|[\u041a\u043a]\u0430\u043a\u0438[\u0435\u043c\u0445]|[\u041a\u043a]\u0430\u043a\u0438\u043c\u0438|[\u041a\u043a]\u0430\u043a\u0443\u044e|[\u0427\u0447]\u0442\u043e|[\u0427\u0447]\u0435\u0433\u043e|[\u0427\u0447]\u0435[\u0439\u043c]|[\u0427\u0447]\u044c\u0438\u043c?|[\u041a\u043a]\u0442\u043e|[\u041a\u043a]\u043e\u0433\u043e|[\u041a\u043a]\u043e\u043c\u0443|[\u041a\u043a]\u0435\u043c)( | -|- )(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+rr("ru/dashAfter"),"g");return e.replace(t,(function(e,t,n,r,o){var a=n+r+o;return"\u043a\u0430\u043a \u0442\u043e"===a||"\u041a\u0430\u043a \u0442\u043e"===a?e:t+n+"-"+o}))}},Do={name:"ru/dash/kakto",handler:function(e){var t=new RegExp("(^|[^\u0410-\u042f\u0401\u0430-\u044f\u0451\\w])([\u041a\u043a]\u0430\u043a) \u0442\u043e"+rr("ru/dashAfter"),"g");return e.replace(t,"$1$2-\u0442\u043e")}},No={name:"ru/dash/weekday",handler:function(e,t){var n="("+rr("ru/weekday")+")",r=new RegExp(n+" ?("+rr("common/dash")+") ?"+n,"gi");return e.replace(r,"$1"+t.dash+"$3")},settings:{dash:"\u2013"}},Co={name:"ru/dash/years",handler:function(e,t){var n=rr("common/dash"),r=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+n+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return e.replace(r,(function(e,n,r,o,a){return parseInt(r,10)<parseInt(a,10)?n+r+t.dash+a:e}))},settings:{dash:"\u2013"}};kr.addRules([fo,yo,vo,bo,xo,$o,wo,Eo,Ro,To,qo,Ao,So,ko,Bo,Do,No,Co]);var Lo="(-|\\.|\\/)",Io="(-|\\/)",Oo=new RegExp("(^|\\D)(\\d{4})"+Lo+"(\\d{2})"+Lo+"(\\d{2})(\\D|$)","gi"),Po=new RegExp("(^|\\D)(\\d{2})"+Io+"(\\d{2})"+Io+"(\\d{4})(\\D|$)","gi"),zo={name:"ru/date/fromISO",handler:function(e){return e.replace(Oo,"$1$6.$4.$2$7").replace(Po,"$1$4.$2.$6$7")}},Mo={name:"ru/date/weekday",handler:function(e){var t=rr("ru/monthGenCase"),n=rr("ru/weekday"),r=new RegExp("(\\d)( |\xa0)("+t+"),( |\xa0)("+n+")","gi");return e.replace(r,(function(e,t,n,r,o,a){return t+n+r.toLowerCase()+","+o+a.toLowerCase()}))}};kr.addRules([zo,Mo]);var jo={name:"ru/money/currency",handler:function(e){var t="([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])",n="[ \xa0\u2009\u202f]",r=new RegExp("(^|[\\D]{2})"+t+" ?("+ir+"("+n+"\\d{3})*)("+n+"?(\u0442\u044b\u0441\\.|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d))?","gm"),o=new RegExp("(^|[\\D])("+ir+") ?"+t,"gm");return e.replace(r,(function(e,t,n,r,o,a,s,i){return t+r+(i?"\xa0"+i:"")+"\xa0"+n})).replace(o,"$1$2\xa0$4")},disabled:!0},Uo={name:"ru/money/ruble",handler:function(e){var t="$1\xa0\u20bd",n="(\\d+)( |\xa0)?(\u0440|\u0440\u0443\u0431)\\.",r=new RegExp("^"+n+"$","g"),o=new RegExp(n+"(?=[!?,:;])","g"),a=new RegExp(n+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(r,t).replace(o,t).replace(a,t+".")},disabled:!0};function Wo(e,t,n,r){return"\u0434\u0434"===n&&"\u043c\u043c"===r||["\u0440\u0444","\u0440\u0443","\u0440\u0443\u0441","\u043e\u0440\u0433","\u0443\u043a\u0440","\u0431\u0433","\u0441\u0440\u0431"].indexOf(r)>-1?e:t+n+".\xa0"+r+"."}kr.addRules([jo,Uo]);var Fo={name:"ru/nbsp/abbr",handler:function(e){var t=new RegExp("(^|\\s|".concat(cr,")([\u0430-\u044f\u0451]{1,3})\\. ?([\u0430-\u044f\u0451]{1,3})\\."),"g");return e.replace(t,Wo).replace(t,Wo)}},_o={name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var t="(\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)",n=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451]) "+t+'(?=[,;:?!"\u2018\u201c\xbb])',"g"),r=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451])[ \xa0]"+t+"[ \xa0]","g");return e.replace(n,"$1\xa0$2").replace(r,"$1\xa0$2 ")}},Ho={name:"ru/nbsp/centuries",handler:function(e){var t=rr("common/dash"),n="(^|\\s)([VIX]+)",r='(?=[,;:?!"\u2018\u201c\xbb]|$)',o=new RegExp(n+"[ \xa0]?\u0432\\.?"+r,"gm"),a=new RegExp(n+"("+t+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+r,"gm");return e.replace(o,"$1$2\xa0\u0432.").replace(a,"$1$2$3$4\xa0\u0432\u0432.")}},Qo={name:"ru/nbsp/dayMonth",handler:function(e){var t=new RegExp("(\\d{1,2}) ("+rr("ru/shortMonth")+")","gi");return e.replace(t,"$1\xa0$2")}},Vo={name:"ru/nbsp/initials",handler:function(e){var t="\xa0\u202f ",n=rr("ru/quote"),r=new RegExp("(^|["+t+n.left+'\uf000"])([\u0410-\u042f\u0401])\\.['+t+"]?([\u0410-\u042f\u0401])\\.["+t+"]?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)","gm");return e.replace(r,"$1$2.\xa0$3.\xa0$4")}},Go={2:"\xb2","\xb2":"\xb2",3:"\xb3","\xb3":"\xb3","":""},Ko={name:"ru/nbsp/m",index:"+5",handler:function(e){var t=new RegExp("(^|[\\s,.\\(\uf000])(\\d+)[ \xa0]?(\u043c\u043c?|\u0441\u043c|\u043a\u043c|\u0434\u043c|\u0433\u043c|mm?|km|cm|dm)([23\xb2\xb3])?([\\s\\).!?,;\uf000]|$)","gm");return e.replace(t,(function(e,t,n,r,o,a){return t+n+"\xa0"+r+Go[o||""]+("\xa0"===a?" ":a)}))}},Xo={name:"ru/nbsp/page",handler:function(e){var t=new RegExp("(^|[)\\s\uf000])(\u0441\u0442\u0440|\u0433\u043b|\u0440\u0438\u0441|\u0438\u043b\u043b?|\u0441\u0442|\u043f|c)\\. *(\\d+)([\\s.,?!;:]|$)","gim");return e.replace(t,"$1$2.\xa0$3$4")}},Zo={name:"ru/nbsp/ps",handler:function(e){var t=new RegExp("(^|\\s|".concat(cr,")[p\u0437]\\.[ \xa0]?([p\u0437]\\.[ \xa0]?)?[s\u044b]\\.:? "),"gim");return e.replace(t,(function(e,t,n){return t+(n?"P.\xa0P.\xa0S. ":"P.\xa0S. ")}))}},Yo={name:"ru/nbsp/see",handler:function(e){var t=new RegExp("(^|\\s|".concat(cr,"|\\()(\u0441\u043c|\u0438\u043c)\\.[ \xa0]?([\u0430-\u044f\u04510-9a-z]+)([\\s.,?!]|$)"),"gi");return e.replace(t,(function(e,t,n,r,o){return("\xa0"===t?" ":t)+n+".\xa0"+r+o}))}},Jo={name:"ru/nbsp/years",index:"+5",handler:function(e){var t=rr("common/dash"),n=new RegExp("(^|\\D)(\\d{4})("+t+')(\\d{4})[ \xa0]?\u0433\\.?([ \xa0]?\u0433\\.)?(?=[,;:?!"\u2018\u201c\xbb\\s]|$)',"gm");return e.replace(n,"$1$2$3$4\xa0\u0433\u0433.")}};kr.addRules([Fo,{name:"ru/nbsp/addr",handler:function(e){return e.replace(/(\s|^)(\u0434\u043e\u043c|\u0434\.|\u043a\u0432\.|\u043f\u043e\u0434\.|\u043f-\u0434) *(\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\u043c\u043a\u0440-\u043d|\u043c\u043a-\u043d|\u043c\u043a\u0440\.|\u043c\u043a\u0440\u043d)\s/gi,"$1$2\xa0").replace(/(\s|^)(\u044d\u0442\.) *(-?\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\d+) +\u044d\u0442\u0430\u0436([^\u0430-\u044f\u0451]|$)/gi,"$1$2\xa0\u044d\u0442\u0430\u0436$3").replace(/(\s|^)\u043b\u0438\u0442\u0435\u0440\s([\u0410-\u042f]|$)/gi,"$1\u043b\u0438\u0442\u0435\u0440\xa0$2").replace(/(\s|^)(\u043e\u0431\u043b|\u043a\u0440|\u0441\u0442|\u043f\u043e\u0441|\u0441|\u0434|\u0443\u043b|\u043f\u0435\u0440|\u043f\u0440|\u043f\u0440-\u0442|\u043f\u0440\u043e\u0441\u043f|\u043f\u043b|\u0431\u0443\u043b|\u0431-\u0440|\u043d\u0430\u0431|\u0448|\u0442\u0443\u043f|\u043e\u0444|\u043a\u043e\u043c\u043d?|\u0443\u0447|\u0432\u043b|\u0432\u043b\u0430\u0434|\u0441\u0442\u0440|\u043a\u043e\u0440)\. *([\u0430-\u044f\u0451a-z\d]+)/gi,"$1$2.\xa0$3").replace(/(\D[ \u00A0]|^)\u0433\. ?([\u0410-\u042f\u0401])/gm,"$1\u0433.\xa0$2")}},{name:"ru/nbsp/afterNumberSign",handler:function(e){return e.replace(/\u2116[ \u00A0\u2009]?(\d|\u043f\/\u043f)/g,"\u2116\u202f$1")}},_o,Ho,Qo,Vo,Ko,{name:"ru/nbsp/mln",handler:function(e){return e.replace(/(\d) ?(\u0442\u044b\u0441|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d)(\.|\s|$)/gi,"$1\xa0$2$3")}},{name:"ru/nbsp/ooo",handler:function(e){return e.replace(/(^|[^a-\u044f\u0451A-\u042f\u0401])(\u041e\u041e\u041e|\u041e\u0410\u041e|\u0417\u0410\u041e|\u041d\u0418\u0418|\u041f\u0411\u041e\u042e\u041b) /g,"$1$2\xa0")}},Xo,Zo,{name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}},Yo,{name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}},Jo]);var ea={name:"ru/number/ordinals",handler:function(e,t,n){var r=n.getData("char"),o=new RegExp("(\\d[%\u2030]?)-(\u044b\u0439|\u043e\u0439|\u0430\u044f|\u043e\u0435|\u044b\u0435|\u044b\u043c|\u043e\u043c|\u044b\u0445|\u043e\u0433\u043e|\u043e\u043c\u0443|\u044b\u043c\u0438)(?!["+r+"])","g");return e.replace(o,(function(e,t,n){return t+"-"+{\u043e\u0439:"\u0439",\u044b\u0439:"\u0439",\u0430\u044f:"\u044f",\u043e\u0435:"\u0435",\u044b\u0435:"\u0435",\u044b\u043c:"\u043c",\u043e\u043c:"\u043c",\u044b\u0445:"\u0445",\u043e\u0433\u043e:"\u0433\u043e",\u043e\u043c\u0443:"\u043c\u0443",\u044b\u043c\u0438:"\u043c\u0438"}[n]}))}};function ta(e,t){var n=new RegExp('<span class="('+t.join("|")+')">([^]*?)</span>',"g");return e.replace(n,"$2")}function na(e,t){return e.replace(/<title>[^]*?<\/title>/i,(function(e){return ta(e,t)}))}kr.addRules([{name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%\u2030\xb0\xd7x])/gim,"$1$2,$3")}},ea]);var ra=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],oa="ru/optalign/bracket",aa={name:oa,handler:function(e){return e.replace(/( |\u00A0)\(/g,'<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>').replace(/^\(/gm,'<span class="typograf-oa-n-lbracket">(</span>')},disabled:!0,htmlAttrs:!1},sa={name:oa,queue:"start",handler:function(e){return ta(e,ra)},htmlAttrs:!1},ia={name:oa,queue:"end",handler:function(e){return na(e,ra)},htmlAttrs:!1},ua=["typograf-oa-comma","typograf-oa-comma-sp"],la="ru/optalign/comma",ca={name:la,handler:function(e,t,n){var r=n.getData("char"),o=new RegExp("(["+r+"\\d\u0301]+), ","gi");return e.replace(o,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1},pa={name:la,queue:"start",handler:function(e){return ta(e,ua)},htmlAttrs:!1},ga={name:la,queue:"end",handler:function(e){return na(e,ua)},htmlAttrs:!1},ha=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],ma="ru/optalign/quote",da={name:ma,handler:function(e){var t=this.getSetting("common/punctuation/quote","ru"),n="(["+t.left[0]+(t.left[1]||"")+"])",r=new RegExp("(^|\n\n|\uf000)("+n+")","g"),o=new RegExp("([^\n\uf000])([ \xa0\n])("+n+")","gi");return e.replace(r,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(o,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1},fa={name:ma,queue:"start",handler:function(e){return ta(e,ha)},htmlAttrs:!1},ya={name:ma,queue:"end",handler:function(e){return na(e,ha)},htmlAttrs:!1};kr.addRules([aa,ca,da]),kr.addInnerRules([sa,ia,pa,ga,fa,ya]);var va=[];function ba(e){var t,n,r=e[0],o="";if(e.length<8)return xa(e);if(e.length>10)if("+"===r){if("7"!==e[1])return e;t=!0,e=e.substr(2)}else"8"===r&&(n=!0,e=e.substr(1));for(var a=8;a>=2;a--){var s=+e.substr(0,a);if(va.indexOf(s)>-1){o=e.substr(0,a),e=e.substr(a);break}}return o||(o=e.substr(0,5),e=e.substr(5)),(t?"+7\xa0":"")+(n?"8\xa0":"")+function(e){var t=+e,n=e.length,r=[e],o=!1;if(n>3)switch(n){case 4:r=[e.substr(0,2),e.substr(2,2)];break;case 5:r=[e.substr(0,3),e.substr(3,3)];break;case 6:r=[e.substr(0,2),e.substr(2,2),e.substr(4,2)]}else o=t>900&&t<=999||495===t||499===t;var a=r.join("-");return o?a:"("+a+")"}(o)+"\xa0"+xa(e)}function xa(e){var t="";return e.length%2&&(t=e[0],t+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),t+e.split(/(?=(?:\d\d)+$)/).join("-")}function $a(e){return e.replace(/[^\d+]/g,"")}[4162,416332,8512,851111,4722,4725,391379,8442,4732,4152,4154451,4154459,4154455,41544513,8142,8332,8612,8622,3525,812,8342,8152,3812,4862,3422,342633,8112,9142,8452,3432,3434,3435,4812,8432,8439,3822,4872,3412,3511,3512,3022,4112,4852,4855,3852,3854,8182,818,90,3472,4741,4764,4832,4922,8172,8202,8722,4932,493,3952,3951,3953,411533,4842,3842,3843,8212,4942,"39131-39179","39190-39199",391,4712,4742,8362,495,499,4966,4964,4967,498,8312,8313,3832,383612,3532,8412,4232,423370,423630,8632,8642,8482,4242,8672,8652,4752,4822,482502,4826300,3452,8422,4212,3466,3462,8712,8352,"901-934","936-939","950-953",958,"960-969","977-989","991-997",999].forEach((function(e){if("string"==typeof e)for(var t=e.split("-"),n=+t[0];n<=+t[1];n++)va.push(n);else va.push(e)}));var wa={name:"ru/other/phone-number",live:!1,handler:function(e){var t=new RegExp("(^|,| |\uf000)(\\+7[\\d\\(\\) \xa0-]{10,18})(?=,|;|\uf000|$)","gm");return e.replace(t,(function(e,t,n){var r=$a(n);return 12===r.length?t+ba(r):e})).replace(/(^|[^\u0430-\u044f\u0451])([\u260e\u260f\u2706\ud83d\udce0\ud83d\udcde\ud83d\udcf1]|\u0442\.|\u0442\u0435\u043b\.|\u0444\.|\u043c\u043e\u0431\.|\u0444\u0430\u043a\u0441|\u0441\u043e\u0442\u043e\u0432\u044b\u0439|\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439|\u0442\u0435\u043b\u0435\u0444\u043e\u043d)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi,(function(e,t,n,r,o){var a=$a(o);return a.length>=5?t+n+r+ba(a):e}))}};kr.addRules([{name:"ru/other/accent",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])([\u0410\u0415\u0401\u0418\u041e\u0423\u042b\u042d\u042e\u042f])([^\u0410-\u042f\u0401\w]|$)/g,(function(e,t,n,r){return t+n.toLowerCase()+"\u0301"+r}))},disabled:!0},wa]);var Ea={name:"ru/punctuation/ano",handler:function(e){var t=new RegExp("([^\xab\u201e[(!?,:;\\-\u2012\u2013\u2014\\s\uf000])(\\s+)(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(t,"$1,$2$3")}},Ra={name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var t=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(t,"$1?!$2")}};kr.addRules([Ea,{name:"ru/punctuation/exclamation",handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")},live:!1},Ra,{name:"ru/punctuation/hellipQuestion",handler:function(e){return e.replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(!|\?)(\.\.\.|\u2026)(?=[^.]|$)/g,"$1..")}}]);var Ta={name:"ru/space/year",handler:function(e,t,n){var r=n.getData("char"),o=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+r+"]|$)","g");return e.replace(o,"$1$2 $3$5")}};kr.addRules([{name:"ru/space/afterHellip",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])(\.\.\.|\u2026)([\u0410-\u042f\u0401])/g,"$1$2 $3").replace(/([?!]\.\.)([\u0430-\u044f\u0451a-z])/gi,"$1 $2")}},Ta]),kr.addRules([{name:"ru/symbols/NN",handler:function(e){return e.replace(/\u2116\u2116/g,"\u2116")}}]);var qa={A:"\u0410",a:"\u0430",B:"\u0412",E:"\u0415",e:"\u0435",K:"\u041a",M:"\u041c",H:"\u041d",O:"\u041e",o:"\u043e",P:"\u0420",p:"\u0440",C:"\u0421",c:"\u0441",T:"\u0422",y:"\u0443",X:"\u0425",x:"\u0445"},Aa=Object.keys(qa).join(""),Sa={name:"ru/typo/switchingKeyboardLayout",handler:function(e){var t=new RegExp("(["+Aa+"]{1,3})(?=[\u0410-\u042f\u0401\u0430-\u044f\u0451]+?)","g");return e.replace(t,(function(e,t){for(var n="",r=0;r<t.length;r++)n+=qa[t[r]];return n}))}};kr.addRules([Sa]),kr.setData("fr/quote",{left:"\xab\u2039",right:"\xbb\u203a",spacing:!1});const ka=["common/punctuation/quote","en-US/dash/main","common/nbsp/afterParagraphMark","common/nbsp/afterShortWord","common/nbsp/beforeShortLastNumber","common/nbsp/beforeShortLastWord","common/nbsp/dpi","common/punctuation/apostrophe"],Ba=(e,t,n)=>{const r=new kr({locale:n});return r.disableRule("*"),r.enableRule(k(Pn(e).getOr(ka),v(T,ka))),r.execute(t)},Da=["common/space/delBeforePunctuation","common/space/afterComma","common/space/afterColon","common/space/delBetweenExclamationMarks","common/space/afterExclamationMark","common/space/afterQuestionMark","common/space/afterSemicolon","common/space/beforeBracket","common/space/bracket","common/space/delBeforeDot","common/space/delBeforePercent","common/space/squareBracket","common/number/mathSigns","common/number/times","common/number/fraction","common/symbols/arrow","common/symbols/cf","common/symbols/copy","common/punctuation/delDoublePunctuation","common/punctuation/hellip","common/nbsp/afterSectionMark"],Na=(e,t,n)=>{const r=new kr({locale:n});return r.disableRule("*"),r.enableRule(k(Pn(e).getOr(Da),v(T,Da))),r.execute(t)},Ca=(e,t)=>{const n=((e,t,n,r,o,a,s)=>{const i=Dt(e,t,n),u=Dt(e,r,o);return e.eq(i.element,u.element)?An(e,i.element,a,s):((e,t,n,r,o)=>{const a=sn(e,t,n,b),s=Tn(a.left,a.right);return Rn(e,a.left.item,a.right.item,r,s,o)})(e,i.element,u.element,a,s)})(ze(),t,0,t,"img"===z(r=t)?1:(e=>Le.getOption(e))(r).fold((()=>te(r).length),(e=>e.length)),Wn(e),{assess:e=>xn.inView(e)});var r;return B(n.zones,((e,t)=>e.concat((e=>((e,t,n)=>At(St,e,t,n))(e.elements,A(e.words,(e=>`${e.left.getOr("")}${e.word}${e.right.getOr("")}`)),b))(t))),[])},La=(e,t)=>Be(t,(t=>"false"!==e.dom.getContentEditableParent(t.dom)&&F(t)&&!("\ufeff"===t.dom.data))),Ia=(e,t)=>!q(Mn(e).getOr([]),(e=>((e,t,n)=>se(e,t,void 0).isSome())(t,e))),Oa=(e,t)=>{S(La(e,t),(t=>{Ia(e,t)&&Oe(t,Na(e,Ie(t),Fn(e,t)))})),((e,t)=>{const n=e=>{for(let r=0;r<e.childNodes.length;r++){const o=P.fromDom(e.childNodes[r]);if(t(o))return $.some(o);const a=n(e.childNodes[r]);if(a.isSome())return a}return $.none()};return n(e.dom)})(t,(e=>he(e,"data-mce-bogus"))).isSome()&&S(Ca(e,t),(t=>{var n;q(t.elements,(t=>Ia(e,t)))&&(n=t.elements,q(n,(e=>Z(e).exists((e=>he(e,"data-mce-bogus")))))&&S(t.elements,((n,r)=>{const o=Na(e,t.word,Fn(e,P.fromHtml(t.word)));o!==t.word&&(Z(n).each((e=>{he(e,"data-mce-bogus")&&Ne(e)})),0===r?n.dom.replaceWith(o):De(n))})))}))},Pa=(e,t)=>{e.notificationManager.open({text:t,type:"success",timeout:3e3})},za=e=>{let t=e.getBody();const n=Y(P.fromDom(e.selection.getNode()));for(const r of n){if(!e.dom.isEditable(r.dom))break;t=r.dom}S(e.dom.select(((e,t)=>{const n=[],r=p(t)?e=>q(n,(n=>t(n,e))):e=>T(n,e);for(let t=0,o=e.length;t<o;t++){const o=e[t];r(o)||n.push(o)}return n})(A(I(e.schema.getBlockElements()),(e=>e.toLowerCase()))).join(","),t),(t=>{const n=P.fromDom(t);((e,t=!1)=>{return oe(e)?e.dom.isContentEditable:(n=e,ie(n,"[contenteditable]")).fold(d(t),(e=>"true"===ue(e)));var n})(n)&&(Oa(e,n),((e,t)=>{const n=$.from(kn(t)).getOr("");let r=0;S(La(e,t),(t=>{const{length:o}=Ie(t);Ia(e,t)&&Oe(t,Ba(e,n,Fn(e,t)).slice(r,r+o)),r+=o}))})(e,n))})),Pa(e,"Document typography has been enhanced")},Ma=e=>{const t=e.selection.getRng();((e,t)=>{const{startOffset:n,endOffset:r}=t,o=P.fromDom(t.startContainer),a=P.fromDom(t.endContainer);let s=!1;S(e.selection.getSelectedBlocks(),(t=>{const i=P.fromDom(t),u=$.from(kn(i)).getOr("");let l=0;S(La(e,i),(t=>{const i=Ie(t),{length:c}=i,p=Ba(e,u,Fn(e,t)),g=l,h=l+c;l+=c,Ia(e,t)&&(V(t,o)&&V(t,a)?Oe(t,i.slice(0,n)+p.slice(g,h).slice(n,r)+i.slice(r,c)):V(t,o)?(s=!0,Oe(t,i.slice(0,n)+p.slice(g,h).slice(n,c))):V(t,a)?(s=!1,Oe(t,p.slice(g,h).slice(0,r)+i.slice(r,c))):s&&Oe(t,p.slice(g,h)))}))}))})(e,t),((e,t)=>{const{startContainer:n,endContainer:r,startOffset:o,endOffset:a}=t,s=(u=P.fromDom(n),l=o,c=P.fromDom(r),{start:u,soffset:l,finish:c,foffset:a}),i=e.model.table.getSelectedCells();var u,l,c;i.length>0?S(i,(t=>Oa(e,P.fromDom(t)))):tinymce.dom.RangeUtils(e.dom).walk(t,(n=>{S(0===n.length?[t.commonAncestorContainer]:n,(t=>((e,t,n)=>{if(!Ia(n,e))return;if(!V(e,t.start)&&!V(e,t.finish))return void Oa(n,e);const r=Fn(n,e);if(V(e,t.start)&&F(e)){const o=Ie(e);Oe(e,o.slice(0,t.soffset)+Na(n,o.slice(t.soffset,o.length),r))}if(V(e,t.finish)&&F(e)){const o=Ie(e);Oe(e,Na(n,o.slice(0,t.foffset),r)+o.slice(t.foffset,o.length))}})(P.fromDom(t),s,e)))}))})(e,t),Pa(e,"The selected content typography has been enhanced")},ja=(e,t)=>{const n=e.dom.isEditable(e.selection.getNode());t.setEnabled(n&&!e.dom.isEmpty(e.getBody()))},Ua=e=>t=>{ja(e,t);const n=((e,t)=>{let n=null;const r=()=>{u(n)||(clearTimeout(n),n=null)};return{cancel:r,throttle:(...t)=>{r(),n=setTimeout((()=>{n=null,e.apply(null,t)}),50)}}})((()=>ja(e,t)));return e.on("SelectionChange AfterSetSelectionRange",n.throttle),e.on("remove",n.cancel),()=>{n.cancel(),e.off("SelectionChange AfterSetSelectionRange",n.throttle),e.off("remove",n.cancel)}};tinymce.PluginManager.requireLangPack("typography","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("typography",(e=>{((e,n)=>!!e&&-1===((e,n)=>{const r=t(e.major,n.major);if(0!==r)return r;const o=t(e.minor,n.minor);if(0!==o)return o;const a=t(e.patch,n.patch);return 0!==a?a:0})((e=>r((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),r(n)))(tinymce,"6.0.0")?console.error("The typography plugin requires at least version 6.0.0 of TinyMCE."):((e=>{e.addCommand("mceTypography",(()=>(e=>{e.dom.isEditable(e.selection.getNode())&&e.undoManager.transact((()=>{const t=e.selection.isCollapsed(),n=t?e.selection.getBookmark(2):e.selection.getBookmark();t?za(e):Ma(e),e.focus(),e.selection.moveToBookmark(n)}))})(e)))})(e),(e=>{const t=e.options.register;t("typography_rules",{processor:"string[]"}),t("typography_langs",{processor:On,default:Cn}),t("typography_ignore",{processor:"string[]",default:[]}),t("typography_default_lang",{processor:"string",default:Ln})})(e),(e=>{const t=zn(e),n=t=>{t.isEnabled()&&e.execCommand("mceTypography")};if(t.length<=1)e.ui.registry.addButton("typography",{icon:"typography",tooltip:"Typography",onAction:n,onSetup:Ua(e)}),e.ui.registry.addMenuItem("typography",{icon:"typography",text:"Typography",onAction:n,onSetup:Ua(e)});else{const r=t=>t===Wn(e),o=t=>{(e=>{tinymce.util.LocalStorage.setItem(Un,e)})(t),e.execCommand("mceTypography")};e.ui.registry.addSplitButton("typography",{icon:"typography",tooltip:"Typography",onAction:n,select:r,onSetup:Ua(e),onItemAction:(e,t)=>o(t),fetch:e=>e(A(t,(e=>({value:e,type:"choiceitem",text:Nn[e]}))))}),e.ui.registry.addNestedMenuItem("typography",{icon:"typography",text:"Typography",onSetup:Ua(e),getSubmenuItems:()=>[{type:"menuitem",text:"Enhance",onAction:n},{type:"nestedmenuitem",text:"Language",getSubmenuItems:()=>A(t,(e=>({active:r(e),type:"togglemenuitem",text:Nn[e],onAction:()=>o(e)})))}]})}})(e))}))}(); |