NDSAnimation.js 336 KB

1
  1. !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NDSAnimation=t():e.NDSAnimation=t()}(window,function(){return i=[function(e,t){var i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(m,y,e){!function(e){var t,g,a,o,s,l,c,d,u,i,r,n,h;function f(){this.init()}function p(e){e.src&&0!==e.src.length?this.init(e):console.error("An array of source files must be passed with any new Howl.")}f.prototype={init:function(){var e=this||g;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var t=this||g;if(e=parseFloat(e),t.ctx||u(),void 0!==e&&0<=e&&e<=1){if(t._volume=e,!t._muted){t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e,g.ctx.currentTime);for(var i=0;i<t._howls.length;i++)if(!t._howls[i]._webAudio)for(var r=t._howls[i]._getSoundIds(),n=0;n<r.length;n++){var a=t._howls[i]._soundById(r[n]);a&&a._node&&(a._node.volume=a._volume*e)}}return t}return t._volume},mute:function(e){var t=this||g;t.ctx||u(),t._muted=e,t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e?0:t._volume,g.ctx.currentTime);for(var i=0;i<t._howls.length;i++)if(!t._howls[i]._webAudio)for(var r=t._howls[i]._getSoundIds(),n=0;n<r.length;n++){var a=t._howls[i]._soundById(r[n]);a&&a._node&&(a._node.muted=!!e||a._muted)}return t},stop:function(){for(var e=this||g,t=0;t<e._howls.length;t++)e._howls[t].stop();return e},unload:function(){for(var e=this||g,t=e._howls.length-1;0<=t;t--)e._howls[t].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,u()),e},codecs:function(e){return(this||g)._codecs[e.replace(/^x-/,"")]},_setup:function(){var t=this||g;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(e){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var e,t,i,r,n=this||g,a=null;try{a="undefined"!=typeof Audio?new Audio:null}catch(e){return n}return a&&"function"==typeof a.canPlayType&&(e=a.canPlayType("audio/mpeg;").replace(/^no$/,""),t=(t=(i=n._navigator?n._navigator.userAgent:"").match(/OPR\/(\d+)/g))&&parseInt(t[0].split("/")[1],10)<33,r=-1!==i.indexOf("Safari")&&-1===i.indexOf("Chrome"),i=i.match(/Version\/(.*?) /),r=r&&i&&parseInt(i[1],10)<15,n._codecs={mp3:!(t||!e&&!a.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!e,opus:!!a.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(a.canPlayType('audio/wav; codecs="1"')||a.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!a.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!a.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(a.canPlayType("audio/x-m4b;")||a.canPlayType("audio/m4b;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(a.canPlayType("audio/x-mp4;")||a.canPlayType("audio/mp4;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(r||!a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(r||!a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!a.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(a.canPlayType("audio/x-flac;")||a.canPlayType("audio/flac;")).replace(/^no$/,"")}),n},_unlockAudio:function(){var s,l=this||g;if(!l._audioUnlocked&&l.ctx)return l._audioUnlocked=!1,l.autoUnlock=!1,l._mobileUnloaded||44100===l.ctx.sampleRate||(l._mobileUnloaded=!0,l.unload()),l._scratchBuffer=l.ctx.createBuffer(1,1,22050),s=function(e){for(;l._html5AudioPool.length<l.html5PoolSize;)try{var t=new Audio;t._unlocked=!0,l._releaseHtml5Audio(t)}catch(e){l.noAudio=!0;break}for(var i=0;i<l._howls.length;i++)if(!l._howls[i]._webAudio)for(var r=l._howls[i]._getSoundIds(),n=0;n<r.length;n++){var a=l._howls[i]._soundById(r[n]);a&&a._node&&!a._node._unlocked&&(a._node._unlocked=!0,a._node.load())}l._autoResume();var o=l.ctx.createBufferSource();o.buffer=l._scratchBuffer,o.connect(l.ctx.destination),void 0===o.start?o.noteOn(0):o.start(0),"function"==typeof l.ctx.resume&&l.ctx.resume(),o.onended=function(){o.disconnect(0),l._audioUnlocked=!0,document.removeEventListener("touchstart",s,!0),document.removeEventListener("touchend",s,!0),document.removeEventListener("click",s,!0),document.removeEventListener("keydown",s,!0);for(var e=0;e<l._howls.length;e++)l._howls[e]._emit("unlock")}},document.addEventListener("touchstart",s,!0),document.addEventListener("touchend",s,!0),document.addEventListener("click",s,!0),document.addEventListener("keydown",s,!0),l},_obtainHtml5Audio:function(){var e=this||g;return e._html5AudioPool.length?e._html5AudioPool.pop():((e=(new Audio).play())&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)&&e.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio)},_releaseHtml5Audio:function(e){var t=this||g;return e._unlocked&&t._html5AudioPool.push(e),t},_autoSuspend:function(){var t=this;if(t.autoSuspend&&t.ctx&&void 0!==t.ctx.suspend&&g.usingWebAudio){for(var e=0;e<t._howls.length;e++)if(t._howls[e]._webAudio)for(var i=0;i<t._howls[e]._sounds.length;i++)if(!t._howls[e]._sounds[i]._paused)return t;return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout(function(){var e;t.autoSuspend&&(t._suspendTimer=null,t.state="suspending",e=function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())},t.ctx.suspend().then(e,e))},3e4),t}},_autoResume:function(){var t=this;if(t.ctx&&void 0!==t.ctx.resume&&g.usingWebAudio)return"running"===t.state&&"interrupted"!==t.ctx.state&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):"suspended"===t.state||"running"===t.state&&"interrupted"===t.ctx.state?(t.ctx.resume().then(function(){t.state="running";for(var e=0;e<t._howls.length;e++)t._howls[e]._emit("resume")}),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):"suspending"===t.state&&(t._resumeAfterSuspend=!0),t}},g=new f,p.prototype={init:function(e){var t=this;return g.ctx||u(),t._autoplay=e.autoplay||!1,t._format="string"!=typeof e.format?e.format:[e.format],t._html5=e.html5||!1,t._muted=e.mute||!1,t._loop=e.loop||!1,t._pool=e.pool||5,t._preload="boolean"!=typeof e.preload&&"metadata"!==e.preload||e.preload,t._rate=e.rate||1,t._sprite=e.sprite||{},t._src="string"!=typeof e.src?e.src:[e.src],t._volume=void 0!==e.volume?e.volume:1,t._xhr={method:e.xhr&&e.xhr.method?e.xhr.method:"GET",headers:e.xhr&&e.xhr.headers?e.xhr.headers:null,withCredentials:!(!e.xhr||!e.xhr.withCredentials)&&e.xhr.withCredentials},t._duration=0,t._state="unloaded",t._sounds=[],t._endTimers={},t._queue=[],t._playLock=!1,t._onend=e.onend?[{fn:e.onend}]:[],t._onfade=e.onfade?[{fn:e.onfade}]:[],t._onload=e.onload?[{fn:e.onload}]:[],t._onloaderror=e.onloaderror?[{fn:e.onloaderror}]:[],t._onplayerror=e.onplayerror?[{fn:e.onplayerror}]:[],t._onpause=e.onpause?[{fn:e.onpause}]:[],t._onplay=e.onplay?[{fn:e.onplay}]:[],t._onstop=e.onstop?[{fn:e.onstop}]:[],t._onmute=e.onmute?[{fn:e.onmute}]:[],t._onvolume=e.onvolume?[{fn:e.onvolume}]:[],t._onrate=e.onrate?[{fn:e.onrate}]:[],t._onseek=e.onseek?[{fn:e.onseek}]:[],t._onunlock=e.onunlock?[{fn:e.onunlock}]:[],t._onresume=[],t._webAudio=g.usingWebAudio&&!t._html5,void 0!==g.ctx&&g.ctx&&g.autoUnlock&&g._unlockAudio(),g._howls.push(t),t._autoplay&&t._queue.push({event:"play",action:function(){t.play()}}),t._preload&&"none"!==t._preload&&t.load(),t},load:function(){var e=this,t=null;if(g.noAudio)e._emit("loaderror",null,"No audio support.");else{"string"==typeof e._src&&(e._src=[e._src]);for(var i,r,n=0;n<e._src.length;n++){if(e._format&&e._format[n])i=e._format[n];else{if("string"!=typeof(r=e._src[n])){e._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}i=(i=(i=/^data:audio\/([^;,]+);/i.exec(r))||/\.([^.]+)$/.exec(r.split("?",1)[0]))&&i[1].toLowerCase()}if(i||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),i&&g.codecs(i)){t=e._src[n];break}}if(t)return e._src=t,e._state="loading","https:"===window.location.protocol&&"http:"===t.slice(0,5)&&(e._html5=!0,e._webAudio=!1),new a(e),e._webAudio&&s(e),e;e._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(t,i){var r=this,e=null;if("number"==typeof t)e=t,t=null;else{if("string"==typeof t&&"loaded"===r._state&&!r._sprite[t])return null;if(void 0===t&&(t="__default",!r._playLock)){for(var n=0,a=0;a<r._sounds.length;a++)r._sounds[a]._paused&&!r._sounds[a]._ended&&(n++,e=r._sounds[a]._id);1===n?t=null:e=null}}var o,s=e?r._soundById(e):r._inactiveSound();if(!s)return null;if(e&&!t&&(t=s._sprite||"__default"),"loaded"!==r._state)return s._sprite=t,s._ended=!1,o=s._id,r._queue.push({event:"play",action:function(){r.play(o)}}),o;if(e&&!s._paused)return i||r._loadQueue("play"),s._id;r._webAudio&&g._autoResume();var l,c,d,u,h=Math.max(0,0<s._seek?s._seek:r._sprite[t][0]/1e3),f=Math.max(0,(r._sprite[t][0]+r._sprite[t][1])/1e3-h),p=1e3*f/Math.abs(s._rate),m=r._sprite[t][0]/1e3,y=(r._sprite[t][0]+r._sprite[t][1])/1e3,v=(s._sprite=t,s._ended=!1,function(){s._paused=!1,s._seek=h,s._start=m,s._stop=y,s._loop=!(!s._loop&&!r._sprite[t][2])});if(!(y<=h))return l=s._node,r._webAudio?(d=function(){r._playLock=!1,v(),r._refreshBuffer(s);var e=s._muted||r._muted?0:s._volume;l.gain.setValueAtTime(e,g.ctx.currentTime),s._playStart=g.ctx.currentTime,void 0===l.bufferSource.start?s._loop?l.bufferSource.noteGrainOn(0,h,86400):l.bufferSource.noteGrainOn(0,h,f):s._loop?l.bufferSource.start(0,h,86400):l.bufferSource.start(0,h,f),p!==1/0&&(r._endTimers[s._id]=setTimeout(r._ended.bind(r,s),p)),i||setTimeout(function(){r._emit("play",s._id),r._loadQueue()},0)},"running"===g.state&&"interrupted"!==g.ctx.state?d():(r._playLock=!0,r.once("resume",d),r._clearTimer(s._id))):(c=function(){l.currentTime=h,l.muted=s._muted||r._muted||g._muted||l.muted,l.volume=s._volume*g.volume(),l.playbackRate=s._rate;try{var e=l.play();e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)?(r._playLock=!0,v(),e.then(function(){r._playLock=!1,l._unlocked=!0,i?r._loadQueue():r._emit("play",s._id)}).catch(function(){r._playLock=!1,r._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),s._ended=!0,s._paused=!0})):i||(r._playLock=!1,v(),r._emit("play",s._id)),l.playbackRate=s._rate,l.paused?r._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."):"__default"!==t||s._loop?r._endTimers[s._id]=setTimeout(r._ended.bind(r,s),p):(r._endTimers[s._id]=function(){r._ended(s),l.removeEventListener("ended",r._endTimers[s._id],!1)},l.addEventListener("ended",r._endTimers[s._id],!1))}catch(e){r._emit("playerror",s._id,e)}},"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===l.src&&(l.src=r._src,l.load()),d=window&&window.ejecta||!l.readyState&&g._navigator.isCocoonJS,3<=l.readyState||d?c():(r._playLock=!0,r._state="loading",u=function(){r._state="loaded",c(),l.removeEventListener(g._canPlayEvent,u,!1)},l.addEventListener(g._canPlayEvent,u,!1),r._clearTimer(s._id))),s._id;r._ended(s)},pause:function(e){var t=this;if("loaded"!==t._state||t._playLock)t._queue.push({event:"pause",action:function(){t.pause(e)}});else for(var i=t._getSoundIds(e),r=0;r<i.length;r++){t._clearTimer(i[r]);var n=t._soundById(i[r]);if(n&&!n._paused&&(n._seek=t.seek(i[r]),n._rateSeek=0,n._paused=!0,t._stopFade(i[r]),n._node))if(t._webAudio){if(!n._node.bufferSource)continue;void 0===n._node.bufferSource.stop?n._node.bufferSource.noteOff(0):n._node.bufferSource.stop(0),t._cleanBuffer(n._node)}else isNaN(n._node.duration)&&n._node.duration!==1/0||n._node.pause();arguments[1]||t._emit("pause",n?n._id:null)}return t},stop:function(e,t){var i=this;if("loaded"!==i._state||i._playLock)i._queue.push({event:"stop",action:function(){i.stop(e)}});else for(var r=i._getSoundIds(e),n=0;n<r.length;n++){i._clearTimer(r[n]);var a=i._soundById(r[n]);a&&(a._seek=a._start||0,a._rateSeek=0,a._paused=!0,a._ended=!0,i._stopFade(r[n]),a._node&&(i._webAudio?a._node.bufferSource&&(void 0===a._node.bufferSource.stop?a._node.bufferSource.noteOff(0):a._node.bufferSource.stop(0),i._cleanBuffer(a._node)):isNaN(a._node.duration)&&a._node.duration!==1/0||(a._node.currentTime=a._start||0,a._node.pause(),a._node.duration===1/0&&i._clearSound(a._node))),t||i._emit("stop",a._id))}return i},mute:function(e,t){var i=this;if("loaded"!==i._state||i._playLock)i._queue.push({event:"mute",action:function(){i.mute(e,t)}});else{if(void 0===t){if("boolean"!=typeof e)return i._muted;i._muted=e}for(var r=i._getSoundIds(t),n=0;n<r.length;n++){var a=i._soundById(r[n]);a&&(a._muted=e,a._interval&&i._stopFade(a._id),i._webAudio&&a._node?a._node.gain.setValueAtTime(e?0:a._volume,g.ctx.currentTime):a._node&&(a._node.muted=!!g._muted||e),i._emit("mute",a._id))}}return i},volume:function(){var e,t,i=this,r=arguments;if(0===r.length)return i._volume;if(1===r.length||2===r.length&&void 0===r[1]?0<=i._getSoundIds().indexOf(r[0])?n=parseInt(r[0],10):e=parseFloat(r[0]):2<=r.length&&(e=parseFloat(r[0]),n=parseInt(r[1],10)),!(void 0!==e&&0<=e&&e<=1))return(t=n?i._soundById(n):i._sounds[0])?t._volume:0;if("loaded"!==i._state||i._playLock)i._queue.push({event:"volume",action:function(){i.volume.apply(i,r)}});else{void 0===n&&(i._volume=e);for(var n=i._getSoundIds(n),a=0;a<n.length;a++)(t=i._soundById(n[a]))&&(t._volume=e,r[2]||i._stopFade(n[a]),i._webAudio&&t._node&&!t._muted?t._node.gain.setValueAtTime(e,g.ctx.currentTime):t._node&&!t._muted&&(t._node.volume=e*g.volume()),i._emit("volume",t._id))}return i},fade:function(e,t,i,r){var n=this;if("loaded"!==n._state||n._playLock)n._queue.push({event:"fade",action:function(){n.fade(e,t,i,r)}});else{e=Math.min(Math.max(0,parseFloat(e)),1),t=Math.min(Math.max(0,parseFloat(t)),1),i=parseFloat(i),n.volume(e,r);for(var a=n._getSoundIds(r),o=0;o<a.length;o++){var s,l,c=n._soundById(a[o]);c&&(r||n._stopFade(a[o]),n._webAudio&&!c._muted&&(l=(s=g.ctx.currentTime)+i/1e3,c._volume=e,c._node.gain.setValueAtTime(e,s),c._node.gain.linearRampToValueAtTime(t,l)),n._startFadeInterval(c,e,t,i,a[o],void 0===r))}}return n},_startFadeInterval:function(t,i,r,n,e,a){var o=this,s=i,l=r-i,c=Math.abs(l/.01),c=Math.max(4,0<c?n/c:n),d=Date.now();t._fadeTo=r,t._interval=setInterval(function(){var e=(Date.now()-d)/n;d=Date.now(),s+=l*e,s=Math.round(100*s)/100,s=l<0?Math.max(r,s):Math.min(r,s),o._webAudio?t._volume=s:o.volume(s,t._id,!0),a&&(o._volume=s),(r<i&&s<=r||i<r&&r<=s)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,o.volume(r,t._id),o._emit("fade",t._id))},c)},_stopFade:function(e){var t=this,i=t._soundById(e);return i&&i._interval&&(t._webAudio&&i._node.gain.cancelScheduledValues(g.ctx.currentTime),clearInterval(i._interval),i._interval=null,t.volume(i._fadeTo,e),i._fadeTo=null,t._emit("fade",e)),t},loop:function(){var e,t,i,r=this,n=arguments;if(0===n.length)return r._loop;if(1===n.length){if("boolean"!=typeof n[0])return!!(i=r._soundById(parseInt(n[0],10)))&&i._loop;r._loop=e=n[0]}else 2===n.length&&(e=n[0],t=parseInt(n[1],10));for(var a=r._getSoundIds(t),o=0;o<a.length;o++)(i=r._soundById(a[o]))&&(i._loop=e,r._webAudio)&&i._node&&i._node.bufferSource&&(i._node.bufferSource.loop=e)&&(i._node.bufferSource.loopStart=i._start||0,i._node.bufferSource.loopEnd=i._stop,r.playing(a[o]))&&(r.pause(a[o],!0),r.play(a[o],!0));return r},rate:function(){var e,t=this,i=arguments;if(0===i.length?a=t._sounds[0]._id:1===i.length?0<=t._getSoundIds().indexOf(i[0])?a=parseInt(i[0],10):e=parseFloat(i[0]):2===i.length&&(e=parseFloat(i[0]),a=parseInt(i[1],10)),"number"!=typeof e)return((n=t._soundById(a))||t)._rate;if("loaded"!==t._state||t._playLock)t._queue.push({event:"rate",action:function(){t.rate.apply(t,i)}});else{void 0===a&&(t._rate=e);for(var r,n,a=t._getSoundIds(a),o=0;o<a.length;o++)(n=t._soundById(a[o]))&&(t.playing(a[o])&&(n._rateSeek=t.seek(a[o]),n._playStart=t._webAudio?g.ctx.currentTime:n._playStart),n._rate=e,t._webAudio&&n._node&&n._node.bufferSource?n._node.bufferSource.playbackRate.setValueAtTime(e,g.ctx.currentTime):n._node&&(n._node.playbackRate=e),r=t.seek(a[o]),r=1e3*((t._sprite[n._sprite][0]+t._sprite[n._sprite][1])/1e3-r)/Math.abs(n._rate),!t._endTimers[a[o]]&&n._paused||(t._clearTimer(a[o]),t._endTimers[a[o]]=setTimeout(t._ended.bind(t,n),r)),t._emit("rate",n._id))}return t},seek:function(){var e,t,i=this,r=arguments;if(0===r.length?i._sounds.length&&(t=i._sounds[0]._id):1===r.length?0<=i._getSoundIds().indexOf(r[0])?t=parseInt(r[0],10):i._sounds.length&&(t=i._sounds[0]._id,e=parseFloat(r[0])):2===r.length&&(e=parseFloat(r[0]),t=parseInt(r[1],10)),void 0===t)return 0;if("number"!=typeof e||"loaded"===i._state&&!i._playLock){var n,a,o,s,l,c=i._soundById(t);if(c){if(!("number"==typeof e&&0<=e))return i._webAudio?(s=i.playing(t)?g.ctx.currentTime-c._playStart:0,l=c._rateSeek?c._rateSeek-c._seek:0,c._seek+(l+s*Math.abs(c._rate))):c._node.currentTime;(n=i.playing(t))&&i.pause(t,!0),c._seek=e,c._ended=!1,i._clearTimer(t),i._webAudio||!c._node||isNaN(c._node.duration)||(c._node.currentTime=e),a=function(){n&&i.play(t,!0),i._emit("seek",t)},n&&!i._webAudio?(o=function(){i._playLock?setTimeout(o,0):a()},setTimeout(o,0)):a()}}else i._queue.push({event:"seek",action:function(){i.seek.apply(i,r)}});return i},playing:function(e){if("number"==typeof e)return!!(e=this._soundById(e))&&!e._paused;for(var t=0;t<this._sounds.length;t++)if(!this._sounds[t]._paused)return!0;return!1},duration:function(e){var t=this._duration,e=this._soundById(e);return t=e?this._sprite[e._sprite][1]/1e3:t},state:function(){return this._state},unload:function(){for(var e=this,t=e._sounds,i=0;i<t.length;i++)t[i]._paused||e.stop(t[i]._id),e._webAudio||(e._clearSound(t[i]._node),t[i]._node.removeEventListener("error",t[i]._errorFn,!1),t[i]._node.removeEventListener(g._canPlayEvent,t[i]._loadFn,!1),t[i]._node.removeEventListener("ended",t[i]._endFn,!1),g._releaseHtml5Audio(t[i]._node)),delete t[i]._node,e._clearTimer(t[i]._id);for(var r=g._howls.indexOf(e),n=(0<=r&&g._howls.splice(r,1),!0),i=0;i<g._howls.length;i++)if(g._howls[i]._src===e._src||0<=e._src.indexOf(g._howls[i]._src)){n=!1;break}return o&&n&&delete o[e._src],g.noAudio=!1,e._state="unloaded",e._sounds=[],e=null},on:function(e,t,i,r){e=this["_on"+e];return"function"==typeof t&&e.push(r?{id:i,fn:t,once:r}:{id:i,fn:t}),this},off:function(e,t,i){var r=this,n=r["_on"+e],a=0;if("number"==typeof t&&(i=t,t=null),t||i)for(a=0;a<n.length;a++){var o=i===n[a].id;if(t===n[a].fn&&o||!t&&o){n.splice(a,1);break}}else if(e)r["_on"+e]=[];else for(var s=Object.keys(r),a=0;a<s.length;a++)0===s[a].indexOf("_on")&&Array.isArray(r[s[a]])&&(r[s[a]]=[]);return r},once:function(e,t,i){return this.on(e,t,i,1),this},_emit:function(e,t,i){for(var r=this,n=r["_on"+e],a=n.length-1;0<=a;a--)n[a].id&&n[a].id!==t&&"load"!==e||(setTimeout(function(e){e.call(this,t,i)}.bind(r,n[a].fn),0),n[a].once&&r.off(e,n[a].fn,n[a].id));return r._loadQueue(e),r},_loadQueue:function(e){var t,i=this;return 0<i._queue.length&&((t=i._queue[0]).event===e&&(i._queue.shift(),i._loadQueue()),e||t.action()),i},_ended:function(e){var t,i=this,r=e._sprite;return!i._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime<e._stop?setTimeout(i._ended.bind(i,e),100):(r=!(!e._loop&&!i._sprite[r][2]),i._emit("end",e._id),!i._webAudio&&r&&i.stop(e._id,!0).play(e._id),i._webAudio&&r&&(i._emit("play",e._id),e._seek=e._start||0,e._rateSeek=0,e._playStart=g.ctx.currentTime,t=1e3*(e._stop-e._start)/Math.abs(e._rate),i._endTimers[e._id]=setTimeout(i._ended.bind(i,e),t)),i._webAudio&&!r&&(e._paused=!0,e._ended=!0,e._seek=e._start||0,e._rateSeek=0,i._clearTimer(e._id),i._cleanBuffer(e._node),g._autoSuspend()),i._webAudio||r||i.stop(e._id,!0)),i},_clearTimer:function(e){var t,i=this;return i._endTimers[e]&&("function"!=typeof i._endTimers[e]?clearTimeout(i._endTimers[e]):(t=i._soundById(e))&&t._node&&t._node.removeEventListener("ended",i._endTimers[e],!1),delete i._endTimers[e]),i},_soundById:function(e){for(var t=0;t<this._sounds.length;t++)if(e===this._sounds[t]._id)return this._sounds[t];return null},_inactiveSound:function(){var e=this;e._drain();for(var t=0;t<e._sounds.length;t++)if(e._sounds[t]._ended)return e._sounds[t].reset();return new a(e)},_drain:function(){var e=this,t=e._pool,i=0,r=0;if(!(e._sounds.length<t)){for(r=0;r<e._sounds.length;r++)e._sounds[r]._ended&&i++;for(r=e._sounds.length-1;0<=r;r--){if(i<=t)return;e._sounds[r]._ended&&(e._webAudio&&e._sounds[r]._node&&e._sounds[r]._node.disconnect(0),e._sounds.splice(r,1),i--)}}},_getSoundIds:function(e){if(void 0!==e)return[e];for(var t=[],i=0;i<this._sounds.length;i++)t.push(this._sounds[i]._id);return t},_refreshBuffer:function(e){return e._node.bufferSource=g.ctx.createBufferSource(),e._node.bufferSource.buffer=o[this._src],e._panner?e._node.bufferSource.connect(e._panner):e._node.bufferSource.connect(e._node),e._node.bufferSource.loop=e._loop,e._loop&&(e._node.bufferSource.loopStart=e._start||0,e._node.bufferSource.loopEnd=e._stop||0),e._node.bufferSource.playbackRate.setValueAtTime(e._rate,g.ctx.currentTime),this},_cleanBuffer:function(e){var t=g._navigator&&0<=g._navigator.vendor.indexOf("Apple");if(e.bufferSource){if(g._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=g._scratchBuffer}catch(e){}e.bufferSource=null}return this},_clearSound:function(e){/MSIE |Trident\//.test(g._navigator&&g._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}},(a=function(e){this._parent=e,this.init()}).prototype={init:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++g._counter,t._sounds.push(e),e.create(),e},create:function(){var e=this,t=e._parent,i=g._muted||e._muted||e._parent._muted?0:e._volume;return t._webAudio?(e._node=void 0===g.ctx.createGain?g.ctx.createGainNode():g.ctx.createGain(),e._node.gain.setValueAtTime(i,g.ctx.currentTime),e._node.paused=!0,e._node.connect(g.masterGain)):g.noAudio||(e._node=g._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(g._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=t._src,e._node.preload=!0===t._preload?"auto":t._preload,e._node.volume=i*g.volume(),e._node.load()),e},reset:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++g._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this._parent;e._duration=Math.ceil(10*this._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),this._node.removeEventListener(g._canPlayEvent,this._loadFn,!1)},_endListener:function(){var e=this,t=e._parent;t._duration===1/0&&(t._duration=Math.ceil(10*e._node.duration)/10,t._sprite.__default[1]===1/0&&(t._sprite.__default[1]=1e3*t._duration),t._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}},o={},s=function(t){var e=t._src;if(o[e])t._duration=o[e].duration,d(t);else if(/^data:[^;]+;base64,/.test(e)){for(var i=atob(e.split(",")[1]),r=new Uint8Array(i.length),n=0;n<i.length;++n)r[n]=i.charCodeAt(n);c(r.buffer,t)}else{var a=new XMLHttpRequest;a.open(t._xhr.method,e,!0),a.withCredentials=t._xhr.withCredentials,a.responseType="arraybuffer",t._xhr.headers&&Object.keys(t._xhr.headers).forEach(function(e){a.setRequestHeader(e,t._xhr.headers[e])}),a.onload=function(){var e=(a.status+"")[0];"0"!==e&&"2"!==e&&"3"!==e?t._emit("loaderror",null,"Failed loading audio file with status: "+a.status+"."):c(a.response,t)},a.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete o[e],t.load())},l(a)}},l=function(t){try{t.send()}catch(e){t.onerror()}},c=function(e,t){function i(){t._emit("loaderror",null,"Decoding audio data failed.")}function r(e){e&&0<t._sounds.length?(o[t._src]=e,d(t,e)):i()}"undefined"!=typeof Promise&&1===g.ctx.decodeAudioData.length?g.ctx.decodeAudioData(e).then(r).catch(i):g.ctx.decodeAudioData(e,r,i)},d=function(e,t){t&&!e._duration&&(e._duration=t.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},u=function(){if(g.usingWebAudio){try{"undefined"!=typeof AudioContext?g.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?g.ctx=new webkitAudioContext:g.usingWebAudio=!1}catch(e){g.usingWebAudio=!1}g.ctx||(g.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(g._navigator&&g._navigator.platform),t=g._navigator&&g._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=t?parseInt(t[1],10):null;e&&t&&t<9&&(e=/safari/.test(g._navigator&&g._navigator.userAgent.toLowerCase()),g._navigator)&&!e&&(g.usingWebAudio=!1),g.usingWebAudio&&(g.masterGain=void 0===g.ctx.createGain?g.ctx.createGainNode():g.ctx.createGain(),g.masterGain.gain.setValueAtTime(g._muted?0:g._volume,g.ctx.currentTime),g.masterGain.connect(g.ctx.destination)),g._setup()}},void 0!==(t=function(){return{Howler:g,Howl:p}}.apply(y,[]))&&(m.exports=t),y.Howler=g,y.Howl=p,void 0!==e?(e.HowlerGlobal=f,e.Howler=g,e.Howl=p,e.Sound=a):"undefined"!=typeof window&&(window.HowlerGlobal=f,window.Howler=g,window.Howl=p,window.Sound=a),HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var t=this;if(t.ctx&&t.ctx.listener)for(var i=t._howls.length-1;0<=i;i--)t._howls[i].stereo(e);return t},HowlerGlobal.prototype.pos=function(e,t,i){var r=this;if(r.ctx&&r.ctx.listener){if(t="number"!=typeof t?r._pos[1]:t,i="number"!=typeof i?r._pos[2]:i,"number"!=typeof e)return r._pos;r._pos=[e,t,i],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2])}return r},HowlerGlobal.prototype.orientation=function(e,t,i,r,n,a){var o=this;if(o.ctx&&o.ctx.listener){var s=o._orientation;if(t="number"!=typeof t?s[1]:t,i="number"!=typeof i?s[2]:i,r="number"!=typeof r?s[3]:r,n="number"!=typeof n?s[4]:n,a="number"!=typeof a?s[5]:a,"number"!=typeof e)return s;o._orientation=[e,t,i,r,n,a],void 0!==o.ctx.listener.forwardX?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(t,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(a,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,t,i,r,n,a)}return o},Howl.prototype.init=(i=Howl.prototype.init,function(e){var t=this;return t._orientation=e.orientation||[1,0,0],t._stereo=e.stereo||null,t._pos=e.pos||null,t._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},t._onstereo=e.onstereo?[{fn:e.onstereo}]:[],t._onpos=e.onpos?[{fn:e.onpos}]:[],t._onorientation=e.onorientation?[{fn:e.onorientation}]:[],i.call(this,e)}),Howl.prototype.stereo=function(e,t){var i=this;if(i._webAudio)if("loaded"!==i._state)i._queue.push({event:"stereo",action:function(){i.stereo(e,t)}});else{var r=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof e)return i._stereo;i._stereo=e,i._pos=[e,0,0]}for(var n=i._getSoundIds(t),a=0;a<n.length;a++){var o=i._soundById(n[a]);if(o){if("number"!=typeof e)return o._stereo;o._stereo=e,o._pos=[e,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",o._panner&&o._panner.pan||h(o,r),"spatial"==r?void 0!==o._panner.positionX?(o._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(e,0,0):o._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),i._emit("stereo",o._id)}}}return i},Howl.prototype.pos=function(e,t,i,r){var n=this;if(n._webAudio)if("loaded"!==n._state)n._queue.push({event:"pos",action:function(){n.pos(e,t,i,r)}});else{if(t="number"!=typeof t?0:t,i="number"!=typeof i?-.5:i,void 0===r){if("number"!=typeof e)return n._pos;n._pos=[e,t,i]}for(var a=n._getSoundIds(r),o=0;o<a.length;o++){var s=n._soundById(a[o]);if(s){if("number"!=typeof e)return s._pos;s._pos=[e,t,i],s._node&&(s._panner&&!s._panner.pan||h(s,"spatial"),void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(t,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(i,Howler.ctx.currentTime)):s._panner.setPosition(e,t,i)),n._emit("pos",s._id)}}}return n},Howl.prototype.orientation=function(e,t,i,r){var n=this;if(n._webAudio)if("loaded"!==n._state)n._queue.push({event:"orientation",action:function(){n.orientation(e,t,i,r)}});else{if(t="number"!=typeof t?n._orientation[1]:t,i="number"!=typeof i?n._orientation[2]:i,void 0===r){if("number"!=typeof e)return n._orientation;n._orientation=[e,t,i]}for(var a=n._getSoundIds(r),o=0;o<a.length;o++){var s=n._soundById(a[o]);if(s){if("number"!=typeof e)return s._orientation;s._orientation=[e,t,i],s._node&&(s._panner||(s._pos||(s._pos=n._pos||[0,0,-.5]),h(s,"spatial")),void 0!==s._panner.orientationX?(s._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),s._panner.orientationY.setValueAtTime(t,Howler.ctx.currentTime),s._panner.orientationZ.setValueAtTime(i,Howler.ctx.currentTime)):s._panner.setOrientation(e,t,i)),n._emit("orientation",s._id)}}}return n},Howl.prototype.pannerAttr=function(){var e,t,i=this,r=arguments;if(i._webAudio){if(0===r.length)return i._pannerAttr;if(1===r.length){if("object"!=typeof r[0])return((o=i._soundById(parseInt(r[0],10)))||i)._pannerAttr;e=r[0],void 0===t&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),i._pannerAttr={coneInnerAngle:void 0!==e.pannerAttr.coneInnerAngle?e.pannerAttr.coneInnerAngle:i._coneInnerAngle,coneOuterAngle:void 0!==e.pannerAttr.coneOuterAngle?e.pannerAttr.coneOuterAngle:i._coneOuterAngle,coneOuterGain:void 0!==e.pannerAttr.coneOuterGain?e.pannerAttr.coneOuterGain:i._coneOuterGain,distanceModel:void 0!==e.pannerAttr.distanceModel?e.pannerAttr.distanceModel:i._distanceModel,maxDistance:void 0!==e.pannerAttr.maxDistance?e.pannerAttr.maxDistance:i._maxDistance,refDistance:void 0!==e.pannerAttr.refDistance?e.pannerAttr.refDistance:i._refDistance,rolloffFactor:void 0!==e.pannerAttr.rolloffFactor?e.pannerAttr.rolloffFactor:i._rolloffFactor,panningModel:void 0!==e.pannerAttr.panningModel?e.pannerAttr.panningModel:i._panningModel})}else 2===r.length&&(e=r[0],t=parseInt(r[1],10));for(var n,a,o,s=i._getSoundIds(t),l=0;l<s.length;l++)(o=i._soundById(s[l]))&&(n=o._pannerAttr,n={coneInnerAngle:(void 0!==e.coneInnerAngle?e:n).coneInnerAngle,coneOuterAngle:(void 0!==e.coneOuterAngle?e:n).coneOuterAngle,coneOuterGain:(void 0!==e.coneOuterGain?e:n).coneOuterGain,distanceModel:(void 0!==e.distanceModel?e:n).distanceModel,maxDistance:(void 0!==e.maxDistance?e:n).maxDistance,refDistance:(void 0!==e.refDistance?e:n).refDistance,rolloffFactor:(void 0!==e.rolloffFactor?e:n).rolloffFactor,panningModel:(void 0!==e.panningModel?e:n).panningModel},(a=o._panner)||(o._pos||(o._pos=i._pos||[0,0,-.5]),h(o,"spatial"),a=o._panner),a.coneInnerAngle=n.coneInnerAngle,a.coneOuterAngle=n.coneOuterAngle,a.coneOuterGain=n.coneOuterGain,a.distanceModel=n.distanceModel,a.maxDistance=n.maxDistance,a.refDistance=n.refDistance,a.rolloffFactor=n.rolloffFactor,a.panningModel=n.panningModel)}return i},Sound.prototype.init=(r=Sound.prototype.init,function(){var e=this,t=e._parent;e._orientation=t._orientation,e._stereo=t._stereo,e._pos=t._pos,e._pannerAttr=t._pannerAttr,r.call(this),e._stereo?t.stereo(e._stereo):e._pos&&t.pos(e._pos[0],e._pos[1],e._pos[2],e._id)}),Sound.prototype.reset=(n=Sound.prototype.reset,function(){var e=this,t=e._parent;return e._orientation=t._orientation,e._stereo=t._stereo,e._pos=t._pos,e._pannerAttr=t._pannerAttr,e._stereo?t.stereo(e._stereo):e._pos?t.pos(e._pos[0],e._pos[1],e._pos[2],e._id):e._panner&&(e._panner.disconnect(0),e._panner=void 0,t._refreshBuffer(e)),n.call(this)}),h=function(e,t){"spatial"===(t=t||"spatial")?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}.call(this,e(0))},function(e,t){var i,r,e=e.exports={};function n(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}try{i="function"==typeof setTimeout?setTimeout:n}catch(e){i=n}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}function o(t){if(i===setTimeout)return setTimeout(t,0);if((i===n||!i)&&setTimeout)return(i=setTimeout)(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}var s,l=[],c=!1,d=-1;function u(){c&&s&&(c=!1,s.length?l=s.concat(l):d=-1,l.length)&&h()}function h(){if(!c){for(var e=o(u),t=(c=!0,l.length);t;){for(s=l,l=[];++d<t;)s&&s[d].run();d=-1,t=l.length}s=null,c=!1,!function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return(r=clearTimeout)(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}e.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];l.push(new f(e,t)),1!==l.length||c||o(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=p,e.addListener=p,e.once=p,e.off=p,e.removeListener=p,e.removeAllListeners=p,e.emit=p,e.prependListener=p,e.prependOnceListener=p,e.listeners=function(e){return[]},e.binding=function(e){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},function(e,t,i){!function(u,f,r,p){e.exports=function r(n,a,o){function s(t,e){if(!a[t]){if(!n[t]){if(l)return l(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}i=a[t]={exports:{}};n[t][0].call(i.exports,function(e){return s(n[t][1][e]||e)},i,i.exports,r,n,a,o)}return a[t].exports}for(var l=!1,e=0;e<o.length;e++)s(o[e]);return s}({1:[function(e,t,i){var u=e("./utils"),d=e("./support"),h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,r,n,a,o,s=[],l=0,c=e.length,d="string"!==u.getTypeOf(e);l<e.length;)o=c-l,r=d?(t=e[l++],i=l<c?e[l++]:0,l<c?e[l++]:0):(t=e.charCodeAt(l++),i=l<c?e.charCodeAt(l++):0,l<c?e.charCodeAt(l++):0),n=(3&t)<<4|i>>4,a=1<o?(15&i)<<2|r>>6:64,o=2<o?63&r:64,s.push(h.charAt(t>>2)+h.charAt(n)+h.charAt(a)+h.charAt(o));return s.join("")},i.decode=function(e){var t,i,r,n,a,o=0,s=0;if("data:"===e.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var l,c=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===h.charAt(64)&&c--,e.charAt(e.length-2)===h.charAt(64)&&c--,c%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=new(d.uint8array?Uint8Array:Array)(0|c);o<e.length;)t=h.indexOf(e.charAt(o++))<<2|(n=h.indexOf(e.charAt(o++)))>>4,i=(15&n)<<4|(n=h.indexOf(e.charAt(o++)))>>2,r=(3&n)<<6|(a=h.indexOf(e.charAt(o++))),l[s++]=t,64!==n&&(l[s++]=i),64!==a&&(l[s++]=r);return l}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,i,r,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=r,this.compressedContent=n}s.prototype={getContentWorker:function(){var e=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,i){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),o=function(){for(var e=[],t=0;t<256;t++){for(var i=t,r=0;r<8;r++)i=1&i?3988292384^i>>>1:i>>>1;e[t]=i}return e}();t.exports=function(e,t){return void 0!==e&&e.length?("string"!==r.getTypeOf(e)?function(e,t,i){var r=o,n=0+i;e^=-1;for(var a=0;a<n;a++)e=e>>>8^r[255&(e^t[a])];return-1^e}:function(e,t,i){var r=o,n=0+i;e^=-1;for(var a=0;a<n;a++)e=e>>>8^r[255&(e^t.charCodeAt(a))];return-1^e})(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){e="undefined"!=typeof Promise?Promise:e("lie");t.exports={Promise:e}},{lie:37}],7:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=r?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",a.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},i.compressWorker=function(e){return new l("Deflate",e)},i.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function g(e,t){for(var i="",r=0;r<t;r++)i+=String.fromCharCode(255&e),e>>>=8;return i}function r(e,t,i,r,n,a){var o=e.file,s=e.compression,l=a!==w.utf8encode,c=_.transformTo("string",a(o.name)),d=_.transformTo("string",w.utf8encode(o.name)),u=o.comment,a=_.transformTo("string",a(u)),h=_.transformTo("string",w.utf8encode(u)),f=d.length!==o.name.length,u=h.length!==u.length,p="",m=o.dir,y=o.date,v={crc32:0,compressedSize:0,uncompressedSize:0},i=(t&&!i||(v.crc32=e.crc32,v.compressedSize=e.compressedSize,v.uncompressedSize=e.uncompressedSize),0),e=(t&&(i|=8),l||!f&&!u||(i|=2048),0),t=0,y=(m&&(e|=16),"UNIX"===n?(t=798,e|=(65535&((l=o.unixPermissions)?l:m?16893:33204))<<16):(t=20,e|=63&(o.dosPermissions||0)),n=y.getUTCHours(),n=(n=((n<<=6)|y.getUTCMinutes())<<5)|y.getUTCSeconds()/2,l=y.getUTCFullYear()-1980,l=(l=((l<<=4)|y.getUTCMonth()+1)<<5)|y.getUTCDate(),f&&(m=g(1,1)+g(x(c),4)+d,p+="up"+g(m.length,2)+m),u&&(o=g(1,1)+g(x(a),4)+h,p+="uc"+g(o.length,2)+o),""),y=(y=(y=(y=(y=(y=(y=(y=(y=(y+="\n\0")+g(i,2))+s.magic)+g(n,2))+g(l,2))+g(v.crc32,4))+g(v.compressedSize,4))+g(v.uncompressedSize,4))+g(c.length,2))+g(p.length,2);return{fileRecord:I.LOCAL_FILE_HEADER+y+c+p,dirRecord:I.CENTRAL_FILE_HEADER+g(t,2)+y+g(a.length,2)+"\0\0\0\0"+g(e,4)+g(r,4)+c+p+a}}var _=e("../utils"),n=e("../stream/GenericWorker"),w=e("../utf8"),x=e("../crc32"),I=e("../signature");function a(e,t,i,r){n.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}_.inherits(a,n),a.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,n.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-r-1))/i:100}}))},a.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;t?(e=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName),this.push({data:e.fileRecord,meta:{percent:0}})):this.accumulate=!0},a.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:(t=e,I.DATA_DESCRIPTOR+g(t.crc32,4)+g(t.compressedSize,4)+g(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},a.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i=this.bytesWritten-e,i=function(e,t,i,r,n){n=_.transformTo("string",n(r));return I.CENTRAL_DIRECTORY_END+"\0\0\0\0"+g(e,2)+g(e,2)+g(t,4)+g(i,4)+g(n.length,2)+n}(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},a.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},a.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},a.prototype.error=function(e){var t=this._sources;if(!n.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(e){}return!0},a.prototype.lock=function(){n.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=a},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var c=e("../compressions"),r=e("./ZipFileWorker");i.generateWorker=function(e,o,t){var s=new r(o.streamFiles,t,o.platform,o.encodeFileName),l=0;try{e.forEach(function(e,t){l++;var i=function(e,t){e=e||t,t=c[e];if(t)return t;throw new Error(e+" is not a valid compression method !")}(t.options.compression,o.compression),r=t.options.compressionOptions||o.compressionOptions||{},n=t.dir,a=t.date;t._compressWorker(i,r).withStreamInfo("file",{name:e,dir:n,date:a,comment:t.comment||"",unixPermissions:t.unixPermissions,dosPermissions:t.dosPermissions}).pipe(s)}),s.entriesCount=l}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e,t=new r;for(e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var l=e("./utils"),n=e("./external"),r=e("./utf8"),a=e("./zipEntries"),c=e("./stream/Crc32Probe"),d=e("./nodejsUtils");t.exports=function(e,o){var s=this;return o=l.extend(o||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),d.isNode&&d.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):l.prepareContent("the loaded zip file",e,!0,o.optimizedBinaryString,o.base64).then(function(e){var t=new a(o);return t.load(e),t}).then(function(e){var t=[n.Promise.resolve(e)],i=e.files;if(o.checkCRC32)for(var r=0;r<i.length;r++)t.push(function(r){return new n.Promise(function(e,t){var i=r.decompressed.getContentWorker().pipe(new c);i.on("error",function(e){t(e)}).on("end",function(){i.streamInfo.crc32!==r.decompressed.crc32?t(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}(i[r]));return n.Promise.all(t)}).then(function(e){for(var e=e.shift(),t=e.files,i=0;i<t.length;i++){var r=t[i],n=r.fileNameStr,a=l.resolve(r.fileNameStr);s.file(a,r.decompressed,{binary:!0,optimizedBinaryString:!0,date:r.date,dir:r.dir,comment:r.fileCommentStr.length?r.fileCommentStr:null,unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions,createFolders:o.createFolders}),r.dir||(s.file(a).unsafeOriginalName=n)}return e.zipComment.length&&(s.comment=e.zipComment),s})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function a(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(a,n),a.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var n=e("readable-stream").Readable;function r(e,t,i){n.call(this,t),this._helper=e;var r=this;e.on("data",function(e,t){r.push(e)||r._helper.pause(),i&&i(t)}).on("error",function(e){r.emit("error",e)}).on("end",function(){r.push(null)})}e("../utils").inherits(r,n),r.prototype._read=function(){this._helper.resume()},t.exports=r},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:void 0!==u,newBufferFrom:function(e,t){if(u.from&&u.from!==Uint8Array.from)return u.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new u(e,t)},allocBuffer:function(e){return u.alloc?u.alloc(e):((e=new u(e)).fill(0),e)},isBuffer:function(e){return u.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function n(e,t,i){var r=l.getTypeOf(t),n=l.extend(i||{},u),a=(n.date=n.date||new Date,null!==n.compression&&(n.compression=n.compression.toUpperCase()),"string"==typeof n.unixPermissions&&(n.unixPermissions=parseInt(n.unixPermissions,8)),n.unixPermissions&&16384&n.unixPermissions&&(n.dir=!0),n.dosPermissions&&16&n.dosPermissions&&(n.dir=!0),n.dir&&(e=v(e)),n.createFolders&&(a=o(e))&&s.call(this,a,!0),"string"===r&&!1===n.binary&&!1===n.base64),r=(i&&void 0!==i.binary||(n.binary=!a),(t instanceof h&&0===t.uncompressedSize||n.dir||!t||0===t.length)&&(n.base64=!1,n.binary=!0,t="",n.compression="STORE"),t instanceof h||t instanceof c?t:m.isNode&&m.isStream(t)?new y(e,t):l.prepareContent(e,t,n.binary,n.optimizedBinaryString,n.base64)),i=new f(e,r,n);this.files[e]=i}function o(e){var t=(e="/"===e.slice(-1)?e.substring(0,e.length-1):e).lastIndexOf("/");return 0<t?e.substring(0,t):""}function s(e,t){return t=void 0!==t?t:u.createFolders,e=v(e),this.files[e]||n.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]}var a=e("./utf8"),l=e("./utils"),c=e("./stream/GenericWorker"),d=e("./stream/StreamHelper"),u=e("./defaults"),h=e("./compressedObject"),f=e("./zipObject"),p=e("./generate"),m=e("./nodejsUtils"),y=e("./nodejs/NodejsStreamInputAdapter"),v=function(e){return"/"!==e.slice(-1)&&(e+="/"),e};function g(e){return"[object RegExp]"===Object.prototype.toString.call(e)}t.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,r;for(t in this.files)r=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,r)},filter:function(i){var r=[];return this.forEach(function(e,t){i(e,t)&&r.push(t)}),r},file:function(e,t,i){var r;return 1!==arguments.length?(e=this.root+e,n.call(this,e,t,i),this):g(e)?(r=e,this.filter(function(e,t){return!t.dir&&r.test(e)})):(t=this.files[this.root+e])&&!t.dir?t:null},folder:function(i){var e,t;return i?g(i)?this.filter(function(e,t){return t.dir&&i.test(e)}):(e=this.root+i,e=s.call(this,e),(t=this.clone()).root=e.name,t):this},remove:function(i){i=this.root+i;var e=this.files[i];if(e||("/"!==i.slice(-1)&&(i+="/"),e=this.files[i]),e&&!e.dir)delete this.files[i];else for(var t=this.filter(function(e,t){return t.name.slice(0,i.length)===i}),r=0;r<t.length;r++)delete this.files[t[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t={};try{if((t=l.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=t.type.toLowerCase(),t.compression=t.compression.toUpperCase(),"binarystring"===t.type&&(t.type="string"),!t.type)throw new Error("No output type specified.");l.checkSupport(t.type),"darwin"!==t.platform&&"freebsd"!==t.platform&&"linux"!==t.platform&&"sunos"!==t.platform||(t.platform="UNIX"),"win32"===t.platform&&(t.platform="DOS");var i=t.comment||this.comment||"",r=p.generateWorker(this,t,i)}catch(e){(r=new c("error")).error(e)}return new d(r,t.type||"string",t.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.length-4;0<=a;--a)if(this.data[a]===t&&this.data[a+1]===i&&this.data[a+2]===r&&this.data[a+3]===n)return a-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),e=e.charCodeAt(3),n=this.readData(4);return t===n[0]&&i===n[1]&&r===n[2]&&e===n[3]},n.prototype.readData=function(e){var t;return this.checkOffset(e),0===e?[]:(t=this.data.slice(this.zero+this.index,this.zero+this.index+e),this.index+=e,t)},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){var t;return this.checkOffset(e),0===e?new Uint8Array(0):(t=this.data.subarray(this.zero+this.index,this.zero+this.index+e),this.index+=e,t)},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new s(e):n.uint8array?new l(r.transformTo("uint8array",e)):new a(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function a(e){r.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,n),a.prototype.processChunk=function(e){var t;e&&(t=this.streamInfo[this.propName]||0,this.streamInfo[this.propName]=t+e.data.length),n.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished)||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0)},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){var e;return!(!this.isPaused||this.isFinished||(e=this.isPaused=!1,this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),e))},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,i){var c=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),d=e("../base64"),r=e("../support"),o=e("../external"),s=null;if(r.nodestream)try{s=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function l(e,t,i){var r=t;switch(t){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=t,this._mimeType=i,c.checkSupport(r),this._worker=e.pipe(new n(r)),e.lock()}catch(e){this._worker=new a("error"),this._worker.error(e)}}l.prototype={accumulate:function(e){return s=this,l=e,new o.Promise(function(t,i){var r=[],n=s._internalType,a=s._outputType,o=s._mimeType;s.on("data",function(e,t){r.push(e),l&&l(t)}).on("error",function(e){r=[],i(e)}).on("end",function(){try{var e=function(e,t,i){switch(e){case"blob":return c.newBlob(c.transformTo("arraybuffer",t),i);case"base64":return d.encode(t);default:return c.transformTo(e,t)}}(a,function(e,t){for(var i=0,r=null,n=0,a=0;a<t.length;a++)n+=t[a].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(n),a=0;a<t.length;a++)r.set(t[a],i),i+=t[a].length;return r;case"nodebuffer":return u.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(n,r),o);t(e)}catch(e){i(e)}r=[]}).resume()});var s,l},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,function(e){t.call(i,e.data,e.meta)}):this._worker.on(e,function(){c.delay(t,arguments,i)}),this},resume:function(){return c.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(c.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new s(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=l},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer=void 0!==u,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(e){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(e){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var l=e("./utils"),c=e("./support"),d=e("./nodejsUtils"),i=e("./stream/GenericWorker"),u=new Array(256),r=0;r<256;r++)u[r]=252<=r?6:248<=r?5:240<=r?4:224<=r?3:192<=r?2:1;function a(){i.call(this,"utf-8 decode"),this.leftOver=null}function o(){i.call(this,"utf-8 encode")}u[254]=u[254]=1,n.utf8encode=function(e){if(c.nodebuffer)return d.newBufferFrom(e,"utf-8");for(var t,i,r,n,a=e,o=a.length,s=0,l=0;l<o;l++)55296==(64512&(i=a.charCodeAt(l)))&&l+1<o&&56320==(64512&(r=a.charCodeAt(l+1)))&&(i=65536+(i-55296<<10)+(r-56320),l++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new(c.uint8array?Uint8Array:Array)(s),l=n=0;n<s;l++)55296==(64512&(i=a.charCodeAt(l)))&&l+1<o&&56320==(64512&(r=a.charCodeAt(l+1)))&&(i=65536+(i-55296<<10)+(r-56320),l++),i<128?t[n++]=i:(i<2048?t[n++]=192|i>>>6:(i<65536?t[n++]=224|i>>>12:(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63),t[n++]=128|i>>>6&63),t[n++]=128|63&i);return t},n.utf8decode=function(e){if(c.nodebuffer)return l.transformTo("nodebuffer",e).toString("utf-8");for(var t,i,r,n=e=l.transformTo(c.uint8array?"uint8array":"array",e),a=n.length,o=new Array(2*a),s=t=0;s<a;)if((i=n[s++])<128)o[t++]=i;else if(4<(r=u[i]))o[t++]=65533,s+=r-1;else{for(i&=2===r?31:3===r?15:7;1<r&&s<a;)i=i<<6|63&n[s++],r--;1<r?o[t++]=65533:i<65536?o[t++]=i:(i-=65536,o[t++]=55296|i>>10&1023,o[t++]=56320|1023&i)}return o.length!==t&&(o.subarray?o=o.subarray(0,t):o.length=t),l.applyFromCharCode(o)},l.inherits(a,i),a.prototype.processChunk=function(e){var t=l.transformTo(c.uint8array?"uint8array":"array",e.data),i=(this.leftOver&&this.leftOver.length&&(c.uint8array?(i=t,(t=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),t.set(i,this.leftOver.length)):t=this.leftOver.concat(t),this.leftOver=null),function(e,t){for(var i=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=i&&128==(192&e[i]);)i--;return!(i<0)&&0!==i&&i+u[e[i]]>t?i:t}(t)),r=t;i!==t.length&&(c.uint8array?(r=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(r=t.slice(0,i),this.leftOver=t.slice(i,t.length))),this.push({data:n.utf8decode(r),meta:e.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=a,l.inherits(o,i),o.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=o},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,o){var s=e("./support"),l=e("./base64"),i=e("./nodejsUtils"),c=e("./external");function r(e){return e}function d(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),o.newBlob=function(t,i){o.checkSupport("blob");try{return new Blob([t],{type:i})}catch(e){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(t),r.getBlob(i)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var n={stringifyByChunk:function(e,t,i){var r=[],n=0,a=e.length;if(a<=i)return String.fromCharCode.apply(null,e);for(;n<a;)r.push("array"===t||"nodebuffer"===t?String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,a))):String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,a)))),n+=i;return r.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&1===String.fromCharCode.apply(null,i.allocBuffer(1)).length}catch(e){return!1}}()}};function a(e){var t=65536,i=o.getTypeOf(e),r=!0;if("uint8array"===i?r=n.applyCanBeUsed.uint8array:"nodebuffer"===i&&(r=n.applyCanBeUsed.nodebuffer),r)for(;1<t;)try{return n.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2)}return n.stringifyByChar(e)}function u(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}o.applyFromCharCode=a;var h={};h.string={string:r,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:function(e){return d(e,i.allocBuffer(e.length))}},h.array={string:a,array:r,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return i.newBufferFrom(e)}},h.arraybuffer={string:function(e){return a(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:r,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return i.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:a,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:r,nodebuffer:function(e){return i.newBufferFrom(e)}},h.nodebuffer={string:a,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:r},o.transformTo=function(e,t){if(t=t||"",!e)return t;o.checkSupport(e);var i=o.getTypeOf(t);return h[i][e](t)},o.resolve=function(e){for(var t=e.split("/"),i=[],r=0;r<t.length;r++){var n=t[r];"."===n||""===n&&0!==r&&r!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},o.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&&i.isBuffer(e)?"nodebuffer":s.uint8array&&e instanceof Uint8Array?"uint8array":s.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(e){for(var t,i="",r=0;r<(e||"").length;r++)i+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return i},o.delay=function(e,t,i){f(function(){e.apply(i||null,t||[])})},o.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},o.extend=function(){for(var e,t={},i=0;i<arguments.length;i++)for(e in arguments[i])Object.prototype.hasOwnProperty.call(arguments[i],e)&&void 0===t[e]&&(t[e]=arguments[i][e]);return t},o.prepareContent=function(i,e,r,n,a){return c.Promise.resolve(e).then(function(r){return s.blob&&(r instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(r)))&&"undefined"!=typeof FileReader?new c.Promise(function(t,i){var e=new FileReader;e.onload=function(e){t(e.target.result)},e.onerror=function(e){i(e.target.error)},e.readAsArrayBuffer(r)}):r}).then(function(e){var t=o.getTypeOf(e);return t?("arraybuffer"===t?e=o.transformTo("uint8array",e):"string"===t&&(a?e=l.decode(e):r&&!0!==n&&(e=d(t=e,new(s.uint8array?Uint8Array:Array)(t.length)))),e):c.Promise.reject(new Error("Can't read the data of '"+i+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./signature"),o=e("./zipEntry"),s=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){var t;if(!this.reader.readAndCheckSignature(e))throw this.reader.index-=4,t=this.reader.readString(4),new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")},isSignature:function(e,t){var i=this.reader.index,e=(this.reader.setIndex(e),this.reader.readString(4)===t);return this.reader.setIndex(i),e},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=s.uint8array?"uint8array":"array",t=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(t)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){for(var e,t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}e=this.centralDirOffset+this.centralDirSize,e=t-(e=this.zip64?e+20+(12+this.zip64EndOfCentralSize):e);if(0<e)this.isSignature(t,a.CENTRAL_FILE_HEADER)||(this.reader.zero=e);else if(e<0)throw new Error("Corrupted zip: missing "+Math.abs(e)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),s=e("./utf8"),l=e("./compressions"),c=e("./support");function d(e,t){this.options=e,this.loadOptions=t}d.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t;if(e.skip(22),this.fileNameLength=e.readInt(2),t=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(t),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){var e;this.extraFields[1]&&(e=r(this.extraFields[1].value),this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS)&&(this.diskNumberStart=e.readInt(4))},readExtraFields:function(e){var t,i,r,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[t]={id:t,length:i,value:r};e.setIndex(n)},handleUTF8:function(){var e,t=c.uint8array?"uint8array":"array";this.useUTF8()?(this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment)):(null!==(e=this.findExtraFieldUnicodePath())?this.fileNameStr=e:(e=n.transformTo(t,this.fileName),this.fileNameStr=this.loadOptions.decodeFileName(e)),null!==(e=this.findExtraFieldUnicodeComment())?this.fileCommentStr=e:(e=n.transformTo(t,this.fileComment),this.fileCommentStr=this.loadOptions.decodeFileName(e)))},findExtraFieldUnicodePath:function(){var e,t=this.extraFields[28789];return!t||1!==(e=r(t.value)).readInt(1)||o(this.fileName)!==e.readInt(4)?null:s.utf8decode(e.readData(t.length-5))},findExtraFieldUnicodeComment:function(){var e,t=this.extraFields[25461];return!t||1!==(e=r(t.value)).readInt(1)||o(this.fileComment)!==e.readInt(4)?null:s.utf8decode(e.readData(t.length-5))}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var a=e("./stream/StreamHelper"),n=e("./stream/DataWorker"),o=e("./utf8"),s=e("./compressedObject"),l=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(i=e.toLowerCase())||"text"===i,n=("binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker(),!this._dataBinary);n&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!n&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new a(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){var i;return this._data instanceof s&&this._data.compression.magic===e.magic?this._data.getCompressedWorker():(i=this._decompressWorker(),this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),s.createWorkerFrom(i,e,t))},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof l?this._data:new n(this._data)}};for(var c=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<c.length;u++)r.prototype[c[u]]=d;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,c,t){!function(t){var r,e,i,n,a=t.MutationObserver||t.WebKitMutationObserver,o=a?(e=0,a=new a(l),i=t.document.createTextNode(""),a.observe(i,{characterData:!0}),function(){i.data=e=++e%2}):t.setImmediate||void 0===t.MessageChannel?"document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){l(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(l,0)}:((n=new t.MessageChannel).port1.onmessage=l,function(){n.port2.postMessage(0)}),s=[];function l(){var e,t;r=!0;for(var i=s.length;i;){for(t=s,s=[],e=-1;++e<i;)t[e]();i=s.length}r=!1}c.exports=function(e){1!==s.push(e)||r||o()}}.call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var n=e("immediate");function l(){}var c={},a=["REJECTED"],o=["FULFILLED"],r=["PENDING"];function s(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=r,this.queue=[],this.outcome=void 0,e!==l&&f(this,e)}function d(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(t,i,r){n(function(){var e;try{e=i(r)}catch(e){return c.reject(t,e)}e===t?c.reject(t,new TypeError("Cannot resolve promise with itself")):c.resolve(t,e)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(t,e){var i=!1;function r(e){i||(i=!0,c.reject(t,e))}function n(e){i||(i=!0,c.resolve(t,e))}var a=p(function(){e(n,r)});"error"===a.status&&r(a.value)}function p(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=s).prototype.finally=function(t){var i;return"function"!=typeof t?this:(i=this.constructor,this.then(function(e){return i.resolve(t()).then(function(){return e})},function(e){return i.resolve(t()).then(function(){throw e})}))},s.prototype.catch=function(e){return this.then(null,e)},s.prototype.then=function(e,t){var i;return"function"!=typeof e&&this.state===o||"function"!=typeof t&&this.state===a?this:(i=new this.constructor(l),this.state!==r?u(i,this.state===o?e:t,this.outcome):this.queue.push(new d(i,e,t)),i)},d.prototype.callFulfilled=function(e){c.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){c.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},c.resolve=function(e,t){var i=p(h,t);if("error"===i.status)return c.reject(e,i.value);i=i.value;if(i)f(e,i);else{e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callFulfilled(t)}return e},c.reject=function(e,t){e.state=a,e.outcome=t;for(var i=-1,r=e.queue.length;++i<r;)e.queue[i].callRejected(t);return e},s.resolve=function(e){return e instanceof this?e:c.resolve(new this(l),e)},s.reject=function(e){var t=new this(l);return c.reject(t,e)},s.all=function(e){var i=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),o=0,t=-1,s=new this(l);++t<r;)!function(e,t){i.resolve(e).then(function(e){a[t]=e,++o!==r||n||(n=!0,c.resolve(s,a))},function(e){n||(n=!0,c.reject(s,e))})}(e[t],t);return s},s.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,i=!1;if(!t)return this.resolve([]);for(var r,n=-1,a=new this(l);++n<t;)r=e[n],this.resolve(r).then(function(e){i||(i=!0,c.resolve(a,e))},function(e){i||(i=!0,c.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var o=e("./zlib/deflate"),s=e("./utils/common"),l=e("./utils/strings"),r=e("./zlib/messages"),n=e("./zlib/zstream"),c=Object.prototype.toString;function a(e){if(!(this instanceof a))return new a(e);this.options=s.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var e=this.options,t=(e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0,o.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy));if(0!==t)throw new Error(r[t]);if(e.header&&o.deflateSetHeader(this.strm,e.header),e.dictionary){e="string"==typeof e.dictionary?l.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary;if(0!==(t=o.deflateSetDictionary(this.strm,e)))throw new Error(r[t]);this._dict_set=!0}}function d(e,t){t=new a(t);if(t.push(e,!0),t.err)throw t.msg||r[t.err];return t.result}a.prototype.push=function(e,t){var i,r,n=this.strm,a=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=l.string2buf(e):"[object ArrayBuffer]"===c.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new s.Buf8(a),n.next_out=0,n.avail_out=a),1!==(i=o.deflate(n,r))&&0!==i)return this.onEnd(i),!(this.ended=!0)}while(0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(l.buf2binstring(s.shrinkBuf(n.output,n.next_out))):this.onData(s.shrinkBuf(n.output,n.next_out))),(0<n.avail_in||0===n.avail_out)&&1!==i);return 4===r?(i=o.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),!(n.avail_out=0))},a.prototype.onData=function(e){this.chunks.push(e)},a.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=a,i.deflate=d,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,d(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var u=e("./zlib/inflate"),h=e("./utils/common"),f=e("./utils/strings"),p=e("./zlib/constants"),r=e("./zlib/messages"),n=e("./zlib/zstream"),a=e("./zlib/gzheader"),m=Object.prototype.toString;function o(e){if(!(this instanceof o))return new o(e);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options,e=(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits)&&(t.windowBits=-15),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0,u.inflateInit2(this.strm,t.windowBits));if(e!==p.Z_OK)throw new Error(r[e]);this.header=new a,u.inflateGetHeader(this.strm,this.header)}function s(e,t){t=new o(t);if(t.push(e,!0),t.err)throw t.msg||r[t.err];return t.result}o.prototype.push=function(e,t){var i,r,n,a,o,s=this.strm,l=this.options.chunkSize,c=this.options.dictionary,d=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?p.Z_FINISH:p.Z_NO_FLUSH,"string"==typeof e?s.input=f.binstring2buf(e):"[object ArrayBuffer]"===m.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new h.Buf8(l),s.next_out=0,s.avail_out=l),(i=u.inflate(s,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&c&&(o="string"==typeof c?f.string2buf(c):"[object ArrayBuffer]"===m.call(c)?new Uint8Array(c):c,i=u.inflateSetDictionary(this.strm,o)),i===p.Z_BUF_ERROR&&!0===d&&(i=p.Z_OK,d=!1),i!==p.Z_STREAM_END&&i!==p.Z_OK)return this.onEnd(i),!(this.ended=!0)}while(!s.next_out||0!==s.avail_out&&i!==p.Z_STREAM_END&&(0!==s.avail_in||r!==p.Z_FINISH&&r!==p.Z_SYNC_FLUSH)||("string"===this.options.to?(o=f.utf8border(s.output,s.next_out),n=s.next_out-o,a=f.buf2string(s.output,o),s.next_out=n,s.avail_out=l-n,n&&h.arraySet(s.output,s.output,o,n,0),this.onData(a)):this.onData(h.shrinkBuf(s.output,s.next_out))),0===s.avail_in&&0===s.avail_out&&(d=!0),(0<s.avail_in||0===s.avail_out)&&i!==p.Z_STREAM_END);return(r=i===p.Z_STREAM_END?p.Z_FINISH:r)===p.Z_FINISH?(i=u.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===p.Z_OK):r!==p.Z_SYNC_FLUSH||(this.onEnd(p.Z_OK),!(s.avail_out=0))},o.prototype.onData=function(e){this.chunks.push(e)},o.prototype.onEnd=function(e){e===p.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=o,i.inflate=s,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,s(e,t)},i.ungzip=s},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array,n=(i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)},{arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){for(var t,i,r,n,a=t=0,o=e.length;a<o;a++)t+=e[a].length;for(n=new Uint8Array(t),a=i=0,o=e.length;a<o;a++)r=e[a],n.set(r,i),i+=r.length;return n}}),a={arraySet:function(e,t,i,r,n){for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(r)},{}],42:[function(e,t,i){var l=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var c=new l.Buf8(256),r=0;r<256;r++)c[r]=252<=r?6:248<=r?5:240<=r?4:224<=r?3:192<=r?2:1;function d(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,l.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}c[254]=c[254]=1,i.string2buf=function(e){for(var t,i,r,n,a=e.length,o=0,s=0;s<a;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new l.Buf8(o),s=n=0;n<o;s++)55296==(64512&(i=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(i=65536+(i-55296<<10)+(r-56320),s++),i<128?t[n++]=i:(i<2048?t[n++]=192|i>>>6:(i<65536?t[n++]=224|i>>>12:(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63),t[n++]=128|i>>>6&63),t[n++]=128|63&i);return t},i.buf2binstring=function(e){return d(e,e.length)},i.binstring2buf=function(e){for(var t=new l.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){for(var i,r,n,a=t||e.length,o=new Array(2*a),s=i=0;s<a;)if((r=e[s++])<128)o[i++]=r;else if(4<(n=c[r]))o[i++]=65533,s+=n-1;else{for(r&=2===n?31:3===n?15:7;1<n&&s<a;)r=r<<6|63&e[s++],n--;1<n?o[i++]=65533:r<65536?o[i++]=r:(r-=65536,o[i++]=55296|r>>10&1023,o[i++]=56320|1023&r)}return d(o,i)},i.utf8border=function(e,t){for(var i=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=i&&128==(192&e[i]);)i--;return!(i<0)&&0!==i&&i+c[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,r){for(var n=65535&e|0,a=e>>>16&65535|0,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;a=a+(n=n+t[r++]|0)|0,--o;);n%=65521,a%=65521}return n|a<<16|0}},{}],44:[function(e,t,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,i){var s=function(){for(var e=[],t=0;t<256;t++){for(var i=t,r=0;r<8;r++)i=1&i?3988292384^i>>>1:i>>>1;e[t]=i}return e}();t.exports=function(e,t,i,r){var n=s,a=r+i;e^=-1;for(var o=r;o<a;o++)e=e>>>8^n[255&(e^t[o])];return-1^e}},{}],46:[function(e,R,t){var s,u=e("../utils/common"),l=e("./trees"),h=e("./adler32"),f=e("./crc32"),i=e("./messages"),c=0,d=0,p=-2,r=2,m=8,n=286,a=30,o=19,U=2*n+1,F=15,y=3,v=258,g=v+y+1,_=42,w=113;function x(e,t){return e.msg=i[t],t}function I(e){return(e<<1)-(4<e?9:0)}function b(e){for(var t=e.length;0<=--t;)e[t]=0}function M(e){var t=e.state,i=t.pending;0!==(i=i>e.avail_out?e.avail_out:i)&&(u.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending)&&(t.pending_out=0)}function A(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,M(e.strm)}function k(e,t){e.pending_buf[e.pending++]=t}function T(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function D(e,t){var i,r,n=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-g?e.strstart-(e.w_size-g):0,c=e.window,d=e.w_mask,u=e.prev,h=e.strstart+v,f=c[a+o-1],p=c[a+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(i=t)+o]===p&&c[i+o-1]===f&&c[i]===c[a]&&c[++i]===c[a+1]){for(a+=2,i++;c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&c[++a]===c[++i]&&a<h;);if(r=v-(h-a),a=h-v,o<r){if(e.match_start=t,s<=(o=r))break;f=c[a+o-1],p=c[a+o]}}}while((t=u[t&d])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function E(e){var t,i,r,n,a,o,s,l,c,d=e.w_size;do{if(l=e.window_size-e.lookahead-e.strstart,e.strstart>=d+(d-g)){for(u.arraySet(e.window,e.window,d,d,0),e.match_start-=d,e.strstart-=d,e.block_start-=d,t=i=e.hash_size;r=e.head[--t],e.head[t]=d<=r?r-d:0,--i;);for(t=i=d;r=e.prev[--t],e.prev[t]=d<=r?r-d:0,--i;);l+=d}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,s=e.strstart+e.lookahead,c=void 0,i=0===(c=(l=l)<(c=a.avail_in)?l:c)?0:(a.avail_in-=c,u.arraySet(o,a.input,a.next_in,c,s),1===a.state.wrap?a.adler=h(a.adler,o,c,s):2===a.state.wrap&&(a.adler=f(a.adler,o,c,s)),a.next_in+=c,a.total_in+=c,c),e.lookahead+=i,e.lookahead+e.insert>=y)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=(e.ins_h<<e.hash_shift^e.window[n+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[n+y-1])&e.hash_mask,e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<y)););}while(e.lookahead<g&&0!==e.strm.avail_in)}function S(e,t){for(var i,r;;){if(e.lookahead<g){if(E(e),e.lookahead<g&&t===c)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=y&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+y-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-g&&(e.match_length=D(e,i)),e.match_length>=y)if(r=l._tr_tally(e,e.strstart-e.match_start,e.match_length-y),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=y){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+y-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(A(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<y-1?e.strstart:y-1,4===t?(A(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?1:2}function O(e,t){for(var i,r,n;;){if(e.lookahead<g){if(E(e),e.lookahead<g&&t===c)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=y&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+y-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=y-1,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-g&&(e.match_length=D(e,i),e.match_length<=5)&&(1===e.strategy||e.match_length===y&&4096<e.strstart-e.match_start)&&(e.match_length=y-1),e.prev_length>=y&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-y,r=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-y),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+y-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=y-1,e.strstart++,r&&(A(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=l._tr_tally(e,0,e.window[e.strstart-1]))&&A(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=l._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<y-1?e.strstart:y-1,4===t?(A(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?1:2}function B(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function N(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=m,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new u.Buf16(2*U),this.dyn_dtree=new u.Buf16(2*(2*a+1)),this.bl_tree=new u.Buf16(2*(2*o+1)),b(this.dyn_ltree),b(this.dyn_dtree),b(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new u.Buf16(F+1),this.heap=new u.Buf16(2*n+1),b(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new u.Buf16(2*n+1),b(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function C(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=r,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?_:w,e.adler=2===t.wrap?0:1,t.last_flush=c,l._tr_init(t),d):x(e,p)}function P(e){var t=C(e);return t===d&&((e=e.state).window_size=2*e.w_size,b(e.head),e.max_lazy_match=s[e.level].max_lazy,e.good_match=s[e.level].good_length,e.nice_match=s[e.level].nice_length,e.max_chain_length=s[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=y-1,e.match_available=0,e.ins_h=0),t}function L(e,t,i,r,n,a){if(!e)return p;var o=1;if(-1===t&&(t=6),r<0?(o=0,r=-r):15<r&&(o=2,r-=16),n<1||9<n||i!==m||r<8||15<r||t<0||9<t||a<0||4<a)return x(e,p);8===r&&(r=9);var s=new N;return(e.state=s).strm=e,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+y-1)/y),s.window=new u.Buf8(2*s.w_size),s.head=new u.Buf16(s.hash_size),s.prev=new u.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new u.Buf8(s.pending_buf_size),s.d_buf=+s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=i,P(e)}s=[new B(0,0,0,0,function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(E(e),0===e.lookahead&&t===c)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,A(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-g&&(A(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(A(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(A(e,!1),e.strm.avail_out),1)}),new B(4,4,8,4,S),new B(4,5,16,8,S),new B(4,6,32,32,S),new B(4,4,16,16,O),new B(8,16,32,32,O),new B(8,16,128,128,O),new B(8,32,128,256,O),new B(32,128,258,1024,O),new B(32,258,258,4096,O)],t.deflateInit=function(e,t){return L(e,t,m,15,8,0)},t.deflateInit2=L,t.deflateReset=P,t.deflateResetKeep=C,t.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?p:(e.state.gzhead=t,d)},t.deflate=function(e,t){var i,r,n,a;if(!e||!e.state||5<t||t<0)return e?x(e,p):p;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&4!==t)return x(e,0===e.avail_out?-5:p);if(r.strm=e,i=r.last_flush,r.last_flush=t,r.status===_&&(2===r.wrap?(e.adler=0,k(r,31),k(r,139),k(r,8),r.gzhead?(k(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),k(r,255&r.gzhead.time),k(r,r.gzhead.time>>8&255),k(r,r.gzhead.time>>16&255),k(r,r.gzhead.time>>24&255),k(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),k(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(k(r,255&r.gzhead.extra.length),k(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=f(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(k(r,0),k(r,0),k(r,0),k(r,0),k(r,0),k(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),k(r,3),r.status=w)):(o=m+(r.w_bits-8<<4)<<8,o|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(o|=32),o+=31-o%31,r.status=w,T(r,o),0!==r.strstart&&(T(r,e.adler>>>16),T(r,65535&e.adler)),e.adler=1)),69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=f(e.adler,r.pending_buf,r.pending-n,n)),M(e),n=r.pending,r.pending!==r.pending_buf_size));)k(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=f(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=f(e.adler,r.pending_buf,r.pending-n,n)),M(e),n=r.pending,r.pending===r.pending_buf_size)){a=1;break}}while(a=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,k(r,a),0!==a);r.gzhead.hcrc&&r.pending>n&&(e.adler=f(e.adler,r.pending_buf,r.pending-n,n)),0===a&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=f(e.adler,r.pending_buf,r.pending-n,n)),M(e),n=r.pending,r.pending===r.pending_buf_size)){a=1;break}}while(a=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,k(r,a),0!==a);r.gzhead.hcrc&&r.pending>n&&(e.adler=f(e.adler,r.pending_buf,r.pending-n,n)),0===a&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&M(e),r.pending+2<=r.pending_buf_size&&(k(r,255&e.adler),k(r,e.adler>>8&255),e.adler=0,r.status=w)):r.status=w),0!==r.pending){if(M(e),0===e.avail_out)return r.last_flush=-1,d}else if(0===e.avail_in&&I(t)<=I(i)&&4!==t)return x(e,-5);if(666===r.status&&0!==e.avail_in)return x(e,-5);if(0!==e.avail_in||0!==r.lookahead||t!==c&&666!==r.status){var o=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(E(e),0===e.lookahead)){if(t===c)return 1;break}if(e.match_length=0,i=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(A(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(A(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,a,o=e.window;;){if(e.lookahead<=v){if(E(e),e.lookahead<=v&&t===c)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=y&&0<e.strstart&&(r=o[n=e.strstart-1])===o[++n]&&r===o[++n]&&r===o[++n]){for(a=e.strstart+v;r===o[++n]&&r===o[++n]&&r===o[++n]&&r===o[++n]&&r===o[++n]&&r===o[++n]&&r===o[++n]&&r===o[++n]&&n<a;);e.match_length=v-(a-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=y?(i=l._tr_tally(e,1,e.match_length-y),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(A(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(A(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?1:2}(r,t):s[r.level].func(r,t);if(3!==o&&4!==o||(r.status=666),1===o||3===o)return 0===e.avail_out&&(r.last_flush=-1),d;if(2===o&&(1===t?l._tr_align(r):5!==t&&(l._tr_stored_block(r,0,0,!1),3===t)&&(b(r.head),0===r.lookahead)&&(r.strstart=0,r.block_start=0,r.insert=0),M(e),0===e.avail_out))return r.last_flush=-1,d}return 4!==t||!(r.wrap<=0)&&(2===r.wrap?(k(r,255&e.adler),k(r,e.adler>>8&255),k(r,e.adler>>16&255),k(r,e.adler>>24&255),k(r,255&e.total_in),k(r,e.total_in>>8&255),k(r,e.total_in>>16&255),k(r,e.total_in>>24&255)):(T(r,e.adler>>>16),T(r,65535&e.adler)),M(e),0<r.wrap&&(r.wrap=-r.wrap),0!==r.pending)?d:1},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==_&&69!==t&&73!==t&&91!==t&&103!==t&&t!==w&&666!==t?x(e,p):(e.state=null,t===w?x(e,-3):d):p},t.deflateSetDictionary=function(e,t){var i,r,n,a,o,s,l,c=t.length;if(!e||!e.state)return p;if(2===(a=(i=e.state).wrap)||1===a&&i.status!==_||i.lookahead)return p;for(1===a&&(e.adler=h(e.adler,t,c,0)),i.wrap=0,c>=i.w_size&&(0===a&&(b(i.head),i.strstart=0,i.block_start=0,i.insert=0),l=new u.Buf8(i.w_size),u.arraySet(l,t,c-i.w_size,i.w_size,0),t=l,c=i.w_size),l=e.avail_in,o=e.next_in,s=e.input,e.avail_in=c,e.next_in=0,e.input=t,E(i);i.lookahead>=y;){for(r=i.strstart,n=i.lookahead-(y-1);i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+y-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,--n;);i.strstart=r,i.lookahead=y-1,E(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=y-1,i.match_available=0,e.next_in=o,e.input=s,e.avail_in=l,i.wrap=a,d},t.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,i){t.exports=function(e,t){var i,r,n,a,o,s,l=e.state,c=e.next_in,d=e.input,u=c+(e.avail_in-5),h=e.next_out,f=e.output,p=h-(t-e.avail_out),m=h+(e.avail_out-257),y=l.dmax,v=l.wsize,g=l.whave,_=l.wnext,w=l.window,x=l.hold,I=l.bits,b=l.lencode,M=l.distcode,A=(1<<l.lenbits)-1,k=(1<<l.distbits)-1;e:do{for(I<15&&(x+=d[c++]<<I,I+=8,x+=d[c++]<<I,I+=8),i=b[x&A];;){if(x>>>=r=i>>>24,I-=r,0==(r=i>>>16&255))f[h++]=65535&i;else{if(!(16&r)){if(0==(64&r)){i=b[(65535&i)+(x&(1<<r)-1)];continue}if(32&r){l.mode=12;break e}e.msg="invalid literal/length code",l.mode=30;break e}for(n=65535&i,(r&=15)&&(I<r&&(x+=d[c++]<<I,I+=8),n+=x&(1<<r)-1,x>>>=r,I-=r),I<15&&(x+=d[c++]<<I,I+=8,x+=d[c++]<<I,I+=8),i=M[x&k];;){if(x>>>=r=i>>>24,I-=r,!(16&(r=i>>>16&255))){if(0==(64&r)){i=M[(65535&i)+(x&(1<<r)-1)];continue}e.msg="invalid distance code",l.mode=30;break e}if(a=65535&i,I<(r&=15)&&(x+=d[c++]<<I,(I+=8)<r)&&(x+=d[c++]<<I,I+=8),y<(a+=x&(1<<r)-1)){e.msg="invalid distance too far back",l.mode=30;break e}if(x>>>=r,I-=r,(r=h-p)<a){if(g<(r=a-r)&&l.sane){e.msg="invalid distance too far back",l.mode=30;break e}if(s=w,(o=0)===_){if(o+=v-r,r<n){for(n-=r;f[h++]=w[o++],--r;);o=h-a,s=f}}else if(_<r){if(o+=v+_-r,(r-=_)<n){for(n-=r;f[h++]=w[o++],--r;);if(o=0,_<n){for(n-=r=_;f[h++]=w[o++],--r;);o=h-a,s=f}}}else if(o+=_-r,r<n){for(n-=r;f[h++]=w[o++],--r;);o=h-a,s=f}for(;2<n;)f[h++]=s[o++],f[h++]=s[o++],f[h++]=s[o++],n-=3;n&&(f[h++]=s[o++],1<n)&&(f[h++]=s[o++])}else{for(o=h-a;f[h++]=f[o++],f[h++]=f[o++],f[h++]=f[o++],2<(n-=3););n&&(f[h++]=f[o++],1<n)&&(f[h++]=f[o++])}break}}break}}while(c<u&&h<m);c-=n=I>>3,x&=(1<<(I-=n<<3))-1,e.next_in=c,e.next_out=h,e.avail_in=c<u?u-c+5:5-(c-u),e.avail_out=h<m?m-h+257:257-(h-m),l.hold=x,l.bits=I}},{}],49:[function(e,t,i){var O=e("../utils/common"),B=e("./adler32"),C=e("./crc32"),P=e("./inffast"),L=e("./inftrees"),R=0,U=-2,F=1,r=852,n=592;function N(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function a(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new O.Buf16(320),this.work=new O.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=F,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new O.Buf32(r),t.distcode=t.distdyn=new O.Buf32(n),t.sane=1,t.back=-1,R):U}function s(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,o(e)):U}function l(e,t){var i,r;return!e||!e.state||(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t))?U:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,s(e))}function c(e,t){var i;return e?(i=new a,(e.state=i).window=null,(i=l(e,t))!==R&&(e.state=null),i):U}var z,H,j=!0;function K(e,t,i,r){var n,e=e.state;return null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new O.Buf8(e.wsize)),r>=e.wsize?(O.arraySet(e.window,t,i-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(r<(n=e.wsize-e.wnext)&&(n=r),O.arraySet(e.window,t,i-r,n,e.wnext),(r-=n)?(O.arraySet(e.window,t,i-r,r,0),e.wnext=r,e.whave=e.wsize):(e.wnext+=n,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=n))),0}i.inflateReset=s,i.inflateReset2=l,i.inflateResetKeep=o,i.inflateInit=function(e){return c(e,15)},i.inflateInit2=c,i.inflate=function(e,t){var i,r,n,a,o,s,l,c,d,u,h,f,p,m,y,v,g,_,w,x,I,b,M,A,k=0,T=new O.Buf8(4),D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return U;12===(i=e.state).mode&&(i.mode=13),o=e.next_out,n=e.output,l=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=i.hold,d=i.bits,u=s,h=l,b=R;e:for(;;)switch(i.mode){case F:if(0===i.wrap)i.mode=13;else{for(;d<16;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(2&i.wrap&&35615===c)T[i.check=0]=255&c,T[1]=c>>>8&255,i.check=C(i.check,T,2,0),d=c=0,i.mode=2;else if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",i.mode=30;else if(8!=(15&c))e.msg="unknown compression method",i.mode=30;else{if(d-=4,I=8+(15&(c>>>=4)),0===i.wbits)i.wbits=I;else if(I>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<I,e.adler=i.check=1,i.mode=512&c?10:12,d=c=0}}break;case 2:for(;d<16;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(i.flags=c,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=c>>8&1),512&i.flags&&(T[0]=255&c,T[1]=c>>>8&255,i.check=C(i.check,T,2,0)),d=c=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}i.head&&(i.head.time=c),512&i.flags&&(T[0]=255&c,T[1]=c>>>8&255,T[2]=c>>>16&255,T[3]=c>>>24&255,i.check=C(i.check,T,4,0)),d=c=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}i.head&&(i.head.xflags=255&c,i.head.os=c>>8),512&i.flags&&(T[0]=255&c,T[1]=c>>>8&255,i.check=C(i.check,T,2,0)),d=c=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}i.length=c,i.head&&(i.head.extra_len=c),512&i.flags&&(T[0]=255&c,T[1]=c>>>8&255,i.check=C(i.check,T,2,0)),d=c=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((f=s<(f=i.length)?s:f)&&(i.head&&(I=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),O.arraySet(i.head.extra,r,a,f,I)),512&i.flags&&(i.check=C(i.check,r,f,a)),s-=f,a+=f,i.length-=f),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;for(f=0;I=r[a+f++],i.head&&I&&i.length<65536&&(i.head.name+=String.fromCharCode(I)),I&&f<s;);if(512&i.flags&&(i.check=C(i.check,r,f,a)),s-=f,a+=f,I)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break e;for(f=0;I=r[a+f++],i.head&&I&&i.length<65536&&(i.head.comment+=String.fromCharCode(I)),I&&f<s;);if(512&i.flags&&(i.check=C(i.check,r,f,a)),s-=f,a+=f,I)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(c!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}d=c=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}e.adler=i.check=N(c),d=c=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,i.hold=c,i.bits=d,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last)c>>>=7&d,d-=7&d,i.mode=27;else{for(;d<3;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}switch(i.last=1&c,--d,3&(c>>>=1)){case 0:i.mode=14;break;case 1:E=S=void 0;var E,S=i;if(j){for(z=new O.Buf32(512),H=new O.Buf32(32),E=0;E<144;)S.lens[E++]=8;for(;E<256;)S.lens[E++]=9;for(;E<280;)S.lens[E++]=7;for(;E<288;)S.lens[E++]=8;for(L(1,S.lens,0,288,z,0,S.work,{bits:9}),E=0;E<32;)S.lens[E++]=5;L(2,S.lens,0,32,H,0,S.work,{bits:5}),j=!1}if(S.lencode=z,S.lenbits=9,S.distcode=H,S.distbits=5,i.mode=20,6!==t)break;c>>>=2,d-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}c>>>=2,d-=2}break;case 14:for(c>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&c,d=c=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(f=i.length){if(0===(f=l<(f=s<f?s:f)?l:f))break e;O.arraySet(n,r,a,f,o),s-=f,a+=f,l-=f,o+=f,i.length-=f}else i.mode=12;break;case 17:for(;d<14;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(i.nlen=257+(31&c),c>>>=5,d-=5,i.ndist=1+(31&c),c>>>=5,d-=5,i.ncode=4+(15&c),c>>>=4,d-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}i.lens[D[i.have++]]=7&c,c>>>=3,d-=3}for(;i.have<19;)i.lens[D[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,M={bits:i.lenbits},b=L(0,i.lens,0,19,i.lencode,0,i.work,M),i.lenbits=M.bits,b){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;v=(k=i.lencode[c&(1<<i.lenbits)-1])>>>16&255,g=65535&k,!((y=k>>>24)<=d);){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(g<16)c>>>=y,d-=y,i.lens[i.have++]=g;else{if(16===g){for(A=y+2;d<A;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(c>>>=y,d-=y,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}I=i.lens[i.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===g){for(A=y+3;d<A;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}I=0,f=3+(7&(c>>>=y)),c>>>=3,d=d-y-3}else{for(A=y+7;d<A;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}I=0,f=11+(127&(c>>>=y)),c>>>=7,d=d-y-7}if(i.have+f>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;f--;)i.lens[i.have++]=I}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,M={bits:i.lenbits},b=L(1,i.lens,0,i.nlen,i.lencode,0,i.work,M),i.lenbits=M.bits,b){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,M={bits:i.distbits},b=L(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,M),i.distbits=M.bits,b){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=s&&258<=l){e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,i.hold=c,i.bits=d,P(e,h),o=e.next_out,n=e.output,l=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=i.hold,d=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;v=(k=i.lencode[c&(1<<i.lenbits)-1])>>>16&255,g=65535&k,!((y=k>>>24)<=d);){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(v&&0==(240&v)){for(_=y,w=v,x=g;v=(k=i.lencode[x+((c&(1<<_+w)-1)>>_)])>>>16&255,g=65535&k,!(_+(y=k>>>24)<=d);){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}c>>>=_,d-=_,i.back+=_}if(c>>>=y,d-=y,i.back+=y,i.length=g,0===v){i.mode=26;break}if(32&v){i.back=-1,i.mode=12;break}if(64&v){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&v,i.mode=22;case 22:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}i.length+=c&(1<<i.extra)-1,c>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;v=(k=i.distcode[c&(1<<i.distbits)-1])>>>16&255,g=65535&k,!((y=k>>>24)<=d);){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(0==(240&v)){for(_=y,w=v,x=g;v=(k=i.distcode[x+((c&(1<<_+w)-1)>>_)])>>>16&255,g=65535&k,!(_+(y=k>>>24)<=d);){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}c>>>=_,d-=_,i.back+=_}if(c>>>=y,d-=y,i.back+=y,64&v){e.msg="invalid distance code",i.mode=30;break}i.offset=g,i.extra=15&v,i.mode=24;case 24:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}i.offset+=c&(1<<i.extra)-1,c>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===l)break e;if(i.offset>(f=h-l)){if((f=i.offset-f)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}p=f>i.wnext?(f-=i.wnext,i.wsize-f):i.wnext-f,f>i.length&&(f=i.length),m=i.window}else m=n,p=o-i.offset,f=i.length;for(l-=f=l<f?l:f,i.length-=f;n[o++]=m[p++],--f;);0===i.length&&(i.mode=21);break;case 26:if(0===l)break e;n[o++]=i.length,l--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===s)break e;s--,c|=r[a++]<<d,d+=8}if(h-=l,e.total_out+=h,i.total+=h,h&&(e.adler=i.check=(i.flags?C:B)(i.check,n,h,o-h)),h=l,(i.flags?c:N(c))!==i.check){e.msg="incorrect data check",i.mode=30;break}d=c=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===s)break e;s--,c+=r[a++]<<d,d+=8}if(c!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}d=c=0}i.mode=29;case 29:b=1;break e;case 30:b=-3;break e;case 31:return-4;default:return U}return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,i.hold=c,i.bits=d,(i.wsize||h!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&K(e,e.output,e.next_out,h-e.avail_out)?(i.mode=31,-4):(u-=e.avail_in,h-=e.avail_out,e.total_in+=u,e.total_out+=h,i.total+=h,i.wrap&&h&&(e.adler=i.check=(i.flags?C:B)(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),b=(0==u&&0===h||4===t)&&b===R?-5:b)},i.inflateEnd=function(e){var t;return e&&e.state?((t=e.state).window&&(t.window=null),e.state=null,R):U},i.inflateGetHeader=function(e,t){return!e||!e.state||0==(2&(e=e.state).wrap)?U:((e.head=t).done=!1,R)},i.inflateSetDictionary=function(e,t){var i,r=t.length;return!e||!e.state||0!==(i=e.state).wrap&&11!==i.mode?U:11===i.mode&&B(1,t,r,0)!==i.check?-3:K(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,R)},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var P=e("../utils/common"),L=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],R=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],U=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],F=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,i,r,n,a,o,s){for(var l,c,d,u,h,f,p,m,y,v=s.bits,g=0,_=0,w=0,x=0,I=0,b=0,M=0,A=0,k=0,T=0,D=null,E=0,S=new P.Buf16(16),O=new P.Buf16(16),B=null,C=0,g=0;g<=15;g++)S[g]=0;for(_=0;_<r;_++)S[t[i+_]]++;for(I=v,x=15;1<=x&&0===S[x];x--);if(x<I&&(I=x),0===x)n[a++]=20971520,n[a++]=20971520,s.bits=1;else{for(w=1;w<x&&0===S[w];w++);for(I<w&&(I=w),g=A=1;g<=15;g++)if((A=(A<<1)-S[g])<0)return-1;if(0<A&&(0===e||1!==x))return-1;for(O[1]=0,g=1;g<15;g++)O[g+1]=O[g]+S[g];for(_=0;_<r;_++)0!==t[i+_]&&(o[O[t[i+_]]++]=_);if(f=0===e?(D=B=o,19):1===e?(D=L,E-=257,B=R,C-=257,256):(D=U,B=F,-1),g=w,h=a,M=_=T=0,d=-1,u=(k=1<<(b=I))-1,1===e&&852<k||2===e&&592<k)return 1;for(;;){for(y=o[_]<f?(m=0,o[_]):o[_]>f?(m=B[C+o[_]],D[E+o[_]]):(m=96,0),l=1<<(p=g-M),w=c=1<<b;n[h+(T>>M)+(c-=l)]=p<<24|m<<16|y|0,0!==c;);for(l=1<<g-1;T&l;)l>>=1;if(0!==l?T=(T&l-1)+l:T=0,_++,0==--S[g]){if(g===x)break;g=t[i+o[_]]}if(I<g&&(T&u)!==d){for(h+=w,A=1<<(b=g-(M=0===M?I:M));b+M<x&&!((A-=S[b+M])<=0);)b++,A<<=1;if(k+=1<<b,1===e&&852<k||2===e&&592<k)return 1;n[d=T&u]=I<<24|b<<16|h-a|0}}0!==T&&(n[h+T]=g-M<<24|64<<16|0),s.bits=I}return 0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,R,t){var n=e("../utils/common");function i(e){for(var t=e.length;0<=--t;)e[t]=0}var r=16,l=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],u=new Array(576),h=(i(u),new Array(60)),f=(i(h),new Array(512)),p=(i(f),new Array(256)),m=(i(p),new Array(29));i(m);var y,v,g,_=new Array(30);function w(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function x(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function I(e){return e<256?f[e]:f[256+(e>>>7)]}function a(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function b(e,t,i){e.bi_valid>r-i?(e.bi_buf|=t<<e.bi_valid&65535,a(e,e.bi_buf),e.bi_buf=t>>r-e.bi_valid,e.bi_valid+=i-r):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function M(e,t,i){b(e,i[2*t],i[2*t+1])}function A(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function k(e,t,i){for(var r,n=new Array(16),a=0,o=1;o<=15;o++)n[o]=a=a+i[o-1]<<1;for(r=0;r<=t;r++){var s=e[2*r+1];0!==s&&(e[2*r]=A(n[s]++,s))}}function T(e){for(var t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function D(e){8<e.bi_valid?a(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function o(e,t,i,r){var n=2*t,a=2*i;return e[n]<e[a]||e[n]===e[a]&&r[t]<=r[i]}function E(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&o(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!o(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function S(e,t,i){var r,n,a,o,s=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0==r?M(e,n,t):(M(e,(a=p[n])+256+1,t),0!==(o=l[a])&&b(e,n-=m[a],o),M(e,a=I(--r),i),0!==(o=c[a])&&b(e,r-=_[a],o)),s<e.last_lit;);M(e,256,t)}function O(e,t){var i,r,n,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,l=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<l;i++)0!==a[2*i]?(e.heap[++e.heap_len]=c=i,e.depth[i]=0):a[2*i+1]=0;for(;e.heap_len<2;)a[2*(n=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=o[2*n+1]);for(t.max_code=c,i=e.heap_len>>1;1<=i;i--)E(e,a,i);for(n=l;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],E(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,a[2*n]=a[2*i]+a[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,a[2*i+1]=a[2*r+1]=n,e.heap[1]=n++,E(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var d,u,h,f,p,m=e,y=t.dyn_tree,v=t.max_code,g=t.stat_desc.static_tree,_=t.stat_desc.has_stree,w=t.stat_desc.extra_bits,x=t.stat_desc.extra_base,I=t.stat_desc.max_length,b=0,M=0;M<=15;M++)m.bl_count[M]=0;for(y[2*m.heap[m.heap_max]+1]=0,d=m.heap_max+1;d<573;d++)I<(M=y[2*y[2*(u=m.heap[d])+1]+1]+1)&&(M=I,b++),y[2*u+1]=M,v<u||(m.bl_count[M]++,f=0,x<=u&&(f=w[u-x]),p=y[2*u],m.opt_len+=p*(M+f),_&&(m.static_len+=p*(g[2*u+1]+f)));if(0!==b){do{for(M=I-1;0===m.bl_count[M];)M--}while(m.bl_count[M]--,m.bl_count[M+1]+=2,m.bl_count[I]--,0<(b-=2));for(M=I;0!==M;M--)for(u=m.bl_count[M];0!==u;)v<(h=m.heap[--d])||(y[2*h+1]!==M&&(m.opt_len+=(M-y[2*h+1])*y[2*h],y[2*h+1]=M),u--)}k(a,c,e.bl_count)}function B(e,t,i){var r,n,a=-1,o=t[1],s=0,l=7,c=4;for(0===o&&(l=138,c=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++s<l&&n===o||(s<c?e.bl_tree[2*n]+=s:0!==n?(n!==a&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=n,c=(s=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4))}function C(e,t,i){var r,n,a=-1,o=t[1],s=0,l=7,c=4;for(0===o&&(l=138,c=3),r=0;r<=i;r++)if(n=o,o=t[2*(r+1)+1],!(++s<l&&n===o)){if(s<c)for(;M(e,n,e.bl_tree),0!=--s;);else 0!==n?(n!==a&&(M(e,n,e.bl_tree),s--),M(e,16,e.bl_tree),b(e,s-3,2)):s<=10?(M(e,17,e.bl_tree),b(e,s-3,3)):(M(e,18,e.bl_tree),b(e,s-11,7));a=n,c=(s=0)===o?(l=138,3):n===o?(l=6,3):(l=7,4)}}i(_);var P=!1;function L(e,t,i,r){b(e,0+(r?1:0),3),r=t,t=i,D(i=e),a(i,t),a(i,~t),n.arraySet(i.pending_buf,i.window,r,t,i.pending),i.pending+=t}t._tr_init=function(e){if(!P){for(var t,i,r,n,a=new Array(16),o=r=0;o<28;o++)for(m[o]=r,t=0;t<1<<l[o];t++)p[r++]=o;for(p[r-1]=o,o=n=0;o<16;o++)for(_[o]=n,t=0;t<1<<c[o];t++)f[n++]=o;for(n>>=7;o<30;o++)for(_[o]=n<<7,t=0;t<1<<c[o]-7;t++)f[256+n++]=o;for(i=0;i<=15;i++)a[i]=0;for(t=0;t<=143;)u[2*t+1]=8,t++,a[8]++;for(;t<=255;)u[2*t+1]=9,t++,a[9]++;for(;t<=279;)u[2*t+1]=7,t++,a[7]++;for(;t<=287;)u[2*t+1]=8,t++,a[8]++;for(k(u,287,a),t=0;t<30;t++)h[2*t+1]=5,h[2*t]=A(t,5);y=new w(u,l,257,286,15),v=new w(h,c,0,30,15),g=new w(new Array(0),s,0,19,7),P=!0}e.l_desc=new x(e.dyn_ltree,y),e.d_desc=new x(e.dyn_dtree,v),e.bl_desc=new x(e.bl_tree,g),e.bi_buf=0,e.bi_valid=0,T(e)},t._tr_stored_block=L,t._tr_flush_block=function(e,t,i,r){var n,a,o,s=0;if(0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){for(var t=4093624447,i=0;i<=31;i++,t>>>=1)if(1&t&&0!==e.dyn_ltree[2*i])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(i=32;i<256;i++)if(0!==e.dyn_ltree[2*i])return 1;return 0}(e)),O(e,e.l_desc),O(e,e.d_desc),s=function(e){var t;for(B(e,e.dyn_ltree,e.l_desc.max_code),B(e,e.dyn_dtree,e.d_desc.max_code),O(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=n&&(n=a)):n=a=i+5,i+4<=n&&-1!==t)L(e,t,i,r);else if(4===e.strategy||a===n)b(e,2+(r?1:0),3),S(e,u,h);else{b(e,4+(r?1:0),3);var l=e,c=(t=e.l_desc.max_code+1,i=e.d_desc.max_code+1,s+1);for(b(l,t-257,5),b(l,i-1,5),b(l,c-4,4),o=0;o<c;o++)b(l,l.bl_tree[2*d[o]+1],3);C(l,l.dyn_ltree,t-1),C(l,l.dyn_dtree,i-1),S(e,e.dyn_ltree,e.dyn_dtree)}T(e),r&&D(e)},t._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(p[i]+256+1)]++,e.dyn_dtree[2*I(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){b(e,2,3),M(e,256,u),16===(e=e).bi_valid?(a(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){!function(e){function n(e){delete d[e]}function a(e){if(u)setTimeout(a,0,e);else{var t=d[e];if(t){u=!0;try{var i=t.callback,r=t.args;switch(r.length){case 0:i();break;case 1:i(r[0]);break;case 2:i(r[0],r[1]);break;case 3:i(r[0],r[1],r[2]);break;default:i.apply(o,r)}}finally{n(e),u=!1}}}}function t(e){e.source===i&&"string"==typeof e.data&&0===e.data.indexOf(l)&&a(+e.data.slice(l.length))}var i,o,r,s,l,c,d,u,h,f;(i="undefined"==typeof self?void 0===e?this:e:self).setImmediate||(c=1,u=!(d={}),h=i.document,e=(e=Object.getPrototypeOf&&Object.getPrototypeOf(i))&&e.setTimeout?e:i,f="[object process]"==={}.toString.call(i.process)?function(e){p.nextTick(function(){a(e)})}:function(){var e,t;if(i.postMessage&&!i.importScripts)return e=!0,t=i.onmessage,i.onmessage=function(){e=!1},i.postMessage("","*"),i.onmessage=t,e}()?(l="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",t,!1):i.attachEvent("onmessage",t),function(e){i.postMessage(l+e,"*")}):i.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){a(e.data)},function(e){s.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(r=h.documentElement,function(e){var t=h.createElement("script");t.onreadystatechange=function(){a(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(a,0,e)},e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return d[c]={callback:e,args:t},f(c),c++},e.clearImmediate=n)}.call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)}.call(this,i(4).Buffer,i(8).setImmediate,i(0),i(2))},function(e,B,C){!function(e){var M=C(5),a=C(6),s=C(7);function i(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function l(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(e=null===e?new u(t):e).length=t,e}function u(e,t,i){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,i);if("number"!=typeof e)return r(this,e,t,i);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return o(this,e)}function r(e,t,i,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var n=e,a=t,o=i;if(a.byteLength,o<0||a.byteLength<o)throw new RangeError("'offset' is out of bounds");if(a.byteLength<o+(r||0))throw new RangeError("'length' is out of bounds");return a=void 0===o&&void 0===r?new Uint8Array(a):void 0===r?new Uint8Array(a,o):new Uint8Array(a,o,r),u.TYPED_ARRAY_SUPPORT?(n=a).__proto__=u.prototype:n=c(n,a),n}if("string"!=typeof t){o=e,r=t;if(u.isBuffer(r))return a=0|d(r.length),0!==(o=l(o,a)).length&&r.copy(o,0,0,a),o;if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||function(e){return e!=e}(r.length)?l(o,0):c(o,r);if("Buffer"===r.type&&s(r.data))return c(o,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}n=e,r=t,e=i;if(u.isEncoding(e="string"==typeof e&&""!==e?e:"utf8"))return t=0|h(r,e),n=(r=(n=l(n,t)).write(r,e))!==t?n.slice(0,r):n;throw new TypeError('"encoding" must be a valid string encoding')}function n(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function o(e,t){if(n(t),e=l(e,t<0?0:0|d(t)),!u.TYPED_ARRAY_SUPPORT)for(var i=0;i<t;++i)e[i]=0;return e}function c(e,t){var i=t.length<0?0:0|d(t.length);e=l(e,i);for(var r=0;r<i;r+=1)e[r]=255&t[r];return e}function d(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function h(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var i=(e="string"!=typeof e?""+e:e).length;if(0===i)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return S(e).length;default:if(r)return E(e).length;t=(""+t).toLowerCase(),r=!0}}function t(e,t,i){var r,n=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((i=void 0===i||i>this.length?this.length:i)<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var a=this,o=t,s=i,l=a.length;(!s||s<0||l<s)&&(s=l);for(var c="",d=o=!o||o<0?0:o;d<s;++d)c+=function(e){return e<16?"0"+e.toString(16):e.toString(16)}(a[d]);return c;case"utf8":case"utf-8":return A(this,t,i);case"ascii":var u=this,l=t,h=i,f="";h=Math.min(u.length,h);for(var p=l;p<h;++p)f+=String.fromCharCode(127&u[p]);return f;case"latin1":case"binary":var m=this,o=t,y=i,v="";y=Math.min(m.length,y);for(var g=o;g<y;++g)v+=String.fromCharCode(m[g]);return v;case"base64":return _=this,r=i,0===(w=t)&&r===_.length?M.fromByteArray(_):M.fromByteArray(_.slice(w,r));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(var _=t,w=i,x=this.slice(_,w),I="",b=0;b<x.length;b+=2)I+=String.fromCharCode(x[b]+256*x[b+1]);return I;default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function f(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function p(e,t,i,r,n){if(0===e.length)return-1;if("string"==typeof i?(r=i,i=0):2147483647<i?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,(i=(i=isNaN(i)?n?0:e.length-1:i)<0?e.length+i:i)>=e.length){if(n)return-1;i=e.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,i,r,n);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(n?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,i):m(e,[t],i,r,n);throw new TypeError("val must be string, number or Buffer")}function m(e,t,i,r,n){var a=1,o=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o/=a=2,s/=2,i/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n)for(var c=-1,d=i;d<o;d++)if(l(e,d)===l(t,-1===c?0:d-c)){if(d-(c=-1===c?d:c)+1===s)return c*a}else-1!==c&&(d-=d-c),c=-1;else for(d=i=o<i+s?o-s:i;0<=d;d--){for(var u=!0,h=0;h<s;h++)if(l(e,d+h)!==l(t,h)){u=!1;break}if(u)return d}return-1}function y(e,t,i,r){return O(function(e){for(var t=[],i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,r)}function v(e,t,i,r){return O(function(e,t){for(var i,r,n=[],a=0;a<e.length&&!((t-=2)<0);++a)i=e.charCodeAt(a),r=i>>8,n.push(i%256),n.push(r);return n}(t,e.length-i),e,i,r)}function A(e,t,i){i=Math.min(e.length,i);for(var r=[],n=t;n<i;){var a,o,s,l,c=e[n],d=null,u=239<c?4:223<c?3:191<c?2:1;if(n+u<=i)switch(u){case 1:c<128&&(d=c);break;case 2:128==(192&(a=e[n+1]))&&127<(l=(31&c)<<6|63&a)&&(d=l);break;case 3:a=e[n+1],o=e[n+2],128==(192&a)&&128==(192&o)&&2047<(l=(15&c)<<12|(63&a)<<6|63&o)&&(l<55296||57343<l)&&(d=l);break;case 4:a=e[n+1],o=e[n+2],s=e[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&65535<(l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)&&l<1114112&&(d=l)}null===d?(d=65533,u=1):65535<d&&(r.push((d-=65536)>>>10&1023|55296),d=56320|1023&d),r.push(d),n+=u}var h=r,f=h.length;if(f<=g)return String.fromCharCode.apply(String,h);for(var p="",m=0;m<f;)p+=String.fromCharCode.apply(String,h.slice(m,m+=g));return p}B.Buffer=u,B.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},B.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),B.kMaxLength=i(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,i){return r(null,e,t,i)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol)&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0}),u.alloc=function(e,t,i){return r=null,t=t,i=i,n(e=e),!(e<=0)&&void 0!==t?"string"==typeof i?l(r,e).fill(t,i):l(r,e).fill(t):l(r,e);var r},u.allocUnsafe=function(e){return o(null,e)},u.allocUnsafeSlow=function(e){return o(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,r=t.length,n=0,a=Math.min(i,r);n<a;++n)if(e[n]!==t[n]){i=e[n],r=t[n];break}return i<r?-1:r<i?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);if(void 0===t)for(n=t=0;n<e.length;++n)t+=e[n].length;for(var i=u.allocUnsafe(t),r=0,n=0;n<e.length;++n){var a=e[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,r),r+=a.length}return i},u.byteLength=h,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?A(this,0,e):t.apply(this,arguments)},u.prototype.equals=function(e){if(u.isBuffer(e))return this===e||0===u.compare(this,e);throw new TypeError("Argument must be a Buffer")},u.prototype.inspect=function(){var e="",t=B.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t)&&(e+=" ... "),"<Buffer "+e+">"},u.prototype.compare=function(e,t,i,r,n){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===i&&(i=e?e.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),(t=void 0===t?0:t)<0||i>e.length||r<0||n>this.length)throw new RangeError("out of range index");if(n<=r&&i<=t)return 0;if(n<=r)return-1;if(i<=t)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(r>>>=0),o=(i>>>=0)-(t>>>=0),s=Math.min(a,o),l=this.slice(r,n),c=e.slice(t,i),d=0;d<s;++d)if(l[d]!==c[d]){a=l[d],o=c[d];break}return a<o?-1:o<a?1:0},u.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},u.prototype.indexOf=function(e,t,i){return p(this,e,t,i,!0)},u.prototype.lastIndexOf=function(e,t,i){return p(this,e,t,i,!1)},u.prototype.write=function(e,t,i,r){if(void 0===t)r="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)r=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-t;if((void 0===i||n<i)&&(i=n),0<e.length&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r=r||"utf8";for(var a,o,s,l=!1;;)switch(r){case"hex":var c=this,d=e,u=t,h=i,f=(u=Number(u)||0,c.length-u);if((!h||f<(h=Number(h)))&&(h=f),(f=d.length)%2!=0)throw new TypeError("Invalid hex string");f/2<h&&(h=f/2);for(var p=0;p<h;++p){var m=parseInt(d.substr(2*p,2),16);if(isNaN(m))return p;c[u+p]=m}return p;case"utf8":case"utf-8":return f=t,s=i,O(E(e,(o=this).length-f),o,f,s);case"ascii":return y(this,e,t,i);case"latin1":case"binary":return y(this,e,t,i);case"base64":return o=this,s=t,a=i,O(S(e),o,s,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,e,t,i);default:if(l)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),l=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var g=4096;function _(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(i<e+t)throw new RangeError("Trying to access beyond buffer length")}function w(e,t,i,r,n,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n<t||t<a)throw new RangeError('"value" argument is out of bounds');if(i+r>e.length)throw new RangeError("Index out of range")}function x(e,t,i,r){t<0&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-i,2);n<a;++n)e[i+n]=(t&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function I(e,t,i,r){t<0&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-i,4);n<a;++n)e[i+n]=t>>>8*(r?n:3-n)&255}function b(e,t,i,r){if(i+r>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function k(e,t,i,r,n){return n||b(e,0,i,4),a.write(e,t,i,r,23,4),i+4}function T(e,t,i,r,n){return n||b(e,0,i,8),a.write(e,t,i,r,52,8),i+8}u.prototype.slice=function(e,t){var i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):i<e&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):i<t&&(t=i),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else for(var r=t-e,n=new u(r,void 0),a=0;a<r;++a)n[a]=this[a+e];return n},u.prototype.readUIntLE=function(e,t,i){e|=0,t|=0,i||_(e,t,this.length);for(var r=this[e],n=1,a=0;++a<t&&(n*=256);)r+=this[e+a]*n;return r},u.prototype.readUIntBE=function(e,t,i){e|=0,t|=0,i||_(e,t,this.length);for(var r=this[e+--t],n=1;0<t&&(n*=256);)r+=this[e+--t]*n;return r},u.prototype.readUInt8=function(e,t){return t||_(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||_(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||_(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||_(e,t,this.length);for(var r=this[e],n=1,a=0;++a<t&&(n*=256);)r+=this[e+a]*n;return(n*=128)<=r&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||_(e,t,this.length);for(var r=t,n=1,a=this[e+--r];0<r&&(n*=256);)a+=this[e+--r]*n;return(n*=128)<=a&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||_(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||_(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt16BE=function(e,t){t||_(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt32LE=function(e,t){return t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||_(e,4,this.length),a.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||_(e,4,this.length),a.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||_(e,8,this.length),a.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||_(e,8,this.length),a.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,i,r){e=+e,t|=0,i|=0,r||w(this,e,t,i,Math.pow(2,8*i)-1,0);var n=1,a=0;for(this[t]=255&e;++a<i&&(n*=256);)this[t+a]=e/n&255;return t+i},u.prototype.writeUIntBE=function(e,t,i,r){e=+e,t|=0,i|=0,r||w(this,e,t,i,Math.pow(2,8*i)-1,0);var n=i-1,a=1;for(this[t+n]=255&e;0<=--n&&(a*=256);)this[t+n]=e/a&255;return t+i},u.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,i,r){e=+e,t|=0,r||w(this,e,t,i,(r=Math.pow(2,8*i-1))-1,-r);var n=0,a=1,o=0;for(this[t]=255&e;++n<i&&(a*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/a>>0)-o&255;return t+i},u.prototype.writeIntBE=function(e,t,i,r){e=+e,t|=0,r||w(this,e,t,i,(r=Math.pow(2,8*i-1))-1,-r);var n=i-1,a=1,o=0;for(this[t+n]=255&e;0<=--n&&(a*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/a>>0)-o&255;return t+i},u.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},u.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||w(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,i){return k(this,e,t,!0,i)},u.prototype.writeFloatBE=function(e,t,i){return k(this,e,t,!1,i)},u.prototype.writeDoubleLE=function(e,t,i){return T(this,e,t,!0,i)},u.prototype.writeDoubleBE=function(e,t,i){return T(this,e,t,!1,i)},u.prototype.copy=function(e,t,i,r){if(i=i||0,r||0===r||(r=this.length),t>=e.length&&(t=e.length),(r=0<r&&r<i?i:r)===i)return 0;if(0===e.length||0===this.length)return 0;if((t=t||0)<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length);var n,a=(r=e.length-t<r-i?e.length-t+i:r)-i;if(this===e&&i<t&&t<r)for(n=a-1;0<=n;--n)e[n+t]=this[n+i];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n<a;++n)e[n+t]=this[n+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+a),t);return a},u.prototype.fill=function(e,t,i,r){if("string"==typeof e){var n;if("string"==typeof t?(r=t,t=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===e.length&&(n=e.charCodeAt(0))<256&&(e=n),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(!(i<=t))if(t>>>=0,i=void 0===i?this.length:i>>>0,"number"==typeof(e=e||0))for(s=t;s<i;++s)this[s]=e;else for(var a=u.isBuffer(e)?e:E(new u(e,r).toString()),o=a.length,s=0;s<i-t;++s)this[s+t]=a[s%o];return this};var D=/[^+\/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var i,r=e.length,n=null,a=[],o=0;o<r;++o){if(55295<(i=e.charCodeAt(o))&&i<57344){if(!n){if(56319<i){-1<(t-=3)&&a.push(239,191,189);continue}if(o+1===r){-1<(t-=3)&&a.push(239,191,189);continue}n=i;continue}if(i<56320){-1<(t-=3)&&a.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&-1<(t-=3)&&a.push(239,191,189);if(n=null,i<128){if(--t<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function S(e){return M.toByteArray(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,i,r){for(var n=0;n<r&&!(n+i>=t.length||n>=e.length);++n)t[n+i]=e[n];return n}}.call(this,C(0))},function(e,t,i){t.byteLength=function(e){var e=d(e),t=e[0],e=e[1];return 3*(t+e)/4-e},t.toByteArray=function(e){var t,i,r=d(e),n=r[0],r=r[1],a=new c(function(e,t){return 3*(e+t)/4-t}(n,r)),o=0,s=0<r?n-4:n;for(i=0;i<s;i+=4)t=l[e.charCodeAt(i)]<<18|l[e.charCodeAt(i+1)]<<12|l[e.charCodeAt(i+2)]<<6|l[e.charCodeAt(i+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=255&t;2===r&&(t=l[e.charCodeAt(i)]<<2|l[e.charCodeAt(i+1)]>>4,a[o++]=255&t);1===r&&(t=l[e.charCodeAt(i)]<<10|l[e.charCodeAt(i+1)]<<4|l[e.charCodeAt(i+2)]>>2,a[o++]=t>>8&255,a[o++]=255&t);return a},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,n=[],a=0,o=i-r;a<o;a+=16383)n.push(function(e,t,i){for(var r,n=[],a=t;a<i;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),n.push(function(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}(r));return n.join("")}(e,a,o<a+16383?o:a+16383));1==r?(t=e[i-1],n.push(s[t>>2]+s[t<<4&63]+"==")):2==r&&(t=(e[i-2]<<8)+e[i-1],n.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return n.join("")};for(var s=[],l=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,a=r.length;n<a;++n)s[n]=r[n],l[r.charCodeAt(n)]=n;function d(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");e=e.indexOf("="),t=(e=-1===e?t:e)===t?0:4-e%4;return[e,t]}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,i,r,n){var a,o,s=8*n-r-1,l=(1<<s)-1,c=l>>1,d=-7,u=i?n-1:0,h=i?-1:1,n=e[t+u];for(u+=h,a=n&(1<<-d)-1,n>>=-d,d+=s;0<d;a=256*a+e[t+u],u+=h,d-=8);for(o=a&(1<<-d)-1,a>>=-d,d+=r;0<d;o=256*o+e[t+u],u+=h,d-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(n?-1:1);o+=Math.pow(2,r),a-=c}return(n?-1:1)*o*Math.pow(2,a-r)},t.write=function(e,t,i,r,n,a){var o,s,l=8*a-n-1,c=(1<<l)-1,d=c>>1,u=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,f=r?1:-1,a=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(r=Math.pow(2,-o))<1&&(o--,r*=2),2<=(t+=1<=o+d?u/r:u*Math.pow(2,1-d))*r&&(o++,r/=2),c<=o+d?(s=0,o=c):1<=o+d?(s=(t*r-1)*Math.pow(2,n),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,n),o=0));8<=n;e[i+h]=255&s,h+=f,s/=256,n-=8);for(o=o<<n|s,l+=n;0<l;e[i+h]=255&o,h+=f,o/=256,l-=8);e[i+h-f]|=128*a}},function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},function(e,n,a){!function(e){var t=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function r(e,t){this._id=e,this._clearFn=t}n.setTimeout=function(){return new r(i.call(setTimeout,t,arguments),clearTimeout)},n.setInterval=function(){return new r(i.call(setInterval,t,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(t,this._id)},n.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},n.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},n._unrefActive=n.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},a(9),n.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,n.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}.call(this,a(0))},function(e,t,i){!function(e,t){function a(e){delete l[e]}function o(e){if(c)setTimeout(o,0,e);else{var t=l[e];if(t){c=!0;try{var i=t,r=i.callback,n=i.args;switch(n.length){case 0:r();break;case 1:r(n[0]);break;case 2:r(n[0],n[1]);break;case 3:r(n[0],n[1],n[2]);break;default:r.apply(s,n)}}finally{a(e),c=!1}}}}function i(){function e(e){e.source===r&&"string"==typeof e.data&&0===e.data.indexOf(t)&&o(+e.data.slice(t.length))}var t="setImmediate$"+Math.random()+"$";r.addEventListener?r.addEventListener("message",e,!1):r.attachEvent("onmessage",e),u=function(e){r.postMessage(t+e,"*")}}var r,s,n,l,c,d,u,h,f;(r="undefined"==typeof self?void 0===e?this:e:self).setImmediate||(n=1,c=!(l={}),d=r.document,e=(e=Object.getPrototypeOf&&Object.getPrototypeOf(r))&&e.setTimeout?e:r,"[object process]"==={}.toString.call(r.process)?u=function(e){t.nextTick(function(){o(e)})}:!function(){var e,t;if(r.postMessage&&!r.importScripts)return e=!0,t=r.onmessage,r.onmessage=function(){e=!1},r.postMessage("","*"),r.onmessage=t,e}()?u=r.MessageChannel?((f=new MessageChannel).port1.onmessage=function(e){o(e.data)},function(e){f.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(h=d.documentElement,function(e){var t=d.createElement("script");t.onreadystatechange=function(){o(e),t.onreadystatechange=null,h.removeChild(t),t=null},h.appendChild(t)}):function(e){setTimeout(o,0,e)}:i(),e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return l[n]={callback:e,args:t},u(n),n++},e.clearImmediate=a)}.call(this,i(0),i(2))},function(i,e,t){t.r(e),t.d(e,"NDSAnimationExtension",function(){return x}),t.d(e,"NDSAnimationEdit",function(){return we});var O=t(1);function M(e,t){var i,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){{var i;if(e)return"string"==typeof e?a(e,t):"Map"===(i="Object"===(i={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),i=0,function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function v(){return(v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)!{}.hasOwnProperty.call(r,i)||(e[i]=r[i])}return e}).apply(null,arguments)}function A(e,t){var i=e.findIndex(function(e){return t<e});return-1===i?e.length:i}function K(e,t,i){var r=new THREE.Matrix4,n=new THREE.Vector3,a=new THREE.Quaternion,o=new THREE.Vector3,i=(r.makeRotationFromQuaternion(i),r.getInverse(r),new THREE.Matrix4),s=(i.makeTranslation(e.x,e.y,e.z),new THREE.Matrix4);return s.makeTranslation(-e.x,-e.y,-e.z),t.premultiply(s).premultiply(r).premultiply(i),t.decompose(n,a,o),n}function s(e,t,i,r,n,a,o){var s=r-i,r=n-i,n=a.map(function(e){return(e-i)/s});new THREE.LinearInterpolant(n,e,t,o).evaluate(r/s)}function V(e,t){var i=[],r=[],n=[],a=[],o=[];return e.forEach(function(e){1==e.trackType||8==e.trackType?i=t?e.translations.slice(0,3):e.translations.slice(-3):2==e.trackType?r=t?e.rotations.slice(0,4):e.rotations.slice(-4):3==e.trackType?n=t?e.scales.slice(0,3):e.scales.slice(-3):4==e.trackType?a=t?e.colors.slice(0,3):e.colors.slice(-3):5!=e.trackType&&7!=e.trackType&&11!=e.trackType||(o=t?e.opacities.slice(0,1):e.opacities.slice(-1))}),{currentTranslation:i,currentRotation:r,currentScale:n,currentColor:a,currentOpacity:o}}function p(e,t,i){for(var r=t.length/e.length,n=e.slice(),a=(i.forEach(function(e){var t=e.index,e=e.time;n[t]=e}),n.map(function(e,t){return t}).sort(function(e,t){return n[e]-n[t]})),e=n.sort(function(e,t){return e-t}),o=[],s=0;s<a.length;s++)for(var l=a[s]*r,c=0;c<r;c++)o.push(t[l+c]);return{times:e,target:o}}function g(){var i=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(i+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"===e?t:3&t|8).toString(16)})}function _(i,e,t,r,n,a,o){var s=[],l=[],c=(Array.isArray(i)&&i.forEach(function(e){l.push(e.r,e.g,e.b)}),[]),d=[];return e.forEach(function(e){Array.isArray(i)?s.push(l,null,null):s.push(i.r,i.g,i.b);var t=g();c.push(t),d.push("a")}),{ndsModelId:o,animationID:n,trackID:t,trackType:r,modelID:[a],centers:[],worldMatrixFrame:[],keyframeIds:c,interoplationEnd:[],interoplationStart:[],interoplationType:0,name:"",times:e,groups:d,rotations:[],scales:[],translations:[],colors:s,opacities:[],cameras:[]}}function w(i,e,t,r,n,a,o){var s=[],l=[],c=[];return e.forEach(function(e){Array.isArray(i)?s.push(1<i.length?i:i[0]):s.push(i);var t=g();l.push(t),c.push("a")}),{ndsModelId:o,animationID:n,trackID:t,trackType:r,modelID:[a],centers:[],worldMatrixFrame:[],keyframeIds:l,interoplationEnd:[],interoplationStart:[],interoplationType:0,name:"",times:e,groups:c,rotations:[],scales:[],translations:[],colors:[],opacities:s,cameras:[]}}function Z(e){var t=Math.round(255*e.r).toString(16),i=Math.round(255*e.g).toString(16),e=Math.round(255*e.b).toString(16);return"0x"+(1===t.length?"0"+t:t)+(1===i.length?"0"+i:i)+(1===e.length?"0"+e:e)}function m(e){if(e=e.replace(/^#/,""),/^(?:[0-9a-fA-F]{3}){1,2}$/.test(e))return 3===e.length&&(e=e.split("").map(function(e){return e+e}).join("")),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255];throw new Error("无效的十六进制颜色代码")}function B(e){var t=e[0],i=e[1],e=e[2],t=Math.round(255*t),i=Math.round(255*i),e=Math.round(255*e);return"#"+t.toString(16).padStart(2,"0")+i.toString(16).padStart(2,"0")+e.toString(16).padStart(2,"0")}function S(e,t){for(var i=0;i<t.length;i++)e.includes(t[i])||e.push(t[i]);return e}function c(e,t){if(e.length<2)return e;for(var i=e[e.length-2],r=e[e.length-1],n=(r-i)/(t+1),a=[],o=1;o<=t;o++)a.push(i+n*o);return e.slice(0,e.length-1).concat(a,r)}function I(e,t){for(var i=0;i<t;i++)e.splice(-1,0,0,1);e.splice(-1,1)}function W(e){var t=-1/0,i=1/0,r=null,n=null;return e.forEach(function(e){e.times[e.times.length-1]>t&&(t=e.times[e.times.length-1],r=e),e.times[e.times.length-1]==t&&8==e.trackType&&(r=e),e.times[0]<i&&(i=e.times[0],n=e),e.times[0]==i&&8==e.trackType&&(n=e)}),{max:t,min:i,maxTrack:r,minTrack:n}}function C(e,t){var i=(r=W(e)).max,r=r.min;return b(e,i<t?i:t<r?r:t)}function b(e,r){var t,n=0,a=0,o=[];return e.forEach(function(e){var t=function(e,t){{var i,r,n;if(e&&e.opacities.length)return i=e.times[e.times.length-1],r=e.times[0],n=[],i<t?n=e.opacities.slice(-3):t<r?n=e.opacities.slice(0,3):s(e.opacities,1,r,i,t,e.times,n),n[0]}return 0}(e,r),i=function(e,t){{var i;if(e&&e.opacities.length)return i=e.times[e.times.length-1],e.times[0]<=t&&t<=i?1:0}return 0}(e,r);a+=i,n+=i*t,r>e.times[e.times.length-1]&&o.push(e)}),0==a&&o.length?(t=(e=W(o)).max,e.min,b(o,t)):n/=a}function P(e,t,i){var r=(n=W(t)).max,n=n.min;return Y(e,t,r<i?r:i<n?n:i)}function Y(r,e,n){var t,a=null,o=0,s=[];return e.forEach(function(e){var t=function(e,s,l){{var t,i,c,r;if(s&&s.opacities.length)return r=s.times[s.times.length-1],t=s.times[0],i=[],c=[],r<l?(r=V([s],!1),i=r.currentOpacity,e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds&&e.leafBodyAttri.bodyMeshIds.length&&e.leafBodyAttri.bodyMeshIds.forEach(function(e,t){c.push({meshId:e,value:Array.isArray(i[0])?i[0][t]:i[0]})})):l<t?(r=V([s],!0),i=r.currentOpacity,e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds&&e.leafBodyAttri.bodyMeshIds.length&&e.leafBodyAttri.bodyMeshIds.forEach(function(e,t){c.push({meshId:e,value:Array.isArray(i[0])?i[0][t]:i[0]})})):e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds&&e.leafBodyAttri.bodyMeshIds.length&&e.leafBodyAttri.bodyMeshIds.forEach(function(e,t){var i=[],r=s.times.findIndex(function(e){return l<=e}),n=s.times.slice(r-1,r+1),a=s.opacities.slice(r-1,r),r=s.opacities.slice(r,r+1),o=[];Array.isArray(a[0])&&!Array.isArray(r[0])?o.push(a[0][t],r[0]):!Array.isArray(a[0])&&Array.isArray(r[0])?o.push(a[0],r[0][t]):Array.isArray(a[0])||Array.isArray(r[0])?Array.isArray(a[0])&&Array.isArray(r[0])&&o.push(a[0][t],r[0][t]):o.push(a[0],r[0]),o.length&&(t=n[1]-n[0],a=l-n[0],new THREE.LinearInterpolant([0,1],o,1,i).evaluate(a/t),c.push({meshId:e,value:i[0]}))}),c.length?c:i[0]}return 0}(r,e,n),i=function(e,t){{var i;if(e&&e.opacities.length)return i=e.times[e.times.length-1],e.times[0]<=t&&t<=i?1:0}return 0}(e,n);Array.isArray(t)&&(a=a||JSON.parse(JSON.stringify(t)),t.forEach(function(e,t){e=i*e.value;null!=a[t].mixOpacity&&null!=a[t].mixOpacity||(a[t].mixOpacity=0),a[t].mixOpacity+=e})),o+=i,n>e.times[e.times.length-1]&&s.push(e)}),0==o&&s.length?(t=(e=W(s)).max,e.min,Y(r,s,t)):(Array.isArray(a)&&a.forEach(function(e){e.value=e.mixOpacity/o}),a)}function L(e,t,i){var r,n,a;if(e&&e[t]&&e[t].length)return r=e.times[e.times.length-1],n=e.times[0],a=[],r<i?a=e[t].slice(-3):i<n?a=e[t].slice(0,3):s(e[t],3,n,r,i,e.times,a),a}function R(e,s,l){var t,i,c,r,n,a;if(s&&s.colors.length)return t=s.times[s.times.length-1],i=s.times[0],n=null,c=[],t<l?(r=V([s],!1).currentColor,Array.isArray(r[0])?e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds&&e.leafBodyAttri.bodyMeshIds.length&&e.leafBodyAttri.bodyMeshIds.forEach(function(e,t){var i=new THREE.Color;i.fromArray(r[0],3*t),c.push({meshId:e,value:i})}):n=(new THREE.Color).fromArray(r)):l<i?(a=V([s],!0).currentColor,Array.isArray(a[0])?e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds&&e.leafBodyAttri.bodyMeshIds.length&&e.leafBodyAttri.bodyMeshIds.forEach(function(e,t){var i=new THREE.Color;i.fromArray(a[0],3*t),c.push({meshId:e,value:i})}):n=(new THREE.Color).fromArray(a)):e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds&&e.leafBodyAttri.bodyMeshIds.length&&e.leafBodyAttri.bodyMeshIds.forEach(function(e,t){var i=[],r=s.times.findIndex(function(e){return l<=e}),n=s.times.slice(r-1,r+1),a=s.colors.slice(3*r-3,3*r),r=s.colors.slice(3*r,3*r+3),o=[];Array.isArray(a[0])&&!Array.isArray(r[0])?o.push(a[0][3*t],a[0][3*t+1],a[0][3*t+2],r[0],r[1],r[2]):!Array.isArray(a[0])&&Array.isArray(r[0])?o.push(a[0],a[1],a[2],r[0][3*t],r[0][3*t+1],r[0][3*t+2]):Array.isArray(a[0])||Array.isArray(r[0])?Array.isArray(a[0])&&Array.isArray(r[0])&&o.push(a[0][3*t],a[0][3*t+1],a[0][3*t+2],r[0][3*t],r[0][3*t+1],r[0][3*t+2]):o.push(a[0],a[1],a[2],r[0],r[1],r[2]),o.length&&(t=n[1]-n[0],a=l-n[0],new THREE.LinearInterpolant([0,1],o,3,i).evaluate(a/t),r=new THREE.Color,c.push({meshId:e,value:r.fromArray(i)}))}),c.length?c:n?Z(n):null}function q(e,t,i){var r,n;return e.length&&!t.length?J([e[0]],e[1],e[2],i):!e.length&&t.length?o(t,i):e.length&&t.length?((r=W([e[0]].concat(t))).max,r.min,n=r.maxTrack,r.minTrack,function(e,t){for(var i=0;i<e.length;i++){var r=e[i];if(t>=r.times[0]&&t<=r.times[r.times.length-1])return 1}}(t,i)||8==n.trackType&&i>n.times[n.times.length-1]?o(t,i):J([e[0]],e[1],e[2],i)):null}function o(e,t){var i,r,n=W(e),a=n.max,o=n.min,s=n.maxTrack,n=n.minTrack,l=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,u=new THREE.Matrix4,h=[],f=[],p=[];return p=(a<=t?(h=V([s],!1).currentTranslation,f=s.rotations,s):t<=o?(h=V([n],!0).currentTranslation,f=n.rotations,n):(a=X(e,t),i=a.times[0],r=a.times[a.times.length-1]-i,s=t-i,o=a.times.map(function(e){return(e-i)/r}),new THREE.LinearInterpolant(o,a.translations,3,h).evaluate(s/r),f=a.rotations,a)).scales,u.compose(c.fromArray(h),l.fromArray(f),d.fromArray(p)),u}function J(e,t,i,r){var n,R,U,F,a,o,s,l,c,d,u,h,N,f,z,p,H,m,y,j,v,g,_,w,x,I,b,M,A,k,T,D,E,S,O,B=W(e),C=B.max,P=B.min,L=B.maxTrack,B=B.minTrack;if(t.worldMatrixFrame&&t.worldMatrixFrame.length&&t.centers&&t.centers.length)return n=new THREE.Quaternion,R=new THREE.Vector3,U=new THREE.Quaternion,F=new THREE.Vector3,a=new THREE.Matrix4,o=new THREE.Matrix4,y=t.centers,c=[],d=[],u=[],s=[],l=null,C<=r?(c=(C=V([l=l||L,t,i],!1)).currentTranslation,d=C.currentRotation,u=C.currentScale,1==l.trackType&&(s=y.slice(-3))):r<=P?(c=(L=V([l=l||B,t,i],!0)).currentTranslation,d=L.currentRotation,u=L.currentScale,1==l.trackType&&(s=y.slice(0,3))):1==(l=X(e,r)).trackType?(C=t,P=i,B=c,L=d,y=u,e=s,j=r,(E=(m=l).times.findIndex(function(e){return j<e}))<1?(O=V([m,C,P],!1),B.push(O.currentTranslation[0],O.currentTranslation[1],O.currentTranslation[2]),L.push(O.currentRotation[0],O.currentRotation[1],O.currentRotation[2],O.currentRotation[3]),y.push(O.currentScale[0],O.currentScale[1],O.currentScale[2]),1==m.trackType&&e.push(C.centers[C.centers.length-3],C.centers[C.centers.length-2],C.centers[C.centers.length-1])):(O=E-1,v=m.centers.slice(),(g=new THREE.Vector3).set(v[3*E],v[3*E+1],v[3*E+2]),S=new THREE.Quaternion,_=new THREE.Vector3,x=new THREE.Vector3,A=new THREE.Vector3,w=new THREE.Vector3,T=new THREE.Matrix4,I=new THREE.Quaternion,k=new THREE.Matrix4,D=new THREE.Matrix4,S.fromArray(C.rotations,4*O),x.fromArray(m.translations,3*E),A.fromArray(P.scales,3*O),T.compose(x,I,A),k.makeTranslation(-g.x,-g.y,-g.z),T.premultiply(k),k.makeRotationFromQuaternion(S),T.premultiply(k),k.makeTranslation(g.x,g.y,g.z),T.premultiply(k),T.decompose(w,new THREE.Quaternion,new THREE.Vector3),E=D.fromArray(m.worldMatrixFrame,16*O),_.setFromMatrixPosition(E),x=_.sub(w),I=g.add(x),b=m.times[0],M=m.times[m.times.length-1]-b,A=j-b,k=m.times.map(function(e){return(e-b)/M}),v[3*O]=I.x,v[3*O+1]=I.y,v[3*O+2]=I.z,new THREE.LinearInterpolant(k,v,3,e).evaluate(A/M),T=m.translations.slice(),D=K(I,E.clone(),S),T[3*O]=D.x,T[3*O+1]=D.y,T[3*O+2]=D.z,new THREE.LinearInterpolant(k,T,3,B).evaluate(A/M),new THREE.QuaternionLinearInterpolant(k,C.rotations,4,L).evaluate(A/M),new THREE.LinearInterpolant(k,P.scales,3,y).evaluate(A/M))):(_=t,w=i,g=c,x=d,v=u,e=r,p=(m=l).times[0],H=m.times[m.times.length-1]-p,I=e-p,E=m.times.map(function(e){return(e-p)/H}),new THREE.LinearInterpolant(E,m.translations,3,g).evaluate(I/H),1==_.times.length?x.push.apply(x,_.rotations.slice()):(h=_.times[0],N=_.times[_.times.length-1]-h,E=e-h,m=_.times.map(function(e){return(e-h)/N}),new THREE.QuaternionLinearInterpolant(m,_.rotations,4,x).evaluate(E/N)),1==w.times.length?v.push.apply(v,w.scales.slice()):(f=w.times[0],z=w.times[w.times.length-1]-f,g=e-f,I=w.times.map(function(e){return(e-f)/z}),new THREE.LinearInterpolant(I,w.scales,3,v).evaluate(g/z))),1==l.trackType?(S=R.fromArray(c),O=F.fromArray(u),a.compose(S,n,O),o.makeTranslation(-s[0],-s[1],-s[2]),a.premultiply(o),o.makeRotationFromQuaternion(U.fromArray(d)),a.premultiply(o),o.makeTranslation(s[0],s[1],s[2]),a.premultiply(o)):a.compose(R.fromArray(c),n.fromArray(d),F.fromArray(u)),a}function X(e,t){var i,r;return 1==e.length?e[0]:(r=null,i=[],e.forEach(function(e){t>=e.times[0]&&t<=e.times[e.times.length-1]&&(r=e),t>e.times[e.times.length-1]&&i.push(e)}),r=r||W(i).maxTrack)}function U(e,t,i){if(e&&0!=e.times.length&&null!=e.devices){var r=e.times[0],n=e.times[e.times.length-1],a=n-r,o=t-r,s=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3,u=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,y=new THREE.Matrix4,v=-1;if(t<=r)s.fromArray(e.cameras.slice(3*(v=0),3*v+3)),c.fromArray(e.targets.slice(3*v,3*v+3)),f.fromArray(e.ups.slice(3*v,3*v+3));else if(n<=t)v=e.times.length-1,s.fromArray(e.cameras.slice(3*v,3*v+3)),c.fromArray(e.targets.slice(3*v,3*v+3)),f.fromArray(e.ups.slice(3*v,3*v+3));else{if(-1==(n=e.times.findIndex(function(e){return t<=e})))return;s.fromArray(e.cameras.slice(3*(v=0==n?0:n-1),3*v+3)),l.fromArray(e.cameras.slice(3*n,3*n+3)),c.fromArray(e.targets.slice(3*v,3*v+3)),d.fromArray(e.targets.slice(3*n,3*n+3)),u.fromArray(e.orbitCenters.slice(3*v,3*v+3)),h.fromArray(e.orbitCenters.slice(3*n,3*n+3)),p.fromArray(e.ups.slice(3*v,3*v+3)),m.fromArray(e.devices.slice(3*n,3*n+3)),y.fromArray(e.projectionMatrixInverses.slice(16*n,16*n+16));var g=e.times.map(function(e){return(e-r)/a}),_=[],_=(new THREE.LinearInterpolant(g,e.cameras,3,_).evaluate(o/a),(new THREE.Vector3).fromArray(_)),w=[],w=(new THREE.LinearInterpolant(g,e.ups,3,w).evaluate(o/a),f.fromArray(w),[]),g=(new THREE.LinearInterpolant(g,e.targets,3,w).evaluate(o/a),(new THREE.Vector3).fromArray(w)),o=new THREE.Vector3,w=s.distanceToSquared(c).toFixed(2),x=l.distanceToSquared(d).toFixed(2),I=(new THREE.Vector3).subVectors(c,u),b=(new THREE.Vector3).subVectors(d,h),M=(new THREE.Vector3).subVectors(s,c),d=(new THREE.Vector3).subVectors(l,d);if(1e-4<Math.abs(M.angleTo(d))&&i&&"OpDrawGeom"==i.controls.getOperator().type&&i.controls.getOperator().rotateViewBox(),1e-4<Math.abs(M.angleTo(d))&&Math.abs(I.length()-b.length())<1e-4)return i=(t-e.times[v])/(e.times[n]-e.times[v]),M=new THREE.Vector3,d=new THREE.Vector3,M.copy(s).sub(I),d.copy(l).sub(b),n=new THREE.Vector3,e=new THREE.Vector3,n.subVectors(M,u),e.subVectors(d,h),v=n.angleTo(e),0==(I=n.clone().cross(e).normalize()).x&&0==I.y&&0==I.z&&(0!=f.y?I.y=1:0!=f.z?I.x=1:0!=f.x?I.z=1:(I.x=1,f.z=1)),0==f.x&&0==f.y&&0==f.z&&(0!=p.x&&(f.x=1),0!=p.y&&(f.y=1),0!=p.z)&&(f.z=1),f.normalize(),_.copy(n).applyAxisAngle(I,v*i),_.add(h),g.copy(h),{position:_,up:f,target:g,device:m,projectionMatrixInverse:y,orbitCenter:h};w==x?o.copy(s).sub(c):o.copy(_).sub(g);l=(new THREE.Vector3).subVectors(_,g).normalize();s.copy(g).addScaledVector(l,o.length()),c.copy(g)}return{position:s,up:f,target:c}}}function F(e,t,i){for(var r=M(e);!(n=r()).done;){var n=n.value,a=n[0],n=n[1];if(a.startsWith(i)&&t>=n.startTime&&t<=n.endTime)return n}return null}function f(e,t,i){var r=i.renderer.getPixelRatio(),i=i.renderer.domElement;return{x:e*r/i.width*2-1,y:2*-(t*r/i.height)+1}}function N(e,t,i){var r=i.renderer.getPixelRatio(),i=i.renderer.domElement,n=i.width/2,i=i.height/2;return{x:Math.round((n*e+n)/r),y:Math.round((-i*t+i)/r)}}function z(e,t){var i=e.times[e.times.length-1],r=e.times[0],n=[],a={};return i<t?n=e.translations.slice(-3):t<r?n=e.translations.slice(0,3):s(e.translations,3,r,i,t,e.times,n),a.x=n[0],a.y=n[1],a.z=n[2],a}function k(e,i){var r=e.groups,n=e.times,a=-1,o=-1,s=[];if(Array.isArray(r))for(var t,l=0;l<r.length;l++)if(t=function(t){if(!s.includes(r[t])){s.push(r[t]),a=n[t];var e=r.findLastIndex(function(e){return e==r[t]});if(o=n[e],a<=i&&i<=o)return{v:!0}}}(l))return t.v;return!1}function Q(n,e,a){for(var t=e.uuids,i=e.imageLabelsMap,r=e.textLabelsMap,o=e.id2showHideStatusMap,s=e.id2showHideTrackMap,l=e.AnimationEdit,c=e.time,d=e.textIdLabelsMap,u=e.selectedHideTreeBody,h=n.ndsModel.getModelsByAnimationId(a),f=(t.length&&t.forEach(function(e){var t,i,r=e.lastIndexOf("-");0<r&&(i=e.slice(0,r),t=e.slice(r+1),0<h.filter(function(e){return e.id==t}).length)&&(e=n.ndsModel.getRootNodeFromUuid(i,t))&&e.uuid&&(r=a+"-"+e.uuid+"-"+t,i=!(i=s.get(r))||k(i,c),o.set(r,i),r=n.ndsModel.getBodyNodeFrom(e.uuid,t))&&(i?(1!=n.getObjectOrSomeChildVisibleStatus(r,t)&&n.ndsModel.showBody(r),u&&u.forEach(function(e){e=n.getObjectByUUID(e);n.ndsModel.hideBody(e)})):0!=n.getObjectOrSomeChildVisibleStatus(r,t)&&n.ndsModel.hideBody(r))}),[]),p=[],m=M(i);!(y=m()).done;){var y=y.value,v=y[0];y[1].animationID==a&&((y=s.get(v))?(y=k(y,c),o.set(v,y),l?l.setImageVisible(v,y,!1):n.setPicTextVisible(v,y),y||p.push(v)):(o.set(v,!0),n.setPicTextVisible(v,!0)))}for(var g=M(r);!(_=g()).done;){var _=_.value,w=_[0];_[1].animationID==a&&((_=s.get(w))?(_=k(_,c),o.set(w,_),l?l.setTextVisible(w,_,!1):n.setPicTextVisible(w,_),_||p.push(w)):(o.set(w,!0),n.setPicTextVisible(w,!0)))}n.controls.staticAnnotation&&(n.controls.staticAnnotation.selectIDs.length?n.controls.staticAnnotation.selectIDs.forEach(function(e){p.includes(e)||f.push(e)}):(n.controls.staticAnnotation.selectID&&!p.includes(n.controls.staticAnnotation.selectID)&&f.push(n.controls.staticAnnotation.selectID),n.controls.staticAnnotation.picSelectID&&!p.includes(n.controls.staticAnnotation.picSelectID)&&f.push(n.controls.staticAnnotation.picSelectID))),n.setSelectIdArray(f);for(var x=M(d);!(I=x()).done;){var I=I.value,b=I[0];I[1].animationID==a&&((I=s.get(b))?(I=k(I,c),o.set(b,I),n.textAnimationOp("setTextPointShow",b,I),I||(n.textAnimationOp("_changeTextareaStatus",b,"default"),n.dispatchEvent({type:"updatePropPanel"}))):(o.set(b,!0),n.textAnimationOp("setTextPointShow",b,!0)),I=n.textAnimationOp("getTextPointDataById",b),n.textAnimationOp("setFontHeight",b,I.style.height))}}var e=t(3),$=t.n(e);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)!{}.hasOwnProperty.call(r,i)||(e[i]=r[i])}return e}).apply(null,arguments)}window.keys=new Set,document.addEventListener("keydown",function(e){window.keys.add(e.key)}),document.addEventListener("keyup",function(e){window.keys.delete(e.key)});var d="textpoint_",ee=120,y=30,te=24,ie="宋体",re="normal",ne="normal",ae=28,oe="auto",r="textNode",se="#000000",le="1";function ce(t){function i(e,t){t&&(e.style.height="auto"),e.style.height=e.scrollHeight+"px",de((e.id||"").split("_").pop(),e.scrollHeight)}function r(e){n&&(clearTimeout(n),n=null),n=setTimeout(function(){i(e)},200)}var n=null;t.addEventListener?(t.addEventListener("input",function(){i(t,!0)},!1),i(t)):t.attachEvent&&(t.attachEvent("onpropertychange",function(){i(t)}),i(t)),window.VBArray&&window.addEventListener&&(t.attachEvent("onkeydown",function(){var e=window.event.keyCode;8!=e&&46!=e||r(t)}),t.attachEvent("oncut",function(){r(t)}));new(window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver)(function(e){1<e.length||i(t,!0)}).observe(t,{childList:!1,attributes:!0,characterData:!1,subtree:!1,attributeFilter:["style"],attributeOldValue:!1,characterDataOldValue:!1})}function de(e,t){var i=document.querySelector("#"+ue.preId+"spanlefti_"+e),e=document.querySelector("#"+ue.preId+"spanrighti_"+e);i&&(i.style.height=t+"px",i.style.top=-(t-12)/2+"px"),e&&(e.style.height=t+"px",e.style.top=-(t-12)/2+"px")}var ue={preId:"textpoint_",list:[],el:"#t_container",viewer:null,viewerEl:null,mousePopEl:null,mousePopElShow:!1,canAddPoint:!1,curSelectPoint:null,nameIndex:0,moveState:"",mousePoint:{x:null,y:null},mouseClickObj:{mouseStatus:"up",leftOrRight:"right"},init:function(e){var t;this.viewer||(this.viewer=e),this.viewerEl||(this.viewerEl=document.querySelector(this.el),this.viewerEl.addEventListener("click",this._addTextPoint.bind(this)),this._initPageEvent(),this.mousePopEl=(e=this.viewerEl,(t=document.createElement("div")).innerText="单击确定文本位置",t.style.position="absolute",t.style.zIndex="10",t.style.width="132px",t.style.height="20px",t.style.overflow="hidden",t.style.fontSize="14px",t.style.lineHeight="20px",t.style.padding="2px",t.style.cursor="default",t.style.userSelect="none",t.style.backgroundColor="rgba(255, 255, 255, 0.5)",t.style.border="1px solid rgb(255, 0, 0)",t.style.textWrap="nowrap",t.style.display="none",e.appendChild(t),t))},_initPageEvent:function(){var e,t,i,f=this;this.viewerEl.addEventListener("mouseup",function(e){f.moveState="",f.mouseClickObj.mouseStatus="up",(e.target.id||(e.target.id||"").includes("cms")||e.target.parentNode.id||(e.target.parentNode.id||"").includes("cms")||e.ctrlKey)&&(e.target.id.includes(f.preId+"textarea_")?document.querySelector("#"+e.target.id).focus():e.ctrlKey||f._clearAllSelectedStatus())}),this.viewerEl&&this.viewerEl.addEventListener("mousemove",(e=function(e){try{if(f.viewer.AnimationEdit&&f.viewer.AnimationEdit.opMouseMoveByEvent&&f.viewer.AnimationEdit.opMouseMoveByEvent(e),f._mousePopHandler.call(f,e),f.moveState){var t,i,r,n,a,o,s=document.querySelector("#"+f.preId+"textarea_"+f.curSelectPoint.id),l=document.querySelector("#"+f.preId+"wrap_"+f.curSelectPoint.id);if("width"==f.moveState&&"down"==f.mouseClickObj.mouseStatus){var c,d=e.x;if("right"==f.mouseClickObj.leftOrRight){var u=d-f.mousePoint.x;f.mousePoint.x=d,c=parseInt(s.style.width)+u,s.style.width=parseInt(s.style.width)+u+"px"}else if("left"==f.mouseClickObj.leftOrRight){var h=f.mousePoint.x-d;if(f.mousePoint.x=d,parseInt(s.style.width)+h<ae)return;c=parseInt(s.style.width)+h,s.style.width=parseInt(s.style.width)+h+"px",l.style.left=parseInt(l.style.left)-h+"px"}f._updateDataList({id:f.curSelectPoint.id,style:{width:c}})}"position"==f.moveState&&(t=e.x,i=e.y,r=t-f.mousePoint.x,n=i-f.mousePoint.y,f.mousePoint.x=t,f.mousePoint.y=i,a=parseInt(l.style.left)+r,o=parseInt(l.style.top)+n,parseInt(s.offsetWidth||0),parseInt(s.offsetHeight||0),f.viewerEl.offsetWidth,f.viewerEl.offsetHeight,l.style.left=(0<a?a:0)+"px",l.style.top=(0<o?o:0)+"px",f._updateDataList({id:f.curSelectPoint.id,position:{x:parseInt(l.style.left),y:parseInt(l.style.top)}}))}}catch(e){console.log(e)}},void 0===(t=17)&&(t=100),i=!0,function(){i&&(e.apply(this,arguments),i=!1,setTimeout(function(){i=!0},t))}))},_mousePopHandler:function(e){try{this.mousePopElShow&&"CANVAS"===e.target.nodeName&&e.target.id?(this._showMousePopHandler(!0),this.mousePopEl.style.top=e.offsetY+20+"px",this.mousePopEl.style.left=e.offsetX+6+"px"):this._showMousePopHandler(!1)}catch(e){console.log("【_mousePopHandler】 error = ",e)}},_showMousePopHandler:function(e){this.mousePopEl&&(this.mousePopEl.style.display=e?"block":"none")},_changeTextareaStatus:function(t,i){void 0===i&&(i="default");var e=document.querySelector("#"+d+"wrap_"+t),r=document.querySelector("#"+d+"mask_"+t),n=document.querySelector("#"+d+"spanleft_"+t),a=document.querySelector("#"+d+"spanright_"+t),o=document.querySelector("#"+d+"textarea_"+t);r&&("default"==i?(e.style.border="1px solid transparent",e.style.zIndex="7",o.style.border="1px solid transparent",r.style.zIndex=10,r.style.cursor="auto",n.style.display="none",a.style.display="none"):"selected"==i?(e.style.border="1px solid rgb(255, 195, 0)",e.style.zIndex="9",n.style.display="block",a.style.display="block",r.style.cursor="move"):"edit"==i&&(e.style.zIndex="9",e.style.border="1px solid rgb(255, 195, 0)",o.focus(),r.style.zIndex="-1",r.style.cursor="auto",n.style.display="block",a.style.display="block"),this.list=this.list.map(function(e){return e.id==t&&(e.selectStatus=i),l({},e)}))},_initTextPointEvent:function(t){var o=this,e=document.querySelector("#"+this.preId+"wrap_"+t),s=(e.addEventListener("click",function(e){try{o._getCurPoint(e);var t=(e.target.id||"").split("_").pop();t&&o._changeTextareaStatus(t,"selected"),o._selectedNode(t)}catch(e){console.log(e)}}),e.addEventListener("dblclick",function(e){try{o._getCurPoint(e);var t=(e.target.id||"").split("_").pop();t&&o._changeTextareaStatus(t,"edit")}catch(e){console.log(e)}}),e.addEventListener("mousedown",function(e){(e.target.id||"").split("_").pop();o.mousePoint.x=e.x,o.mousePoint.y=e.y,"move"==e.target.style.cursor&&(o.moveState="position")}),document.querySelector("#"+this.preId+"textarea_"+t));s.addEventListener("input",function(e){o._updateDataList({id:t,content:e.target.value.trim(),style:{height:e.target.scrollHeight}})}),s.addEventListener("keydown",function(e){try{var t,i,r,n,a;13==e.keyCode&&(s.value=e.target.value.trim(),o._clearAllSelectedStatus(),t=e.target.id.split("_").pop(),i=e.target.value,r=e.target.getAttribute("data-create"),i&&i.trim()?("true"==r&&(a=o.list.find(function(e){return e.id==t})||{},o.viewer&&o.viewer.dispatchEvent({type:"addShowHideTrack",data:{name:a.name,textIds:[t],animationID:a.animationID}}),o.viewer)&&o.viewer.dispatchEvent({type:"PureTextAdd"}),e.target.setAttribute("data-create","false"),o.viewer&&o.viewer.AnimationEdit.resetContainerStyle()):(o.delTextPoint(t),"true"==r&&(o.nameIndex--,n=[],o.list.forEach(function(e){return e.id!=t&&n.push(e)}),o.list=n),"false"==r&&o.viewer&&o.viewer.dispatchEvent({type:"deleteShowHideTrack",data:{textId:[t]}})))}catch(e){}}),s.addEventListener("blur",function(e){try{s.value=e.target.value.trim();var t,i,r=e.target.id.split("_").pop(),n=e.target.value,a=e.target.getAttribute("data-create");n&&n.trim()?("true"==a&&(o.viewer&&o.viewer.dispatchEvent({type:"PureTextAdd"}),i=o.list.find(function(e){return e.id==r})||{},o.viewer)&&o.viewer.dispatchEvent({type:"addShowHideTrack",data:{name:i.name,textIds:[r],animationID:i.animationID}}),e.target.setAttribute("data-create","false"),o.viewer&&o.viewer.AnimationEdit.resetContainerStyle()):(o.delTextPoint(r),"true"==a&&(o.nameIndex--,t=[],o.list.forEach(function(e){return e.id!=r&&t.push(e)}),o.list=t),"false"==a&&o.viewer&&o.viewer.dispatchEvent({type:"deleteShowHideTrack",data:{textId:[r]}}))}catch(e){}}),document.querySelector("#"+this.preId+"spanright_"+t).addEventListener("mousedown",function(e){o.moveState="width",o.mouseClickObj.leftOrRight="right",o._getCurPoint(e),o.mousePoint.x=e.x,o.mousePoint.y=e.y,o.mouseClickObj.mouseStatus="down"}),document.querySelector("#"+this.preId+"spanleft_"+t).addEventListener("mousedown",function(e){o.moveState="width",o.mouseClickObj.leftOrRight="left",o._getCurPoint(e),o.mousePoint.x=e.x,o.mousePoint.y=e.y,o.mouseClickObj.mouseStatus="down"})},_clearAllSelectedStatus:function(){var i=this;this.list.forEach(function(e){var t=document.querySelector("#"+i.preId+"textarea_"+e.id);t&&t.blur(),i._changeTextareaStatus(e.id,"default"),e.selectStatus="default"}),this._selectedNode()},_getCurPoint:function(e){var t=(e.target.id||"").split("_").pop();t&&(this.curSelectPoint=this.list.find(function(e){return e.id==t}))},_addTextPoint:function(e,t,i,r){if(void 0===t&&(t={}),!(e.target&&"CANVAS"!=e.target.nodeName||e.target&&!e.target.id)){var n=this,a=e.offsetX||e.x,o=e.offsetY||e.y;if(this.canAddPoint||t.id){var s=t.id||"cms"+(s=new Date).getDay()+s.getHours()+s.getMinutes()+s.getSeconds()+s.getMilliseconds()+Math.round(1e4*Math.random()),l=(l=this.preId+"wrap_"+s,u=t,d=(c={x:a,y:o}).x,c=c.y,(h=document.createElement("div")).id=l,h.style.position="absolute",h.style.top=c+"px",h.style.left=d+"px",h.style.zIndex="7",h.style.width="auto",h.style.height="auto",h.style.display="flex","default"==u.selectStatus?h.style.border="1px solid transparent":(h.style.border="1px solid rgb(255, 195, 0)",h.style.zIndex="9"),h),c=(c=this.preId+"textarea_"+s,u=(d=void 0===(d=t)?{}:d).style||{},(h=document.createElement("textarea")).id=c,d.content&&(h.innerText=d.content),h.rows="1",h.style.padding="2px",h.style.width=(u.width||ee)+"px",h.style.height=(u.height||y)+"px",h.style.overflow="hidden",h.style.boxSizing="border-box",h.style.fontSize=(u.fontSize||te)+"px",h.style.fontFamily=u.fontFamily||ie,h.style.minWidth=ae+"px",h.style.wordBreak="break-all",h.style.boxSizing="border-box",u.color&&(h.style.color=u.color),u.fontStyle&&(h.style.fontStyle=u.fontStyle),u.fontWeight&&(h.style.fontWeight=u.fontWeight),u.opacity&&(h.style.opacity=u.opacity),u.textDecoration&&(h.style.textDecoration=u.textDecoration),h),e=(e.target&&c.setAttribute("data-create","true"),d=this.preId+"spanleft_"+s,(u=document.createElement("span")).id=d,u.style.width="6px",u.style.height="12px",u.style.border="1px solid rgb(255, 195, 0)",u.style.position="absolute",u.style.left="-4px",u.style.top="50%",u.style.transform="translateY(-50%)",u.style.background="#fff",u.style.zIndex="11",u.style.cursor="e-resize",(h=document.createElement("i")).id=d.replace("spanleft","spanlefti"),h.style.display="block",h.style.position="absolute",h.style.width="8px",h.style.height=y+"px",h.style.background="transparent",h.style.top=-(y-12)/2+"px",u.appendChild(h),u),d=(d=this.preId+"spanright_"+s,(h=document.createElement("span")).id=d,h.style.width="6px",h.style.height="12px",h.style.border="1px solid rgb(255, 195, 0)",h.style.position="absolute",h.style.right="-4px",h.style.top="50%",h.style.transform="translateY(-50%)",h.style.background="#fff",h.style.zIndex="11",h.style.cursor="e-resize",(u=document.createElement("i")).id=d.replace("spanright","spanrighti"),u.style.display="block",u.style.position="absolute",u.style.width="8px",u.style.height=y+"px",u.style.background="transparent",u.style.top=-(y-12)/2+"px",h.appendChild(u),h),u=(u=this.preId+"mask_"+s,(h=document.createElement("div")).id=u,h.style.width="100%",h.style.height="100%",h.style.position="absolute",h.style.left="0",h.style.top="0",h.style.zIndex="-1",h);u.addEventListener("click",function(e){n.viewer&&n.viewer.onCancelHighlight(e)}),l.appendChild(c),l.appendChild(e),l.appendChild(d),l.appendChild(u),this.viewerEl.appendChild(l),t.id||c.focus();try{ce(c)}catch(e){console.log("【makeHeightAuto】 error = ",e)}this.nameIndex++;var h=t.style||{},e={id:s,name:t.name||"文本"+this.nameIndex,content:t.content||"",selectStatus:"edit",position:{x:a,y:o},initPosition:{x:a,y:o},style:{width:h.width||ee,height:h.height||y,fontSize:h.fontSize||te,fontFamily:h.fontFamily||ie,textDecoration:h.textDecoration||oe,fontStyle:h.fontStyle||re,fontWeight:h.fontWeight||ne,color:h.color||se,opacity:h.opacity||le},animationID:i||this.viewer&&this.viewer.AnimationEdit&&this.viewer.AnimationEdit._activeAnimationID,visible:null==r||r};return this.list.push(e),this._initTextPointEvent(s),this._showMousePopHandler(!1),e}}},_updateDataList:function(e,t){var i=e.id,r=e.name,n=e.content,a=e.position,o=void 0===a?{}:a,a=e.style,s=void 0===a?{}:a;this.list.forEach(function(e){e.id==i&&(null!=t&&(e.visible=t),n&&(e.content=n),r&&(e.name=r),o.x&&(e.position.x=o.x),o.y&&(e.position.y=o.y),s.fontSize&&(e.style.fontSize=s.fontSize),s.minWidth&&(e.style.minWidth=s.minWidth),s.fontFamily&&(e.style.fontFamily=s.fontFamily),s.fontStyle&&(e.style.fontStyle=s.fontStyle),s.fontWeight&&(e.style.fontWeight=s.fontWeight),s.textDecoration&&(e.style.textDecoration=s.textDecoration),s.color&&(e.style.color=s.color),null!=s.opacity&&(e.style.opacity=s.opacity),s.display&&(e.style.display=s.display),s.height&&(e.style.height=s.height),s.width)&&(e.style.width=s.width)})},_selectedNode:function(e){void 0===e&&(e=null);e=this.getSelectContent()||[];this.viewer&&this.viewer.dispatchEvent({type:"animationTextselected",data:e}),this.viewer&&this.viewer.dispatchEvent({type:"PurnTextSelect",data:e})},setNameIndex:function(e){this.nameIndex=e},getNameIndex:function(){return this.nameIndex},addTextPoint:function(e){var t=e.x,t=void 0===t?0:t,e=e.y,e=void 0===e?0:e;return this.canAddPoint=!0,this._addTextPoint({x:t,y:e})},delTextPoint:function(t){var i,e=document.querySelector("#"+this.preId+"wrap_"+t);e&&(e.parentNode.removeChild(e),this.viewer&&this.viewer.dispatchEvent({type:"PureTextDelete",data:this.list.filter(function(e){return e.id==t})}),i=[],this.list.forEach(function(e){e.id!=t&&i.push(e)}),this.list=i)},selectTextPoint:function(t){var e=document.querySelector("#"+d+"wrap_"+t);e&&e.style&&e.style.display&&"none"!=e.style.display&&(this.list.forEach(function(e){return e.id==t&&(e.selectStatus="selected")}),this._changeTextareaStatus(t,"selected"))},setFontSize:function(e,t){var i;null!=t&&(i=document.querySelector("#"+this.preId+"textarea_"+e))&&(i.style.fontSize=parseInt(t||0)+"px",i.style.minWidth=parseInt(t||0)+4+"px",this._updateDataList({id:e,style:{fontSize:parseInt(t||0),minWidth:parseInt(t||0)+4}}))},setFontFamily:function(e,t){var i;null!=t&&(i=document.querySelector("#"+this.preId+"textarea_"+e))&&(i.style.fontFamily=t,this._updateDataList({id:e,style:{fontFamily:t}}))},setFontStyle:function(e,t){var i;null!=t&&(i=document.querySelector("#"+this.preId+"textarea_"+e))&&(i.style.fontStyle=t,this._updateDataList({id:e,style:{fontStyle:t}}))},setFontWeight:function(e,t){var i;null!=t&&(i=document.querySelector("#"+this.preId+"textarea_"+e))&&(i.style.fontWeight=t,this._updateDataList({id:e,style:{fontWeight:t}}))},setTextDecoration:function(e,t){var i;null!=t&&(i=document.querySelector("#"+this.preId+"textarea_"+e))&&(i.style.textDecoration=t,this._updateDataList({id:e,style:{textDecoration:t}}))},setFontColor:function(e,t){var i;null!=t&&(i=document.querySelector("#"+this.preId+"textarea_"+e))&&(i.style.color=t,this._updateDataList({id:e,style:{color:t}}))},setOpacity:function(e,t){var i;null!=t&&(i=document.querySelector("#"+this.preId+"textarea_"+e))&&(i.style.opacity=t,this._updateDataList({id:e,style:{opacity:t}}))},setFontHeight:function(e,t){var i;null!=t&&((i=document.querySelector("#"+this.preId+"textarea_"+e)).style.height="auto"==t?i.scrollHeight+"px":t+"px",de(e,i.scrollHeight),setTimeout(function(){i.style.height="auto",setTimeout(function(){i.style.height=i.scrollHeight+"px"},200)},200),this._updateDataList({id:e,style:{height:t}}))},setPosition:function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0);var r=document.querySelector("#"+this.preId+"wrap_"+e);r&&(r.style.left=parseInt(t)+"px",r.style.top=parseInt(i)+"px",this._updateDataList({id:e,position:{x:parseInt(t),y:parseInt(i)}}))},setTextPointShow:function(e,t){void 0===t&&(t=!0);var i=document.querySelector("#"+this.preId+"wrap_"+e),r=t?"block":"none";i&&(i.style.display=r,this._updateDataList({id:e,style:{display:r}},t))},setTextPointName:function(e,t){this._updateDataList({id:e,name:t}),this.viewer&&this.viewer.dispatchEvent({type:"animationTextNameChange",data:{id:e,name:t}})},getTextPointDataById:function(t){return t?l({},this.list.find(function(e){return e.id==t})||null,{selectStatus:"default"}):null},getTextPointAllData:function(){return this.list.map(function(e){return l({},e)})},getTextLabels:function(){return this.list.map(function(e){return{id:e.id,name:e.name,type:r,visible:e.visible,animationID:e.animationID}})},setData:function(e){var t=this;0!==this.list.length&&this.list.forEach(function(e){return t.delTextPoint(e.id)}),this.list=[],this.nameIndex=e.length;for(var i=0;i<e.length;i++){var r=e[i];this._addTextPoint(r.position,l({},r,{selectStatus:"default"}),r.animationID,r.visible),this.viewer&&this.viewer.dispatchEvent({type:"addShowHideTrack",data:{name:r.name,textIds:[r.id],animationID:r.animationID}})}this._clearAllSelectedStatus(),this.viewer&&this.viewer.dispatchEvent({type:"PureTextAdd"})},clickAddPoint:function(){this.canAddPoint=!0,this.mousePopElShow=!0},resetOperate:function(){this.canAddPoint=!1,this.mousePopElShow=!1,this._showMousePopHandler(!1)},setTextPointHighLight:function(e,t){this._changeTextareaStatus(e,t?"selected":"default")},getSelectContent:function(){return this.list.filter(function(e){return"selected"==e.selectStatus})},resetStyle:function(e){this.setFontStyle(e,re),this.setFontWeight(e,ne),this.setTextDecoration(e,oe),this.setFontColor(e,se),this.setFontFamily(e,ie),this.setFontSize(e,te),this.setOpacity(e,le)}},u=window._nd_aniTextPoint=ue;function H(){H=function(){return o};var l,o={},e=Object.prototype,c=e.hasOwnProperty,d=Object.defineProperty||function(e,t,i){e[t]=i.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",i=t.asyncIterator||"@@asyncIterator",n=t.toStringTag||"@@toStringTag";function a(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(l){a=function(e,t,i){return e[t]=i}}function s(e,t,i,r){var n,a,o,s,t=t&&t.prototype instanceof v?t:v,t=Object.create(t.prototype),r=new k(r||[]);return d(t,"_invoke",{value:(n=e,a=i,o=r,s=h,function(e,t){if(s===p)throw Error("Generator is already running");if(s===m){if("throw"===e)throw t;return{value:l,done:!0}}for(o.method=e,o.arg=t;;){var i=o.delegate;if(i){i=function e(t,i){var r=i.method,n=t.iterator[r];if(n===l)return i.delegate=null,"throw"===r&&t.iterator.return&&(i.method="return",i.arg=l,e(t,i),"throw"===i.method)||"return"!==r&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;r=u(n,t.iterator,i.arg);if("throw"===r.type)return i.method="throw",i.arg=r.arg,i.delegate=null,y;n=r.arg;return n?n.done?(i[t.resultName]=n.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=l),i.delegate=null,y):n:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}(i,o);if(i){if(i===y)continue;return i}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(s===h)throw s=m,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);s=p;i=u(n,a,o);if("normal"===i.type){if(s=o.done?m:f,i.arg===y)continue;return{value:i.arg,done:o.done}}"throw"===i.type&&(s=m,o.method="throw",o.arg=i.arg)}})}),t}function u(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}o.wrap=s;var h="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function v(){}function g(){}function _(){}var t={},w=(a(t,r,function(){return this}),Object.getPrototypeOf),w=w&&w(w(T([]))),x=(w&&w!==e&&c.call(w,r)&&(t=w),_.prototype=v.prototype=Object.create(t));function I(e){["next","throw","return"].forEach(function(t){a(e,t,function(e){return this._invoke(t,e)})})}function b(o,s){var t;d(this,"_invoke",{value:function(i,r){function e(){return new s(function(e,t){!function t(e,i,r,n){var a,e=u(o[e],o,i);if("throw"!==e.type)return(i=(a=e.arg).value)&&"object"==typeof i&&c.call(i,"__await")?s.resolve(i.__await).then(function(e){t("next",e,r,n)},function(e){t("throw",e,r,n)}):s.resolve(i).then(function(e){a.value=e,r(a)},function(e){return t("throw",e,r,n)});n(e.arg)}(i,r,e,t)})}return t=t?t.then(e,e):e()}})}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function T(t){if(t||""===t){var i,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return i=-1,(e=function e(){for(;++i<t.length;)if(c.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=l,e.done=!0,e}).next=e}throw new TypeError(typeof t+" is not iterable")}return d(x,"constructor",{value:g.prototype=_,configurable:!0}),d(_,"constructor",{value:g,configurable:!0}),g.displayName=a(_,n,"GeneratorFunction"),o.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,a(e,n,"GeneratorFunction")),e.prototype=Object.create(x),e},o.awrap=function(e){return{__await:e}},I(b.prototype),a(b.prototype,i,function(){return this}),o.AsyncIterator=b,o.async=function(e,t,i,r,n){void 0===n&&(n=Promise);var a=new b(s(e,t,i,r),n);return o.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(x),a(x,n,"Generator"),a(x,r,function(){return this}),a(x,"toString",function(){return"[object Generator]"}),o.keys=function(e){var t,i=Object(e),r=[];for(t in i)r.push(t);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in i)return e.value=t,e.done=!1,e}return e.done=!0,e}},o.values=T,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=l,this.done=!1,this.delegate=null,this.method="next",this.arg=l,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&c.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=l)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var r=this;function e(e,t){return a.type="throw",a.arg=i,r.next=e,t&&(r.method="next",r.arg=l),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t],a=n.completion;if("root"===n.tryLoc)return e("end");if(n.tryLoc<=this.prev){var o=c.call(n,"catchLoc"),s=c.call(n,"finallyLoc");if(o&&s){if(this.prev<n.catchLoc)return e(n.catchLoc,!0);if(this.prev<n.finallyLoc)return e(n.finallyLoc)}else if(o){if(this.prev<n.catchLoc)return e(n.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return e(n.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;0<=i;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&c.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var n=r;break}}var a=(n=n&&("break"===e||"continue"===e)&&n.tryLoc<=t&&t<=n.finallyLoc?null:n)?n.completion:{};return a.type=e,a.arg=t,n?(this.method="next",this.next=n.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),A(i),y}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var i,r,n=this.tryEntries[t];if(n.tryLoc===e)return"throw"===(i=n.completion).type&&(r=i.arg,A(n)),r}throw Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:T(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=l),y}},o}function he(e,t,i,r,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return i(e)}s.done?t(l):Promise.resolve(l).then(r,n)}function h(s){return function(){var e=this,o=arguments;return new Promise(function(t,i){var r=s.apply(e,o);function n(e){he(r,t,i,n,a,"next",e)}function a(e){he(r,t,i,n,a,"throw",e)}n(void 0)})}}function j(e,t){var i,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){{var i;if(e)return"string"==typeof e?fe(e,t):"Map"===(i="Object"===(i={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),i=0,function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function pe(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,function(e){e=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof e?e:e+""}(r.key),r)}}function me(e,t){return(me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var x=new(function(i){function e(){var b,M=i.call(this)||this,_=(M.name="NDSAnimationExtension",console.log("NDSAnimationExtension version 1.0.37"),[]),w=!1,x=[],n=[],I=(M.animationScene=new THREE.Group,M.node_animations=new Map,M.composited_animations=[],M.animationFinish=!1,M.initLables=!1,new THREE.Clock),a=new THREE.AnimationMixer(M.animationScene),A=null,k=0,T=!1,D=M,o=THREE.LoopOnce,E=1,s=1,l=(M._animationData={},M._animationID="",M.relativePath="",new Map),S=0;M.originalFileMap=new Map,M.cameraTrackMap=new Map,M.playlistMap=new Map,M.activeAudio=null,M.imageLabelsMap=new Map,M.textLabelsMap=new Map,M.textIdLabelsMap=new Map,M.id2showHideStatusMap=new Map,M.id2showHideTrackMap=new Map,M.selectedHideTreeBody=[],M._defaultRootUUID=[],M.resetState=!0;return M.endEventMap=new Map,M.AnimationStart=function(e,t){if(void 0===e&&(e=0),Number.isInteger(e)||(e=0),t)for(var i=0;i<x.length;i++)x[i].animationID==t&&(b=x[e=i]);else b=x[e];var r;M.resetState=!1,e>n.length-1||(T=!0,w&&(A&&a&&(a.uncacheAction(A),A=null),(r=n[e]).resetDuration(),a=new THREE.AnimationMixer(b),(A=a.clipAction(r)).loop=o,A.timeScale=E,w=!1,a.addEventListener("finished",function(e){D.dispatchEvent({type:"animationfinished",event:e}),D.animationFinish=!0,s=1}),a.addEventListener("loop",function(e){D.dispatchEvent({type:"animationloop",event:e}),2202==A.loop&&s++,D.activeAudio&&(D.activeAudio.howl.stop(),D.activeAudio=null)})),A.time=S,S=0,A.play(),I.start(),k=0,M.animationFinish=!1,M.viewer.AnimationEdit||M.changeBodyByTime(0),M.viewer.controls.staticAnnotation&&M.viewer.controls.staticAnnotation.SetEnableMove(!1),M.viewer.removeEventListener("updateProgress",M.viewer.onUpdateProgress),M.viewer.render())},M.getAnimations=function(){var i=[];return x.forEach(function(e,t){i[t]=e.name}),i},M.clearAnimations=function(){a.stopAllAction(),n.forEach(function(e){a.uncacheClip(e)}),b&&a.uncacheRoot(b),x=[],n=[],w=!(b=A=null),this._animationData={},_=[],this.node_animations.clear(),l.clear(),this.cameraTrackMap.clear(),this.activeAudio=null},M.AnimationStop=function(e){if((void 0===e&&(e=!0),I.stop(),T=!1,b)&&(M.activeAudio&&(M.activeAudio.howl.stop(),M.activeAudio=null),A&&(t=F(M.playlistMap,A.time,b.animationID))&&t.howl.stop(),S=0,!M.resetState)){if(e){var t={uuids:M._defaultRootUUID||[],imageLabelsMap:M.imageLabelsMap,textLabelsMap:M.textLabelsMap,textIdLabelsMap:M.textIdLabelsMap,id2showHideStatusMap:M.id2showHideStatusMap,id2showHideTrackMap:M.id2showHideTrackMap,time:0,selectedHideTreeBody:M.selectedHideTreeBody};Q(M.viewer,t,b.animationID);for(var i=0,r=b.children.length;i<r;++i){var n=b.children[i],a=M.node_animations.get(n.uuid);n.matrix.copy(a.oriWorldMatrix),n.matrix.decompose(n.position,n.quaternion,n.scale)}b.updateMatrixWorld(!0),b.traverse(function(t){var r,e,i,n,a,o,s,l;t.isMesh&&(i=t.ndsModelId,r=D.viewer.ndsModel.getModelById(i))&&(e=D.node_animations.get(t.uuid).bodyNode)&&(D.viewer.ndsModel.setActiveModelByModelId(i),b.isNDSAnimation?(i=[],n=[],l=b.positionTracksDataMap.get(t.uuid),o=b.rotationTracksDataMap.get(t.uuid),s=b.scaleTracksDataMap.get(t.uuid),l&&((a=l.find(function(e){return 1==e.trackType&&e.modelID[0]+"-"+e.ndsModelId==t.uuid}))&&o&&s&&i.push(a,o,s),n=l.filter(function(e){return 8==e.trackType&&e.modelID[0]+"-"+e.ndsModelId==t.uuid})),(a=q(i,n,0))&&(e.preChangeWorldMatrix?e.preChangeWorldMatrix.copy(e.worldMatrix):e.preChangeWorldMatrix=e.worldMatrix.clone(),e.worldMatrix.copy(a),e.preChangeWorldMatrix)&&((o=new THREE.Matrix4).getInverse(e.preChangeWorldMatrix),o.premultiply(e.worldMatrix),D.viewer.translatePiovt(e.uuid+"-"+e.ndsModel.id,o),(s=new THREE.Matrix4).extractRotation(o),D.viewer.rotateOnlyPiovt(e.uuid+"-"+e.ndsModel.id,s)),(l=b.opacityTracksDataMap.get(t.uuid))&&l.length&&(i=P(e,l,0),D.viewer.setObjectOpacityOnly([e],i,!0)),(n=b.colorTracksDataMap.get(t.uuid))&&(a=R(e,n,0),D.viewer.ndsModel.setActiveModelByModelId(e.ndsModel.id),a)&&D.viewer.changeObjectColor(e.uuid,a,!0,!1,e.ndsModel.id)):e.worldMatrix.copy(t.matrixWorld),e.leafBodyAttri.bodyMeshIds.forEach(function(e){e=r.meshManager.geomId[e];if(-1<e){var t=r.meshManager.geomManager.getGeomFromId(e);if(t.updateModelMatrix=!0,t.aniMorphInfluences)for(var i=0;i<t.aniMorphInfluences.length;i++)t.aniMorphInfluences[i]=0}}),o=e.parent?r.calculateNodeWorldMatrix(e.parent):new THREE.Matrix4,(s=new THREE.Matrix4).getInverse(o),l=e.worldMatrix.clone().premultiply(s),D.viewer.ndsModel.updateNodeMatrix(e.uuid,l.toArray(),e.getModel().id))});e=D.cameraTrackMap.get(b.animationID);if(e&&(t=U(e,0))&&t.position&&t.up&&(M.viewer.camera.position.copy(t.position),M.viewer.camera.up.copy(t.up),M.viewer.camera.target.copy(t.target),M.viewer.camera.setCameraTarget(M.viewer.camera.getCameraTarget()),M.viewer.camera.updateProjectionMatrix(),M.viewer.camera.updateMatrixWorld(!0),M.viewer.viewBox)&&M.viewer.cameraControl.updateViewBoxCamDir(),b.textOpacityTracksDataMap&&b.textOpacityTracksDataMap.size)for(var o=j(b.textOpacityTracksDataMap);!(s=o()).done;){var s=s.value,l=s[0],s=s[1],c=C(s,0);"number"==typeof c&&(-1<s.findIndex(function(e){return"text"==e.type})?D.viewer.textAnimationOp("setOpacity",l,c):D.viewer.setTransparent(l,c))}if(b.textImgId2PositionMap&&b.textImgId2PositionMap.size)for(var d=j(b.textImgId2PositionMap);!(u=d()).done;){var u=u.value,h=u[0],u=u[1],f=z(u,0);f&&D.viewer.controls.staticAnnotation&&("pic"==u.type&&(f=N(f.x,f.y,D.viewer)),D.viewer.controls.staticAnnotation)&&D.viewer.controls.staticAnnotation.setTextLineImgPosition&&D.viewer.controls.staticAnnotation.setTextLineImgPosition(h,f),f&&"text"==u.type&&(f=N(f.x,f.y,M.viewer),D.viewer.textAnimationOp("setPosition",h,f.x,f.y))}if(b.textLineColorTracksDataMap&&b.textLineColorTracksDataMap.size)for(var p=j(b.textLineColorTracksDataMap);!(v=p()).done;){var m,y,v=v.value,g=v[0],v=v[1];"text"==v.type?(m=B(L(v,"colors",0)),D.viewer.textAnimationOp("setFontColor",g,m)):(m=L(v,"colors",0),v=L(v,"lineColors",0),y=B(m),v=B(v),D.viewer.setNoteColor(g,y),D.viewer.setNoteLineColor(g,v))}D.viewer.controls.setBoundingBox(D.viewer.modelRootObject.boundingBox.min,D.viewer.modelRootObject.boundingBox.max),D.viewer.switchRotateCenterBySelection()}w=!0,k=0,M.viewer.controls.staticAnnotation&&M.viewer.controls.staticAnnotation.SetEnableMove(!0),M.viewer.addEventListener("updateProgress",M.viewer.onUpdateProgress,!1),M.viewer.render()}},M.AnimationPause=function(){var e;I.stop(),T=!1,M.activeAudio&&(M.activeAudio.howl.stop(),M.activeAudio=null),A&&(e=F(M.playlistMap,A.time,b.animationID))&&e.howl.playing()&&e.howl.stop(),M.viewer.controls.staticAnnotation&&M.viewer.controls.staticAnnotation.SetEnableMove(!0),M.viewer.render()},M.AnimationContinue=function(){S&&A&&(A.time=S,S=0),M.activeAudio&&(M.activeAudio.howl.stop(),M.activeAudio=null),I.start(),T=!0,M.viewer.controls.staticAnnotation&&M.viewer.controls.staticAnnotation.SetEnableMove(!1),M.viewer.render()},M.isrunning=function(){return T},M.getCurrentTime=function(){return k},M.setTimeScale=function(e){E=e,A&&(A.timeScale=E),A&&(e=F(M.playlistMap,A.time,b.animationID))&&e.howl.rate(E),w=!0,M.viewer.render()},M.setLoopType=function(e){2!=e&&(s=1),o=e+THREE.LoopOnce,A&&(A.loop=o),w=!0,M.viewer.render()},M.getLoopTime=function(e){return e>n.length-1?-1:x[e].loopTime},M.addLablels=function(e){var i,r,n,t,a,o,s,l,c,d,u;this.initLables||(this.initLables=!0,NDSWebViewer.SETTING.HideLeafBody&&this.viewer.ndsModel.unmergeNode(),!this.viewer.AnimationEdit&&e.textLabels&&e.textLabels.length&&(t=e.textLabels,t=t,i=this.textLabelsMap,r=this.viewer,n=!1,Array.isArray(t))&&t.length&&t.forEach(function(e){var t;i.has(e.id)||(t=v({},e,{interPnt:(new THREE.Vector3).fromArray(e.interPnt),projPt:(new THREE.Vector3).fromArray(e.projPt)}),i.set(e.id,t),t=i.get(e.id),r.setNoteAnnotation(t),r.setPicTextVisible(e.id,!!n))}),!this.viewer.AnimationEdit&&e.imageLabels&&e.imageLabels.length&&(t=e.imageLabels,l=t,a=this.imageLabelsMap,o=this.viewer,s=!1,Array.isArray(l))&&l.length&&l.forEach(function(e){a.has(e.id)||(a.set(e.id,e),o.setPicAnnotation(e),o.setPicTextVisible(e.id,!!s))}),!this.viewer.AnimationEdit&&e.textIdLabels&&e.textIdLabels.length&&(l=e.textIdLabels,e=l,c=this.textIdLabelsMap,d=this.viewer,u=!1,Array.isArray(e))&&e.length&&(d.textAnimationOp("init",d),d.textAnimationOp("setData",e),e.forEach(function(e){c.has(e.id)||c.set(e.id,e),d.textAnimationOp("setTextPointShow",e.id,!!u),u&&d.textAnimationOp("setFontHeight",e.id,e.style.height)})),NDSWebViewer.SETTING.HideLeafBody&&this.viewer.ndsModel.mergeNode())},M.switchAnnimation=function(){var i=h(H().mark(function e(t,i){var r,n,a,o,s,l,c,d,u,h;return H().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.resetAnimationState(),e.next=3,this.resetAnimationModel(t,i);case 3:for(r=0;r<x.length;r++)x[r].animationID==t&&(b=x[r]);for(n=j(this.textLabelsMap);!(a=n()).done;)a=a.value,o=a[0],a[1].animationID!=t&&this.viewer.setPicTextVisible(o,!1);for(s=j(this.imageLabelsMap);!(l=s()).done;)l=l.value,c=l[0],l[1].animationID!=t&&this.viewer.setPicTextVisible(c,!1);for(d=j(this.textIdLabelsMap);!(u=d()).done;)u=u.value,h=u[0],u[1].animationID!=t&&this.viewer.textAnimationOp("setTextPointShow",h,!1);this.changeBodyByTime(0);case 8:case"end":return e.stop()}},e,this)}));return function(e,t){return i.apply(this,arguments)}}(),M.preparAnimationFile=function(e){if(e.models&&0<e.models.length)for(var t=0;t<e.models.length;t++){var i,r=e.models[t];0!=r.modelId&&r.animationId&&(r=r.animationId,M.originalFileMap.has(r)||(i=function(e,t){var i=[];if(e&&0<e.length)for(var r=0;r<e.length;++r){var n=e[r];n.animationId==t&&i.push(n)}return i}(e.models,r),M.originalFileMap.set(r,i)))}},M.resetAnimationModel=function(){var i=h(H().mark(function e(t,i){var r,n,a,o,s,l,c,d;return H().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("-resetAnimationModel eventID:",i),5!=D.viewer.getRenderMode()&&D.viewer.setRenderMode("shaded"),NDSWebViewer.SETTING.HideLeafBody&&M.viewer.ndsModel.unmergeNode(),M._animationID=t,r=M.originalFileMap.get(t),M.originalFileMap.has(t)&&M.originalFileMap.delete(t),n=[],r&&0<r.length){for(a=0;a<r.length;a++)0==(o=r[a]).modelId||M.viewer.ndsModel.getModelById(o.modelId)||n.push(o);if(n&&0<n.length)return e.next=13,M.addLoadAnimationFile(n,i)}e.next=13;break;case 13:if((s=M.viewer.ndsModel.models)&&1<s.length)for(l=1;l<s.length;l++)(c=s[l])&&c.rootBodyNode&&(d=c.rootBodyNode.uuid+"-"+c.rootBodyNode.ndsModel.id,c.animationId==t?M.setAnimationModelShowHide(d,!0):0!=c.id&&M.setAnimationModelShowHide(d,!1));n&&0<n.length||(D.endCallBack&&D.endCallBack(i),console.log("this.endCallBack--00 eventID:",i));case 16:case"end":return e.stop()}},e)}));return function(e,t){return i.apply(this,arguments)}}(),M.endCallBack=function(e){console.log("this.endCallBack--01 eventID:",e),this.endEventMap.has(e)&&(console.log("this.endCallBack--02 eventID:",e),e=this.endEventMap.get(e))&&e()},M.addEndEvent=function(e,t){this.endEventMap.set(e,t)},M.clearEndEvent=function(){this.endEventMap.clear()},M.loadAnimationFile=function(){var t=h(H().mark(function e(t){var i,r,n,a,o;return H().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=[],e.prev=1,r=0;case 3:r<t.length?0!=(n=t[r]).modelId?e.next=9:(n.unload=!1,e.next=30):e.next=34;break;case 9:return e.next=11,fetch(n.url);case 11:(a=e.sent).ok?e.next=17:(i.push(n),n.unload=!1,e.next=30);break;case 17:return o=null,e.prev=18,e.next=21,a.json();case 21:o=e.sent,e.next=29;break;case 24:return e.prev=24,e.t0=e.catch(18),i.push(n),n.unload=!1,e.abrupt("continue",31);case 29:o&&o.metadata?n.unload=!0:(i.push(n),n.unload=!1);case 30:M.viewer.prepareLoadModels.push(n);case 31:r++,e.next=3;break;case 34:e.next=39;break;case 36:e.prev=36,e.t1=e.catch(1),console.error("在请求过程中发生错误:",e.t1);case 39:0<i.length&&M.viewer.dispatchEvent({type:"AnimationFailedFiles",Modelfiles:i});case 40:case"end":return e.stop()}},e,null,[[1,36],[18,24]])}));return function(e){return t.apply(this,arguments)}}(),M.addLoadAnimationFile=function(){var i=h(H().mark(function e(t,i){var r;return H().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=M).viewer.prepareLoadModels=[],e.next=4,M.loadAnimationFile(t);case 4:return e.abrupt("return",new Promise(function(e){M.viewer.prepareLoadModels&&0<M.viewer.prepareLoadModels.length?(M.loadAnimationFileEnd=function(){setTimeout(function(){r.endCallBack&&r.endCallBack(i)},0),e()},M.viewer.removeEventListener("AnimatioModelLoadEnd",M.loadAnimationFileEnd),M.viewer.addEventListener("AnimatioModelLoadEnd",M.loadAnimationFileEnd,!1),M.viewer.startLoadAnimationModel()):(r.endCallBack&&r.endCallBack(i),e())}));case 5:case"end":return e.stop()}},e)}));return function(e,t){return i.apply(this,arguments)}}(),M.checkTime0Camera=function(e){e=M.cameraTrackMap.get(e);if(e){e=U(e,0);if(e&&e.position&&e.up)return}M.viewer.zoomExtents(!0,!1)},M.addAnimation=function(c,e){NDSWebViewer.SETTING.HideLeafBody&&M.viewer.ndsModel.unmergeNode(),M.originalFileMap.size<1&&M.preparAnimationFile(e);var d=new Map,u=new Map,h=new Map,f=new Map,p=new Map,m=new Map,y=new Map,v=new Map;(b=new THREE.Group).name=c.name,b.isNDSAnimation=c.isNDSAnimation,b.positionTracksDataMap=d,b.opacityTracksDataMap=u,b.textOpacityTracksDataMap=h,b.textImgId2PositionMap=p,b.textLineColorTracksDataMap=f,b.colorTracksDataMap=m,b.rotationTracksDataMap=y,b.scaleTracksDataMap=v,b.animationID=c.animationID;for(var t=0;t<c.tracks.length;++t){var g=c.tracks[t].trackID;e.tracks.forEach(function(e){if(e.trackID==g){var t=e.ndsModelId?parseInt(e.ndsModelId):0;if(1==e.trackType||8==e.trackType)D.addKeyFrameTrack(e,"position",e.times,e.translations),d.has(e.modelID[0]+"-"+t)?d.get(e.modelID[0]+"-"+t).push(e):d.set(e.modelID[0]+"-"+t,[e]);else if(2==e.trackType)D.addKeyFrameTrack(e,"quaternion",e.times,e.rotations),y.has(e.modelID[0]+"-"+t)||y.set(e.modelID[0]+"-"+t,e);else if(3==e.trackType)D.addKeyFrameTrack(e,"scale",e.times,e.scales),v.has(e.modelID[0]+"-"+t)||v.set(e.modelID[0]+"-"+t,e);else if(4==e.trackType)D.addKeyFrameTrack(e,"material.color",e.times,b.isNDSAnimation?e.colors.map(function(e){return 0}):e.colors),m.has(e.modelID[0]+"-"+t)||m.set(e.modelID[0]+"-"+t,e);else if(5==e.trackType||7==e.trackType)D.addKeyFrameTrack(e,"material.opacity",e.times,e.opacities),u.has(e.modelID[0]+"-"+t)?u.get(e.modelID[0]+"-"+t).push(e):u.set(e.modelID[0]+"-"+t,[e]);else if(6==e.trackType)e.times.length&&e.cameras.length&&(D.addKeyFrameTrack(e,"position",e.times,e.cameras),D.cameraTrackMap.set(b.animationID,e));else if(9==e.trackType){if(e.times.length&&e.src.length){var i=!1;if(D.playlistMap.size)for(var r=j(D.playlistMap);!(n=r()).done;){var n=n.value,a=n[0];n[1];0<=a.indexOf(String(c.animationID))&&(i=!0)}D.addKeyFrameTrack(e,"material.opacity",e.times,e.times),i||(o=D.playlistMap,s=e,l=D.relativePath,s.src.forEach(function(e,t){var i=s.srcKeys[t],r={srcKey:i,src:l+e,howl:null};o.set(s.animationID+"-"+i,r),r.howl=new O.Howl({src:[l+e],html5:!0,usingWebAudio:!0,onplay:function(){console.log("播放开始")},onload:function(){var e=r.howl.duration();r.startTime=s.times[2*t],r.endTime=s.times[2*t]+e,r.duration=e},onend:function(){console.log("播放结束")},onloaderror:function(e,t){console.log("read load error:",e,t)},onplayerror:function(e,t){console.log("read play error:",e,t)}})}))}}else 10==e.trackType?e.morphTargetInfluences&&e.morphTargetInfluences.length&&D.addKeyFrameTrack(e,"morphTargetInfluences",e.times,e.morphTargetInfluences):11==e.trackType||12==e.trackType?(D.addKeyFrameTrack(e,"material.opacity",e.times,e.opacities),h.has("text"!=e.type?e.textImgId:e.textId)?h.get("text"!=e.type?e.textImgId:e.textId).push(e):h.set("text"!=e.type?e.textImgId:e.textId,[e])):13==e.trackType?(D.addKeyFrameTrack(e,"material.color",e.times,e.colors),f.has("text"!=e.type?e.textImgId:e.textId)||f.set("text"!=e.type?e.textImgId:e.textId,e)):17==e.trackType?p.set(e.textImgId||e.textId,e):14==e.trackType?(e.times.length&&D.addKeyFrameTrack(e,"material.opacity",e.times,e.times),D.id2showHideTrackMap.set(c.animationID+"-"+e.htmlUUIDS[0],e),D._defaultRootUUID.includes(e.htmlUUIDS[0])||D._defaultRootUUID.push(e.htmlUUIDS[0])):15==e.trackType?(e.times.length&&D.addKeyFrameTrack(e,"material.opacity",e.times,e.times),D.id2showHideTrackMap.set(e.textImgId,e)):16==e.trackType&&(e.times.length&&D.addKeyFrameTrack(e,"material.opacity",e.times,e.times),D.id2showHideTrackMap.set(e.textId,e))}var o,s,l})}l.set(c.animationID,_);var i=new THREE.AnimationClip(c.name,_.length,_.concat());i.resetDuration(),n.push(i),b.loopTime=i.duration;for(var r=0;r<x.length;r++)if(x[r].animationID==b.animationID){x[r]=b,b=null;break}b&&x.push(b),_=[],w=!(b=null),NDSWebViewer.SETTING.HideLeafBody&&!M._animationID&&M.viewer.ndsModel.mergeNode()},M.addMorphAnimation=function(e,o){for(var s=M,t=(NDSWebViewer.SETTING.HideLeafBody&&M.viewer.ndsModel.unmergeNode(),new Map),i=0;i<e.tracks.length;i++){var r=e.tracks[i];if(r.deformation){var n=r.modelID[0],n=s.viewer.ndsModel.getBodyNodeFromUuid(n);if(!n)return;n=s.viewer.ndsModel.getLeafBodies(n);if(n&&n[0].leafBodyAttri){for(var n=n[0].leafBodyAttri.bodyMeshIds[0],a=[],l=[],c=r.deformation,d=0;d<c.length;d++)for(var l=l.concat(c[d].targetShapeIds),u=0;u<c[d].targetShapeIds.length;u++)a.push(c[d].frames[u]);t.set(n,l),r.morphTargetInfluences=[];for(var h=0;h<r.times.length;h++)for(var f=0;f<a.length;f++)r.morphTargetInfluences.push(a[f][h])}}}t.forEach(function(e,t){t=s.viewer.ndsModel.meshManager.geomId[t];if(-1<t){var i=s.viewer.ndsModel.geomManager.getGeomFromId(t);i.morphAttributes.position=[];for(var r=0;r<e.length;r++)i.morphAttributes.position.push(new THREE.BufferAttribute(o[e[r]].position,3));for(var n=[],a=0;a<e.length;a++)n.push(new THREE.BufferAttribute(o[e[a]].normal,3));0<n.length&&(i.morphAttributes.normal=n)}})},M.addKeyFrameTrack=function(s,e,t,i,r){var l=s.ndsModelId?parseInt(s.ndsModelId):0,n=14==s.trackType?s.bodyUuid:s.modelID[0],c=(14==s.trackType&&(l=0),M.viewer.ndsModel.getModelById(l));if(c){if(!M.node_animations.has(n+"-"+l)){var a=c.getBodyNodeFromUuid(n);if(!a)return;M.node_animations.set(n+"-"+l,{bodyNode:a,oriMatrix:a.matrix?(new THREE.Matrix4).fromArray(a.matrix):null,oriWorldMatrix:a.worldMatrix?a.worldMatrix.clone():c.calculateNodeWorldMatrix(a)});for(var o=c.getLeafBodies(a),d=0,u=o.length;d<u;d++)o[d].leafBodyAttri&&M.node_animations.set(o[d].uuid+"-"+l,{bodyNode:o[d],oriMatrix:o[d].matrix?(new THREE.Matrix4).fromArray(o[d].matrix):null,oriWorldMatrix:o[d].worldMatrix?o[d].worldMatrix.clone():c.calculateNodeWorldMatrix(o[d])})}var h,f,p,m,y,a=M.node_animations.get(n+"-"+l),v=(b.getObjectByProperty("uuid",n+"-"+l)||(h=a.bodyNode,(f=new THREE.Group).uuid=h.uuid+"-"+l,f.applyMatrix(a.oriWorldMatrix),p=function e(t,i){for(var r=0;r<t.children.length;r++){var n,a,o=t.children[r];o.leafBodyAttri?((n=new THREE.Object3D).isMesh=!0,n.ndsModelId=l,n.uuid=o.uuid+"-"+l,o.matrix&&(n.matrix.fromArray(o.matrix),n.matrix.decompose(n.position,n.quaternion,n.scale)),(a=o.leafBodyAttri.bodyMeshIds).length&&(a=c.meshManager.materialId[a[0]],n.material=c.meshManager.mats[a]&&c.meshManager.mats[a].clone()),n.animationID=s.animationID,i.add(n)):((a=new THREE.Group).uuid=o.uuid,o.matrix&&(a.matrix.fromArray(o.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale)),i.add(a),0<o.children.length&&e(o,a))}},0==h.children.length?((m=new THREE.Mesh).isMesh=!0,m.uuid=h.uuid+"-"+l,m.ndsModelId=l,h.leafBodyAttri&&((v=h.leafBodyAttri.bodyMeshIds).length&&(y=c.meshManager.materialId[v[0]],m.material=c.meshManager.mats[y]&&c.meshManager.mats[y].clone()),-1<(y=c.meshManager.geomId[v[0]])&&(m.geometry=c.geomManager.getGeomFromId(y),m.updateMorphTargets(),m.geometry.aniMorphInfluences=m.morphTargetInfluences,m.geometry.aniMorphDictionary=m.morphTargetDictionary),m.animationID=s.animationID,m.applyMatrix(a.oriWorldMatrix),b.add(m))):(p(h,f),b.add(f)),b.updateMatrixWorld(!0)),null);"position"===e||"scale"===e?v=new THREE.VectorKeyframeTrack(n+"-"+l+"."+e,t,i,r):"quaternion"===e?v=new THREE.QuaternionKeyframeTrack(n+"-"+l+"."+e,t,i,r):"material.color"===e?v=new THREE.ColorKeyframeTrack(n+"-"+l+"."+e,t,i,r):"material.opacity"!==e&&"morphTargetInfluences"!==e||(v=new THREE.NumberKeyframeTrack(n+"-"+l+"."+e,t,i,r)),_.push(v),w=!0}},M.update=function(){var e;T&&b&&(e=I.getDelta(),k+=e=.2<e?.001:e,a&&a.update(e),A)&&(M.dispatchEvent({type:"animationTime",time:A.time%b.loopTime}),e=s%2==0?b.loopTime-A.time:A.time,b.updateMatrixWorld(!0),M.changeBodyByTime(e),M.animationFinish&&o==THREE.LoopOnce&&(M.AnimationStop(),M.dispatchEvent({type:"animationTime",time:0}),M.viewer.AnimationEdit)&&M.viewer.AnimationEdit.changeBodyNodeMatrix(0),M.viewer.render())},M.resetAnimationStartTime=function(e){S=e},M.changeBodyByTime=function(d){this.viewer.controls.staticAnnotation&&(this.viewer.controls.staticAnnotation.useOffsetMatrix=!0);var u=this;if(this._animationID&&(!b||b.animationID!=this._animationID))for(var e=0;e<x.length;e++)x[e].animationID==this._animationID&&(b=x[e]);if(b){var t={uuids:this._defaultRootUUID||[],imageLabelsMap:this.imageLabelsMap,textLabelsMap:this.textLabelsMap,textIdLabelsMap:this.textIdLabelsMap,id2showHideStatusMap:this.id2showHideStatusMap,id2showHideTrackMap:this.id2showHideTrackMap,time:d,selectedHideTreeBody:this.selectedHideTreeBody},h=(Q(this.viewer,t,b.animationID),this.id2showHideStatusMap.get(this._defaultRootUUID));if(null==h&&(h=!0),b.traverse(function(t){if(t.isMesh){var e=t.ndsModelId,i=u.viewer.ndsModel.getModelById(e),r=u.node_animations.get(t.uuid).bodyNode;if(u.viewer.ndsModel.setActiveModelByModelId(e),b.isNDSAnimation){if(!h)return!0;var n=[],a=[],o=b.positionTracksDataMap.get(t.uuid),s=b.rotationTracksDataMap.get(t.uuid),l=b.scaleTracksDataMap.get(t.uuid),c=(o&&((c=o.find(function(e){return 1==e.trackType&&e.modelID[0]+"-"+e.ndsModelId==t.uuid}))&&s&&l&&n.push(c,s,l),a=o.filter(function(e){return 8==e.trackType&&e.modelID[0]+"-"+e.ndsModelId==t.uuid})),q(n,a,d)),c=(c&&(r.preChangeWorldMatrix?r.preChangeWorldMatrix.copy(r.worldMatrix):r.preChangeWorldMatrix=r.worldMatrix.clone(),r.worldMatrix.copy(c),r.preChangeWorldMatrix&&((s=new THREE.Matrix4).getInverse(r.preChangeWorldMatrix),s.premultiply(r.worldMatrix),u.viewer.translatePiovt(r.uuid+"-"+r.ndsModel.id,s),(l=new THREE.Matrix4).extractRotation(s),u.viewer.rotateOnlyPiovt(r.uuid+"-"+r.ndsModel.id,l)),r.leafBodyAttri.bodyMeshIds.forEach(function(e){var e=i.meshManager.geomId[e];-1<e&&((e=i.meshManager.geomManager.getGeomFromId(e)).needsUpdate=!0,e.updateModelMatrix=!0)}),o=r.parent?i.calculateNodeWorldMatrix(r.parent):new THREE.Matrix4,(n=new THREE.Matrix4).getInverse(o),a=r.worldMatrix.clone().premultiply(n),u.viewer.ndsModel.updateNodeMatrix(r.uuid,a.toArray(),r.getModel().id)),b.opacityTracksDataMap.get(t.uuid)),l=(c&&c.length&&(s=P(r,c,d),i.transparentBodyChanged=!0,u.viewer.setObjectOpacityOnly([r],s,!0)),b.colorTracksDataMap.get(t.uuid));l&&(o=R(r,l,d))&&u.viewer.changeObjectColor(r.uuid,o,!0,!1,e)}else r.worldMatrix.copy(t.matrixWorld),r.matrix=t.matrix.toArray().slice(0),t.material.color&&u.viewer.changeObjectColor(r.uuid,Z(t.material.color),!1,!1,e),t.opacity&&u.viewer.setObjectOpacityOnly([r],t.opacity)}}),b.textOpacityTracksDataMap&&b.textOpacityTracksDataMap.size)for(var i=j(b.textOpacityTracksDataMap);!(n=i()).done;){var r,n=n.value,a=n[0],n=n[1];u.id2showHideStatusMap.get(a)&&"number"==typeof(r=C(n,d))&&(-1<n.findIndex(function(e){return"text"==e.type})?u.viewer.textAnimationOp("setOpacity",a,r):u.viewer.setTransparent(a,r))}if(b.textLineColorTracksDataMap&&b.textLineColorTracksDataMap.size)for(var o=j(b.textLineColorTracksDataMap);!(c=o()).done;){var s,l,c=c.value,f=c[0],c=c[1];u.id2showHideStatusMap.get(f)&&("text"==c.type?(s=B(L(c,"colors",d)),u.viewer.textAnimationOp("setFontColor",f,s)):(s=L(c,"colors",d),c=L(c,"lineColors",d),l=B(s),c=B(c),u.viewer.setNoteColor(f,l),u.viewer.setNoteLineColor(f,c)))}var p,t=u.cameraTrackMap.get(b.animationID),t=(t&&(t=U(t,d))&&t.position&&t.up&&(this.viewer.camera.position.copy(t.position),this.viewer.camera.up.copy(t.up),this.viewer.camera.target.copy(t.target),this.viewer.camera.setCameraTarget(this.viewer.camera.getCameraTarget()),this.viewer.camera.updateProjectionMatrix(),this.viewer.camera.updateMatrixWorld(!0),this.viewer.viewBox&&this.viewer.cameraControl.updateViewBoxCamDir(),t.device&&t.projectionMatrixInverse&&((p=new THREE.Vector3).copy(t.device).applyMatrix4(t.projectionMatrixInverse).applyMatrix4(this.viewer.camera.matrixWorld),t=new THREE.Vector3(0,0,t.device.z).applyMatrix4(t.projectionMatrixInverse).applyMatrix4(this.viewer.camera.matrixWorld),t=(new THREE.Vector3).copy(t).sub(p),this.viewer.camera.position.add(t),this.viewer.camera.target.add(t)),p={center:this.viewer.camera.target,up:this.viewer.camera.up,position:this.viewer.camera.position},this.viewer.cameraControl.adjustNearAndFar(),this.viewer.startSmoothTranslation(p)),F(this.playlistMap,d,b.animationID));if(!T||!t||this.activeAudio&&this.activeAudio.srcKey==t.srcKey||t.howl.playing()||(this.activeAudio&&this.activeAudio.howl.stop(),t.howl.seek(d-t.startTime),t.howl._rate!=E&&t.howl.rate(E),t.howl.play(),this.activeAudio=t),b.textImgId2PositionMap&&b.textImgId2PositionMap.size)for(var m=j(b.textImgId2PositionMap);!(v=m()).done;){var y,v=v.value,g=v[0],v=v[1];this.id2showHideStatusMap.get(g)&&((y=z(v,d))&&u.viewer.controls.staticAnnotation&&("pic"==v.type&&(y=N(y.x,y.y,u.viewer)),u.viewer.controls.staticAnnotation.setTextLineImgPosition(g,y)),y&&"text"==v.type&&(y=N(y.x,y.y,this.viewer),u.viewer.textAnimationOp("setPosition",g,y.x,y.y)),u.viewer.controls.staticAnnotation)&&u.viewer.controls.staticAnnotation.setTextLineImgPosition&&u.viewer.controls.staticAnnotation.setTextLineImgPosition(g,y)}this.viewer.ndsModel.models.forEach(function(e){e.forceRenderAll=!0})}},M.unloadAnimationModel=function(){M.resetAnimationState(),NDSWebViewer.SETTING.HideLeafBody&&D.viewer.ndsModel.mergeNode();var e=M._animationData;M.preparAnimationFile(M._animationData),M._animationData=e;for(var t,i=M.viewer.ndsModel.models.length-1;0<i;i--)M.viewer.unloadAnimationModel(i);M.viewer.controls.staticAnnotation&&(t=[],M.viewer.controls.staticAnnotation.TextContents.forEach(function(e){e.AnimationEdit&&t.push(e.id)}),M.viewer.controls.staticAnnotation.PicContents.forEach(function(e){e.AnimationEdit&&t.push(e.id)}),M.viewer.controls.staticAnnotation.deleteNoteAnnotation(t,!1),M.initLables=!1,M.textLabelsMap.clear(),M.imageLabelsMap.clear()),D.viewer.CADViewer&&(e=new THREE.Vector3,r=new THREE.Vector3,D.viewer.computeBoundingBox(D.viewer.scene,e,r,{},void 0,!0),D.viewer.controls.setBoundingBox(e,r)),M.viewer.zoomExtents(!0,!0);var r,e=M.viewer.ndsModel.models;1==M.viewer.ndsModel.models.length&&(r=e[0])&&r.rootBodyNode&&(e=r.rootBodyNode.uuid+"-"+r.rootBodyNode.ndsModel.id,M.setAnimationModelShowHide(e,!0)),M.viewer.render()},M.resetAnimationState=function(){if(D.resetState=!0,D.viewer.removeEventListener("AnimationLoaded",M.AnimationStart),b&&b.isNDSAnimation){M.viewer.controls.staticAnnotation&&(M.viewer.controls.staticAnnotation.useOffsetMatrix=!0);for(var e=0,t=b.children.length;e<t;++e){var i=b.children[e],r=D.node_animations.get(i.uuid);i.matrix.copy(r.oriWorldMatrix),i.matrix.decompose(i.position,i.quaternion,i.scale)}b.updateMatrixWorld(!0),b.traverse(function(e){var t,i,r;e.isMesh&&(r=e.ndsModelId,t=D.viewer.ndsModel.getModelById(r))&&(i=D.node_animations.get(e.uuid).bodyNode)&&(D.viewer.ndsModel.setActiveModelByModelId(r),i.worldMatrix.copy(e.matrixWorld),i.leafBodyAttri.bodyMeshIds.forEach(function(e){e=t.meshManager.geomId[e];-1<e&&(t.meshManager.geomManager.getGeomFromId(e).updateModelMatrix=!0)}),r=i.parent?t.calculateNodeWorldMatrix(i.parent):new THREE.Matrix4,(e=new THREE.Matrix4).getInverse(r),r=i.worldMatrix.clone().premultiply(e),D.viewer.ndsModel.updateNodeMatrix(i.uuid,r.toArray(),i.getModel().id),D.viewer.setObjectOpacityOnly([i]),D.viewer.ndsModel.setActiveModelByModelId(i.ndsModel.id),D.viewer.changeObjectColor(i.uuid,null,!1,!1,i.ndsModel.id))});var n=M.viewer.ndsModel.getAllTransparentBodies(!0),a=(M.viewer.ndsModel.isolateBodiesOnly(n),M.viewer),o=!1,s=M.imageLabelsMap,l=M.textLabelsMap,c=M.textIdLabelsMap,d=a.getallPicContent();if(Array.isArray(d))for(var u=0;u<d.length;u++){var h=d[u],h=(h.state||h).id;s.has(h)&&a.setPicTextVisible(h,o)}var f=a.getAllNoteContent();if(Array.isArray(f))for(var p=0;p<f.length;p++){var m=f[p],m=(m.state||m).id;l.has(m)&&a.setPicTextVisible(m,o)}var y=a.textAnimationOp("getTextPointAllData");if(Array.isArray(y))for(var v=0;v<y.length;v++){var g=y[v],_=g.id;c.has(_)&&(a.textAnimationOp("setTextPointShow",_,o),o)&&a.textAnimationOp("setFontHeight",_,g.style.height)}if(D.viewer.controls.setBoundingBox(D.viewer.modelRootObject.boundingBox.min,D.viewer.modelRootObject.boundingBox.max),D.viewer.CADViewer){for(var w=1;w<D.viewer.ndsModel.models.length;w++){var x=D.viewer.ndsModel.models[w];x&&x.rootBodyNode&&x.hideBody(x.rootBodyNode)}var n=new THREE.Vector3,I=new THREE.Vector3;D.viewer.computeVisibleBoundingBox(D.viewer.scene,n,I,{},void 0,!0),D.viewer.controls.setBoundingBox(n,I)}D.viewer.switchRotateCenterBySelection(),D.viewer.render()}},M.textAnimationOp=function(e){if(u[e]){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return u[e].apply(u,i)}},M.setTextPointShow=function(e,t){var i=M.textIdLabelsMap.get(e);if(i&&(i.visible=t),u.setTextPointShow)return u.setTextPointShow(e,t)},M.getTextAnimationObject=function(){return u},M}t=i,(n=e).prototype=Object.create(t.prototype),me(n.prototype.constructor=n,t);var t,r,n=e.prototype;return n.overrideValue=function(e,t){i.prototype.overrideValue.call(this,this.currentTypeName,e,t)},n.overrideFunction=function(e,t){i.prototype.overrideFunction.call(this,this.currentTypeName,e,t)},n.overridePrototype=function(e){i.prototype.overridePrototype.call(this,this.currentTypeName,e)},n.load=function(e){var a;this.viewer||(i.prototype.load.call(this,e),this.viewer=e,this.viewer.zip||(e=new $.a,this.viewer.zip=e),this.currentTypeName="",a=(e=this).viewer,e.getAnimationCamera=function(){var e=a.camera.position,t=a.camera.up,i=a.camera.target;return{position:{x:e.x,y:e.y,z:e.z},up:{x:t.x,y:t.y,z:t.z},target:{x:i.x,y:i.y,z:i.z}}},e.setAnimationCamera=function(e){e&&e.position&&e.up&&e.target&&(a.camera.position.set(e.position.x,e.position.y,e.position.z),a.camera.up.set(e.up.x,e.up.y,e.up.z),a.camera.target.set(e.target.x,e.target.y,e.target.z),a.camera.setCameraTarget(a.camera.getCameraTarget()),a.camera.updateProjectionMatrix(),a.camera.updateMatrixWorld(!0),a.render())},e.setAnimationModelShowHide=function(e,t){var i,r=e.lastIndexOf("-");0<r&&(i=e.slice(0,r),e=e.slice(r+1),r=a.ndsModel.getModelById(e))&&(e=r.bodyUuid2NodeMap[i])&&(t?a.ndsModel.showBody(e):a.ndsModel.hideBody(e),a.render())},e.getTotalBodyBoundingBox=function(r){var n=new THREE.Box3;return a.ndsModel.models.forEach(function(e,t){if(e.sketchFileUrl)return!0;var i;0!=t&&e.animationId!=r||(i=e.rootBodyNode?e.getBodyBoundingBox(e.rootBodyNode):i)&&n.union(i)}),n},Object.defineProperty(this.viewer.ndsModel,"forceRenderAll",{get:function(){return!1},set:function(){}}))},n.unload=function(e){i.prototype.unload.call(this,e)},t=e,(n=[{key:"animationData",get:function(){return this._animationData},set:function(e){var t=e.isInit,e=e.data;this._animationData=e,t&&this.dispatchEvent({type:"animationDatafinished",animationData:e})}}])&&pe(t.prototype,n),r&&pe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(NDSWebViewer.Extension));function ye(e){throw new TypeError('"'+e+'" is read-only')}function T(){return(T=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)!{}.hasOwnProperty.call(r,i)||(e[i]=r[i])}return e}).apply(null,arguments)}function G(e,t){var i,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){{var i;if(e)return"string"==typeof e?ve(e,t):"Map"===(i="Object"===(i={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ve(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),i=0,function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function D(){D=function(){return o};var l,o={},e=Object.prototype,c=e.hasOwnProperty,d=Object.defineProperty||function(e,t,i){e[t]=i.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",i=t.asyncIterator||"@@asyncIterator",n=t.toStringTag||"@@toStringTag";function a(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(l){a=function(e,t,i){return e[t]=i}}function s(e,t,i,r){var n,a,o,s,t=t&&t.prototype instanceof v?t:v,t=Object.create(t.prototype),r=new k(r||[]);return d(t,"_invoke",{value:(n=e,a=i,o=r,s=h,function(e,t){if(s===p)throw Error("Generator is already running");if(s===m){if("throw"===e)throw t;return{value:l,done:!0}}for(o.method=e,o.arg=t;;){var i=o.delegate;if(i){i=function e(t,i){var r=i.method,n=t.iterator[r];if(n===l)return i.delegate=null,"throw"===r&&t.iterator.return&&(i.method="return",i.arg=l,e(t,i),"throw"===i.method)||"return"!==r&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;r=u(n,t.iterator,i.arg);if("throw"===r.type)return i.method="throw",i.arg=r.arg,i.delegate=null,y;n=r.arg;return n?n.done?(i[t.resultName]=n.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=l),i.delegate=null,y):n:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}(i,o);if(i){if(i===y)continue;return i}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(s===h)throw s=m,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);s=p;i=u(n,a,o);if("normal"===i.type){if(s=o.done?m:f,i.arg===y)continue;return{value:i.arg,done:o.done}}"throw"===i.type&&(s=m,o.method="throw",o.arg=i.arg)}})}),t}function u(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}o.wrap=s;var h="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function v(){}function g(){}function _(){}var t={},w=(a(t,r,function(){return this}),Object.getPrototypeOf),w=w&&w(w(T([]))),x=(w&&w!==e&&c.call(w,r)&&(t=w),_.prototype=v.prototype=Object.create(t));function I(e){["next","throw","return"].forEach(function(t){a(e,t,function(e){return this._invoke(t,e)})})}function b(o,s){var t;d(this,"_invoke",{value:function(i,r){function e(){return new s(function(e,t){!function t(e,i,r,n){var a,e=u(o[e],o,i);if("throw"!==e.type)return(i=(a=e.arg).value)&&"object"==typeof i&&c.call(i,"__await")?s.resolve(i.__await).then(function(e){t("next",e,r,n)},function(e){t("throw",e,r,n)}):s.resolve(i).then(function(e){a.value=e,r(a)},function(e){return t("throw",e,r,n)});n(e.arg)}(i,r,e,t)})}return t=t?t.then(e,e):e()}})}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function T(t){if(t||""===t){var i,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return i=-1,(e=function e(){for(;++i<t.length;)if(c.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=l,e.done=!0,e}).next=e}throw new TypeError(typeof t+" is not iterable")}return d(x,"constructor",{value:g.prototype=_,configurable:!0}),d(_,"constructor",{value:g,configurable:!0}),g.displayName=a(_,n,"GeneratorFunction"),o.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,a(e,n,"GeneratorFunction")),e.prototype=Object.create(x),e},o.awrap=function(e){return{__await:e}},I(b.prototype),a(b.prototype,i,function(){return this}),o.AsyncIterator=b,o.async=function(e,t,i,r,n){void 0===n&&(n=Promise);var a=new b(s(e,t,i,r),n);return o.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(x),a(x,n,"Generator"),a(x,r,function(){return this}),a(x,"toString",function(){return"[object Generator]"}),o.keys=function(e){var t,i=Object(e),r=[];for(t in i)r.push(t);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in i)return e.value=t,e.done=!1,e}return e.done=!0,e}},o.values=T,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=l,this.done=!1,this.delegate=null,this.method="next",this.arg=l,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&c.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=l)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var r=this;function e(e,t){return a.type="throw",a.arg=i,r.next=e,t&&(r.method="next",r.arg=l),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t],a=n.completion;if("root"===n.tryLoc)return e("end");if(n.tryLoc<=this.prev){var o=c.call(n,"catchLoc"),s=c.call(n,"finallyLoc");if(o&&s){if(this.prev<n.catchLoc)return e(n.catchLoc,!0);if(this.prev<n.finallyLoc)return e(n.finallyLoc)}else if(o){if(this.prev<n.catchLoc)return e(n.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return e(n.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;0<=i;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&c.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var n=r;break}}var a=(n=n&&("break"===e||"continue"===e)&&n.tryLoc<=t&&t<=n.finallyLoc?null:n)?n.completion:{};return a.type=e,a.arg=t,n?(this.method="next",this.next=n.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),A(i),y}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var i,r,n=this.tryEntries[t];if(n.tryLoc===e)return"throw"===(i=n.completion).type&&(r=i.arg,A(n)),r}throw Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:T(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=l),y}},o}function ge(e,t,i,r,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return i(e)}s.done?t(l):Promise.resolve(l).then(r,n)}function n(s){return function(){var e=this,o=arguments;return new Promise(function(t,i){var r=s.apply(e,o);function n(e){ge(r,t,i,n,a,"next",e)}function a(e){ge(r,t,i,n,a,"throw",e)}n(void 0)})}}function _e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,function(e){e=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof e?e:e+""}(r.key),r)}}NDSWebViewer.ExtensionManager.addExtension(x),x.currentTypeName="SelectionManager",x.overrideFunction("clearSelection",function(){this.viewer.selectionManager.__clearSelection(),"OpExplode"==this.viewer.controls.getOperator().type&&this.viewer.controls.getOperator().changeSelobject()});var E=[{trackType:4,describe:"color",type:"color"},{trackType:5,describe:"opacity",type:"opacity"}],we=function(){function e(e){this.viewer=e,(this.viewer.AnimationEdit=this).tempCenterBox=new THREE.Vector3,this.trackDataMap=new Map,this.animationDataMap=new Map,this.trackDataMapByAnimationID=new Map,this.allBodyUuid2BodyNodeMap=new Map,this.selectedBodyUuidMap=new Map,this.allBodyUuid2OriMatrixMap=new Map,this.allBodyUuid2CenterMap=new Map,this.uuid2TrajectoryMatrixMap=new Map,this.originalColorMap=new Map,this.originalOpacityMap=new Map,this.originalTextLineColorMap=new Map,this.uuid2OpacityTrackDataMap=new Map,this.uuid2TextImgOpacityTrackMap=new Map,this.uuid2TextLineColorTrackMap=new Map,this.uuid2AllTrackDataMap=new Map,this.uuid2TrajectoryMap=new Map,this.trackID2PositionTrackMap=new Map,this.uuid2OperateCenter=new Map,this.randomKey2TranslationMap=new Map,this.uuid2SplitPositionMap=new Map,this.textImgId2PositionMap=new Map,this.mainFilebodyUuid2VisibleMap0=new Map,this.originalCameraInfo=null,this.geomVisibleMap=new Map,this.releaseTrackMap=new Map,this.releaseModelMap=new Map,this.modelMarkMap=new Map,this.textCount=1,this.imgCount=1,this.timelinePosTrack=[],this.struct={animations:[],tracks:[]},this._releaseStuctData={animations:[],tracks:[],drawGeoms:[]},this.animationIDs=[],this._activeAnimationID=null,this._defaultAnimationID=null,this.releaseAnimationStatus=!1,this.isPlay=!1,x.load(this.viewer),this._isCreateAnimation=!0,this.isRelease=!0,this.loopType=0,this._readData=null,this._defaultUUID=null,this.highlights=[],this.viewer.dispatchEvent({type:"updateProgress",userData:{precent:1}}),this.viewer.removeEventListener("updateProgress",this.viewer.onUpdateProgress)}var t,i,r=e.prototype;return r.setSelectedBodyNode=function(e,t,i){var r,n,a,o=this;Array.isArray(e)&&this._activeAnimationID&&!this.isPlay&&(r=[],a=(n=this.selectedBodyUuidMap.get(this._activeAnimationID)||[]).find(function(e){return e.type==t}),e.forEach(function(e){var t=o.viewer.ndsModel.getModelById(e.ndsModel.id);if(!t)return!0;t.getLeafBodies(e).forEach(function(e){e.leafBodyAttri.bodyMeshIds.length&&(r.push(e.uuid+"-"+e.ndsModel.id),i)&&o.uuid2OperateCenter.set(o._activeAnimationID+"-"+e.uuid+"-"+e.ndsModel.id,i)})}),a?a.uuids=S(a.uuids,r):n.push({type:t,uuids:r}),this.selectedBodyUuidMap.set(this._activeAnimationID,n))},r.setSelectedBodyNodeByUUID=function(e,t){var i=this.selectedBodyUuidMap.get(this._activeAnimationID)||[],r=i.find(function(e){return e.type==t});r?r.uuids=S(r.uuids,e):i.push({type:t,uuids:e.slice()}),this.selectedBodyUuidMap.set(this._activeAnimationID,i)},r.getTrackData=function(){return Array.from(this.trackDataMap.values())},r.constructAnimation=function(){var i=this.AnimationEdit||this.viewer.AnimationEdit,r=(i.removeListener(),JSON.parse(JSON.stringify(i._readData)));if(!i._defaultAnimationID){var e=r.animations.filter(function(e){return e.isNDSAnimation});if(!e.length)return void i.createAnimation("defaultID","动画1",!0);i._defaultAnimationID=e[0].animationID}for(var n,a=0;a<r.animations.length;a++)!function(){var t=r.animations[a],e=(t.isNDSAnimation&&(i.animationIDs.push(t.animationID),i.struct.animations.push(t)),t.tracks.forEach(function(e){i.animationDataMap.set(e.trackID,e)}),n=r.tracks.filter(function(e){return e.animationID==t.animationID}),{textLabels:[],imageLabels:[],textIdLabels:[]});e.textLabels=r.textLabels?r.textLabels.filter(function(e){return e.animationID==t.animationID}):[],e.imageLabels=r.imageLabels?r.imageLabels.filter(function(e){return e.animationID==t.animationID}):[],e.textIdLabels=r.textIdLabels?r.textIdLabels.filter(function(e){return e.animationID==t.animationID}):[],i.releaseTrackMap.set("rtrack_"+t.animationID,{animation:t,tracks:n,label:e}),t.animationID!=i._defaultAnimationID&&(n=i.getModelsByAnimationId(r.models,t.animationID),i.modelMarkMap.set("omodel_"+t.animationID,n),i.modelMarkMap.set("otrack_"+t.animationID,!0))}();r.tracks&&0<r.tracks.length&&r.tracks.forEach(function(e){i.trackDataMap.set(e.trackID,e),1!=e.trackType&&2!=e.trackType&&3!=e.trackType||i.trackID2PositionTrackMap.set(e.trackID,e)}),r.timelinePosTrack&&(i.timelinePosTrack=r.timelinePosTrack);e=r.animations.find(function(e){return e.isNDSAnimation&&e.animationID==i._defaultAnimationID});if(e?(i._activeAnimationID=e.animationID,i.readAnimationTraceData(e)):i.createAnimation("defaultID","动画1",!0),i.originalCameraInfo=x.getAnimationCamera(),r.drawGeoms&&0<r.drawGeoms.length){i.viewer.opDrawGeomCreate(),i.viewer.controls.staticDrawGeomOp.addGeomItem(r.drawGeoms),i.viewer.controls.staticDrawGeomOp.hideAllMesh();var t=r.drawGeoms.filter(function(e){return e.animationID==i._activeAnimationID});if(t&&0<t.length)for(var o=0;o<t.length;o++){var s=t[o].uuid;i.viewer.controls.staticDrawGeomOp.showMesh(s)}}i._preReleaseAnimation(),i.changeBodyNodeMatrix(0),i.viewer.dispatchEvent({type:"animatioFileLoadEnd",id:i._defaultAnimationID}),i.removeListener()},r.switchAnnimation=function(){var t=n(D().mark(function e(t){var i,r,n,a,o,s=this;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.resetAnimationModel(t);case 2:if(this.viewer.controls.staticDrawGeomOp&&(i=this.viewer.controls.staticDrawGeomOp.drawScene.children.filter(function(e){return e.isDrawGeom&&e.animationID==s._activeAnimationID}).map(function(e){return e.uuid}))&&0<i.length)for(r=this.geomVisibleMap.get("geom_"+this._activeAnimationID),n=r?Array.from(r):[],a=0;a<i.length;a++)o=i[a],n.indexOf(o)<0&&this.viewer.controls.staticDrawGeomOp.showMesh(o);return this._switchRotateCenterBySelection(),setTimeout(function(){s.setTime0Camera()},0),this.struct.tracks=this.getTrackData(),e.abrupt("return",this.struct);case 7:case"end":return e.stop()}},e,this)}));return function(e){return t.apply(this,arguments)}}(),r.recordSelectedObjects=function(t){var e,r,n,a,o=this;this.selectedBodyUuidMap.has(t.animationID)||(e=[],r=[],n=[],a=[],this._readData.tracks.filter(function(e){return e.animationID==t.animationID}).forEach(function(e){void 0===e.ndsModelId&&(e.ndsModelId=0);var t,i=e.modelID[0]+"-"+e.ndsModelId;4==e.trackType?r.push(i):5==e.trackType?n.push(i):7==e.trackType?(a.push(i),o._recordOpacityUuid2Track(i,e)):11==e.trackType||12==e.trackType?o._recordMapUuid2Track(o.uuid2TextImgOpacityTrackMap,e.textImgId||e.textId,e):13==e.trackType?o.uuid2TextLineColorTrackMap.set(e.textImgId||e.textId,e):8==e.trackType?(o._recordMapUuid2Track(o.uuid2TrajectoryMap,i,e),o.randomKey2TranslationMap.has(e.randomKey)?o.randomKey2TranslationMap.get(e.randomKey)[i]=e.translations.slice():((t={})[i]=e.translations.slice(),o.randomKey2TranslationMap.set(e.randomKey,t))):17==e.trackType&&o.textImgId2PositionMap.set(e.textImgId||e.textId,e)}),r.length&&e.push({type:"color",uuids:Array.from(new Set(r))}),n.length&&e.push({type:"opacity",uuids:Array.from(new Set(n))}),a.length&&e.push({type:"specialEffect",uuids:Array.from(new Set(a))}),this.selectedBodyUuidMap.set(t.animationID,e))},r.readAnimationTraceData=function(e){if(e){this.recordSelectedObjects(e),this._isCreateAnimation=!1,this._activeAnimationID=e.animationID;for(var t=this.viewer.ndsModel.getModelsByAnimationId(e.animationID),i=0;i<t.length;i++)for(var r=t[i].bodyUuid2NodeMap,n=0,a=Object.entries(r);n<a.length;n++){var o,s,l=a[n],l=(l[0],l[1]);("Body"==l.type||"Model"==l.type)&&l.leafBodyAttri&&l.leafBodyAttri.bodyMeshIds.length&&(0!=l.ndsModel.id&&(o=l.uuid+"-"+l.ndsModel.id,this.allBodyUuid2BodyNodeMap.set(o,l),s=this.viewer.ndsModel.getBodyBoundingBox(l).getCenter(this.tempCenterBox),this.uuid2OperateCenter.set(o,s),this.allBodyUuid2CenterMap.set(o,s),s=new THREE.Matrix4,this.allBodyUuid2OriMatrixMap.set(o,s.copy(l.worldMatrix)),this.originalColorMap.set(o,this.viewer.getObjectColorRGB(l.uuid,l.ndsModel.id)),this.originalOpacityMap.set(o,this.viewer.getObjectOpacityOnly(l))),this.readKeyframeTrack(l))}this._fillTextImgData()}},r.recordOriginalMainFileInfo=function(){var e=this.viewer.ndsModel.getModelById(0);if(e)for(var e=e.bodyUuid2NodeMap,t=0,i=Object.entries(e);t<i.length;t++){var r,n,a=i[t],a=(a[0],a[1]);("Body"==a.type||"Model"==a.type)&&a.leafBodyAttri&&a.leafBodyAttri.bodyMeshIds.length&&(r=a.uuid+"-"+a.ndsModel.id,this.allBodyUuid2BodyNodeMap.set(r,a),this.mainFilebodyUuid2VisibleMap0.set(r,a.visible),this._defaultUUID||(this._defaultUUID=r),n=this.viewer.ndsModel.getBodyBoundingBox(a).getCenter(this.tempCenterBox),this.uuid2OperateCenter.set(r,n),this.allBodyUuid2CenterMap.set(r,n),n=new THREE.Matrix4,this.allBodyUuid2OriMatrixMap.set(r,n.copy(a.worldMatrix)),this.originalColorMap.set(r,this.viewer.getObjectColorRGB(a.uuid,a.ndsModel.id)),this.originalOpacityMap.set(r,this.viewer.getObjectOpacityOnly(a)))}},r.removeListener=function(){this.viewer.removeEventListener("AnimatioModelLoadEnd",this.constructAnimation)},r.loadAnimationFile=function(){var t=n(D().mark(function e(t){var i,r,n,a,o;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=[],e.prev=1,r=0;case 3:r<t.length?0!=(n=t[r]).modelId?e.next=9:(n.unload=!1,e.next=30):e.next=34;break;case 9:return e.next=11,fetch(n.url);case 11:(a=e.sent).ok?e.next=17:(i.push(n),n.unload=!1,e.next=30);break;case 17:return o=null,e.prev=18,e.next=21,a.json();case 21:o=e.sent,e.next=29;break;case 24:return e.prev=24,e.t0=e.catch(18),i.push(n),n.unload=!1,e.abrupt("continue",31);case 29:o&&o.metadata?n.unload=!0:(i.push(n),n.unload=!1);case 30:this.viewer.prepareLoadModels.push(n);case 31:r++,e.next=3;break;case 34:e.next=39;break;case 36:e.prev=36,e.t1=e.catch(1),console.error("在请求过程中发生错误:",e.t1);case 39:0<i.length&&this.viewer.dispatchEvent({type:"AnimationFailedFiles",Modelfiles:i});case 40:case"end":return e.stop()}},e,this,[[1,36],[18,24]])}));return function(e){return t.apply(this,arguments)}}(),r.readAnimation=function(){var t=n(D().mark(function e(t){var i,r,n;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._readData=t,i=JSON.parse(JSON.stringify(t)),this.recordOriginalMainFileInfo(),i.animations&&0<i.animations.length&&!this._defaultAnimationID&&(this._defaultAnimationID=i.animations[0].animationID),this.models=i.models||[],i.models&&1<i.models.length)return r=this.getModelsByAnimationId(i.models,this._defaultAnimationID),n=this.getMaxModelId(i.models)+1,this.viewer.ndsModel.setglobalModelId(n),this.recordInitModels(i.models),this.viewer.prepareLoadModels=[],e.next=13,this.loadAnimationFile(r);e.next=16;break;case 13:this.viewer.prepareLoadModels&&0<this.viewer.prepareLoadModels.length?(this.viewer.addEventListener("AnimatioModelLoadEnd",this.constructAnimation,!1),this.viewer.startLoadAnimationModel()):this.constructAnimation(),e.next=17;break;case 16:this.constructAnimation();case 17:case"end":return e.stop()}},e,this)}));return function(e){return t.apply(this,arguments)}}(),r.restoreView=function(){var e,o=this;if(this.resetBodyNode(),this._updateTextLabels(this._activeAnimationID),this.viewer.piovtInfoMap.clear(),this.uuid2OperateCenter.size){var t=Array.from(this.uuid2OperateCenter.keys());if(t&&0<t.length)for(var i=t.length-1;0<=i;i--)0<=(f=String(t[i])).indexOf(this._activeAnimationID)&&this.uuid2OperateCenter.delete(f)}this.viewer.controls.staticDrawGeomOp&&(e=this.viewer.controls.staticDrawGeomOp.drawScene.children.filter(function(e){return e.isDrawGeom&&e.animationID==o._activeAnimationID&&!e.visible}).map(function(e){return e.uuid}),this.geomVisibleMap.set("geom_"+this._activeAnimationID,e)),this.viewer.selectionManager.clearSelection(),this.viewer.onExplode(0),this.cancelImageTextHighlight(),this.cancelTextPointHighlight();var r=Array.from(this.textLabelsMap.keys());if(r&&0<r.length)for(var n=0;n<r.length;n++){var a=r[n];this.setTextVisible(a,!1)}var s=Array.from(this.imageLabelsMap.keys());if(s&&0<s.length)for(var l=0;l<s.length;l++){var c=s[l];this.setImageVisible(c,!1)}var d=Array.from(this.textIdLabelsMap.keys());if(d&&0<d.length)for(var u=0;u<d.length;u++){var h=d[u];animationEdit.viewer.setTextPointShow(h,!1)}this.viewer.controls.staticDrawGeomOp&&this.viewer.controls.staticDrawGeomOp.hideAllMesh();for(var f,p,m,y,v,g,_=Array.from(this.mainFilebodyUuid2VisibleMap0),w=0;w<_.length;w++)!function(){f=_[w][0],y=_[w][1],m="",0<(p=f).indexOf("-")&&(p=f.split("-")[0],m=f.split("-")[1]),x.setAnimationModelShowHide(f,y);var e=o.viewer.ndsModel.getBodyNodeFrom(p,m);if(e){var i,r=o.originalOpacityMap.get(f),t=(r&&(i=[],Array.isArray(r)&&e.leafBodyAttri.bodyMeshIds.forEach(function(e,t){i.push({meshId:e,value:r[t]||r[0]})}),o.viewer.setObjectOpacityOnly([e],i.length?i:r,!0)),o.originalColorMap.get(f));if(t&&0<t.length)if(1==t.length)y=Z(t[0]),m&&o.viewer.ndsModel.setActiveModelByModelId(m),o.viewer.changeObjectColor(p,y,!0,!1,m);else{v=[],g=[],e&&e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds.forEach(function(e){g.push(e)});for(var n=0;n<t.length;n++){var a=t[n];v.push({meshId:g[n],value:a})}o.viewer.changeObjectColor(p,v,!0,!1,m)}}}();this.originalCameraInfo&&x.setAnimationCamera(this.originalCameraInfo,!0),this.viewer.render()},r.setAnimationModelShowHide=function(e,t){x.setAnimationModelShowHide(e,t)},r.updateAnimationName=function(t,e){var i=this.struct.animations.find(function(e){return e.animationID==t});if(i&&(i.name=e),this.releaseTrackMap.size)for(var r=G(this.releaseTrackMap);!(n=r()).done;){var n=n.value,a=n[0],n=n[1];a=="rtrack_"+t&&(n.animation.name=e)}},r.removeAnimation=function(t){var e;if((this.struct.animations=this.struct.animations.filter(function(e){return e.animationID!=t}),this.trackDataMap)&&((e=Array.from(this.trackDataMap.keys()))&&0<e.length))for(var i=e.length-1;0<=i;i--){var r=e[i];0<=r.indexOf(t)&&(this.trackDataMap.delete(r),this.animationDataMap.delete(r))}if(this.releaseTrackMap.has("rtrack_"+t)&&this.releaseTrackMap.delete("rtrack_"+t),this.selectedBodyUuidMap.has(t)&&this.selectedBodyUuidMap.delete(t),this.geomVisibleMap.has("geom_"+t)&&this.geomVisibleMap.delete("geom_"+t),this.viewer.controls.staticDrawGeomOp){for(var n=[],a=this.viewer.controls.staticDrawGeomOp.drawScene.children,o=a.length-1;0<=o;o--)a[o].isDrawGeom&&a[o].animationID==t&&n.push(a[o].uuid);n&&0<n.length&&this.viewer.controls.staticDrawGeomOp.removeMesh(n)}if(this.uuid2OperateCenter.size&&((e=Array.from(this.uuid2OperateCenter.keys()))&&0<e.length))for(var s=e.length-1;0<=s;s--){var l=String(e[s]);0<=l.indexOf(t)&&this.uuid2OperateCenter.delete(l)}if(this.uuid2AllTrackDataMap.size)for(var c=G(this.uuid2AllTrackDataMap);!(d=c()).done;){var d=d.value,u=d[0],h=d[1].filter(function(e){return e.animationID!=t});this.uuid2AllTrackDataMap.set(u,h)}if(this.uuid2TrajectoryMap.size)for(var f=G(this.uuid2TrajectoryMap);!(p=f()).done;){var p=p.value,m=p[0],h=p[1].filter(function(e){return e.animationID!=t});this.uuid2TrajectoryMap.set(m,h)}if(this.getTextIdsLabels(),this.textLabelsMap.size){for(var y=[],v=G(this.textLabelsMap);!(g=v()).done;){var g=g.value,_=g[0];g[1].animationID==t&&(y.push(_),this.viewer.deleteNoteAnnotation(_),this.uuid2TextImgOpacityTrackMap.get(_)&&this.uuid2TextImgOpacityTrackMap.delete(_),this.uuid2TextLineColorTrackMap.get(_))&&this.uuid2TextLineColorTrackMap.delete(_)}if(y&&0<y.length)for(var w=0;w<y.length;w++){var x=y[w];this.textLabelsMap.delete(x)}}if(this.imageLabelsMap.size){for(var y=[],I=G(this.imageLabelsMap);!(b=I()).done;){var b=b.value,M=b[0];b[1].animationID==t&&(y.push(M),this.viewer.deleteNoteAnnotation(M),this.uuid2TextImgOpacityTrackMap.get(M))&&this.uuid2TextImgOpacityTrackMap.delete(M)}if(y&&0<y.length)for(var A=0;A<y.length;A++){var k=y[A];this.imageLabelsMap.delete(k)}}if(this.textIdLabelsMap.size){for(var y=[],T=G(this.textIdLabelsMap);!(D=T()).done;){var D=D.value,E=D[0];D[1].animationID==t&&(y.push(E),this.viewer.textAnimationOp("delTextPoint",E),this.textIdLabelsMap.delete(E),this.uuid2TextImgOpacityTrackMap.get(E)&&this.uuid2TextImgOpacityTrackMap.delete(E),this.uuid2TextLineColorTrackMap.get(E))&&this.uuid2TextLineColorTrackMap.delete(E)}if(y&&0<y.length)for(var S=0;S<y.length;S++){var R=y[S];this.textIdLabelsMap.delete(R)}}if(this.textImgId2PositionMap.size){for(var y=[],U=G(this.textImgId2PositionMap);!(O=U()).done;){var O=O.value,F=O[0];O[1].animationID==t&&y.push(F)}if(y&&0<y.length)for(var B=y.length-1;0<=B;B--){var N=y[B];this.textImgId2PositionMap.delete(N)}}if(this.id2showHideTrackMap.size){for(var C=[],z=G(this.id2showHideTrackMap);!(P=z()).done;){var P=P.value,H=P[0];P[1].animationID==t&&C.push(H)}if(C&&0<C.length)for(var L=C.length-1;0<=L;L--)this.id2showHideTrackMap.delete(C[L])}},r.createAnimation=function(e,t,i){if(void 0===t&&(t=""),!e)throw"动画id不可为空";if(this.hasAnimation(e))throw"已存在相同id的动画实例";this._resetAnimationModel(e),i&&(this.originalCameraInfo=x.getAnimationCamera()),this._isCreateAnimation=!0,this.animationIDs.push(e);t={animationID:e,jsonCameraMoves:[],loopTime:0,name:t,tracks:[],isNDSAnimation:!0,isShowPositonFirstKeyframe:!1,isShowColorFirstKeyframe:!1,isShowOpacityFirstKeyframe:!1,positionNotDefault:!1,randomKeys:[]},e={animationID:this._activeAnimationID=e,type:"position",groups:[],name:"",times:[]};this.timelinePosTrack.push(e),this.struct.animations.push(t),this.startEdit(i),this.isRelease=!1,this._switchRotateCenterBySelection()},r.setRandomKeys=function(e){var t=this,i=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});i&&(i.randomKeys=e)},r.getRandomKeys=function(){var t=this,e=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});return e?e.randomKeys:null},r.hasAnimation=function(e){return this.animationIDs.includes(e)},r.getAnimations=function(){return this.struct},r.getCurAnimation=function(){var t=this;return this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID})},r.getModelsByAnimationId=function(e,t){var i=[];if(e&&0<e.length)for(var r=0;r<e.length;++r){var n=e[r];(0==n.modelId||n.animationId==t)&&i.push(n)}return i},r.getTargetNdsModelId=function(t,e){var i,r;return"0"==t?"0":(i=this.viewer.ndsModel.getModelById(t))?i.animationId==e?i.id:!(r=this.viewer.ndsModel.getModelsByAnimationId(i.animationId).filter(function(e){return e.modelUri==i.modelUri}))||r.length<1||(r=r.findIndex(function(e){return e.id==t}))<0||!(e=this.viewer.ndsModel.getModelsByAnimationId(e).filter(function(e){return e.modelUri==i.modelUri}))||e.length<1||r>e.length-1?-1:e[r].id:-1},r.getTargetIncludeNdsModelIds=function(e,t){var i=[],r=this.viewer.ndsModel.getModelsByAnimationId(e);if(r&&0<r.length)for(var n=0;n<r.length;n++){var a=r[n];0!=a&&-1==this.getTargetNdsModelId(a.id,t)||i.push(a.id)}return i},r.checkHasCopyData=function(t,e){if(e&&!(e.length<1))for(var i=this.getTrackData(),r=0;r<e.length;r++){var n,a=e[r],o=a.time;if("位置"==a.type){if((n=i.filter(function(e){return e.animationID==t&&(1==e.trackType||2==e.trackType||3==e.trackType)&&0<=e.times.indexOf(o)}))&&0<n.length)return!0}else if("属性"==a.type){if((n=i.filter(function(e){return e.animationID==t&&(4==e.trackType||5==e.trackType)&&0<=e.times.indexOf(o)}))&&0<n.length)return!0}else if("轨迹"==a.type){if((n=i.filter(function(e){return e.animationID==t&&8==e.trackType&&e.randomKey==randomKey}))&&0<n.length)return!0}else if("特效"==a.type){if((n=i.filter(function(e){return e.animationID==t&&7==e.trackType&&e.randomKey==randomKey}))&&0<n.length)return!0}else if("相机"==a.type)if((n=i.filter(function(e){return e.animationID==t&&6==e.trackType&&0<=e.times.indexOf(o)}))&&0<n.length)return!0}return!1},r.recordInitModels=function(e){if(e&&0<e.length)for(var t=0;t<e.length;++t){var i=e[t];this.releaseModelMap.set(i.modelId,i)}},r.getMaxModelId=function(e){var t=0;if(e&&0<e.length)for(var i=0;i<e.length;++i)var r=e[i],t=Math.max(r.modelId,t);return t},r.getNdsModelbyId=function(t){return this.viewer.ndsModel.models.find(function(e){return e.id==t})},r.getNdsModelbyUrl=function(t){return this.viewer.ndsModel.models.find(function(e){return 0<=e.modelUri.toLowerCase().indexOf(t)})},r.getNdsModelsbyAnimationId=function(e){e=this.getModelsByAnimationId(this.viewer.ndsModel.models,e);if(!e)return[];e.map(function(e){return e.id})},r._resetAnimationModel=function(){var t=n(D().mark(function e(t){var i,r,n,a,o,s,l,c;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.modelMarkMap.get("omodel_"+t),this.modelMarkMap.has("omodel_"+t)&&this.modelMarkMap.delete("omodel_"+t),r=[],i&&0<i.length){for(n=1;n<i.length;n++)0==(a=i[n]).modelId||this.viewer.ndsModel.getModelById(a.modelId)||r.push(a);if(r&&0<r.length)return e.next=8,this.addLoadAnimationFile(r)}e.next=8;break;case 8:if((o=this.viewer.ndsModel.models)&&1<o.length)for(s=1;s<o.length;s++)(l=o[s])&&l.rootBodyNode&&(c=l.rootBodyNode.uuid+"-"+l.rootBodyNode.ndsModel.id,l.animationId==t?x.setAnimationModelShowHide(c,!0):0!=l.id&&x.setAnimationModelShowHide(c,!1));(!r||r.length<1)&&this.loadAnimationFileEnd&&this.loadAnimationFileEnd();case 11:case"end":return e.stop()}},e,this)}));return function(e){return t.apply(this,arguments)}}(),r.resetAnimationModel=function(){var t=n(D().mark(function e(t){var i,r,n=this;return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=(i=this).struct.animations.find(function(e){return e.animationID==t}),this._activeAnimationID=r.animationID,e.abrupt("return",new Promise(function(e){n.loadAnimationFileEnd=function(){i.viewer.dispatchEvent({type:"animatioFileLoadEnd",id:t}),i.modelMarkMap.has("otrack_"+t)&&(i.readAnimationTraceData(r),i.modelMarkMap.delete("otrack_"+t)),e()},n._resetAnimationModel(t)}));case 4:case"end":return e.stop()}},e,this)}));return function(e){return t.apply(this,arguments)}}(),r.addLoadAnimationFile=function(){var t=n(D().mark(function e(t){return D().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&0<t.length)return this.viewer.prepareLoadModels=[],e.next=4,this.loadAnimationFile(t);e.next=7;break;case 4:0<this.viewer.prepareLoadModels.length?(this.viewer.removeEventListener("AnimatioModelLoadEnd",this.loadAnimationFileEnd),this.viewer.addEventListener("AnimatioModelLoadEnd",this.loadAnimationFileEnd,!1),this.viewer.startLoadAnimationModel()):this.loadAnimationFileEnd&&this.loadAnimationFileEnd(),e.next=8;break;case 7:this.loadAnimationFileEnd&&this.loadAnimationFileEnd();case 8:case"end":return e.stop()}},e,this)}));return function(e){return t.apply(this,arguments)}}(),r.insertEdit=function(){if(this.viewer.loadAnimationEnd){this.viewer.loadAnimationEnd=!1;for(var e=this.viewer.ndsModel.models.length-1,e=(this.viewer.ndsModel.setActiveModel(e),this.viewer.ndsModel.activeModel.bodyUuid2NodeMap),t=this.viewer.ndsModel.activeModel.rootBodyNode,i=0,r=Object.entries(e);i<r.length;i++){var n,a,o=r[i],o=(o[0],o[1]);("Body"==o.type||"Model"==o.type)&&o.leafBodyAttri&&o.leafBodyAttri.bodyMeshIds.length&&(n=o.uuid+"-"+this.viewer.ndsModel.id,a=this.viewer.ndsModel.getBodyBoundingBox(o).getCenter(this.tempCenterBox),this.uuid2OperateCenter.set(n,a),this.allBodyUuid2CenterMap.set(n,a),this.allBodyUuid2BodyNodeMap.set(n,o),a=new THREE.Matrix4,this.allBodyUuid2OriMatrixMap.set(n,a.copy(o.worldMatrix)),this.originalColorMap.set(n,this.viewer.getObjectColorRGB(o.uuid,this.viewer.ndsModel.id)),this.originalOpacityMap.set(n,this.viewer.getObjectOpacityOnly(o)),this.insertKeyframeTrack(n,o))}this.viewer.dispatchEvent({type:"addShowHideTrack",data:{name:t.name,uuids:[t.uuid+"-"+t.ndsModel.id]}}),this._preReleaseAnimation(),this._switchRotateCenterBySelection()}},r.insertFileDelete=function(e){},r.deleteEdit=function(e){for(var t=this,i=(this.viewer.ndsModel.setActiveModel(e),this.viewer.ndsModel.id),e=this.viewer.ndsModel.activeModel.bodyUuid2NodeMap,r=this.viewer.ndsModel.activeModel.rootBodyNode,n=0,a=Object.entries(e);n<a.length;n++){var o=a[n],o=(o[0],o[1]);("Body"==o.type||"Model"==o.type)&&o.leafBodyAttri&&o.leafBodyAttri.bodyMeshIds.length&&(o=o.uuid+"-"+this.viewer.ndsModel.id,this.uuid2OperateCenter.delete(o),this.allBodyUuid2CenterMap.delete(o),this.allBodyUuid2BodyNodeMap.delete(o),this.allBodyUuid2OriMatrixMap.delete(o),this.originalColorMap.delete(o),this.originalOpacityMap.delete(o),this.deleteKeyframeTrack(o),this.uuid2TrajectoryMap.has(o)&&this.uuid2TrajectoryMap.get(o).map(function(e){return e.trackID}).forEach(function(e){t.trackDataMap.delete(e),t.animationDataMap.delete(e)}),this.uuid2TrajectoryMap.delete(o),this.uuid2OpacityTrackDataMap.has(o)&&this.uuid2OpacityTrackDataMap.get(o).map(function(e){return e.trackID}).forEach(function(e){t.trackDataMap.delete(e),t.animationDataMap.delete(e)}),this.uuid2OpacityTrackDataMap.delete(o))}var s=this.selectedBodyUuidMap.get(this._activeAnimationID);if(s&&s.length)for(var l=0;l<s.length;l++){var c=s[l].uuids;s[l].uuids=c.filter(function(e){var t=e.lastIndexOf("-");if(0<t&&e.slice(t+1)==i)return!1;return!0})}e=this._activeAnimationID+"-"+r.uuid+"-"+r.ndsModel.id;this.id2showHideTrackMap.delete(e),this.id2showHideStatusMap.delete(e),this.viewer.dispatchEvent({type:"deleteShowHideTrack",data:{uuid:[r.uuid+"-"+r.ndsModel.id]}}),this._preReleaseAnimation(),this._switchRotateCenterBySelection()},r.startEdit=function(e){for(var t=this.viewer.ndsModel.getModelById(0).bodyUuid2NodeMap,i=0,r=Object.entries(t);i<r.length;i++){var n,a,o=r[i],o=(o[0],o[1]);("Body"==o.type||"Model"==o.type)&&o.leafBodyAttri&&o.leafBodyAttri.bodyMeshIds.length&&(n=o.uuid+"-"+this.viewer.ndsModel.id,this._defaultUUID||(this._defaultUUID=n),e&&(0==this.viewer.ndsModel.id&&this.mainFilebodyUuid2VisibleMap0.set(n,o.visible),a=this.viewer.ndsModel.getBodyBoundingBox(o).getCenter(this.tempCenterBox),this.uuid2OperateCenter.set(n,a),this.allBodyUuid2CenterMap.set(n,a),this.allBodyUuid2BodyNodeMap.set(n,o),a=new THREE.Matrix4,this.allBodyUuid2OriMatrixMap.set(n,a.copy(o.worldMatrix)),this.originalColorMap.set(n,this.viewer.getObjectColorRGB(o.uuid,this.viewer.ndsModel.id)),this.originalOpacityMap.set(n,this.viewer.getObjectOpacityOnly(o))),this.createKeyframeTrack(n))}t=this._activeAnimationID+"-"+this._defaultUUID+"-6";this.trackDataMap.has(t)||this.addKeyframeTrack(this._defaultUUID,6,t);var t="a",s=!1,l=!1;this.addColorKeyframeForAll("0",0,t,s,l),this.addOpacityKeyframeForAll("0",0,t,s,l)},r.readKeyframeTrack=function(n){var a=this,o=n.uuid+"-"+n.ndsModel.id;E.forEach(function(e){var t,i,e=e.trackType,r=a._activeAnimationID+"-"+o+"-"+e;a.animationDataMap.has(r)||(a.animationDataMap.set(r,{durationTime:-1,startTime:0,trackID:r}),4==e?(i=null,i=(i=a._readData.tracks.find(function(e){return 4==e.trackType}))?i.times.slice():[0],(t=a.viewer.getObjectColorRGB(n.uuid,n.ndsModel.id))&&(t=_(t,i,r,e,a._activeAnimationID,n.uuid,n.ndsModel.id),a.trackDataMap.set(r,t))):5==e&&(i=null,t=(i=a._readData.tracks.find(function(e){return 5==e.trackType}))?i.times.slice():[0],i=a.viewer.getObjectOpacityOnly(n))&&(i=w(i,t,r,e,a._activeAnimationID,n.uuid,n.ndsModel.id),a.trackDataMap.set(r,i)))})},r.createKeyframeTrack=function(i){var r=this;E.forEach(function(e){var t=r._activeAnimationID+"-"+i+"-"+e.trackType;r.addKeyframeTrack(i,e.trackType,t)})},r.insertKeyframeTrack=function(u,h){var f=this;E.forEach(function(e){var t=e.trackType,i=f._activeAnimationID+"-"+u+"-"+e.trackType;switch(t){case 4:for(var r=null,n=G(f.trackDataMap);!(a=n()).done;){var a=a.value,a=(a[0],a[1]);if(4==a.trackType&&a.animationID==f._activeAnimationID){r=a;break}}var o=r?r.times.slice():[0],s=f.viewer.getObjectColorRGB(h.uuid,h.ndsModel.id);s&&(s=_(s,o,i,t,f._activeAnimationID,h.uuid,h.ndsModel.id),f.trackDataMap.set(i,s));break;case 5:for(var l=null,c=G(f.trackDataMap);!(d=c()).done;){var d=d.value,d=(d[0],d[1]);if(5==d.trackType&&d.animationID==f._activeAnimationID){l=d;break}}var o=l?l.times.slice():[0],s=f.viewer.getObjectOpacityOnly(h);s&&(s=w(s,o,i,t,f._activeAnimationID,h.uuid,h.ndsModel.id),f.trackDataMap.set(i,s))}f.animationDataMap.set(i,{durationTime:-1,startTime:0,trackID:i})})},r.deleteKeyframeTrack=function(t){var i=this;E.forEach(function(e){e=i._activeAnimationID+"-"+t+"-"+e.trackType;i.trackDataMap.delete(e),i.animationDataMap.delete(e)}),[this._activeAnimationID+"-"+t+"-1",this._activeAnimationID+"-"+t+"-2",this._activeAnimationID+"-"+t+"-3"].forEach(function(e){i.trackDataMap.delete(e),i.animationDataMap.delete(e),i.trackID2PositionTrackMap.delete(e)})},r.addKeyframeTrack=function(e,t,i,r,n,a,o,s,l,c,d,u){this.animationDataMap.set(i,{durationTime:-1,startTime:0,trackID:i});var h=null,f=null,p=e.lastIndexOf("-"),e=(0<p&&(h=e.slice(0,p),f=e.slice(p+1)),{animationID:u||this._activeAnimationID,textImgId:c,textId:d,type:d?"text":null,trackID:i,randomKey:r,trackType:t,modelID:[h],centers:[],worldMatrixFrame:[],keyframeIds:[],htmlTitle:n,htmlId:a,htmlUUIDS:o,htmlNum:s,geomUUId:l,groups:[],interoplationEnd:[],interoplationStart:[],interoplationType:0,name:"",ndsModelId:f=null==f?0:f,times:[],rotations:[],scales:[],translations:[],colors:[],opacities:[],cameras:[]});return this.trackDataMap.set(i,e),14!=t&&15!=t&&16!=t||(p="",15==t?p=c:14==t?p=this._activeAnimationID+"-"+o[0]:16==t&&(p=d),this.id2showHideTrackMap.set(p,e)),1!=t&&2!=t&&3!=t||this.trackID2PositionTrackMap.set(i,e),e},r._recordOpacityUuid2Track=function(e,t){this.uuid2OpacityTrackDataMap.has(e)?this.uuid2OpacityTrackDataMap.get(e).push(t):this.uuid2OpacityTrackDataMap.set(e,[t])},r._recordMapUuid2Track=function(e,t,i){var r;e.has(t)?-1==(r=e.get(t)).findIndex(function(e){return e.trackID==i.trackID})&&r.push(i):e.set(t,[i])},r.removeTextLineColorTrackByTrackID=function(e,t){this.trackDataMap.has(e)&&(this.trackDataMap.delete(e),this.animationDataMap.delete(e),t)&&this.uuid2TextLineColorTrackMap.has(t)&&this.uuid2TextLineColorTrackMap.delete(t)},r.removeTextLinePosTrackByTrackID=function(e,t){this.trackDataMap.has(e)&&(this.trackDataMap.delete(e),this.animationDataMap.delete(e),t)&&this.textImgId2PositionMap.has(t)&&this.textImgId2PositionMap.delete(t)},r.removeShowHideTrackByTrackID=function(e,t){this.trackDataMap.has(e)&&(this.trackDataMap.delete(e),this.animationDataMap.delete(e),t&&this.id2showHideStatusMap.has(t)&&this.id2showHideStatusMap.delete(t),t)&&this.id2showHideTrackMap.has(t)&&this.id2showHideTrackMap.delete(t)},r.updateShowHideTrackTitle=function(e,t){this.trackDataMap.has(e)&&((e=this.trackDataMap.get(e)).title=t,e.htmlTitle=t,this.struct.tracks=this.getTrackData())},r.removeOpacityTrackByTrackID=function(t,e,i){var r,n,a,o;this.trackDataMap.has(t)&&(this.trackDataMap.delete(t),this.animationDataMap.delete(t),"label"==i?e&&this.uuid2TextImgOpacityTrackMap.has(e)&&(-1<(r=(i=this.uuid2TextImgOpacityTrackMap.get(e)).findIndex(function(e){return e.trackID==t}))&&((n=i[r]).textImgId&&this.viewer.setTransparent(n.textImgId,1),n.textId&&this.viewer.textAnimationOp("setOpacity",n.textId,1),i.splice(r,1)),0==i.length)&&this.uuid2TextImgOpacityTrackMap.delete(e):e&&this.uuid2OpacityTrackDataMap.has(e)&&(-1<(r=(n=this.uuid2OpacityTrackDataMap.get(e)).findIndex(function(e){return e.trackID==t}))&&n.splice(r,1),i=null,i=0<(n=e.lastIndexOf("-"))?(r=e.slice(0,n),n=e.slice(n+1),(n=this.viewer.ndsModel.getModelById(n))&&n.getBodyNodeFromUuid(r)):this.viewer.ndsModel.getBodyNodeFromUuid(e))&&(a=this.originalOpacityMap.get(e))&&(o=[],Array.isArray(a)&&i.leafBodyAttri.bodyMeshIds.forEach(function(e,t){o.push({meshId:e,value:a[t]||a[0]})}),this.viewer.setObjectOpacityOnly([i],o.length?o:a,!0)))},r.removeTrajectoryTrackByTrackID=function(t,e){var i;this.trackDataMap.has(t)&&(this.trackDataMap.delete(t),this.animationDataMap.delete(t),e)&&this.uuid2TrajectoryMap.has(e)&&(i=(e=this.uuid2TrajectoryMap.get(e)).findIndex(function(e){return e.trackID==t}),e.splice(i,1))},r.removeKeyframeTrackByTrackID=function(t,e){var i,r,n,a,o;this.trackDataMap.has(t)&&(this.trackDataMap.delete(t),this.animationDataMap.delete(t),e)&&this.uuid2OpacityTrackDataMap.has(e)&&(-1<(r=(n=this.uuid2OpacityTrackDataMap.get(e)).findIndex(function(e){return e.trackID==t}))&&n.splice(r,1),n=null,n=0<(r=e.lastIndexOf("-"))?(i=e.slice(0,r),r=e.slice(r+1),(r=this.viewer.ndsModel.getModelById(r))&&r.getBodyNodeFromUuid(i)):this.viewer.ndsModel.getBodyNodeFromUuid(e))&&(a=this.originalOpacityMap.get(e))&&(o=[],Array.isArray(a)&&n.leafBodyAttri.bodyMeshIds.forEach(function(e,t){o.push({meshId:e,value:a[t]||a[0]})}),this.viewer.setObjectOpacityOnly([n],o.length?o:a,!0))},r.addEffectsKeyframeForAll=function(e,t,i,r,n){var a=this;if(void 0===n&&(n=!1),this.trackDataMap.has(t)){var o=this.trackDataMap.get(t),n=11==o.trackType?o.textImgId||o.textId:o.modelID[0]+"-"+o.ndsModelId,t=(this.viewer.ndsModel.setActiveModelByModelId(parseInt(o.ndsModelId)),0);if(11==o.trackType)t=o.textImgId?(s=this.viewer.getAnnotationColorAndOpacity(n))?parseFloat(s.opacity):1:(s=this.viewer.textAnimationOp("getTextPointDataById",n)).style?parseFloat(s.style.opacity):1;else{var s=this.allBodyUuid2BodyNodeMap.get(n);if(!s)return;t=this.viewer.getObjectOpacityOnly(s)}var s=[e,e+.5,e+1],l=[];"淡入"==i?l=[t,0,1]:"淡出"==i?l=[t,1,0]:"闪烁"==i&&(l=[t,1,1],s=c(s,2*r-1),I(l,r)),s.forEach(function(e,t){a.addPropertyKeyframe("opacity",o,e,l[t])}),11==o.trackType?this._recordMapUuid2Track(this.uuid2TextImgOpacityTrackMap,o.textImgId||o.textId,o):this._recordOpacityUuid2Track(n,o)}},r.addShowHideKeyframeForAll=function(e,t,i,r){if(void 0===r&&(r="a"),this.trackDataMap.has(e)){var n,a,e=this.trackDataMap.get(e);if(15==e.trackType)a=e.textImgId;else if(14==e.trackType)n=e.htmlUUIDS[0],a=this._activeAnimationID+"-"+e.htmlUUIDS[0];else{if(16!=e.trackType)return;a=e.textId}this.addShowHideKeyframe(e,t,i,r),this.id2showHideTrackMap.set(a,e),14==e.trackType&&0<(t=n.lastIndexOf("-"))&&(i=n.slice(0,t),r=n.slice(t+1),n=(a=this.viewer.ndsModel.getModelById(r))&&a.getRootNodeFromUuid(i))&&n.uuid&&(t=n.uuid+"-"+r,this._defaultRootUUID.includes(t)||this._defaultRootUUID.push(t),0<(a=this._defaultUUID.lastIndexOf("-")))&&(i=this._defaultUUID.slice(0,a),e.bodyUuid=i)}},r.addShowHideKeyframe=function(e,t,i,r){var n=JSON.parse(JSON.stringify(e.times)),a=A(e.times,i);n.splice(a,0,i),e.times=n,e.keyframeIds.splice(a,0,t),e.groups.splice(a,0,r)},r.addTrajectoryKeyframeForAll=function(e,t,i,r,n){var a;void 0===n&&(n=!1),this.trackDataMap.has(i)&&(i=(n=this.trackDataMap.get(i)).modelID[0]+"-"+n.ndsModelId,this.allBodyUuid2BodyNodeMap.has(i))&&(this.randomKey2TranslationMap.has(e)?this.randomKey2TranslationMap.get(e)[i]=r.slice():((a={})[i]=r.slice(),this.randomKey2TranslationMap.set(e,a)),e=[t,t+1],(a=r.length/3-2)&&(e=c(e,a)),n.times=e,n.translations=r,t=this.allBodyUuid2BodyNodeMap.get(i).worldMatrix,a=new THREE.Vector3,e=new THREE.Quaternion,t.decompose(new THREE.Vector3,e,a),n.rotations=e.toArray(),n.scales=a.toArray(),this._recordMapUuid2Track(this.uuid2TrajectoryMap,i,n))},r.updateTrajectoryKeyframeByTrackID=function(e,t){var i;this.trackDataMap.has(e)&&(i=c((e=this.trackDataMap.get(e)).times,t.length/3-2),e.times=i,e.translations=t)},r.updateBlinkKeyframeByTrackID=function(e,t){var i,r,n=this;this.trackDataMap.has(e)&&(e=(i=this.trackDataMap.get(e)).times.slice(),r=i.opacities.slice(),i.times=[],i.opacities=[],e=c(e,2*t-1),I(r,t),e.forEach(function(e,t){n.addPropertyKeyframe("opacity",i,e,r[t])}))},r.addEffectsKeyframeByTrackID=function(e,t){var i,r,n;this.trackDataMap.has(t)&&(t=this.trackDataMap.get(t),i=this.originalOpacityMap.get(t.modelID[0]))&&(r=JSON.parse(JSON.stringify(t.times)),n=A(t.times,e),r.splice(n,0,e),t.times=r,(e=JSON.parse(JSON.stringify(t.opacities))).splice(+n,0,i[0]),t.opacities=e)},r._addTextKeyframeForAll=function(l,c,d,u){var h=this,e=(void 0===d&&(d=!1),void 0===u&&(u=!1),this.viewer.textAnimationOp("getSelectContent")),e=e&&e.length?e.filter(function(e){return e.animationID==h._activeAnimationID}):[];e&&e.length&&e.forEach(function(e){var t,i,r,n,a=e.id,o=h._activeAnimationID+"-"+a+"-17",s=(h.trackDataMap.has(o)||(h.addKeyframeTrack(h._defaultUUID,17,o,null,null,null,null,null,null,null,a),0!=l&&(t=e.initPosition||e.position,(i=h.trackDataMap.get(o)).type="text",t=f(t.x,t.y,h.viewer),h.addTextLineImgKeyframe(i,0,t,"a"),h.trackDataMap.set(o,i),h.textImgId2PositionMap.set(a,i))),h.trackDataMap.get(o));s&&s.animationID==h._activeAnimationID&&(i=f((t=d&&e.initPosition||e.position).x,t.y,h.viewer),s.type="text",u&&(i=z(s,l)),h.addTextLineImgKeyframe(s,l,i,c),(e=h.timelinePosTrack.find(function(e){return e.animationID==h._activeAnimationID}))&&h._addTimelineKeframe(e,l,c),u&&(r=s.times.findIndex(function(e){return l<=e}),n=s.groups[r+1],s.groups.forEach(function(e,t){r<=t&&e==n&&(s.groups[t]=c)})),h.trackDataMap.set(o,s),h.textImgId2PositionMap.set(a,s))})},r._addTextLineImgKeyframeForAll=function(l,c,d,u){var h=this,e=(void 0===d&&(d=!1),void 0===u&&(u=!1),this.viewer.getSelectedNoteContent()),t=this.viewer.getSelectedPicContent(),i=[];Array.isArray(e)&&e.map(function(e){(e.animationID||e.state.animationID)==h._activeAnimationID&&i.push(e.state.id)}),Array.isArray(t)&&t.map(function(e){(e.animationID||e.state.animationID)==h._activeAnimationID&&i.push(e.id)}),i&&i.length&&i.forEach(function(e){var t,i,r,n,a,o=h._activeAnimationID+"-"+e+"-17",s=(h.trackDataMap.has(o)||(h.addKeyframeTrack(h._defaultUUID,17,o,null,null,null,null,null,null,e),0!=l&&h.viewer.controls.staticAnnotation&&(i={x:56,y:19,z:0},i="pic"==(t=h.viewer.controls.staticAnnotation.getTextLineImgPosition(e)).type?f(i.x,i.y,h.viewer):t.oriPos,(r=h.trackDataMap.get(o)).type=t.type,h.addTextLineImgKeyframe(r,0,i,"a"),h.trackDataMap.set(o,r),h.textImgId2PositionMap.set(e,r))),h.trackDataMap.get(o));s&&s.animationID==h._activeAnimationID&&h.viewer.controls.staticAnnotation&&(t=h.viewer.controls.staticAnnotation.getTextLineImgPosition(e))&&(i={x:56,y:19,z:0},i=d?"pic"==t.type?f(i.x,i.y,h.viewer):t.oriPos:"pic"==t.type?f(t.x,t.y,h.viewer):{x:t.x,y:t.y,z:t.z},s.type=t.type,u&&(i=z(s,l)),h.addTextLineImgKeyframe(s,l,i,c),(r=h.timelinePosTrack.find(function(e){return e.animationID==h._activeAnimationID}))&&h._addTimelineKeframe(r,l,c),u&&(n=s.times.findIndex(function(e){return l<=e}),a=s.groups[n+1],s.groups.forEach(function(e,t){n<=t&&e==a&&(s.groups[t]=c)})),h.trackDataMap.set(o,s),h.textImgId2PositionMap.set(e,s))})},r._fillTextImgData=function(){var t=this,e=this.viewer.getAllNoteContent(),i=this.viewer.getallPicContent(),r=this.viewer.textAnimationOp("getTextPointAllData");Array.isArray(e)&&e.map(function(e){t.fillTextOpacityColorById(e,"textLine")}),Array.isArray(i)&&i.map(function(e){t.fillTextOpacityColorById(e,"img")}),Array.isArray(r)&&r.map(function(e){t.fillTextOpacityColor(e,e.id)})},r.fillTextOpacityColor=function(e,t){var o,i,a,s=this,e=e.animationID,l=e+"-"+t+"-13",c=(!this.trackDataMap.has(l)&&(this.addKeyframeTrack(this._defaultUUID,13,l,null,null,null,null,null,null,null,t,e),i=e+"-"+this._defaultUUID+"-4",o=this.trackDataMap.get(i))&&o.times.forEach(function(e,t,i){var r=s.trackDataMap.get(l),n=o.keyframeIds[t],t=o.groups[t],a=m("#000000");s.addTextColorKeyframe(r,e,a,null,n,t),r.type="text",s.trackDataMap.set(l,r)}),e+"-"+t+"-12");!this.trackDataMap.has(c)&&(this.addKeyframeTrack(this._defaultUUID,12,c,null,null,null,null,null,null,null,t,e),i=e+"-"+this._defaultUUID+"-5",a=this.trackDataMap.get(i))&&a.times.forEach(function(e,t,i){var r=s.trackDataMap.get(c),n=a.keyframeIds[t],t=a.groups[t];s.addPropertyKeyframe("opacity",r,e,1,n,t),r.type="text",s.trackDataMap.set(c,r)})},r.fillTextOpacityColorById=function(e,t){var s,l,a,c=this,i=e.id||e.state.id,e=e.animationID||e.state.animationID,o=("textLine"==(t=void 0===t?"textLine":t)&&!this.trackDataMap.has(s=e+"-"+i+"-13")&&(this.addKeyframeTrack(this._defaultUUID,13,s,null,null,null,null,null,null,i,null,e),t=e+"-"+this._defaultUUID+"-4",l=this.trackDataMap.get(t))&&l.times.forEach(function(e,t,i){var r=c.trackDataMap.get(s),n=(r.lineColors||(r.lineColors=[]),l.keyframeIds[t]),t=l.groups[t],a=m("#000000"),o=m("#FF6302");c.addTextColorKeyframe(r,e,a,o,n,t),c.trackDataMap.set(s,r)}),e+"-"+i+"-12");!this.trackDataMap.has(o)&&(this.addKeyframeTrack(this._defaultUUID,12,o,null,null,null,null,null,null,i,null,e),t=e+"-"+this._defaultUUID+"-5",a=this.trackDataMap.get(t))&&a.times.forEach(function(e,t,i){var r=c.trackDataMap.get(o),n=a.keyframeIds[t],t=a.groups[t];c.addPropertyKeyframe("opacity",r,e,1,n,t),c.trackDataMap.set(o,r)})},r.fillTextLineImgPosById=function(s){var e,l,c=this,d=this._activeAnimationID+"-"+s+"-17";!this.trackDataMap.has(d)&&(this.addKeyframeTrack(this._defaultUUID,17,d,null,null,null,null,null,null,s),e=this._activeAnimationID+"-"+this._defaultUUID+"-1",l=this.trackDataMap.get(e))&&l.times.forEach(function(e,t,i){var r,n=c.trackDataMap.get(d),a=l.keyframeIds[t],t=l.groups[t],o=c.viewer.controls.staticAnnotation&&c.viewer.controls.staticAnnotation.getTextLineImgPosition(s);o&&(r={x:56,y:19,z:0},r="pic"==o.type?f(r.x,r.y,c.viewer):{x:o.x,y:o.y,z:o.z},n.type=o.type,c.addTextLineImgKeyframe(n,e,r,a,t),c.trackDataMap.set(d,n),c.textImgId2PositionMap.set(s,n))})},r.fillTextPosById=function(o){var e,s,l=this,c=this._activeAnimationID+"-"+o+"-17";!this.trackDataMap.has(c)&&(this.addKeyframeTrack(this._defaultUUID,17,c,null,null,null,null,null,null,null,o),e=this._activeAnimationID+"-"+this._defaultUUID+"-1",s=this.trackDataMap.get(e))&&s.times.forEach(function(e,t,i){var r=l.trackDataMap.get(c),n=s.keyframeIds[t],t=s.groups[t],a=l.viewer.textAnimationOp("getTextPointDataById",o),a=a.initPosition||a.position,a=f(a.x,a.y,l.viewer);r.type="text",l.addTextLineImgKeyframe(r,e,a,n,t),l.trackDataMap.set(c,r),l.textImgId2PositionMap.set(o,r)})},r.addTextColorByTrackId=function(c,d,u,h,f){var p=this,e=(void 0===u&&(u="a"),void 0===h&&(h=!1),void 0===f&&(f=!1),this.viewer.getAllNoteContent());Array.isArray(e)&&e.forEach(function(e){var t=e.id||e.state.id;if((e.animationID||e.state.animationID)!=p._activeAnimationID)return!0;var i,r,n,a,o,s,e=p._activeAnimationID+"-"+t+"-13",l=(p.trackDataMap.has(e)||(p.addKeyframeTrack(p._defaultUUID,13,e,null,null,null,null,null,null,t),0!=d&&(r=m("#000000"),a=m("#FF6302"),(i=p.trackDataMap.get(e)).lineColors||(i.lineColors=[]),p.addTextColorKeyframe(i,0,r,a,"0","a"),p.trackDataMap.set(e,i),p.uuid2TextLineColorTrackMap.set(t,i))),p.trackDataMap.get(e));l.lineColors||(l.lineColors=[]),l&&l.animationID==p._activeAnimationID&&(a=h?(n=m("#000000"),m("#FF6302")):(n=m((r=p.viewer.getAnnotationColorAndOpacity(t))?r.Notecolor:"#000000"),m(r?r.NoteLineColor:"#FF6302")),f&&(n=L(l,"colors",d),a=L(l,"lineColors",d)),l.times.includes(d)&&p.removeKeyframeByTrackID(d,l.trackID),p.addTextColorKeyframe(l,d,n,a,c,u),f&&(o=l.times.findIndex(function(e){return d<=e}),s=l.groups[o+1],l.groups.forEach(function(e,t){o<=t&&e==s&&(l.groups[t]=u)})),p.trackDataMap.set(e,l),p.uuid2TextLineColorTrackMap.set(t,l))}),this.addText2ColorByTrackId(c,d,u,h,f)},r.addText2ColorByTrackId=function(s,l,c,d,u){var h=this,e=(void 0===c&&(c="a"),void 0===d&&(d=!1),void 0===u&&(u=!1),this.viewer.textAnimationOp("getTextPointAllData"));Array.isArray(e)&&e.forEach(function(e){if(e.animationID!=h._activeAnimationID)return!0;var t,i,r,n,e=e.id,a=h._activeAnimationID+"-"+e+"-13",o=(h.trackDataMap.has(a)||(h.addKeyframeTrack(h._defaultUUID,13,a,null,null,null,null,null,null,null,e),0!=l&&(t=m("#000000"),(i=h.trackDataMap.get(a)).type="text",h.addTextColorKeyframe(i,0,t,null,"0","a"),h.trackDataMap.set(a,i),h.uuid2TextLineColorTrackMap.set(e,i))),h.trackDataMap.get(a));o&&o.animationID==h._activeAnimationID&&(i=d||"inherit"==(t=h.viewer.textAnimationOp("getTextPointDataById",e)).style.color?m("#000000"):m(t.style.color),u&&(i=L(o,"colors",l)),o.times.includes(l)&&h.removeKeyframeByTrackID(l,o.trackID),h.addTextColorKeyframe(o,l,i,null,s,c),u&&(r=o.times.findIndex(function(e){return l<=e}),n=o.groups[r+1],o.groups.forEach(function(e,t){r<=t&&e==n&&(o.groups[t]=c)})),o.type="text",h.trackDataMap.set(a,o),h.uuid2TextLineColorTrackMap.set(e,o))})},r.addColorKeyframeForAll=function(l,c,d,u,h){for(var f,p=this,e=(void 0===d&&(d="a"),void 0===u&&(u=!1),void 0===h&&(h=!1),G(this.trackDataMap));!(f=e()).done;)!function(){var t,i,r,n,e,a=f.value,o=a[0],s=a[1],a=(s.ndsModelId&&p.viewer.ndsModel.setActiveModelByModelId(s.ndsModelId),s.modelID[0]);s.animationID==p._activeAnimationID&&(e=s.trackType,t=[],4==e)&&(e=u?p.originalColorMap.get(a+"-"+s.ndsModelId):p.viewer.getObjectColorRGB(a,s.ndsModelId),h&&(a=R(p.viewer.ndsModel.getBodyNodeFrom(a,s.ndsModelId),s,c),i=[],Array.isArray(a)&&a.length&&a.forEach(function(e){i.push(e.value)}),i.length)&&(e=i),s.times.includes(c)&&p.removeKeyframeForAllByType(c,[4]),Array.isArray(e)&&e.forEach(function(e){t.push(e.r,e.g,e.b)}),p.addPropertyKeyframe("color",s,c,t.length?t:e,l,d),h&&(r=s.times.findIndex(function(e){return c<=e}),n=s.groups[r+1],s.groups.forEach(function(e,t){r<=t&&e==n&&(s.groups[t]=d)})),p.trackDataMap.set(o,s))}()},r.addTextImgOpacityByTrackId=function(s,l,c,d,u){var h=this,e=(void 0===d&&(d=!1),void 0===u&&(u=!1),this.viewer.getAllNoteContent()),t=this.viewer.getallPicContent(),i=[];Array.isArray(e)&&e.map(function(e){e.state.animationID==h._activeAnimationID&&i.push(e.state.id)}),Array.isArray(t)&&t.map(function(e){e.animationID==h._activeAnimationID&&i.push(e.id)}),i&&i.length&&i.forEach(function(e){var t,i,r,n,a=h._activeAnimationID+"-"+e+"-12",o=(h.trackDataMap.has(a)||(h.addKeyframeTrack(h._defaultUUID,12,a,null,null,null,null,null,null,e),0!=l&&(t=h.trackDataMap.get(a),h.addPropertyKeyframe("opacity",t,0,1,"0","a"),h.trackDataMap.set(a,t),h._recordMapUuid2Track(h.uuid2TextImgOpacityTrackMap,e,t))),h.trackDataMap.get(a));o&&o.animationID==h._activeAnimationID&&(t=!d&&(t=h.viewer.getAnnotationColorAndOpacity(e))?parseFloat(t.opacity):1,u&&(i=C([o],l))&&(t=i),o.times.includes(l)&&h.removeKeyframeByTrackID(l,o.trackID),h.addPropertyKeyframe("opacity",o,l,t,s,c),u&&(r=o.times.findIndex(function(e){return l<=e}),n=o.groups[r+1],o.groups.forEach(function(e,t){r<=t&&e==n&&(o.groups[t]=c)})),h.trackDataMap.set(a,o),h._recordMapUuid2Track(h.uuid2TextImgOpacityTrackMap,e,o))}),this.addTextOpacityByTrackId(s,l,c,d,u)},r.addTextOpacityByTrackId=function(s,l,c,d,u){var h=this,e=(void 0===d&&(d=!1),void 0===u&&(u=!1),this.viewer.textAnimationOp("getTextPointAllData"));e&&e.length&&e.forEach(function(e){if(e.animationID!=h._activeAnimationID)return!0;var i,r,t,n=e.id,a=h._activeAnimationID+"-"+n+"-12",o=(h.trackDataMap.has(a)||(h.addKeyframeTrack(h._defaultUUID,12,a,null,null,null,null,null,null,null,n),0!=l&&(t=h.trackDataMap.get(a),h.addPropertyKeyframe("opacity",t,0,1,"0","a"),t.type="text",h.trackDataMap.set(a,t),h._recordMapUuid2Track(h.uuid2TextImgOpacityTrackMap,n,t))),h.trackDataMap.get(a));o&&o.animationID==h._activeAnimationID&&(t=d?1:parseFloat(e.style.opacity),u&&(e=C([o],l))&&(t=e),o.times.includes(l)&&h.removeKeyframeByTrackID(l,o.trackID),h.addPropertyKeyframe("opacity",o,l,t,s,c),u&&(i=o.times.findIndex(function(e){return l<=e}),r=o.groups[i+1],o.groups.forEach(function(e,t){i<=t&&e==r&&(o.groups[t]=c)})),o.type="text",h.trackDataMap.set(a,o),h._recordMapUuid2Track(h.uuid2TextImgOpacityTrackMap,n,o))})},r.addOpacityKeyframeForAll=function(o,s,l,c,d){for(var u,h=this,e=(void 0===l&&(l="a"),void 0===c&&(c=!1),void 0===d&&(d=!1),G(this.trackDataMap));!(u=e()).done;)!function(){var e=u.value,t=e[0],i=e[1],e=(i.ndsModelId&&h.viewer.ndsModel.setActiveModelByModelId(i.ndsModelId),i.modelID[0]+"-"+i.ndsModelId);if(i.animationID==h._activeAnimationID&&5==i.trackType){var r,n,a=h.allBodyUuid2BodyNodeMap.get(e);if(!a)return;e=c?h.originalOpacityMap.get(e):h.viewer.getObjectOpacityOnly(a),d&&(a=P(a,[i],s),Array.isArray(a))&&(e=a.map(function(e){return e.value})),i.times.includes(s)&&h.removeKeyframeForAllByType(s,[5]),h.addPropertyKeyframe("opacity",i,s,e,o,l),d&&(r=i.times.findIndex(function(e){return s<=e}),n=i.groups[r+1],i.groups.forEach(function(e,t){r<=t&&e==n&&(i.groups[t]=l)})),h.trackDataMap.set(t,i)}}()},r.addPropertyKeyframe=function(e,t,i,r,n,a){t.keyframeIds||(t.keyframeIds=[]),t.groups||(t.groups=[]);var o=JSON.parse(JSON.stringify(t.times)),s=A(t.times,i);switch(o.splice(s,0,i),t.times=o,n&&t.keyframeIds.splice(s,0,n),a&&t.groups.splice(s,0,a),e){case"color":var l=JSON.parse(JSON.stringify(t.colors));Array.isArray(r)?l.splice(3*s,0,r,null,null):l.splice(3*s,0,r.r,r.g,r.b),t.colors=l;break;case"opacity":l=JSON.parse(JSON.stringify(t.opacities));Array.isArray(r)?l.splice(+s,0,1<r.length?r:r[0]):l.splice(+s,0,r),t.opacities=l}},r.addTextColorKeyframe=function(e,t,i,r,n,a){e.keyframeIds||(e.keyframeIds=[]),e.groups||(e.groups=[]);var o=JSON.parse(JSON.stringify(e.times)),s=A(e.times,t),t=(o.splice(s,0,t),e.times=o,n&&e.keyframeIds.splice(s,0,n),a&&e.groups.splice(s,0,a),JSON.parse(JSON.stringify(e.colors)));t.splice(3*s,0,i[0],i[1],i[2]),e.colors=t,r&&((o=JSON.parse(JSON.stringify(e.lineColors))).splice(3*s,0,r[0],r[1],r[2]),e.lineColors=o)},r.addCameraKeyframe=function(e,t,i,r){void 0===i&&(i="a"),void 0===r&&(r=!1);var n,a,o=this._activeAnimationID+"-"+this._defaultUUID+"-6",s=(this.trackDataMap.has(o)||this.addKeyframeTrack(this._defaultUUID,6,o),this.trackDataMap.get(o)),o=(s.times.includes(t)&&this.removeKeyframe(s,t),s.keyframeIds||(s.keyframeIds=[]),s.groups||(s.groups=[]),s.ups||(s.ups=[]),s.targets||(s.targets=[]),s.devices||(s.devices=[]),s.projectionMatrixInverses||(s.projectionMatrixInverses=[]),s.orbitCenters||(s.orbitCenters=[]),null),l=(r&&(o=U(s,t)),A(s.times,t)),e=(s.keyframeIds.splice(l,0,e),s.groups.splice(l,0,i),s.times.splice(l,0,t),(o||this.viewer.camera).position),c=(o||this.viewer.camera).up,d=(o||this.viewer.camera).target,u=o&&o.orbitCenter?o.orbitCenter:this.viewer.controls.getBoundingBox().getCenter(new THREE.Vector3),h=o&&o.device?o.device:(new THREE.Vector3).copy(u).project(this.viewer.camera),o=(o&&o.projectionMatrixInverse?o:this.viewer.camera).projectionMatrixInverse.toArray();s.orbitCenters.splice(3*l,0,u.x,u.y,u.z),s.devices.splice(3*l,0,h.x,h.y,h.z),(u=s.projectionMatrixInverses).splice.apply(u,[16*l,0].concat(o)),s.cameras.splice(3*l,0,e.x,e.y,e.z),s.ups.splice(3*l,0,c.x,c.y,c.z),s.targets.splice(3*l,0,d.x,d.y,d.z),r&&(n=s.times.findIndex(function(e){return t<=e}),a=s.groups[n+1],s.groups.forEach(function(e,t){n<=t&&e==a&&(s.groups[t]=i)}))},r.removeCameraKeyframe=function(e){var t=this._activeAnimationID+"-"+this._defaultUUID+"-6",i=this.trackDataMap.get(t);i&&i.times.includes(e)&&this.removeKeyframe(i,e),0==i.times.length&&(this.trackDataMap.delete(t),this.animationDataMap.delete(t),this.viewer.resetCamera({useOrginal:!0,smoothTranslation:!0}))},r.getAudioFileLen=function(e,t){var i=e.name.split(".")[1],e=URL.createObjectURL(e),r=new O.Howl({src:[e],html5:!0,format:[i],onload:function(){var e=r.duration();t&&t(e)},onloaderror:function(e,t){console.log("load error:",e,t)},onplayerror:function(e,t){console.log("play error:",e,t)}})},r.addAudioKeyframe=function(e,t,i,r){void 0===r&&(r="a");var n,a,o,s=i.name,l=this._activeAnimationID+"-"+this._defaultUUID+"-9",l=(this.trackDataMap.has(l)||this.addKeyframeTrack(this._defaultUUID,9,l),this.trackDataMap.get(l)),c=(l.groups||(l.groups=[]),l.src||(l.src=[]),l.srcKeys||(l.srcKeys=[]),A(l.times,e)),s=(l.groups.splice(c,0,r,r),l.times.splice(c,0,e,t),l.src.splice(c,0,s),r);l.srcKeys.splice(c,0,s),r=this.playlistMap,n=e,a=t,l=i,c=s,e=this._activeAnimationID,t=l.name,i=t.split(".")[1],s=URL.createObjectURL(l),o={srcKey:c,src:s,howl:null,name:t,file:l,animationID:e},r.set(e+"-"+c,o),o.howl=new O.Howl({src:[s],html5:!0,format:[i],usingWebAudio:!0,onplay:function(){console.log("播放开始")},onload:function(){var e=o.howl.duration();o.startTime=n,o.endTime=a,o.duration=e},onend:function(){console.log("播放结束")},onloaderror:function(e,t){console.log("edit load error:",e,t)},onplayerror:function(e,t){console.log("edit play error:",e,t)}})},r.removeAudioKeyframe=function(e){var t=this._activeAnimationID+"-"+this._defaultUUID+"-9",t=this.trackDataMap.get(t),t=(t&&t.times.includes(e)&&this.removeKeyframe(t,e),F(this.playlistMap,e,this._activeAnimationID));t&&(t.howl.stop(),this.playlistMap.delete(this._activeAnimationID+"-"+t.srcKey))},r.addKeyframe=function(e,t,i,r,n,a,o){t.times.includes(i)&&this.removeKeyframe(t,i);var s=JSON.parse(JSON.stringify(t.times)),l=A(t.times,i),i=(s.splice(l,0,i),t.times=s,t.centers.splice(3*l,0,n.x,n.y,n.z),[]);switch(Array.isArray(a)?i=a.slice():a.toArray(i),(s=t.worldMatrixFrame).splice.apply(s,[16*l,0].concat(i)),t.groups.splice(l,0,o),e){case"quaternion":var c=JSON.parse(JSON.stringify(t.rotations));c.splice(4*l,0,r.x,r.y,r.z,r.w),t.rotations=c;break;case"position":c=JSON.parse(JSON.stringify(t.translations));c.splice(3*l,0,r.x,r.y,r.z),t.translations=c;break;case"scale":c=JSON.parse(JSON.stringify(t.scales));c.splice(3*l,0,r.x,r.y,r.z),t.scales=c}},r.addTextLineImgKeyframe=function(e,t,i,r){e.times.includes(t)&&this.removeKeyframe(e,t);var n=JSON.parse(JSON.stringify(e.times)),a=A(e.times,t),t=(n.splice(a,0,t),e.times=n,e.groups.splice(a,0,r),JSON.parse(JSON.stringify(e.translations)));t.splice(3*a,0,i.x,i.y,i.z||0),e.translations=t},r.pasteKeyframe=function(t,e,i,r){for(var n=G(this.trackDataMap);!(b=n()).done;){var a,o,s,l,c,d,u,h,f,p,m,y,v,g,_,w,x,I,b=b.value,b=(b[0],b[1]);Array.isArray(b.keyframeIds)&&-1<(I=b.keyframeIds.findIndex(function(e){return e==t}))&&(b.times.includes(i)&&this.removeKeyframeByTrackID(i,b.trackID),I=b.keyframeIds.findIndex(function(e){return e==t}),a=A(b.times,i),1==b.trackType?(l=b.translations[3*I],s=b.translations[3*I+1],o=b.translations[3*I+2],b.translations.splice(3*a,0,l,s,o),b.times.splice(a,0,i),l=b.centers[3*I],s=b.centers[3*I+1],o=b.centers[3*I+2],b.centers.splice(3*a,0,l,s,o),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r),l=b.worldMatrixFrame.slice(16*I,16*I+16),(s=b.worldMatrixFrame).splice.apply(s,[16*a,0].concat(l))):2==b.trackType?(o=b.rotations[4*I],s=b.rotations[4*I+1],l=b.rotations[4*I+2],u=b.rotations[4*I+3],b.rotations.splice(4*a,0,o,s,l,u),b.times.splice(a,0,i),u=b.centers[3*I],d=b.centers[3*I+1],c=b.centers[3*I+2],b.centers.splice(3*a,0,u,d,c),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r),u=b.worldMatrixFrame.slice(16*I,16*I+16),(d=b.worldMatrixFrame).splice.apply(d,[16*a,0].concat(u))):3==b.trackType?(c=b.scales[3*I],d=b.scales[3*I+1],u=b.scales[3*I+2],b.scales.splice(3*a,0,c,d,u),b.times.splice(a,0,i),p=b.centers[3*I],f=b.centers[3*I+1],h=b.centers[3*I+2],b.centers.splice(3*a,0,p,f,h),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r),p=b.worldMatrixFrame.slice(16*I,16*I+16),(f=b.worldMatrixFrame).splice.apply(f,[16*a,0].concat(p))):4==b.trackType?(h=b.colors[3*I],f=b.colors[3*I+1],p=b.colors[3*I+2],b.colors.splice(3*a,0,h,f,p),b.times.splice(a,0,i),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r)):5==b.trackType?(m=b.opacities[I],b.opacities.splice(a,0,m),b.times.splice(a,0,i),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r)):6==b.trackType?(m=b.cameras[3*I],g=b.cameras[3*I+1],v=b.cameras[3*I+2],b.cameras.splice(3*a,0,m,g,v),b.times.splice(a,0,i),g=b.ups[3*I],v=b.ups[3*I+1],y=b.ups[3*I+2],b.ups.splice(3*a,0,g,v,y),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r),g=b.targets[3*I],v=b.targets[3*I+1],y=b.targets[3*I+2],b.targets.splice(3*a,0,g,v,y),g=b.orbitCenters[3*I],v=b.orbitCenters[3*I+1],y=b.orbitCenters[3*I+2],b.orbitCenters.splice(3*a,0,g,v,y),b.devices&&(g=b.devices[3*I],v=b.devices[3*I+1],y=b.devices[3*I+2],b.devices.splice(3*a,0,g,v,y)),b.projectionMatrixInverses&&(g=b.projectionMatrixInverses.slice(16*I,16*I+16),(v=b.projectionMatrixInverses).splice.apply(v,[16*a,0].concat(g)))):13==b.trackType?(y=b.colors[3*I],v=b.colors[3*I+1],g=b.colors[3*I+2],b.colors.splice(3*a,0,y,v,g),b.lineColors&&b.lineColors.length&&(_=b.lineColors[3*I],w=b.lineColors[3*I+1],x=b.lineColors[3*I+2],b.lineColors.splice(3*a,0,_,w,x)),b.times.splice(a,0,i),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r)):12==b.trackType?(_=b.opacities[I],b.opacities.splice(a,0,_),b.times.splice(a,0,i),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r)):17==b.trackType?(w=b.translations[3*I],x=b.translations[3*I+1],I=b.translations[3*I+2],b.translations.splice(3*a,0,w,x,I),b.times.splice(a,0,i),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r)):14!=b.trackType&&15!=b.trackType&&16!=b.trackType||(b.times.splice(a,0,i),b.keyframeIds.splice(a,0,e),b.groups.splice(a,0,r)))}},r.deleteBlockKeyframe=function(e,t,i){var r=this,n=Array.from(this.trackID2PositionTrackMap.values()),a=[];if("位置"==e?a=n.filter(function(e){return e.animationID==r._activeAnimationID&&(1==e.trackType||2==e.trackType||3==e.trackType)}):"属性"==e?a=n.filter(function(e){return e.animationID==r._activeAnimationID&&(4==e.trackType||5==e.trackType)}):"相机"==e?a=n.filter(function(e){return e.animationID==r._activeAnimationID&&6==e.trackType}):"轨迹"==e?a=n.filter(function(e){return e.animationID==r._activeAnimationID&&8==e.trackType}):"特效"==e&&(a=n.filter(function(e){return e.animationID==r._activeAnimationID&&7==e.trackType})),a&&0<a.length){for(var o=[],s=0;s<a.length;s++)for(var l=a[s],c=0;c<l.times.length;c++)l.times[c]>=t&&l.times[c]<=i&&o.push({trackID:l.trackID,time:l.times[c]});if(o&&0<o.length)if("位置"==e)for(var d=this.timelinePosTrack.find(function(e){return e.animationID==r._activeAnimationID}),u=0;u<o.length;u++){var h=o[u];this.removeKeyframeByTrackID(h.time,h.trackID),this._removeTimelineKeyframe(d,h.time)}else for(var f=0;f<o.length;f++){var p=o[f];this.removeKeyframeByTrackID(p.time,p.trackID)}}},r.getTime0PostionModelObjects=function(){var t=this,e=[],i=Array.from(this.trackID2PositionTrackMap.values()).filter(function(e){return e.animationID==t._activeAnimationID&&1==e.trackType&&e.times.includes(0)});if(i&&0<i.length)for(var r=[],n=0;n<i.length;n++){var a=i[n],o=a.modelID[0]+"-"+a.ndsModelId;r.indexOf(o)<0&&(r.push(o),o=a.modelID[0],a=a.ndsModelId,o=this.viewer.ndsModel.getBodyNodeFrom(o,a),e.push(o))}return e},r.pastePositionKeyframe=function(t,e,i){for(var r=this,n=G(this.trackID2PositionTrackMap);!(a=n()).done;){var a=a.value,o=(a[0],a[1]);if(o.times.includes(t)){o.times.includes(e)&&this.removeKeyframeByTrackID(e,o.trackID);for(var s,a=o.times.findIndex(function(e){return e==t}),l=A(o.times,e),c=JSON.parse(JSON.stringify(o.times)),c=(c.splice(l,0,e),o.times=c,JSON.parse(JSON.stringify(o.centers))),c={x:c[3*a],y:c[3*a+1],z:c[3*a+2]},d=[],u=16*a,h=16+u,f=u;f<h;f++)d.push(o.worldMatrixFrame[f]);o.centers.splice(3*l,0,c.x,c.y,c.z),(u=o.worldMatrixFrame).splice.apply(u,[16*l,0].concat(d)),o.groups.splice(l,0,i),o.rotations.length&&(s={x:(c=JSON.parse(JSON.stringify(o.rotations)))[4*a],y:c[4*a+1],z:c[4*a+2],w:c[4*a+3]},c.splice(4*l,0,s.x,s.y,s.z,s.w),o.rotations=c),o.translations.length&&(s={x:(u=JSON.parse(JSON.stringify(o.translations)))[3*a],y:u[3*a+1],z:u[3*a+2]},u.splice(3*l,0,s.x,s.y,s.z),o.translations=u),o.scales.length&&(s={x:(c=JSON.parse(JSON.stringify(o.scales)))[3*a],y:c[3*a+1],z:c[3*a+2]},c.splice(3*l,0,s.x,s.y,s.z),o.scales=c)}}var p=this.timelinePosTrack.find(function(e){return e.animationID==r._activeAnimationID});p&&this._addTimelineKeframe(p,e,i)},r._verifyRecordedUuid=function(){var t=this,e=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID}),i=this._activeAnimationID+"-"+this._defaultUUID+"-1",i=this.trackDataMap.get(i),i=(i&&1==i.times.length&&e&&!e.isShowPositonFirstKeyframe&&-1<(r=(i=this.selectedBodyUuidMap.get(this._activeAnimationID))&&i.findIndex(function(e){return"position"==e.type}))&&i.splice(r,1),this._activeAnimationID+"-"+this._defaultUUID+"-4"),r=this.trackDataMap.get(i),i=(r&&1==r.times.length&&e&&!e.isShowColorFirstKeyframe&&-1<(r=(i=this.selectedBodyUuidMap.get(this._activeAnimationID))&&i.findIndex(function(e){return"color"==e.type}))&&i.splice(r,1),this._activeAnimationID+"-"+this._defaultUUID+"-5"),r=this.trackDataMap.get(i);r&&1==r.times.length&&e&&!e.isShowOpacityFirstKeyframe&&-1<(r=(i=this.selectedBodyUuidMap.get(this._activeAnimationID))&&i.findIndex(function(e){return"opacity"==e.type}))&&i.splice(r,1)},r._preReleaseAnimation=function(){this._releaseStuctData={animations:[],tracks:[],drawGeoms:[],textLabels:[],imageLabels:[],textIdLabels:[],models:[],timelinePosTrack:this.timelinePosTrack};for(var e=0;e<this.viewer.ndsModel.models.length;e++){var t=this.viewer.ndsModel.models[e],i={animationId:t.animationId,name:t.rootBodyNode.name,url:t.modelUri,modelId:t.id,main:0==e,position:t.position,modelRootMatrix:t.rootMatrix};this._releaseStuctData.models.push(i),this.releaseModelMap.has(t.id)&&this.releaseModelMap.delete(t.id)}if(this.releaseModelMap.size)for(var r=G(this.releaseModelMap);!(n=r()).done;){var n=n.value,n=(n[0],n[1]);this._releaseStuctData.models.push(n)}if(this.models=this._releaseStuctData.models,this._preReleaseTraceData(this._activeAnimationID),this.releaseTrackMap.size){for(var a=Array.from(this.releaseTrackMap.keys()),o=0;o<a.length;o++){var s=a[o],l=s.split("_")[1];l&&!this.struct.animations.find(function(e){return e.animationID==l})&&this.releaseTrackMap.delete(s)}for(var c=G(this.releaseTrackMap);!(d=c()).done;){var d=d.value,u=d[0],d=d[1];u.startsWith("rtrack_")&&(this._releaseStuctData.animations.push(d.animation),this._releaseStuctData.tracks=this._releaseStuctData.tracks.concat(d.tracks),this._releaseStuctData.textLabels=this._releaseStuctData.textLabels.concat(d.label.textLabels),this._releaseStuctData.imageLabels=this._releaseStuctData.imageLabels.concat(d.label.imageLabels),this._releaseStuctData.textIdLabels=this._releaseStuctData.textIdLabels.concat(d.label.textIdLabels))}}},r._preReleaseTraceData=function(l){var c=this,e=this.struct.animations.find(function(e){return e.animationID==l});if(e){var t,i,e=JSON.parse(JSON.stringify(e)),d=[],u=[],h={textLabels:[],imageLabels:[],textIdLabels:[]},r=this.selectedBodyUuidMap.get(l);if(r&&r.length?((t=r.find(function(e){return"color"==e.type}))?t.uuids.forEach(function(e){var e=l+"-"+e+"-4",t=c.animationDataMap.get(e),t=(t&&u.push(t),c.trackDataMap.get(e));t&&d.push(t)}):(t=l+"-"+this._defaultUUID+"-4",(i=this.animationDataMap.get(t))&&u.push(i),(i=this.trackDataMap.get(t))&&d.push(i)),(t=r.find(function(e){return"opacity"==e.type}))?t.uuids.forEach(function(e){var e=l+"-"+e+"-5",t=c.animationDataMap.get(e),t=(t&&u.push(t),c.trackDataMap.get(e));t&&d.push(t)}):(i=l+"-"+this._defaultUUID+"-5",(t=this.animationDataMap.get(i))&&u.push(t),(t=this.trackDataMap.get(i))&&d.push(t)),(i=r.find(function(e){return"specialEffect"==e.type}))&&i.uuids.forEach(function(e){e=c.uuid2OpacityTrackDataMap.get(e);e&&e.forEach(function(e){var t;e.animationID==c._activeAnimationID&&((t=c.animationDataMap.get(e.trackID))&&u.push(t),t=c.trackDataMap.get(e.trackID),d.push(t))})}),t=l+"-"+this._defaultUUID+"-6",(r=this.trackDataMap.get(t))&&r.times.length&&((i=this.animationDataMap.get(t))&&u.push(i),d.push(r)),t=l+"-"+this._defaultUUID+"-9",(i=this.trackDataMap.get(t))&&i.times.length&&((r=this.animationDataMap.get(t))&&u.push(r),d.push(i))):(E.forEach(function(e){var e=l+"-"+c._defaultUUID+"-"+e.trackType,t=c.animationDataMap.get(e),t=(t&&u.push(t),c.trackDataMap.get(e));d.push(t)}),t=l+"-"+this._defaultUUID+"-6",(r=this.trackDataMap.get(t))&&r.times.length&&((i=this.animationDataMap.get(t))&&u.push(i),d.push(r)),t=l+"-"+this._defaultUUID+"-9",(i=this.trackDataMap.get(t))&&i.times.length&&((r=this.animationDataMap.get(t))&&u.push(r),d.push(i))),this.getTextIdsLabels(),this.textLabelsMap.size)for(var f,n=G(this.textLabelsMap);!(f=n()).done;)!function(){var e=f.value,t=e[0],i=e[1];if(i.animationID==l){for(var r={x:0,y:0,z:0},n=0;n<c.models.length;n++){var a=c.models[n];if(a.animationId&&a.animationId==l&&a.modelId==i.ndsModelId){r=Array.isArray(a.position)?a.position[_index]:a.position;break}}var e=i.interPnt?i.interPnt.toArray():null,o=i.projPt?i.projPt.toArray():null,e=T({},i,{interPnt:e&&[e[0]-r.x,e[1]-r.y,e[2]-r.z],projPt:o&&[o[0]-r.x,o[1]-r.y,o[2]-r.z]}),s=(h.textLabels.push(e),c.uuid2TextImgOpacityTrackMap.get(t)),o=(s&&s.forEach(function(e,t){var i;e.animationID==l&&((i=c.animationDataMap.get(e.trackID))&&u.push(i),i=c.trackDataMap.get(e.trackID),d.push(i),s[t]=i)}),c.uuid2TextLineColorTrackMap.get(t));o&&o.animationID==l&&((e=c.animationDataMap.get(o.trackID))&&u.push(e),t=c.trackDataMap.get(o.trackID),d.push(t))}}();if(this.imageLabelsMap.size)for(var a,o=G(this.imageLabelsMap);!(a=o()).done;)!function(){var r,e=a.value,t=e[0],e=e[1];e.animationID==l&&(h.imageLabels.push(e),r=c.uuid2TextImgOpacityTrackMap.get(t))&&r.forEach(function(e,t){var i;e.animationID==l&&((i=c.animationDataMap.get(e.trackID))&&u.push(i),i=c.trackDataMap.get(e.trackID),d.push(i),r[t]=i)})}();if(this.textIdLabelsMap.size)for(var s,p=G(this.textIdLabelsMap);!(s=p()).done;)!function(){var r,e=s.value,t=e[0],e=e[1];e.animationID==l&&(e=T({},e),h.textIdLabels.push(e),(r=c.uuid2TextImgOpacityTrackMap.get(t))&&r.forEach(function(e,t){var i;e.animationID==l&&((i=c.animationDataMap.get(e.trackID))&&u.push(i),i=c.trackDataMap.get(e.trackID),d.push(i),r[t]=i)}),e=c.uuid2TextLineColorTrackMap.get(t))&&e.animationID==l&&((t=c.animationDataMap.get(e.trackID))&&u.push(t),t=c.trackDataMap.get(e.trackID),d.push(t))}();if(this.textImgId2PositionMap.size)for(var m=G(this.textImgId2PositionMap);!(v=m()).done;){var y,v=v.value,v=(v[0],v[1]);v.animationID==l&&((y=this.animationDataMap.get(v.trackID))&&u.push(y),y=this.trackDataMap.get(v.trackID),d.push(y))}if(this.id2showHideTrackMap.size)for(var g=G(this.id2showHideTrackMap);!(w=g()).done;){var _,w=w.value,w=(w[0],w[1]);w.animationID==l&&((_=this.animationDataMap.get(w.trackID))&&u.push(_),_=this.trackDataMap.get(w.trackID),d.push(_))}if(this.trackID2PositionTrackMap.size)for(var x=G(this.trackID2PositionTrackMap);!(I=x()).done;){var I=I.value,b=I[0];I[1].animationID==l&&((I=this.animationDataMap.get(b))&&u.push(I),I=this.trackDataMap.get(b),d.push(I))}if(this.uuid2TrajectoryMap.size)for(var M=G(this.uuid2TrajectoryMap);!(A=M()).done;){var A=A.value;A[0];A[1].filter(function(e){return e.animationID==l}).forEach(function(e){var t=c.animationDataMap.get(e.trackID),t=(t&&u.push(t),c.trackDataMap.get(e.trackID));d.push(t)})}e.tracks=u,this.releaseTrackMap.set("rtrack_"+l,{animation:e,tracks:d,label:h})}else console.log("_preReleaseTraceData undefine")},r._updateTextLabels=function(e){if(this.textLabelsMap.size&&this.releaseTrackMap.has("rtrack_"+e)){this.releaseTrackMap.get("rtrack_"+e).label.textLabels.length=0;for(var t=G(this.textLabelsMap);!(i=t()).done;){var i=i.value,r=(i[0],i[1]);if(r.animationID==e){for(var n={x:0,y:0,z:0},a=0;a<this.models.length;a++){var o=this.models[a];if(o.animationId&&o.animationId==e&&o.modelId==r.ndsModelId){o.position&&(n=o.position);break}}var i=r.interPnt?r.interPnt.toArray():null,s=r.projPt?r.projPt.toArray():null,i=T({},r,{interPnt:i&&[i[0]-n.x,i[1]-n.y,i[2]-n.z],projPt:s&&[s[0]-n.x,s[1]-n.y,s[2]-n.z]});this.releaseTrackMap.get("rtrack_"+e).label.textLabels.push(i)}}}},r.updateKeyframeGroupByType=function(e,t,i){for(var r=G(this.trackDataMap);!(n=r()).done;){var n=n.value,n=(n[0],n[1]);n.animationID==this._activeAnimationID&&i.includes(n.trackType)&&this.updateKeyframeGroup(n,e,t)}},r.updateKeyframeGroup=function(i,r,n){Array.isArray(i.groups)&&i.groups.length&&i.groups.forEach(function(e,t){e==r&&(i.groups[t]=n)})},r.removeKeyframeForAll=function(e){for(var t=G(this.trackDataMap);!(i=t()).done;){var i=i.value,r=i[0],i=i[1];i.animationID==this._activeAnimationID&&(this.removeKeyframe(i,e),this.trackDataMap.set(r,i))}},r.removeKeyframeForAllByType=function(e,t){for(var i=G(this.trackDataMap);!(r=i()).done;){var r=r.value,n=r[0],r=r[1];r.animationID==this._activeAnimationID&&t.includes(r.trackType)&&(this.removeKeyframe(r,e),this.trackDataMap.set(n,r))}},r.removeKeyframeByTrackID=function(e,t,i){if(this.trackDataMap.has(t)){var r,t=this.trackDataMap.get(t);if(this.removeKeyframe(t,e,i),14==t.trackType||15==t.trackType||16==t.trackType){if(15==t.trackType)r=t.textImgId;else if(14==t.trackType)r=this._activeAnimationID+"-"+t.htmlUUIDS[0];else{if(16!=t.trackType)return;r=t.textId}this.id2showHideTrackMap.set(r,t)}}},r.removeKeyframe=function(e,t,i){var r={trackID:e.trackID},n=e.times.slice(),a=i?e.groups.findIndex(function(e){return e==i}):e.times.findIndex(function(e){return e==t});if(-1<a)return r.times=n.splice(a,1),e.times=n,e.keyframeIds&&e.keyframeIds.length&&(r.keyframeIds=e.keyframeIds.splice(a,1)),e.groups&&e.groups.length&&(r.groups=e.groups.splice(a,1)),1==e.trackType&&e.translations.length?(r.translations=e.translations.splice(3*a,3),r.worldMatrixFrame=e.worldMatrixFrame.splice(16*a,16),r.centers=e.centers.splice(3*a,3)):2==e.trackType&&e.rotations.length?(r.rotations=e.rotations.splice(4*a,4),r.worldMatrixFrame=e.worldMatrixFrame.splice(16*a,16),r.centers=e.centers.splice(3*a,3)):3==e.trackType&&e.scales.length?(r.scales=e.scales.splice(3*a,3),r.worldMatrixFrame=e.worldMatrixFrame.splice(16*a,16),r.centers=e.centers.splice(3*a,3)):4==e.trackType&&e.colors.length?r.colors=e.colors.splice(3*a,3):5==e.trackType&&e.opacities.length?r.opacities=e.opacities.splice(a,1):6==e.trackType&&e.cameras.length?(r.cameras=e.cameras.splice(3*a,3),r.ups=e.ups.splice(3*a,3),r.targets=e.targets.splice(3*a,3),r.orbitCenters=e.orbitCenters.splice(3*a,3),r.devices=e.devices&&e.devices.splice(3*a,3),r.projectionMatrixInverses=e.projectionMatrixInverses&&e.projectionMatrixInverses.splice(16*a,16)):7==e.trackType&&e.opacities.length?r.opacities=e.opacities.splice(a,1):8==e.trackType&&e.translations.length?r.translations=e.translations.splice(3*a,3):9==e.trackType&&e.srcKeys.length&&e.src.length?(r.srcKeys=e.srcKeys.splice(a,1),r.src=e.src.splice(a,1)):13==e.trackType&&(e.colors.length||e.lineColors&&e.lineColors.length)?(r.colors=e.colors.splice(3*a,3),e.lineColors&&(r.lineColors=e.lineColors.splice(3*a,3))):12==e.trackType&&e.opacities.length&&(r.opacities=e.opacities.splice(a,1)),17==e.trackType&&e.translations.length&&(r.translations=e.translations.splice(3*a,3)),r},r.releaseAnimation=function(n,a){var o,s=this;if(this.isPlay&&this.stop(),this.getImageLabels(),this.getTextLabels(),this.getTextIdsLabels(),this.resetAnimationStartTime(0),this.resetBodyNode(),this.changeBodyNodeMatrix(0),this._verifyRecordedUuid(),this._preReleaseAnimation(),this._releaseStuctData&&this.viewer.controls.staticDrawGeomOp){this._releaseStuctData.drawGeoms=[];for(var e,t=this.viewer.controls.staticDrawGeomOp.drawScene.children,i=0;i<t.length;i++)t[i].isDrawGeom&&(e={uuid:t[i].uuid,name:t[i].name,objectType:t[i].objectType,visible:t[i].visible,geometry:"Point"==t[i].objectType?[]:Array.from(t[i].geometry.attributes.position.array),matrix:Array.from(t[i].matrix.elements),animationID:t[i].animationID},this._releaseStuctData.drawGeoms.push(e))}(this.isRelease||this._releaseStuctData.drawGeoms.length||this._releaseStuctData.textLabels.length||this._releaseStuctData.imageLabels.length)&&this._releaseStuctData&&this._releaseStuctData.tracks.length?(o=pako.deflate(JSON.stringify(this._releaseStuctData),{to:"string"}),this.viewer.zip.file((a||"动画1")+".js",JSON.stringify(this._releaseStuctData)),this.viewer.zip.generateAsync({type:"blob"}).then(function(t){if(s.viewer.jsonMainText){var e=JSON.parse(s.viewer.jsonMainText);e.animationFile=(a||"动画1")+".js.gz",s.viewer.zip.file("model.js",JSON.stringify(e)),s.viewer.zip.file((a||"动画1")+".js.gz",o,{binary:!0});for(var i=G(s.playlistMap);!(r=i()).done;){var r=r.value,r=(r[0],r[1]);r.name&&r.file&&s.viewer.zip.file(r.name,r.file,{binary:!0})}s.viewer.zip.generateAsync({type:"blob"}).then(function(e){n({animationFile:t,modelFile:e}),s.viewer.dispatchEvent({type:"resetOriginTime"})})}})):n({animationFile:null,modelFile:null})},r.resetAnimationStartTime=function(e){x.resetAnimationStartTime(e)},r.resetContainerStyle=function(){document.getElementById("t_container").style.position="relative"==document.getElementById("t_container").style.position?"static":"relative",document.getElementById("t_container").style.overflow="hidden"},r.changeBodyNodeMatrix=function(u){var h=this;if(this._activeAnimationID){this._resetModelNoteNode(),this.viewer.ndsModel.models.forEach(function(e){e.forceRenderAll=!0}),this.viewer.dispatchEvent({type:"exitDrawTrace"});for(var t,f,e={uuids:this._defaultRootUUID,imageLabelsMap:this.imageLabelsMap,textLabelsMap:this.textLabelsMap,textIdLabelsMap:this.textIdLabelsMap,id2showHideStatusMap:this.id2showHideStatusMap,id2showHideTrackMap:this.id2showHideTrackMap,AnimationEdit:this,time:u,selectedHideTreeBody:this.selectedHideTreeBody},e=(Q(this.viewer,e,this._activeAnimationID),this.id2showHideStatusMap.get(this._defaultRootUUID)),p=(null==e&&(e=!0),this.viewer.ndsModel.getModelsByAnimationId(this._activeAnimationID)),i=(e&&this._activeAnimationID&&this.selectedBodyUuidMap.has(this._activeAnimationID)&&((x=(e=this.selectedBodyUuidMap.get(this._activeAnimationID)).find(function(e){return"color"==e.type}))&&x.uuids.forEach(function(e){var t=null,i=null,r=null,n=e.lastIndexOf("-");if(0<n){i=e.slice(0,n),r=e.slice(n+1);if(0<p.filter(function(e){return e.id==r}).length){var n=h.viewer.ndsModel.getModelById(r);if(!n)return!0;t=n.getBodyNodeFromUuid(i)}}else t=h.viewer.ndsModel.getBodyNodeFromUuid(e);t?(n=R(t,h.trackDataMap.get(h._activeAnimationID+"-"+e+"-4"),u),i&&null!=r?(h.viewer.ndsModel.setActiveModelByModelId(r),h.viewer.changeObjectColor(i,n,!0,!1,r)):h.viewer.changeObjectColor(e,n,!0,!1,t.ndsModel.id)):console.log("bodyNode null")}),x=e.filter(function(e){return"opacity"==e.type||"specialEffect"==e.type}))&&(t=[],f=[],x.forEach(function(e){"opacity"==e.type&&(f=e.uuids),S(t,e.uuids)}),t.forEach(function(t){var e=null,i=[],r=(f.includes(t)&&(e=h.trackDataMap.get(h._activeAnimationID+"-"+t+"-5")),h.uuid2OpacityTrackDataMap.get(t));if(r&&r.length&&(r=r.filter(function(e){return e.animationID==h._activeAnimationID})),e&&i.push(e),r&&r.length){i.push.apply(i,r);for(var n=h.struct.animations.find(function(e){return e.animationID==h._activeAnimationID}),a=0;a<r.length;a++)if(r[a].times.includes(0)&&n&&!n.isShowOpacityFirstKeyframe&&e&&1==e.times.length){var o=i.findIndex(function(e){return e.trackID==h._activeAnimationID+"-"+t+"-5"});-1<o&&i.splice(o,1);break}}if(i&&i.length){var s=null,l=t.lastIndexOf("-");if(0<l){var c=t.slice(0,l),d=t.slice(l+1);if(0<p.filter(function(e){return e.id==d}).length){var l=h.viewer.ndsModel.getModelById(d);if(!l)return!0;s=l.getBodyNodeFromUuid(c)}}else s=h.viewer.ndsModel.getBodyNodeFromUuid(t);s&&(l=P(s,i,u),h.viewer.ndsModel.transparentBodyChanged=!0,h.viewer.setObjectOpacityOnly([s],l,!0))}})),[]),r=G(this.uuid2TrajectoryMap);!(n=r()).done;){var n=n.value,a=n[0];0<n[1].filter(function(e){return e.animationID==h._activeAnimationID}).length&&i.push(a)}for(var o=G(this.trackID2PositionTrackMap);!(s=o()).done;){var s=s.value,s=(s[0],s[1]);1==s.trackType&&s.animationID==this._activeAnimationID&&(s=s.modelID+"-"+s.ndsModelId,i.includes(s)||i.push(s))}i.forEach(function(e){var t,i,r,n,a=[],o=[],s=e.lastIndexOf("-");return s<=0||(t=e.slice(s+1),!(0<p.filter(function(e){return e.id==t}).length&&(i=h.allBodyUuid2BodyNodeMap.get(e))))||(s=h._activeAnimationID+"-"+e+"-1",r=h._activeAnimationID+"-"+e+"-2",n=h._activeAnimationID+"-"+e+"-3",s=h.trackID2PositionTrackMap.get(s),r=h.trackID2PositionTrackMap.get(r),n=h.trackID2PositionTrackMap.get(n),s&&r&&n&&a.push(s,r,n),h.uuid2TrajectoryMap.has(e)&&h.uuid2TrajectoryMap.get(e).forEach(function(e){e.animationID==h._activeAnimationID&&o.push(h.trackDataMap.get(e.trackID))}),void((s=q(a,o,u))&&h._changeBodyPosition(i,e,s)))}),this._switchRotateCenterBySelection(),this.viewer.dispatchEvent({type:"updateOpball"});for(var l=G(this.uuid2TextImgOpacityTrackMap);!(d=l()).done;){var c,d=d.value,m=d[0],d=d[1];this.id2showHideStatusMap.get(m)&&"number"==typeof(c=C(d,u))&&(-1<d.findIndex(function(e){return"text"==e.type})?this.viewer.textAnimationOp("setOpacity",m,c):this.viewer.setTransparent(m,c))}for(var y=G(this.uuid2TextLineColorTrackMap);!(_=y()).done;){var v,g,_=_.value,w=_[0],_=_[1];this.id2showHideStatusMap.get(w)&&("text"==_.type?(v=B(L(_,"colors",u)),this.viewer.textAnimationOp("setFontColor",w,v)):(v=L(_,"colors",u),_=L(_,"lineColors",u),g=B(v),_=B(_),this.viewer.setNoteColor(w,g),this.viewer.setNoteLineColor(w,_)))}var e=this.trackDataMap.get(this._activeAnimationID+"-"+this._defaultUUID+"-6"),x=e&&U(e,u,this.viewer);x&&x.position&&x.up&&(this.viewer.camera.position.copy(x.position),this.viewer.camera.up.copy(x.up),this.viewer.camera.target.copy(x.target),this.viewer.camera.setCameraTarget(this.viewer.camera.getCameraTarget()),this.viewer.camera.updateProjectionMatrix(),this.viewer.camera.updateMatrixWorld(!0),this.viewer.viewBox&&this.viewer.cameraControl.updateViewBoxCamDir(),x.device&&x.projectionMatrixInverse&&((e=new THREE.Vector3).copy(x.device).applyMatrix4(x.projectionMatrixInverse).applyMatrix4(this.viewer.camera.matrixWorld),x=new THREE.Vector3(0,0,x.device.z).applyMatrix4(x.projectionMatrixInverse).applyMatrix4(this.viewer.camera.matrixWorld),x=(new THREE.Vector3).copy(x).sub(e),this.viewer.camera.position.add(x),this.viewer.camera.target.add(x)),e={center:this.viewer.camera.target,up:this.viewer.camera.up,position:this.viewer.camera.position},this.viewer.cameraControl.adjustNearAndFar(),this.viewer.startSmoothTranslation(e));for(var I=G(this.textImgId2PositionMap);!(M=I()).done;){var b,M=M.value,A=M[0],M=M[1];this.id2showHideStatusMap.get(A)&&((b=z(M,u))&&this.viewer.controls.staticAnnotation&&"text"!=M.type&&("pic"==M.type&&(b=N(b.x,b.y,this.viewer)),this.viewer.controls.staticAnnotation.setTextLineImgPosition(A,b)),b&&"text"==M.type&&(b=N(b.x,b.y,this.viewer),this.viewer.textAnimationOp("setPosition",A,b.x,b.y)),this.viewer.controls.staticAnnotation)&&this.viewer.controls.staticAnnotation.setTextLineImgPosition&&this.viewer.controls.staticAnnotation.setTextLineImgPosition(A,b)}this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.clearFlag(!0),this.viewer.dispatchEvent({type:"updateAnimationProperties"}),this.viewer.render()}},r.picPositionUpdate=function(e){for(var t=G(this.textImgId2PositionMap);!(r=t()).done;){var i,r=r.value,n=r[0],r=r[1];this.id2showHideStatusMap.get(n)&&((i=z(r,e))&&this.viewer.controls.staticAnnotation&&"text"!=r.type&&("pic"==r.type&&(i=N(i.x,i.y,this.viewer)),this.viewer.controls.staticAnnotation.setTextLineImgPosition(n,i)),i&&"text"==r.type&&(i=N(i.x,i.y,this.viewer),this.viewer.textAnimationOp("setPosition",n,i.x,i.y)),this.viewer.controls.staticAnnotation)&&this.viewer.controls.staticAnnotation.setTextLineImgPosition&&this.viewer.controls.staticAnnotation.setTextLineImgPosition(n,i)}this.viewer.render()},r.setTime0Camera=function(){var e=this.trackDataMap.get(this._activeAnimationID+"-"+this._defaultUUID+"-6"),e=e&&U(e,0,this.viewer);e&&e.position&&e.up||this.viewer.zoomExtents(!0,!1)},r._changeBodyPosition=function(e,t,i){var r;e.preChangeWorldMatrix?e.preChangeWorldMatrix.copy(e.worldMatrix):e.preChangeWorldMatrix=e.worldMatrix.clone(),e.worldMatrix.copy(i),e.preChangeWorldMatrix&&((i=new THREE.Matrix4).getInverse(e.preChangeWorldMatrix),i.premultiply(e.worldMatrix),this.viewer.translatePiovt(t,i),(r=new THREE.Matrix4).extractRotation(i),this.viewer.rotateOnlyPiovt(t,r)),this.viewer.controls.staticAnnotation&&(this.viewer.controls.staticAnnotation.useOffsetMatrix=!0),this._updateBodyNodeBox(e)},r._updateBodyNodeBox=function(e){var i=this,t=(e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds.length&&e.leafBodyAttri.bodyMeshIds.forEach(function(e){var t=i.viewer.ndsModel.meshManager.geomId[e];-1<t&&((t=i.viewer.ndsModel.meshManager.geomManager.getGeomFromId(t)).needsUpdate=!0,t.updateModelMatrix=!0,i.viewer.ndsModel.meshManager.updateMeshBBox(e))}),this.viewer.ndsModel.setActiveModelByModelId(e.getModel().id),e.parent?this.viewer.ndsModel.calculateNodeWorldMatrix(e.parent):new THREE.Matrix4),r=new THREE.Matrix4,t=(r.getInverse(t),e.worldMatrix.clone().premultiply(r));this.viewer.ndsModel.updateNodeMatrix(e.uuid,t.toArray(),e.getModel().id)},r.changeKeyframeForAll=function(e,t,i){for(var r=G(this.trackDataMap);!(f=r()).done;){var n,a,o,s,l,c,d,u,h,f=f.value,f=(f[0],f[1]);t.includes(f.trackType)&&f.animationID==this._activeAnimationID&&(f.centers&&f.centers.length&&(n=p(f.times,f.centers,e),f.centers=n.target),f.worldMatrixFrame&&f.worldMatrixFrame.length&&(n=p(f.times,f.worldMatrixFrame,e),f.worldMatrixFrame=n.target),f.keyframeIds&&f.keyframeIds.length&&(a=p(f.times,f.keyframeIds,e),f.keyframeIds=a.target),f.groups&&f.groups.length&&(a=p(f.times,f.groups,e),f.groups=a.target),1!=f.trackType&&17!=f.trackType||!f.translations.length?2==f.trackType&&f.rotations.length?(o=p(f.times,f.rotations,e),f.rotations=o.target,f.times=o.times):3==f.trackType&&f.scales.length?(o=p(f.times,f.scales,e),f.scales=o.target,f.times=o.times):4==f.trackType&&f.colors.length?(s=p(f.times,f.colors,e),f.times=s.times,f.colors=s.target):5==f.trackType&&f.opacities.length?(s=p(f.times,f.opacities,e),f.times=s.times,f.opacities=s.target):6==f.trackType&&f.cameras.length&&f.ups.length&&f.targets.length?(d=p(f.times,f.cameras,e),u=p(f.times,f.ups,e),l=p(f.times,f.targets,e),c=p(f.times,f.orbitCenters,e),f.times=d.times,f.cameras=d.target,f.ups=u.target,f.targets=l.target,f.orbitCenters=c.target,f.devices&&(d=p(f.times,f.devices,e),f.devices=d.target),f.projectionMatrixInverses&&(u=p(f.times,f.projectionMatrixInverses,e),f.projectionMatrixInverses=u.target)):7!=f.trackType&&11!=f.trackType||!f.opacities.length||i!=f.randomKey?8==f.trackType&&f.translations.length&&i==f.randomKey?(l=p(f.times,f.translations,e),f.times=l.times,f.translations=l.target):13==f.trackType&&f.colors.length?(c=p(f.times,f.colors,e),f.lineColors&&f.lineColors.length&&(d=p(f.times,f.lineColors,e),f.lineColors=d.target),f.times=c.times,f.colors=c.target):12==f.trackType&&f.opacities.length&&(u=p(f.times,f.opacities,e),f.times=u.times,f.opacities=u.target):(h=p(f.times,f.opacities,e),f.times=h.times,f.opacities=h.target):(h=p(f.times,f.translations,e),f.translations=h.target,f.times=h.times))}},r.changeKeyframeByTrackID=function(e,t){if(this.trackDataMap.has(t)){var i,t=this.trackDataMap.get(t),r=[],n=[],a=[];if(e.forEach(function(e){r.push(e.time),n.push(e.group),a.push(e.keyframeId)}),t.times=r,t.groups=n,t.keyframeIds=a,15==t.trackType)i=t.textImgId;else if(14==t.trackType)i=this._activeAnimationID+"-"+t.htmlUUIDS[0];else{if(16!=t.trackType)return;i=t.textId}this.id2showHideTrackMap.set(i,t)}},r.changeKeyframeForAudio=function(e){var i,r=this,t=this._activeAnimationID+"-"+this._defaultUUID+"-9",n=this.trackDataMap.get(t);n&&n.times.length&&(i=null,e.forEach(function(e){var t;r.playlistMap&&r.playlistMap.size&&(t=r.playlistMap.get(r._activeAnimationID+"-"+e.srcKey))&&i!=t.srcKey&&(t.startTime=e.time,t.endTime=t.startTime+t.duration,i=t.srcKey),n.times[e.index]=e.time}))},r.recordTrajectoryByUUIDs=function(e){var n=this;this.uuid2TrajectoryMatrixMap.clear(),Array.isArray(e)&&e.forEach(function(e){var t=e.lastIndexOf("-");if(0<t){var i=e.slice(0,t),r=e.slice(t+1),t=n.viewer.ndsModel.getModelById(r);if(!t)return!0;(i=t.getBodyNodeFromUuid(i)).leafBodyAttri?n.uuid2TrajectoryMatrixMap.has(e)||n.uuid2TrajectoryMatrixMap.set(e,i.worldMatrix):t.getLeafBodies(i).forEach(function(e){n.uuid2TrajectoryMatrixMap.has(e.uuid+"-"+r)||n.uuid2TrajectoryMatrixMap.set(e.uuid+"-"+r,e.worldMatrix)})}})},r.resetBodyNode=function(e){this._resetBodyNode(e,void 0,!0),this._switchRotateCenterBySelection()},r.resetBodyNodeToRecord=function(e){var n=this;Array.isArray(e)&&e.forEach(function(e){var t=null,i=e.lastIndexOf("-");if(0<i){var r=e.slice(0,i),i=e.slice(i+1),i=n.viewer.ndsModel.getModelById(i);if(!i)return!0;t=i.getBodyNodeFromUuid(r)}else t=n.viewer.ndsModel.getBodyNodeFromUuid(e);t.leafBodyAttri?n.uuid2TrajectoryMatrixMap.has(e)&&n._changeBodyPosition(t,e,n.uuid2TrajectoryMatrixMap.get(e)):n.viewer.ndsModel.getLeafBodies(t).forEach(function(e){var t=e.uuid+"-"+e.ndsModel.id;n.uuid2TrajectoryMatrixMap.has(t)&&n._changeBodyPosition(e,t,n.uuid2TrajectoryMatrixMap.get(t))})}),this.viewer.dispatchEvent({type:"updateOpball"}),this._switchRotateCenterBySelection(),this.viewer.render()},r.resetBodyNodeByNode=function(e){var i=this,r=[];e.forEach(function(e){var t=i.viewer.ndsModel.getModelById(e.ndsModel.id);if(!t)return!0;t.getLeafBodies(e).forEach(function(e){var t=e.uuid+"-"+e.ndsModel.id;i.allBodyUuid2OriMatrixMap.has(t)&&i._changeBodyPosition(e,t,i.allBodyUuid2OriMatrixMap.get(t)),r.push(t)})}),this.viewer.clearPiovtInfoMap(r),this.viewer.dispatchEvent({type:"updateOpball"}),this._switchRotateCenterBySelection(),this.viewer.render()},r._resetModelNoteNode=function(i){var o=this,e=(i=i||this._activeAnimationID,this.getTextIdsLabels()),e=(e&&e.forEach(function(e){e.animationID==i&&o.viewer.textAnimationOp("setPosition",e.id,e.initPosition.x,e.initPosition.y)}),this.getTextLabels()),e=(e&&this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.setTextLineImgPosition&&e.forEach(function(e){var t;e.animationID==i&&(t=o.viewer.controls.staticAnnotation.getTextLineImgPosition(e.id).oriPos)&&o.viewer.controls.staticAnnotation.setTextLineImgPosition(e.id,t)}),this.getImageLabels());e&&this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.setTextLineImgPosition&&e.forEach(function(e){e.animationID==i&&o.viewer.controls.staticAnnotation.setTextLineImgPosition(e.id,{x:56,y:19,z:0})}),i&&this.selectedBodyUuidMap.has(i)&&(e=this.selectedBodyUuidMap.get(i).find(function(e){return"position"==e.type}))&&e.uuids.forEach(function(e){var i,r,t=null,n=e.lastIndexOf("-");if(0<n){var a=e.slice(0,n),n=e.slice(n+1),n=o.viewer.ndsModel.getModelById(n);if(!n)return!0;t=n.getBodyNodeFromUuid(a)}else t=o.viewer.ndsModel.getBodyNodeFromUuid(e);t&&o.allBodyUuid2OriMatrixMap.has(e)&&(o._changeBodyPosition(t,e,o.allBodyUuid2OriMatrixMap.get(e)),i=o.viewer.getObjectOpacityOnly(t),r=[],Array.isArray(i)&&t.leafBodyAttri.bodyMeshIds.forEach(function(e,t){r.push({meshId:e,value:i[t]||i[0]})}),o.viewer.setObjectOpacityOnly([t],r.length?r:i,!0))})},r._resetBodyNode=function(e,t,i){var r,n,a,o=this;(t=t||this._activeAnimationID)&&this.selectedBodyUuidMap.has(t)&&(t=this.selectedBodyUuidMap.get(t).find(function(e){return"position"==e.type}),e?(a=null,(a=0<(n=e.lastIndexOf("-"))?(r=e.slice(0,n),n=e.slice(n+1),(n=this.viewer.ndsModel.getModelById(n))&&n.getBodyNodeFromUuid(r)):this.viewer.ndsModel.getBodyNodeFromUuid(e))&&this.viewer.ndsModel.getLeafBodies(a).forEach(function(e){var t=e.uuid+"-"+e.ndsModel.id;o.allBodyUuid2OriMatrixMap.has(t)&&o._changeBodyPosition(e,t,o.allBodyUuid2OriMatrixMap.get(t))})):t&&t.uuids.forEach(function(e){var t=null,i=e.lastIndexOf("-");if(0<i){var r=e.slice(0,i),i=e.slice(i+1),i=o.viewer.ndsModel.getModelById(i);if(!i)return!0;t=i.getBodyNodeFromUuid(r)}else t=o.viewer.ndsModel.getBodyNodeFromUuid(e);t&&o.allBodyUuid2OriMatrixMap.has(e)&&o._changeBodyPosition(t,e,o.allBodyUuid2OriMatrixMap.get(e))}),this.viewer.dispatchEvent({type:"updateOpball"}),i)&&this.viewer.render()},r._initAnimation=function(i){var r=this;x.clearAnimations(),this.resetBodyNode(),this._preReleaseAnimation(),this.releaseAnimationStatus=!!this._releaseStuctData.animations.length,this._releaseStuctData.animations.forEach(function(t){var e;t&&t.animationID==i&&(e={animations:[t],tracks:r._releaseStuctData.tracks.filter(function(e){return e&&e.animationID==t.animationID}),drawGeoms:r._releaseStuctData.drawGeoms,textLabels:r._releaseStuctData.textLabels,imageLabels:r._releaseStuctData.imageLabels,textIdLabels:r._releaseStuctData.textIdLabels},x.addAnimation(t,e))})},r._switchRotateCenterBySelection=function(){var e,t,i;this._activeAnimationID&&(e=new THREE.Vector3,t=new THREE.Vector3,i=x.getTotalBodyBoundingBox(this._activeAnimationID),e.copy(i.min),t.copy(i.max),e.x>t.x||e.y>t.y||e.z>t.z||(this.viewer.controls.setBoundingBox(e,t),this.viewer.switchRotateCenterBySelection()))},r.getImageLabels=function(){var e=[],t=this.viewer.getallPicContent();if(Array.isArray(t))for(var i=0;i<t.length;i++){var r=t[i],n=r.id,a=this.imgCount;r.animationName="图片"+a,r.AnimationEdit=!0,this.imageLabelsMap.has(n)&&(a=this.imageLabelsMap.get(n),r.animationName=a.animationName),this.imageLabelsMap.set(n,r),this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.setSelectImgName(n,r.animationName),e.push({name:r.animationName,id:n,visible:r.visible,type:r.type,animationID:r.animationID||this._defaultAnimationID})}return e},r.getTextIdsLabels=function(){var e=this.viewer.textAnimationOp("getTextPointAllData");if(Array.isArray(e))for(var t=0;t<e.length;t++){var i=e[t],r=i.id;i.animationID||(i.animationID=this._defaultAnimationID),this.textIdLabelsMap.set(r,i)}return e},r.getPurnTxtLabels=function(){var e=this.viewer.textAnimationOp("getTextLabels");if(Array.isArray(e))for(var t=0;t<e.length;t++){var i=e[t];i.animationID||(i.animationID=this._defaultAnimationID)}},r.setPurnTxtVisible=function(e,t){e&&(this.textAnimationOp("setTextPointShow",e,t),e=this.textIdLabelsMap.get(e))&&(e.visible=t)},r.getTextLabels=function(){var e=[],t=this.viewer.getAllNoteContent();if(Array.isArray(t))for(var i=0;i<t.length;i++){var r=t[i].state,n=r.id,a=this.textCount;r.animationName="引线"+a,r.AnimationEdit=!0,this.textLabelsMap.has(n)&&(a=this.textLabelsMap.get(n),r.animationName=a.animationName),this.textLabelsMap.set(n,r),this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.setSelectTextName(n,r.animationName),e.push({name:r.animationName,id:n,visible:r.visible,type:r.origiType,animationID:r.animationID||this._defaultAnimationID})}return e},r.setTextLabelsName=function(e,t){e&&null!=t&&(this.textLabelsMap.has(e)&&(this.textLabelsMap.get(e).animationName=t,this.viewer.controls.staticAnnotation)&&this.viewer.controls.staticAnnotation.setSelectTextName(e,t),this._preReleaseAnimation())},r.setImageLabelsName=function(e,t){e&&null!=t&&(this.imageLabelsMap.has(e)&&(this.imageLabelsMap.get(e).animationName=t,this.viewer.controls.staticAnnotation)&&this.viewer.controls.staticAnnotation.setSelectImgName(e,t),this._preReleaseAnimation())},r.setImageTextHighlight=function(t,e){t&&(e?this.highlights.includes(t)||this.highlights.push(t):-1<(e=this.highlights.findIndex(function(e){return e==t}))&&this.highlights.splice(e,1),this.viewer.setSelectIdArray(this.highlights,!1))},r._setImageTextHighlight=function(e,t){var i=this;Array.isArray(e)&&(t?e.forEach(function(e){i.highlights.includes(e)||i.highlights.push(e)}):e.forEach(function(t){var e=i.highlights.findIndex(function(e){return e==t});-1<e&&i.highlights.splice(e,1)}),this.viewer.setSelectIdArray(this.highlights))},r.cancelImageTextHighlight=function(){this.highlights=[],this.viewer.setSelectIdArray(this.highlights)},r.cancelPurnTextHighlight=function(){var e=this.viewer.textAnimationOp("getSelectContent"),t=[];if(e&&0<e.length)for(var i=0;i<e.length;i++){var r=e[i].id;t.indexOf(r)<0&&t.push(r)}t&&0<t.length&&this._setTextPointHighLight(t,!1)},r.setTextVisible=function(e,t,i){void 0===i&&(i=!0),e&&(this.viewer.setPicTextVisible(e,t),this.textLabelsMap.get(e).visible=t)},r.setImageVisible=function(e,t,i){void 0===i&&(i=!0),e&&(this.viewer.setPicTextVisible(e,t),this.imageLabelsMap.get(e).visible=t)},r._setTextPointHighLight=function(e,t){if(Array.isArray(e)&&e&&0<e.length){for(var i=0;i<e.length;i++)this.viewer.textAnimationOp("setTextPointHighLight",e[i],t);this.viewer.textAnimationOp("_selectedNode")}},r.cancelTextPointHighlight=function(){this.viewer.textAnimationOp("_clearAllSelectedStatus")},r.play=function(e,t){this.viewer.controls.staticAnnotation&&(this.viewer.controls.staticAnnotation.useOffsetMatrix=!0,this.viewer.controls.staticAnnotation.clearFlag()),this.viewer.textAnimationOp&&this.viewer.textAnimationOp("_clearAllSelectedStatus"),this._initAnimation(e),this.releaseAnimationStatus?(this.isPlay=!0,this.cancelImageTextHighlight(),x.AnimationStart(0,e),this.viewer.dispatchEvent({type:"animationPlayStatus",isPlay:!0})):console.log("没有有效的动画数据")},r.pause=function(){this.releaseAnimationStatus?(this.isPlay=!1,this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.clearFlag(),x.AnimationPause(),this.viewer.dispatchEvent({type:"animationPlayStatus",isPlay:!1})):console.log("没有有效的动画数据")},r.stop=function(){this.releaseAnimationStatus?(this.isPlay=!1,this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.clearFlag(),x.AnimationStop(!1),this.viewer.dispatchEvent({type:"animationPlayStatus",isPlay:!1})):console.log("没有有效的动画数据")},r.continue=function(){this.releaseAnimationStatus?(this.isPlay=!0,this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.clearFlag(),x.AnimationContinue(),this.viewer.dispatchEvent({type:"animationPlayStatus",isPlay:!0})):console.log("没有有效的动画数据")},r.setTimeScale=function(e){this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.clearFlag(),x.setTimeScale(e)},r.setLoopType=function(e){this.loopType=e,this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.clearFlag(),x.setLoopType(e)},r.getBoxCenter=function(){var e=this.viewer.selectionManager.getSelectedleafObjects(!0);if(e.length){for(var t=new THREE.Box3,i=0;i<e.length;++i){var r=e[i],n=null;r.isDrawGeom?(n=r.geometry.boundingBox.clone()).applyMatrix4(r.matrix):n=this.viewer.ndsModel.getBodyBoundingBox(r),n&&!n.isEmpty()&&(t.expandByPoint(n.max),t.expandByPoint(n.min))}return t.getCenter(this.tempCenterBox)}return null},r.getBoxCenterByUUID=function(e){var t,i=e.lastIndexOf("-");return 0<i?(t=e.slice(0,i),i=e.slice(i+1),this.viewer.ndsModel.setActiveModelByModelId(i),this.viewer.ndsModel.getBodyNodeFromUuid(t)):this.viewer.ndsModel.getBodyNodeFromUuid(e),ye("bodyNode"),this.viewer.ndsModel.getBodyBoundingBox(null).getCenter(this.tempCenterBox)},r.setSelectedHideTreeBody=function(e){var t=this,e=this.viewer.ndsModel.getBodyNodeFromUuid(e),e=this.viewer.ndsModel.getLeafBodies(e);e&&e.forEach(function(e){t.selectedHideTreeBody.includes(e.uuid)||t.selectedHideTreeBody.push(e.uuid)})},r.removeSelectedHideTreeBody=function(e){var i=this,e=this.viewer.ndsModel.getBodyNodeFromUuid(e),e=this.viewer.ndsModel.getLeafBodies(e);e&&e.forEach(function(t){var e=i.selectedHideTreeBody.findIndex(function(e){return e==t.uuid});-1<e&&i.selectedHideTreeBody.splice(e,1)})},r.opMouseMoveByEvent=function(e){this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation&&this.viewer.controls.staticAnnotation.mouseMoveByEvent(e)},r._addPositionKeyframeByTrack=function(e,t,i){var r=this,i=i=void 0===i?{}:i,n=i.group,n=void 0===n?"a":n,i=i.isUseOriValue,a=e.modelID[0]+"-"+e.ndsModelId;if(1==e.trackType||2==e.trackType||3==e.trackType){var o,s=null,l=null;if(void 0!==i&&i)s=this.allBodyUuid2OriMatrixMap.get(a),l=this.allBodyUuid2CenterMap.get(a);else{i=this.allBodyUuid2BodyNodeMap.get(a);if(!i)return;s=i.worldMatrix,l=this.uuid2OperateCenter.get(this._activeAnimationID+"-"+a)||this.uuid2OperateCenter.get(a)}s&&l&&(i=new THREE.Vector3,a=new THREE.Quaternion,o=new THREE.Vector3,s.decompose(o,a,i),o=K(l,s.clone(),a),1==e.trackType?this.addKeyframe("position",e,t,o,l,s,n):2==e.trackType?this.addKeyframe("quaternion",e,t,a,l,s,n):3==e.trackType&&this.addKeyframe("scale",e,t,i,l,s,n),o=this.timelinePosTrack.find(function(e){return e.animationID==r._activeAnimationID}))&&this._addTimelineKeframe(o,t,n)}},r._addPositionKeyframeByDeleteTrack=function(e,a){var o=this,s=this.timelinePosTrack.find(function(e){return e.animationID==o._activeAnimationID});e.forEach(function(e,t){var i,r,n=o.trackDataMap.get(e.trackID);1==n.trackType?(r={x:e.translations[0],y:e.translations[1],z:e.translations[2]},i={x:e.centers[0],y:e.centers[1],z:e.centers[2]},o.addKeyframe("position",n,a,r,i,e.worldMatrixFrame,e.groups[0])):2==n.trackType?(r={x:e.rotations[0],y:e.rotations[1],z:e.rotations[2],w:e.rotations[3]},i={x:e.centers[0],y:e.centers[1],z:e.centers[2]},o.addKeyframe("quaternion",n,a,r,i,e.worldMatrixFrame,e.groups[0])):3==n.trackType?(r={x:e.scales[0],y:e.scales[1],z:e.scales[2]},i={x:e.centers[0],y:e.centers[1],z:e.centers[2]},o.addKeyframe("scale",n,a,r,i,e.worldMatrixFrame,e.groups[0])):17==n.trackType&&(r={x:e.translations[0],y:e.translations[1],z:e.translations[2]},o.addTextLineImgKeyframe(n,a,r,e.groups[0])),s&&0==t&&o._addTimelineKeframe(s,a,e.groups[0])})},r.addPositionKeyframe=function(d,e){var u=this,e=e=void 0===e?{}:e,t=e.group,h=void 0===t?"a":t,t=e.isUseOriValue,f=void 0!==t&&t,t=e.isSplit,p=void 0!==t&&t,t=e.deleteTracks,e=e.modelObjects,e=void 0===e?[]:e;t?this._addPositionKeyframeByDeleteTrack(t,d):("OpExplode"==this.viewer.controls.getOperator().type&&this.viewer.controls.getOperator().updateNodeMatrix(),this.uuid2SplitPositionMap.clear(),(e&&0<e.length?e:this.viewer.selectionManager.getSelectedleafObjects()).forEach(function(e){if(("Body"==e.type||"Model"==e.type)&&e.leafBodyAttri&&e.leafBodyAttri.bodyMeshIds.length){var t,i,r,e=e.uuid+"-"+e.ndsModel.id,n=u._activeAnimationID+"-"+e+"-1",a=(u.trackDataMap.has(n)||(o=u.addKeyframeTrack(e,1,n),u._addPositionKeyframeByTrack(o,0,{isUseOriValue:!0})),u.trackDataMap.get(n)),o=u._activeAnimationID+"-"+e+"-2",n=(u.trackDataMap.has(o)||(n=u.addKeyframeTrack(e,2,o),u._addPositionKeyframeByTrack(n,0,{isUseOriValue:!0})),u.trackDataMap.get(o)),o=u._activeAnimationID+"-"+e+"-3",s=(u.trackDataMap.has(o)||(s=u.addKeyframeTrack(e,3,o),u._addPositionKeyframeByTrack(s,0,{isUseOriValue:!0})),u.trackDataMap.get(o)),o=null,l=null;if(f)o=u.allBodyUuid2OriMatrixMap.get(e),l=u.allBodyUuid2CenterMap.get(e);else{var c=u.allBodyUuid2BodyNodeMap.get(e);if(!c)return;o=c.worldMatrix,l=u.uuid2OperateCenter.get(u._activeAnimationID+"-"+e)||u.uuid2OperateCenter.get(e)}p&&(c=a.times.findIndex(function(e){return d<=e}),l=(new THREE.Vector3).fromArray(a.centers,3*c),u.uuid2SplitPositionMap.has(e)||(c=J([a],n,s,d),u.uuid2SplitPositionMap.set(e,c)),o=u.uuid2SplitPositionMap.get(e)),o&&l&&(c=new THREE.Vector3,e=new THREE.Quaternion,t=new THREE.Vector3,o.decompose(t,e,c),t=K(l,o.clone(),e),u.addKeyframe("position",a,d,t,l,o,h),u.addKeyframe("quaternion",n,d,e,l,o,h),u.addKeyframe("scale",s,d,c,l,o,h),(t=u.timelinePosTrack.find(function(e){return e.animationID==u._activeAnimationID}))&&u._addTimelineKeframe(t,d,h),p)&&(i=a.times.findIndex(function(e){return d<=e}),r=a.groups[i+1][s].forEach(function(e){e.groups.forEach(function(e,t){i<=t&&e==r&&(a.groups[t]=h)}),u.trackDataMap.set(e.trackID,e),u.trackID2PositionTrackMap.set(e.trackID,e)}))}}),this._addTextLineImgKeyframeForAll(d,h,f,p),this._addTextKeyframeForAll(d,h,f,p),this.changeBodyNodeMatrix(d))},r.removePositionKeyframe=function(e,t){for(var i=this,t=(t=void 0===t?{}:t,t.isFillTime0),t=void 0!==t&&t,r=[],n=(0==e&&t&&(r=this.getTime0PostionModelObjects()),[]),a=G(this.trackID2PositionTrackMap);!(o=a()).done;){var o=o.value,o=(o[0],o[1]),s=this.removeKeyframe(o,e);s&&(this.trackDataMap.set(o.trackID,o),n.push(s))}for(var l=G(this.textImgId2PositionMap);!(c=l()).done;){var c=c.value,c=(c[0],c[1]),d=this.removeKeyframe(c,e);d&&(this.trackDataMap.set(c.trackID,c),n.push(d))}var u=this.timelinePosTrack.find(function(e){return e.animationID==i._activeAnimationID});return this._removeTimelineKeyframe(u,e),0==e&&t&&0<r.length&&this.addPositionKeyframe(0,{isUseOriValue:!0,modelObjects:r}),n},r._addTimelineKeframe=function(e,t,i){e.times.includes(t)&&this._removeTimelineKeyframe(e,t);var r=A(e.times,t);e.times.splice(r,0,t),e.groups.splice(r,0,i)},r._removeTimelineKeyframe=function(e,t){var i=e.times.findIndex(function(e){return e==t});-1<i&&(e.times.splice(i,1),e.groups)&&e.groups.length&&e.groups.splice(i,1)},r=e,(t=[{key:"isShowPositonFirstKeyframe",get:function(){var t=this,e=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});return e?e.isShowPositonFirstKeyframe:null},set:function(e){var t=this,i=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});i&&(i.isShowPositonFirstKeyframe=e)}},{key:"isShowColorFirstKeyframe",get:function(){var t=this,e=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});return e?e.isShowColorFirstKeyframe:null},set:function(e){var t=this,i=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});i&&(i.isShowColorFirstKeyframe=e)}},{key:"isShowOpacityFirstKeyframe",get:function(){var t=this,e=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});return e?e.isShowOpacityFirstKeyframe:null},set:function(e){var t=this,i=this.struct.animations.find(function(e){return e.animationID==t._activeAnimationID});i&&(i.isShowOpacityFirstKeyframe=e)}},{key:"playlistMap",get:function(){return x.playlistMap}},{key:"textLabelsMap",get:function(){return x.textLabelsMap}},{key:"imageLabelsMap",get:function(){return x.imageLabelsMap}},{key:"textIdLabelsMap",get:function(){return x.textIdLabelsMap}},{key:"id2showHideStatusMap",get:function(){return x.id2showHideStatusMap}},{key:"id2showHideTrackMap",get:function(){return x.id2showHideTrackMap}},{key:"selectedHideTreeBody",get:function(){return x.selectedHideTreeBody}},{key:"_defaultRootUUID",get:function(){return x._defaultRootUUID}}])&&_e(r.prototype,t),i&&_e(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r}()}],r={},n.m=i,n.c=r,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10);function n(e){var t;return(r[e]||(t=r[e]={i:e,l:!1,exports:{}},i[e].call(t.exports,t,t.exports,n),t.l=!0,t)).exports}var i,r});