Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

speak-tts

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speak-tts - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

2

demo/build/demo.bundle.js

@@ -1,1 +0,1 @@

!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=32)}([function(e,t,n){var o=n(17),r="object"==typeof self&&self&&self.Object===Object&&self,a=o||r||Function("return this")();e.exports=a},function(e,t,n){var o=n(61);e.exports=function(e,t,n){var r=null==e?void 0:o(e,t);return void 0===r?n:r}},function(e,t,n){var o=n(13),r=n(35),a=n(36),c="[object Null]",i="[object Undefined]",u=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?i:c:u&&u in Object(e)?r(e):a(e)}},function(e,t,n){var o=n(50),r=n(53);e.exports=function(e,t){var n=r(e,t);return o(n)?n:void 0}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){var o=n(3)(Object,"create");e.exports=o},function(e,t,n){var o=n(78);e.exports=function(e,t){for(var n=e.length;n--;)if(o(e[n][0],t))return n;return-1}},function(e,t,n){var o=n(83);e.exports=function(e,t){var n=e.__data__;return o(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var o=n(16),r=n(37),a=n(39),c=n(43),i=n(44),u=n(20),l=/^\s+|\s+$/g;e.exports=function(e,t,n){if((e=u(e))&&(n||void 0===t))return e.replace(l,"");if(!e||!(t=o(t)))return e;var f=i(e),s=i(t),p=c(f,s),v=a(f,s)+1;return r(f,p,v).join("")}},function(e,t,n){var o=n(21),r=n(23),a=n(88),c=n(4),i=n(27),u=n(90),l=n(22),f=n(92),s="[object Map]",p="[object Set]",v=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(i(e)&&(c(e)||"string"==typeof e||"function"==typeof e.splice||u(e)||f(e)||a(e)))return!e.length;var t=r(e);if(t==s||t==p)return!e.size;if(l(e))return!o(e).length;for(var n in e)if(v.call(e,n))return!1;return!0}},function(e,t,n){var o=n(0).isFinite;e.exports=function(e){return"number"==typeof e&&o(e)}},function(e,t,n){var o=n(0).Symbol;e.exports=o},function(e,t,n){var o=n(2),r=n(5),a="[object Symbol]";e.exports=function(e){return"symbol"==typeof e||r(e)&&o(e)==a}},function(e,t,n){var o=n(2),r=n(4),a=n(5),c="[object String]";e.exports=function(e){return"string"==typeof e||!r(e)&&a(e)&&o(e)==c}},function(e,t,n){var o=n(13),r=n(34),a=n(4),c=n(14),i=1/0,u=o?o.prototype:void 0,l=u?u.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(a(t))return r(t,e)+"";if(c(t))return l?l.call(t):"";var n=t+"";return"0"==n&&1/t==-i?"-0":n}},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(33))},function(e,t,n){var o=n(40),r=n(41),a=n(42);e.exports=function(e,t,n){return t==t?a(e,t,n):o(e,r,n)}},function(e,t){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return n.test(e)}},function(e,t,n){var o=n(16);e.exports=function(e){return null==e?"":o(e)}},function(e,t,n){var o=n(22),r=n(47),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!o(e))return r(e);var t=[];for(var n in Object(e))a.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t,n){var o=n(49),r=n(26),a=n(54),c=n(55),i=n(56),u=n(2),l=n(25),f=l(o),s=l(r),p=l(a),v=l(c),d=l(i),h=u;(o&&"[object DataView]"!=h(new o(new ArrayBuffer(1)))||r&&"[object Map]"!=h(new r)||a&&"[object Promise]"!=h(a.resolve())||c&&"[object Set]"!=h(new c)||i&&"[object WeakMap]"!=h(new i))&&(h=function(e){var t=u(e),n="[object Object]"==t?e.constructor:void 0,o=n?l(n):"";if(o)switch(o){case f:return"[object DataView]";case s:return"[object Map]";case p:return"[object Promise]";case v:return"[object Set]";case d:return"[object WeakMap]"}return t}),e.exports=h},function(e,t,n){var o=n(2),r=n(9),a="[object AsyncFunction]",c="[object Function]",i="[object GeneratorFunction]",u="[object Proxy]";e.exports=function(e){if(!r(e))return!1;var t=o(e);return t==c||t==i||t==a||t==u}},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var o=n(3)(n(0),"Map");e.exports=o},function(e,t,n){var o=n(24),r=n(28);e.exports=function(e){return null!=e&&r(e.length)&&!o(e)}},function(e,t){var n=9007199254740991;e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){var o=n(21),r=n(23),a=n(27),c=n(15),i=n(57),u="[object Map]",l="[object Set]";e.exports=function(e){if(null==e)return 0;if(a(e))return c(e)?i(e):e.length;var t=r(e);return t==u||t==l?e.size:o(e).length}},function(e,t){e.exports=function(e){return null==e}},function(e,t,n){e.exports=n(96)},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e,t){for(var n=-1,o=null==e?0:e.length,r=Array(o);++n<o;)r[n]=t(e[n],n,e);return r}},function(e,t,n){var o=n(13),r=Object.prototype,a=r.hasOwnProperty,c=r.toString,i=o?o.toStringTag:void 0;e.exports=function(e){var t=a.call(e,i),n=e[i];try{e[i]=void 0;var o=!0}catch(e){}var r=c.call(e);return o&&(t?e[i]=n:delete e[i]),r}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var o=n(38);e.exports=function(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:o(e,t,n)}},function(e,t){e.exports=function(e,t,n){var o=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(n=n>r?r:n)<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(r);++o<r;)a[o]=e[o+t];return a}},function(e,t,n){var o=n(18);e.exports=function(e,t){for(var n=e.length;n--&&o(t,e[n],0)>-1;);return n}},function(e,t){e.exports=function(e,t,n,o){for(var r=e.length,a=n+(o?1:-1);o?a--:++a<r;)if(t(e[a],a,e))return a;return-1}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var o=n-1,r=e.length;++o<r;)if(e[o]===t)return o;return-1}},function(e,t,n){var o=n(18);e.exports=function(e,t){for(var n=-1,r=e.length;++n<r&&o(t,e[n],0)>-1;);return n}},function(e,t,n){var o=n(45),r=n(19),a=n(46);e.exports=function(e){return r(e)?a(e):o(e)}},function(e,t){e.exports=function(e){return e.split("")}},function(e,t){var n="[\\ud800-\\udfff]",o="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",a="[^\\ud800-\\udfff]",c="(?:\\ud83c[\\udde6-\\uddff]){2}",i="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+o+"|"+r+")"+"?",l="[\\ufe0e\\ufe0f]?"+u+("(?:\\u200d(?:"+[a,c,i].join("|")+")[\\ufe0e\\ufe0f]?"+u+")*"),f="(?:"+[a+o+"?",o,c,i,n].join("|")+")",s=RegExp(r+"(?="+r+")|"+f+l,"g");e.exports=function(e){return e.match(s)||[]}},function(e,t,n){var o=n(48)(Object.keys,Object);e.exports=o},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var o=n(3)(n(0),"DataView");e.exports=o},function(e,t,n){var o=n(24),r=n(51),a=n(9),c=n(25),i=/^\[object .+?Constructor\]$/,u=Function.prototype,l=Object.prototype,f=u.toString,s=l.hasOwnProperty,p=RegExp("^"+f.call(s).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!a(e)||r(e))&&(o(e)?p:i).test(c(e))}},function(e,t,n){var o=n(52),r=function(){var e=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=function(e){return!!r&&r in e}},function(e,t,n){var o=n(0)["__core-js_shared__"];e.exports=o},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var o=n(3)(n(0),"Promise");e.exports=o},function(e,t,n){var o=n(3)(n(0),"Set");e.exports=o},function(e,t,n){var o=n(3)(n(0),"WeakMap");e.exports=o},function(e,t,n){var o=n(58),r=n(19),a=n(60);e.exports=function(e){return r(e)?a(e):o(e)}},function(e,t,n){var o=n(59)("length");e.exports=o},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t){var n="[\\ud800-\\udfff]",o="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",a="[^\\ud800-\\udfff]",c="(?:\\ud83c[\\udde6-\\uddff]){2}",i="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+o+"|"+r+")"+"?",l="[\\ufe0e\\ufe0f]?"+u+("(?:\\u200d(?:"+[a,c,i].join("|")+")[\\ufe0e\\ufe0f]?"+u+")*"),f="(?:"+[a+o+"?",o,c,i,n].join("|")+")",s=RegExp(r+"(?="+r+")|"+f+l,"g");e.exports=function(e){for(var t=s.lastIndex=0;s.test(e);)++t;return t}},function(e,t,n){var o=n(62),r=n(87);e.exports=function(e,t){for(var n=0,a=(t=o(t,e)).length;null!=e&&n<a;)e=e[r(t[n++])];return n&&n==a?e:void 0}},function(e,t,n){var o=n(4),r=n(63),a=n(64),c=n(20);e.exports=function(e,t){return o(e)?e:r(e,t)?[e]:a(c(e))}},function(e,t,n){var o=n(4),r=n(14),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c=/^\w*$/;e.exports=function(e,t){if(o(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!r(e))||c.test(e)||!a.test(e)||null!=t&&e in Object(t)}},function(e,t,n){var o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=n(65)(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,function(e,n,o,a){t.push(o?a.replace(r,"$1"):n||e)}),t});e.exports=a},function(e,t,n){var o=n(66),r=500;e.exports=function(e){var t=o(e,function(e){return n.size===r&&n.clear(),e}),n=t.cache;return t}},function(e,t,n){var o=n(67),r="Expected a function";function a(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(r);var n=function(){var o=arguments,r=t?t.apply(this,o):o[0],a=n.cache;if(a.has(r))return a.get(r);var c=e.apply(this,o);return n.cache=a.set(r,c)||a,c};return n.cache=new(a.Cache||o),n}a.Cache=o,e.exports=a},function(e,t,n){var o=n(68),r=n(82),a=n(84),c=n(85),i=n(86);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=r,u.prototype.get=a,u.prototype.has=c,u.prototype.set=i,e.exports=u},function(e,t,n){var o=n(69),r=n(75),a=n(26);e.exports=function(){this.size=0,this.__data__={hash:new o,map:new(a||r),string:new o}}},function(e,t,n){var o=n(70),r=n(71),a=n(72),c=n(73),i=n(74);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=r,u.prototype.get=a,u.prototype.has=c,u.prototype.set=i,e.exports=u},function(e,t,n){var o=n(6);e.exports=function(){this.__data__=o?o(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var o=n(6),r="__lodash_hash_undefined__",a=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(o){var n=t[e];return n===r?void 0:n}return a.call(t,e)?t[e]:void 0}},function(e,t,n){var o=n(6),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return o?void 0!==t[e]:r.call(t,e)}},function(e,t,n){var o=n(6),r="__lodash_hash_undefined__";e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=o&&void 0===t?r:t,this}},function(e,t,n){var o=n(76),r=n(77),a=n(79),c=n(80),i=n(81);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}u.prototype.clear=o,u.prototype.delete=r,u.prototype.get=a,u.prototype.has=c,u.prototype.set=i,e.exports=u},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var o=n(7),r=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=o(t,e);return!(n<0||(n==t.length-1?t.pop():r.call(t,n,1),--this.size,0))}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var o=n(7);e.exports=function(e){var t=this.__data__,n=o(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var o=n(7);e.exports=function(e){return o(this.__data__,e)>-1}},function(e,t,n){var o=n(7);e.exports=function(e,t){var n=this.__data__,r=o(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}},function(e,t,n){var o=n(8);e.exports=function(e){var t=o(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var o=n(8);e.exports=function(e){return o(this,e).get(e)}},function(e,t,n){var o=n(8);e.exports=function(e){return o(this,e).has(e)}},function(e,t,n){var o=n(8);e.exports=function(e,t){var n=o(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}},function(e,t,n){var o=n(14),r=1/0;e.exports=function(e){if("string"==typeof e||o(e))return e;var t=e+"";return"0"==t&&1/e==-r?"-0":t}},function(e,t,n){var o=n(89),r=n(5),a=Object.prototype,c=a.hasOwnProperty,i=a.propertyIsEnumerable,u=o(function(){return arguments}())?o:function(e){return r(e)&&c.call(e,"callee")&&!i.call(e,"callee")};e.exports=u},function(e,t,n){var o=n(2),r=n(5),a="[object Arguments]";e.exports=function(e){return r(e)&&o(e)==a}},function(e,t,n){(function(e){var o=n(0),r=n(91),a="object"==typeof t&&t&&!t.nodeType&&t,c=a&&"object"==typeof e&&e&&!e.nodeType&&e,i=c&&c.exports===a?o.Buffer:void 0,u=(i?i.isBuffer:void 0)||r;e.exports=u}).call(this,n(29)(e))},function(e,t){e.exports=function(){return!1}},function(e,t,n){var o=n(93),r=n(94),a=n(95),c=a&&a.isTypedArray,i=c?r(c):o;e.exports=i},function(e,t,n){var o=n(2),r=n(28),a=n(5),c={};c["[object Float32Array]"]=c["[object Float64Array]"]=c["[object Int8Array]"]=c["[object Int16Array]"]=c["[object Int32Array]"]=c["[object Uint8Array]"]=c["[object Uint8ClampedArray]"]=c["[object Uint16Array]"]=c["[object Uint32Array]"]=!0,c["[object Arguments]"]=c["[object Array]"]=c["[object ArrayBuffer]"]=c["[object Boolean]"]=c["[object DataView]"]=c["[object Date]"]=c["[object Error]"]=c["[object Function]"]=c["[object Map]"]=c["[object Number]"]=c["[object Object]"]=c["[object RegExp]"]=c["[object Set]"]=c["[object String]"]=c["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&r(e.length)&&!!c[o(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){(function(e){var o=n(17),r="object"==typeof t&&t&&!t.nodeType&&t,a=r&&"object"==typeof e&&e&&!e.nodeType&&e,c=a&&a.exports===r&&o.process,i=function(){try{var e=a&&a.require&&a.require("util").types;return e||c&&c.binding&&c.binding("util")}catch(e){}}();e.exports=i}).call(this,n(29)(e))},function(e,t,n){"use strict";n.r(t);var o=n(10),r=n.n(o),a=n(30),c=n.n(a),i=n(1),u=n.n(i),l=n(31),f=n.n(l),s=n(11),p=n.n(s),v=n(9),d=n.n(v),h=n(15),m=n.n(h),g=n(12),y=n.n(g),b=/^(?:(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))$|^((?:[a-z]{2,3}(?:(?:-[a-z]{3}){1,3})?)|[a-z]{4}|[a-z]{5,8})(?:-([a-z]{4}))?(?:-([a-z]{2}|\d{3}))?((?:-(?:[\da-z]{5,8}|\d[\da-z]{3}))*)?((?:-[\da-wy-z](?:-[\da-z]{2,8})+)*)?(-x(?:-[\da-z]{1,8})+)?$|^(x(?:-[\da-z]{1,8})+)$/i,S=[{name:"pt-BR",voiceURI:"pt-BR",lang:"pt-BR",localService:!0,default:!0},{name:"fr-CA",voiceURI:"fr-CA",lang:"fr-CA",localService:!0,default:!0},{name:"sk-SK",voiceURI:"sk-SK",lang:"sk-SK",localService:!0,default:!0},{name:"th-TH",voiceURI:"th-TH",lang:"th-TH",localService:!0,default:!0},{name:"ro-RO",voiceURI:"ro-RO",lang:"ro-RO",localService:!0,default:!0},{name:"no-NO",voiceURI:"no-NO",lang:"no-NO",localService:!0,default:!0},{name:"fi-FI",voiceURI:"fi-FI",lang:"fi-FI",localService:!0,default:!0},{name:"pl-PL",voiceURI:"pl-PL",lang:"pl-PL",localService:!0,default:!0},{name:"de-DE",voiceURI:"de-DE",lang:"de-DE",localService:!0,default:!0},{name:"nl-NL",voiceURI:"nl-NL",lang:"nl-NL",localService:!0,default:!0},{name:"id-ID",voiceURI:"id-ID",lang:"id-ID",localService:!0,default:!0},{name:"tr-TR",voiceURI:"tr-TR",lang:"tr-TR",localService:!0,default:!0},{name:"it-IT",voiceURI:"it-IT",lang:"it-IT",localService:!0,default:!0},{name:"pt-PT",voiceURI:"pt-PT",lang:"pt-PT",localService:!0,default:!0},{name:"fr-FR",voiceURI:"fr-FR",lang:"fr-FR",localService:!0,default:!0},{name:"ru-RU",voiceURI:"ru-RU",lang:"ru-RU",localService:!0,default:!0},{name:"es-MX",voiceURI:"es-MX",lang:"es-MX",localService:!0,default:!0},{name:"zh-HK",voiceURI:"zh-HK",lang:"zh-HK",localService:!0,default:!0},{name:"sv-SE",voiceURI:"sv-SE",lang:"sv-SE",localService:!0,default:!0},{name:"hu-HU",voiceURI:"hu-HU",lang:"hu-HU",localService:!0,default:!0},{name:"zh-TW",voiceURI:"zh-TW",lang:"zh-TW",localService:!0,default:!0},{name:"es-ES",voiceURI:"es-ES",lang:"es-ES",localService:!0,default:!0},{name:"zh-CN",voiceURI:"zh-CN",lang:"zh-CN",localService:!0,default:!0},{name:"nl-BE",voiceURI:"nl-BE",lang:"nl-BE",localService:!0,default:!0},{name:"en-GB",voiceURI:"en-GB",lang:"en-GB",localService:!0,default:!0},{name:"ar-SA",voiceURI:"ar-SA",lang:"ar-SA",localService:!0,default:!0},{name:"ko-KR",voiceURI:"ko-KR",lang:"ko-KR",localService:!0,default:!0},{name:"cs-CZ",voiceURI:"cs-CZ",lang:"cs-CZ",localService:!0,default:!0},{name:"en-ZA",voiceURI:"en-ZA",lang:"en-ZA",localService:!0,default:!0},{name:"en-AU",voiceURI:"en-AU",lang:"en-AU",localService:!0,default:!0},{name:"da-DK",voiceURI:"da-DK",lang:"da-DK",localService:!0,default:!0},{name:"en-US",voiceURI:"en-US",lang:"en-US",localService:!0,default:!0},{name:"en-IE",voiceURI:"en-IE",lang:"en-IE",localService:!0,default:!0},{name:"he-IL",voiceURI:"he-IL",lang:"he-IL",localService:!0,default:!0},{name:"hi-IN",voiceURI:"hi-IN",lang:"hi-IN",localService:!0,default:!0},{name:"el-GR",voiceURI:"el-GR",lang:"el-GR",localService:!0,default:!0},{name:"ja-JP",voiceURI:"ja-JP",lang:"ja-JP",localService:!0,default:!0}],x=[{name:"Maged",voiceURI:"com.apple.ttsbundle.Maged-compact",lang:"ar-SA",localService:!0,default:!0},{name:"Zuzana",voiceURI:"com.apple.ttsbundle.Zuzana-compact",lang:"cs-CZ",localService:!0,default:!0},{name:"Sara",voiceURI:"com.apple.ttsbundle.Sara-compact",lang:"da-DK",localService:!0,default:!0},{name:"Anna",voiceURI:"com.apple.ttsbundle.Anna-compact",lang:"de-DE",localService:!0,default:!0},{name:"Melina",voiceURI:"com.apple.ttsbundle.Melina-compact",lang:"el-GR",localService:!0,default:!0},{name:"Karen",voiceURI:"com.apple.ttsbundle.Karen-compact",lang:"en-AU",localService:!0,default:!0},{name:"Daniel",voiceURI:"com.apple.ttsbundle.Daniel-compact",lang:"en-GB",localService:!0,default:!0},{name:"Moira",voiceURI:"com.apple.ttsbundle.Moira-compact",lang:"en-IE",localService:!0,default:!0},{name:"Samantha (Enhanced)",voiceURI:"com.apple.ttsbundle.Samantha-premium",lang:"en-US",localService:!0,default:!0},{name:"Samantha",voiceURI:"com.apple.ttsbundle.Samantha-compact",lang:"en-US",localService:!0,default:!0},{name:"Tessa",voiceURI:"com.apple.ttsbundle.Tessa-compact",lang:"en-ZA",localService:!0,default:!0},{name:"Monica",voiceURI:"com.apple.ttsbundle.Monica-compact",lang:"es-ES",localService:!0,default:!0},{name:"Paulina",voiceURI:"com.apple.ttsbundle.Paulina-compact",lang:"es-MX",localService:!0,default:!0},{name:"Satu",voiceURI:"com.apple.ttsbundle.Satu-compact",lang:"fi-FI",localService:!0,default:!0},{name:"Amelie",voiceURI:"com.apple.ttsbundle.Amelie-compact",lang:"fr-CA",localService:!0,default:!0},{name:"Thomas",voiceURI:"com.apple.ttsbundle.Thomas-compact",lang:"fr-FR",localService:!0,default:!0},{name:"Carmit",voiceURI:"com.apple.ttsbundle.Carmit-compact",lang:"he-IL",localService:!0,default:!0},{name:"Lekha",voiceURI:"com.apple.ttsbundle.Lekha-compact",lang:"hi-IN",localService:!0,default:!0},{name:"Mariska",voiceURI:"com.apple.ttsbundle.Mariska-compact",lang:"hu-HU",localService:!0,default:!0},{name:"Damayanti",voiceURI:"com.apple.ttsbundle.Damayanti-compact",lang:"id-ID",localService:!0,default:!0},{name:"Alice",voiceURI:"com.apple.ttsbundle.Alice-compact",lang:"it-IT",localService:!0,default:!0},{name:"Kyoko",voiceURI:"com.apple.ttsbundle.Kyoko-compact",lang:"ja-JP",localService:!0,default:!0},{name:"Yuna",voiceURI:"com.apple.ttsbundle.Yuna-compact",lang:"ko-KR",localService:!0,default:!0},{name:"Ellen",voiceURI:"com.apple.ttsbundle.Ellen-compact",lang:"nl-BE",localService:!0,default:!0},{name:"Xander",voiceURI:"com.apple.ttsbundle.Xander-compact",lang:"nl-NL",localService:!0,default:!0},{name:"Nora",voiceURI:"com.apple.ttsbundle.Nora-compact",lang:"no-NO",localService:!0,default:!0},{name:"Zosia",voiceURI:"com.apple.ttsbundle.Zosia-compact",lang:"pl-PL",localService:!0,default:!0},{name:"Luciana",voiceURI:"com.apple.ttsbundle.Luciana-compact",lang:"pt-BR",localService:!0,default:!0},{name:"Joana",voiceURI:"com.apple.ttsbundle.Joana-compact",lang:"pt-PT",localService:!0,default:!0},{name:"Ioana",voiceURI:"com.apple.ttsbundle.Ioana-compact",lang:"ro-RO",localService:!0,default:!0},{name:"Milena",voiceURI:"com.apple.ttsbundle.Milena-compact",lang:"ru-RU",localService:!0,default:!0},{name:"Laura",voiceURI:"com.apple.ttsbundle.Laura-compact",lang:"sk-SK",localService:!0,default:!0},{name:"Alva",voiceURI:"com.apple.ttsbundle.Alva-compact",lang:"sv-SE",localService:!0,default:!0},{name:"Kanya",voiceURI:"com.apple.ttsbundle.Kanya-compact",lang:"th-TH",localService:!0,default:!0},{name:"Yelda",voiceURI:"com.apple.ttsbundle.Yelda-compact",lang:"tr-TR",localService:!0,default:!0},{name:"Ting-Ting",voiceURI:"com.apple.ttsbundle.Ting-Ting-compact",lang:"zh-CN",localService:!0,default:!0},{name:"Sin-Ji",voiceURI:"com.apple.ttsbundle.Sin-Ji-compact",lang:"zh-HK",localService:!0,default:!0},{name:"Mei-Jia",voiceURI:"com.apple.ttsbundle.Mei-Jia-compact",lang:"zh-TW",localService:!0,default:!0}];function I(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var R=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.browserSupport="speechSynthesis"in window&&"SpeechSynthesisUtterance"in window,this.synthesisVoice=null}return function(e,t,n){t&&I(e.prototype,t),n&&I(e,n)}(e,[{key:"init",value:function(e){var t=this;return new Promise(function(n,o){t.browserSupport||o("Your browser does not support Speech Synthesis"),t.splitSentences=u()(e,"splitSentences",!0);var r=u()(e,"lang"),a=u()(e,"volume"),c=u()(e,"rate"),i=u()(e,"pitch"),l=u()(e,"voice");t._loadVoices().then(function(e){r&&t.setLanguage(r),l&&t.setVoice(l),a&&t.setVolume(a),c&&t.setRate(c),i&&t.setPitch(i),n({voices:e,lang:t.lang,voice:t.voice,volume:t.volume,rate:t.rate,pitch:t.pitch,browserSupport:t.browserSupport})}).catch(o)})}},{key:"_loadVoices",value:function(){var e=this,t=function(e,t){var n=speechSynthesis.getVoices();p()(n)?t():e(n)};return new Promise(function(n,o){var r=speechSynthesis.getVoices();if(!p()(r))return n(r);void 0!==speechSynthesis.onvoiceschanged?speechSynthesis.onvoiceschanged=function(){return t(n,o)}:e._tryfallbackVoices().finally(function(){return t(n,o)})})}},{key:"_tryfallbackVoices",value:function(){var e=function(){if(/(iPhone|iPad|iPod)/.test(navigator.platform)){var e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return parseInt(e[1],10)}return!1}();return new Promise(function(t,n){setTimeout(function(){p()(speechSynthesis.getVoices())&&(e?(delete speechSynthesis.getVoices,speechSynthesis.getVoices=function(){return version>=9?x:S},t()):n())},100)})}},{key:"hasBrowserSupport",value:function(){return this.browserSupport}},{key:"setVoice",value:function(e){var t,n=speechSynthesis.getVoices();if(m()(e)&&(t=n.find(function(t){return t.name===e})),d()(e)&&(t=e),!t)throw"Error setting voice. The voice you passed is not valid or the voices have not been loaded yet.";this.synthesisVoice=t}},{key:"setLanguage",value:function(e){if(!function(e){return"string"==typeof e&&b.test(e)}(e))throw"Error setting language. Please verify your locale is BCP47 format (http://schneegans.de/lv/?tags=es-FR&format=text)";this.lang=e}},{key:"setVolume",value:function(e){if(e=parseFloat(e),!(y()(e)&&e>=0&&e<=1))throw"Error setting volume. Please verify your volume value is a number between 0 and 1.";this.volume=e}},{key:"setRate",value:function(e){if(e=parseFloat(e),!(y()(e)&&e>=0&&e<=10))throw"Error setting rate. Please verify your volume value is a number between 0 and 10.";this.rate=e}},{key:"setPitch",value:function(e){if(e=parseFloat(e),!(y()(e)&&e>=0&&e<=2))throw"Error setting pitch. Please verify your pitch value is a number between 0 and 2.";this.pitch=e}},{key:"speak",value:function(e){var t=this;return new Promise(function(n,o){var a=e.text,i=r()(a);f()(i)&&n(),t.stop();var u=t.splitSentences?function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\.+/g,".|").replace(/\?/g,"?|").replace(/\!/g,"!|").split("|").map(function(e){return r()(e)})}(i):[i];u.forEach(function(e,r){var a=r===c()(u)-1,i=new SpeechSynthesisUtterance;t.synthesisVoice&&(i.voice=t.synthesisVoice),t.lang&&(i.lang=t.lang),t.volume&&(i.volume=t.volume),t.rate&&(i.rate=t.rate),t.pitch&&(i.pitch=t.pitch),i.text=e,i.onerror=o,i.onend=function(){a&&n()},speechSynthesis.speak(i)})})}},{key:"stop",value:function(){speechSynthesis.cancel()}}]),e}(),j=function(e){var t=window.document.createElement("div"),n='<h2>Available Voices</h2><select id="languages"><option value="">autodetect language</option>';e.forEach(function(e){n+='<option value="'.concat(e.lang,'" data-name="').concat(e.name,'">').concat(e.name," (").concat(e.lang,")</option>")}),t.innerHTML=n,window.document.body.appendChild(t)};!function(){var e=new R;e.init({volume:.5,lang:"en-GB",rate:1,pitch:1}).then(function(t){console.log("Speech is ready",t),j(t.voices),function(e){var t=document.getElementById("play"),n=document.getElementById("text"),o=document.getElementById("languages");t.addEventListener("click",function(){var t=o.value,r=o.options[o.selectedIndex].dataset.name;t&&e.setLanguage(o.value),r&&e.setVoice(r),e.speak({text:n.value}).then(function(){console.log("Success !")}).catch(function(e){console.error("An error occurred :",e)})})}(e)}).catch(function(e){console.error("An error occured while initializing : ",e)});var t=e.hasBrowserSupport()?"Hurray, your browser supports speech synthesis":"Your browser does NOT support speech synthesis. Try using Chrome of Safari instead !";document.getElementById("support").innerHTML=t}()}]);
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=33)}([function(t,e,n){var r=n(19),o="object"==typeof self&&self&&self.Object===Object&&self,u=r||o||Function("return this")();t.exports=u},function(t,e,n){var r=n(62);t.exports=function(t,e,n){var o=null==t?void 0:r(t,e);return void 0===o?n:o}},function(t,e){t.exports=function(t){return null==t}},function(t,e,n){var r=n(13),o=n(35),u=n(36),i="[object Null]",c="[object Undefined]",a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?c:i:a&&a in Object(t)?o(t):u(t)}},function(t,e,n){var r=n(51),o=n(54);t.exports=function(t,e){var n=o(t,e);return r(n)?n:void 0}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){var r=n(4)(Object,"create");t.exports=r},function(t,e,n){var r=n(79);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},function(t,e,n){var r=n(84);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var r=n(18),o=n(37),u=n(39),i=n(43),c=n(44),a=n(23),s=/^\s+|\s+$/g;t.exports=function(t,e,n){if((t=a(t))&&(n||void 0===e))return t.replace(s,"");if(!t||!(e=r(e)))return t;var f=c(t),p=c(e),l=i(f,p),v=u(f,p)+1;return o(f,l,v).join("")}},function(t,e,n){var r=n(0).isFinite;t.exports=function(t){return"number"==typeof t&&r(t)}},function(t,e,n){var r=n(0).Symbol;t.exports=r},function(t,e,n){var r=n(3),o=n(6),u="[object Symbol]";t.exports=function(t){return"symbol"==typeof t||o(t)&&r(t)==u}},function(t,e,n){var r=n(3),o=n(5),u=n(6),i="[object String]";t.exports=function(t){return"string"==typeof t||!o(t)&&u(t)&&r(t)==i}},function(t,e,n){var r=n(24),o=n(25),u=n(29),i=n(15),c=n(58),a="[object Map]",s="[object Set]";t.exports=function(t){if(null==t)return 0;if(u(t))return i(t)?c(t):t.length;var e=o(t);return e==a||e==s?t.size:r(t).length}},function(t,e,n){var r=n(89)(n(93));t.exports=r},function(t,e,n){var r=n(13),o=n(20),u=n(5),i=n(14),c=1/0,a=r?r.prototype:void 0,s=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(u(e))return o(e,t)+"";if(i(e))return s?s.call(e):"";var n=e+"";return"0"==n&&1/e==-c?"-0":n}},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(34))},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}},function(t,e,n){var r=n(40),o=n(41),u=n(42);t.exports=function(t,e,n){return e==e?u(t,e,n):r(t,o,n)}},function(t,e){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return n.test(t)}},function(t,e,n){var r=n(18);t.exports=function(t){return null==t?"":r(t)}},function(t,e,n){var r=n(47),o=n(48),u=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=[];for(var n in Object(t))u.call(t,n)&&"constructor"!=n&&e.push(n);return e}},function(t,e,n){var r=n(50),o=n(28),u=n(55),i=n(56),c=n(57),a=n(3),s=n(27),f=s(r),p=s(o),l=s(u),v=s(i),h=s(c),d=a;(r&&"[object DataView]"!=d(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=d(new o)||u&&"[object Promise]"!=d(u.resolve())||i&&"[object Set]"!=d(new i)||c&&"[object WeakMap]"!=d(new c))&&(d=function(t){var e=a(t),n="[object Object]"==e?t.constructor:void 0,r=n?s(n):"";if(r)switch(r){case f:return"[object DataView]";case p:return"[object Map]";case l:return"[object Promise]";case v:return"[object Set]";case h:return"[object WeakMap]"}return e}),t.exports=d},function(t,e,n){var r=n(3),o=n(10),u="[object AsyncFunction]",i="[object Function]",c="[object GeneratorFunction]",a="[object Proxy]";t.exports=function(t){if(!o(t))return!1;var e=r(t);return e==i||e==c||e==u||e==a}},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e,n){var r=n(4)(n(0),"Map");t.exports=r},function(t,e,n){var r=n(26),o=n(30);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},function(t,e){var n=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=function(t){for(var e=-1,n=null==t?0:t.length,r=0,o=[];++e<n;){var u=t[e];u&&(o[r++]=u)}return o}},function(t,e,n){t.exports=n(105)},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(13),o=Object.prototype,u=o.hasOwnProperty,i=o.toString,c=r?r.toStringTag:void 0;t.exports=function(t){var e=u.call(t,c),n=t[c];try{t[c]=void 0;var r=!0}catch(t){}var o=i.call(t);return r&&(e?t[c]=n:delete t[c]),o}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var r=n(38);t.exports=function(t,e,n){var o=t.length;return n=void 0===n?o:n,!e&&n>=o?t:r(t,e,n)}},function(t,e){t.exports=function(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var u=Array(o);++r<o;)u[r]=t[r+e];return u}},function(t,e,n){var r=n(21);t.exports=function(t,e){for(var n=t.length;n--&&r(e,t[n],0)>-1;);return n}},function(t,e){t.exports=function(t,e,n,r){for(var o=t.length,u=n+(r?1:-1);r?u--:++u<o;)if(e(t[u],u,t))return u;return-1}},function(t,e){t.exports=function(t){return t!=t}},function(t,e){t.exports=function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}},function(t,e,n){var r=n(21);t.exports=function(t,e){for(var n=-1,o=t.length;++n<o&&r(e,t[n],0)>-1;);return n}},function(t,e,n){var r=n(45),o=n(22),u=n(46);t.exports=function(t){return o(t)?u(t):r(t)}},function(t,e){t.exports=function(t){return t.split("")}},function(t,e){var n="[\\ud800-\\udfff]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",u="[^\\ud800-\\udfff]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",c="[\\ud800-\\udbff][\\udc00-\\udfff]",a="(?:"+r+"|"+o+")"+"?",s="[\\ufe0e\\ufe0f]?"+a+("(?:\\u200d(?:"+[u,i,c].join("|")+")[\\ufe0e\\ufe0f]?"+a+")*"),f="(?:"+[u+r+"?",r,i,c,n].join("|")+")",p=RegExp(o+"(?="+o+")|"+f+s,"g");t.exports=function(t){return t.match(p)||[]}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(49)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var r=n(4)(n(0),"DataView");t.exports=r},function(t,e,n){var r=n(26),o=n(52),u=n(10),i=n(27),c=/^\[object .+?Constructor\]$/,a=Function.prototype,s=Object.prototype,f=a.toString,p=s.hasOwnProperty,l=RegExp("^"+f.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!u(t)||o(t))&&(r(t)?l:c).test(i(t))}},function(t,e,n){var r=n(53),o=function(){var t=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=function(t){return!!o&&o in t}},function(t,e,n){var r=n(0)["__core-js_shared__"];t.exports=r},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var r=n(4)(n(0),"Promise");t.exports=r},function(t,e,n){var r=n(4)(n(0),"Set");t.exports=r},function(t,e,n){var r=n(4)(n(0),"WeakMap");t.exports=r},function(t,e,n){var r=n(59),o=n(22),u=n(61);t.exports=function(t){return o(t)?u(t):r(t)}},function(t,e,n){var r=n(60)("length");t.exports=r},function(t,e){t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},function(t,e){var n="[\\ud800-\\udfff]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",u="[^\\ud800-\\udfff]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",c="[\\ud800-\\udbff][\\udc00-\\udfff]",a="(?:"+r+"|"+o+")"+"?",s="[\\ufe0e\\ufe0f]?"+a+("(?:\\u200d(?:"+[u,i,c].join("|")+")[\\ufe0e\\ufe0f]?"+a+")*"),f="(?:"+[u+r+"?",r,i,c,n].join("|")+")",p=RegExp(o+"(?="+o+")|"+f+s,"g");t.exports=function(t){for(var e=p.lastIndex=0;p.test(t);)++e;return e}},function(t,e,n){var r=n(63),o=n(88);t.exports=function(t,e){for(var n=0,u=(e=r(e,t)).length;null!=t&&n<u;)t=t[o(e[n++])];return n&&n==u?t:void 0}},function(t,e,n){var r=n(5),o=n(64),u=n(65),i=n(23);t.exports=function(t,e){return r(t)?t:o(t,e)?[t]:u(i(t))}},function(t,e,n){var r=n(5),o=n(14),u=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!o(t))||i.test(t)||!u.test(t)||null!=e&&t in Object(e)}},function(t,e,n){var r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,u=n(66)(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(r,function(t,n,r,u){e.push(r?u.replace(o,"$1"):n||t)}),e});t.exports=u},function(t,e,n){var r=n(67),o=500;t.exports=function(t){var e=r(t,function(t){return n.size===o&&n.clear(),t}),n=e.cache;return e}},function(t,e,n){var r=n(68),o="Expected a function";function u(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(o);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],u=n.cache;if(u.has(o))return u.get(o);var i=t.apply(this,r);return n.cache=u.set(o,i)||u,i};return n.cache=new(u.Cache||r),n}u.Cache=r,t.exports=u},function(t,e,n){var r=n(69),o=n(83),u=n(85),i=n(86),c=n(87);function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=u,a.prototype.has=i,a.prototype.set=c,t.exports=a},function(t,e,n){var r=n(70),o=n(76),u=n(28);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(u||o),string:new r}}},function(t,e,n){var r=n(71),o=n(72),u=n(73),i=n(74),c=n(75);function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=u,a.prototype.has=i,a.prototype.set=c,t.exports=a},function(t,e,n){var r=n(7);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,n){var r=n(7),o="__lodash_hash_undefined__",u=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return n===o?void 0:n}return u.call(e,t)?e[t]:void 0}},function(t,e,n){var r=n(7),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:o.call(e,t)}},function(t,e,n){var r=n(7),o="__lodash_hash_undefined__";t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?o:e,this}},function(t,e,n){var r=n(77),o=n(78),u=n(80),i=n(81),c=n(82);function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=u,a.prototype.has=i,a.prototype.set=c,t.exports=a},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,n){var r=n(8),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0||(n==e.length-1?e.pop():o.call(e,n,1),--this.size,0))}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,n){var r=n(8);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},function(t,e,n){var r=n(8);t.exports=function(t){return r(this.__data__,t)>-1}},function(t,e,n){var r=n(8);t.exports=function(t,e){var n=this.__data__,o=r(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}},function(t,e,n){var r=n(9);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,n){var r=n(9);t.exports=function(t){return r(this,t).get(t)}},function(t,e,n){var r=n(9);t.exports=function(t){return r(this,t).has(t)}},function(t,e,n){var r=n(9);t.exports=function(t,e){var n=r(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this}},function(t,e,n){var r=n(14),o=1/0;t.exports=function(t){if("string"==typeof t||r(t))return t;var e=t+"";return"0"==e&&1/t==-o?"-0":e}},function(t,e,n){var r=n(90),o=n(25),u=n(91),i=n(92),c="[object Map]",a="[object Set]";t.exports=function(t){return function(e){var n=o(e);return n==c?u(e):n==a?i(e):r(e,t(e))}}},function(t,e,n){var r=n(20);t.exports=function(t,e){return r(e,function(e){return[e,t[e]]})}},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}},function(t,e,n){var r=n(94),o=n(24),u=n(29);t.exports=function(t){return u(t)?r(t):o(t)}},function(t,e,n){var r=n(95),o=n(96),u=n(5),i=n(98),c=n(100),a=n(101),s=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=u(t),f=!n&&o(t),p=!n&&!f&&i(t),l=!n&&!f&&!p&&a(t),v=n||f||p||l,h=v?r(t.length,String):[],d=h.length;for(var y in t)!e&&!s.call(t,y)||v&&("length"==y||p&&("offset"==y||"parent"==y)||l&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||c(y,d))||h.push(y);return h}},function(t,e){t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},function(t,e,n){var r=n(97),o=n(6),u=Object.prototype,i=u.hasOwnProperty,c=u.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(t){return o(t)&&i.call(t,"callee")&&!c.call(t,"callee")};t.exports=a},function(t,e,n){var r=n(3),o=n(6),u="[object Arguments]";t.exports=function(t){return o(t)&&r(t)==u}},function(t,e,n){(function(t){var r=n(0),o=n(99),u="object"==typeof e&&e&&!e.nodeType&&e,i=u&&"object"==typeof t&&t&&!t.nodeType&&t,c=i&&i.exports===u?r.Buffer:void 0,a=(c?c.isBuffer:void 0)||o;t.exports=a}).call(this,n(31)(t))},function(t,e){t.exports=function(){return!1}},function(t,e){var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var o=typeof t;return!!(e=null==e?n:e)&&("number"==o||"symbol"!=o&&r.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e,n){var r=n(102),o=n(103),u=n(104),i=u&&u.isTypedArray,c=i?o(i):r;t.exports=c},function(t,e,n){var r=n(3),o=n(30),u=n(6),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(t){return u(t)&&o(t.length)&&!!i[r(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){(function(t){var r=n(19),o="object"==typeof e&&e&&!e.nodeType&&e,u=o&&"object"==typeof t&&t&&!t.nodeType&&t,i=u&&u.exports===o&&r.process,c=function(){try{var t=u&&u.require&&u.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=c}).call(this,n(31)(t))},function(t,e,n){"use strict";n.r(e);var r=n(11),o=n.n(r),u=n(16),i=n.n(u),c=n(1),a=n.n(c),s=n(17),f=n.n(s),p=n(2),l=n.n(p),v=n(10),h=n.n(v),d=n(15),y=n.n(d),b=n(12),g=n.n(b),x=n(32),j=n.n(x),m=/^(?:(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))$|^((?:[a-z]{2,3}(?:(?:-[a-z]{3}){1,3})?)|[a-z]{4}|[a-z]{5,8})(?:-([a-z]{4}))?(?:-([a-z]{2}|\d{3}))?((?:-(?:[\da-z]{5,8}|\d[\da-z]{3}))*)?((?:-[\da-wy-z](?:-[\da-z]{2,8})+)*)?(-x(?:-[\da-z]{1,8})+)?$|^(x(?:-[\da-z]{1,8})+)$/i;function _(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,u=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,u=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw u}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var S=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.browserSupport="speechSynthesis"in window&&"SpeechSynthesisUtterance"in window,this.synthesisVoice=null}return function(t,e,n){e&&w(t.prototype,e),n&&w(t,n)}(t,[{key:"init",value:function(t){var e=this;return new Promise(function(n,r){e.browserSupport||r("Your browser does not support Speech Synthesis");var o=a()(t,"listeners",{}),u=a()(t,"splitSentences",!0),i=a()(t,"lang"),c=a()(t,"volume",1),s=a()(t,"rate",1),p=a()(t,"pitch",1),v=a()(t,"voice");f()(o).forEach(function(t){var e=_(t,2),n=e[0],r=e[1];"onvoiceschanged"!==n&&(speechSynthesis[n]=function(t){r&&r(t)})}),e._loadVoices().then(function(t){o.onvoiceschanged&&o.onvoiceschanged(t),!l()(i)&&e.setLanguage(i),!l()(v)&&e.setVoice(v),!l()(c)&&e.setVolume(c),!l()(s)&&e.setRate(s),!l()(p)&&e.setPitch(p),!l()(u)&&e.setSplitSentences(u),n({voices:t,lang:e.lang,voice:e.voice,volume:e.volume,rate:e.rate,pitch:e.pitch,splitSentences:e.splitSentences,browserSupport:e.browserSupport})}).catch(function(){r()})})}},{key:"_fetchVoices",value:function(){return new Promise(function(t,e){setTimeout(function(){var n=speechSynthesis.getVoices();return i()(n)>0?t(n):e()},100)})}},{key:"_loadVoices",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._fetchVoices().catch(function(n){if(0===e)throw n;return t._loadVoices(e-1)})}},{key:"hasBrowserSupport",value:function(){return this.browserSupport}},{key:"setVoice",value:function(t){var e,n=speechSynthesis.getVoices();if(y()(t)&&(e=n.find(function(e){return e.name===t})),h()(t)&&(e=t),!e)throw"Error setting voice. The voice you passed is not valid or the voices have not been loaded yet.";this.synthesisVoice=e}},{key:"setLanguage",value:function(t){if(!function(t){return"string"==typeof t&&m.test(t)}(t=t.replace("_","-")))throw"Error setting language. Please verify your locale is BCP47 format (http://schneegans.de/lv/?tags=es-FR&format=text)";this.lang=t}},{key:"setVolume",value:function(t){if(t=parseFloat(t),!(g()(t)&&t>=0&&t<=1))throw"Error setting volume. Please verify your volume value is a number between 0 and 1.";this.volume=t}},{key:"setRate",value:function(t){if(t=parseFloat(t),!(g()(t)&&t>=0&&t<=10))throw"Error setting rate. Please verify your volume value is a number between 0 and 10.";this.rate=t}},{key:"setPitch",value:function(t){if(t=parseFloat(t),!(g()(t)&&t>=0&&t<=2))throw"Error setting pitch. Please verify your pitch value is a number between 0 and 2.";this.pitch=t}},{key:"setSplitSentences",value:function(t){this.splitSentences=t}},{key:"speak",value:function(t){var e=this;return new Promise(function(n,r){var u=t.text,c=t.listeners,a=void 0===c?{}:c,s=t.queue,p=void 0===s||s,v=o()(u);l()(v)&&n(),!p&&e.cancel();var h=[],d=e.splitSentences?function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return j()(t.replace(/\.+/g,".|").replace(/\?/g,"?|").replace(/\!/g,"!|").split("|").map(function(t){return o()(t)}))}(v):[v];d.forEach(function(t,o){var u=o===i()(d)-1,c=new SpeechSynthesisUtterance;e.synthesisVoice&&(c.voice=e.synthesisVoice),e.lang&&(c.lang=e.lang),e.volume&&(c.volume=e.volume),e.rate&&(c.rate=e.rate),e.pitch&&(c.pitch=e.pitch),c.text=t,f()(a).forEach(function(t){var e=_(t,2),o=e[0],i=e[1];c[o]=function(t){i&&i(t),"onerror"===o&&r({utterances:h,lastUtterance:c,error:t}),"onend"===o&&u&&n({utterances:h,lastUtterance:c})}}),h.push(c),speechSynthesis.speak(c)})})}},{key:"pending",value:function(){return speechSynthesis.pending}},{key:"paused",value:function(){return speechSynthesis.paused}},{key:"speaking",value:function(){return speechSynthesis.speaking}},{key:"pause",value:function(){speechSynthesis.pause()}},{key:"resume",value:function(){speechSynthesis.resume()}},{key:"cancel",value:function(){speechSynthesis.cancel()}}]),t}(),O=function(t){var e=window.document.createElement("div"),n='<h2>Available Voices</h2><select id="languages"><option value="">autodetect language</option>';t.forEach(function(t){n+='<option value="'.concat(t.lang,'" data-name="').concat(t.name,'">').concat(t.name," (").concat(t.lang,")</option>")}),e.innerHTML=n,window.document.body.appendChild(e)};!function(){var t=new S;t.init({volume:.5,lang:"en-GB",rate:1,pitch:1,listeners:{onvoiceschanged:function(t){console.log("Voices changed",t)}}}).then(function(e){console.log("Speech is ready",e),O(e.voices),function(t){var e=document.getElementById("play"),n=document.getElementById("pause"),r=document.getElementById("resume"),o=document.getElementById("text"),u=document.getElementById("languages");e.addEventListener("click",function(){var e=u.value,n=u.options[u.selectedIndex].dataset.name;e&&t.setLanguage(u.value),n&&t.setVoice(n),t.speak({text:o.value,queue:!1,listeners:{onstart:function(){console.log("Start utterance")},onend:function(){console.log("End utterance")},onresume:function(){console.log("Resume utterance")},onboundary:function(t){console.log(t.name+" boundary reached after "+t.elapsedTime+" milliseconds.")}}}).then(function(t){console.log("Success !",t)}).catch(function(t){console.error("An error occurred :",t)})}),n.addEventListener("click",function(){t.pause()}),r.addEventListener("click",function(){t.resume()})}(t)}).catch(function(t){console.error("An error occured while initializing : ",t)});var e=t.hasBrowserSupport()?"Hurray, your browser supports speech synthesis":"Your browser does NOT support speech synthesis. Try using Chrome of Safari instead !";document.getElementById("support").innerHTML=e}()}]);

