/*! * Button visually impaired - v1.0.0 https://bvi.isvek.ru * Copyright 2014-2021 Oleg Korotenko . * Licensed MIT (https://github.com/veks/button-visually-impaired-javascript/blob/master/LICENSE.md) */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).isvek=t()}(this,(function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;A(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:x(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),b}},e}({});try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(),[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach((function(e){e.hasOwnProperty("prepend")||Object.defineProperty(e,"prepend",{configurable:!0,enumerable:!0,writable:!0,value:function(){var e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach((function(e){var n=e instanceof Node;t.appendChild(n?e:document.createTextNode(String(e)))})),this.insertBefore(t,this.firstChild)}})})),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),window.HTMLCollection&&!HTMLCollection.prototype.forEach&&(HTMLCollection.prototype.forEach=Array.prototype.forEach);var l=function(e){switch(e){case"on":case"true":case"1":return!0;default:return!1}},s=function(e,t,n){for("string"==typeof t&&(t=document.createElement(t)),e.appendChild(t).className=n;e.firstChild!==t;)t.appendChild(e.firstChild)},u=function(e){var t=document.createDocumentFragment();if(e){for(;e.firstChild;){var n=e.removeChild(e.firstChild);t.appendChild(n)}e.parentNode.replaceChild(t,e)}},v=function(e,t){Object.keys(e).forEach((function(e){"function"==typeof t&&t(e)}))},f=function(e,t){Array.from(e).forEach((function(e){"function"==typeof t&&t(e)}))},h=function(){return window.speechSynthesis},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new Date,i=n.getTime();i+=864e5,n.setTime(i),document.cookie="bvi_".concat(e,"=").concat(t,";path=/;expires=").concat(n.toUTCString(),";domain=").concat(location.host)},m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e="bvi_".concat(e,"=");for(var t=decodeURIComponent(document.cookie),n=t.split(";"),i=0;i0&&void 0!==arguments[0]?arguments[0]:"";document.cookie="bvi_".concat(e,"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=").concat(location.host)},g={"ru-RU":{text:{fontSize:"Размер шрифта",siteColors:"Цвета сайта",images:"Изображения",speech:"Синтез речи",settings:"Настройки",regularVersionOfTheSite:"Обычная версия сайта",letterSpacing:"Межбуквенное расстояние",normal:"Стандартный",average:"Средний",big:"Большой",lineHeight:"Межстрочный интервал",font:"Шрифт",arial:"Без засечек",times:"С засечками",builtElements:"Встроенные элементы (Видео, карты и тд.)",on:"Включить",off:"Выключить",reset:"Сбросить настройки",plural_0:"пиксель",plural_1:"пекселя",plural_2:"пикселей"},voice:{fontSizePlus:"Размер шрифта увели́чен",fontSizeMinus:"Размер шрифта уме́ньшен",siteColorBlackOnWhite:"Цвет сайта черным по белому",siteColorWhiteOnBlack:"Цвет сайта белым по черному",siteColorDarkBlueOnBlue:"Цвет сайта тёмно-синим по голубому",siteColorBeigeBrown:"Цвет сайта кори́чневым по бе́жевому",siteColorGreenOnDarkBrown:"Цвет сайта зеленым по тёмно-коричневому",imagesOn:"Изображения включены",imagesOFF:"Изображения выключены",imagesGrayscale:"Изображения чёрно-белые",speechOn:"Синтез речи включён",speechOff:"Синтез речи вы́ключен",lineHeightNormal:"Межстрочный интервал стандартный",lineHeightAverage:"Межстрочный интервал средний",lineHeightBig:"Межстрочный интервал большой",LetterSpacingNormal:"Интервал между буквами стандартный",LetterSpacingAverage:"Интервал между буквами средний",LetterSpacingBig:"Интервал между буквами большой",fontArial:"Шрифт без засечек",fontTimes:"Шрифт с засечками",builtElementsOn:"Встроенные элементы включены",builtElementsOFF:"Встроенные элементы выключены",resetSettings:"Установлены настройки по умолча́нию",panelShow:"Панель открыта",panelHide:"Панель скрыта",panelOn:"Версия сайта для слабови́дящий",panelOff:"Обычная версия сайта"}},"en-US":{text:{fontSize:"Font size",siteColors:"Site colors",images:"Images",speech:"Speech synthesis",settings:"Settings",regularVersionOfTheSite:"Regular version Of The site",letterSpacing:"Letter spacing",normal:"Single",average:"One and a half",big:"Double",lineHeight:"Line spacing",font:"Font",arial:"Sans Serif - Arial",times:"Serif - Times New Roman",builtElements:"Include inline elements (Videos, maps, etc.)",on:"Enable",off:"Disabled",reset:"Reset settings",plural_0:"pixel",plural_1:"pixels",plural_2:"pixels"},voice:{fontSizePlus:"Font size increased",fontSizeMinus:"Font size reduced",siteColorBlackOnWhite:"Site color black on white",siteColorWhiteOnBlack:"Site color white on black",siteColorDarkBlueOnBlue:"Site color dark blue on cyan",siteColorBeigeBrown:"SiteColorBeigeBrown",siteColorGreenOnDarkBrown:"Site color green on dark brown",imagesOn:"Images enable",imagesOFF:"Images disabled",imagesGrayscale:"Images gray scale",speechOn:"Synthesis speech enable",speechOff:"Synthesis speech disabled",lineHeightNormal:"Line spacing single",lineHeightAverage:"Line spacing one and a half",lineHeightBig:"Line spacing double",LetterSpacingNormal:"Letter spacing single",LetterSpacingAverage:"Letter spacing one and a half",LetterSpacingBig:"Letter spacing letter double",fontArial:"Sans Serif - Arial",fontTimes:"Serif - Times New Roman",builtElementsOn:"Include inline elements are enabled",builtElementsOFF:"Include inline elements are disabled",resetSettings:"Default settings have been set",panelShow:"Panel show",panelHide:"Panel hide",panelOn:"Site version for visually impaired",panelOff:"Regular version of the site"}}},p=function(){function e(t){i(this,e),this._config=t}return o(e,[{key:"t",value:function(e){return g[this._config.lang].text[e]}},{key:"v",value:function(e){return g[this._config.lang].voice[e]}}]),e}(),y={target:".bvi-open",fontSize:16,theme:"white",images:"grayscale",letterSpacing:"normal",lineHeight:"normal",speech:!0,fontFamily:"arial",builtElements:!1,panelFixed:!0,panelHide:!1,reload:!1,lang:"ru-RU"},S={target:"string",fontSize:"number",theme:"string",images:"(string|boolean)",letterSpacing:"string",lineHeight:"string",speech:"boolean",fontFamily:"string",builtElements:"boolean",panelFixed:"boolean",panelHide:"boolean",reload:"boolean",lang:"string"},_={target:"",fontSize:"(^[1-9]$|^[1-3][0-9]?$|^39$)",theme:"(white|black|blue|brown|green)",images:"(true|false|grayscale)",letterSpacing:"(normal|average|big)",lineHeight:"(normal|average|big)",speech:"(true|false)",fontFamily:"(arial|times)",builtElements:"(true|false)",panelFixed:"(true|false)",panelHide:"(true|false)",reload:"(true|false)",lang:"(ru-RU|en-US)"};return{Bvi:function(){function e(t){i(this,e),this._config=this._getConfig(t),this._elements=document.querySelectorAll(this._config.target),this._i18n=new p({lang:this._config.lang}),this._addEventListeners(),this._init(),console.log("Bvi console: ready Button visually impaired v1.0.0")}return o(e,[{key:"_init",value:function(){v(this._config,(function(e){void 0===m(e)&&b("panelActive")})),l(m("panelActive"))?(this._set(),this._getPanel(),this._addEventListenersPanel(),this._images(),this._speechPlayer(),"speechSynthesis"in window&&l(m("speech"))&&setInterval((function(){if(!1===h().pending){var e=document.querySelectorAll(".bvi-speech-play"),t=document.querySelectorAll(".bvi-speech-pause"),n=document.querySelectorAll(".bvi-speech-resume"),i=document.querySelectorAll(".bvi-speech-stop"),r=function(e,t){e.forEach((function(e){return t(e)}))};r(e,(function(e){return e.classList.remove("disabled")})),r(t,(function(e){return e.classList.add("disabled")})),r(n,(function(e){return e.classList.add("disabled")})),r(i,(function(e){return e.classList.add("disabled")}))}}),1e3)):this._remove()}},{key:"_addEventListeners",value:function(){var e=this;if(!this._elements)return!1;this._elements.forEach((function(t){t.addEventListener("click",(function(t){t.preventDefault(),v(e._config,(function(t){return d(t,e._config[t])})),d("panelActive",!0),e._init(),e._speech("".concat(e._i18n.v("panelOn")))}))}))}},{key:"_addEventListenersPanel",value:function(){var e=this,t={fontSizeMinus:document.querySelector(".bvi-fontSize-minus"),fontSizePlus:document.querySelector(".bvi-fontSize-plus"),themeWhite:document.querySelector(".bvi-theme-white"),themeBlack:document.querySelector(".bvi-theme-black"),themeBlue:document.querySelector(".bvi-theme-blue"),themeBrown:document.querySelector(".bvi-theme-brown"),themeGreen:document.querySelector(".bvi-theme-green"),imagesOn:document.querySelector(".bvi-images-on"),imagesOff:document.querySelector(".bvi-images-off"),imagesGrayscale:document.querySelector(".bvi-images-grayscale"),speechOn:document.querySelector(".bvi-speech-on"),speechOff:document.querySelector(".bvi-speech-off"),lineHeightNormal:document.querySelector(".bvi-line-height-normal"),lineHeightAverage:document.querySelector(".bvi-line-height-average"),lineHeightBig:document.querySelector(".bvi-line-height-big"),letterSpacingNormal:document.querySelector(".bvi-letter-spacing-normal"),letterSpacingAverage:document.querySelector(".bvi-letter-spacing-average"),letterSpacingBig:document.querySelector(".bvi-letter-spacing-big"),fontFamilyArial:document.querySelector(".bvi-font-family-arial"),fontFamilyTimes:document.querySelector(".bvi-font-family-times"),builtElementsOn:document.querySelector(".bvi-built-elements-on"),builtElementsOff:document.querySelector(".bvi-built-elements-off"),reset:document.querySelector(".bvi-reset"),links:document.querySelectorAll(".bvi-link"),modal:document.querySelector(".bvi-modal")},n=function(e){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}(e.parentNode.children);try{for(n.s();!(t=n.n()).done;)t.value.classList.remove("active")}catch(e){n.e(e)}finally{n.f()}e.classList.add("active")},i=function(e,t){e.addEventListener("click",(function(e){e.preventDefault(),"function"==typeof t&&t(e)}))},r=function(){document.querySelectorAll(".bvi-link").forEach((function(e){e.classList.remove("active")})),v(e._config,(function(e){if("theme"===e){var t=m(e);document.querySelector(".bvi-theme-".concat(t)).classList.add("active")}if("images"===e){var n="grayscale"===m(e)?"grayscale":l(m(e))?"on":"off";document.querySelector(".bvi-images-".concat(n)).classList.add("active")}if("speech"===e){var i=l(m(e))?"on":"off";document.querySelector(".bvi-speech-".concat(i)).classList.add("active")}if("lineHeight"===e){var r=m(e);document.querySelector(".bvi-line-height-".concat(r)).classList.add("active")}if("letterSpacing"===e){var o=m(e);document.querySelector(".bvi-letter-spacing-".concat(o)).classList.add("active")}if("fontFamily"===e){var a=m(e);document.querySelector(".bvi-font-family-".concat(a)).classList.add("active")}if("builtElements"===e){var c=l(m(e))?"on":"off";document.querySelector(".bvi-built-elements-".concat(c)).classList.add("active")}}))};r(),i(t.fontSizeMinus,(function(){var i=parseFloat(m("fontSize"))-1;0!==i&&(e._setAttrDataBviBody("fontSize",i),d("fontSize",i),e._speech("".concat(e._i18n.v("fontSizeMinus"))),n(t.fontSizeMinus))})),i(t.fontSizePlus,(function(){var i=parseFloat(m("fontSize"))+1;40!==i&&(e._setAttrDataBviBody("fontSize",i),d("fontSize",i),e._speech("".concat(e._i18n.v("fontSizePlus"))),n(t.fontSizePlus))})),i(t.themeWhite,(function(){e._setAttrDataBviBody("theme","white"),d("theme","white"),e._speech("".concat(e._i18n.v("siteColorBlackOnWhite"))),n(t.themeWhite)})),i(t.themeBlack,(function(){e._setAttrDataBviBody("theme","black"),d("theme","black"),e._speech("".concat(e._i18n.v("siteColorWhiteOnBlack"))),n(t.themeBlack)})),i(t.themeBlue,(function(){e._setAttrDataBviBody("theme","blue"),d("theme","blue"),e._speech("".concat(e._i18n.v("siteColorDarkBlueOnBlue"))),n(t.themeBlue)})),i(t.themeBrown,(function(){e._setAttrDataBviBody("theme","brown"),d("theme","brown"),e._speech("".concat(e._i18n.v("siteColorBeigeBrown"))),n(t.themeBrown)})),i(t.themeGreen,(function(){e._setAttrDataBviBody("theme","green"),d("theme","green"),e._speech("".concat(e._i18n.v("siteColorGreenOnDarkBrown"))),n(t.themeGreen)})),i(t.imagesOn,(function(){e._setAttrDataBviBody("images","true"),d("images","true"),e._speech("".concat(e._i18n.v("imagesOn"))),n(t.imagesOn)})),i(t.imagesOff,(function(){e._setAttrDataBviBody("images","false"),d("images","false"),e._speech("".concat(e._i18n.v("imagesOFF"))),n(t.imagesOff)})),i(t.imagesGrayscale,(function(){e._setAttrDataBviBody("images","grayscale"),d("images","grayscale"),e._speech("".concat(e._i18n.v("imagesGrayscale"))),n(t.imagesGrayscale)})),i(t.speechOn,(function(){e._setAttrDataBviBody("speech","true"),d("speech","true"),e._speech("".concat(e._i18n.v("speechOn"))),n(t.speechOn),e._speechPlayer()})),i(t.speechOff,(function(){e._speech("".concat(e._i18n.v("speechOff"))),e._setAttrDataBviBody("speech","false"),d("speech","false"),n(t.speechOff),e._speechPlayer()})),i(t.lineHeightNormal,(function(){e._setAttrDataBviBody("lineHeight","normal"),d("lineHeight","normal"),e._speech("".concat(e._i18n.v("lineHeightNormal"))),n(t.lineHeightNormal)})),i(t.lineHeightAverage,(function(){e._setAttrDataBviBody("lineHeight","average"),d("lineHeight","average"),e._speech("".concat(e._i18n.v("lineHeightAverage"))),n(t.lineHeightAverage)})),i(t.lineHeightBig,(function(){e._setAttrDataBviBody("lineHeight","big"),d("lineHeight","big"),e._speech("".concat(e._i18n.v("lineHeightBig"))),n(t.lineHeightBig)})),i(t.letterSpacingNormal,(function(){e._setAttrDataBviBody("letterSpacing","normal"),d("letterSpacing","normal"),e._speech("".concat(e._i18n.v("LetterSpacingNormal"))),n(t.letterSpacingNormal)})),i(t.letterSpacingAverage,(function(){e._setAttrDataBviBody("letterSpacing","average"),d("letterSpacing","average"),e._speech("".concat(e._i18n.v("LetterSpacingAverage"))),n(t.letterSpacingAverage)})),i(t.letterSpacingBig,(function(){e._setAttrDataBviBody("letterSpacing","big"),d("letterSpacing","big"),e._speech("".concat(e._i18n.v("LetterSpacingBig"))),n(t.letterSpacingBig)})),i(t.fontFamilyArial,(function(){e._setAttrDataBviBody("fontFamily","arial"),d("fontFamily","arial"),e._speech("".concat(e._i18n.v("fontArial"))),n(t.fontFamilyArial)})),i(t.fontFamilyTimes,(function(){e._setAttrDataBviBody("fontFamily","times"),d("fontFamily","times"),e._speech("".concat(e._i18n.v("fontTimes"))),n(t.fontFamilyTimes)})),i(t.builtElementsOn,(function(){e._setAttrDataBviBody("builtElements","true"),d("builtElements","true"),e._speech("".concat(e._i18n.v("builtElementsOn"))),n(t.builtElementsOn)})),i(t.builtElementsOff,(function(){e._setAttrDataBviBody("builtElements","false"),d("builtElements","false"),e._speech("".concat(e._i18n.v("builtElementsOFF"))),n(t.builtElementsOff)})),i(t.reset,(function(){e._speech("".concat(e._i18n.v("resetSettings"))),v(e._config,(function(t){e._setAttrDataBviBody(t,e._config[t]),d(t,e._config[t]),r()}))})),f(t.links,(function(n){i(n,(function(n){var i=n.target.getAttribute("data-bvi");"close"===i&&(e._setAttrDataBviBody("panelActive","false"),d("panelActive","false"),e._init()),"modal"===i&&(document.body.style.overflow="hidden",document.body.classList.add("bvi-noscroll"),t.modal.classList.toggle("show")),"modal-close"===i&&(document.body.classList.remove("bvi-noscroll"),document.body.style.overflow="",t.modal.classList.remove("show")),"panel-hide"===i&&(document.querySelector(".bvi-panel").classList.add("bvi-panel-hide"),document.querySelector(".bvi-link-fixed-top").classList.remove("bvi-hide"),document.querySelector(".bvi-link-fixed-top").classList.add("bvi-show"),d("panelHide","true"),e._speech("".concat(e._i18n.v("panelHide")))),"panel-show"===i&&(document.querySelector(".bvi-link-fixed-top").classList.remove("bvi-show"),document.querySelector(".bvi-link-fixed-top").classList.add("bvi-hide"),document.querySelector(".bvi-panel").classList.remove("bvi-panel-hide"),d("panelHide","false"),e._speech("".concat(e._i18n.v("panelShow"))))}))})),i(t.modal,(function(e){e.target.contains(t.modal)&&(document.body.classList.remove("bvi-noscroll"),document.body.style.overflow="",t.modal.classList.remove("show"))}))}},{key:"_getPanel",value:function(){var e=function(){var e=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;l(m("panelFixed"))&&(e>200?document.querySelector(".bvi-panel").classList.add("bvi-fixed-top"):document.querySelector(".bvi-panel").classList.remove("bvi-fixed-top"))},t=l(m("panelHide"))?" bvi-panel-hide":"",n=l(m("panelHide"))?"bvi-show":" bvi-hide",i="\n
\n
\n
\n
').concat(this._i18n.t("fontSize"),'
\n А-\n А+\n
\n
\n
').concat(this._i18n.t("siteColors"),'
\n Ц\n Ц\n Ц\n Ц\n Ц\n
\n
\n
').concat(this._i18n.t("images"),'
\n \n \n \n \n \n \n \n \n \n
\n
\n
').concat(this._i18n.t("speech"),'
\n \n \n \n \n \n \n
\n
\n
').concat(this._i18n.t("settings"),'
\n \n \n \n \n ').concat(this._i18n.t("regularVersionOfTheSite"),'\n \n \n \n \n
\n
\n
\n
\n
\n
\n
').concat(this._i18n.t("settings"),'
\n ×\n
\n
\n
\n \n \n
\n
').concat(this._i18n.t("font"),'
\n ').concat(this._i18n.t("arial"),'\n ').concat(this._i18n.t("times"),'\n
\n
\n
').concat(this._i18n.t("builtElements"),'
\n ').concat(this._i18n.t("on"),'\n ').concat(this._i18n.t("off"),'\n
\n
\n \n
\n \n
\n
\n
\n
"),r='')+'';window.addEventListener("scroll",e),document.querySelector(".bvi-body").insertAdjacentHTML("beforebegin",i),document.querySelector(".bvi-body").insertAdjacentHTML("afterbegin",r),e()}},{key:"_set",value:function(){var e=this;document.body.classList.add("bvi-active"),s(document.body,"div","bvi-body"),v(this._config,(function(t){return e._setAttrDataBviBody(t,m(t))})),f(this._elements,(function(e){return e.style.display="none"})),document.querySelectorAll("img").forEach((function(e){e.classList.contains("bvi-img")&&e.classList.remove("bvi-img")})),document.querySelectorAll("body *").forEach((function(e){e.classList.contains("bvi-background-image")&&e.classList.remove("bvi-background-image")}))}},{key:"_remove",value:function(){var e=document.querySelector(".bvi-panel"),t=document.querySelector(".bvi-body"),n=document.querySelector(".bvi-link-fixed-top");e&&e.remove(),t&&u(t),n&&n.remove(),this._speech("".concat(this._i18n.v("panelOff"))),document.body.classList.remove("bvi-active"),f(this._elements,(function(e){return e.style.display=""})),l(m("reload"))&&document.location.reload(),v(this._config,(function(e){b(e)})),this._speechPlayer(),b("panelActive")}},{key:"_images",value:function(){document.querySelectorAll("img").forEach((function(e){e.classList.contains("bvi-no-style")||e.classList.add("bvi-img")})),document.querySelectorAll(".bvi-body *").forEach((function(e){var t=getComputedStyle(e);"none"===t.backgroundImage||"none"===t.background||e.classList.contains("bvi-no-style")||e.classList.add("bvi-background-image")}))}},{key:"_getConfig",value:function(e){e=t(t({},y),e);var i={};for(var r in y)i[r]=e[r];return function(e,t,i){Object.keys(t).forEach((function(i){var r,o=t[i],a=e[i],c=a&&(r=a)&&"object"===n(r)&&void 0!==r.nodeType?"element":function(e){return null==e?"".concat(e):{}.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase()}(a);if(!new RegExp(o).test(c))throw new TypeError('Bvi console: Опция "'.concat(i,'" предоставленный тип "').concat(c,'", ожидаемый тип "').concat(o,'".'))})),Object.keys(i).forEach((function(t){var n=i[t],r=e[t];if(!new RegExp(n).test(r))throw new TypeError('Bvi console: Опция "'.concat(t,'" параметр "').concat(r,'", ожидаемый параметр "').concat(n,'".'))}))}(i,S,_),i}},{key:"_setAttrDataBviBody",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";document.querySelector(".bvi-body").setAttribute("data-bvi-".concat(e),t)}},{key:"_speechPlayer",value:function(){var e=this,t=document.querySelectorAll(".bvi-speech-text"),n=document.querySelectorAll(".bvi-speech-link"),i=document.querySelectorAll(".bvi-speech");if("speechSynthesis"in window&&l(m("speech"))){if(i){t&&t.forEach((function(e){return u(e)})),n&&n.forEach((function(e){return e.remove()})),i.forEach((function(e,t){var n="bvi-speech-text-id-".concat(t+1);s(e,"div","bvi-speech-text ".concat(n)),e.insertAdjacentHTML("afterbegin",'\n ')}));var r=document.querySelectorAll(".bvi-speech-play"),o=document.querySelectorAll(".bvi-speech-pause"),a=document.querySelectorAll(".bvi-speech-resume"),c=document.querySelectorAll(".bvi-speech-stop"),v=function(e,t){e.forEach((function(e){e.addEventListener("click",(function(n){if(n.preventDefault(),"function"==typeof t)return t(e,n)}),!1)}))};v(r,(function(t,n){var i=n.target,r=i.parentNode.nextElementSibling,o=n.target.closest(".bvi-speech-link"),a=document.querySelectorAll(".bvi-speech-play"),c=document.querySelectorAll(".bvi-speech-pause"),l=document.querySelectorAll(".bvi-speech-resume"),s=document.querySelectorAll(".bvi-speech-stop");e._speech(r.textContent,r,!0),a.forEach((function(e){return e.classList.remove("disabled")})),c.forEach((function(e){return e.classList.add("disabled")})),l.forEach((function(e){return e.classList.add("disabled")})),s.forEach((function(e){return e.classList.add("disabled")})),i.classList.add("disabled"),o.querySelector(".bvi-speech-pause").classList.remove("disabled"),o.querySelector(".bvi-speech-stop").classList.remove("disabled")})),v(o,(function(e,t){var n=t.target,i=t.target.closest(".bvi-speech-link");n.classList.add("disabled"),i.querySelector(".bvi-speech-resume").classList.remove("disabled"),h().pause()})),v(a,(function(e,t){var n=t.target,i=t.target.closest(".bvi-speech-link");n.classList.add("disabled"),i.querySelector(".bvi-speech-pause").classList.remove("disabled"),h().resume()})),v(c,(function(e,t){var n=t.target,i=t.target.closest(".bvi-speech-link");n.classList.add("disabled"),i.querySelector(".bvi-speech-pause").classList.add("disabled"),i.querySelector(".bvi-speech-play").classList.remove("disabled"),h().cancel()}))}}else t&&t.forEach((function(e){return u(e)})),n&&n.forEach((function(e){return e.remove()}))}},{key:"_speech",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("speechSynthesis"in window&&l(m("speech"))){h().cancel();for(var r=function(e,t){e=String(e),t=Number(t)>>>0;var n=e.slice(0,t+1).search(/\S+$/),i=e.slice(t).search(/\s/);return i<0?e.slice(n):e.slice(n,i+t)},o=120,a=new RegExp("^[\\s\\S]{"+Math.floor(o/2)+","+o+"}[.!?,]{1}|^[\\s\\S]{1,"+o+"}$|^[\\s\\S]{1,"+o+"} "),c=[],s=e,u=h().getVoices();s.length>0;)c.push(s.match(a)[0]),s=s.substring(c[c.length-1].length);c.forEach((function(e){var o=new SpeechSynthesisUtterance(e.trim());o.volume=1,o.rate=1,o.pitch=1,o.lang=n._config.lang;for(var a=0;a]+>)*$1(<[^>]+>)*)"),a=new RegExp("("+o+")","gi");i=(i=i.replace(a,"$1")).replace(/([^<>]*)((<[^>]+>)+)([^<>]*<\/mark>)/,"$1$2$4"),t.innerHTML=i},o.onend=function(e){t.classList.remove("bvi-highlighting");var n=t.textContent;n=n.replace(/($1<\/mark>)/,"$1"),t.innerHTML=n}),h().speak(o)}))}}}]),e}()}})); //# sourceMappingURL=bvi.min.js.map