wfs-min.js 93 KB

1
  1. !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;(t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Wfs=e()}}(function(){return(function(){function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){return i(t[a][1][e]||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}return e})()({1:[function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function e(t,n,r){return Function.prototype.apply.call(t,n,r)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function e(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function e(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function e(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function e(t,n){return new Promise(function(e,r){var i,o,a;function s(e){t.removeListener(n,u),r(e)}function u(){"function"==typeof t.removeListener&&t.removeListener("error",s),e([].slice.call(arguments))}y(t,n,u,{once:!0}),"error"!==n&&(i=t,o=s,a={once:!0},"function"==typeof i.on&&y(i,"error",o,a))})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){if(c(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var i,o,a,s,u=Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function d(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function e(t){for(var n=Array(t.length),r=0;r<n.length;++r)n[r]=t[r].listener||t[r];return n}(i):v(i,i.length)}function $(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function v(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function y(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else if("function"==typeof e.addEventListener)e.addEventListener(t,function i(o){r.once&&e.removeEventListener(t,i),n(o)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function e(t){if("number"!=typeof t||t<0||a(t))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function e(){return l(this)},s.prototype.emit=function e(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i="error"===t,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var s,u=Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=a[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,n);else for(var l=c.length,f=v(c,l),r=0;r<l;++r)o(f[r],this,n);return!0},s.prototype.addListener=function e(t,n){return f(this,t,n,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function e(t,n){return f(this,t,n,!0)},s.prototype.once=function e(t,n){return c(n),this.on(t,h(this,t,n)),this},s.prototype.prependOnceListener=function e(t,n){return c(n),this.prependListener(t,h(this,t,n)),this},s.prototype.removeListener=function e(t,n){var r,i,o,a,s;if(c(n),void 0===(i=this._events)||void 0===(r=i[t]))return this;if(r===n||r.listener===n)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||n));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===n||r[a].listener===n){s=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function e(t,n){for(;n+1<t.length;n++)t[n]=t[n+1];t.pop()}(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,s||n)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function e(t){var n,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,a=Object.keys(r);for(i=0;i<a.length;++i)"removeListener"!==(o=a[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(n=r[t]))this.removeListener(t,n);else if(void 0!==n)for(i=n.length-1;i>=0;i--)this.removeListener(t,n[i]);return this},s.prototype.listeners=function e(t){return p(this,t,!0)},s.prototype.rawListeners=function e(t){return p(this,t,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):$.call(e,t)},s.prototype.listenerCount=$,s.prototype.eventNames=function e(){return this._eventsCount>0?r(this._events):[]}},{}],2:[function(e,t,n){var r,i,o,a=t.exports={};function s(){throw Error("setTimeout has not been defined")}function u(){throw Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(n){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{i="function"==typeof clearTimeout?clearTimeout:u}catch(t){i=u}}();var l=[],f=!1,d=-1;function h(){f&&o&&(f=!1,o.length?l=o.concat(l):d=-1,l.length&&p())}function p(){if(!f){var e=c(h);f=!0;for(var t=l.length;t;){for(o=l,l=[];++d<t;)o&&o[d].run();d=-1,t=l.length}o=null,f=!1,function e(t){if(i===clearTimeout)return clearTimeout(t);if((i===u||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(n){try{return i.call(null,t)}catch(r){return i.call(this,t)}}}(e)}}function $(e,t){this.fun=e,this.array=t}function v(){}a.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new $(e,t)),1!==l.length||f||c(p)},$.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=v,a.addListener=v,a.once=v,a.off=v,a.removeListener=v,a.removeAllListeners=v,a.emit=v,a.prependListener=v,a.prependOnceListener=v,a.listeners=function(e){return[]},a.binding=function(e){throw Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],3:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=e("../errors"),o=u(e("../events")),a=u(e("../event-handler")),s=u(e("../utils/mp4-encoder"));function u(e){return e&&e.__esModule?e:{default:e}}function c(){c=function t(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(l){u=function e(t,n,r){return t[n]=r}}function f(e,t,n,r){var i,o,a,s,u=Object.create((t&&t.prototype instanceof p?t:p).prototype),c=new A(r||[]);return u._invoke=(i=e,o=n,a=c,s="suspendedStart",function(e,t){if("executing"===s)throw Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return R()}for(a.method=e,a.arg=t;;){var n=a.delegate;if(n){var r=w(n,a);if(r){if(r===h)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";var u=d(i,o,a);if("normal"===u.type){if(s=a.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:a.done}}"throw"===u.type&&(s="completed",a.method="throw",a.arg=u.arg)}}),u}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}e.wrap=f;var h={};function p(){}function $(){}function v(){}var y={};u(y,o,function(){return this});var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==t&&n.call(m,o)&&(y=m);var _=v.prototype=p.prototype=Object.create(y);function b(e){["next","throw","return"].forEach(function(t){u(e,t,function(e){return this._invoke(t,e)})})}function E(e,t){var i;this._invoke=function(o,a){function s(){return new t(function(i,s){!function i(o,a,s,u){var c=d(e[o],e,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==r(f)&&n.call(f,"__await")?t.resolve(f.__await).then(function(e){i("next",e,s,u)},function(e){i("throw",e,s,u)}):t.resolve(f).then(function(e){l.value=e,s(l)},function(e){return i("throw",e,s,u)})}u(c.arg)}(o,a,i,s)})}return i=i?i.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return h;t.method="throw",t.arg=TypeError("The iterator does not provide a 'throw' method")}return h}var r=d(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,h;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=TypeError("iterator result is not an object"),t.delegate=null,h)}function T(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function S(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return $.prototype=v,u(_,"constructor",v),u(v,"constructor",$),$.displayName=u(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===$||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,s,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},b(E.prototype),u(E.prototype,a,function(){return this}),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new E(f(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then(function(e){return e.done?e.value:a.next()})},b(_),u(_,s,"Generator"),u(_,o,function(){return this}),u(_,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=S,A.prototype={constructor:A,reset:function e(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function e(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function e(t){if(this.done)throw t;var r=this;function i(e,n){return s.type="throw",s.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function e(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=t,s.arg=r,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(s)},complete:function e(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),h},finish:function e(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),h}},catch:function e(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var o=i.arg;k(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function e(t,n,r){return this.delegate={iterator:S(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function e(t,n){return t.__proto__=n,t})(e,t)}function d(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function e(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}function p(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(c){n(c);return}s.done?t(u):Promise.resolve(u).then(r,i)}var $=null;function v(){var e;return(v=(e=c().mark(function e(){return c().wrap(function e(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,s.default)().then(function(e){$=e});case 2:case"end":return t.stop()}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){p(o,r,i,a,s,"next",e)}function s(e){p(o,r,i,a,s,"throw",e)}a(void 0)})})).apply(this,arguments)}var y=function(e){!function e(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&f(t,n)}(y,e);var t,n,s,u,c,p=(t=y,n=function e(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function e(){var i,o=h(t);if(n){var a=h(this).constructor;i=Reflect.construct(o,arguments,a)}else i=o.apply(this,arguments);return function e(t,n){if(n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw TypeError("Derived constructors may only return object or undefined");return d(t)}(this,i)});function y(e){var t;return!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,y),(t=p.call(this,e,o.default.MEDIA_ATTACHING,o.default.BUFFER_APPENDING,o.default.BUFFER_RESET,o.default.RECORDING_START,o.default.RECORDING_STOP,o.default.H264_DATA_APPENDING,o.default.PLAYER_SEEK_NOW)).rec_threshold_total=17179869184,t.rec_threshold_single=1073741824,t.rec_timer=void 0,t.rec_file="",t.rec_result_cb=void 0,t.rec_state_cb=void 0,t.mediaElement=null,t.mediaSource=null,t.mediaSize=0,t.sourceBuffers={},t.segments=[],t.h264Frames=[],t.appended=0,t.mediaErrorCount=0,t.count=0,t.recording=!1,t.onsbue=t.onSBUpdateEnd.bind(d(t)),t.browserType=0,-1!==navigator.userAgent.toLowerCase().indexOf("firefox")&&(t.browserType=1),t.mediaType="",t.websocketName=void 0,t.channelName=void 0,t._fs=null,t.track_info={width:0,height:0},!function e(){return v.apply(this,arguments)}(),t.mp4BlobBuffer=[],t}return s=y,u=[{key:"destroy",value:function e(){a.default.prototype.destroy.call(this)}},{key:"pad2",value:function e(t){return t<10?"0"+t:t}},{key:"onRecordingProc",value:function e(){var t=this;if(null==t._fs){t.rec_result_cb&&t.rec_result_cb(!1),console.log("fs is not authorized");return}t.rec_timer&&(clearInterval(t.rec_timer),t.rec_timer=void 0),t.count=0,t.rec_timer=setInterval(function(){if(""==t.mediaType||"H264Raw"==t.mediaType&&t.appended>10){clearInterval(t.rec_timer),t.rec_timer=void 0;var e=new Date,n=1900+e.getYear()+"-"+t.pad2(e.getMonth()+1)+"-"+t.pad2(e.getDate())+"_"+t.pad2(e.getHours())+"-"+t.pad2(e.getMinutes())+"-"+t.pad2(e.getSeconds());t.rec_file="ax_"+n+".mp4",console.log("MediaRecorder started: "+t.rec_file),t.mediaSize=0,t.recording=!0,t.rec_result_cb&&t.rec_result_cb(!0)}else t.count++;t.count>=10&&(clearInterval(t.rec_timer),t.rec_timer=void 0,t.rec_result_cb&&t.rec_result_cb(!1))},1e3)}},{key:"onRecordingStart",value:function e(t){if(this.recording){console.log("recording is in progress");return}void 0!=t&&(this.rec_threshold_single=t.rec_file_threshold,this.rec_result_cb=t.result_cb,this.rec_state_cb=t.state_cb);var n=this;navigator.webkitPersistentStorage.queryUsageAndQuota(function(e,t){""==t?n.requestFs():window.webkitRequestFileSystem(window.PERSISTENT,n.rec_threshold_total,function(e){n._fs=e,e.root.getDirectory("ax_video",{create:!0},function(e){console.log("Directory: "+e.name+" fs requested"),n.onRecordingProc()},n.errorHandler)})},this.errorHandler)}},{key:"onRecordingStop",value:function e(){this.rec_timer&&(clearInterval(this.rec_timer),this.rec_timer=void 0,console.log("Media Recorder stopped2"));var t=this;t.recording=!1,t.saveToMP4Blob(t.h264Frames,this.track_info),t.h264Frames=[]}},{key:"errorHandler",value:function e(t){console.log("An error occured(errcd): "+t.code)}},{key:"requestFs",value:function e(){var t=this;navigator.webkitPersistentStorage.requestQuota(this.rec_threshold_total,function(e){console.log("grantedBytes: "+e),e>0?window.webkitRequestFileSystem(window.PERSISTENT,e,function(e){t._fs=e,e.root.getDirectory("ax_video",{create:!0},function(e){console.log("Directory: "+e.name+" exists or just created."),t.onRecordingProc()},t.errorHandler)}):t.rec_result_cb&&t.rec_result_cb(!1)})}},{key:"onMediaAttaching",value:function e(t){var n=this.mediaElement=t.media;if(this.mediaType=t.mediaType,this.websocketName=t.websocketName,this.channelName=t.channelName,n){var r=this.mediaSource=new MediaSource;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),n.src=URL.createObjectURL(r)}}},{key:"onMediaDetaching",value:function e(){}},{key:"onH264DataAppending",value:function e(t){if(this.recording&&t.data){var n=this,r=t.data;n.h264Frames.push(t.data),n.mediaSize+=r.length,n.mediaSize>=n.rec_threshold_single&&(n.rec_state_cb&&n.rec_state_cb(!1),n.onRecordingStop(),n.onRecordingStart(),n.rec_state_cb&&n.rec_state_cb(!0))}}},{key:"saveToMP4Blob",value:function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.length>0){var r=n.width,i=n.height,o=$.createEncoder({width:r,height:i,hevc:!1});t.forEach(function(e){o.addNalu(e)});var a=new Blob([o.end()]);this.writeMP4Data(a)}}},{key:"writeMP4Data",value:function e(t){var n=this;n._fs.root.getFile("ax_video/"+n.rec_file,{create:!0},function(e){e.createWriter(function(e){e.onwriteend=function(e){},e.onerror=function(e){console.log("Write rec data failed: "+e.toString())},e.seek(e.length),e.write(t)},n.errorHandler)},n.errorHandler)}},{key:"onBufferAppending",value:function e(t){this.segments.push(t),this.doAppending()}},{key:"onMediaSourceClose",value:function e(){console.log("media source closed")}},{key:"onMediaSourceEnded",value:function e(){console.log("media source ended")}},{key:"onSBUpdateEnd",value:function e(t){this.appending=!1,this.doAppending()}},{key:"onMediaSourceOpen",value:function e(){console.log("media source open");var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.wfs.trigger(o.default.MEDIA_ATTACHED,{media:this.media,channelName:this.channelName,mediaType:this.mediaType,websocketName:this.websocketName})}},{key:"onBufferReset",value:function e(t){"H264Raw"===this.mediaType&&this.createSourceBuffers({tracks:"video",mimeType:t.mimeType}),this.track_info.width=t.width,this.track_info.height=t.height}},{key:"createSourceBuffers",value:function e(t){var n,r=this.sourceBuffers,i=this.mediaSource;n=""===t.mimeType?"video/mp4;codecs=avc1.420028":"video/mp4;codecs="+t.mimeType;try{(r.video=i.addSourceBuffer(n)).addEventListener("updateend",this.onsbue)}catch(a){}this.wfs.trigger(o.default.BUFFER_CREATED,{tracks:t}),this.mediaElement.play()}},{key:"onPlayerSeekNow",value:function e(){var t=this.mediaElement.buffered.end(0);this.mediaElement.currentTime=t}},{key:"doAppending",value:function e(){var t=this.wfs,n=this.sourceBuffers,r=this.segments;if(Object.keys(n).length){if(this.mediaElement.error){if(this.segments=[],this.mediaErrorCount++,this.mediaErrorCount<100)console.log("doAppending although a media error occured, error code:",this.media.error.code);else{var a={type:i.ErrorTypes.MEDIA_ERROR};a.details=i.ErrorDetails.BUFFER_APPEND_ERROR,a.frag=this.fragCurrent,a.fatal=!0,this.wfs.trigger(o.default.ERROR,a)}return}if(this.mediaErrorCount=0,this.appending)return;if(r&&r.length){var s=r.shift();try{n[s.type]&&(this.parent=s.parent,n[s.type].appendBuffer(s.data),this.appendError=0,this.appended++,this.appending=!0)}catch(u){r.unshift(s);var c={type:i.ErrorTypes.MEDIA_ERROR};22!==u.code?(this.appendError?this.appendError++:this.appendError=1,c.details=i.ErrorDetails.BUFFER_APPEND_ERROR,c.frag=this.fragCurrent,this.appendError>t.config.appendErrorMaxRetry?(r=[],c.fatal=!0):c.fatal=!1):(this.segments=[],c.details=i.ErrorDetails.BUFFER_FULL_ERROR,c.fatal=!0),this.wfs.trigger(o.default.ERROR,c)}}}}}],l(s.prototype,u),c&&l(s,c),Object.defineProperty(s,"prototype",{writable:!1}),y}(a.default);n.default=y},{"../errors":7,"../event-handler":8,"../events":9,"../utils/mp4-encoder":17}],4:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=a(e("../events")),o=a(e("../event-handler"));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return(u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function e(t,n){return t.__proto__=n,t})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function e(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}var l=function(e){!function e(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&u(t,n)}(h,e);var t,n,a,l,f,d=(t=h,n=function e(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function e(){var i,o=c(t);if(n){var a=c(this).constructor;i=Reflect.construct(o,arguments,a)}else i=o.apply(this,arguments);return function e(t,n){if(n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw TypeError("Derived constructors may only return object or undefined");return function e(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)});function h(e){var t;!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,h),(t=d.call(this,e,i.default.MEDIA_ATTACHED,i.default.BUFFER_CREATED,i.default.FILE_PARSING_DATA,i.default.FILE_HEAD_LOADED,i.default.FILE_DATA_LOADED,i.default.WEBSOCKET_ATTACHED,i.default.FRAG_PARSING_DATA,i.default.FRAG_PARSING_INIT_SEGMENT)).fileStart=0,t.fileEnd=0,t.pendingAppending=0,t.mediaType=void 0;e:t.channelName;return t}return a=h,l=[{key:"destroy",value:function e(){o.default.prototype.destroy.call(this)}},{key:"onMediaAttached",value:function e(t){if(console.log("media attached"),void 0!=t.websocketName){var n=t.websocketName,r=new WebSocket(n,"binary");this.wfs.attachWebsocket(r,t.websocketName,t.channelName)}else console.log("websocketName ERROE!!!")}},{key:"onBufferCreated",value:function e(t){this.mediaType=t.mediaType}},{key:"onFileHeadLoaded",value:function e(t){}},{key:"onFileDataLoaded",value:function e(t){}},{key:"onFileParsingData",value:function e(t){}},{key:"onWebsocketAttached",value:function e(t){this.wfs.trigger(i.default.BUFFER_APPENDING,{type:"video",data:t.payload,parent:"main"})}},{key:"onFragParsingInitSegment",value:function e(t){var n,r=t.tracks,o=r.video;for(n in o&&(o.id=t.id),r){var a=(o=r[n]).initSegment;a&&(this.pendingAppending++,this.wfs.trigger(i.default.BUFFER_APPENDING,{type:n,data:a,parent:"main"}))}}},{key:"onFragParsingData",value:function e(t){var n=this;[t.data1,t.data2].forEach(function(e){e&&(n.pendingAppending++,n.wfs.trigger(i.default.BUFFER_APPENDING,{type:t.type,data:e,parent:"main"}))})}}],s(a.prototype,l),f&&s(a,f),Object.defineProperty(a,"prototype",{writable:!1}),h}(o.default);n.default=l},{"../event-handler":8,"../events":9}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("../utils/logger");function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){var e,t,n;function o(e){!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,o),this.data=e,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return e=o,t=[{key:"loadWord",value:function e(){var t=this.data.byteLength-this.bytesAvailable,n=new Uint8Array(4),r=Math.min(4,this.bytesAvailable);if(0===r)throw Error("no bytes available");n.set(this.data.subarray(t,t+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}},{key:"skipBits",value:function e(t){var n;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,n=t>>3,t-=n>>3,this.bytesAvailable-=n,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}},{key:"readBits",value:function e(t){var n=Math.min(this.bitsAvailable,t),i=this.word>>>32-n;return(t>32&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=n,this.bitsAvailable>0?this.word<<=n:this.bytesAvailable>0&&this.loadWord(),(n=t-n)>0)?i<<n|this.readBits(n):i}},{key:"skipLZ",value:function e(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}},{key:"skipUEG",value:function e(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function e(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function e(){var t=this.skipLZ();return this.readBits(t+1)-1}},{key:"readEG",value:function e(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}},{key:"readBoolean",value:function e(){return 1===this.readBits(1)}},{key:"readUByte",value:function e(){return this.readBits(8)}},{key:"readUShort",value:function e(){return this.readBits(16)}},{key:"readUInt",value:function e(){return this.readBits(32)}},{key:"skipScalingList",value:function e(t){var n,r,i=8,o=8;for(n=0;n<t;n++)0!==o&&(o=(i+(r=this.readEG())+256)%256),i=0===o?i:o}},{key:"readSPS",value:function e(){var t,n,r,i,o,a,s,u,c,l=0,f=0,d=0,h=0,p=1;if(this.readUByte(),t=this.readUByte(),n=this.readBits(5),this.skipBits(3),r=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var $=this.readUEG();if(3===$&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(c=0,u=3!==$?8:12;c<u;c++)this.readBoolean()&&(c<6?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var v=this.readUEG();if(0===v)this.readUEG();else if(1===v)for(this.skipBits(1),this.skipEG(),this.skipEG(),i=this.readUEG(),c=0;c<i;c++)this.skipEG();if(this.skipUEG(),this.skipBits(1),o=this.readUEG(),a=this.readUEG(),0===(s=this.readBits(1))&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(l=this.readUEG(),f=this.readUEG(),d=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var y,g=this.readUByte();switch(g){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}y&&(p=y[0]/y[1])}return{width:Math.ceil(((o+1)*16-2*l-2*f)*p),height:(2-s)*(a+1)*16-(s?2:4)*(d+h)}}},{key:"readSliceType",value:function e(){return this.readUByte(),this.readUEG(),this.readUEG()}}],i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}();n.default=o},{"../utils/logger":16}],6:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,e("../errors");var i=u(e("../events")),o=u(e("./exp-golomb")),a=u(e("../event-handler")),s=u(e("../remux/mp4-remuxer"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function e(t,n){return t.__proto__=n,t})(e,t)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function e(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}var d=function(e){!function e(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&l(t,n)}($,e);var t,n,u,d,h,p=(t=$,n=function e(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function e(){var i,o=f(t);if(n){var a=f(this).constructor;i=Reflect.construct(o,arguments,a)}else i=o.apply(this,arguments);return function e(t,n){if(n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw TypeError("Derived constructors may only return object or undefined");return function e(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)});function $(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,$),(t=p.call(this,e,i.default.H264_DATA_PARSING)).config=t.wfs.config||n,t.wfs=e,t.id="main",MediaSource.isTypeSupported("video/mp4"),t.remuxer=new s.default(t.wfs,t.id,t.config),t.contiguous=!0,t.timeOffset=1,t.sn=0,t.TIMESCALE=9e4,t.timestamp=0,t.scaleFactor=t.TIMESCALE/1e3,t.H264_TIMEBASE=t.config.mp4Duration,t._avcTrack={container:"video/mp4",type:"video",id:1,sequenceNumber:0,samples:[],len:0,nbNalu:0,dropped:0,count:0},t.browserType=0,-1!==navigator.userAgent.toLowerCase().indexOf("firefox")&&(t.browserType=1),t}return u=$,d=[{key:"destroy",value:function e(){a.default.prototype.destroy.call(this)}},{key:"getTimestampM",value:function e(){return this.timestamp+=this.H264_TIMEBASE,this.timestamp}},{key:"onH264DataParsing",value:function e(t){this._parseAVCTrack(t.data),this.browserType,this.remuxer.pushVideo(0,this.sn,this._avcTrack,this.timeOffset,this.contiguous),this.sn+=1}},{key:"_parseAVCTrack",value:function e(t){var n,r,a,s,u=this,c=this._avcTrack,l=c.samples,f=this._parseAVCNALu(t),d=[],h=!1,p=0,$="",v=(function(){if(d.length){if(!this.config.forceKeyFrameOnDiscontinuity||!0===h||c.sps&&(l.length||this.contiguous)){var e=this.getTimestampM();r={units:{units:d,length:p},pts:e,dts:e,key:h},l.push(r),c.len+=p,c.nbNalu+=d.length}else c.dropped++;d=[],p=0}}).bind(this);f.forEach(function(e){switch(e.type){case 1:a=!0;break;case 5:a=!0,h=!0;break;case 6:e.data=u.discardEPB(e.data),(n=new o.default(e.data)).readUByte();break;case 7:if(a=!1,!c.sps){var t=(n=new o.default(e.data)).readSPS();c.width=t.width,c.height=t.height,c.sps=[e.data],c.duration=0;var r=e.data.subarray(1,4),l="avc1.";for(s=0;s<3;s++){var f=r[s].toString(16);f.length<2&&(f="0"+f),l+=f}c.codec=l,u.wfs.trigger(i.default.BUFFER_RESET,{mimeType:c.codec,width:c.width,height:c.height}),a=!0}break;case 8:a=!1,c.pps||(c.pps=[e.data],a=!0);break;case 9:a=!1,v();break;default:a=!1,$+="unknown NAL "+e.type+" "}a&&(d.push(e),p+=e.data.byteLength)}),$.length&&logger.log($),v()}},{key:"_parseAVCNALu",value:function e(t){for(var n,r,i,o,a,s=0,u=t.byteLength,c=0,l=[];s<u;)switch(n=t[s++],c){case 0:0===n&&(c=1);break;case 1:c=0===n?2:0;break;case 2:case 3:0===n?c=3:(1===n&&s<u&&(i=31&t[s],o&&l.push(r={data:t.subarray(o,s-c-1),type:a}),o=s,a=i),c=0)}return o&&l.push(r={data:t.subarray(o,u),type:a,state:c}),l}},{key:"discardEPB",value:function e(t){for(var n,r,i=t.byteLength,o=[],a=1;a<i-2;)0===t[a]&&0===t[a+1]&&3===t[a+2]?(o.push(a+2),a+=2):a++;if(0===o.length)return t;n=i-o.length,r=new Uint8Array(n);var s=0;for(a=0;a<n;s++,a++)s===o[0]&&(s++,o.shift()),r[a]=t[s];return r}}],c(u.prototype,d),h&&c(u,h),Object.defineProperty(u,"prototype",{writable:!1}),$}(a.default);n.default=d},{"../errors":7,"../event-handler":8,"../events":9,"../remux/mp4-remuxer":15,"./exp-golomb":5}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorTypes=n.ErrorDetails=void 0,n.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},n.ErrorDetails={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException",NETWORK_RECV_DATA_TIMEOUT:"networkRecvDataTimeout"}},{}],8:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0,(o=e("./events"))&&o.__esModule;var o,a=function(){var e,t,n;function o(e){!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,o),this.wfs=e,this.onEvent=this.onEvent.bind(this);for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}return e=o,t=[{key:"destroy",value:function e(){this.unregisterListeners()}},{key:"isEventHandler",value:function e(){return"object"===r(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function e(){this.isEventHandler()&&this.handledEvents.forEach((function(e){this.wfs.on(e,this.onEvent)}).bind(this))}},{key:"unregisterListeners",value:function e(){this.isEventHandler()&&this.handledEvents.forEach((function(e){this.wfs.off(e,this.onEvent)}).bind(this))}},{key:"onEvent",value:function e(t,n){this.onEventGeneric(t,n)}},{key:"onEventGeneric",value:function e(t,n){var r=function e(t,n){var r="on"+t.replace("wfs","");return this[r],this[r].bind(this,n)};try{r.call(this,t,n).call()}catch(i){console.log("internal error happened while processing ".concat(t,":").concat(i.message))}}}],i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),o}();n.default=a},{"./events":9}],9:[function(e,t,n){"use strict";t.exports={MEDIA_ATTACHING:"wfsMediaAttaching",MEDIA_ATTACHED:"wfsMediaAttached",FRAG_LOADING:"wfsFragLoading",BUFFER_CREATED:"wfsBufferCreated",BUFFER_APPENDING:"wfsBufferAppending",BUFFER_RESET:"wfsBufferReset",BUFFER_CLEAR:"wfsBufferClear",FRAG_PARSING_DATA:"wfsFragParsingData",FRAG_PARSING_INIT_SEGMENT:"wfsFragParsingInitSegment",H264_DATA_APPENDING:"wfsH264DataAppending",H264_DATA_PARSING:"wfsH264DataParsing",WEBSOCKET_ATTACHED:"wfsWebsocketAttached",WEBSOCKET_ATTACHING:"wfsWebsocketAttaching",WEBSOCKET_DATA_UPLOADING:"wfsWebsocketDataUploading",WEBSOCKET_MESSAGE_SENDING:"wfsWebsocketMessageSending",FILE_HEAD_LOADING:"wfsFileHeadLoading",FILE_HEAD_LOADED:"wfsFileHeadLoaded",FILE_DATA_LOADING:"wfsFileDataLoading",FILE_DATA_LOADED:"wfsFileDataLoaded",FILE_PARSING_DATA:"wfsFileParsingData",RECORDING_START:"wfsRecordingStart",PLAYER_SEEK_NOW:"wfsPlayerSeekNow",RECORDING_STOP:"wfsRecordingStop",ERROR:"wfsError"}},{}],10:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=function(){var e,t;function n(){!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,n)}return e=n,t=[{key:"getSilentFrame",value:function e(t){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);else if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);return null}}],t&&r(e,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();n.default=i},{}],11:[function(e,t,n){"use strict";t.exports=e("./wfs.js").default},{"./wfs.js":20}],12:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=a(e("../events")),o=a(e("../event-handler"));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return(u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function e(t,n){return t.__proto__=n,t})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function e(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}var l=function(e){!function e(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&u(t,n)}(h,e);var t,n,a,l,f,d=(t=h,n=function e(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function e(){var i,o=c(t);if(n){var a=c(this).constructor;i=Reflect.construct(o,arguments,a)}else i=o.apply(this,arguments);return function e(t,n){if(n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw TypeError("Derived constructors may only return object or undefined");return function e(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)});function h(e){var t;return!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,h),(t=d.call(this,e,i.default.FRAG_LOADING,i.default.FILE_HEAD_LOADING,i.default.FILE_DATA_LOADING)).loaders={},t}return a=h,l=[{key:"destroy",value:function e(){for(var t in this.loaders){var n=this.loaders[t];n&&n.destroy()}this.loaders={},o.default.prototype.destroy.call(this)}},{key:"onFileHeadLoading",value:function e(t){var n,r,i,o=this.wfs.config,a=new o.loader(o);n={url:o.fmp4FileUrl},r={maxRetry:0,retryDelay:0},i={onSuccess:this.fileloadheadsuccess.bind(this)},a.loadHead(n,r,i)}},{key:"fileloadheadsuccess",value:function e(t){this.wfs.trigger(i.default.FILE_HEAD_LOADED,{size:t})}},{key:"onFileDataLoading",value:function e(t){var n,r,i,o=this.wfs.config,a=new o.loader(o);n={url:o.fmp4FileUrl,responseType:"arraybuffer",progressData:!1};var s=t.fileStart,u=t.fileEnd;isNaN(s)||isNaN(u)||(n.rangeStart=s,n.rangeEnd=u),r={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout},i={onSuccess:this.fileloaddatasuccess.bind(this)},a.load(n,r,i)}},{key:"fileloaddatasuccess",value:function e(t,n,r){this.wfs.trigger(i.default.FILE_DATA_LOADED,{payload:t.data,stats:n})}},{key:"loaderror",value:function e(t,n){var r=n.loader;r&&r.abort(),this.loaders[n.type]=void 0}},{key:"loadtimeout",value:function e(t,n){var r=n.loader;r&&r.abort(),this.loaders[n.type]=void 0}},{key:"loadprogress",value:function e(t,n,r){n.frag.loaded=t.loaded}}],s(a.prototype,l),f&&s(a,f),Object.defineProperty(a,"prototype",{writable:!1}),h}(o.default);n.default=l},{"../event-handler":8,"../events":9}],13:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=e("../errors"),o=u(e("../events")),a=u(e("../event-handler")),s=u(e("../demux/h264-demuxer"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function e(t,n){return t.__proto__=n,t})(e,t)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function e(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}var d=function(e){!function e(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&l(t,n)}($,e);var t,n,u,d,h,p=(t=$,n=function e(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function e(){var i,o=f(t);if(n){var a=f(this).constructor;i=Reflect.construct(o,arguments,a)}else i=o.apply(this,arguments);return function e(t,n){if(n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw TypeError("Derived constructors may only return object or undefined");return function e(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,i)});function $(e){var t;return!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,$),(t=p.call(this,e,o.default.WEBSOCKET_ATTACHING,o.default.WEBSOCKET_DATA_UPLOADING,o.default.WEBSOCKET_MESSAGE_SENDING)).buf=null,t.ctx=null,t.h264Demuxer=new s.default(e),t.websocketName=void 0,t.media=void 0,t.mediaType=void 0,t.mediaCode=0,t.channelName=void 0,t.isForceClosed=!1,t.timer=void 0,t.lastRecvDataTime=0,t.extraData=void 0,t.isLoaded=!1,t}return u=$,d=[{key:"create_timer",value:function e(){var t=this;this.lastRecvDataTime=performance.now(),console.log("Websocket: create_timer"),this.timer=setInterval(function(){if(t.lastRecvDataTime>0){var e=performance.now()-t.lastRecvDataTime;if(e>t.wfs.config.wsMinPacketInterval&&console.log("Websocket: did not recv data over "+e+" ms"),e>t.wfs.config.wsMaxPacketInterval&&!t.isForceClosed){t.unload(),console.log("Websocket data not received in "+t.wfs.config.wsMaxPacketInterval/1e3+"s, open again...");var n={type:i.ErrorTypes.NETWORK_ERROR};n.details=i.ErrorDetails.NETWORK_RECV_DATA_TIMEOUT,n.fatal=!0,t.wfs.trigger(o.default.ERROR,n)}}else t.lastRecvDataTime=performance.now()},this.wfs.config.wsMinPacketInterval)}},{key:"kill_timer",value:function e(){this.timer&&(console.log("Websocket close: clear timer"),clearInterval(this.timer),this.timer=void 0)}},{key:"destroy",value:function e(){this.kill_timer(),this.isForceClosed=!0,this.client&&this.client.close(),a.default.prototype.destroy.call(this)}},{key:"onWebsocketAttaching",value:function e(t){(this.kill_timer(),this.create_timer(),"MJPEG"===t.mediaType)?(this.mediaCode=1,this.ctx=t.media.getContext("2d")):this.mediaCode=0,this.websocketName=t.websocketName,this.media=t.media,this.mediaType=t.mediaType,this.channelName=t.channelName,this.extraData=t.extraData,t.websocket instanceof WebSocket&&(this.client=t.websocket,this.client.onopen=this.initSocketClient.bind(this),this.client.onclose=this.closeSocketClient.bind(this),this.client.onerror=this.errorSocketClient.bind(this))}},{key:"errorSocketClient",value:function e(t){this.unload(),console.log("WebSocket error: ",t)}},{key:"closeSocketClient",value:function e(t){this.unload(),console.log("Websocket closed: ",t)}},{key:"initSocketClient",value:function e(t){this.load()}},{key:"receiveSocketMessage",value:function e(t){var n=this;if(this.isLoaded){if(this.lastRecvDataTime=performance.now(),0===this.mediaCode){this.buf=new Uint8Array(t.data);var r=new Uint8Array(this.buf),i=new Uint8Array(this.buf);this.wfs.trigger(o.default.H264_DATA_PARSING,{data:r}),this.wfs.trigger(o.default.H264_DATA_APPENDING,{data:i})}else if(1===this.mediaCode){if(this.extraData){if(!this.extraData.isDrawImg||void 0==this.media||!this.media)return;var a=new FileReader;a.onload=function(e){if(e.target.readyState===FileReader.DONE){var t=n.ctx,r=new Image,i=n.extraData.mjpeg_w,o=n.extraData.mjpeg_h,a=n.extraData.sizeOptionInd,s=n.extraData.getObjectFitSize;r.onload=function(){if(t.clearRect(0,0,i,o),1===a){var e=s(a,i,o,this.width,this.height),n=e.sx,u=e.sy,c=e.swidth,l=e.sheight,f=e.x,d=e.y,h=e.width,p=e.height;t.drawImage(r,n,u,c,l,f,d,h,p)}else t.drawImage(r,0,0,i,o)},r.src=e.target.result}},a.readAsDataURL(t.data)}else console.log("extraData is undefined"),this.extraData=this.wfs.extraData}}}},{key:"onWebsocketDataUploading",value:function e(t){this.client.send(t.data)}},{key:"onWebsocketMessageSending",value:function e(t){this.client.send(JSON.stringify({t:t.commandType,c:t.channelName,v:t.commandValue}))}},{key:"load",value:function e(){0===this.mediaCode&&(this.client.binaryType="arraybuffer"),this.client.onmessage=this.receiveSocketMessage.bind(this),this.wfs.trigger(o.default.WEBSOCKET_MESSAGE_SENDING,{commandType:"open",channelName:this.channelName,commandValue:"NA"}),this.isLoaded=!0}},{key:"unload",value:function e(){this.isLoaded=!1,1===this.mediaCode&&this.ctx.clearRect(0,0,this.extraData.mjpeg_w,this.extraData.mjpeg_h)}}],c(u.prototype,d),h&&c(u,h),Object.defineProperty(u,"prototype",{writable:!1}),$}(a.default);n.default=d},{"../demux/h264-demuxer":6,"../errors":7,"../event-handler":8,"../events":9}],14:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=function(){var e,t;function n(){!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,n)}return e=n,t=[{key:"init",value:function e(){for(t in n.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},n.types)n.types.hasOwnProperty(t)&&(n.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var t,r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);n.HDLR_TYPES={video:r,audio:i};var o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);n.STTS=n.STSC=n.STCO=a,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);n.FTYP=n.box(n.types.ftyp,s,c,s,u),n.DINF=n.box(n.types.dinf,n.box(n.types.dref,o))}},{key:"box",value:function e(t){for(var n,r=Array.prototype.slice.call(arguments,1),i=8,o=r.length,a=o;o--;)i+=r[o].byteLength;for((n=new Uint8Array(i))[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=255&i,n.set(t,4),o=0,i=8;o<a;o++)n.set(r[o],i),i+=r[o].byteLength;return n}},{key:"hdlr",value:function e(t){return n.box(n.types.hdlr,n.HDLR_TYPES[t])}},{key:"mdat",value:function e(t){return n.box(n.types.mdat,t)}},{key:"mdhd",value:function e(t,r){return r*=t,n.box(n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function e(t){return n.box(n.types.mdia,n.mdhd(t.timescale,t.duration),n.hdlr(t.type),n.minf(t))}},{key:"mfhd",value:function e(t){return n.box(n.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function e(t){return"audio"===t.type?n.box(n.types.minf,n.box(n.types.smhd,n.SMHD),n.DINF,n.stbl(t)):n.box(n.types.minf,n.box(n.types.vmhd,n.VMHD),n.DINF,n.stbl(t))}},{key:"moof",value:function e(t,r,i){return n.box(n.types.moof,n.mfhd(t),n.traf(i,r))}},{key:"moov",value:function e(t){for(var r=t.length,i=[];r--;)i[r]=n.trak(t[r]);return n.box.apply(null,[n.types.moov,n.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(n.mvex(t)))}},{key:"mvex",value:function e(t){for(var r=t.length,i=[];r--;)i[r]=n.trex(t[r]);return n.box.apply(null,[n.types.mvex].concat(i))}},{key:"mvhd",value:function e(t,r){r=0;var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n.box(n.types.mvhd,i)}},{key:"sdtp",value:function e(t){var r,i,o=t.samples||[],a=new Uint8Array(4+o.length);for(i=0;i<o.length;i++)r=o[i].flags,a[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return n.box(n.types.sdtp,a)}},{key:"stbl",value:function e(t){return n.box(n.types.stbl,n.stsd(t),n.box(n.types.stts,n.STTS),n.box(n.types.stsc,n.STSC),n.box(n.types.stsz,n.STSZ),n.box(n.types.stco,n.STCO))}},{key:"avc1",value:function e(t){var r,i,o,a=[],s=[];for(r=0;r<t.sps.length;r++)o=(i=t.sps[r]).byteLength,a.push(o>>>8&255),a.push(255&o),a=a.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)o=(i=t.pps[r]).byteLength,s.push(o>>>8&255),s.push(255&o),s=s.concat(Array.prototype.slice.call(i));var u=n.box(n.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),c=t.width,l=t.height;return n.box(n.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,255&c,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,106,101,102,102,45,121,97,110,47,47,47,103,119,102,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function e(t){var n=t.config.length;return new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(t.config).concat([6,1,2]))}},{key:"mp4a",value:function e(t){var r=t.audiosamplerate;return n.box(n.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),n.box(n.types.esds,n.esds(t)))}},{key:"stsd",value:function e(t){return"audio"===t.type?n.box(n.types.stsd,n.STSD,n.mp4a(t)):n.box(n.types.stsd,n.STSD,n.avc1(t))}},{key:"tkhd",value:function e(t){var r=t.id,i=t.duration*t.timescale,o=t.width,a=t.height;return n.box(n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,o>>8&255,255&o,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function e(t,r){var i=n.sdtp(t),o=t.id;return n.box(n.types.traf,n.box(n.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o])),n.box(n.types.tfdt,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),n.trun(t,i.length+16+16+8+16+8+8),i)}},{key:"trak",value:function e(t){return t.duration=t.duration||4294967295,n.box(n.types.trak,n.tkhd(t),n.mdia(t))}},{key:"trex",value:function e(t){var r=t.id;return n.box(n.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function e(t,r){var i,o,a,s,u,c,l=t.samples||[],f=l.length,d=12+16*f,h=new Uint8Array(d);for(r+=8+d,h.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,255&f,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<f;i++)a=(o=l[i]).duration,s=o.size,u=o.flags,c=o.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*i);return n.box(n.types.trun,h)}},{key:"initSegment",value:function e(t){n.types||n.init();var r,i=n.moov(t);return(r=new Uint8Array(n.FTYP.byteLength+i.byteLength)).set(n.FTYP),r.set(i,n.FTYP.byteLength),r}}],t&&r(e,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();n.default=i},{}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=u(e("../helper/aac")),i=u(e("../events")),o=e("../utils/logger"),a=u(e("../remux/mp4-generator")),s=e("../errors");function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e("../utils/polyfill");var l=function(){var e,t,n;function u(e,t,n){!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,u),this.observer=e,this.id=t,this.config=n,this.ISGenerated=!1,this.PES2MP4SCALEFACTOR=4,this.PES_TIMESCALE=9e4,this.MP4_TIMESCALE=this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR,this.nextAvcDts=90300,this.H264_TIMEBASE=this.config.mp4Duration,this.genISFailCount=0}return e=u,t=[{key:"passthrough",get:function e(){return!1}},{key:"destroy",value:function e(){}},{key:"insertDiscontinuity",value:function e(){this._initPTS=this._initDTS=void 0}},{key:"switchLevel",value:function e(){this.ISGenerated=!1,this.genISFailCount=0}},{key:"pushVideo",value:function e(t,n,r,i,o){this.level=t,this.sn=n,this.ISGenerated||this.generateVideoIS(r,i),this.ISGenerated&&this.remuxVideo_2(r,i,o)}},{key:"remuxVideo_2",value:function e(t,n,r,s){var u,c,l=8,f=t.samples,d=[];u=new Uint8Array(t.len+4*t.nbNalu+8);var h=new DataView(u.buffer);h.setUint32(0,u.byteLength),u.set(a.default.types.mdat,4);for(var p=0,$=0;$<f.length;$++){for(var v=f[$],y=0;v.units.units.length;){var g=v.units.units.shift();h.setUint32(l,g.data.byteLength),l+=4,u.set(g.data,l),l+=g.data.byteLength,y+=4+g.data.byteLength}var m=v.pts-this._initPTS,_=v.dts-this._initDTS;if(_=Math.min(m,_),void 0!==w)b=this._PTSNormalize(m,w),(p=(E=this._PTSNormalize(_,w))-w)<=0&&(o.logger.log("invalid sample duration at PTS/DTS: ".concat(v.pts,"/").concat(v.dts,"|dts norm: ").concat(E,"|lastDTS: ").concat(w,":").concat(p)),p=1);else{var b,E,w,T,k=this.nextAvcDts;b=this._PTSNormalize(m,k),E=this._PTSNormalize(_,k),k&&600>Math.abs(T=Math.round(E-k))&&T&&(T>1?o.logger.log("AVC:".concat(T," ms hole between fragments detected,filling it")):T<-1&&o.logger.log("AVC:".concat(-T," ms overlapping between fragments detected")),b=Math.max(b-T,E=k),o.logger.log("Video/PTS/DTS adjusted: ".concat(b,"/").concat(E,",delta:").concat(T))),this.firstPTS=Math.max(0,b),this.firstDTS=Math.max(0,E),p=.03}d.push({size:y,duration:this.H264_TIMEBASE,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:v.key?2:1,isNonSync:v.key?0:1}}),w=E}var A=0;if(d.length>=2&&(A=d[d.length-2].duration,d[0].duration=A),this.nextAvcDts=E+A,t.len=0,t.nbNalu=0,t.dropped=0,d.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var S=d[0].flags;S.dependsOn=2,S.isNonSync=0}t.samples=d,c=a.default.moof(t.sequenceNumber++,E,t),t.samples=[];var R={data1:c,data2:u,type:"video"};return this.observer.trigger(i.default.FRAG_PARSING_DATA,R),R}},{key:"generateVideoIS",value:function e(t,n){var r,o,u=this.observer,c=t.samples,l=(this.PES_TIMESCALE,{}),f={id:this.id,level:this.level,sn:this.sn,tracks:l,unique:!1},d=void 0===this._initPTS;d&&(r=o=1/0),t.sps&&t.pps&&c.length&&(t.timescale=9e4,l.video={container:"video/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{width:t.width,height:t.height}},d&&(r=Math.min(r,c[0].pts-this.H264_TIMEBASE),o=Math.min(o,c[0].dts-this.H264_TIMEBASE))),Object.keys(l).length?(u.trigger(i.default.FRAG_PARSING_INIT_SEGMENT,f),this.ISGenerated=!0,this.genISFailCount=0,d&&(this._initPTS=r,this._initDTS=o)):(this.genISFailCount++,this.genISFailCount>60&&console.log("generateVideoIS ERROR: ",s.ErrorTypes.MEDIA_ERROR))}},{key:"remux",value:function e(t,n,r,o,a,s,u,c){if(this.level=t,this.sn=n,this.ISGenerated||this.generateIS(r,o,u),this.ISGenerated){if(r.samples.length){var l,f,d=this.remuxAudio(r,u,c);o.samples.length&&(d&&(f=d.endPTS-d.startPTS),this.remuxVideo(o,u,c,f))}else o.samples.length&&(l=this.remuxVideo(o,u,c)),l&&r.codec&&this.remuxEmptyAudio(r,u,c,l)}a.samples.length&&this.remuxID3(a,u),s.samples.length&&this.remuxText(s,u),this.observer.trigger(i.default.FRAG_PARSED,{id:this.id,level:this.level,sn:this.sn})}},{key:"generateIS",value:function e(t,n,r){var u,c,l=this.observer,f=t.samples,d=n.samples,h=this.PES_TIMESCALE,p={},$={id:this.id,level:this.level,sn:this.sn,tracks:p,unique:!1},v=void 0===this._initPTS;v&&(u=c=1/0),t.config&&f.length&&(t.timescale=t.audiosamplerate,t.timescale*t.duration>4294967296&&(t.timescale=t.audiosamplerate/function e(t,n){return n?e(n,t%n):t}(t.audiosamplerate,1024)),o.logger.log("audio mp4 timescale :"+t.timescale),p.audio={container:"audio/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{channelCount:t.channelCount}},v&&(u=c=f[0].pts-h*r)),n.sps&&n.pps&&d.length&&(n.timescale=this.MP4_TIMESCALE,p.video={container:"video/mp4",codec:n.codec,initSegment:a.default.initSegment([n]),metadata:{width:n.width,height:n.height}},v&&(u=Math.min(u,d[0].pts-h*r),c=Math.min(c,d[0].dts-h*r))),Object.keys(p).length?(l.trigger(i.default.FRAG_PARSING_INIT_SEGMENT,$),this.ISGenerated=!0,v&&(this._initPTS=u,this._initDTS=c)):l.trigger(i.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,id:this.id,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxAudio",value:function e(t,n,s){var u,c,l,f,d,h,p,$,v,y,g,m,_,b=this.PES_TIMESCALE,E=b/t.timescale,w=1024*t.timescale/t.audiosamplerate,T=8,k=[],A=[];t.samples.sort(function(e,t){return e.pts-t.pts}),A=t.samples;for(var S=s?this.nextAacPts:n*b,R=this._PTSNormalize(A[0].pts-this._initPTS,S),P=w*E,D=R+P,L=1;L<A.length;){var x=A[L],C=this._PTSNormalize(x.pts-this._initPTS,S),O=C-D;if(O<-.5*P)o.logger.log("Dropping frame due to ".concat(Math.abs(O/90)," ms overlap.")),A.splice(L,1),t.len-=x.unit.length;else if(O>.5*P){var I=Math.round(O/P);o.logger.log("Injecting ".concat(I," frame").concat(I>1?"s":""," of missing audio due to ").concat(Math.round(O/90)," ms gap."));for(var N=0;N<I;N++){var F=A[L-1].pts+P,M=r.default.getSilentFrame(t.channelCount);M||(o.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),M=x.unit.slice(0)),A.splice(L,0,{unit:M,pts:F,dts:F}),t.len+=M.length,L+=1}D+=(I+1)*P,x.pts=A[L-1].pts+P,L+=1}else Math.abs(O)>.1*P&&o.logger.log("Invalid frame delta ".concat(C-D+P," at PTS ").concat(Math.round(C/90)," (should be ").concat(P,").")),D+=P,x.pts=A[L-1].pts+P,L+=1}for(;A.length;){if(f=(c=A.shift()).unit,y=c.pts-this._initDTS,g=c.dts-this._initDTS,void 0!==v)m=this._PTSNormalize(y,v),_=this._PTSNormalize(g,v),l.duration=(_-v)/E;else{m=this._PTSNormalize(y,S),_=this._PTSNormalize(g,S);var G=Math.round(1e3*(m-S)/b);if(s&&G){if(G>0)o.logger.log("".concat(G," ms hole between AAC samples detected,filling it"));else if(G<-12){o.logger.log("".concat(-G," ms overlapping between AAC samples detected, drop frame")),t.len-=f.byteLength;continue}m=_=S}if(p=Math.max(0,m),$=Math.max(0,_),!(t.len>0))return;d=new Uint8Array(t.len+8),(u=new DataView(d.buffer)).setUint32(0,d.byteLength),d.set(a.default.types.mdat,4)}d.set(f,T),T+=f.byteLength,l={size:f.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},k.push(l),v=_}var B=0,U=k.length;if(U>=2&&(B=k[U-2].duration,l.duration=B),U){this.nextAacPts=m+E*B,t.len=0,t.samples=k,h=a.default.moof(t.sequenceNumber++,$/E,t),t.samples=[];var H={id:this.id,level:this.level,sn:this.sn,data1:h,data2:d,startPTS:p/b,endPTS:this.nextAacPts/b,startDTS:$/b,endDTS:(_+E*B)/b,type:"audio",nb:U};return this.observer.trigger(i.default.FRAG_PARSING_DATA,H),H}return null}},{key:"remuxEmptyAudio",value:function e(t,n,i,a){var s=this.PES_TIMESCALE,u=t.timescale?t.timescale:t.audiosamplerate,c=a.startDTS*s+this._initDTS,l=a.endDTS*s+this._initDTS,f=s/u*1024,d=Math.ceil((l-c)/f),h=r.default.getSilentFrame(t.channelCount);if(!h){o.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");return}for(var p=[],$=0;$<d;$++){var v=c+$*f;p.push({unit:h.slice(0),pts:v,dts:v}),t.len+=h.length}t.samples=p,this.remuxAudio(t,n,i)}},{key:"remuxID3",value:function e(t,n){var r,o=t.samples.length;if(o){for(var a=0;a<o;a++)(r=t.samples[a]).pts=(r.pts-this._initPTS)/this.PES_TIMESCALE,r.dts=(r.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(i.default.FRAG_PARSING_METADATA,{id:this.id,level:this.level,sn:this.sn,samples:t.samples})}t.samples=[]}},{key:"remuxText",value:function e(t,n){t.samples.sort(function(e,t){return e.pts-t.pts});var r,o=t.samples.length;if(o){for(var a=0;a<o;a++)(r=t.samples[a]).pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(i.default.FRAG_PARSING_USERDATA,{id:this.id,level:this.level,sn:this.sn,samples:t.samples})}t.samples=[]}},{key:"_PTSNormalize",value:function e(t,n){var r;if(void 0===n)return t;for(r=n<t?-8589934592:8589934592;Math.abs(t-n)>4294967296;)t+=r;return t}}],c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),u}();n.default=l},{"../errors":7,"../events":9,"../helper/aac":10,"../remux/mp4-generator":14,"../utils/logger":16,"../utils/polyfill":18}],16:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){}Object.defineProperty(n,"__esModule",{value:!0}),n.logger=n.enableLogs=void 0;var o={trace:i,debug:i,log:i,warn:i,info:i,error:i},a=o,s=function e(t){if(!0===t||"object"===r(t)){!function e(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];r.forEach(function(e){var n,r;a[e]=t[e]?t[e].bind(t):(n=e,(r=window.console[n])?function(){for(var e,t,i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];o[0]&&(o[0]=(e=n,t="["+e+"] > "+(t=o[0]))),r.apply(window.console,o)}:i)})}(t,"debug","log","info","warn","error");try{a.log()}catch(n){a=o}}else a=o};n.enableLogs=s;var u=a;n.logger=u},{}],17:[function(e,t,n){(function(e){(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.createEncoderWithModule=a,n.createFile=o,n.default=void 0;var r,i=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(n){var i,o,s,u,c,l,f,d,h,p,$,v,y,g,m,_,b,E,w,T,k,A,n=void 0!==(n=n||{})?n:{};n.ready=new Promise(function(e,t){o=e,s=t}),n.createEncoder=function e(t){return a(n,t)};var S=Object.assign({},n),R=[],P="./this.program",D=function e(t,n){throw n},L=("undefined"==typeof window?"undefined":t(window))=="object",x="function"==typeof importScripts;(void 0===e?"undefined":t(e))=="object"&&"object"==t(e.versions)&&e.versions.node;var C="";(L||x)&&(x?C=self.location.href:"undefined"!=typeof document&&document.currentScript&&(C=document.currentScript.src),r&&(C=r),C=0!==C.indexOf("blob:")?C.substr(0,C.replace(/[?#].*/,"").lastIndexOf("/")+1):"",u=function e(t){var n=new XMLHttpRequest;return n.open("GET",t,!1),n.send(null),n.responseText},x&&(l=function e(t){var n=new XMLHttpRequest;return n.open("GET",t,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),c=function e(t,n,r){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){if(200==i.status||0==i.status&&i.response){n(i.response);return}r()},i.onerror=r,i.send(null)},f=function e(t){return document.title=t}),n.print||console.log.bind(console);var O=n.printErr||console.warn.bind(console);Object.assign(n,S),S=null,n.arguments&&(R=n.arguments),n.thisProgram&&(P=n.thisProgram),n.quit&&(D=n.quit),n.wasmBinary&&(d=n.wasmBinary),n.noExitRuntime,("undefined"==typeof WebAssembly?"undefined":t(WebAssembly))!="object"&&q("no native wasm support detected");var I=!1;function N(e,t){return e?function e(t,n,r){for(var i=n+r,o="";!(n>=i);){var a=t[n++];if(!a)break;if(!(128&a)){o+=String.fromCharCode(a);continue}var s=63&t[n++];if((224&a)==192){o+=String.fromCharCode((31&a)<<6|s);continue}var u=63&t[n++];if((a=(240&a)==224?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[n++])<65536)o+=String.fromCharCode(a);else{var c=a-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}return o}(y,e,t):""}function F(e){$=e,n.HEAP8=v=new Int8Array(e),n.HEAP16=g=new Int16Array(e),n.HEAP32=_=new Int32Array(e),n.HEAPU8=y=new Uint8Array(e),n.HEAPU16=m=new Uint16Array(e),n.HEAPU32=b=new Uint32Array(e),n.HEAPF32=E=new Float32Array(e),n.HEAPF64=w=new Float64Array(e)}n.INITIAL_MEMORY;var M=[],G=[],B=[],U=!1;function H(e){M.unshift(e)}function W(e){B.unshift(e)}var V=0,j=null,z=null;function q(e){n.onAbort&&n.onAbort(e),O(e="Aborted("+e+")"),I=!0,p=1,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw s(t),t}function K(e){return e.startsWith("data:application/octet-stream;base64,")}function Y(e){try{if(e==k&&d)return new Uint8Array(d);if(l)return l(e);throw"both async and sync fetching of the wasm failed"}catch(t){q(t)}}function Z(e){for(;e.length>0;)e.shift()(n)}function J(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw TypeError("Unknown type size: "+e)}}!K(k="mp4-encoder.wasm")&&(k=(i=k,n.locateFile?n.locateFile(i,C):C+i));var Q=void 0;function X(e){for(var t="",n=e;y[n];)t+=Q[y[n++]];return t}var ee={},et={},en={};function er(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function ei(e,t){return Function("body","return function "+(e=er(e))+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function eo(e,t){var n=ei(t,function(e){this.name=t,this.message=e;var n=Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var ea=void 0;function es(e){throw new ea(e)}var eu=void 0;function ec(e){throw new eu(e)}function el(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw TypeError("registerType registeredInstance requires argPackAdvance");var r=t.name;if(e||es('type "'+r+'" must have a positive integer typeid pointer'),et.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;es("Cannot register type '"+r+"' twice")}if(et[e]=t,delete en[e],ee.hasOwnProperty(e)){var i=ee[e];delete ee[e],i.forEach(function(e){return e()})}}var ef=[],ed=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function eh(e){e>4&&0==--ed[e].refcount&&(ed[e]=void 0,ef.push(e))}var ep={toValue:function e(t){return t||es("Cannot use deleted val. handle = "+t),ed[t].value},toHandle:function e(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var n=ef.length?ef.pop():ed.length;return ed[n]={refcount:1,value:t},n}}};function e$(e){return this.fromWireType(_[e>>2])}function ev(e){for(;e.length;){var t=e.pop();e.pop()(t)}}var ey=[];function eg(e){var t=ey[e];return t||(e>=ey.length&&(ey.length=e+1),ey[e]=t=T.get(e)),t}var em=void 0;function e_(e){var t=eL(e),n=X(t);return eD(t),n}function eb(e,t){for(var n="",r=0;!(r>=t/2);++r){var i=g[e+2*r>>1];if(0==i)break;n+=String.fromCharCode(i)}return n}function e8(e,t,n){if(void 0===n&&(n=2147483647),n<2)return 0;for(var r=t,i=(n-=2)<2*e.length?n/2:e.length,o=0;o<i;++o){var a=e.charCodeAt(o);g[t>>1]=a,t+=2}return g[t>>1]=0,t-r}function eE(e){return 2*e.length}function ew(e,t){for(var n=0,r="";!(n>=t/4);){var i=_[e+4*n>>2];if(0==i)break;if(++n,i>=65536){var o=i-65536;r+=String.fromCharCode(55296|o>>10,56320|1023&o)}else r+=String.fromCharCode(i)}return r}function e0(e,t,n){if(void 0===n&&(n=2147483647),n<4)return 0;for(var r=t,i=r+n-4,o=0;o<e.length;++o){var a=e.charCodeAt(o);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),_[t>>2]=a,(t+=4)+4>i)break}return _[t>>2]=0,t-r}function eT(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&++n,t+=4}return t}function ek(e,t){var n=et[e];return void 0===n&&es(t+" has unknown type "+e_(e)),n}var eA={};function eS(e){try{return h.grow(e-$.byteLength+65535>>>16),F(h.buffer),1}catch(t){}}(function e(){for(var t=Array(256),n=0;n<256;++n)t[n]=String.fromCharCode(n);Q=t})(),ea=n.BindingError=eo(Error,"BindingError"),eu=n.InternalError=eo(Error,"InternalError"),n.count_emval_handles=function e(){for(var t=0,n=5;n<ed.length;++n)void 0!==ed[n]&&++t;return t},n.get_first_emval=function e(){for(var t=5;t<ed.length;++t)if(void 0!==ed[t])return ed[t];return null},em=n.UnboundTypeError=eo(Error,"UnboundTypeError");var eR={a:function e(t,n,r,i){q("Assertion failed: "+N(t)+", at: "+[n?N(n):"unknown filename",r,i?N(i):"unknown function"])},q:function e(t,n,r,i,o){},u:function e(t,n,r,i,o){var a=J(r);n=X(n),el(t,{name:n,fromWireType:function e(t){return!!t},toWireType:function e(t,n){return n?i:o},argPackAdvance:8,readValueFromPointer:function e(t){var i;if(1===r)i=v;else if(2===r)i=g;else if(4===r)i=_;else throw TypeError("Unknown boolean type size: "+n);return this.fromWireType(i[t>>a])},destructorFunction:null})},t:function e(t,n){n=X(n),el(t,{name:n,fromWireType:function e(t){var n=ep.toValue(t);return eh(t),n},toWireType:function e(t,n){return ep.toHandle(n)},argPackAdvance:8,readValueFromPointer:e$,destructorFunction:null})},o:function e(t,n,r){var i=J(r);n=X(n),el(t,{name:n,fromWireType:function e(t){return t},toWireType:function e(t,n){return n},argPackAdvance:8,readValueFromPointer:function e(t,n){switch(n){case 2:return function(e){return this.fromWireType(E[e>>2])};case 3:return function(e){return this.fromWireType(w[e>>3])};default:throw TypeError("Unknown float type: "+t)}}(n,i),destructorFunction:null})},h:function e(r,i,o,a,s,u){var c,l,f,d,h,p,$=function e(t,n){for(var r=[],i=0;i<t;i++)r.push(b[n+4*i>>2]);return r}(i,o);r=X(r),s=(c=a,l=s,c=X(c),"function"!=typeof(f=function e(){if(c.includes("j")){var t,r,i;return t=c,r=l,i=[],function(){var e,o,a,s,u,c,l;return i.length=0,Object.assign(i,arguments),e=t,o=r,a=i,e.includes("j")?(s=e,u=o,c=a,l=n["dynCall_"+s],c&&c.length?l.apply(null,[u].concat(c)):l.call(null,u)):eg(o).apply(null,a)}}return eg(l)}())&&es("unknown function pointer with signature "+c+": "+l),f),d=r,h=function(){!function e(t,n){var r=[],i={};function o(e){if(!i[e]&&!et[e]){if(en[e]){en[e].forEach(o);return}r.push(e),i[e]=!0}}throw n.forEach(o),new em(t+": "+r.map(e_).join([", "]))}("Cannot call "+r+" due to unbound types",$)},p=i-1,n.hasOwnProperty(d)?((void 0===p||void 0!==n[d].overloadTable&&void 0!==n[d].overloadTable[p])&&es("Cannot register public name '"+d+"' twice"),function e(t,n,r){if(void 0===t[n].overloadTable){var i=t[n];t[n]=function(){return t[n].overloadTable.hasOwnProperty(arguments.length)||es("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[n].overloadTable+")!"),t[n].overloadTable[arguments.length].apply(this,arguments)},t[n].overloadTable=[],t[n].overloadTable[i.argCount]=i}}(n,d,d),n.hasOwnProperty(p)&&es("Cannot register multiple overloads of a function with the same number of arguments ("+p+")!"),n[d].overloadTable[p]=h):(n[d]=h,void 0!==p&&(n[d].numArguments=p)),function e(t,n,r){function i(e){var n=r(e);n.length!==t.length&&ec("Mismatched type converter count");for(var i=0;i<t.length;++i)el(t[i],n[i])}t.forEach(function(e){en[e]=n});var o=Array(n.length),a=[],s=0;n.forEach(function(e,t){et.hasOwnProperty(e)?o[t]=et[e]:(a.push(e),ee.hasOwnProperty(e)||(ee[e]=[]),ee[e].push(function(){o[t]=et[e],++s===a.length&&i(o)}))}),0===a.length&&i(o)}([],$,function(e){var o,a,c,l=[e[0],null].concat(e.slice(1));return o=r,a=function e(n,r,i,o,a){var s=r.length;s<2&&es("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=null!==r[1]&&!1,c=!1,l=1;l<r.length;++l)if(null!==r[l]&&void 0===r[l].destructorFunction){c=!0;break}for(var f="void"!==r[0].name,d="",h="",l=0;l<s-2;++l)d+=(0!==l?", ":"")+"arg"+l,h+=(0!==l?", ":"")+"arg"+l+"Wired";var p="return function "+er(n)+"("+d+") {\nif (arguments.length !== "+(s-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+(s-2)+" args!');\n}\n";c&&(p+="var destructors = [];\n");var $=c?"destructors":"null",v=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],y=[es,o,a,ev,r[0],r[1]];u&&(p+="var thisWired = classParam.toWireType("+$+", this);\n");for(var l=0;l<s-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+$+", arg"+l+"); // "+r[l+2].name+"\n",v.push("argType"+l),y.push(r[l+2]);if(u&&(h="thisWired"+(h.length>0?", ":"")+h),p+=(f?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",c)p+="runDestructors(destructors);\n";else for(var l=u?1:2;l<r.length;++l){var g=1===l?"thisWired":"arg"+(l-2)+"Wired";null!==r[l].destructorFunction&&(p+=g+"_dtor("+g+"); // "+r[l].name+"\n",v.push(g+"_dtor"),y.push(r[l].destructorFunction))}return f&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),p+="}\n",v.push(p),(function e(n,r){if(!(n instanceof Function))throw TypeError("new_ called with constructor type "+t(n)+" which is not a function");var i=ei(n.name||"unknownFunctionName",function(){});i.prototype=n.prototype;var o=new i,a=n.apply(o,r);return a instanceof Object?a:o})(Function,v).apply(null,y)}(r,l,null,s,u),c=i-1,n.hasOwnProperty(o)||ec("Replacing nonexistant public symbol"),void 0!==n[o].overloadTable&&void 0!==c?n[o].overloadTable[c]=a:(n[o]=a,n[o].argCount=c),[]})},d:function e(t,n,r,i,o){n=X(n),-1===o&&(o=4294967295);var a,s=J(r),u=function e(t){return t};if(0===i){var c=32-8*r;u=function e(t){return t<<c>>>c}}var l=n.includes("unsigned"),f=function e(t,n){};a=l?function e(t,n){return f(n,this.name),n>>>0}:function e(t,n){return f(n,this.name),n},el(t,{name:n,fromWireType:u,toWireType:a,argPackAdvance:8,readValueFromPointer:function e(t,n,r){switch(n){case 0:return r?function e(t){return v[t]}:function e(t){return y[t]};case 1:return r?function e(t){return g[t>>1]}:function e(t){return m[t>>1]};case 2:return r?function e(t){return _[t>>2]}:function e(t){return b[t>>2]};default:throw TypeError("Unknown integer type: "+t)}}(n,s,0!==i),destructorFunction:null})},c:function e(t,n,r){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][n];function o(e){var t=b,n=t[e>>=2],r=t[e+1];return new i($,r,n)}r=X(r),el(t,{name:r,fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},n:function e(t,n){var r="std::string"===(n=X(n));el(t,{name:n,fromWireType:function e(t){var n,i=b[t>>2],o=t+4;if(r)for(var a=o,s=0;s<=i;++s){var u=o+s;if(s==i||0==y[u]){var c=u-a,l=N(a,c);void 0===n?n=l:(n+="\0",n+=l),a=u+1}}else{for(var f=Array(i),s=0;s<i;++s)f[s]=String.fromCharCode(y[o+s]);n=f.join("")}return eD(t),n},toWireType:function e(t,n){n instanceof ArrayBuffer&&(n=new Uint8Array(n));var i,o,a,s,u="string"==typeof n;u||n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int8Array||es("Cannot pass non-string to std::string");var c=e3(4+(s=r&&u?function e(t){for(var n=0,r=0;r<t.length;++r){var i=t.charCodeAt(r);i<=127?n++:i<=2047?n+=2:i>=55296&&i<=57343?(n+=4,++r):n+=3}return n}(n):n.length)+1),l=c+4;if(b[c>>2]=s,r&&u)i=n,o=l,function e(t,n,r,i){if(!(i>0))return 0;for(var o=r,a=r+i-1,s=0;s<t.length;++s){var u=t.charCodeAt(s);if(u>=55296&&u<=57343&&(u=65536+((1023&u)<<10)|1023&t.charCodeAt(++s)),u<=127){if(r>=a)break;n[r++]=u}else if(u<=2047){if(r+1>=a)break;n[r++]=192|u>>6,n[r++]=128|63&u}else if(u<=65535){if(r+2>=a)break;n[r++]=224|u>>12,n[r++]=128|u>>6&63,n[r++]=128|63&u}else{if(r+3>=a)break;n[r++]=240|u>>18,n[r++]=128|u>>12&63,n[r++]=128|u>>6&63,n[r++]=128|63&u}}return n[r]=0,r-o}(i,y,o,a=s+1);else if(u)for(var f=0;f<s;++f){var d=n.charCodeAt(f);d>255&&(eD(l),es("String has UTF-16 code units that do not fit in 8 bits")),y[l+f]=d}else for(var f=0;f<s;++f)y[l+f]=n[f];return null!==t&&t.push(eD,c),c},argPackAdvance:8,readValueFromPointer:e$,destructorFunction:function e(t){eD(t)}})},l:function e(t,n,r){var i,o,a,s,u;r=X(r),2===n?(i=eb,o=e8,s=eE,a=function e(){return m},u=1):4===n&&(i=ew,o=e0,s=eT,a=function e(){return b},u=2),el(t,{name:r,fromWireType:function e(t){for(var r,o=b[t>>2],s=a(),c=t+4,l=0;l<=o;++l){var f=t+4+l*n;if(l==o||0==s[f>>u]){var d=f-c,h=i(c,d);void 0===r?r=h:(r+="\0",r+=h),c=f+n}}return eD(t),r},toWireType:function e(t,i){"string"!=typeof i&&es("Cannot pass non-string to C++ string type "+r);var a=s(i),c=e3(4+a+n);return b[c>>2]=a>>u,o(i,c+4,a+n),null!==t&&t.push(eD,c),c},argPackAdvance:8,readValueFromPointer:e$,destructorFunction:function e(t){eD(t)}})},v:function e(t,n){n=X(n),el(t,{isVoid:!0,name:n,argPackAdvance:0,fromWireType:function e(){},toWireType:function e(t,n){}})},k:function e(t,n,r){t=ep.toValue(t),n=ek(n,"emval::as");var i=[],o=ep.toHandle(i);return b[r>>2]=o,n.toWireType(i,t)},w:function e(t,n,r,i){t=ep.toValue(t);for(var o=function e(t,n){for(var r=Array(t),i=0;i<t;++i)r[i]=ek(b[n+4*i>>2],"parameter "+i);return r}(n,r),a=Array(n),s=0;s<n;++s){var u=o[s];a[s]=u.readValueFromPointer(i),i+=u.argPackAdvance}var c=t.apply(void 0,a);return ep.toHandle(c)},b:eh,e:function e(t,n){return t=ep.toValue(t),n=ep.toValue(n),ep.toHandle(t[n])},g:function e(t){t>4&&(ed[t].refcount+=1)},p:function e(t){return"number"==typeof(t=ep.toValue(t))},f:function e(t){var n,r;return ep.toHandle(void 0===(r=eA[n=t])?X(n):r)},j:function e(t){ev(ep.toValue(t)),eh(t)},i:function e(t,n){var r=(t=ek(t,"_emval_take_value")).readValueFromPointer(n);return ep.toHandle(r)},m:function e(){q("")},s:function e(t,n,r){y.copyWithin(t,n,n+r)},r:function e(t){var n=y.length;if((t>>>=0)>2147483648)return!1;for(var r=1;r<=4;r*=2){var i,o,a=n*(1+.2/r);if(a=Math.min(a,t+100663296),eS(Math.min(2147483648,(i=Math.max(t,a))+(65536-i%65536)%65536)))return!0}return!1}};(function e(){var t={a:eR};function r(e,t){var r,i=e.exports;n.asm=i,F((h=n.asm.x).buffer),T=n.asm.B,r=n.asm.y,G.unshift(r),function e(t){if(V--,n.monitorRunDependencies&&n.monitorRunDependencies(V),0==V&&(null!==j&&(clearInterval(j),j=null),z)){var r=z;z=null,r()}}("wasm-instantiate")}function i(e){r(e.instance)}function o(e){return(!d&&(L||x)&&"function"==typeof fetch?fetch(k,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+k+"'";return e.arrayBuffer()}).catch(function(){return Y(k)}):Promise.resolve().then(function(){return Y(k)})).then(function(e){return WebAssembly.instantiate(e,t)}).then(function(e){return e}).then(e,function(e){O("failed to asynchronously prepare wasm: "+e),q(e)})}if(V++,n.monitorRunDependencies&&n.monitorRunDependencies(V),n.instantiateWasm)try{return n.instantiateWasm(t,r)}catch(a){O("Module.instantiateWasm callback failed with error: "+a),s(a)}return(d||"function"!=typeof WebAssembly.instantiateStreaming||K(k)||"function"!=typeof fetch?o(i):fetch(k,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,t).then(i,function(e){return O("wasm streaming compile failed: "+e),O("falling back to ArrayBuffer instantiation"),o(i)})})).catch(s),{}})();var eP=n.___wasm_call_ctors=function(){return(eP=n.___wasm_call_ctors=n.asm.y).apply(null,arguments)},e3=n._malloc=function(){return(e3=n._malloc=n.asm.z).apply(null,arguments)},eD=n._free=function(){return(eD=n._free=n.asm.A).apply(null,arguments)},eL=n.___getTypeName=function(){return(eL=n.___getTypeName=n.asm.C).apply(null,arguments)},ex=n.__embind_initialize_bindings=function(){return(ex=n.__embind_initialize_bindings=n.asm.D).apply(null,arguments)},e2=n.dynCall_ijiii=function(){return(e2=n.dynCall_ijiii=n.asm.E).apply(null,arguments)};function eC(e){if(e=e||R,!(V>0))(function e(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)H(n.preRun.shift());Z(M)})(),!(V>0)&&(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),t()},1)):t());function t(){!A&&(A=!0,n.calledRun=!0,I||(U=!0,Z(G),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function e(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)W(n.postRun.shift());Z(B)}()))}}if(z=function e(){A||eC(),A||(z=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return eC(),n.ready});function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256,t=0,n=0,r=new Uint8Array(e);return{contents:function e(){return r.slice(0,n)},seek:function e(n){t=n},write:function e(i){var o=i.byteLength;return function e(t){var i=r.length;if(!(i>=t)){t=Math.max(t,i*(i<1048576?2:1.125)>>>0),0!=i&&(t=Math.max(t,256));var o=r;r=new Uint8Array(t),n>0&&r.set(o.subarray(0,n),0)}}(t+o),r.set(i,t),t+=o,n=Math.max(n,t),o}}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.width,r=t.height,i=t.fps,a=t.fragmentation,s=t.sequential,u=t.hevc;if("number"!=typeof n||"number"!=typeof r)throw Error("Must specify { width, height } options");if(!isFinite(n)||n<0||!isFinite(r)||r<0)throw Error("{ width, height } options must be positive integers");var c=o(),l=e.create_muxer({width:n,height:r,fps:void 0===i?30:i,fragmentation:void 0!==a&&a,sequential:void 0!==s&&s,hevc:void 0!==u&&u},function t(n,r,i){c.seek(i);var o=e.HEAPU8.subarray(n,n+r);return c.write(o)!==o.byteLength});return{end:function t(){return e.finalize_muxer(l),c.contents()},addNalu:function t(n){var r=e._malloc(n.byteLength);e.HEAPU8.set(n,r),e.mux_nal(l,r,n.byteLength),e._free(r)}}}n.default=i,i.createFile=o}).call(this)}).call(this,e("_process"))},{_process:2}],18:[function(e,t,n){"use strict";"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(e,t){var n=new Uint8Array(this);void 0===t&&(t=n.length);for(var r=new ArrayBuffer(t-e),i=new Uint8Array(r),o=0;o<i.length;o++)i[o]=n[o+e];return r})},{}],19:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=function(){var e,t,n;function i(e){!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,i),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return e=i,t=[{key:"destroy",value:function e(){this.abort(),this.loader=null}},{key:"abort",value:function e(){var t=this.loader;t&&4!==t.readyState&&(this.stats.aborted=!0,t.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null}},{key:"loadHead",value:function e(t,n,r){this.context=t,this.config=n,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=n.retryDelay;var i=new XMLHttpRequest;i.open("head",t.url),i.onload=function(){r.onSuccess(i.getResponseHeader("content-length"))},i.send()}},{key:"load",value:function e(t,n,r){this.context=t,this.config=n,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=n.retryDelay,this.loadInternal()}},{key:"loadInternal",value:function e(){var t,n=this.context;(t="undefined"!=typeof XDomainRequest?this.loader=new XDomainRequest:this.loader=new XMLHttpRequest).onloadend=this.loadend.bind(this),t.onprogress=this.loadprogress.bind(this),t.open("GET",n.url,!0),n.rangeEnd&&t.setRequestHeader("Range","bytes="+n.rangeStart+"-"+(n.rangeEnd-1)),t.responseType=n.responseType;var r=this.stats;r.tfirst=0,r.loaded=0,this.xhrSetup&&this.xhrSetup(t,n.url),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),t.send()}},{key:"loadend",value:function e(t){var n=t.currentTarget,r=n.status,i=this.stats,o=this.context,a=this.config;if(!i.aborted){if(window.clearTimeout(this.requestTimeout),r>=200&&r<300){i.tload=Math.max(i.tfirst,performance.now()),u="arraybuffer"===o.responseType?(s=n.response).byteLength:(s=n.responseText).length,i.loaded=i.total=u;var s,u,c={url:n.responseURL,data:s};this.callbacks.onSuccess(c,i,o)}else i.retry>=a.maxRetry||r>=400&&r<499?this.callbacks.onError({code:r,text:n.statusText},o):(this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}}},{key:"loadtimeout",value:function e(){this.callbacks.onTimeout(this.stats,this.context)}},{key:"loadprogress",value:function e(t){var n=this.stats;0===n.tfirst&&(n.tfirst=Math.max(performance.now(),n.trequest)),n.loaded=t.loaded,t.lengthComputable&&(n.total=t.total);var r=this.callbacks.onProgress;r&&r(n,this.context,null)}}],r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();n.default=i},{}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("./errors"),i=l(e("./events")),o=l(e("./controller/flow-controller")),a=l(e("./controller/buffer-controller")),s=l(e("events")),u=l(e("./utils/xhr-loader"));l(e("./loader/file-loader"));var c=l(e("./loader/websocket-loader"));function l(e){return e&&e.__esModule?e:{default:e}}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d=function(){var e,t,n;function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function e(t,n){if(!(t instanceof n))throw TypeError("Cannot call a class as a function")}(this,l);var t=l.DefaultConfig;for(var n in t)!(n in e)&&(e[n]=t[n]);this.config=e;var r=this.observer=new s.default;r.trigger=function e(t){for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r.emit.apply(r,[t,t].concat(i))},r.off=function e(t){for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r.removeListener.apply(r,[t].concat(i))},this.on=r.on.bind(r),this.off=r.off.bind(r),this.trigger=r.trigger.bind(r),this.flowController=new o.default(this),this.bufferController=new a.default(this),this.websocketLoader=new c.default(this),this.mediaType=void 0,this.extraData=void 0}return e=l,t=[{key:"destroy",value:function e(){console.log("wfs destroy +++"),this.flowController.destroy(),this.bufferController.destroy(),this.websocketLoader.destroy(),console.log("wfs destroy ---")}},{key:"attachMedia",value:function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"chX",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"H264Raw",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"play2",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;this.mediaType=r,this.media=t,this.extraData=a;var s=void 0;s="MJPEG"===r?i.default.MEDIA_ATTACHED:i.default.MEDIA_ATTACHING,this.trigger(s,{media:t,channelName:n,mediaType:r,websocketName:o,extraData:this.extraData})}},{key:"attachWebsocket",value:function e(t,n,r){this.trigger(i.default.WEBSOCKET_ATTACHING,{websocket:t,websocketName:n,media:this.media,mediaType:this.mediaType,channelName:r,extraData:this.extraData})}},{key:"start_recording",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1073741824,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;this.trigger(i.default.RECORDING_START,{rec_file_threshold:t,result_cb:n,state_cb:r})}},{key:"playerSeekNow",value:function e(){this.trigger(i.default.PLAYER_SEEK_NOW)}},{key:"stop_recording",value:function e(){this.trigger(i.default.RECORDING_STOP)}}],n=[{key:"version",get:function e(){return"v.0.0.0.1"}},{key:"isSupported",value:function e(){return window.MediaSource&&"function"==typeof window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42c01f,mp4a.40.2"')}},{key:"Events",get:function e(){return i.default}},{key:"ErrorTypes",get:function e(){return r.ErrorTypes}},{key:"ErrorDetails",get:function e(){return r.ErrorDetails}},{key:"DefaultConfig",get:function e(){return l.defaultConfig||(l.defaultConfig={autoStartLoad:!0,startPosition:-1,debug:!1,fLoader:void 0,loader:u.default,fmp4FileUrl:"xxxx.mp4",fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,fragLoadingLoopThreshold:3,forceKeyFrameOnDiscontinuity:!0,appendErrorMaxRetry:3,wsMinPacketInterval:3e3,wsMaxPacketInterval:3e4,mp4Duration:1e3}),l.defaultConfig},set:function e(t){l.defaultConfig=t}}],t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),l}();n.default=d},{"./controller/buffer-controller":3,"./controller/flow-controller":4,"./errors":7,"./events":9,"./loader/file-loader":12,"./loader/websocket-loader":13,"./utils/xhr-loader":19,events:1}]},{},[11])(11)});