@@ -21,3 +21,8 @@ import Speech from '../src/speak-tts.js'

//'voice':'Google UK English Male',
//'splitSentences': false
//'splitSentences': false,
'listeners': {
'onvoiceschanged': (voices) => {
console.log("Voices changed", voices)
}
}
}).then((data) => {

@@ -36,2 +41,4 @@ console.log("Speech is ready", data)

const speakButton = document.getElementById('play')
const pauseButton = document.getElementById('pause')
const resumeButton = document.getElementById('resume')
const textarea = document.getElementById('text')

@@ -46,4 +53,19 @@ const languages = document.getElementById('languages')

text: textarea.value,
}).then(() => {
console.log("Success !")
queue: false,
listeners: {
onstart: () => {
console.log("Start utterance")
},
onend: () => {
console.log("End utterance")
},
onresume: () => {
console.log("Resume utterance")
},
onboundary: (event) => {
console.log(event.name + ' boundary reached after ' + event.elapsedTime + ' milliseconds.')
}
}
}).then((data) => {
console.log("Success !", data)
}).catch(e => {

@@ -53,4 +75,12 @@ console.error("An error occurred :", e)

})
pauseButton.addEventListener('click', () => {
speech.pause()
})
resumeButton.addEventListener('click', () => {
speech.resume()
})
}
_init()

