/*! * FlvPlayer.js v1.1.8 * Github: https://github.com/zhw2590582/FlvPlayer#readme * (c) 2017-2020 Harvey Zack * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).FlvPlayer=t()}(this,(function(){"use strict";var e=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};var t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function n(e,t){for(var n=0;n1?n-1:0),o=1;o1?n-1:0),i=1;i1?n-1:0),i=1;i3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(t))return t.map((function(t){return r.proxy(e,t,n,o)}));e.addEventListener(t,n,o);var i=function(){return e.removeEventListener(t,n,o)};return this.destroys.push(i),i}},{key:"destroy",value:function(){this.destroys.forEach((function(e){return e()}))}}]),e}();function S(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function k(){return/MicroMessenger/i.test(navigator.userAgent)}function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function j(e){var t=0;function n(r){for(var o=new Uint8Array(r),i=0;i1?t-1:0),r=1;r=1e3&&(e(t/i*1e3),n=o,t=0)}}var E=Object.freeze({__proto__:null,isMobile:S,isWechat:k,hasOwnProperty:O,readBuffer:j,mergeBuffer:A,createWorker:function(e){return new Worker(URL.createObjectURL(new Blob([e],{type:"application/javascript"})))},secondToTime:function(e){var t=Math.floor(e/3600),n=Math.floor((e-3600*t)/60),r=Math.floor(e-3600*t-60*n);return(t>0?[t,n,r]:[n,r]).map((function(e){return e<10?"0".concat(e):String(e)})).join(":")},getNowTime:x,debounce:function(e,t,n){var r;function o(){for(var o=arguments.length,i=new Array(o),a=0;a2&&void 0!==arguments[2])||arguments[2],r=getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(r):r},loadScript:T,proxyPropertys:D,calculationRate:R});var L=function e(n){t(this,e),function(e,t){var n=e.options,r=n.container.style.cssText;n.container.classList.add("flvplayer-container"),n.container.innerHTML='
'),e.on("destroy",(function(){n.container.innerHTML="",n.container.style.cssText=r,n.container.classList.remove("flvplayer-container")})),Object.defineProperty(t,"$container",{value:n.container}),Object.defineProperty(t,"$player",{value:n.container.querySelector(".flvplayer-player")}),Object.defineProperty(t,"$canvas",{value:n.container.querySelector(".flvplayer-canvas")})}(n,this),function(e,t){Object.defineProperty(t,"rect",{get:function(){return t.$container.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(e){Object.defineProperty(t,e,{get:function(){return t.rect[e]}})})),Object.defineProperty(t,"currentTime",{get:function(){return e.decoder.currentTime},set:function(n){e.options.cache&&e.decoder.seeked(C(n,0,t.loaded))}}),Object.defineProperty(t,"streaming",{get:function(){return e.demuxer.streaming}}),Object.defineProperty(t,"demuxed",{get:function(){return e.demuxer.demuxed}}),Object.defineProperty(t,"videoDecoding",{get:function(){return e.decoder.video.decoding}}),Object.defineProperty(t,"audioDecoding",{get:function(){return e.decoder.audio.decoding}}),Object.defineProperty(t,"duration",{get:function(){try{return e.demuxer.scripMeta.amf2.metaData.duration||e.options.duration}catch(t){return e.options.duration}}}),Object.defineProperty(t,"frameRate",{get:function(){var t=Math.round(e.options.frameRate||30);try{return Math.round(e.demuxer.scripMeta.amf2.metaData.framerate)||t}catch(e){return t}}}),Object.defineProperty(t,"frameDuration",{get:function(){return 1e3/t.frameRate|0}}),Object.defineProperty(t,"muted",{get:function(){return e.decoder.audio.muted},set:function(t){e.decoder.audio.muted=t}}),Object.defineProperty(t,"volume",{get:function(){try{return e.decoder.audio.volume}catch(e){return 0}},set:function(n){try{return e.decoder.audio.volume=C(n,0,1),t.volume}catch(e){return n}}}),Object.defineProperty(t,"loaded",{get:function(){return e.decoder.video.loaded}}),Object.defineProperty(t,"playing",{get:function(){return e.decoder.playing}}),Object.defineProperty(t,"ended",{get:function(){return e.decoder.ended}}),Object.defineProperty(t,"play",{value:function(){t.playing||e.decoder.play()}}),Object.defineProperty(t,"pause",{value:function(){e.decoder.pause()}}),Object.defineProperty(t,"toggle",{value:function(){t.playing?t.pause():t.play()}})}(n,this),function(e,t){var n=e.events.proxy;e.on("scripMeta",(function(e){var n=e.amf2.metaData,r=n.width,o=n.height;r&&o&&(t.$canvas.width=r,t.$canvas.height=o)})),n(t.$canvas,"click",(function(){t.toggle()}))}(n,this)};function M(e,t,n){return Math.max(Math.min(e,Math.max(t,n)),Math.min(t,n))}function _(...e){const t=e[0].constructor;return e.reduce((e,n)=>{const r=new t((0|e.byteLength)+(0|n.byteLength));return r.set(e,0),r.set(n,0|e.byteLength),r},new t)}class B{constructor(e={}){if(this.option=d({...B.option,...e},B.scheme),this.option.volume=M(this.option.volume,0,1),this.option.chunk=M(this.option.chunk,0,1/0),this.option.maxTimeDiff=M(this.option.maxTimeDiff,0,1/0),this.option.autoEndTime=M(this.option.autoEndTime,0,1/0),this.context=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.context.createGain(),this.gainNode.gain.value=this.option.volume,this.source=null,this.decoding=!1,this.playing=!1,this.loadLength=0,this.loadByteSize=0,this.audioDuration=0,this.pcmLength=0,this.timestamps=[],this.audiobuffers=[],this.timestampTmp=[],this.decodeErrorBuffer=new Uint8Array,this.decodeWaitingBuffer=new Uint8Array,this.autoEndDebounce=function(e,t,n){let r;return function(...o){clearTimeout(r),r=setTimeout((function(){r=null,e.apply(n,o)}),t)}}(()=>{this.end()},this.option.autoEndTime),this.option.touchResume&&"suspended"===this.context.state&&"ontouchstart"in window){const e=()=>{this.context.resume(),this.volume=1,document.body.removeEventListener("touchstart",e,!1),document.body.removeEventListener("click",e,!1)};document.body.addEventListener("touchstart",e,!1),document.body.addEventListener("click",e,!1)}}static get option(){return{volume:.7,cache:!0,chunk:65536,maxTimeDiff:200,autoEnd:!0,autoEndTime:5e3,touchResume:!0,onNext:e=>e,onLoad:()=>null,onStop:()=>null,onPlay:()=>null,onEnd:()=>null,onDestroy:()=>null,onDecodeDone:()=>null,onDecodeError:()=>null,onVolumeChange:()=>null,onFreeMemory:()=>null}}static get scheme(){return{volume:"number",cache:"boolean",chunk:"number",maxTimeDiff:"number",autoEnd:"boolean",autoEndTime:"number",touchResume:"boolean",onNext:"function",onLoad:"function",onStop:"function",onPlay:"function",onEnd:"function",onDestroy:"function",onDecodeDone:"function",onDecodeError:"function",onVolumeChange:"function",onFreeMemory:"function"}}get volume(){return this.gainNode.gain.value}set volume(e){this.gainNode.gain.value=M(e,0,1),this.option.onVolumeChange(e)}get duration(){return this.audiobuffers.reduce((e,t)=>e+=t.duration,0)}destroy(){return this.stop(),this.context=null,this.gainNode=null,this.source=null,this.timestamps=[],this.audiobuffers=[],this.timestampTmp=[],this.decodeErrorBuffer=new Uint8Array,this.decodeWaitingBuffer=new Uint8Array,this.option.onDestroy(),this}load(e,t){if(this.decoding=!0,this.loadLength+=1,this.loadByteSize+=e.byteLength,this.option.onLoad(e,t),this.decodeWaitingBuffer.byteLength>=this.option.chunk){this.timestamps.push(this.timestampTmp[0]),this.timestampTmp=[];const{buffer:e}=_(this.decodeErrorBuffer,this.decodeWaitingBuffer);this.decodeWaitingBuffer=new Uint8Array,this.context.decodeAudioData(e,e=>{this.audioDuration+=e.duration,this.pcmLength+=e.length,this.audiobuffers.push(e),this.decodeErrorBuffer=new Uint8Array,this.option.onDecodeDone(e)},e=>{this.decodeErrorBuffer=_(this.decodeErrorBuffer,this.decodeWaitingBuffer),this.option.onDecodeError(e)})}else this.timestampTmp.push(t),this.decodeWaitingBuffer=_(this.decodeWaitingBuffer,e);return this.option.autoEnd&&this.autoEndDebounce(),this}end(){if(this.decodeWaitingBuffer.length){this.timestamps.push(this.timestampTmp[0]),this.timestampTmp=[];const{buffer:e}=this.decodeWaitingBuffer;this.decodeWaitingBuffer=new Uint8Array,this.decodeErrorBuffer=new Uint8Array,this.context.decodeAudioData(e,e=>{this.audioDuration+=e.duration,this.pcmLength+=e.length,this.audiobuffers.push(e),this.decoding=!1,this.option.onEnd()})}return this}findIndex(e){return this.timestamps.findIndex((t,n)=>{const r=this.audiobuffers[n];return r&&t+1e3*r.duration>=e})}play(e=0){this.source&&(this.source.onended=null,this.source.stop(),this.source=null),e+=1,this.playing=!0;const t=this.findIndex(e),n=this.timestamps[t],r=this.audiobuffers[t];if(void 0===n||void 0===r)return this.stop(t,n);const o=Math.max(0,(e-n)/1e3);return this.source=this.context.createBufferSource(),this.source.connect(this.gainNode),this.gainNode.connect(this.context.destination),this.source.buffer=r,this.option.onPlay(r,e,o),this.source.start(0,o),this.source.onended=()=>{const e=this.timestamps[t+1],r=this.audiobuffers[t+1];if(void 0!==e&&void 0!==r){const t=this.option.onNext(e),n=this.findIndex(t);!this.option.cache&&n>0&&(this.option.onFreeMemory({total:this.pcmLength,pcm:this.audiobuffers.reduce((e,t)=>e+=t.length,0),index:n}),this.audiobuffers.splice(0,n),this.timestamps.splice(0,n)),this.play(t)}else this.stop(t,n)},this}stop(e,t){return this.playing=!1,this.source&&(this.source.onended=null,this.source.stop(),this.source=null),this.option.onStop(e,t),this}}var F=function(){function e(n,r){var o=this;t(this,e),this.flv=n,this.dida=new B({volume:n.options.muted?0:n.options.volume,cache:n.options.cache,chunk:n.options.audioChunk,maxTimeDiff:n.options.maxTimeDiff,touchResume:n.options.touchResume,onNext:function(e){var t=e-1e3*r.currentTime;return n.debug.log("time-diff",t),Math.abs(t)>=n.options.maxTimeDiff&&(n.debug.log("time-sync",t),r.currentTime=e/1e3),e},onVolumeChange:function(e){n.emit("volumechange",e)},onFreeMemory:function(e){n.debug.log("free-audio-memory",e),n.emit("freeAudioMemory",e)}}),n.on("audioData",(function(e,t){o.dida.load(e,t)})),n.on("destroy",(function(){o.dida.destroy()}))}return r(e,[{key:"play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.dida.play(1e3*e)}},{key:"stop",value:function(){this.dida.stop()}},{key:"muted",get:function(){return 0===this.volume},set:function(e){this.volume=e?0:.7}},{key:"volume",get:function(){return this.dida.volume},set:function(e){this.dida.volume=e}},{key:"decoding",get:function(){return this.dida.decoding}},{key:"playing",get:function(){return this.dida.playing}}]),e}(),V=function(){function e(n){var r=this;t(this,e),this.flv=n,this.ended=!1,this.playing=!1,this.waiting=!1,this.animationFrameTimer=null,this.waitingTimer=null,this.currentTime=0,this.lastUpdateTime=0,this.video=new window.FlvplayerDecoder(n,this),n.options.hasAudio?this.audio=new F(n,this):this.audio={play:function(){return null},stop:function(){return null},playing:!0,decoding:!1},n.on("ready",(function(){n.options.autoPlay?r.play():r.video.draw(0)})),n.on("destroy",(function(){r.pause()})),n.on("timeupdate",(function(e){!n.options.live&&e>=n.player.duration&&r.pause()}));var o=!1;n.events.proxy(document,"visibilitychange",(function(){document.hidden?(o=r.playing,r.pause()):o&&r.play()}))}return r(e,[{key:"play",value:function(){this.lastUpdateTime=x(),this.video.play(this.currentTime),this.audio.play(this.currentTime),this.animationFrame(),this.flv.emit("play")}},{key:"animationFrame",value:function(){var e=this,t=this.flv,n=t.options,r=t.player,o=t.debug;this.animationFrameTimer=requestAnimationFrame((function(){if(!e.video.playing||!e.audio.playing)return r.streaming||e.video.decoding||e.audio.decoding?(e.ended=!1,e.playing=!0,e.waiting=!0,e.flv.emit("waiting",e.currentTime),void(e.waitingTimer=setTimeout((function(){o.log("play-retry",{streaming:r.streaming,playing:{video:e.video.playing,audio:e.audio.playing},decoding:{video:e.video.decoding,audio:e.audio.decoding}}),e.play()}),n.live?3e3:1e3))):(e.ended=!0,e.playing=!1,e.waiting=!1,e.pause(),e.flv.emit("ended",e.currentTime),void(n.loop&&n.cache&&!n.live&&(e.currentTime=0,e.play(),e.flv.emit("loop"))));e.ended=!1,e.playing=!0,e.waiting=!1;var t=x();e.currentTime+=(t-e.lastUpdateTime)/1e3,e.lastUpdateTime=t,e.flv.emit("timeupdate",e.currentTime),e.animationFrame()}))}},{key:"pause",value:function(){cancelAnimationFrame(this.animationFrameTimer),clearTimeout(this.waitingTimer),this.animationFrameTimer=null,this.waitingTimer=null,this.video.stop(),this.audio.stop(),this.ended=!1,this.playing=!1,this.waiting=!1,this.flv.emit("pause")}},{key:"seeked",value:function(e){var t=this.flv,n=t.player,r=t.options;r.cache&&!r.live&&(cancelAnimationFrame(this.animationFrameTimer),clearTimeout(this.waitingTimer),this.animationFrameTimer=null,this.waitingTimer=null,this.currentTime=e,this.video.draw(Math.floor(e*n.frameRate)),this.playing&&this.play(),this.flv.emit("seeked",e))}}]),e}();var U=function e(n){var r=this;t(this,e);var o=n.options,i=n.debug;this.header=null,this.streaming=!1,this.demuxed=!1,this.videoDataSize=0,this.audioDataSize=0,this.videoDataLength=0,this.audioDataLength=0,this.streamStartTime=0,this.streamEndTime=0,this.scripMeta=null,this.AudioSpecificConfig=null,this.AVCDecoderConfigurationRecord=null,this.demuxWorker=new Worker(URL.createObjectURL(new Blob(['"use strict";function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b=a}function read(a){for(var b=new Uint8Array(a),c=0;c>4,codecID:15&a.body[0]};debug.error(7===b.codecID,"[videoTrack] Unsupported codec in video frame: ".concat(b.codecID));var c=a.body.slice(1,5);debug.error(4<=c.length,"[H264] Invalid AVC packet, missing AVCPacketType or/and CompositionTime");var d=new DataView(c.buffer),e=d.getUint8(0),f=(16777215&d.getUint32(0))<<8>>8,g=f+a.timestamp,h=a.body.subarray(5);if(0===e){debug.warn(!AVCDecoderConfigurationRecord,"[h264] Find another one AVCDecoderConfigurationRecord"),debug.error(7<=h.length,"[H264] AVCDecoderConfigurationRecord parse length is not enough");var j=readBuffer(h),k={};k.configurationVersion=j(1)[0],debug.error(1===k.configurationVersion,"[H264] Invalid configurationVersion: ".concat(k.configurationVersion)),k.AVCProfileIndication=j(1)[0],debug.error(0!==k.AVCProfileIndication,"[H264] Invalid AVCProfileIndication: ".concat(k.AVCProfileIndication)),k.profile_compatibility=j(1)[0],k.AVCLevelIndication=j(1)[0],k.lengthSizeMinusOne=(3&j(1)[0])+1,debug.error(4===k.lengthSizeMinusOne||3!==k.lengthSizeMinusOne,"[H264] Invalid lengthSizeMinusOne: ".concat(k.lengthSizeMinusOne)),k.numOfSequenceParameterSets=31&j(1)[0],debug.error(0!==k.numOfSequenceParameterSets,"[H264] Invalid numOfSequenceParameterSets: ".concat(k.numOfSequenceParameterSets)),debug.warn(1===k.numOfSequenceParameterSets,"[H264] Strange numOfSequenceParameterSets: ".concat(k.numOfSequenceParameterSets));for(var p=0;p>4,soundRate:(12&a.body[0])>>2,soundSize:(2&a.body[0])>>1,soundType:(1&a.body[0])>>0};debug.error(10===b.soundFormat,"[audioTrack] unsupported audio format: ".concat(b.soundFormat));var c=a.body.subarray(1),d=c[0];if(0===d){var k=c.subarray(1);debug.warn(!AudioSpecificConfig,"[AAC] Find another one AudioSpecificConfig"),debug.error(2<=k.length,"[AAC] AudioSpecificConfig parse length is not enough");var l={};l.audioObjectType=(248&k[0])>>3,l.samplingFrequencyIndex=((7&k[0])<<1)+(1&(128&k[1])>>7),l.channelConfiguration=(127&k[1])>>3,AudioSpecificConfig=l,postMessage({type:"AudioSpecificConfig",data:l})}else{var e=AudioSpecificConfig,f=e.audioObjectType,g=e.samplingFrequencyIndex,h=e.channelConfiguration,i=a.dataSize-2+7,j=new Uint8Array(7);j[0]=255,j[1]=240,j[1]|=0,j[1]|=0,j[1]|=1,j[2]=f-1<<6,j[2]|=(15&g)<<2,j[2]|=0,j[2]|=(4&h)>>2,j[3]=(3&h)<<6,j[3]|=0,j[3]|=0,j[3]|=0,j[3]|=0,j[3]|=(6144&i)>>11,j[4]=(2040&i)>>3,j[5]=(7&i)<<5,j[5]|=31,j[6]=252;var m=a.body.subarray(2);postMessage({type:"audioData",data:mergeBuffer(j,m),timestamp:a.timestamp})}}onmessage=function onmessage(a){if(uint8=mergeBuffer(uint8,a.data),!header&&readable(13)){header=Object.create(null),header.signature=readString(read(3)),header.version=read(1)[0],debug.error("FLV"===header.signature&&1===header.version,"FLV header not found"),header.flags=read(1)[0];var b=0!=(4&header.flags)>>>2,c=0!=(1&header.flags);debug.warn(c,"[FLV header] flags not found video"),debug.warn(b,"[FLV header] flags not found audio"),header.headersize=readBufferSum(read(4));var j=readBufferSum(read(4));debug.error(0===j,"PrevTagSize0 should be equal to 0, but got ".concat(j)),postMessage({type:"flvHeader",data:header})}for(;indexthis.chunkStart){var t=this.data.subarray(this.chunkStart,e);this.flv.emit("streaming",t),this.chunkStart=e}}},{key:"initFetchStream",value:function(){var e=this,t=this.flv,n=t.options,r=t.debug;return this.flv.emit("streamStart"),fetch(n.url,{credentials:n.withCredentials?"include":"omit",mode:n.cors?"cors":"no-cors",headers:n.headers}).then((function(t){return t.body&&"function"==typeof t.body.getReader?(e.reader=t.body.getReader(),function e(){var t=this;return this.reader.read().then((function(o){var i=o.done,a=o.value;if(i)return t.flv.emit("streamEnd"),r.log("stream-end","".concat(t.byteLength," byte")),null;var u=new Uint8Array(a);return t.byteLength+=u.byteLength,t.streamRate(u.byteLength),n.live?t.flv.emit("streaming",u):(t.data=A(t.data,u),0===t.chunkStart&&t.data.length>=t.chunkSize&&t.readChunk()),e.call(t)})).catch((function(e){throw t.flv.emit("streamError",e),e}))}.call(e)):(r.log("stream-type","Try use response arrayBuffer"),t.arrayBuffer())})).then((function(t){t&&t.byteLength&&!n.live&&(e.data=new Uint8Array(t),e.byteLength+=e.data.byteLength,e.flv.emit("streamEnd",e.data),r.log("stream-end","".concat(e.byteLength," byte")))})).catch((function(t){throw e.flv.emit("streamError",t),t}))}},{key:"initFetchRange",value:function(e,t){var n=this,r=this.flv.options;return fetch(r.url,{credentials:r.withCredentials?"include":"omit",mode:r.cors?"cors":"no-cors",headers:z({},r.headers,{range:"bytes=".concat(e,"-").concat(t)})}).then((function(e){return e.arrayBuffer()})).then((function(e){var o=new Uint8Array(e);n.byteLength+=o.byteLength,n.streamRate(o.byteLength),r.live?n.flv.emit("streaming",o):(n.data=A(n.data,o),0===n.chunkStart&&n.data.length>=n.chunkSize&&n.readChunk());var i=Math.min(n.contentLength,t+1),a=Math.min(n.contentLength,i+n.chunkSize);a>i&&n.initFetchRange(i,a)})).catch((function(e){throw n.flv.emit("streamError",e),e}))}}]),e}(),q=function e(n){var r=this;t(this,e);var o=n.debug,i=n.options,a=n.events.proxy;this.byteLength=0,this.streamRate=R((function(e){n.emit("streamRate",e)})),this.socket=new WebSocket(n.options.url),this.socket.binaryType="arraybuffer",n.emit("streamStart"),a(this.socket,"open",(function(){r.socket.send(i.socketSend)})),a(this.socket,"message",(function(e){var t=new Uint8Array(e.data);r.byteLength+=t.byteLength,r.streamRate(t.byteLength),n.emit("streaming",t)})),a(this.socket,"close",(function(){n.emit("streamEnd"),o.log("stream-end","".concat(r.byteLength," byte"))})),a(this.socket,"error",(function(e){throw n.emit("streamError",e),e})),n.on("destroy",(function(){r.socket.close()}))},N=function e(n){t(this,e);var r=new FileReader,o=n.events.proxy;o(r,"load",(function(e){var t=new Uint8Array(e.target.result);n.emit("streamEnd",t),n.debug.log("stream-end","".concat(t.byteLength," byte"))})),o(r,"error",(function(e){n.emit("streamError",e)})),n.on("destroy",(function(){r.abort()})),n.emit("streamStart"),r.readAsArrayBuffer(n.options.url)},H=function(){function e(n){t(this,e);var r=e.getLoaderFactory(n.options.url);return n.debug.log("stream-loader",r.name),new r(n,this)}return r(e,null,[{key:"getLoaderFactory",value:function(e){return e instanceof File?N:/^ws{1,2}:\/\//i.test(e)?q:W}}]),e}();function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function G(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var J=0,K=function(n){a(u,n);var o,i=(o=u,function(){var e,t=f(o);if(G()){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return s(this,e)});function u(n){var r;return t(this,u),(r=i.call(this)).options=d(function(t){for(var n=1;n