@huluvu424242/honey-slideshow
Version:
Text to Speech component wich is reading texts from DOM elements.
1,253 lines • 141 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { r as registerInstance, h, g as getElement } from './index-a2883912.js';
import { I as IonicSafeString } from './index-dbc17a36.js';
var IMG_START = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m954.5431 670.8872l-812.8905 -308.69644l818.3474 -304.63376l-5.456909 89.36221l-561.92786 215.27156l567.38477 219.33426z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m954.5431 670.8872l-812.8905 -308.69644l818.3474 -304.63376l-5.456909 89.36221l-561.92786 215.27156l567.38477 219.33426z"\n' +
' fill-rule="evenodd"/>\n' +
' <path fill="#000000" d="m141.67947 720.0l-141.6693 0l0 -720.0l141.6693 0z" fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m141.67947 720.0l-141.6693 0l0 -720.0l141.6693 0z" fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var IMG_FASTREWIND = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m956.60803 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8512573 104.90401l-396.59186 252.71136l400.4431 257.48062z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m956.60803 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8512573 104.90401l-396.59186 252.71136l400.4431 257.48062z"\n' +
' fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m574.16724 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8513184 104.90401l-396.59186 252.71136l400.44318 257.48062z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m574.16724 718.49603l-573.71375 -362.3846l577.56506 -357.61536l-3.8513184 104.90401l-396.59186 252.71136l400.44318 257.48062z"\n' +
' fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var IMG_REWIND = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m951.5988 722.2808l-951.6064 -364.2935l957.99445 -359.49908l-6.3880615 105.45658l-657.81824 254.04251l664.2063 258.83694z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m951.5988 722.2808l-951.6064 -364.2935l957.99445 -359.49908l-6.3880615 105.45658l-657.81824 254.04251l664.2063 258.83694z"\n' +
' fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var IMG_PLAY = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000" d="m-0.007874016 0l958.3937 360.86615l-958.3937 360.86615z" fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m-0.007874016 0l958.3937 360.86615l-958.3937 360.86615z" fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var IMG_PAUSE = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000" d="m198.31253 1.2073491l192.50394 0l0 720.0l-192.50394 0z" fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m198.31253 1.2073491l192.50394 0l0 720.0l-192.50394 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000" d="m550.7434 1.2073491l192.50397 0l0 720.0l-192.50397 0z" fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m550.7434 1.2073491l192.50397 0l0 720.0l-192.50397 0z" fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var IMG_FOREWARD = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m6.4014697 -1.503937l953.6023 362.38464l-960.0038 357.6154l6.4014697 -104.90405l659.1979 -252.71133l-665.59937 -257.48065z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m6.4014697 -1.503937l953.6023 362.38464l-960.0038 357.6154l6.4014697 -104.90405l659.1979 -252.71133l-665.59937 -257.48065z"\n' +
' fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var IMG_FASTFOREWARD = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m3.8513029 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8513029 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m3.8513029 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8513029 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' +
' fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m386.29053 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8512878 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m386.29053 -1.503937l573.71375 362.38464l-577.56506 357.6154l3.8512878 -104.90405l396.59186 -252.71133l-400.44315 -257.48065z"\n' +
' fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var IMG_END = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000"\n' +
' d="m5.486655 49.11279l817.3259 308.69644l-822.81256 304.63376l5.486655 -89.36218l564.99396 -215.27158l-570.4806 -219.33423z"\n' +
' fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m5.486655 49.11279l817.3259 308.69644l-822.81256 304.63376l5.486655 -89.36218l564.99396 -215.27158l-570.4806 -219.33423z"\n' +
' fill-rule="evenodd"/>\n' +
' <path fill="#000000" d="m822.78174 0l142.45667 0l0 720.0l-142.45667 0z" fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m822.78174 0l142.45667 0l0 720.0l-142.45667 0z" fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>\n';
var IMG_STOP = '<svg version="1.1" viewBox="0.0 0.0 960.0 720.0" fill="none" stroke="none" stroke-linecap="square"\n' +
' stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">\n' +
' <clipPath id="p.0">\n' +
' <path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/>\n' +
' </clipPath>\n' +
' <g clip-path="url(#p.0)">\n' +
' <path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/>\n' +
' <path fill="#000000" d="m198.312 1.2073491l544.9449 0l0 720.0l-544.9449 0z" fill-rule="evenodd"/>\n' +
' <path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt"\n' +
' d="m198.312 1.2073491l544.9449 0l0 720.0l-544.9449 0z" fill-rule="evenodd"/>\n' +
' </g>\n' +
'</svg>';
var Logger = /** @class */ (function () {
function Logger() {
}
Logger.logMessage = function (message) {
console.log(message);
};
Logger.debugMessage = function (message) {
console.debug(message);
};
Logger.errorMessage = function (message) {
console.error(message);
};
Logger.infoMessage = function (message) {
console.info(message);
};
return Logger;
}());
var Sprachausgabe = /** @class */ (function () {
function Sprachausgabe(sprachSynthese, sprachauswahl, vorleserCallbacks) {
this.sprachSynthese = sprachSynthese;
this.sprachauswahl = sprachauswahl;
this.vorleserCallbacks = vorleserCallbacks;
Logger.infoMessage("####constructor finished");
}
Sprachausgabe.prototype.initialisiereVorleserStimme = function (vorleser) {
Logger.infoMessage("erzeugeVorleser started");
vorleser.pitch = this.sprachauswahl.getPitch();
vorleser.rate = this.sprachauswahl.getRate();
vorleser.volume = this.sprachauswahl.getVolume();
vorleser.voice = this.sprachauswahl.getVoice();
if (vorleser.voice && vorleser.voice.lang) {
vorleser.lang = vorleser.voice.lang;
}
else {
vorleser.lang = "de-DE";
}
};
Sprachausgabe.prototype.erzeugeVorleser = function (text) {
var _this = this;
var vorleser = new SpeechSynthesisUtterance(text);
if (this.vorleserCallbacks) {
vorleser.onend = function () {
Logger.debugMessage("Vorlesen beendet");
if (_this.vorleserCallbacks.onend) {
_this.vorleserCallbacks.onend();
}
};
vorleser.onstart = function () {
Logger.debugMessage("Vorlesen gestartet");
if (_this.vorleserCallbacks.onstart) {
_this.vorleserCallbacks.onstart();
}
};
vorleser.onpause = function () {
Logger.debugMessage("Pause mit Vorlesen");
if (_this.vorleserCallbacks.onpause) {
_this.vorleserCallbacks.onpause();
}
};
vorleser.onresume = function () {
Logger.debugMessage("Fortsetzen des Vorlesen");
if (_this.vorleserCallbacks.onresume) {
_this.vorleserCallbacks.onresume();
}
};
vorleser.onerror = function () {
Logger.errorMessage("Fehler beim Vorlesen");
if (_this.vorleserCallbacks.onerror) {
_this.vorleserCallbacks.onerror();
}
};
}
this.initialisiereVorleserStimme(vorleser);
return vorleser;
};
Sprachausgabe.prototype.textVorlesen = function (zuLesenderText) {
var _this = this;
if (zuLesenderText) {
// Auftrennung in Textblöcken nach Sprachen.
// const texte: string[] = zuLesenderText.match(/(\S+[\s.]){1,20}/g);
var texte = [zuLesenderText];
texte.forEach(function (text) {
var vorleser = _this.erzeugeVorleser(text);
Logger.infoMessage("speaker lang used:" + vorleser.lang);
if (vorleser.voice) {
Logger.infoMessage("speaker voice used:" + vorleser.voice.name);
Logger.infoMessage("speaker voice lang:" + vorleser.voice.lang);
}
else {
Logger.infoMessage("no voice matched for text: " + zuLesenderText);
}
_this.sprachSynthese.getSynthese().speak(vorleser);
});
}
};
Sprachausgabe.prototype.cancelSpeakingAndClearQueue = function () {
this.sprachSynthese.getSynthese().cancel();
};
Sprachausgabe.prototype.pauseSpeakingFromQueue = function () {
this.sprachSynthese.getSynthese().pause();
};
Sprachausgabe.prototype.resumeSpeakingFromQueue = function () {
this.sprachSynthese.getSynthese().resume();
};
Sprachausgabe.prototype.isPaused = function () {
return this.sprachSynthese.getSynthese().paused;
};
return Sprachausgabe;
}());
var Sprachauswahl = /** @class */ (function () {
function Sprachauswahl(sprachsynthese) {
Logger.infoMessage("create Sprachauswahl");
this.sprachSynthese = sprachsynthese;
this.rate = 1;
this.volume = 1;
this.pitch = 1;
this.initDefaultStimme();
}
Sprachauswahl.prototype.initDefaultStimme = function () {
var voices = this.sprachSynthese.getVoices();
if (!voices) {
var voicesRetry = this.sprachSynthese.getVoices();
this.voice = voicesRetry[0];
}
else {
this.voice = voices[0];
}
};
Sprachauswahl.prototype.getRate = function () {
return this.rate;
};
Sprachauswahl.prototype.getVolume = function () {
return this.volume;
};
Sprachauswahl.prototype.getPitch = function () {
return this.pitch;
};
Sprachauswahl.prototype.getVoice = function () {
return this.voice;
};
Sprachauswahl.prototype.getVoiceList = function () {
return this.sprachSynthese.getVoices();
};
Sprachauswahl.prototype.setChoosenVoice = function (voice) {
this.voice = voice;
};
Sprachauswahl.prototype.setVolume = function (volume) {
this.volume = volume;
};
Sprachauswahl.prototype.setRate = function (rate) {
this.rate = rate;
};
Sprachauswahl.prototype.setPitch = function (pitch) {
this.pitch = pitch;
};
return Sprachauswahl;
}());
function isFunction(x) {
return typeof x === 'function';
}
var _enable_super_gross_mode_that_will_cause_bad_things = false;
var config = {
Promise: undefined,
set useDeprecatedSynchronousErrorHandling(value) {
if (value) {
var error = new Error();
console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
}
else if (_enable_super_gross_mode_that_will_cause_bad_things) {
console.log('RxJS: Back to a better error behavior. Thank you. <3');
}
_enable_super_gross_mode_that_will_cause_bad_things = value;
},
get useDeprecatedSynchronousErrorHandling() {
return _enable_super_gross_mode_that_will_cause_bad_things;
},
};
function hostReportError(err) {
setTimeout(function () { throw err; }, 0);
}
var empty = {
closed: true,
next: function (value) { },
error: function (err) {
if (config.useDeprecatedSynchronousErrorHandling) {
throw err;
}
else {
hostReportError(err);
}
},
complete: function () { }
};
var isArray = (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
function isObject(x) {
return x !== null && typeof x === 'object';
}
var UnsubscriptionErrorImpl = (function () {
function UnsubscriptionErrorImpl(errors) {
Error.call(this);
this.message = errors ?
errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '';
this.name = 'UnsubscriptionError';
this.errors = errors;
return this;
}
UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype);
return UnsubscriptionErrorImpl;
})();
var UnsubscriptionError = UnsubscriptionErrorImpl;
var Subscription = /** @class */ (function () {
function Subscription(unsubscribe) {
this.closed = false;
this._parentOrParents = null;
this._subscriptions = null;
if (unsubscribe) {
this._unsubscribe = unsubscribe;
}
}
Subscription.prototype.unsubscribe = function () {
var errors;
if (this.closed) {
return;
}
var _a = this, _parentOrParents = _a._parentOrParents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
this.closed = true;
this._parentOrParents = null;
this._subscriptions = null;
if (_parentOrParents instanceof Subscription) {
_parentOrParents.remove(this);
}
else if (_parentOrParents !== null) {
for (var index = 0; index < _parentOrParents.length; ++index) {
var parent = _parentOrParents[index];
parent.remove(this);
}
}
if (isFunction(_unsubscribe)) {
try {
_unsubscribe.call(this);
}
catch (e) {
errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
}
}
if (isArray(_subscriptions)) {
var index = -1;
var len = _subscriptions.length;
while (++index < len) {
var sub = _subscriptions[index];
if (isObject(sub)) {
try {
sub.unsubscribe();
}
catch (e) {
errors = errors || [];
if (e instanceof UnsubscriptionError) {
errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
}
else {
errors.push(e);
}
}
}
}
}
if (errors) {
throw new UnsubscriptionError(errors);
}
};
Subscription.prototype.add = function (teardown) {
var subscription = teardown;
if (!teardown) {
return Subscription.EMPTY;
}
switch (typeof teardown) {
case 'function':
subscription = new Subscription(teardown);
case 'object':
if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
return subscription;
}
else if (this.closed) {
subscription.unsubscribe();
return subscription;
}
else if (!(subscription instanceof Subscription)) {
var tmp = subscription;
subscription = new Subscription();
subscription._subscriptions = [tmp];
}
break;
default: {
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
}
}
var _parentOrParents = subscription._parentOrParents;
if (_parentOrParents === null) {
subscription._parentOrParents = this;
}
else if (_parentOrParents instanceof Subscription) {
if (_parentOrParents === this) {
return subscription;
}
subscription._parentOrParents = [_parentOrParents, this];
}
else if (_parentOrParents.indexOf(this) === -1) {
_parentOrParents.push(this);
}
else {
return subscription;
}
var subscriptions = this._subscriptions;
if (subscriptions === null) {
this._subscriptions = [subscription];
}
else {
subscriptions.push(subscription);
}
return subscription;
};
Subscription.prototype.remove = function (subscription) {
var subscriptions = this._subscriptions;
if (subscriptions) {
var subscriptionIndex = subscriptions.indexOf(subscription);
if (subscriptionIndex !== -1) {
subscriptions.splice(subscriptionIndex, 1);
}
}
};
return Subscription;
}());
Subscription.EMPTY = (function (empty) {
empty.closed = true;
return empty;
}(new Subscription()));
function flattenUnsubscriptionErrors(errors) {
return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
}
var rxSubscriber = (function () { return typeof Symbol === 'function'
? Symbol('rxSubscriber')
: '@@rxSubscriber_' + Math.random(); })();
var Subscriber = /** @class */ (function (_super) {
__extends(Subscriber, _super);
function Subscriber(destinationOrNext, error, complete) {
var _this = _super.call(this) || this;
_this.syncErrorValue = null;
_this.syncErrorThrown = false;
_this.syncErrorThrowable = false;
_this.isStopped = false;
switch (arguments.length) {
case 0:
_this.destination = empty;
break;
case 1:
if (!destinationOrNext) {
_this.destination = empty;
break;
}
if (typeof destinationOrNext === 'object') {
if (destinationOrNext instanceof Subscriber) {
_this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
_this.destination = destinationOrNext;
destinationOrNext.add(_this);
}
else {
_this.syncErrorThrowable = true;
_this.destination = new SafeSubscriber(_this, destinationOrNext);
}
break;
}
default:
_this.syncErrorThrowable = true;
_this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
break;
}
return _this;
}
Subscriber.prototype[rxSubscriber] = function () { return this; };
Subscriber.create = function (next, error, complete) {
var subscriber = new Subscriber(next, error, complete);
subscriber.syncErrorThrowable = false;
return subscriber;
};
Subscriber.prototype.next = function (value) {
if (!this.isStopped) {
this._next(value);
}
};
Subscriber.prototype.error = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this._error(err);
}
};
Subscriber.prototype.complete = function () {
if (!this.isStopped) {
this.isStopped = true;
this._complete();
}
};
Subscriber.prototype.unsubscribe = function () {
if (this.closed) {
return;
}
this.isStopped = true;
_super.prototype.unsubscribe.call(this);
};
Subscriber.prototype._next = function (value) {
this.destination.next(value);
};
Subscriber.prototype._error = function (err) {
this.destination.error(err);
this.unsubscribe();
};
Subscriber.prototype._complete = function () {
this.destination.complete();
this.unsubscribe();
};
Subscriber.prototype._unsubscribeAndRecycle = function () {
var _parentOrParents = this._parentOrParents;
this._parentOrParents = null;
this.unsubscribe();
this.closed = false;
this.isStopped = false;
this._parentOrParents = _parentOrParents;
return this;
};
return Subscriber;
}(Subscription));
var SafeSubscriber = /** @class */ (function (_super) {
__extends(SafeSubscriber, _super);
function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
var _this = _super.call(this) || this;
_this._parentSubscriber = _parentSubscriber;
var next;
var context = _this;
if (isFunction(observerOrNext)) {
next = observerOrNext;
}
else if (observerOrNext) {
next = observerOrNext.next;
error = observerOrNext.error;
complete = observerOrNext.complete;
if (observerOrNext !== empty) {
context = Object.create(observerOrNext);
if (isFunction(context.unsubscribe)) {
_this.add(context.unsubscribe.bind(context));
}
context.unsubscribe = _this.unsubscribe.bind(_this);
}
}
_this._context = context;
_this._next = next;
_this._error = error;
_this._complete = complete;
return _this;
}
SafeSubscriber.prototype.next = function (value) {
if (!this.isStopped && this._next) {
var _parentSubscriber = this._parentSubscriber;
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
this.__tryOrUnsub(this._next, value);
}
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.error = function (err) {
if (!this.isStopped) {
var _parentSubscriber = this._parentSubscriber;
var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
if (this._error) {
if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
this.__tryOrUnsub(this._error, err);
this.unsubscribe();
}
else {
this.__tryOrSetError(_parentSubscriber, this._error, err);
this.unsubscribe();
}
}
else if (!_parentSubscriber.syncErrorThrowable) {
this.unsubscribe();
if (useDeprecatedSynchronousErrorHandling) {
throw err;
}
hostReportError(err);
}
else {
if (useDeprecatedSynchronousErrorHandling) {
_parentSubscriber.syncErrorValue = err;
_parentSubscriber.syncErrorThrown = true;
}
else {
hostReportError(err);
}
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.complete = function () {
var _this = this;
if (!this.isStopped) {
var _parentSubscriber = this._parentSubscriber;
if (this._complete) {
var wrappedComplete = function () { return _this._complete.call(_this._context); };
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
this.__tryOrUnsub(wrappedComplete);
this.unsubscribe();
}
else {
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
this.unsubscribe();
}
}
else {
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
try {
fn.call(this._context, value);
}
catch (err) {
this.unsubscribe();
if (config.useDeprecatedSynchronousErrorHandling) {
throw err;
}
else {
hostReportError(err);
}
}
};
SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
if (!config.useDeprecatedSynchronousErrorHandling) {
throw new Error('bad call');
}
try {
fn.call(this._context, value);
}
catch (err) {
if (config.useDeprecatedSynchronousErrorHandling) {
parent.syncErrorValue = err;
parent.syncErrorThrown = true;
return true;
}
else {
hostReportError(err);
return true;
}
}
return false;
};
SafeSubscriber.prototype._unsubscribe = function () {
var _parentSubscriber = this._parentSubscriber;
this._context = null;
this._parentSubscriber = null;
_parentSubscriber.unsubscribe();
};
return SafeSubscriber;
}(Subscriber));
function canReportError(observer) {
while (observer) {
var closed = observer.closed, destination = observer.destination, isStopped = observer.isStopped;
if (closed || isStopped) {
return false;
}
else if (destination && destination instanceof Subscriber) {
observer = destination;
}
else {
observer = null;
}
}
return true;
}
function toSubscriber(nextOrObserver, error, complete) {
if (nextOrObserver) {
if (nextOrObserver instanceof Subscriber) {
return nextOrObserver;
}
if (nextOrObserver[rxSubscriber]) {
return nextOrObserver[rxSubscriber]();
}
}
if (!nextOrObserver && !error && !complete) {
return new Subscriber(empty);
}
return new Subscriber(nextOrObserver, error, complete);
}
var observable = (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
function identity(x) {
return x;
}
function pipeFromArray(fns) {
if (fns.length === 0) {
return identity;
}
if (fns.length === 1) {
return fns[0];
}
return function piped(input) {
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
};
}
var Observable = /** @class */ (function () {
function Observable(subscribe) {
this._isScalar = false;
if (subscribe) {
this._subscribe = subscribe;
}
}
Observable.prototype.lift = function (operator) {
var observable = new Observable();
observable.source = this;
observable.operator = operator;
return observable;
};
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
var operator = this.operator;
var sink = toSubscriber(observerOrNext, error, complete);
if (operator) {
sink.add(operator.call(sink, this.source));
}
else {
sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
this._subscribe(sink) :
this._trySubscribe(sink));
}
if (config.useDeprecatedSynchronousErrorHandling) {
if (sink.syncErrorThrowable) {
sink.syncErrorThrowable = false;
if (sink.syncErrorThrown) {
throw sink.syncErrorValue;
}
}
}
return sink;
};
Observable.prototype._trySubscribe = function (sink) {
try {
return this._subscribe(sink);
}
catch (err) {
if (config.useDeprecatedSynchronousErrorHandling) {
sink.syncErrorThrown = true;
sink.syncErrorValue = err;
}
if (canReportError(sink)) {
sink.error(err);
}
else {
console.warn(err);
}
}
};
Observable.prototype.forEach = function (next, promiseCtor) {
var _this = this;
promiseCtor = getPromiseCtor(promiseCtor);
return new promiseCtor(function (resolve, reject) {
var subscription;
subscription = _this.subscribe(function (value) {
try {
next(value);
}
catch (err) {
reject(err);
if (subscription) {
subscription.unsubscribe();
}
}
}, reject, resolve);
});
};
Observable.prototype._subscribe = function (subscriber) {
var source = this.source;
return source && source.subscribe(subscriber);
};
Observable.prototype[observable] = function () {
return this;
};
Observable.prototype.pipe = function () {
var operations = [];
for (var _i = 0; _i < arguments.length; _i++) {
operations[_i] = arguments[_i];
}
if (operations.length === 0) {
return this;
}
return pipeFromArray(operations)(this);
};
Observable.prototype.toPromise = function (promiseCtor) {
var _this = this;
promiseCtor = getPromiseCtor(promiseCtor);
return new promiseCtor(function (resolve, reject) {
var value;
_this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
});
};
return Observable;
}());
Observable.create = function (subscribe) {
return new Observable(subscribe);
};
function getPromiseCtor(promiseCtor) {
if (!promiseCtor) {
promiseCtor = Promise;
}
if (!promiseCtor) {
throw new Error('no Promise impl found');
}
return promiseCtor;
}
var ObjectUnsubscribedErrorImpl = (function () {
function ObjectUnsubscribedErrorImpl() {
Error.call(this);
this.message = 'object unsubscribed';
this.name = 'ObjectUnsubscribedError';
return this;
}
ObjectUnsubscribedErrorImpl.prototype = Object.create(Error.prototype);
return ObjectUnsubscribedErrorImpl;
})();
var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
var SubjectSubscription = /** @class */ (function (_super) {
__extends(SubjectSubscription, _super);
function SubjectSubscription(subject, subscriber) {
var _this = _super.call(this) || this;
_this.subject = subject;
_this.subscriber = subscriber;
_this.closed = false;
return _this;
}
SubjectSubscription.prototype.unsubscribe = function () {
if (this.closed) {
return;
}
this.closed = true;
var subject = this.subject;
var observers = subject.observers;
this.subject = null;
if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
return;
}
var subscriberIndex = observers.indexOf(this.subscriber);
if (subscriberIndex !== -1) {
observers.splice(subscriberIndex, 1);
}
};
return SubjectSubscription;
}(Subscription));
var SubjectSubscriber = /** @class */ (function (_super) {
__extends(SubjectSubscriber, _super);
function SubjectSubscriber(destination) {
var _this = _super.call(this, destination) || this;
_this.destination = destination;
return _this;
}
return SubjectSubscriber;
}(Subscriber));
var Subject = /** @class */ (function (_super) {
__extends(Subject, _super);
function Subject() {
var _this = _super.call(this) || this;
_this.observers = [];
_this.closed = false;
_this.isStopped = false;
_this.hasError = false;
_this.thrownError = null;
return _this;
}
Subject.prototype[rxSubscriber] = function () {
return new SubjectSubscriber(this);
};
Subject.prototype.lift = function (operator) {
var subject = new AnonymousSubject(this, this);
subject.operator = operator;
return subject;
};
Subject.prototype.next = function (value) {
if (this.closed) {
throw new ObjectUnsubscribedError();
}
if (!this.isStopped) {
var observers = this.observers;
var len = observers.length;
var copy = observers.slice();
for (var i = 0; i < len; i++) {
copy[i].next(value);
}
}
};
Subject.prototype.error = function (err) {
if (this.closed) {
throw new ObjectUnsubscribedError();
}
this.hasError = true;
this.thrownError = err;
this.isStopped = true;
var observers = this.observers;
var len = observers.length;
var copy = observers.slice();
for (var i = 0; i < len; i++) {
copy[i].error(err);
}
this.observers.length = 0;
};
Subject.prototype.complete = function () {
if (this.closed) {
throw new ObjectUnsubscribedError();
}
this.isStopped = true;
var observers = this.observers;
var len = observers.length;
var copy = observers.slice();
for (var i = 0; i < len; i++) {
copy[i].complete();
}
this.observers.length = 0;
};
Subject.prototype.unsubscribe = function () {
this.isStopped = true;
this.closed = true;
this.observers = null;
};
Subject.prototype._trySubscribe = function (subscriber) {
if (this.closed) {
throw new ObjectUnsubscribedError();
}
else {
return _super.prototype._trySubscribe.call(this, subscriber);
}
};
Subject.prototype._subscribe = function (subscriber) {
if (this.closed) {
throw new ObjectUnsubscribedError();
}
else if (this.hasError) {
subscriber.error(this.thrownError);
return Subscription.EMPTY;
}
else if (this.isStopped) {
subscriber.complete();
return Subscription.EMPTY;
}
else {
this.observers.push(subscriber);
return new SubjectSubscription(this, subscriber);
}
};
Subject.prototype.asObservable = function () {
var observable = new Observable();
observable.source = this;
return observable;
};
return Subject;
}(Observable));
Subject.create = function (destination, source) {
return new AnonymousSubject(destination, source);
};
var AnonymousSubject = /** @class */ (function (_super) {
__extends(AnonymousSubject, _super);
function AnonymousSubject(destination, source) {
var _this = _super.call(this) || this;
_this.destination = destination;
_this.source = source;
return _this;
}
AnonymousSubject.prototype.next = function (value) {
var destination = this.destination;
if (destination && destination.next) {
destination.next(value);
}
};
AnonymousSubject.prototype.error = function (err) {
var destination = this.destination;
if (destination && destination.error) {
this.destination.error(err);
}
};
AnonymousSubject.prototype.complete = function () {
var destination = this.destination;
if (destination && destination.complete) {
this.destination.complete();
}
};
AnonymousSubject.prototype._subscribe = function (subscriber) {
var source = this.source;
if (source) {
return this.source.subscribe(subscriber);
}
else {
return Subscription.EMPTY;
}
};
return AnonymousSubject;
}(Subject));
var Fileloader = /** @class */ (function () {
function Fileloader(fileURL) {
this.responseInfo = { content: null, status: null };
this.url = fileURL;
}
Fileloader.of = function (fileURL) {
return new Fileloader(new URL(fileURL));
};
Fileloader.prototype.loadFile = function () {
var responseInfo = this.responseInfo;
var subject = new Subject();
var client = new XMLHttpRequest();
client.addEventListener("load", function (event) {
responseInfo.content = client.responseText;
console.log(event.total + " bytes gelesen.\n:" + responseInfo.content);
});
client.onloadend = function () {
responseInfo.status = client.status;
console.log("Response Status:" + responseInfo.status);
subject.next(responseInfo);
};
client.open("GET", this.url.toString());
client.send();
return subject;
};
return Fileloader;
}());
function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire();
}
}, fn(module, module.exports), module.exports;
}
function commonjsRequire() {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
var defaults = createCommonjsModule(function (module) {
function getDefaults() {
return {
baseUrl: null,
breaks: false,
gfm: true,
headerIds: true,
headerPrefix: '',
highlight: null,
langPrefix: 'language-',
mangle: true,
pedantic: false,
renderer: null,
sanitize: false,
sanitizer: null,
silent: false,
smartLists: false,
smartypants: false,
tokenizer: null,
xhtml: false
};
}
function changeDefaults(newDefaults) {
module.exports.defaults = newDefaults;
}
module.exports = {
defaults: getDefaults(),
getDefaults: getDefaults,
changeDefaults: changeDefaults
};
});
var defaults$1 = createCommonjsModule(function (module) {
function getDefaults() {
return {
baseUrl: null,
breaks: false,
gfm: true,
headerIds: true,
headerPrefix: '',
highlight: null,
langPrefix: 'language-',
mangle: true,
pedantic: false,
renderer: null,
sanitize: false,
sanitizer: null,
silent: false,
smartLists: false,
smartypants: false,
tokenizer: null,
xhtml: false
};
}
function changeDefaults(newDefaults) {
module.exports.defaults = newDefaults;
}
module.exports = {
defaults: getDefaults(),
getDefaults: getDefaults,
changeDefaults: changeDefaults
};
});
/**
* Helpers
*/
var escapeTest = /[&<>"']/;
var escapeReplace = /[&<>"']/g;
var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
var escapeReplacements = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
var getEscapeReplacement = function (ch) { return escapeReplacements[ch]; };
function escape(html, encode) {
if (encode) {
if (escapeTest.test(html)) {
return html.replace(escapeReplace, getEscapeReplacement);
}
}
else {
if (escapeTestNoEncode.test(html)) {
return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
}
}
return html;
}
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
function unescape(html) {
// explicitly match decimal, hex, and named HTML entities
return html.replace(unescapeTest, function (_, n) {
n = n.toLowerCase();
if (n === 'colon')
return ':';
if (n.charAt(0) === '#') {
return n.charAt(1) === 'x'
? String.fromCharCode(parseInt(n.substring(2), 16))
: String.fromCharCode(+n.substring(1));
}
return '';
});
}
var caret = /(^|[^\[])\^/g;
function edit(regex, opt) {
regex = regex.source || regex;
opt = opt || '';
var obj = {
replace: function (name, val) {
val = val.source || val;
val = val.replace(caret, '$1');
regex = regex.replace(name, val);
return obj;
},
getRegex: function () {
return new RegExp(regex, opt);
}
};
return obj;
}
var nonWordAndColonTest = /[^\w:]/g;
var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
function cleanUrl(sanitize, base, href) {
if (sanitize) {
var prot = void 0;
try {
prot = decodeURIComponent(unescape(href))
.replace(nonWordAndColonTest, '')
.toLowerCase();
}
catch (e) {
return null;
}
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
return null;
}
}
if (base && !originIndependentUrl.test(href)) {
href = resolveUrl(base, href);
}
try {
href = encodeURI(href).replace(/%25/g, '%');
}
catch (e) {
return null;
}
return href;
}
var baseUrls = {};
var