diff --git a/README.en.md b/README.en.md index 39c22a4..8914912 100644 --- a/README.en.md +++ b/README.en.md @@ -18,7 +18,7 @@ For the English overview of the TextAlive project, please refer to [the academic TextAlive App API can be used by `script` tags in an HTML document or by installing the npm package `textalive-app-api`. -The primary entry point to the API features is the [`Player`](https://developer.textalive.jp/packages/textalive-app-api/classes/player.html) class. To use it, you would need an application token that can be retrieved in the [TextAlive for Developers](https://developer.textalive.jp) website. Please note that all of the API documents are bi-lingual -- written in both Japanese and English. +The primary entry point to the API features is the [`Player`](https://developer.textalive.jp/packages/textalive-app-api/classes/Player.html) class. To use it, you would need an application token that can be retrieved in the [TextAlive for Developers](https://developer.textalive.jp) website. Please note that all of the API documents are bi-lingual -- written in both Japanese and English. ### `script` tags @@ -47,4 +47,4 @@ Please reach out to the developer team using [GitHub Issues](https://github.com/ --- -© AIST TextAlive Project 2020-2021 +© AIST TextAlive Project 2020-2024 diff --git a/README.md b/README.md index b4e3eb7..a6fd149 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,11 @@ npm install textalive-app-api - [TextAlive App API チュートリアル](https://developer.textalive.jp/app) - [API リファレンス](https://developer.textalive.jp/packages/textalive-app-api) - [GitHub サンプルコード](https://github.com/TextAliveJp) +- [TextAlive App API の開発履歴 (Scrapbox)](https://scrapbox.io/textalive/TextAlive_App_API%E3%81%AE%E9%96%8B%E7%99%BA%E5%B1%A5%E6%AD%B4) 技術的に分からないことやバグ報告などがあれば、 [GitHub Issues](https://github.com/TextAliveJp/textalive-app-api/issues?q=is%3Aissue) か [Gitter Chat](https://gitter.im/textalive-app-api/community) までお願いいたします。 [TextAlive for Developers トップページ](https://developer.textalive.jp) もぜひご覧ください。 --- -© AIST TextAlive Project 2020-2021 +© AIST TextAlive Project 2020-2024 diff --git a/dist/index.es.js b/dist/index.es.js index 5004bb5..3c61f7b 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1,2 +1,2 @@ -/** textalive-app-api v0.3.2 | Copyright 2021 AIST TextAlive Project (https://textalive.jp) */ -import t from"axios";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var e={exports:{}};!function(t){function e(t,e,r){for(var n=r&&"number"!=typeof e?r(e):e,i=0,o=t.length;i>>1;(r?r(t[s]):t[s])0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=0||"string"==typeof t.user.songleAccessToken)},t.prototype.isSpoofingSongleUser=function(t){return this.isSongleUser(t)&&("number"!=typeof t.user.id||t.user.id<0)},t.prototype.addListener=function(t){t&&this.listeners.push(t)},t.prototype.removeListener=function(t){this.listeners=this.listeners.filter((function(e){return e!==t}))},t.prototype.emitUserProfile=function(t){this.userProfile=t;for(var e=0,r=this.listeners;e=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){return this.contains(t)||this.contains(e)||this.startTime<=t&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?(t-this.startTime)/this.duration:-1},t.prototype.maximize=function(){var t=!1,e=this.endTime,r=Math.max(null===this._parent?0:this._parent.startTime,null===this._previous?0:this._previous.endTime);r!==this.startTime&&(this.moveWithChildren(r-this.startTime),t=!0);var n=Math.min(null===this._parent?this.video.duration:this._parent.endTime,null===this._next?this.video.duration:this._next.startTime);return n!==this.endTime&&(this._data.endTime=n,t=e!==n),t},t.prototype.moveWithChildren=function(t){var e=[];for(e.push(this);e.length>0;){var r=e.pop();null!=r._children&&r._children.forEach((function(t){return e.push(t)})),r._data.startTime+=t,r._data.endTime+=t}},t.prototype.getTemplate=function(t){return void 0===t&&(t=0),t<0||t>=this._templates.length?null:this._templates[t]},t.prototype.addTemplateAt=function(t,e){this._templates.splice(e,0,t),t.assignedUnit=this},t.prototype.addTemplate=function(t){this._templates.push(t),t.assignedUnit=this},t.prototype.removeTemplates=function(){for(var t=this._templates.slice();this._templates.length>0;)this._templates.pop();return t},t.prototype.removeTemplateAt=function(t){if(t<0||t>=this._templates.length)return null;var e=this._templates.splice(t,1)[0];return e.assignedUnit=null,e},t.prototype.removeTemplate=function(t){for(var e=0;et?e:t}function H(t,e){return"number"==typeof e&&!isNaN(e)&&e>24&255:255,this.r=t>>16&255,this.g=t>>8&255,this.b=255&t)},t}();var $=function(){function t(t,e,r){void 0===t&&(t="Noto Sans Japanese"),void 0===e&&(e=40),void 0===r&&(r=""),this._family=t,this._size=e,this._style=r}return Object.defineProperty(t.prototype,"family",{get:function(){return this._family},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},enumerable:!1,configurable:!0}),t.prototype.deriveFamily=function(e){return new t(e,this._size,this._style)},t.prototype.deriveStyle=function(e){return new t(this._family,this._size,e)},t.prototype.deriveSize=function(e){return new t(this._family,e,this._style)},t.prototype.clone=function(){return new t(this._family,this._size,this._style)},t.prototype.eq=function(t){return this._family===t._family&&this._size===t._size&&this._style===t._style},t.prototype.toString=function(t){void 0===t&&(t=1);var e,r=function(t){if(!t||t.length<=0)return[];for(var e=[],r="",n=!1,i=!1,o=!1,s=0,a=t;s1?" "+r.join(", "):(e=r[0]).length>1&&e[0]!==e[e.length-1]||"'"!==e[0]&&'"'!==e[0]?" '"+e+"'":" "+e,this._style+(this._style.length>0?" ":"")+this._size*t+"px"+e},t}(),Q=function(t){function e(e){var r=t.call(this)||this;return r._data=e,r._font=new $(e&&e.fontFamily,e&&e.fontSize,e&&e.fontStyle),r._color=new Z,r}return Y(e,t),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._data&&this._data.char||"?"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"advance",{get:function(){return this._runtime?this._runtime.advance:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ascent",{get:function(){return this._runtime?this._runtime.ascent:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"descent",{get:function(){return this._runtime?this._runtime.descent:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"font",{get:function(){return this._font},set:function(t){null===t||this.font.eq(t)||(this._font=t.clone(),this._data.fontFamily=t.family,this._data.fontSize=t.size,this._data.fontStyle=t.style,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontFamily",{get:function(){return this.font.family},set:function(t){this.font.family!==t&&(this._font=this.font.deriveFamily(t),this._data.fontFamily=t,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontStyle",{get:function(){return this.font.style},set:function(t){this.font.style!==t&&(this._font=this.font.deriveStyle(t),this._data.fontStyle=t,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){return this.font.size},set:function(t){isNaN(t)||this.font.size===t||(this._font=this.font.deriveSize(t),this._data.fontSize=t,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){t&&!t.eq(this.color)&&(this._color=t,this._runtime&&this._runtime.onColorUpdate(t))},enumerable:!1,configurable:!0}),e.prototype.getType=function(){return r.CHAR},e}(X),K=function(t){function e(e){var r=t.call(this)||this;return r._data=e,r}return Y(e,t),e.prototype.getType=function(){return r.GRAPHIC},e.prototype.toString=function(){return"Graphic"},e}(z),tt=function(t){function e(e){var r=t.call(this)||this;return r._data=e,r}return Y(e,t),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.firstChar?this.firstChar.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.lastChar?this.lastChar.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pos",{get:function(){return this._data&&this._data.pos||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rawPos",{get:function(){return this._data&&this._data.rawPoS||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"language",{get:function(){return this._data&&this._data.language||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"countDown",{get:function(){return this._data?this._data.countDown:-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"countUp",{get:function(){return this._data?this._data.countUp:-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initialCount",{get:function(){return this._data?this._data.initialCount:-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._children.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){return this._children.length<=0?null:this._children[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){return this._children.length<=0?null:this._children[this._children.length-1]},enumerable:!1,configurable:!0}),e.prototype.addChar=function(t){if(t){this._children.length>0&&(t._previous=this.lastChar,this.lastChar._next=t),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){return t instanceof Q?this._children.indexOf(t):-1},e.prototype.getType=function(){return r.WORD},e}(X),et=function(t){function e(e,r){var n=t.call(this)||this;return n._video=e,n._data=r,n.createUnits(),n}return Y(e,t),e.prototype.createUnits=function(){var t=this,e=this._data;e&&Array.isArray(e.words)&&e.words.forEach((function(e){if(e){var r=new tt(e);Array.isArray(e.characters)&&e.characters.forEach((function(t){return r.addChar(new Q(t))})),t.addWord(r)}}))},Object.defineProperty(e.prototype,"children",{get:function(){return this._children.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.firstChar?this.firstChar.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.lastChar?this.lastChar.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordCount",{get:function(){return this._children.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._children.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstWord",{get:function(){return this._children.length<=0?null:this._children[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastWord",{get:function(){return this._children.length<=0?null:this._children[this._children.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){var t=this.firstWord;return null===t?null:t.firstChar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){var t=this.lastWord;return null===t?null:t.lastChar},enumerable:!1,configurable:!0}),e.prototype.getWord=function(t){return t<0||t>=this._children.length?null:this._children[t]},e.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.addWord=function(t){if(t){this._children.length>0&&(t._previous=this.lastWord,t._previous._next=t,t.firstChar._previous=t._previous.lastChar,t._previous.lastChar._next=t.firstChar),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){if(t instanceof tt)return this._children.indexOf(t);if(t instanceof Q){for(var e=0,r=!1,n=0,i=this._children;n=t.length&&(i=t.length-1);var o=r,s=n.endTime;return t[i].overlaps(o,s)?t[i]:i<1?null:t[i-1].overlaps(o,s)?t[i-1]:null}return i>=t.length?null:(null==n?void 0:n.loose)||t[i].contains(r)?t[i]:null}var nt=function(){function t(t){this._credits=[],this._phrases=[],this._graphics=[],this.data=t||{},this.createUnits()}return Object.defineProperty(t.prototype,"credits",{get:function(){return this._credits.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"phrases",{get:function(){return this._phrases.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphics",{get:function(){return this._graphics.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rendering",{get:function(){return this._runtime.rendering},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this.data.duration||0},set:function(t){this.data.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){return this.data.startTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endTime",{get:function(){return this.data.endTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"creditCount",{get:function(){return this._credits.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"phraseCount",{get:function(){return this._phrases.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphicCount",{get:function(){return this._graphics.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.wordCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"charCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstCredit",{get:function(){return this._credits.length<=0?null:this._credits[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastCredit",{get:function(){return this._credits.length<=0?null:this._credits[this._credits.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[this._phrases.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstWord",{get:function(){var t;return(null===(t=this.firstPhrase)||void 0===t?void 0:t.firstWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastWord",{get:function(){var t;return(null===(t=this.lastPhrase)||void 0===t?void 0:t.lastWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstChar",{get:function(){var t;return(null===(t=this.firstWord)||void 0===t?void 0:t.firstChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChar",{get:function(){var t;return(null===(t=this.lastWord)||void 0===t?void 0:t.lastChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[this._graphics.length-1]},enumerable:!1,configurable:!0}),t.prototype.createUnits=function(){var t,e,r=this;Array.isArray(this.data.credits)?(this.data.credits.sort(it),this.data.credits.forEach((function(t){return r.doAddCredit(new et(r,t),!1)})),this.organizeTimings(null===(t=this.firstCredit)||void 0===t?void 0:t.firstChar)):this.data.credits=[],Array.isArray(this.data.phrases)?(this.data.phrases.sort(it),this.data.phrases.forEach((function(t){return r.doAddPhrase(new et(r,t),!1)})),this.organizeTimings(null===(e=this.firstPhrase)||void 0===e?void 0:e.firstChar)):this.data.phrases=[],Array.isArray(this.data.graphics)?(this.data.graphics.sort(it),this.data.graphics.forEach((function(t){return r.doAddGraphic(new K(t),!1)}))):this.data.graphics=[]},t.prototype.organizeTimings=function(t){for(;t;)t.startTime===t.endTime&&t.maximize(),t=t.next},t.prototype.exportData=function(e){this.updateTemplateData(e);for(var r=t.exportUnitData(this.data.credits,!0),n=r.units,i=r.templateClasses,o=t.exportUnitData(this.data.phrases,!1),s=o.units,a=o.templateClasses,u=t.exportUnitData(this.data.graphics,!0),l=u.units,c=u.templateClasses,p=i.concat(a,c).filter((function(t,e,r){return r.indexOf(t)===e})),h={};p.length>0;){var d=p.shift(),f=e.getByName(d);if(f){h[d]=f.id;for(var y=0,v=e.getRequiredTemplates(f.script);y0?t[n-1]:null,o=n0){for(var s=i;s&&!s.lastWord;)s=s.previous;for(var a=o;a&&!a.firstWord;)a=a.next;if(s&&(r.firstWord._previous=s.lastWord,s.lastWord._next=r.firstWord),a&&(r.lastWord._next=a.firstWord,a.firstWord._previous=r.lastWord),r.charCount>0){for(var u=null==s?void 0:s.lastWord;u&&null===u.lastChar;)u=u.previous;for(var l=null==a?void 0:a.firstWord;l&&null===l.firstChar;)l=l.next;u&&(r.firstChar._previous=u.lastChar,u.lastChar._next=r.firstChar),l&&(r.lastChar._next=l.firstChar,l.firstChar._previous=r.lastChar)}}return this.updateStartAndEndTime(),n}},t.prototype.removeCredit=function(t){var e=this.removeRenderingUnit(this._credits,t);return!(e<0||(this.data.credits.splice(e,1),this._runtime&&this._runtime.removeCredit(t),0))},t.prototype.removeCredits=function(){var t=this;this._runtime&&this._credits.forEach((function(e){return t._runtime.removeCredit(e)})),this._credits=[],this.data.credits.splice(0,this.data.credits.length)},t.prototype.removePhrase=function(t){var e=this.removeRenderingUnit(this._phrases,t);return!(e<0||(this.data.phrases.splice(e,1),this._runtime&&this._runtime.removePhrase(t),0))},t.prototype.removePhrases=function(){var t=this;this._runtime&&this._phrases.forEach((function(e){return t._runtime.removePhrase(e)})),this._phrases=[],this.data.phrases.splice(0,this.data.phrases.length)},t.prototype.removeGraphic=function(t){var e=this.removeRenderingUnit(this._graphics,t);return!(e<0||(this.data.graphics.splice(e,1),this._runtime&&this._runtime.removeGraphic(t),0))},t.prototype.removeGraphics=function(){var t=this;this._runtime&&this._graphics.forEach((function(e){return t._runtime.removeGraphic(e)})),this._graphics=[],this.data.graphics.splice(0,this.data.graphics.length),this.rendering.reset()},t.prototype.removeRenderingUnit=function(t,r){var n=e.exports.sortedIndex(t,r,ot);if(n<0||t[n]!==r)return-1;if(t.splice(n,1),r instanceof et){if(r.charCount>0){for(var i=r._previous;i&&null===i.lastChar;)i=i.previous;for(var o=r._next;o&&null===o.firstChar;)o=o.next;i&&o?(i.lastChar._next=o.firstChar,o.firstChar._previous=i.lastChar):i?i.lastChar._next=null:o&&(o.firstChar._previous=null)}if(r.wordCount>0){for(i=r._previous;i&&null===i.lastWord;)i=i.previous;for(o=r._next;o&&null===o.firstWord;)o=o.next;i&&o?(i.lastWord._next=o.firstWord,o.firstWord._previous=i.lastWord):i?i.lastWord._next=null:o&&(o.firstWord._previous=null)}}r._previous&&(r._previous._next=r._next),r._next&&(r._next._previous=r._previous),this.updateStartAndEndTime()},t.prototype.updateStartAndEndTime=function(){var t,e,r,n,i,o,s,a;this.data.endTime=Math.max((null===(e=null===(t=this.lastCredit)||void 0===t?void 0:t.lastChar)||void 0===e?void 0:e.endTime)||0,(null===(r=this.lastChar)||void 0===r?void 0:r.endTime)||0,(null===(n=this.lastGraphic)||void 0===n?void 0:n.endTime)||0);var u=null===(o=null===(i=this.firstCredit)||void 0===i?void 0:i.firstChar)||void 0===o?void 0:o.startTime,l=null===(s=this.firstChar)||void 0===s?void 0:s.startTime,c=null===(a=this.firstGraphic)||void 0===a?void 0:a.startTime;this.data.startTime=Math.min("number"==typeof u?u:Number.MAX_VALUE,"number"==typeof l?l:Number.MAX_VALUE,"number"==typeof c?c:Number.MAX_VALUE,this.data.endTime)},t.prototype.findIndex=function(t){if(t instanceof et)return(e=this._phrases.indexOf(t))>=0?e:this._credits.indexOf(t);if(t instanceof tt){for(var e=0,r=!1,n=0,i=this._phrases;n=this._credits.length?null:this._credits[t]},t.prototype.getPhrase=function(t){return t<0||t>=this._phrases.length?null:this._phrases[t]},t.prototype.getWord=function(t){if(t<0)return null;for(var e=0,r=this.firstPhrase;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},t.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},t.prototype.getGraphic=function(t){return t<0||t>=this._graphics.length?null:this._graphics[t]},t.prototype.findCredit=function(t,e){return rt(this._credits,t,e)},t.prototype.findPhrase=function(t,e){return rt(this._phrases,t,e)},t.prototype.findWord=function(t,e){var r=this.findPhrase(t,e);return r?rt(r._children,t,e):null},t.prototype.findChar=function(t,e){var r=this.findWord(t,e);return r?rt(r._children,t,e):null},t.prototype.findGraphic=function(t,e){return rt(this._graphics,t,e)},t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){return this.contains(t)||this.contains(e)||this.startTime<=t&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?(t-this.startTime)/this.duration:-1},t}();function it(t,e){return t.startTime-e.startTime}function ot(t){return t.startTime}var st=function(){function t(t,e,r,n,i,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.setValues(t,e,r,n,i,o)}return t.prototype.setValues=function(t,e,r,n,i,o){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=o,this},t.prototype.append=function(t,e,r,n,i,o){var s=this.a,a=this.b,u=this.c,l=this.d;return 1==t&&0==e&&0==r&&1==n||(this.a=s*t+u*e,this.b=a*t+l*e,this.c=s*r+u*n,this.d=a*r+l*n),this.tx=s*i+u*o+this.tx,this.ty=a*i+l*o+this.ty,this},t.prototype.prepend=function(t,e,r,n,i,o){var s=this.a,a=this.c,u=this.tx;return this.a=t*s+r*this.b,this.b=e*s+n*this.b,this.c=t*a+r*this.d,this.d=e*a+n*this.d,this.tx=t*u+r*this.ty+i,this.ty=e*u+n*this.ty+o,this},t.prototype.appendMatrix=function(t){return this.append(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.prependMatrix=function(t){return this.prepend(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.appendTransform=function(e,r,n,i,o,s,a,u,l){var c,p,h;return o%360?(c=o*t.DEG_TO_RAD,p=Math.cos(c),h=Math.sin(c)):(p=1,h=0),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.append(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r),this.append(p*n,h*n,-h*i,p*i,0,0)):this.append(p*n,h*n,-h*i,p*i,e,r),(u||l)&&(this.tx-=u*this.a+l*this.c,this.ty-=u*this.b+l*this.d),this},t.prototype.prependTransform=function(e,r,n,i,o,s,a,u,l){var c,p,h;return o%360?(c=o*t.DEG_TO_RAD,p=Math.cos(c),h=Math.sin(c)):(p=1,h=0),(u||l)&&(this.tx-=u,this.ty-=l),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.prepend(p*n,h*n,-h*i,p*i,0,0),this.prepend(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r)):this.prepend(p*n,h*n,-h*i,p*i,e,r),this},t.prototype.rotate=function(e){e*=t.DEG_TO_RAD;var r=Math.cos(e),n=Math.sin(e),i=this.a,o=this.b;return this.a=i*r+this.c*n,this.b=o*r+this.d*n,this.c=-i*n+this.c*r,this.d=-o*n+this.d*r,this},t.prototype.skew=function(e,r){return e*=t.DEG_TO_RAD,r*=t.DEG_TO_RAD,this.append(Math.cos(r),Math.sin(r),-Math.sin(e),Math.cos(e),0,0),this},t.prototype.scale=function(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this},t.prototype.translate=function(t,e){return this.tx+=this.a*t+this.c*e,this.ty+=this.b*t+this.d*e,this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},t.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,n=this.d,i=this.tx,o=t*n-e*r;return this.a=n/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-n*i)/o,this.ty=-(t*this.ty-e*i)/o,this},t.prototype.isIdentity=function(){return 0===this.tx&&0===this.ty&&1===this.a&&0===this.b&&0===this.c&&1===this.d},t.prototype.equals=function(t){return this.tx===t.tx&&this.ty===t.ty&&this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d},t.prototype.transformPoint=function(t,e,r){return r.x=t*this.a+e*this.c+this.tx,r.y=t*this.b+e*this.d+this.ty,r},t.prototype.decompose=function(e){void 0===e&&(e={}),e.x=this.tx,e.y=this.ty,e.scaleX=Math.sqrt(this.a*this.a+this.b*this.b),e.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var r=Math.atan2(-this.c,this.d),n=Math.atan2(this.b,this.a);return Math.abs(1-r/n)<1e-5?(e.rotation=n/t.DEG_TO_RAD,this.a<0&&this.d>=0&&(e.rotation+=e.rotation<=0?180:-180),e.skewX=e.skewY=0):(e.skewX=r/t.DEG_TO_RAD,e.skewY=n/t.DEG_TO_RAD),e},t.prototype.copy=function(t){return this.setValues(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.clone=function(){return new t(this.a,this.b,this.c,this.d,this.tx,this.ty)},t.prototype.toString=function(){return"["+this.constructor.name+" (a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+")]"},t.DEG_TO_RAD=Math.PI/180,t.identity=new t,t}(),at=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.setValues(t,e)}return t.prototype.setValues=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e,this},t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.toString=function(){return"["+this.constructor.name+" (x="+this.x+" y="+this.y+")]"},t}(),ut=function(){function t(){this.tx=new st,this.alpha=0,this.composite="",this.visible=!0}return t.prototype.reset=function(){},t}(),lt=function(){function t(){this.rendering=new ut}return t.prototype.addCredit=function(t){this.doAddPhrase(t)},t.prototype.removeCredit=function(t){t._runtime=null},t.prototype.addPhrase=function(t){this.doAddPhrase(t)},t.prototype.removePhrase=function(t){t._runtime=null},t.prototype.doAddPhrase=function(t){t._runtime={graphics:{clear:function(){}},rendering:new ut,update:function(){}};for(var e=t.firstWord;e;){e._runtime={graphics:{clear:function(){}},rendering:new ut,update:function(){}};for(var r=e.firstChar;r&&(r._runtime={graphics:{clear:function(){}},rendering:new ut,update:function(){},advance:0,ascent:0,descent:0,onFontUpdate:function(){},onColorUpdate:function(){}},r!==e.lastChar);)r=r.next;if(e===t.lastWord)break;e=e.next}},t.prototype.addGraphic=function(t){t._runtime={graphics:{clear:function(){}},rendering:new ut,update:function(){}}},t.prototype.removeGraphic=function(t){t._runtime=null},t}(),ct=function(){function t(){this.wrapperTable={}}return t.prototype.isGraphics=function(){return!1},t.prototype.setCanvas=function(){return Promise.resolve()},t.prototype.createRuntime=function(t){return function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}(this,void 0,void 0,(function(){var e,r,n;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]3){for(r.sort((function(t,e){return e.length-t.length})),e+="switch(str.length){",n=0;n=170&&$e.test(String.fromCharCode(t)))},rr=function(t){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||t>=170&&Qe.test(String.fromCharCode(t))))};function nr(){this.line=St,this.column=gt-Tt}function ir(t,e){bt=gt,dt.locations&&(wt=new nr),Pt=t,ar(),Et=e,Ot=t.beforeExpr}function or(){var t,e=dt.onComment&&dt.locations&&new nr,r=gt,n=ft.indexOf("*/",gt+=2);if(-1===n&&Ut(gt-2,"Unterminated comment"),gt=n+2,dt.locations)for(tr.lastIndex=r;(t=tr.exec(ft))&&t.index8&&t<14)++gt;else if(47===t){var e;if(42===(e=ft.charCodeAt(gt+1)))or();else{if(47!==e)break;sr()}}else if(160===t)++gt;else{if(!(t>=5760&&Xe.test(String.fromCharCode(t))))break;++gt}}}function ur(t){if(t?gt=mt+1:mt=gt,dt.locations&&(_t=new nr),t)return cr();if(gt>=yt)return ir(Vt);var e=ft.charCodeAt(gt);if(er(e)||92===e)return yr();var r=function(t){switch(t){case 46:return function(){var t=ft.charCodeAt(gt+1);return t>=48&&t<=57?hr(!0):(++gt,ir(Ee))}();case 40:return++gt,ir(me);case 41:return++gt,ir(be);case 59:return++gt,ir(we);case 44:return++gt,ir(_e);case 91:return++gt,ir(fe);case 93:return++gt,ir(ye);case 123:return++gt,ir(ve);case 125:return++gt,ir(ge);case 58:return++gt,ir(Pe);case 63:return++gt,ir(Oe);case 48:var e=ft.charCodeAt(gt+1);if(120===e||88===e)return function(){gt+=2;var t=pr(16);return null==t&&Ut(mt+2,"Expected hexadecimal number"),er(ft.charCodeAt(gt))&&Ut(gt,"Identifier directly after number"),ir(Lt,t)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return hr(!1);case 34:case 39:return function(t){gt++;for(var e="";;){gt>=yt&&Ut(mt,"Unterminated string constant");var r=ft.charCodeAt(gt);if(r===t)return++gt,ir(Mt,e);if(92===r){r=ft.charCodeAt(++gt);var n=/^[0-7]+/.exec(ft.slice(gt,gt+3));for(n&&(n=n[0]);n&&parseInt(n,8)>255;)n=n.slice(0,-1);if("0"===n&&(n=null),++gt,n)kt&&Ut(gt-2,"Octal literal in strict mode"),e+=String.fromCharCode(parseInt(n,8)),gt+=n.length-1;else switch(r){case 110:e+="\n";break;case 114:e+="\r";break;case 120:e+=String.fromCharCode(dr(2));break;case 117:e+=String.fromCharCode(dr(4));break;case 85:e+=String.fromCharCode(dr(8));break;case 116:e+="\t";break;case 98:e+="\b";break;case 118:e+="\v";break;case 102:e+="\f";break;case 48:e+="\0";break;case 13:10===ft.charCodeAt(gt)&&++gt;case 10:dt.locations&&(Tt=gt,++St);break;default:e+=String.fromCharCode(r)}}else 13!==r&&10!==r&&8232!==r&&8233!==r||Ut(mt,"Unterminated string constant"),e+=String.fromCharCode(r),++gt}}(t);case 47:return function(t){var e=ft.charCodeAt(gt+1);return Ot?(++gt,cr()):61===e?lr(xe,2):lr(Se,1)}();case 37:case 42:return 61===ft.charCodeAt(gt+1)?lr(xe,2):lr(Me,1);case 124:case 38:return function(t){var e=ft.charCodeAt(gt+1);return e===t?lr(124===t?Ce:Ne,2):61===e?lr(xe,2):lr(124===t?ke:Ie,1)}(t);case 94:return 61===ft.charCodeAt(gt+1)?lr(xe,2):lr(je,1);case 43:case 45:return function(t){var e=ft.charCodeAt(gt+1);return e===t?45==e&&62==ft.charCodeAt(gt+2)&&Ke.test(ft.slice(At,gt))?(gt+=3,sr(),ar(),ur()):lr(Ae,2):61===e?lr(xe,2):lr(De,1)}(t);case 60:case 62:return function(t){var e=ft.charCodeAt(gt+1),r=1;return e===t?(r=62===t&&62===ft.charCodeAt(gt+2)?3:2,61===ft.charCodeAt(gt+r)?lr(xe,r+1):lr(Le,r)):33==e&&60==t&&45==ft.charCodeAt(gt+2)&&45==ft.charCodeAt(gt+3)?(gt+=4,sr(),ar(),ur()):(61===e&&(r=61===ft.charCodeAt(gt+2)?3:2),lr(Fe,r))}(t);case 61:case 33:return function(t){return 61===ft.charCodeAt(gt+1)?lr(Ue,61===ft.charCodeAt(gt+2)?3:2):lr(61===t?Te:Re,1)}(t);case 126:return lr(Re,1)}return!1}(e);if(!1===r){var n=String.fromCharCode(e);if("\\"===n||$e.test(n))return yr();Ut(gt,"Unexpected character '"+n+"'")}return r}function lr(t,e){var r=ft.slice(gt,gt+e);gt+=e,ir(t,r)}function cr(){for(var t,e,r=gt;;){gt>=yt&&Ut(r,"Unterminated regular expression");var n=ft.charAt(gt);if(Ke.test(n)&&Ut(r,"Unterminated regular expression"),t)t=!1;else{if("["===n)e=!0;else if("]"===n&&e)e=!1;else if("/"===n&&!e)break;t="\\"===n}++gt}var i=ft.slice(r,gt);++gt;var o=fr();return o&&!/^[gmsiy]*$/.test(o)&&Ut(r,"Invalid regexp flag"),ir(Dt,new RegExp(i,o))}function pr(t,e){for(var r=gt,n=0,i=0,o=null==e?1/0:e;i=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=t)break;++gt,n=n*t+s}return gt===r||null!=e&>-r!==e?null:n}function hr(t){var e=gt,r=!1,n=48===ft.charCodeAt(gt);t||null!==pr(10)||Ut(e,"Invalid number"),46===ft.charCodeAt(gt)&&(++gt,pr(10),r=!0);var i=ft.charCodeAt(gt);69!==i&&101!==i||(43!==(i=ft.charCodeAt(++gt))&&45!==i||++gt,null===pr(10)&&Ut(e,"Invalid number"),r=!0),er(ft.charCodeAt(gt))&&Ut(gt,"Identifier directly after number");var o,s=ft.slice(e,gt);return r?o=parseFloat(s):n&&1!==s.length?/[89]/.test(s)||kt?Ut(e,"Invalid number"):o=parseInt(s,8):o=parseInt(s,10),ir(Lt,o)}function dr(t){var e=pr(16,t);return null===e&&Ut(mt,"Bad character escape sequence"),e}function fr(){qe=!1;for(var t,e=!0,r=gt;;){var n=ft.charCodeAt(gt);if(rr(n))qe&&(t+=ft.charAt(gt)),++gt;else{if(92!==n)break;qe||(t=ft.slice(r,gt)),qe=!0,117!=ft.charCodeAt(++gt)&&Ut(gt,"Expecting Unicode escape sequence \\uXXXX"),++gt;var i=dr(4),o=String.fromCharCode(i);o||Ut(gt-1,"Invalid Unicode escape"),(e?er(i):rr(i))||Ut(gt-4,"Invalid Unicode escape"),t+=o}e=!1}return qe?t:ft.slice(r,gt)}function yr(){var t=fr(),e=Bt;return qe||(He(t)?e=de[t]:(dt.forbidReserved&&(3===dt.ecmaVersion?We:Ye)(t)||kt&&ze(t))&&Ut(mt,"The keyword '"+t+"' is reserved")),ir(e,t)}function vr(){xt=mt,At=bt,Rt=wt,ur()}function gr(t){if(kt=t,gt=At,dt.locations)for(;gt=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"use strict"===t.expression.value}function Or(t){if(Pt===t)return vr(),!0}function Sr(){return!dt.strictSemicolons&&(Pt===Vt||Pt===ge||Ke.test(ft.slice(At,mt)))}function Tr(){Or(we)||Sr()||Ar()}function xr(t){Pt===t?vr():Ar()}function Ar(){Ut(mt,"Unexpected token")}function Rr(t){"Identifier"!==t.type&&"MemberExpression"!==t.type&&Ut(t.start,"Assigning to rvalue"),kt&&"Identifier"===t.type&&Je(t.name)&&Ut(t.start,"Assigning to "+t.name+" in strict mode")}var Cr={kind:"loop"},Nr={kind:"switch"};function kr(){(Pt===Se||Pt===xe&&"/="==Et)&&ur(!0);var t=Pt,e=_r();switch(t){case Gt:case Yt:vr();var r=t===Gt;Or(we)||Sr()?e.label=null:Pt!==Bt?Ar():(e.label=Jr(),Tr());for(var n=0;ne){var i=wr(t);i.left=t,i.operator=Et;var o=Pt;return vr(),i.right=Br(Vr(),n,r),Br(Pr(i,o===Ce||o===Ne?"LogicalExpression":"BinaryExpression"),e,r)}return t}function Vr(){if(Pt.prefix){var t=_r(),e=Pt.isUpdate;return t.operator=Et,t.prefix=!0,Ot=!0,vr(),t.argument=Vr(),e?Rr(t.argument):kt&&"delete"===t.operator&&"Identifier"===t.argument.type&&Ut(t.start,"Deleting local variable in strict mode"),Pr(t,e?"UpdateExpression":"UnaryExpression")}for(var r=Gr(qr());Pt.postfix&&!Sr();)(t=wr(r)).operator=Et,t.prefix=!1,t.argument=r,Rr(r),vr(),r=Pr(t,"UpdateExpression");return r}function Gr(t,e){var r;return Or(Ee)?((r=wr(t)).object=t,r.property=Jr(!0),r.computed=!1,Gr(Pr(r,"MemberExpression"),e)):Or(fe)?((r=wr(t)).object=t,r.property=Dr(),r.computed=!0,xr(ye),Gr(Pr(r,"MemberExpression"),e)):!e&&Or(me)?((r=wr(t)).callee=t,r.arguments=zr(be,!1),Gr(Pr(r,"CallExpression"),e)):t}function qr(){switch(Pt){case ue:var t=_r();return vr(),Pr(t,"ThisExpression");case Bt:return Jr();case Lt:case Mt:case Dt:return(t=_r()).value=Et,t.raw=ft.slice(mt,bt),vr(),Pr(t,"Literal");case le:case ce:case pe:return(t=_r()).value=Pt.atomValue,t.raw=Pt.keyword,vr(),Pr(t,"Literal");case me:var e=_t,r=mt;vr();var n=Dr();return n.start=r,n.end=bt,dt.locations&&(n.loc.start=e,n.loc.end=wt),dt.ranges&&(n.range=[r,bt]),xr(be),n;case fe:return t=_r(),vr(),t.elements=zr(ye,!0,!0),Pr(t,"ArrayExpression");case ve:return function(){var t=_r(),e=!0,r=!1;for(t.properties=[],vr();!Or(ge);){if(e)e=!1;else if(xr(_e),dt.allowTrailingCommas&&Or(ge))break;var n,i={key:Wr()},o=!1;if(Or(Pe)?(i.value=Dr(!0),n=i.kind="init"):dt.ecmaVersion>=5&&"Identifier"===i.key.type&&("get"===i.key.name||"set"===i.key.name)?(o=r=!0,n=i.kind=i.key.name,i.key=Wr(),Pt!==me&&Ar(),i.value=Yr(_r(),!1)):Ar(),"Identifier"===i.key.type&&(kt||r))for(var s=0;s=0)for(var a=0;a>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;","Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")},t.prototype.initString=function(e){var r,n=this;r=function(t){return t=String(t),n.calledWithNew()?(this.data=t,this):t},this.STRING=this.createNativeFunction(r,!0),this.setProperty(e,"String",this.STRING),this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(String.fromCharCode,!1),t.NONENUMERABLE_DESCRIPTOR);for(var i=["trim","toLowerCase","toUpperCase","toLocaleLowerCase","toLocaleUpperCase","charAt","charCodeAt","substring","slice","substr","indexOf","lastIndexOf","concat"],o=0;o= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);","}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","")},t.prototype.initBoolean=function(t){var e,r=this;e=function(t){return t=Boolean(t),r.calledWithNew()?(this.data=t,this):t},this.BOOLEAN=this.createNativeFunction(e,!0),this.setProperty(t,"Boolean",this.BOOLEAN)},t.prototype.initNumber=function(e){var r,n=this;r=function(t){return t=Number(t),n.calledWithNew()?(this.data=t,this):t},this.NUMBER=this.createNativeFunction(r,!0),this.setProperty(e,"Number",this.NUMBER);for(var i=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"],o=0;o>>0;return e===Number(t)?e:NaN},t.legalArrayIndex=function(t){var e=t>>>0;return String(e)===String(t)&&4294967295!==e?e:NaN},t.prototype.createObject=function(t){return this.createObjectProto(t&&t.properties.prototype)},t.prototype.createObjectProto=function(t){var e=new Xr(t);return this.isa(e,this.FUNCTION)&&(this.setProperty(e,"prototype",this.createObjectProto(this.OBJECT_PROTO||null)),e.class="Function"),this.isa(e,this.ARRAY)&&(this.setProperty(e,"length",0,{configurable:!1,enumerable:!1,writable:!0}),e.class="Array"),this.isa(e,this.ERROR)&&(e.class="Error"),e},t.prototype.populateRegExp=function(e,r){e.data=r,this.setProperty(e,"lastIndex",r.lastIndex,t.NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"source",r.source,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"global",r.global,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"ignoreCase",r.ignoreCase,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"multiline",r.multiline,t.READONLY_NONENUMERABLE_DESCRIPTOR)},t.prototype.createFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.parentScope=r,n.node=e,this.setProperty(n,"length",n.node.params.length,t.READONLY_DESCRIPTOR),n},t.prototype.createNativeFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.nativeFunc=e,e.id=this.functionCounter_++,this.setProperty(n,"length",e.length,t.READONLY_DESCRIPTOR),r?this.setProperty(n.properties.prototype,"constructor",n,t.NONENUMERABLE_DESCRIPTOR):!1===r&&(n.illegalConstructor=!0,this.setProperty(n,"prototype",void 0)),n},t.prototype.createAsyncFunction=function(e){var r=this.createObjectProto(this.FUNCTION_PROTO);return r.asyncFunc=e,e.id=this.functionCounter_++,this.setProperty(r,"length",e.length,t.READONLY_DESCRIPTOR),r},t.prototype.nativeToPseudo=function(t){if("boolean"==typeof t||"number"==typeof t||"string"==typeof t||null==t)return t;if(t instanceof RegExp){var e=this.createObjectProto(this.REGEXP_PROTO);return this.populateRegExp(e,t),e}if(t instanceof Function){var r=this;return this.createNativeFunction((function(){return r.nativeToPseudo(t.apply(r,Array.prototype.slice.call(arguments).map((function(t){return r.pseudoToNative(t)}))))}),void 0)}var n;if(Array.isArray(t)){n=this.createObjectProto(this.ARRAY_PROTO);for(var i=0;i>=":s>>=a;break;case">>>=":s>>>=a;break;case"&=":s&=a;break;case"^=":s^=a;break;case"|=":s|=a;break;default:throw SyntaxError("Unknown assignment expression: "+r.operator)}var u=this.setValue(e.leftReference_,s);if(u)return e.doneSetter_=s,this.createSetter_(u,e.leftReference_,s);t.pop(),t[t.length-1].value=s},t.prototype.stepBinaryExpression=function(t,e,r){if(!e.doneLeft_)return e.doneLeft_=!0,new Zr(r.left,e.scope);if(!e.doneRight_)return e.doneRight_=!0,e.leftValue_=e.value,new Zr(r.right,e.scope);t.pop();var n,i=e.leftValue_,o=e.value;switch(r.operator){case"==":n=i==o;break;case"!=":n=i!=o;break;case"===":n=i===o;break;case"!==":n=i!==o;break;case">":n=i>o;break;case">=":n=i>=o;break;case"<":n=i>":n=i>>o;break;case">>>":n=i>>>o;break;case"in":o&&o.isObject||this.throwException(this.TYPE_ERROR,"'in' expects an object, not '"+o+"'"),n=this.hasProperty(o,i);break;case"instanceof":this.isa(o,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Right-hand side of instanceof is not an object"),n=!!i.isObject&&this.isa(i,o);break;default:throw SyntaxError("Unknown binary operator: "+r.operator)}t[t.length-1].value=n},t.prototype.stepBlockStatement=function(t,e,r){var n=e.n_||0,i=r.body[n];if(i)return e.n_=n+1,new Zr(i,e.scope);t.pop()},t.prototype.stepBreakStatement=function(t,e,r){t.pop();var n=null;for(r.label&&(n=r.label.name);e&&"CallExpression"!==e.node.type&&"NewExpression"!==e.node.type;){if(n){if(e.labels&&-1!==e.labels.indexOf(n))return}else if(e.isLoop||e.isSwitch)return;e=t.pop()}throw SyntaxError("Illegal break statement")},t.prototype.stepCallExpression=function(e,r,n){if(!r.doneCallee_){r.doneCallee_=1;var i=new Zr(n.callee,r.scope);return i.components=!0,i}if(1===r.doneCallee_){r.doneCallee_=2;var o=r.value;if(Array.isArray(o)){if(r.func_=this.getValue(o),o[0]!==t.SCOPE_REFERENCE&&(r.funcThis_=o[0]),(o=r.func_)&&"object"==typeof o&&o.isGetter)return o.isGetter=!1,r.doneCallee_=1,this.createGetter_(o,r.value)}else r.func_=o;r.arguments_=[],r.n_=0}if(o=r.func_,!r.doneArgs_){if(0!==r.n_&&r.arguments_.push(r.value),n.arguments[r.n_])return new Zr(n.arguments[r.n_++],r.scope);"NewExpression"===n.type?(o.illegalConstructor&&this.throwException(this.TYPE_ERROR,o+" is not a constructor"),r.funcThis_=this.createObject(o),r.isConstructor=!0):void 0===r.funcThis_&&(r.funcThis_=r.scope.strict?void 0:this.global),r.doneArgs_=!0}if(r.doneExec_)e.pop(),r.isConstructor&&"object"!=typeof r.value?e[e.length-1].value=r.funcThis_:e[e.length-1].value=r.value;else{r.doneExec_=!0,o&&o.isObject||(console.log("non-function called",o,r),this.throwException(this.TYPE_ERROR,o+" is not a function"));var s=o.node;if(s){for(var a=this.createScope(s.body,o.parentScope),u=0;uu?r.arguments_[u]:void 0;this.setProperty(a,l,c)}var p=this.createObjectProto(this.ARRAY_PROTO);for(u=0;u=0)return!0;r=Object.getPrototypeOf(r)}return!1};function Qr(t,e){var r={},n=jt(t,{locations:!0,onComment:function(t,e,n,i,o,s){r[s.line]=e}});if("Program"!==n.type||1!==n.body.length||"FunctionDeclaration"!==n.body[0].type)throw new Error("JavaScript program should only have one function definition");var i=n.body[0].body.body,o=[],s=[];return i.forEach((function(t){if("ExpressionStatement"===t.type){var n=t.expression;if("AssignmentExpression"===n.type&&"="===n.operator&&"MemberExpression"===n.left.type&&"ThisExpression"===n.left.object.type&&"Identifier"===n.left.property.type){for(var i=[],a=n.loc.start.line-1;a>=0&&void 0!==r[a];a--)i.push(r[a]);if(!(i.length<=0)){var u=n.left.property.name;if(!(Array.isArray(e)&&e.indexOf(u)>=0)&&"FunctionExpression"!==n.right.type){var l=function(t,e,r){var n={name:t,title:{},className:null,proposed:!1,initialValue:null};if(e.forEach((function(t){var e=t.indexOf("@ui ");if(e>=0)n.description=t.substring(e+"@ui ".length).trim();else{var r=t.indexOf("@title ");if(r>=0){var i=t.substring(r+"@title ".length).trim();0===i.indexOf("@ja ")?n.title.ja=i.substring("@ja ".length).trim():n.title.default=i}else if(t.indexOf("@proposed")>=0)n.proposed=!0;else{var o=t.indexOf("@comment ");if(o>=0){var s=t.substring(o+"@comment ".length).trim();return n.comment||(n.comment={}),void(0===s.indexOf("@ja ")?n.comment.ja=s.substring("@ja ".length).trim():n.comment.default=s)}}}})),!n.description&&!n.comment)return null;if(n.proposed||n.comment)return n;var i=n.description.indexOf("("),o=n.description.indexOf(")",i);if(!(i<0||o<0)){n.className=n.description.substr(0,i);try{var s=new Hr("["+n.description.substr(i+1,o-i-1)+"]"),a=Date.now();for(s.unwrap=null,s.wrap=null;s.step()&&!(Date.now()-a>100););n.params=s.pseudoToNative(s.value)}catch(t){}return n.params||(n.params=[]),n}}(u,i);s.push(n),l&&o.push(l)}}}}})),{widgets:o,fields:s,ast:n}}function Kr(t,e){if(void 0===e&&(e=-1),!t)return{dependencyAtCursor:null,dependencies:[]};for(var r=[],n=null,i=("string"==typeof t?jt(t,Hr.PARSE_OPTIONS):t).body[0].body.body.slice(0);i.length>0;){var o=i.shift();if(null!=o)if("CallExpression"!==o.type)o.expression&&i.push(o.expression),o.object&&i.push(o.object),o.property&&i.push(o.property),o.name&&"string"!=typeof name&&i.push(o.name),o.left&&i.push(o.left),o.right&&i.push(o.right),o.id&&i.push(o.id),o.init&&i.push(o.init),o.callee&&i.push(o.callee),o.body&&Array.isArray(o.body)&&i.push.apply(i,o.body),o.declarations&&Array.isArray(o.declarations)&&i.push.apply(i,o.declarations),o.arguments&&Array.isArray(o.arguments)&&i.push.apply(i,o.arguments),o.params&&Array.isArray(o.params)&&i.push.apply(i,o.params);else if(o.callee.name&&"require"===o.callee.name){var s=o.arguments;if(s&&Array.isArray(s)&&1===s.length){var a=s[0];if("Literal"===a.type){var u=a.value;r.push(u),o.start&&o.end&&o.start<=e&&o.end>=e&&(n=u)}}}}return{dependencyAtCursor:n,dependencies:r}}Hr.Object=Xr,Hr.State=Zr;var tn=function(){return tn=Object.assign||function(t){for(var e,r=1,n=arguments.length;rt){i=!0;break}}catch(o){throw this.verbose&&console.log(r.stateStack),"string"==typeof o&&(o=new Error(o)),r.stateStack.length>0&&(o.node=r.stateStack[r.stateStack.length-1].node),o}if(i){var o=new Error("timeout: spent too long time (> "+t+"ms) to "+e);throw r.stateStack.length>0&&(o.node=r.stateStack[0].node),o}return this.interpreter.value},t.prototype.cleanupProperties=function(t){if(!t)return null;for(var e in this.ignoredPropNames.forEach((function(e){void 0!==t.properties[e]&&delete t.properties[e]})),t.properties)this.cleanupProperty(t.properties[e])||delete t.properties[e];return t.properties},t.prototype.cleanupProperty=function(t){if(rn(t))return!0;var e=t;if(e._native)return!0;var r=this.globalScope.properties;if(e.parent===r.Array){for(var n=e.length,i=0;i0}if(e.parent===r.Object){var o=!0;for(var s in e.properties)this.cleanupProperty(e.properties[s])?o=!1:delete e.properties[s];return!o}return!1},t.prototype.restoreProperties=function(t,e){e&&(t.properties=tn(tn({},t.properties),e))},t.prototype.wrap=function(t){if("object"==typeof t&&null!==t&&void 0!==t.constructor&&"string"==typeof t.constructor.className){var e=t.constructor.className,r=this.wrappers[e];if(void 0===r)return;var n=this.interpreter.createObject(r);return n._native=t,n}return this.verbose&&(rn(t)||Array.isArray(t)||console.log("wrap complex obj:",String(t))),this.interpreter.nativeToPseudo(t)},t.prototype.unwrap=function(t,e){return"object"==typeof t&&null!==t&&t._native?t._native:this.interpreter.pseudoToNative(t,e)},t.prototype.wrapClass=function(t,e){this.verbose&&console.log("--- wrapping "+e+" ---"),t.className=e;var r=this,n=this.interpreter.createNativeFunction((function(e){var i,o;if(i=r.interpreter.calledWithNew()?this:r.interpreter.createObjectProto(n.properties.prototype),void 0!==e)if(Array.isArray(e))for(var s=0;s0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=this.player.video.duration&&this.stop()},t}();function gn(){return pn(this,void 0,void 0,(function(){return hn(this,(function(t){return fn&&fn.Player?[2,fn]:"undefined"==typeof window?[2,import("songle-api")]:window.Songle&&window.Songle.Player?[2,window.Songle]:[2,new Promise((function(t){var e=!1;window.onSongleAPIReady=function(r){e=!0,t(fn=r)},setTimeout((function(){if(!e){var t=[];document.querySelectorAll("script").forEach((function(e){var r=e.getAttribute("src");r&&r.indexOf("songle.jp/v2/api.js")>=0&&t.push(e)})),t.forEach((function(t){return t.parentElement.removeChild(t)}));var r=document.createElement("script");r.src="https://api.songle.jp/v2/api.js",document.head.appendChild(r)}}),1e3)}))]}))}))}var mn=function(){function t(t){void 0===t&&(t={}),this.options=t,this.wait=50,this.volumeListener={onVolumeUpdate:this.onVolumeUpdate.bind(this)},this.resetProps()}return Object.defineProperty(t.prototype,"songlePlayer",{get:function(){return this._songlePlayer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._songlePlayer&&this._songlePlayer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"withSync",{get:function(){var t,e;return!(!(null===(t=this.options)||void 0===t?void 0:t.accessToken)&&!(null===(e=this.options)||void 0===e?void 0:e.secretToken))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){var t;if(!this._songlePlayer)return 0;if(this.lastPosition>0&&this.lastTime>0)return Date.now()+this.lastPosition-this.lastTime;var e=this._songlePlayer.positionTime;if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var r=this.lastTime,n=this.lastPosition,i=void 0;if(r>0){var o=Date.now()-r;i=Math.max(0,this.wait-o)}else i=this.wait;0===n&&e>=500?e=0:0===r&&e-n>=800&&(e=n+i)}return e},enumerable:!1,configurable:!0}),t.prototype.initialize=function(t){var e,r,n,i=t.player,o=t.updater,s=t.emitter,a=t.altSourceUrl;return pn(this,void 0,void 0,(function(){var t,l,c;return hn(this,(function(p){switch(p.label){case 0:return this.player&&this.player.removeListener(this.volumeListener),this.player=i,this.player.addListener(this.volumeListener),this.updateMediaPosition=o,this.emitter=s,this._songlePlayer?[3,2]:[4,this.initializeSonglePlayer()];case 1:p.sent(),p.label=2;case 2:return t=this.options.headless,l=a||this.options.altSourceUrls&&(null===(e=this.player.data.song)||void 0===e?void 0:e.permalink)&&this.options.altSourceUrls[null===(r=this.player.data.song)||void 0===r?void 0:r.permalink]||void 0,u.isUploaderUrl(l)&&(l=u.getAltSongUrlFromUploaderGuid(u.getUploaderGuid(u.getSongPathFromUrl(l)))),(c=(null===(n=this.player.data.song)||void 0===n?void 0:n.permalink)||l)===l&&(l=void 0),[4,this._songlePlayer.useMedia(c,{headless:t,altSourceUrl:l})];case 3:return p.sent(),this.ignoreSonglePlayerEvents=!0,this._songlePlayer.volume=0*(1-this.player.volume/100)+100*this.player.volume/100,this._songlePlayer.play(),this._songlePlayer.stop(),this.ignoreSonglePlayerEvents=!1,this.resetProps(),[2]}}))}))},t.prototype.resetProps=function(){this.lastPosition=0,this.lastTime=0,this.elapsedTimes=[]},t.prototype.initializeSonglePlayer=function(){var t;return pn(this,void 0,void 0,(function(){var e,r,n,i,o,s,a,u=this;return hn(this,(function(l){switch(l.label){case 0:return e=this.options,r=e.accessToken,n=e.secretToken,(o=this.options.songle)?[3,2]:[4,gn()];case 1:o=l.sent(),l.label=2;case 2:return(i=o).System&&(i.System.showLicense=!1),s=null===(t=this.options)||void 0===t?void 0:t.autoUseMedia,this._songlePlayer=this.withSync?new i.SyncPlayer({mediaElement:this.player.mediaSourceElement,accessToken:r,secretToken:n,autoUseMedia:s}):new i.Player({mediaElement:this.player.mediaSourceElement}),a=!1,this._songlePlayer.on("play",(function(){u.ignoreSonglePlayerEvents||(a=!1,u.handler||(u.startPolling(),u.emitter.onPlay()))})),this._songlePlayer.on("pause",(function(){return pn(u,void 0,void 0,(function(){return hn(this,(function(t){switch(t.label){case 0:return this.ignoreSonglePlayerEvents?[2]:(a=!1,this.stopPolling(),this.emitter.onPause(),this.stopping?(this.stopping=!1,[4,this.updateMediaPosition(0)]):[3,2]);case 1:t.sent(),this.resetProps(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("finish",(function(){return pn(u,void 0,void 0,(function(){return hn(this,(function(t){switch(t.label){case 0:return a=!1,this.handler?(this.stopPolling(),[4,this.updateMediaPosition(0)]):[3,2];case 1:t.sent(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("seek",(function(t){var e=t.data;return pn(u,void 0,void 0,(function(){return hn(this,(function(t){switch(t.label){case 0:return this._songlePlayer.isPlaying?[3,2]:(a=!1,[4,this.updateMediaPosition(e.positionTime)]);case 1:return t.sent(),this.emitter.onSeekComplete(e.positionTime),[3,4];case 2:return a=!0,[4,this.updateMediaPosition(this._songlePlayer.positionTime)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))})),this._songlePlayer.on("mediaSeek",(function(){a&&(u.emitter.onSeekComplete(u.position),a=!1)})),this.withSync&&(this._songlePlayer.on("mediaPlay",(function(){u.handler||(u.startPolling(),u.emitter.onPlay())})),this._songlePlayer.on("mediaFinish",(function(){u.handler&&(u.stopPolling(),u.emitter.onStop())}))),[2]}}))}))},t.prototype.play=function(){if(this._songlePlayer)return this._songlePlayer.play();this.emitter.onPlay()},t.prototype.stop=function(){if(this._songlePlayer)return this.stopping=this._songlePlayer.isPlaying,this._songlePlayer.stop();this.emitter.onStop()},t.prototype.pause=function(){if(this._songlePlayer)return this.stopping=!1,this._songlePlayer.pause();this.emitter.onPause()},t.prototype.seek=function(t){var e=this;this._songlePlayer?(this._songlePlayer.seekTo(t),this.emitter.onSeek(t)):this.updateMediaPosition(t).then((function(){e.emitter.onSeek(t)}))},t.prototype.startPolling=function(){var t,e=this;if(this.lastTime>0){var r=Date.now()-this.lastTime;t=Math.max(0,this.wait-r)}else t=this.wait;this.handler=setTimeout((function(){return pn(e,void 0,void 0,(function(){var e,r,n,i,o,s,a,u,l;return hn(this,(function(c){switch(c.label){case 0:return r=(e=this).lastTime,n=e.lastPosition,i=this._songlePlayer.positionTime,o=!1,"songle-api-html-media-element-media"===(null===(l=this._songlePlayer.media)||void 0===l?void 0:l.dispatcherName)&&(0===n&&i>=500?(i=0,o=!0):0===r&&i-n>=800&&(i=n+t,o=!0)),s=r>0?Date.now()-r:t,this.updateElapsedTimes(s),a=n>0?n+s:i,u=Math.abs(i-a),(a=u>2*this.wait?i:a<=i?.5*(a+i):Math.max(n,i))5*this.wait||(a=this.lastPosition)),o||(this.lastTime=Date.now()),this.lastPosition=a,[4,this.updateMediaPosition(a)];case 1:return c.sent(),this.handler&&this.startPolling(),[2]}}))}))}),t)},t.prototype.updateElapsedTimes=function(t){if(this.elapsedTimes.unshift(t),this.elapsedTimes=this.elapsedTimes.slice(0,10),this.elapsedTimes.length>=10){var e=this.elapsedTimes.reduce((function(t,e){return t+e}))/10;e>5*this.wait&&(this.player.stageScale=Math.max(.25,.9*this.player.stageScale),this.elapsedTimes=[]),e<1.2*this.wait&&this.player.stageScale<1&&(this.player.stageScale=Math.min(1,this.player.stageScale/.9),this.elapsedTimes=[])}},t.prototype.stopPolling=function(){var t;if(this.handler){if(clearTimeout(this.handler),this._songlePlayer)if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var e=this.lastTime,r=this.lastPosition,n=Date.now()-e;this.lastPosition=r+n}else this.lastPosition=this._songlePlayer.positionTime;this.lastTime=0}this.handler=null},t.prototype.dispose=function(){this.player&&this.player.removeListener(this.volumeListener),this._songlePlayer&&(this._songlePlayer.stop(),this._songlePlayer=null)},t.prototype.onVolumeUpdate=function(t){this._songlePlayer&&(this._songlePlayer.volume=t)},t}(),bn=function(){function t(t){this.listeners=[],this.throttleInterval=t&&t.throttleInterval?Number(t.throttleInterval):100}return t.prototype.onVideoLoad=function(t,e){this.listeners.forEach((function(r){return r.onVideoLoad&&r.onVideoLoad(t,e)}))},t.prototype.onSongLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongLoad&&r.onSongLoad(t,e)}))},t.prototype.onSongMapLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongMapLoad&&r.onSongMapLoad(t,e)}))},t.prototype.onSongInfoLoad=function(t,e){var r=!1;this.listeners.forEach((function(n){n.onSongInfoLoad&&(n.onSongInfoLoad(t,e),r=!0)})),r&&console.warn('[TextAlive API] "onSongInfoLoad" event is deprecated; use "onSongMapLoad" event instead')},t.prototype.onVocalAmplitudeLoad=function(t,e){this.listeners.forEach((function(r){return r.onVocalAmplitudeLoad&&r.onVocalAmplitudeLoad(t,e)}))},t.prototype.onValenceArousalLoad=function(t,e){this.listeners.forEach((function(r){return r.onValenceArousalLoad&&r.onValenceArousalLoad(t,e)}))},t.prototype.onLyricsLoad=function(t,e){this.listeners.forEach((function(r){return r.onLyricsLoad&&r.onLyricsLoad(t,e)}))},t.prototype.onTextLoad=function(t,e){this.listeners.forEach((function(r){return r.onTextLoad&&r.onTextLoad(t,e)}))},t.prototype.onAppLoad=function(t){this.listeners.forEach((function(e){return e.onAppLoad&&e.onAppLoad(t)}))},t.prototype.onAppReady=function(t){this.listeners.forEach((function(e){return e.onAppReady&&e.onAppReady(t)}))},t.prototype.onAppParameterUpdate=function(t,e){this.listeners.forEach((function(r){return r.onAppParameterUpdate&&r.onAppParameterUpdate(t,e)}))},t.prototype.onAppMediaChange=function(t,e){this.listeners.forEach((function(r){return r.onAppMediaChange&&r.onAppMediaChange(t,e)}))},t.prototype.onTemplateUpdate=function(t){this.listeners.forEach((function(e){return e.onTemplateUpdate&&e.onTemplateUpdate(t)}))},t.prototype.onTemplateCommit=function(t){this.listeners.forEach((function(e){return e.onTemplateCommit&&e.onTemplateCommit(t)}))},t.prototype.onTemplatesLoad=function(t,e){this.listeners.forEach((function(r){return r.onTemplatesLoad&&r.onTemplatesLoad(t,e)}))},t.prototype.onFontsLoad=function(t,e){this.listeners.forEach((function(r){return r.onFontsLoad&&r.onFontsLoad(t,e)}))},t.prototype.onVideoReady=function(t){this.listeners.forEach((function(e){return e.onVideoReady&&e.onVideoReady(t)}))},t.prototype.onTimerReady=function(t){this.listeners.forEach((function(e){return e.onTimerReady&&e.onTimerReady(t)}))},t.prototype.onStageElementSet=function(t){this.listeners.forEach((function(e){return e.onStageElementSet&&e.onStageElementSet(t)}))},t.prototype.onMediaElementSet=function(t){this.listeners.forEach((function(e){return e.onMediaElementSet&&e.onMediaElementSet(t)}))},t.prototype.onTimeUpdate=function(t){var e=this;this.listeners.forEach((function(e){return e.onTimeUpdate&&e.onTimeUpdate(t)})),this.position=t,this.throttledTimeUpdate||(this.throttledTimeUpdate=new Promise((function(t,r){setTimeout((function(){e.onThrottledTimeUpdate(e.position),e.throttledTimeUpdate=null,t()}),e.throttleInterval)})))},t.prototype.onThrottledTimeUpdate=function(t){this.listeners.forEach((function(e){return e.onThrottledTimeUpdate&&e.onThrottledTimeUpdate(t)}))},t.prototype.onBackgroundGraphicsUpdate=function(t){this.listeners.forEach((function(e){return e.onBackgroundGraphicsUpdate&&e.onBackgroundGraphicsUpdate(t)}))},t.prototype.onMediaSeek=function(t){this.listeners.forEach((function(e){return e.onMediaSeek&&e.onMediaSeek(t)}))},t.prototype.onVideoSeekStart=function(){this.listeners.forEach((function(t){return t.onVideoSeekStart&&t.onVideoSeekStart()}))},t.prototype.onVideoSeekEnd=function(){this.listeners.forEach((function(t){return t.onVideoSeekEnd&&t.onVideoSeekEnd()}))},t.prototype.onVideoSeek=function(t){this.listeners.forEach((function(e){return e.onVideoSeek&&e.onVideoSeek(t)}))},t.prototype.onPlay=function(){this.listeners.forEach((function(t){return t.onPlay&&t.onPlay()}))},t.prototype.onPause=function(){this.listeners.forEach((function(t){return t.onPause&&t.onPause()}))},t.prototype.onSeek=function(t){this.listeners.forEach((function(e){return e.onSeek&&e.onSeek(t)}))},t.prototype.onSeekComplete=function(t){this.listeners.forEach((function(e){return e.onSeekComplete&&e.onSeekComplete(t)}))},t.prototype.onStop=function(){this.listeners.forEach((function(t){return t.onStop&&t.onStop()}))},t.prototype.onDispose=function(){this.listeners.forEach((function(t){return t.onDispose&&t.onDispose()}))},t.prototype.onResize=function(t){this.listeners.forEach((function(e){return e.onResize&&e.onResize(t)}))},t.prototype.onVolumeUpdate=function(t){this.listeners.forEach((function(e){return e.onVolumeUpdate&&e.onVolumeUpdate(t)}))},t.prototype.addListener=function(t){!t||this.listeners.indexOf(t)>=0||this.listeners.push(t)},t.prototype.removeListener=function(t){var e=!1;return this.listeners=this.listeners.filter((function(r){var n=r===t;return e=e||n,!n})),e},t}(),_n=function(){function t(t,e,r){var n=this;this.player=t,this.manager=e,this.emitter=r,this._defaultBackgroundCss=null,this._background=null,t.addListener({onStageElementSet:function(t){return n.doUpdateBackground(n.background)}})}return Object.defineProperty(t.prototype,"background",{get:function(){return this._background},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultBackgroundCss",{get:function(){return this._defaultBackgroundCss?this._defaultBackgroundCss:""},set:function(t){this._defaultBackgroundCss=t,this.updateBackground(this._background)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return null!==this._background},enumerable:!1,configurable:!0}),t.prototype.settingBackground=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){switch(e.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,e.sent()&&this.doUpdateBackground(t)]}}))}))},t.prototype.setBackground=function(t){return pn(this,void 0,void 0,(function(){var e;return hn(this,(function(r){switch(r.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,(e=r.sent())&&this.updateBackground(e)]}}))}))},t.prototype.doSetBackground=function(t){return pn(this,void 0,void 0,(function(){var e,r,n;return hn(this,(function(i){switch(i.label){case 0:return e=t&&t.originalUrl?t.originalUrl:"",this.manager.isBackgroundColorAsset(t)?[2,{css:e,originalUrl:e}]:this.manager.isBackgroundPiaproImageAsset(t)?[4,this.manager.read(e)]:[3,2];case 1:return(r=i.sent())&&r.url&&this.manager.checkBackgroundImageLicense(r.license)?(r.originalUrl=e,t&&(r.x=t.x,r.y=t.y),[2,r]):[2,{css:"",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,license:r?r.license:void 0}];case 2:return this.manager.isBackgroundSpecialImageAsset(t)?[2,{css:'url("https://api.textalive.jp/images/backgrounds/snowmiku2016/'+(n=/^snowmiku2016-([0-9]{2})$/.exec(e))[1]+'.jpg")',contentUrl:"https://api.textalive.jp/images/backgrounds/snowmiku2016/"+n[1]+".jpg",url:"https://snowmiku.com/2016/info_chara.html",name:"SNOW MIKU 2016",authorName:"豆の素",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,defaultY:0}]:[2,{originalUrl:null,css:"",x:t?t.x:void 0,y:t?t.y:void 0}]}}))}))},t.prototype.updateBackground=function(t){return!!this.doUpdateBackground(t)&&(this.emitter&&this.emitter.onBackgroundGraphicsUpdate&&this.emitter.onBackgroundGraphicsUpdate(t),!0)},t.prototype.doUpdateBackground=function(t){if(!t)return!1;if(!this.player.stageElement)return this._background=t,!0;var e=this.player.stageElement.style;return t.css.length<=0?e.background=this.defaultBackgroundCss:e.background=t.css,"number"==typeof t.x||this._background&&"number"==typeof this._background.x?("number"!=typeof t.x&&(t.x=this._background.x),e.backgroundPositionX=e.backgroundPositionX+"%"):e.backgroundPositionX="number"==typeof t.defaultX?t.defaultX+"%":"center","number"==typeof t.y||this._background&&"number"==typeof this._background.y?("number"!=typeof t.y&&(t.y=this._background.y),e.backgroundPositionY=e.backgroundPositionY+"%"):e.backgroundPositionY="number"==typeof t.defaultY?t.defaultY+"%":"center",e.backgroundSize="cover",this._background=t,!0},t.prototype.export=function(){if(!this.background||!this.background.originalUrl)return null;var t={originalUrl:this.background.originalUrl};return void 0!==this.background.x&&(t.x=this.background.x),void 0!==this.background.y&&(t.y=this.background.y),t},t.prototype.exportPartialVideoEntry=function(t){return{background:this.export()}},t}();function wn(t,e,r){return pn(this,void 0,void 0,(function(){var n,i,o,s,a,u,l,c,p,h,d,f,y,v;return hn(this,(function(g){switch(g.label){case 0:if(n={loaded:[],failed:[]},"undefined"==typeof window||!window.document||!window.document.head)return n.failed=t.slice(),[2,n];for(i=r.split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort(),o=!0,s=0,i.forEach((function(t){var r=e.indexOf(t,s);o=o&&r>=0,s=r})),a=window.document.head,u=[],l=0;l0&&(f.google={families:d}),h.length>0&&(f.custom={families:h,urls:p}),g.label=1;case 1:return g.trys.push([1,5,,6]),(v="undefined"!=typeof window&&(null===window||void 0===window?void 0:window.WebFont))?[3,3]:[4,import("webfontloader")];case 2:v=g.sent(),g.label=3;case 3:return y=v,[4,new Promise((function(t){f.active=f.inactive=t,y.load(f)}))];case 4:case 5:return g.sent(),[3,6];case 6:return[2,n]}}))}))}function Pn(t,e){return pn(this,void 0,void 0,(function(){var r,n,i,o,s,a,u,l;return hn(this,(function(c){switch(c.label){case 0:if(r={loaded:[],failed:[]},!("undefined"!=typeof window&&window.document&&window.document.head&&window.Ts&&window.Ts.loadFontAsync))return r.failed=t.slice(),[2,r];for(n=window.document.head,i={},o=function(t){var e=n.children.item(t);if("style"!==e.tagName.toLowerCase()||"text/css"!==e.getAttribute("type")||"stylesheet"!==e.getAttribute("rel")||!e.hasAttribute("data-cssName"))return"continue";var r=e.getAttribute("data-cssName");if(void 0===i[r])return i[r]=new Set(e.getAttribute("data-text")),{value:void 0};e.getAttribute("data-text").split("").forEach((function(t){return i[r].add(t)}))},s=0;s=0})))]}}))}))},t.prototype.listFontFamiliesInVideo=function(t){if(!t||!t.phrases)return null;var e=[];return t.phrases.forEach((function(t){return t.words.forEach((function(t){return t.characters.forEach((function(t){return e.push(t.fontFamily)}))}))})),e.filter((function(t,e,r){return r.indexOf(t)===e}))},t.prototype.listAvailableFonts=function(){return pn(this,void 0,void 0,(function(){return hn(this,(function(t){return[2,this.fontInfoManager.listAvailableFonts()]}))}))},t.prototype.isLoading=function(){return!!this.queue},t.prototype.load=function(t){return pn(this,void 0,void 0,(function(){var e,r;return hn(this,(function(n){switch(n.label){case 0:return e=[],r=[],t.forEach((function(t){"string"==typeof t?e.push(t):r.push(t)})),[4,this.fontInfoManager.listAvailableFonts()];case 1:return n.sent().forEach((function(t){e.indexOf(t.key)>=0&&r.push(t)})),[2,this.loadFonts(r)]}}))}))},t.prototype.loadFonts=function(t){return pn(this,void 0,void 0,(function(){var e=this;return hn(this,(function(r){return this.queue?(this.listener&&this.listener.onFontsLoad&&this.listener.onFontsLoad(null,new En("Failed to load some fonts because there is an ongoing font loding process",this.failed.slice())),[2,this.loaded]):(this.queue=this.doLoad(t).then((function(t){return e.queue=null,t})),[2,this.queue])}))}))},t.prototype.doLoad=function(t){return pn(this,void 0,void 0,(function(){var e,r,n,i,o=this;return hn(this,(function(s){switch(s.label){case 0:return e=[],r=[],[4,this.fontInfoManager.getFrequentChars()];case 1:return n=s.sent(),t.forEach((function(t){t.typesquare||t.typekit||e.push(t),t.typesquare&&r.push(t)})),i=(this.textFetcher&&this.textFetcher()||"").split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort().join(""),[2,Promise.all([wn(e,n,i),Pn(r,i)]).then((function(t){var e=t[0],r=t[1],n=e.loaded.concat(r.loaded);if(o.addLoadedFonts(n),e.failed.length>0||r.failed.length>0){var i=e.failed.concat(r.failed);o.addFailedFonts(i),o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new En("Failed to load some fonts",o.failed.slice()))}else o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(n);return o.loaded})).catch((function(t){return o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new En(t,o.failed.slice())),o.loaded}))]}}))}))},t.prototype.addLoadedFonts=function(t){var e=this;this._loaded=this.loaded.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t.prototype.addFailedFonts=function(t){var e=this;this._failed=this.failed.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t}(),Sn=function(){function t(){}return Object.defineProperty(t.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){return this.contains(t)||this.contains(e)||this.startTime<=t&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?this.startTime===this.endTime?0:(t-this.startTime)/(this.endTime-this.startTime):-1},t}(),Tn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return ln(e,t),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.next?this.next.startTime:this.startTime},enumerable:!1,configurable:!0}),e}(Sn),xn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return ln(e,t),e}(Sn),An=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return ln(e,t),e}(Sn),Rn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return ln(e,t),e}(Sn),Cn=function(){function t(t){var e=t.analysis,r=t.info;this.beats=[],this.chords=[],this.segments=[],this.voice=[],this._revisions={beatId:r.beatRevisionId,chordId:r.chordRevisionId,repetitiveSegmentId:r.chorusRevisionId},this.parseBeats(e.beats),this.parseSegments(e.repetitive_segment),this.parseChords(e.chords),e.voice&&this.parseVoice(e.voice)}return Object.defineProperty(t.prototype,"revisions",{get:function(){return this._revisions},enumerable:!1,configurable:!0}),t.prototype.parseBeats=function(t){var e=this;if(Array.isArray(t)&&Array.isArray(t[0])){var r=null,n=0;t[0].forEach((function(t){var i=new Tn;i.startTime=1e3*t[0],i.length=t[2],i.position=t[3],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.beats.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseChords=function(t){var e=this;if(Array.isArray(t)){var r=null,n=0;t.forEach((function(t){var i=new xn;i.startTime=1e3*t[0],i.endTime=1e3*t[1],i.name=t[2],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.chords.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseSegments=function(t){var e=this;Array.isArray(t)&&t.forEach((function(t){var r={chorus:!!t.chorus,duration:10*t.segment_length,segments:null},n=null,i=0;r.segments=t.start_frames.map((function(t){var e=new An;return e.startTime=10*t,e.endTime=e.startTime+r.duration,e.previous=n,null!==n&&(n.next=e),e.index=i++,n=e,e})),null!==n&&(n.next=null),e.segments.push(r)}))},t.prototype.parseVoice=function(t){var e=this;Array.isArray(t)&&t.forEach((function(t){var r=[],n=null,i=0,o=0;t.forEach((function(t){var e=new Rn;e.startTime=o,e.endTime=e.startTime+10*t[1],e.f0=t[0][0],e.initialF0=t[0][1],e.previous=n,null!==n&&(n.next=e),e.index=i++,r.push(e),n=e,o=e.endTime})),null!==n&&(n.next=null),e.voice.push(r)}))},t}();function Nn(t,e,r){for(var n=r&&"number"!=typeof e?r(e):e,i=0,o=t.length;i>>1;(r?r(t[s]):t[s])=e.length?-1:this._vocalAmplitude[r]},t.prototype.getMaxVocalAmplitude=function(){return"number"==typeof this._maxVocalAmplitude?this._maxVocalAmplitude:-1},t.prototype.getValenceArousal=function(t){var e=this._valenceArousal;if(!e)return null;var r=Nn(e.seq,t,(function(t){return 1e3*t.t[1]}));if(r<0)return{a:e.seq[0].a,v:e.seq[0].v};if(r+1>=e.seq.length||t<1e3*e.seq[r+1].t[0])return{a:e.seq[Math.min(r,e.seq.length-1)].a,v:e.seq[Math.min(r,e.seq.length-1)].v};var n=e.seq[r],i=e.seq[r+1],o=t/1e3,s=i.t[0],a=n.t[1],u=a-s;return{a:(n.a*(a-o)+i.a*(o-s))/u,v:(n.v*(a-o)+i.v*(o-s))/u}},t.prototype.getMedianValenceArousal=function(){var t=this._valenceArousal;return t?t.stats.median:null},t}(),jn=function(){function t(t,e,r){this.songManager=t,this.options=r,this.listener=e}return Object.defineProperty(t.prototype,"song",{get:function(){return this._song},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"analysis",{get:function(){return this._analysis},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vocalAmplitude",{get:function(){return this._vocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxVocalAmplitude",{get:function(){return this._maxVocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valenceArousal",{get:function(){return this._valenceArousal},enumerable:!1,configurable:!0}),t.prototype.loadSong=function(t,e){var r,n,i;return pn(this,void 0,void 0,(function(){var o,s;return hn(this,(function(a){switch(a.label){case 0:return"number"==typeof t&&t<0||!t?(this.onSongLoad(null,new Error("Neither Songle ID or code provided")),[2,null]):[4,this.songManager.load("number"==typeof t?{id:t}:{code:t})];case 1:return o=a.sent(),this.onSongLoad(o,o?void 0:new Error("Song data not found")),o?(s={chord:null==e?void 0:e.chordId,beat:null==e?void 0:e.beatId,chorus:null==e?void 0:e.repetitiveSegmentId},[4,Promise.all([(null===(r=this.options)||void 0===r?void 0:r.vocalFrequencyEnabled)?this.loadSongDetailInfo(o.song.code,{revisions:s}):this.loadSongInfo(o.song.code,{revisions:s}),(null===(n=this.options)||void 0===n?void 0:n.vocalAmplitudeEnabled)?this.loadVocalAmplitude(o.song.code):Promise.resolve(null),(null===(i=this.options)||void 0===i?void 0:i.valenceArousalEnabled)?this.loadValenceArousal(o.song.code):Promise.resolve(null)])]):[2,null];case 2:return a.sent(),[2,new kn(this)]}}))}))},t.prototype.onSongLoad=function(t,e){this._song=t,this.listener&&this.listener.onSongLoad&&this.listener.onSongLoad(t,e)},t.prototype.loadSongInfo=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.loadSongDetailInfo=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadDetailInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.mockSongInfo=function(t){var e=function(t){for(var e=t.beat,r=t.chorusSegment,n=t.duration,i=[],o=0;60*o/e.bpm=0,r=this.managers.lyrics.fetchLyricBody(n||t.url,{parserPath:t.parser_path,directAccess:i}),[4,e?Promise.race([r,new Promise((function(t,e){return setTimeout((function(){return e(new Error("Fetching lyrics text timeout"))}),o.options.lyricsFetchTimeout)}))]):r];case 1:return[2,s.sent()]}}))}))},t.prototype.onLyricsLoad=function(t,e){this.listener&&this.listener.onLyricsLoad&&this.listener.onLyricsLoad(t,e)},t.prototype.onTextLoad=function(t,e){this.listener&&this.listener.onTextLoad&&this.listener.onTextLoad(t,e)},t}(),Un=function(){function t(t){var e=t.video;this._video=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._video.json},enumerable:!1,configurable:!0}),t}(),Fn=function(){function t(t,e){this.managers=t,this.listener=e,this.listener=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),t.prototype.onVideoLoad=function(t,e){var r=t?Object.assign(t,e):null;return r&&("string"==typeof r.json?r.json=JSON.parse(r.json):"object"==typeof r.json&&null!==r.json||(r.json={}),"string"==typeof r.config?r.config=JSON.parse(r.config):"object"==typeof r.config&&null!==r.config||(r.config={})),this._video=r,this.listener&&this.listener.onVideoLoad&&this.listener.onVideoLoad(r),new Un({video:r})},t.prototype.createFromVideoId=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,this.managers.video.load(t)];case 1:return r=n.sent(),[2,this.onVideoLoad(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return this.onVideoLoad(t,e)},t.prototype.createFromSongUrl=function(t,e){return pn(this,void 0,void 0,(function(){return hn(this,(function(r){return[2,this.createFromSongPath(this.managers.song.getSongPathFromUrl(t),e)]}))}))},t.prototype.createFromSongPath=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({songPath:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongId=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({id:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongCode=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({code:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSong=function(t,e){var r;return pn(this,void 0,void 0,(function(){var n,i,o,s,a,u;return hn(this,(function(l){switch(l.label){case 0:return n=null==e?void 0:e.lyricId,i=null==e?void 0:e.lyricDiffId,"number"!=typeof n||n<0?[4,this.managers.lyrics.load(t.code)]:[3,4];case 1:return o=l.sent(),(a=o&&!o.status.failed&&!o.status.processing&&Array.isArray(o.lyrics)&&o.lyrics.length>0)?[4,this.managers.lyrics.loadDetail(t.code,o.lyrics[0].id)]:[3,3];case 2:a=l.sent(),l.label=3;case 3:(s=a)&&(n=s.id,i=null===(r=s.diff)||void 0===r?void 0:r.id),l.label=4;case 4:return"number"!=typeof n&&(n=-1),"number"!=typeof i&&(i=-1),u={id:-1,sourceId:-1,sourceOriginId:-1,songleId:t.id,songleCode:t.code,lyricId:n,lyricDiffId:i,title:null,log:null,background:null,config:null,json:null,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null},[2,this.onVideoLoad(u,e)]}}))}))},t.prototype.createFromText=function(t,e){return pn(this,void 0,void 0,(function(){var r,n,i,o,s,a;return hn(this,(function(u){switch(u.label){case 0:return[4,this.managers.text.parse(t)];case 1:return r=u.sent(),n=r&&"success"===r.status?this.createVideoDataFromParsedText(r,t):this.createVideoDataFromText(t),i=n[n.length-1],o=i&&i.words[i.words.length-1],s=o&&o.characters[o.characters.length-1],a=s?s.endTime:0,[2,this.createFromJSON({phrases:n,startTime:0,endTime:a,duration:a},e)]}}))}))},t.prototype.createFromJSON=function(t,e){var r={id:-1,sourceId:-1,sourceOriginId:-1,songleId:-1,lyricId:-1,lyricDiffId:-1,title:null,log:null,background:null,config:null,json:t,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null};return this.onVideoLoad(r,e)},t.prototype.createVideoDataFromParsedText=function(t,e){var r=0,n=e.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/);return t.result.map((function(t,e){return{words:t.map((function(t){return{characters:n[e].substr(t.startPosition,t.wordLength).split("").map((function(t){return{char:t,startTime:300*r,endTime:300*++r}})),pos:t.PoS,rawPoS:t.rawPoS,language:t.language}})),templates:[{type:"DefaultAlignment"}]}}))},t.prototype.createVideoDataFromText=function(t){for(var e,r={characters:[]},n={words:[r],templates:[{type:"DefaultAlignment"}]},i=0,o=[n],s=0;s=0?(this.fontLoader.loadForVideo(null===(t=this.videoProvider)||void 0===t?void 0:t.data),[2]):Array.isArray(null===(e=this.options)||void 0===e?void 0:e.fontFamilies)?(this.fontLoader.load(this.options.fontFamilies),[2]):null===(null===(r=this.options)||void 0===r?void 0:r.fontFamilies)?(this.fontLoader.loadAll(),[2]):[2]}))}))},t.prototype.importLyrics=function(){var t=this.text.replace(/[\s\r\n]/g,""),e=0,r={phrases:this.lyrics.data.map((function(r){return{words:r.map((function(r){return{characters:r.map((function(r){return{char:t.charAt(e++),startTime:1e3*r.start_time,endTime:1e3*r.end_time}}))}}))}}))};this.video.json&&Array.isArray(this.video.json.phrases)?this.video.json.phrases.forEach((function(t,e){t.words.forEach((function(t,n){t.characters.forEach((function(t,i){var o=r.phrases[e].words[n].characters[i];t.char=o.char,t.startTime=o.startTime,t.endTime=o.endTime}))}))})):this.video.json=r},t.prototype.getChoruses=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChoruses()},t.prototype.findChorus=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorusBetween(t,e)},t.prototype.getBeats=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getBeats()},t.prototype.findBeat=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findBeat(t,e)},t.prototype.getChords=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChords()},t.prototype.findChord=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChord(t,e)},t.prototype.getVocalFrequency=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMedianValenceArousal()},t}(),Dn=function(){function t(t,e){this.player=t,this.listener=e,this.initialize()}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?cn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"author",{get:function(){return this._author},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"server",{get:function(){return this._server},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"managed",{get:function(){return!!this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songUrl",{get:function(){return this._songUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songOptions",{get:function(){return this._songOptions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parameters",{get:function(){return this._parameters},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isConnecting",{get:function(){return!!this.connecting},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t,e,r,n;return pn(this,void 0,void 0,(function(){return hn(this,(function(i){switch(i.label){case 0:return this._options=null===(e=null===(t=this.player)||void 0===t?void 0:t.options)||void 0===e?void 0:e.app,this._options&&(this._options=cn({},this._options),this._name=null===(r=this._options)||void 0===r?void 0:r.appName,this._author=null===(n=this._options)||void 0===n?void 0:n.appAuthor,this._options.token&&(g.textalive.appToken=this._options.token)),this._parameters={},this.parseQueryString(),this.initializeServerConnection(),"undefined"!=typeof window&&this._options?[4,this.connect()]:[3,2];case 1:i.sent(),this.initializePlayerListener(),this.initializeMessageListener(),i.label=2;case 2:return this._songUrl&&this.createFromSongUrl(),[2]}}))}))},t.prototype.initializeServerConnection=function(){var t,e,r,n,i,o;return pn(this,void 0,void 0,(function(){var s,a,u,l,c;return hn(this,(function(p){switch(p.label){case 0:return[4,T.getServerStatus()];case 1:return s=p.sent(),a="ja"===(null==s?void 0:s.lang),g.textalive.appToken&&(null==s?void 0:s.app)&&(s.app.data&&(this._name=null===(t=s.app.data)||void 0===t?void 0:t.name,this._author=null===(r=null===(e=s.app)||void 0===e?void 0:e.data)||void 0===r?void 0:r.author,u=null===(i=null===(n=s.app)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status,this._status="number"==typeof u?u:-1),this._server={version:s.version,message:s.app.message,error:s.app.error},!this._server.error)?(l=this._server.message?"\n"+this._server.message:"",a?console.info("[TextAlive API] クライアント v"+g.client.version+" でサーバ v"+(this._server.version||"0.0.0")+" に接続"+l):console.info("[TextAlive API] App API client v"+g.client.version+" connected to server v"+(this._server.version||"0.0.0")+l),this.listener.onAppLoad(this),[2]):(c=(null===(o=this._server)||void 0===o?void 0:o.error)?"\n"+this._server.error:"",a?console.warn("[TextAlive API] このアプリはトークンが正しく指定されていないため動作しません。 https://developer.textalive.jp からトークンを入手して指定してください。"+c):console.warn("[TextAlive API] This app requires a valid app token to run properly. You could get a token from https://developer.textalive.jp."+c),this.listener.onAppLoad(null,c),[2])}}))}))},t.prototype.initializePlayerListener=function(){var t=this;this.playerListener={onVideoReady:function(e){t._host&&window.parent.postMessage({kind:"ta_video",options:{lyrics:!!t.player.data.lyrics,duration:t.player.video.duration}},"*")},onThrottledTimeUpdate:function(e){t._host&&window.parent.postMessage({kind:"ta_position",options:{position:e}},"*")},onPlay:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"play"}},"*")},onPause:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"pause"}},"*")},onStop:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"stop"}},"*")},onDispose:function(){t.dispose()}},this.player.addListener(this.playerListener)},t.prototype.initializeMessageListener=function(){var t=this;this.messageListener=function(e){if(e.data.kind&&/^ta_/.test(e.data.kind)){var r=t.player;switch(e.data.kind.substring("ta_".length)){case"status":switch(e.data.options.status){case"play":r.requestPlay();break;case"pause":r.requestPause();break;case"stop":r.requestStop()}break;case"seek":r.requestMediaSeek(e.data.options.position);break;case"parameter":var n=e.data.options,i=n.name,o=n.value;t.parameters[i]=o,t.listener.onAppParameterUpdate(i,o);break;case"media":t._songUrl=e.data.options.url,t._songOptions=e.data.options.options||{},r.requestStop();var s=t.createFromSongUrl();t.listener.onAppMediaChange(t._songUrl,s)}}},window.addEventListener("message",this.messageListener)},t.prototype.createFromSongUrl=function(){var t,e=this._songOptions;return e&&(t={video:{}},e.altLyricsUrl&&(t.altLyricsUrl=e.altLyricsUrl),e.lyricsDirectAccess&&(t.lyricsDirectAccess=e.lyricsDirectAccess),e.lyricId&&(t.video.lyricId=e.lyricId),e.lyricDiffId&&(t.video.lyricDiffId=e.lyricDiffId),e.chordId&&(t.video.chordId=e.chordId),e.beatId&&(t.video.beatId=e.beatId),e.repetitiveSegmentId&&(t.video.repetitiveSegmentId=e.repetitiveSegmentId)),this.player.createFromSongUrl(this._songUrl,t)},t.prototype.parseQueryString=function(){var t=an("ta_app_token");t&&(g.textalive.appToken=t),this._songUrl=an("ta_song_url"),this._songOptions={};var e=an("ta_lyric_id");e&&(this._songOptions.lyricId=parseInt(e),isNaN(this._songOptions.lyricId)&&delete this._songOptions.lyricId);var r=an("ta_lyric_diff_id");r&&(this._songOptions.lyricDiffId=parseInt(r),isNaN(this._songOptions.lyricDiffId)&&delete this._songOptions.lyricDiffId);var n=an("ta_alt_lyrics_url");n&&(this._songOptions.altLyricsUrl=n);var i=an("ta_lyrics_direct_access");i&&(this._songOptions.lyricsDirectAccess="true"===i,this._songOptions.lyricsDirectAccess||delete this._songOptions.lyricsDirectAccess);var o=an("ta_chord_id");o&&(this._songOptions.chordId=parseInt(o),isNaN(this._songOptions.chordId)&&delete this._songOptions.chordId);var s=an("ta_beat_id");s&&(this._songOptions.beatId=parseInt(s),isNaN(this._songOptions.beatId)&&delete this._songOptions.beatId);var a=an("ta_repetitive_segment_id");a&&(this._songOptions.repetitiveSegmentId=parseInt(a),isNaN(this._songOptions.repetitiveSegmentId)&&delete this._songOptions.repetitiveSegmentId)},t.prototype.connect=function(){return pn(this,void 0,void 0,(function(){var t,e=this;return hn(this,(function(r){switch(r.label){case 0:return this.connecting?[2,this.connecting]:"undefined"!=typeof window&&this.options&&window.parent&&window!==window.parent?[3,2]:[4,new Promise((function(t){return setTimeout(t,1)}))];case 1:return r.sent(),this.listener.onAppReady(this),[2,!1];case 2:return this.connecting=Promise.race([new Promise((function(r){t=function(n){n.data.kind&&/^ta_/.test(n.data.kind)&&"ack"===n.data.kind.substring("ta_".length)&&(window.removeEventListener("message",t),e._host=n.data.options,r(!0))},window.addEventListener("message",t)})),pn(e,void 0,void 0,(function(){var e;return hn(this,(function(r){switch(r.label){case 0:e=0,r.label=1;case 1:return e<5?(window.parent.postMessage({kind:"ta_connect",options:this.options},"*"),[4,new Promise((function(t){return setTimeout(t,200)}))]):[3,4];case 2:if(r.sent(),this._host)return[3,4];r.label=3;case 3:return e++,[3,1];case 4:return!this._host&&t&&window.removeEventListener("message",t),[2,!!this._host]}}))}))]),this.connecting.finally((function(){e.connecting=null,e.listener.onAppReady(e)})),[2,this.connecting]}}))}))},t.prototype.dispose=function(){"undefined"!=typeof window&&this.options&&(this.player.removeListener(this.playerListener),window.removeEventListener("message",this.messageListener)),this._host=null,this.player=null},t}();function Mn(t){return t}function Bn(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0==t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}function Vn(t){return function(e){return Math.pow(e,t)}}function Gn(t){return function(e){return 1-Math.pow(1-e,t)}}function qn(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}var Wn=Vn(2),Yn=Gn(2),zn=qn(2),Jn=Vn(3),Hn=Gn(3),Xn=qn(3),Zn=Vn(4),$n=Gn(4),Qn=qn(4),Kn=Vn(5),ti=Gn(5),ei=qn(5);function ri(t){return 1-Math.cos(t*Math.PI/2)}function ni(t){return Math.sin(t*Math.PI/2)}function ii(t){return-.5*(Math.cos(Math.PI*t)-1)}function oi(t){return function(e){return e*e*((t+1)*e-t)}}var si=oi(1.7);function ai(t){return function(e){return--e*e*((t+1)*e+t)+1}}var ui=ai(1.7);function li(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}var ci=li(1.7);function pi(t){return-(Math.sqrt(1-t*t)-1)}function hi(t){return Math.sqrt(1- --t*t)}function di(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function fi(t){return 1-yi(1-t)}function yi(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function vi(t){return t<.5?.5*fi(2*t):.5*yi(2*t-1)+.5}function gi(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return-t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)}}var mi=gi(1,.3);function bi(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return t*Math.pow(2,-10*n)*Math.sin((n-i)*r/e)+1}}var _i=bi(1,.3);function wi(t,e){var r=2*Math.PI;return function(n){var i=e/r*Math.asin(1/t);return(n*=2)<1?t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)*-.5:t*Math.pow(2,-10*(n-=1))*Math.sin((n-i)*r/e)*.5+1}}var Pi=wi(1,.3*1.5),Ei=Object.freeze({__proto__:null,linear:Mn,get:Bn,getPowIn:Vn,getPowOut:Gn,getPowInOut:qn,quadIn:Wn,quadOut:Yn,quadInOut:zn,cubicIn:Jn,cubicOut:Hn,cubicInOut:Xn,quartIn:Zn,quartOut:$n,quartInOut:Qn,quintIn:Kn,quintOut:ti,quintInOut:ei,sineIn:ri,sineOut:ni,sineInOut:ii,getBackIn:oi,backIn:si,getBackOut:ai,backOut:ui,getBackInOut:li,backInOut:ci,circIn:pi,circOut:hi,circInOut:di,bounceIn:fi,bounceOut:yi,bounceInOut:vi,getElasticIn:gi,elasticIn:mi,getElasticOut:bi,elasticOut:_i,getElasticInOut:wi,elasticInOut:Pi}),Oi=function(){function t(){}return t.linear=Mn,t.get=Bn,t.getPowIn=Vn,t.getPowOut=Gn,t.getPowInOut=qn,t.quadIn=Wn,t.quadOut=Yn,t.quadInOut=zn,t.cubicIn=Jn,t.cubicOut=Hn,t.cubicInOut=Xn,t.quartIn=Zn,t.quartOut=$n,t.quartInOut=Qn,t.quintIn=Kn,t.quintOut=ti,t.quintInOut=ei,t.sineIn=ri,t.sineOut=ni,t.sineInOut=ii,t.getBackIn=oi,t.backIn=si,t.getBackOut=ai,t.backOut=ui,t.getBackInOut=li,t.backInOut=ci,t.circIn=pi,t.circOut=hi,t.circInOut=di,t.bounceIn=fi,t.bounceOut=yi,t.bounceInOut=vi,t.getElasticIn=gi,t.elasticIn=mi,t.getElasticOut=bi,t.elasticOut=_i,t.getElasticInOut=wi,t.elasticInOut=Pi,t}(),Si=function(){function t(){this.cursor=-1,this.widgets=[],this.instances=[],this.model={id:-1,type:r.NONE,sourceId:-1,author:null,originalAuthor:null,className:null,createdDate:null}}return Object.defineProperty(t.prototype,"id",{get:function(){return this.model?this.model.id:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"script",{get:function(){return this.model?this.model.script:null},enumerable:!1,configurable:!0}),t}(),Ti=function(){},xi=function(){function t(t,e){this.onTemplateLoad=e,this._emitter=null,this._loaded=null,this._loading=null,this.verbose=!1,this._emitter=t,this.clear()}return Object.defineProperty(t.prototype,"loaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this._loading},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this._loaded={},this._loading={}},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),pn(this,void 0,void 0,(function(){var e;return hn(this,(function(r){switch(r.label){case 0:return[4,V.list({maxResults:t,withoutAuthors:!0,withoutOriginalAuthors:!0,script:!0})];case 1:return(e=r.sent())&&e.list?(this.verbose&&console.log("--- loading template classes ---"),[2,this.registerMany(e.list)]):[2]}}))}))},t.prototype.loadForVideo=function(t){return pn(this,void 0,void 0,(function(){var e,r=this;return hn(this,(function(n){switch(n.label){case 0:return[4,V.loadForVideo(t)];case 1:return(e=n.sent())&&e.list?(this.verbose&&console.log("--- loading template classes for vid:"+t+" ---"),[4,this.registerMany(e.list)]):[2,null];case 2:return[2,n.sent().map((function(t){return t?r.getByName(t):null}))]}}))}))},t.prototype.loadByNames=function(t){return pn(this,void 0,void 0,(function(){var e,r=this;return hn(this,(function(n){switch(n.label){case 0:return!Array.isArray(t)||t.length<=0?[2,[]]:(this.verbose&&console.log("--- loading template classes ---"),[4,Promise.all(t.map((function(t){return r.doLoadByName(t)})))]);case 1:return(e=n.sent())&&this._emitter.onTemplatesLoad(e.filter((function(t){return!!t})).map((function(t){return t.className}))),[2,e]}}))}))},t.prototype.loadByName=function(t){return pn(this,void 0,void 0,(function(){var e,r;return hn(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.doLoadByName(t)];case 1:return e=n.sent(),this._emitter.onTemplatesLoad([e.className]),[2,e];case 2:return r=n.sent(),this._emitter.onTemplatesLoad(null,r),[2,null];case 3:return[2]}}))}))},t.prototype.doLoadByName=function(t){return pn(this,void 0,void 0,(function(){var e,r,n=this;return hn(this,(function(i){return null!==(e=this.getByName(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return V.loadByName(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.loadById=function(t){return pn(this,void 0,void 0,(function(){var e,r,n;return hn(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.doLoadById(t)];case 1:return e=i.sent(),r=null,[3,3];case 2:return n=i.sent(),r=n,[3,3];case 3:return this._emitter.onTemplatesLoad(e?[e.className]:null,r),[2,e]}}))}))},t.prototype.doLoadById=function(t){return pn(this,void 0,void 0,(function(){var e,r,n=this;return hn(this,(function(i){return(e=this.getById(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return V.load(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.registerMany=function(t){return pn(this,void 0,void 0,(function(){var e,r,n=this;return hn(this,(function(i){switch(i.label){case 0:return e=t.map((function(t){var e=n.onTemplateLoad(t);return n._loading[t.className]=e,n._loading[t.className+"@"+t.id]=e,e})),[4,Promise.all(e.map((function(t){return t.then((function(t){return t.className})).catch((function(t){return null}))})))];case 1:return r=i.sent().filter((function(t){return!!t})),this._emitter.onTemplatesLoad(r),[2,r]}}))}))},t.prototype.commit=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,V.create({sourceId:t.model.sourceId,script:t.model.script,log:e})];case 1:return(r=n.sent()).success&&(t.model.id=r.id,this._emitter.onTemplateCommit(t.className)),[2,r]}}))}))},t.prototype.getByName=function(t,e){var r;if(void 0===e&&(e=!1),t&&(r=t.match(/(.+)@([0-9]+)/))){t=r[1];var n=parseInt(r[2]);if(!this._loaded[t])return null;var i=this._loaded[t].model;if(i.id!==n){if(!e)return null;this.verbose&&console.log("[warning] template "+t+" version "+n+" is requested but "+i.id+" is used")}}return this._loaded[t]?this._loaded[t]:null},t.prototype.getById=function(t){var e=null;for(var r in this._loaded)if(this._loaded[r].model.id===t){e=this._loaded[r];break}return e},t}(),Ai={Matrix2D:st,Point:at,Color:Z,Font:$,RenderingUnit:z,TextUnit:X,Graphic:K,Phrase:et,Word:tt,Char:Q,Beat:Tn,RepetitiveSegment:An},Ri=["headTime","tailTime","insomnia"],Ci=["animate","getAssignedUnit","name","type"],Ni=function(){function t(t,e,r){this._emitter=null,this._player=null,this.interpreter=null,this.unsafeAcceleration=!1,this._verbose=!1,this.ignoreVersion=!1,this.rawConsole=!1,this._player=t,this._emitter=e,this.unsafeAcceleration=r,this.loader=new xi(e,this.register.bind(this)),t.addListener({onVideoReady:this.onVideoReady.bind(this)})}return Object.defineProperty(t.prototype,"verbose",{get:function(){return this._verbose},set:function(t){this._verbose=this.loader.verbose=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return!!this.interpreter},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return this.loader.loaded},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t=this;if(!this.ready){var e=function(t){var e=t.player,n=t.ignoredPropNames,i=t.rawConsole,o=t.templateGetter,s=e.graphics.wrapperTable,a=new on(cn(cn({},Ai),s),n,(function(t,r){return e.graphics.isGraphics(t)&&r instanceof Z?r.toString():r})),u={require:{func:function(t){if(!(t.length<1||"string"!=typeof t[0])){var e=t[0],r=o(e);return null===r?void 0:r.functionDefinition}},raw:!0,isConstructor:!0},print:{func:function(t){e.isEditing&&console.log.apply(console,t)},raw:i},findChorus:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findChorus(t[0])}},findBeat:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findBeat(t[0])}},getVocalFrequency:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getVocalFrequency(t[0])}},getVocalAmplitude:{func:function(t){return t.length<1||"number"!=typeof t[0]?-1:e.getVocalAmplitude(t[0])}},getMaxVocalAmplitude:{func:function(t){return e.getMaxVocalAmplitude()}},getValenceArousal:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getValenceArousal(t[0])}},getMedianValenceArousal:{func:function(t){return e.getMedianValenceArousal()}}};Object.keys(r).forEach((function(t){a.setProperty(a.globalScope,t,r[t]),u[t]={value:r[t]}})),Object.keys(Ei).forEach((function(t){var e=Ei[t];0!==t.indexOf("get")&&(u[t]={func:e})}));var l=Object.keys(a.wrapperTable);return l&&l.forEach((function(t){return u[t]={cls:a.wrapperTable[t]}})),Object.keys(u).forEach((function(t){var e=u[t];e.func?a.createGlobalFunction(t,e):e.value&&a.setProperty(a.globalScope,t,e.value)})),{interpreter:a,unsafeGlobalScope:u}}({player:this._player,ignoredPropNames:Ci,rawConsole:this.rawConsole,templateGetter:function(e){return t.getByName(e,!0)}}),n=e.interpreter,i=e.unsafeGlobalScope;this.unsafeGlobalScope=i,this.interpreter=n,this.onVideoReady(this._player.video)}},t.prototype.getByName=function(t,e){return void 0===e&&(e=!1),this.loader.getByName(t,e)},t.prototype.getById=function(t){return this.loader.getById(t)},t.prototype.clear=function(){this.loader.clear()},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),pn(this,void 0,void 0,(function(){return hn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadLatest(t)]}))}))},t.prototype.loadForVideo=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadForVideo(t)]}))}))},t.prototype.loadByNames=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByNames(t)]}))}))},t.prototype.loadByName=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByName(t)]}))}))},t.prototype.loadById=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadById(t)]}))}))},t.prototype.commit=function(t,e){return pn(this,void 0,void 0,(function(){return hn(this,(function(r){return[2,this.loader.commit(t,e)]}))}))},t.prototype.register=function(t){return pn(this,void 0,void 0,(function(){var e,r,n,i,o,s,a,u=this;return hn(this,(function(l){switch(l.label){case 0:if(!t)return[2,null];if("number"==typeof t.sourceId){if(e=t,!(r=this.createClass(t.script)))return[2,null]}else r=t;n=Kr(r.ast).dependencies,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Promise.all(n.map((function(t){var e=u.getByName(t,u.ignoreVersion);return e?Promise.resolve(e):u.loadByName(t)})))];case 2:return l.sent(),this.verbose&&console.log("load dependencies for",r.className,n),[3,4];case 3:return i=l.sent(),this.verbose&&console.error("failed loading dependencies for",r.className,i),[3,4];case 4:try{if(o=void 0,e?(o=this.newRawInstance(r),r.model=e):o=this.createModel(r),!o)throw new Error("failed to create a template instance");return[2,this.registerClass(r)]}catch(t){throw s=void 0,e&&(delete(a=cn({},e)).script,s=a),{error:t.message,stack:t.stack,cause:s}}return[2]}}))}))},t.prototype.updateClassScript=function(t,e){var r=this.createClass(e);return this.updateClass(t,r)},t.prototype.registerClass=function(t){if(!t)return null;if(this.loader.loaded[t.className]){this.verbose&&console.log("updating",t.className,t.model.id);var e=this.updateClass(this.loader.loaded[t.className],t);return this.verbose&&console.log("updated",e.className,e.id),e}return this.loader.loaded[t.className]=t,this.verbose&&console.log("loaded",t.className,t.model.id),t},t.prototype.updateClass=function(t,e){var r=t,n=e;if(!n)return null;if(r.model.script===n.model.script)return this.verbose&&console.log("no diff for",r.className),r;if(!this.createModel(n))return null;if(r.className!==n.className){var i=this.getByName(n.className);if(!i)return n.cursor=r.cursor,this.loader.loaded[n.className]=n,this.verbose&&console.log("create",n.className),n;r=i}return r.newStatement=n.newStatement,r.widgets=n.widgets,r.scope=n.scope,r.functionDefinition=n.functionDefinition,r.newStatement=n.newStatement,r.unsafeConstructorGenerator=n.unsafeConstructorGenerator,r.ast=n.ast,r.cursor<0&&(r.cursor=n.cursor),n.id>=0?(this.verbose&&console.log("replace",n.className,r.id,n.id),r.model=n.model):(this.verbose&&console.log("update",n.className,r.id,n.id),r.model.type=n.model.type,r.model.className=n.model.className,r.model.prettyName=n.model.prettyName,r.model.script=n.model.script,r.model.createdDate=null,r.id>=0&&(r.model.sourceId=r.model.id,r.model.id=-1)),n=r,this.updateInstances(r.instances.slice(),n),this._emitter.onTemplateUpdate(n.className),n},t.prototype.createModel=function(t){var e=this.newRawInstance(t);if(null===e)return!1;if(t.id>=0)return!0;var r=e.templateInstance,n=t.model.script;return t.model={id:-1,sourceId:-1,className:t.className,prettyName:r?this.interpreter.getProperty(r,"name"):e.unsafeTemplateInstance.name,type:r?this.interpreter.getProperty(r,"type"):e.unsafeTemplateInstance.type,script:n,author:null,originalAuthor:null,createdDate:null},e},t.prototype.updateInstances=function(t,e){var r=this;t.forEach((function(t){try{r.updateInstance(t,e)}catch(r){console.log("failed updating template for",t.assignedUnit,":",e)}})),this._player.isPlaying||this._player.requestStageUpdate()},t.prototype.createClass=function(t){var e=this;this.ready||this.initialize();var r=new Si;r.model={id:-1,sourceId:-1,className:null,prettyName:null,type:0,script:t,author:null,originalAuthor:null,createdDate:null};var n=Qr(t,Ci),i=n.ast,o=n.widgets;if(r.ast=i,r.widgets=o,r.className=r.ast.body[0].id.name,r.scope=this.interpreter.prepareRun(r.ast),this.interpreter.run(1e3,"to define "+r.className),r.functionDefinition=this.interpreter.getRawProperty(r.scope,r.className),r.newStatement=this.interpreter.newStatementFor(r.className),this.unsafeAcceleration){var s=Object.keys(this.unsafeGlobalScope),a="return function(props){var "+Object.keys(this.getGlobalProperties()).map((function(t){return t+"=props."+t})).join(",")+";"+t+"return "+r.className+";}",u=new(Function.bind.apply(Function,dn(dn([void 0],s,!1),[a],!1))),l=function(t){var r=e.getByName(t);return r?r.unsafeConstructorGenerator(e.getGlobalProperties()):null},c=s.map((function(t){if("require"===t)return l;var r=e.unsafeGlobalScope[t];return r.func?function(){for(var t=[],e=0;e8&&(g=g.substring(0,8)),!(t.indexOf(g)<0););c.length>h&&c[h].length>0&&c.splice(h,0,""),c.splice(h,0,"",p+"// @proposed",p+"// @title "+e,p+"// "+function(t,e){if("Slider"===t)return"@ui Slider("+e.min+", "+e.max+")";if("Check"===t)return"@ui Check()";if("Color"===t)return"@ui Color()";var r=e.etc;return"@comment "+(r=r.replace(/(\r\n|[\n\v\f\r\x85\u2028\u2029])/g,"")).replace(/\/[*/]/g,"")}(r,n),p+"this."+g+" = "+function(t,e){return"Slider"===t?((e.min+e.max)/2).toString():"Check"===t?"false":"Color"===t?'new Color("#000000")':"null"}(r,n)+";"),t=c.join(l)}catch(t){}return t}(t.model.script,e,r,n))},t.prototype.onVideoReady=function(t){this.ready&&(this.interpreter.setRawProperty(this.interpreter.globalScope,"width",this._player.resolutionWidth),this.interpreter.setRawProperty(this.interpreter.globalScope,"height",this._player.resolutionHeight),this.interpreter.setRawProperty(this.interpreter.globalScope,"margin",this.interpreter.wrap(this._player.margin)),this.interpreter.setRawProperty(this.interpreter.globalScope,"duration",(null==t?void 0:t.duration)||0))},t}(),ki=function(t){function e(e,r){var n=this.constructor,i=t.call(this,e)||this;return i.video=r,Object.setPrototypeOf(i,n.prototype),i}return ln(e,t),e}(Error),ji=function(){this.halted=[],this.errors=[]},Ii=function(){function t(t,e){var r=this;this.listener=e,this.player=null,this._scale=1,this.playerListener={onResize:function(t){r.elementWidth=t.width,r.updateSize()},onVideoReady:function(){r.elementWidth=r.calcWidth(),r.updateSize()},onStageElementSet:function(t){r.elementWidth=r.calcWidth(),r.updateSize(),r.player.graphics.setCanvas(t)},onDispose:function(){r.dispose()}},this.requestedTime=0,this.request=null,this.player=t,t.addListener(this.playerListener)}return Object.defineProperty(t.prototype,"scale",{get:function(){return this._scale},set:function(t){this._scale=t,this.updateSize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.player.graphics.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.player.graphics.height},enumerable:!1,configurable:!0}),t.prototype.requestUpdate=function(t){return pn(this,void 0,void 0,(function(){var e=this;return hn(this,(function(r){return this.requestedTime=void 0===t?this.player.videoPosition:t,this.request||(this.request=new Promise((function(t){setTimeout((function(){try{e.update(e.requestedTime)}catch(t){}e.request=null,t(e.requestedTime)}),0)}))),[2,this.request]}))}))},t.prototype.update=function(t){t||(t=this.player.mediaPosition),"number"==typeof t&&(this.player.graphics.reset(),this.animate(t),this.player.graphics.update(),this.listener.onStageUpdate(t))},t.prototype.animate=function(t){for(var e=new ji,r=e.errors,n=e.halted,i=0,o=[this.player.video.firstCredit,this.player.video.firstPhrase,this.player.video.firstWord,this.player.video.firstChar,this.player.video.firstGraphic];i0){console.error("---");for(var a=0;a0&&(!s.rendering.visible||0===s.rendering.alpha))return void(e.rendering.visible=!1);s=s.parent}var a=this.player.templates.getProperty(n,"insomnia"),u=Ui(e);if(!a&&u){var l=function(t,e,n,i){var o=i&&t(i,"headTime")||500,s=i&&t(i,"tailTime")||500;return!(n.startTime-o<=e&&n.endTime+s>=e)&&(n.getType()!==r.GRAPHIC&&(n.rendering.visible=!1),!0)}((function(t,e){return o.player.templates.getProperty(t,e)}),t,e,n);if(l)return}this.doAnimateTemplate(t,n,i)}},t.prototype.doAnimateTemplate=function(t,e,r){var n=r.errors,i=r.halted;try{this.player.templates.exec(e,"animate",[t])}catch(t){n.push(t),i.push(e)}},t.prototype.calcWidth=function(){var t=this.player.stageElement;if(!t)return 0;var e=window.getComputedStyle(t);return t.offsetWidth-sn(e.borderLeftWidth)-sn(e.borderRightWidth)-sn(e.paddingLeft)-sn(e.paddingRight)},t.prototype.updateSize=function(){var t=this.player.stageElement;if(t){var e=this.elementWidth*this.player.videoProportion;if(t.style.height=e+"px",t.width=this.elementWidth*this._scale,t.height=e*this._scale,this.player.video){var r=t.width/this.player.videoWidth;this.player.graphics.updateStageTx(r,this.player.margin),this.player.isPlaying||this.requestUpdate()}}},t.prototype.dispose=function(){this.player.removeListener(this.playerListener),this.player=null},t}();function Ui(t){if(t.getType()===r.GRAPHIC)return!0;for(var e=!0,n=t.parent;n;){if(n.templateCount>0){e=!1;break}n=n.parent}return e}var Fi='',Li="https://textalive.jp",Di=function(){function t(t){var e,r=this;if(this.player=t,this._position="embed",this._rounded=!1,this._bordered=!1,this._shadowed=!1,this._background="#fff",this._color="#1f4391",void 0!==(null===(e=t.options)||void 0===e?void 0:e.mediaBannerPosition)&&(this._position=t.options.mediaBannerPosition),this.domEnabled){this.logoAnchor=document.createElement("a"),this.logoAnchor.className="textalive-logo",this.logoAnchor.innerHTML=Fi,this.logoAnchor.style.padding=this.bordered?"1px 2px":"1px 3px",this.logoAnchor.href=Li,this.logoAnchor.target="_blank",this.logoAnchor.title="Powered by TextAlive App API",this.logoSvg=this.logoAnchor.querySelector("svg"),this.logoSvg.style.width="24px",this.songNameDiv=document.createElement("div"),this.songNameDiv.className="name",this.songNameDiv.style.fontWeight="bold",this.songNameDiv.style.overflow="hidden",this.songNameDiv.style.textOverflow="ellipsis",this.songNameDiv.style.marginBottom="2px",this.songNameDiv.textContent="-",this.songArtistDiv=document.createElement("div"),this.songArtistDiv.className="artist",this.songArtistDiv.textContent="-",this.songArtistDiv.style.overflow="hidden",this.songArtistDiv.style.textOverflow="ellipsis";var n=document.createElement("span");n.innerHTML='',n.style.padding="0 3px 0 0",this.songSvg=n.querySelector("svg"),this.songSvg.style.width="14px",this.songWrapper=document.createElement("div"),this.songWrapper.style.width="203px",this.songWrapper.style.maxWidth="203px",this.songWrapper.appendChild(this.songNameDiv),this.songWrapper.appendChild(this.songArtistDiv),this.songAnchor=document.createElement("a"),this.songAnchor.className="song",this.songAnchor.target="_blank",this.songAnchor.style.display="flex",this.songAnchor.style.lineHeight="1.2em",this.songAnchor.style.padding="4px 3px 3px 3px",this.songAnchor.style.textDecoration="none",this.songAnchor.appendChild(n),this.songAnchor.appendChild(this.songWrapper),this.lyricsNameDiv=document.createElement("div"),this.lyricsNameDiv.className="name",this.lyricsNameDiv.style.fontWeight="bold",this.lyricsNameDiv.textContent="-",this.lyricsNameDiv.style.overflow="hidden",this.lyricsNameDiv.style.textOverflow="ellipsis",this.lyricsNameDiv.style.marginBottom="2px",this.lyricsArtistDiv=document.createElement("div"),this.lyricsArtistDiv.className="artist",this.lyricsArtistDiv.textContent="-",this.lyricsArtistDiv.style.overflow="hidden",this.lyricsArtistDiv.style.textOverflow="ellipsis";var i=document.createElement("span");i.innerHTML='',i.style.padding="0 3px 0 0",this.lyricsSvg=i.querySelector("svg"),this.lyricsSvg.style.width="14px",this.lyricsWrapper=document.createElement("div"),this.lyricsWrapper.style.width="90px",this.lyricsWrapper.style.maxWidth="90px",this.lyricsWrapper.appendChild(this.lyricsNameDiv),this.lyricsWrapper.appendChild(this.lyricsArtistDiv),this.lyricsAnchor=document.createElement("a"),this.lyricsAnchor.className="lyrics",this.lyricsAnchor.target="_blank",this.lyricsAnchor.style.display="flex",this.lyricsAnchor.style.lineHeight="1.2em",this.lyricsAnchor.style.padding="4px 3px 3px 3px",this.lyricsAnchor.style.textDecoration="none",this.lyricsAnchor.appendChild(i),this.lyricsAnchor.appendChild(this.lyricsWrapper),this.bannerDiv=document.createElement("div"),this.bannerDiv.className="textalive-banner",this.bannerDiv.style.cursor="pointer",this.bannerDiv.style.zIndex="10000",this.bannerDiv.style.background="#1f4391",this.bannerDiv.style.lineHeight="0",this.bannerDiv.style.display="flex",this.bannerDiv.style.maxWidth="256px",this.bannerDiv.style.fontFamily="'Hiragino Kaku Gothic Pro','游ゴシック体','Yu Gothic',YuGothic,Meiryo,HelveticaNeue,'Helvetica Neue',Helvetica,Arial,sans-serif",this.bannerDiv.style.fontSize="9px",this.bannerDiv.style.alignItems="center",this.bannerDiv.style.whiteSpace="nowrap",this.bannerDiv.appendChild(this.logoAnchor),this.bannerDiv.appendChild(this.songAnchor),this.bannerDiv.appendChild(this.lyricsAnchor),this.songAnchor.style.display="none",this.lyricsAnchor.style.display="none",this.updatePosition(),this.updateRounded(),this.updateBordered(),this.updateShadowed(),this.updateBackground(),this.updateColor()}this.listener={onAppReady:function(){r.updatePosition()},onMediaElementSet:function(t){r.domEnabled&&(r.bannerDiv&&r.bannerDiv.parentElement&&r.bannerDiv.parentElement.removeChild(r.bannerDiv),r.player.mediaBannerElement&&r.player.mediaBannerElement.appendChild(r.bannerDiv))},onVideoLoad:function(){r.domEnabled&&(r.logoAnchor.href=Li,r.songAnchor.style.display="none",r.lyricsAnchor.style.display="none",r.songAnchor.style.borderRadius="0")},onSongLoad:function(t){return pn(r,void 0,void 0,(function(){var e,r,n,i,o,s,a,l,c;return hn(this,(function(p){switch(p.label){case 0:return t?(e=null===(a=null===(s=null==t?void 0:t.song)||void 0===s?void 0:s.artist)||void 0===a?void 0:a.name,r=null===(l=null==t?void 0:t.song)||void 0===l?void 0:l.name,n=null===(c=null==t?void 0:t.song)||void 0===c?void 0:c.permalink,i=Li+(n?"/songs/"+encodeURIComponent(u.getSongPathFromUrl(n)):""),this.domEnabled&&(this.logoAnchor.href=i,this.songArtistDiv.textContent=Mi(e),this.songNameDiv.textContent=Mi(r),this.songAnchor.title=Mi(r)+" by "+Mi(e),this.songAnchor.href=n,this.songAnchor.style.display="flex",this.songAnchor.style.borderRadius=this.rounded?"0 4px 4px 0":"0",this.songWrapper.style.width="auto"),[4,T.getServerStatus()]):[2];case 1:return"ja"===(null==(o=p.sent())?void 0:o.lang)?console.warn("[TextAlive API] 楽曲 アーティスト:",Mi(e),"/ 楽曲名:",Mi(r),"/ 配信元サイト:",Mi(n)):console.warn("[TextAlive API] Song artist:",Mi(e),"/ song name:",Mi(r),"/ distributed at:",Mi(n)),[2]}}))}))},onLyricsLoad:function(t){t&&(r.songWrapper.style.maxWidth="90px",r.lyricsAnchor.style.display="flex",r.songAnchor.style.borderRadius="0")},onTextLoad:function(t){return pn(r,void 0,void 0,(function(){var e,r,n,i,o;return hn(this,(function(s){switch(s.label){case 0:return t?(e=null===(o=null==t?void 0:t.artist)||void 0===o?void 0:o.name,r=null==t?void 0:t.name,n=null==t?void 0:t.url,this.domEnabled&&(this.lyricsArtistDiv.textContent=Mi(e),this.lyricsNameDiv.textContent=Mi(r),this.lyricsAnchor.title=Mi(r)+" by "+Mi(e),this.lyricsAnchor.href=n,this.lyricsWrapper.style.width="auto"),[4,T.getServerStatus()]):[2];case 1:return"ja"===(null==(i=s.sent())?void 0:i.lang)?console.warn("[TextAlive API] 歌詞 アーティスト:",Mi(e),"/ 歌詞名:",Mi(r),"/ 配信元サイト:",Mi(n)):console.warn("[TextAlive API] Song lyrics artist:",Mi(e),"/ lyrics name:",Mi(r),"/ distributed at:",Mi(n)),[2]}}))}))},onDispose:function(){this.dispose()}},t.addListener(this.listener),t.mediaBannerElement&&this.player.mediaBannerElement.appendChild(this.bannerDiv)}return Object.defineProperty(t.prototype,"domEnabled",{get:function(){return"undefined"!=typeof window},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(t){this._position=t,this.updatePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rounded",{get:function(){return this._rounded},set:function(t){this._rounded=t,this.updateRounded()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bordered",{get:function(){return this._bordered},set:function(t){this._bordered=t,this.updateBordered()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowed",{get:function(){return this._shadowed},set:function(t){this._shadowed=t,this.updateShadowed()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(t){this._background=t,this.updateBackground()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this.updateColor()},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.player.removeListener(this.listener)},t.prototype.updatePosition=function(){var t,e;if(this.domEnabled){var r=this.position,n=this.player;if(null===r||!(null===(t=n.options)||void 0===t?void 0:t.app)||(null===(e=n.app)||void 0===e?void 0:e.managed))this.bannerDiv.style.display="none";else if(this.bannerDiv.style.display="flex","embed"===r)this.bannerDiv.style.position="initial",this.bannerDiv.style.marginTop="4px",this.songAnchor.style.flexGrow="1",this.lyricsAnchor.style.flexGrow="1";else{this.bannerDiv.style.position="fixed",this.bannerDiv.style.marginTop="0";var i=r.indexOf("top")>=0,o=r.indexOf("right")>=0,s=r.indexOf("bottom")>=0,a=r.indexOf("left")>=0;this.bannerDiv.style.top=i?"4px":"initial",this.bannerDiv.style.right=o?"4px":"initial",this.bannerDiv.style.bottom=s?"4px":"initial",this.bannerDiv.style.left=a?"4px":"initial",this.songAnchor.style.flexGrow="0",this.lyricsAnchor.style.flexGrow="0"}}},t.prototype.updateRounded=function(){if(this.domEnabled){var t=this.rounded;this.logoSvg.style.borderRadius=t?"4px 0 0 4px":"0",this.lyricsAnchor.style.borderRadius=t?"0 4px 4px 0":"0",this.bannerDiv.style.borderRadius=t?"4px":"0"}},t.prototype.updateBordered=function(){if(this.domEnabled){var t=this.bordered;this.logoAnchor.style.padding=t?"1px 2px":"1px 3px",this.bannerDiv.style.border=t?"1px solid rgba(31, 67, 145, 0.3)":"none"}},t.prototype.updateShadowed=function(){if(this.domEnabled){var t=this.shadowed;this.bannerDiv.style.boxShadow=t?"1px 1px 3px 0 rgba(9, 19, 42, 0.9)":"none"}},t.prototype.updateBackground=function(){this.domEnabled&&(this.songAnchor.style.background=this.background,this.lyricsAnchor.style.background=this.background)},t.prototype.updateColor=function(){this.domEnabled&&(this.songSvg.style.fill=this.color,this.songAnchor.style.color=this.color,this.lyricsSvg.style.fill=this.color,this.lyricsAnchor.style.color=this.color)},t}();function Mi(t){return t&&""!==t?t:"-"}function Bi(t,e){var r=e.parser;return pn(this,void 0,void 0,(function(){var e,n,i;return hn(this,(function(o){switch(o.label){case 0:return t&&t.length>0&&t[0].words&&t[0].words.length>0&&t[0].words[0]&&!t[0].words[0].pos?(e=t.map((function(t){return t.words.map((function(t){return t.characters.map((function(t){return t.char})).join("")})).join(" ")})),n=e.join("\n"),[4,r(n)]):[2];case 1:return(i=o.sent())&&"success"===i.status?(t.forEach((function(t,r){var n=i.result[r],o=0;t.words.forEach((function(t){var i=t.characters.map((function(t){return t.char})).join(""),s=e[r].indexOf(i,o);if(!(s<0)){o=s;var a=n.find((function(t){return t.startPosition<=s&&t.endPosition>=s}));a&&(t.pos=a.PoS,t.rawPoS=a.rawPoS,t.language=a.language)}}))})),[2]):[2]}}))}))}function Vi(t){for(;t.firstElementChild;)t.removeChild(t.firstElementChild)}function Gi(t,e){var r=e.id,n=e.data,i=e.loader,o=e.deserializer;return pn(this,void 0,void 0,(function(){return hn(this,(function(e){switch(e.label){case 0:return r&&r>=0?[4,i(r)]:[3,2];case 1:e.sent(),e.label=2;case 2:return o(t,n),[2]}}))}))}function qi(t){return"string"!=typeof t?t:"undefined"==typeof window?null:document.querySelector(t)}var Wi=function(){function t(t){this._mediaPosition=0,this._videoPosition=0,this.isEditing=!1,this._isVideoSeeking=!1,this._volume=100,this._options=t,this.emitter=new bn(t),this._templates=new Ni(this,this.emitter,t&&t.unsafeAcceleration);var e=Object.assign({},q);t&&t.managers&&(e=Object.assign(e,t.managers)),this.managers=e,this._timer=t&&t.timer||this.createDefaultTimer(),this._data=new Ln(e,this.emitter,t),this._backgroundGraphics=new _n(this,e.asset,this.emitter),this._graphics=t&&t.graphics||this.createDefaultGraphicsDriver(),this.stage=new Ii(this,{onStageUpdate:this.onStageUpdate.bind(this)}),this._banner=new Di(this),this.stageElement=qi(null==t?void 0:t.stageElement)||null,this.mediaElement=qi(null==t?void 0:t.mediaElement)||null,this._app=new Dn(this,this.emitter)}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?cn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return this._app},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundGraphics",{get:function(){return this._backgroundGraphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"templates",{get:function(){return this._templates},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphics",{get:function(){return this._graphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageElement",{get:function(){return this._stageElement},set:function(t){this._stageElement=t,this.emitter.onStageElementSet(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageScale",{get:function(){return this.stage.scale},set:function(t){this.stage.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaElement",{get:function(){return this._mediaElement},set:function(t){this.updateMediaElement(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaSourceElement",{get:function(){return this._mediaSourceElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaBannerElement",{get:function(){return this._mediaBannerElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaPosition",{get:function(){return this._mediaPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoPosition",{get:function(){return this._videoPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wait",{get:function(){return this._timer?this._timer.wait:0},set:function(t){this._timer&&(this._timer.wait=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fps",{get:function(){return 1e3/this.wait},set:function(t){this.wait=1e3/t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionWidth",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.width?this._data.video.config.width:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.width)?this._options.defaultVideoSize.width:1280},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionHeight",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.height?this._data.video.config.height:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.height)?this._options.defaultVideoSize.height:720},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionProportion",{get:function(){return this.resolutionHeight/this.resolutionWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"margin",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&this._data.video.config.margin?this._data.video.config.margin:(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.margin)||yn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoWidth",{get:function(){var t=this.resolutionWidth,e=this.margin;return t+e[1]+e[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoHeight",{get:function(){var t=this.resolutionHeight,e=this.margin;return t+e[0]+e[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoProportion",{get:function(){return this.videoHeight/this.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageWidth",{get:function(){return this.stage.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageHeight",{get:function(){return this.stage.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return!!this._videoPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._timer&&this._timer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVideoSeeking",{get:function(){return this._isVideoSeeking},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"banner",{get:function(){return this._banner},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timer",{get:function(){return this._timer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volume",{get:function(){return this._volume},set:function(t){isNaN(t)||(this._volume=Math.min(100,Math.max(0,t)),this.emitter.onVolumeUpdate(this._volume))},enumerable:!1,configurable:!0}),t.prototype.createDefaultTimer=function(){try{if("undefined"!=typeof window&&"basic"!==an("ta_timer"))return new mn}catch(t){}return new vn},t.prototype.createDefaultGraphicsDriver=function(){return new ct},t.prototype.addListener=function(t){return this.emitter.addListener(t)},t.prototype.removeListener=function(t){return this.emitter.removeListener(t)},t.prototype.createFromVideoId=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideoId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideoId=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,(r=new Ln(this.managers,this.emitter,this._options)).createFromVideoId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideo(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideo=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){return(r=new Ln(this.managers,this.emitter,this._options)).createFromVideo(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.createFromSongUrl=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongUrl(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongUrl=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,(r=new Ln(this.managers,this.emitter,this._options)).createFromSongUrl(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongPath=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongPath(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongPath=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,(r=new Ln(this.managers,this.emitter,this._options)).createFromSongPath(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongId=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongId=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,(r=new Ln(this.managers,this.emitter,this._options)).createFromSongId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongCode=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongCode(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongCode=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,(r=new Ln(this.managers,this.emitter,this._options)).createFromSongCode(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromText=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromText(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromText=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){switch(n.label){case 0:return[4,(r=new Ln(this.managers,this.emitter,this._options)).createFromText(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromJSON=function(t,e){return pn(this,void 0,void 0,(function(){var r=this;return hn(this,(function(n){return[2,this.create((function(){return r.doCreateFromJSON(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromJSON=function(t,e){return pn(this,void 0,void 0,(function(){var r;return hn(this,(function(n){return(r=new Ln(this.managers,this.emitter,this._options)).createFromJSON(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.create=function(t,e){return pn(this,void 0,void 0,(function(){var r,n=this;return hn(this,(function(i){if(this._videoPromise&&!e)throw new ki("Player.createFrom* method calls cannot run in parallel",this._videoPromise);return r=t(),e||(this._videoPromise=r,r.finally((function(){return n._videoPromise=null}))),[2,r]}))}))},t.prototype.finalize=function(t,e){return pn(this,void 0,void 0,(function(){var r,n,i,o=this;return hn(this,(function(s){switch(s.label){case 0:return t.video?[4,Promise.all([t.finalize(e),this.backgroundGraphics.setBackground(t.video.background)])]:[2,null];case 1:return s.sent(),(null==e?void 0:e.dryRun)?[2,null]:(r=t.video.json,function(t,e){var r=e.config,n=e.song;r&&"object"==typeof r&&"number"==typeof r.duration?t.duration=r.duration:n?t.duration=1e3*n.length:t.duration||(t.duration=t.endTime)}(n=new nt(r),{config:t.video.config,song:t.song}),[4,Promise.all([this.graphics.createRuntime(n),Gi(n,{id:t.video.id,data:r,loader:function(t){return pn(o,void 0,void 0,(function(){return hn(this,(function(e){switch(e.label){case 0:return[4,this.templates.loadForVideo(t)];case 1:return e.sent(),[2]}}))}))},deserializer:function(t,e){return o.templates.importInstances(t,e)}}),Bi(null==r?void 0:r.phrases,{parser:x.parse.bind(x)})])]);case 2:return s.sent(),this._data,this._video&&this.templates.disposeInstances(this._video),this._data=t,this._video=n,this.emitter.onVideoReady(n),i=(null==e?void 0:e.altSourceUrl)||void 0,[4,this._timer.initialize({player:this,updater:this.updateMediaPosition.bind(this),emitter:this.emitter,altSourceUrl:i})];case 3:return s.sent(),this.emitter.onTimerReady(this._timer),[2,n]}}))}))},t.prototype.updateMediaPosition=function(t){return pn(this,void 0,void 0,(function(){var e=this;return hn(this,(function(r){return this._isVideoSeeking?(this._mediaPosition=t,this.emitter.onMediaSeek(t),[2,t]):[2,this.stage.requestUpdate(t).then((function(t){return e._mediaPosition=t,e._videoPosition=t,e.emitter.onMediaSeek(t),t}))]}))}))},t.prototype.exportVideo=function(t){return void 0===t&&(t={legacyStringMode:!0}),pn(this,void 0,void 0,(function(){var e,r,n,i;return hn(this,(function(o){return e={sourceId:this._data.video.id,sourceOriginId:this._data.video.sourceOriginId,songleId:this._data.song.id,lyricId:this._data.lyricsId,lyricDiffId:this._data.lyrics?this._data.lyrics.id:-1,config:((null==t?void 0:t.legacyStringMode)?this._data.video.config&&JSON.stringify(this._data.video.config):this._data.video.config)||null},r=this.backgroundGraphics.exportPartialVideoEntry(t),n=this._video.exportData(this._templates),i=(null==t?void 0:t.legacyStringMode)?JSON.stringify(n):n,[2,cn(cn(cn({},e),r),{json:i})]}))}))},t.prototype.getChoruses=function(){return this._data.getChoruses()},t.prototype.findChorus=function(t,e){return this._data.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){return this._data.findChorusBetween(t,e)},t.prototype.getBeats=function(){return this._data.getBeats()},t.prototype.findBeat=function(t,e){return this._data.findBeat(t,e)},t.prototype.getChords=function(){return this._data.getChords()},t.prototype.findChord=function(t,e){return this._data.findChord(t,e)},t.prototype.getVocalFrequency=function(t){return this._data.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){return this._data.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){return this._data.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){return this._data.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){return this._data.getMedianValenceArousal()},t.prototype.resize=function(t){return this.emitter.onResize(t)},t.prototype.onResize=function(t){return this.resize(t)},t.prototype.setStageElement=function(t){return this._stageElement=t,this.emitter.onStageElementSet(t)},t.prototype.setMediaElement=function(t){this.mediaElement=t},t.prototype.updateMediaElement=function(t){"undefined"!=typeof document&&(this._mediaElement&&Vi(this._mediaElement),t?(Vi(t),this._mediaSourceElement||(this._mediaSourceElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-media-wrapper")),t.appendChild(this._mediaSourceElement),this._mediaBannerElement||(this._mediaBannerElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-banner-wrapper")),t.appendChild(this._mediaBannerElement)):(this._mediaSourceElement=null,this._mediaBannerElement=null)),this._mediaElement=t,this.emitter.onMediaElementSet(t)},t.prototype.setVideoPosition=function(t){return pn(this,void 0,void 0,(function(){var e=this;return hn(this,(function(r){return[2,this.stage.requestUpdate(t).then((function(t){return e._videoPosition=t,e.emitter.onVideoSeek(t),t}))]}))}))},t.prototype.setMediaPosition=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){return this.requestMediaSeek(t),[2]}))}))},t.prototype.requestPlay=function(){return this._timer.play(),!0},t.prototype.requestStop=function(){return this._timer.stop(),!0},t.prototype.requestPause=function(){return this._timer.pause(),!0},t.prototype.requestMediaSeek=function(t){return this._timer.seek(t),!0},t.prototype.startVideoSeek=function(){return this._isVideoSeeking=!0,this.emitter.onVideoSeekStart()},t.prototype.endVideoSeek=function(){return this._isVideoSeeking=!1,this.emitter.onVideoSeekEnd()},t.prototype.requestSettingBackground=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){return[2,this.backgroundGraphics.settingBackground(t)]}))}))},t.prototype.requestSetBackground=function(t){return pn(this,void 0,void 0,(function(){return hn(this,(function(e){return[2,this.backgroundGraphics.setBackground(t)]}))}))},t.prototype.requestStageUpdate=function(){return pn(this,void 0,void 0,(function(){return hn(this,(function(t){return[2,this.stage.requestUpdate()]}))}))},t.prototype.onStageUpdate=function(t){this._isVideoSeeking||this.emitter.onTimeUpdate(t)},t.prototype.dispose=function(){this._timer&&(this._timer.dispose(),this._timer=null),this.mediaElement&&(Vi(this._mediaElement),this._mediaElement=null),this.stageElement&&(this._stageElement=null),this.emitter.onDispose()},t}();console.log("# ライセンス表記に関するガイドライン\n\n国立研究開発法人産業技術総合研究所\n人間情報インタラクション研究部門\nメディアインタラクション研究グループ\n\nTextAlive App APIは非商用利用に限り、どなたでも無料・無保証で利用することができます。\nただし、原則としてTextAlive App APIを利用している旨を TextAlive https://textalive.jp/ サイト内楽曲ページまたは https://developer.textalive.jp/ にハイパーリンクした上で、利用しているシステムもしくは外部サイト等に表示する必要があります。\n\n# お問い合わせ\n\ntextalive-ml@aist.go.jp");var Yi=e.exports.sortedIndex;export{vn as BasicTimer,Z as Color,Oi as Ease,st as Matrix2D,ct as NullGraphicsDriver,Wi as Player,Fi as PlayerLogoImage,at as Point,mn as SongleTimer,r as UnitTypes,E as dataUrlToString,rt as findTimedObject,P as isStringEncodedDataUrl,Yi as sortedIndex,O as stringToDataUrl}; +/** textalive-app-api v0.4.0 | Copyright 2024 AIST TextAlive Project (https://textalive.jp) */ +import t from"axios";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var e={exports:{}};!function(t){function e(t,e,r){for(var n=r&&"number"!=typeof e?r(e):e,i=0,o=t.length;i>>1;(r?r(t[s]):t[s])0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=0||"string"==typeof t.user.songleAccessToken)},t.prototype.isSpoofingSongleUser=function(t){return this.isSongleUser(t)&&("number"!=typeof t.user.id||t.user.id<0)},t.prototype.addListener=function(t){t&&this.listeners.push(t)},t.prototype.removeListener=function(t){this.listeners=this.listeners.filter((function(e){return e!==t}))},t.prototype.emitUserProfile=function(t){this.userProfile=t;for(var e=0,r=this.listeners;e>>24&255:0,this.r=t>>>16&255,this.g=t>>>8&255,this.b=t>>>0&255)},t}();var Z=function(){function t(t,e,r){void 0===t&&(t="Noto Sans Japanese"),void 0===e&&(e=40),void 0===r&&(r=""),this._family=t,this._size=e,this._style=r}return Object.defineProperty(t.prototype,"family",{get:function(){return this._family},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},enumerable:!1,configurable:!0}),t.prototype.deriveFamily=function(e){return new t(e,this._size,this._style)},t.prototype.deriveStyle=function(e){return new t(this._family,this._size,e)},t.prototype.deriveSize=function(e){return new t(this._family,e,this._style)},t.prototype.clone=function(){return new t(this._family,this._size,this._style)},t.prototype.eq=function(t){return this._family===t._family&&this._size===t._size&&this._style===t._style},t.prototype.toString=function(t){void 0===t&&(t=1);var e,r=function(t){if(!t||t.length<=0)return[];for(var e=[],r="",n=!1,i=!1,o=!1,s=0,a=t;s1?" "+r.join(", "):(e=r[0]).length>1&&e[0]!==e[e.length-1]||"'"!==e[0]&&'"'!==e[0]?" '".concat(e,"'"):" ".concat(e),this._style+(this._style.length>0?" ":"")+this._size*t+"px"+e},t}(),$=function(){function t(){}return Object.defineProperty(t.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){if("object"==typeof t)return this.overlaps(t.startTime,t.endTime);var r=t;return this.contains(r)||this.contains(e)||this.startTime<=r&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?(t-this.startTime)/this.duration:-1},t}(),K=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._parent=null,e._children=[],e._previous=null,e._next=null,e._runtime=null,e._templates=[],e}return J(e,t),Object.defineProperty(e.prototype,"video",{get:function(){return this.parent&&this.parent.video},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this._data?this._data.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this._data?this._data.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rendering",{get:function(){return this._runtime?this._runtime.rendering:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"graphics",{get:function(){return this._runtime?this._runtime.graphics:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"templates",{get:function(){return this._templates.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"templateCount",{get:function(){return this._templates.length},enumerable:!1,configurable:!0}),e.prototype.maximize=function(){var t=!1,e=this.endTime,r=Math.max(null===this._parent?0:this._parent.startTime,null===this._previous?0:this._previous.endTime);r!==this.startTime&&(this.moveWithChildren(r-this.startTime),t=!0);var n=Math.min(null===this._parent?this.video.duration:this._parent.endTime,null===this._next?this.video.duration:this._next.startTime);return n!==this.endTime&&(this._data.endTime=n,t=e!==n),t},e.prototype.moveWithChildren=function(t){var e=[];for(e.push(this);e.length>0;){var r=e.pop();null!=r._children&&r._children.forEach((function(t){return e.push(t)})),r._data.startTime+=t,r._data.endTime+=t}},e.prototype.getTemplate=function(t){return void 0===t&&(t=0),t<0||t>=this._templates.length?null:this._templates[t]},e.prototype.addTemplateAt=function(t,e){this._templates.splice(e,0,t),t.assignedUnit=this},e.prototype.addTemplate=function(t){this._templates.push(t),t.assignedUnit=this},e.prototype.removeTemplates=function(){for(var t=this._templates.slice();this._templates.length>0;)this._templates.pop();return t},e.prototype.removeTemplateAt=function(t){if(t<0||t>=this._templates.length)return null;var e=this._templates.splice(t,1)[0];return e.assignedUnit=null,e},e.prototype.removeTemplate=function(t){for(var e=0;et?e:t}function tt(t,e){return"number"==typeof e&&!isNaN(e)&&e0&&(t._previous=this.lastChar,this.lastChar._next=t),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){return t instanceof rt?this._children.indexOf(t):-1},e.prototype.getType=function(){return n.WORD},e}(et),ot=function(t){function e(e,r){var n=t.call(this)||this;return n._video=e,n._data=r,n.createUnits(),n}return J(e,t),e.prototype.createUnits=function(){var t=this,e=this._data;e&&Array.isArray(e.words)&&e.words.forEach((function(e){if(e){var r=new it(e);Array.isArray(e.characters)&&e.characters.forEach((function(t){return r.addChar(new rt(t))})),t.addWord(r)}}))},Object.defineProperty(e.prototype,"children",{get:function(){return this._children.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.firstChar?this.firstChar.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.lastChar?this.lastChar.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordCount",{get:function(){return this._children.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._children.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstWord",{get:function(){return this._children.length<=0?null:this._children[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastWord",{get:function(){return this._children.length<=0?null:this._children[this._children.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){var t=this.firstWord;return null===t?null:t.firstChar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){var t=this.lastWord;return null===t?null:t.lastChar},enumerable:!1,configurable:!0}),e.prototype.getWord=function(t){return t<0||t>=this._children.length?null:this._children[t]},e.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.addWord=function(t){if(t){this._children.length>0&&(t._previous=this.lastWord,t._previous._next=t,t.firstChar._previous=t._previous.lastChar,t._previous.lastChar._next=t.firstChar),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){if(t instanceof it)return this._children.indexOf(t);if(t instanceof rt){for(var e=0,r=!1,n=0,i=this._children;n=t.length&&(i=t.length-1);var o=e,s=n.endTime;return t[i].overlaps(o,s)?t[i]:i<1?null:t[i-1].overlaps(o,s)?t[i-1]:null}return i>=t.length?null:n&&"loose"in n&&n.loose||t[i].contains(e)?t[i]:null}function at(t,e,n){if(!t||t.length<=0)return{current:null,entered:[],left:[],previous:null,next:null};var i=r.sortedIndex(t,e,(function(t){return t.startTime}));ie?i-2:i-1,c=r.sortedIndex(t,n,(function(t){return t.endTime}));c>=t.length?(o=-1,s=-1,a=t[c-1].endTime>e?t.length:0):(t[c].startTime>n?(o=-1,s=c):c+1>=t.length||t[c+1].startTime>n?(o=t[c].endTime>n&&t[c].startTime<=n?c:-1,s=c+1):(o=c+1,s=c+2),a=t[c].endTime<=n?c+1:c);var l=u>=0?t[u]:null,p=s>=0&&s=0?t[o]:null,entered:t.slice(i,s),left:t.slice(u+1,a),previous:l,next:p}}var ut=function(t){function e(e){var r=t.call(this)||this;return r._credits=[],r._phrases=[],r._graphics=[],r.data=e||{},r.createUnits(),r}return J(e,t),Object.defineProperty(e.prototype,"credits",{get:function(){return this._credits.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"phrases",{get:function(){return this._phrases.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"words",{get:function(){return this._phrases.reduce((function(t,e){return t.splice.apply(t,H([t.length,0],e._children,!1)),t}),[])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"chars",{get:function(){return this.words.reduce((function(t,e){return t.splice.apply(t,H([t.length,0],e._children,!1)),t}),[])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"graphics",{get:function(){return this._graphics.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rendering",{get:function(){return this._runtime.rendering},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this.data.duration||0},set:function(t){this.data.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.data.startTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.data.endTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"creditCount",{get:function(){return this._credits.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"phraseCount",{get:function(){return this._phrases.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"graphicCount",{get:function(){return this._graphics.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.wordCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstCredit",{get:function(){return this._credits.length<=0?null:this._credits[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastCredit",{get:function(){return this._credits.length<=0?null:this._credits[this._credits.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[this._phrases.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstWord",{get:function(){var t;return(null===(t=this.firstPhrase)||void 0===t?void 0:t.firstWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastWord",{get:function(){var t;return(null===(t=this.lastPhrase)||void 0===t?void 0:t.lastWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){var t;return(null===(t=this.firstWord)||void 0===t?void 0:t.firstChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){var t;return(null===(t=this.lastWord)||void 0===t?void 0:t.lastChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[this._graphics.length-1]},enumerable:!1,configurable:!0}),e.prototype.createUnits=function(){var t,e,r=this;Array.isArray(this.data.credits)?(this.data.credits.sort(ct),this.data.credits.forEach((function(t){return r.doAddCredit(new ot(r,t),!1)})),this.organizeTimings(null===(t=this.firstCredit)||void 0===t?void 0:t.firstChar)):this.data.credits=[],Array.isArray(this.data.phrases)?(this.data.phrases.sort(ct),this.data.phrases.forEach((function(t){return r.doAddPhrase(new ot(r,t),!1)})),this.organizeTimings(null===(e=this.firstPhrase)||void 0===e?void 0:e.firstChar)):this.data.phrases=[],Array.isArray(this.data.graphics)?(this.data.graphics.sort(ct),this.data.graphics.forEach((function(t){return r.doAddGraphic(new nt(t),!1)}))):this.data.graphics=[]},e.prototype.organizeTimings=function(t){for(;t;)t.startTime===t.endTime&&t.maximize(),t=t.next},e.prototype.exportData=function(t){this.updateTemplateData(t);for(var r=e.exportUnitData(this.data.credits,!0),n=r.units,i=r.templateClasses,o=e.exportUnitData(this.data.phrases,!1),s=o.units,a=o.templateClasses,u=e.exportUnitData(this.data.graphics,!0),c=u.units,l=u.templateClasses,p=i.concat(a,l).filter((function(t,e,r){return r.indexOf(t)===e})),h={};p.length>0;){var d=p.shift(),f=t.getByName(d);if(f){h[d]=f.id;for(var y=0,g=t.getRequiredTemplates(f.script);y0?t[n-1]:null,o=n0){for(var s=i;s&&!s.lastWord;)s=s.previous;for(var a=o;a&&!a.firstWord;)a=a.next;if(s&&(e.firstWord._previous=s.lastWord,s.lastWord._next=e.firstWord),a&&(e.lastWord._next=a.firstWord,a.firstWord._previous=e.lastWord),e.charCount>0){for(var u=null==s?void 0:s.lastWord;u&&null===u.lastChar;)u=u.previous;for(var c=null==a?void 0:a.firstWord;c&&null===c.firstChar;)c=c.next;u&&(e.firstChar._previous=u.lastChar,u.lastChar._next=e.firstChar),c&&(e.lastChar._next=c.firstChar,c.firstChar._previous=e.lastChar)}}return this.updateStartAndEndTime(),n}},e.prototype.removeCredit=function(t){var e=this.removeRenderingUnit(this._credits,t);return!(e<0||(this.data.credits.splice(e,1),this._runtime&&this._runtime.removeCredit(t),0))},e.prototype.removeCredits=function(){var t=this;this._runtime&&this._credits.forEach((function(e){return t._runtime.removeCredit(e)})),this._credits=[],this.data.credits.splice(0,this.data.credits.length)},e.prototype.removePhrase=function(t){var e=this.removeRenderingUnit(this._phrases,t);return!(e<0||(this.data.phrases.splice(e,1),this._runtime&&this._runtime.removePhrase(t),0))},e.prototype.removePhrases=function(){var t=this;this._runtime&&this._phrases.forEach((function(e){return t._runtime.removePhrase(e)})),this._phrases=[],this.data.phrases.splice(0,this.data.phrases.length)},e.prototype.removeGraphic=function(t){var e=this.removeRenderingUnit(this._graphics,t);return!(e<0||(this.data.graphics.splice(e,1),this._runtime&&this._runtime.removeGraphic(t),0))},e.prototype.removeGraphics=function(){var t=this;this._runtime&&this._graphics.forEach((function(e){return t._runtime.removeGraphic(e)})),this._graphics=[],this.data.graphics.splice(0,this.data.graphics.length),this.rendering.reset()},e.prototype.removeRenderingUnit=function(t,e){var n=r.sortedIndex(t,e,lt);if(n<0||t[n]!==e)return-1;if(t.splice(n,1),e instanceof ot){if(e.charCount>0){for(var i=e._previous;i&&null===i.lastChar;)i=i.previous;for(var o=e._next;o&&null===o.firstChar;)o=o.next;i&&o?(i.lastChar._next=o.firstChar,o.firstChar._previous=i.lastChar):i?i.lastChar._next=null:o&&(o.firstChar._previous=null)}if(e.wordCount>0){for(i=e._previous;i&&null===i.lastWord;)i=i.previous;for(o=e._next;o&&null===o.firstWord;)o=o.next;i&&o?(i.lastWord._next=o.firstWord,o.firstWord._previous=i.lastWord):i?i.lastWord._next=null:o&&(o.firstWord._previous=null)}}e._previous&&(e._previous._next=e._next),e._next&&(e._next._previous=e._previous),this.updateStartAndEndTime()},e.prototype.updateStartAndEndTime=function(){var t,e,r,n,i,o,s,a;this.data.endTime=Math.max((null===(e=null===(t=this.lastCredit)||void 0===t?void 0:t.lastChar)||void 0===e?void 0:e.endTime)||0,(null===(r=this.lastChar)||void 0===r?void 0:r.endTime)||0,(null===(n=this.lastGraphic)||void 0===n?void 0:n.endTime)||0);var u=null===(o=null===(i=this.firstCredit)||void 0===i?void 0:i.firstChar)||void 0===o?void 0:o.startTime,c=null===(s=this.firstChar)||void 0===s?void 0:s.startTime,l=null===(a=this.firstGraphic)||void 0===a?void 0:a.startTime;this.data.startTime=Math.min("number"==typeof u?u:Number.MAX_VALUE,"number"==typeof c?c:Number.MAX_VALUE,"number"==typeof l?l:Number.MAX_VALUE,this.data.endTime)},e.prototype.findIndex=function(t){if(t instanceof ot)return(e=this._phrases.indexOf(t))>=0?e:this._credits.indexOf(t);if(t instanceof it){for(var e=0,r=!1,n=0,i=this._phrases;n=this._credits.length?null:this._credits[t]},e.prototype.getPhrase=function(t){return t<0||t>=this._phrases.length?null:this._phrases[t]},e.prototype.getWord=function(t){if(t<0)return null;for(var e=0,r=this.firstPhrase;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.getGraphic=function(t){return t<0||t>=this._graphics.length?null:this._graphics[t]},e.prototype.findCredit=function(t,e){return st(this._credits,t,e)},e.prototype.findCreditChange=function(t,e){return at(this._credits,t,e)},e.prototype.findPhrase=function(t,e){return st(this._phrases,t,e)},e.prototype.findPhraseChange=function(t,e){return at(this._phrases,t,e)},e.prototype.findWord=function(t,e){var r=this.findPhrase(t,e);return r?st(r._children,t,e):null},e.prototype.findWordChange=function(t,e){return at(this.words,t,e)},e.prototype.findChar=function(t,e){var r=this.findWord(t,e);return r?st(r._children,t,e):null},e.prototype.findCharChange=function(t,e){return at(this.chars,t,e)},e.prototype.findGraphic=function(t,e){return st(this._graphics,t,e)},e.prototype.findGraphicChange=function(t,e){return at(this._graphics,t,e)},e}($);function ct(t,e){return t.startTime-e.startTime}function lt(t){return t.startTime}var pt=function(){function t(t,e,r,n,i,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.setValues(t,e,r,n,i,o)}return t.prototype.setValues=function(t,e,r,n,i,o){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=o,this},t.prototype.append=function(t,e,r,n,i,o){var s=this.a,a=this.b,u=this.c,c=this.d;return 1==t&&0==e&&0==r&&1==n||(this.a=s*t+u*e,this.b=a*t+c*e,this.c=s*r+u*n,this.d=a*r+c*n),this.tx=s*i+u*o+this.tx,this.ty=a*i+c*o+this.ty,this},t.prototype.prepend=function(t,e,r,n,i,o){var s=this.a,a=this.c,u=this.tx;return this.a=t*s+r*this.b,this.b=e*s+n*this.b,this.c=t*a+r*this.d,this.d=e*a+n*this.d,this.tx=t*u+r*this.ty+i,this.ty=e*u+n*this.ty+o,this},t.prototype.appendMatrix=function(t){return this.append(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.prependMatrix=function(t){return this.prepend(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.appendTransform=function(e,r,n,i,o,s,a,u,c){var l,p,h;return o%360?(l=o*t.DEG_TO_RAD,p=Math.cos(l),h=Math.sin(l)):(p=1,h=0),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.append(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r),this.append(p*n,h*n,-h*i,p*i,0,0)):this.append(p*n,h*n,-h*i,p*i,e,r),(u||c)&&(this.tx-=u*this.a+c*this.c,this.ty-=u*this.b+c*this.d),this},t.prototype.prependTransform=function(e,r,n,i,o,s,a,u,c){var l,p,h;return o%360?(l=o*t.DEG_TO_RAD,p=Math.cos(l),h=Math.sin(l)):(p=1,h=0),(u||c)&&(this.tx-=u,this.ty-=c),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.prepend(p*n,h*n,-h*i,p*i,0,0),this.prepend(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r)):this.prepend(p*n,h*n,-h*i,p*i,e,r),this},t.prototype.rotate=function(e){e*=t.DEG_TO_RAD;var r=Math.cos(e),n=Math.sin(e),i=this.a,o=this.b;return this.a=i*r+this.c*n,this.b=o*r+this.d*n,this.c=-i*n+this.c*r,this.d=-o*n+this.d*r,this},t.prototype.skew=function(e,r){return e*=t.DEG_TO_RAD,r*=t.DEG_TO_RAD,this.append(Math.cos(r),Math.sin(r),-Math.sin(e),Math.cos(e),0,0),this},t.prototype.scale=function(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this},t.prototype.translate=function(t,e){return this.tx+=this.a*t+this.c*e,this.ty+=this.b*t+this.d*e,this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},t.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,n=this.d,i=this.tx,o=t*n-e*r;return this.a=n/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-n*i)/o,this.ty=-(t*this.ty-e*i)/o,this},t.prototype.isIdentity=function(){return 0===this.tx&&0===this.ty&&1===this.a&&0===this.b&&0===this.c&&1===this.d},t.prototype.equals=function(t){return this.tx===t.tx&&this.ty===t.ty&&this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d},t.prototype.transformPoint=function(t,e,r){return r.x=t*this.a+e*this.c+this.tx,r.y=t*this.b+e*this.d+this.ty,r},t.prototype.decompose=function(e){void 0===e&&(e={}),e.x=this.tx,e.y=this.ty,e.scaleX=Math.sqrt(this.a*this.a+this.b*this.b),e.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var r=Math.atan2(-this.c,this.d),n=Math.atan2(this.b,this.a);return Math.abs(1-r/n)<1e-5?(e.rotation=n/t.DEG_TO_RAD,this.a<0&&this.d>=0&&(e.rotation+=e.rotation<=0?180:-180),e.skewX=e.skewY=0):(e.skewX=r/t.DEG_TO_RAD,e.skewY=n/t.DEG_TO_RAD),e},t.prototype.copy=function(t){return this.setValues(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.clone=function(){return new t(this.a,this.b,this.c,this.d,this.tx,this.ty)},t.prototype.toString=function(){return"[".concat(this.constructor.name," (a=").concat(this.a," b=").concat(this.b," c=").concat(this.c," d=").concat(this.d," tx=").concat(this.tx," ty=").concat(this.ty,")]")},t.DEG_TO_RAD=Math.PI/180,t.identity=new t,t}(),ht=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.setValues(t,e)}return t.prototype.setValues=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e,this},t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.toString=function(){return"[".concat(this.constructor.name," (x=").concat(this.x," y=").concat(this.y,")]")},t}(),dt=function(){function t(){this.tx=new pt,this.alpha=0,this.composite="",this.visible=!0}return t.prototype.reset=function(){},t}(),ft=function(){function t(){this.rendering=new dt}return t.prototype.addCredit=function(t){this.doAddPhrase(t)},t.prototype.removeCredit=function(t){t._runtime=null},t.prototype.addPhrase=function(t){this.doAddPhrase(t)},t.prototype.removePhrase=function(t){t._runtime=null},t.prototype.doAddPhrase=function(t){t._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){}};for(var e=t.firstWord;e;){e._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){}};for(var r=e.firstChar;r&&(r._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){},advance:0,ascent:0,descent:0,onFontUpdate:function(){},onColorUpdate:function(){}},r!==e.lastChar);)r=r.next;if(e===t.lastWord)break;e=e.next}},t.prototype.addGraphic=function(t){t._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){}}},t.prototype.removeGraphic=function(t){t._runtime=null},t}(),yt=function(){function t(){this.wrapperTable={}}return t.prototype.isGraphics=function(){return!1},t.prototype.setCanvas=function(){return Promise.resolve()},t.prototype.createRuntime=function(t){return function(t,e,r,n){return new(r||(r=Promise))((function(e,i){function o(t){try{a(n.next(t))}catch(t){i(t)}}function s(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(t){t(n)}))).then(o,s)}a((n=n.apply(t,[])).next())}))}(this,0,void 0,(function(){var e,r,n;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]3){for(r.sort((function(t,e){return e.length-t.length})),e+="switch(str.length){",n=0;n=170&&er.test(String.fromCharCode(t)))},sr=function(t){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||t>=170&&rr.test(String.fromCharCode(t))))};function ar(){this.line=Ct,this.column=Pt-Nt}function ur(t,e){Ot=Pt,mt.locations&&(Tt=new ar),xt=t,pr(),At=e,Rt=t.beforeExpr}function cr(){var t,e=mt.onComment&&mt.locations&&new ar,r=Pt,n=bt.indexOf("*/",Pt+=2);if(-1===n&&Vt(Pt-2,"Unterminated comment"),Pt=n+2,mt.locations)for(ir.lastIndex=r;(t=ir.exec(bt))&&t.index8&&t<14)++Pt;else if(47===t){var e;if(42===(e=bt.charCodeAt(Pt+1)))cr();else{if(47!==e)break;lr()}}else if(160===t)++Pt;else{if(!(t>=5760&&Qe.test(String.fromCharCode(t))))break;++Pt}}}function hr(t){if(t?Pt=Et+1:Et=Pt,mt.locations&&(St=new ar),t)return fr();if(Pt>=_t)return ur(Jt);var e=bt.charCodeAt(Pt);if(or(e)||92===e)return br();var r=function(t){switch(t){case 46:return function(){var t=bt.charCodeAt(Pt+1);return t>=48&&t<=57?gr(!0):(++Pt,ur(Re))}();case 40:return++Pt,ur(Oe);case 41:return++Pt,ur(Se);case 59:return++Pt,ur(xe);case 44:return++Pt,ur(Te);case 91:return++Pt,ur(_e);case 93:return++Pt,ur(we);case 123:return++Pt,ur(Pe);case 125:return++Pt,ur(Ee);case 58:return++Pt,ur(Ae);case 63:return++Pt,ur(Ce);case 48:var e=bt.charCodeAt(Pt+1);if(120===e||88===e)return function(){Pt+=2;var t=yr(16);return null==t&&Vt(Et+2,"Expected hexadecimal number"),or(bt.charCodeAt(Pt))&&Vt(Pt,"Identifier directly after number"),ur(qt,t)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return gr(!1);case 34:case 39:return function(t){Pt++;for(var e="";;){Pt>=_t&&Vt(Et,"Unterminated string constant");var r=bt.charCodeAt(Pt);if(r===t)return++Pt,ur(Yt,e);if(92===r){r=bt.charCodeAt(++Pt);var n=/^[0-7]+/.exec(bt.slice(Pt,Pt+3));for(n&&(n=n[0]);n&&parseInt(n,8)>255;)n=n.slice(0,-1);if("0"===n&&(n=null),++Pt,n)Lt&&Vt(Pt-2,"Octal literal in strict mode"),e+=String.fromCharCode(parseInt(n,8)),Pt+=n.length-1;else switch(r){case 110:e+="\n";break;case 114:e+="\r";break;case 120:e+=String.fromCharCode(vr(2));break;case 117:e+=String.fromCharCode(vr(4));break;case 85:e+=String.fromCharCode(vr(8));break;case 116:e+="\t";break;case 98:e+="\b";break;case 118:e+="\v";break;case 102:e+="\f";break;case 48:e+="\0";break;case 13:10===bt.charCodeAt(Pt)&&++Pt;case 10:mt.locations&&(Nt=Pt,++Ct);break;default:e+=String.fromCharCode(r)}}else 13!==r&&10!==r&&8232!==r&&8233!==r||Vt(Et,"Unterminated string constant"),e+=String.fromCharCode(r),++Pt}}(t);case 47:return function(t){var e=bt.charCodeAt(Pt+1);return Rt?(++Pt,fr()):61===e?dr(je,2):dr(Ne,1)}();case 37:case 42:return 61===bt.charCodeAt(Pt+1)?dr(je,2):dr(Ye,1);case 124:case 38:return function(t){var e=bt.charCodeAt(Pt+1);return e===t?dr(124===t?Fe:Le,2):61===e?dr(je,2):dr(124===t?De:Be,1)}(t);case 94:return 61===bt.charCodeAt(Pt+1)?dr(je,2):dr(Me,1);case 43:case 45:return function(t){var e=bt.charCodeAt(Pt+1);return e===t?45==e&&62==bt.charCodeAt(Pt+2)&&nr.test(bt.slice(jt,Pt))?(Pt+=3,lr(),pr(),hr()):dr(Ie,2):61===e?dr(je,2):dr(We,1)}(t);case 60:case 62:return function(t){var e=bt.charCodeAt(Pt+1),r=1;return e===t?(r=62===t&&62===bt.charCodeAt(Pt+2)?3:2,61===bt.charCodeAt(Pt+r)?dr(je,r+1):dr(qe,r)):33==e&&60==t&&45==bt.charCodeAt(Pt+2)&&45==bt.charCodeAt(Pt+3)?(Pt+=4,lr(),pr(),hr()):(61===e&&(r=61===bt.charCodeAt(Pt+2)?3:2),dr(Ge,r))}(t);case 61:case 33:return function(t){return 61===bt.charCodeAt(Pt+1)?dr(Ve,61===bt.charCodeAt(Pt+2)?3:2):dr(61===t?ke:Ue,1)}(t);case 126:return dr(Ue,1)}return!1}(e);if(!1===r){var n=String.fromCharCode(e);if("\\"===n||er.test(n))return br();Vt(Pt,"Unexpected character '"+n+"'")}return r}function dr(t,e){var r=bt.slice(Pt,Pt+e);Pt+=e,ur(t,r)}function fr(){for(var t,e,r=Pt;;){Pt>=_t&&Vt(r,"Unterminated regular expression");var n=bt.charAt(Pt);if(nr.test(n)&&Vt(r,"Unterminated regular expression"),t)t=!1;else{if("["===n)e=!0;else if("]"===n&&e)e=!1;else if("/"===n&&!e)break;t="\\"===n}++Pt}var i=bt.slice(r,Pt);++Pt;var o=mr();return o&&!/^[gmsiy]*$/.test(o)&&Vt(r,"Invalid regexp flag"),ur(Wt,new RegExp(i,o))}function yr(t,e){for(var r=Pt,n=0,i=0,o=null==e?1/0:e;i=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=t)break;++Pt,n=n*t+s}return Pt===r||null!=e&&Pt-r!==e?null:n}function gr(t){var e=Pt,r=!1,n=48===bt.charCodeAt(Pt);t||null!==yr(10)||Vt(e,"Invalid number"),46===bt.charCodeAt(Pt)&&(++Pt,yr(10),r=!0);var i=bt.charCodeAt(Pt);69!==i&&101!==i||(43!==(i=bt.charCodeAt(++Pt))&&45!==i||++Pt,null===yr(10)&&Vt(e,"Invalid number"),r=!0),or(bt.charCodeAt(Pt))&&Vt(Pt,"Identifier directly after number");var o,s=bt.slice(e,Pt);return r?o=parseFloat(s):n&&1!==s.length?/[89]/.test(s)||Lt?Vt(e,"Invalid number"):o=parseInt(s,8):o=parseInt(s,10),ur(qt,o)}function vr(t){var e=yr(16,t);return null===e&&Vt(Et,"Bad character escape sequence"),e}function mr(){Je=!1;for(var t,e=!0,r=Pt;;){var n=bt.charCodeAt(Pt);if(sr(n))Je&&(t+=bt.charAt(Pt)),++Pt;else{if(92!==n)break;Je||(t=bt.slice(r,Pt)),Je=!0,117!=bt.charCodeAt(++Pt)&&Vt(Pt,"Expecting Unicode escape sequence \\uXXXX"),++Pt;var i=vr(4),o=String.fromCharCode(i);o||Vt(Pt-1,"Invalid Unicode escape"),(e?or(i):sr(i))||Vt(Pt-4,"Invalid Unicode escape"),t+=o}e=!1}return Je?t:bt.slice(r,Pt)}function br(){var t=mr(),e=zt;return Je||(Ke(t)?e=be[t]:(mt.forbidReserved&&(3===mt.ecmaVersion?He:Xe)(t)||Lt&&Ze(t))&&Vt(Et,"The keyword '"+t+"' is reserved")),ur(e,t)}function _r(){kt=Et,jt=Ot,It=Tt,hr()}function wr(t){if(Lt=t,Pt=jt,mt.locations)for(;Pt=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"use strict"===t.expression.value}function Ar(t){if(xt===t)return _r(),!0}function Rr(){return!mt.strictSemicolons&&(xt===Jt||xt===Ee||nr.test(bt.slice(jt,Et)))}function Cr(){Ar(xe)||Rr()||kr()}function Nr(t){xt===t?_r():kr()}function kr(){Vt(Et,"Unexpected token")}function jr(t){"Identifier"!==t.type&&"MemberExpression"!==t.type&&Vt(t.start,"Assigning to rvalue"),Lt&&"Identifier"===t.type&&$e(t.name)&&Vt(t.start,"Assigning to "+t.name+" in strict mode")}var Ir={kind:"loop"},Ur={kind:"switch"};function Fr(){(xt===Ne||xt===je&&"/="==At)&&hr(!0);var t=xt,e=Or();switch(t){case Ht:case $t:_r();var r=t===Ht;Ar(xe)||Rr()?e.label=null:xt!==zt?kr():(e.label=$r(),Cr());for(var n=0;ne){var i=Sr(t);i.left=t,i.operator=At;var o=xt;return _r(),i.right=Wr(Yr(),n,r),Wr(Tr(i,o===Fe||o===Le?"LogicalExpression":"BinaryExpression"),e,r)}return t}function Yr(){if(xt.prefix){var t=Or(),e=xt.isUpdate;return t.operator=At,t.prefix=!0,Rt=!0,_r(),t.argument=Yr(),e?jr(t.argument):Lt&&"delete"===t.operator&&"Identifier"===t.argument.type&&Vt(t.start,"Deleting local variable in strict mode"),Tr(t,e?"UpdateExpression":"UnaryExpression")}for(var r=zr(Jr());xt.postfix&&!Rr();)(t=Sr(r)).operator=At,t.prefix=!1,t.argument=r,jr(r),_r(),r=Tr(t,"UpdateExpression");return r}function zr(t,e){var r;return Ar(Re)?((r=Sr(t)).object=t,r.property=$r(!0),r.computed=!1,zr(Tr(r,"MemberExpression"),e)):Ar(_e)?((r=Sr(t)).object=t,r.property=Gr(),r.computed=!0,Nr(we),zr(Tr(r,"MemberExpression"),e)):!e&&Ar(Oe)?((r=Sr(t)).callee=t,r.arguments=Zr(Se,!1),zr(Tr(r,"CallExpression"),e)):t}function Jr(){switch(xt){case fe:var t=Or();return _r(),Tr(t,"ThisExpression");case zt:return $r();case qt:case Yt:case Wt:return(t=Or()).value=At,t.raw=bt.slice(Et,Ot),_r(),Tr(t,"Literal");case ye:case ge:case ve:return(t=Or()).value=xt.atomValue,t.raw=xt.keyword,_r(),Tr(t,"Literal");case Oe:var e=St,r=Et;_r();var n=Gr();return n.start=r,n.end=Ot,mt.locations&&(n.loc.start=e,n.loc.end=Tt),mt.ranges&&(n.range=[r,Ot]),Nr(Se),n;case _e:return t=Or(),_r(),t.elements=Zr(we,!0,!0),Tr(t,"ArrayExpression");case Pe:return function(){var t=Or(),e=!0,r=!1;for(t.properties=[],_r();!Ar(Ee);){if(e)e=!1;else if(Nr(Te),mt.allowTrailingCommas&&Ar(Ee))break;var n,i={key:Hr()},o=!1;if(Ar(Ae)?(i.value=Gr(!0),n=i.kind="init"):mt.ecmaVersion>=5&&"Identifier"===i.key.type&&("get"===i.key.name||"set"===i.key.name)?(o=r=!0,n=i.kind=i.key.name,i.key=Hr(),xt!==Oe&&kr(),i.value=Xr(Or(),!1)):kr(),"Identifier"===i.key.type&&(Lt||r))for(var s=0;s=0)for(var a=0;a>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;","Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")},t.prototype.initString=function(e){var r,n=this;r=function(t){return t=String(t),n.calledWithNew()?(this.data=t,this):t},this.STRING=this.createNativeFunction(r,!0),this.setProperty(e,"String",this.STRING),this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(String.fromCharCode,!1),t.NONENUMERABLE_DESCRIPTOR);for(var i=["trim","toLowerCase","toUpperCase","toLocaleLowerCase","toLocaleUpperCase","charAt","charCodeAt","substring","slice","substr","indexOf","lastIndexOf","concat"],o=0;o= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);","}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","")},t.prototype.initBoolean=function(t){var e,r=this;e=function(t){return t=Boolean(t),r.calledWithNew()?(this.data=t,this):t},this.BOOLEAN=this.createNativeFunction(e,!0),this.setProperty(t,"Boolean",this.BOOLEAN)},t.prototype.initNumber=function(e){var r,n=this;r=function(t){return t=Number(t),n.calledWithNew()?(this.data=t,this):t},this.NUMBER=this.createNativeFunction(r,!0),this.setProperty(e,"Number",this.NUMBER);for(var i=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"],o=0;o>>0;return e===Number(t)?e:NaN},t.legalArrayIndex=function(t){var e=t>>>0;return String(e)===String(t)&&4294967295!==e?e:NaN},t.prototype.createObject=function(t){return this.createObjectProto(t&&t.properties.prototype)},t.prototype.createObjectProto=function(t){var e=new Qr(t);return this.isa(e,this.FUNCTION)&&(this.setProperty(e,"prototype",this.createObjectProto(this.OBJECT_PROTO||null)),e.class="Function"),this.isa(e,this.ARRAY)&&(this.setProperty(e,"length",0,{configurable:!1,enumerable:!1,writable:!0}),e.class="Array"),this.isa(e,this.ERROR)&&(e.class="Error"),e},t.prototype.populateRegExp=function(e,r){e.data=r,this.setProperty(e,"lastIndex",r.lastIndex,t.NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"source",r.source,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"global",r.global,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"ignoreCase",r.ignoreCase,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"multiline",r.multiline,t.READONLY_NONENUMERABLE_DESCRIPTOR)},t.prototype.createFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.parentScope=r,n.node=e,this.setProperty(n,"length",n.node.params.length,t.READONLY_DESCRIPTOR),n},t.prototype.createNativeFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.nativeFunc=e,e.id=this.functionCounter_++,this.setProperty(n,"length",e.length,t.READONLY_DESCRIPTOR),r?this.setProperty(n.properties.prototype,"constructor",n,t.NONENUMERABLE_DESCRIPTOR):!1===r&&(n.illegalConstructor=!0,this.setProperty(n,"prototype",void 0)),n},t.prototype.createAsyncFunction=function(e){var r=this.createObjectProto(this.FUNCTION_PROTO);return r.asyncFunc=e,e.id=this.functionCounter_++,this.setProperty(r,"length",e.length,t.READONLY_DESCRIPTOR),r},t.prototype.nativeToPseudo=function(t){if("boolean"==typeof t||"number"==typeof t||"string"==typeof t||null==t)return t;if(t instanceof RegExp){var e=this.createObjectProto(this.REGEXP_PROTO);return this.populateRegExp(e,t),e}if(t instanceof Function){var r=this;return this.createNativeFunction((function(){return r.nativeToPseudo(t.apply(r,Array.prototype.slice.call(arguments).map((function(t){return r.pseudoToNative(t)}))))}),void 0)}var n;if(Array.isArray(t)){n=this.createObjectProto(this.ARRAY_PROTO);for(var i=0;i>=":s>>=a;break;case">>>=":s>>>=a;break;case"&=":s&=a;break;case"^=":s^=a;break;case"|=":s|=a;break;default:throw SyntaxError("Unknown assignment expression: "+r.operator)}var u=this.setValue(e.leftReference_,s);if(u)return e.doneSetter_=s,this.createSetter_(u,e.leftReference_,s);t.pop(),t[t.length-1].value=s},t.prototype.stepBinaryExpression=function(t,e,r){if(!e.doneLeft_)return e.doneLeft_=!0,new tn(r.left,e.scope);if(!e.doneRight_)return e.doneRight_=!0,e.leftValue_=e.value,new tn(r.right,e.scope);t.pop();var n,i=e.leftValue_,o=e.value;switch(r.operator){case"==":n=i==o;break;case"!=":n=i!=o;break;case"===":n=i===o;break;case"!==":n=i!==o;break;case">":n=i>o;break;case">=":n=i>=o;break;case"<":n=i>":n=i>>o;break;case">>>":n=i>>>o;break;case"in":o&&o.isObject||this.throwException(this.TYPE_ERROR,"'in' expects an object, not '"+o+"'"),n=this.hasProperty(o,i);break;case"instanceof":this.isa(o,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Right-hand side of instanceof is not an object"),n=!!i.isObject&&this.isa(i,o);break;default:throw SyntaxError("Unknown binary operator: "+r.operator)}t[t.length-1].value=n},t.prototype.stepBlockStatement=function(t,e,r){var n=e.n_||0,i=r.body[n];if(i)return e.n_=n+1,new tn(i,e.scope);t.pop()},t.prototype.stepBreakStatement=function(t,e,r){t.pop();var n=null;for(r.label&&(n=r.label.name);e&&"CallExpression"!==e.node.type&&"NewExpression"!==e.node.type;){if(n){if(e.labels&&-1!==e.labels.indexOf(n))return}else if(e.isLoop||e.isSwitch)return;e=t.pop()}throw SyntaxError("Illegal break statement")},t.prototype.stepCallExpression=function(e,r,n){if(!r.doneCallee_){r.doneCallee_=1;var i=new tn(n.callee,r.scope);return i.components=!0,i}if(1===r.doneCallee_){r.doneCallee_=2;var o=r.value;if(Array.isArray(o)){if(r.func_=this.getValue(o),o[0]!==t.SCOPE_REFERENCE&&(r.funcThis_=o[0]),(o=r.func_)&&"object"==typeof o&&o.isGetter)return o.isGetter=!1,r.doneCallee_=1,this.createGetter_(o,r.value)}else r.func_=o;r.arguments_=[],r.n_=0}if(o=r.func_,!r.doneArgs_){if(0!==r.n_&&r.arguments_.push(r.value),n.arguments[r.n_])return new tn(n.arguments[r.n_++],r.scope);"NewExpression"===n.type?(o.illegalConstructor&&this.throwException(this.TYPE_ERROR,o+" is not a constructor"),r.funcThis_=this.createObject(o),r.isConstructor=!0):void 0===r.funcThis_&&(r.funcThis_=r.scope.strict?void 0:this.global),r.doneArgs_=!0}if(r.doneExec_)e.pop(),r.isConstructor&&"object"!=typeof r.value?e[e.length-1].value=r.funcThis_:e[e.length-1].value=r.value;else{r.doneExec_=!0,o&&o.isObject||(console.log("non-function called",o,r),this.throwException(this.TYPE_ERROR,o+" is not a function"));var s=o.node;if(s){for(var a=this.createScope(s.body,o.parentScope),u=0;uu?r.arguments_[u]:void 0;this.setProperty(a,c,l)}var p=this.createObjectProto(this.ARRAY_PROTO);for(u=0;u=0)return!0;r=Object.getPrototypeOf(r)}return!1};function rn(t,e){var r={},n=Dt(t,{locations:!0,onComment:function(t,e,n,i,o,s){r[s.line]=e}});if("Program"!==n.type||1!==n.body.length||"FunctionDeclaration"!==n.body[0].type)throw new Error("JavaScript program should only have one function definition");var i=n.body[0].body.body,o=[],s=[];return i.forEach((function(t){if("ExpressionStatement"===t.type){var n=t.expression;if("AssignmentExpression"===n.type&&"="===n.operator&&"MemberExpression"===n.left.type&&"ThisExpression"===n.left.object.type&&"Identifier"===n.left.property.type){for(var i=[],a=n.loc.start.line-1;a>=0&&void 0!==r[a];a--)i.push(r[a]);if(!(i.length<=0)){var u=n.left.property.name;if(!(Array.isArray(e)&&e.indexOf(u)>=0)&&"FunctionExpression"!==n.right.type){var c=function(t,e,r){var n={name:t,title:{},className:null,proposed:!1,initialValue:null};if(e.forEach((function(t){var e=t.indexOf("@ui ");if(e>=0)n.description=t.substring(e+4).trim();else{var r=t.indexOf("@title ");if(r>=0){var i=t.substring(r+7).trim();0===i.indexOf("@ja ")?n.title.ja=i.substring(4).trim():n.title.default=i}else if(t.indexOf("@proposed")>=0)n.proposed=!0;else{var o=t.indexOf("@comment ");if(o>=0){var s=t.substring(o+9).trim();return n.comment||(n.comment={}),void(0===s.indexOf("@ja ")?n.comment.ja=s.substring(4).trim():n.comment.default=s)}}}})),!n.description&&!n.comment)return null;if(n.proposed||n.comment)return n;var i=n.description.indexOf("("),o=n.description.indexOf(")",i);if(!(i<0||o<0)){n.className=n.description.substr(0,i);try{var s=new Kr("[".concat(n.description.substr(i+1,o-i-1),"]")),a=Date.now();for(s.unwrap=null,s.wrap=null;s.step()&&!(Date.now()-a>100););n.params=s.pseudoToNative(s.value)}catch(t){}return n.params||(n.params=[]),n}}(u,i);s.push(n),c&&o.push(c)}}}}})),{widgets:o,fields:s,ast:n}}function nn(t,e){if(void 0===e&&(e=-1),!t)return{dependencyAtCursor:null,dependencies:[]};for(var r=[],n=null,i=("string"==typeof t?Dt(t,Kr.PARSE_OPTIONS):t).body[0].body.body.slice(0);i.length>0;){var o=i.shift();if(null!=o)if("CallExpression"!==o.type)o.expression&&i.push(o.expression),o.object&&i.push(o.object),o.property&&i.push(o.property),o.name&&"string"!=typeof name&&i.push(o.name),o.left&&i.push(o.left),o.right&&i.push(o.right),o.id&&i.push(o.id),o.init&&i.push(o.init),o.callee&&i.push(o.callee),o.body&&Array.isArray(o.body)&&i.push.apply(i,o.body),o.declarations&&Array.isArray(o.declarations)&&i.push.apply(i,o.declarations),o.arguments&&Array.isArray(o.arguments)&&i.push.apply(i,o.arguments),o.params&&Array.isArray(o.params)&&i.push.apply(i,o.params);else if(o.callee.name&&"require"===o.callee.name){var s=o.arguments;if(s&&Array.isArray(s)&&1===s.length){var a=s[0];if("Literal"===a.type){var u=a.value;r.push(u),o.start&&o.end&&o.start<=e&&o.end>=e&&(n=u)}}}}return{dependencyAtCursor:n,dependencies:r}}Kr.Object=Qr,Kr.State=tn;var on=function(){return on=Object.assign||function(t){for(var e,r=1,n=arguments.length;rt){i=!0;break}}catch(o){throw this.verbose&&console.log(r.stateStack),"string"==typeof o&&(o=new Error(o)),r.stateStack.length>0&&(o.node=r.stateStack[r.stateStack.length-1].node),o}if(i){var o=new Error("timeout: spent too long time (> "+t+"ms) to "+e);throw r.stateStack.length>0&&(o.node=r.stateStack[0].node),o}return this.interpreter.value},t.prototype.cleanupProperties=function(t){if(!t)return null;for(var e in this.ignoredPropNames.forEach((function(e){void 0!==t.properties[e]&&delete t.properties[e]})),t.properties)this.cleanupProperty(t.properties[e])||delete t.properties[e];return t.properties},t.prototype.cleanupProperty=function(t){if(an(t))return!0;var e=t;if(e._native)return!0;var r=this.globalScope.properties;if(e.parent===r.Array){for(var n=e.length,i=0;i0}if(e.parent===r.Object){var o=!0;for(var s in e.properties)this.cleanupProperty(e.properties[s])?o=!1:delete e.properties[s];return!o}return!1},t.prototype.restoreProperties=function(t,e){e&&(t.properties=on(on({},t.properties),e))},t.prototype.wrap=function(t){if("object"==typeof t&&null!==t&&void 0!==t.constructor&&"string"==typeof t.constructor.className){var e=t.constructor.className,r=this.wrappers[e];if(void 0===r)return;var n=this.interpreter.createObject(r);return n._native=t,n}return this.verbose&&(an(t)||Array.isArray(t)||console.log("wrap complex obj:",String(t))),this.interpreter.nativeToPseudo(t)},t.prototype.unwrap=function(t,e){return"object"==typeof t&&null!==t&&t._native?t._native:this.interpreter.pseudoToNative(t,e)},t.prototype.wrapClass=function(t,e){this.verbose&&console.log("--- wrapping "+e+" ---"),t.className=e;var r=this,n=this.interpreter.createNativeFunction((function(e){var i,o;if(i=r.interpreter.calledWithNew()?this:r.interpreter.createObjectProto(n.properties.prototype),void 0!==e)if(Array.isArray(e))for(var s=0;s0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=this.player.video.duration&&this.stop()},t}();function Pn(){return yn(this,0,void 0,(function(){return gn(this,(function(t){return bn&&bn.Player?[2,bn]:"undefined"==typeof window?[2,import("songle-api")]:window.Songle&&window.Songle.Player?[2,window.Songle]:(mn||(mn=new Promise((function(t){var e=!1;window.onSongleAPIReady=function(r){e=!0,t(bn=r)},setTimeout((function(){if(!e){var t=[];document.querySelectorAll("script").forEach((function(e){var r=e.getAttribute("src");r&&r.indexOf("songle.jp/v2/api.js")>=0&&t.push(e)})),t.forEach((function(t){return t.parentElement.removeChild(t)}));var r=document.createElement("script");r.src="https://api.songle.jp/v2/api.js",document.head.appendChild(r)}}),1e3)}))),[2,mn])}))}))}var En=function(){function t(t){void 0===t&&(t={}),this.options=t,this.wait=50,this.volumeListener={onVolumeUpdate:this.onVolumeUpdate.bind(this)},this.resetProps()}return Object.defineProperty(t.prototype,"songlePlayer",{get:function(){return this._songlePlayer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._songlePlayer&&this._songlePlayer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"withSync",{get:function(){var t,e;return!(!(null===(t=this.options)||void 0===t?void 0:t.accessToken)&&!(null===(e=this.options)||void 0===e?void 0:e.secretToken))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){var t;if(!this._songlePlayer)return 0;if(this.lastPosition>0&&this.lastTime>0)return Date.now()+this.lastPosition-this.lastTime;var e=this._songlePlayer.positionTime;if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var r=this.lastTime,n=this.lastPosition,i=void 0;if(r>0){var o=Date.now()-r;i=Math.max(0,this.wait-o)}else i=this.wait;0===n&&e>=500?e=0:0===r&&e-n>=800&&(e=n+i)}return e},enumerable:!1,configurable:!0}),t.prototype.initialize=function(t){var e,r,n,i,o=t.player,s=t.updater,a=t.emitter,u=t.altSourceUrl;return yn(this,0,void 0,(function(){var t,l,p;return gn(this,(function(h){switch(h.label){case 0:return this.player&&this.player.removeListener(this.volumeListener),this.player=o,this.player.addListener(this.volumeListener),this.updateMediaPosition=s,this.emitter=a,this._songlePlayer?[3,2]:[4,this.initializeSonglePlayer()];case 1:h.sent(),h.label=2;case 2:return t=this.options.headless,l=u||this.options.altSourceUrls&&(null===(e=this.player.data.song)||void 0===e?void 0:e.permalink)&&this.options.altSourceUrls[null===(r=this.player.data.song)||void 0===r?void 0:r.permalink]||(null===(n=this.player.data.song)||void 0===n?void 0:n.permalink)||void 0,c.isUploaderUrl(l)&&(l=c.getAltSongUrlFromUploaderGuid(c.getUploaderGuid(c.getSongPathFromUrl(l)))),(p=(null===(i=this.player.data.song)||void 0===i?void 0:i.permalink)||l)===l&&(l=void 0),[4,this._songlePlayer.useMedia(p,{headless:t,altSourceUrl:l})];case 3:return h.sent(),this.ignoreSonglePlayerEvents=!0,this._songlePlayer.volume=0*(1-this.player.volume/100)+100*this.player.volume/100,this._songlePlayer.play(),this._songlePlayer.stop(),this.ignoreSonglePlayerEvents=!1,this.resetProps(),[2]}}))}))},t.prototype.resetProps=function(){this.lastPosition=0,this.lastTime=0,this.elapsedTimes=[]},t.prototype.initializeSonglePlayer=function(){var t;return yn(this,0,void 0,(function(){var e,r,n,i,o,s,a,u=this;return gn(this,(function(c){switch(c.label){case 0:return e=this.options,r=e.accessToken,n=e.secretToken,(o=this.options.songle)?[3,2]:[4,Pn()];case 1:o=c.sent(),c.label=2;case 2:return(i=o).System&&(i.System.showLicense=!1),s=null===(t=this.options)||void 0===t?void 0:t.autoUseMedia,this._songlePlayer=this.withSync?new i.SyncPlayer({mediaElement:this.player.mediaSourceElement,accessToken:r,secretToken:n,autoUseMedia:s}):new i.Player({mediaElement:this.player.mediaSourceElement}),a=!1,this._songlePlayer.on("play",(function(){u.ignoreSonglePlayerEvents||(a=!1,u.handler||(u.startPolling(),u.emitter.onPlay()))})),this._songlePlayer.on("pause",(function(){return yn(u,0,void 0,(function(){return gn(this,(function(t){switch(t.label){case 0:return this.ignoreSonglePlayerEvents?[2]:(a=!1,this.stopPolling(),this.emitter.onPause(),this.stopping?(this.stopping=!1,[4,this.updateMediaPosition(0)]):[3,2]);case 1:t.sent(),this.resetProps(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("finish",(function(){return yn(u,0,void 0,(function(){return gn(this,(function(t){switch(t.label){case 0:return a=!1,this.handler?(this.stopPolling(),[4,this.updateMediaPosition(0)]):[3,2];case 1:t.sent(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("seek",(function(t){var e=t.data;return yn(u,0,void 0,(function(){return gn(this,(function(t){switch(t.label){case 0:return this._songlePlayer.isPlaying?[3,2]:(a=!1,[4,this.updateMediaPosition(e.positionTime)]);case 1:return t.sent(),this.emitter.onSeekComplete(e.positionTime),[3,4];case 2:return a=!0,[4,this.updateMediaPosition(this._songlePlayer.positionTime)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))})),this._songlePlayer.on("mediaSeek",(function(){a&&(u.emitter.onSeekComplete(u.position),a=!1)})),this.withSync&&(this._songlePlayer.on("mediaPlay",(function(){u.handler||(u.startPolling(),u.emitter.onPlay())})),this._songlePlayer.on("mediaFinish",(function(){u.handler&&(u.stopPolling(),u.emitter.onStop())}))),[2]}}))}))},t.prototype.play=function(){if(this._songlePlayer)return this._songlePlayer.play();this.emitter.onPlay()},t.prototype.stop=function(){if(this._songlePlayer)return this.stopping=this._songlePlayer.isPlaying,this._songlePlayer.stop();this.emitter.onStop()},t.prototype.pause=function(){if(this._songlePlayer)return this.stopping=!1,this._songlePlayer.pause();this.emitter.onPause()},t.prototype.seek=function(t){var e=this;this._songlePlayer?(this._songlePlayer.seekTo(t),this.emitter.onSeek(t)):this.updateMediaPosition(t).then((function(){e.emitter.onSeek(t)}))},t.prototype.startPolling=function(){var t,e=this;if(this.lastTime>0){var r=Date.now()-this.lastTime;t=Math.max(0,this.wait-r)}else t=this.wait;this.handler=setTimeout((function(){return yn(e,0,void 0,(function(){var e,r,n,i,o,s,a,u,c;return gn(this,(function(l){switch(l.label){case 0:return this._songlePlayer?(r=(e=this).lastTime,n=e.lastPosition,i=this._songlePlayer.positionTime,o=!1,"songle-api-html-media-element-media"===(null===(c=this._songlePlayer.media)||void 0===c?void 0:c.dispatcherName)&&(0===n&&i>=500?(i=0,o=!0):0===r&&i-n>=800&&(i=n+t,o=!0)),s=r>0?Date.now()-r:t,this.updateElapsedTimes(s),a=n>0?n+s:i,u=Math.abs(i-a),(a=u>2*this.wait?i:a<=i?.5*(a+i):Math.max(n,i))5*this.wait||(a=this.lastPosition)),o||(this.lastTime=Date.now()),this.lastPosition=a,[4,this.updateMediaPosition(a)]):[2];case 1:return l.sent(),this.handler&&this.startPolling(),[2]}}))}))}),t)},t.prototype.updateElapsedTimes=function(t){if(this.elapsedTimes.unshift(t),this.elapsedTimes=this.elapsedTimes.slice(0,10),this.elapsedTimes.length>=10){var e=this.elapsedTimes.reduce((function(t,e){return t+e}))/10;e>5*this.wait&&(this.player.stageScale=Math.max(.25,.9*this.player.stageScale),this.elapsedTimes=[]),e<1.2*this.wait&&this.player.stageScale<1&&(this.player.stageScale=Math.min(1,this.player.stageScale/.9),this.elapsedTimes=[])}},t.prototype.stopPolling=function(){var t;if(this.handler){if(clearTimeout(this.handler),this._songlePlayer)if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var e=this.lastTime,r=this.lastPosition,n=Date.now()-e;this.lastPosition=r+n}else this.lastPosition=this._songlePlayer.positionTime;this.lastTime=0}this.handler=null},t.prototype.dispose=function(){if(this.player&&this.player.removeListener(this.volumeListener),this._songlePlayer){try{this._songlePlayer.stop()}catch(t){}this._songlePlayer=null}},t.prototype.onVolumeUpdate=function(t){this._songlePlayer&&(this._songlePlayer.volume=t)},t}(),On=function(){function t(t){this.listeners=[],this.throttleInterval=t&&t.throttleInterval?Number(t.throttleInterval):100}return t.prototype.onVideoLoad=function(t,e){this.listeners.forEach((function(r){return r.onVideoLoad&&r.onVideoLoad(t,e)}))},t.prototype.onSongLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongLoad&&r.onSongLoad(t,e)}))},t.prototype.onSongMapLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongMapLoad&&r.onSongMapLoad(t,e)}))},t.prototype.onSongInfoLoad=function(t,e){var r=!1;this.listeners.forEach((function(n){n.onSongInfoLoad&&(n.onSongInfoLoad(t,e),r=!0)})),r&&console.warn('[TextAlive API] "onSongInfoLoad" event is deprecated; use "onSongMapLoad" event instead')},t.prototype.onVocalAmplitudeLoad=function(t,e){this.listeners.forEach((function(r){return r.onVocalAmplitudeLoad&&r.onVocalAmplitudeLoad(t,e)}))},t.prototype.onValenceArousalLoad=function(t,e){this.listeners.forEach((function(r){return r.onValenceArousalLoad&&r.onValenceArousalLoad(t,e)}))},t.prototype.onLyricsLoad=function(t,e){this.listeners.forEach((function(r){return r.onLyricsLoad&&r.onLyricsLoad(t,e)}))},t.prototype.onTextLoad=function(t,e){this.listeners.forEach((function(r){return r.onTextLoad&&r.onTextLoad(t,e)}))},t.prototype.onAppLoad=function(t){this.listeners.forEach((function(e){return e.onAppLoad&&e.onAppLoad(t)}))},t.prototype.onAppReady=function(t){this.listeners.forEach((function(e){return e.onAppReady&&e.onAppReady(t)}))},t.prototype.onAppParameterUpdate=function(t,e){this.listeners.forEach((function(r){return r.onAppParameterUpdate&&r.onAppParameterUpdate(t,e)}))},t.prototype.onAppMediaChange=function(t,e){this.listeners.forEach((function(r){return r.onAppMediaChange&&r.onAppMediaChange(t,e)}))},t.prototype.onTemplateUpdate=function(t){this.listeners.forEach((function(e){return e.onTemplateUpdate&&e.onTemplateUpdate(t)}))},t.prototype.onTemplateCommit=function(t){this.listeners.forEach((function(e){return e.onTemplateCommit&&e.onTemplateCommit(t)}))},t.prototype.onTemplatesLoad=function(t,e){this.listeners.forEach((function(r){return r.onTemplatesLoad&&r.onTemplatesLoad(t,e)}))},t.prototype.onFontsLoad=function(t,e){this.listeners.forEach((function(r){return r.onFontsLoad&&r.onFontsLoad(t,e)}))},t.prototype.onVideoReady=function(t){this.listeners.forEach((function(e){return e.onVideoReady&&e.onVideoReady(t)}))},t.prototype.onTimerReady=function(t){this.listeners.forEach((function(e){return e.onTimerReady&&e.onTimerReady(t)}))},t.prototype.onStageElementSet=function(t){this.listeners.forEach((function(e){return e.onStageElementSet&&e.onStageElementSet(t)}))},t.prototype.onMediaElementSet=function(t){this.listeners.forEach((function(e){return e.onMediaElementSet&&e.onMediaElementSet(t)}))},t.prototype.onTimeUpdate=function(t){var e=this;this.listeners.forEach((function(e){return e.onTimeUpdate&&e.onTimeUpdate(t)})),this.position=t,this.throttledTimeUpdate||(this.throttledTimeUpdate=new Promise((function(t,r){setTimeout((function(){e.onThrottledTimeUpdate(e.position),e.throttledTimeUpdate=null,t()}),e.throttleInterval)})))},t.prototype.onThrottledTimeUpdate=function(t){this.listeners.forEach((function(e){return e.onThrottledTimeUpdate&&e.onThrottledTimeUpdate(t)}))},t.prototype.onBackgroundGraphicsUpdate=function(t){this.listeners.forEach((function(e){return e.onBackgroundGraphicsUpdate&&e.onBackgroundGraphicsUpdate(t)}))},t.prototype.onMediaSeek=function(t){this.listeners.forEach((function(e){return e.onMediaSeek&&e.onMediaSeek(t)}))},t.prototype.onVideoSeekStart=function(){this.listeners.forEach((function(t){return t.onVideoSeekStart&&t.onVideoSeekStart()}))},t.prototype.onVideoSeekEnd=function(){this.listeners.forEach((function(t){return t.onVideoSeekEnd&&t.onVideoSeekEnd()}))},t.prototype.onVideoSeek=function(t){this.listeners.forEach((function(e){return e.onVideoSeek&&e.onVideoSeek(t)}))},t.prototype.onPlay=function(){this.listeners.forEach((function(t){return t.onPlay&&t.onPlay()}))},t.prototype.onPause=function(){this.listeners.forEach((function(t){return t.onPause&&t.onPause()}))},t.prototype.onSeek=function(t){this.listeners.forEach((function(e){return e.onSeek&&e.onSeek(t)}))},t.prototype.onSeekComplete=function(t){this.listeners.forEach((function(e){return e.onSeekComplete&&e.onSeekComplete(t)}))},t.prototype.onStop=function(){this.listeners.forEach((function(t){return t.onStop&&t.onStop()}))},t.prototype.onDispose=function(){this.listeners.forEach((function(t){return t.onDispose&&t.onDispose()}))},t.prototype.onResize=function(t){this.listeners.forEach((function(e){return e.onResize&&e.onResize(t)}))},t.prototype.onVolumeUpdate=function(t){this.listeners.forEach((function(e){return e.onVolumeUpdate&&e.onVolumeUpdate(t)}))},t.prototype.addListener=function(t){!t||this.listeners.indexOf(t)>=0||this.listeners.push(t)},t.prototype.removeListener=function(t){var e=!1;return this.listeners=this.listeners.filter((function(r){var n=r===t;return e=e||n,!n})),e},t}(),Sn=function(){function t(t,e,r){var n=this;this.player=t,this.manager=e,this.emitter=r,this._defaultBackgroundCss=null,this._background=null,t.addListener({onStageElementSet:function(t){return n.doUpdateBackground(n.background)}})}return Object.defineProperty(t.prototype,"background",{get:function(){return this._background},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultBackgroundCss",{get:function(){return this._defaultBackgroundCss?this._defaultBackgroundCss:""},set:function(t){this._defaultBackgroundCss=t,this.updateBackground(this._background)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return null!==this._background},enumerable:!1,configurable:!0}),t.prototype.settingBackground=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){switch(e.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,e.sent()&&this.doUpdateBackground(t)]}}))}))},t.prototype.setBackground=function(t){return yn(this,0,void 0,(function(){var e;return gn(this,(function(r){switch(r.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,(e=r.sent())&&this.updateBackground(e)]}}))}))},t.prototype.doSetBackground=function(t){return yn(this,0,void 0,(function(){var e,r,n;return gn(this,(function(i){switch(i.label){case 0:return e=t&&t.originalUrl?t.originalUrl:"",this.manager.isBackgroundColorAsset(t)?[2,{css:e,originalUrl:e}]:this.manager.isBackgroundPiaproImageAsset(t)?[4,this.manager.read(e)]:[3,2];case 1:return(r=i.sent())&&r.url&&this.manager.checkBackgroundImageLicense(r.license)?(r.originalUrl=e,t&&(r.x=t.x,r.y=t.y),[2,r]):[2,{css:"",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,license:r?r.license:void 0}];case 2:return this.manager.isBackgroundSpecialImageAsset(t)?[2,{css:'url("https://api.textalive.jp/images/backgrounds/snowmiku2016/'+(n=/^snowmiku2016-([0-9]{2})$/.exec(e))[1]+'.jpg")',contentUrl:"https://api.textalive.jp/images/backgrounds/snowmiku2016/"+n[1]+".jpg",url:"https://snowmiku.com/2016/info_chara.html",name:"SNOW MIKU 2016",authorName:"豆の素",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,defaultY:0}]:[2,{originalUrl:null,css:"",x:t?t.x:void 0,y:t?t.y:void 0}]}}))}))},t.prototype.updateBackground=function(t){return!!this.doUpdateBackground(t)&&(this.emitter&&this.emitter.onBackgroundGraphicsUpdate&&this.emitter.onBackgroundGraphicsUpdate(t),!0)},t.prototype.doUpdateBackground=function(t){if(!t)return!1;if(!this.player.stageElement)return this._background=t,!0;var e=this.player.stageElement.style;return t.css.length<=0?e.background=this.defaultBackgroundCss:e.background=t.css,"number"==typeof t.x||this._background&&"number"==typeof this._background.x?("number"!=typeof t.x&&(t.x=this._background.x),e.backgroundPositionX=e.backgroundPositionX+"%"):e.backgroundPositionX="number"==typeof t.defaultX?t.defaultX+"%":"center","number"==typeof t.y||this._background&&"number"==typeof this._background.y?("number"!=typeof t.y&&(t.y=this._background.y),e.backgroundPositionY=e.backgroundPositionY+"%"):e.backgroundPositionY="number"==typeof t.defaultY?t.defaultY+"%":"center",e.backgroundSize="cover",this._background=t,!0},t.prototype.export=function(){if(!this.background||!this.background.originalUrl)return null;var t={originalUrl:this.background.originalUrl};return void 0!==this.background.x&&(t.x=this.background.x),void 0!==this.background.y&&(t.y=this.background.y),t},t.prototype.exportPartialVideoEntry=function(t){return{background:this.export()}},t}();function Tn(t,e,r){return yn(this,0,void 0,(function(){var n,i,o,s,a,u,c,l,p,h,d,f,y,g;return gn(this,(function(v){switch(v.label){case 0:if(n={loaded:[],failed:[]},"undefined"==typeof window||!window.document||!window.document.head)return n.failed=t.slice(),[2,n];for(i=r.split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort(),o=!0,s=0,i.forEach((function(t){var r=e.indexOf(t,s);o=o&&r>=0,s=r})),a=window.document.head,u=[],c=0;c0&&(f.google={families:d}),h.length>0&&(f.custom={families:h,urls:p}),!f.google&&!f.custom)return[3,6];v.label=1;case 1:return v.trys.push([1,5,,6]),(g="undefined"!=typeof window&&(null===window||void 0===window?void 0:window.WebFont))?[3,3]:[4,import("webfontloader")];case 2:g=v.sent(),v.label=3;case 3:return y=g,[4,new Promise((function(t){f.active=f.inactive=t,y.load(f)}))];case 4:case 5:return v.sent(),[3,6];case 6:return[2,n]}}))}))}function xn(t,e){return yn(this,0,void 0,(function(){var r,n,i,o,s,a,u;return gn(this,(function(c){switch(c.label){case 0:if(r={loaded:[],failed:[]},!("undefined"!=typeof window&&window.document&&window.document.head&&window.Ts&&window.Ts.loadFontAsync))return r.failed=t.slice(),[2,r];for(n=window.document.head,i={},o=function(t){var e=n.children.item(t);if("style"!==e.tagName.toLowerCase()||"text/css"!==e.getAttribute("type")||"stylesheet"!==e.getAttribute("rel")||!e.hasAttribute("data-cssName"))return"continue";var r=e.getAttribute("data-cssName");if(void 0===i[r])return i[r]=new Set(e.getAttribute("data-text")),"continue";e.getAttribute("data-text").split("").forEach((function(t){return i[r].add(t)}))},s=0;s=0})))]}}))}))},t.prototype.listFontFamiliesInVideo=function(t){if(!t||!t.phrases)return null;var e=[];return t.phrases.forEach((function(t){return t.words.forEach((function(t){return t.characters.forEach((function(t){return e.push(t.fontFamily)}))}))})),e.filter((function(t,e,r){return r.indexOf(t)===e}))},t.prototype.listAvailableFonts=function(){return yn(this,0,void 0,(function(){return gn(this,(function(t){return[2,this.fontInfoManager.listAvailableFonts()]}))}))},t.prototype.isLoading=function(){return!!this.queue},t.prototype.load=function(t){return yn(this,0,void 0,(function(){var e,r;return gn(this,(function(n){switch(n.label){case 0:return e=[],r=[],t.forEach((function(t){"string"==typeof t?e.push(t):r.push(t)})),[4,this.fontInfoManager.listAvailableFonts()];case 1:return n.sent().forEach((function(t){e.indexOf(t.key)>=0&&r.push(t)})),[2,this.loadFonts(r)]}}))}))},t.prototype.loadFonts=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return this.queue?(this.listener&&this.listener.onFontsLoad&&this.listener.onFontsLoad(null,new An("Failed to load some fonts because there is an ongoing font loding process",this.failed.slice())),[2,this.loaded]):(this.queue=this.doLoad(t).then((function(t){return e.queue=null,t})),[2,this.queue])}))}))},t.prototype.doLoad=function(t){return yn(this,0,void 0,(function(){var e,r,n,i,o=this;return gn(this,(function(s){switch(s.label){case 0:return e=[],r=[],[4,this.fontInfoManager.getFrequentChars()];case 1:return n=s.sent(),t.forEach((function(t){t.typesquare||t.typekit||e.push(t),t.typesquare&&r.push(t)})),i=(this.textFetcher&&this.textFetcher()||"").split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort().join(""),[2,Promise.all([Tn(e,n,i),xn(r,i)]).then((function(t){var e=t[0],r=t[1],n=e.loaded.concat(r.loaded);if(o.addLoadedFonts(n),e.failed.length>0||r.failed.length>0){var i=e.failed.concat(r.failed);o.addFailedFonts(i),o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new An("Failed to load some fonts",o.failed.slice()))}else o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(n);return o.loaded})).catch((function(t){return o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new An(t,o.failed.slice())),o.loaded}))]}}))}))},t.prototype.addLoadedFonts=function(t){var e=this;this._loaded=this.loaded.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t.prototype.addFailedFonts=function(t){var e=this;this._failed=this.failed.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t}(),Cn=function(){function t(){}return Object.defineProperty(t.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){if("object"==typeof t)return this.overlaps(t.startTime,t.endTime);var r=t;return this.contains(r)||this.contains(e)||this.startTime<=r&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?this.startTime===this.endTime?0:(t-this.startTime)/(this.endTime-this.startTime):-1},t}(),Nn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.next?this.next.startTime:this.startTime},enumerable:!1,configurable:!0}),e}(Cn),kn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),e}(Cn),jn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),e}(Cn),In=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),e}(Cn),Un=function(){function t(t){var e=t.analysis,r=t.info;this.beats=[],this.chords=[],this.segments=[],this.voice=[],this._revisions={beatId:(null==r?void 0:r.beatRevisionId)||-1,chordId:(null==r?void 0:r.chordRevisionId)||-1,repetitiveSegmentId:(null==r?void 0:r.chorusRevisionId)||-1},this.parseBeats(null==e?void 0:e.beats),this.parseSegments(null==e?void 0:e.repetitive_segment),this.parseChords(null==e?void 0:e.chords),this.parseVoice(e.voice)}return Object.defineProperty(t.prototype,"revisions",{get:function(){return this._revisions},enumerable:!1,configurable:!0}),t.prototype.parseBeats=function(t){var e=this;if(this.beats.splice(0,this.beats.length),Array.isArray(t)&&Array.isArray(t[0])){var r=null,n=0;t[0].forEach((function(t){var i=new Nn;i.startTime=1e3*t[0],i.length=t[2],i.position=t[3],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.beats.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseChords=function(t){var e=this;if(this.chords.splice(0,this.chords.length),Array.isArray(t)){var r=null,n=0;t.forEach((function(t){var i=new kn;i.startTime=1e3*t[0],i.endTime=1e3*t[1],i.name=t[2],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.chords.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseSegments=function(t){var e=this;this.segments.splice(0,this.segments.length),Array.isArray(t)&&t.forEach((function(t){var r={chorus:!!t.chorus,duration:10*t.segment_length,segments:null},n=null,i=0;r.segments=t.start_frames.map((function(t){var e=new jn;return e.startTime=10*t,e.endTime=e.startTime+r.duration,e.previous=n,null!==n&&(n.next=e),e.index=i++,n=e,e})),null!==n&&(n.next=null),e.segments.push(r)}))},t.prototype.parseVoice=function(t){var e=this;this.voice.splice(0,this.voice.length),Array.isArray(t)&&t.forEach((function(t){var r=[],n=null,i=0,o=0;t.forEach((function(t){var e=new In;e.startTime=o,e.endTime=e.startTime+10*t[1],e.f0=t[0][0],e.initialF0=t[0][1],e.previous=n,null!==n&&(n.next=e),e.index=i++,r.push(e),n=e,o=e.endTime})),null!==n&&(n.next=null),e.voice.push(r)}))},t}(),Fn=function(){function t(t){var e=t.song,r=t.analysis,n=t.vocalAmplitude,i=t.maxVocalAmplitude,o=t.valenceArousal;this._song=e,this._analysis=r,this._vocalAmplitude=n,this._maxVocalAmplitude=i,this._valenceArousal=o}return Object.defineProperty(t.prototype,"song",{get:function(){return this._song},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"analysis",{get:function(){return this._analysis},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vocalAmplitude",{get:function(){return this._vocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxVocalAmplitude",{get:function(){return this._maxVocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valenceArousal",{get:function(){return this._valenceArousal},enumerable:!1,configurable:!0}),t.prototype.getChoruses=function(){var t;if(!this._analysis)return[];var e=this._analysis.segments.filter((function(t){return t.chorus}));return e.length<=0?[]:(null===(t=e[0].segments)||void 0===t?void 0:t.slice())||[]},t.prototype.findChorus=function(t,e){return st(this.getChoruses(),t,e)},t.prototype.findChorusBetween=function(t,e){return this.findChorus(t,{endTime:e})},t.prototype.findChorusChange=function(t,e){return at(this.getChoruses(),t,e)},t.prototype.getBeats=function(){var t,e;return(null===(e=null===(t=this._analysis)||void 0===t?void 0:t.beats)||void 0===e?void 0:e.slice())||[]},t.prototype.findBeat=function(t,e){return st(this.getBeats(),t,e)},t.prototype.findBeatChange=function(t,e){return at(this.getBeats(),t,e)},t.prototype.getChords=function(){var t,e;return(null===(e=null===(t=this._analysis)||void 0===t?void 0:t.chords)||void 0===e?void 0:e.slice())||[]},t.prototype.findChord=function(t,e){return st(this.getChords(),t,e)},t.prototype.findChordChange=function(t,e){return at(this.getChords(),t,e)},t.prototype.getVocalFrequency=function(t){var e;if(!Array.isArray(null===(e=this._analysis)||void 0===e?void 0:e.voice))return-1;var n=this._analysis.voice[0];if(n.length<=0)return-1;var i=r.sortedIndex(n,t,(function(t){return t.endTime}));return n[i].contains(t)?n[i].f0:-1},t.prototype.getVocalAmplitude=function(t){var e=this._vocalAmplitude,r=Math.round(t/10);return!Array.isArray(this._vocalAmplitude)||r<0||r>=e.length?-1:this._vocalAmplitude[r]},t.prototype.getMaxVocalAmplitude=function(){return"number"==typeof this._maxVocalAmplitude?this._maxVocalAmplitude:-1},t.prototype.getValenceArousal=function(t){var e=this._valenceArousal;if(!e)return null;var n=r.sortedIndex(e.seq,t,(function(t){return 1e3*t.t[1]}));if(n<0)return{a:e.seq[0].a,v:e.seq[0].v};if(n+1>=e.seq.length||t<1e3*e.seq[n+1].t[0])return{a:e.seq[Math.min(n,e.seq.length-1)].a,v:e.seq[Math.min(n,e.seq.length-1)].v};var i=e.seq[n],o=e.seq[n+1],s=t/1e3,a=o.t[0],u=i.t[1],c=u-a;return{a:(i.a*(u-s)+o.a*(s-a))/c,v:(i.v*(u-s)+o.v*(s-a))/c}},t.prototype.getMedianValenceArousal=function(){var t=this._valenceArousal;return t?t.stats.median:null},t}(),Ln=function(){function t(t,e,r){this.songManager=t,this.options=r,this.listener=e}return Object.defineProperty(t.prototype,"song",{get:function(){return this._song},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"analysis",{get:function(){return this._analysis},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vocalAmplitude",{get:function(){return this._vocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxVocalAmplitude",{get:function(){return this._maxVocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valenceArousal",{get:function(){return this._valenceArousal},enumerable:!1,configurable:!0}),t.prototype.loadSong=function(t,e){var r,n,i;return yn(this,0,void 0,(function(){var o,s;return gn(this,(function(a){switch(a.label){case 0:return"number"==typeof t&&t<0||!t?(this.onSongLoad(null,new Error("Neither Songle ID or code provided")),[2,null]):[4,this.songManager.load("number"==typeof t?{id:t}:{code:t})];case 1:return o=a.sent(),this.onSongLoad(o,o?void 0:new Error("Song data not found")),o?(s={chord:null==e?void 0:e.chordId,beat:null==e?void 0:e.beatId,chorus:null==e?void 0:e.repetitiveSegmentId},[4,Promise.all([(null===(r=this.options)||void 0===r?void 0:r.vocalFrequencyEnabled)?this.loadSongDetailInfo(o.song.code,{revisions:s}):this.loadSongInfo(o.song.code,{revisions:s}),(null===(n=this.options)||void 0===n?void 0:n.vocalAmplitudeEnabled)?this.loadVocalAmplitude(o.song.code):Promise.resolve(null),(null===(i=this.options)||void 0===i?void 0:i.valenceArousalEnabled)?this.loadValenceArousal(o.song.code):Promise.resolve(null)])]):[2,null];case 2:return a.sent(),[2,new Fn(this)]}}))}))},t.prototype.onSongLoad=function(t,e){this._song=t,this.listener&&this.listener.onSongLoad&&this.listener.onSongLoad(t,e)},t.prototype.loadSongInfo=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.loadSongDetailInfo=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadDetailInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.mockSongInfo=function(t){var e=function(t){for(var e=t.beat,r=t.chorusSegment,n=t.duration,i=[],o=0;60*o/e.bpm=0,r=this.managers.lyrics.fetchLyricBody(n||t.url,{parserPath:t.parser_path,directAccess:i}),[4,e?Promise.race([r,new Promise((function(t,e){return setTimeout((function(){return e(new Error("Fetching lyrics text timeout"))}),o.options.lyricsFetchTimeout)}))]):r];case 1:return[2,s.sent()]}}))}))},t.prototype.onLyricsLoad=function(t,e){this.listener&&this.listener.onLyricsLoad&&this.listener.onLyricsLoad(t,e)},t.prototype.onTextLoad=function(t,e){this.listener&&this.listener.onTextLoad&&this.listener.onTextLoad(t,e)},t}(),Mn=function(){function t(t){var e=t.video;this._video=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._video.json},enumerable:!1,configurable:!0}),t}(),Bn=function(){function t(t,e){this.managers=t,this.listener=e,this.listener=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),t.prototype.onVideoLoad=function(t,e){var r=t?Object.assign(t,e):null;return r&&("string"==typeof r.json?r.json=JSON.parse(r.json):"object"==typeof r.json&&null!==r.json||(r.json={}),"string"==typeof r.config?r.config=JSON.parse(r.config):"object"==typeof r.config&&null!==r.config||(r.config={})),this._video=r,this.listener&&this.listener.onVideoLoad&&this.listener.onVideoLoad(r),new Mn({video:r})},t.prototype.createFromVideoId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.video.load(t)];case 1:return r=n.sent(),[2,this.onVideoLoad(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return this.onVideoLoad(t,e)},t.prototype.createFromSongUrl=function(t,e){return yn(this,0,void 0,(function(){return gn(this,(function(r){return[2,this.createFromSongPath(this.managers.song.getSongPathFromUrl(t),e)]}))}))},t.prototype.createFromSongPath=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({songPath:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({id:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongCode=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({code:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSong=function(t,e){var r;return yn(this,0,void 0,(function(){var n,i,o,s,a,u;return gn(this,(function(c){switch(c.label){case 0:return n=null==e?void 0:e.lyricId,i=null==e?void 0:e.lyricDiffId,"number"!=typeof n||n<0?[4,this.managers.lyrics.load(t.code)]:[3,4];case 1:return o=c.sent(),(a=o&&!o.status.failed&&!o.status.processing&&Array.isArray(o.lyrics)&&o.lyrics.length>0)?[4,this.managers.lyrics.loadDetail(t.code,o.lyrics[0].id)]:[3,3];case 2:a=c.sent(),c.label=3;case 3:(s=a)&&(n=s.id,i=null===(r=s.diff)||void 0===r?void 0:r.id),c.label=4;case 4:return"number"!=typeof n&&(n=-1),"number"!=typeof i&&(i=-1),u={id:-1,sourceId:-1,sourceOriginId:-1,songleId:t.id,songleCode:t.code,lyricId:n,lyricDiffId:i,title:null,log:null,background:null,config:null,json:null,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null},[2,this.onVideoLoad(u,e)]}}))}))},t.prototype.createFromText=function(t,e){return yn(this,0,void 0,(function(){var r,n,i,o,s,a;return gn(this,(function(u){switch(u.label){case 0:return[4,this.managers.text.parse(t)];case 1:return r=u.sent(),n=r&&"success"===r.status?this.createVideoDataFromParsedText(r,t):this.createVideoDataFromText(t),i=n[n.length-1],o=i&&i.words[i.words.length-1],s=o&&o.characters[o.characters.length-1],a=s?s.endTime:0,[2,this.createFromJSON({phrases:n,startTime:0,endTime:a,duration:a},e)]}}))}))},t.prototype.createFromJSON=function(t,e){var r={id:-1,sourceId:-1,sourceOriginId:-1,songleId:-1,lyricId:-1,lyricDiffId:-1,title:null,log:null,background:null,config:null,json:t,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null};return this.onVideoLoad(r,e)},t.prototype.createVideoDataFromParsedText=function(t,e){var r=0,n=e.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/);return t.result.map((function(t,e){return{words:t.map((function(t){return{characters:n[e].substr(t.startPosition,t.wordLength).split("").map((function(t){return{char:t,startTime:300*r,endTime:300*++r}})),pos:t.PoS,rawPoS:t.rawPoS,language:t.language}})),templates:[{type:"DefaultAlignment"}]}}))},t.prototype.createVideoDataFromText=function(t){for(var e,r={characters:[]},n={words:[r],templates:[{type:"DefaultAlignment"}]},i=0,o=[n],s=0;s=0?[4,this.fontLoader.loadForVideo(null===(t=this.videoProvider)||void 0===t?void 0:t.data)]:[3,2];case 1:case 3:case 5:return n.sent(),[2];case 2:return Array.isArray(null===(e=this.options)||void 0===e?void 0:e.fontFamilies)?[4,this.fontLoader.load(this.options.fontFamilies)]:[3,4];case 4:return null!==(null===(r=this.options)||void 0===r?void 0:r.fontFamilies)?[3,6]:[4,this.fontLoader.loadAll()];case 6:return[2]}}))}))},t.prototype.importLyrics=function(){var t=this.text.replace(/[\s\r\n]/g,""),e=0,r={phrases:this.lyrics.data.map((function(r){return{words:r.map((function(r){return{characters:r.map((function(r){return{char:t.charAt(e++),startTime:1e3*r.start_time,endTime:1e3*r.end_time}}))}}))}}))};this.video.json&&Array.isArray(this.video.json.phrases)?this.video.json.phrases.forEach((function(t,e){t.words.forEach((function(t,n){t.characters.forEach((function(t,i){var o=r.phrases[e].words[n].characters[i];t.char=o.char,t.startTime=o.startTime,t.endTime=o.endTime}))}))})):this.video.json=r},t.prototype.getChoruses=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChoruses()},t.prototype.findChorus=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorusBetween(t,e)},t.prototype.findChorusChange=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorusChange(t,e)},t.prototype.getBeats=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getBeats()},t.prototype.findBeat=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findBeat(t,e)},t.prototype.findBeatChange=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findBeatChange(t,e)},t.prototype.getChords=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChords()},t.prototype.findChord=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChord(t,e)},t.prototype.findChordChange=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChordChange(t,e)},t.prototype.getVocalFrequency=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMedianValenceArousal()},t}(),Gn=function(){function t(t,e){this.player=t,this.listener=e,this.initialize()}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?fn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"author",{get:function(){return this._author},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"server",{get:function(){return this._server},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"managed",{get:function(){return!!this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songUrl",{get:function(){return this._songUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songOptions",{get:function(){return this._songOptions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parameters",{get:function(){return this._parameters},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isConnecting",{get:function(){return!!this.connecting},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t,e,r,n;return yn(this,0,void 0,(function(){return gn(this,(function(i){switch(i.label){case 0:return this._options=null===(e=null===(t=this.player)||void 0===t?void 0:t.options)||void 0===e?void 0:e.app,this._options&&(this._options=fn({},this._options),this._name=null===(r=this._options)||void 0===r?void 0:r.appName,this._author=null===(n=this._options)||void 0===n?void 0:n.appAuthor,this._options.token&&(m.textalive.appToken=this._options.token)),this._parameters={},this.parseQueryString(),this.initializeServerConnection(),"undefined"!=typeof window&&this._options?[4,this.connect()]:[3,2];case 1:i.sent(),this.initializePlayerListener(),this.initializeMessageListener(),i.label=2;case 2:return this._songUrl&&this.createFromSongUrl(),[2]}}))}))},t.prototype.initializeServerConnection=function(){var t,e,r,n,i,o;return yn(this,0,void 0,(function(){var s,a,u,c,l;return gn(this,(function(p){switch(p.label){case 0:return[4,A.getServerStatus()];case 1:return s=p.sent(),a="ja"===(null==s?void 0:s.lang),m.textalive.appToken&&(null==s?void 0:s.app)&&(s.app.data&&(this._name=null===(t=s.app.data)||void 0===t?void 0:t.name,this._author=null===(r=null===(e=s.app)||void 0===e?void 0:e.data)||void 0===r?void 0:r.author,u=null===(i=null===(n=s.app)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status,this._status="number"==typeof u?u:-1),this._server={version:s.version,message:s.app.message,error:s.app.error},!this._server.error)?(c=this._server.message?"\n".concat(this._server.message):"",a?console.info("[TextAlive API] クライアント v".concat(m.client.version," でサーバ v").concat(this._server.version||"0.0.0"," に接続").concat(c)):console.info("[TextAlive API] App API client v".concat(m.client.version," connected to server v").concat(this._server.version||"0.0.0").concat(c)),this.listener.onAppLoad(this),[2]):(l=(null===(o=this._server)||void 0===o?void 0:o.error)?"\n".concat(this._server.error):"",a?console.warn("[TextAlive API] このアプリはトークンが正しく指定されていないため動作しません。 https://developer.textalive.jp からトークンを入手して指定してください。".concat(l)):console.warn("[TextAlive API] This app requires a valid app token to run properly. You could get a token from https://developer.textalive.jp. ".concat(l)),this.listener.onAppLoad(null,l),[2])}}))}))},t.prototype.initializePlayerListener=function(){var t=this;this.playerListener={onVideoReady:function(e){t._host&&window.parent.postMessage({kind:"ta_video",options:{lyrics:!!t.player.data.lyrics,duration:t.player.video.duration}},"*")},onThrottledTimeUpdate:function(e){t._host&&window.parent.postMessage({kind:"ta_position",options:{position:e}},"*")},onPlay:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"play"}},"*")},onPause:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"pause"}},"*")},onStop:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"stop"}},"*")},onVolumeUpdate:function(e){t._host&&window.parent.postMessage({kind:"ta_volume",options:{volume:e}},"*")},onDispose:function(){t.dispose()}},this.player.addListener(this.playerListener)},t.prototype.initializeMessageListener=function(){var t=this;this.messageListener=function(e){if(e.data.kind&&/^ta_/.test(e.data.kind)){var r=t.player;switch(e.data.kind.substring(3)){case"status":switch(e.data.options.status){case"play":r.requestPlay();break;case"pause":r.requestPause();break;case"stop":r.requestStop()}break;case"seek":r.requestMediaSeek(e.data.options.position);break;case"volume":r.volume=e.data.options.volume;break;case"parameter":var n=e.data.options,i=n.name,o=n.value;t.parameters[i]=o,t.listener.onAppParameterUpdate(i,o);break;case"media":t._songUrl=e.data.options.url,t._songOptions=e.data.options.options||{},r.requestStop();var s=t.createFromSongUrl();t.listener.onAppMediaChange(t._songUrl,s)}}},window.addEventListener("message",this.messageListener)},t.prototype.createFromSongUrl=function(){var t,e=this._songOptions;return e&&(t={video:{}},e.altLyricsUrl&&(t.altLyricsUrl=e.altLyricsUrl),e.lyricsDirectAccess&&(t.lyricsDirectAccess=e.lyricsDirectAccess),e.lyricId&&(t.video.lyricId=e.lyricId),e.lyricDiffId&&(t.video.lyricDiffId=e.lyricDiffId),e.chordId&&(t.video.chordId=e.chordId),e.beatId&&(t.video.beatId=e.beatId),e.repetitiveSegmentId&&(t.video.repetitiveSegmentId=e.repetitiveSegmentId)),this.player.createFromSongUrl(this._songUrl,t)},t.prototype.parseQueryString=function(){var t=pn("ta_app_token");t&&(m.textalive.appToken=t),this._songUrl=pn("ta_song_url"),this._songOptions={};var e=pn("ta_lyric_id");e&&(this._songOptions.lyricId=parseInt(e),isNaN(this._songOptions.lyricId)&&delete this._songOptions.lyricId);var r=pn("ta_lyric_diff_id");r&&(this._songOptions.lyricDiffId=parseInt(r),isNaN(this._songOptions.lyricDiffId)&&delete this._songOptions.lyricDiffId);var n=pn("ta_alt_lyrics_url");n&&(this._songOptions.altLyricsUrl=n);var i=pn("ta_lyrics_direct_access");i&&(this._songOptions.lyricsDirectAccess="true"===i,this._songOptions.lyricsDirectAccess||delete this._songOptions.lyricsDirectAccess);var o=pn("ta_chord_id");o&&(this._songOptions.chordId=parseInt(o),isNaN(this._songOptions.chordId)&&delete this._songOptions.chordId);var s=pn("ta_beat_id");s&&(this._songOptions.beatId=parseInt(s),isNaN(this._songOptions.beatId)&&delete this._songOptions.beatId);var a=pn("ta_repetitive_segment_id");a&&(this._songOptions.repetitiveSegmentId=parseInt(a),isNaN(this._songOptions.repetitiveSegmentId)&&delete this._songOptions.repetitiveSegmentId)},t.prototype.connect=function(){return yn(this,0,void 0,(function(){var t,e=this;return gn(this,(function(r){switch(r.label){case 0:return this.connecting?[2,this.connecting]:"undefined"!=typeof window&&this.options&&window.parent&&window!==window.parent?[3,2]:[4,new Promise((function(t){return setTimeout(t,1)}))];case 1:return r.sent(),this.listener.onAppReady(this),[2,!1];case 2:return this.connecting=Promise.race([new Promise((function(r){t=function(n){n.data.kind&&/^ta_/.test(n.data.kind)&&"ack"===n.data.kind.substring(3)&&(window.removeEventListener("message",t),e._host=n.data.options,r(!0))},window.addEventListener("message",t)})),yn(e,0,void 0,(function(){var e;return gn(this,(function(r){switch(r.label){case 0:e=0,r.label=1;case 1:return e<5?(window.parent.postMessage({kind:"ta_connect",options:this.options},"*"),[4,new Promise((function(t){return setTimeout(t,200)}))]):[3,4];case 2:if(r.sent(),this._host)return[3,4];r.label=3;case 3:return e++,[3,1];case 4:return!this._host&&t&&window.removeEventListener("message",t),[2,!!this._host]}}))}))]),this.connecting.finally((function(){e.connecting=null,e.listener.onAppReady(e)})),[2,this.connecting]}}))}))},t.prototype.dispose=function(){"undefined"!=typeof window&&this.options&&(this.player.removeListener(this.playerListener),window.removeEventListener("message",this.messageListener)),this._host=null,this.player=null},t}();function qn(t){return t}function Wn(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0==t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}function Yn(t){return function(e){return Math.pow(e,t)}}function zn(t){return function(e){return 1-Math.pow(1-e,t)}}function Jn(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}var Hn=Yn(2),Xn=zn(2),Zn=Jn(2),$n=Yn(3),Kn=zn(3),Qn=Jn(3),ti=Yn(4),ei=zn(4),ri=Jn(4),ni=Yn(5),ii=zn(5),oi=Jn(5);function si(t){return 1-Math.cos(t*Math.PI/2)}function ai(t){return Math.sin(t*Math.PI/2)}function ui(t){return-.5*(Math.cos(Math.PI*t)-1)}function ci(t){return function(e){return e*e*((t+1)*e-t)}}var li=ci(1.7);function pi(t){return function(e){return--e*e*((t+1)*e+t)+1}}var hi=pi(1.7);function di(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}var fi=di(1.7);function yi(t){return-(Math.sqrt(1-t*t)-1)}function gi(t){return Math.sqrt(1- --t*t)}function vi(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function mi(t){return 1-bi(1-t)}function bi(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function _i(t){return t<.5?.5*mi(2*t):.5*bi(2*t-1)+.5}function wi(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return-t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)}}var Pi=wi(1,.3);function Ei(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return t*Math.pow(2,-10*n)*Math.sin((n-i)*r/e)+1}}var Oi=Ei(1,.3);function Si(t,e){var r=2*Math.PI;return function(n){var i=e/r*Math.asin(1/t);return(n*=2)<1?t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)*-.5:t*Math.pow(2,-10*(n-=1))*Math.sin((n-i)*r/e)*.5+1}}var Ti=Si(1,.3*1.5),xi=Object.freeze({__proto__:null,backIn:li,backInOut:fi,backOut:hi,bounceIn:mi,bounceInOut:_i,bounceOut:bi,circIn:yi,circInOut:vi,circOut:gi,cubicIn:$n,cubicInOut:Qn,cubicOut:Kn,elasticIn:Pi,elasticInOut:Ti,elasticOut:Oi,get:Wn,getBackIn:ci,getBackInOut:di,getBackOut:pi,getElasticIn:wi,getElasticInOut:Si,getElasticOut:Ei,getPowIn:Yn,getPowInOut:Jn,getPowOut:zn,linear:qn,quadIn:Hn,quadInOut:Zn,quadOut:Xn,quartIn:ti,quartInOut:ri,quartOut:ei,quintIn:ni,quintInOut:oi,quintOut:ii,sineIn:si,sineInOut:ui,sineOut:ai}),Ai=function(){function t(){}return t.linear=qn,t.get=Wn,t.getPowIn=Yn,t.getPowOut=zn,t.getPowInOut=Jn,t.quadIn=Hn,t.quadOut=Xn,t.quadInOut=Zn,t.cubicIn=$n,t.cubicOut=Kn,t.cubicInOut=Qn,t.quartIn=ti,t.quartOut=ei,t.quartInOut=ri,t.quintIn=ni,t.quintOut=ii,t.quintInOut=oi,t.sineIn=si,t.sineOut=ai,t.sineInOut=ui,t.getBackIn=ci,t.backIn=li,t.getBackOut=pi,t.backOut=hi,t.getBackInOut=di,t.backInOut=fi,t.circIn=yi,t.circOut=gi,t.circInOut=vi,t.bounceIn=mi,t.bounceOut=bi,t.bounceInOut=_i,t.getElasticIn=wi,t.elasticIn=Pi,t.getElasticOut=Ei,t.elasticOut=Oi,t.getElasticInOut=Si,t.elasticInOut=Ti,t}(),Ri=function(){function t(){this.cursor=-1,this.widgets=[],this.instances=[],this.model={id:-1,type:n.NONE,sourceId:-1,author:null,originalAuthor:null,className:null,createdDate:null}}return Object.defineProperty(t.prototype,"id",{get:function(){return this.model?this.model.id:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"script",{get:function(){return this.model?this.model.script:null},enumerable:!1,configurable:!0}),t}(),Ci=function(){},Ni=function(){function t(t,e){this.onTemplateLoad=e,this._emitter=null,this._loaded=null,this._loading=null,this.verbose=!1,this._emitter=t,this.clear()}return Object.defineProperty(t.prototype,"loaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this._loading},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this._loaded={},this._loading={}},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),yn(this,0,void 0,(function(){var e;return gn(this,(function(r){switch(r.label){case 0:return[4,q.list({maxResults:t,withoutAuthors:!0,withoutOriginalAuthors:!0,script:!0})];case 1:return(e=r.sent())&&e.list?(this.verbose&&console.log("--- loading template classes ---"),[2,this.registerMany(e.list)]):[2]}}))}))},t.prototype.loadForVideo=function(t){return yn(this,0,void 0,(function(){var e,r=this;return gn(this,(function(n){switch(n.label){case 0:return[4,q.loadForVideo(t)];case 1:return(e=n.sent())&&e.list?(this.verbose&&console.log("--- loading template classes for vid:".concat(t," ---")),[4,this.registerMany(e.list)]):[2,null];case 2:return[2,n.sent().map((function(t){return t?r.getByName(t):null}))]}}))}))},t.prototype.loadByNames=function(t){return yn(this,0,void 0,(function(){var e,r=this;return gn(this,(function(n){switch(n.label){case 0:return!Array.isArray(t)||t.length<=0?[2,[]]:(this.verbose&&console.log("--- loading template classes ---"),[4,Promise.all(t.map((function(t){return r.doLoadByName(t)})))]);case 1:return(e=n.sent())&&this._emitter.onTemplatesLoad(e.filter((function(t){return!!t})).map((function(t){return t.className}))),[2,e]}}))}))},t.prototype.loadByName=function(t){return yn(this,0,void 0,(function(){var e,r;return gn(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.doLoadByName(t)];case 1:return e=n.sent(),this._emitter.onTemplatesLoad([e.className]),[2,e];case 2:return r=n.sent(),this._emitter.onTemplatesLoad(null,r),[2,null];case 3:return[2]}}))}))},t.prototype.doLoadByName=function(t){return yn(this,0,void 0,(function(){var e,r,n=this;return gn(this,(function(i){return null!==(e=this.getByName(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return q.loadByName(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.loadById=function(t){return yn(this,0,void 0,(function(){var e,r,n;return gn(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.doLoadById(t)];case 1:return e=i.sent(),r=null,[3,3];case 2:return n=i.sent(),r=n,[3,3];case 3:return this._emitter.onTemplatesLoad(e?[e.className]:null,r),[2,e]}}))}))},t.prototype.doLoadById=function(t){return yn(this,0,void 0,(function(){var e,r,n=this;return gn(this,(function(i){return(e=this.getById(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return q.load(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.registerMany=function(t){return yn(this,0,void 0,(function(){var e,r,n=this;return gn(this,(function(i){switch(i.label){case 0:return e=t.map((function(t){var e=n.onTemplateLoad(t);return n._loading[t.className]=e,n._loading["".concat(t.className,"@").concat(t.id)]=e,e})),[4,Promise.all(e.map((function(t){return t.then((function(t){return t.className})).catch((function(t){return null}))})))];case 1:return r=i.sent().filter((function(t){return!!t})),this._emitter.onTemplatesLoad(r),[2,r]}}))}))},t.prototype.commit=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,q.create({sourceId:t.model.sourceId,script:t.model.script,log:e})];case 1:return(r=n.sent()).success&&(t.model.id=r.id,this._emitter.onTemplateCommit(t.className)),[2,r]}}))}))},t.prototype.getByName=function(t,e){var r;if(void 0===e&&(e=!1),t&&(r=t.match(/(.+)@([0-9]+)/))){t=r[1];var n=parseInt(r[2]);if(!this._loaded[t])return null;var i=this._loaded[t].model;if(i.id!==n){if(!e)return null;this.verbose&&console.log("[warning] template ".concat(t," version ").concat(n," is requested but ").concat(i.id," is used"))}}return this._loaded[t]?this._loaded[t]:null},t.prototype.getById=function(t){var e=null;for(var r in this._loaded)if(this._loaded[r].model.id===t){e=this._loaded[r];break}return e},t}(),ki={Matrix2D:pt,Point:ht,Color:X,Font:Z,RenderingUnit:K,TextUnit:et,Graphic:nt,Phrase:ot,Word:it,Char:rt,Beat:Nn,RepetitiveSegment:jn},ji=["headTime","tailTime","insomnia"],Ii=["animate","getAssignedUnit","name","type"],Ui=function(){function t(t,e,r){this._emitter=null,this._player=null,this.interpreter=null,this.unsafeAcceleration=!1,this._verbose=!1,this.ignoreVersion=!1,this.rawConsole=!1,this._player=t,this._emitter=e,this.unsafeAcceleration=r,this.loader=new Ni(e,this.register.bind(this)),t.addListener({onVideoReady:this.onVideoReady.bind(this)})}return Object.defineProperty(t.prototype,"verbose",{get:function(){return this._verbose},set:function(t){this._verbose=this.loader.verbose=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return!!this.interpreter},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return this.loader.loaded},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t=this;if(!this.ready){var e=function(t){var e=t.player,r=t.ignoredPropNames,i=t.rawConsole,o=t.templateGetter,s=e.graphics.wrapperTable,a=new cn(fn(fn({},ki),s),r,(function(t,r){return e.graphics.isGraphics(t)&&r instanceof X?r.toString():r})),u={require:{func:function(t){if(!(t.length<1||"string"!=typeof t[0])){var e=t[0],r=o(e);return null===r?void 0:r.functionDefinition}},raw:!0,isConstructor:!0},print:{func:function(t){e.isEditing&&console.log.apply(console,t)},raw:i},findChorus:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findChorus(t[0])}},findBeat:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findBeat(t[0])}},getVocalFrequency:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getVocalFrequency(t[0])}},getVocalAmplitude:{func:function(t){return t.length<1||"number"!=typeof t[0]?-1:e.getVocalAmplitude(t[0])}},getMaxVocalAmplitude:{func:function(t){return e.getMaxVocalAmplitude()}},getValenceArousal:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getValenceArousal(t[0])}},getMedianValenceArousal:{func:function(t){return e.getMedianValenceArousal()}}};Object.keys(n).forEach((function(t){a.setProperty(a.globalScope,t,n[t]),u[t]={value:n[t]}})),Object.keys(xi).forEach((function(t){var e=xi[t];0!==t.indexOf("get")&&(u[t]={func:e})}));var c=Object.keys(a.wrapperTable);return c&&c.forEach((function(t){return u[t]={cls:a.wrapperTable[t]}})),Object.keys(u).forEach((function(t){var e=u[t];e.func?a.createGlobalFunction(t,e):e.value&&a.setProperty(a.globalScope,t,e.value)})),{interpreter:a,unsafeGlobalScope:u}}({player:this._player,ignoredPropNames:Ii,rawConsole:this.rawConsole,templateGetter:function(e){return t.getByName(e,!0)}}),r=e.interpreter,i=e.unsafeGlobalScope;this.unsafeGlobalScope=i,this.interpreter=r,this.onVideoReady(this._player.video)}},t.prototype.getByName=function(t,e){return void 0===e&&(e=!1),this.loader.getByName(t,e)},t.prototype.getById=function(t){return this.loader.getById(t)},t.prototype.clear=function(){this.loader.clear()},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadLatest(t)]}))}))},t.prototype.loadForVideo=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadForVideo(t)]}))}))},t.prototype.loadByNames=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByNames(t)]}))}))},t.prototype.loadByName=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByName(t)]}))}))},t.prototype.loadById=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadById(t)]}))}))},t.prototype.commit=function(t,e){return yn(this,0,void 0,(function(){return gn(this,(function(r){return[2,this.loader.commit(t,e)]}))}))},t.prototype.register=function(t){return yn(this,0,void 0,(function(){var e,r,n,i,o,s,a=this;return gn(this,(function(u){switch(u.label){case 0:if(!t)return[2,null];if("number"==typeof t.sourceId){if(e=t,!(r=this.createClass(t.script)))return[2,null]}else r=t;n=nn(r.ast).dependencies,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(n.map((function(t){var e=a.getByName(t,a.ignoreVersion);return e?Promise.resolve(e):a.loadByName(t)})))];case 2:return u.sent(),this.verbose&&console.log("load dependencies for",r.className,n),[3,4];case 3:return i=u.sent(),this.verbose&&console.error("failed loading dependencies for",r.className,i),[3,4];case 4:try{if(!(e?this.loadModel(r,e):this.createModel(r)))throw new Error("failed to create a template instance");return[2,this.registerClass(r)]}catch(t){throw o=void 0,e&&(delete(s=fn({},e)).script,o=s),{error:t.message,stack:t.stack,cause:o}}return[2]}}))}))},t.prototype.updateClassScript=function(t,e){var r=this.createClass(e);return this.updateClass(t,r)},t.prototype.registerClass=function(t){if(!t)return null;if(this.loader.loaded[t.className]){this.verbose&&console.log("updating",t.className,t.model.id);var e=this.updateClass(this.loader.loaded[t.className],t);return this.verbose&&console.log("updated",e.className,e.id),e}return this.loader.loaded[t.className]=t,this.verbose&&console.log("loaded",t.className,t.model.id),t},t.prototype.updateClass=function(t,e){var r=t,n=e;if(!n)return null;if(r.model.script===n.model.script)return this.verbose&&console.log("no diff for",r.className),r;if(!this.createModel(n))return null;if(r.className!==n.className){var i=this.getByName(n.className);if(!i)return n.cursor=r.cursor,this.loader.loaded[n.className]=n,this.verbose&&console.log("create",n.className),n;r=i}return r.newStatement=n.newStatement,r.widgets=n.widgets,r.scope=n.scope,r.functionDefinition=n.functionDefinition,r.newStatement=n.newStatement,r.unsafeConstructorGenerator=n.unsafeConstructorGenerator,r.ast=n.ast,r.cursor<0&&(r.cursor=n.cursor),n.id>=0?(this.verbose&&console.log("replace",n.className,r.id,n.id),r.model=n.model):(this.verbose&&console.log("update",n.className,r.id,n.id),r.model.type=n.model.type,r.model.className=n.model.className,r.model.prettyName=n.model.prettyName,r.model.script=n.model.script,r.model.createdDate=null,r.id>=0&&(r.model.sourceId=r.model.id,r.model.id=-1)),n=r,this.updateInstances(r.instances.slice(),n),this._emitter.onTemplateUpdate(n.className),n},t.prototype.loadModel=function(t,e){var r=this.newRawInstance(t);return t.model=e,this.updateWidgetInitialValues(t,r),r},t.prototype.createModel=function(t){var e=this.newRawInstance(t);if(null===e)return!1;if(t.id>=0)return!0;var r=e.templateInstance,n=t.model.script;return t.model={id:-1,sourceId:-1,className:t.className,prettyName:r?this.interpreter.getProperty(r,"name"):e.unsafeTemplateInstance.name,type:r?this.interpreter.getProperty(r,"type"):e.unsafeTemplateInstance.type,script:n,author:null,originalAuthor:null,createdDate:null},this.updateWidgetInitialValues(t,e),e},t.prototype.updateWidgetInitialValues=function(t,e){var r=this;t.widgets.forEach((function(t){t.initialValue=r.getProperty(e,t.name)}))},t.prototype.updateInstances=function(t,e){var r=this;t.forEach((function(t){try{r.updateInstance(t,e)}catch(r){console.log("failed updating template for",t.assignedUnit,":",e)}})),this._player.isPlaying||this._player.requestStageUpdate()},t.prototype.createClass=function(t){var e=this;this.ready||this.initialize();var r=new Ri;r.model={id:-1,sourceId:-1,className:null,prettyName:null,type:0,script:t,author:null,originalAuthor:null,createdDate:null};var n=rn(t,Ii),i=n.ast,o=n.widgets;if(r.ast=i,r.widgets=o,r.className=r.ast.body[0].id.name,r.scope=this.interpreter.prepareRun(r.ast),this.interpreter.run(1e3,"to define "+r.className),r.functionDefinition=this.interpreter.getRawProperty(r.scope,r.className),r.newStatement=this.interpreter.newStatementFor(r.className),this.unsafeAcceleration){var s=Object.keys(this.unsafeGlobalScope),a=Object.keys(this.getGlobalProperties()).map((function(t){return"".concat(t,"=props.").concat(t)})).join(","),u="return function(props){var ".concat(a,";").concat(t,"return ").concat(r.className,";}"),c=new(Function.bind.apply(Function,vn(vn([void 0],s,!1),[u],!1))),l=function(t){var r=e.getByName(t);return r?r.unsafeConstructorGenerator(e.getGlobalProperties()):null},p=s.map((function(t){if("require"===t)return l;var r=e.unsafeGlobalScope[t];return r.func?function(){for(var t=[],e=0;e8&&(v=v.substring(0,8)),!(t.indexOf(v)<0););l.length>h&&l[h].length>0&&l.splice(h,0,""),l.splice(h,0,"",p+"// @proposed",p+"// @title "+e,p+"// "+function(t,e){if("Slider"===t)return"@ui Slider("+e.min+", "+e.max+")";if("Check"===t)return"@ui Check()";if("Color"===t)return"@ui Color()";var r=e.etc;return"@comment "+(r=r.replace(/(\r\n|[\n\v\f\r\x85\u2028\u2029])/g,"")).replace(/\/[*/]/g,"")}(r,n),p+"this."+v+" = "+function(t,e){return"Slider"===t?((e.min+e.max)/2).toString():"Check"===t?"false":"Color"===t?'new Color("#000000")':"null"}(r,n)+";"),t=l.join(c)}catch(t){}return t}(t.model.script,e,r,n))},t.prototype.onVideoReady=function(t){this.ready&&(this.interpreter.setRawProperty(this.interpreter.globalScope,"width",this._player.resolutionWidth),this.interpreter.setRawProperty(this.interpreter.globalScope,"height",this._player.resolutionHeight),this.interpreter.setRawProperty(this.interpreter.globalScope,"margin",this.interpreter.wrap(this._player.margin)),this.interpreter.setRawProperty(this.interpreter.globalScope,"duration",(null==t?void 0:t.duration)||0))},t}(),Fi='',Li="https://textalive.jp",Di=function(){function t(t){var e,r=this;if(this.player=t,this._position="embed",this._rounded=!1,this._bordered=!1,this._shadowed=!1,this._background="#fff",this._color="#1f4391",void 0!==(null===(e=t.options)||void 0===e?void 0:e.mediaBannerPosition)&&(this._position=t.options.mediaBannerPosition),this.domEnabled){this.logoAnchor=document.createElement("a"),this.logoAnchor.className="textalive-logo",this.logoAnchor.innerHTML=Fi,this.logoAnchor.style.padding=this.bordered?"1px 2px":"1px 3px",this.logoAnchor.href=Li,this.logoAnchor.target="_blank",this.logoAnchor.title="Powered by TextAlive App API",this.logoSvg=this.logoAnchor.querySelector("svg"),this.logoSvg.style.width="24px",this.songNameDiv=document.createElement("div"),this.songNameDiv.className="name",this.songNameDiv.style.fontWeight="bold",this.songNameDiv.style.overflow="hidden",this.songNameDiv.style.textOverflow="ellipsis",this.songNameDiv.style.marginBottom="2px",this.songNameDiv.textContent="-",this.songArtistDiv=document.createElement("div"),this.songArtistDiv.className="artist",this.songArtistDiv.textContent="-",this.songArtistDiv.style.overflow="hidden",this.songArtistDiv.style.textOverflow="ellipsis";var n=document.createElement("span");n.innerHTML='',n.style.padding="0 3px 0 0",this.songSvg=n.querySelector("svg"),this.songSvg.style.width="14px",this.songWrapper=document.createElement("div"),this.songWrapper.style.width="203px",this.songWrapper.style.maxWidth="203px",this.songWrapper.appendChild(this.songNameDiv),this.songWrapper.appendChild(this.songArtistDiv),this.songAnchor=document.createElement("a"),this.songAnchor.className="song",this.songAnchor.target="_blank",this.songAnchor.style.display="flex",this.songAnchor.style.lineHeight="1.2em",this.songAnchor.style.padding="4px 3px 3px 3px",this.songAnchor.style.textDecoration="none",this.songAnchor.appendChild(n),this.songAnchor.appendChild(this.songWrapper),this.lyricsNameDiv=document.createElement("div"),this.lyricsNameDiv.className="name",this.lyricsNameDiv.style.fontWeight="bold",this.lyricsNameDiv.textContent="-",this.lyricsNameDiv.style.overflow="hidden",this.lyricsNameDiv.style.textOverflow="ellipsis",this.lyricsNameDiv.style.marginBottom="2px",this.lyricsArtistDiv=document.createElement("div"),this.lyricsArtistDiv.className="artist",this.lyricsArtistDiv.textContent="-",this.lyricsArtistDiv.style.overflow="hidden",this.lyricsArtistDiv.style.textOverflow="ellipsis";var i=document.createElement("span");i.innerHTML='',i.style.padding="0 3px 0 0",this.lyricsSvg=i.querySelector("svg"),this.lyricsSvg.style.width="14px",this.lyricsWrapper=document.createElement("div"),this.lyricsWrapper.style.width="90px",this.lyricsWrapper.style.maxWidth="90px",this.lyricsWrapper.appendChild(this.lyricsNameDiv),this.lyricsWrapper.appendChild(this.lyricsArtistDiv),this.lyricsAnchor=document.createElement("a"),this.lyricsAnchor.className="lyrics",this.lyricsAnchor.target="_blank",this.lyricsAnchor.style.display="flex",this.lyricsAnchor.style.lineHeight="1.2em",this.lyricsAnchor.style.padding="4px 3px 3px 3px",this.lyricsAnchor.style.textDecoration="none",this.lyricsAnchor.appendChild(i),this.lyricsAnchor.appendChild(this.lyricsWrapper),this.bannerDiv=document.createElement("div"),this.bannerDiv.className="textalive-banner",this.bannerDiv.style.cursor="pointer",this.bannerDiv.style.zIndex="10000",this.bannerDiv.style.background="#1f4391",this.bannerDiv.style.lineHeight="0",this.bannerDiv.style.display="flex",this.bannerDiv.style.maxWidth="256px",this.bannerDiv.style.fontFamily="'Hiragino Kaku Gothic Pro','游ゴシック体','Yu Gothic',YuGothic,Meiryo,HelveticaNeue,'Helvetica Neue',Helvetica,Arial,sans-serif",this.bannerDiv.style.fontSize="9px",this.bannerDiv.style.alignItems="center",this.bannerDiv.style.whiteSpace="nowrap",this.bannerDiv.appendChild(this.logoAnchor),this.bannerDiv.appendChild(this.songAnchor),this.bannerDiv.appendChild(this.lyricsAnchor),this.songAnchor.style.display="none",this.lyricsAnchor.style.display="none",this.updatePosition(),this.updateRounded(),this.updateBordered(),this.updateShadowed(),this.updateBackground(),this.updateColor()}this.listener={onAppReady:function(){r.updatePosition()},onMediaElementSet:function(t){r.domEnabled&&(r.bannerDiv&&r.bannerDiv.parentElement&&r.bannerDiv.parentElement.removeChild(r.bannerDiv),r.player.mediaBannerElement&&r.player.mediaBannerElement.appendChild(r.bannerDiv))},onVideoLoad:function(){r.domEnabled&&(r.logoAnchor.href=Li,r.songAnchor.style.display="none",r.lyricsAnchor.style.display="none",r.songAnchor.style.borderRadius="0")},onSongLoad:function(t){return yn(r,0,void 0,(function(){var e,r,n,i,o,s,a,u,l;return gn(this,(function(p){switch(p.label){case 0:return t?(e=null===(a=null===(s=null==t?void 0:t.song)||void 0===s?void 0:s.artist)||void 0===a?void 0:a.name,r=null===(u=null==t?void 0:t.song)||void 0===u?void 0:u.name,n=null===(l=null==t?void 0:t.song)||void 0===l?void 0:l.permalink,i="".concat(Li).concat(n?"/songs/".concat(encodeURIComponent(c.getSongPathFromUrl(n))):""),this.domEnabled&&(this.logoAnchor.href=i,this.songArtistDiv.textContent=Mi(e),this.songNameDiv.textContent=Mi(r),this.songAnchor.title="".concat(Mi(r)," by ").concat(Mi(e)),this.songAnchor.href=n,this.songAnchor.style.display="flex",this.songAnchor.style.borderRadius=this.rounded?"0 4px 4px 0":"0",this.songWrapper.style.width="auto"),[4,A.getServerStatus()]):[2];case 1:return"ja"===(null==(o=p.sent())?void 0:o.lang)?console.warn("[TextAlive API] 楽曲 アーティスト:",Mi(e),"/ 楽曲名:",Mi(r),"/ 配信元サイト:",Mi(n)):console.warn("[TextAlive API] Song artist:",Mi(e),"/ song name:",Mi(r),"/ distributed at:",Mi(n)),[2]}}))}))},onLyricsLoad:function(t){t&&r.domEnabled&&(r.songWrapper.style.maxWidth="90px",r.lyricsAnchor.style.display="flex",r.songAnchor.style.borderRadius="0")},onTextLoad:function(t){return yn(r,0,void 0,(function(){var e,r,n,i,o;return gn(this,(function(s){switch(s.label){case 0:return t?(e=null===(o=null==t?void 0:t.artist)||void 0===o?void 0:o.name,r=null==t?void 0:t.name,n=null==t?void 0:t.url,this.domEnabled&&(this.lyricsArtistDiv.textContent=Mi(e),this.lyricsNameDiv.textContent=Mi(r),this.lyricsAnchor.title="".concat(Mi(r)," by ").concat(Mi(e)),this.lyricsAnchor.href=n,this.lyricsWrapper.style.width="auto"),[4,A.getServerStatus()]):[2];case 1:return"ja"===(null==(i=s.sent())?void 0:i.lang)?console.warn("[TextAlive API] 歌詞 アーティスト:",Mi(e),"/ 歌詞名:",Mi(r),"/ 配信元サイト:",Mi(n)):console.warn("[TextAlive API] Song lyrics artist:",Mi(e),"/ lyrics name:",Mi(r),"/ distributed at:",Mi(n)),[2]}}))}))},onDispose:function(){r.dispose()}},t.addListener(this.listener),t.mediaBannerElement&&this.player.mediaBannerElement.appendChild(this.bannerDiv)}return Object.defineProperty(t.prototype,"domEnabled",{get:function(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(t){this._position=t,this.updatePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rounded",{get:function(){return this._rounded},set:function(t){this._rounded=t,this.updateRounded()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bordered",{get:function(){return this._bordered},set:function(t){this._bordered=t,this.updateBordered()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowed",{get:function(){return this._shadowed},set:function(t){this._shadowed=t,this.updateShadowed()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(t){this._background=t,this.updateBackground()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this.updateColor()},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.player.removeListener(this.listener)},t.prototype.updatePosition=function(){var t,e;if(this.domEnabled){var r=this.position,n=this.player;if(null===r||!(null===(t=n.options)||void 0===t?void 0:t.app)||(null===(e=n.app)||void 0===e?void 0:e.managed))this.bannerDiv.style.display="none";else if(this.bannerDiv.style.display="flex","embed"===r)this.bannerDiv.style.position="initial",this.bannerDiv.style.marginTop="4px",this.songAnchor.style.flexGrow="1",this.lyricsAnchor.style.flexGrow="1";else{this.bannerDiv.style.position="fixed",this.bannerDiv.style.marginTop="0";var i=r.indexOf("top")>=0,o=r.indexOf("right")>=0,s=r.indexOf("bottom")>=0,a=r.indexOf("left")>=0;this.bannerDiv.style.top=i?"4px":"initial",this.bannerDiv.style.right=o?"4px":"initial",this.bannerDiv.style.bottom=s?"4px":"initial",this.bannerDiv.style.left=a?"4px":"initial",this.songAnchor.style.flexGrow="0",this.lyricsAnchor.style.flexGrow="0"}}},t.prototype.updateRounded=function(){if(this.domEnabled){var t=this.rounded;this.logoSvg.style.borderRadius=t?"4px 0 0 4px":"0",this.lyricsAnchor.style.borderRadius=t?"0 4px 4px 0":"0",this.bannerDiv.style.borderRadius=t?"4px":"0"}},t.prototype.updateBordered=function(){if(this.domEnabled){var t=this.bordered;this.logoAnchor.style.padding=t?"1px 2px":"1px 3px",this.bannerDiv.style.border=t?"1px solid rgba(31, 67, 145, 0.3)":"none"}},t.prototype.updateShadowed=function(){if(this.domEnabled){var t=this.shadowed;this.bannerDiv.style.boxShadow=t?"1px 1px 3px 0 rgba(9, 19, 42, 0.9)":"none"}},t.prototype.updateBackground=function(){this.domEnabled&&(this.songAnchor.style.background=this.background,this.lyricsAnchor.style.background=this.background)},t.prototype.updateColor=function(){this.domEnabled&&(this.songSvg.style.fill=this.color,this.songAnchor.style.color=this.color,this.lyricsSvg.style.fill=this.color,this.lyricsAnchor.style.color=this.color)},t}();function Mi(t){return t&&""!==t?t:"-"}var Bi=function(){this.halted=[],this.errors=[]},Vi=function(){function t(t,e){var r=this;this.listener=e,this.player=null,this._scale=1,this.playerListener={onResize:function(t){r.elementWidth=Math.floor(t.width),r.updateSize()},onVideoReady:function(){r.elementWidth=r.calcWidth(),r.updateSize()},onStageElementSet:function(t){r.elementWidth=r.calcWidth(),r.updateSize(),r.player.graphics.setCanvas(t)},onDispose:function(){r.dispose()}},this.requestedTime=0,this.request=null,this.player=t,t.addListener(this.playerListener)}return Object.defineProperty(t.prototype,"scale",{get:function(){return this._scale},set:function(t){this._scale=t,this.updateSize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.player.graphics.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.player.graphics.height},enumerable:!1,configurable:!0}),t.prototype.requestUpdate=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return this.requestedTime=void 0===t?this.player.videoPosition:t,this.request||(this.request=new Promise((function(t){setTimeout((function(){try{e.update(e.requestedTime)}catch(t){}e.request=null,t(e.requestedTime)}),0)}))),[2,this.request]}))}))},t.prototype.update=function(t){t||(t=this.player.mediaPosition),"number"==typeof t&&(this.player.graphics.reset(),this.animate(t),this.player.graphics.update(),this.listener.onStageUpdate(t))},t.prototype.animate=function(t){for(var e=new Bi,r=e.errors,n=e.halted,i=0,o=[this.player.video.firstCredit,this.player.video.firstPhrase,this.player.video.firstWord,this.player.video.firstChar,this.player.video.firstGraphic];i0){console.error("---");for(var a=0;a0&&(!s.rendering.visible||0===s.rendering.alpha))return void(e.rendering.visible=!1);s=s.parent}var a=this.player.templates.getProperty(r,"insomnia"),u=Gi(e);if(!a&&u){var c=function(t,e,r,i){var o=i&&t(i,"headTime")||500,s=i&&t(i,"tailTime")||500;return!(r.startTime-o<=e&&r.endTime+s>=e)&&(r.getType()!==n.GRAPHIC&&(r.rendering.visible=!1),!0)}((function(t,e){return o.player.templates.getProperty(t,e)}),t,e,r);if(c)return}this.doAnimateTemplate(t,r,i)}},t.prototype.doAnimateTemplate=function(t,e,r){var n=r.errors,i=r.halted;try{this.player.templates.exec(e,"animate",[t])}catch(t){n.push(t),i.push(e)}},t.prototype.calcWidth=function(){var t=this.player.stageElement;if(!t)return 0;var e=window.getComputedStyle(t);return t.offsetWidth-ln(e.borderLeftWidth)-ln(e.borderRightWidth)-ln(e.paddingLeft)-ln(e.paddingRight)},t.prototype.updateSize=function(){var t=this.player.stageElement;if(t){var e=this.elementWidth*this.player.videoProportion;if(t.style.height="".concat(e,"px"),t.width=this.elementWidth*this._scale,t.height=e*this._scale,this.player.video){var r=t.width/this.player.videoWidth;this.player.graphics.updateStageTx(r,this.player.margin),this.player.isPlaying||this.requestUpdate()}}},t.prototype.dispose=function(){this.player.removeListener(this.playerListener),this.player=null},t}();function Gi(t){if(t.getType()===n.GRAPHIC)return!0;for(var e=!0,r=t.parent;r;){if(r.templateCount>0){e=!1;break}r=r.parent}return e}var qi=function(t){function e(e,r){var n=this.constructor,i=t.call(this,e)||this;return i.video=r,Object.setPrototypeOf(i,n.prototype),i}return dn(e,t),e}(Error);function Wi(t,e){var r=e.parser;return yn(this,0,void 0,(function(){var e,n,i;return gn(this,(function(o){switch(o.label){case 0:return t&&t.length>0&&t[0].words&&t[0].words.length>0&&t[0].words[0]&&!t[0].words[0].pos?(e=t.map((function(t){return t.words.map((function(t){return t.characters.map((function(t){return t.char})).join("")})).join(" ")})),n=e.join("\n"),[4,r(n)]):[2];case 1:return(i=o.sent())&&"success"===i.status?(t.forEach((function(t,r){var n=i.result[r],o=0;t.words.forEach((function(t){var i=t.characters.map((function(t){return t.char})).join(""),s=e[r].indexOf(i,o);if(!(s<0)){o=s;var a=n.find((function(t){return t.startPosition<=s&&t.endPosition>=s}));a&&(t.pos=a.PoS,t.rawPoS=a.rawPoS,t.language=a.language)}}))})),[2]):[2]}}))}))}function Yi(t){for(;t.firstElementChild;)t.removeChild(t.firstElementChild)}function zi(t,e){var r=e.id,n=e.data,i=e.loader,o=e.deserializer;return yn(this,0,void 0,(function(){return gn(this,(function(e){switch(e.label){case 0:return r&&r>=0?[4,i(r)]:[3,2];case 1:e.sent(),e.label=2;case 2:return o(t,n),[2]}}))}))}function Ji(t){return"string"!=typeof t?t:"undefined"==typeof window?null:document.querySelector(t)}var Hi=function(){function t(t){this._mediaPosition=0,this._videoPosition=0,this.isEditing=!1,this._isVideoSeeking=!1,this._volume=100,this._options=t,this.emitter=new On(t),this._templates=new Ui(this,this.emitter,t&&t.unsafeAcceleration);var e=Object.assign({},Y);t&&t.managers&&(e=Object.assign(e,t.managers)),this.managers=e,this._timer=t&&t.timer||this.createDefaultTimer(),this._data=new Vn(e,this.emitter,t),this._backgroundGraphics=new Sn(this,e.asset,this.emitter),this._graphics=t&&t.graphics||this.createDefaultGraphicsDriver(),this.stage=new Vi(this,{onStageUpdate:this.onStageUpdate.bind(this)}),this._banner=new Di(this),this.stageElement=Ji(null==t?void 0:t.stageElement)||null,this.mediaElement=Ji(null==t?void 0:t.mediaElement)||null,this._app=new Gn(this,this.emitter)}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?fn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return this._app},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundGraphics",{get:function(){return this._backgroundGraphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"templates",{get:function(){return this._templates},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphics",{get:function(){return this._graphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageElement",{get:function(){return this._stageElement},set:function(t){this._stageElement=t,this.emitter.onStageElementSet(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageScale",{get:function(){return this.stage.scale},set:function(t){this.stage.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaElement",{get:function(){return this._mediaElement},set:function(t){this.updateMediaElement(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaSourceElement",{get:function(){return this._mediaSourceElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaBannerElement",{get:function(){return this._mediaBannerElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaPosition",{get:function(){return this._mediaPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoPosition",{get:function(){return this._videoPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wait",{get:function(){return this._timer?this._timer.wait:0},set:function(t){this._timer&&(this._timer.wait=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fps",{get:function(){return 1e3/this.wait},set:function(t){this.wait=1e3/t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionWidth",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.width?this._data.video.config.width:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.width)?this._options.defaultVideoSize.width:1280},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionHeight",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.height?this._data.video.config.height:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.height)?this._options.defaultVideoSize.height:720},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionProportion",{get:function(){return this.resolutionHeight/this.resolutionWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"margin",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&this._data.video.config.margin?this._data.video.config.margin:(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.margin)||_n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoWidth",{get:function(){var t=this.resolutionWidth,e=this.margin;return t+e[1]+e[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoHeight",{get:function(){var t=this.resolutionHeight,e=this.margin;return t+e[0]+e[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoProportion",{get:function(){return this.videoHeight/this.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageWidth",{get:function(){return this.stage.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageHeight",{get:function(){return this.stage.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return!!this._videoPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._timer&&this._timer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVideoSeeking",{get:function(){return this._isVideoSeeking},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"banner",{get:function(){return this._banner},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timer",{get:function(){return this._timer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volume",{get:function(){return this._volume},set:function(t){isNaN(t)||(this._volume=Math.min(100,Math.max(0,t)),this.emitter.onVolumeUpdate(this._volume))},enumerable:!1,configurable:!0}),t.prototype.createDefaultTimer=function(){try{if("undefined"!=typeof window&&"basic"!==pn("ta_timer"))return new En}catch(t){}return new wn},t.prototype.createDefaultGraphicsDriver=function(){return new yt},t.prototype.addListener=function(t){return this.emitter.addListener(t)},t.prototype.removeListener=function(t){return this.emitter.removeListener(t)},t.prototype.createFromVideoId=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideoId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideoId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromVideoId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideo(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideo=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){return(r=new Vn(this.managers,this.emitter,this._options)).createFromVideo(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.createFromSongUrl=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongUrl(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongUrl=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongUrl(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongPath=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongPath(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongPath=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongPath(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongId=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongCode=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongCode(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongCode=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongCode(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromText=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromText(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromText=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromText(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromJSON=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromJSON(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromJSON=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){return(r=new Vn(this.managers,this.emitter,this._options)).createFromJSON(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.create=function(t,e){return yn(this,0,void 0,(function(){var r,n=this;return gn(this,(function(i){if(this._videoPromise&&!e)throw new qi("Player.createFrom* method calls cannot run in parallel",this._videoPromise);return r=t(),e||(this._videoPromise=r,r.finally((function(){return n._videoPromise=null}))),[2,r]}))}))},t.prototype.finalize=function(t,e){return yn(this,0,void 0,(function(){var r,n,i,o=this;return gn(this,(function(s){switch(s.label){case 0:return t.video?[4,Promise.all([t.finalize(e),this.backgroundGraphics.setBackground(t.video.background)])]:[2,null];case 1:return s.sent(),(null==e?void 0:e.dryRun)?[2,null]:(r=t.video.json,function(t,e){var r=e.config,n=e.song;r&&"object"==typeof r&&"number"==typeof r.duration?t.duration=r.duration:n?t.duration=1e3*n.length:t.duration||(t.duration=t.endTime)}(n=new ut(r),{config:t.video.config,song:t.song}),[4,Promise.all([this.graphics.createRuntime(n),zi(n,{id:t.video.id,data:r,loader:function(t){return yn(o,0,void 0,(function(){return gn(this,(function(e){switch(e.label){case 0:return[4,this.templates.loadForVideo(t)];case 1:return e.sent(),[2]}}))}))},deserializer:function(t,e){return o.templates.importInstances(t,e)}}),Wi(null==r?void 0:r.phrases,{parser:R.parse.bind(R)})])]);case 2:return s.sent(),this._data,this._video&&this.templates.disposeInstances(this._video),this._data=t,this._video=n,this.emitter.onVideoReady(n),i=(null==e?void 0:e.altSourceUrl)||void 0,[4,this._timer.initialize({player:this,updater:this.updateMediaPosition.bind(this),emitter:this.emitter,altSourceUrl:i})];case 3:return s.sent(),this.emitter.onTimerReady(this._timer),[2,n]}}))}))},t.prototype.updateMediaPosition=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return this._isVideoSeeking?(this._mediaPosition=t,this.emitter.onMediaSeek(t),[2,t]):[2,this.stage.requestUpdate(t).then((function(t){return e._mediaPosition=t,e._videoPosition=t,e.emitter.onMediaSeek(t),t}))]}))}))},t.prototype.exportVideo=function(t){var e,r,n,i,o,s,a;return void 0===t&&(t={legacyStringMode:!0}),yn(this,0,void 0,(function(){var u,c,l,p;return gn(this,(function(h){return u={sourceId:(null===(e=this._data.video)||void 0===e?void 0:e.id)||-1,sourceOriginId:(null===(r=this._data.video)||void 0===r?void 0:r.sourceOriginId)||-1,songleId:(null===(n=this._data.song)||void 0===n?void 0:n.id)||-1,lyricId:this._data.lyricsId||-1,lyricDiffId:(null===(i=this._data.lyrics)||void 0===i?void 0:i.id)||-1,config:((null==t?void 0:t.legacyStringMode)?(null===(o=this._data.video)||void 0===o?void 0:o.config)&&JSON.stringify(this._data.video.config):null===(s=this._data.video)||void 0===s?void 0:s.config)||null},c=this.backgroundGraphics.exportPartialVideoEntry(t),l=(null===(a=this._video)||void 0===a?void 0:a.exportData(this._templates))||null,p=(null==t?void 0:t.legacyStringMode)?JSON.stringify(l):l,[2,fn(fn(fn({},u),c),{json:p})]}))}))},t.prototype.getChoruses=function(){return this._data.getChoruses()},t.prototype.findChorus=function(t,e){return this._data.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){return this._data.findChorusBetween(t,e)},t.prototype.findChorusChange=function(t,e){return this._data.findChorusChange(t,e)},t.prototype.getBeats=function(){return this._data.getBeats()},t.prototype.findBeat=function(t,e){return this._data.findBeat(t,e)},t.prototype.findBeatChange=function(t,e){return this._data.findBeatChange(t,e)},t.prototype.getChords=function(){return this._data.getChords()},t.prototype.findChord=function(t,e){return this._data.findChord(t,e)},t.prototype.findChordChange=function(t,e){return this._data.findChordChange(t,e)},t.prototype.getVocalFrequency=function(t){return this._data.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){return this._data.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){return this._data.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){return this._data.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){return this._data.getMedianValenceArousal()},t.prototype.resize=function(t){return this.emitter.onResize(t)},t.prototype.onResize=function(t){return this.resize(t)},t.prototype.setStageElement=function(t){return this._stageElement=t,this.emitter.onStageElementSet(t)},t.prototype.setMediaElement=function(t){this.mediaElement=t},t.prototype.updateMediaElement=function(t){"undefined"!=typeof document&&(this._mediaElement&&Yi(this._mediaElement),t?(Yi(t),this._mediaSourceElement||(this._mediaSourceElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-media-wrapper")),t.appendChild(this._mediaSourceElement),this._mediaBannerElement||(this._mediaBannerElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-banner-wrapper")),t.appendChild(this._mediaBannerElement)):(this._mediaSourceElement=null,this._mediaBannerElement=null)),this._mediaElement=t,this.emitter.onMediaElementSet(t)},t.prototype.setVideoPosition=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return[2,this.stage.requestUpdate(t).then((function(t){return e._videoPosition=t,e.emitter.onVideoSeek(t),t}))]}))}))},t.prototype.setMediaPosition=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.requestMediaSeek(t),[2]}))}))},t.prototype.requestPlay=function(){return this._timer.play(),!0},t.prototype.requestStop=function(){return this._timer.stop(),!0},t.prototype.requestPause=function(){return this._timer.pause(),!0},t.prototype.requestMediaSeek=function(t){return this._timer.seek(t),!0},t.prototype.startVideoSeek=function(){return this._isVideoSeeking=!0,this.emitter.onVideoSeekStart()},t.prototype.endVideoSeek=function(){return this._isVideoSeeking=!1,this.emitter.onVideoSeekEnd()},t.prototype.requestSettingBackground=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return[2,this.backgroundGraphics.settingBackground(t)]}))}))},t.prototype.requestSetBackground=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return[2,this.backgroundGraphics.setBackground(t)]}))}))},t.prototype.requestStageUpdate=function(){return yn(this,0,void 0,(function(){return gn(this,(function(t){return[2,this.stage.requestUpdate()]}))}))},t.prototype.onStageUpdate=function(t){this._isVideoSeeking||this.emitter.onTimeUpdate(t)},t.prototype.dispose=function(){this._timer&&(this._timer.dispose(),this._timer=null),this.mediaElement&&(Yi(this._mediaElement),this._mediaElement=null),this.stageElement&&(this._stageElement=null),this.emitter.onDispose()},t}();console.log("# ライセンス表記に関するガイドライン\n\n国立研究開発法人産業技術総合研究所\n人間情報インタラクション研究部門\nメディアインタラクション研究グループ\n\nTextAlive App APIは非商用利用に限り、どなたでも無料・無保証で利用することができます。\nただし、原則としてTextAlive App APIを利用している旨を TextAlive https://textalive.jp/ サイト内楽曲ページまたは https://developer.textalive.jp/ にハイパーリンクした上で、利用しているシステムもしくは外部サイト等に表示する必要があります。\n\n# お問い合わせ\n\ntextalive-ml@aist.go.jp");var Xi=r.sortedIndex;export{wn as BasicTimer,X as Color,Ai as Ease,pt as Matrix2D,Hi as Player,Fi as PlayerLogoImage,ht as Point,En as SongleTimer,$ as TimedUnit,n as UnitTypes,S as dataUrlToString,st as findTimedObject,at as findTimedObjectsInRange,O as isStringEncodedDataUrl,Xi as sortedIndex,T as stringToDataUrl}; diff --git a/dist/index.js b/dist/index.js index bbec687..f6dee17 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -/** textalive-app-api v0.3.2 | Copyright 2021 AIST TextAlive Project (https://textalive.jp) */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TextAliveApp={},t.axios)}(this,(function(t,e){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(e),i=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,{exports:{}});!function(t,e){!function(t){function e(t,e,r){for(var n=r&&"number"!=typeof e?r(e):e,i=0,o=t.length;i>>1;(r?r(t[s]):t[s])0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=0||"string"==typeof t.user.songleAccessToken)},t.prototype.isSpoofingSongleUser=function(t){return this.isSongleUser(t)&&("number"!=typeof t.user.id||t.user.id<0)},t.prototype.addListener=function(t){t&&this.listeners.push(t)},t.prototype.removeListener=function(t){this.listeners=this.listeners.filter((function(e){return e!==t}))},t.prototype.emitUserProfile=function(t){this.userProfile=t;for(var e=0,r=this.listeners;e=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){return this.contains(t)||this.contains(e)||this.startTime<=t&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?(t-this.startTime)/this.duration:-1},t.prototype.maximize=function(){var t=!1,e=this.endTime,r=Math.max(null===this._parent?0:this._parent.startTime,null===this._previous?0:this._previous.endTime);r!==this.startTime&&(this.moveWithChildren(r-this.startTime),t=!0);var n=Math.min(null===this._parent?this.video.duration:this._parent.endTime,null===this._next?this.video.duration:this._next.startTime);return n!==this.endTime&&(this._data.endTime=n,t=e!==n),t},t.prototype.moveWithChildren=function(t){var e=[];for(e.push(this);e.length>0;){var r=e.pop();null!=r._children&&r._children.forEach((function(t){return e.push(t)})),r._data.startTime+=t,r._data.endTime+=t}},t.prototype.getTemplate=function(t){return void 0===t&&(t=0),t<0||t>=this._templates.length?null:this._templates[t]},t.prototype.addTemplateAt=function(t,e){this._templates.splice(e,0,t),t.assignedUnit=this},t.prototype.addTemplate=function(t){this._templates.push(t),t.assignedUnit=this},t.prototype.removeTemplates=function(){for(var t=this._templates.slice();this._templates.length>0;)this._templates.pop();return t},t.prototype.removeTemplateAt=function(t){if(t<0||t>=this._templates.length)return null;var e=this._templates.splice(t,1)[0];return e.assignedUnit=null,e},t.prototype.removeTemplate=function(t){for(var e=0;et?e:t}function Z(t,e){return"number"==typeof e&&!isNaN(e)&&e>24&255:255,this.r=t>>16&255,this.g=t>>8&255,this.b=255&t)},t}();var K=function(){function t(t,e,r){void 0===t&&(t="Noto Sans Japanese"),void 0===e&&(e=40),void 0===r&&(r=""),this._family=t,this._size=e,this._style=r}return Object.defineProperty(t.prototype,"family",{get:function(){return this._family},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},enumerable:!1,configurable:!0}),t.prototype.deriveFamily=function(e){return new t(e,this._size,this._style)},t.prototype.deriveStyle=function(e){return new t(this._family,this._size,e)},t.prototype.deriveSize=function(e){return new t(this._family,e,this._style)},t.prototype.clone=function(){return new t(this._family,this._size,this._style)},t.prototype.eq=function(t){return this._family===t._family&&this._size===t._size&&this._style===t._style},t.prototype.toString=function(t){void 0===t&&(t=1);var e,r=function(t){if(!t||t.length<=0)return[];for(var e=[],r="",n=!1,i=!1,o=!1,s=0,a=t;s1?" "+r.join(", "):(e=r[0]).length>1&&e[0]!==e[e.length-1]||"'"!==e[0]&&'"'!==e[0]?" '"+e+"'":" "+e,this._style+(this._style.length>0?" ":"")+this._size*t+"px"+e},t}(),tt=function(t){function e(e){var r=t.call(this)||this;return r._data=e,r._font=new K(e&&e.fontFamily,e&&e.fontSize,e&&e.fontStyle),r._color=new Q,r}return J(e,t),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._data&&this._data.char||"?"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"advance",{get:function(){return this._runtime?this._runtime.advance:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ascent",{get:function(){return this._runtime?this._runtime.ascent:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"descent",{get:function(){return this._runtime?this._runtime.descent:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"font",{get:function(){return this._font},set:function(t){null===t||this.font.eq(t)||(this._font=t.clone(),this._data.fontFamily=t.family,this._data.fontSize=t.size,this._data.fontStyle=t.style,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontFamily",{get:function(){return this.font.family},set:function(t){this.font.family!==t&&(this._font=this.font.deriveFamily(t),this._data.fontFamily=t,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontStyle",{get:function(){return this.font.style},set:function(t){this.font.style!==t&&(this._font=this.font.deriveStyle(t),this._data.fontStyle=t,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){return this.font.size},set:function(t){isNaN(t)||this.font.size===t||(this._font=this.font.deriveSize(t),this._data.fontSize=t,this._runtime&&this._runtime.onFontUpdate(this.font))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){t&&!t.eq(this.color)&&(this._color=t,this._runtime&&this._runtime.onColorUpdate(t))},enumerable:!1,configurable:!0}),e.prototype.getType=function(){return o.CHAR},e}($),et=function(t){function e(e){var r=t.call(this)||this;return r._data=e,r}return J(e,t),e.prototype.getType=function(){return o.GRAPHIC},e.prototype.toString=function(){return"Graphic"},e}(H),rt=function(t){function e(e){var r=t.call(this)||this;return r._data=e,r}return J(e,t),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.firstChar?this.firstChar.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.lastChar?this.lastChar.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pos",{get:function(){return this._data&&this._data.pos||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rawPos",{get:function(){return this._data&&this._data.rawPoS||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"language",{get:function(){return this._data&&this._data.language||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"countDown",{get:function(){return this._data?this._data.countDown:-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"countUp",{get:function(){return this._data?this._data.countUp:-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initialCount",{get:function(){return this._data?this._data.initialCount:-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._children.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){return this._children.length<=0?null:this._children[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){return this._children.length<=0?null:this._children[this._children.length-1]},enumerable:!1,configurable:!0}),e.prototype.addChar=function(t){if(t){this._children.length>0&&(t._previous=this.lastChar,this.lastChar._next=t),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){return t instanceof tt?this._children.indexOf(t):-1},e.prototype.getType=function(){return o.WORD},e}($),nt=function(t){function e(e,r){var n=t.call(this)||this;return n._video=e,n._data=r,n.createUnits(),n}return J(e,t),e.prototype.createUnits=function(){var t=this,e=this._data;e&&Array.isArray(e.words)&&e.words.forEach((function(e){if(e){var r=new rt(e);Array.isArray(e.characters)&&e.characters.forEach((function(t){return r.addChar(new tt(t))})),t.addWord(r)}}))},Object.defineProperty(e.prototype,"children",{get:function(){return this._children.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.firstChar?this.firstChar.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.lastChar?this.lastChar.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordCount",{get:function(){return this._children.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._children.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstWord",{get:function(){return this._children.length<=0?null:this._children[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastWord",{get:function(){return this._children.length<=0?null:this._children[this._children.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){var t=this.firstWord;return null===t?null:t.firstChar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){var t=this.lastWord;return null===t?null:t.lastChar},enumerable:!1,configurable:!0}),e.prototype.getWord=function(t){return t<0||t>=this._children.length?null:this._children[t]},e.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.addWord=function(t){if(t){this._children.length>0&&(t._previous=this.lastWord,t._previous._next=t,t.firstChar._previous=t._previous.lastChar,t._previous.lastChar._next=t.firstChar),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){if(t instanceof rt)return this._children.indexOf(t);if(t instanceof tt){for(var e=0,r=!1,n=0,i=this._children;n=t.length&&(n=t.length-1);var o=e,s=r.endTime;return t[n].overlaps(o,s)?t[n]:n<1?null:t[n-1].overlaps(o,s)?t[n-1]:null}return n>=t.length?null:(null==r?void 0:r.loose)||t[n].contains(e)?t[n]:null}var ot=function(){function t(t){this._credits=[],this._phrases=[],this._graphics=[],this.data=t||{},this.createUnits()}return Object.defineProperty(t.prototype,"credits",{get:function(){return this._credits.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"phrases",{get:function(){return this._phrases.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphics",{get:function(){return this._graphics.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rendering",{get:function(){return this._runtime.rendering},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this.data.duration||0},set:function(t){this.data.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){return this.data.startTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endTime",{get:function(){return this.data.endTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"creditCount",{get:function(){return this._credits.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"phraseCount",{get:function(){return this._phrases.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphicCount",{get:function(){return this._graphics.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.wordCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"charCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstCredit",{get:function(){return this._credits.length<=0?null:this._credits[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastCredit",{get:function(){return this._credits.length<=0?null:this._credits[this._credits.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[this._phrases.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstWord",{get:function(){var t;return(null===(t=this.firstPhrase)||void 0===t?void 0:t.firstWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastWord",{get:function(){var t;return(null===(t=this.lastPhrase)||void 0===t?void 0:t.lastWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstChar",{get:function(){var t;return(null===(t=this.firstWord)||void 0===t?void 0:t.firstChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChar",{get:function(){var t;return(null===(t=this.lastWord)||void 0===t?void 0:t.lastChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[this._graphics.length-1]},enumerable:!1,configurable:!0}),t.prototype.createUnits=function(){var t,e,r=this;Array.isArray(this.data.credits)?(this.data.credits.sort(st),this.data.credits.forEach((function(t){return r.doAddCredit(new nt(r,t),!1)})),this.organizeTimings(null===(t=this.firstCredit)||void 0===t?void 0:t.firstChar)):this.data.credits=[],Array.isArray(this.data.phrases)?(this.data.phrases.sort(st),this.data.phrases.forEach((function(t){return r.doAddPhrase(new nt(r,t),!1)})),this.organizeTimings(null===(e=this.firstPhrase)||void 0===e?void 0:e.firstChar)):this.data.phrases=[],Array.isArray(this.data.graphics)?(this.data.graphics.sort(st),this.data.graphics.forEach((function(t){return r.doAddGraphic(new et(t),!1)}))):this.data.graphics=[]},t.prototype.organizeTimings=function(t){for(;t;)t.startTime===t.endTime&&t.maximize(),t=t.next},t.prototype.exportData=function(e){this.updateTemplateData(e);for(var r=t.exportUnitData(this.data.credits,!0),n=r.units,i=r.templateClasses,o=t.exportUnitData(this.data.phrases,!1),s=o.units,a=o.templateClasses,u=t.exportUnitData(this.data.graphics,!0),l=u.units,c=u.templateClasses,p=i.concat(a,c).filter((function(t,e,r){return r.indexOf(t)===e})),h={};p.length>0;){var d=p.shift(),f=e.getByName(d);if(f){h[d]=f.id;for(var y=0,v=e.getRequiredTemplates(f.script);y0?t[r-1]:null,o=r0){for(var s=n;s&&!s.lastWord;)s=s.previous;for(var a=o;a&&!a.firstWord;)a=a.next;if(s&&(e.firstWord._previous=s.lastWord,s.lastWord._next=e.firstWord),a&&(e.lastWord._next=a.firstWord,a.firstWord._previous=e.lastWord),e.charCount>0){for(var u=null==s?void 0:s.lastWord;u&&null===u.lastChar;)u=u.previous;for(var l=null==a?void 0:a.firstWord;l&&null===l.firstChar;)l=l.next;u&&(e.firstChar._previous=u.lastChar,u.lastChar._next=e.firstChar),l&&(e.lastChar._next=l.firstChar,l.firstChar._previous=e.lastChar)}}return this.updateStartAndEndTime(),r}},t.prototype.removeCredit=function(t){var e=this.removeRenderingUnit(this._credits,t);return!(e<0||(this.data.credits.splice(e,1),this._runtime&&this._runtime.removeCredit(t),0))},t.prototype.removeCredits=function(){var t=this;this._runtime&&this._credits.forEach((function(e){return t._runtime.removeCredit(e)})),this._credits=[],this.data.credits.splice(0,this.data.credits.length)},t.prototype.removePhrase=function(t){var e=this.removeRenderingUnit(this._phrases,t);return!(e<0||(this.data.phrases.splice(e,1),this._runtime&&this._runtime.removePhrase(t),0))},t.prototype.removePhrases=function(){var t=this;this._runtime&&this._phrases.forEach((function(e){return t._runtime.removePhrase(e)})),this._phrases=[],this.data.phrases.splice(0,this.data.phrases.length)},t.prototype.removeGraphic=function(t){var e=this.removeRenderingUnit(this._graphics,t);return!(e<0||(this.data.graphics.splice(e,1),this._runtime&&this._runtime.removeGraphic(t),0))},t.prototype.removeGraphics=function(){var t=this;this._runtime&&this._graphics.forEach((function(e){return t._runtime.removeGraphic(e)})),this._graphics=[],this.data.graphics.splice(0,this.data.graphics.length),this.rendering.reset()},t.prototype.removeRenderingUnit=function(t,e){var r=i.exports.sortedIndex(t,e,at);if(r<0||t[r]!==e)return-1;if(t.splice(r,1),e instanceof nt){if(e.charCount>0){for(var n=e._previous;n&&null===n.lastChar;)n=n.previous;for(var o=e._next;o&&null===o.firstChar;)o=o.next;n&&o?(n.lastChar._next=o.firstChar,o.firstChar._previous=n.lastChar):n?n.lastChar._next=null:o&&(o.firstChar._previous=null)}if(e.wordCount>0){for(n=e._previous;n&&null===n.lastWord;)n=n.previous;for(o=e._next;o&&null===o.firstWord;)o=o.next;n&&o?(n.lastWord._next=o.firstWord,o.firstWord._previous=n.lastWord):n?n.lastWord._next=null:o&&(o.firstWord._previous=null)}}e._previous&&(e._previous._next=e._next),e._next&&(e._next._previous=e._previous),this.updateStartAndEndTime()},t.prototype.updateStartAndEndTime=function(){var t,e,r,n,i,o,s,a;this.data.endTime=Math.max((null===(e=null===(t=this.lastCredit)||void 0===t?void 0:t.lastChar)||void 0===e?void 0:e.endTime)||0,(null===(r=this.lastChar)||void 0===r?void 0:r.endTime)||0,(null===(n=this.lastGraphic)||void 0===n?void 0:n.endTime)||0);var u=null===(o=null===(i=this.firstCredit)||void 0===i?void 0:i.firstChar)||void 0===o?void 0:o.startTime,l=null===(s=this.firstChar)||void 0===s?void 0:s.startTime,c=null===(a=this.firstGraphic)||void 0===a?void 0:a.startTime;this.data.startTime=Math.min("number"==typeof u?u:Number.MAX_VALUE,"number"==typeof l?l:Number.MAX_VALUE,"number"==typeof c?c:Number.MAX_VALUE,this.data.endTime)},t.prototype.findIndex=function(t){if(t instanceof nt)return(e=this._phrases.indexOf(t))>=0?e:this._credits.indexOf(t);if(t instanceof rt){for(var e=0,r=!1,n=0,i=this._phrases;n=this._credits.length?null:this._credits[t]},t.prototype.getPhrase=function(t){return t<0||t>=this._phrases.length?null:this._phrases[t]},t.prototype.getWord=function(t){if(t<0)return null;for(var e=0,r=this.firstPhrase;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},t.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},t.prototype.getGraphic=function(t){return t<0||t>=this._graphics.length?null:this._graphics[t]},t.prototype.findCredit=function(t,e){return it(this._credits,t,e)},t.prototype.findPhrase=function(t,e){return it(this._phrases,t,e)},t.prototype.findWord=function(t,e){var r=this.findPhrase(t,e);return r?it(r._children,t,e):null},t.prototype.findChar=function(t,e){var r=this.findWord(t,e);return r?it(r._children,t,e):null},t.prototype.findGraphic=function(t,e){return it(this._graphics,t,e)},t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){return this.contains(t)||this.contains(e)||this.startTime<=t&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?(t-this.startTime)/this.duration:-1},t}();function st(t,e){return t.startTime-e.startTime}function at(t){return t.startTime}var ut=function(){function t(t,e,r,n,i,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.setValues(t,e,r,n,i,o)}return t.prototype.setValues=function(t,e,r,n,i,o){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=o,this},t.prototype.append=function(t,e,r,n,i,o){var s=this.a,a=this.b,u=this.c,l=this.d;return 1==t&&0==e&&0==r&&1==n||(this.a=s*t+u*e,this.b=a*t+l*e,this.c=s*r+u*n,this.d=a*r+l*n),this.tx=s*i+u*o+this.tx,this.ty=a*i+l*o+this.ty,this},t.prototype.prepend=function(t,e,r,n,i,o){var s=this.a,a=this.c,u=this.tx;return this.a=t*s+r*this.b,this.b=e*s+n*this.b,this.c=t*a+r*this.d,this.d=e*a+n*this.d,this.tx=t*u+r*this.ty+i,this.ty=e*u+n*this.ty+o,this},t.prototype.appendMatrix=function(t){return this.append(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.prependMatrix=function(t){return this.prepend(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.appendTransform=function(e,r,n,i,o,s,a,u,l){var c,p,h;return o%360?(c=o*t.DEG_TO_RAD,p=Math.cos(c),h=Math.sin(c)):(p=1,h=0),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.append(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r),this.append(p*n,h*n,-h*i,p*i,0,0)):this.append(p*n,h*n,-h*i,p*i,e,r),(u||l)&&(this.tx-=u*this.a+l*this.c,this.ty-=u*this.b+l*this.d),this},t.prototype.prependTransform=function(e,r,n,i,o,s,a,u,l){var c,p,h;return o%360?(c=o*t.DEG_TO_RAD,p=Math.cos(c),h=Math.sin(c)):(p=1,h=0),(u||l)&&(this.tx-=u,this.ty-=l),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.prepend(p*n,h*n,-h*i,p*i,0,0),this.prepend(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r)):this.prepend(p*n,h*n,-h*i,p*i,e,r),this},t.prototype.rotate=function(e){e*=t.DEG_TO_RAD;var r=Math.cos(e),n=Math.sin(e),i=this.a,o=this.b;return this.a=i*r+this.c*n,this.b=o*r+this.d*n,this.c=-i*n+this.c*r,this.d=-o*n+this.d*r,this},t.prototype.skew=function(e,r){return e*=t.DEG_TO_RAD,r*=t.DEG_TO_RAD,this.append(Math.cos(r),Math.sin(r),-Math.sin(e),Math.cos(e),0,0),this},t.prototype.scale=function(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this},t.prototype.translate=function(t,e){return this.tx+=this.a*t+this.c*e,this.ty+=this.b*t+this.d*e,this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},t.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,n=this.d,i=this.tx,o=t*n-e*r;return this.a=n/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-n*i)/o,this.ty=-(t*this.ty-e*i)/o,this},t.prototype.isIdentity=function(){return 0===this.tx&&0===this.ty&&1===this.a&&0===this.b&&0===this.c&&1===this.d},t.prototype.equals=function(t){return this.tx===t.tx&&this.ty===t.ty&&this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d},t.prototype.transformPoint=function(t,e,r){return r.x=t*this.a+e*this.c+this.tx,r.y=t*this.b+e*this.d+this.ty,r},t.prototype.decompose=function(e){void 0===e&&(e={}),e.x=this.tx,e.y=this.ty,e.scaleX=Math.sqrt(this.a*this.a+this.b*this.b),e.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var r=Math.atan2(-this.c,this.d),n=Math.atan2(this.b,this.a);return Math.abs(1-r/n)<1e-5?(e.rotation=n/t.DEG_TO_RAD,this.a<0&&this.d>=0&&(e.rotation+=e.rotation<=0?180:-180),e.skewX=e.skewY=0):(e.skewX=r/t.DEG_TO_RAD,e.skewY=n/t.DEG_TO_RAD),e},t.prototype.copy=function(t){return this.setValues(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.clone=function(){return new t(this.a,this.b,this.c,this.d,this.tx,this.ty)},t.prototype.toString=function(){return"["+this.constructor.name+" (a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+")]"},t.DEG_TO_RAD=Math.PI/180,t.identity=new t,t}(),lt=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.setValues(t,e)}return t.prototype.setValues=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e,this},t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.toString=function(){return"["+this.constructor.name+" (x="+this.x+" y="+this.y+")]"},t}(),ct=function(){function t(){this.tx=new ut,this.alpha=0,this.composite="",this.visible=!0}return t.prototype.reset=function(){},t}(),pt=function(){function t(){this.rendering=new ct}return t.prototype.addCredit=function(t){this.doAddPhrase(t)},t.prototype.removeCredit=function(t){t._runtime=null},t.prototype.addPhrase=function(t){this.doAddPhrase(t)},t.prototype.removePhrase=function(t){t._runtime=null},t.prototype.doAddPhrase=function(t){t._runtime={graphics:{clear:function(){}},rendering:new ct,update:function(){}};for(var e=t.firstWord;e;){e._runtime={graphics:{clear:function(){}},rendering:new ct,update:function(){}};for(var r=e.firstChar;r&&(r._runtime={graphics:{clear:function(){}},rendering:new ct,update:function(){},advance:0,ascent:0,descent:0,onFontUpdate:function(){},onColorUpdate:function(){}},r!==e.lastChar);)r=r.next;if(e===t.lastWord)break;e=e.next}},t.prototype.addGraphic=function(t){t._runtime={graphics:{clear:function(){}},rendering:new ct,update:function(){}}},t.prototype.removeGraphic=function(t){t._runtime=null},t}(),ht=function(){function t(){this.wrapperTable={}}return t.prototype.isGraphics=function(){return!1},t.prototype.setCanvas=function(){return Promise.resolve()},t.prototype.createRuntime=function(t){return function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}(this,void 0,void 0,(function(){var e,r,n;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]3){for(r.sort((function(t,e){return e.length-t.length})),e+="switch(str.length){",n=0;n=170&&Ke.test(String.fromCharCode(t)))},ir=function(t){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||t>=170&&tr.test(String.fromCharCode(t))))};function or(){this.line=xt,this.column=bt-At}function sr(t,e){wt=bt,yt.locations&&(Et=new or),Ot=t,lr(),St=e,Tt=t.beforeExpr}function ar(){var t,e=yt.onComment&&yt.locations&&new or,r=bt,n=vt.indexOf("*/",bt+=2);if(-1===n&&Lt(bt-2,"Unterminated comment"),bt=n+2,yt.locations)for(rr.lastIndex=r;(t=rr.exec(vt))&&t.index8&&t<14)++bt;else if(47===t){var e;if(42===(e=vt.charCodeAt(bt+1)))ar();else{if(47!==e)break;ur()}}else if(160===t)++bt;else{if(!(t>=5760&&$e.test(String.fromCharCode(t))))break;++bt}}}function cr(t){if(t?bt=_t+1:_t=bt,yt.locations&&(Pt=new or),t)return hr();if(bt>=gt)return sr(qt);var e=vt.charCodeAt(bt);if(nr(e)||92===e)return gr();var r=function(t){switch(t){case 46:return function(){var t=vt.charCodeAt(bt+1);return t>=48&&t<=57?fr(!0):(++bt,sr(Se))}();case 40:return++bt,sr(_e);case 41:return++bt,sr(we);case 59:return++bt,sr(Ee);case 44:return++bt,sr(Pe);case 91:return++bt,sr(ve);case 93:return++bt,sr(ge);case 123:return++bt,sr(me);case 125:return++bt,sr(be);case 58:return++bt,sr(Oe);case 63:return++bt,sr(Te);case 48:var e=vt.charCodeAt(bt+1);if(120===e||88===e)return function(){bt+=2;var t=dr(16);return null==t&&Lt(_t+2,"Expected hexadecimal number"),nr(vt.charCodeAt(bt))&&Lt(bt,"Identifier directly after number"),sr(Mt,t)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return fr(!1);case 34:case 39:return function(t){bt++;for(var e="";;){bt>=gt&&Lt(_t,"Unterminated string constant");var r=vt.charCodeAt(bt);if(r===t)return++bt,sr(Vt,e);if(92===r){r=vt.charCodeAt(++bt);var n=/^[0-7]+/.exec(vt.slice(bt,bt+3));for(n&&(n=n[0]);n&&parseInt(n,8)>255;)n=n.slice(0,-1);if("0"===n&&(n=null),++bt,n)It&&Lt(bt-2,"Octal literal in strict mode"),e+=String.fromCharCode(parseInt(n,8)),bt+=n.length-1;else switch(r){case 110:e+="\n";break;case 114:e+="\r";break;case 120:e+=String.fromCharCode(yr(2));break;case 117:e+=String.fromCharCode(yr(4));break;case 85:e+=String.fromCharCode(yr(8));break;case 116:e+="\t";break;case 98:e+="\b";break;case 118:e+="\v";break;case 102:e+="\f";break;case 48:e+="\0";break;case 13:10===vt.charCodeAt(bt)&&++bt;case 10:yt.locations&&(At=bt,++xt);break;default:e+=String.fromCharCode(r)}}else 13!==r&&10!==r&&8232!==r&&8233!==r||Lt(_t,"Unterminated string constant"),e+=String.fromCharCode(r),++bt}}(t);case 47:return function(t){var e=vt.charCodeAt(bt+1);return Tt?(++bt,hr()):61===e?pr(Re,2):pr(xe,1)}();case 37:case 42:return 61===vt.charCodeAt(bt+1)?pr(Re,2):pr(Ve,1);case 124:case 38:return function(t){var e=vt.charCodeAt(bt+1);return e===t?pr(124===t?ke:je,2):61===e?pr(Re,2):pr(124===t?Ie:Fe,1)}(t);case 94:return 61===vt.charCodeAt(bt+1)?pr(Re,2):pr(Ue,1);case 43:case 45:return function(t){var e=vt.charCodeAt(bt+1);return e===t?45==e&&62==vt.charCodeAt(bt+2)&&er.test(vt.slice(Ct,bt))?(bt+=3,ur(),lr(),cr()):pr(Ce,2):61===e?pr(Re,2):pr(Be,1)}(t);case 60:case 62:return function(t){var e=vt.charCodeAt(bt+1),r=1;return e===t?(r=62===t&&62===vt.charCodeAt(bt+2)?3:2,61===vt.charCodeAt(bt+r)?pr(Re,r+1):pr(Me,r)):33==e&&60==t&&45==vt.charCodeAt(bt+2)&&45==vt.charCodeAt(bt+3)?(bt+=4,ur(),lr(),cr()):(61===e&&(r=61===vt.charCodeAt(bt+2)?3:2),pr(De,r))}(t);case 61:case 33:return function(t){return 61===vt.charCodeAt(bt+1)?pr(Le,61===vt.charCodeAt(bt+2)?3:2):pr(61===t?Ae:Ne,1)}(t);case 126:return pr(Ne,1)}return!1}(e);if(!1===r){var n=String.fromCharCode(e);if("\\"===n||Ke.test(n))return gr();Lt(bt,"Unexpected character '"+n+"'")}return r}function pr(t,e){var r=vt.slice(bt,bt+e);bt+=e,sr(t,r)}function hr(){for(var t,e,r=bt;;){bt>=gt&&Lt(r,"Unterminated regular expression");var n=vt.charAt(bt);if(er.test(n)&&Lt(r,"Unterminated regular expression"),t)t=!1;else{if("["===n)e=!0;else if("]"===n&&e)e=!1;else if("/"===n&&!e)break;t="\\"===n}++bt}var i=vt.slice(r,bt);++bt;var o=vr();return o&&!/^[gmsiy]*$/.test(o)&&Lt(r,"Invalid regexp flag"),sr(Bt,new RegExp(i,o))}function dr(t,e){for(var r=bt,n=0,i=0,o=null==e?1/0:e;i=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=t)break;++bt,n=n*t+s}return bt===r||null!=e&&bt-r!==e?null:n}function fr(t){var e=bt,r=!1,n=48===vt.charCodeAt(bt);t||null!==dr(10)||Lt(e,"Invalid number"),46===vt.charCodeAt(bt)&&(++bt,dr(10),r=!0);var i=vt.charCodeAt(bt);69!==i&&101!==i||(43!==(i=vt.charCodeAt(++bt))&&45!==i||++bt,null===dr(10)&&Lt(e,"Invalid number"),r=!0),nr(vt.charCodeAt(bt))&&Lt(bt,"Identifier directly after number");var o,s=vt.slice(e,bt);return r?o=parseFloat(s):n&&1!==s.length?/[89]/.test(s)||It?Lt(e,"Invalid number"):o=parseInt(s,8):o=parseInt(s,10),sr(Mt,o)}function yr(t){var e=dr(16,t);return null===e&&Lt(_t,"Bad character escape sequence"),e}function vr(){Ye=!1;for(var t,e=!0,r=bt;;){var n=vt.charCodeAt(bt);if(ir(n))Ye&&(t+=vt.charAt(bt)),++bt;else{if(92!==n)break;Ye||(t=vt.slice(r,bt)),Ye=!0,117!=vt.charCodeAt(++bt)&&Lt(bt,"Expecting Unicode escape sequence \\uXXXX"),++bt;var i=yr(4),o=String.fromCharCode(i);o||Lt(bt-1,"Invalid Unicode escape"),(e?nr(i):ir(i))||Lt(bt-4,"Invalid Unicode escape"),t+=o}e=!1}return Ye?t:vt.slice(r,bt)}function gr(){var t=vr(),e=Gt;return Ye||(Ze(t)?e=ye[t]:(yt.forbidReserved&&(3===yt.ecmaVersion?ze:Je)(t)||It&&He(t))&&Lt(_t,"The keyword '"+t+"' is reserved")),sr(e,t)}function mr(){Rt=_t,Ct=wt,Nt=Et,cr()}function br(t){if(It=t,bt=Ct,yt.locations)for(;bt=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"use strict"===t.expression.value}function Tr(t){if(Ot===t)return mr(),!0}function xr(){return!yt.strictSemicolons&&(Ot===qt||Ot===be||er.test(vt.slice(Ct,_t)))}function Ar(){Tr(Ee)||xr()||Cr()}function Rr(t){Ot===t?mr():Cr()}function Cr(){Lt(_t,"Unexpected token")}function Nr(t){"Identifier"!==t.type&&"MemberExpression"!==t.type&&Lt(t.start,"Assigning to rvalue"),It&&"Identifier"===t.type&&Xe(t.name)&&Lt(t.start,"Assigning to "+t.name+" in strict mode")}var kr={kind:"loop"},jr={kind:"switch"};function Ir(){(Ot===xe||Ot===Re&&"/="==St)&&cr(!0);var t=Ot,e=Pr();switch(t){case Wt:case Jt:mr();var r=t===Wt;Tr(Ee)||xr()?e.label=null:Ot!==Gt?Cr():(e.label=Xr(),Ar());for(var n=0;ne){var i=Er(t);i.left=t,i.operator=St;var o=Ot;return mr(),i.right=Gr(qr(),n,r),Gr(Or(i,o===ke||o===je?"LogicalExpression":"BinaryExpression"),e,r)}return t}function qr(){if(Ot.prefix){var t=Pr(),e=Ot.isUpdate;return t.operator=St,t.prefix=!0,Tt=!0,mr(),t.argument=qr(),e?Nr(t.argument):It&&"delete"===t.operator&&"Identifier"===t.argument.type&&Lt(t.start,"Deleting local variable in strict mode"),Or(t,e?"UpdateExpression":"UnaryExpression")}for(var r=Wr(Yr());Ot.postfix&&!xr();)(t=Er(r)).operator=St,t.prefix=!1,t.argument=r,Nr(r),mr(),r=Or(t,"UpdateExpression");return r}function Wr(t,e){var r;return Tr(Se)?((r=Er(t)).object=t,r.property=Xr(!0),r.computed=!1,Wr(Or(r,"MemberExpression"),e)):Tr(ve)?((r=Er(t)).object=t,r.property=Br(),r.computed=!0,Rr(ge),Wr(Or(r,"MemberExpression"),e)):!e&&Tr(_e)?((r=Er(t)).callee=t,r.arguments=Hr(we,!1),Wr(Or(r,"CallExpression"),e)):t}function Yr(){switch(Ot){case ce:var t=Pr();return mr(),Or(t,"ThisExpression");case Gt:return Xr();case Mt:case Vt:case Bt:return(t=Pr()).value=St,t.raw=vt.slice(_t,wt),mr(),Or(t,"Literal");case pe:case he:case de:return(t=Pr()).value=Ot.atomValue,t.raw=Ot.keyword,mr(),Or(t,"Literal");case _e:var e=Pt,r=_t;mr();var n=Br();return n.start=r,n.end=wt,yt.locations&&(n.loc.start=e,n.loc.end=Et),yt.ranges&&(n.range=[r,wt]),Rr(we),n;case ve:return t=Pr(),mr(),t.elements=Hr(ge,!0,!0),Or(t,"ArrayExpression");case me:return function(){var t=Pr(),e=!0,r=!1;for(t.properties=[],mr();!Tr(be);){if(e)e=!1;else if(Rr(Pe),yt.allowTrailingCommas&&Tr(be))break;var n,i={key:zr()},o=!1;if(Tr(Oe)?(i.value=Br(!0),n=i.kind="init"):yt.ecmaVersion>=5&&"Identifier"===i.key.type&&("get"===i.key.name||"set"===i.key.name)?(o=r=!0,n=i.kind=i.key.name,i.key=zr(),Ot!==_e&&Cr(),i.value=Jr(Pr(),!1)):Cr(),"Identifier"===i.key.type&&(It||r))for(var s=0;s=0)for(var a=0;a>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;","Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")},t.prototype.initString=function(e){var r,n=this;r=function(t){return t=String(t),n.calledWithNew()?(this.data=t,this):t},this.STRING=this.createNativeFunction(r,!0),this.setProperty(e,"String",this.STRING),this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(String.fromCharCode,!1),t.NONENUMERABLE_DESCRIPTOR);for(var i=["trim","toLowerCase","toUpperCase","toLocaleLowerCase","toLocaleUpperCase","charAt","charCodeAt","substring","slice","substr","indexOf","lastIndexOf","concat"],o=0;o= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);","}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","")},t.prototype.initBoolean=function(t){var e,r=this;e=function(t){return t=Boolean(t),r.calledWithNew()?(this.data=t,this):t},this.BOOLEAN=this.createNativeFunction(e,!0),this.setProperty(t,"Boolean",this.BOOLEAN)},t.prototype.initNumber=function(e){var r,n=this;r=function(t){return t=Number(t),n.calledWithNew()?(this.data=t,this):t},this.NUMBER=this.createNativeFunction(r,!0),this.setProperty(e,"Number",this.NUMBER);for(var i=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"],o=0;o>>0;return e===Number(t)?e:NaN},t.legalArrayIndex=function(t){var e=t>>>0;return String(e)===String(t)&&4294967295!==e?e:NaN},t.prototype.createObject=function(t){return this.createObjectProto(t&&t.properties.prototype)},t.prototype.createObjectProto=function(t){var e=new $r(t);return this.isa(e,this.FUNCTION)&&(this.setProperty(e,"prototype",this.createObjectProto(this.OBJECT_PROTO||null)),e.class="Function"),this.isa(e,this.ARRAY)&&(this.setProperty(e,"length",0,{configurable:!1,enumerable:!1,writable:!0}),e.class="Array"),this.isa(e,this.ERROR)&&(e.class="Error"),e},t.prototype.populateRegExp=function(e,r){e.data=r,this.setProperty(e,"lastIndex",r.lastIndex,t.NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"source",r.source,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"global",r.global,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"ignoreCase",r.ignoreCase,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"multiline",r.multiline,t.READONLY_NONENUMERABLE_DESCRIPTOR)},t.prototype.createFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.parentScope=r,n.node=e,this.setProperty(n,"length",n.node.params.length,t.READONLY_DESCRIPTOR),n},t.prototype.createNativeFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.nativeFunc=e,e.id=this.functionCounter_++,this.setProperty(n,"length",e.length,t.READONLY_DESCRIPTOR),r?this.setProperty(n.properties.prototype,"constructor",n,t.NONENUMERABLE_DESCRIPTOR):!1===r&&(n.illegalConstructor=!0,this.setProperty(n,"prototype",void 0)),n},t.prototype.createAsyncFunction=function(e){var r=this.createObjectProto(this.FUNCTION_PROTO);return r.asyncFunc=e,e.id=this.functionCounter_++,this.setProperty(r,"length",e.length,t.READONLY_DESCRIPTOR),r},t.prototype.nativeToPseudo=function(t){if("boolean"==typeof t||"number"==typeof t||"string"==typeof t||null==t)return t;if(t instanceof RegExp){var e=this.createObjectProto(this.REGEXP_PROTO);return this.populateRegExp(e,t),e}if(t instanceof Function){var r=this;return this.createNativeFunction((function(){return r.nativeToPseudo(t.apply(r,Array.prototype.slice.call(arguments).map((function(t){return r.pseudoToNative(t)}))))}),void 0)}var n;if(Array.isArray(t)){n=this.createObjectProto(this.ARRAY_PROTO);for(var i=0;i>=":s>>=a;break;case">>>=":s>>>=a;break;case"&=":s&=a;break;case"^=":s^=a;break;case"|=":s|=a;break;default:throw SyntaxError("Unknown assignment expression: "+r.operator)}var u=this.setValue(e.leftReference_,s);if(u)return e.doneSetter_=s,this.createSetter_(u,e.leftReference_,s);t.pop(),t[t.length-1].value=s},t.prototype.stepBinaryExpression=function(t,e,r){if(!e.doneLeft_)return e.doneLeft_=!0,new Qr(r.left,e.scope);if(!e.doneRight_)return e.doneRight_=!0,e.leftValue_=e.value,new Qr(r.right,e.scope);t.pop();var n,i=e.leftValue_,o=e.value;switch(r.operator){case"==":n=i==o;break;case"!=":n=i!=o;break;case"===":n=i===o;break;case"!==":n=i!==o;break;case">":n=i>o;break;case">=":n=i>=o;break;case"<":n=i>":n=i>>o;break;case">>>":n=i>>>o;break;case"in":o&&o.isObject||this.throwException(this.TYPE_ERROR,"'in' expects an object, not '"+o+"'"),n=this.hasProperty(o,i);break;case"instanceof":this.isa(o,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Right-hand side of instanceof is not an object"),n=!!i.isObject&&this.isa(i,o);break;default:throw SyntaxError("Unknown binary operator: "+r.operator)}t[t.length-1].value=n},t.prototype.stepBlockStatement=function(t,e,r){var n=e.n_||0,i=r.body[n];if(i)return e.n_=n+1,new Qr(i,e.scope);t.pop()},t.prototype.stepBreakStatement=function(t,e,r){t.pop();var n=null;for(r.label&&(n=r.label.name);e&&"CallExpression"!==e.node.type&&"NewExpression"!==e.node.type;){if(n){if(e.labels&&-1!==e.labels.indexOf(n))return}else if(e.isLoop||e.isSwitch)return;e=t.pop()}throw SyntaxError("Illegal break statement")},t.prototype.stepCallExpression=function(e,r,n){if(!r.doneCallee_){r.doneCallee_=1;var i=new Qr(n.callee,r.scope);return i.components=!0,i}if(1===r.doneCallee_){r.doneCallee_=2;var o=r.value;if(Array.isArray(o)){if(r.func_=this.getValue(o),o[0]!==t.SCOPE_REFERENCE&&(r.funcThis_=o[0]),(o=r.func_)&&"object"==typeof o&&o.isGetter)return o.isGetter=!1,r.doneCallee_=1,this.createGetter_(o,r.value)}else r.func_=o;r.arguments_=[],r.n_=0}if(o=r.func_,!r.doneArgs_){if(0!==r.n_&&r.arguments_.push(r.value),n.arguments[r.n_])return new Qr(n.arguments[r.n_++],r.scope);"NewExpression"===n.type?(o.illegalConstructor&&this.throwException(this.TYPE_ERROR,o+" is not a constructor"),r.funcThis_=this.createObject(o),r.isConstructor=!0):void 0===r.funcThis_&&(r.funcThis_=r.scope.strict?void 0:this.global),r.doneArgs_=!0}if(r.doneExec_)e.pop(),r.isConstructor&&"object"!=typeof r.value?e[e.length-1].value=r.funcThis_:e[e.length-1].value=r.value;else{r.doneExec_=!0,o&&o.isObject||(console.log("non-function called",o,r),this.throwException(this.TYPE_ERROR,o+" is not a function"));var s=o.node;if(s){for(var a=this.createScope(s.body,o.parentScope),u=0;uu?r.arguments_[u]:void 0;this.setProperty(a,l,c)}var p=this.createObjectProto(this.ARRAY_PROTO);for(u=0;u=0)return!0;r=Object.getPrototypeOf(r)}return!1};function tn(t,e){var r={},n=Ut(t,{locations:!0,onComment:function(t,e,n,i,o,s){r[s.line]=e}});if("Program"!==n.type||1!==n.body.length||"FunctionDeclaration"!==n.body[0].type)throw new Error("JavaScript program should only have one function definition");var i=n.body[0].body.body,o=[],s=[];return i.forEach((function(t){if("ExpressionStatement"===t.type){var n=t.expression;if("AssignmentExpression"===n.type&&"="===n.operator&&"MemberExpression"===n.left.type&&"ThisExpression"===n.left.object.type&&"Identifier"===n.left.property.type){for(var i=[],a=n.loc.start.line-1;a>=0&&void 0!==r[a];a--)i.push(r[a]);if(!(i.length<=0)){var u=n.left.property.name;if(!(Array.isArray(e)&&e.indexOf(u)>=0)&&"FunctionExpression"!==n.right.type){var l=function(t,e,r){var n={name:t,title:{},className:null,proposed:!1,initialValue:null};if(e.forEach((function(t){var e=t.indexOf("@ui ");if(e>=0)n.description=t.substring(e+"@ui ".length).trim();else{var r=t.indexOf("@title ");if(r>=0){var i=t.substring(r+"@title ".length).trim();0===i.indexOf("@ja ")?n.title.ja=i.substring("@ja ".length).trim():n.title.default=i}else if(t.indexOf("@proposed")>=0)n.proposed=!0;else{var o=t.indexOf("@comment ");if(o>=0){var s=t.substring(o+"@comment ".length).trim();return n.comment||(n.comment={}),void(0===s.indexOf("@ja ")?n.comment.ja=s.substring("@ja ".length).trim():n.comment.default=s)}}}})),!n.description&&!n.comment)return null;if(n.proposed||n.comment)return n;var i=n.description.indexOf("("),o=n.description.indexOf(")",i);if(!(i<0||o<0)){n.className=n.description.substr(0,i);try{var s=new Zr("["+n.description.substr(i+1,o-i-1)+"]"),a=Date.now();for(s.unwrap=null,s.wrap=null;s.step()&&!(Date.now()-a>100););n.params=s.pseudoToNative(s.value)}catch(t){}return n.params||(n.params=[]),n}}(u,i);s.push(n),l&&o.push(l)}}}}})),{widgets:o,fields:s,ast:n}}function en(t,e){if(void 0===e&&(e=-1),!t)return{dependencyAtCursor:null,dependencies:[]};for(var r=[],n=null,i=("string"==typeof t?Ut(t,Zr.PARSE_OPTIONS):t).body[0].body.body.slice(0);i.length>0;){var o=i.shift();if(null!=o)if("CallExpression"!==o.type)o.expression&&i.push(o.expression),o.object&&i.push(o.object),o.property&&i.push(o.property),o.name&&"string"!=typeof name&&i.push(o.name),o.left&&i.push(o.left),o.right&&i.push(o.right),o.id&&i.push(o.id),o.init&&i.push(o.init),o.callee&&i.push(o.callee),o.body&&Array.isArray(o.body)&&i.push.apply(i,o.body),o.declarations&&Array.isArray(o.declarations)&&i.push.apply(i,o.declarations),o.arguments&&Array.isArray(o.arguments)&&i.push.apply(i,o.arguments),o.params&&Array.isArray(o.params)&&i.push.apply(i,o.params);else if(o.callee.name&&"require"===o.callee.name){var s=o.arguments;if(s&&Array.isArray(s)&&1===s.length){var a=s[0];if("Literal"===a.type){var u=a.value;r.push(u),o.start&&o.end&&o.start<=e&&o.end>=e&&(n=u)}}}}return{dependencyAtCursor:n,dependencies:r}}Zr.Object=$r,Zr.State=Qr;var rn=function(){return rn=Object.assign||function(t){for(var e,r=1,n=arguments.length;rt){i=!0;break}}catch(o){throw this.verbose&&console.log(r.stateStack),"string"==typeof o&&(o=new Error(o)),r.stateStack.length>0&&(o.node=r.stateStack[r.stateStack.length-1].node),o}if(i){var o=new Error("timeout: spent too long time (> "+t+"ms) to "+e);throw r.stateStack.length>0&&(o.node=r.stateStack[0].node),o}return this.interpreter.value},t.prototype.cleanupProperties=function(t){if(!t)return null;for(var e in this.ignoredPropNames.forEach((function(e){void 0!==t.properties[e]&&delete t.properties[e]})),t.properties)this.cleanupProperty(t.properties[e])||delete t.properties[e];return t.properties},t.prototype.cleanupProperty=function(t){if(on(t))return!0;var e=t;if(e._native)return!0;var r=this.globalScope.properties;if(e.parent===r.Array){for(var n=e.length,i=0;i0}if(e.parent===r.Object){var o=!0;for(var s in e.properties)this.cleanupProperty(e.properties[s])?o=!1:delete e.properties[s];return!o}return!1},t.prototype.restoreProperties=function(t,e){e&&(t.properties=rn(rn({},t.properties),e))},t.prototype.wrap=function(t){if("object"==typeof t&&null!==t&&void 0!==t.constructor&&"string"==typeof t.constructor.className){var e=t.constructor.className,r=this.wrappers[e];if(void 0===r)return;var n=this.interpreter.createObject(r);return n._native=t,n}return this.verbose&&(on(t)||Array.isArray(t)||console.log("wrap complex obj:",String(t))),this.interpreter.nativeToPseudo(t)},t.prototype.unwrap=function(t,e){return"object"==typeof t&&null!==t&&t._native?t._native:this.interpreter.pseudoToNative(t,e)},t.prototype.wrapClass=function(t,e){this.verbose&&console.log("--- wrapping "+e+" ---"),t.className=e;var r=this,n=this.interpreter.createNativeFunction((function(e){var i,o;if(i=r.interpreter.calledWithNew()?this:r.interpreter.createObjectProto(n.properties.prototype),void 0!==e)if(Array.isArray(e))for(var s=0;s0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=this.player.video.duration&&this.stop()},t}();function bn(){return dn(this,void 0,void 0,(function(){return fn(this,(function(t){return vn&&vn.Player?[2,vn]:"undefined"==typeof window?[2,import("songle-api")]:window.Songle&&window.Songle.Player?[2,window.Songle]:[2,new Promise((function(t){var e=!1;window.onSongleAPIReady=function(r){e=!0,t(vn=r)},setTimeout((function(){if(!e){var t=[];document.querySelectorAll("script").forEach((function(e){var r=e.getAttribute("src");r&&r.indexOf("songle.jp/v2/api.js")>=0&&t.push(e)})),t.forEach((function(t){return t.parentElement.removeChild(t)}));var r=document.createElement("script");r.src="https://api.songle.jp/v2/api.js",document.head.appendChild(r)}}),1e3)}))]}))}))}var _n=function(){function t(t){void 0===t&&(t={}),this.options=t,this.wait=50,this.volumeListener={onVolumeUpdate:this.onVolumeUpdate.bind(this)},this.resetProps()}return Object.defineProperty(t.prototype,"songlePlayer",{get:function(){return this._songlePlayer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._songlePlayer&&this._songlePlayer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"withSync",{get:function(){var t,e;return!(!(null===(t=this.options)||void 0===t?void 0:t.accessToken)&&!(null===(e=this.options)||void 0===e?void 0:e.secretToken))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){var t;if(!this._songlePlayer)return 0;if(this.lastPosition>0&&this.lastTime>0)return Date.now()+this.lastPosition-this.lastTime;var e=this._songlePlayer.positionTime;if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var r=this.lastTime,n=this.lastPosition,i=void 0;if(r>0){var o=Date.now()-r;i=Math.max(0,this.wait-o)}else i=this.wait;0===n&&e>=500?e=0:0===r&&e-n>=800&&(e=n+i)}return e},enumerable:!1,configurable:!0}),t.prototype.initialize=function(t){var e,r,n,i=t.player,o=t.updater,s=t.emitter,a=t.altSourceUrl;return dn(this,void 0,void 0,(function(){var t,u,l;return fn(this,(function(c){switch(c.label){case 0:return this.player&&this.player.removeListener(this.volumeListener),this.player=i,this.player.addListener(this.volumeListener),this.updateMediaPosition=o,this.emitter=s,this._songlePlayer?[3,2]:[4,this.initializeSonglePlayer()];case 1:c.sent(),c.label=2;case 2:return t=this.options.headless,u=a||this.options.altSourceUrls&&(null===(e=this.player.data.song)||void 0===e?void 0:e.permalink)&&this.options.altSourceUrls[null===(r=this.player.data.song)||void 0===r?void 0:r.permalink]||void 0,p.isUploaderUrl(u)&&(u=p.getAltSongUrlFromUploaderGuid(p.getUploaderGuid(p.getSongPathFromUrl(u)))),(l=(null===(n=this.player.data.song)||void 0===n?void 0:n.permalink)||u)===u&&(u=void 0),[4,this._songlePlayer.useMedia(l,{headless:t,altSourceUrl:u})];case 3:return c.sent(),this.ignoreSonglePlayerEvents=!0,this._songlePlayer.volume=0*(1-this.player.volume/100)+100*this.player.volume/100,this._songlePlayer.play(),this._songlePlayer.stop(),this.ignoreSonglePlayerEvents=!1,this.resetProps(),[2]}}))}))},t.prototype.resetProps=function(){this.lastPosition=0,this.lastTime=0,this.elapsedTimes=[]},t.prototype.initializeSonglePlayer=function(){var t;return dn(this,void 0,void 0,(function(){var e,r,n,i,o,s,a,u=this;return fn(this,(function(l){switch(l.label){case 0:return e=this.options,r=e.accessToken,n=e.secretToken,(o=this.options.songle)?[3,2]:[4,bn()];case 1:o=l.sent(),l.label=2;case 2:return(i=o).System&&(i.System.showLicense=!1),s=null===(t=this.options)||void 0===t?void 0:t.autoUseMedia,this._songlePlayer=this.withSync?new i.SyncPlayer({mediaElement:this.player.mediaSourceElement,accessToken:r,secretToken:n,autoUseMedia:s}):new i.Player({mediaElement:this.player.mediaSourceElement}),a=!1,this._songlePlayer.on("play",(function(){u.ignoreSonglePlayerEvents||(a=!1,u.handler||(u.startPolling(),u.emitter.onPlay()))})),this._songlePlayer.on("pause",(function(){return dn(u,void 0,void 0,(function(){return fn(this,(function(t){switch(t.label){case 0:return this.ignoreSonglePlayerEvents?[2]:(a=!1,this.stopPolling(),this.emitter.onPause(),this.stopping?(this.stopping=!1,[4,this.updateMediaPosition(0)]):[3,2]);case 1:t.sent(),this.resetProps(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("finish",(function(){return dn(u,void 0,void 0,(function(){return fn(this,(function(t){switch(t.label){case 0:return a=!1,this.handler?(this.stopPolling(),[4,this.updateMediaPosition(0)]):[3,2];case 1:t.sent(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("seek",(function(t){var e=t.data;return dn(u,void 0,void 0,(function(){return fn(this,(function(t){switch(t.label){case 0:return this._songlePlayer.isPlaying?[3,2]:(a=!1,[4,this.updateMediaPosition(e.positionTime)]);case 1:return t.sent(),this.emitter.onSeekComplete(e.positionTime),[3,4];case 2:return a=!0,[4,this.updateMediaPosition(this._songlePlayer.positionTime)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))})),this._songlePlayer.on("mediaSeek",(function(){a&&(u.emitter.onSeekComplete(u.position),a=!1)})),this.withSync&&(this._songlePlayer.on("mediaPlay",(function(){u.handler||(u.startPolling(),u.emitter.onPlay())})),this._songlePlayer.on("mediaFinish",(function(){u.handler&&(u.stopPolling(),u.emitter.onStop())}))),[2]}}))}))},t.prototype.play=function(){if(this._songlePlayer)return this._songlePlayer.play();this.emitter.onPlay()},t.prototype.stop=function(){if(this._songlePlayer)return this.stopping=this._songlePlayer.isPlaying,this._songlePlayer.stop();this.emitter.onStop()},t.prototype.pause=function(){if(this._songlePlayer)return this.stopping=!1,this._songlePlayer.pause();this.emitter.onPause()},t.prototype.seek=function(t){var e=this;this._songlePlayer?(this._songlePlayer.seekTo(t),this.emitter.onSeek(t)):this.updateMediaPosition(t).then((function(){e.emitter.onSeek(t)}))},t.prototype.startPolling=function(){var t,e=this;if(this.lastTime>0){var r=Date.now()-this.lastTime;t=Math.max(0,this.wait-r)}else t=this.wait;this.handler=setTimeout((function(){return dn(e,void 0,void 0,(function(){var e,r,n,i,o,s,a,u,l;return fn(this,(function(c){switch(c.label){case 0:return r=(e=this).lastTime,n=e.lastPosition,i=this._songlePlayer.positionTime,o=!1,"songle-api-html-media-element-media"===(null===(l=this._songlePlayer.media)||void 0===l?void 0:l.dispatcherName)&&(0===n&&i>=500?(i=0,o=!0):0===r&&i-n>=800&&(i=n+t,o=!0)),s=r>0?Date.now()-r:t,this.updateElapsedTimes(s),a=n>0?n+s:i,u=Math.abs(i-a),(a=u>2*this.wait?i:a<=i?.5*(a+i):Math.max(n,i))5*this.wait||(a=this.lastPosition)),o||(this.lastTime=Date.now()),this.lastPosition=a,[4,this.updateMediaPosition(a)];case 1:return c.sent(),this.handler&&this.startPolling(),[2]}}))}))}),t)},t.prototype.updateElapsedTimes=function(t){if(this.elapsedTimes.unshift(t),this.elapsedTimes=this.elapsedTimes.slice(0,10),this.elapsedTimes.length>=10){var e=this.elapsedTimes.reduce((function(t,e){return t+e}))/10;e>5*this.wait&&(this.player.stageScale=Math.max(.25,.9*this.player.stageScale),this.elapsedTimes=[]),e<1.2*this.wait&&this.player.stageScale<1&&(this.player.stageScale=Math.min(1,this.player.stageScale/.9),this.elapsedTimes=[])}},t.prototype.stopPolling=function(){var t;if(this.handler){if(clearTimeout(this.handler),this._songlePlayer)if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var e=this.lastTime,r=this.lastPosition,n=Date.now()-e;this.lastPosition=r+n}else this.lastPosition=this._songlePlayer.positionTime;this.lastTime=0}this.handler=null},t.prototype.dispose=function(){this.player&&this.player.removeListener(this.volumeListener),this._songlePlayer&&(this._songlePlayer.stop(),this._songlePlayer=null)},t.prototype.onVolumeUpdate=function(t){this._songlePlayer&&(this._songlePlayer.volume=t)},t}(),wn=function(){function t(t){this.listeners=[],this.throttleInterval=t&&t.throttleInterval?Number(t.throttleInterval):100}return t.prototype.onVideoLoad=function(t,e){this.listeners.forEach((function(r){return r.onVideoLoad&&r.onVideoLoad(t,e)}))},t.prototype.onSongLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongLoad&&r.onSongLoad(t,e)}))},t.prototype.onSongMapLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongMapLoad&&r.onSongMapLoad(t,e)}))},t.prototype.onSongInfoLoad=function(t,e){var r=!1;this.listeners.forEach((function(n){n.onSongInfoLoad&&(n.onSongInfoLoad(t,e),r=!0)})),r&&console.warn('[TextAlive API] "onSongInfoLoad" event is deprecated; use "onSongMapLoad" event instead')},t.prototype.onVocalAmplitudeLoad=function(t,e){this.listeners.forEach((function(r){return r.onVocalAmplitudeLoad&&r.onVocalAmplitudeLoad(t,e)}))},t.prototype.onValenceArousalLoad=function(t,e){this.listeners.forEach((function(r){return r.onValenceArousalLoad&&r.onValenceArousalLoad(t,e)}))},t.prototype.onLyricsLoad=function(t,e){this.listeners.forEach((function(r){return r.onLyricsLoad&&r.onLyricsLoad(t,e)}))},t.prototype.onTextLoad=function(t,e){this.listeners.forEach((function(r){return r.onTextLoad&&r.onTextLoad(t,e)}))},t.prototype.onAppLoad=function(t){this.listeners.forEach((function(e){return e.onAppLoad&&e.onAppLoad(t)}))},t.prototype.onAppReady=function(t){this.listeners.forEach((function(e){return e.onAppReady&&e.onAppReady(t)}))},t.prototype.onAppParameterUpdate=function(t,e){this.listeners.forEach((function(r){return r.onAppParameterUpdate&&r.onAppParameterUpdate(t,e)}))},t.prototype.onAppMediaChange=function(t,e){this.listeners.forEach((function(r){return r.onAppMediaChange&&r.onAppMediaChange(t,e)}))},t.prototype.onTemplateUpdate=function(t){this.listeners.forEach((function(e){return e.onTemplateUpdate&&e.onTemplateUpdate(t)}))},t.prototype.onTemplateCommit=function(t){this.listeners.forEach((function(e){return e.onTemplateCommit&&e.onTemplateCommit(t)}))},t.prototype.onTemplatesLoad=function(t,e){this.listeners.forEach((function(r){return r.onTemplatesLoad&&r.onTemplatesLoad(t,e)}))},t.prototype.onFontsLoad=function(t,e){this.listeners.forEach((function(r){return r.onFontsLoad&&r.onFontsLoad(t,e)}))},t.prototype.onVideoReady=function(t){this.listeners.forEach((function(e){return e.onVideoReady&&e.onVideoReady(t)}))},t.prototype.onTimerReady=function(t){this.listeners.forEach((function(e){return e.onTimerReady&&e.onTimerReady(t)}))},t.prototype.onStageElementSet=function(t){this.listeners.forEach((function(e){return e.onStageElementSet&&e.onStageElementSet(t)}))},t.prototype.onMediaElementSet=function(t){this.listeners.forEach((function(e){return e.onMediaElementSet&&e.onMediaElementSet(t)}))},t.prototype.onTimeUpdate=function(t){var e=this;this.listeners.forEach((function(e){return e.onTimeUpdate&&e.onTimeUpdate(t)})),this.position=t,this.throttledTimeUpdate||(this.throttledTimeUpdate=new Promise((function(t,r){setTimeout((function(){e.onThrottledTimeUpdate(e.position),e.throttledTimeUpdate=null,t()}),e.throttleInterval)})))},t.prototype.onThrottledTimeUpdate=function(t){this.listeners.forEach((function(e){return e.onThrottledTimeUpdate&&e.onThrottledTimeUpdate(t)}))},t.prototype.onBackgroundGraphicsUpdate=function(t){this.listeners.forEach((function(e){return e.onBackgroundGraphicsUpdate&&e.onBackgroundGraphicsUpdate(t)}))},t.prototype.onMediaSeek=function(t){this.listeners.forEach((function(e){return e.onMediaSeek&&e.onMediaSeek(t)}))},t.prototype.onVideoSeekStart=function(){this.listeners.forEach((function(t){return t.onVideoSeekStart&&t.onVideoSeekStart()}))},t.prototype.onVideoSeekEnd=function(){this.listeners.forEach((function(t){return t.onVideoSeekEnd&&t.onVideoSeekEnd()}))},t.prototype.onVideoSeek=function(t){this.listeners.forEach((function(e){return e.onVideoSeek&&e.onVideoSeek(t)}))},t.prototype.onPlay=function(){this.listeners.forEach((function(t){return t.onPlay&&t.onPlay()}))},t.prototype.onPause=function(){this.listeners.forEach((function(t){return t.onPause&&t.onPause()}))},t.prototype.onSeek=function(t){this.listeners.forEach((function(e){return e.onSeek&&e.onSeek(t)}))},t.prototype.onSeekComplete=function(t){this.listeners.forEach((function(e){return e.onSeekComplete&&e.onSeekComplete(t)}))},t.prototype.onStop=function(){this.listeners.forEach((function(t){return t.onStop&&t.onStop()}))},t.prototype.onDispose=function(){this.listeners.forEach((function(t){return t.onDispose&&t.onDispose()}))},t.prototype.onResize=function(t){this.listeners.forEach((function(e){return e.onResize&&e.onResize(t)}))},t.prototype.onVolumeUpdate=function(t){this.listeners.forEach((function(e){return e.onVolumeUpdate&&e.onVolumeUpdate(t)}))},t.prototype.addListener=function(t){!t||this.listeners.indexOf(t)>=0||this.listeners.push(t)},t.prototype.removeListener=function(t){var e=!1;return this.listeners=this.listeners.filter((function(r){var n=r===t;return e=e||n,!n})),e},t}(),Pn=function(){function t(t,e,r){var n=this;this.player=t,this.manager=e,this.emitter=r,this._defaultBackgroundCss=null,this._background=null,t.addListener({onStageElementSet:function(t){return n.doUpdateBackground(n.background)}})}return Object.defineProperty(t.prototype,"background",{get:function(){return this._background},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultBackgroundCss",{get:function(){return this._defaultBackgroundCss?this._defaultBackgroundCss:""},set:function(t){this._defaultBackgroundCss=t,this.updateBackground(this._background)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return null!==this._background},enumerable:!1,configurable:!0}),t.prototype.settingBackground=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){switch(e.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,e.sent()&&this.doUpdateBackground(t)]}}))}))},t.prototype.setBackground=function(t){return dn(this,void 0,void 0,(function(){var e;return fn(this,(function(r){switch(r.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,(e=r.sent())&&this.updateBackground(e)]}}))}))},t.prototype.doSetBackground=function(t){return dn(this,void 0,void 0,(function(){var e,r,n;return fn(this,(function(i){switch(i.label){case 0:return e=t&&t.originalUrl?t.originalUrl:"",this.manager.isBackgroundColorAsset(t)?[2,{css:e,originalUrl:e}]:this.manager.isBackgroundPiaproImageAsset(t)?[4,this.manager.read(e)]:[3,2];case 1:return(r=i.sent())&&r.url&&this.manager.checkBackgroundImageLicense(r.license)?(r.originalUrl=e,t&&(r.x=t.x,r.y=t.y),[2,r]):[2,{css:"",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,license:r?r.license:void 0}];case 2:return this.manager.isBackgroundSpecialImageAsset(t)?[2,{css:'url("https://api.textalive.jp/images/backgrounds/snowmiku2016/'+(n=/^snowmiku2016-([0-9]{2})$/.exec(e))[1]+'.jpg")',contentUrl:"https://api.textalive.jp/images/backgrounds/snowmiku2016/"+n[1]+".jpg",url:"https://snowmiku.com/2016/info_chara.html",name:"SNOW MIKU 2016",authorName:"豆の素",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,defaultY:0}]:[2,{originalUrl:null,css:"",x:t?t.x:void 0,y:t?t.y:void 0}]}}))}))},t.prototype.updateBackground=function(t){return!!this.doUpdateBackground(t)&&(this.emitter&&this.emitter.onBackgroundGraphicsUpdate&&this.emitter.onBackgroundGraphicsUpdate(t),!0)},t.prototype.doUpdateBackground=function(t){if(!t)return!1;if(!this.player.stageElement)return this._background=t,!0;var e=this.player.stageElement.style;return t.css.length<=0?e.background=this.defaultBackgroundCss:e.background=t.css,"number"==typeof t.x||this._background&&"number"==typeof this._background.x?("number"!=typeof t.x&&(t.x=this._background.x),e.backgroundPositionX=e.backgroundPositionX+"%"):e.backgroundPositionX="number"==typeof t.defaultX?t.defaultX+"%":"center","number"==typeof t.y||this._background&&"number"==typeof this._background.y?("number"!=typeof t.y&&(t.y=this._background.y),e.backgroundPositionY=e.backgroundPositionY+"%"):e.backgroundPositionY="number"==typeof t.defaultY?t.defaultY+"%":"center",e.backgroundSize="cover",this._background=t,!0},t.prototype.export=function(){if(!this.background||!this.background.originalUrl)return null;var t={originalUrl:this.background.originalUrl};return void 0!==this.background.x&&(t.x=this.background.x),void 0!==this.background.y&&(t.y=this.background.y),t},t.prototype.exportPartialVideoEntry=function(t){return{background:this.export()}},t}();function En(t,e,r){return dn(this,void 0,void 0,(function(){var n,i,o,s,a,u,l,c,p,h,d,f,y,v;return fn(this,(function(g){switch(g.label){case 0:if(n={loaded:[],failed:[]},"undefined"==typeof window||!window.document||!window.document.head)return n.failed=t.slice(),[2,n];for(i=r.split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort(),o=!0,s=0,i.forEach((function(t){var r=e.indexOf(t,s);o=o&&r>=0,s=r})),a=window.document.head,u=[],l=0;l0&&(f.google={families:d}),h.length>0&&(f.custom={families:h,urls:p}),g.label=1;case 1:return g.trys.push([1,5,,6]),(v="undefined"!=typeof window&&(null===window||void 0===window?void 0:window.WebFont))?[3,3]:[4,import("webfontloader")];case 2:v=g.sent(),g.label=3;case 3:return y=v,[4,new Promise((function(t){f.active=f.inactive=t,y.load(f)}))];case 4:case 5:return g.sent(),[3,6];case 6:return[2,n]}}))}))}function On(t,e){return dn(this,void 0,void 0,(function(){var r,n,i,o,s,a,u,l;return fn(this,(function(c){switch(c.label){case 0:if(r={loaded:[],failed:[]},!("undefined"!=typeof window&&window.document&&window.document.head&&window.Ts&&window.Ts.loadFontAsync))return r.failed=t.slice(),[2,r];for(n=window.document.head,i={},o=function(t){var e=n.children.item(t);if("style"!==e.tagName.toLowerCase()||"text/css"!==e.getAttribute("type")||"stylesheet"!==e.getAttribute("rel")||!e.hasAttribute("data-cssName"))return"continue";var r=e.getAttribute("data-cssName");if(void 0===i[r])return i[r]=new Set(e.getAttribute("data-text")),{value:void 0};e.getAttribute("data-text").split("").forEach((function(t){return i[r].add(t)}))},s=0;s=0})))]}}))}))},t.prototype.listFontFamiliesInVideo=function(t){if(!t||!t.phrases)return null;var e=[];return t.phrases.forEach((function(t){return t.words.forEach((function(t){return t.characters.forEach((function(t){return e.push(t.fontFamily)}))}))})),e.filter((function(t,e,r){return r.indexOf(t)===e}))},t.prototype.listAvailableFonts=function(){return dn(this,void 0,void 0,(function(){return fn(this,(function(t){return[2,this.fontInfoManager.listAvailableFonts()]}))}))},t.prototype.isLoading=function(){return!!this.queue},t.prototype.load=function(t){return dn(this,void 0,void 0,(function(){var e,r;return fn(this,(function(n){switch(n.label){case 0:return e=[],r=[],t.forEach((function(t){"string"==typeof t?e.push(t):r.push(t)})),[4,this.fontInfoManager.listAvailableFonts()];case 1:return n.sent().forEach((function(t){e.indexOf(t.key)>=0&&r.push(t)})),[2,this.loadFonts(r)]}}))}))},t.prototype.loadFonts=function(t){return dn(this,void 0,void 0,(function(){var e=this;return fn(this,(function(r){return this.queue?(this.listener&&this.listener.onFontsLoad&&this.listener.onFontsLoad(null,new Sn("Failed to load some fonts because there is an ongoing font loding process",this.failed.slice())),[2,this.loaded]):(this.queue=this.doLoad(t).then((function(t){return e.queue=null,t})),[2,this.queue])}))}))},t.prototype.doLoad=function(t){return dn(this,void 0,void 0,(function(){var e,r,n,i,o=this;return fn(this,(function(s){switch(s.label){case 0:return e=[],r=[],[4,this.fontInfoManager.getFrequentChars()];case 1:return n=s.sent(),t.forEach((function(t){t.typesquare||t.typekit||e.push(t),t.typesquare&&r.push(t)})),i=(this.textFetcher&&this.textFetcher()||"").split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort().join(""),[2,Promise.all([En(e,n,i),On(r,i)]).then((function(t){var e=t[0],r=t[1],n=e.loaded.concat(r.loaded);if(o.addLoadedFonts(n),e.failed.length>0||r.failed.length>0){var i=e.failed.concat(r.failed);o.addFailedFonts(i),o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new Sn("Failed to load some fonts",o.failed.slice()))}else o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(n);return o.loaded})).catch((function(t){return o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new Sn(t,o.failed.slice())),o.loaded}))]}}))}))},t.prototype.addLoadedFonts=function(t){var e=this;this._loaded=this.loaded.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t.prototype.addFailedFonts=function(t){var e=this;this._failed=this.failed.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t}(),xn=function(){function t(){}return Object.defineProperty(t.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){return this.contains(t)||this.contains(e)||this.startTime<=t&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?this.startTime===this.endTime?0:(t-this.startTime)/(this.endTime-this.startTime):-1},t}(),An=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return pn(e,t),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.next?this.next.startTime:this.startTime},enumerable:!1,configurable:!0}),e}(xn),Rn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return pn(e,t),e}(xn),Cn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return pn(e,t),e}(xn),Nn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return pn(e,t),e}(xn),kn=function(){function t(t){var e=t.analysis,r=t.info;this.beats=[],this.chords=[],this.segments=[],this.voice=[],this._revisions={beatId:r.beatRevisionId,chordId:r.chordRevisionId,repetitiveSegmentId:r.chorusRevisionId},this.parseBeats(e.beats),this.parseSegments(e.repetitive_segment),this.parseChords(e.chords),e.voice&&this.parseVoice(e.voice)}return Object.defineProperty(t.prototype,"revisions",{get:function(){return this._revisions},enumerable:!1,configurable:!0}),t.prototype.parseBeats=function(t){var e=this;if(Array.isArray(t)&&Array.isArray(t[0])){var r=null,n=0;t[0].forEach((function(t){var i=new An;i.startTime=1e3*t[0],i.length=t[2],i.position=t[3],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.beats.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseChords=function(t){var e=this;if(Array.isArray(t)){var r=null,n=0;t.forEach((function(t){var i=new Rn;i.startTime=1e3*t[0],i.endTime=1e3*t[1],i.name=t[2],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.chords.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseSegments=function(t){var e=this;Array.isArray(t)&&t.forEach((function(t){var r={chorus:!!t.chorus,duration:10*t.segment_length,segments:null},n=null,i=0;r.segments=t.start_frames.map((function(t){var e=new Cn;return e.startTime=10*t,e.endTime=e.startTime+r.duration,e.previous=n,null!==n&&(n.next=e),e.index=i++,n=e,e})),null!==n&&(n.next=null),e.segments.push(r)}))},t.prototype.parseVoice=function(t){var e=this;Array.isArray(t)&&t.forEach((function(t){var r=[],n=null,i=0,o=0;t.forEach((function(t){var e=new Nn;e.startTime=o,e.endTime=e.startTime+10*t[1],e.f0=t[0][0],e.initialF0=t[0][1],e.previous=n,null!==n&&(n.next=e),e.index=i++,r.push(e),n=e,o=e.endTime})),null!==n&&(n.next=null),e.voice.push(r)}))},t}();function jn(t,e,r){for(var n=r&&"number"!=typeof e?r(e):e,i=0,o=t.length;i>>1;(r?r(t[s]):t[s])=e.length?-1:this._vocalAmplitude[r]},t.prototype.getMaxVocalAmplitude=function(){return"number"==typeof this._maxVocalAmplitude?this._maxVocalAmplitude:-1},t.prototype.getValenceArousal=function(t){var e=this._valenceArousal;if(!e)return null;var r=jn(e.seq,t,(function(t){return 1e3*t.t[1]}));if(r<0)return{a:e.seq[0].a,v:e.seq[0].v};if(r+1>=e.seq.length||t<1e3*e.seq[r+1].t[0])return{a:e.seq[Math.min(r,e.seq.length-1)].a,v:e.seq[Math.min(r,e.seq.length-1)].v};var n=e.seq[r],i=e.seq[r+1],o=t/1e3,s=i.t[0],a=n.t[1],u=a-s;return{a:(n.a*(a-o)+i.a*(o-s))/u,v:(n.v*(a-o)+i.v*(o-s))/u}},t.prototype.getMedianValenceArousal=function(){var t=this._valenceArousal;return t?t.stats.median:null},t}(),Un=function(){function t(t,e,r){this.songManager=t,this.options=r,this.listener=e}return Object.defineProperty(t.prototype,"song",{get:function(){return this._song},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"analysis",{get:function(){return this._analysis},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vocalAmplitude",{get:function(){return this._vocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxVocalAmplitude",{get:function(){return this._maxVocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valenceArousal",{get:function(){return this._valenceArousal},enumerable:!1,configurable:!0}),t.prototype.loadSong=function(t,e){var r,n,i;return dn(this,void 0,void 0,(function(){var o,s;return fn(this,(function(a){switch(a.label){case 0:return"number"==typeof t&&t<0||!t?(this.onSongLoad(null,new Error("Neither Songle ID or code provided")),[2,null]):[4,this.songManager.load("number"==typeof t?{id:t}:{code:t})];case 1:return o=a.sent(),this.onSongLoad(o,o?void 0:new Error("Song data not found")),o?(s={chord:null==e?void 0:e.chordId,beat:null==e?void 0:e.beatId,chorus:null==e?void 0:e.repetitiveSegmentId},[4,Promise.all([(null===(r=this.options)||void 0===r?void 0:r.vocalFrequencyEnabled)?this.loadSongDetailInfo(o.song.code,{revisions:s}):this.loadSongInfo(o.song.code,{revisions:s}),(null===(n=this.options)||void 0===n?void 0:n.vocalAmplitudeEnabled)?this.loadVocalAmplitude(o.song.code):Promise.resolve(null),(null===(i=this.options)||void 0===i?void 0:i.valenceArousalEnabled)?this.loadValenceArousal(o.song.code):Promise.resolve(null)])]):[2,null];case 2:return a.sent(),[2,new In(this)]}}))}))},t.prototype.onSongLoad=function(t,e){this._song=t,this.listener&&this.listener.onSongLoad&&this.listener.onSongLoad(t,e)},t.prototype.loadSongInfo=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.loadSongDetailInfo=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadDetailInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.mockSongInfo=function(t){var e=function(t){for(var e=t.beat,r=t.chorusSegment,n=t.duration,i=[],o=0;60*o/e.bpm=0,r=this.managers.lyrics.fetchLyricBody(n||t.url,{parserPath:t.parser_path,directAccess:i}),[4,e?Promise.race([r,new Promise((function(t,e){return setTimeout((function(){return e(new Error("Fetching lyrics text timeout"))}),o.options.lyricsFetchTimeout)}))]):r];case 1:return[2,s.sent()]}}))}))},t.prototype.onLyricsLoad=function(t,e){this.listener&&this.listener.onLyricsLoad&&this.listener.onLyricsLoad(t,e)},t.prototype.onTextLoad=function(t,e){this.listener&&this.listener.onTextLoad&&this.listener.onTextLoad(t,e)},t}(),Ln=function(){function t(t){var e=t.video;this._video=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._video.json},enumerable:!1,configurable:!0}),t}(),Dn=function(){function t(t,e){this.managers=t,this.listener=e,this.listener=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),t.prototype.onVideoLoad=function(t,e){var r=t?Object.assign(t,e):null;return r&&("string"==typeof r.json?r.json=JSON.parse(r.json):"object"==typeof r.json&&null!==r.json||(r.json={}),"string"==typeof r.config?r.config=JSON.parse(r.config):"object"==typeof r.config&&null!==r.config||(r.config={})),this._video=r,this.listener&&this.listener.onVideoLoad&&this.listener.onVideoLoad(r),new Ln({video:r})},t.prototype.createFromVideoId=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,this.managers.video.load(t)];case 1:return r=n.sent(),[2,this.onVideoLoad(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return this.onVideoLoad(t,e)},t.prototype.createFromSongUrl=function(t,e){return dn(this,void 0,void 0,(function(){return fn(this,(function(r){return[2,this.createFromSongPath(this.managers.song.getSongPathFromUrl(t),e)]}))}))},t.prototype.createFromSongPath=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({songPath:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongId=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({id:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongCode=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({code:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSong=function(t,e){var r;return dn(this,void 0,void 0,(function(){var n,i,o,s,a,u;return fn(this,(function(l){switch(l.label){case 0:return n=null==e?void 0:e.lyricId,i=null==e?void 0:e.lyricDiffId,"number"!=typeof n||n<0?[4,this.managers.lyrics.load(t.code)]:[3,4];case 1:return o=l.sent(),(a=o&&!o.status.failed&&!o.status.processing&&Array.isArray(o.lyrics)&&o.lyrics.length>0)?[4,this.managers.lyrics.loadDetail(t.code,o.lyrics[0].id)]:[3,3];case 2:a=l.sent(),l.label=3;case 3:(s=a)&&(n=s.id,i=null===(r=s.diff)||void 0===r?void 0:r.id),l.label=4;case 4:return"number"!=typeof n&&(n=-1),"number"!=typeof i&&(i=-1),u={id:-1,sourceId:-1,sourceOriginId:-1,songleId:t.id,songleCode:t.code,lyricId:n,lyricDiffId:i,title:null,log:null,background:null,config:null,json:null,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null},[2,this.onVideoLoad(u,e)]}}))}))},t.prototype.createFromText=function(t,e){return dn(this,void 0,void 0,(function(){var r,n,i,o,s,a;return fn(this,(function(u){switch(u.label){case 0:return[4,this.managers.text.parse(t)];case 1:return r=u.sent(),n=r&&"success"===r.status?this.createVideoDataFromParsedText(r,t):this.createVideoDataFromText(t),i=n[n.length-1],o=i&&i.words[i.words.length-1],s=o&&o.characters[o.characters.length-1],a=s?s.endTime:0,[2,this.createFromJSON({phrases:n,startTime:0,endTime:a,duration:a},e)]}}))}))},t.prototype.createFromJSON=function(t,e){var r={id:-1,sourceId:-1,sourceOriginId:-1,songleId:-1,lyricId:-1,lyricDiffId:-1,title:null,log:null,background:null,config:null,json:t,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null};return this.onVideoLoad(r,e)},t.prototype.createVideoDataFromParsedText=function(t,e){var r=0,n=e.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/);return t.result.map((function(t,e){return{words:t.map((function(t){return{characters:n[e].substr(t.startPosition,t.wordLength).split("").map((function(t){return{char:t,startTime:300*r,endTime:300*++r}})),pos:t.PoS,rawPoS:t.rawPoS,language:t.language}})),templates:[{type:"DefaultAlignment"}]}}))},t.prototype.createVideoDataFromText=function(t){for(var e,r={characters:[]},n={words:[r],templates:[{type:"DefaultAlignment"}]},i=0,o=[n],s=0;s=0?(this.fontLoader.loadForVideo(null===(t=this.videoProvider)||void 0===t?void 0:t.data),[2]):Array.isArray(null===(e=this.options)||void 0===e?void 0:e.fontFamilies)?(this.fontLoader.load(this.options.fontFamilies),[2]):null===(null===(r=this.options)||void 0===r?void 0:r.fontFamilies)?(this.fontLoader.loadAll(),[2]):[2]}))}))},t.prototype.importLyrics=function(){var t=this.text.replace(/[\s\r\n]/g,""),e=0,r={phrases:this.lyrics.data.map((function(r){return{words:r.map((function(r){return{characters:r.map((function(r){return{char:t.charAt(e++),startTime:1e3*r.start_time,endTime:1e3*r.end_time}}))}}))}}))};this.video.json&&Array.isArray(this.video.json.phrases)?this.video.json.phrases.forEach((function(t,e){t.words.forEach((function(t,n){t.characters.forEach((function(t,i){var o=r.phrases[e].words[n].characters[i];t.char=o.char,t.startTime=o.startTime,t.endTime=o.endTime}))}))})):this.video.json=r},t.prototype.getChoruses=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChoruses()},t.prototype.findChorus=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorusBetween(t,e)},t.prototype.getBeats=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getBeats()},t.prototype.findBeat=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findBeat(t,e)},t.prototype.getChords=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChords()},t.prototype.findChord=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChord(t,e)},t.prototype.getVocalFrequency=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMedianValenceArousal()},t}(),Bn=function(){function t(t,e){this.player=t,this.listener=e,this.initialize()}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?hn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"author",{get:function(){return this._author},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"server",{get:function(){return this._server},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"managed",{get:function(){return!!this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songUrl",{get:function(){return this._songUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songOptions",{get:function(){return this._songOptions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parameters",{get:function(){return this._parameters},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isConnecting",{get:function(){return!!this.connecting},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t,e,r,n;return dn(this,void 0,void 0,(function(){return fn(this,(function(i){switch(i.label){case 0:return this._options=null===(e=null===(t=this.player)||void 0===t?void 0:t.options)||void 0===e?void 0:e.app,this._options&&(this._options=hn({},this._options),this._name=null===(r=this._options)||void 0===r?void 0:r.appName,this._author=null===(n=this._options)||void 0===n?void 0:n.appAuthor,this._options.token&&(_.textalive.appToken=this._options.token)),this._parameters={},this.parseQueryString(),this.initializeServerConnection(),"undefined"!=typeof window&&this._options?[4,this.connect()]:[3,2];case 1:i.sent(),this.initializePlayerListener(),this.initializeMessageListener(),i.label=2;case 2:return this._songUrl&&this.createFromSongUrl(),[2]}}))}))},t.prototype.initializeServerConnection=function(){var t,e,r,n,i,o;return dn(this,void 0,void 0,(function(){var s,a,u,l,c;return fn(this,(function(p){switch(p.label){case 0:return[4,A.getServerStatus()];case 1:return s=p.sent(),a="ja"===(null==s?void 0:s.lang),_.textalive.appToken&&(null==s?void 0:s.app)&&(s.app.data&&(this._name=null===(t=s.app.data)||void 0===t?void 0:t.name,this._author=null===(r=null===(e=s.app)||void 0===e?void 0:e.data)||void 0===r?void 0:r.author,u=null===(i=null===(n=s.app)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status,this._status="number"==typeof u?u:-1),this._server={version:s.version,message:s.app.message,error:s.app.error},!this._server.error)?(l=this._server.message?"\n"+this._server.message:"",a?console.info("[TextAlive API] クライアント v"+_.client.version+" でサーバ v"+(this._server.version||"0.0.0")+" に接続"+l):console.info("[TextAlive API] App API client v"+_.client.version+" connected to server v"+(this._server.version||"0.0.0")+l),this.listener.onAppLoad(this),[2]):(c=(null===(o=this._server)||void 0===o?void 0:o.error)?"\n"+this._server.error:"",a?console.warn("[TextAlive API] このアプリはトークンが正しく指定されていないため動作しません。 https://developer.textalive.jp からトークンを入手して指定してください。"+c):console.warn("[TextAlive API] This app requires a valid app token to run properly. You could get a token from https://developer.textalive.jp."+c),this.listener.onAppLoad(null,c),[2])}}))}))},t.prototype.initializePlayerListener=function(){var t=this;this.playerListener={onVideoReady:function(e){t._host&&window.parent.postMessage({kind:"ta_video",options:{lyrics:!!t.player.data.lyrics,duration:t.player.video.duration}},"*")},onThrottledTimeUpdate:function(e){t._host&&window.parent.postMessage({kind:"ta_position",options:{position:e}},"*")},onPlay:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"play"}},"*")},onPause:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"pause"}},"*")},onStop:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"stop"}},"*")},onDispose:function(){t.dispose()}},this.player.addListener(this.playerListener)},t.prototype.initializeMessageListener=function(){var t=this;this.messageListener=function(e){if(e.data.kind&&/^ta_/.test(e.data.kind)){var r=t.player;switch(e.data.kind.substring("ta_".length)){case"status":switch(e.data.options.status){case"play":r.requestPlay();break;case"pause":r.requestPause();break;case"stop":r.requestStop()}break;case"seek":r.requestMediaSeek(e.data.options.position);break;case"parameter":var n=e.data.options,i=n.name,o=n.value;t.parameters[i]=o,t.listener.onAppParameterUpdate(i,o);break;case"media":t._songUrl=e.data.options.url,t._songOptions=e.data.options.options||{},r.requestStop();var s=t.createFromSongUrl();t.listener.onAppMediaChange(t._songUrl,s)}}},window.addEventListener("message",this.messageListener)},t.prototype.createFromSongUrl=function(){var t,e=this._songOptions;return e&&(t={video:{}},e.altLyricsUrl&&(t.altLyricsUrl=e.altLyricsUrl),e.lyricsDirectAccess&&(t.lyricsDirectAccess=e.lyricsDirectAccess),e.lyricId&&(t.video.lyricId=e.lyricId),e.lyricDiffId&&(t.video.lyricDiffId=e.lyricDiffId),e.chordId&&(t.video.chordId=e.chordId),e.beatId&&(t.video.beatId=e.beatId),e.repetitiveSegmentId&&(t.video.repetitiveSegmentId=e.repetitiveSegmentId)),this.player.createFromSongUrl(this._songUrl,t)},t.prototype.parseQueryString=function(){var t=ln("ta_app_token");t&&(_.textalive.appToken=t),this._songUrl=ln("ta_song_url"),this._songOptions={};var e=ln("ta_lyric_id");e&&(this._songOptions.lyricId=parseInt(e),isNaN(this._songOptions.lyricId)&&delete this._songOptions.lyricId);var r=ln("ta_lyric_diff_id");r&&(this._songOptions.lyricDiffId=parseInt(r),isNaN(this._songOptions.lyricDiffId)&&delete this._songOptions.lyricDiffId);var n=ln("ta_alt_lyrics_url");n&&(this._songOptions.altLyricsUrl=n);var i=ln("ta_lyrics_direct_access");i&&(this._songOptions.lyricsDirectAccess="true"===i,this._songOptions.lyricsDirectAccess||delete this._songOptions.lyricsDirectAccess);var o=ln("ta_chord_id");o&&(this._songOptions.chordId=parseInt(o),isNaN(this._songOptions.chordId)&&delete this._songOptions.chordId);var s=ln("ta_beat_id");s&&(this._songOptions.beatId=parseInt(s),isNaN(this._songOptions.beatId)&&delete this._songOptions.beatId);var a=ln("ta_repetitive_segment_id");a&&(this._songOptions.repetitiveSegmentId=parseInt(a),isNaN(this._songOptions.repetitiveSegmentId)&&delete this._songOptions.repetitiveSegmentId)},t.prototype.connect=function(){return dn(this,void 0,void 0,(function(){var t,e=this;return fn(this,(function(r){switch(r.label){case 0:return this.connecting?[2,this.connecting]:"undefined"!=typeof window&&this.options&&window.parent&&window!==window.parent?[3,2]:[4,new Promise((function(t){return setTimeout(t,1)}))];case 1:return r.sent(),this.listener.onAppReady(this),[2,!1];case 2:return this.connecting=Promise.race([new Promise((function(r){t=function(n){n.data.kind&&/^ta_/.test(n.data.kind)&&"ack"===n.data.kind.substring("ta_".length)&&(window.removeEventListener("message",t),e._host=n.data.options,r(!0))},window.addEventListener("message",t)})),dn(e,void 0,void 0,(function(){var e;return fn(this,(function(r){switch(r.label){case 0:e=0,r.label=1;case 1:return e<5?(window.parent.postMessage({kind:"ta_connect",options:this.options},"*"),[4,new Promise((function(t){return setTimeout(t,200)}))]):[3,4];case 2:if(r.sent(),this._host)return[3,4];r.label=3;case 3:return e++,[3,1];case 4:return!this._host&&t&&window.removeEventListener("message",t),[2,!!this._host]}}))}))]),this.connecting.finally((function(){e.connecting=null,e.listener.onAppReady(e)})),[2,this.connecting]}}))}))},t.prototype.dispose=function(){"undefined"!=typeof window&&this.options&&(this.player.removeListener(this.playerListener),window.removeEventListener("message",this.messageListener)),this._host=null,this.player=null},t}();function Vn(t){return t}function Gn(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0==t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}function qn(t){return function(e){return Math.pow(e,t)}}function Wn(t){return function(e){return 1-Math.pow(1-e,t)}}function Yn(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}var zn=qn(2),Jn=Wn(2),Hn=Yn(2),Xn=qn(3),Zn=Wn(3),$n=Yn(3),Qn=qn(4),Kn=Wn(4),ti=Yn(4),ei=qn(5),ri=Wn(5),ni=Yn(5);function ii(t){return 1-Math.cos(t*Math.PI/2)}function oi(t){return Math.sin(t*Math.PI/2)}function si(t){return-.5*(Math.cos(Math.PI*t)-1)}function ai(t){return function(e){return e*e*((t+1)*e-t)}}var ui=ai(1.7);function li(t){return function(e){return--e*e*((t+1)*e+t)+1}}var ci=li(1.7);function pi(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}var hi=pi(1.7);function di(t){return-(Math.sqrt(1-t*t)-1)}function fi(t){return Math.sqrt(1- --t*t)}function yi(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function vi(t){return 1-gi(1-t)}function gi(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function mi(t){return t<.5?.5*vi(2*t):.5*gi(2*t-1)+.5}function bi(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return-t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)}}var _i=bi(1,.3);function wi(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return t*Math.pow(2,-10*n)*Math.sin((n-i)*r/e)+1}}var Pi=wi(1,.3);function Ei(t,e){var r=2*Math.PI;return function(n){var i=e/r*Math.asin(1/t);return(n*=2)<1?t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)*-.5:t*Math.pow(2,-10*(n-=1))*Math.sin((n-i)*r/e)*.5+1}}var Oi=Ei(1,.3*1.5),Si=Object.freeze({__proto__:null,linear:Vn,get:Gn,getPowIn:qn,getPowOut:Wn,getPowInOut:Yn,quadIn:zn,quadOut:Jn,quadInOut:Hn,cubicIn:Xn,cubicOut:Zn,cubicInOut:$n,quartIn:Qn,quartOut:Kn,quartInOut:ti,quintIn:ei,quintOut:ri,quintInOut:ni,sineIn:ii,sineOut:oi,sineInOut:si,getBackIn:ai,backIn:ui,getBackOut:li,backOut:ci,getBackInOut:pi,backInOut:hi,circIn:di,circOut:fi,circInOut:yi,bounceIn:vi,bounceOut:gi,bounceInOut:mi,getElasticIn:bi,elasticIn:_i,getElasticOut:wi,elasticOut:Pi,getElasticInOut:Ei,elasticInOut:Oi}),Ti=function(){function t(){}return t.linear=Vn,t.get=Gn,t.getPowIn=qn,t.getPowOut=Wn,t.getPowInOut=Yn,t.quadIn=zn,t.quadOut=Jn,t.quadInOut=Hn,t.cubicIn=Xn,t.cubicOut=Zn,t.cubicInOut=$n,t.quartIn=Qn,t.quartOut=Kn,t.quartInOut=ti,t.quintIn=ei,t.quintOut=ri,t.quintInOut=ni,t.sineIn=ii,t.sineOut=oi,t.sineInOut=si,t.getBackIn=ai,t.backIn=ui,t.getBackOut=li,t.backOut=ci,t.getBackInOut=pi,t.backInOut=hi,t.circIn=di,t.circOut=fi,t.circInOut=yi,t.bounceIn=vi,t.bounceOut=gi,t.bounceInOut=mi,t.getElasticIn=bi,t.elasticIn=_i,t.getElasticOut=wi,t.elasticOut=Pi,t.getElasticInOut=Ei,t.elasticInOut=Oi,t}(),xi=function(){function t(){this.cursor=-1,this.widgets=[],this.instances=[],this.model={id:-1,type:o.NONE,sourceId:-1,author:null,originalAuthor:null,className:null,createdDate:null}}return Object.defineProperty(t.prototype,"id",{get:function(){return this.model?this.model.id:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"script",{get:function(){return this.model?this.model.script:null},enumerable:!1,configurable:!0}),t}(),Ai=function(){},Ri=function(){function t(t,e){this.onTemplateLoad=e,this._emitter=null,this._loaded=null,this._loading=null,this.verbose=!1,this._emitter=t,this.clear()}return Object.defineProperty(t.prototype,"loaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this._loading},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this._loaded={},this._loading={}},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),dn(this,void 0,void 0,(function(){var e;return fn(this,(function(r){switch(r.label){case 0:return[4,q.list({maxResults:t,withoutAuthors:!0,withoutOriginalAuthors:!0,script:!0})];case 1:return(e=r.sent())&&e.list?(this.verbose&&console.log("--- loading template classes ---"),[2,this.registerMany(e.list)]):[2]}}))}))},t.prototype.loadForVideo=function(t){return dn(this,void 0,void 0,(function(){var e,r=this;return fn(this,(function(n){switch(n.label){case 0:return[4,q.loadForVideo(t)];case 1:return(e=n.sent())&&e.list?(this.verbose&&console.log("--- loading template classes for vid:"+t+" ---"),[4,this.registerMany(e.list)]):[2,null];case 2:return[2,n.sent().map((function(t){return t?r.getByName(t):null}))]}}))}))},t.prototype.loadByNames=function(t){return dn(this,void 0,void 0,(function(){var e,r=this;return fn(this,(function(n){switch(n.label){case 0:return!Array.isArray(t)||t.length<=0?[2,[]]:(this.verbose&&console.log("--- loading template classes ---"),[4,Promise.all(t.map((function(t){return r.doLoadByName(t)})))]);case 1:return(e=n.sent())&&this._emitter.onTemplatesLoad(e.filter((function(t){return!!t})).map((function(t){return t.className}))),[2,e]}}))}))},t.prototype.loadByName=function(t){return dn(this,void 0,void 0,(function(){var e,r;return fn(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.doLoadByName(t)];case 1:return e=n.sent(),this._emitter.onTemplatesLoad([e.className]),[2,e];case 2:return r=n.sent(),this._emitter.onTemplatesLoad(null,r),[2,null];case 3:return[2]}}))}))},t.prototype.doLoadByName=function(t){return dn(this,void 0,void 0,(function(){var e,r,n=this;return fn(this,(function(i){return null!==(e=this.getByName(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return q.loadByName(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.loadById=function(t){return dn(this,void 0,void 0,(function(){var e,r,n;return fn(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.doLoadById(t)];case 1:return e=i.sent(),r=null,[3,3];case 2:return n=i.sent(),r=n,[3,3];case 3:return this._emitter.onTemplatesLoad(e?[e.className]:null,r),[2,e]}}))}))},t.prototype.doLoadById=function(t){return dn(this,void 0,void 0,(function(){var e,r,n=this;return fn(this,(function(i){return(e=this.getById(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return q.load(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.registerMany=function(t){return dn(this,void 0,void 0,(function(){var e,r,n=this;return fn(this,(function(i){switch(i.label){case 0:return e=t.map((function(t){var e=n.onTemplateLoad(t);return n._loading[t.className]=e,n._loading[t.className+"@"+t.id]=e,e})),[4,Promise.all(e.map((function(t){return t.then((function(t){return t.className})).catch((function(t){return null}))})))];case 1:return r=i.sent().filter((function(t){return!!t})),this._emitter.onTemplatesLoad(r),[2,r]}}))}))},t.prototype.commit=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,q.create({sourceId:t.model.sourceId,script:t.model.script,log:e})];case 1:return(r=n.sent()).success&&(t.model.id=r.id,this._emitter.onTemplateCommit(t.className)),[2,r]}}))}))},t.prototype.getByName=function(t,e){var r;if(void 0===e&&(e=!1),t&&(r=t.match(/(.+)@([0-9]+)/))){t=r[1];var n=parseInt(r[2]);if(!this._loaded[t])return null;var i=this._loaded[t].model;if(i.id!==n){if(!e)return null;this.verbose&&console.log("[warning] template "+t+" version "+n+" is requested but "+i.id+" is used")}}return this._loaded[t]?this._loaded[t]:null},t.prototype.getById=function(t){var e=null;for(var r in this._loaded)if(this._loaded[r].model.id===t){e=this._loaded[r];break}return e},t}(),Ci={Matrix2D:ut,Point:lt,Color:Q,Font:K,RenderingUnit:H,TextUnit:$,Graphic:et,Phrase:nt,Word:rt,Char:tt,Beat:An,RepetitiveSegment:Cn},Ni=["headTime","tailTime","insomnia"],ki=["animate","getAssignedUnit","name","type"],ji=function(){function t(t,e,r){this._emitter=null,this._player=null,this.interpreter=null,this.unsafeAcceleration=!1,this._verbose=!1,this.ignoreVersion=!1,this.rawConsole=!1,this._player=t,this._emitter=e,this.unsafeAcceleration=r,this.loader=new Ri(e,this.register.bind(this)),t.addListener({onVideoReady:this.onVideoReady.bind(this)})}return Object.defineProperty(t.prototype,"verbose",{get:function(){return this._verbose},set:function(t){this._verbose=this.loader.verbose=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return!!this.interpreter},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return this.loader.loaded},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t=this;if(!this.ready){var e=function(t){var e=t.player,r=t.ignoredPropNames,n=t.rawConsole,i=t.templateGetter,s=e.graphics.wrapperTable,a=new an(hn(hn({},Ci),s),r,(function(t,r){return e.graphics.isGraphics(t)&&r instanceof Q?r.toString():r})),u={require:{func:function(t){if(!(t.length<1||"string"!=typeof t[0])){var e=t[0],r=i(e);return null===r?void 0:r.functionDefinition}},raw:!0,isConstructor:!0},print:{func:function(t){e.isEditing&&console.log.apply(console,t)},raw:n},findChorus:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findChorus(t[0])}},findBeat:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findBeat(t[0])}},getVocalFrequency:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getVocalFrequency(t[0])}},getVocalAmplitude:{func:function(t){return t.length<1||"number"!=typeof t[0]?-1:e.getVocalAmplitude(t[0])}},getMaxVocalAmplitude:{func:function(t){return e.getMaxVocalAmplitude()}},getValenceArousal:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getValenceArousal(t[0])}},getMedianValenceArousal:{func:function(t){return e.getMedianValenceArousal()}}};Object.keys(o).forEach((function(t){a.setProperty(a.globalScope,t,o[t]),u[t]={value:o[t]}})),Object.keys(Si).forEach((function(t){var e=Si[t];0!==t.indexOf("get")&&(u[t]={func:e})}));var l=Object.keys(a.wrapperTable);return l&&l.forEach((function(t){return u[t]={cls:a.wrapperTable[t]}})),Object.keys(u).forEach((function(t){var e=u[t];e.func?a.createGlobalFunction(t,e):e.value&&a.setProperty(a.globalScope,t,e.value)})),{interpreter:a,unsafeGlobalScope:u}}({player:this._player,ignoredPropNames:ki,rawConsole:this.rawConsole,templateGetter:function(e){return t.getByName(e,!0)}}),r=e.interpreter,n=e.unsafeGlobalScope;this.unsafeGlobalScope=n,this.interpreter=r,this.onVideoReady(this._player.video)}},t.prototype.getByName=function(t,e){return void 0===e&&(e=!1),this.loader.getByName(t,e)},t.prototype.getById=function(t){return this.loader.getById(t)},t.prototype.clear=function(){this.loader.clear()},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),dn(this,void 0,void 0,(function(){return fn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadLatest(t)]}))}))},t.prototype.loadForVideo=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadForVideo(t)]}))}))},t.prototype.loadByNames=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByNames(t)]}))}))},t.prototype.loadByName=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByName(t)]}))}))},t.prototype.loadById=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadById(t)]}))}))},t.prototype.commit=function(t,e){return dn(this,void 0,void 0,(function(){return fn(this,(function(r){return[2,this.loader.commit(t,e)]}))}))},t.prototype.register=function(t){return dn(this,void 0,void 0,(function(){var e,r,n,i,o,s,a,u=this;return fn(this,(function(l){switch(l.label){case 0:if(!t)return[2,null];if("number"==typeof t.sourceId){if(e=t,!(r=this.createClass(t.script)))return[2,null]}else r=t;n=en(r.ast).dependencies,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Promise.all(n.map((function(t){var e=u.getByName(t,u.ignoreVersion);return e?Promise.resolve(e):u.loadByName(t)})))];case 2:return l.sent(),this.verbose&&console.log("load dependencies for",r.className,n),[3,4];case 3:return i=l.sent(),this.verbose&&console.error("failed loading dependencies for",r.className,i),[3,4];case 4:try{if(o=void 0,e?(o=this.newRawInstance(r),r.model=e):o=this.createModel(r),!o)throw new Error("failed to create a template instance");return[2,this.registerClass(r)]}catch(t){throw s=void 0,e&&(delete(a=hn({},e)).script,s=a),{error:t.message,stack:t.stack,cause:s}}return[2]}}))}))},t.prototype.updateClassScript=function(t,e){var r=this.createClass(e);return this.updateClass(t,r)},t.prototype.registerClass=function(t){if(!t)return null;if(this.loader.loaded[t.className]){this.verbose&&console.log("updating",t.className,t.model.id);var e=this.updateClass(this.loader.loaded[t.className],t);return this.verbose&&console.log("updated",e.className,e.id),e}return this.loader.loaded[t.className]=t,this.verbose&&console.log("loaded",t.className,t.model.id),t},t.prototype.updateClass=function(t,e){var r=t,n=e;if(!n)return null;if(r.model.script===n.model.script)return this.verbose&&console.log("no diff for",r.className),r;if(!this.createModel(n))return null;if(r.className!==n.className){var i=this.getByName(n.className);if(!i)return n.cursor=r.cursor,this.loader.loaded[n.className]=n,this.verbose&&console.log("create",n.className),n;r=i}return r.newStatement=n.newStatement,r.widgets=n.widgets,r.scope=n.scope,r.functionDefinition=n.functionDefinition,r.newStatement=n.newStatement,r.unsafeConstructorGenerator=n.unsafeConstructorGenerator,r.ast=n.ast,r.cursor<0&&(r.cursor=n.cursor),n.id>=0?(this.verbose&&console.log("replace",n.className,r.id,n.id),r.model=n.model):(this.verbose&&console.log("update",n.className,r.id,n.id),r.model.type=n.model.type,r.model.className=n.model.className,r.model.prettyName=n.model.prettyName,r.model.script=n.model.script,r.model.createdDate=null,r.id>=0&&(r.model.sourceId=r.model.id,r.model.id=-1)),n=r,this.updateInstances(r.instances.slice(),n),this._emitter.onTemplateUpdate(n.className),n},t.prototype.createModel=function(t){var e=this.newRawInstance(t);if(null===e)return!1;if(t.id>=0)return!0;var r=e.templateInstance,n=t.model.script;return t.model={id:-1,sourceId:-1,className:t.className,prettyName:r?this.interpreter.getProperty(r,"name"):e.unsafeTemplateInstance.name,type:r?this.interpreter.getProperty(r,"type"):e.unsafeTemplateInstance.type,script:n,author:null,originalAuthor:null,createdDate:null},e},t.prototype.updateInstances=function(t,e){var r=this;t.forEach((function(t){try{r.updateInstance(t,e)}catch(r){console.log("failed updating template for",t.assignedUnit,":",e)}})),this._player.isPlaying||this._player.requestStageUpdate()},t.prototype.createClass=function(t){var e=this;this.ready||this.initialize();var r=new xi;r.model={id:-1,sourceId:-1,className:null,prettyName:null,type:0,script:t,author:null,originalAuthor:null,createdDate:null};var n=tn(t,ki),i=n.ast,o=n.widgets;if(r.ast=i,r.widgets=o,r.className=r.ast.body[0].id.name,r.scope=this.interpreter.prepareRun(r.ast),this.interpreter.run(1e3,"to define "+r.className),r.functionDefinition=this.interpreter.getRawProperty(r.scope,r.className),r.newStatement=this.interpreter.newStatementFor(r.className),this.unsafeAcceleration){var s=Object.keys(this.unsafeGlobalScope),a="return function(props){var "+Object.keys(this.getGlobalProperties()).map((function(t){return t+"=props."+t})).join(",")+";"+t+"return "+r.className+";}",u=new(Function.bind.apply(Function,yn(yn([void 0],s,!1),[a],!1))),l=function(t){var r=e.getByName(t);return r?r.unsafeConstructorGenerator(e.getGlobalProperties()):null},c=s.map((function(t){if("require"===t)return l;var r=e.unsafeGlobalScope[t];return r.func?function(){for(var t=[],e=0;e8&&(g=g.substring(0,8)),!(t.indexOf(g)<0););c.length>h&&c[h].length>0&&c.splice(h,0,""),c.splice(h,0,"",p+"// @proposed",p+"// @title "+e,p+"// "+function(t,e){if("Slider"===t)return"@ui Slider("+e.min+", "+e.max+")";if("Check"===t)return"@ui Check()";if("Color"===t)return"@ui Color()";var r=e.etc;return"@comment "+(r=r.replace(/(\r\n|[\n\v\f\r\x85\u2028\u2029])/g,"")).replace(/\/[*/]/g,"")}(r,n),p+"this."+g+" = "+function(t,e){return"Slider"===t?((e.min+e.max)/2).toString():"Check"===t?"false":"Color"===t?'new Color("#000000")':"null"}(r,n)+";"),t=c.join(l)}catch(t){}return t}(t.model.script,e,r,n))},t.prototype.onVideoReady=function(t){this.ready&&(this.interpreter.setRawProperty(this.interpreter.globalScope,"width",this._player.resolutionWidth),this.interpreter.setRawProperty(this.interpreter.globalScope,"height",this._player.resolutionHeight),this.interpreter.setRawProperty(this.interpreter.globalScope,"margin",this.interpreter.wrap(this._player.margin)),this.interpreter.setRawProperty(this.interpreter.globalScope,"duration",(null==t?void 0:t.duration)||0))},t}(),Ii=function(t){function e(e,r){var n=this.constructor,i=t.call(this,e)||this;return i.video=r,Object.setPrototypeOf(i,n.prototype),i}return pn(e,t),e}(Error),Ui=function(){this.halted=[],this.errors=[]},Fi=function(){function t(t,e){var r=this;this.listener=e,this.player=null,this._scale=1,this.playerListener={onResize:function(t){r.elementWidth=t.width,r.updateSize()},onVideoReady:function(){r.elementWidth=r.calcWidth(),r.updateSize()},onStageElementSet:function(t){r.elementWidth=r.calcWidth(),r.updateSize(),r.player.graphics.setCanvas(t)},onDispose:function(){r.dispose()}},this.requestedTime=0,this.request=null,this.player=t,t.addListener(this.playerListener)}return Object.defineProperty(t.prototype,"scale",{get:function(){return this._scale},set:function(t){this._scale=t,this.updateSize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.player.graphics.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.player.graphics.height},enumerable:!1,configurable:!0}),t.prototype.requestUpdate=function(t){return dn(this,void 0,void 0,(function(){var e=this;return fn(this,(function(r){return this.requestedTime=void 0===t?this.player.videoPosition:t,this.request||(this.request=new Promise((function(t){setTimeout((function(){try{e.update(e.requestedTime)}catch(t){}e.request=null,t(e.requestedTime)}),0)}))),[2,this.request]}))}))},t.prototype.update=function(t){t||(t=this.player.mediaPosition),"number"==typeof t&&(this.player.graphics.reset(),this.animate(t),this.player.graphics.update(),this.listener.onStageUpdate(t))},t.prototype.animate=function(t){for(var e=new Ui,r=e.errors,n=e.halted,i=0,o=[this.player.video.firstCredit,this.player.video.firstPhrase,this.player.video.firstWord,this.player.video.firstChar,this.player.video.firstGraphic];i0){console.error("---");for(var a=0;a0&&(!s.rendering.visible||0===s.rendering.alpha))return void(e.rendering.visible=!1);s=s.parent}var a=this.player.templates.getProperty(r,"insomnia"),u=Li(e);if(!a&&u){var l=function(t,e,r,n){var i=n&&t(n,"headTime")||500,s=n&&t(n,"tailTime")||500;return!(r.startTime-i<=e&&r.endTime+s>=e)&&(r.getType()!==o.GRAPHIC&&(r.rendering.visible=!1),!0)}((function(t,e){return i.player.templates.getProperty(t,e)}),t,e,r);if(l)return}this.doAnimateTemplate(t,r,n)}},t.prototype.doAnimateTemplate=function(t,e,r){var n=r.errors,i=r.halted;try{this.player.templates.exec(e,"animate",[t])}catch(t){n.push(t),i.push(e)}},t.prototype.calcWidth=function(){var t=this.player.stageElement;if(!t)return 0;var e=window.getComputedStyle(t);return t.offsetWidth-un(e.borderLeftWidth)-un(e.borderRightWidth)-un(e.paddingLeft)-un(e.paddingRight)},t.prototype.updateSize=function(){var t=this.player.stageElement;if(t){var e=this.elementWidth*this.player.videoProportion;if(t.style.height=e+"px",t.width=this.elementWidth*this._scale,t.height=e*this._scale,this.player.video){var r=t.width/this.player.videoWidth;this.player.graphics.updateStageTx(r,this.player.margin),this.player.isPlaying||this.requestUpdate()}}},t.prototype.dispose=function(){this.player.removeListener(this.playerListener),this.player=null},t}();function Li(t){if(t.getType()===o.GRAPHIC)return!0;for(var e=!0,r=t.parent;r;){if(r.templateCount>0){e=!1;break}r=r.parent}return e}var Di='',Mi="https://textalive.jp",Bi=function(){function t(t){var e,r=this;if(this.player=t,this._position="embed",this._rounded=!1,this._bordered=!1,this._shadowed=!1,this._background="#fff",this._color="#1f4391",void 0!==(null===(e=t.options)||void 0===e?void 0:e.mediaBannerPosition)&&(this._position=t.options.mediaBannerPosition),this.domEnabled){this.logoAnchor=document.createElement("a"),this.logoAnchor.className="textalive-logo",this.logoAnchor.innerHTML=Di,this.logoAnchor.style.padding=this.bordered?"1px 2px":"1px 3px",this.logoAnchor.href=Mi,this.logoAnchor.target="_blank",this.logoAnchor.title="Powered by TextAlive App API",this.logoSvg=this.logoAnchor.querySelector("svg"),this.logoSvg.style.width="24px",this.songNameDiv=document.createElement("div"),this.songNameDiv.className="name",this.songNameDiv.style.fontWeight="bold",this.songNameDiv.style.overflow="hidden",this.songNameDiv.style.textOverflow="ellipsis",this.songNameDiv.style.marginBottom="2px",this.songNameDiv.textContent="-",this.songArtistDiv=document.createElement("div"),this.songArtistDiv.className="artist",this.songArtistDiv.textContent="-",this.songArtistDiv.style.overflow="hidden",this.songArtistDiv.style.textOverflow="ellipsis";var n=document.createElement("span");n.innerHTML='',n.style.padding="0 3px 0 0",this.songSvg=n.querySelector("svg"),this.songSvg.style.width="14px",this.songWrapper=document.createElement("div"),this.songWrapper.style.width="203px",this.songWrapper.style.maxWidth="203px",this.songWrapper.appendChild(this.songNameDiv),this.songWrapper.appendChild(this.songArtistDiv),this.songAnchor=document.createElement("a"),this.songAnchor.className="song",this.songAnchor.target="_blank",this.songAnchor.style.display="flex",this.songAnchor.style.lineHeight="1.2em",this.songAnchor.style.padding="4px 3px 3px 3px",this.songAnchor.style.textDecoration="none",this.songAnchor.appendChild(n),this.songAnchor.appendChild(this.songWrapper),this.lyricsNameDiv=document.createElement("div"),this.lyricsNameDiv.className="name",this.lyricsNameDiv.style.fontWeight="bold",this.lyricsNameDiv.textContent="-",this.lyricsNameDiv.style.overflow="hidden",this.lyricsNameDiv.style.textOverflow="ellipsis",this.lyricsNameDiv.style.marginBottom="2px",this.lyricsArtistDiv=document.createElement("div"),this.lyricsArtistDiv.className="artist",this.lyricsArtistDiv.textContent="-",this.lyricsArtistDiv.style.overflow="hidden",this.lyricsArtistDiv.style.textOverflow="ellipsis";var i=document.createElement("span");i.innerHTML='',i.style.padding="0 3px 0 0",this.lyricsSvg=i.querySelector("svg"),this.lyricsSvg.style.width="14px",this.lyricsWrapper=document.createElement("div"),this.lyricsWrapper.style.width="90px",this.lyricsWrapper.style.maxWidth="90px",this.lyricsWrapper.appendChild(this.lyricsNameDiv),this.lyricsWrapper.appendChild(this.lyricsArtistDiv),this.lyricsAnchor=document.createElement("a"),this.lyricsAnchor.className="lyrics",this.lyricsAnchor.target="_blank",this.lyricsAnchor.style.display="flex",this.lyricsAnchor.style.lineHeight="1.2em",this.lyricsAnchor.style.padding="4px 3px 3px 3px",this.lyricsAnchor.style.textDecoration="none",this.lyricsAnchor.appendChild(i),this.lyricsAnchor.appendChild(this.lyricsWrapper),this.bannerDiv=document.createElement("div"),this.bannerDiv.className="textalive-banner",this.bannerDiv.style.cursor="pointer",this.bannerDiv.style.zIndex="10000",this.bannerDiv.style.background="#1f4391",this.bannerDiv.style.lineHeight="0",this.bannerDiv.style.display="flex",this.bannerDiv.style.maxWidth="256px",this.bannerDiv.style.fontFamily="'Hiragino Kaku Gothic Pro','游ゴシック体','Yu Gothic',YuGothic,Meiryo,HelveticaNeue,'Helvetica Neue',Helvetica,Arial,sans-serif",this.bannerDiv.style.fontSize="9px",this.bannerDiv.style.alignItems="center",this.bannerDiv.style.whiteSpace="nowrap",this.bannerDiv.appendChild(this.logoAnchor),this.bannerDiv.appendChild(this.songAnchor),this.bannerDiv.appendChild(this.lyricsAnchor),this.songAnchor.style.display="none",this.lyricsAnchor.style.display="none",this.updatePosition(),this.updateRounded(),this.updateBordered(),this.updateShadowed(),this.updateBackground(),this.updateColor()}this.listener={onAppReady:function(){r.updatePosition()},onMediaElementSet:function(t){r.domEnabled&&(r.bannerDiv&&r.bannerDiv.parentElement&&r.bannerDiv.parentElement.removeChild(r.bannerDiv),r.player.mediaBannerElement&&r.player.mediaBannerElement.appendChild(r.bannerDiv))},onVideoLoad:function(){r.domEnabled&&(r.logoAnchor.href=Mi,r.songAnchor.style.display="none",r.lyricsAnchor.style.display="none",r.songAnchor.style.borderRadius="0")},onSongLoad:function(t){return dn(r,void 0,void 0,(function(){var e,r,n,i,o,s,a,u,l;return fn(this,(function(c){switch(c.label){case 0:return t?(e=null===(a=null===(s=null==t?void 0:t.song)||void 0===s?void 0:s.artist)||void 0===a?void 0:a.name,r=null===(u=null==t?void 0:t.song)||void 0===u?void 0:u.name,n=null===(l=null==t?void 0:t.song)||void 0===l?void 0:l.permalink,i=Mi+(n?"/songs/"+encodeURIComponent(p.getSongPathFromUrl(n)):""),this.domEnabled&&(this.logoAnchor.href=i,this.songArtistDiv.textContent=Vi(e),this.songNameDiv.textContent=Vi(r),this.songAnchor.title=Vi(r)+" by "+Vi(e),this.songAnchor.href=n,this.songAnchor.style.display="flex",this.songAnchor.style.borderRadius=this.rounded?"0 4px 4px 0":"0",this.songWrapper.style.width="auto"),[4,A.getServerStatus()]):[2];case 1:return"ja"===(null==(o=c.sent())?void 0:o.lang)?console.warn("[TextAlive API] 楽曲 アーティスト:",Vi(e),"/ 楽曲名:",Vi(r),"/ 配信元サイト:",Vi(n)):console.warn("[TextAlive API] Song artist:",Vi(e),"/ song name:",Vi(r),"/ distributed at:",Vi(n)),[2]}}))}))},onLyricsLoad:function(t){t&&(r.songWrapper.style.maxWidth="90px",r.lyricsAnchor.style.display="flex",r.songAnchor.style.borderRadius="0")},onTextLoad:function(t){return dn(r,void 0,void 0,(function(){var e,r,n,i,o;return fn(this,(function(s){switch(s.label){case 0:return t?(e=null===(o=null==t?void 0:t.artist)||void 0===o?void 0:o.name,r=null==t?void 0:t.name,n=null==t?void 0:t.url,this.domEnabled&&(this.lyricsArtistDiv.textContent=Vi(e),this.lyricsNameDiv.textContent=Vi(r),this.lyricsAnchor.title=Vi(r)+" by "+Vi(e),this.lyricsAnchor.href=n,this.lyricsWrapper.style.width="auto"),[4,A.getServerStatus()]):[2];case 1:return"ja"===(null==(i=s.sent())?void 0:i.lang)?console.warn("[TextAlive API] 歌詞 アーティスト:",Vi(e),"/ 歌詞名:",Vi(r),"/ 配信元サイト:",Vi(n)):console.warn("[TextAlive API] Song lyrics artist:",Vi(e),"/ lyrics name:",Vi(r),"/ distributed at:",Vi(n)),[2]}}))}))},onDispose:function(){this.dispose()}},t.addListener(this.listener),t.mediaBannerElement&&this.player.mediaBannerElement.appendChild(this.bannerDiv)}return Object.defineProperty(t.prototype,"domEnabled",{get:function(){return"undefined"!=typeof window},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(t){this._position=t,this.updatePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rounded",{get:function(){return this._rounded},set:function(t){this._rounded=t,this.updateRounded()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bordered",{get:function(){return this._bordered},set:function(t){this._bordered=t,this.updateBordered()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowed",{get:function(){return this._shadowed},set:function(t){this._shadowed=t,this.updateShadowed()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(t){this._background=t,this.updateBackground()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this.updateColor()},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.player.removeListener(this.listener)},t.prototype.updatePosition=function(){var t,e;if(this.domEnabled){var r=this.position,n=this.player;if(null===r||!(null===(t=n.options)||void 0===t?void 0:t.app)||(null===(e=n.app)||void 0===e?void 0:e.managed))this.bannerDiv.style.display="none";else if(this.bannerDiv.style.display="flex","embed"===r)this.bannerDiv.style.position="initial",this.bannerDiv.style.marginTop="4px",this.songAnchor.style.flexGrow="1",this.lyricsAnchor.style.flexGrow="1";else{this.bannerDiv.style.position="fixed",this.bannerDiv.style.marginTop="0";var i=r.indexOf("top")>=0,o=r.indexOf("right")>=0,s=r.indexOf("bottom")>=0,a=r.indexOf("left")>=0;this.bannerDiv.style.top=i?"4px":"initial",this.bannerDiv.style.right=o?"4px":"initial",this.bannerDiv.style.bottom=s?"4px":"initial",this.bannerDiv.style.left=a?"4px":"initial",this.songAnchor.style.flexGrow="0",this.lyricsAnchor.style.flexGrow="0"}}},t.prototype.updateRounded=function(){if(this.domEnabled){var t=this.rounded;this.logoSvg.style.borderRadius=t?"4px 0 0 4px":"0",this.lyricsAnchor.style.borderRadius=t?"0 4px 4px 0":"0",this.bannerDiv.style.borderRadius=t?"4px":"0"}},t.prototype.updateBordered=function(){if(this.domEnabled){var t=this.bordered;this.logoAnchor.style.padding=t?"1px 2px":"1px 3px",this.bannerDiv.style.border=t?"1px solid rgba(31, 67, 145, 0.3)":"none"}},t.prototype.updateShadowed=function(){if(this.domEnabled){var t=this.shadowed;this.bannerDiv.style.boxShadow=t?"1px 1px 3px 0 rgba(9, 19, 42, 0.9)":"none"}},t.prototype.updateBackground=function(){this.domEnabled&&(this.songAnchor.style.background=this.background,this.lyricsAnchor.style.background=this.background)},t.prototype.updateColor=function(){this.domEnabled&&(this.songSvg.style.fill=this.color,this.songAnchor.style.color=this.color,this.lyricsSvg.style.fill=this.color,this.lyricsAnchor.style.color=this.color)},t}();function Vi(t){return t&&""!==t?t:"-"}function Gi(t,e){var r=e.parser;return dn(this,void 0,void 0,(function(){var e,n,i;return fn(this,(function(o){switch(o.label){case 0:return t&&t.length>0&&t[0].words&&t[0].words.length>0&&t[0].words[0]&&!t[0].words[0].pos?(e=t.map((function(t){return t.words.map((function(t){return t.characters.map((function(t){return t.char})).join("")})).join(" ")})),n=e.join("\n"),[4,r(n)]):[2];case 1:return(i=o.sent())&&"success"===i.status?(t.forEach((function(t,r){var n=i.result[r],o=0;t.words.forEach((function(t){var i=t.characters.map((function(t){return t.char})).join(""),s=e[r].indexOf(i,o);if(!(s<0)){o=s;var a=n.find((function(t){return t.startPosition<=s&&t.endPosition>=s}));a&&(t.pos=a.PoS,t.rawPoS=a.rawPoS,t.language=a.language)}}))})),[2]):[2]}}))}))}function qi(t){for(;t.firstElementChild;)t.removeChild(t.firstElementChild)}function Wi(t,e){var r=e.id,n=e.data,i=e.loader,o=e.deserializer;return dn(this,void 0,void 0,(function(){return fn(this,(function(e){switch(e.label){case 0:return r&&r>=0?[4,i(r)]:[3,2];case 1:e.sent(),e.label=2;case 2:return o(t,n),[2]}}))}))}function Yi(t){return"string"!=typeof t?t:"undefined"==typeof window?null:document.querySelector(t)}var zi=function(){function t(t){this._mediaPosition=0,this._videoPosition=0,this.isEditing=!1,this._isVideoSeeking=!1,this._volume=100,this._options=t,this.emitter=new wn(t),this._templates=new ji(this,this.emitter,t&&t.unsafeAcceleration);var e=Object.assign({},Y);t&&t.managers&&(e=Object.assign(e,t.managers)),this.managers=e,this._timer=t&&t.timer||this.createDefaultTimer(),this._data=new Mn(e,this.emitter,t),this._backgroundGraphics=new Pn(this,e.asset,this.emitter),this._graphics=t&&t.graphics||this.createDefaultGraphicsDriver(),this.stage=new Fi(this,{onStageUpdate:this.onStageUpdate.bind(this)}),this._banner=new Bi(this),this.stageElement=Yi(null==t?void 0:t.stageElement)||null,this.mediaElement=Yi(null==t?void 0:t.mediaElement)||null,this._app=new Bn(this,this.emitter)}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?hn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return this._app},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundGraphics",{get:function(){return this._backgroundGraphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"templates",{get:function(){return this._templates},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphics",{get:function(){return this._graphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageElement",{get:function(){return this._stageElement},set:function(t){this._stageElement=t,this.emitter.onStageElementSet(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageScale",{get:function(){return this.stage.scale},set:function(t){this.stage.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaElement",{get:function(){return this._mediaElement},set:function(t){this.updateMediaElement(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaSourceElement",{get:function(){return this._mediaSourceElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaBannerElement",{get:function(){return this._mediaBannerElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaPosition",{get:function(){return this._mediaPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoPosition",{get:function(){return this._videoPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wait",{get:function(){return this._timer?this._timer.wait:0},set:function(t){this._timer&&(this._timer.wait=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fps",{get:function(){return 1e3/this.wait},set:function(t){this.wait=1e3/t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionWidth",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.width?this._data.video.config.width:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.width)?this._options.defaultVideoSize.width:1280},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionHeight",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.height?this._data.video.config.height:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.height)?this._options.defaultVideoSize.height:720},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionProportion",{get:function(){return this.resolutionHeight/this.resolutionWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"margin",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&this._data.video.config.margin?this._data.video.config.margin:(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.margin)||gn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoWidth",{get:function(){var t=this.resolutionWidth,e=this.margin;return t+e[1]+e[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoHeight",{get:function(){var t=this.resolutionHeight,e=this.margin;return t+e[0]+e[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoProportion",{get:function(){return this.videoHeight/this.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageWidth",{get:function(){return this.stage.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageHeight",{get:function(){return this.stage.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return!!this._videoPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._timer&&this._timer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVideoSeeking",{get:function(){return this._isVideoSeeking},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"banner",{get:function(){return this._banner},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timer",{get:function(){return this._timer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volume",{get:function(){return this._volume},set:function(t){isNaN(t)||(this._volume=Math.min(100,Math.max(0,t)),this.emitter.onVolumeUpdate(this._volume))},enumerable:!1,configurable:!0}),t.prototype.createDefaultTimer=function(){try{if("undefined"!=typeof window&&"basic"!==ln("ta_timer"))return new _n}catch(t){}return new mn},t.prototype.createDefaultGraphicsDriver=function(){return new ht},t.prototype.addListener=function(t){return this.emitter.addListener(t)},t.prototype.removeListener=function(t){return this.emitter.removeListener(t)},t.prototype.createFromVideoId=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideoId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideoId=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,(r=new Mn(this.managers,this.emitter,this._options)).createFromVideoId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideo(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideo=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){return(r=new Mn(this.managers,this.emitter,this._options)).createFromVideo(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.createFromSongUrl=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongUrl(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongUrl=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,(r=new Mn(this.managers,this.emitter,this._options)).createFromSongUrl(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongPath=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongPath(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongPath=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,(r=new Mn(this.managers,this.emitter,this._options)).createFromSongPath(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongId=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongId=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,(r=new Mn(this.managers,this.emitter,this._options)).createFromSongId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongCode=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongCode(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongCode=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,(r=new Mn(this.managers,this.emitter,this._options)).createFromSongCode(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromText=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromText(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromText=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){switch(n.label){case 0:return[4,(r=new Mn(this.managers,this.emitter,this._options)).createFromText(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromJSON=function(t,e){return dn(this,void 0,void 0,(function(){var r=this;return fn(this,(function(n){return[2,this.create((function(){return r.doCreateFromJSON(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromJSON=function(t,e){return dn(this,void 0,void 0,(function(){var r;return fn(this,(function(n){return(r=new Mn(this.managers,this.emitter,this._options)).createFromJSON(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.create=function(t,e){return dn(this,void 0,void 0,(function(){var r,n=this;return fn(this,(function(i){if(this._videoPromise&&!e)throw new Ii("Player.createFrom* method calls cannot run in parallel",this._videoPromise);return r=t(),e||(this._videoPromise=r,r.finally((function(){return n._videoPromise=null}))),[2,r]}))}))},t.prototype.finalize=function(t,e){return dn(this,void 0,void 0,(function(){var r,n,i,o=this;return fn(this,(function(s){switch(s.label){case 0:return t.video?[4,Promise.all([t.finalize(e),this.backgroundGraphics.setBackground(t.video.background)])]:[2,null];case 1:return s.sent(),(null==e?void 0:e.dryRun)?[2,null]:(r=t.video.json,function(t,e){var r=e.config,n=e.song;r&&"object"==typeof r&&"number"==typeof r.duration?t.duration=r.duration:n?t.duration=1e3*n.length:t.duration||(t.duration=t.endTime)}(n=new ot(r),{config:t.video.config,song:t.song}),[4,Promise.all([this.graphics.createRuntime(n),Wi(n,{id:t.video.id,data:r,loader:function(t){return dn(o,void 0,void 0,(function(){return fn(this,(function(e){switch(e.label){case 0:return[4,this.templates.loadForVideo(t)];case 1:return e.sent(),[2]}}))}))},deserializer:function(t,e){return o.templates.importInstances(t,e)}}),Gi(null==r?void 0:r.phrases,{parser:R.parse.bind(R)})])]);case 2:return s.sent(),this._data,this._video&&this.templates.disposeInstances(this._video),this._data=t,this._video=n,this.emitter.onVideoReady(n),i=(null==e?void 0:e.altSourceUrl)||void 0,[4,this._timer.initialize({player:this,updater:this.updateMediaPosition.bind(this),emitter:this.emitter,altSourceUrl:i})];case 3:return s.sent(),this.emitter.onTimerReady(this._timer),[2,n]}}))}))},t.prototype.updateMediaPosition=function(t){return dn(this,void 0,void 0,(function(){var e=this;return fn(this,(function(r){return this._isVideoSeeking?(this._mediaPosition=t,this.emitter.onMediaSeek(t),[2,t]):[2,this.stage.requestUpdate(t).then((function(t){return e._mediaPosition=t,e._videoPosition=t,e.emitter.onMediaSeek(t),t}))]}))}))},t.prototype.exportVideo=function(t){return void 0===t&&(t={legacyStringMode:!0}),dn(this,void 0,void 0,(function(){var e,r,n,i;return fn(this,(function(o){return e={sourceId:this._data.video.id,sourceOriginId:this._data.video.sourceOriginId,songleId:this._data.song.id,lyricId:this._data.lyricsId,lyricDiffId:this._data.lyrics?this._data.lyrics.id:-1,config:((null==t?void 0:t.legacyStringMode)?this._data.video.config&&JSON.stringify(this._data.video.config):this._data.video.config)||null},r=this.backgroundGraphics.exportPartialVideoEntry(t),n=this._video.exportData(this._templates),i=(null==t?void 0:t.legacyStringMode)?JSON.stringify(n):n,[2,hn(hn(hn({},e),r),{json:i})]}))}))},t.prototype.getChoruses=function(){return this._data.getChoruses()},t.prototype.findChorus=function(t,e){return this._data.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){return this._data.findChorusBetween(t,e)},t.prototype.getBeats=function(){return this._data.getBeats()},t.prototype.findBeat=function(t,e){return this._data.findBeat(t,e)},t.prototype.getChords=function(){return this._data.getChords()},t.prototype.findChord=function(t,e){return this._data.findChord(t,e)},t.prototype.getVocalFrequency=function(t){return this._data.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){return this._data.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){return this._data.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){return this._data.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){return this._data.getMedianValenceArousal()},t.prototype.resize=function(t){return this.emitter.onResize(t)},t.prototype.onResize=function(t){return this.resize(t)},t.prototype.setStageElement=function(t){return this._stageElement=t,this.emitter.onStageElementSet(t)},t.prototype.setMediaElement=function(t){this.mediaElement=t},t.prototype.updateMediaElement=function(t){"undefined"!=typeof document&&(this._mediaElement&&qi(this._mediaElement),t?(qi(t),this._mediaSourceElement||(this._mediaSourceElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-media-wrapper")),t.appendChild(this._mediaSourceElement),this._mediaBannerElement||(this._mediaBannerElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-banner-wrapper")),t.appendChild(this._mediaBannerElement)):(this._mediaSourceElement=null,this._mediaBannerElement=null)),this._mediaElement=t,this.emitter.onMediaElementSet(t)},t.prototype.setVideoPosition=function(t){return dn(this,void 0,void 0,(function(){var e=this;return fn(this,(function(r){return[2,this.stage.requestUpdate(t).then((function(t){return e._videoPosition=t,e.emitter.onVideoSeek(t),t}))]}))}))},t.prototype.setMediaPosition=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){return this.requestMediaSeek(t),[2]}))}))},t.prototype.requestPlay=function(){return this._timer.play(),!0},t.prototype.requestStop=function(){return this._timer.stop(),!0},t.prototype.requestPause=function(){return this._timer.pause(),!0},t.prototype.requestMediaSeek=function(t){return this._timer.seek(t),!0},t.prototype.startVideoSeek=function(){return this._isVideoSeeking=!0,this.emitter.onVideoSeekStart()},t.prototype.endVideoSeek=function(){return this._isVideoSeeking=!1,this.emitter.onVideoSeekEnd()},t.prototype.requestSettingBackground=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){return[2,this.backgroundGraphics.settingBackground(t)]}))}))},t.prototype.requestSetBackground=function(t){return dn(this,void 0,void 0,(function(){return fn(this,(function(e){return[2,this.backgroundGraphics.setBackground(t)]}))}))},t.prototype.requestStageUpdate=function(){return dn(this,void 0,void 0,(function(){return fn(this,(function(t){return[2,this.stage.requestUpdate()]}))}))},t.prototype.onStageUpdate=function(t){this._isVideoSeeking||this.emitter.onTimeUpdate(t)},t.prototype.dispose=function(){this._timer&&(this._timer.dispose(),this._timer=null),this.mediaElement&&(qi(this._mediaElement),this._mediaElement=null),this.stageElement&&(this._stageElement=null),this.emitter.onDispose()},t}();console.log("# ライセンス表記に関するガイドライン\n\n国立研究開発法人産業技術総合研究所\n人間情報インタラクション研究部門\nメディアインタラクション研究グループ\n\nTextAlive App APIは非商用利用に限り、どなたでも無料・無保証で利用することができます。\nただし、原則としてTextAlive App APIを利用している旨を TextAlive https://textalive.jp/ サイト内楽曲ページまたは https://developer.textalive.jp/ にハイパーリンクした上で、利用しているシステムもしくは外部サイト等に表示する必要があります。\n\n# お問い合わせ\n\ntextalive-ml@aist.go.jp"),t.BasicTimer=mn,t.Color=Q,t.Ease=Ti,t.Matrix2D=ut,t.NullGraphicsDriver=ht,t.Player=zi,t.PlayerLogoImage=Di,t.Point=lt,t.SongleTimer=_n,t.UnitTypes=o,t.dataUrlToString=T,t.findTimedObject=it,t.isStringEncodedDataUrl=S,t.sortedIndex=i.exports.sortedIndex,t.stringToDataUrl=function(t){return"string"!=typeof t?null:"data:text/plain;base64,"+btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt("0x"+e))})))},Object.defineProperty(t,"__esModule",{value:!0})})); +/** textalive-app-api v0.4.0 | Copyright 2024 AIST TextAlive Project (https://textalive.jp) */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TextAliveApp={},t.axios)}(this,(function(t,e){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var r={exports:{}};!function(t,e){!function(t){function e(t,e,r){for(var n=r&&"number"!=typeof e?r(e):e,i=0,o=t.length;i>>1;(r?r(t[s]):t[s])0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=0||"string"==typeof t.user.songleAccessToken)},t.prototype.isSpoofingSongleUser=function(t){return this.isSongleUser(t)&&("number"!=typeof t.user.id||t.user.id<0)},t.prototype.addListener=function(t){t&&this.listeners.push(t)},t.prototype.removeListener=function(t){this.listeners=this.listeners.filter((function(e){return e!==t}))},t.prototype.emitUserProfile=function(t){this.userProfile=t;for(var e=0,r=this.listeners;e>>24&255:0,this.r=t>>>16&255,this.g=t>>>8&255,this.b=t>>>0&255)},t}();var Z=function(){function t(t,e,r){void 0===t&&(t="Noto Sans Japanese"),void 0===e&&(e=40),void 0===r&&(r=""),this._family=t,this._size=e,this._style=r}return Object.defineProperty(t.prototype,"family",{get:function(){return this._family},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},enumerable:!1,configurable:!0}),t.prototype.deriveFamily=function(e){return new t(e,this._size,this._style)},t.prototype.deriveStyle=function(e){return new t(this._family,this._size,e)},t.prototype.deriveSize=function(e){return new t(this._family,e,this._style)},t.prototype.clone=function(){return new t(this._family,this._size,this._style)},t.prototype.eq=function(t){return this._family===t._family&&this._size===t._size&&this._style===t._style},t.prototype.toString=function(t){void 0===t&&(t=1);var e,r=function(t){if(!t||t.length<=0)return[];for(var e=[],r="",n=!1,i=!1,o=!1,s=0,a=t;s1?" "+r.join(", "):(e=r[0]).length>1&&e[0]!==e[e.length-1]||"'"!==e[0]&&'"'!==e[0]?" '".concat(e,"'"):" ".concat(e),this._style+(this._style.length>0?" ":"")+this._size*t+"px"+e},t}(),$=function(){function t(){}return Object.defineProperty(t.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){if("object"==typeof t)return this.overlaps(t.startTime,t.endTime);var r=t;return this.contains(r)||this.contains(e)||this.startTime<=r&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?(t-this.startTime)/this.duration:-1},t}(),K=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._parent=null,e._children=[],e._previous=null,e._next=null,e._runtime=null,e._templates=[],e}return J(e,t),Object.defineProperty(e.prototype,"video",{get:function(){return this.parent&&this.parent.video},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this._data?this._data.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this._data?this._data.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rendering",{get:function(){return this._runtime?this._runtime.rendering:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"graphics",{get:function(){return this._runtime?this._runtime.graphics:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"templates",{get:function(){return this._templates.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"templateCount",{get:function(){return this._templates.length},enumerable:!1,configurable:!0}),e.prototype.maximize=function(){var t=!1,e=this.endTime,r=Math.max(null===this._parent?0:this._parent.startTime,null===this._previous?0:this._previous.endTime);r!==this.startTime&&(this.moveWithChildren(r-this.startTime),t=!0);var n=Math.min(null===this._parent?this.video.duration:this._parent.endTime,null===this._next?this.video.duration:this._next.startTime);return n!==this.endTime&&(this._data.endTime=n,t=e!==n),t},e.prototype.moveWithChildren=function(t){var e=[];for(e.push(this);e.length>0;){var r=e.pop();null!=r._children&&r._children.forEach((function(t){return e.push(t)})),r._data.startTime+=t,r._data.endTime+=t}},e.prototype.getTemplate=function(t){return void 0===t&&(t=0),t<0||t>=this._templates.length?null:this._templates[t]},e.prototype.addTemplateAt=function(t,e){this._templates.splice(e,0,t),t.assignedUnit=this},e.prototype.addTemplate=function(t){this._templates.push(t),t.assignedUnit=this},e.prototype.removeTemplates=function(){for(var t=this._templates.slice();this._templates.length>0;)this._templates.pop();return t},e.prototype.removeTemplateAt=function(t){if(t<0||t>=this._templates.length)return null;var e=this._templates.splice(t,1)[0];return e.assignedUnit=null,e},e.prototype.removeTemplate=function(t){for(var e=0;et?e:t}function tt(t,e){return"number"==typeof e&&!isNaN(e)&&e0&&(t._previous=this.lastChar,this.lastChar._next=t),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){return t instanceof rt?this._children.indexOf(t):-1},e.prototype.getType=function(){return i.WORD},e}(et),ot=function(t){function e(e,r){var n=t.call(this)||this;return n._video=e,n._data=r,n.createUnits(),n}return J(e,t),e.prototype.createUnits=function(){var t=this,e=this._data;e&&Array.isArray(e.words)&&e.words.forEach((function(e){if(e){var r=new it(e);Array.isArray(e.characters)&&e.characters.forEach((function(t){return r.addChar(new rt(t))})),t.addWord(r)}}))},Object.defineProperty(e.prototype,"children",{get:function(){return this._children.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.firstChar?this.firstChar.startTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.lastChar?this.lastChar.endTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordCount",{get:function(){return this._children.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._children.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstWord",{get:function(){return this._children.length<=0?null:this._children[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastWord",{get:function(){return this._children.length<=0?null:this._children[this._children.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){var t=this.firstWord;return null===t?null:t.firstChar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){var t=this.lastWord;return null===t?null:t.lastChar},enumerable:!1,configurable:!0}),e.prototype.getWord=function(t){return t<0||t>=this._children.length?null:this._children[t]},e.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.addWord=function(t){if(t){this._children.length>0&&(t._previous=this.lastWord,t._previous._next=t,t.firstChar._previous=t._previous.lastChar,t._previous.lastChar._next=t.firstChar),this._children.push(t),t._parent=this;var e=this.expandTime(t),r=e.startTime,n=e.endTime;this._data.startTime=r,this._data.endTime=n}},e.prototype.findIndex=function(t){if(t instanceof it)return this._children.indexOf(t);if(t instanceof rt){for(var e=0,r=!1,n=0,i=this._children;n=t.length&&(i=t.length-1);var o=e,s=r.endTime;return t[i].overlaps(o,s)?t[i]:i<1?null:t[i-1].overlaps(o,s)?t[i-1]:null}return i>=t.length?null:r&&"loose"in r&&r.loose||t[i].contains(e)?t[i]:null}function at(t,e,r){if(!t||t.length<=0)return{current:null,entered:[],left:[],previous:null,next:null};var i=n.sortedIndex(t,e,(function(t){return t.startTime}));ie?i-2:i-1,c=n.sortedIndex(t,r,(function(t){return t.endTime}));c>=t.length?(o=-1,s=-1,a=t[c-1].endTime>e?t.length:0):(t[c].startTime>r?(o=-1,s=c):c+1>=t.length||t[c+1].startTime>r?(o=t[c].endTime>r&&t[c].startTime<=r?c:-1,s=c+1):(o=c+1,s=c+2),a=t[c].endTime<=r?c+1:c);var l=u>=0?t[u]:null,p=s>=0&&s=0?t[o]:null,entered:t.slice(i,s),left:t.slice(u+1,a),previous:l,next:p}}var ut=function(t){function e(e){var r=t.call(this)||this;return r._credits=[],r._phrases=[],r._graphics=[],r.data=e||{},r.createUnits(),r}return J(e,t),Object.defineProperty(e.prototype,"credits",{get:function(){return this._credits.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"phrases",{get:function(){return this._phrases.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"words",{get:function(){return this._phrases.reduce((function(t,e){return t.splice.apply(t,H([t.length,0],e._children,!1)),t}),[])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"chars",{get:function(){return this.words.reduce((function(t,e){return t.splice.apply(t,H([t.length,0],e._children,!1)),t}),[])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"graphics",{get:function(){return this._graphics.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rendering",{get:function(){return this._runtime.rendering},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this.data.duration||0},set:function(t){this.data.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){return this.data.startTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.data.endTime||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"creditCount",{get:function(){return this._credits.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"phraseCount",{get:function(){return this._phrases.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"graphicCount",{get:function(){return this._graphics.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.wordCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"charCount",{get:function(){return this._phrases.reduce((function(t,e){return t+e.charCount}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstCredit",{get:function(){return this._credits.length<=0?null:this._credits[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastCredit",{get:function(){return this._credits.length<=0?null:this._credits[this._credits.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastPhrase",{get:function(){return this._phrases.length<=0?null:this._phrases[this._phrases.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstWord",{get:function(){var t;return(null===(t=this.firstPhrase)||void 0===t?void 0:t.firstWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastWord",{get:function(){var t;return(null===(t=this.lastPhrase)||void 0===t?void 0:t.lastWord)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChar",{get:function(){var t;return(null===(t=this.firstWord)||void 0===t?void 0:t.firstChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChar",{get:function(){var t;return(null===(t=this.lastWord)||void 0===t?void 0:t.lastChar)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastGraphic",{get:function(){return this._graphics.length<=0?null:this._graphics[this._graphics.length-1]},enumerable:!1,configurable:!0}),e.prototype.createUnits=function(){var t,e,r=this;Array.isArray(this.data.credits)?(this.data.credits.sort(ct),this.data.credits.forEach((function(t){return r.doAddCredit(new ot(r,t),!1)})),this.organizeTimings(null===(t=this.firstCredit)||void 0===t?void 0:t.firstChar)):this.data.credits=[],Array.isArray(this.data.phrases)?(this.data.phrases.sort(ct),this.data.phrases.forEach((function(t){return r.doAddPhrase(new ot(r,t),!1)})),this.organizeTimings(null===(e=this.firstPhrase)||void 0===e?void 0:e.firstChar)):this.data.phrases=[],Array.isArray(this.data.graphics)?(this.data.graphics.sort(ct),this.data.graphics.forEach((function(t){return r.doAddGraphic(new nt(t),!1)}))):this.data.graphics=[]},e.prototype.organizeTimings=function(t){for(;t;)t.startTime===t.endTime&&t.maximize(),t=t.next},e.prototype.exportData=function(t){this.updateTemplateData(t);for(var r=e.exportUnitData(this.data.credits,!0),n=r.units,i=r.templateClasses,o=e.exportUnitData(this.data.phrases,!1),s=o.units,a=o.templateClasses,u=e.exportUnitData(this.data.graphics,!0),c=u.units,l=u.templateClasses,p=i.concat(a,l).filter((function(t,e,r){return r.indexOf(t)===e})),h={};p.length>0;){var d=p.shift(),f=t.getByName(d);if(f){h[d]=f.id;for(var y=0,g=t.getRequiredTemplates(f.script);y0?t[r-1]:null,o=r0){for(var s=i;s&&!s.lastWord;)s=s.previous;for(var a=o;a&&!a.firstWord;)a=a.next;if(s&&(e.firstWord._previous=s.lastWord,s.lastWord._next=e.firstWord),a&&(e.lastWord._next=a.firstWord,a.firstWord._previous=e.lastWord),e.charCount>0){for(var u=null==s?void 0:s.lastWord;u&&null===u.lastChar;)u=u.previous;for(var c=null==a?void 0:a.firstWord;c&&null===c.firstChar;)c=c.next;u&&(e.firstChar._previous=u.lastChar,u.lastChar._next=e.firstChar),c&&(e.lastChar._next=c.firstChar,c.firstChar._previous=e.lastChar)}}return this.updateStartAndEndTime(),r}},e.prototype.removeCredit=function(t){var e=this.removeRenderingUnit(this._credits,t);return!(e<0||(this.data.credits.splice(e,1),this._runtime&&this._runtime.removeCredit(t),0))},e.prototype.removeCredits=function(){var t=this;this._runtime&&this._credits.forEach((function(e){return t._runtime.removeCredit(e)})),this._credits=[],this.data.credits.splice(0,this.data.credits.length)},e.prototype.removePhrase=function(t){var e=this.removeRenderingUnit(this._phrases,t);return!(e<0||(this.data.phrases.splice(e,1),this._runtime&&this._runtime.removePhrase(t),0))},e.prototype.removePhrases=function(){var t=this;this._runtime&&this._phrases.forEach((function(e){return t._runtime.removePhrase(e)})),this._phrases=[],this.data.phrases.splice(0,this.data.phrases.length)},e.prototype.removeGraphic=function(t){var e=this.removeRenderingUnit(this._graphics,t);return!(e<0||(this.data.graphics.splice(e,1),this._runtime&&this._runtime.removeGraphic(t),0))},e.prototype.removeGraphics=function(){var t=this;this._runtime&&this._graphics.forEach((function(e){return t._runtime.removeGraphic(e)})),this._graphics=[],this.data.graphics.splice(0,this.data.graphics.length),this.rendering.reset()},e.prototype.removeRenderingUnit=function(t,e){var r=n.sortedIndex(t,e,lt);if(r<0||t[r]!==e)return-1;if(t.splice(r,1),e instanceof ot){if(e.charCount>0){for(var i=e._previous;i&&null===i.lastChar;)i=i.previous;for(var o=e._next;o&&null===o.firstChar;)o=o.next;i&&o?(i.lastChar._next=o.firstChar,o.firstChar._previous=i.lastChar):i?i.lastChar._next=null:o&&(o.firstChar._previous=null)}if(e.wordCount>0){for(i=e._previous;i&&null===i.lastWord;)i=i.previous;for(o=e._next;o&&null===o.firstWord;)o=o.next;i&&o?(i.lastWord._next=o.firstWord,o.firstWord._previous=i.lastWord):i?i.lastWord._next=null:o&&(o.firstWord._previous=null)}}e._previous&&(e._previous._next=e._next),e._next&&(e._next._previous=e._previous),this.updateStartAndEndTime()},e.prototype.updateStartAndEndTime=function(){var t,e,r,n,i,o,s,a;this.data.endTime=Math.max((null===(e=null===(t=this.lastCredit)||void 0===t?void 0:t.lastChar)||void 0===e?void 0:e.endTime)||0,(null===(r=this.lastChar)||void 0===r?void 0:r.endTime)||0,(null===(n=this.lastGraphic)||void 0===n?void 0:n.endTime)||0);var u=null===(o=null===(i=this.firstCredit)||void 0===i?void 0:i.firstChar)||void 0===o?void 0:o.startTime,c=null===(s=this.firstChar)||void 0===s?void 0:s.startTime,l=null===(a=this.firstGraphic)||void 0===a?void 0:a.startTime;this.data.startTime=Math.min("number"==typeof u?u:Number.MAX_VALUE,"number"==typeof c?c:Number.MAX_VALUE,"number"==typeof l?l:Number.MAX_VALUE,this.data.endTime)},e.prototype.findIndex=function(t){if(t instanceof ot)return(e=this._phrases.indexOf(t))>=0?e:this._credits.indexOf(t);if(t instanceof it){for(var e=0,r=!1,n=0,i=this._phrases;n=this._credits.length?null:this._credits[t]},e.prototype.getPhrase=function(t){return t<0||t>=this._phrases.length?null:this._phrases[t]},e.prototype.getWord=function(t){if(t<0)return null;for(var e=0,r=this.firstPhrase;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.getChar=function(t){if(t<0)return null;for(var e=0,r=this.firstWord;;){if(!r)return null;if(e+r.children.length>t)break;e+=r.children.length,r=r.next}return r.children[t-e]},e.prototype.getGraphic=function(t){return t<0||t>=this._graphics.length?null:this._graphics[t]},e.prototype.findCredit=function(t,e){return st(this._credits,t,e)},e.prototype.findCreditChange=function(t,e){return at(this._credits,t,e)},e.prototype.findPhrase=function(t,e){return st(this._phrases,t,e)},e.prototype.findPhraseChange=function(t,e){return at(this._phrases,t,e)},e.prototype.findWord=function(t,e){var r=this.findPhrase(t,e);return r?st(r._children,t,e):null},e.prototype.findWordChange=function(t,e){return at(this.words,t,e)},e.prototype.findChar=function(t,e){var r=this.findWord(t,e);return r?st(r._children,t,e):null},e.prototype.findCharChange=function(t,e){return at(this.chars,t,e)},e.prototype.findGraphic=function(t,e){return st(this._graphics,t,e)},e.prototype.findGraphicChange=function(t,e){return at(this._graphics,t,e)},e}($);function ct(t,e){return t.startTime-e.startTime}function lt(t){return t.startTime}var pt=function(){function t(t,e,r,n,i,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.setValues(t,e,r,n,i,o)}return t.prototype.setValues=function(t,e,r,n,i,o){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=o,this},t.prototype.append=function(t,e,r,n,i,o){var s=this.a,a=this.b,u=this.c,c=this.d;return 1==t&&0==e&&0==r&&1==n||(this.a=s*t+u*e,this.b=a*t+c*e,this.c=s*r+u*n,this.d=a*r+c*n),this.tx=s*i+u*o+this.tx,this.ty=a*i+c*o+this.ty,this},t.prototype.prepend=function(t,e,r,n,i,o){var s=this.a,a=this.c,u=this.tx;return this.a=t*s+r*this.b,this.b=e*s+n*this.b,this.c=t*a+r*this.d,this.d=e*a+n*this.d,this.tx=t*u+r*this.ty+i,this.ty=e*u+n*this.ty+o,this},t.prototype.appendMatrix=function(t){return this.append(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.prependMatrix=function(t){return this.prepend(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.appendTransform=function(e,r,n,i,o,s,a,u,c){var l,p,h;return o%360?(l=o*t.DEG_TO_RAD,p=Math.cos(l),h=Math.sin(l)):(p=1,h=0),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.append(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r),this.append(p*n,h*n,-h*i,p*i,0,0)):this.append(p*n,h*n,-h*i,p*i,e,r),(u||c)&&(this.tx-=u*this.a+c*this.c,this.ty-=u*this.b+c*this.d),this},t.prototype.prependTransform=function(e,r,n,i,o,s,a,u,c){var l,p,h;return o%360?(l=o*t.DEG_TO_RAD,p=Math.cos(l),h=Math.sin(l)):(p=1,h=0),(u||c)&&(this.tx-=u,this.ty-=c),s||a?(s*=t.DEG_TO_RAD,a*=t.DEG_TO_RAD,this.prepend(p*n,h*n,-h*i,p*i,0,0),this.prepend(Math.cos(a),Math.sin(a),-Math.sin(s),Math.cos(s),e,r)):this.prepend(p*n,h*n,-h*i,p*i,e,r),this},t.prototype.rotate=function(e){e*=t.DEG_TO_RAD;var r=Math.cos(e),n=Math.sin(e),i=this.a,o=this.b;return this.a=i*r+this.c*n,this.b=o*r+this.d*n,this.c=-i*n+this.c*r,this.d=-o*n+this.d*r,this},t.prototype.skew=function(e,r){return e*=t.DEG_TO_RAD,r*=t.DEG_TO_RAD,this.append(Math.cos(r),Math.sin(r),-Math.sin(e),Math.cos(e),0,0),this},t.prototype.scale=function(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this},t.prototype.translate=function(t,e){return this.tx+=this.a*t+this.c*e,this.ty+=this.b*t+this.d*e,this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},t.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,n=this.d,i=this.tx,o=t*n-e*r;return this.a=n/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-n*i)/o,this.ty=-(t*this.ty-e*i)/o,this},t.prototype.isIdentity=function(){return 0===this.tx&&0===this.ty&&1===this.a&&0===this.b&&0===this.c&&1===this.d},t.prototype.equals=function(t){return this.tx===t.tx&&this.ty===t.ty&&this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d},t.prototype.transformPoint=function(t,e,r){return r.x=t*this.a+e*this.c+this.tx,r.y=t*this.b+e*this.d+this.ty,r},t.prototype.decompose=function(e){void 0===e&&(e={}),e.x=this.tx,e.y=this.ty,e.scaleX=Math.sqrt(this.a*this.a+this.b*this.b),e.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var r=Math.atan2(-this.c,this.d),n=Math.atan2(this.b,this.a);return Math.abs(1-r/n)<1e-5?(e.rotation=n/t.DEG_TO_RAD,this.a<0&&this.d>=0&&(e.rotation+=e.rotation<=0?180:-180),e.skewX=e.skewY=0):(e.skewX=r/t.DEG_TO_RAD,e.skewY=n/t.DEG_TO_RAD),e},t.prototype.copy=function(t){return this.setValues(t.a,t.b,t.c,t.d,t.tx,t.ty)},t.prototype.clone=function(){return new t(this.a,this.b,this.c,this.d,this.tx,this.ty)},t.prototype.toString=function(){return"[".concat(this.constructor.name," (a=").concat(this.a," b=").concat(this.b," c=").concat(this.c," d=").concat(this.d," tx=").concat(this.tx," ty=").concat(this.ty,")]")},t.DEG_TO_RAD=Math.PI/180,t.identity=new t,t}(),ht=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.setValues(t,e)}return t.prototype.setValues=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e,this},t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.toString=function(){return"[".concat(this.constructor.name," (x=").concat(this.x," y=").concat(this.y,")]")},t}(),dt=function(){function t(){this.tx=new pt,this.alpha=0,this.composite="",this.visible=!0}return t.prototype.reset=function(){},t}(),ft=function(){function t(){this.rendering=new dt}return t.prototype.addCredit=function(t){this.doAddPhrase(t)},t.prototype.removeCredit=function(t){t._runtime=null},t.prototype.addPhrase=function(t){this.doAddPhrase(t)},t.prototype.removePhrase=function(t){t._runtime=null},t.prototype.doAddPhrase=function(t){t._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){}};for(var e=t.firstWord;e;){e._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){}};for(var r=e.firstChar;r&&(r._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){},advance:0,ascent:0,descent:0,onFontUpdate:function(){},onColorUpdate:function(){}},r!==e.lastChar);)r=r.next;if(e===t.lastWord)break;e=e.next}},t.prototype.addGraphic=function(t){t._runtime={graphics:{clear:function(){}},rendering:new dt,update:function(){}}},t.prototype.removeGraphic=function(t){t._runtime=null},t}(),yt=function(){function t(){this.wrapperTable={}}return t.prototype.isGraphics=function(){return!1},t.prototype.setCanvas=function(){return Promise.resolve()},t.prototype.createRuntime=function(t){return function(t,e,r,n){return new(r||(r=Promise))((function(e,i){function o(t){try{a(n.next(t))}catch(t){i(t)}}function s(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(t){t(n)}))).then(o,s)}a((n=n.apply(t,[])).next())}))}(this,0,void 0,(function(){var e,r,n;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]3){for(r.sort((function(t,e){return e.length-t.length})),e+="switch(str.length){",n=0;n=170&&er.test(String.fromCharCode(t)))},sr=function(t){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||t>=170&&rr.test(String.fromCharCode(t))))};function ar(){this.line=Ct,this.column=Pt-Nt}function ur(t,e){Ot=Pt,mt.locations&&(Tt=new ar),xt=t,pr(),At=e,Rt=t.beforeExpr}function cr(){var t,e=mt.onComment&&mt.locations&&new ar,r=Pt,n=bt.indexOf("*/",Pt+=2);if(-1===n&&Vt(Pt-2,"Unterminated comment"),Pt=n+2,mt.locations)for(ir.lastIndex=r;(t=ir.exec(bt))&&t.index8&&t<14)++Pt;else if(47===t){var e;if(42===(e=bt.charCodeAt(Pt+1)))cr();else{if(47!==e)break;lr()}}else if(160===t)++Pt;else{if(!(t>=5760&&Qe.test(String.fromCharCode(t))))break;++Pt}}}function hr(t){if(t?Pt=Et+1:Et=Pt,mt.locations&&(St=new ar),t)return fr();if(Pt>=_t)return ur(Jt);var e=bt.charCodeAt(Pt);if(or(e)||92===e)return br();var r=function(t){switch(t){case 46:return function(){var t=bt.charCodeAt(Pt+1);return t>=48&&t<=57?gr(!0):(++Pt,ur(Re))}();case 40:return++Pt,ur(Oe);case 41:return++Pt,ur(Se);case 59:return++Pt,ur(xe);case 44:return++Pt,ur(Te);case 91:return++Pt,ur(_e);case 93:return++Pt,ur(we);case 123:return++Pt,ur(Pe);case 125:return++Pt,ur(Ee);case 58:return++Pt,ur(Ae);case 63:return++Pt,ur(Ce);case 48:var e=bt.charCodeAt(Pt+1);if(120===e||88===e)return function(){Pt+=2;var t=yr(16);return null==t&&Vt(Et+2,"Expected hexadecimal number"),or(bt.charCodeAt(Pt))&&Vt(Pt,"Identifier directly after number"),ur(qt,t)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return gr(!1);case 34:case 39:return function(t){Pt++;for(var e="";;){Pt>=_t&&Vt(Et,"Unterminated string constant");var r=bt.charCodeAt(Pt);if(r===t)return++Pt,ur(Yt,e);if(92===r){r=bt.charCodeAt(++Pt);var n=/^[0-7]+/.exec(bt.slice(Pt,Pt+3));for(n&&(n=n[0]);n&&parseInt(n,8)>255;)n=n.slice(0,-1);if("0"===n&&(n=null),++Pt,n)Lt&&Vt(Pt-2,"Octal literal in strict mode"),e+=String.fromCharCode(parseInt(n,8)),Pt+=n.length-1;else switch(r){case 110:e+="\n";break;case 114:e+="\r";break;case 120:e+=String.fromCharCode(vr(2));break;case 117:e+=String.fromCharCode(vr(4));break;case 85:e+=String.fromCharCode(vr(8));break;case 116:e+="\t";break;case 98:e+="\b";break;case 118:e+="\v";break;case 102:e+="\f";break;case 48:e+="\0";break;case 13:10===bt.charCodeAt(Pt)&&++Pt;case 10:mt.locations&&(Nt=Pt,++Ct);break;default:e+=String.fromCharCode(r)}}else 13!==r&&10!==r&&8232!==r&&8233!==r||Vt(Et,"Unterminated string constant"),e+=String.fromCharCode(r),++Pt}}(t);case 47:return function(t){var e=bt.charCodeAt(Pt+1);return Rt?(++Pt,fr()):61===e?dr(je,2):dr(Ne,1)}();case 37:case 42:return 61===bt.charCodeAt(Pt+1)?dr(je,2):dr(Ye,1);case 124:case 38:return function(t){var e=bt.charCodeAt(Pt+1);return e===t?dr(124===t?Fe:Le,2):61===e?dr(je,2):dr(124===t?De:Be,1)}(t);case 94:return 61===bt.charCodeAt(Pt+1)?dr(je,2):dr(Me,1);case 43:case 45:return function(t){var e=bt.charCodeAt(Pt+1);return e===t?45==e&&62==bt.charCodeAt(Pt+2)&&nr.test(bt.slice(jt,Pt))?(Pt+=3,lr(),pr(),hr()):dr(Ie,2):61===e?dr(je,2):dr(We,1)}(t);case 60:case 62:return function(t){var e=bt.charCodeAt(Pt+1),r=1;return e===t?(r=62===t&&62===bt.charCodeAt(Pt+2)?3:2,61===bt.charCodeAt(Pt+r)?dr(je,r+1):dr(qe,r)):33==e&&60==t&&45==bt.charCodeAt(Pt+2)&&45==bt.charCodeAt(Pt+3)?(Pt+=4,lr(),pr(),hr()):(61===e&&(r=61===bt.charCodeAt(Pt+2)?3:2),dr(Ge,r))}(t);case 61:case 33:return function(t){return 61===bt.charCodeAt(Pt+1)?dr(Ve,61===bt.charCodeAt(Pt+2)?3:2):dr(61===t?ke:Ue,1)}(t);case 126:return dr(Ue,1)}return!1}(e);if(!1===r){var n=String.fromCharCode(e);if("\\"===n||er.test(n))return br();Vt(Pt,"Unexpected character '"+n+"'")}return r}function dr(t,e){var r=bt.slice(Pt,Pt+e);Pt+=e,ur(t,r)}function fr(){for(var t,e,r=Pt;;){Pt>=_t&&Vt(r,"Unterminated regular expression");var n=bt.charAt(Pt);if(nr.test(n)&&Vt(r,"Unterminated regular expression"),t)t=!1;else{if("["===n)e=!0;else if("]"===n&&e)e=!1;else if("/"===n&&!e)break;t="\\"===n}++Pt}var i=bt.slice(r,Pt);++Pt;var o=mr();return o&&!/^[gmsiy]*$/.test(o)&&Vt(r,"Invalid regexp flag"),ur(Wt,new RegExp(i,o))}function yr(t,e){for(var r=Pt,n=0,i=0,o=null==e?1/0:e;i=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=t)break;++Pt,n=n*t+s}return Pt===r||null!=e&&Pt-r!==e?null:n}function gr(t){var e=Pt,r=!1,n=48===bt.charCodeAt(Pt);t||null!==yr(10)||Vt(e,"Invalid number"),46===bt.charCodeAt(Pt)&&(++Pt,yr(10),r=!0);var i=bt.charCodeAt(Pt);69!==i&&101!==i||(43!==(i=bt.charCodeAt(++Pt))&&45!==i||++Pt,null===yr(10)&&Vt(e,"Invalid number"),r=!0),or(bt.charCodeAt(Pt))&&Vt(Pt,"Identifier directly after number");var o,s=bt.slice(e,Pt);return r?o=parseFloat(s):n&&1!==s.length?/[89]/.test(s)||Lt?Vt(e,"Invalid number"):o=parseInt(s,8):o=parseInt(s,10),ur(qt,o)}function vr(t){var e=yr(16,t);return null===e&&Vt(Et,"Bad character escape sequence"),e}function mr(){Je=!1;for(var t,e=!0,r=Pt;;){var n=bt.charCodeAt(Pt);if(sr(n))Je&&(t+=bt.charAt(Pt)),++Pt;else{if(92!==n)break;Je||(t=bt.slice(r,Pt)),Je=!0,117!=bt.charCodeAt(++Pt)&&Vt(Pt,"Expecting Unicode escape sequence \\uXXXX"),++Pt;var i=vr(4),o=String.fromCharCode(i);o||Vt(Pt-1,"Invalid Unicode escape"),(e?or(i):sr(i))||Vt(Pt-4,"Invalid Unicode escape"),t+=o}e=!1}return Je?t:bt.slice(r,Pt)}function br(){var t=mr(),e=zt;return Je||(Ke(t)?e=be[t]:(mt.forbidReserved&&(3===mt.ecmaVersion?He:Xe)(t)||Lt&&Ze(t))&&Vt(Et,"The keyword '"+t+"' is reserved")),ur(e,t)}function _r(){kt=Et,jt=Ot,It=Tt,hr()}function wr(t){if(Lt=t,Pt=jt,mt.locations)for(;Pt=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"use strict"===t.expression.value}function Ar(t){if(xt===t)return _r(),!0}function Rr(){return!mt.strictSemicolons&&(xt===Jt||xt===Ee||nr.test(bt.slice(jt,Et)))}function Cr(){Ar(xe)||Rr()||kr()}function Nr(t){xt===t?_r():kr()}function kr(){Vt(Et,"Unexpected token")}function jr(t){"Identifier"!==t.type&&"MemberExpression"!==t.type&&Vt(t.start,"Assigning to rvalue"),Lt&&"Identifier"===t.type&&$e(t.name)&&Vt(t.start,"Assigning to "+t.name+" in strict mode")}var Ir={kind:"loop"},Ur={kind:"switch"};function Fr(){(xt===Ne||xt===je&&"/="==At)&&hr(!0);var t=xt,e=Or();switch(t){case Ht:case $t:_r();var r=t===Ht;Ar(xe)||Rr()?e.label=null:xt!==zt?kr():(e.label=$r(),Cr());for(var n=0;ne){var i=Sr(t);i.left=t,i.operator=At;var o=xt;return _r(),i.right=Wr(Yr(),n,r),Wr(Tr(i,o===Fe||o===Le?"LogicalExpression":"BinaryExpression"),e,r)}return t}function Yr(){if(xt.prefix){var t=Or(),e=xt.isUpdate;return t.operator=At,t.prefix=!0,Rt=!0,_r(),t.argument=Yr(),e?jr(t.argument):Lt&&"delete"===t.operator&&"Identifier"===t.argument.type&&Vt(t.start,"Deleting local variable in strict mode"),Tr(t,e?"UpdateExpression":"UnaryExpression")}for(var r=zr(Jr());xt.postfix&&!Rr();)(t=Sr(r)).operator=At,t.prefix=!1,t.argument=r,jr(r),_r(),r=Tr(t,"UpdateExpression");return r}function zr(t,e){var r;return Ar(Re)?((r=Sr(t)).object=t,r.property=$r(!0),r.computed=!1,zr(Tr(r,"MemberExpression"),e)):Ar(_e)?((r=Sr(t)).object=t,r.property=Gr(),r.computed=!0,Nr(we),zr(Tr(r,"MemberExpression"),e)):!e&&Ar(Oe)?((r=Sr(t)).callee=t,r.arguments=Zr(Se,!1),zr(Tr(r,"CallExpression"),e)):t}function Jr(){switch(xt){case fe:var t=Or();return _r(),Tr(t,"ThisExpression");case zt:return $r();case qt:case Yt:case Wt:return(t=Or()).value=At,t.raw=bt.slice(Et,Ot),_r(),Tr(t,"Literal");case ye:case ge:case ve:return(t=Or()).value=xt.atomValue,t.raw=xt.keyword,_r(),Tr(t,"Literal");case Oe:var e=St,r=Et;_r();var n=Gr();return n.start=r,n.end=Ot,mt.locations&&(n.loc.start=e,n.loc.end=Tt),mt.ranges&&(n.range=[r,Ot]),Nr(Se),n;case _e:return t=Or(),_r(),t.elements=Zr(we,!0,!0),Tr(t,"ArrayExpression");case Pe:return function(){var t=Or(),e=!0,r=!1;for(t.properties=[],_r();!Ar(Ee);){if(e)e=!1;else if(Nr(Te),mt.allowTrailingCommas&&Ar(Ee))break;var n,i={key:Hr()},o=!1;if(Ar(Ae)?(i.value=Gr(!0),n=i.kind="init"):mt.ecmaVersion>=5&&"Identifier"===i.key.type&&("get"===i.key.name||"set"===i.key.name)?(o=r=!0,n=i.kind=i.key.name,i.key=Hr(),xt!==Oe&&kr(),i.value=Xr(Or(),!1)):kr(),"Identifier"===i.key.type&&(Lt||r))for(var s=0;s=0)for(var a=0;a>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;","Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")},t.prototype.initString=function(e){var r,n=this;r=function(t){return t=String(t),n.calledWithNew()?(this.data=t,this):t},this.STRING=this.createNativeFunction(r,!0),this.setProperty(e,"String",this.STRING),this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(String.fromCharCode,!1),t.NONENUMERABLE_DESCRIPTOR);for(var i=["trim","toLowerCase","toUpperCase","toLocaleLowerCase","toLocaleUpperCase","charAt","charCodeAt","substring","slice","substr","indexOf","lastIndexOf","concat"],o=0;o= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);","}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","")},t.prototype.initBoolean=function(t){var e,r=this;e=function(t){return t=Boolean(t),r.calledWithNew()?(this.data=t,this):t},this.BOOLEAN=this.createNativeFunction(e,!0),this.setProperty(t,"Boolean",this.BOOLEAN)},t.prototype.initNumber=function(e){var r,n=this;r=function(t){return t=Number(t),n.calledWithNew()?(this.data=t,this):t},this.NUMBER=this.createNativeFunction(r,!0),this.setProperty(e,"Number",this.NUMBER);for(var i=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"],o=0;o>>0;return e===Number(t)?e:NaN},t.legalArrayIndex=function(t){var e=t>>>0;return String(e)===String(t)&&4294967295!==e?e:NaN},t.prototype.createObject=function(t){return this.createObjectProto(t&&t.properties.prototype)},t.prototype.createObjectProto=function(t){var e=new Qr(t);return this.isa(e,this.FUNCTION)&&(this.setProperty(e,"prototype",this.createObjectProto(this.OBJECT_PROTO||null)),e.class="Function"),this.isa(e,this.ARRAY)&&(this.setProperty(e,"length",0,{configurable:!1,enumerable:!1,writable:!0}),e.class="Array"),this.isa(e,this.ERROR)&&(e.class="Error"),e},t.prototype.populateRegExp=function(e,r){e.data=r,this.setProperty(e,"lastIndex",r.lastIndex,t.NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"source",r.source,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"global",r.global,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"ignoreCase",r.ignoreCase,t.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(e,"multiline",r.multiline,t.READONLY_NONENUMERABLE_DESCRIPTOR)},t.prototype.createFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.parentScope=r,n.node=e,this.setProperty(n,"length",n.node.params.length,t.READONLY_DESCRIPTOR),n},t.prototype.createNativeFunction=function(e,r){var n=this.createObjectProto(this.FUNCTION_PROTO);return n.nativeFunc=e,e.id=this.functionCounter_++,this.setProperty(n,"length",e.length,t.READONLY_DESCRIPTOR),r?this.setProperty(n.properties.prototype,"constructor",n,t.NONENUMERABLE_DESCRIPTOR):!1===r&&(n.illegalConstructor=!0,this.setProperty(n,"prototype",void 0)),n},t.prototype.createAsyncFunction=function(e){var r=this.createObjectProto(this.FUNCTION_PROTO);return r.asyncFunc=e,e.id=this.functionCounter_++,this.setProperty(r,"length",e.length,t.READONLY_DESCRIPTOR),r},t.prototype.nativeToPseudo=function(t){if("boolean"==typeof t||"number"==typeof t||"string"==typeof t||null==t)return t;if(t instanceof RegExp){var e=this.createObjectProto(this.REGEXP_PROTO);return this.populateRegExp(e,t),e}if(t instanceof Function){var r=this;return this.createNativeFunction((function(){return r.nativeToPseudo(t.apply(r,Array.prototype.slice.call(arguments).map((function(t){return r.pseudoToNative(t)}))))}),void 0)}var n;if(Array.isArray(t)){n=this.createObjectProto(this.ARRAY_PROTO);for(var i=0;i>=":s>>=a;break;case">>>=":s>>>=a;break;case"&=":s&=a;break;case"^=":s^=a;break;case"|=":s|=a;break;default:throw SyntaxError("Unknown assignment expression: "+r.operator)}var u=this.setValue(e.leftReference_,s);if(u)return e.doneSetter_=s,this.createSetter_(u,e.leftReference_,s);t.pop(),t[t.length-1].value=s},t.prototype.stepBinaryExpression=function(t,e,r){if(!e.doneLeft_)return e.doneLeft_=!0,new tn(r.left,e.scope);if(!e.doneRight_)return e.doneRight_=!0,e.leftValue_=e.value,new tn(r.right,e.scope);t.pop();var n,i=e.leftValue_,o=e.value;switch(r.operator){case"==":n=i==o;break;case"!=":n=i!=o;break;case"===":n=i===o;break;case"!==":n=i!==o;break;case">":n=i>o;break;case">=":n=i>=o;break;case"<":n=i>":n=i>>o;break;case">>>":n=i>>>o;break;case"in":o&&o.isObject||this.throwException(this.TYPE_ERROR,"'in' expects an object, not '"+o+"'"),n=this.hasProperty(o,i);break;case"instanceof":this.isa(o,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Right-hand side of instanceof is not an object"),n=!!i.isObject&&this.isa(i,o);break;default:throw SyntaxError("Unknown binary operator: "+r.operator)}t[t.length-1].value=n},t.prototype.stepBlockStatement=function(t,e,r){var n=e.n_||0,i=r.body[n];if(i)return e.n_=n+1,new tn(i,e.scope);t.pop()},t.prototype.stepBreakStatement=function(t,e,r){t.pop();var n=null;for(r.label&&(n=r.label.name);e&&"CallExpression"!==e.node.type&&"NewExpression"!==e.node.type;){if(n){if(e.labels&&-1!==e.labels.indexOf(n))return}else if(e.isLoop||e.isSwitch)return;e=t.pop()}throw SyntaxError("Illegal break statement")},t.prototype.stepCallExpression=function(e,r,n){if(!r.doneCallee_){r.doneCallee_=1;var i=new tn(n.callee,r.scope);return i.components=!0,i}if(1===r.doneCallee_){r.doneCallee_=2;var o=r.value;if(Array.isArray(o)){if(r.func_=this.getValue(o),o[0]!==t.SCOPE_REFERENCE&&(r.funcThis_=o[0]),(o=r.func_)&&"object"==typeof o&&o.isGetter)return o.isGetter=!1,r.doneCallee_=1,this.createGetter_(o,r.value)}else r.func_=o;r.arguments_=[],r.n_=0}if(o=r.func_,!r.doneArgs_){if(0!==r.n_&&r.arguments_.push(r.value),n.arguments[r.n_])return new tn(n.arguments[r.n_++],r.scope);"NewExpression"===n.type?(o.illegalConstructor&&this.throwException(this.TYPE_ERROR,o+" is not a constructor"),r.funcThis_=this.createObject(o),r.isConstructor=!0):void 0===r.funcThis_&&(r.funcThis_=r.scope.strict?void 0:this.global),r.doneArgs_=!0}if(r.doneExec_)e.pop(),r.isConstructor&&"object"!=typeof r.value?e[e.length-1].value=r.funcThis_:e[e.length-1].value=r.value;else{r.doneExec_=!0,o&&o.isObject||(console.log("non-function called",o,r),this.throwException(this.TYPE_ERROR,o+" is not a function"));var s=o.node;if(s){for(var a=this.createScope(s.body,o.parentScope),u=0;uu?r.arguments_[u]:void 0;this.setProperty(a,c,l)}var p=this.createObjectProto(this.ARRAY_PROTO);for(u=0;u=0)return!0;r=Object.getPrototypeOf(r)}return!1};function rn(t,e){var r={},n=Dt(t,{locations:!0,onComment:function(t,e,n,i,o,s){r[s.line]=e}});if("Program"!==n.type||1!==n.body.length||"FunctionDeclaration"!==n.body[0].type)throw new Error("JavaScript program should only have one function definition");var i=n.body[0].body.body,o=[],s=[];return i.forEach((function(t){if("ExpressionStatement"===t.type){var n=t.expression;if("AssignmentExpression"===n.type&&"="===n.operator&&"MemberExpression"===n.left.type&&"ThisExpression"===n.left.object.type&&"Identifier"===n.left.property.type){for(var i=[],a=n.loc.start.line-1;a>=0&&void 0!==r[a];a--)i.push(r[a]);if(!(i.length<=0)){var u=n.left.property.name;if(!(Array.isArray(e)&&e.indexOf(u)>=0)&&"FunctionExpression"!==n.right.type){var c=function(t,e,r){var n={name:t,title:{},className:null,proposed:!1,initialValue:null};if(e.forEach((function(t){var e=t.indexOf("@ui ");if(e>=0)n.description=t.substring(e+4).trim();else{var r=t.indexOf("@title ");if(r>=0){var i=t.substring(r+7).trim();0===i.indexOf("@ja ")?n.title.ja=i.substring(4).trim():n.title.default=i}else if(t.indexOf("@proposed")>=0)n.proposed=!0;else{var o=t.indexOf("@comment ");if(o>=0){var s=t.substring(o+9).trim();return n.comment||(n.comment={}),void(0===s.indexOf("@ja ")?n.comment.ja=s.substring(4).trim():n.comment.default=s)}}}})),!n.description&&!n.comment)return null;if(n.proposed||n.comment)return n;var i=n.description.indexOf("("),o=n.description.indexOf(")",i);if(!(i<0||o<0)){n.className=n.description.substr(0,i);try{var s=new Kr("[".concat(n.description.substr(i+1,o-i-1),"]")),a=Date.now();for(s.unwrap=null,s.wrap=null;s.step()&&!(Date.now()-a>100););n.params=s.pseudoToNative(s.value)}catch(t){}return n.params||(n.params=[]),n}}(u,i);s.push(n),c&&o.push(c)}}}}})),{widgets:o,fields:s,ast:n}}function nn(t,e){if(void 0===e&&(e=-1),!t)return{dependencyAtCursor:null,dependencies:[]};for(var r=[],n=null,i=("string"==typeof t?Dt(t,Kr.PARSE_OPTIONS):t).body[0].body.body.slice(0);i.length>0;){var o=i.shift();if(null!=o)if("CallExpression"!==o.type)o.expression&&i.push(o.expression),o.object&&i.push(o.object),o.property&&i.push(o.property),o.name&&"string"!=typeof name&&i.push(o.name),o.left&&i.push(o.left),o.right&&i.push(o.right),o.id&&i.push(o.id),o.init&&i.push(o.init),o.callee&&i.push(o.callee),o.body&&Array.isArray(o.body)&&i.push.apply(i,o.body),o.declarations&&Array.isArray(o.declarations)&&i.push.apply(i,o.declarations),o.arguments&&Array.isArray(o.arguments)&&i.push.apply(i,o.arguments),o.params&&Array.isArray(o.params)&&i.push.apply(i,o.params);else if(o.callee.name&&"require"===o.callee.name){var s=o.arguments;if(s&&Array.isArray(s)&&1===s.length){var a=s[0];if("Literal"===a.type){var u=a.value;r.push(u),o.start&&o.end&&o.start<=e&&o.end>=e&&(n=u)}}}}return{dependencyAtCursor:n,dependencies:r}}Kr.Object=Qr,Kr.State=tn;var on=function(){return on=Object.assign||function(t){for(var e,r=1,n=arguments.length;rt){i=!0;break}}catch(o){throw this.verbose&&console.log(r.stateStack),"string"==typeof o&&(o=new Error(o)),r.stateStack.length>0&&(o.node=r.stateStack[r.stateStack.length-1].node),o}if(i){var o=new Error("timeout: spent too long time (> "+t+"ms) to "+e);throw r.stateStack.length>0&&(o.node=r.stateStack[0].node),o}return this.interpreter.value},t.prototype.cleanupProperties=function(t){if(!t)return null;for(var e in this.ignoredPropNames.forEach((function(e){void 0!==t.properties[e]&&delete t.properties[e]})),t.properties)this.cleanupProperty(t.properties[e])||delete t.properties[e];return t.properties},t.prototype.cleanupProperty=function(t){if(an(t))return!0;var e=t;if(e._native)return!0;var r=this.globalScope.properties;if(e.parent===r.Array){for(var n=e.length,i=0;i0}if(e.parent===r.Object){var o=!0;for(var s in e.properties)this.cleanupProperty(e.properties[s])?o=!1:delete e.properties[s];return!o}return!1},t.prototype.restoreProperties=function(t,e){e&&(t.properties=on(on({},t.properties),e))},t.prototype.wrap=function(t){if("object"==typeof t&&null!==t&&void 0!==t.constructor&&"string"==typeof t.constructor.className){var e=t.constructor.className,r=this.wrappers[e];if(void 0===r)return;var n=this.interpreter.createObject(r);return n._native=t,n}return this.verbose&&(an(t)||Array.isArray(t)||console.log("wrap complex obj:",String(t))),this.interpreter.nativeToPseudo(t)},t.prototype.unwrap=function(t,e){return"object"==typeof t&&null!==t&&t._native?t._native:this.interpreter.pseudoToNative(t,e)},t.prototype.wrapClass=function(t,e){this.verbose&&console.log("--- wrapping "+e+" ---"),t.className=e;var r=this,n=this.interpreter.createNativeFunction((function(e){var i,o;if(i=r.interpreter.calledWithNew()?this:r.interpreter.createObjectProto(n.properties.prototype),void 0!==e)if(Array.isArray(e))for(var s=0;s0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=this.player.video.duration&&this.stop()},t}();function Pn(){return yn(this,0,void 0,(function(){return gn(this,(function(t){return bn&&bn.Player?[2,bn]:"undefined"==typeof window?[2,import("songle-api")]:window.Songle&&window.Songle.Player?[2,window.Songle]:(mn||(mn=new Promise((function(t){var e=!1;window.onSongleAPIReady=function(r){e=!0,t(bn=r)},setTimeout((function(){if(!e){var t=[];document.querySelectorAll("script").forEach((function(e){var r=e.getAttribute("src");r&&r.indexOf("songle.jp/v2/api.js")>=0&&t.push(e)})),t.forEach((function(t){return t.parentElement.removeChild(t)}));var r=document.createElement("script");r.src="https://api.songle.jp/v2/api.js",document.head.appendChild(r)}}),1e3)}))),[2,mn])}))}))}var En=function(){function t(t){void 0===t&&(t={}),this.options=t,this.wait=50,this.volumeListener={onVolumeUpdate:this.onVolumeUpdate.bind(this)},this.resetProps()}return Object.defineProperty(t.prototype,"songlePlayer",{get:function(){return this._songlePlayer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._songlePlayer&&this._songlePlayer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"withSync",{get:function(){var t,e;return!(!(null===(t=this.options)||void 0===t?void 0:t.accessToken)&&!(null===(e=this.options)||void 0===e?void 0:e.secretToken))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){var t;if(!this._songlePlayer)return 0;if(this.lastPosition>0&&this.lastTime>0)return Date.now()+this.lastPosition-this.lastTime;var e=this._songlePlayer.positionTime;if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var r=this.lastTime,n=this.lastPosition,i=void 0;if(r>0){var o=Date.now()-r;i=Math.max(0,this.wait-o)}else i=this.wait;0===n&&e>=500?e=0:0===r&&e-n>=800&&(e=n+i)}return e},enumerable:!1,configurable:!0}),t.prototype.initialize=function(t){var e,r,n,i,o=t.player,s=t.updater,a=t.emitter,u=t.altSourceUrl;return yn(this,0,void 0,(function(){var t,c,p;return gn(this,(function(h){switch(h.label){case 0:return this.player&&this.player.removeListener(this.volumeListener),this.player=o,this.player.addListener(this.volumeListener),this.updateMediaPosition=s,this.emitter=a,this._songlePlayer?[3,2]:[4,this.initializeSonglePlayer()];case 1:h.sent(),h.label=2;case 2:return t=this.options.headless,c=u||this.options.altSourceUrls&&(null===(e=this.player.data.song)||void 0===e?void 0:e.permalink)&&this.options.altSourceUrls[null===(r=this.player.data.song)||void 0===r?void 0:r.permalink]||(null===(n=this.player.data.song)||void 0===n?void 0:n.permalink)||void 0,l.isUploaderUrl(c)&&(c=l.getAltSongUrlFromUploaderGuid(l.getUploaderGuid(l.getSongPathFromUrl(c)))),(p=(null===(i=this.player.data.song)||void 0===i?void 0:i.permalink)||c)===c&&(c=void 0),[4,this._songlePlayer.useMedia(p,{headless:t,altSourceUrl:c})];case 3:return h.sent(),this.ignoreSonglePlayerEvents=!0,this._songlePlayer.volume=0*(1-this.player.volume/100)+100*this.player.volume/100,this._songlePlayer.play(),this._songlePlayer.stop(),this.ignoreSonglePlayerEvents=!1,this.resetProps(),[2]}}))}))},t.prototype.resetProps=function(){this.lastPosition=0,this.lastTime=0,this.elapsedTimes=[]},t.prototype.initializeSonglePlayer=function(){var t;return yn(this,0,void 0,(function(){var e,r,n,i,o,s,a,u=this;return gn(this,(function(c){switch(c.label){case 0:return e=this.options,r=e.accessToken,n=e.secretToken,(o=this.options.songle)?[3,2]:[4,Pn()];case 1:o=c.sent(),c.label=2;case 2:return(i=o).System&&(i.System.showLicense=!1),s=null===(t=this.options)||void 0===t?void 0:t.autoUseMedia,this._songlePlayer=this.withSync?new i.SyncPlayer({mediaElement:this.player.mediaSourceElement,accessToken:r,secretToken:n,autoUseMedia:s}):new i.Player({mediaElement:this.player.mediaSourceElement}),a=!1,this._songlePlayer.on("play",(function(){u.ignoreSonglePlayerEvents||(a=!1,u.handler||(u.startPolling(),u.emitter.onPlay()))})),this._songlePlayer.on("pause",(function(){return yn(u,0,void 0,(function(){return gn(this,(function(t){switch(t.label){case 0:return this.ignoreSonglePlayerEvents?[2]:(a=!1,this.stopPolling(),this.emitter.onPause(),this.stopping?(this.stopping=!1,[4,this.updateMediaPosition(0)]):[3,2]);case 1:t.sent(),this.resetProps(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("finish",(function(){return yn(u,0,void 0,(function(){return gn(this,(function(t){switch(t.label){case 0:return a=!1,this.handler?(this.stopPolling(),[4,this.updateMediaPosition(0)]):[3,2];case 1:t.sent(),this.emitter.onStop(),t.label=2;case 2:return[2]}}))}))})),this._songlePlayer.on("seek",(function(t){var e=t.data;return yn(u,0,void 0,(function(){return gn(this,(function(t){switch(t.label){case 0:return this._songlePlayer.isPlaying?[3,2]:(a=!1,[4,this.updateMediaPosition(e.positionTime)]);case 1:return t.sent(),this.emitter.onSeekComplete(e.positionTime),[3,4];case 2:return a=!0,[4,this.updateMediaPosition(this._songlePlayer.positionTime)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))})),this._songlePlayer.on("mediaSeek",(function(){a&&(u.emitter.onSeekComplete(u.position),a=!1)})),this.withSync&&(this._songlePlayer.on("mediaPlay",(function(){u.handler||(u.startPolling(),u.emitter.onPlay())})),this._songlePlayer.on("mediaFinish",(function(){u.handler&&(u.stopPolling(),u.emitter.onStop())}))),[2]}}))}))},t.prototype.play=function(){if(this._songlePlayer)return this._songlePlayer.play();this.emitter.onPlay()},t.prototype.stop=function(){if(this._songlePlayer)return this.stopping=this._songlePlayer.isPlaying,this._songlePlayer.stop();this.emitter.onStop()},t.prototype.pause=function(){if(this._songlePlayer)return this.stopping=!1,this._songlePlayer.pause();this.emitter.onPause()},t.prototype.seek=function(t){var e=this;this._songlePlayer?(this._songlePlayer.seekTo(t),this.emitter.onSeek(t)):this.updateMediaPosition(t).then((function(){e.emitter.onSeek(t)}))},t.prototype.startPolling=function(){var t,e=this;if(this.lastTime>0){var r=Date.now()-this.lastTime;t=Math.max(0,this.wait-r)}else t=this.wait;this.handler=setTimeout((function(){return yn(e,0,void 0,(function(){var e,r,n,i,o,s,a,u,c;return gn(this,(function(l){switch(l.label){case 0:return this._songlePlayer?(r=(e=this).lastTime,n=e.lastPosition,i=this._songlePlayer.positionTime,o=!1,"songle-api-html-media-element-media"===(null===(c=this._songlePlayer.media)||void 0===c?void 0:c.dispatcherName)&&(0===n&&i>=500?(i=0,o=!0):0===r&&i-n>=800&&(i=n+t,o=!0)),s=r>0?Date.now()-r:t,this.updateElapsedTimes(s),a=n>0?n+s:i,u=Math.abs(i-a),(a=u>2*this.wait?i:a<=i?.5*(a+i):Math.max(n,i))5*this.wait||(a=this.lastPosition)),o||(this.lastTime=Date.now()),this.lastPosition=a,[4,this.updateMediaPosition(a)]):[2];case 1:return l.sent(),this.handler&&this.startPolling(),[2]}}))}))}),t)},t.prototype.updateElapsedTimes=function(t){if(this.elapsedTimes.unshift(t),this.elapsedTimes=this.elapsedTimes.slice(0,10),this.elapsedTimes.length>=10){var e=this.elapsedTimes.reduce((function(t,e){return t+e}))/10;e>5*this.wait&&(this.player.stageScale=Math.max(.25,.9*this.player.stageScale),this.elapsedTimes=[]),e<1.2*this.wait&&this.player.stageScale<1&&(this.player.stageScale=Math.min(1,this.player.stageScale/.9),this.elapsedTimes=[])}},t.prototype.stopPolling=function(){var t;if(this.handler){if(clearTimeout(this.handler),this._songlePlayer)if("songle-api-html-media-element-media"===(null===(t=this._songlePlayer.media)||void 0===t?void 0:t.dispatcherName)){var e=this.lastTime,r=this.lastPosition,n=Date.now()-e;this.lastPosition=r+n}else this.lastPosition=this._songlePlayer.positionTime;this.lastTime=0}this.handler=null},t.prototype.dispose=function(){if(this.player&&this.player.removeListener(this.volumeListener),this._songlePlayer){try{this._songlePlayer.stop()}catch(t){}this._songlePlayer=null}},t.prototype.onVolumeUpdate=function(t){this._songlePlayer&&(this._songlePlayer.volume=t)},t}(),On=function(){function t(t){this.listeners=[],this.throttleInterval=t&&t.throttleInterval?Number(t.throttleInterval):100}return t.prototype.onVideoLoad=function(t,e){this.listeners.forEach((function(r){return r.onVideoLoad&&r.onVideoLoad(t,e)}))},t.prototype.onSongLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongLoad&&r.onSongLoad(t,e)}))},t.prototype.onSongMapLoad=function(t,e){this.listeners.forEach((function(r){return r.onSongMapLoad&&r.onSongMapLoad(t,e)}))},t.prototype.onSongInfoLoad=function(t,e){var r=!1;this.listeners.forEach((function(n){n.onSongInfoLoad&&(n.onSongInfoLoad(t,e),r=!0)})),r&&console.warn('[TextAlive API] "onSongInfoLoad" event is deprecated; use "onSongMapLoad" event instead')},t.prototype.onVocalAmplitudeLoad=function(t,e){this.listeners.forEach((function(r){return r.onVocalAmplitudeLoad&&r.onVocalAmplitudeLoad(t,e)}))},t.prototype.onValenceArousalLoad=function(t,e){this.listeners.forEach((function(r){return r.onValenceArousalLoad&&r.onValenceArousalLoad(t,e)}))},t.prototype.onLyricsLoad=function(t,e){this.listeners.forEach((function(r){return r.onLyricsLoad&&r.onLyricsLoad(t,e)}))},t.prototype.onTextLoad=function(t,e){this.listeners.forEach((function(r){return r.onTextLoad&&r.onTextLoad(t,e)}))},t.prototype.onAppLoad=function(t){this.listeners.forEach((function(e){return e.onAppLoad&&e.onAppLoad(t)}))},t.prototype.onAppReady=function(t){this.listeners.forEach((function(e){return e.onAppReady&&e.onAppReady(t)}))},t.prototype.onAppParameterUpdate=function(t,e){this.listeners.forEach((function(r){return r.onAppParameterUpdate&&r.onAppParameterUpdate(t,e)}))},t.prototype.onAppMediaChange=function(t,e){this.listeners.forEach((function(r){return r.onAppMediaChange&&r.onAppMediaChange(t,e)}))},t.prototype.onTemplateUpdate=function(t){this.listeners.forEach((function(e){return e.onTemplateUpdate&&e.onTemplateUpdate(t)}))},t.prototype.onTemplateCommit=function(t){this.listeners.forEach((function(e){return e.onTemplateCommit&&e.onTemplateCommit(t)}))},t.prototype.onTemplatesLoad=function(t,e){this.listeners.forEach((function(r){return r.onTemplatesLoad&&r.onTemplatesLoad(t,e)}))},t.prototype.onFontsLoad=function(t,e){this.listeners.forEach((function(r){return r.onFontsLoad&&r.onFontsLoad(t,e)}))},t.prototype.onVideoReady=function(t){this.listeners.forEach((function(e){return e.onVideoReady&&e.onVideoReady(t)}))},t.prototype.onTimerReady=function(t){this.listeners.forEach((function(e){return e.onTimerReady&&e.onTimerReady(t)}))},t.prototype.onStageElementSet=function(t){this.listeners.forEach((function(e){return e.onStageElementSet&&e.onStageElementSet(t)}))},t.prototype.onMediaElementSet=function(t){this.listeners.forEach((function(e){return e.onMediaElementSet&&e.onMediaElementSet(t)}))},t.prototype.onTimeUpdate=function(t){var e=this;this.listeners.forEach((function(e){return e.onTimeUpdate&&e.onTimeUpdate(t)})),this.position=t,this.throttledTimeUpdate||(this.throttledTimeUpdate=new Promise((function(t,r){setTimeout((function(){e.onThrottledTimeUpdate(e.position),e.throttledTimeUpdate=null,t()}),e.throttleInterval)})))},t.prototype.onThrottledTimeUpdate=function(t){this.listeners.forEach((function(e){return e.onThrottledTimeUpdate&&e.onThrottledTimeUpdate(t)}))},t.prototype.onBackgroundGraphicsUpdate=function(t){this.listeners.forEach((function(e){return e.onBackgroundGraphicsUpdate&&e.onBackgroundGraphicsUpdate(t)}))},t.prototype.onMediaSeek=function(t){this.listeners.forEach((function(e){return e.onMediaSeek&&e.onMediaSeek(t)}))},t.prototype.onVideoSeekStart=function(){this.listeners.forEach((function(t){return t.onVideoSeekStart&&t.onVideoSeekStart()}))},t.prototype.onVideoSeekEnd=function(){this.listeners.forEach((function(t){return t.onVideoSeekEnd&&t.onVideoSeekEnd()}))},t.prototype.onVideoSeek=function(t){this.listeners.forEach((function(e){return e.onVideoSeek&&e.onVideoSeek(t)}))},t.prototype.onPlay=function(){this.listeners.forEach((function(t){return t.onPlay&&t.onPlay()}))},t.prototype.onPause=function(){this.listeners.forEach((function(t){return t.onPause&&t.onPause()}))},t.prototype.onSeek=function(t){this.listeners.forEach((function(e){return e.onSeek&&e.onSeek(t)}))},t.prototype.onSeekComplete=function(t){this.listeners.forEach((function(e){return e.onSeekComplete&&e.onSeekComplete(t)}))},t.prototype.onStop=function(){this.listeners.forEach((function(t){return t.onStop&&t.onStop()}))},t.prototype.onDispose=function(){this.listeners.forEach((function(t){return t.onDispose&&t.onDispose()}))},t.prototype.onResize=function(t){this.listeners.forEach((function(e){return e.onResize&&e.onResize(t)}))},t.prototype.onVolumeUpdate=function(t){this.listeners.forEach((function(e){return e.onVolumeUpdate&&e.onVolumeUpdate(t)}))},t.prototype.addListener=function(t){!t||this.listeners.indexOf(t)>=0||this.listeners.push(t)},t.prototype.removeListener=function(t){var e=!1;return this.listeners=this.listeners.filter((function(r){var n=r===t;return e=e||n,!n})),e},t}(),Sn=function(){function t(t,e,r){var n=this;this.player=t,this.manager=e,this.emitter=r,this._defaultBackgroundCss=null,this._background=null,t.addListener({onStageElementSet:function(t){return n.doUpdateBackground(n.background)}})}return Object.defineProperty(t.prototype,"background",{get:function(){return this._background},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultBackgroundCss",{get:function(){return this._defaultBackgroundCss?this._defaultBackgroundCss:""},set:function(t){this._defaultBackgroundCss=t,this.updateBackground(this._background)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return null!==this._background},enumerable:!1,configurable:!0}),t.prototype.settingBackground=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){switch(e.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,e.sent()&&this.doUpdateBackground(t)]}}))}))},t.prototype.setBackground=function(t){return yn(this,0,void 0,(function(){var e;return gn(this,(function(r){switch(r.label){case 0:return[4,this.doSetBackground(t)];case 1:return[2,(e=r.sent())&&this.updateBackground(e)]}}))}))},t.prototype.doSetBackground=function(t){return yn(this,0,void 0,(function(){var e,r,n;return gn(this,(function(i){switch(i.label){case 0:return e=t&&t.originalUrl?t.originalUrl:"",this.manager.isBackgroundColorAsset(t)?[2,{css:e,originalUrl:e}]:this.manager.isBackgroundPiaproImageAsset(t)?[4,this.manager.read(e)]:[3,2];case 1:return(r=i.sent())&&r.url&&this.manager.checkBackgroundImageLicense(r.license)?(r.originalUrl=e,t&&(r.x=t.x,r.y=t.y),[2,r]):[2,{css:"",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,license:r?r.license:void 0}];case 2:return this.manager.isBackgroundSpecialImageAsset(t)?[2,{css:'url("https://api.textalive.jp/images/backgrounds/snowmiku2016/'+(n=/^snowmiku2016-([0-9]{2})$/.exec(e))[1]+'.jpg")',contentUrl:"https://api.textalive.jp/images/backgrounds/snowmiku2016/"+n[1]+".jpg",url:"https://snowmiku.com/2016/info_chara.html",name:"SNOW MIKU 2016",authorName:"豆の素",originalUrl:e,x:t?t.x:void 0,y:t?t.y:void 0,defaultY:0}]:[2,{originalUrl:null,css:"",x:t?t.x:void 0,y:t?t.y:void 0}]}}))}))},t.prototype.updateBackground=function(t){return!!this.doUpdateBackground(t)&&(this.emitter&&this.emitter.onBackgroundGraphicsUpdate&&this.emitter.onBackgroundGraphicsUpdate(t),!0)},t.prototype.doUpdateBackground=function(t){if(!t)return!1;if(!this.player.stageElement)return this._background=t,!0;var e=this.player.stageElement.style;return t.css.length<=0?e.background=this.defaultBackgroundCss:e.background=t.css,"number"==typeof t.x||this._background&&"number"==typeof this._background.x?("number"!=typeof t.x&&(t.x=this._background.x),e.backgroundPositionX=e.backgroundPositionX+"%"):e.backgroundPositionX="number"==typeof t.defaultX?t.defaultX+"%":"center","number"==typeof t.y||this._background&&"number"==typeof this._background.y?("number"!=typeof t.y&&(t.y=this._background.y),e.backgroundPositionY=e.backgroundPositionY+"%"):e.backgroundPositionY="number"==typeof t.defaultY?t.defaultY+"%":"center",e.backgroundSize="cover",this._background=t,!0},t.prototype.export=function(){if(!this.background||!this.background.originalUrl)return null;var t={originalUrl:this.background.originalUrl};return void 0!==this.background.x&&(t.x=this.background.x),void 0!==this.background.y&&(t.y=this.background.y),t},t.prototype.exportPartialVideoEntry=function(t){return{background:this.export()}},t}();function Tn(t,e,r){return yn(this,0,void 0,(function(){var n,i,o,s,a,u,c,l,p,h,d,f,y,g;return gn(this,(function(v){switch(v.label){case 0:if(n={loaded:[],failed:[]},"undefined"==typeof window||!window.document||!window.document.head)return n.failed=t.slice(),[2,n];for(i=r.split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort(),o=!0,s=0,i.forEach((function(t){var r=e.indexOf(t,s);o=o&&r>=0,s=r})),a=window.document.head,u=[],c=0;c0&&(f.google={families:d}),h.length>0&&(f.custom={families:h,urls:p}),!f.google&&!f.custom)return[3,6];v.label=1;case 1:return v.trys.push([1,5,,6]),(g="undefined"!=typeof window&&(null===window||void 0===window?void 0:window.WebFont))?[3,3]:[4,import("webfontloader")];case 2:g=v.sent(),v.label=3;case 3:return y=g,[4,new Promise((function(t){f.active=f.inactive=t,y.load(f)}))];case 4:case 5:return v.sent(),[3,6];case 6:return[2,n]}}))}))}function xn(t,e){return yn(this,0,void 0,(function(){var r,n,i,o,s,a,u;return gn(this,(function(c){switch(c.label){case 0:if(r={loaded:[],failed:[]},!("undefined"!=typeof window&&window.document&&window.document.head&&window.Ts&&window.Ts.loadFontAsync))return r.failed=t.slice(),[2,r];for(n=window.document.head,i={},o=function(t){var e=n.children.item(t);if("style"!==e.tagName.toLowerCase()||"text/css"!==e.getAttribute("type")||"stylesheet"!==e.getAttribute("rel")||!e.hasAttribute("data-cssName"))return"continue";var r=e.getAttribute("data-cssName");if(void 0===i[r])return i[r]=new Set(e.getAttribute("data-text")),"continue";e.getAttribute("data-text").split("").forEach((function(t){return i[r].add(t)}))},s=0;s=0})))]}}))}))},t.prototype.listFontFamiliesInVideo=function(t){if(!t||!t.phrases)return null;var e=[];return t.phrases.forEach((function(t){return t.words.forEach((function(t){return t.characters.forEach((function(t){return e.push(t.fontFamily)}))}))})),e.filter((function(t,e,r){return r.indexOf(t)===e}))},t.prototype.listAvailableFonts=function(){return yn(this,0,void 0,(function(){return gn(this,(function(t){return[2,this.fontInfoManager.listAvailableFonts()]}))}))},t.prototype.isLoading=function(){return!!this.queue},t.prototype.load=function(t){return yn(this,0,void 0,(function(){var e,r;return gn(this,(function(n){switch(n.label){case 0:return e=[],r=[],t.forEach((function(t){"string"==typeof t?e.push(t):r.push(t)})),[4,this.fontInfoManager.listAvailableFonts()];case 1:return n.sent().forEach((function(t){e.indexOf(t.key)>=0&&r.push(t)})),[2,this.loadFonts(r)]}}))}))},t.prototype.loadFonts=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return this.queue?(this.listener&&this.listener.onFontsLoad&&this.listener.onFontsLoad(null,new An("Failed to load some fonts because there is an ongoing font loding process",this.failed.slice())),[2,this.loaded]):(this.queue=this.doLoad(t).then((function(t){return e.queue=null,t})),[2,this.queue])}))}))},t.prototype.doLoad=function(t){return yn(this,0,void 0,(function(){var e,r,n,i,o=this;return gn(this,(function(s){switch(s.label){case 0:return e=[],r=[],[4,this.fontInfoManager.getFrequentChars()];case 1:return n=s.sent(),t.forEach((function(t){t.typesquare||t.typekit||e.push(t),t.typesquare&&r.push(t)})),i=(this.textFetcher&&this.textFetcher()||"").split("").filter((function(t,e,r){return r.indexOf(t)===e})).sort().join(""),[2,Promise.all([Tn(e,n,i),xn(r,i)]).then((function(t){var e=t[0],r=t[1],n=e.loaded.concat(r.loaded);if(o.addLoadedFonts(n),e.failed.length>0||r.failed.length>0){var i=e.failed.concat(r.failed);o.addFailedFonts(i),o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new An("Failed to load some fonts",o.failed.slice()))}else o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(n);return o.loaded})).catch((function(t){return o.listener&&o.listener.onFontsLoad&&o.listener.onFontsLoad(null,new An(t,o.failed.slice())),o.loaded}))]}}))}))},t.prototype.addLoadedFonts=function(t){var e=this;this._loaded=this.loaded.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t.prototype.addFailedFonts=function(t){var e=this;this._failed=this.failed.concat(t.filter((function(t){return e.failed.findIndex((function(e){return e.key===t.key}))<0})))},t}(),Cn=function(){function t(){}return Object.defineProperty(t.prototype,"duration",{get:function(){return this.endTime-this.startTime},enumerable:!1,configurable:!0}),t.prototype.contains=function(t){return t>=this.startTime&&t<=this.endTime},t.prototype.overlaps=function(t,e){if("object"==typeof t)return this.overlaps(t.startTime,t.endTime);var r=t;return this.contains(r)||this.contains(e)||this.startTime<=r&&this.endTime>=e},t.prototype.progress=function(t){return this.contains(t)?this.startTime===this.endTime?0:(t-this.startTime)/(this.endTime-this.startTime):-1},t}(),Nn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),Object.defineProperty(e.prototype,"endTime",{get:function(){return this.next?this.next.startTime:this.startTime},enumerable:!1,configurable:!0}),e}(Cn),kn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),e}(Cn),jn=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),e}(Cn),In=function(t){function e(){var e=t.call(this)||this;return e.previous=e.next=null,e}return dn(e,t),e}(Cn),Un=function(){function t(t){var e=t.analysis,r=t.info;this.beats=[],this.chords=[],this.segments=[],this.voice=[],this._revisions={beatId:(null==r?void 0:r.beatRevisionId)||-1,chordId:(null==r?void 0:r.chordRevisionId)||-1,repetitiveSegmentId:(null==r?void 0:r.chorusRevisionId)||-1},this.parseBeats(null==e?void 0:e.beats),this.parseSegments(null==e?void 0:e.repetitive_segment),this.parseChords(null==e?void 0:e.chords),this.parseVoice(e.voice)}return Object.defineProperty(t.prototype,"revisions",{get:function(){return this._revisions},enumerable:!1,configurable:!0}),t.prototype.parseBeats=function(t){var e=this;if(this.beats.splice(0,this.beats.length),Array.isArray(t)&&Array.isArray(t[0])){var r=null,n=0;t[0].forEach((function(t){var i=new Nn;i.startTime=1e3*t[0],i.length=t[2],i.position=t[3],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.beats.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseChords=function(t){var e=this;if(this.chords.splice(0,this.chords.length),Array.isArray(t)){var r=null,n=0;t.forEach((function(t){var i=new kn;i.startTime=1e3*t[0],i.endTime=1e3*t[1],i.name=t[2],i.previous=r,null!==r&&(r.next=i),i.index=n++,e.chords.push(i),r=i})),null!==r&&(r.next=null)}},t.prototype.parseSegments=function(t){var e=this;this.segments.splice(0,this.segments.length),Array.isArray(t)&&t.forEach((function(t){var r={chorus:!!t.chorus,duration:10*t.segment_length,segments:null},n=null,i=0;r.segments=t.start_frames.map((function(t){var e=new jn;return e.startTime=10*t,e.endTime=e.startTime+r.duration,e.previous=n,null!==n&&(n.next=e),e.index=i++,n=e,e})),null!==n&&(n.next=null),e.segments.push(r)}))},t.prototype.parseVoice=function(t){var e=this;this.voice.splice(0,this.voice.length),Array.isArray(t)&&t.forEach((function(t){var r=[],n=null,i=0,o=0;t.forEach((function(t){var e=new In;e.startTime=o,e.endTime=e.startTime+10*t[1],e.f0=t[0][0],e.initialF0=t[0][1],e.previous=n,null!==n&&(n.next=e),e.index=i++,r.push(e),n=e,o=e.endTime})),null!==n&&(n.next=null),e.voice.push(r)}))},t}(),Fn=function(){function t(t){var e=t.song,r=t.analysis,n=t.vocalAmplitude,i=t.maxVocalAmplitude,o=t.valenceArousal;this._song=e,this._analysis=r,this._vocalAmplitude=n,this._maxVocalAmplitude=i,this._valenceArousal=o}return Object.defineProperty(t.prototype,"song",{get:function(){return this._song},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"analysis",{get:function(){return this._analysis},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vocalAmplitude",{get:function(){return this._vocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxVocalAmplitude",{get:function(){return this._maxVocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valenceArousal",{get:function(){return this._valenceArousal},enumerable:!1,configurable:!0}),t.prototype.getChoruses=function(){var t;if(!this._analysis)return[];var e=this._analysis.segments.filter((function(t){return t.chorus}));return e.length<=0?[]:(null===(t=e[0].segments)||void 0===t?void 0:t.slice())||[]},t.prototype.findChorus=function(t,e){return st(this.getChoruses(),t,e)},t.prototype.findChorusBetween=function(t,e){return this.findChorus(t,{endTime:e})},t.prototype.findChorusChange=function(t,e){return at(this.getChoruses(),t,e)},t.prototype.getBeats=function(){var t,e;return(null===(e=null===(t=this._analysis)||void 0===t?void 0:t.beats)||void 0===e?void 0:e.slice())||[]},t.prototype.findBeat=function(t,e){return st(this.getBeats(),t,e)},t.prototype.findBeatChange=function(t,e){return at(this.getBeats(),t,e)},t.prototype.getChords=function(){var t,e;return(null===(e=null===(t=this._analysis)||void 0===t?void 0:t.chords)||void 0===e?void 0:e.slice())||[]},t.prototype.findChord=function(t,e){return st(this.getChords(),t,e)},t.prototype.findChordChange=function(t,e){return at(this.getChords(),t,e)},t.prototype.getVocalFrequency=function(t){var e;if(!Array.isArray(null===(e=this._analysis)||void 0===e?void 0:e.voice))return-1;var r=this._analysis.voice[0];if(r.length<=0)return-1;var i=n.sortedIndex(r,t,(function(t){return t.endTime}));return r[i].contains(t)?r[i].f0:-1},t.prototype.getVocalAmplitude=function(t){var e=this._vocalAmplitude,r=Math.round(t/10);return!Array.isArray(this._vocalAmplitude)||r<0||r>=e.length?-1:this._vocalAmplitude[r]},t.prototype.getMaxVocalAmplitude=function(){return"number"==typeof this._maxVocalAmplitude?this._maxVocalAmplitude:-1},t.prototype.getValenceArousal=function(t){var e=this._valenceArousal;if(!e)return null;var r=n.sortedIndex(e.seq,t,(function(t){return 1e3*t.t[1]}));if(r<0)return{a:e.seq[0].a,v:e.seq[0].v};if(r+1>=e.seq.length||t<1e3*e.seq[r+1].t[0])return{a:e.seq[Math.min(r,e.seq.length-1)].a,v:e.seq[Math.min(r,e.seq.length-1)].v};var i=e.seq[r],o=e.seq[r+1],s=t/1e3,a=o.t[0],u=i.t[1],c=u-a;return{a:(i.a*(u-s)+o.a*(s-a))/c,v:(i.v*(u-s)+o.v*(s-a))/c}},t.prototype.getMedianValenceArousal=function(){var t=this._valenceArousal;return t?t.stats.median:null},t}(),Ln=function(){function t(t,e,r){this.songManager=t,this.options=r,this.listener=e}return Object.defineProperty(t.prototype,"song",{get:function(){return this._song},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"analysis",{get:function(){return this._analysis},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vocalAmplitude",{get:function(){return this._vocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxVocalAmplitude",{get:function(){return this._maxVocalAmplitude},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valenceArousal",{get:function(){return this._valenceArousal},enumerable:!1,configurable:!0}),t.prototype.loadSong=function(t,e){var r,n,i;return yn(this,0,void 0,(function(){var o,s;return gn(this,(function(a){switch(a.label){case 0:return"number"==typeof t&&t<0||!t?(this.onSongLoad(null,new Error("Neither Songle ID or code provided")),[2,null]):[4,this.songManager.load("number"==typeof t?{id:t}:{code:t})];case 1:return o=a.sent(),this.onSongLoad(o,o?void 0:new Error("Song data not found")),o?(s={chord:null==e?void 0:e.chordId,beat:null==e?void 0:e.beatId,chorus:null==e?void 0:e.repetitiveSegmentId},[4,Promise.all([(null===(r=this.options)||void 0===r?void 0:r.vocalFrequencyEnabled)?this.loadSongDetailInfo(o.song.code,{revisions:s}):this.loadSongInfo(o.song.code,{revisions:s}),(null===(n=this.options)||void 0===n?void 0:n.vocalAmplitudeEnabled)?this.loadVocalAmplitude(o.song.code):Promise.resolve(null),(null===(i=this.options)||void 0===i?void 0:i.valenceArousalEnabled)?this.loadValenceArousal(o.song.code):Promise.resolve(null)])]):[2,null];case 2:return a.sent(),[2,new Fn(this)]}}))}))},t.prototype.onSongLoad=function(t,e){this._song=t,this.listener&&this.listener.onSongLoad&&this.listener.onSongLoad(t,e)},t.prototype.loadSongInfo=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.loadSongDetailInfo=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.songManager.loadDetailInfo(String(t),e)];case 1:return r=n.sent(),this.onSongMapLoad(r,r?void 0:new Error("Song analysis data not found")),[2,r]}}))}))},t.prototype.mockSongInfo=function(t){var e=function(t){for(var e=t.beat,r=t.chorusSegment,n=t.duration,i=[],o=0;60*o/e.bpm=0,r=this.managers.lyrics.fetchLyricBody(n||t.url,{parserPath:t.parser_path,directAccess:i}),[4,e?Promise.race([r,new Promise((function(t,e){return setTimeout((function(){return e(new Error("Fetching lyrics text timeout"))}),o.options.lyricsFetchTimeout)}))]):r];case 1:return[2,s.sent()]}}))}))},t.prototype.onLyricsLoad=function(t,e){this.listener&&this.listener.onLyricsLoad&&this.listener.onLyricsLoad(t,e)},t.prototype.onTextLoad=function(t,e){this.listener&&this.listener.onTextLoad&&this.listener.onTextLoad(t,e)},t}(),Mn=function(){function t(t){var e=t.video;this._video=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._video.json},enumerable:!1,configurable:!0}),t}(),Bn=function(){function t(t,e){this.managers=t,this.listener=e,this.listener=e}return Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),t.prototype.onVideoLoad=function(t,e){var r=t?Object.assign(t,e):null;return r&&("string"==typeof r.json?r.json=JSON.parse(r.json):"object"==typeof r.json&&null!==r.json||(r.json={}),"string"==typeof r.config?r.config=JSON.parse(r.config):"object"==typeof r.config&&null!==r.config||(r.config={})),this._video=r,this.listener&&this.listener.onVideoLoad&&this.listener.onVideoLoad(r),new Mn({video:r})},t.prototype.createFromVideoId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.video.load(t)];case 1:return r=n.sent(),[2,this.onVideoLoad(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return this.onVideoLoad(t,e)},t.prototype.createFromSongUrl=function(t,e){return yn(this,0,void 0,(function(){return gn(this,(function(r){return[2,this.createFromSongPath(this.managers.song.getSongPathFromUrl(t),e)]}))}))},t.prototype.createFromSongPath=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({songPath:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({id:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSongCode=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,this.managers.song.load({code:t})];case 1:return(r=n.sent())?[2,this.createFromSong(r.song,e)]:[2,null]}}))}))},t.prototype.createFromSong=function(t,e){var r;return yn(this,0,void 0,(function(){var n,i,o,s,a,u;return gn(this,(function(c){switch(c.label){case 0:return n=null==e?void 0:e.lyricId,i=null==e?void 0:e.lyricDiffId,"number"!=typeof n||n<0?[4,this.managers.lyrics.load(t.code)]:[3,4];case 1:return o=c.sent(),(a=o&&!o.status.failed&&!o.status.processing&&Array.isArray(o.lyrics)&&o.lyrics.length>0)?[4,this.managers.lyrics.loadDetail(t.code,o.lyrics[0].id)]:[3,3];case 2:a=c.sent(),c.label=3;case 3:(s=a)&&(n=s.id,i=null===(r=s.diff)||void 0===r?void 0:r.id),c.label=4;case 4:return"number"!=typeof n&&(n=-1),"number"!=typeof i&&(i=-1),u={id:-1,sourceId:-1,sourceOriginId:-1,songleId:t.id,songleCode:t.code,lyricId:n,lyricDiffId:i,title:null,log:null,background:null,config:null,json:null,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null},[2,this.onVideoLoad(u,e)]}}))}))},t.prototype.createFromText=function(t,e){return yn(this,0,void 0,(function(){var r,n,i,o,s,a;return gn(this,(function(u){switch(u.label){case 0:return[4,this.managers.text.parse(t)];case 1:return r=u.sent(),n=r&&"success"===r.status?this.createVideoDataFromParsedText(r,t):this.createVideoDataFromText(t),i=n[n.length-1],o=i&&i.words[i.words.length-1],s=o&&o.characters[o.characters.length-1],a=s?s.endTime:0,[2,this.createFromJSON({phrases:n,startTime:0,endTime:a,duration:a},e)]}}))}))},t.prototype.createFromJSON=function(t,e){var r={id:-1,sourceId:-1,sourceOriginId:-1,songleId:-1,lyricId:-1,lyricDiffId:-1,title:null,log:null,background:null,config:null,json:t,synthJson:null,author:null,createdDate:null,accessCount:-1,altUrl:null};return this.onVideoLoad(r,e)},t.prototype.createVideoDataFromParsedText=function(t,e){var r=0,n=e.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/);return t.result.map((function(t,e){return{words:t.map((function(t){return{characters:n[e].substr(t.startPosition,t.wordLength).split("").map((function(t){return{char:t,startTime:300*r,endTime:300*++r}})),pos:t.PoS,rawPoS:t.rawPoS,language:t.language}})),templates:[{type:"DefaultAlignment"}]}}))},t.prototype.createVideoDataFromText=function(t){for(var e,r={characters:[]},n={words:[r],templates:[{type:"DefaultAlignment"}]},i=0,o=[n],s=0;s=0?[4,this.fontLoader.loadForVideo(null===(t=this.videoProvider)||void 0===t?void 0:t.data)]:[3,2];case 1:case 3:case 5:return n.sent(),[2];case 2:return Array.isArray(null===(e=this.options)||void 0===e?void 0:e.fontFamilies)?[4,this.fontLoader.load(this.options.fontFamilies)]:[3,4];case 4:return null!==(null===(r=this.options)||void 0===r?void 0:r.fontFamilies)?[3,6]:[4,this.fontLoader.loadAll()];case 6:return[2]}}))}))},t.prototype.importLyrics=function(){var t=this.text.replace(/[\s\r\n]/g,""),e=0,r={phrases:this.lyrics.data.map((function(r){return{words:r.map((function(r){return{characters:r.map((function(r){return{char:t.charAt(e++),startTime:1e3*r.start_time,endTime:1e3*r.end_time}}))}}))}}))};this.video.json&&Array.isArray(this.video.json.phrases)?this.video.json.phrases.forEach((function(t,e){t.words.forEach((function(t,n){t.characters.forEach((function(t,i){var o=r.phrases[e].words[n].characters[i];t.char=o.char,t.startTime=o.startTime,t.endTime=o.endTime}))}))})):this.video.json=r},t.prototype.getChoruses=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChoruses()},t.prototype.findChorus=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorusBetween(t,e)},t.prototype.findChorusChange=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChorusChange(t,e)},t.prototype.getBeats=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getBeats()},t.prototype.findBeat=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findBeat(t,e)},t.prototype.findBeatChange=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findBeatChange(t,e)},t.prototype.getChords=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getChords()},t.prototype.findChord=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChord(t,e)},t.prototype.findChordChange=function(t,e){var r;return null===(r=this.songProvider)||void 0===r?void 0:r.findChordChange(t,e)},t.prototype.getVocalFrequency=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){var e;return null===(e=this.songProvider)||void 0===e?void 0:e.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){var t;return null===(t=this.songProvider)||void 0===t?void 0:t.getMedianValenceArousal()},t}(),Gn=function(){function t(t,e){this.player=t,this.listener=e,this.initialize()}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?fn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"author",{get:function(){return this._author},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"server",{get:function(){return this._server},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"managed",{get:function(){return!!this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songUrl",{get:function(){return this._songUrl},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"songOptions",{get:function(){return this._songOptions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parameters",{get:function(){return this._parameters},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isConnecting",{get:function(){return!!this.connecting},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t,e,r,n;return yn(this,0,void 0,(function(){return gn(this,(function(i){switch(i.label){case 0:return this._options=null===(e=null===(t=this.player)||void 0===t?void 0:t.options)||void 0===e?void 0:e.app,this._options&&(this._options=fn({},this._options),this._name=null===(r=this._options)||void 0===r?void 0:r.appName,this._author=null===(n=this._options)||void 0===n?void 0:n.appAuthor,this._options.token&&(b.textalive.appToken=this._options.token)),this._parameters={},this.parseQueryString(),this.initializeServerConnection(),"undefined"!=typeof window&&this._options?[4,this.connect()]:[3,2];case 1:i.sent(),this.initializePlayerListener(),this.initializeMessageListener(),i.label=2;case 2:return this._songUrl&&this.createFromSongUrl(),[2]}}))}))},t.prototype.initializeServerConnection=function(){var t,e,r,n,i,o;return yn(this,0,void 0,(function(){var s,a,u,c,l;return gn(this,(function(p){switch(p.label){case 0:return[4,A.getServerStatus()];case 1:return s=p.sent(),a="ja"===(null==s?void 0:s.lang),b.textalive.appToken&&(null==s?void 0:s.app)&&(s.app.data&&(this._name=null===(t=s.app.data)||void 0===t?void 0:t.name,this._author=null===(r=null===(e=s.app)||void 0===e?void 0:e.data)||void 0===r?void 0:r.author,u=null===(i=null===(n=s.app)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status,this._status="number"==typeof u?u:-1),this._server={version:s.version,message:s.app.message,error:s.app.error},!this._server.error)?(c=this._server.message?"\n".concat(this._server.message):"",a?console.info("[TextAlive API] クライアント v".concat(b.client.version," でサーバ v").concat(this._server.version||"0.0.0"," に接続").concat(c)):console.info("[TextAlive API] App API client v".concat(b.client.version," connected to server v").concat(this._server.version||"0.0.0").concat(c)),this.listener.onAppLoad(this),[2]):(l=(null===(o=this._server)||void 0===o?void 0:o.error)?"\n".concat(this._server.error):"",a?console.warn("[TextAlive API] このアプリはトークンが正しく指定されていないため動作しません。 https://developer.textalive.jp からトークンを入手して指定してください。".concat(l)):console.warn("[TextAlive API] This app requires a valid app token to run properly. You could get a token from https://developer.textalive.jp. ".concat(l)),this.listener.onAppLoad(null,l),[2])}}))}))},t.prototype.initializePlayerListener=function(){var t=this;this.playerListener={onVideoReady:function(e){t._host&&window.parent.postMessage({kind:"ta_video",options:{lyrics:!!t.player.data.lyrics,duration:t.player.video.duration}},"*")},onThrottledTimeUpdate:function(e){t._host&&window.parent.postMessage({kind:"ta_position",options:{position:e}},"*")},onPlay:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"play"}},"*")},onPause:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"pause"}},"*")},onStop:function(){t._host&&window.parent.postMessage({kind:"ta_status",options:{status:"stop"}},"*")},onVolumeUpdate:function(e){t._host&&window.parent.postMessage({kind:"ta_volume",options:{volume:e}},"*")},onDispose:function(){t.dispose()}},this.player.addListener(this.playerListener)},t.prototype.initializeMessageListener=function(){var t=this;this.messageListener=function(e){if(e.data.kind&&/^ta_/.test(e.data.kind)){var r=t.player;switch(e.data.kind.substring(3)){case"status":switch(e.data.options.status){case"play":r.requestPlay();break;case"pause":r.requestPause();break;case"stop":r.requestStop()}break;case"seek":r.requestMediaSeek(e.data.options.position);break;case"volume":r.volume=e.data.options.volume;break;case"parameter":var n=e.data.options,i=n.name,o=n.value;t.parameters[i]=o,t.listener.onAppParameterUpdate(i,o);break;case"media":t._songUrl=e.data.options.url,t._songOptions=e.data.options.options||{},r.requestStop();var s=t.createFromSongUrl();t.listener.onAppMediaChange(t._songUrl,s)}}},window.addEventListener("message",this.messageListener)},t.prototype.createFromSongUrl=function(){var t,e=this._songOptions;return e&&(t={video:{}},e.altLyricsUrl&&(t.altLyricsUrl=e.altLyricsUrl),e.lyricsDirectAccess&&(t.lyricsDirectAccess=e.lyricsDirectAccess),e.lyricId&&(t.video.lyricId=e.lyricId),e.lyricDiffId&&(t.video.lyricDiffId=e.lyricDiffId),e.chordId&&(t.video.chordId=e.chordId),e.beatId&&(t.video.beatId=e.beatId),e.repetitiveSegmentId&&(t.video.repetitiveSegmentId=e.repetitiveSegmentId)),this.player.createFromSongUrl(this._songUrl,t)},t.prototype.parseQueryString=function(){var t=pn("ta_app_token");t&&(b.textalive.appToken=t),this._songUrl=pn("ta_song_url"),this._songOptions={};var e=pn("ta_lyric_id");e&&(this._songOptions.lyricId=parseInt(e),isNaN(this._songOptions.lyricId)&&delete this._songOptions.lyricId);var r=pn("ta_lyric_diff_id");r&&(this._songOptions.lyricDiffId=parseInt(r),isNaN(this._songOptions.lyricDiffId)&&delete this._songOptions.lyricDiffId);var n=pn("ta_alt_lyrics_url");n&&(this._songOptions.altLyricsUrl=n);var i=pn("ta_lyrics_direct_access");i&&(this._songOptions.lyricsDirectAccess="true"===i,this._songOptions.lyricsDirectAccess||delete this._songOptions.lyricsDirectAccess);var o=pn("ta_chord_id");o&&(this._songOptions.chordId=parseInt(o),isNaN(this._songOptions.chordId)&&delete this._songOptions.chordId);var s=pn("ta_beat_id");s&&(this._songOptions.beatId=parseInt(s),isNaN(this._songOptions.beatId)&&delete this._songOptions.beatId);var a=pn("ta_repetitive_segment_id");a&&(this._songOptions.repetitiveSegmentId=parseInt(a),isNaN(this._songOptions.repetitiveSegmentId)&&delete this._songOptions.repetitiveSegmentId)},t.prototype.connect=function(){return yn(this,0,void 0,(function(){var t,e=this;return gn(this,(function(r){switch(r.label){case 0:return this.connecting?[2,this.connecting]:"undefined"!=typeof window&&this.options&&window.parent&&window!==window.parent?[3,2]:[4,new Promise((function(t){return setTimeout(t,1)}))];case 1:return r.sent(),this.listener.onAppReady(this),[2,!1];case 2:return this.connecting=Promise.race([new Promise((function(r){t=function(n){n.data.kind&&/^ta_/.test(n.data.kind)&&"ack"===n.data.kind.substring(3)&&(window.removeEventListener("message",t),e._host=n.data.options,r(!0))},window.addEventListener("message",t)})),yn(e,0,void 0,(function(){var e;return gn(this,(function(r){switch(r.label){case 0:e=0,r.label=1;case 1:return e<5?(window.parent.postMessage({kind:"ta_connect",options:this.options},"*"),[4,new Promise((function(t){return setTimeout(t,200)}))]):[3,4];case 2:if(r.sent(),this._host)return[3,4];r.label=3;case 3:return e++,[3,1];case 4:return!this._host&&t&&window.removeEventListener("message",t),[2,!!this._host]}}))}))]),this.connecting.finally((function(){e.connecting=null,e.listener.onAppReady(e)})),[2,this.connecting]}}))}))},t.prototype.dispose=function(){"undefined"!=typeof window&&this.options&&(this.player.removeListener(this.playerListener),window.removeEventListener("message",this.messageListener)),this._host=null,this.player=null},t}();function qn(t){return t}function Wn(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0==t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}function Yn(t){return function(e){return Math.pow(e,t)}}function zn(t){return function(e){return 1-Math.pow(1-e,t)}}function Jn(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}var Hn=Yn(2),Xn=zn(2),Zn=Jn(2),$n=Yn(3),Kn=zn(3),Qn=Jn(3),ti=Yn(4),ei=zn(4),ri=Jn(4),ni=Yn(5),ii=zn(5),oi=Jn(5);function si(t){return 1-Math.cos(t*Math.PI/2)}function ai(t){return Math.sin(t*Math.PI/2)}function ui(t){return-.5*(Math.cos(Math.PI*t)-1)}function ci(t){return function(e){return e*e*((t+1)*e-t)}}var li=ci(1.7);function pi(t){return function(e){return--e*e*((t+1)*e+t)+1}}var hi=pi(1.7);function di(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}var fi=di(1.7);function yi(t){return-(Math.sqrt(1-t*t)-1)}function gi(t){return Math.sqrt(1- --t*t)}function vi(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function mi(t){return 1-bi(1-t)}function bi(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function _i(t){return t<.5?.5*mi(2*t):.5*bi(2*t-1)+.5}function wi(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return-t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)}}var Pi=wi(1,.3);function Ei(t,e){var r=2*Math.PI;return function(n){if(0==n||1==n)return n;var i=e/r*Math.asin(1/t);return t*Math.pow(2,-10*n)*Math.sin((n-i)*r/e)+1}}var Oi=Ei(1,.3);function Si(t,e){var r=2*Math.PI;return function(n){var i=e/r*Math.asin(1/t);return(n*=2)<1?t*Math.pow(2,10*(n-=1))*Math.sin((n-i)*r/e)*-.5:t*Math.pow(2,-10*(n-=1))*Math.sin((n-i)*r/e)*.5+1}}var Ti=Si(1,.3*1.5),xi=Object.freeze({__proto__:null,backIn:li,backInOut:fi,backOut:hi,bounceIn:mi,bounceInOut:_i,bounceOut:bi,circIn:yi,circInOut:vi,circOut:gi,cubicIn:$n,cubicInOut:Qn,cubicOut:Kn,elasticIn:Pi,elasticInOut:Ti,elasticOut:Oi,get:Wn,getBackIn:ci,getBackInOut:di,getBackOut:pi,getElasticIn:wi,getElasticInOut:Si,getElasticOut:Ei,getPowIn:Yn,getPowInOut:Jn,getPowOut:zn,linear:qn,quadIn:Hn,quadInOut:Zn,quadOut:Xn,quartIn:ti,quartInOut:ri,quartOut:ei,quintIn:ni,quintInOut:oi,quintOut:ii,sineIn:si,sineInOut:ui,sineOut:ai}),Ai=function(){function t(){}return t.linear=qn,t.get=Wn,t.getPowIn=Yn,t.getPowOut=zn,t.getPowInOut=Jn,t.quadIn=Hn,t.quadOut=Xn,t.quadInOut=Zn,t.cubicIn=$n,t.cubicOut=Kn,t.cubicInOut=Qn,t.quartIn=ti,t.quartOut=ei,t.quartInOut=ri,t.quintIn=ni,t.quintOut=ii,t.quintInOut=oi,t.sineIn=si,t.sineOut=ai,t.sineInOut=ui,t.getBackIn=ci,t.backIn=li,t.getBackOut=pi,t.backOut=hi,t.getBackInOut=di,t.backInOut=fi,t.circIn=yi,t.circOut=gi,t.circInOut=vi,t.bounceIn=mi,t.bounceOut=bi,t.bounceInOut=_i,t.getElasticIn=wi,t.elasticIn=Pi,t.getElasticOut=Ei,t.elasticOut=Oi,t.getElasticInOut=Si,t.elasticInOut=Ti,t}(),Ri=function(){function t(){this.cursor=-1,this.widgets=[],this.instances=[],this.model={id:-1,type:i.NONE,sourceId:-1,author:null,originalAuthor:null,className:null,createdDate:null}}return Object.defineProperty(t.prototype,"id",{get:function(){return this.model?this.model.id:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"script",{get:function(){return this.model?this.model.script:null},enumerable:!1,configurable:!0}),t}(),Ci=function(){},Ni=function(){function t(t,e){this.onTemplateLoad=e,this._emitter=null,this._loaded=null,this._loading=null,this.verbose=!1,this._emitter=t,this.clear()}return Object.defineProperty(t.prototype,"loaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this._loading},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this._loaded={},this._loading={}},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),yn(this,0,void 0,(function(){var e;return gn(this,(function(r){switch(r.label){case 0:return[4,q.list({maxResults:t,withoutAuthors:!0,withoutOriginalAuthors:!0,script:!0})];case 1:return(e=r.sent())&&e.list?(this.verbose&&console.log("--- loading template classes ---"),[2,this.registerMany(e.list)]):[2]}}))}))},t.prototype.loadForVideo=function(t){return yn(this,0,void 0,(function(){var e,r=this;return gn(this,(function(n){switch(n.label){case 0:return[4,q.loadForVideo(t)];case 1:return(e=n.sent())&&e.list?(this.verbose&&console.log("--- loading template classes for vid:".concat(t," ---")),[4,this.registerMany(e.list)]):[2,null];case 2:return[2,n.sent().map((function(t){return t?r.getByName(t):null}))]}}))}))},t.prototype.loadByNames=function(t){return yn(this,0,void 0,(function(){var e,r=this;return gn(this,(function(n){switch(n.label){case 0:return!Array.isArray(t)||t.length<=0?[2,[]]:(this.verbose&&console.log("--- loading template classes ---"),[4,Promise.all(t.map((function(t){return r.doLoadByName(t)})))]);case 1:return(e=n.sent())&&this._emitter.onTemplatesLoad(e.filter((function(t){return!!t})).map((function(t){return t.className}))),[2,e]}}))}))},t.prototype.loadByName=function(t){return yn(this,0,void 0,(function(){var e,r;return gn(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.doLoadByName(t)];case 1:return e=n.sent(),this._emitter.onTemplatesLoad([e.className]),[2,e];case 2:return r=n.sent(),this._emitter.onTemplatesLoad(null,r),[2,null];case 3:return[2]}}))}))},t.prototype.doLoadByName=function(t){return yn(this,0,void 0,(function(){var e,r,n=this;return gn(this,(function(i){return null!==(e=this.getByName(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return q.loadByName(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.loadById=function(t){return yn(this,0,void 0,(function(){var e,r,n;return gn(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.doLoadById(t)];case 1:return e=i.sent(),r=null,[3,3];case 2:return n=i.sent(),r=n,[3,3];case 3:return this._emitter.onTemplatesLoad(e?[e.className]:null,r),[2,e]}}))}))},t.prototype.doLoadById=function(t){return yn(this,0,void 0,(function(){var e,r,n=this;return gn(this,(function(i){return(e=this.getById(t))?[2,e]:this._loading[t]?[2,this._loading[t]]:(r=new Promise((function(e){return q.load(t).then((function(t){return n.onTemplateLoad(t)})).then(e)})),this._loading[t]=r,r.finally((function(){return delete n._loading[t]})),[2,r])}))}))},t.prototype.registerMany=function(t){return yn(this,0,void 0,(function(){var e,r,n=this;return gn(this,(function(i){switch(i.label){case 0:return e=t.map((function(t){var e=n.onTemplateLoad(t);return n._loading[t.className]=e,n._loading["".concat(t.className,"@").concat(t.id)]=e,e})),[4,Promise.all(e.map((function(t){return t.then((function(t){return t.className})).catch((function(t){return null}))})))];case 1:return r=i.sent().filter((function(t){return!!t})),this._emitter.onTemplatesLoad(r),[2,r]}}))}))},t.prototype.commit=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,q.create({sourceId:t.model.sourceId,script:t.model.script,log:e})];case 1:return(r=n.sent()).success&&(t.model.id=r.id,this._emitter.onTemplateCommit(t.className)),[2,r]}}))}))},t.prototype.getByName=function(t,e){var r;if(void 0===e&&(e=!1),t&&(r=t.match(/(.+)@([0-9]+)/))){t=r[1];var n=parseInt(r[2]);if(!this._loaded[t])return null;var i=this._loaded[t].model;if(i.id!==n){if(!e)return null;this.verbose&&console.log("[warning] template ".concat(t," version ").concat(n," is requested but ").concat(i.id," is used"))}}return this._loaded[t]?this._loaded[t]:null},t.prototype.getById=function(t){var e=null;for(var r in this._loaded)if(this._loaded[r].model.id===t){e=this._loaded[r];break}return e},t}(),ki={Matrix2D:pt,Point:ht,Color:X,Font:Z,RenderingUnit:K,TextUnit:et,Graphic:nt,Phrase:ot,Word:it,Char:rt,Beat:Nn,RepetitiveSegment:jn},ji=["headTime","tailTime","insomnia"],Ii=["animate","getAssignedUnit","name","type"],Ui=function(){function t(t,e,r){this._emitter=null,this._player=null,this.interpreter=null,this.unsafeAcceleration=!1,this._verbose=!1,this.ignoreVersion=!1,this.rawConsole=!1,this._player=t,this._emitter=e,this.unsafeAcceleration=r,this.loader=new Ni(e,this.register.bind(this)),t.addListener({onVideoReady:this.onVideoReady.bind(this)})}return Object.defineProperty(t.prototype,"verbose",{get:function(){return this._verbose},set:function(t){this._verbose=this.loader.verbose=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return!!this.interpreter},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return this.loader.loaded},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){var t=this;if(!this.ready){var e=function(t){var e=t.player,r=t.ignoredPropNames,n=t.rawConsole,o=t.templateGetter,s=e.graphics.wrapperTable,a=new cn(fn(fn({},ki),s),r,(function(t,r){return e.graphics.isGraphics(t)&&r instanceof X?r.toString():r})),u={require:{func:function(t){if(!(t.length<1||"string"!=typeof t[0])){var e=t[0],r=o(e);return null===r?void 0:r.functionDefinition}},raw:!0,isConstructor:!0},print:{func:function(t){e.isEditing&&console.log.apply(console,t)},raw:n},findChorus:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findChorus(t[0])}},findBeat:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.findBeat(t[0])}},getVocalFrequency:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getVocalFrequency(t[0])}},getVocalAmplitude:{func:function(t){return t.length<1||"number"!=typeof t[0]?-1:e.getVocalAmplitude(t[0])}},getMaxVocalAmplitude:{func:function(t){return e.getMaxVocalAmplitude()}},getValenceArousal:{func:function(t){return t.length<1||"number"!=typeof t[0]?null:e.getValenceArousal(t[0])}},getMedianValenceArousal:{func:function(t){return e.getMedianValenceArousal()}}};Object.keys(i).forEach((function(t){a.setProperty(a.globalScope,t,i[t]),u[t]={value:i[t]}})),Object.keys(xi).forEach((function(t){var e=xi[t];0!==t.indexOf("get")&&(u[t]={func:e})}));var c=Object.keys(a.wrapperTable);return c&&c.forEach((function(t){return u[t]={cls:a.wrapperTable[t]}})),Object.keys(u).forEach((function(t){var e=u[t];e.func?a.createGlobalFunction(t,e):e.value&&a.setProperty(a.globalScope,t,e.value)})),{interpreter:a,unsafeGlobalScope:u}}({player:this._player,ignoredPropNames:Ii,rawConsole:this.rawConsole,templateGetter:function(e){return t.getByName(e,!0)}}),r=e.interpreter,n=e.unsafeGlobalScope;this.unsafeGlobalScope=n,this.interpreter=r,this.onVideoReady(this._player.video)}},t.prototype.getByName=function(t,e){return void 0===e&&(e=!1),this.loader.getByName(t,e)},t.prototype.getById=function(t){return this.loader.getById(t)},t.prototype.clear=function(){this.loader.clear()},t.prototype.loadLatest=function(t){return void 0===t&&(t=100),yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadLatest(t)]}))}))},t.prototype.loadForVideo=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadForVideo(t)]}))}))},t.prototype.loadByNames=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByNames(t)]}))}))},t.prototype.loadByName=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadByName(t)]}))}))},t.prototype.loadById=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.ready||this.initialize(),[2,this.loader.loadById(t)]}))}))},t.prototype.commit=function(t,e){return yn(this,0,void 0,(function(){return gn(this,(function(r){return[2,this.loader.commit(t,e)]}))}))},t.prototype.register=function(t){return yn(this,0,void 0,(function(){var e,r,n,i,o,s,a=this;return gn(this,(function(u){switch(u.label){case 0:if(!t)return[2,null];if("number"==typeof t.sourceId){if(e=t,!(r=this.createClass(t.script)))return[2,null]}else r=t;n=nn(r.ast).dependencies,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(n.map((function(t){var e=a.getByName(t,a.ignoreVersion);return e?Promise.resolve(e):a.loadByName(t)})))];case 2:return u.sent(),this.verbose&&console.log("load dependencies for",r.className,n),[3,4];case 3:return i=u.sent(),this.verbose&&console.error("failed loading dependencies for",r.className,i),[3,4];case 4:try{if(!(e?this.loadModel(r,e):this.createModel(r)))throw new Error("failed to create a template instance");return[2,this.registerClass(r)]}catch(t){throw o=void 0,e&&(delete(s=fn({},e)).script,o=s),{error:t.message,stack:t.stack,cause:o}}return[2]}}))}))},t.prototype.updateClassScript=function(t,e){var r=this.createClass(e);return this.updateClass(t,r)},t.prototype.registerClass=function(t){if(!t)return null;if(this.loader.loaded[t.className]){this.verbose&&console.log("updating",t.className,t.model.id);var e=this.updateClass(this.loader.loaded[t.className],t);return this.verbose&&console.log("updated",e.className,e.id),e}return this.loader.loaded[t.className]=t,this.verbose&&console.log("loaded",t.className,t.model.id),t},t.prototype.updateClass=function(t,e){var r=t,n=e;if(!n)return null;if(r.model.script===n.model.script)return this.verbose&&console.log("no diff for",r.className),r;if(!this.createModel(n))return null;if(r.className!==n.className){var i=this.getByName(n.className);if(!i)return n.cursor=r.cursor,this.loader.loaded[n.className]=n,this.verbose&&console.log("create",n.className),n;r=i}return r.newStatement=n.newStatement,r.widgets=n.widgets,r.scope=n.scope,r.functionDefinition=n.functionDefinition,r.newStatement=n.newStatement,r.unsafeConstructorGenerator=n.unsafeConstructorGenerator,r.ast=n.ast,r.cursor<0&&(r.cursor=n.cursor),n.id>=0?(this.verbose&&console.log("replace",n.className,r.id,n.id),r.model=n.model):(this.verbose&&console.log("update",n.className,r.id,n.id),r.model.type=n.model.type,r.model.className=n.model.className,r.model.prettyName=n.model.prettyName,r.model.script=n.model.script,r.model.createdDate=null,r.id>=0&&(r.model.sourceId=r.model.id,r.model.id=-1)),n=r,this.updateInstances(r.instances.slice(),n),this._emitter.onTemplateUpdate(n.className),n},t.prototype.loadModel=function(t,e){var r=this.newRawInstance(t);return t.model=e,this.updateWidgetInitialValues(t,r),r},t.prototype.createModel=function(t){var e=this.newRawInstance(t);if(null===e)return!1;if(t.id>=0)return!0;var r=e.templateInstance,n=t.model.script;return t.model={id:-1,sourceId:-1,className:t.className,prettyName:r?this.interpreter.getProperty(r,"name"):e.unsafeTemplateInstance.name,type:r?this.interpreter.getProperty(r,"type"):e.unsafeTemplateInstance.type,script:n,author:null,originalAuthor:null,createdDate:null},this.updateWidgetInitialValues(t,e),e},t.prototype.updateWidgetInitialValues=function(t,e){var r=this;t.widgets.forEach((function(t){t.initialValue=r.getProperty(e,t.name)}))},t.prototype.updateInstances=function(t,e){var r=this;t.forEach((function(t){try{r.updateInstance(t,e)}catch(r){console.log("failed updating template for",t.assignedUnit,":",e)}})),this._player.isPlaying||this._player.requestStageUpdate()},t.prototype.createClass=function(t){var e=this;this.ready||this.initialize();var r=new Ri;r.model={id:-1,sourceId:-1,className:null,prettyName:null,type:0,script:t,author:null,originalAuthor:null,createdDate:null};var n=rn(t,Ii),i=n.ast,o=n.widgets;if(r.ast=i,r.widgets=o,r.className=r.ast.body[0].id.name,r.scope=this.interpreter.prepareRun(r.ast),this.interpreter.run(1e3,"to define "+r.className),r.functionDefinition=this.interpreter.getRawProperty(r.scope,r.className),r.newStatement=this.interpreter.newStatementFor(r.className),this.unsafeAcceleration){var s=Object.keys(this.unsafeGlobalScope),a=Object.keys(this.getGlobalProperties()).map((function(t){return"".concat(t,"=props.").concat(t)})).join(","),u="return function(props){var ".concat(a,";").concat(t,"return ").concat(r.className,";}"),c=new(Function.bind.apply(Function,vn(vn([void 0],s,!1),[u],!1))),l=function(t){var r=e.getByName(t);return r?r.unsafeConstructorGenerator(e.getGlobalProperties()):null},p=s.map((function(t){if("require"===t)return l;var r=e.unsafeGlobalScope[t];return r.func?function(){for(var t=[],e=0;e8&&(v=v.substring(0,8)),!(t.indexOf(v)<0););l.length>h&&l[h].length>0&&l.splice(h,0,""),l.splice(h,0,"",p+"// @proposed",p+"// @title "+e,p+"// "+function(t,e){if("Slider"===t)return"@ui Slider("+e.min+", "+e.max+")";if("Check"===t)return"@ui Check()";if("Color"===t)return"@ui Color()";var r=e.etc;return"@comment "+(r=r.replace(/(\r\n|[\n\v\f\r\x85\u2028\u2029])/g,"")).replace(/\/[*/]/g,"")}(r,n),p+"this."+v+" = "+function(t,e){return"Slider"===t?((e.min+e.max)/2).toString():"Check"===t?"false":"Color"===t?'new Color("#000000")':"null"}(r,n)+";"),t=l.join(c)}catch(t){}return t}(t.model.script,e,r,n))},t.prototype.onVideoReady=function(t){this.ready&&(this.interpreter.setRawProperty(this.interpreter.globalScope,"width",this._player.resolutionWidth),this.interpreter.setRawProperty(this.interpreter.globalScope,"height",this._player.resolutionHeight),this.interpreter.setRawProperty(this.interpreter.globalScope,"margin",this.interpreter.wrap(this._player.margin)),this.interpreter.setRawProperty(this.interpreter.globalScope,"duration",(null==t?void 0:t.duration)||0))},t}(),Fi='',Li="https://textalive.jp",Di=function(){function t(t){var e,r=this;if(this.player=t,this._position="embed",this._rounded=!1,this._bordered=!1,this._shadowed=!1,this._background="#fff",this._color="#1f4391",void 0!==(null===(e=t.options)||void 0===e?void 0:e.mediaBannerPosition)&&(this._position=t.options.mediaBannerPosition),this.domEnabled){this.logoAnchor=document.createElement("a"),this.logoAnchor.className="textalive-logo",this.logoAnchor.innerHTML=Fi,this.logoAnchor.style.padding=this.bordered?"1px 2px":"1px 3px",this.logoAnchor.href=Li,this.logoAnchor.target="_blank",this.logoAnchor.title="Powered by TextAlive App API",this.logoSvg=this.logoAnchor.querySelector("svg"),this.logoSvg.style.width="24px",this.songNameDiv=document.createElement("div"),this.songNameDiv.className="name",this.songNameDiv.style.fontWeight="bold",this.songNameDiv.style.overflow="hidden",this.songNameDiv.style.textOverflow="ellipsis",this.songNameDiv.style.marginBottom="2px",this.songNameDiv.textContent="-",this.songArtistDiv=document.createElement("div"),this.songArtistDiv.className="artist",this.songArtistDiv.textContent="-",this.songArtistDiv.style.overflow="hidden",this.songArtistDiv.style.textOverflow="ellipsis";var n=document.createElement("span");n.innerHTML='',n.style.padding="0 3px 0 0",this.songSvg=n.querySelector("svg"),this.songSvg.style.width="14px",this.songWrapper=document.createElement("div"),this.songWrapper.style.width="203px",this.songWrapper.style.maxWidth="203px",this.songWrapper.appendChild(this.songNameDiv),this.songWrapper.appendChild(this.songArtistDiv),this.songAnchor=document.createElement("a"),this.songAnchor.className="song",this.songAnchor.target="_blank",this.songAnchor.style.display="flex",this.songAnchor.style.lineHeight="1.2em",this.songAnchor.style.padding="4px 3px 3px 3px",this.songAnchor.style.textDecoration="none",this.songAnchor.appendChild(n),this.songAnchor.appendChild(this.songWrapper),this.lyricsNameDiv=document.createElement("div"),this.lyricsNameDiv.className="name",this.lyricsNameDiv.style.fontWeight="bold",this.lyricsNameDiv.textContent="-",this.lyricsNameDiv.style.overflow="hidden",this.lyricsNameDiv.style.textOverflow="ellipsis",this.lyricsNameDiv.style.marginBottom="2px",this.lyricsArtistDiv=document.createElement("div"),this.lyricsArtistDiv.className="artist",this.lyricsArtistDiv.textContent="-",this.lyricsArtistDiv.style.overflow="hidden",this.lyricsArtistDiv.style.textOverflow="ellipsis";var i=document.createElement("span");i.innerHTML='',i.style.padding="0 3px 0 0",this.lyricsSvg=i.querySelector("svg"),this.lyricsSvg.style.width="14px",this.lyricsWrapper=document.createElement("div"),this.lyricsWrapper.style.width="90px",this.lyricsWrapper.style.maxWidth="90px",this.lyricsWrapper.appendChild(this.lyricsNameDiv),this.lyricsWrapper.appendChild(this.lyricsArtistDiv),this.lyricsAnchor=document.createElement("a"),this.lyricsAnchor.className="lyrics",this.lyricsAnchor.target="_blank",this.lyricsAnchor.style.display="flex",this.lyricsAnchor.style.lineHeight="1.2em",this.lyricsAnchor.style.padding="4px 3px 3px 3px",this.lyricsAnchor.style.textDecoration="none",this.lyricsAnchor.appendChild(i),this.lyricsAnchor.appendChild(this.lyricsWrapper),this.bannerDiv=document.createElement("div"),this.bannerDiv.className="textalive-banner",this.bannerDiv.style.cursor="pointer",this.bannerDiv.style.zIndex="10000",this.bannerDiv.style.background="#1f4391",this.bannerDiv.style.lineHeight="0",this.bannerDiv.style.display="flex",this.bannerDiv.style.maxWidth="256px",this.bannerDiv.style.fontFamily="'Hiragino Kaku Gothic Pro','游ゴシック体','Yu Gothic',YuGothic,Meiryo,HelveticaNeue,'Helvetica Neue',Helvetica,Arial,sans-serif",this.bannerDiv.style.fontSize="9px",this.bannerDiv.style.alignItems="center",this.bannerDiv.style.whiteSpace="nowrap",this.bannerDiv.appendChild(this.logoAnchor),this.bannerDiv.appendChild(this.songAnchor),this.bannerDiv.appendChild(this.lyricsAnchor),this.songAnchor.style.display="none",this.lyricsAnchor.style.display="none",this.updatePosition(),this.updateRounded(),this.updateBordered(),this.updateShadowed(),this.updateBackground(),this.updateColor()}this.listener={onAppReady:function(){r.updatePosition()},onMediaElementSet:function(t){r.domEnabled&&(r.bannerDiv&&r.bannerDiv.parentElement&&r.bannerDiv.parentElement.removeChild(r.bannerDiv),r.player.mediaBannerElement&&r.player.mediaBannerElement.appendChild(r.bannerDiv))},onVideoLoad:function(){r.domEnabled&&(r.logoAnchor.href=Li,r.songAnchor.style.display="none",r.lyricsAnchor.style.display="none",r.songAnchor.style.borderRadius="0")},onSongLoad:function(t){return yn(r,0,void 0,(function(){var e,r,n,i,o,s,a,u,c;return gn(this,(function(p){switch(p.label){case 0:return t?(e=null===(a=null===(s=null==t?void 0:t.song)||void 0===s?void 0:s.artist)||void 0===a?void 0:a.name,r=null===(u=null==t?void 0:t.song)||void 0===u?void 0:u.name,n=null===(c=null==t?void 0:t.song)||void 0===c?void 0:c.permalink,i="".concat(Li).concat(n?"/songs/".concat(encodeURIComponent(l.getSongPathFromUrl(n))):""),this.domEnabled&&(this.logoAnchor.href=i,this.songArtistDiv.textContent=Mi(e),this.songNameDiv.textContent=Mi(r),this.songAnchor.title="".concat(Mi(r)," by ").concat(Mi(e)),this.songAnchor.href=n,this.songAnchor.style.display="flex",this.songAnchor.style.borderRadius=this.rounded?"0 4px 4px 0":"0",this.songWrapper.style.width="auto"),[4,A.getServerStatus()]):[2];case 1:return"ja"===(null==(o=p.sent())?void 0:o.lang)?console.warn("[TextAlive API] 楽曲 アーティスト:",Mi(e),"/ 楽曲名:",Mi(r),"/ 配信元サイト:",Mi(n)):console.warn("[TextAlive API] Song artist:",Mi(e),"/ song name:",Mi(r),"/ distributed at:",Mi(n)),[2]}}))}))},onLyricsLoad:function(t){t&&r.domEnabled&&(r.songWrapper.style.maxWidth="90px",r.lyricsAnchor.style.display="flex",r.songAnchor.style.borderRadius="0")},onTextLoad:function(t){return yn(r,0,void 0,(function(){var e,r,n,i,o;return gn(this,(function(s){switch(s.label){case 0:return t?(e=null===(o=null==t?void 0:t.artist)||void 0===o?void 0:o.name,r=null==t?void 0:t.name,n=null==t?void 0:t.url,this.domEnabled&&(this.lyricsArtistDiv.textContent=Mi(e),this.lyricsNameDiv.textContent=Mi(r),this.lyricsAnchor.title="".concat(Mi(r)," by ").concat(Mi(e)),this.lyricsAnchor.href=n,this.lyricsWrapper.style.width="auto"),[4,A.getServerStatus()]):[2];case 1:return"ja"===(null==(i=s.sent())?void 0:i.lang)?console.warn("[TextAlive API] 歌詞 アーティスト:",Mi(e),"/ 歌詞名:",Mi(r),"/ 配信元サイト:",Mi(n)):console.warn("[TextAlive API] Song lyrics artist:",Mi(e),"/ lyrics name:",Mi(r),"/ distributed at:",Mi(n)),[2]}}))}))},onDispose:function(){r.dispose()}},t.addListener(this.listener),t.mediaBannerElement&&this.player.mediaBannerElement.appendChild(this.bannerDiv)}return Object.defineProperty(t.prototype,"domEnabled",{get:function(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(t){this._position=t,this.updatePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rounded",{get:function(){return this._rounded},set:function(t){this._rounded=t,this.updateRounded()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bordered",{get:function(){return this._bordered},set:function(t){this._bordered=t,this.updateBordered()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowed",{get:function(){return this._shadowed},set:function(t){this._shadowed=t,this.updateShadowed()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(t){this._background=t,this.updateBackground()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this.updateColor()},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.player.removeListener(this.listener)},t.prototype.updatePosition=function(){var t,e;if(this.domEnabled){var r=this.position,n=this.player;if(null===r||!(null===(t=n.options)||void 0===t?void 0:t.app)||(null===(e=n.app)||void 0===e?void 0:e.managed))this.bannerDiv.style.display="none";else if(this.bannerDiv.style.display="flex","embed"===r)this.bannerDiv.style.position="initial",this.bannerDiv.style.marginTop="4px",this.songAnchor.style.flexGrow="1",this.lyricsAnchor.style.flexGrow="1";else{this.bannerDiv.style.position="fixed",this.bannerDiv.style.marginTop="0";var i=r.indexOf("top")>=0,o=r.indexOf("right")>=0,s=r.indexOf("bottom")>=0,a=r.indexOf("left")>=0;this.bannerDiv.style.top=i?"4px":"initial",this.bannerDiv.style.right=o?"4px":"initial",this.bannerDiv.style.bottom=s?"4px":"initial",this.bannerDiv.style.left=a?"4px":"initial",this.songAnchor.style.flexGrow="0",this.lyricsAnchor.style.flexGrow="0"}}},t.prototype.updateRounded=function(){if(this.domEnabled){var t=this.rounded;this.logoSvg.style.borderRadius=t?"4px 0 0 4px":"0",this.lyricsAnchor.style.borderRadius=t?"0 4px 4px 0":"0",this.bannerDiv.style.borderRadius=t?"4px":"0"}},t.prototype.updateBordered=function(){if(this.domEnabled){var t=this.bordered;this.logoAnchor.style.padding=t?"1px 2px":"1px 3px",this.bannerDiv.style.border=t?"1px solid rgba(31, 67, 145, 0.3)":"none"}},t.prototype.updateShadowed=function(){if(this.domEnabled){var t=this.shadowed;this.bannerDiv.style.boxShadow=t?"1px 1px 3px 0 rgba(9, 19, 42, 0.9)":"none"}},t.prototype.updateBackground=function(){this.domEnabled&&(this.songAnchor.style.background=this.background,this.lyricsAnchor.style.background=this.background)},t.prototype.updateColor=function(){this.domEnabled&&(this.songSvg.style.fill=this.color,this.songAnchor.style.color=this.color,this.lyricsSvg.style.fill=this.color,this.lyricsAnchor.style.color=this.color)},t}();function Mi(t){return t&&""!==t?t:"-"}var Bi=function(){this.halted=[],this.errors=[]},Vi=function(){function t(t,e){var r=this;this.listener=e,this.player=null,this._scale=1,this.playerListener={onResize:function(t){r.elementWidth=Math.floor(t.width),r.updateSize()},onVideoReady:function(){r.elementWidth=r.calcWidth(),r.updateSize()},onStageElementSet:function(t){r.elementWidth=r.calcWidth(),r.updateSize(),r.player.graphics.setCanvas(t)},onDispose:function(){r.dispose()}},this.requestedTime=0,this.request=null,this.player=t,t.addListener(this.playerListener)}return Object.defineProperty(t.prototype,"scale",{get:function(){return this._scale},set:function(t){this._scale=t,this.updateSize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.player.graphics.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.player.graphics.height},enumerable:!1,configurable:!0}),t.prototype.requestUpdate=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return this.requestedTime=void 0===t?this.player.videoPosition:t,this.request||(this.request=new Promise((function(t){setTimeout((function(){try{e.update(e.requestedTime)}catch(t){}e.request=null,t(e.requestedTime)}),0)}))),[2,this.request]}))}))},t.prototype.update=function(t){t||(t=this.player.mediaPosition),"number"==typeof t&&(this.player.graphics.reset(),this.animate(t),this.player.graphics.update(),this.listener.onStageUpdate(t))},t.prototype.animate=function(t){for(var e=new Bi,r=e.errors,n=e.halted,i=0,o=[this.player.video.firstCredit,this.player.video.firstPhrase,this.player.video.firstWord,this.player.video.firstChar,this.player.video.firstGraphic];i0){console.error("---");for(var a=0;a0&&(!s.rendering.visible||0===s.rendering.alpha))return void(e.rendering.visible=!1);s=s.parent}var a=this.player.templates.getProperty(r,"insomnia"),u=Gi(e);if(!a&&u){var c=function(t,e,r,n){var o=n&&t(n,"headTime")||500,s=n&&t(n,"tailTime")||500;return!(r.startTime-o<=e&&r.endTime+s>=e)&&(r.getType()!==i.GRAPHIC&&(r.rendering.visible=!1),!0)}((function(t,e){return o.player.templates.getProperty(t,e)}),t,e,r);if(c)return}this.doAnimateTemplate(t,r,n)}},t.prototype.doAnimateTemplate=function(t,e,r){var n=r.errors,i=r.halted;try{this.player.templates.exec(e,"animate",[t])}catch(t){n.push(t),i.push(e)}},t.prototype.calcWidth=function(){var t=this.player.stageElement;if(!t)return 0;var e=window.getComputedStyle(t);return t.offsetWidth-ln(e.borderLeftWidth)-ln(e.borderRightWidth)-ln(e.paddingLeft)-ln(e.paddingRight)},t.prototype.updateSize=function(){var t=this.player.stageElement;if(t){var e=this.elementWidth*this.player.videoProportion;if(t.style.height="".concat(e,"px"),t.width=this.elementWidth*this._scale,t.height=e*this._scale,this.player.video){var r=t.width/this.player.videoWidth;this.player.graphics.updateStageTx(r,this.player.margin),this.player.isPlaying||this.requestUpdate()}}},t.prototype.dispose=function(){this.player.removeListener(this.playerListener),this.player=null},t}();function Gi(t){if(t.getType()===i.GRAPHIC)return!0;for(var e=!0,r=t.parent;r;){if(r.templateCount>0){e=!1;break}r=r.parent}return e}var qi=function(t){function e(e,r){var n=this.constructor,i=t.call(this,e)||this;return i.video=r,Object.setPrototypeOf(i,n.prototype),i}return dn(e,t),e}(Error);function Wi(t,e){var r=e.parser;return yn(this,0,void 0,(function(){var e,n,i;return gn(this,(function(o){switch(o.label){case 0:return t&&t.length>0&&t[0].words&&t[0].words.length>0&&t[0].words[0]&&!t[0].words[0].pos?(e=t.map((function(t){return t.words.map((function(t){return t.characters.map((function(t){return t.char})).join("")})).join(" ")})),n=e.join("\n"),[4,r(n)]):[2];case 1:return(i=o.sent())&&"success"===i.status?(t.forEach((function(t,r){var n=i.result[r],o=0;t.words.forEach((function(t){var i=t.characters.map((function(t){return t.char})).join(""),s=e[r].indexOf(i,o);if(!(s<0)){o=s;var a=n.find((function(t){return t.startPosition<=s&&t.endPosition>=s}));a&&(t.pos=a.PoS,t.rawPoS=a.rawPoS,t.language=a.language)}}))})),[2]):[2]}}))}))}function Yi(t){for(;t.firstElementChild;)t.removeChild(t.firstElementChild)}function zi(t,e){var r=e.id,n=e.data,i=e.loader,o=e.deserializer;return yn(this,0,void 0,(function(){return gn(this,(function(e){switch(e.label){case 0:return r&&r>=0?[4,i(r)]:[3,2];case 1:e.sent(),e.label=2;case 2:return o(t,n),[2]}}))}))}function Ji(t){return"string"!=typeof t?t:"undefined"==typeof window?null:document.querySelector(t)}var Hi=function(){function t(t){this._mediaPosition=0,this._videoPosition=0,this.isEditing=!1,this._isVideoSeeking=!1,this._volume=100,this._options=t,this.emitter=new On(t),this._templates=new Ui(this,this.emitter,t&&t.unsafeAcceleration);var e=Object.assign({},Y);t&&t.managers&&(e=Object.assign(e,t.managers)),this.managers=e,this._timer=t&&t.timer||this.createDefaultTimer(),this._data=new Vn(e,this.emitter,t),this._backgroundGraphics=new Sn(this,e.asset,this.emitter),this._graphics=t&&t.graphics||this.createDefaultGraphicsDriver(),this.stage=new Vi(this,{onStageUpdate:this.onStageUpdate.bind(this)}),this._banner=new Di(this),this.stageElement=Ji(null==t?void 0:t.stageElement)||null,this.mediaElement=Ji(null==t?void 0:t.mediaElement)||null,this._app=new Gn(this,this.emitter)}return Object.defineProperty(t.prototype,"options",{get:function(){return this._options?fn({},this._options):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return this._app},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundGraphics",{get:function(){return this._backgroundGraphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"video",{get:function(){return this._video},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"templates",{get:function(){return this._templates},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphics",{get:function(){return this._graphics},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageElement",{get:function(){return this._stageElement},set:function(t){this._stageElement=t,this.emitter.onStageElementSet(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageScale",{get:function(){return this.stage.scale},set:function(t){this.stage.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaElement",{get:function(){return this._mediaElement},set:function(t){this.updateMediaElement(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaSourceElement",{get:function(){return this._mediaSourceElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaBannerElement",{get:function(){return this._mediaBannerElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaPosition",{get:function(){return this._mediaPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoPosition",{get:function(){return this._videoPosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wait",{get:function(){return this._timer?this._timer.wait:0},set:function(t){this._timer&&(this._timer.wait=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fps",{get:function(){return 1e3/this.wait},set:function(t){this.wait=1e3/t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionWidth",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.width?this._data.video.config.width:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.width)?this._options.defaultVideoSize.width:1280},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionHeight",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&"number"==typeof this._data.video.config.height?this._data.video.config.height:"number"==typeof(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.height)?this._options.defaultVideoSize.height:720},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolutionProportion",{get:function(){return this.resolutionHeight/this.resolutionWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"margin",{get:function(){var t,e,r,n;return"object"==typeof(null===(e=null===(t=this._data)||void 0===t?void 0:t.video)||void 0===e?void 0:e.config)&&this._data.video.config.margin?this._data.video.config.margin:(null===(n=null===(r=this._options)||void 0===r?void 0:r.defaultVideoSize)||void 0===n?void 0:n.margin)||_n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoWidth",{get:function(){var t=this.resolutionWidth,e=this.margin;return t+e[1]+e[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoHeight",{get:function(){var t=this.resolutionHeight,e=this.margin;return t+e[0]+e[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoProportion",{get:function(){return this.videoHeight/this.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageWidth",{get:function(){return this.stage.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stageHeight",{get:function(){return this.stage.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoading",{get:function(){return!!this._videoPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPlaying",{get:function(){return!!this._timer&&this._timer.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVideoSeeking",{get:function(){return this._isVideoSeeking},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"banner",{get:function(){return this._banner},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timer",{get:function(){return this._timer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volume",{get:function(){return this._volume},set:function(t){isNaN(t)||(this._volume=Math.min(100,Math.max(0,t)),this.emitter.onVolumeUpdate(this._volume))},enumerable:!1,configurable:!0}),t.prototype.createDefaultTimer=function(){try{if("undefined"!=typeof window&&"basic"!==pn("ta_timer"))return new En}catch(t){}return new wn},t.prototype.createDefaultGraphicsDriver=function(){return new yt},t.prototype.addListener=function(t){return this.emitter.addListener(t)},t.prototype.removeListener=function(t){return this.emitter.removeListener(t)},t.prototype.createFromVideoId=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideoId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideoId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromVideoId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromVideo=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromVideo(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromVideo=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){return(r=new Vn(this.managers,this.emitter,this._options)).createFromVideo(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.createFromSongUrl=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongUrl(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongUrl=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongUrl(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongPath=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongPath(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongPath=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongPath(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongId=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongId(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongId=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongId(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromSongCode=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromSongCode(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromSongCode=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromSongCode(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromText=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromText(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromText=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){switch(n.label){case 0:return[4,(r=new Vn(this.managers,this.emitter,this._options)).createFromText(t,null==e?void 0:e.video)];case 1:return n.sent(),[2,this.finalize(r,e)]}}))}))},t.prototype.createFromJSON=function(t,e){return yn(this,0,void 0,(function(){var r=this;return gn(this,(function(n){return[2,this.create((function(){return r.doCreateFromJSON(t,e)}),null==e?void 0:e.dryRun)]}))}))},t.prototype.doCreateFromJSON=function(t,e){return yn(this,0,void 0,(function(){var r;return gn(this,(function(n){return(r=new Vn(this.managers,this.emitter,this._options)).createFromJSON(t,null==e?void 0:e.video),[2,this.finalize(r,e)]}))}))},t.prototype.create=function(t,e){return yn(this,0,void 0,(function(){var r,n=this;return gn(this,(function(i){if(this._videoPromise&&!e)throw new qi("Player.createFrom* method calls cannot run in parallel",this._videoPromise);return r=t(),e||(this._videoPromise=r,r.finally((function(){return n._videoPromise=null}))),[2,r]}))}))},t.prototype.finalize=function(t,e){return yn(this,0,void 0,(function(){var r,n,i,o=this;return gn(this,(function(s){switch(s.label){case 0:return t.video?[4,Promise.all([t.finalize(e),this.backgroundGraphics.setBackground(t.video.background)])]:[2,null];case 1:return s.sent(),(null==e?void 0:e.dryRun)?[2,null]:(r=t.video.json,function(t,e){var r=e.config,n=e.song;r&&"object"==typeof r&&"number"==typeof r.duration?t.duration=r.duration:n?t.duration=1e3*n.length:t.duration||(t.duration=t.endTime)}(n=new ut(r),{config:t.video.config,song:t.song}),[4,Promise.all([this.graphics.createRuntime(n),zi(n,{id:t.video.id,data:r,loader:function(t){return yn(o,0,void 0,(function(){return gn(this,(function(e){switch(e.label){case 0:return[4,this.templates.loadForVideo(t)];case 1:return e.sent(),[2]}}))}))},deserializer:function(t,e){return o.templates.importInstances(t,e)}}),Wi(null==r?void 0:r.phrases,{parser:R.parse.bind(R)})])]);case 2:return s.sent(),this._data,this._video&&this.templates.disposeInstances(this._video),this._data=t,this._video=n,this.emitter.onVideoReady(n),i=(null==e?void 0:e.altSourceUrl)||void 0,[4,this._timer.initialize({player:this,updater:this.updateMediaPosition.bind(this),emitter:this.emitter,altSourceUrl:i})];case 3:return s.sent(),this.emitter.onTimerReady(this._timer),[2,n]}}))}))},t.prototype.updateMediaPosition=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return this._isVideoSeeking?(this._mediaPosition=t,this.emitter.onMediaSeek(t),[2,t]):[2,this.stage.requestUpdate(t).then((function(t){return e._mediaPosition=t,e._videoPosition=t,e.emitter.onMediaSeek(t),t}))]}))}))},t.prototype.exportVideo=function(t){var e,r,n,i,o,s,a;return void 0===t&&(t={legacyStringMode:!0}),yn(this,0,void 0,(function(){var u,c,l,p;return gn(this,(function(h){return u={sourceId:(null===(e=this._data.video)||void 0===e?void 0:e.id)||-1,sourceOriginId:(null===(r=this._data.video)||void 0===r?void 0:r.sourceOriginId)||-1,songleId:(null===(n=this._data.song)||void 0===n?void 0:n.id)||-1,lyricId:this._data.lyricsId||-1,lyricDiffId:(null===(i=this._data.lyrics)||void 0===i?void 0:i.id)||-1,config:((null==t?void 0:t.legacyStringMode)?(null===(o=this._data.video)||void 0===o?void 0:o.config)&&JSON.stringify(this._data.video.config):null===(s=this._data.video)||void 0===s?void 0:s.config)||null},c=this.backgroundGraphics.exportPartialVideoEntry(t),l=(null===(a=this._video)||void 0===a?void 0:a.exportData(this._templates))||null,p=(null==t?void 0:t.legacyStringMode)?JSON.stringify(l):l,[2,fn(fn(fn({},u),c),{json:p})]}))}))},t.prototype.getChoruses=function(){return this._data.getChoruses()},t.prototype.findChorus=function(t,e){return this._data.findChorus(t,e)},t.prototype.findChorusBetween=function(t,e){return this._data.findChorusBetween(t,e)},t.prototype.findChorusChange=function(t,e){return this._data.findChorusChange(t,e)},t.prototype.getBeats=function(){return this._data.getBeats()},t.prototype.findBeat=function(t,e){return this._data.findBeat(t,e)},t.prototype.findBeatChange=function(t,e){return this._data.findBeatChange(t,e)},t.prototype.getChords=function(){return this._data.getChords()},t.prototype.findChord=function(t,e){return this._data.findChord(t,e)},t.prototype.findChordChange=function(t,e){return this._data.findChordChange(t,e)},t.prototype.getVocalFrequency=function(t){return this._data.getVocalFrequency(t)},t.prototype.getVocalAmplitude=function(t){return this._data.getVocalAmplitude(t)},t.prototype.getMaxVocalAmplitude=function(){return this._data.getMaxVocalAmplitude()},t.prototype.getValenceArousal=function(t){return this._data.getValenceArousal(t)},t.prototype.getMedianValenceArousal=function(){return this._data.getMedianValenceArousal()},t.prototype.resize=function(t){return this.emitter.onResize(t)},t.prototype.onResize=function(t){return this.resize(t)},t.prototype.setStageElement=function(t){return this._stageElement=t,this.emitter.onStageElementSet(t)},t.prototype.setMediaElement=function(t){this.mediaElement=t},t.prototype.updateMediaElement=function(t){"undefined"!=typeof document&&(this._mediaElement&&Yi(this._mediaElement),t?(Yi(t),this._mediaSourceElement||(this._mediaSourceElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-media-wrapper")),t.appendChild(this._mediaSourceElement),this._mediaBannerElement||(this._mediaBannerElement=document.createElement("div"),this._mediaSourceElement.classList.add("textalive-banner-wrapper")),t.appendChild(this._mediaBannerElement)):(this._mediaSourceElement=null,this._mediaBannerElement=null)),this._mediaElement=t,this.emitter.onMediaElementSet(t)},t.prototype.setVideoPosition=function(t){return yn(this,0,void 0,(function(){var e=this;return gn(this,(function(r){return[2,this.stage.requestUpdate(t).then((function(t){return e._videoPosition=t,e.emitter.onVideoSeek(t),t}))]}))}))},t.prototype.setMediaPosition=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return this.requestMediaSeek(t),[2]}))}))},t.prototype.requestPlay=function(){return this._timer.play(),!0},t.prototype.requestStop=function(){return this._timer.stop(),!0},t.prototype.requestPause=function(){return this._timer.pause(),!0},t.prototype.requestMediaSeek=function(t){return this._timer.seek(t),!0},t.prototype.startVideoSeek=function(){return this._isVideoSeeking=!0,this.emitter.onVideoSeekStart()},t.prototype.endVideoSeek=function(){return this._isVideoSeeking=!1,this.emitter.onVideoSeekEnd()},t.prototype.requestSettingBackground=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return[2,this.backgroundGraphics.settingBackground(t)]}))}))},t.prototype.requestSetBackground=function(t){return yn(this,0,void 0,(function(){return gn(this,(function(e){return[2,this.backgroundGraphics.setBackground(t)]}))}))},t.prototype.requestStageUpdate=function(){return yn(this,0,void 0,(function(){return gn(this,(function(t){return[2,this.stage.requestUpdate()]}))}))},t.prototype.onStageUpdate=function(t){this._isVideoSeeking||this.emitter.onTimeUpdate(t)},t.prototype.dispose=function(){this._timer&&(this._timer.dispose(),this._timer=null),this.mediaElement&&(Yi(this._mediaElement),this._mediaElement=null),this.stageElement&&(this._stageElement=null),this.emitter.onDispose()},t}();console.log("# ライセンス表記に関するガイドライン\n\n国立研究開発法人産業技術総合研究所\n人間情報インタラクション研究部門\nメディアインタラクション研究グループ\n\nTextAlive App APIは非商用利用に限り、どなたでも無料・無保証で利用することができます。\nただし、原則としてTextAlive App APIを利用している旨を TextAlive https://textalive.jp/ サイト内楽曲ページまたは https://developer.textalive.jp/ にハイパーリンクした上で、利用しているシステムもしくは外部サイト等に表示する必要があります。\n\n# お問い合わせ\n\ntextalive-ml@aist.go.jp"),t.BasicTimer=wn,t.Color=X,t.Ease=Ai,t.Matrix2D=pt,t.Player=Hi,t.PlayerLogoImage=Fi,t.Point=ht,t.SongleTimer=En,t.TimedUnit=$,t.UnitTypes=i,t.dataUrlToString=T,t.findTimedObject=st,t.findTimedObjectsInRange=at,t.isStringEncodedDataUrl=S,t.sortedIndex=n.sortedIndex,t.stringToDataUrl=function(t){return"string"!=typeof t?null:O+btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt("0x"+e))})))}})); diff --git a/dist/textalive-app-api.d.ts b/dist/textalive-app-api.d.ts index 77ee1c2..698aed9 100644 --- a/dist/textalive-app-api.d.ts +++ b/dist/textalive-app-api.d.ts @@ -1,5688 +1,3872 @@ -import { sortedIndex } from 'sortedindex'; - -/** - * TextAlive ログインに使えるサービス / Account service for TextAlive login - */ -declare type AccountService = "twitter" | "github" | "youtube" | "piapro" | "songle"; - -declare interface Asset { - originalUrl: string; - contentType?: number; - contentUrl?: string; - url?: string; - name?: string; - authorName?: string; - authorPath?: string; - license?: AssetLicense; - createdDate?: string; -} - -declare interface AssetLicense { - code?: number; - condition?: { - uploader?: boolean; - by?: boolean; - ns?: boolean; - nc?: boolean; - org?: boolean; - clb?: boolean; - }; -} - -/** - * 背景グラフィックに関するイベントのリスナ - * - * Event listener for background graphics - * @public - */ -declare interface BackgroundGraphicsListener { - -} - -declare interface BackgroundImageAsset extends Asset { - css?: string; - x?: number; - y?: number; - defaultX?: number; - defaultY?: number; -} - -/** - * **Basic timer** - * - * もっともシンプルな {@link Timer} の実装: - * - * - 音源を再生しません - * - デバッグ時などに有用です - * - * The simplest {@link Timer} implementation: - * - * - No audio elements are embedded (thus no sound playback) - * - Useful for debugging - * @public - */ -export declare class BasicTimer implements Timer { - private player; - private updateMediaPosition; - private emitter; - private _isPlaying; - private _position; - private basePosition; - private intervalId; - private _wait; - /** - * @inheritDoc - */ - get wait(): number; - set wait(val: number); - /** - * @inheritDoc - */ - get isPlaying(): boolean; - /** - * @inheritDoc - */ - get position(): number; - constructor(); - /** - * @inheritDoc - */ - initialize({ player, updater, emitter }: TimerInitOptions): Promise; - /** - * @inheritDoc - */ - play(): void; - /** - * @inheritDoc - */ - stop(): void; - /** - * @inheritDoc - */ - pause(): void; - /** - * @inheritDoc - */ - seek(time: number): void; - /** - * @inheritDoc - */ - dispose(): void; - private clearInterval; - private start; - private update; -} - -/** - * ビート情報 / Beat info - */ -declare class Beat extends SongMapElement implements IBeat { - /** - * @inheritDoc - */ - startTime: number; - /** - * @inheritDoc - */ - get endTime(): number; - /** - * @inheritDoc - */ - length: number; - /** - * @inheritDoc - */ - position: number; - /** - * @inheritDoc - */ - previous: Beat; - /** - * @inheritDoc - */ - next: Beat; - /** - * @inheritDoc - */ - index: number; - constructor(); -} - -/** - * @param t - Timing [0, 1] - */ -declare function bounceIn(t: number): number; - -/** - * @param t - Timing [0, 1] - */ -declare function bounceInOut(t: number): number; - -/** - * @param t - Timing [0, 1] - */ -declare function bounceOut(t: number): number; - -declare class Char extends TextUnit implements IChar { - private _font; - private _color; - constructor(data: CharData); - /** - * @inheritDoc - */ - animate: RenderingUnitFunction; - get parent(): Word; - get previous(): Char; - get next(): Char; - get text(): string; - get advance(): number; - get ascent(): number; - get descent(): number; - set font(val: Font); - get font(): Font; - set fontFamily(val: string); - get fontFamily(): string; - set fontStyle(val: string); - get fontStyle(): string; - set fontSize(val: number); - get fontSize(): number; - set color(val: Color); - get color(): Color; - getType(): number; -} - -/** - * @public - */ -export declare interface CharData extends UnitData, FontData { - char?: string; -} - -/** - * コード進行の情報 / Chord info - */ -declare class Chord extends SongMapElement implements IChord { - /** - * @inheritDoc - */ - startTime: number; - /** - * @inheritDoc - */ - endTime: number; - /** - * @inheritDoc - */ - name: string; - /** - * @inheritDoc - */ - previous: Chord; - /** - * @inheritDoc - */ - next: Chord; - /** - * @inheritDoc - */ - index: number; - constructor(); -} - -/** - * @param t - Timing [0, 1] - */ -declare function circIn(t: number): number; - -/** - * @param t - Timing [0, 1] - */ -declare function circInOut(t: number): number; - -/** - * @param t - Timing [0, 1] - */ -declare function circOut(t: number): number; - -/** - * **Color** - * - * 色情報 / Color info - * @public - */ -export declare class Color implements IColor { - /** - * @inheritDoc - */ - a: number; - /** - * @inheritDoc - */ - r: number; - /** - * @inheritDoc - */ - g: number; - /** - * @inheritDoc - */ - b: number; - constructor(color?: string | number | IColor); - /** - * @inheritDoc - */ - get value(): number; - set value(val: number); - /** - * @inheritDoc - */ - get rgb(): string; - /** - * @inheritDoc - */ - get rgba(): string; - /** - * @inheritDoc - */ - eq(color: Color): boolean; - /** - * @inheritDoc - */ - toString(withAlpha?: boolean): string; - /** - * @inheritDoc - */ - from(color?: string | number | IColor): void; - /** - * @inheritDoc - */ - fromString(color: string): void; - /** - * @inheritDoc - */ - fromNumber(val: number, withAlpha?: boolean): void; -} - -/** - * @public - */ -declare interface ColorData { - type: "Color"; - /** - * All values range from 0 to 255 - */ - value: { - a: number; - r: number; - g: number; - b: number; - }; -} - -/** - * データ読み込みルーチンに関するイベントのリスナ - * - * Event listener for data loading procedures - * @public - */ -export declare type DataLoaderListener = VideoLoaderListener & SongLoaderListener & TextLoaderListener & FontLoaderListener; - -/** - * データURLのBase64エンコードされた文字列を復号 - * - * Decode a data URL that encodes UTF-8 string in Base64 format - * @param url - URL - * @public - */ -export declare function dataUrlToString(url: string): string; - -export declare interface DecomposedProps { - x?: number; - y?: number; - scaleX?: number; - scaleY?: number; - skewX?: number; - skewY?: number; - rotation?: number; -} - -/** - * **Ease** - * - * イージング関数のコレクション: - * - * - `CreateJS` というライブラリのオープンソース実装をお借りしています - * - {@link https://www.createjs.com/demos/tweenjs/tween_sparktable} に分かりやすいデモがあります - * - * Collection of easing functions: - * - Inherited from an open-source library implementation `CreateJS` - * - See {@link https://www.createjs.com/demos/tweenjs/tween_sparktable} for live demonstrations - * - * Visit http://createjs.com/ for documentation, updates and examples. - * - * Copyright (c) 2010 gskinner.com, inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * @public - */ -export declare class Ease { - static linear: typeof linear; - static get: typeof get; - static getPowIn: typeof getPowIn; - static getPowOut: typeof getPowOut; - static getPowInOut: typeof getPowInOut; - static quadIn: (input: number) => number; - static quadOut: (input: number) => number; - static quadInOut: (input: number) => number; - static cubicIn: (input: number) => number; - static cubicOut: (input: number) => number; - static cubicInOut: (input: number) => number; - static quartIn: (input: number) => number; - static quartOut: (input: number) => number; - static quartInOut: (input: number) => number; - static quintIn: (input: number) => number; - static quintOut: (input: number) => number; - static quintInOut: (input: number) => number; - static sineIn: typeof sineIn; - static sineOut: typeof sineOut; - static sineInOut: typeof sineInOut; - static getBackIn: typeof getBackIn; - static backIn: (input: number) => number; - static getBackOut: typeof getBackOut; - static backOut: (input: number) => number; - static getBackInOut: typeof getBackInOut; - static backInOut: (input: number) => number; - static circIn: typeof circIn; - static circOut: typeof circOut; - static circInOut: typeof circInOut; - static bounceIn: typeof bounceIn; - static bounceOut: typeof bounceOut; - static bounceInOut: typeof bounceInOut; - static getElasticIn: typeof getElasticIn; - static elasticIn: (input: number) => number; - static getElasticOut: typeof getElasticOut; - static elasticOut: (input: number) => number; - static getElasticInOut: typeof getElasticInOut; - static elasticInOut: (input: number) => number; -} - -declare interface EndpointData { - fallback: { - protocol: string; - }; - songle: { - protocol?: string; - domain: string; - server?: string; - }; - textalive: { - protocol?: string; - domain: string; - server?: string; - appToken?: string; - authUser?: string; - authToken?: string; - }; - content: { - protocol?: string; - domain: string; - server?: string; - }; - client: { - version?: string; - }; -} - -/** - * @param objects - 時刻付きオブジェクトの配列 / Array of sorted timed objects - * @param time - 時刻 [ms] / Time [ms] - * @param options - 探索オプション / Find options - * @returns 指定された時刻に存在するオブジェクトを返す / Returns the object at the specified timing - * @public - */ -export declare function findTimedObject(objects: T[], time: number, options?: FindTimedObjectOptions): T; - -/** - * 時刻付きオブジェクトの探索オプション - * - * Find options for sorted timed objects - * @public - */ -export declare interface FindTimedObjectOptions { - /** - * 指定された場合、探索対象の時刻とこの時刻情報がなす区間と重複する時刻付きオブジェクトを返す - * - * When specified, find an object that overlaps with the specified range rather than the timing - */ - endTime?: number; - /** - * 指定された場合、時刻付きオブジェクトは必ずしも探索対象の時刻を含んでいなくてもよい(二分探索の結果をそのまま返す) - * - * When specified, an object does not need to contain the specified timing (result from the binary tree search is always returned) - */ - loose?: boolean; -} - -declare class Font implements IFont { - private _family; - private _size; - private _style; - constructor(family?: string, size?: number, style?: string); - get family(): string; - get size(): number; - get style(): string; - deriveFamily(family: string): Font; - deriveStyle(style: string): Font; - deriveSize(size: number): Font; - clone(): Font; - eq(font: Font): boolean; - toString(scaleFactor?: number): string; -} - -/** - * @public - */ -export declare interface FontData { - fontFamily?: string; - fontSize?: number; - fontStyle?: string; -} - -/** - * フォント情報 - * - * Font info - * @public - */ -export declare interface FontInfo { - /** - * フォントのキー (文字列ID) - * - * Font key (string ID) - */ - key: string; - /** - * 英語フォントファミリー名 - * - * English font family name - */ - en: string; - /** - * 日本語フォントファミリー名 - * - * Japanese font family name - */ - ja?: string; - /** - * CSSのURL - * - * URL of the CSS file - */ - url?: string; - /** - * CSSのURL (頻出文字のみを抽出したサブセット) - * - * URL of the CSS file (Subset fonts for frequently-used chars) - */ - compactUrl?: string; - /** - * モリサワ TypeSquare フォントか否か - * - * Whether this font is provided by Morisawa TypeSquare or not - */ - typesquare?: boolean; - /** - * Google Fonts フォントか否か - * - * Whether this font is provided by Google Fonts or not - */ - google?: boolean; - - /** - * フォントのグループ名 - * - * Optional font group name - */ - group?: string; -} - -/** - * @public - */ -export declare interface FontLoaderListener { - /** - * フォントが読み込まれたときに呼ばれる - * - * Called when fonts are loaded - * @param fonts - 読み込まれたフォントの一覧 - * @param reason - 失敗したときの理由 / Reason for failures (if any) - */ - onFontsLoad?(fonts: FontInfo[], reason?: FontLoadingError): void; -} - -/** - * @public - */ -export declare interface FontLoadingError extends Error { - /** - * 読み込みに失敗したフォントの一覧 / Fonts that could not be loaded - */ - fonts: FontInfo[]; -} - -/** - * Mimics the simple -100 to 100 easing in Adobe Flash/Animate. - * @param amount - A value from -1 (ease in) to 1 (ease out) indicating the strength and direction of the ease. - */ -declare function get(amount: number): (input: number) => number; - -/** - * Configurable "back in" ease. - * @param amount - The strength of the ease. - */ -declare function getBackIn(amount: number): (input: number) => number; - -/** - * Configurable "back in out" ease. - * @param amount - The strength of the ease. - */ -declare function getBackInOut(amount: number): (input: number) => number; - -/** - * Configurable "back out" ease. - * @param amount - The strength of the ease. - */ -declare function getBackOut(amount: number): (input: number) => number; - -/** - * Configurable elastic ease. - * @param amplitude - * @param period - */ -declare function getElasticIn(amplitude: number, period: number): (input: number) => number; - -/** - * Configurable elastic ease. - * @param amplitude - * @param period - */ -declare function getElasticInOut(amplitude: number, period: number): (input: number) => number; - -/** - * Configurable elastic ease. - * @param amplitude - * @param period - */ -declare function getElasticOut(amplitude: number, period: number): (input: number) => number; - -/** - * Configurable exponential ease. - * @param pow - The exponent to use (ex. 3 would return a cubic ease). - */ -declare function getPowIn(pow: number): (input: number) => number; - -/** - * Configurable exponential ease. - * @param pow - The exponent to use (ex. 3 would return a cubic ease). - */ -declare function getPowInOut(pow: number): (input: number) => number; - -/** - * Configurable exponential ease. - * @param pow - The exponent to use (ex. 3 would return a cubic ease). - */ -declare function getPowOut(pow: number): (input: number) => number; - -declare class Graphic extends RenderingUnit { - constructor(data: GraphicData); - /** - * @inheritDoc - */ - animate: RenderingUnitFunction; - getType(): number; - toString(): string; -} - -/** - * @public - */ -export declare type GraphicData = UnitData; - -/** - * @public - */ -export declare interface GraphicsDriver { - /** - * ステージの幅 [px] - * - * Stage width (e.g., HTML Canvas width in a browser window) - */ - width: number; - /** - * ステージの高さ [px] - * - * Stage height (e.g., HTML Canvas height in a browser window) - */ - height: number; - /** - * インタプリタ内にラップして提供するAPIのテーブル - * - * A table used to wrap classes in the interpreter - */ - readonly wrapperTable: WrapperTable; - /** - * @param g - グラフィックコンテキスト / Graphics context - * @returns 引数がグラフィックコンテキストか否か / Whether the specified parameter is an instance of graphic context or not - */ - isGraphics(g: any): boolean; - /** - * Canvas要素を初期化する - * - * Initialize the canvas element - * @param el - Canvas要素 / Canvas element - */ - setCanvas(el: HTMLElement): Promise; - /** - * 動画オブジェクトを描画するためのランタイムインスタンスを作成する - * - * Create a runtime instance for the video object - * @param video - 動画オブジェクト / Video object - */ - createRuntime(video: IVideo): Promise; - /** - * キャンバスの状態を初期化する - * - * Reset the canvas state - */ - reset(): void; - /** - * キャンバスに現在の状態を描画する - * - * Update the canvas with the current runtime state - */ - update(): void; - /** - * ステージの描画倍率を調整する - * - * @param scale - 倍率 / Scale - * @param margin - マージン / Margin - */ - updateStageTx(scale: number, margin: [number, number, number, number]): void; -} - -declare interface IAssetLicenceLoader { - read(url: string, skipOptoutCheck?: boolean): Promise; -} - -declare interface IAssetURLManager { - isUploaderAsset(asset: Asset): boolean; - isPiaproAsset(asset: Asset): boolean; -} - -declare interface IBackgroundAssetManager { - checkBackgroundImageLicense(license: AssetLicense): boolean; - getQueryParameter(backgroundImage: BackgroundImageAsset): string; -} - -declare interface IBackgroundGraphicsLoader { - readonly background: BackgroundImageAsset; - readonly defaultBackgroundCss: string; - readonly ready: boolean; - settingBackground(background: BackgroundImageAsset): Promise; - setBackground(background: BackgroundImageAsset): Promise; - export(): BackgroundImageAsset; - exportPartialVideoEntry(options: VideoExportOptions): Partial; -} - -declare type IBackgroundPlayer = IBackgroundURLManager & IAssetURLManager & IBackgroundAssetManager & IAssetLicenceLoader; - -declare interface IBackgroundURLManager { - isBlankBackgroundAsset(background: BackgroundImageAsset): boolean; - isBackgroundColorAsset(background: BackgroundImageAsset): boolean; - isBackgroundPiaproImageAsset(background: BackgroundImageAsset): boolean; - isBackgroundSpecialImageAsset(background: BackgroundImageAsset): boolean; -} - -/** - * ビート情報 / Beat info - * @public - */ -export declare interface IBeat extends TimedObject { - /** - * @inheritDoc - */ - readonly endTime: number; - /** ビート間隔 [ms] / Duration [ms] */ - readonly duration: number; - /** - * 指定された楽曲中の位置をこのビート中の位置 `[0, 1]` にマッピングして返す - * - * Returns the position in this beat [0, 1] - * @param time - 楽曲中の位置 / Position in a song - */ - progress(time: number): number; - /** 小節中のビート数 / Number of beats in a bar */ - length: number; - /** 小節中のビート位置 / Index in the bar */ - position: number; - /** 前のビート / Previous beat */ - previous: IBeat; - /** 次のビート / Next beat */ - next: IBeat; - /** 楽曲中のビート位置 / Index of this beat in the song */ - index: number; -} - -/** - * @public - */ -export declare interface IChar extends ITextUnit { - /** - * @inheritDoc - */ - readonly parent: IWord; - /** - * @inheritDoc - */ - readonly previous: IChar; - /** - * @inheritDoc - */ - readonly next: IChar; -} - -/** - * コード進行の情報 / Chord info - * @public - */ -export declare interface IChord extends TimedObject { - /** コード進行の継続時間 [ms] / Duration [ms] */ - readonly duration: number; - /** - * 指定された楽曲中の位置をこのコード進行中の位置 `[0, 1]` にマッピングして返す - * - * Returns the position in this chord [0, 1] - * @param time - 楽曲中の位置 / Position in a song - */ - progress(time: number): number; - /** コード進行 / Chord */ - name: string; - /** 前のコード / Previous chord */ - previous: IChord; - /** 次のコード / Next chord */ - next: IChord; - /** 楽曲中のコード進行位置 / Index of this chord in the song */ - index: number; -} - -/** - * 色情報 - * - * Color info - * @public - */ -export declare interface IColor { - /** 透明度 / Alpha */ - a: number; - /** 赤 / Red */ - r: number; - /** 緑 / Green */ - g: number; - /** 青 / Blue */ - b: number; - /** 色情報の 32 bit 表現 / Color info in 32 bit integer */ - value: number; - /** 色情報の16進数表現 (RGB) / Hex string (RGB) */ - readonly rgb: string; - /** 色情報の16進数表現 (RGBA) / Hex string (RGBA) */ - readonly rgba: string; - /** - * @param color - 色情報 / Color - * @returns 色情報が一致するか否か / Whether the specified color info matches the current info - */ - eq(color: IColor): boolean; - /** - * 色情報の文字列表現を得る - * - * Retrieve string representation of this color info - * @param withAlpha - 透明度付きにするか否か / Whether to include alpha value or not - */ - toString(withAlpha?: boolean): string; - /** - * 色情報をセットする - * - * Set color info - * @param color - 色情報 / Information source - */ - from(color: string | number | IColor): void; - /** - * 色情報をセットする - * - * Set color info - * @param color - 色情報の文字列表現 / Information source in string - */ - fromString(color: string): void; - /** - * 色情報をセットする - * - * Set color info - * @param val - 色情報の数値表現 / Information source in number - * @param withAlpha - 透明度付きか否か / Whether alpha value is included or not - */ - fromNumber(val: number, withAlpha?: boolean): void; -} - -/** - * **IDataLoader** - * - * 読み込まれている音楽地図などの情報 - * - * Current video materials - * @public - */ -export declare interface IDataLoader extends ISongExplorer { - /** TextAlive サービスのURL / TextAlive website url */ - readonly permalink: string; - /** 動画データ / Video data */ - readonly video: VideoEntry; - /** 楽曲情報 / Song info */ - readonly song: Song; - /** 楽曲の解析ステータス / Song analysis status */ - readonly songStatus: SongStatus; - /** 音楽地図情報 / Song map info */ - readonly songMap: ISongMap; - /** 歌詞の発声タイミング推定ID / Lyrics timing estimation ID */ - readonly lyricsId: number; - /** 歌詞の発声タイミング情報 / Lyrics timing info */ - readonly lyrics: LyricsInfo; - /** 歌詞の情報 / Lyrics info */ - readonly lyricsBody: LyricsBody; - /** 歌詞テキスト / Lyrics text */ - readonly text: string; - /** フォントの読み込みステータス / Font loading status */ - readonly fonts: IFontLoader; -} - -declare interface IEndpointManager extends EndpointData { - songle: { - protocol?: string; - domain: string; - server?: string; - }; - textalive: { - protocol: string; - domain: string; - server: string; - appToken?: string; - authUser?: string; - authToken?: string; - }; - client: { - version: string; - axios?: any; - }; -} - -/** - * フォント情報 - * - * Font info - * @public - */ -export declare interface IFont { - /** フォントファミリー / Font family */ - readonly family: string; - /** フォントサイズ / Font size */ - readonly size: number; - /** フォントのスタイル / Font style */ - readonly style: string; - /** - * フォントファミリーだけ変更したフォント情報を生成する - * - * Derive font info with the specified font family - * @param family - フォントファミリー / Font family - */ - deriveFamily(family: string): IFont; - /** - * フォントサイズだけ変更したフォント情報を生成する - * - * Derive font info with the specified font size - * @param size - フォントサイズ / Font size - */ - deriveSize(size: number): IFont; - /** - * フォントのスタイルだけ変更したフォント情報を生成する - * - * Derive font info with the specified font style - * @param style - フォントのスタイル / Font style - */ - deriveStyle(style: string): IFont; - /** - * フォント情報を複製する - * - * Clone this font info - */ - clone(): IFont; - /** - * @param font - フォント情報 / Font - * @returns フォント情報が一致するか否か / Whether the specified font info matches the current info - */ - eq(font: IFont): boolean; - /** - * @param scaleFactor - Scale factor to multiply the size info [px] - * @returns フォント情報のCSS用文字列表現 / CSS text that represents this font info - */ - toString(scaleFactor?: number): string; -} - -declare interface IFontInfoManager { - endpoint: string; - getFrequentChars(): Promise; - listAvailableFonts(): Promise; -} - -/** - * @public - */ -export declare interface IFontLoader { - /** - * 読み込みに失敗したフォントの一覧 / List of fonts failed to load - */ - readonly failed: FontInfo[]; - /** - * 読み込まれたフォントの一覧 / List of fonts succeeded to load - */ - readonly loaded: FontInfo[]; - /** - * 読み込みプロセスの有無 / Whether fonts are currently loaded or not - */ - isLoading(): boolean; - /** - * フォントを読み込む - * - * Load fonts - * @param fonts - フォント名の一覧 / List of font family names - * @returns 読み込めたフォントの一覧 / List of fonts suceeded to load - */ - load(fonts: (string | FontInfo)[]): Promise; - /** - * 利用可能なすべてのフォントを読み込む - * - * Load all available fonts - * @returns 読み込めたフォントの一覧 / List of fonts suceeded to load - */ - loadAll(): Promise; - /** - * 指定した動画データ中で利用されているフォントを読み込む - * - * Load all required fonts to render the specified video data - * @param json - 動画データ / Video data - * @returns 読み込まれたフォントの一覧 / List of loaded fonts - */ - loadForVideo(json: VideoData): Promise; - /** - * 指定した動画データ中で利用されているフォントの一覧を取得する - * - * List up required fonts to render the specified video data - * @param json - 動画データ / Video data - * @returns フォント名の一覧 / List of font family names - */ - listFontFamiliesInVideo(json: VideoData): string[]; - /** - * 利用可能なフォントの一覧を取得する - * - * List up all available fonts - * @returns フォントの一覧 / List of fonts - */ - listAvailableFonts(): Promise; -} - -/** - * @public - */ -export declare interface IGraphic extends IRenderingUnit { - /** - * @inheritDoc - */ - readonly previous: IGraphic; - /** - * @inheritDoc - */ - readonly next: IGraphic; -} - -declare interface ILyricsBodyFetcher { - parseLyricBody(text: string, parserUrl: string): Promise; - fetchLyricBody(lyricUrl: string, options: { - parserPath: string; - directAccess?: boolean; - }): Promise; - fetchLocalLyricBody(lyricIdOrSongCode: number | string): Promise; -} - -declare interface ILyricsDiffManager { - loadDiffs(songCode: string, lyricsId: number): Promise; - loadDiff(songCode: string, lyricsId: number, diffId: number): Promise; -} - -declare interface ILyricsLoader { - load(songCode: string): Promise; - loadDetail(songCode: string, lyricsId: number): Promise; -} - -declare type ILyricsPlayer = ILyricsURLManager & ILyricsDiffManager & ILyricsBodyFetcher & ILyricsLoader; - -declare interface ILyricsURLManager { - isUploaderUrl(url: string): boolean; - parseUploaderUrl(url: string): { - user: string; - identifier: string; - }; -} - -/** - * @public - */ -export declare interface IMatrix2D { - /** - * Position (0, 0) in a 3x3 affine transformation matrix. - */ - a: number; - /** - * Position (0, 1) in a 3x3 affine transformation matrix. - */ - b: number; - /** - * Position (1, 0) in a 3x3 affine transformation matrix. - */ - c: number; - /** - * Position (1, 1) in a 3x3 affine transformation matrix. - */ - d: number; - /** - * Position (2, 0) in a 3x3 affine transformation matrix. - */ - tx: number; - /** - * Position (2, 1) in a 3x3 affine transformation matrix. - */ - ty: number; - /** - * Appends the specified matrix properties to this matrix. All parameters are required. - * This is the equivalent of multiplying `(this matrix) * (specified matrix)`. - * @param a - * @param b - * @param c - * @param d - * @param tx - * @param ty - * @returns This matrix. Useful for chaining method calls. - */ - append(a: number, b: number, c: number, d: number, tx: number, ty: number): IMatrix2D; - /** - * Appends the specified matrix to this matrix. - * This is the equivalent of multiplying `(this matrix) * (specified matrix)`. - * @param matrix - * @returns This matrix. Useful for chaining method calls. - */ - appendMatrix(matrix: IMatrix2D): IMatrix2D; - /** - * Generates matrix properties from the specified display object transform properties, and appends them to this matrix. - * For example, you can use this to generate a matrix representing the transformations of a display object: - * - * var mtx = new createjs.Matrix2D(); - * mtx.appendTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation); - * @param x - * @param y - * @param scaleX - * @param scaleY - * @param rotation - * @param skewX - * @param skewY - * @param regX - Optional. - * @param regY - Optional. - * @returns This matrix. Useful for chaining method calls. - */ - appendTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): IMatrix2D; - /** - * Returns a clone of the Matrix2D instance. - * @returns a clone of the Matrix2D instance. - */ - clone(): IMatrix2D; - /** - * Copies all properties from the specified matrix to this matrix. - * @param matrix - The matrix to copy properties from. - * @returns This matrix. Useful for chaining method calls. - */ - copy(matrix: IMatrix2D): IMatrix2D; - /** - * Decomposes the matrix into transform properties (x, y, scaleX, scaleY, and rotation). Note that these values - * may not match the transform properties you used to generate the matrix, though they will produce the same visual - * results. - * @param target - The object to apply the transform properties to. If null, then a new object will be returned. - * @returns The target, or a new generic object with the transform properties applied. - */ - decompose(target?: DecomposedProps): DecomposedProps; - /** - * Returns true if this matrix is equal to the specified matrix (all property values are equal). - * @param matrix - The matrix to compare. - */ - equals(matrix: IMatrix2D): boolean; - /** - * Sets the properties of the matrix to those of an identity matrix (one that applies a null transformation). - * @returns This matrix. Useful for chaining method calls. - */ - identity(): IMatrix2D; - /** - * Inverts the matrix, causing it to perform the opposite transformation. - * @returns This matrix. Useful for chaining method calls. - */ - invert(): IMatrix2D; - /** - * Returns true if the matrix is an identity matrix. - */ - isIdentity(): boolean; - /** - * Prepends the specified matrix properties to this matrix. - * This is the equivalent of multiplying `(specified matrix) * (this matrix)`. - * All parameters are required. - * @param a - * @param b - * @param c - * @param d - * @param tx - * @param ty - * @returns This matrix. Useful for chaining method calls. - */ - prepend(a: number, b: number, c: number, d: number, tx: number, ty: number): IMatrix2D; - /** - * Prepends the specified matrix to this matrix. - * This is the equivalent of multiplying `(specified matrix) * (this matrix)`. - * For example, you could calculate the combined transformation for a child object using: - * - * var o = myDisplayObject; - * var mtx = o.getMatrix(); - * while (o = o.parent) { - * // prepend each parent's transformation in turn: - * o.prependMatrix(o.getMatrix()); - * } - * @param matrix - * @returns This matrix. Useful for chaining method calls. - */ - prependMatrix(matrix: IMatrix2D): IMatrix2D; - /** - * Generates matrix properties from the specified display object transform properties, and prepends them to this matrix. - * For example, you could calculate the combined transformation for a child object using: - * - * var o = myDisplayObject; - * var mtx = new createjs.Matrix2D(); - * do { - * // prepend each parent's transformation in turn: - * mtx.prependTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation, o.skewX, o.skewY, o.regX, o.regY); - * } while (o = o.parent); - * - * Note that the above example would not account for {@link https://www.createjs.com/docs/easeljs/classes/DisplayObject.html#property_transformMatrix} - * values. See {@link IMatrix2D.prependMatrix} for an example that does. - * @param x - * @param y - * @param scaleX - * @param scaleY - * @param rotation - * @param skewX - * @param skewY - * @param regX - Optional. - * @param regY - Optional. - * @returns This matrix. Useful for chaining method calls. - */ - prependTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): IMatrix2D; - /** - * Applies a clockwise rotation transformation to the matrix. - * @param angle - The angle to rotate by, in degrees. To use a value in radians, multiply it by `180/Math.PI`. - * @returns This matrix. Useful for chaining method calls. - */ - rotate(angle: number): IMatrix2D; - /** - * Applies a scale transformation to the matrix. - * @param x - The amount to scale horizontally. E.G. a value of 2 will double the size in the X direction, and 0.5 will halve it. - * @param y - The amount to scale vertically. - * @returns This matrix. Useful for chaining method calls. - */ - scale(x: number, y: number): IMatrix2D; - /** - * Sets the specified values on this instance. - * @param a - Specifies the a property for the new matrix. - * @param b - Specifies the b property for the new matrix. - * @param c - Specifies the c property for the new matrix. - * @param d - Specifies the d property for the new matrix. - * @param tx - Specifies the tx property for the new matrix. - * @param ty - Specifies the ty property for the new matrix. - * @returns This instance. Useful for chaining method calls. - */ - setValues(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): IMatrix2D; - /** - * Applies a skew transformation to the matrix. - * @param skewX - The amount to skew horizontally in degrees. To use a value in radians, multiply it by `180/Math.PI`. - * @param skewY - The amount to skew vertically in degrees. - * @returns This matrix. Useful for chaining method calls. - */ - skew(skewX: number, skewY: number): IMatrix2D; - /** - * Returns a string representation of this object. - * @returns a string representation of the instance. - */ - toString(): string; - /** - * Transforms a point according to this matrix. - * @param x - The x component of the point to transform. - * @param y - The y component of the point to transform. - * @param pt - An object to copy the result into. If omitted a generic object with x/y properties will be returned. - * @returns This matrix. Useful for chaining method calls. - */ - transformPoint(x: number, y: number, pt?: IPoint | any): IPoint; - /** - * Translates the matrix on the x and y axes. - * @param x - * @param y - * @returns This matrix. Useful for chaining method calls. - */ - translate(x: number, y: number): IMatrix2D; -} - -/** - * @public - */ -export declare interface IPhrase extends ITextUnit { - /** - * @inheritDoc - */ - readonly children: IWord[]; - /** - * @inheritDoc - */ - readonly previous: IPhrase; - /** - * @inheritDoc - */ - readonly next: IPhrase; - readonly wordCount: number; - readonly charCount: number; - readonly firstWord: IWord; - readonly firstChar: IChar; - readonly lastWord: IWord; - readonly lastChar: IChar; - findIndex(unit: IWord | IChar): number; -} - -/** - * **IPlayer** - * - * TextAlive のプレイヤーが実装するインタフェースです。 - * - * TextAlive Player implements this interface. - * @public - */ -export declare interface IPlayer { - /** - * プレイヤーの初期化オプション - * - * Player options - */ - readonly options: PlayerOptions; - /** - * TextAlive アプリの状態 - * - * TextAlive app status - */ - readonly app: IPlayerApp; - /** - * 読み込まれている音楽地図などの情報 - * - * Current video materials - */ - readonly data: IDataLoader; - - /** - * 動画オブジェクト - * - * Current video object - */ - readonly video: IVideo; - - - - - /** - * 音源メディアの配置先となるDOM要素 - * - * Media element - * - * @see {@link IPlayer.banner} - */ - mediaElement: HTMLElement; - /** - * 音源メディアの直接の配置先となるDOM要素 - * - * Media source element - */ - readonly mediaSourceElement: HTMLElement; - /** - * 音源などに関するバナーの配置先となるDOM要素 - * - * Media banner element - */ - readonly mediaBannerElement: HTMLElement; - /** - * 現在の音源メディアの再生位置 [ms] - * - * Current media position [ms] - */ - readonly mediaPosition: number; - /** - * 現在の動画の再生位置 [ms] - * - * Current video position [ms] - */ - readonly videoPosition: number; - /** - * 動画の描画間隔 [ms] - * - * A time window between rendering frames [ms] - * - * @see {@link IPlayer.fps} - */ - wait: number; - /** - * フレームレート [フレーム数/秒] - * - * Framerate [frames per sec] - * - * @see {@link IPlayer.wait} - */ - fps: number; - - - - - - - - - - /** - * 動画(楽曲情報や歌詞など)が読み込み中か否か - * - * Whether the video (song, lyrics, etc.) is being loaded or not - */ - readonly isLoading: boolean; - /** - * 動画再生中か否か - * - * Whether the video is being played or not - */ - readonly isPlaying: boolean; - - /** - * 動画シーク中か否か - * - * - `true` のとき 1) {@link PlayerEventListener.onTimeUpdate} イベントは発火せず 2) {@link IPlayer.mediaPosition} は描画タスクをトリガーせずに更新され続けます - * - シークバーの実装で利用されます - * - * Whether the seeking operation is ongoing on or not - * - * - When this property is `true`, 1) {@link PlayerEventListener.onTimeUpdate} event is not emitted and 2) {@link IPlayer.mediaPosition} is updated without rendering a new frame - * - Intended to be used by a seekbar implementation - */ - readonly isVideoSeeking: boolean; - /** - * TextAlive Player の情報を表示する `IPlayerBanner` インスタンスです。 - * - * A banner instance that shows the player info. - */ - readonly banner: IPlayerBanner; - /** - * TextAlive Player の音源の再生状態を管理する `Timer` インスタンスです。 - * - * A timer instance that controls the player status. - */ - readonly timer: Timer; - /** - * 音量 [0-100] - * - * Volume [0-100] - */ - volume: number; - /** - * イベントリスナを登録する - * - * Add event listener - * @param listener - イベントリスナ / Event listener - */ - addListener(listener: PlayerListener): void; - /** - * イベントリスナを削除する - * - * Remove event listener - * @param listener - イベントリスナ / Event listener - * @returns 削除の成否 / Whether the listener was successfully removed or not - */ - removeListener(listener: PlayerListener): boolean; - - - /** - * 楽曲URLに基づいて音楽地図などを読み込み、動画データを生成する - * - * Generate video data from song URL - * - * @param songUrl - 楽曲URL / Song URL - * @param options - オプション / Optional data to build the video object - * @returns 動画オブジェクト / Video object - */ - createFromSongUrl(songUrl: string, options?: PlayerVideoOptions): Promise; - /** - * 楽曲パス(URLから `http://` などのプロトコル部分を除いたもの)に基づいて音楽地図などを読み込み、動画データを生成する - * - * Generate video data from song path - * - * @param songPath - 楽曲パス / Song path - * @param options - オプション / Optional data to build the video object - * @returns 動画オブジェクト / Video object - */ - createFromSongPath(songPath: string, options?: PlayerVideoOptions): Promise; - - - /** - * テキストからダミーの音楽地図情報と動画データを生成する - * - * Generate video data from text - * @param text - テキスト / Text to show - * @param options - オプション / Optional data to build the video object - * @returns 動画オブジェクト / Video object - */ - createFromText(text: string, options?: PlayerVideoOptions): Promise; - /** - * 動画情報を表すデータ({@link VideoData})から動画データを生成する - * - * Generate video data from JSON - * @param json - 動画情報 / JSON data to be converted to a video - * @param options - オプション / Optional data to build the video object - * @returns 動画オブジェクト / Video object - */ - createFromJSON(json: VideoData, options?: PlayerVideoOptions): Promise; - - /** - * 楽曲中のサビに関する情報を取得する - * - * Get chorus parts in the current song - * - * @see {@link IDataLoader.getChoruses} - * @returns サビ情報(見つからなければ空の配列) - */ - getChoruses(): IRepetitiveSegment[]; - /** - * 指定された位置のサビ情報を取得する - * - * Find a chorus part that overlaps with the specified timing - * - * @see {@link IDataLoader.findChorus} - * @param time - 位置 [ms] / Position [ms] - * @param options - optional parameters for finding a chorus part - * @returns サビ情報(見つからなければ `null`) - */ - findChorus(time: number, options?: PlayerFindOptions): IRepetitiveSegment; - /** - * @deprecated Use of {@link IPlayer.findChorusBetween} is deprecated - find a chorus part with {@link IPlayer.findChorus} instead. - */ - findChorusBetween(startTime: number, endTime: number): IRepetitiveSegment; - /** - * 楽曲中のビートに関する情報を取得する - * - * Get beats in the current song - * - * @see {@link IDataLoader.getBeats} - * @returns ビート情報(見つからなければ空の配列) - */ - getBeats(): IBeat[]; - /** - * 指定された位置のビート情報を取得する - * - * Find beat that overlaps with the specified timing - * - * @see {@link IDataLoader.findBeat} - * @param time - 位置 [ms] / Position [ms] - * @param options - 探索オプション / Optional parameters for finding beat - * @returns ビート情報(見つからなければ `null`) - */ - findBeat(time: number, options?: PlayerFindOptions): IBeat; - /** - * 楽曲中のコード進行に関する情報を取得する - * - * Get chord info in the current song - * - * @see {@link IDataLoader.getChords} - * @returns コード進行の情報(見つからなければ空の配列) - */ - getChords(): IChord[]; - /** - * 指定された位置のコード進行を取得する - * - * Find chord that overlaps with the specified timing - * - * @see {@link IDataLoader.findChord} - * @param time - 位置 [ms] / Position [ms] - * @param options - 探索オプション / Optional parameters for finding chord - * @returns コード進行(見つからなければ `null`) - */ - findChord(time: number, options?: PlayerFindOptions): IChord; - - /** - * 指定された位置の声量を取得する - * - * - 取得するには、あらかじめプレイヤー初期化オプション {@link PlayerOptions.vocalAmplitudeEnabled} を `true` にセットしておく必要があります - * - 返値は 0 以上 {@link IPlayer.getMaxVocalAmplitude} で取得できる最大値以下の値 - * - * Get vocal amplitude at the specified timing - * - * - Constructor option {@link PlayerOptions.vocalAmplitudeEnabled} needs to be `true` - * - Return value ranges from 0 to the maximum value that can be retrieved by {@link IPlayer.getMaxVocalAmplitude} - * - * @see {@link IDataLoader.getVocalAmplitude} - * @param time - 位置 [ms] / Position [ms] - * @returns 声量 - */ - getVocalAmplitude(time: number): number; - /** - * 楽曲中の最大声量を取得する - * - * - 取得するには、あらかじめプレイヤー初期化オプション {@link PlayerOptions.vocalAmplitudeEnabled} を `true` にセットしておく必要があります - * - * Get maximum vocal amplitude - * - * - Constructor option {@link PlayerOptions.vocalAmplitudeEnabled} needs to be `true` - * - * @see {@link IDataLoader.getMaxVocalAmplitude} - * @returns 最大声量 - */ - getMaxVocalAmplitude(): number; - /** - * 指定された位置のV/A空間中の座標を取得する - * - * - 取得するには、あらかじめプレイヤー初期化オプション {@link PlayerOptions.valenceArousalEnabled} を `true` にセットしておく必要があります - * - * Get valence arousal value at the specified timing - * - * - Constructor option {@link PlayerOptions.valenceArousalEnabled} needs to be `true` - * - * @see {@link IDataLoader.getValenceArousal} - * @param time - 位置 [ms] / Position [ms] - * @returns 座標値 - */ - getValenceArousal(time: number): ValenceArousalValue; - /** - * V/A空間中の座標遷移の中央値を取得する - * - * - 取得するには、あらかじめプレイヤー初期化オプション {@link PlayerOptions.valenceArousalEnabled} を `true` にセットしておく必要があります - * - * Get median valence arousal value throughout the song - * - * - Constructor option {@link PlayerOptions.valenceArousalEnabled} needs to be `true` - * - * @see {@link IDataLoader.getMedianValenceArousal} - * @returns 座標値 - */ - getMedianValenceArousal(): ValenceArousalValue; - - /** - * 動画の再生位置を指定する - * - * Try setting video position - * @param position - 再生位置 [ms] / Video position [ms] - */ - setVideoPosition(position: number): Promise; - /** - * 楽曲の再生を開始する - * - * Start playing music - * @returns 開始の成否 - */ - requestPlay(): boolean; - /** - * 楽曲の再生を停止する(一時停止したうえで先頭に巻き戻しする) - * - * Stop playing music (pause and then seek the beginning) - * @returns 停止の成否 - */ - requestStop(): boolean; - /** - * 楽曲の再生を一時停止する - * - * Pause playing music - * @returns 一時停止の成否 - */ - requestPause(): boolean; - /** - * 楽曲の再生位置を指定する - * - * Seek specified position in the current media - * @param position - 再生位置 [ms] / Media position [ms] - */ - requestMediaSeek(position: number): boolean; - /** - * 動画のシーク操作を始める - * - * - {@link IPlayer.isVideoSeeking} を `true` にします - * - シーク操作開始後は {@link Timer} が {@link PlayerEventListener.onTimeUpdate} を呼ばなくなります - * - * Start video seeking operation - * - This will set {@link IPlayer.isVideoSeeking} `true` - * - After calling this method, {@link Timer} does not trigger {@link PlayerEventListener.onTimeUpdate} - */ - startVideoSeek(): void; - /** - * 動画のシーク操作を終える - * - * - {@link IPlayer.isVideoSeeking} を `false` にします - * - シーク操作終了後は {@link Timer} が {@link PlayerEventListener.onTimeUpdate} を呼ぶようになります - * - * End video seeking operation - * - This will set {@link IPlayer.isVideoSeeking} `false` - * - After calling this method, position updates by {@link Timer} trigger {@link PlayerEventListener.onTimeUpdate} again - */ - endVideoSeek(): void; - - - /** - * 動画の現在のフレームを強制的に再描画する - * - * Force rendering current frame - * @returns 動画の現在位置 [ms] / Video position [ms] - */ - requestStageUpdate(): Promise; - /** - * プレイヤーを破棄する - * - * Dispose this player - */ - dispose(): void; -} - -/** - * TextAlive アプリの情報 - * - * TextAlive app information - * @public - */ -export declare interface IPlayerApp { - /** - * TextAlive アプリのオプション - * - * TextAlive app options - */ - readonly options: PlayerAppOptions; - /** - * アプリの名前 - * - * Name of this application - */ - name: string; - /** - * アプリ作者の名前 - * - * Name of the author of this application - */ - author: string; - /** - * アプリの状態 - * - * Status of this application - */ - status: number; - /** - * TextAlive API サーバの情報 - * - * TextAlive server info - */ - readonly server: PlayerAppServer; - /** - * TextAlive のホストに接続されているか否か - * - * Whether this app is connected to the TextAlive host or not - */ - readonly managed: boolean; - /** - * TextAlive のホストに接続されている場合、その情報 - * - * TextAlive host information - */ - readonly host: PlayerAppHost; - /** - * クエリパラメタまたはTextAliveホストにより指定されている再生対象の楽曲URL - * - * - アプリは起動時にクエリパラメタを調べ、楽曲が指定されていれば自動的に {@link IPlayer.createFromSongUrl} で楽曲情報の読み込みを開始します(ホストに接続されていても、クエリパラメタによる指定がなければ空になります) - * - アプリがTextAliveホストに接続されると、ホストの指示により楽曲が上書きされることがあります(この後に {@link PlayerAppListener.onAppMediaChange} イベントが呼ばれます) - * - * Song url specified by the query parameter or updated by the media message - * - * - During the initialization of this app, it automatically looks for the song URL in the query parameter. When the song URL is specified, it loads the song by calling {@link IPlayer.createFromSongUrl}. - * - When the app is connected to a host, the host might overwrite the song URL, resulting in the {@link PlayerAppListener.onAppMediaChange} event. - */ - readonly songUrl: string; - /** - * クエリパラメタまたはTextAliveホストにより指定されている楽曲データの読み込みオプション - * - * Options to load song data specified by the query parameter or updated by the media message - */ - readonly songOptions: PlayerAppSongOptions; - /** - * ホストから指定されているパラメタの現在値 - * - * Current parameter values - */ - readonly parameters: ParameterValues; - /** - * ホストへの接続中か否か - * - * Whether the player is trying to connect to a host - */ - readonly isConnecting: boolean; - /** - * ホストへの接続を試みる - * - * - 親フレームに 5 回までメッセージを送信する - * - 返事を 200 [ms] まで待つ - * - 最大で計 1 [s] 待つ - * - * Try connecting to a host - * - * - posts message to the parent frame for 5 times at most - * - waits for the ack response for 200 [ms] - * - takes up to 1 [s] to complete - */ - connect(): Promise; -} - -/** - * **IPlayerBanner** - * - * TextAlive Player の情報を表示する `IPlayerBanner` インスタンスです。Webブラウザで実行されると以下のようなDOM要素が生成されます。 - * - * - CSSクラス `textalive-banner` を持つ {@link IPlayer.mediaElement} の子要素になります - * - TextAliveサービスサイトへのリンクになっているアイコンを子要素に持ちます - * - 楽曲配信元へのリンクになっているCSSクラス `song` を持つアンカーを子要素に持ちます - * - 歌詞配信元へのリンクになっているCSSクラス `lyrics` を持つアンカーを子要素に持ちます - * - * A banner instance that shows the player info. When executed in a web browser, the banner is shown as a DOM element with the following conditions. - * - * - The banner is shown as a child element of {@link IPlayer.mediaElement} with the CSS class `textalive-banner` - * - The banner contains an icon link to the TextAlive website - * - The banner contains an anchor to the song URL with the CSS class `song` - * - The banner also contains an anchor to the lyrics URL with the CSS class `lyrics` - * @public - */ -declare interface IPlayerBanner { - readonly domEnabled: boolean; - position: PlayerBannerPosition; - rounded: boolean; - bordered: boolean; - shadowed: boolean; - background: string; - color: string; -} - -/** - * TextAlive の各種APIアクセスを司るマネージャのコレクションです。 - * - * TextAlive manager instances. - * @public - */ -export declare interface IPlayerManagers { - asset?: IBackgroundPlayer; - endpoint?: IEndpointManager; - lyrics?: ILyricsPlayer; - song?: ISongPlayer; - template?: ITemplateManager; - text?: ITextPlayer; - font?: IFontInfoManager; - user?: IUserManager; - video?: IVideoPlayer; -} - -/** - * @public - */ -export declare interface IPoint { - /** - * X position. - */ - x: number; - /** - * Y position. - */ - y: number; - /** - * Returns a clone of the Point instance. - * @returns a clone of the Point instance. - */ - clone(): IPoint; - /** - * Copies all properties from the specified point to this point. - * @param point - The point to copy properties from. - * @returns This point. Useful for chaining method calls. - */ - copy(IPoint: IPoint): IPoint; - /** - * Sets the specified values on this instance. - * @param x - X position. - * @param y - Y position. - * @returns This instance. Useful for chaining method calls. - */ - setValues(x?: number, y?: number): IPoint; - /** - * Returns a string representation of this object. - * @returns a string representation of the instance. - */ - toString(): string; -} - -/** - * 描画ユニット: - * - * - TextAlive における画面描画処理の最小単位 - * - 種類(フレーズ、単語、文字、グラフィック)を {@link getType} で取得できる - * - 前後のユニットを {@link previous} と {@link next} で取得できる - * - (存在する場合)親要素と子要素の一覧をそれぞれ {@link parent} と {@link children} で取得できる - * - 開始時刻、終了時刻、その差分を {@link startTime} {@link endTime} および {@link duration} で取得できる - * - * Rendering unit: - * - * - The base interface for all rendering unit implementations in TextAlive - * - {@link getType} returns the implementation type (phrase, word, character, or graphic) - * - {@link previous} and {@link next} return the previous and next unit - * - {@link parent} and {@link children} return the parent unit and the list of child units (if applicable) - * - {@link startTime} and {@link endTime} return the timing information and {@link duration} returns the duration i.e. `endTime` - `startTime` - * - * @see {@link TimedObject} - * @public - */ -export declare interface IRenderingUnit extends TimedObject { - readonly parent: IRenderingUnit; - readonly children: IRenderingUnit[]; - readonly previous: IRenderingUnit; - readonly next: IRenderingUnit; - /** 描画ユニットの長さ [ms] / Duration of this rendering unit [ms] */ - readonly duration: number; - - - - - /** - * 指定された楽曲中の位置をこの描画ユニット中の位置 `[0, 1]` にマッピングして返す - * - * Returns the position in this rendering unit [0, 1] - * @param time - 楽曲中の位置 / Position in a song - */ - progress(time: number): number; - - - - - - - /** - * この描画ユニットの種類 / Type of this rendering unit - * @see {@link UnitTypes} - */ - getType(): number; - /** - * この描画ユニットの文字表現 / String representation of this rendering unit - */ - toString(): string; -} - -/** - * サビなどの繰り返し区間の情報 / Repetitive segment info (e.g., chorus segment) - * @public - */ -export declare interface IRepetitiveSegment extends TimedObject { - /** 繰り返し区間の継続時間 [ms] / Duration [ms] */ - readonly duration: number; - /** - * 指定された楽曲中の位置をこの繰り返し区間中の位置 `[0, 1]` にマッピングして返す - * - * Returns the position in this repetitive segment [0, 1] - * @param time - 楽曲中の位置 / Position in a song - */ - progress(time: number): number; - /** 前の繰り返し区間 / Previous repetitive segment */ - previous: IRepetitiveSegment; - /** 次の繰り返し区間 / Next repetitive segment */ - next: IRepetitiveSegment; - /** 楽曲中の繰り返し区間の位置 / Index of this repetitive segment in the song */ - index: number; -} - -/** - * 全繰り返し区間の情報 / Information of all repetitive segments - * @public - */ -export declare interface IRepetitiveSegments { - /** サビかどうか / Whether this repetitive segment info is chorus part or not */ - chorus: boolean; - /** 繰り返し区間の継続時間 / Duration */ - duration: number; - /** 繰り返し区間の配列 / Array of repetitive segments */ - segments: IRepetitiveSegment[]; -} - -declare interface ISongExplorer { - /** - * 楽曲中のサビに関する情報を取得する - * - * Get chorus parts in the current song - * @returns サビ情報(見つからなければ空の配列) - */ - getChoruses(): IRepetitiveSegment[]; - /** - * 指定された位置のサビ情報を取得する - * - * Find a chorus part that overlaps with the specified timing - * @param time - 位置 [ms] / Position [ms] - * @param options - optional parameters for finding a chorus part - * @returns サビ情報(見つからなければ `null`) - */ - findChorus(time: number, options?: PlayerFindOptions): IRepetitiveSegment; - /** - * @deprecated Use of {@link ISongExplorer.findChorusBetween} is deprecated - find a chorus part with {@link ISongExplorer.findChorus} instead. - */ - findChorusBetween(startTime: number, endTime: number): IRepetitiveSegment; - /** - * 楽曲中のビートに関する情報を取得する - * - * Get beats in the current song - * @returns ビート情報(見つからなければ空の配列) - */ - getBeats(): IBeat[]; - /** - * 指定された位置のビート情報を取得する - * - * Find beat that overlaps with the specified timing - * @param time - 位置 [ms] / Position [ms] - * @param options - 探索オプション / Optional parameters for finding beat - * @returns ビート情報(見つからなければ `null`) - */ - findBeat(time: number, options?: PlayerFindOptions): IBeat; - /** - * 楽曲中のコード進行に関する情報を取得する - * - * Get chord info in the current song - * @returns コード進行の情報(見つからなければ空の配列) - */ - getChords(): IChord[]; - /** - * 指定された位置のコード進行を取得する - * - * Find chord that overlaps with the specified timing - * @param time - 位置 [ms] / Position [ms] - * @param options - 探索オプション / Optional parameters for finding chord - * @returns コード進行(見つからなければ `null`) - */ - findChord(time: number, options?: PlayerFindOptions): IChord; - - /** - * 指定された位置の声量を取得する - * - * Get vocal amplitude at the specified timing - * - * - このメソッドを使うには {@link Player} の初期化オプション({@link PlayerOptions#vocalAmplitudeEnabled} を `true` にする必要があります - * - To use this method, {@link Player} constructor option {@link PlayerOptions#vocalAmplitudeEnabled} needs to be `true` - * - * @param time - 位置 [ms] / Position [ms] - * @returns 声量 - */ - getVocalAmplitude(time: number): number; - /** - * 楽曲中の最大声量を取得する - * - * Get maximum vocal amplitude - * - * - このメソッドを使うには {@link Player} の初期化オプション({@link PlayerOptions#vocalAmplitudeEnabled} を `true` にする必要があります - * - To use this method, {@link Player} constructor option {@link PlayerOptions#vocalAmplitudeEnabled} needs to be `true` - * - * @returns 最大声量 - */ - getMaxVocalAmplitude(): number; - /** - * 指定された位置のV/A空間中の座標を取得する - * - * Get valence arousal value at the specified timing - * - * - このメソッドを使うには {@link Player} の初期化オプション({@link PlayerOptions#valenceArousalEnabled} を `true` にする必要があります - * - To use this method, {@link Player} constructor option {@link PlayerOptions#valenceArousalEnabled} needs to be `true` - * - * @param time - 位置 [ms] / Position [ms] - * @returns 座標値 - * @see {@link PlayerOptions} - */ - getValenceArousal(time: number): ValenceArousalValue; - /** - * V/A空間中の座標遷移の中央値を取得する - * - * Get median valence arousal value throughout the song - * - * - このメソッドを使うには {@link Player} の初期化オプション({@link PlayerOptions#valenceArousalEnabled} を `true` にする必要があります - * - To use this method, {@link Player} constructor option {@link PlayerOptions#valenceArousalEnabled} needs to be `true` - * - * @returns 座標値 - */ - getMedianValenceArousal(): ValenceArousalValue; -} - -declare interface ISongInfoLoader { - loadVocalAmplitude(identifier: number | string): Promise; - loadValenceArousal(identifier: number | string): Promise; -} - -declare interface ISongLoader { - load(q: { - id?: number; - code?: string; - songPath?: string; - }): Promise; - loadInfo(identifier: number | string, options?: { - revisions?: SongMapRevisions; - }): Promise; - loadDetailInfo(identifier: number | string, options?: { - revisions?: SongMapRevisions; - }): Promise; -} - -/** - * 音楽地図の情報 - * - * Song map info - * @public - */ -export declare interface ISongMap { - /** - * ビート - * - * Beat - */ - readonly beats: IBeat[]; - /** - * コード進行 - * - * Chord - */ - readonly chords: IChord[]; - /** - * 繰り返し区間 - * - * Repetitive segments - */ - readonly segments: IRepetitiveSegments[]; - - /** - * 音楽地図のリビジョンID - */ - revisions: { - /** - * コード進行の情報のリビジョンID / Chord info revision ID - */ - chordId?: number; - /** - * ビート情報のリビジョンID / Beat info revision ID - */ - beatId?: number; - /** - * サビなどの繰り返し区間のリビジョンID / Repetitive segment revision ID - */ - repetitiveSegmentId?: number; - }; -} - -declare type ISongPlayer = ISongURLManager & ISongLoader & ISongInfoLoader; - -declare interface ISongURLManager { - getSongPathFromUrl(url: string): string; - isUploaderUrl(url: string): boolean; - isUploaderPath(path: string): boolean; - getUploaderGuid(path: string): string; - getSongUrlFromUploaderGuid(guid: string): string; - getAltSongUrlFromUploaderGuid(guid: string): string; - getSongUrlFromPath(path: string): string; - isYouTubeUrl(url: string): boolean; - isNicovideoUrl(url: string): boolean; - isVideoSiteUrl(url: string): boolean; - isPiaproUrl(url: string): boolean; -} - -/** - * 文字列がBase64エンコードされたデータURLかどうか判別 - * - * Detect whether the specified string represents a data URL that encodes UTF-8 string in Base64 format - * @param url - URL - * @public - */ -export declare function isStringEncodedDataUrl(url: string): boolean; - -declare interface ITemplate { - templateClass: ITemplateClass; - templateInstance: any; - unsafeTemplateInstance: Function; - ignore: boolean; - assignedUnit: IRenderingUnit; -} - -declare interface ITemplateClass { - className: string; - id: number; - script: string; -} - -declare interface ITemplateInfoManager { - create(request: TemplateCreateRequest): Promise; - listContributors(className: string, templateId: number): Promise; -} - -declare interface ITemplateLoader { - list(options?: TemplateListRequest): Promise; - load(templateId: number): Promise; - loadByName(templateName: string): Promise; - loadForVideo(videoId: number, options?: TemplateListForVideoRequest): Promise; -} - -declare type ITemplateManager = ITemplateLoader & ITemplateInfoManager; - -declare interface ITextParser { - parse(text: string): Promise; -} - -declare type ITextPlayer = ITextParser; - -/** - * - * @public - */ -export declare interface ITextUnit extends IRenderingUnit { - /** - * 文字ユニットに含まれるプレーンテキスト / Plain text contained in this text unit - */ - readonly text: string; - - - - - - - - - -} - -declare interface IUserActionManager { - getServerStatus(): Promise; - doGetServerStatus(): Promise; - getProfile(): Promise; - doGetProfile(): Promise; - getToken(): Promise; - doGetToken(): Promise; - getMergingUsers(): Promise; - mergeUsers(): Promise; - updateUser(entry: UserUpdateRequest): Promise; - authenticate(userId: number, password: string): Promise; -} - -declare interface IUserBrowserActionManager { - loginTwitter(ev?: MouseEvent): false; - loginGitHub(ev?: MouseEvent): false; - loginYouTube(ev?: MouseEvent): false; - loginPiapro(ev?: MouseEvent): false; - loginSongle(ev?: MouseEvent): false; - login(ev?: MouseEvent, provider?: AccountService): false; - logoutTwitter(ev?: MouseEvent): false; - logoutGitHub(ev?: MouseEvent): false; - logoutYouTube(ev?: MouseEvent): false; - logoutPiapro(ev?: MouseEvent): false; - logoutSongle(ev?: MouseEvent): false; - logout(ev?: MouseEvent, provider?: AccountService): false; -} - -declare interface IUserEventManager { - readonly userProfile: UserProfile; - isLoading(): boolean; - addListener(listener: UserListener): void; - removeListener(listener: UserListener): void; -} - -declare type IUserManager = IUserTypeManager & IUserActionManager & IUserBrowserActionManager & IUserSpoofingManager & IUserEventManager; - -/** - * @deprecated Use {@link EndpointManager.textalive.authUser} and {@link EndpointManager.textalive.authToken} properties instead - */ -declare interface IUserSpoofingManager { - /** - * @deprecated Use {@link EndpointManager.textalive.authUser} and {@link EndpointManager.textalive.authToken} properties instead - */ - spoof(userProfile: UserProfile): void; - /** - * @deprecated Use {@link EndpointManager.textalive.authUser} and {@link EndpointManager.textalive.authToken} properties instead - */ - isSpoofingSongleUser(profile: UserProfile): boolean; -} - -declare interface IUserTypeManager { - isYouTubeUser(profile: UserProfile): boolean; - isPiaproUser(profile: UserProfile): boolean; - isSongleUser(profile: UserProfile): boolean; -} - -/** - * 動画({@link IRenderingUnit} を格納する入れ物) - * - * Video (A container for {@link IRenderingUnit} objects) - * @public - */ -export declare interface IVideo extends TimedObject { - readonly credits: IPhrase[]; - readonly phrases: IPhrase[]; - readonly graphics: IGraphic[]; - - duration: number; - readonly startTime: number; - readonly endTime: number; - readonly creditCount: number; - readonly phraseCount: number; - readonly graphicCount: number; - readonly wordCount: number; - readonly charCount: number; - readonly firstCredit: IPhrase; - readonly firstPhrase: IPhrase; - readonly firstWord: IWord; - readonly firstChar: IChar; - readonly firstGraphic: IGraphic; - readonly lastCredit: IPhrase; - readonly lastPhrase: IPhrase; - readonly lastWord: IWord; - readonly lastChar: IChar; - readonly lastGraphic: IGraphic; - /** - * 指定された位置を `[0, 1]` にマッピングして返す - * - * Returns the position in [0, 1] - * @param time - 位置 / Position in this video - */ - progress(time: number): number; - getCredit(index: number): IPhrase; - getPhrase(index: number): IPhrase; - getWord(index: number): IWord; - getChar(index: number): IChar; - getGraphic(index: number): IGraphic; - findIndex(unit: IRenderingUnit): number; - /** - * Get phrase object (credits) in the current video - * @param time - position [ms] - * @param options - optional parameters for finding phrase - */ - findCredit(time: number, options?: FindTimedObjectOptions): IPhrase; - /** - * Get phrase object in the current video - * @param time - position [ms] - * @param options - optional parameters for finding phrase - */ - findPhrase(time: number, options?: FindTimedObjectOptions): IPhrase; - /** - * Get word object in the current video - * @param time - position [ms] - * @param options - optional parameters for finding word - */ - findWord(time: number, options?: FindTimedObjectOptions): IWord; - /** - * Get character object in the current video - * @param time - position [ms] - * @param options - optional parameters for finding character - */ - findChar(time: number, options?: FindTimedObjectOptions): IChar; - /** - * Get graphic object in the current video - * @param time - position [ms] - * @param options - optional parameters for finding graphic - */ - findGraphic(time: number, options?: FindTimedObjectOptions): IGraphic; -} - -declare interface IVideoLoader { - list(options?: VideoListRequest): Promise; - load(videoId: number): Promise; -} - -declare type IVideoPlayer = IVideoLoader; - -/** - * @public - */ -export declare interface IWord extends ITextUnit { - /** - * @inheritDoc - */ - readonly parent: IPhrase; - /** - * @inheritDoc - */ - readonly children: IChar[]; - /** - * @inheritDoc - */ - readonly previous: IWord; - /** - * @inheritDoc - */ - readonly next: IWord; - /** - * 品詞 - * - * Part-of-speech - * - * - N: 名詞 (Noun) - * - PN: 代名詞 (ProNoun) - * - V: 動詞 (Verb) - * - R: 副詞 (adveRb) - * - J: 形容詞 (adJective) - * - A: 連体詞 (Adnominal adjective) - * - P: 助詞 (Particle) - * - M: 助動詞 (Modal) - * - W: 疑問詞 (Wh) - * - D: 冠詞 (Determiner) - * - I: 接続詞 (conjunction) - * - U: 感動詞 (Interjection) - * - F: 接頭詞 (preFix) - * - S: 記号 (Symbol) - * - X: その他 (other) - */ - readonly pos: string; - /** - * 品詞(英語ならNLTK、日本語ならMeCabの判定結果) - * - * Raw part-of-speech data (NLTK result for English and MeCab result for Japanese) - */ - readonly rawPos: string; - /** - * 言語(`en`: 英語、`ja`: 日本語) - */ - readonly language: string; - /** - * カウントダウン(カウントダウンの場合は 0 以上の数値) - */ - readonly countDown: number; - /** - * カウントアップ(カウントアップの場合は 0 以上の数値) - */ - readonly countUp: number; - /** - * カウントダウン、カウントアップの初期値 - */ - readonly initialCount: number; - readonly charCount: number; - readonly firstChar: IChar; - readonly lastChar: IChar; - findIndex(unit: IChar): number; -} - -/** - * @param t - Timing [0, 1] - */ -declare function linear(t: number): number; - -declare interface ListRequest extends ListSimpleRequest { - lastId?: number; - startId?: number; - maxResults?: number; -} - -declare interface ListResponse extends ListSimpleResponse { - nextStartId?: number; - nextLastId?: number; -} - -declare interface ListSimpleRequest { - lastIndex?: number; - startIndex?: number; -} - -declare interface ListSimpleResponse { - list: T[]; - nextStartIndex?: number; - nextLastIndex?: number; -} - -/** - * 読み込みルーチンに関するイベントのリスナ - * - * Event listener for various loading procedures - * @public - */ -export declare type LoaderListener = DataLoaderListener & BackgroundGraphicsListener & TemplateListener; - -/** - * 歌詞発声タイミングの推定結果 - * - * Results of lyrics timing estimation - */ -declare interface Lyrics { - /** 歌詞発声タイミングの推定ID / Lyrics timing estimation ID */ - id: number; - /** 楽曲情報 / Song info */ - song: Song; - /** Songle で推定中か否か / Processing status */ - processing: boolean; - /** Songle での推定が失敗したか否か / Failure status */ - failed: boolean; - /** 作成日時 / Created date */ - created_at: string; - /** 更新日時 / Updated date */ - updated_at: string; -} - -/** - * 歌詞テキスト - * - * Lyrics body - * @public - */ -export declare interface LyricsBody { - text: string; - artist?: { - name: string; - url?: string; - }; - name?: string; - url?: string; -} - -/** - * 歌詞発声タイミングの訂正情報 - * - * Lyrics diff information - */ -declare interface LyricsDiff { - /** 歌詞発声タイミングの訂正ID / Lyrics diff ID */ - id: number; - - /** 更新日時 / Updated date */ - updated_at: string; -} - -/** - * 歌詞発声タイミングの詳細情報 - * - * Detailed lyrics diff information - * @public - */ -export declare interface LyricsDiffInfo extends LyricsTimingInfo { - /** - * 歌詞発声タイミングの訂正ID - * - * Lyrics diff ID - */ - id: number; -} - -/** - * 歌詞発声タイミングの推定結果 - * - * Results of lyrics timing estimation - * @public - */ -export declare interface LyricsInfo extends LyricsTimingInfo { - /** - * 歌詞発声タイミングのID - */ - id: number; - /** - * 歌詞発声タイミングの訂正情報 - * - * Lyrics diff info - */ - diff: { - id: number; - }; - /** - * Songle で推定中か否か - * - * Songle analysis processing status - */ - processing?: boolean; - /** - * Songle での推定が失敗したか否か - * - * Songle analysis failure status - */ - failed?: boolean; - - -} - -/** - * 歌詞発声タイミングの情報 - * - * Lyrics timing information - * @public - */ -export declare interface LyricsTimingInfo { - /** - * 歌詞URL - * - * Lyrics url - */ - url: string; - - - -} - -/** - * **Matrix2D** - * - * Represents an affine transformation matrix, and provides tools for constructing and concatenating matrices. - * - * This matrix can be visualized as: - * - * [ a c tx - * b d ty - * 0 0 1 ] - * - * Note the locations of b and c. - * - * --- - * - * Visit http://createjs.com/ for documentation, updates and examples. - * - * Copyright (c) 2017 gskinner.com, inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * @public - */ -export declare class Matrix2D implements IMatrix2D { - /** - * @inheritDoc - */ - a: number; - /** - * @inheritDoc - */ - b: number; - /** - * @inheritDoc - */ - c: number; - /** - * @inheritDoc - */ - d: number; - /** - * @inheritDoc - */ - tx: number; - /** - * @inheritDoc - */ - ty: number; - /** - * @param a - Specifies the a property for the new matrix. - * @param b - Specifies the b property for the new matrix. - * @param c - Specifies the c property for the new matrix. - * @param d - Specifies the d property for the new matrix. - * @param tx - Specifies the tx property for the new matrix. - * @param ty - Specifies the ty property for the new matrix. - */ - constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number); - /** - * @inheritDoc - */ - setValues(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): Matrix2D; - /** - * @inheritDoc - */ - append(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; - /** - * @inheritDoc - */ - prepend(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; - /** - * @inheritDoc - */ - appendMatrix(matrix: Matrix2D): Matrix2D; - /** - * @inheritDoc - */ - prependMatrix(matrix: Matrix2D): Matrix2D; - /** - * @inheritDoc - */ - appendTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX: number, regY: number): Matrix2D; - /** - * @inheritDoc - */ - prependTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX: number, regY: number): Matrix2D; - /** - * @inheritDoc - */ - rotate(angle: number): Matrix2D; - /** - * @inheritDoc - */ - skew(skewX: number, skewY: number): Matrix2D; - /** - * @inheritDoc - */ - scale(x: number, y: number): Matrix2D; - /** - * @inheritDoc - */ - translate(x: number, y: number): Matrix2D; - /** - * @inheritDoc - */ - identity(): Matrix2D; - /** - * @inheritDoc - */ - invert(): Matrix2D; - /** - * @inheritDoc - */ - isIdentity(): boolean; - /** - * @inheritDoc - */ - equals(matrix: Matrix2D): boolean; - /** - * @inheritDoc - */ - transformPoint(x: number, y: number, pt: Point): Point; - /** - * @inheritDoc - */ - decompose(target?: DecomposedProps): DecomposedProps; - /** - * @inheritDoc - */ - copy(matrix: Matrix2D): Matrix2D; - /** - * @inheritDoc - */ - clone(): Matrix2D; - /** - * @inheritDoc - */ - toString(): string; - /** - * Multiplier for converting degrees to radians. Used internally by Matrix2D. - */ - static readonly DEG_TO_RAD: number; - /** - * An identity matrix, representing a null transformation. - */ - static readonly identity: Matrix2D; -} - -/** - * **NullGraphicsDriver** - * - * デフォルトのグラフィックドライバ: - * - * - 何も描画しない - * - TextAlive App 開発時などに利用される - * - TextAlive 本サイトで利用している `canvas` 要素へ描画する機能を持ったドライバは現状非公開(利用したい場合は textalive-ml@aist.go.jp までご相談ください) - * - * A default graphic driver: - * - * - This driver does not render anything on canvas - * - The driver is particularly useful when developing applications with TextAlive App API - * - There exists an implementation that renders actual graphics on `canvas` elements but is not public; contact us at textalive-ml@aist.go.jp if interested - * @public - */ -export declare class NullGraphicsDriver implements GraphicsDriver { - private video; - width: 1280; - height: 720; - wrapperTable: {}; - isGraphics(): boolean; - setCanvas(): Promise; - createRuntime(video: Video): Promise; - reset(): void; - private resetTextUnitsFrom; - update(): void; - private updateCharsFrom; - updateStageTx(): void; -} - -/** - * TextAlive アプリ、スタイル、テンプレートで調整可能なパラメタ値の型情報 - * - * Type definition for parameter values that can be customized in TextAlive App, styles, and templates - * @public - */ -export declare type ParameterValue = IColor | string | number | boolean; - -/** - * @public - */ -export declare interface ParameterValues { - [name: string]: ParameterValue; -} - -/** - * TextAlive アプリ、スタイル、テンプレートで調整可能なパラメタ - * - * Parameters that can be customized in TextAlive App, styles, and templates - * @public - */ -export declare interface ParameterWidget { - /** - * パラメタの名前 - * - * Name of this parameter variable - */ - name: string; - /** - * ユーザに提示するパラメタの名前 - * - * Human-readable representation of this varible - */ - title?: string | RegionalText; - - /** - * パラメタの種類(例: `Slider`) - * - * Type of this variable (e.g. `Slider`) - */ - className?: string; - /** - * パラメタのオプション(例: {@link ParameterWidget.className} が `Slider` のとき `[0, 100]` で値域 `0` から `100` のスライダーウィジェットが出現) - * - * Options for constructing a parameter widget parsed from description e.g. `[0, 100]` - */ - params?: (boolean | number | string | [boolean | number | string, string?] | { - [value: string]: string; - })[]; - - - /** - * パラメタの初期値 - * - * Initial value for this parameter variable - */ - initialValue?: ParameterValue; -} - -/** - * TextAlive の動画データを上書きする情報 - * - * Optional data to overwrite TextAlive video data - * @see {@link VideoEntry} - * @public - */ -export declare interface PartialVideoEntry { - /** - * 楽曲コード(ID) / Songle song code - */ - songleCode?: string; - /** - * 歌詞ID - * - * - `-1`: 最新の歌詞情報が使われる - * - `0`: 歌詞情報を読み込まない - * - それ以外: 指定されたIDの歌詞情報が使われる - * - * Lyrics ID - * - * - `-1`: Latest lyrics info is used - * - `0`: No lyrics info will be loaded - * - Or otherwise, the specified lyrics info is used - */ - lyricId?: number; - /** - * 歌詞訂正ID / Lyrics diff ID - */ - lyricDiffId?: number; - /** - * コード進行の情報のリビジョンID / Chord info revision ID - */ - chordId?: number; - /** - * ビート情報のリビジョンID / Beat info revision ID - */ - beatId?: number; - /** - * サビなどの繰り返し区間のリビジョンID / Repetitive segment revision ID - */ - repetitiveSegmentId?: number; - - - /** - * 動画の実データ / Video data - */ - json?: VideoData; -} - -declare class Phrase extends TextUnit implements IPhrase { - private _video; - constructor(video: Video, data: PhraseData); - private createUnits; - /** - * @inheritDoc - */ - animate: RenderingUnitFunction; - get children(): Word[]; - get previous(): Phrase; - get next(): Phrase; - get video(): Video; - get startTime(): number; - get endTime(): number; - get wordCount(): number; - get charCount(): number; - get firstWord(): Word; - get lastWord(): Word; - get firstChar(): Char; - get lastChar(): Char; - getWord(index: number): Word; - getChar(index: number): Char; - addWord(w: Word): Word; - findIndex(unit: Word | Char): number; - getType(): number; -} - -/** - * @public - */ -export declare interface PhraseData extends UnitData { - words: WordData[]; -} - -/** - * **TextAlive Player** - * - * TextAlive API を用いてプログラミングするときのエントリーポイント: - * - * - TextAlive の主要クラスの一つです - * - 楽曲の音楽地図、歌詞テキスト、歌詞の発声タイミングなどを読み込む機能を持ちます - * - 楽曲再生時の映像演出のプログラミングに必要な API を提供します - * - * This class serves as an entry point to its API: - * - * - One of the primary classes of TextAlive - * - Song map, lyrics text, and its vocalized timing information are loaded within this class instance - * - APIs useful for visual performance synchronized with music playback are provided through this class - * @public - */ -export declare class Player implements IPlayer { - /** - * @inheritDoc - */ - get options(): PlayerOptions; - private _options?; - /** - * @inheritDoc - */ - get app(): IPlayerApp; - private _app; - /** - * Data managers - */ - private managers; - /** - * @inheritDoc - */ - get data(): IDataLoader; - private _data; - - private _backgroundGraphics; - /** - * @inheritDoc - */ - get video(): Video; - private _video; - private _videoPromise; - - private _templates; - - private _graphics; - - - private _stageElement; - - - /** - * @inheritDoc - */ - get mediaElement(): HTMLElement; - set mediaElement(element: HTMLElement); - private _mediaElement; - /** - * @inheritDoc - */ - get mediaSourceElement(): HTMLElement; - private _mediaSourceElement; - /** - * @inheritDoc - */ - get mediaBannerElement(): HTMLElement; - private _mediaBannerElement; - /** - * @inheritDoc - */ - get mediaPosition(): number; - private _mediaPosition; - /** - * @inheritDoc - */ - get videoPosition(): number; - private _videoPosition; - /** - * @inheritDoc - */ - get wait(): number; - set wait(val: number); - /** - * @inheritDoc - */ - get fps(): number; - set fps(val: number); - - - - - - - - - - /** - * @inheritDoc - */ - get isLoading(): boolean; - /** - * @inheritDoc - */ - get isPlaying(): boolean; - - /** - * @inheritDoc - */ - get isVideoSeeking(): boolean; - private _isVideoSeeking; - /** - * Event emitter - */ - private emitter; - /** - * Stage - */ - private stage; - /** - * @inheritDoc - */ - get banner(): IPlayerBanner; - private _banner; - /** - * @inheritDoc - */ - get timer(): Timer; - private _timer; - /** - * @inheritDoc - */ - set volume(val: number); - get volume(): number; - private _volume; - /** - * @param options - プレイヤーの初期化オプション / player options - * @see {@link IPlayer.options} - */ - constructor(options?: PlayerOptions); - private createDefaultTimer; - private createDefaultGraphicsDriver; - /** - * @inheritDoc - */ - addListener(listener: PlayerListener): void; - /** - * @inheritDoc - */ - removeListener(listener: PlayerListener): boolean; - - private doCreateFromVideoId; - - private doCreateFromVideo; - /** - * @inheritDoc - */ - createFromSongUrl(songUrl: string, options?: PlayerVideoOptions): Promise