typograf 7.4.4 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! typograf | © 2025 Denis Seleznev | MIT License | https://github.com/typograf/typograf */
2
- ((e,n)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).Typograf=n()})(this,function(){var r=function(){return(r=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e}).apply(this,arguments)};function t(e,n,t){if(t||2===arguments.length)for(var r,a=0,o=n.length;a<o;a++)!r&&a in n||((r=r||Array.prototype.slice.call(n,0,a))[a]=n[a]);return e.concat(r||Array.prototype.slice.call(n))}var P=[["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]],e=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]];function n(){var n=this;this.entities=this.prepareEntities(t(t([],P,!0),e,!0)),this.entitiesByName={},this.entitiesByNameEntity={},this.entitiesByDigitEntity={},this.entitiesByUtf={},this.entities.forEach(function(e){n.entitiesByName[e.name]=e,n.entitiesByNameEntity[e.nameEntity]=e,n.entitiesByDigitEntity[e.digitEntity]=e,n.entitiesByUtf[e.utf]=e}),this.invisibleEntities=this.prepareEntities(e)}n.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}))},n.prototype.decHexToUtf=function(e){return e.replace(/&#(\d{1,6});/gi,function(e,n){return String.fromCharCode(parseInt(n,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,n){return String.fromCharCode(parseInt(n,16))})},n.prototype.restore=function(e){var n=e.prefs.htmlEntity,t=n.type,r=this.entities;"name"!==t&&"digit"!==t||((n.onlyInvisible||n.list)&&(r=[],n.onlyInvisible&&(r=r.concat(this.invisibleEntities)),n.list)&&(r=r.concat(this.prepareListParam(n.list))),e.text=this.restoreEntitiesByIndex(e.text,"name"===t?"nameEntity":"digitEntity",r))},n.prototype.getByUtf=function(e,n){var t;switch(n){case"digit":t=this.entitiesByDigitEntity[e];break;case"name":t=this.entitiesByNameEntity[e];break;default:t=e}return t},n.prototype.prepareEntities=function(e){var r=[];return e.forEach(function(e){var n=e[0],e=e[1],t=String.fromCharCode(e);r.push({name:n,nameEntity:"&"+n+";",digitEntity:"&#"+e+";",utf:t,reName:new RegExp("&"+n+";","g"),reUtf:new RegExp(t,"g")})}),r},n.prototype.prepareListParam=function(e){var n=this,t=[];return e.forEach(function(e){e=n.entitiesByName[e];e&&t.push(e)}),t},n.prototype.restoreEntitiesByIndex=function(n,t,e){return e.forEach(function(e){n=n.replace(e.reUtf,e[t])}),n};var s=new n,a=[];function o(e){e=(e||"").split("/")[0];e&&"common"!==e&&!i(e)&&(a.push(e),a.sort())}function i(e){return"common"===e||-1!==a.indexOf(e)}function u(e,n){e=e||n;return e?Array.isArray(e)?e:[e]:[]}function c(e){if(!e.length)throw Error('Not defined the property "locale".');e.forEach(function(e){if(!i(e))throw Error('"'.concat(e,'" is not supported locale.'))})}var l={};function z(e){return l[e]}function p(n){Object.keys(n).forEach(function(e){o(e),l[e]=n[e]})}var I=["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"],m=new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),h="\\d+([.,]\\d+)?",C=/\d/;function g(e){return-1<e.search(C)}var d="",f="",O=(b.prototype.add=function(e){this.tags.own.push(this.prepareRegExp(e))},b.prototype.show=function(n,t){for(var e=new RegExp("tf\\d+","g"),r=new RegExp("tf\\d"),a=function(e){return n.safeTags.hidden[t][e]||e},o=0,s=this.tags[t].length;o<s&&(n.text=n.text.replace(e,a),-1!==n.text.search(r));o++);},b.prototype.hide=function(n,e){var t=this,r=(n.safeTags.hidden[e]={},this.pasteLabel.bind(this,n,e));this.tags[e].forEach(function(e){n.text=n.text.replace(t.prepareRegExp(e),r)})},b.prototype.hideHTMLTags=function(e){var n;e.isHTML&&(n=this.pasteLabel.bind(this,e,"html"),e.text=e.text.replace(/<\/?[a-z][^]*?>/gi,n).replace(/&lt;\/?[a-z][^]*?&gt;/gi,n).replace(/&[gl]t;/gi,n))},b.prototype.getPrevLabel=function(e,n){for(var t=n-1;0<=t;t--)if(e[t]===d)return e.slice(t,n+1);return""},b.prototype.getNextLabel=function(e,n){for(var t=n+1;t<e.length;t++)if(e[t]===d)return e.slice(n,t+1);return""},b.prototype.getTagByLabel=function(t,r){var a=null;return this.groups.some(function(e){var n=t.safeTags.hidden[e][r];return a=void 0!==n?{group:e,value:n}:a}),a},b.prototype.getTagInfo=function(e){if(!e)return null;var n={group:e.group};switch(e.group){case"html":n.name=e.value.split(/[<\s>]/)[1],n.isInline=-1<I.indexOf(n.name),n.isClosing=-1<e.value.search(/^<\//);break;case"url":n.isInline=!0;break;case"own":n.isInline=!1}return n},b.prototype.pasteLabel=function(e,n,t){var e=e.safeTags,r="tf"+e.counter+d;return e.hidden[n][r]=t,e.counter++,r},b.prototype.prepareRegExp=function(e){var n,t;return e instanceof RegExp?e:(n=e[0],t=e[2],new RegExp(n+(void 0===t?"[^]*?":t)+e[1],"gi"))},b.prototype.getPrevTagInfo=function(e,n,t){n=this.getPrevLabel(n,t-1);if(n){t=this.getTagByLabel(e,n);if(t)return this.getTagInfo(t)}return null},b.prototype.getNextTagInfo=function(e,n,t){n=this.getNextLabel(n,t+1);if(n){t=this.getTagByLabel(e,n);if(t)return this.getTagInfo(t)}return null},b);function b(){this.groups=["own","html","url"],this.hidden={},this.counter=0;var n=[["\x3c!--","--\x3e"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach(function(e){n.push(["<".concat(e,"(\\s[^>]*?)?>"),"</".concat(e,">")])}),this.tags={own:[],html:n.map(this.prepareRegExp),url:[m]}}function $(e,n){for(var t="";1==(1&n)&&(t+=e),0!=(n>>>=1);)e+=e;return t}function y(e){return e.replace(/\u00A0/g," ")}function x(e,n){for(var t=0;t<n.length;t++)e=e.replace(n[t][0],n[t][1]);return e}function H(e){return-1!==e.search(/(<\/?[a-z]|<!|&[lg]t;)/i)}function v(e){return"object"==typeof e?JSON.parse(JSON.stringify(e)):e}var j={symbols:110,number:150,space:210,dash:310,punctuation:410,nbsp:510,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},Q=0,F="default",Y=[],W=[];function R(){var e=t([],Y,!0);return e.sort(function(e,n){return e.index>n.index?1:-1}),e}function X(){return t([],W,!0)}function G(e){var n=e.name.split("/"),t=n[0];return{name:e.name,shortName:n[2],handler:e.handler,queue:e.queue||F,enabled:!0!==e.disabled,locale:t,group:n[1],index:"number"==typeof(t=e).index?t.index:(n=t.name.split("/")[1],void 0===(n=j[n])&&(n=Q),"string"==typeof t.index?n+parseInt(t.index,10):n),settings:e.settings,live:e.live,htmlAttrs:e.htmlAttrs}}function K(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 V(e){return e||"LF"}S.addRule=function(e){o((e=G(e=e)).locale),Y.push(e)},S.addRules=function(e){var n=this;e.forEach(function(e){n.addRule(e)})},S.addInnerRule=function(e){W.push(G(e))},S.addInnerRules=function(e){var n=this;e.forEach(function(e){n.addInnerRule(e)})},S.getRule=function(n){var t=null;return R().some(function(e){return e.name===n&&(t=e,!0)}),t},S.getRules=R,S.getInnerRules=X,S.getLocales=function(){return a},S.addLocale=function(e){o(e)},S.hasLocale=i,S.setData=function(e){p(e)},S.getData=function(e){return l[e]},S.prototype.execute=function(e,n){var t;return(e=""+e)?(t=this.prefs,n=n,t=r({},t),n&&("locale"in n&&(t.locale=u(n.locale)),"htmlEntity"in n&&(t.htmlEntity=K(n.htmlEntity)),"lineEnding"in n&&(t.lineEnding=V(n.lineEnding)),"processingSeparateParts"in n&&(t.processingSeparateParts=n.processingSeparateParts),"ruleFilter"in n)&&(t.ruleFilter=n.ruleFilter),c((n=t).locale),t=this.prepareContext(e,n),this.process(t)):""},S.prototype.getSetting=function(e,n){return this.settings[e]&&this.settings[e][n]},S.prototype.setSetting=function(e,n,t){this.settings[e]=this.settings[e]||{},this.settings[e][n]=t},S.prototype.isEnabledRule=function(e){return!1!==this.enabledRules[e]},S.prototype.isDisabledRule=function(e){return!this.enabledRules[e]},S.prototype.enableRule=function(e){return this.enable(e,!0)},S.prototype.disableRule=function(e){return this.enable(e,!1)},S.prototype.addSafeTag=function(e,n,t){e=e instanceof RegExp?e:[e,n,t];this.safeTags.add(e)},S.prototype.prepareContext=function(e,t){return{text:e,isHTML:H(e),prefs:t,getData:function(n){return"char"===n?t.locale.map(function(e){return l[e+"/"+n]}).join(""):z(t.locale[0]+"/"+n)},safeTags:this.safeTags}},S.prototype.splitBySeparateParts=function(a){var o,e,s;return a.isHTML&&!1!==a.prefs.processingSeparateParts?(o=[],e=new RegExp("<("+this.separatePartsTags.join("|")+")(\\s[^>]*?)?>[^]*?</\\1>","gi"),s=0,a.text.replace(e,function(e,n,t,r){return s!==r&&o.push((s?f:"")+a.text.slice(s,r)+f),o.push(e),s=r+e.length,e}),o.push(s?f+a.text.slice(s,a.text.length):a.text),o):[a.text]},S.prototype.process=function(n){var e,t=this,r=(n.text=n.text.replace(/\r\n?/g,"\n"),this.executeRules(n,"start"),this.safeTags.hide(n,"own"),this.executeRules(n,"hide-safe-tags-own"),this.safeTags.hide(n,"html"),this.executeRules(n,"hide-safe-tags-html"),n.isHTML),a=new RegExp(f,"g");return n.text=this.splitBySeparateParts(n).map(function(e){return n.text=e,n.isHTML=H(e),t.safeTags.hideHTMLTags(n),t.safeTags.hide(n,"url"),t.executeRules(n,"hide-safe-tags-url"),t.executeRules(n,"hide-safe-tags"),s.toUtf(n),n.prefs.live&&(n.text=y(n.text)),t.executeRules(n,"utf"),t.executeRules(n),s.restore(n),t.executeRules(n,"html-entities"),t.safeTags.show(n,"url"),t.executeRules(n,"show-safe-tags-url"),n.text.replace(a,"")}).join(""),n.isHTML=r,this.safeTags.show(n,"html"),this.executeRules(n,"show-safe-tags-html"),this.safeTags.show(n,"own"),this.executeRules(n,"show-safe-tags-own"),this.executeRules(n,"end"),r=n.text,"CRLF"===(e=n.prefs.lineEnding)?r.replace(/\n/g,"\r\n"):"CR"===e?r.replace(/\n/g,"\r"):r},S.prototype.executeRules=function(n,e){var t=this,r=this.rulesByQueues[e=void 0===e?F:e],e=this.innerRulesByQueues[e];e&&e.forEach(function(e){t.ruleIterator(n,e)}),r&&r.forEach(function(e){t.ruleIterator(n,e)})},S.prototype.ruleIterator=function(e,n){!0===e.prefs.live&&!1===n.live||!1===e.prefs.live&&!0===n.live||"common"!==n.locale&&n.locale!==e.prefs.locale[0]||!this.isEnabledRule(n.name)||e.prefs.ruleFilter&&!e.prefs.ruleFilter(n)||(this.onBeforeRule&&this.onBeforeRule(n.name,e),e.text=n.handler.call(this,e.text,this.settings[n.name],e),this.onAfterRule&&this.onAfterRule(n.name,e))},S.prototype.prepareRuleSettings=function(e){this.settings[e.name]=v(e.settings),this.enabledRules[e.name]=e.enabled},S.prototype.enable=function(e,n){var t=this;Array.isArray(e)?e.forEach(function(e){t.enableByMask(e,n)}):this.enableByMask(e,n)},S.prototype.enableByMask=function(e,n){var t,r=this;e&&(-1!==e.search(/\*/)?(t=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this.rules.forEach(function(e){e=e.name;t.test(e)&&(r.enabledRules[e]=n)})):this.enabledRules[e]=n)},S.groups=[],S.titles={},S.version="7.4.4";var w=S;function S(e){var n=this;this.rules=[],this.innerRules=[],this.rulesByQueues={},this.innerRulesByQueues={},this.separatePartsTags=["title","p","h[1-6]","select","legend"],this.prefs={locale:u((e=e).locale),lineEnding:V(e.lineEnding),live:Boolean(e.live),ruleFilter:e.ruleFilter,enableRule:e.enableRule,disableRule:e.disableRule,processingSeparateParts:e.processingSeparateParts,htmlEntity:K(e.htmlEntity)},c(this.prefs.locale),this.safeTags=new O,this.settings={},this.enabledRules={},this.innerRulesByQueues={},this.innerRules=X(),this.innerRules.forEach(function(e){n.innerRulesByQueues[e.queue]=n.innerRulesByQueues[e.queue]||[],n.innerRulesByQueues[e.queue].push(e)}),this.rulesByQueues={},this.rules=R(),this.rules.forEach(function(e){n.prepareRuleSettings(e),n.rulesByQueues[e.queue]=n.rulesByQueues[e.queue]||[],n.rulesByQueues[e.queue].push(e)}),this.prefs.disableRule&&this.disableRule(this.prefs.disableRule),this.prefs.enableRule&&this.enableRule(this.prefs.enableRule)}[{"common/char":"a-z","common/dash":"--?|‒|–|—","common/quote":'«‹»›„“‟”"'},{"be/char":"абвгдежзйклмнопрстуфхцчшыьэюяёіўґ","be/quote":{left:"«“",right:"»”"}},{"bg/char":"абвгдежзийклмнопрстуфхцчшщъьюя","bg/quote":{left:"„’",right:"“’"}},{"ca/char":"abcdefghijlmnopqrstuvxyzàçèéíïòóúü","ca/quote":{left:"«“",right:"»”"}},{"cs/char":"a-záéíóúýčďěňřšťůž","cs/quote":{left:"„‚",right:"“‘"}},{"da/char":"a-zåæø","da/quote":{left:"»›",right:"«‹"}},{"de/char":"a-zßäöü","de/quote":{left:"„‚",right:"“‘"}},{"el/char":"ΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϲάέήίόύώ","el/quote":{left:"«“",right:"»”"}},{"en-GB/char":"a-z","en-GB/quote":{left:"‘“",right:"’”"}},{"en-US/char":"a-z","en-US/quote":{left:"“‘",right:"”’"},"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ĉĝĥĵŝŭ","eo/quote":{left:"“‘",right:"”’"}},{"es/char":"a-záéíñóúü","es/quote":{left:"«“",right:"»”"}},{"et/char":"abdefghijklmnoprstuvzäõöüšž","et/quote":{left:"„«",right:"“»"}},{"fi/char":"abcdefghijklmnopqrstuvyöäå","fi/quote":{left:"”’",right:"”’"}},{"fr/char":"a-zàâçèéêëîïôûüœæ","fr/quote":{left:"«‹",right:"»›",spacing:!0}},{"ga/char":"abcdefghilmnoprstuvwxyzáéíóú","ga/quote":{left:"“‘",right:"”’"}},{"hu/char":"a-záäéíóöúüőű","hu/quote":{left:"„»",right:"”«"}},{"it/char":"a-zàéèìòù","it/quote":{left:"«“",right:"»”"}},{"lv/char":"abcdefghijklmnopqrstuvxzæœ","lv/quote":{left:"«„",right:"»“"}},{"nl/char":"a-zäçèéêëîïñöûü","nl/quote":{left:"‘“",right:"’”"}},{"no/char":"a-zåæèéêòóôø","no/quote":{left:"«’",right:"»’"}},{"pl/char":"abcdefghijklmnoprstuvwxyzóąćęłńśźż","pl/quote":{left:"„«",right:"”»"}},{"ro/char":"abcdefghijklmnoprstuvxzîășț","ro/quote":{left:"„«",right:"”»"}},{"ru/char":"а-яё","ru/dashBefore":"(^| |\\n)","ru/dashAfter":"(?=[  ,.?:!]|$)","ru/dashAfterDe":"(?=[,.?:!]|[  ][^А-ЯЁ]|$)","ru/l":"а-яёa-z","ru/L":"А-ЯЁA-Z","ru/month":"январь|февраль|март|апрель|май|июнь|июль|август|сентябрь|октябрь|ноябрь|декабрь","ru/monthGenCase":"января|февраля|марта|апреля|мая|июня|июля|августа|сентября|октября|ноября|декабря","ru/monthPreCase":"январе|феврале|марте|апреле|мае|июне|июле|августе|сентябре|октябре|ноябре|декабре","ru/quote":{left:"«„‚",right:"»“‘",removeDuplicateQuotes:!0},"ru/shortMonth":"янв|фев|мар|апр|ма[ейя]|июн|июл|авг|сен|окт|ноя|дек","ru/shortWord":"а|бы|в|во|да|до|же|за|и|из|к|ко|ли|на|не|ни|но|о|об|от|по|с|со|то|у","ru/weekday":"понедельник|вторник|среда|четверг|пятница|суббота|воскресенье"},{"sk/char":"abcdefghijklmnoprstuvwxyzáäéíóôúýčďľňŕšťž","sk/quote":{left:"„‚",right:"“‘"}},{"sl/char":"a-zčšž","sl/quote":{left:"„‚",right:"“‘"}},{"sr/char":"abcdefghijklmnoprstuvzćčđšž","sr/quote":{left:"„’",right:"”’"}},{"sv/char":"a-zäåéö","sv/quote":{left:"”’",right:"”’"}},{"tr/char":"abcdefghijklmnoprstuvyzâçîöûüğış","tr/quote":{left:"“‘",right:"”’"}},{"uk/char":"абвгдежзийклмнопрстуфхцчшщьюяєіїґ","uk/quote":{left:"«„",right:"»“"}}].forEach(p);var Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},E={name:"common/html/escape",index:"+100",queue:"end",handler:function(e){return e.replace(/[&<>"'/]/g,function(e){return Z[e]})},disabled:!0},J=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]"),E=(w.addRules([{name:"common/html/e-mail",queue:"end",handler:function(e,n,t){return t.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},E,{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},{name:"common/html/p",index:"+5",queue:"end",handler:function(e){e=e.split("\n\n");return e.forEach(function(e,n,t){!e.trim()||J.test(e)||(t[n]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1"))}),e.join("\n\n")},disabled:!0,htmlAttrs:!1},{name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(e,n,t){var s=this,r=new RegExp("(^|\\s)("+n.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),i=v(t.prefs);return i.ruleFilter=function(e){return!1!==e.htmlAttrs},e.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g,function(e,n,t){return n+t.replace(r,function(e,n,t,r){var a=r[0],o=r[r.length-1],r=r.slice(1,-1);return n+t+"="+a+s.execute(r,i)+o})})},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1},{name:"common/html/quot",queue:"hide-safe-tags",handler:function(e){return e.replace(/&quot;/g,'"')}},{name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0},{name:"common/html/url",queue:"end",handler:function(e,n,t){return t.isHTML?e:e.replace(m,function(e,n,t){t=t.replace(/([^/]+\/?)(\?|#)$/,"$1").replace(/^([^/]+)\/$/,"$1"),"http"===n?t=t.replace(/^([^/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===n&&(t=t.replace(/^([^/]+)(:443)([^\d]|\/|$)/,"$1$3"));var r=t,t=n+"://"+t,a='<a href="'+t+'">';return"http"===n||"https"===n?(r=r.replace(/^www\./,""),a+("http"===n?r:n+"://"+r)+"</a>"):a+t+"</a>"})},disabled:!0,htmlAttrs:!1}]),{name:"common/nbsp/afterNumber",handler:function(e,n,t){t=t.getData("char");return e.replace(new RegExp("(^|\\s)(\\d{1,5}) (["+t+"]+)","gi"),"$1$2 $3")},disabled:!0});function _(e,n,t,r){return n+t.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+r}w.addRules([E,{name:"common/nbsp/afterParagraphMark",handler:function(e){return e.replace(/¶ ?(?=\d)/g,"¶ ")}},{name:"common/nbsp/afterSectionMark",handler:function(e,n,t){t=t.prefs.locale[0];return e.replace(/§[ \u00A0\u2009]?(?=\d|I|V|X)/g,"ru"===t?"§ ":"§ ")}},{name:"common/nbsp/afterShortWord",handler:function(e,n,t){var r=n.lengthShortWord,n=n.useShortWordList,a=l["common/quote"],o=t.getData("char"),t=t.getData("shortWord"),a="  ("+a,n=new RegExp(n&&void 0!==t?"(^|["+a+"])("+t+") ":"(^|["+a+"])(["+o+"]{1,"+r+"}) ","gim");return e.replace(n,"$1$2 ").replace(n,"$1$2 ")},settings:{lengthShortWord:2,useShortWordList:!1}},{name:"common/nbsp/beforeShortLastNumber",handler:function(e,n,t){var r=t.getData("quote"),t=t.getData("char"),a=t.toUpperCase(),t=new RegExp("(["+t+a+"]) (?=\\d{1,"+n.lengthLastNumber+"}[-+−%'\""+r.right+")]?([.!?…]( ["+a+"]|$)|$))","gm");return e.replace(t,"$1 ")},live:!1,settings:{lengthLastNumber:2}},{name:"common/nbsp/beforeShortLastWord",handler:function(e,n,t){var t=t.getData("char"),r=t.toUpperCase(),t=new RegExp("(["+t+"\\d]) (["+t+r+"]{1,"+n.lengthLastWord+"}[.!?…])( ["+r+"]|$)","g");return e.replace(t,"$1 $2$3")},settings:{lengthLastWord:3}},{name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1 $2")}},{name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,_).replace(/(<nobr>)(.*?)(<\/nobr>)/g,_)}},{name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:y,disabled:!0}]);E={name:"common/number/digitGrouping",index:"310",disabled:!0,handler:function(e,a){return e.replace(new RegExp("(^ ?|\\D |".concat(d,")(\\d{1,3}([    ]\\d{3})+)(?! ?[\\d-])"),"gm"),function(e,n,t){return n+t.replace(/\s/g,a.space)}).replace(/(\d{5,}([.,]\d+)?)/g,function(e,n){var t=n.match(/[.,]/),n=t?n.split(t):[n],r=n[0],n=n[1],r=r.replace(/(\d)(?=(\d{3})+([^\d]|$))/g,"$1"+a.space);return t?r+t+n:r})},settings:{space:" "}},w.addRules([E,{name:"common/number/fraction",handler:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1½$2").replace(/(^|\D)1\/4(\D|$)/g,"$1¼$2").replace(/(^|\D)3\/4(\D|$)/g,"$1¾$2")}},{name:"common/number/mathSigns",handler:function(e){return x(e,[[/!=/g,"≠"],[/<=/g,"≤"],[/(^|[^=])>=/g,"$1≥"],[/<=>/g,"⇔"],[/<</g,"≪"],[/>>/g,"≫"],[/~=/g,"≅"],[/(^|[^+])\+-/g,"$1±"]])}},{name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[xх][ \u00A0]?(\d)/g,"$1×$2")}}]),w.addRules([{name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}},{name:"common/other/repeatWord",handler:function(e,n,t){var r=l["common/quote"],t=t.getData("char"),r="[;:,.?! \n"+r+"]",t=new RegExp("("+r+"|^)(["+t+"]{"+n.min+",}) \\2("+r+"|$)","gi");return e.replace(t,"$1$2$3")},settings:{min:2},disabled:!0}]),E={name:"common/punctuation/apostrophe",handler:function(e,n,t){t="(["+t.getData("char")+"])",t=new RegExp(t+"'"+t,"gi");return e.replace(t,"$1’$2")}};function U(){this.bufferQuotes={left:"",right:""},this.beforeLeft=" \n\t [(",this.afterRight=" \n\t !?.:;#*,…)\\]"}U.prototype.process=function(e){var n,t,r=e.context.text;return this.count(r).total&&(n=e.settings,(t=e.settings.left[0]===e.settings.right[0])&&(e.settings=v(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&&(r=this.removeSpacing(r,e.settings)),r=this.set(r,e),e.settings.spacing&&(r=this.setSpacing(r,e.settings)),e.settings.removeDuplicateQuotes&&(r=this.removeDuplicates(r,e.settings)),t)&&(r=this.returnOriginalQuotes(r,n,e.settings),e.settings=n),r},U.prototype.returnOriginalQuotes=function(e,n,t){for(var r={},a=0;a<t.left.length;a++)r[t.left[a]]=n.left[a],r[t.right[a]]=n.right[a];return e.replace(new RegExp("["+t.left+t.right+"]","g"),function(e){return r[e]})},U.prototype.count=function(e){var n={total:0};return e.replace(new RegExp("["+l["common/quote"]+"]","g"),function(e){return n[e]||(n[e]=0),n[e]++,n.total++,e}),n},U.prototype.removeDuplicates=function(e,n){var t=n.left[0],r=n.left[1]||t,n=n.right[0];return t!==r?e:e.replace(new RegExp(t+t,"g"),t).replace(new RegExp(n+n,"g"),n)},U.prototype.removeSpacing=function(e,n){for(var t=0,r=n.left.length;t<r;t++){var a=n.left[t],o=n.right[t];e=e.replace(new RegExp(a+"([   ])","g"),a).replace(new RegExp("([   ])"+o,"g"),o)}return e},U.prototype.setSpacing=function(e,n){for(var t=0,r=n.left.length;t<r;t++){var a=n.left[t],o=n.right[t];e=e.replace(new RegExp(a+"([^ ])","g"),a+" $1").replace(new RegExp("([^ ])"+o,"g"),"$1 "+o)}return e},U.prototype.set=function(e,n){var t=l["common/quote"],r=n.settings.left[0],a=n.settings.left[1]||r,o=n.settings.right[0],s=new RegExp("(^|["+this.beforeLeft+"])(["+t+"]+)(?=[^\\s"+d+"])","gim"),t=new RegExp("([^\\s])(["+t+"]+)(?=["+this.afterRight+"]|$)","gim");return e=e.replace(s,function(e,n,t){return n+$(r,t.length)}).replace(t,function(e,n,t){return n+$(o,t.length)}),e=this.setAboveTags(e,n),e=r!==a?this.setInner(e,n.settings):e},U.prototype.setAboveTags=function(o,s){var i=this,u=s.settings.left[0],c=s.settings.right[0];return o.replace(new RegExp("(^|.)(["+l["common/quote"]+"])(.|$)","gm"),function(e,n,t,r,a){return n!==d&&r!==d?e:n===d&&r===d?'"'===t?n+i.getAboveTwoTags(o,a+1,s)+r:e:n===d?(t=-1<i.afterRight.indexOf(r),e=s.safeTags.getPrevTagInfo(s.context,o,a+1),t&&e&&"html"===e.group?n+(e.isClosing?c:u)+r:n+(!r||t?c:u)+r):(e=-1<i.beforeLeft.indexOf(n),t=s.safeTags.getNextTagInfo(s.context,o,a+1),e&&t&&"html"===t.group?n+(t.isClosing?c:u)+r:n+(!n||e?u:c)+r)})},U.prototype.getAboveTwoTags=function(e,n,t){var r=t.safeTags.getPrevTagInfo(t.context,e,n),a=t.safeTags.getNextTagInfo(t.context,e,n);if(r&&"html"===r.group){if(!r.isClosing)return t.settings.left[0];if(a&&a.isClosing&&r.isClosing)return t.settings.right[0]}return e[n]},U.prototype.setInner=function(e,n){for(var t=n.left[0],r=n.right[0],a=this.getMaxLevel(e,t,r,n.left.length),o=0,s="",i=0,u=e.length;i<u;i++){var c=e[i];c===t?(s+=n.left[a-1<o?a-1:o],a<++o&&(o=a)):c===r?(--o<0&&(o=0),s+=n.right[o]):('"'===c&&(o=0),s+=c)}return s},U.prototype.getMaxLevel=function(e,n,t,r){e=this.count(e);return e[n]===e[t]?r:Math.min(r,2)};var ee=new U,ne={},k=(a.forEach(function(e){ne[e]=v(l[e+"/quote"])}),{name:"common/punctuation/quote",handler:function(e,n,t){n=n[t.prefs.locale[0]];return n?ee.process({context:t,settings:n,safeTags:this.safeTags}):e},settings:ne}),E=(w.addRules([E,{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,n,t){return"ru"===t.prefs.locale[0]?e.replace(/(^|[^.])\.{3,4}(?=[^.]|$)/g,"$1…"):e.replace(/(^|[^.])\.{3}(\.?)(?=[^.]|$)/g,"$1…$2")}},k,{name:"common/punctuation/quoteLink",queue:"show-safe-tags-html",index:"+5",handler:function(e,n,t){var t=this.getSetting("common/punctuation/quote",t.prefs.locale[0]),r=s.getByUtf(t.left[0]),a=s.getByUtf(t.right[0]),o=(o=s.getByUtf(t.left[1]))?"|"+o:"",t=(t=s.getByUtf(t.right[1]))?"|"+t:"",r=new RegExp("(<[aA]\\s[^>]*?>)("+r+o+")([^]*?)("+a+t+")(</[aA]>)","g");return e.replace(r,"$2$1$3$5$4")}}]),{name:"common/space/beforeBracket",handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(["+t+".!?,;…)])\\(","gi");return e.replace(t,"$1 (")}}),k={name:"common/space/delRepeatN",index:"-1",handler:function(e,n){var n=n.maxConsecutiveLineBreaks,t=new RegExp("\n{".concat(n+1,",}"),"g"),n=$("\n",n);return e.replace(t,n)},settings:{maxConsecutiveLineBreaks:2}},q={name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}},te={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,"")}},re=new RegExp('(\\D):([^)",:.?\\s\\/\\\\])',"g"),T={name:"common/space/afterColon",handler:function(e){return e.replace(re,"$1: $2")}},A={name:"common/space/afterComma",handler:function(e,n,t){t=t.getData("quote"),t="string"==typeof t?t:t.right;return e.replace(new RegExp('(.),([^)",:.?\\s\\/\\\\'+t+"])","g"),function(e,n,t){return g(n)&&g(t)?e:n+", "+t})}},ae=new RegExp("\\?([^).…!;?\\s[\\])"+l["common/quote"]+"])","g"),B={name:"common/space/afterQuestionMark",handler:function(e){return e.replace(ae,"? $1")}},oe=new RegExp("!([^).…!;?\\s[\\])"+l["common/quote"]+"])","g"),D={name:"common/space/afterExclamationMark",handler:function(e){return e.replace(oe,"! $1")}},se=new RegExp(";([^).…!;?\\s[\\])"+l["common/quote"]+"])","g"),T=(w.addRules([T,A,B,D,{name:"common/space/afterSemicolon",handler:function(e){return e.replace(se,"; $1")}},E,{name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}},{name:"common/space/delBeforeDot",handler:function(e){return e.replace(/(^|[^!?:;,.…]) (\.|\.\.\.)(\s|$)/g,"$1$2$3")}},{name:"common/space/delBeforePercent",handler:function(e){return e.replace(/(\d)( |\u00A0)(%|‰|‱)/g,"$1$3")}},{name:"common/space/delBeforePunctuation",handler:function(e){return e.replace(/(^|[^!?:;,.…]) ([!?:;,])(?!\))/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},k,{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,"]")}},q,te]),{name:"common/symbols/arrow",handler:function(e){return x(e,[[/(^|[^-])->(?!>)/g,"$1→"],[/(^|[^<])<-(?!-)/g,"$1←"]])}}),A=(w.addRules([T,{name:"common/symbols/cf",handler:function(e){var n=new RegExp('(^|[\\s(\\[+≈±−—–\\-])(\\d+(?:[.,]\\d+)?)[   ]?(C|F)([\\W\\s.,:!?")\\]]|$)',"mg");return e.replace(n,"$1$2 °$3$4")}},{name:"common/symbols/copy",handler:function(e){return x(e,[[/\(r\)/gi,"®"],[/(copyright )?\((c|с)\)/gi,"©"],[/\(tm\)/gi,"™"]])}}]),{name:"en-US/dash/main",index:"-5",handler:function(e){var n=l["common/dash"],t="[ ".concat(" ","]"),r="[ ".concat(" ","\n]"),t=new RegExp("".concat(t,"(").concat(n,")(").concat(r,")"),"g");return e.replace(t,"".concat(" ").concat("—","$2"))}}),B=(w.addRules([A]),{name:"ru/dash/centuries",handler:function(e,n){var t=new RegExp("(X|I|V)[ | ]?"+("("+l["common/dash"]+")")+"[ | ]?(X|I|V)","g");return e.replace(t,"$1"+n.dash+"$3")},settings:{dash:"–"}}),D=(w.addRules([B,{name:"ru/dash/daysMonth",handler:function(e,n){var t=new RegExp("(^|\\s)([123]?\\d)("+l["common/dash"]+")([123]?\\d)[  ]("+l["ru/monthGenCase"]+")","g");return e.replace(t,"$1$2"+n.dash+"$4 $5")},settings:{dash:"–"}},{name:"ru/dash/de",handler:function(e){var n=new RegExp("([a-яё]+) де"+l["ru/dashAfterDe"],"g");return e.replace(n,"$1-де")},disabled:!0},{name:"ru/dash/decade",handler:function(e,n){var t=new RegExp("(^|\\s)(\\d{3}|\\d)0("+l["common/dash"]+")(\\d{3}|\\d)0(-е[  ])(?=г\\.?[  ]?г|год)","g");return e.replace(t,"$1$20"+n.dash+"$40$5")},settings:{dash:"–"}},{name:"ru/dash/directSpeech",handler:function(e){var n=l["common/dash"],t=new RegExp('(["»‘“,])[ | ]?('.concat(n,")[ | ]"),"g"),r=new RegExp("(^|".concat(d,")(").concat(n,")( | )"),"gm"),n=new RegExp("([.…?!])[  ](".concat(n,")[  ]"),"g");return e.replace(t,"$1 — ").replace(r,"$1— ").replace(n,"$1 — ")}},{name:"ru/dash/izpod",handler:function(e){var n=new RegExp(l["ru/dashBefore"]+"(И|и)з под"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2з-под")}},{name:"ru/dash/izza",handler:function(e){var n=new RegExp(l["ru/dashBefore"]+"(И|и)з за"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2з-за")}},{name:"ru/dash/ka",handler:function(e){var n=new RegExp("([a-яё]+) ка(сь)?"+l["ru/dashAfter"],"g");return e.replace(n,"$1-ка$2")}},{name:"ru/dash/koe",handler:function(e){var n=new RegExp(l["ru/dashBefore"]+"([Кк]о[ей])\\s([а-яё]{3,})"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2-$3")}},{name:"ru/dash/main",index:"-5",handler:function(e){var n=new RegExp("([  ])("+l["common/dash"]+")([  \\n])","g");return e.replace(n," —$3")}},{name:"ru/dash/month",handler:function(e,n){var t="("+l["ru/month"]+")",r="("+l["ru/monthPreCase"]+")",a=l["common/dash"],t=new RegExp(t+" ?("+a+") ?"+t,"gi"),a=new RegExp(r+" ?("+a+") ?"+r,"gi"),r="$1"+n.dash+"$3";return e.replace(t,r).replace(a,r)},settings:{dash:"–"}},{name:"ru/dash/surname",handler:function(e){var n=new RegExp("([А-ЯЁ][а-яё]+)\\s-([а-яё]{1,3})(?![^а-яё]|$)","g");return e.replace(n,"$1 —$2")}},{name:"ru/dash/taki",handler:function(e){var n=new RegExp("(верно|довольно|опять|прямо|так|вс[её]|действительно|неужели)\\s(таки)"+l["ru/dashAfter"],"g");return e.replace(n,"$1-$2")}},{name:"ru/dash/time",handler:function(e,n){var t=new RegExp(l["ru/dashBefore"]+"(\\d?\\d:[0-5]\\d)"+l["common/dash"]+"(\\d?\\d:[0-5]\\d)"+l["ru/dashAfter"],"g");return e.replace(t,"$1$2"+n.dash+"$3")},settings:{dash:"–"}},{name:"ru/dash/to",handler:function(e){var n=new RegExp("(^|[^А-ЯЁа-яё\\w])([Оо]ткуда|[Кк]уда|[Гг]де|[Кк]огда|[Зз]ачем|[Пп]очему|[Кк]ак|[Кк]ако[ейм]|[Кк]акая|[Кк]аки[емх]|[Кк]акими|[Кк]акую|[Чч]то|[Чч]его|[Чч]е[йм]|[Чч]ьим?|[Кк]то|[Кк]ого|[Кк]ому|[Кк]ем)( | -|- )(то|либо|нибудь)"+l["ru/dashAfter"],"g");return e.replace(n,function(e,n,t,r,a){r=t+r+a;return"как то"===r||"Как то"===r?e:n+t+"-"+a})}},{name:"ru/dash/kakto",handler:function(e){var n=new RegExp("(^|[^А-ЯЁа-яё\\w])([Кк]ак) то"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2-то")}},{name:"ru/dash/weekday",handler:function(e,n){var t="("+l["ru/weekday"]+")",t=new RegExp(t+" ?("+l["common/dash"]+") ?"+t,"gi");return e.replace(t,"$1"+n.dash+"$3")},settings:{dash:"–"}},{name:"ru/dash/years",handler:function(e,o){var n=new RegExp("(\\D|^)(\\d{4})[  ]?("+l["common/dash"]+")[  ]?(\\d{4})(?=[  ]?г)","g");return e.replace(n,function(e,n,t,r,a){return parseInt(t,10)<parseInt(a,10)?n+t+o.dash+a:e})},settings:{dash:"–"}}]),"(-|\\.|\\/)"),E="(-|\\/)",ie=new RegExp("(^|\\D)(\\d{4})"+D+"(\\d{2})"+D+"(\\d{2})(\\D|$)","gi"),ue=new RegExp("(^|\\D)(\\d{2})"+E+"(\\d{2})"+E+"(\\d{4})(\\D|$)","gi"),k=(w.addRules([{name:"ru/date/fromISO",handler:function(e){return e.replace(ie,"$1$6.$4.$2$7").replace(ue,"$1$4.$2.$6$7")}},{name:"ru/date/weekday",handler:function(e){var n=new RegExp("(\\d)( | )("+l["ru/monthGenCase"]+"),( | )("+l["ru/weekday"]+")","gi");return e.replace(n,function(e,n,t,r,a,o){return n+t+r.toLowerCase()+","+a+o.toLowerCase()})}}]),{name:"ru/money/currency",handler:function(e){var n="([$€¥Ұ£₤₽])",t=new RegExp("(^|[\\D]{2})"+n+" ?("+h+"([    ]\\d{3})*)([    ]?(тыс\\.|млн|млрд|трлн))?","gm"),n=new RegExp("(^|[\\D])("+h+") ?"+n,"gm");return e.replace(t,function(e,n,t,r,a,o,s,i){return n+r+(i?" "+i:"")+" "+t}).replace(n,"$1$2 $4")},disabled:!0});function ce(e,n,t,r){return"дд"===t&&"мм"===r||-1<["рф","ру","рус","орг","укр","бг","срб"].indexOf(r)?e:n+t+". "+r+"."}w.addRules([k,{name:"ru/money/ruble",handler:function(e){var n="$1 ₽",t="(\\d+)( | )?(р|руб)\\.",r=new RegExp("^"+t+"$","g"),a=new RegExp(t+"(?=[!?,:;])","g"),t=new RegExp(t+"(?=\\s+[A-ЯЁ])","g");return e.replace(r,n).replace(a,n).replace(t,n+".")},disabled:!0}]);var le={2:"²","²":"²",3:"³","³":"³","":""};w.addRules([{name:"ru/nbsp/abbr",handler:function(e){var n=new RegExp("(^|\\s|".concat(d,")([а-яё]{1,3})\\. ?([а-яё]{1,3})\\."),"g");return e.replace(n,ce).replace(n,ce)}},{name:"ru/nbsp/addr",handler:function(e){return e.replace(/(\s|^)(дом|д\.|кв\.|под\.|п-д) *(\d+)/gi,"$1$2 $3").replace(/(\s|^)(мкр-н|мк-н|мкр\.|мкрн)\s/gi,"$1$2 ").replace(/(\s|^)(эт\.) *(-?\d+)/gi,"$1$2 $3").replace(/(\s|^)(\d+) +этаж([^а-яё]|$)/gi,"$1$2 этаж$3").replace(/(\s|^)литер\s([А-Я]|$)/gi,"$1литер $2").replace(/(\s|^)(обл|кр|ст|пос|с|д|ул|пер|пр|пр-т|просп|пл|бул|б-р|наб|ш|туп|оф|комн?|уч|вл|влад|стр|кор)\. *([а-яёa-z\d]+)/gi,"$1$2. $3").replace(/(\D[ \u00A0]|^)г\. ?([А-ЯЁ])/gm,"$1г. $2")}},{name:"ru/nbsp/afterNumberSign",handler:function(e){return e.replace(/№[ \u00A0\u2009]?(\d|п\/п)/g,"№ $1")}},{name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var n="(ли|ль|же|ж|бы|б)",t=new RegExp("([А-ЯЁа-яё]) "+n+'(?=[,;:?!"‘“»])',"g"),n=new RegExp("([А-ЯЁа-яё])[  ]"+n+"[  ]","g");return e.replace(t,"$1 $2").replace(n,"$1 $2 ")}},{name:"ru/nbsp/centuries",handler:function(e){var n=l["common/dash"],t="(^|\\s)([VIX]+)",r='(?=[,;:?!"‘“»]|$)',a=new RegExp(t+"[  ]?в\\.?"+r,"gm"),t=new RegExp(t+"("+n+")([VIX]+)[  ]?в\\.?([  ]?в\\.?)?"+r,"gm");return e.replace(a,"$1$2 в.").replace(t,"$1$2$3$4 вв.")}},{name:"ru/nbsp/dayMonth",handler:function(e){var n=new RegExp("(\\d{1,2}) ("+l["ru/shortMonth"]+")","gi");return e.replace(n,"$1 $2")}},{name:"ru/nbsp/initials",handler:function(e){var n=new RegExp("(^|[(   "+l["ru/quote"].left+d+'"])([А-ЯЁ])\\.[   ]?([А-ЯЁ])\\.[   ]?([А-ЯЁ][а-яё]+)',"gm");return e.replace(n,"$1$2. $3. $4")}},{name:"ru/nbsp/m",index:"+5",handler:function(e){var n=new RegExp("(^|[\\s,.\\(])(\\d+)[  ]?(мм?|см|км|дм|гм|mm?|km|cm|dm)([23²³])?([\\s\\).!?,;]|$)","gm");return e.replace(n,function(e,n,t,r,a,o){return n+t+" "+r+le[a||""]+(" "===o?" ":o)})}},{name:"ru/nbsp/mln",handler:function(e){return e.replace(/(\d) ?(тыс|млн|млрд|трлн)(\.|\s|$)/gi,"$1 $2$3")}},{name:"ru/nbsp/ooo",handler:function(e){return e.replace(/(^|[^a-яёA-ЯЁ])(ООО|ОАО|ЗАО|НИИ|ПБОЮЛ) /g,"$1$2 ")}},{name:"ru/nbsp/page",handler:function(e){var n=new RegExp("(^|[)\\s])(стр|гл|рис|илл?|ст|п|c)\\. *(\\d+)([\\s.,?!;:]|$)","gim");return e.replace(n,"$1$2. $3$4")}},{name:"ru/nbsp/ps",handler:function(e){var n=new RegExp("(^|\\s|".concat(d,")[pз]\\.[  ]?([pз]\\.[  ]?)?[sы]\\.:? "),"gim");return e.replace(n,function(e,n,t){return n+(t?"P. P. S. ":"P. S. ")})}},{name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(руб|коп)\.)/g,"$1 ")}},{name:"ru/nbsp/see",handler:function(e){var n=new RegExp("(^|\\s|".concat(d,"|\\()(см|им)\\.[  ]?([а-яё0-9a-z]+)([\\s.,?!]|$)"),"gi");return e.replace(n,function(e,n,t,r,a){return(" "===n?" ":n)+t+". "+r+a})}},{name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?г([ ,;.\n]|$)/g,"$1$2 г$3")}},{name:"ru/nbsp/years",index:"+5",handler:function(e){var n=new RegExp("(^|\\D)(\\d{4})("+l["common/dash"]+')(\\d{4})[  ]?г\\.?([  ]?г\\.)?(?=[,;:?!"‘“»\\s]|$)',"gm");return e.replace(n,"$1$2$3$4 гг.")}}]);function L(e,n){n=new RegExp('<span class="('+n.join("|")+')">([^]*?)</span>',"g");return e.replace(n,"$2")}function N(e,n){return e.replace(/<title>[^]*?<\/title>/i,function(e){return L(e,n)})}w.addRules([{name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%‰°×x])/gim,"$1$2,$3")}},{name:"ru/number/ordinals",handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(\\d[%‰]?)-(ый|ой|ая|ое|ые|ым|ом|ых|ого|ому|ыми)(?!["+t+"])","g");return e.replace(t,function(e,n,t){return n+"-"+{"ой":"й","ый":"й","ая":"я","ое":"е","ые":"е","ым":"м","ом":"м","ых":"х","ого":"го","ому":"му","ыми":"ми"}[t]})}}]);var pe=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],q="ru/optalign/bracket",te={name:q,queue:"start",handler:function(e){return L(e,pe)},htmlAttrs:!1},T={name:q,queue:"end",handler:function(e){return N(e,pe)},htmlAttrs:!1},me=["typograf-oa-comma","typograf-oa-comma-sp"],A="ru/optalign/comma",B={name:A,queue:"start",handler:function(e){return L(e,me)},htmlAttrs:!1},D={name:A,queue:"end",handler:function(e){return N(e,me)},htmlAttrs:!1},he=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],E="ru/optalign/quote",k={name:E,queue:"start",handler:function(e){return L(e,he)},htmlAttrs:!1},ge={name:E,queue:"end",handler:function(e){return N(e,he)},htmlAttrs:!1},M=(w.addRules([{name:q,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},{name:A,handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(["+t+"\\d́]+), ","gi");return e.replace(t,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1},{name:E,handler:function(e){var n=this.getSetting("common/punctuation/quote","ru"),n="(["+n.left[0]+(n.left[1]||"")+"])",t=new RegExp("(^|\n\n|)("+n+")","g"),n=new RegExp("([^\n])([  \n])("+n+")","gi");return e.replace(t,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(n,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1}]),w.addInnerRules([te,T,B,D,k,ge]),[]);function de(e){var n,t,r=e[0],a="";if(e.length<8)return fe(e);if(10<e.length)if("+"===r){if("7"!==e[1])return e;n=!0,e=e.substr(2)}else"8"===r&&(t=!0,e=e.substr(1));for(var o=8;2<=o;o--){var s=+e.substr(0,o);if(-1<M.indexOf(s)){a=e.substr(0,o),e=e.substr(o);break}}return a||(a=e.substr(0,5),e=e.substr(5)),(n?"+7 ":"")+(t?"8 ":"")+(e=>{var n=+e,t=e.length,r=[e],a=!1;if(3<t)switch(t){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 a=900<n&&n<=999||495==n||499==n||800==n;return t=r.join("-"),a?t:"("+t+")"})(a)+" "+fe(e)}function fe(e){var n="";return e.length%2&&(n=e[0],n+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),n+e.split(/(?=(?:\d\d)+$)/).join("-")}function be(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,800,"901-934","936-939","950-953",958,"960-969","977-989","991-997",999].forEach(function(e){if("string"==typeof e)for(var n=e.split("-"),t=+n[0];t<=+n[1];t++)M.push(t);else M.push(e)});w.addRules([{name:"ru/other/accent",handler:function(e){return e.replace(/([а-яё])([АЕЁИОУЫЭЮЯ])([^А-ЯЁ\w]|$)/g,function(e,n,t,r){return n+t.toLowerCase()+"́"+r})},disabled:!0},{name:"ru/other/phone-number",live:!1,handler:function(e){var n=new RegExp("(^|,| |)(\\+7[\\d\\(\\)  -]{10,18})(?=,|;||$)","gm");return e.replace(n,function(e,n,t){t=be(t);return 12===t.length?n+de(t):e}).replace(/(^|[^а-яё])([☎☏✆📠📞📱]|т\.|тел\.|ф\.|моб\.|факс|сотовый|мобильный|телефон)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi,function(e,n,t,r,a){a=be(a);return 5<=a.length?n+t+r+de(a):e})}}]);var q={name:"ru/punctuation/ano",handler:function(e){var n=new RegExp("([^«„[(!?,:;\\-‒–—\\s])(\\s+)(а|но)(?= | |\\n)","g");return e.replace(n,"$1,$2$3")}},$e=(w.addRules([q,{name:"ru/punctuation/exclamation",handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")},live:!1},{name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var n=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(n,"$1?!$2")}},{name:"ru/punctuation/hellipQuestion",handler:function(e){return e.replace(/(^|[^.])(\.\.\.|…),/g,"$1…").replace(/(!|\?)(\.\.\.|…)(?=[^.]|$)/g,"$1..")}}]),w.addRules([{name:"ru/space/afterHellip",handler:function(e){return e.replace(/([а-яё])(\.\.\.|…)([А-ЯЁ])/g,"$1$2 $3").replace(/([?!]\.\.)([а-яёa-z])/gi,"$1 $2")}},{name:"ru/space/year",handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(^| | )(\\d{3,4})(год([ауе]|ом)?)([^"+t+"]|$)","g");return e.replace(t,"$1$2 $3$5")}}]),w.addRules([{name:"ru/symbols/NN",handler:function(e){return e.replace(/№№/g,"№")}}]),{A:"А",a:"а",B:"В",E:"Е",e:"е",K:"К",M:"М",H:"Н",O:"О",o:"о",P:"Р",p:"р",C:"С",c:"с",T:"Т",y:"у",X:"Х",x:"х"}),ye=Object.keys($e).join("");w.addRules([{name:"ru/typo/switchingKeyboardLayout",handler:function(e){var n=new RegExp("(["+ye+"]{1,3})(?=[А-ЯЁа-яё]+?)","g");return e.replace(n,function(e,n){for(var t="",r=0;r<n.length;r++)t+=$e[n[r]];return t})}}]);return w.titles={"common/html/e-mail":{"en-US":"Placement of links for e-mail",ru:"Расстановка ссылок для эл. почты"},"common/html/escape":{"en-US":"Escaping HTML",ru:"Экранирование HTML"},"common/html/nbr":{"en-US":"Replacement line break on <br/>",ru:"Замена перевода строки на <br/>"},"common/html/p":{"en-US":"Placement of paragraph",ru:"Расстановка абзацев"},"common/html/processingAttrs":{"en-US":"Processing HTML attributes",ru:"Типографирование HTML-атрибутов"},"common/html/quot":{common:'&⁠quot; → "'},"common/html/stripTags":{"en-US":"Removing HTML-tags",ru:"Удаление HTML-тегов"},"common/html/url":{"en-US":"Placement of links",ru:"Расстановка ссылок"},"common/nbsp/afterNumber":{"en-US":"Non-breaking space between number and word",ru:"Нераз. пробел между числом и словом"},"common/nbsp/afterParagraphMark":{"en-US":"Non-breaking space after ¶",ru:"Нераз. пробел после ¶"},"common/nbsp/afterSectionMark":{"en-US":"Non-breaking space after §",ru:"Нераз. узкий пробел после §"},"common/nbsp/afterShortWord":{"en-US":"Non-breaking space after short word",ru:"Нераз. пробел после короткого слова"},"common/nbsp/beforeShortLastNumber":{"en-US":"Non-breaking space before number (maximum 2 digits) at end of sentence",ru:"Нераз. пробел перед числом (не более 2 цифр) в конце предложения"},"common/nbsp/beforeShortLastWord":{"en-US":"Non-breaking space before last short word in sentence",ru:"Нераз. пробел перед последним коротким словом в предложении"},"common/nbsp/dpi":{"en-US":"Non-breaking space before lpi and dpi",ru:"Нераз. пробел перед lpi и dpi"},"common/nbsp/nowrap":{"en-US":"Replace non-breaking space to normal space in tags nowrap and nobr",ru:"Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr"},"common/nbsp/replaceNbsp":{"en-US":"Replacing non-breaking space on normal before text correction",ru:"Замена неразрывного пробела на обычный перед типографированием"},"common/number/digitGrouping":{"en-US":"Divide into groups numbers with many digits",ru:"Разбивать длинные числа по разрядам"},"common/number/fraction":{common:"1/2 → ½, 1/4 → ¼, 3/4 → ¾"},"common/number/mathSigns":{common:"!= → ≠, <= → ≤, >= → ≥, ~= → ≅, +- → ±"},"common/number/times":{common:"x → × (10 x 5 → 10×5)"},"common/other/delBOM":{"en-US":"Delete character BOM (Byte Order Mark)",ru:"Удаление символа BOM (Byte Order Mark)"},"common/other/repeatWord":{"en-US":"Removing repeat words",ru:"Удаление повтора слова"},"common/punctuation/apostrophe":{"en-US":"Placement of correct apostrophe",ru:"Расстановка правильного апострофа"},"common/punctuation/delDoublePunctuation":{"en-US":"Removing double punctuation",ru:"Удаление двойной пунктуации"},"common/punctuation/hellip":{"en-US":"Replacement of three points by ellipsis",ru:"Замена трёх точек на многоточие"},"common/punctuation/quote":{"en-US":"Placement of quotation marks in texts",ru:"Расстановка кавычек правильного вида"},"common/punctuation/quoteLink":{"en-US":"Removal quotes outside a link",ru:"Вынос кавычек за пределы ссылки"},"common/space/afterColon":{"en-US":"space after colon",ru:"Пробел после двоеточия"},"common/space/afterComma":{"en-US":"space after comma",ru:"Пробел после запятой"},"common/space/afterExclamationMark":{"en-US":"space after exclamation mark",ru:"Пробел после знака восклицания"},"common/space/afterQuestionMark":{"en-US":"space after question mark",ru:"Пробел после знака вопроса"},"common/space/afterSemicolon":{"en-US":"space after semicolon",ru:"Пробел после точки с запятой"},"common/space/beforeBracket":{"en-US":"Space before opening bracket",ru:"Пробел перед открывающей скобкой"},"common/space/bracket":{"en-US":"Remove extra spaces after opening and before closing bracket",ru:"Удаление лишних пробелов после открывающей и перед закрывающей скобкой"},"common/space/delBeforeDot":{"en-US":"Remove space before dot",ru:"Удаление пробела перед точкой"},"common/space/delBeforePercent":{"en-US":"Remove space before %, ‰ and ‱",ru:"Удаление пробела перед %, ‰ и ‱"},"common/space/delBeforePunctuation":{"en-US":"Remove spaces before punctuation",ru:"Удаление пробелов перед знаками пунктуации"},"common/space/delBetweenExclamationMarks":{"en-US":"Remove spaces before exclamation marks",ru:"Удаление пробелов между знаками восклицания"},"common/space/delLeadingBlanks":{"en-US":"Remove spaces at start of line",ru:"Удаление пробелов в начале строки"},"common/space/delRepeatN":{"en-US":"Remove duplicate line breaks",ru:"Удаление повторяющихся переносов строки"},"common/space/delRepeatSpace":{"en-US":"Removing duplicate spaces between characters",ru:"Удаление повторяющихся пробелов между символами"},"common/space/delTrailingBlanks":{"en-US":"Remove spaces at end of line",ru:"Удаление пробелов в конце строки"},"common/space/insertFinalNewline":{"en-US":"Insert final newline",ru:"Вставить в конце текста перевод строки"},"common/space/replaceTab":{"en-US":"Replacement of tab to 4 spaces",ru:"Замена таба на 4 пробела"},"common/space/squareBracket":{"en-US":"Remove extra spaces after opening and before closing square bracket",ru:"Удаление лишних пробелов после открывающей и перед закрывающей квадратной скобкой"},"common/space/trimLeft":{"en-US":"Remove spaces and line breaks in beginning of text",ru:"Удаление пробелов и переносов строк в начале текста"},"common/space/trimRight":{"en-US":"Remove spaces and line breaks at end of text",ru:"Удаление пробелов и переносов строк в конце текста"},"common/symbols/arrow":{common:"-> → →, <- → ←"},"common/symbols/cf":{"en-US":"Adding ° to C and F",ru:"Добавление ° к C и F"},"common/symbols/copy":{common:"(c) → ©, (tm) → ™, (r) → ®"},"en-US/dash/main":{"en-US":"Replace hyphens surrounded by spaces with an em-dash",ru:"Замена дефиса на длинное тире"},"ru/dash/centuries":{"en-US":"Hyphen to dash in centuries",ru:"Замена дефиса на тире в веках"},"ru/dash/daysMonth":{"en-US":"Dash between days of one month",ru:"Тире между днями одного месяца"},"ru/dash/de":{"en-US":"Hyphen before “де”",ru:"Дефис перед «де»"},"ru/dash/decade":{"en-US":"Dash in decade",ru:"Тире в десятилетиях, 80—90-е гг."},"ru/dash/directSpeech":{"en-US":"Dash in direct speech",ru:"Тире в прямой речи"},"ru/dash/izpod":{"en-US":"Hyphen between “из-под”",ru:"Дефис между «из-под»"},"ru/dash/izza":{"en-US":"Hyphen between “из-за”",ru:"Дефис между «из-за»"},"ru/dash/ka":{"en-US":"Hyphen before “ка” and “кась”",ru:"Дефис перед «ка» и «кась»"},"ru/dash/kakto":{"en-US":"Hyphen for “как то”",ru:"Дефис для «как то»"},"ru/dash/koe":{"en-US":"Hyphen after “кое” and “кой”",ru:"Дефис после «кое» и «кой»"},"ru/dash/main":{"en-US":"Replacement hyphen with dash",ru:"Замена дефиса на тире"},"ru/dash/month":{"en-US":"Dash between months",ru:"Тире между месяцами"},"ru/dash/surname":{"en-US":"Acronyms with a dash",ru:"Сокращения с помощью тире"},"ru/dash/taki":{"en-US":"Hyphen between “верно-таки” and etc.",ru:"Дефис между «верно-таки» и т. д."},"ru/dash/time":{"en-US":"Dash in time intervals",ru:"Тире в интервалах времени"},"ru/dash/to":{"en-US":"Hyphen before “то”, “либо”, “нибудь”",ru:"Дефис перед «то», «либо», «нибудь»"},"ru/dash/weekday":{"en-US":"Dash between the days of the week",ru:"Тире между днями недели"},"ru/dash/years":{"en-US":"Hyphen to dash in years",ru:"Замена дефиса на тире в годах"},"ru/date/fromISO":{"en-US":"Converting dates YYYY-MM-DD type DD.MM.YYYY",ru:"Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY"},"ru/date/weekday":{common:"2 Мая, Понедельник → 2 мая, понедельник"},"ru/money/currency":{"en-US":"Currency symbol ($, €, ¥, Ұ, £ and ₤) after the number, $100 → 100 $",ru:"Символ валюты ($, €, ¥, Ұ, £ и ₤) после числа, $100 → 100 $"},"ru/money/ruble":{common:"1 руб. → 1 ₽"},"ru/nbsp/abbr":{"en-US":"Non-breaking space in abbreviations, e.g. “т. д.”",ru:"Нераз. пробел в сокращениях, например, в «т. д.»"},"ru/nbsp/addr":{"en-US":"Placement of non-breaking space after “г.”, “обл.”, “ул.”, “пр.”, “кв.” et al.",ru:"Расстановка нераз. пробела после «г.», «обл.», «ул.», «пр.», «кв.» и др."},"ru/nbsp/afterNumberSign":{"en-US":"Non-breaking thin space after №",ru:"Нераз. узкий пробел после №"},"ru/nbsp/beforeParticle":{"en-US":"Non-breaking space before “ли”, “ль”, “же”, “бы”, “б”",ru:"Нераз. пробел перед «ли», «ль», «же», «бы», «б»"},"ru/nbsp/centuries":{"en-US":"Remove spaces and extra points in “вв.”",ru:"Удаление пробелов и лишних точек в «вв.»"},"ru/nbsp/dayMonth":{"en-US":"Non-breaking space between number and month",ru:"Нераз. пробел между числом и месяцем"},"ru/nbsp/initials":{"en-US":"Binding of initials to the name",ru:"Привязка инициалов к фамилии"},"ru/nbsp/m":{"en-US":"m2 → м², m3 → м³ and non-breaking space",ru:"м2 → м², м3 → м³ и нераз. пробел"},"ru/nbsp/mln":{"en-US":"Non-breaking space between number and “тыс.”, “млн”, “млрд” and “трлн”",ru:"Неразр. пробел между числом и «тыс.», «млн», «млрд» и «трлн»"},"ru/nbsp/ooo":{"en-US":"Non-breaking space after “OOO, ОАО, ЗАО, НИИ, ПБОЮЛ”",ru:"Нераз. пробел после OOO, ОАО, ЗАО, НИИ и ПБОЮЛ"},"ru/nbsp/page":{"en-US":"Non-breaking space after “стр.”, “гл.”, “рис.”, “илл.”",ru:"Нераз. пробел после «стр.», «гл.», «рис.», «илл.»"},"ru/nbsp/ps":{"en-US":"Non-breaking space in P. S. and P. P. S.",ru:"Нераз. пробел в P. S. и P. P. S."},"ru/nbsp/rubleKopek":{"en-US":"Not once. space before the “rub” and “cop.”",ru:"Нераз. пробел перед «руб.» и «коп.»"},"ru/nbsp/see":{"en-US":"Non-breaking space after abbreviation «см.» and «им.»",ru:"Нераз. пробел после сокращений «см.» и «им.»"},"ru/nbsp/year":{"en-US":"Non-breaking space before XXXX г. (2012 г.)",ru:"Нераз. пробел после XXXX г. (2012 г.)"},"ru/nbsp/years":{"en-US":"г.г. → гг. and non-breaking space",ru:"г.г. → гг. и нераз. пробел"},"ru/number/comma":{"en-US":"Commas in numbers",ru:"Замена точки на запятую в числах"},"ru/number/ordinals":{common:"N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)"},"ru/optalign/bracket":{"en-US":"for opening bracket",ru:"для открывающей скобки"},"ru/optalign/comma":{"en-US":"for comma",ru:"для запятой"},"ru/optalign/quote":{"en-US":"for opening quotation marks",ru:"для открывающей кавычки"},"ru/other/accent":{"en-US":"Replacement capital letters to lowercase with addition of accent",ru:"Замена заглавной буквы на строчную с добавлением ударения"},"ru/other/phone-number":{"en-US":"Formatting phone numbers",ru:"Форматирование телефонных номеров"},"ru/punctuation/ano":{"en-US":"Placement of commas before “а” and “но”",ru:"Расстановка запятых перед «а» и «но»"},"ru/punctuation/exclamation":{common:"!! → !"},"ru/punctuation/exclamationQuestion":{common:"!? → ?!"},"ru/punctuation/hellipQuestion":{common:"«?…» → «?..», «!…» → «!..», «…,» → «…»"},"ru/space/afterHellip":{"en-US":"Space after “...”, “!..” and “?..”",ru:"Пробел после «...», «!..» и «?..»"},"ru/space/year":{"en-US":"Space between number and word “год”",ru:"Пробел между числом и словом «год»"},"ru/symbols/NN":{common:"№№ → №"},"ru/typo/switchingKeyboardLayout":{"en-US":"Replacement of Latin letters in Russian. Typos occur when you switch keyboard layouts",ru:"Замена латинских букв на русские. Опечатки, возникающие при переключении клавиатурной раскладки"}},w.groups=[{name:"punctuation",title:{"en-US":"Punctuation",ru:"Пунктуация"}},{name:"optalign",title:{"en-US":"Hanging punctuation",ru:"Висячая пунктуация"}},{name:"dash",title:{"en-US":"Dash and hyphen",ru:"Тире и дефис"}},{name:"nbsp",title:{"en-US":"Non-breaking space",ru:"Неразрывный пробел"}},{name:"space",title:{"en-US":"Space and line ending",ru:"Пробел и окончание строки"}},{name:"html",title:{"en-US":"HTML",ru:"HTML"}},{name:"date",title:{"en-US":"Date",ru:"Дата"}},{name:"money",title:{"en-US":"Money",ru:"Деньги"}},{name:"number",title:{"en-US":"Numbers and mathematical expressions",ru:"Числа и математические выражения"}},{name:"symbols",title:{"en-US":"Symbols and signs",ru:"Символы и знаки"}},{name:"typo",title:{"en-US":"Typos",ru:"Опечатки"}},{name:"other",title:{"en-US":"Other",ru:"Прочее"}}],w});
2
+ ((e,n)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).Typograf=n()})(this,function(){var r=function(){return(r=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e}).apply(this,arguments)};function t(e,n,t){if(t||2===arguments.length)for(var r,a=0,o=n.length;a<o;a++)!r&&a in n||((r=r||Array.prototype.slice.call(n,0,a))[a]=n[a]);return e.concat(r||Array.prototype.slice.call(n))}var P=[["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]],e=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]];function n(){var n=this;this.entities=this.prepareEntities(t(t([],P,!0),e,!0)),this.entitiesByName={},this.entitiesByNameEntity={},this.entitiesByDigitEntity={},this.entitiesByJsEntity={},this.entitiesByUtf={},this.entities.forEach(function(e){n.entitiesByName[e.name]=e,n.entitiesByNameEntity[e.type.name]=e,n.entitiesByDigitEntity[e.type.digit]=e,n.entitiesByJsEntity[e.type.js]=e,n.entitiesByUtf[e.utf]=e}),this.invisibleEntities=this.prepareEntities(e)}n.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})),-1!==e.text.search(/\\u[\da-f]/i)&&(e.text=e.text.replace(/\\u[\da-f]{4};/gi,function(e){var n=t.entitiesByJsEntity[e.toLowerCase()];return n?n.utf:e}))},n.prototype.decHexToUtf=function(e){return e.replace(/&#(\d{1,6});/gi,function(e,n){return String.fromCharCode(parseInt(n,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,n){return String.fromCharCode(parseInt(n,16))})},n.prototype.restore=function(e){var n,t=e.prefs.htmlEntity,r=t.type;"default"!==r&&(n=this.entities,(t.onlyInvisible||t.list)&&(n=[],t.onlyInvisible&&(n=n.concat(this.invisibleEntities)),t.list)&&(n=n.concat(this.prepareListParam(t.list))),e.text=this.restoreEntitiesByIndex(e.text,r,n))},n.prototype.getByUtf=function(e,n){switch(n){case"digit":return this.entitiesByDigitEntity[e];case"name":return this.entitiesByNameEntity[e];case"js":return this.entitiesByJsEntity[e]}return e},n.prototype.prepareEntities=function(e){var r=[];return e.forEach(function(e){var n=e[0],e=e[1],t=String.fromCharCode(e);r.push({name:n,utf:t,reUtf:new RegExp(t,"g"),type:{name:"&"+n+";",digit:"&#"+e+";",js:"\\u"+("0000"+e.toString(16)).slice(-4)}})}),r},n.prototype.prepareListParam=function(e){var n=this,t=[];return e.forEach(function(e){e=n.entitiesByName[e];e&&t.push(e)}),t},n.prototype.restoreEntitiesByIndex=function(n,t,e){return e.forEach(function(e){n=n.replace(e.reUtf,e.type[t])}),n};var s=new n,a=[];function o(e){e=(e||"").split("/")[0];e&&"common"!==e&&!i(e)&&(a.push(e),a.sort())}function i(e){return"common"===e||-1!==a.indexOf(e)}function u(e,n){e=e||n;return e?Array.isArray(e)?e:[e]:[]}function c(e){if(!e.length)throw Error('Not defined the property "locale".');e.forEach(function(e){if(!i(e))throw Error('"'.concat(e,'" is not supported locale.'))})}var l={};function z(e){return l[e]}function p(n){Object.keys(n).forEach(function(e){o(e),l[e]=n[e]})}var I=["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"],m=new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),h="\\d+([.,]\\d+)?",C=/\d/;function g(e){return-1<e.search(C)}var d="",f="",O=(b.prototype.add=function(e){this.tags.own.push(this.prepareRegExp(e))},b.prototype.show=function(n,t){for(var e=new RegExp("tf\\d+","g"),r=new RegExp("tf\\d"),a=function(e){return n.safeTags.hidden[t][e]||e},o=0,s=this.tags[t].length;o<s&&(n.text=n.text.replace(e,a),-1!==n.text.search(r));o++);},b.prototype.hide=function(n,e){var t=this,r=(n.safeTags.hidden[e]={},this.pasteLabel.bind(this,n,e));this.tags[e].forEach(function(e){n.text=n.text.replace(t.prepareRegExp(e),r)})},b.prototype.hideHTMLTags=function(e){var n;e.isHTML&&(n=this.pasteLabel.bind(this,e,"html"),e.text=e.text.replace(/<\/?[a-z][^]*?>/gi,n).replace(/&lt;\/?[a-z][^]*?&gt;/gi,n).replace(/&[gl]t;/gi,n))},b.prototype.getPrevLabel=function(e,n){for(var t=n-1;0<=t;t--)if(e[t]===d)return e.slice(t,n+1);return""},b.prototype.getNextLabel=function(e,n){for(var t=n+1;t<e.length;t++)if(e[t]===d)return e.slice(n,t+1);return""},b.prototype.getTagByLabel=function(t,r){var a=null;return this.groups.some(function(e){var n=t.safeTags.hidden[e][r];return a=void 0!==n?{group:e,value:n}:a}),a},b.prototype.getTagInfo=function(e){if(!e)return null;var n={group:e.group};switch(e.group){case"html":n.name=e.value.split(/[<\s>]/)[1],n.isInline=-1<I.indexOf(n.name),n.isClosing=-1<e.value.search(/^<\//);break;case"url":n.isInline=!0;break;case"own":n.isInline=!1}return n},b.prototype.pasteLabel=function(e,n,t){var e=e.safeTags,r="tf"+e.counter+d;return e.hidden[n][r]=t,e.counter++,r},b.prototype.prepareRegExp=function(e){var n,t;return e instanceof RegExp?e:(n=e[0],t=e[2],new RegExp(n+(void 0===t?"[^]*?":t)+e[1],"gi"))},b.prototype.getPrevTagInfo=function(e,n,t){n=this.getPrevLabel(n,t-1);if(n){t=this.getTagByLabel(e,n);if(t)return this.getTagInfo(t)}return null},b.prototype.getNextTagInfo=function(e,n,t){n=this.getNextLabel(n,t+1);if(n){t=this.getTagByLabel(e,n);if(t)return this.getTagInfo(t)}return null},b);function b(){this.groups=["own","html","url"],this.hidden={},this.counter=0;var n=[["\x3c!--","--\x3e"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach(function(e){n.push(["<".concat(e,"(\\s[^>]*?)?>"),"</".concat(e,">")])}),this.tags={own:[],html:n.map(this.prepareRegExp),url:[m]}}function $(e,n){for(var t="";1==(1&n)&&(t+=e),0!=(n>>>=1);)e+=e;return t}function y(e){return e.replace(/\u00A0/g," ")}function x(e,n){for(var t=0;t<n.length;t++)e=e.replace(n[t][0],n[t][1]);return e}function H(e){return-1!==e.search(/(<\/?[a-z]|<!|&[lg]t;)/i)}function v(e){return"object"==typeof e?JSON.parse(JSON.stringify(e)):e}var j={symbols:110,number:150,space:210,dash:310,punctuation:410,nbsp:510,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},Q=0,F="default",Y=[],W=[];function R(){var e=t([],Y,!0);return e.sort(function(e,n){return e.index>n.index?1:-1}),e}function X(){return t([],W,!0)}function G(e){var n=e.name.split("/"),t=n[0];return{name:e.name,shortName:n[2],handler:e.handler,queue:e.queue||F,enabled:!0!==e.disabled,locale:t,group:n[1],index:"number"==typeof(t=e).index?t.index:(n=t.name.split("/")[1],void 0===(n=j[n])&&(n=Q),"string"==typeof t.index?n+parseInt(t.index,10):n),settings:e.settings,live:e.live,htmlAttrs:e.htmlAttrs}}function J(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 K(e){return e||"LF"}S.addRule=function(e){o((e=G(e=e)).locale),Y.push(e)},S.addRules=function(e){var n=this;e.forEach(function(e){n.addRule(e)})},S.addInnerRule=function(e){W.push(G(e))},S.addInnerRules=function(e){var n=this;e.forEach(function(e){n.addInnerRule(e)})},S.getRule=function(n){var t=null;return R().some(function(e){return e.name===n&&(t=e,!0)}),t},S.getRules=R,S.getInnerRules=X,S.getLocales=function(){return a},S.addLocale=function(e){o(e)},S.hasLocale=i,S.setData=function(e){p(e)},S.getData=function(e){return l[e]},S.prototype.execute=function(e,n){var t;return(e=""+e)?(t=this.prefs,n=n,t=r({},t),n&&("locale"in n&&(t.locale=u(n.locale)),"htmlEntity"in n&&(t.htmlEntity=J(n.htmlEntity)),"lineEnding"in n&&(t.lineEnding=K(n.lineEnding)),"processingSeparateParts"in n&&(t.processingSeparateParts=n.processingSeparateParts),"ruleFilter"in n)&&(t.ruleFilter=n.ruleFilter),c((n=t).locale),t=this.prepareContext(e,n),this.process(t)):""},S.prototype.getSetting=function(e,n){return this.settings[e]&&this.settings[e][n]},S.prototype.setSetting=function(e,n,t){this.settings[e]=this.settings[e]||{},this.settings[e][n]=t},S.prototype.isEnabledRule=function(e){return!1!==this.enabledRules[e]},S.prototype.isDisabledRule=function(e){return!this.enabledRules[e]},S.prototype.enableRule=function(e){return this.enable(e,!0)},S.prototype.disableRule=function(e){return this.enable(e,!1)},S.prototype.addSafeTag=function(e,n,t){e=e instanceof RegExp?e:[e,n,t];this.safeTags.add(e)},S.prototype.prepareContext=function(e,t){return{text:e,isHTML:H(e),prefs:t,getData:function(n){return"char"===n?t.locale.map(function(e){return l[e+"/"+n]}).join(""):z(t.locale[0]+"/"+n)},safeTags:this.safeTags}},S.prototype.splitBySeparateParts=function(a){var o,e,s;return a.isHTML&&!1!==a.prefs.processingSeparateParts?(o=[],e=new RegExp("<("+this.separatePartsTags.join("|")+")(\\s[^>]*?)?>[^]*?</\\1>","gi"),s=0,a.text.replace(e,function(e,n,t,r){return s!==r&&o.push((s?f:"")+a.text.slice(s,r)+f),o.push(e),s=r+e.length,e}),o.push(s?f+a.text.slice(s,a.text.length):a.text),o):[a.text]},S.prototype.process=function(n){var e,t=this,r=(n.text=n.text.replace(/\r\n?/g,"\n"),this.executeRules(n,"start"),this.safeTags.hide(n,"own"),this.executeRules(n,"hide-safe-tags-own"),this.safeTags.hide(n,"html"),this.executeRules(n,"hide-safe-tags-html"),n.isHTML),a=new RegExp(f,"g");return n.text=this.splitBySeparateParts(n).map(function(e){return n.text=e,n.isHTML=H(e),t.safeTags.hideHTMLTags(n),t.safeTags.hide(n,"url"),t.executeRules(n,"hide-safe-tags-url"),t.executeRules(n,"hide-safe-tags"),s.toUtf(n),n.prefs.live&&(n.text=y(n.text)),t.executeRules(n,"utf"),t.executeRules(n),s.restore(n),t.executeRules(n,"html-entities"),t.safeTags.show(n,"url"),t.executeRules(n,"show-safe-tags-url"),n.text.replace(a,"")}).join(""),n.isHTML=r,this.safeTags.show(n,"html"),this.executeRules(n,"show-safe-tags-html"),this.safeTags.show(n,"own"),this.executeRules(n,"show-safe-tags-own"),this.executeRules(n,"end"),r=n.text,"CRLF"===(e=n.prefs.lineEnding)?r.replace(/\n/g,"\r\n"):"CR"===e?r.replace(/\n/g,"\r"):r},S.prototype.executeRules=function(n,e){var t=this,r=this.rulesByQueues[e=void 0===e?F:e],e=this.innerRulesByQueues[e];e&&e.forEach(function(e){t.ruleIterator(n,e)}),r&&r.forEach(function(e){t.ruleIterator(n,e)})},S.prototype.ruleIterator=function(e,n){!0===e.prefs.live&&!1===n.live||!1===e.prefs.live&&!0===n.live||"common"!==n.locale&&n.locale!==e.prefs.locale[0]||!this.isEnabledRule(n.name)||e.prefs.ruleFilter&&!e.prefs.ruleFilter(n)||(this.onBeforeRule&&this.onBeforeRule(n.name,e),e.text=n.handler.call(this,e.text,this.settings[n.name],e),this.onAfterRule&&this.onAfterRule(n.name,e))},S.prototype.prepareRuleSettings=function(e){this.settings[e.name]=v(e.settings),this.enabledRules[e.name]=e.enabled},S.prototype.enable=function(e,n){var t=this;Array.isArray(e)?e.forEach(function(e){t.enableByMask(e,n)}):this.enableByMask(e,n)},S.prototype.enableByMask=function(e,n){var t,r=this;e&&(-1!==e.search(/\*/)?(t=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this.rules.forEach(function(e){e=e.name;t.test(e)&&(r.enabledRules[e]=n)})):this.enabledRules[e]=n)},S.groups=[],S.titles={},S.version="7.6.0";var w=S;function S(e){var n=this;this.rules=[],this.innerRules=[],this.rulesByQueues={},this.innerRulesByQueues={},this.separatePartsTags=["title","p","h[1-6]","select","legend"],this.prefs={locale:u((e=e).locale),lineEnding:K(e.lineEnding),live:Boolean(e.live),ruleFilter:e.ruleFilter,enableRule:e.enableRule,disableRule:e.disableRule,processingSeparateParts:e.processingSeparateParts,htmlEntity:J(e.htmlEntity)},c(this.prefs.locale),this.safeTags=new O,this.settings={},this.enabledRules={},this.innerRulesByQueues={},this.innerRules=X(),this.innerRules.forEach(function(e){n.innerRulesByQueues[e.queue]=n.innerRulesByQueues[e.queue]||[],n.innerRulesByQueues[e.queue].push(e)}),this.rulesByQueues={},this.rules=R(),this.rules.forEach(function(e){n.prepareRuleSettings(e),n.rulesByQueues[e.queue]=n.rulesByQueues[e.queue]||[],n.rulesByQueues[e.queue].push(e)}),this.prefs.disableRule&&this.disableRule(this.prefs.disableRule),this.prefs.enableRule&&this.enableRule(this.prefs.enableRule)}[{"common/char":"a-z","common/dash":"--?|‒|–|—","common/quote":'«‹»›„“‟”"'},{"be/char":"абвгдежзйклмнопрстуфхцчшыьэюяёіўґ","be/quote":{left:"«“",right:"»”"}},{"bg/char":"абвгдежзийклмнопрстуфхцчшщъьюя","bg/quote":{left:"„’",right:"“’"}},{"ca/char":"abcdefghijlmnopqrstuvxyzàçèéíïòóúü","ca/quote":{left:"«“",right:"»”"}},{"cs/char":"a-záéíóúýčďěňřšťůž","cs/quote":{left:"„‚",right:"“‘"}},{"da/char":"a-zåæø","da/quote":{left:"»›",right:"«‹"}},{"de/char":"a-zßäöü","de/quote":{left:"„‚",right:"“‘"}},{"el/char":"ΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϲάέήίόύώ","el/quote":{left:"«“",right:"»”"}},{"en-GB/char":"a-z","en-GB/quote":{left:"‘“",right:"’”"},"en-GB/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"},{"en-US/char":"a-z","en-US/quote":{left:"“‘",right:"”’"},"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ĉĝĥĵŝŭ","eo/quote":{left:"“‘",right:"”’"}},{"es/char":"a-záéíñóúü","es/quote":{left:"«“",right:"»”"}},{"et/char":"abdefghijklmnoprstuvzäõöüšž","et/quote":{left:"„«",right:"“»"}},{"fi/char":"abcdefghijklmnopqrstuvyöäå","fi/quote":{left:"”’",right:"”’"}},{"fr/char":"a-zàâçèéêëîïôûüœæ","fr/quote":{left:"«‹",right:"»›",spacing:!0}},{"ga/char":"abcdefghilmnoprstuvwxyzáéíóú","ga/quote":{left:"“‘",right:"”’"}},{"hu/char":"a-záäéíóöúüőű","hu/quote":{left:"„»",right:"”«"}},{"it/char":"a-zàéèìòù","it/quote":{left:"«“",right:"»”"},"it/shortWord":"a|da|di|in|la|il|lo|e|o|se|su|che|come|ma|è|ho|ha|sa"},{"lv/char":"abcdefghijklmnopqrstuvxzæœ","lv/quote":{left:"«„",right:"»“"}},{"nl/char":"a-zäçèéêëîïñöûü","nl/quote":{left:"‘“",right:"’”"}},{"no/char":"a-zåæèéêòóôø","no/quote":{left:"«’",right:"»’"}},{"pl/char":"abcdefghijklmnoprstuvwxyzóąćęłńśźż","pl/quote":{left:"„«",right:"”»"}},{"ro/char":"abcdefghijklmnoprstuvxzîășț","ro/quote":{left:"„«",right:"”»"}},{"ru/char":"а-яё","ru/dashBefore":"(^| |\\n)","ru/dashAfter":"(?=[  ,.?:!]|$)","ru/dashAfterDe":"(?=[,.?:!]|[  ][^А-ЯЁ]|$)","ru/l":"а-яёa-z","ru/L":"А-ЯЁA-Z","ru/month":"январь|февраль|март|апрель|май|июнь|июль|август|сентябрь|октябрь|ноябрь|декабрь","ru/monthGenCase":"января|февраля|марта|апреля|мая|июня|июля|августа|сентября|октября|ноября|декабря","ru/monthPreCase":"январе|феврале|марте|апреле|мае|июне|июле|августе|сентябре|октябре|ноябре|декабре","ru/quote":{left:"«„‚",right:"»“‘",removeDuplicateQuotes:!0},"ru/shortMonth":"янв|фев|мар|апр|ма[ейя]|июн|июл|авг|сен|окт|ноя|дек","ru/shortWord":"а|без|в|во|если|да|до|для|за|и|или|из|к|ко|как|ли|на|но|не|ни|о|об|обо|от|по|про|при|под|с|со|то|у","ru/weekday":"понедельник|вторник|среда|четверг|пятница|суббота|воскресенье"},{"sk/char":"abcdefghijklmnoprstuvwxyzáäéíóôúýčďľňŕšťž","sk/quote":{left:"„‚",right:"“‘"}},{"sl/char":"a-zčšž","sl/quote":{left:"„‚",right:"“‘"}},{"sr/char":"abcdefghijklmnoprstuvzćčđšž","sr/quote":{left:"„’",right:"”’"}},{"sv/char":"a-zäåéö","sv/quote":{left:"”’",right:"”’"}},{"tr/char":"abcdefghijklmnoprstuvyzâçîöûüğış","tr/quote":{left:"“‘",right:"”’"}},{"uk/char":"абвгдежзийклмнопрстуфхцчшщьюяєіїґ","uk/quote":{left:"«„",right:"»“"}}].forEach(p);var V={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},E={name:"common/html/escape",index:"+100",queue:"end",handler:function(e){return e.replace(/[&<>"'/]/g,function(e){return V[e]})},disabled:!0},Z=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]"),E=(w.addRules([{name:"common/html/e-mail",queue:"end",handler:function(e,n,t){return t.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},E,{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},{name:"common/html/p",index:"+5",queue:"end",handler:function(e){e=e.split("\n\n");return e.forEach(function(e,n,t){!e.trim()||Z.test(e)||(t[n]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1"))}),e.join("\n\n")},disabled:!0,htmlAttrs:!1},{name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(e,n,t){var s=this,r=new RegExp("(^|\\s)("+n.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),i=v(t.prefs);return i.ruleFilter=function(e){return!1!==e.htmlAttrs},e.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g,function(e,n,t){return n+t.replace(r,function(e,n,t,r){var a=r[0],o=r[r.length-1],r=r.slice(1,-1);return n+t+"="+a+s.execute(r,i)+o})})},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1},{name:"common/html/quot",queue:"hide-safe-tags",handler:function(e){return e.replace(/&quot;/g,'"')}},{name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0},{name:"common/html/url",queue:"end",handler:function(e,n,t){return t.isHTML?e:e.replace(m,function(e,n,t){t=t.replace(/([^/]+\/?)(\?|#)$/,"$1").replace(/^([^/]+)\/$/,"$1"),"http"===n?t=t.replace(/^([^/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===n&&(t=t.replace(/^([^/]+)(:443)([^\d]|\/|$)/,"$1$3"));var r=t,t=n+"://"+t,a='<a href="'+t+'">';return"http"===n||"https"===n?(r=r.replace(/^www\./,""),a+("http"===n?r:n+"://"+r)+"</a>"):a+t+"</a>"})},disabled:!0,htmlAttrs:!1}]),{name:"common/nbsp/afterNumber",handler:function(e,n,t){t=t.getData("char");return e.replace(new RegExp("(^|\\s)(\\d{1,5}) (["+t+"]+)","gi"),"$1$2 $3")},disabled:!0});function _(e,n,t,r){return n+t.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+r}w.addRules([E,{name:"common/nbsp/afterParagraphMark",handler:function(e){return e.replace(/¶ ?(?=\d)/g,"¶ ")}},{name:"common/nbsp/afterSectionMark",handler:function(e,n,t){t=t.prefs.locale[0];return e.replace(/§[ \u00A0\u2009]?(?=\d|I|V|X)/g,"ru"===t?"§ ":"§ ")}},{name:"common/nbsp/afterShortWord",handler:function(e,n,t){var n=n.lengthShortWord,r=l["common/quote"],t=t.getData("char"),r=new RegExp("(^|["+("  ("+r)+"])(["+t+"]{1,"+n+"}) ","gim");return e.replace(r,"$1$2 ").replace(r,"$1$2 ")},settings:{lengthShortWord:2}},{name:"common/nbsp/afterShortWordByList",handler:function(e,n,t){var r=l["common/quote"],t=t.getData("shortWord"),r=new RegExp("(^|["+("  ("+r)+"])("+t+") ","gim");return e.replace(r,"$1$2 ").replace(r,"$1$2 ")}},{name:"common/nbsp/beforeShortLastNumber",handler:function(e,n,t){var r=t.getData("quote"),t=t.getData("char"),a=t.toUpperCase(),t=new RegExp("(["+t+a+"]) (?=\\d{1,"+n.lengthLastNumber+"}[-+−%'\""+r.right+")]?([.!?…]( ["+a+"]|$)|$))","gm");return e.replace(t,"$1 ")},live:!1,settings:{lengthLastNumber:2}},{name:"common/nbsp/beforeShortLastWord",handler:function(e,n,t){var t=t.getData("char"),r=t.toUpperCase(),t=new RegExp("(["+t+"\\d]) (["+t+r+"]{1,"+n.lengthLastWord+"}[.!?…])( ["+r+"]|$)","g");return e.replace(t,"$1 $2$3")},settings:{lengthLastWord:3}},{name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1 $2")}},{name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,_).replace(/(<nobr>)(.*?)(<\/nobr>)/g,_)}},{name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:y,disabled:!0}]);E={name:"common/number/digitGrouping",index:"310",disabled:!0,handler:function(e,a){return e.replace(new RegExp("(^ ?|\\D |".concat(d,")(\\d{1,3}([    ]\\d{3})+)(?! ?[\\d-])"),"gm"),function(e,n,t){return n+t.replace(/\s/g,a.space)}).replace(/(\d{5,}([.,]\d+)?)/g,function(e,n){var t=n.match(/[.,]/),n=t?n.split(t):[n],r=n[0],n=n[1],r=r.replace(/(\d)(?=(\d{3})+([^\d]|$))/g,"$1"+a.space);return t?r+t+n:r})},settings:{space:" "}},w.addRules([E,{name:"common/number/fraction",handler:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1½$2").replace(/(^|\D)1\/4(\D|$)/g,"$1¼$2").replace(/(^|\D)3\/4(\D|$)/g,"$1¾$2")}},{name:"common/number/mathSigns",handler:function(e){return x(e,[[/!=/g,"≠"],[/<=/g,"≤"],[/(^|[^=])>=/g,"$1≥"],[/<=>/g,"⇔"],[/<</g,"≪"],[/>>/g,"≫"],[/~=/g,"≅"],[/(^|[^+])\+-/g,"$1±"]])}},{name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[xх][ \u00A0]?(\d)/g,"$1×$2")}}]),w.addRules([{name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}},{name:"common/other/repeatWord",handler:function(e,n,t){var r=l["common/quote"],t=t.getData("char"),r="[;:,.?!  \n"+r+"]",t=new RegExp("("+r+"|^)(["+t+"]{"+n.min+",})[  ]\\2("+r+"|$)","gi");return e.replace(t,"$1$2$3")},settings:{min:2},disabled:!0}]),E={name:"common/punctuation/apostrophe",handler:function(e,n,t){t="(["+t.getData("char")+"])",t=new RegExp(t+"'"+t,"gi");return e.replace(t,"$1’$2")}};function U(){this.bufferQuotes={left:"",right:""},this.beforeLeft=" \n\t [(",this.afterRight=" \n\t !?.:;#*,…)\\]"}U.prototype.process=function(e){var n,t,r=e.context.text;return this.count(r).total&&(n=e.settings,(t=e.settings.left[0]===e.settings.right[0])&&(e.settings=v(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&&(r=this.removeSpacing(r,e.settings)),r=this.set(r,e),e.settings.spacing&&(r=this.setSpacing(r,e.settings)),e.settings.removeDuplicateQuotes&&(r=this.removeDuplicates(r,e.settings)),t)&&(r=this.returnOriginalQuotes(r,n,e.settings),e.settings=n),r},U.prototype.returnOriginalQuotes=function(e,n,t){for(var r={},a=0;a<t.left.length;a++)r[t.left[a]]=n.left[a],r[t.right[a]]=n.right[a];return e.replace(new RegExp("["+t.left+t.right+"]","g"),function(e){return r[e]})},U.prototype.count=function(e){var n={total:0};return e.replace(new RegExp("["+l["common/quote"]+"]","g"),function(e){return n[e]||(n[e]=0),n[e]++,n.total++,e}),n},U.prototype.removeDuplicates=function(e,n){var t=n.left[0],r=n.left[1]||t,n=n.right[0];return t!==r?e:e.replace(new RegExp(t+t,"g"),t).replace(new RegExp(n+n,"g"),n)},U.prototype.removeSpacing=function(e,n){for(var t=0,r=n.left.length;t<r;t++){var a=n.left[t],o=n.right[t];e=e.replace(new RegExp(a+"([   ])","g"),a).replace(new RegExp("([   ])"+o,"g"),o)}return e},U.prototype.setSpacing=function(e,n){for(var t=0,r=n.left.length;t<r;t++){var a=n.left[t],o=n.right[t];e=e.replace(new RegExp(a+"([^ ])","g"),a+" $1").replace(new RegExp("([^ ])"+o,"g"),"$1 "+o)}return e},U.prototype.set=function(e,n){var t=l["common/quote"],r=n.settings.left[0],a=n.settings.left[1]||r,o=n.settings.right[0],s=new RegExp("(^|["+this.beforeLeft+"])(["+t+"]+)(?=[^\\s"+d+"])","gim"),t=new RegExp("([^\\s])(["+t+"]+)(?=["+this.afterRight+"]|$)","gim");return e=e.replace(s,function(e,n,t){return n+$(r,t.length)}).replace(t,function(e,n,t){return n+$(o,t.length)}),e=this.setAboveTags(e,n),e=r!==a?this.setInner(e,n.settings):e},U.prototype.setAboveTags=function(o,s){var i=this,u=s.settings.left[0],c=s.settings.right[0];return o.replace(new RegExp("(^|.)(["+l["common/quote"]+"])(.|$)","gm"),function(e,n,t,r,a){return n!==d&&r!==d?e:n===d&&r===d?'"'===t?n+i.getAboveTwoTags(o,a+1,s)+r:e:n===d?(t=-1<i.afterRight.indexOf(r),e=s.safeTags.getPrevTagInfo(s.context,o,a+1),t&&e&&"html"===e.group?n+(e.isClosing?c:u)+r:n+(!r||t?c:u)+r):(e=-1<i.beforeLeft.indexOf(n),t=s.safeTags.getNextTagInfo(s.context,o,a+1),e&&t&&"html"===t.group?n+(t.isClosing?c:u)+r:n+(!n||e?u:c)+r)})},U.prototype.getAboveTwoTags=function(e,n,t){var r=t.safeTags.getPrevTagInfo(t.context,e,n),a=t.safeTags.getNextTagInfo(t.context,e,n);if(r&&"html"===r.group){if(!r.isClosing)return t.settings.left[0];if(a&&a.isClosing&&r.isClosing)return t.settings.right[0]}return e[n]},U.prototype.setInner=function(e,n){for(var t=n.left[0],r=n.right[0],a=this.getMaxLevel(e,t,r,n.left.length),o=0,s="",i=0,u=e.length;i<u;i++){var c=e[i];c===t?(s+=n.left[a-1<o?a-1:o],a<++o&&(o=a)):c===r?(--o<0&&(o=0),s+=n.right[o]):('"'===c&&(o=0),s+=c)}return s},U.prototype.getMaxLevel=function(e,n,t,r){e=this.count(e);return e[n]===e[t]?r:Math.min(r,2)};var ee=new U,ne={},k=(a.forEach(function(e){ne[e]=v(l[e+"/quote"])}),{name:"common/punctuation/quote",handler:function(e,n,t){n=n[t.prefs.locale[0]];return n?ee.process({context:t,settings:n,safeTags:this.safeTags}):e},settings:ne}),E=(w.addRules([E,{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,n,t){return"ru"===t.prefs.locale[0]?e.replace(/(^|[^.])\.{3,4}(?=[^.]|$)/g,"$1…"):e.replace(/(^|[^.])\.{3}(\.?)(?=[^.]|$)/g,"$1…$2")}},k,{name:"common/punctuation/quoteLink",queue:"show-safe-tags-html",index:"+5",handler:function(e,n,t){var t=this.getSetting("common/punctuation/quote",t.prefs.locale[0]),r=s.getByUtf(t.left[0]),a=s.getByUtf(t.right[0]),o=(o=s.getByUtf(t.left[1]))?"|"+o:"",t=(t=s.getByUtf(t.right[1]))?"|"+t:"",r=new RegExp("(<[aA]\\s[^>]*?>)("+r+o+")([^]*?)("+a+t+")(</[aA]>)","g");return e.replace(r,"$2$1$3$5$4")}}]),{name:"common/space/beforeBracket",handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(["+t+".!?,;…)])\\(","gi");return e.replace(t,"$1 (")}}),k={name:"common/space/delRepeatN",index:"-1",handler:function(e,n){var n=n.maxConsecutiveLineBreaks,t=new RegExp("\n{".concat(n+1,",}"),"g"),n=$("\n",n);return e.replace(t,n)},settings:{maxConsecutiveLineBreaks:2}},q={name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}},te={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,"")}},re=new RegExp('(\\D):([^)",:.?\\s\\/\\\\])',"g"),B={name:"common/space/afterColon",handler:function(e){return e.replace(re,"$1: $2")}},T={name:"common/space/afterComma",handler:function(e,n,t){t=t.getData("quote"),t="string"==typeof t?t:t.right;return e.replace(new RegExp('(.),([^)",:.?\\s\\/\\\\'+t+"])","g"),function(e,n,t){return g(n)&&g(t)?e:n+", "+t})}},ae=new RegExp("\\?([^).…!;?\\s[\\])"+l["common/quote"]+"])","g"),A={name:"common/space/afterQuestionMark",handler:function(e){return e.replace(ae,"? $1")}},oe=new RegExp("!([^).…!;?\\s[\\])"+l["common/quote"]+"])","g"),L={name:"common/space/afterExclamationMark",handler:function(e){return e.replace(oe,"! $1")}},se=new RegExp(";([^).…!;?\\s[\\])"+l["common/quote"]+"])","g"),B=(w.addRules([B,T,A,L,{name:"common/space/afterSemicolon",handler:function(e){return e.replace(se,"; $1")}},E,{name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}},{name:"common/space/delBeforeDot",handler:function(e){return e.replace(/(^|[^!?:;,.…]) (\.|\.\.\.)(\s|$)/g,"$1$2$3")}},{name:"common/space/delBeforePercent",handler:function(e){return e.replace(/(\d)( |\u00A0)(%|‰|‱)/g,"$1$3")}},{name:"common/space/delBeforePunctuation",handler:function(e){return e.replace(/(^|[^!?:;,.…]) ([!?:;,])(?!\))/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},k,{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,"]")}},q,te]),{name:"common/symbols/arrow",handler:function(e){return x(e,[[/(^|[^-])->(?!>)/g,"$1→"],[/(^|[^<])<-(?!-)/g,"$1←"]])}}),T=(w.addRules([B,{name:"common/symbols/cf",handler:function(e){var n=new RegExp('(^|[\\s(\\[+≈±−—–\\-])(\\d+(?:[.,]\\d+)?)[   ]?(C|F)([\\W\\s.,:!?")\\]]|$)',"mg");return e.replace(n,"$1$2 °$3$4")}},{name:"common/symbols/copy",handler:function(e){return x(e,[[/\(r\)/gi,"®"],[/(copyright )?\((c|с)\)/gi,"©"],[/\(tm\)/gi,"™"]])}}]),{name:"en-US/dash/main",index:"-5",handler:function(e){var n=l["common/dash"],t="[ ".concat(" ","]"),r="[ ".concat(" ","\n]"),t=new RegExp("".concat(t,"(").concat(n,")(").concat(r,")"),"g");return e.replace(t,"".concat(" ").concat("—","$2"))}}),A=(w.addRules([T]),{name:"ru/dash/centuries",handler:function(e,n){var t=new RegExp("(X|I|V)[ | ]?"+("("+l["common/dash"]+")")+"[ | ]?(X|I|V)","g");return e.replace(t,"$1"+n.dash+"$3")},settings:{dash:"–"}}),L=(w.addRules([A,{name:"ru/dash/daysMonth",handler:function(e,n){var t=new RegExp("(^|\\s)([123]?\\d)("+l["common/dash"]+")([123]?\\d)[  ]("+l["ru/monthGenCase"]+")","g");return e.replace(t,"$1$2"+n.dash+"$4 $5")},settings:{dash:"–"}},{name:"ru/dash/de",handler:function(e){var n=new RegExp("([a-яё]+) де"+l["ru/dashAfterDe"],"g");return e.replace(n,"$1-де")},disabled:!0},{name:"ru/dash/decade",handler:function(e,n){var t=new RegExp("(^|\\s)(\\d{3}|\\d)0("+l["common/dash"]+")(\\d{3}|\\d)0(-е[  ])(?=г\\.?[  ]?г|год)","g");return e.replace(t,"$1$20"+n.dash+"$40$5")},settings:{dash:"–"}},{name:"ru/dash/directSpeech",handler:function(e){var n=l["common/dash"],t=new RegExp('(["»‘“,])[ | ]?('.concat(n,")[ | ]"),"g"),r=new RegExp("(^|".concat(d,")(").concat(n,")( | )"),"gm"),n=new RegExp("([.…?!])[  ](".concat(n,")[  ]"),"g");return e.replace(t,"$1 — ").replace(r,"$1— ").replace(n,"$1 — ")}},{name:"ru/dash/izpod",handler:function(e){var n=new RegExp(l["ru/dashBefore"]+"(И|и)з под"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2з-под")}},{name:"ru/dash/izza",handler:function(e){var n=new RegExp(l["ru/dashBefore"]+"(И|и)з за"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2з-за")}},{name:"ru/dash/ka",handler:function(e){var n=new RegExp("([a-яё]+) ка(сь)?"+l["ru/dashAfter"],"g");return e.replace(n,"$1-ка$2")}},{name:"ru/dash/koe",handler:function(e){var n=new RegExp(l["ru/dashBefore"]+"([Кк]о[ей])\\s([а-яё]{3,})"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2-$3")}},{name:"ru/dash/main",index:"-5",handler:function(e){var n=new RegExp("([  ])("+l["common/dash"]+")([  \\n])","g");return e.replace(n," —$3")}},{name:"ru/dash/month",handler:function(e,n){var t="("+l["ru/month"]+")",r="("+l["ru/monthPreCase"]+")",a=l["common/dash"],t=new RegExp(t+" ?("+a+") ?"+t,"gi"),a=new RegExp(r+" ?("+a+") ?"+r,"gi"),r="$1"+n.dash+"$3";return e.replace(t,r).replace(a,r)},settings:{dash:"–"}},{name:"ru/dash/surname",handler:function(e){var n=new RegExp("([А-ЯЁ][а-яё]+)\\s-([а-яё]{1,3})(?![^а-яё]|$)","g");return e.replace(n,"$1 —$2")}},{name:"ru/dash/taki",handler:function(e){var n=new RegExp("(верно|довольно|опять|прямо|так|вс[её]|действительно|неужели)\\s(таки)"+l["ru/dashAfter"],"g");return e.replace(n,"$1-$2")}},{name:"ru/dash/time",handler:function(e,n){var t=new RegExp(l["ru/dashBefore"]+"(\\d?\\d:[0-5]\\d)"+l["common/dash"]+"(\\d?\\d:[0-5]\\d)"+l["ru/dashAfter"],"g");return e.replace(t,"$1$2"+n.dash+"$3")},settings:{dash:"–"}},{name:"ru/dash/to",handler:function(e){var n=new RegExp("(^|[^А-ЯЁа-яё\\w])([Оо]ткуда|[Кк]уда|[Гг]де|[Кк]огда|[Зз]ачем|[Пп]очему|[Кк]ак|[Кк]ако[ейм]|[Кк]акая|[Кк]аки[емх]|[Кк]акими|[Кк]акую|[Чч]то|[Чч]его|[Чч]е[йм]|[Чч]ьим?|[Кк]то|[Кк]ого|[Кк]ому|[Кк]ем)( | -|- )(то|либо|нибудь)"+l["ru/dashAfter"],"g");return e.replace(n,function(e,n,t,r,a){r=t+r+a;return"как то"===r||"Как то"===r?e:n+t+"-"+a})}},{name:"ru/dash/kakto",handler:function(e){var n=new RegExp("(^|[^А-ЯЁа-яё\\w])([Кк]ак) то"+l["ru/dashAfter"],"g");return e.replace(n,"$1$2-то")}},{name:"ru/dash/weekday",handler:function(e,n){var t="("+l["ru/weekday"]+")",t=new RegExp(t+" ?("+l["common/dash"]+") ?"+t,"gi");return e.replace(t,"$1"+n.dash+"$3")},settings:{dash:"–"}},{name:"ru/dash/years",handler:function(e,o){var n=new RegExp("(\\D|^)(\\d{4})[  ]?("+l["common/dash"]+")[  ]?(\\d{4})(?=[  ]?г)","g");return e.replace(n,function(e,n,t,r,a){return parseInt(t,10)<parseInt(a,10)?n+t+o.dash+a:e})},settings:{dash:"–"}}]),"(-|\\.|\\/)"),E="(-|\\/)",ie=new RegExp("(^|\\D)(\\d{4})"+L+"(\\d{2})"+L+"(\\d{2})(\\D|$)","gi"),ue=new RegExp("(^|\\D)(\\d{2})"+E+"(\\d{2})"+E+"(\\d{4})(\\D|$)","gi"),k=(w.addRules([{name:"ru/date/fromISO",handler:function(e){return e.replace(ie,"$1$6.$4.$2$7").replace(ue,"$1$4.$2.$6$7")}},{name:"ru/date/weekday",handler:function(e){var n=new RegExp("(\\d)( | )("+l["ru/monthGenCase"]+"),( | )("+l["ru/weekday"]+")","gi");return e.replace(n,function(e,n,t,r,a,o){return n+t+r.toLowerCase()+","+a+o.toLowerCase()})}}]),{name:"ru/money/currency",handler:function(e){var n="([$€¥Ұ£₤₽])",t=new RegExp("(^|[\\D]{2})"+n+" ?("+h+"([    ]\\d{3})*)([    ]?(тыс\\.|млн|млрд|трлн))?","gm"),n=new RegExp("(^|[\\D])("+h+") ?"+n,"gm");return e.replace(t,function(e,n,t,r,a,o,s,i){return n+r+(i?" "+i:"")+" "+t}).replace(n,"$1$2 $4")},disabled:!0});function ce(e,n,t,r){return"дд"===t&&"мм"===r||-1<["рф","ру","рус","орг","укр","бг","срб"].indexOf(r)?e:n+t+". "+r+"."}w.addRules([k,{name:"ru/money/ruble",handler:function(e){var n="$1 ₽",t="(\\d+)( | )?(р|руб)\\.",r=new RegExp("^"+t+"$","g"),a=new RegExp(t+"(?=[!?,:;])","g"),t=new RegExp(t+"(?=\\s+[A-ЯЁ])","g");return e.replace(r,n).replace(a,n).replace(t,n+".")},disabled:!0}]);var le={2:"²","²":"²",3:"³","³":"³","":""};w.addRules([{name:"ru/nbsp/abbr",handler:function(e){var n=new RegExp("(^|\\s|".concat(d,")([а-яё]{1,3})\\. ?([а-яё]{1,3})\\."),"g");return e.replace(n,ce).replace(n,ce)}},{name:"ru/nbsp/addr",handler:function(e){return e.replace(/(\s|^)(дом|д\.|кв\.|под\.|п-д) *(\d+)/gi,"$1$2 $3").replace(/(\s|^)(мкр-н|мк-н|мкр\.|мкрн)\s/gi,"$1$2 ").replace(/(\s|^)(эт\.) *(-?\d+)/gi,"$1$2 $3").replace(/(\s|^)(\d+) +этаж([^а-яё]|$)/gi,"$1$2 этаж$3").replace(/(\s|^)литер\s([А-Я]|$)/gi,"$1литер $2").replace(/(\s|^)(обл|кр|ст|пос|с|д|ул|пер|пр|пр-т|просп|пл|бул|б-р|наб|ш|туп|оф|комн?|уч|вл|влад|стр|кор)\. *([а-яёa-z\d]+)/gi,"$1$2. $3").replace(/(\D[ \u00A0]|^)г\. ?([А-ЯЁ])/gm,"$1г. $2")}},{name:"ru/nbsp/afterNumberSign",handler:function(e){return e.replace(/№[ \u00A0\u2009]?(\d|п\/п)/g,"№ $1")}},{name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var n="(ли|ль|же|ж|бы|б)",t=new RegExp("([А-ЯЁа-яё]) "+n+'(?=[,;:?!"‘“»])',"g"),n=new RegExp("([А-ЯЁа-яё])[  ]"+n+"[  ]","g");return e.replace(t,"$1 $2").replace(n,"$1 $2 ")}},{name:"ru/nbsp/centuries",handler:function(e){var n=l["common/dash"],t="(^|\\s)([VIX]+)",r='(?=[,;:?!"‘“»]|$)',a=new RegExp(t+"[  ]?в\\.?"+r,"gm"),t=new RegExp(t+"("+n+")([VIX]+)[  ]?в\\.?([  ]?в\\.?)?"+r,"gm");return e.replace(a,"$1$2 в.").replace(t,"$1$2$3$4 вв.")}},{name:"ru/nbsp/dayMonth",handler:function(e){var n=new RegExp("(\\d{1,2}) ("+l["ru/shortMonth"]+")","gi");return e.replace(n,"$1 $2")}},{name:"ru/nbsp/initials",handler:function(e){var n=new RegExp("(^|[(   "+l["ru/quote"].left+d+'"])([А-ЯЁ])\\.[   ]?([А-ЯЁ])\\.[   ]?([А-ЯЁ][а-яё]+)',"gm");return e.replace(n,"$1$2. $3. $4")}},{name:"ru/nbsp/m",index:"+5",handler:function(e){var n=new RegExp("(^|[\\s,.\\(])(\\d+)[  ]?(мм?|см|км|дм|гм|mm?|km|cm|dm)([23²³])?([\\s\\).!?,;]|$)","gm");return e.replace(n,function(e,n,t,r,a,o){return n+t+" "+r+le[a||""]+(" "===o?" ":o)})}},{name:"ru/nbsp/mln",handler:function(e){return e.replace(/(\d) ?(тыс|млн|млрд|трлн)(\.|\s|$)/gi,"$1 $2$3")}},{name:"ru/nbsp/ooo",handler:function(e){return e.replace(/(^|[^a-яёA-ЯЁ])(ООО|ОАО|ЗАО|НИИ|ПБОЮЛ) /g,"$1$2 ")}},{name:"ru/nbsp/page",handler:function(e){var n=new RegExp("(^|[)\\s])(стр|гл|рис|илл?|ст|п|c)\\. *(\\d+)([\\s.,?!;:]|$)","gim");return e.replace(n,"$1$2. $3$4")}},{name:"ru/nbsp/ps",handler:function(e){var n=new RegExp("(^|\\s|".concat(d,")[pз]\\.[  ]?([pз]\\.[  ]?)?[sы]\\.:? "),"gim");return e.replace(n,function(e,n,t){return n+(t?"P. P. S. ":"P. S. ")})}},{name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(руб|коп)\.)/g,"$1 ")}},{name:"ru/nbsp/see",handler:function(e){var n=new RegExp("(^|\\s|".concat(d,"|\\()(см|им)\\.[  ]?([а-яё0-9a-z]+)([\\s.,?!]|$)"),"gi");return e.replace(n,function(e,n,t,r,a){return(" "===n?" ":n)+t+". "+r+a})}},{name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?г([ ,;.\n]|$)/g,"$1$2 г$3")}},{name:"ru/nbsp/years",index:"+5",handler:function(e){var n=new RegExp("(^|\\D)(\\d{4})("+l["common/dash"]+')(\\d{4})[  ]?г\\.?([  ]?г\\.)?(?=[,;:?!"‘“»\\s]|$)',"gm");return e.replace(n,"$1$2$3$4 гг.")}}]);function D(e,n){n=new RegExp('<span class="('+n.join("|")+')">([^]*?)</span>',"g");return e.replace(n,"$2")}function N(e,n){return e.replace(/<title>[^]*?<\/title>/i,function(e){return D(e,n)})}w.addRules([{name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%‰°×x])/gim,"$1$2,$3")}},{name:"ru/number/ordinals",handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(\\d[%‰]?)-(ый|ой|ая|ое|ые|ым|ом|ых|ого|ому|ыми)(?!["+t+"])","g");return e.replace(t,function(e,n,t){return n+"-"+{"ой":"й","ый":"й","ая":"я","ое":"е","ые":"е","ым":"м","ом":"м","ых":"х","ого":"го","ому":"му","ыми":"ми"}[t]})}}]);var pe=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],q="ru/optalign/bracket",te={name:q,queue:"start",handler:function(e){return D(e,pe)},htmlAttrs:!1},B={name:q,queue:"end",handler:function(e){return N(e,pe)},htmlAttrs:!1},me=["typograf-oa-comma","typograf-oa-comma-sp"],T="ru/optalign/comma",A={name:T,queue:"start",handler:function(e){return D(e,me)},htmlAttrs:!1},L={name:T,queue:"end",handler:function(e){return N(e,me)},htmlAttrs:!1},he=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],E="ru/optalign/quote",k={name:E,queue:"start",handler:function(e){return D(e,he)},htmlAttrs:!1},ge={name:E,queue:"end",handler:function(e){return N(e,he)},htmlAttrs:!1},M=(w.addRules([{name:q,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},{name:T,handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(["+t+"\\d́]+), ","gi");return e.replace(t,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1},{name:E,handler:function(e){var n=this.getSetting("common/punctuation/quote","ru"),n="(["+n.left[0]+(n.left[1]||"")+"])",t=new RegExp("(^|\n\n|)("+n+")","g"),n=new RegExp("([^\n])([  \n])("+n+")","gi");return e.replace(t,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(n,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1}]),w.addInnerRules([te,B,A,L,k,ge]),[]);function de(e){var n,t,r=e[0],a="";if(e.length<8)return fe(e);if(10<e.length)if("+"===r){if("7"!==e[1])return e;n=!0,e=e.substr(2)}else"8"===r&&(t=!0,e=e.substr(1));for(var o=8;2<=o;o--){var s=+e.substr(0,o);if(-1<M.indexOf(s)){a=e.substr(0,o),e=e.substr(o);break}}return a||(a=e.substr(0,5),e=e.substr(5)),(n?"+7 ":"")+(t?"8 ":"")+(e=>{var n=+e,t=e.length,r=[e],a=!1;if(3<t)switch(t){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 a=900<n&&n<=999||495==n||499==n||800==n;return t=r.join("-"),a?t:"("+t+")"})(a)+" "+fe(e)}function fe(e){var n="";return e.length%2&&(n=e[0],n+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),n+e.split(/(?=(?:\d\d)+$)/).join("-")}function be(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,800,"901-934","936-939","950-953",958,"960-969","977-989","991-997",999].forEach(function(e){if("string"==typeof e)for(var n=e.split("-"),t=+n[0];t<=+n[1];t++)M.push(t);else M.push(e)});w.addRules([{name:"ru/other/accent",handler:function(e){return e.replace(/([а-яё])([АЕЁИОУЫЭЮЯ])([^А-ЯЁ\w]|$)/g,function(e,n,t,r){return n+t.toLowerCase()+"́"+r})},disabled:!0},{name:"ru/other/phone-number",live:!1,handler:function(e){var n=new RegExp("(^|,| |)(\\+7[\\d\\(\\)  -]{10,18})(?=,|;||$)","gm");return e.replace(n,function(e,n,t){t=be(t);return 12===t.length?n+de(t):e}).replace(/(^|[^а-яё])([☎☏✆📠📞📱]|т\.|тел\.|ф\.|моб\.|факс|сотовый|мобильный|телефон)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi,function(e,n,t,r,a){a=be(a);return 5<=a.length?n+t+r+de(a):e})}}]);var q={name:"ru/punctuation/ano",handler:function(e){var n=new RegExp("([^«„[(!?,:;\\-‒–—\\s])(\\s+)(а|но)(?= | |\\n)","g");return e.replace(n,"$1,$2$3")}},$e=(w.addRules([q,{name:"ru/punctuation/exclamation",handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")},live:!1},{name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var n=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(n,"$1?!$2")}},{name:"ru/punctuation/hellipQuestion",handler:function(e){return e.replace(/(^|[^.])(\.\.\.|…),/g,"$1…").replace(/(!|\?)(\.\.\.|…)(?=[^.]|$)/g,"$1..")}}]),w.addRules([{name:"ru/space/afterHellip",handler:function(e){return e.replace(/([а-яё])(\.\.\.|…)([А-ЯЁ])/g,"$1$2 $3").replace(/([?!]\.\.)([а-яёa-z])/gi,"$1 $2")}},{name:"ru/space/year",handler:function(e,n,t){t=t.getData("char"),t=new RegExp("(^| | )(\\d{3,4})(год([ауе]|ом)?)([^"+t+"]|$)","g");return e.replace(t,"$1$2 $3$5")}}]),w.addRules([{name:"ru/symbols/NN",handler:function(e){return e.replace(/№№/g,"№")}}]),{A:"А",a:"а",B:"В",E:"Е",e:"е",K:"К",M:"М",H:"Н",O:"О",o:"о",P:"Р",p:"р",C:"С",c:"с",T:"Т",y:"у",X:"Х",x:"х"}),ye=Object.keys($e).join("");w.addRules([{name:"ru/typo/switchingKeyboardLayout",handler:function(e){var n=new RegExp("(["+ye+"]{1,3})(?=[А-ЯЁа-яё]+?)","g");return e.replace(n,function(e,n){for(var t="",r=0;r<n.length;r++)t+=$e[n[r]];return t})}}]);return w.titles={"common/html/e-mail":{"en-US":"Placement of links for e-mail",ru:"Расстановка ссылок для эл. почты"},"common/html/escape":{"en-US":"Escaping HTML",ru:"Экранирование HTML"},"common/html/nbr":{"en-US":"Replacement line break on <br/>",ru:"Замена перевода строки на <br/>"},"common/html/p":{"en-US":"Placement of paragraph",ru:"Расстановка абзацев"},"common/html/processingAttrs":{"en-US":"Processing HTML attributes",ru:"Типографирование HTML-атрибутов"},"common/html/quot":{common:'&⁠quot; → "'},"common/html/stripTags":{"en-US":"Removing HTML-tags",ru:"Удаление HTML-тегов"},"common/html/url":{"en-US":"Placement of links",ru:"Расстановка ссылок"},"common/nbsp/afterNumber":{"en-US":"Non-breaking space between number and word",ru:"Нераз. пробел между числом и словом"},"common/nbsp/afterParagraphMark":{"en-US":"Non-breaking space after ¶",ru:"Нераз. пробел после ¶"},"common/nbsp/afterSectionMark":{"en-US":"Non-breaking space after §",ru:"Нераз. узкий пробел после §"},"common/nbsp/afterShortWord":{"en-US":"Non-breaking space after short word",ru:"Нераз. пробел после короткого слова"},"common/nbsp/afterShortWordByList":{"en-US":"Non-breaking space after conjunctions, articles and prepositions",ru:"Нераз. пробел после союзов, артиклей и предлогов"},"common/nbsp/beforeShortLastNumber":{"en-US":"Non-breaking space before number (maximum 2 digits) at end of sentence",ru:"Нераз. пробел перед числом (не более 2 цифр) в конце предложения"},"common/nbsp/beforeShortLastWord":{"en-US":"Non-breaking space before last short word in sentence",ru:"Нераз. пробел перед последним коротким словом в предложении"},"common/nbsp/dpi":{"en-US":"Non-breaking space before lpi and dpi",ru:"Нераз. пробел перед lpi и dpi"},"common/nbsp/nowrap":{"en-US":"Replace non-breaking space to normal space in tags nowrap and nobr",ru:"Заменять нераз. пробел на обычный пробел в тегах nowrap и nobr"},"common/nbsp/replaceNbsp":{"en-US":"Replacing non-breaking space on normal before text correction",ru:"Замена неразрывного пробела на обычный перед типографированием"},"common/number/digitGrouping":{"en-US":"Divide into groups numbers with many digits",ru:"Разбивать длинные числа по разрядам"},"common/number/fraction":{common:"1/2 → ½, 1/4 → ¼, 3/4 → ¾"},"common/number/mathSigns":{common:"!= → ≠, <= → ≤, >= → ≥, ~= → ≅, +- → ±"},"common/number/times":{common:"x → × (10 x 5 → 10×5)"},"common/other/delBOM":{"en-US":"Delete character BOM (Byte Order Mark)",ru:"Удаление символа BOM (Byte Order Mark)"},"common/other/repeatWord":{"en-US":"Removing repeat words",ru:"Удаление повтора слова"},"common/punctuation/apostrophe":{"en-US":"Placement of correct apostrophe",ru:"Расстановка правильного апострофа"},"common/punctuation/delDoublePunctuation":{"en-US":"Removing double punctuation",ru:"Удаление двойной пунктуации"},"common/punctuation/hellip":{"en-US":"Replacement of three points by ellipsis",ru:"Замена трёх точек на многоточие"},"common/punctuation/quote":{"en-US":"Placement of quotation marks in texts",ru:"Расстановка кавычек правильного вида"},"common/punctuation/quoteLink":{"en-US":"Removal quotes outside a link",ru:"Вынос кавычек за пределы ссылки"},"common/space/afterColon":{"en-US":"space after colon",ru:"Пробел после двоеточия"},"common/space/afterComma":{"en-US":"space after comma",ru:"Пробел после запятой"},"common/space/afterExclamationMark":{"en-US":"space after exclamation mark",ru:"Пробел после знака восклицания"},"common/space/afterQuestionMark":{"en-US":"space after question mark",ru:"Пробел после знака вопроса"},"common/space/afterSemicolon":{"en-US":"space after semicolon",ru:"Пробел после точки с запятой"},"common/space/beforeBracket":{"en-US":"Space before opening bracket",ru:"Пробел перед открывающей скобкой"},"common/space/bracket":{"en-US":"Remove extra spaces after opening and before closing bracket",ru:"Удаление лишних пробелов после открывающей и перед закрывающей скобкой"},"common/space/delBeforeDot":{"en-US":"Remove space before dot",ru:"Удаление пробела перед точкой"},"common/space/delBeforePercent":{"en-US":"Remove space before %, ‰ and ‱",ru:"Удаление пробела перед %, ‰ и ‱"},"common/space/delBeforePunctuation":{"en-US":"Remove spaces before punctuation",ru:"Удаление пробелов перед знаками пунктуации"},"common/space/delBetweenExclamationMarks":{"en-US":"Remove spaces before exclamation marks",ru:"Удаление пробелов между знаками восклицания"},"common/space/delLeadingBlanks":{"en-US":"Remove spaces at start of line",ru:"Удаление пробелов в начале строки"},"common/space/delRepeatN":{"en-US":"Remove duplicate line breaks",ru:"Удаление повторяющихся переносов строки"},"common/space/delRepeatSpace":{"en-US":"Removing duplicate spaces between characters",ru:"Удаление повторяющихся пробелов между символами"},"common/space/delTrailingBlanks":{"en-US":"Remove spaces at end of line",ru:"Удаление пробелов в конце строки"},"common/space/insertFinalNewline":{"en-US":"Insert final newline",ru:"Вставить в конце текста перевод строки"},"common/space/replaceTab":{"en-US":"Replacement of tab to 4 spaces",ru:"Замена таба на 4 пробела"},"common/space/squareBracket":{"en-US":"Remove extra spaces after opening and before closing square bracket",ru:"Удаление лишних пробелов после открывающей и перед закрывающей квадратной скобкой"},"common/space/trimLeft":{"en-US":"Remove spaces and line breaks in beginning of text",ru:"Удаление пробелов и переносов строк в начале текста"},"common/space/trimRight":{"en-US":"Remove spaces and line breaks at end of text",ru:"Удаление пробелов и переносов строк в конце текста"},"common/symbols/arrow":{common:"-> → →, <- → ←"},"common/symbols/cf":{"en-US":"Adding ° to C and F",ru:"Добавление ° к C и F"},"common/symbols/copy":{common:"(c) → ©, (tm) → ™, (r) → ®"},"en-US/dash/main":{"en-US":"Replace hyphens surrounded by spaces with an em-dash",ru:"Замена дефиса на длинное тире"},"ru/dash/centuries":{"en-US":"Hyphen to dash in centuries",ru:"Замена дефиса на тире в веках"},"ru/dash/daysMonth":{"en-US":"Dash between days of one month",ru:"Тире между днями одного месяца"},"ru/dash/de":{"en-US":"Hyphen before “де”",ru:"Дефис перед «де»"},"ru/dash/decade":{"en-US":"Dash in decade",ru:"Тире в десятилетиях, 80—90-е гг."},"ru/dash/directSpeech":{"en-US":"Dash in direct speech",ru:"Тире в прямой речи"},"ru/dash/izpod":{"en-US":"Hyphen between “из-под”",ru:"Дефис между «из-под»"},"ru/dash/izza":{"en-US":"Hyphen between “из-за”",ru:"Дефис между «из-за»"},"ru/dash/ka":{"en-US":"Hyphen before “ка” and “кась”",ru:"Дефис перед «ка» и «кась»"},"ru/dash/kakto":{"en-US":"Hyphen for “как то”",ru:"Дефис для «как то»"},"ru/dash/koe":{"en-US":"Hyphen after “кое” and “кой”",ru:"Дефис после «кое» и «кой»"},"ru/dash/main":{"en-US":"Replacement hyphen with dash",ru:"Замена дефиса на тире"},"ru/dash/month":{"en-US":"Dash between months",ru:"Тире между месяцами"},"ru/dash/surname":{"en-US":"Acronyms with a dash",ru:"Сокращения с помощью тире"},"ru/dash/taki":{"en-US":"Hyphen between “верно-таки” and etc.",ru:"Дефис между «верно-таки» и т. д."},"ru/dash/time":{"en-US":"Dash in time intervals",ru:"Тире в интервалах времени"},"ru/dash/to":{"en-US":"Hyphen before “то”, “либо”, “нибудь”",ru:"Дефис перед «то», «либо», «нибудь»"},"ru/dash/weekday":{"en-US":"Dash between the days of the week",ru:"Тире между днями недели"},"ru/dash/years":{"en-US":"Hyphen to dash in years",ru:"Замена дефиса на тире в годах"},"ru/date/fromISO":{"en-US":"Converting dates YYYY-MM-DD type DD.MM.YYYY",ru:"Преобразование дат YYYY-MM-DD к виду DD.MM.YYYY"},"ru/date/weekday":{common:"2 Мая, Понедельник → 2 мая, понедельник"},"ru/money/currency":{"en-US":"Currency symbol ($, €, ¥, Ұ, £ and ₤) after the number, $100 → 100 $",ru:"Символ валюты ($, €, ¥, Ұ, £ и ₤) после числа, $100 → 100 $"},"ru/money/ruble":{common:"1 руб. → 1 ₽"},"ru/nbsp/abbr":{"en-US":"Non-breaking space in abbreviations, e.g. “т. д.”",ru:"Нераз. пробел в сокращениях, например, в «т. д.»"},"ru/nbsp/addr":{"en-US":"Placement of non-breaking space after “г.”, “обл.”, “ул.”, “пр.”, “кв.” et al.",ru:"Расстановка нераз. пробела после «г.», «обл.», «ул.», «пр.», «кв.» и др."},"ru/nbsp/afterNumberSign":{"en-US":"Non-breaking thin space after №",ru:"Нераз. узкий пробел после №"},"ru/nbsp/beforeParticle":{"en-US":"Non-breaking space before “ли”, “ль”, “же”, “бы”, “б”",ru:"Нераз. пробел перед «ли», «ль», «же», «бы», «б»"},"ru/nbsp/centuries":{"en-US":"Remove spaces and extra points in “вв.”",ru:"Удаление пробелов и лишних точек в «вв.»"},"ru/nbsp/dayMonth":{"en-US":"Non-breaking space between number and month",ru:"Нераз. пробел между числом и месяцем"},"ru/nbsp/initials":{"en-US":"Binding of initials to the name",ru:"Привязка инициалов к фамилии"},"ru/nbsp/m":{"en-US":"m2 → м², m3 → м³ and non-breaking space",ru:"м2 → м², м3 → м³ и нераз. пробел"},"ru/nbsp/mln":{"en-US":"Non-breaking space between number and “тыс.”, “млн”, “млрд” and “трлн”",ru:"Неразр. пробел между числом и «тыс.», «млн», «млрд» и «трлн»"},"ru/nbsp/ooo":{"en-US":"Non-breaking space after “OOO, ОАО, ЗАО, НИИ, ПБОЮЛ”",ru:"Нераз. пробел после OOO, ОАО, ЗАО, НИИ и ПБОЮЛ"},"ru/nbsp/page":{"en-US":"Non-breaking space after “стр.”, “гл.”, “рис.”, “илл.”",ru:"Нераз. пробел после «стр.», «гл.», «рис.», «илл.»"},"ru/nbsp/ps":{"en-US":"Non-breaking space in P. S. and P. P. S.",ru:"Нераз. пробел в P. S. и P. P. S."},"ru/nbsp/rubleKopek":{"en-US":"Not once. space before the “rub” and “cop.”",ru:"Нераз. пробел перед «руб.» и «коп.»"},"ru/nbsp/see":{"en-US":"Non-breaking space after abbreviation «см.» and «им.»",ru:"Нераз. пробел после сокращений «см.» и «им.»"},"ru/nbsp/year":{"en-US":"Non-breaking space before XXXX г. (2012 г.)",ru:"Нераз. пробел после XXXX г. (2012 г.)"},"ru/nbsp/years":{"en-US":"г.г. → гг. and non-breaking space",ru:"г.г. → гг. и нераз. пробел"},"ru/number/comma":{"en-US":"Commas in numbers",ru:"Замена точки на запятую в числах"},"ru/number/ordinals":{common:"N-ый, -ой, -ая, -ое, -ые, -ым, -ом, -ых → N-й, -я, -е, -м, -х (25-й)"},"ru/optalign/bracket":{"en-US":"for opening bracket",ru:"для открывающей скобки"},"ru/optalign/comma":{"en-US":"for comma",ru:"для запятой"},"ru/optalign/quote":{"en-US":"for opening quotation marks",ru:"для открывающей кавычки"},"ru/other/accent":{"en-US":"Replacement capital letters to lowercase with addition of accent",ru:"Замена заглавной буквы на строчную с добавлением ударения"},"ru/other/phone-number":{"en-US":"Formatting phone numbers",ru:"Форматирование телефонных номеров"},"ru/punctuation/ano":{"en-US":"Placement of commas before “а” and “но”",ru:"Расстановка запятых перед «а» и «но»"},"ru/punctuation/exclamation":{common:"!! → !"},"ru/punctuation/exclamationQuestion":{common:"!? → ?!"},"ru/punctuation/hellipQuestion":{common:"«?…» → «?..», «!…» → «!..», «…,» → «…»"},"ru/space/afterHellip":{"en-US":"Space after “...”, “!..” and “?..”",ru:"Пробел после «...», «!..» и «?..»"},"ru/space/year":{"en-US":"Space between number and word “год”",ru:"Пробел между числом и словом «год»"},"ru/symbols/NN":{common:"№№ → №"},"ru/typo/switchingKeyboardLayout":{"en-US":"Replacement of Latin letters in Russian. Typos occur when you switch keyboard layouts",ru:"Замена латинских букв на русские. Опечатки, возникающие при переключении клавиатурной раскладки"}},w.groups=[{name:"punctuation",title:{"en-US":"Punctuation",ru:"Пунктуация"}},{name:"optalign",title:{"en-US":"Hanging punctuation",ru:"Висячая пунктуация"}},{name:"dash",title:{"en-US":"Dash and hyphen",ru:"Тире и дефис"}},{name:"nbsp",title:{"en-US":"Non-breaking space",ru:"Неразрывный пробел"}},{name:"space",title:{"en-US":"Space and line ending",ru:"Пробел и окончание строки"}},{name:"html",title:{"en-US":"HTML",ru:"HTML"}},{name:"date",title:{"en-US":"Date",ru:"Дата"}},{name:"money",title:{"en-US":"Money",ru:"Деньги"}},{name:"number",title:{"en-US":"Numbers and mathematical expressions",ru:"Числа и математические выражения"}},{name:"symbols",title:{"en-US":"Symbols and signs",ru:"Символы и знаки"}},{name:"typo",title:{"en-US":"Typos",ru:"Опечатки"}},{name:"other",title:{"en-US":"Other",ru:"Прочее"}}],w});
@@ -306,11 +306,13 @@ var HtmlEntities = /** @class */ (function () {
306
306
  this.entitiesByName = {};
307
307
  this.entitiesByNameEntity = {};
308
308
  this.entitiesByDigitEntity = {};
309
+ this.entitiesByJsEntity = {};
309
310
  this.entitiesByUtf = {};
310
311
  this.entities.forEach(function (entity) {
311
312
  _this.entitiesByName[entity.name] = entity;
312
- _this.entitiesByNameEntity[entity.nameEntity] = entity;
313
- _this.entitiesByDigitEntity[entity.digitEntity] = entity;
313
+ _this.entitiesByNameEntity[entity.type.name] = entity;
314
+ _this.entitiesByDigitEntity[entity.type.digit] = entity;
315
+ _this.entitiesByJsEntity[entity.type.js] = entity;
314
316
  _this.entitiesByUtf[entity.utf] = entity;
315
317
  });
316
318
  this.invisibleEntities = this.prepareEntities(invisibleEntities);
@@ -320,9 +322,11 @@ var HtmlEntities = /** @class */ (function () {
320
322
  */
321
323
  HtmlEntities.prototype.toUtf = function (context) {
322
324
  var _this = this;
325
+ // &#160;
323
326
  if (context.text.search(/&#/) !== -1) {
324
327
  context.text = this.decHexToUtf(context.text);
325
328
  }
329
+ // &nbsp;
326
330
  if (context.text.search(/&[a-z]/i) !== -1) {
327
331
  // 2 - min length of entity without & and ;. Example: &DD;
328
332
  // 31 - max length of entity without & and ;. Example: &CounterClockwiseContourIntegral;
@@ -331,6 +335,13 @@ var HtmlEntities = /** @class */ (function () {
331
335
  return entity ? entity.utf : key;
332
336
  });
333
337
  }
338
+ // \u00a0
339
+ if (context.text.search(/\\u[\da-f]/i) !== -1) {
340
+ context.text = context.text.replace(/\\u[\da-f]{4};/gi, function (key) {
341
+ var entity = _this.entitiesByJsEntity[key.toLowerCase()];
342
+ return entity ? entity.utf : key;
343
+ });
344
+ }
334
345
  };
335
346
  /**
336
347
  * Entities in decimal or hexadecimal form to UTF-8.
@@ -350,38 +361,34 @@ var HtmlEntities = /** @class */ (function () {
350
361
  HtmlEntities.prototype.restore = function (context) {
351
362
  var params = context.prefs.htmlEntity;
352
363
  var type = params.type;
364
+ if (type === 'default') {
365
+ return;
366
+ }
353
367
  var entities = this.entities;
354
- if (type === 'name' || type === 'digit') {
355
- if (params.onlyInvisible || params.list) {
356
- entities = [];
357
- if (params.onlyInvisible) {
358
- entities = entities.concat(this.invisibleEntities);
359
- }
360
- if (params.list) {
361
- entities = entities.concat(this.prepareListParam(params.list));
362
- }
368
+ if (params.onlyInvisible || params.list) {
369
+ entities = [];
370
+ if (params.onlyInvisible) {
371
+ entities = entities.concat(this.invisibleEntities);
372
+ }
373
+ if (params.list) {
374
+ entities = entities.concat(this.prepareListParam(params.list));
363
375
  }
364
- var entityType = type === 'name' ? 'nameEntity' : 'digitEntity';
365
- context.text = this.restoreEntitiesByIndex(context.text, entityType, entities);
366
376
  }
377
+ context.text = this.restoreEntitiesByIndex(context.text, type, entities);
367
378
  };
368
379
  /**
369
380
  * Get a entity by utf using the type.
370
381
  */
371
382
  HtmlEntities.prototype.getByUtf = function (symbol, type) {
372
- var result;
373
383
  switch (type) {
374
384
  case 'digit':
375
- result = this.entitiesByDigitEntity[symbol];
376
- break;
385
+ return this.entitiesByDigitEntity[symbol];
377
386
  case 'name':
378
- result = this.entitiesByNameEntity[symbol];
379
- break;
380
- default:
381
- result = symbol;
382
- break;
387
+ return this.entitiesByNameEntity[symbol];
388
+ case 'js':
389
+ return this.entitiesByJsEntity[symbol];
383
390
  }
384
- return result;
391
+ return symbol;
385
392
  };
386
393
  HtmlEntities.prototype.prepareEntities = function (entities) {
387
394
  var result = [];
@@ -390,11 +397,13 @@ var HtmlEntities = /** @class */ (function () {
390
397
  var utf = String.fromCharCode(digit);
391
398
  result.push({
392
399
  name: name,
393
- nameEntity: '&' + name + ';', // &nbsp;
394
- digitEntity: '&#' + digit + ';', // &#160;
395
- utf: utf, // \u00A0
396
- reName: new RegExp('&' + name + ';', 'g'),
397
- reUtf: new RegExp(utf, 'g')
400
+ utf: utf, // \u00a0
401
+ reUtf: new RegExp(utf, 'g'),
402
+ type: {
403
+ name: '&' + name + ';', // &nbsp;
404
+ digit: '&#' + digit + ';', // &#160;
405
+ js: '\\u' + ('0000' + digit.toString(16)).slice(-4), // \u00a0
406
+ },
398
407
  });
399
408
  });
400
409
  return result;
@@ -412,7 +421,7 @@ var HtmlEntities = /** @class */ (function () {
412
421
  };
413
422
  HtmlEntities.prototype.restoreEntitiesByIndex = function (text, type, entities) {
414
423
  entities.forEach(function (entity) {
415
- text = text.replace(entity.reUtf, entity[type]);
424
+ text = text.replace(entity.reUtf, entity.type[type]);
416
425
  });
417
426
  return text;
418
427
  };
@@ -800,7 +809,7 @@ function prepareRule(rule) {
800
809
  return preparedRule;
801
810
  }
802
811
 
803
- var PACKAGE_VERSION = '7.4.4';
812
+ var PACKAGE_VERSION = '7.6.0';
804
813
 
805
814
  function prepareHtmlEntity(htmlEntity) {
806
815
  var result = {
@@ -1207,7 +1216,8 @@ var enGB = {
1207
1216
  'en-GB/quote': {
1208
1217
  left: '‘“',
1209
1218
  right: '’”',
1210
- }
1219
+ },
1220
+ 'en-GB/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',
1211
1221
  };
1212
1222
 
1213
1223
  var enUS = {
@@ -1281,7 +1291,8 @@ var it = {
1281
1291
  'it/quote': {
1282
1292
  left: '«“',
1283
1293
  right: '»”',
1284
- }
1294
+ },
1295
+ 'it/shortWord': 'a|da|di|in|la|il|lo|e|o|se|su|che|come|ma|è|ho|ha|sa',
1285
1296
  };
1286
1297
 
1287
1298
  var lv = {
@@ -1340,7 +1351,7 @@ var ru = {
1340
1351
  removeDuplicateQuotes: true,
1341
1352
  },
1342
1353
  'ru/shortMonth': 'янв|фев|мар|апр|ма[ейя]|июн|июл|авг|сен|окт|ноя|дек',
1343
- 'ru/shortWord': 'а|бы|в|во|да|до|же|за|и|из|к|ко|ли|на|не|ни|но|о|об|от|по|с|со|то|у',
1354
+ 'ru/shortWord': 'а|без|в|во|если|да|до|для|за|и|или|из|к|ко|как|ли|на|но|не|ни|о|об|обо|от|по|про|при|под|с|со|то|у',
1344
1355
  'ru/weekday': 'понедельник|вторник|среда|четверг|пятница|суббота|воскресенье',
1345
1356
  };
1346
1357
 
@@ -1637,14 +1648,11 @@ var afterSectionMarkRule = {
1637
1648
  var afterShortWordRule = {
1638
1649
  name: 'common/nbsp/afterShortWord',
1639
1650
  handler: function (text, settings, context) {
1640
- var lengthShortWord = settings.lengthShortWord, useShortWordList = settings.useShortWordList;
1651
+ var lengthShortWord = settings.lengthShortWord;
1641
1652
  var quote = getData('common/quote');
1642
1653
  var char = context.getData('char');
1643
- var shortWord = context.getData('shortWord');
1644
1654
  var before = ' \u00A0(' + privateLabel + quote;
1645
- var subStr = useShortWordList && shortWord !== undefined
1646
- ? '(^|[' + before + '])(' + shortWord + ') '
1647
- : '(^|[' + before + '])([' + char + ']{1,' + lengthShortWord + '}) ';
1655
+ var subStr = '(^|[' + before + '])([' + char + ']{1,' + lengthShortWord + '}) ';
1648
1656
  var newSubStr = '$1$2\u00A0';
1649
1657
  var re = new RegExp(subStr, 'gim');
1650
1658
  return text
@@ -1653,7 +1661,21 @@ var afterShortWordRule = {
1653
1661
  },
1654
1662
  settings: {
1655
1663
  lengthShortWord: 2,
1656
- useShortWordList: false,
1664
+ },
1665
+ };
1666
+
1667
+ var afterShortWordByListRule = {
1668
+ name: 'common/nbsp/afterShortWordByList',
1669
+ handler: function (text, _, context) {
1670
+ var quote = getData('common/quote');
1671
+ var shortWord = context.getData('shortWord');
1672
+ var before = ' \u00A0(' + privateLabel + quote;
1673
+ var subStr = '(^|[' + before + '])(' + shortWord + ') ';
1674
+ var newSubStr = '$1$2\u00A0';
1675
+ var re = new RegExp(subStr, 'gim');
1676
+ return text
1677
+ .replace(re, newSubStr)
1678
+ .replace(re, newSubStr);
1657
1679
  },
1658
1680
  };
1659
1681
 
@@ -1723,6 +1745,7 @@ Typograf.addRules([
1723
1745
  afterParagraphMarkRule,
1724
1746
  afterSectionMarkRule,
1725
1747
  afterShortWordRule,
1748
+ afterShortWordByListRule,
1726
1749
  beforeShortLastNumberRule,
1727
1750
  beforeShortLastWordRule,
1728
1751
  dpiRule,
@@ -1811,9 +1834,9 @@ var repeatWordRule = {
1811
1834
  handler: function (text, settings, context) {
1812
1835
  var quote = getData('common/quote');
1813
1836
  var char = context.getData('char');
1814
- var punc = '[;:,.?! \n' + quote + ']';
1837
+ var punc = '[;:,.?! \u00a0\n' + quote + ']';
1815
1838
  var re = new RegExp('(' + punc + '|^)' +
1816
- '([' + char + ']{' + settings.min + ',}) ' +
1839
+ '([' + char + ']{' + settings.min + ',})[ \u00a0]' +
1817
1840
  '\\2(' + punc + '|$)', 'gi');
1818
1841
  return text.replace(re, '$1$2$3');
1819
1842
  },