@@ -14,6 +14,6 @@ "use strict";

var _toPairs = _interopRequireDefault(require("lodash/toPairs"));
var _isNil = _interopRequireDefault(require("lodash/isNil"));
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
var _isObject = _interopRequireDefault(require("lodash/isObject"));

@@ -27,6 +27,12 @@

var _ios = require("./ios");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -58,16 +64,34 @@

_this.splitSentences = (0, _get.default)(conf, 'splitSentences', true);
var listeners = (0, _get.default)(conf, 'listeners', {});
var splitSentences = (0, _get.default)(conf, 'splitSentences', true);
var lang = (0, _get.default)(conf, 'lang');
var volume = (0, _get.default)(conf, 'volume');
var rate = (0, _get.default)(conf, 'rate');
var pitch = (0, _get.default)(conf, 'pitch');
var voice = (0, _get.default)(conf, 'voice');
var volume = (0, _get.default)(conf, 'volume', 1);
var rate = (0, _get.default)(conf, 'rate', 1);
var pitch = (0, _get.default)(conf, 'pitch', 1);
var voice = (0, _get.default)(conf, 'voice'); // Attach event listeners
(0, _toPairs.default)(listeners).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
listener = _ref2[0],
fn = _ref2[1];
var newListener = function newListener(data) {
fn && fn(data);
};
if (listener !== 'onvoiceschanged') {
speechSynthesis[listener] = newListener;
}
});
_this._loadVoices().then(function (voices) {
// Initialize values if necessary
lang && _this.setLanguage(lang);
voice && _this.setVoice(voice);
volume && _this.setVolume(volume);
rate && _this.setRate(rate);
pitch && _this.setPitch(pitch);
// Handle callback onvoiceschanged by hand
listeners['onvoiceschanged'] && listeners['onvoiceschanged'](voices); // Initialize values if necessary
!(0, _isNil.default)(lang) && _this.setLanguage(lang);
!(0, _isNil.default)(voice) && _this.setVoice(voice);
!(0, _isNil.default)(volume) && _this.setVolume(volume);
!(0, _isNil.default)(rate) && _this.setRate(rate);
!(0, _isNil.default)(pitch) && _this.setPitch(pitch);
!(0, _isNil.default)(splitSentences) && _this.setSplitSentences(splitSentences);
resolve({

@@ -80,62 +104,21 @@ voices: voices,

pitch: _this.pitch,
splitSentences: _this.splitSentences,
browserSupport: _this.browserSupport
});
}).catch(reject);
});
}
}, {
key: "_loadVoices",
value: function _loadVoices() {
var _this2 = this;
var handlePromise = function handlePromise(resolve, reject) {
var voices = speechSynthesis.getVoices();
if ((0, _isEmpty.default)(voices)) {
}).catch(function () {
reject();
} else {
resolve(voices);
}
};
return new Promise(function (resolve, reject) {
// If voices are already there, nothing to do
var voices = speechSynthesis.getVoices();
if (!(0, _isEmpty.default)(voices)) {
return resolve(voices);
} // Async loading of voices
if (speechSynthesis.onvoiceschanged !== undefined) {
speechSynthesis.onvoiceschanged = function () {
return handlePromise(resolve, reject);
};
} else {
_this2._tryfallbackVoices().finally(function () {
return handlePromise(resolve, reject);
});
}
});
});
}
}, {
key: "_tryfallbackVoices",
value: function _tryfallbackVoices() {
// Try with a timeout
var iosVersion = (0, _ios.iOSversion)();
key: "_fetchVoices",
value: function _fetchVoices() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
// Sometimes IOS has no voice (bug), so we try to use cached voices instead
if ((0, _isEmpty.default)(speechSynthesis.getVoices())) {
if (iosVersion) {
delete speechSynthesis.getVoices;
var voices = speechSynthesis.getVoices();
speechSynthesis.getVoices = function () {
return version >= 9 ? _ios.iOS9voices : _ios.iOS8voices;
};
resolve();
} else {
reject();
}
if ((0, _size.default)(voices) > 0) {
return resolve(voices);
} else {
return reject();
}

@@ -146,2 +129,13 @@ }, 100);

}, {
key: "_loadVoices",
value: function _loadVoices() {
var _this2 = this;
var remainingAttempts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
return this._fetchVoices().catch(function (error) {
if (remainingAttempts === 0) throw error;
return _this2._loadVoices(remainingAttempts - 1);
});
}
}, {
key: "hasBrowserSupport",

@@ -177,2 +171,4 @@ value: function hasBrowserSupport() {

value: function setLanguage(lang) {
lang = lang.replace('_', '-'); // some Android versions seem to ignore BCP 47 and use an underscore character in language tag
if ((0, _utils.validateLocale)(lang)) {

@@ -218,2 +214,7 @@ this.lang = lang;

}, {
key: "setSplitSentences",
value: function setSplitSentences(splitSentences) {
this.splitSentences = splitSentences;
}
}, {
key: "speak",

@@ -224,9 +225,13 @@ value: function speak(data) {

return new Promise(function (resolve, reject) {
var text = data.text;
var text = data.text,
_data$listeners = data.listeners,
listeners = _data$listeners === void 0 ? {} : _data$listeners,
_data$queue = data.queue,
queue = _data$queue === void 0 ? true : _data$queue;
var msg = (0, _trim.default)(text);
if ((0, _isNil.default)(msg)) resolve(); // Stop current speech
_this3.stop(); // Split into sentences (for better result and bug with some versions of chrome)
!queue && _this3.cancel(); // Split into sentences (for better result and bug with some versions of chrome)
var utterances = [];
var sentences = _this3.splitSentences ? (0, _utils.splitSentences)(msg) : [msg];

@@ -244,9 +249,31 @@ sentences.forEach(function (sentence, index) {

utterance.text = sentence;
utterance.onerror = reject;
utterance.text = sentence; // Attach event listeners
utterance.onend = function () {
if (isLast) resolve();
};
(0, _toPairs.default)(listeners).forEach(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
listener = _ref4[0],
fn = _ref4[1];
var newListener = function newListener(data) {
fn && fn(data);
if (listener === 'onerror') {
reject({
utterances: utterances,
lastUtterance: utterance,
error: data
});
}
if (listener === 'onend') {
if (isLast) resolve({
utterances: utterances,
lastUtterance: utterance
});
}
};
utterance[listener] = newListener;
});
utterances.push(utterance);
speechSynthesis.speak(utterance);

@@ -257,4 +284,29 @@ });

}, {
key: "stop",
value: function stop() {
key: "pending",
value: function pending() {
return speechSynthesis.pending;
}
}, {
key: "paused",
value: function paused() {
return speechSynthesis.paused;
}
}, {
key: "speaking",
value: function speaking() {
return speechSynthesis.speaking;
}
}, {
key: "pause",
value: function pause() {
speechSynthesis.pause();
}
}, {
key: "resume",
value: function resume() {
speechSynthesis.resume();
}
}, {
key: "cancel",
value: function cancel() {
speechSynthesis.cancel();

@@ -261,0 +313,0 @@ }

@@ -10,2 +10,4 @@ "use strict";

var _compact = _interopRequireDefault(require("lodash/compact"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -15,5 +17,5 @@

var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return text.replace(/\.+/g, '.|').replace(/\?/g, '?|').replace(/\!/g, '!|').split("|").map(function (sentence) {
return (0, _compact.default)(text.replace(/\.+/g, '.|').replace(/\?/g, '?|').replace(/\!/g, '!|').split("|").map(function (sentence) {
return (0, _trim.default)(sentence);
});
}));
};

@@ -20,0 +22,0 @@

{
"name": "speak-tts",
"version": "2.0.4",
"version": "2.0.5",
"description": "Browser TTS (using Web speech API) made easy",

@@ -24,3 +24,3 @@ "main": "lib/speak-tts.js",

],
"license": "ISC",
"license": "MIT",
"devDependencies": {

@@ -27,0 +27,0 @@ "@babel/cli": "^7.1.2",

@@ -12,8 +12,11 @@ Speech synthesis made easy - Browser based text to speech (TTS)

Speech synthesis (tts) for the browser. Based on browser Web speech API (https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API), it improves it by :
- providing a Promise-base API (the init() and speak() methods respectively returns a Promise)
Speech synthesis (tts) for the browser. Wrapping the browser Speech Synthesis API (https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis) and providing a similar interface, it improves it by :
- giving a Promise-base API (the init() and speak() methods respectively returns a Promise)
-> init() get resolved once voices are loaded
-> speak() get resolved once the full text has been spoken
- handling the fact that Chrome load voices in an asynchronous manner when others browsers don't
-> onvoicesloaded listener gets triggered in all browsers
- handling some quirks and bugs of IOS/android devices and some chrome/firefox versions
- splitting sentences into several speeches to make it sound more natural (can be disabled)
- throwing specific exceptions: explicit exceptions will be thrown if you pass parameters with incompatible values to any of the methods
- splitting sentences into several speeches to make it sound more natural, especially for older versions of Chrome (can be disabled)
- throwing specific exceptions: explicit exceptions will be thrown if you pass parameters with incompatible values to any of the methods

@@ -62,5 +65,6 @@ Work in Chrome, opera and Safari (including ios8 and ios9 devices). Tested successfully on Ipad and Android.

- voice : the voice to use // default is chosen by your browser if not provided
- rate // default is determined by your browser if not provided (=1)
- pitch // default is chosen by your browser if not provided (=1)
- rate // default 1
- pitch // default 1
- splitSentences // default true
- listeners // object of listeners to attach to the SpeechSynthesis object

@@ -70,3 +74,3 @@ ```javascript

Speech.init({
'volume': 0.5,
'volume': 1,
'lang': 'en-GB',

@@ -76,3 +80,8 @@ 'rate': 1,

'voice':'Google UK English Male',
'splitSentences': true
'splitSentences': true,
'listeners': {
'onvoiceschanged': (voices) => {
console.log("Event voiceschanged", voices)
}
}
})

@@ -93,2 +102,34 @@ ```

You can pass the following properties to the speak function:
- text: text to be spoken
- queue // default true: if set to false, the current speech utterance will be interrupted
- listeners // object of listeners to attach to the SpeechSynthesisUtterance (see list on https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance)
Read a text (example with all params):
```javascript
speech.speak({
text: 'Hello, how are you today ?',
queue: false // current speech will be interrupted,
listeners: {
onstart: () => {
console.log("Start utterance")
},
onend: () => {
console.log("End utterance")
},
onresume: () => {
console.log("Resume utterance")
},
onboundary: (event) => {
console.log(event.name + ' boundary reached after ' + event.elapsedTime + ' milliseconds.')
}
}
}).then(() => {
console.log("Success !")
}).catch(e => {
console.error("An error occurred :", e)
})
```
Set language (note that the language must be supported by the client browser) :

@@ -118,10 +159,46 @@

Stop talking in progress:
Set the pitch :
```javascript
Speech.stop()
Speech.setPitch(1)
```
## Supported languages (list might not be up to date)
Pause talking in progress:
```javascript
Speech.pause()
```
Resume talking in progress:
```javascript
Speech.resume()
```
Cancel talking in progress:
```javascript
Speech.cancel()
```
Get boolean indicating if the utterance queue contains as-yet-unspoken utterances:
```javascript
Speech.pending()
```
Get boolean indicating if talking is paused:
```javascript
Speech.paused()
```
Get boolean indicating if talking is in progress:
```javascript
Speech.speaking()
```
## Supported languages (list may be incomplete and depends on your browser)
```
ar-SA

@@ -170,72 +247,2 @@ cs-CZ

## Supported Voices (list might not be up to date)
```
Alex
Alice
Alva
Amelie
Anna
Carmit
Damayanti
Daniel
Diego
Ellen
Fiona
Fred
Ioana
Joana
Jorge
Juan
Kanya
Karen
Kyoko
Laura
Lekha
Luca
Luciana
Maged
Mariska
Mei-Jia
Melina
Milena
Moira
Monica
Nora
Paulina
Samantha
Sara
Satu
Sin-ji
Tessa
Thomas
Ting-Ting
Veena
Victoria
Xander
Yelda
Yuna
Yuri
Zosia
Zuzana
Google Deutsch
Google US English
Google UK English Female
Google UK English Male
Google español
Google español de Estados Unidos
Google français
Google हिन्दी
Google Bahasa Indonesia
Google italiano
Google 日本語
Google 한국의
Google Nederlands
Google polski
Google português do Brasil
Google русский
Google 普通话(中国大陆)
Google 粤語(香港)
Google 國語(臺灣)
```
## Tests

@@ -242,0 +249,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc