!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).EZUIKit=t()}(this,(function(){"use strict";function e(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function t(t){for(var i=1;ie.length)&&(t=e.length);for(var i=0,n=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,s=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return o=e.done,e},e:function(e){s=!0,r=e},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw r}}}}var f=function(){function e(t,i){r(this,e),this.coreX=t,this.coreY=i}return s(e,[{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}}]),e}();Date.prototype.Format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var i in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),t)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[i]:("00"+t[i]).substr((""+t[i]).length)));return e};var x=function(e,t,i,n){var a=document.getElementsByTagName("head")[0].getElementsByTagName("script"),r=!1;if(i)r=i();else for(var o=0;o3){var i=t[1],n=t[2],a="1"===t[3],r="live";return e.indexOf("rec=local")>-1?r="rec":e.indexOf("rec=cloud")>-1&&(r="cloud.rec"),{deviceSerial:i,channelNo:n,hd:a,type:r}}return{}};var C=function(e,t,i,n,r,o){var s=e,l=new XMLHttpRequest;l.onreadystatechange=function(){if(4==l.readyState&&200==l.status)if(function(e){if("string"==typeof e)try{var t=JSON.parse(e);return!("object"!==a(t)||!t)}catch(e){return!1}console.log("It is not a string!")}(l.responseText)){var e=JSON.parse(l.responseText);r(e)}else r(l.responseText)},l.open(t,s,!0);var c=new FormData;for(var d in i)c.append(d,i[d]);if(n&&"object"===a(n))for(var d in n)l.setRequestHeader(d,n[d]);l.send(c)},T=function(){return!!window&&navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i)},R=function(){function e(t,i){var n=this;r(this,e),x("https://open.ys7.com/assets/ezuikit_v3.4/js/hls.js",(function(){console.log("加载hls.min.js成功",window.Hls),console.log("isSupportHls",window.Hls.isSupported()),window.Hls.isSupported()&&n.initHLS(t,i)}),(function(){return!!window.Hls}))}return s(e,[{key:"toString",value:function(){return"hls ".concat(this.coreX,"-").concat(this.coreY)}},{key:"initHLS",value:function(e,t){var i=E(t),n=i.deviceSerial,a=i.channelNo;i.hd,window.ezuikitMonitor.report({protocol:"hls",url:t,serial:n,no:a,action:1});var r=document.getElementById(e),o=new window.Hls({defaultAudioCodec:"mp4a.40.2"});o.loadSource(t),o.attachMedia(r),o.on(window.Hls.Events.MANIFEST_PARSED,(function(){r.play()})),o.on(window.Hls.Events.ERROR,(function(e,t){if(t.fatal)switch(t.type){case window.Hls.ErrorTypes.NETWORK_ERROR:console.log("fatal network error encountered, try to recover"),o.startLoad();break;case window.Hls.ErrorTypes.MEDIA_ERROR:console.log("fatal media error encountered, try to recover"),o.recoverMediaError();break;default:o.destroy()}})),this.hls=o,this.video=r,this.hlsUrl=t}},{key:"play",value:function(){console.log("执行hls播放",this.video),this.hls.startLoad(),this.video.play()}},{key:"stop",value:function(){this.video.pause(),this.hls.stopLoad()}}]),e}(),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function I(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(e,t){!function(t,i){e.exports=i()}(self,(()=>(()=>{var e={99:e=>{var t,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function r(){r.init.call(this)}e.exports=r,e.exports.once=function(e,t){return new Promise((function(i,n){function a(i){e.removeListener(t,r),n(i)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",a),i([].slice.call(arguments))}p(e,t,r,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&p(e,"error",t,{once:!0})}(e,a)}))},r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function c(e,t,i,n){var a,r,o,c;if(s(i),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),r=e._events),o=r[t]),void 0===o)o=r[t]=i,++e._eventsCount;else if("function"==typeof o?o=r[t]=n?[i,o]:[o,i]:n?o.unshift(i):o.push(i),(a=l(e))>0&&o.length>a&&!o.warned){o.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=o.length,c=d,console&&console.warn&&console.warn(c)}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 u(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},a=d.bind(n);return a.listener=i,n.wrapFn=a,a}function h(e,t,i){var n=e._events;if(void 0===n)return[];var a=n[t];return void 0===a?[]:"function"==typeof a?i?[a.listener||a]:[a]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=r[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,d=x(l,c);for(i=0;i=0;r--)if(i[r]===t||i[r].listener===t){o=i[r].listener,a=r;break}if(a<0)return this;0===a?i.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},r.prototype.listeners=function(e){return h(this,e,!0)},r.prototype.rawListeners=function(e){return h(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},r.prototype.listenerCount=f,r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},994:(e,t,i)=>{i.d(t,{Z:()=>n});const n=class{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){const e=!this.hasAudio||this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!this.hasVideo||this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t}isSeekable(){return this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;const t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}_search(e,t){let i=0;const n=e.length-1;let a=0,r=0,o=n;for(t=e[a]&&t{i.d(t,{J1:()=>o,Vn:()=>r,Wk:()=>n,Yy:()=>a});class n{constructor(e,t,i,n,a){this.dts=e,this.pts=t,this.duration=i,this.originalDts=n,this.isSyncPoint=a,this.fileposition=null}}class a{constructor(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}appendSyncPoint(e){e.isSyncPoint=!0,this.syncPoints.push(e)}}class r{constructor(){this._list=[]}clear(){this._list=[]}appendArray(e){const t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts=t[a].dts&&e((null===(t=i[a].lastSample)||void 0===t?void 0:t.originalDts)||0)&&e=((null===(i=null===(t=n[r])||void 0===t?void 0:t.lastSample)||void 0===i?void 0:i.originalDts)||0)&&(r===n.length-1||r0&&(o=this._searchNearestSegmentBefore(a.originalBeginDts)+1),this._lastAppendLocation=o,this._list.splice(o,0,a)}getLastSegmentBefore(e){const t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null}getLastSampleBefore(e){const t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null}getLastSyncPointBefore(e){let t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;for(;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null}}},943:(e,t,i)=>{i.d(t,{Z:()=>ke});var n=i(99),a=i(645),r=i(479),o=i(994);function s(e,t,i){const n=e;if(t+i=128){t.push(String.fromCharCode(65535&e)),n+=2;continue}}}else if(i[n]<240){if(s(i,n,2)){const e=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),n+=3;continue}}}else if(i[n]<248&&s(i,n,3)){let e=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),n+=4;continue}}t.push(String.fromCharCode(65533)),++n}return t.join("")};var c=i(411);const d=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class u{static parseScriptData(e,t,i){const n={};try{const a=u.parseValue(e,t,i),r=u.parseValue(e,t+a.size,i-a.size);n[a.data]=r.data}catch(e){a.Z.e("AMF",e.toString())}return n}static parseObject(e,t,i){if(i<3)throw new c.rT("Data not enough when parse ScriptDataObject");const n=u.parseString(e,t,i),a=u.parseValue(e,t+n.size,i-n.size),r=a.objectEnd;return{data:{name:n.data,value:a.data},size:n.size+a.size,objectEnd:r}}static parseVariable(e,t,i){return u.parseObject(e,t,i)}static parseString(e,t,i){if(i<2)throw new c.rT("Data not enough when parse String");const n=new DataView(e,t,i).getUint16(0,!d);let a;return a=n>0?l(new Uint8Array(e,t+2,n)):"",{data:a,size:2+n}}static parseLongString(e,t,i){if(i<4)throw new c.rT("Data not enough when parse LongString");const n=new DataView(e,t,i).getUint32(0,!d);let a;return a=n>0?l(new Uint8Array(e,t+4,n)):"",{data:a,size:4+n}}static parseDate(e,t,i){if(i<10)throw new c.rT("Data size invalid when parse Date");const n=new DataView(e,t,i);let a=n.getFloat64(0,!d);return a+=60*n.getInt16(8,!d)*1e3,{data:new Date(a),size:10}}static parseValue(e,t,i){if(i<1)throw new c.rT("Data not enough when parse Value");const n=new DataView(e,t,i);let r=1;const o=n.getUint8(0);let s,l=!1;try{switch(o){case 0:s=n.getFloat64(1,!d),r+=8;break;case 1:s=!!n.getUint8(1),r+=1;break;case 2:{const n=u.parseString(e,t+1,i-1);s=n.data,r+=n.size;break}case 3:{s={};let a=0;for(9==(16777215&n.getUint32(i-4,!d))&&(a=3);r32)throw new c.OC("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){const t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;const i=e-this._current_word_bits_left;this._fillCurrentWord();const n=Math.min(i,this._current_word_bits_left),a=this._current_word>>>32-n;return this._current_word<<=n,this._current_word_bits_left-=n,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){const e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){const e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}};class x{static _ebsp2rbsp(e){const t=e,i=t.byteLength,n=new Uint8Array(i);let a=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(n[a]=t[e],a++);return new Uint8Array(n.buffer,0,a)}static parseSPS(e){const t=e.subarray(1,4);let i="avc1.";for(let e=0;e<3;e++){let n=t[e].toString(16);n.length<2&&(n="0"+n),i+=n}const n=x._ebsp2rbsp(e);let a=new f(n);a.readByte();const r=a.readByte();a.readByte();const o=a.readByte();a.readUEG();const s=x.getProfileString(r),l=x.getLevelString(o);let c=1,d=420;let u=8,h=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(c=a.readUEG(),3===c&&a.readBits(1),c<=3&&(d=[0,420,422,444][c]),u=a.readUEG()+8,h=a.readUEG()+8,a.readBits(1),a.readBool())){const e=3!==c?8:12;for(let t=0;t0&&e<16?(E=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],C=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(E=a.readByte()<<8|a.readByte(),C=a.readByte()<<8|a.readByte())}if(a.readBool()&&a.readBool(),a.readBool()&&(a.readBits(4),a.readBool()&&a.readBits(24)),a.readBool()&&(a.readUEG(),a.readUEG()),a.readBool()){const e=a.readBits(32),t=a.readBits(32);R=a.readBool(),w=t,I=2*e,T=w/I}}let D=1;1===E&&1===C||(D=E/C);let k=0,F=0;0===c?(k=1,F=2-v):(k=3===c?1:2,F=(1===c?2:1)*(2-v));let A=16*(_+1),M=16*(g+1)*(2-v);A-=(y+S)*k,M-=(b+P)*F;const L=Math.ceil(A*D);return a.destroy(),a=null,{codec_mimetype:i,profile_idc:r,level_idc:o,profile_string:s,level_string:l,chroma_format_idc:c,bit_depth:u,bit_depth_luma:u,bit_depth_chroma:h,ref_frames:m,chroma_format:d,chroma_format_string:x.getChromaFormatString(d),frame_rate:{fixed:R,fps:T,fps_den:I,fps_num:w},sar_ratio:{width:E,height:C},codec_size:{width:A,height:M},present_size:{width:L,height:M}}}static _skipScalingList(e,t){let i=8,n=8,a=0;for(let r=0;r=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(n[a]=t[e],a++);return new Uint8Array(n.buffer,0,a)}static parseVPS(e){const t=_._ebsp2rbsp(e),i=new f(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){const t=_._ebsp2rbsp(e);let i=new f(t);i.readByte(),i.readByte();let n=0,a=0,r=0,o=0;i.readBits(4);const s=i.readBits(3),l=(i.readBool(),i.readBits(2)),c=i.readBool(),d=i.readBits(5),u=i.readByte(),h=i.readByte(),x=i.readByte(),p=i.readByte(),m=i.readByte(),g=i.readByte(),v=i.readByte(),y=i.readByte(),S=i.readByte(),b=i.readByte(),P=i.readByte(),E=[],C=[];for(let e=0;e0)for(let e=s;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(B=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(B=i.readBits(16),O=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),M=i.readBool(),M&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()&&(N=i.readBits(32),U=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool())){let e=!1,t=!1,n=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(n=i.readBool(),n&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),n&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let a=0;a<=s;a++){const a=i.readBool();j=a;let r=!1,o=1;a||(r=i.readBool());let s=!1;if(r?i.readSEG():s=i.readBool(),s||(o=i.readUEG()+1),e)for(let e=0;e>3,a=0!=(4&e[i]),r=0!=(2&e[i]);e[i],i+=1,a&&(i+=1);let o=Number.POSITIVE_INFINITY;if(r){o=0;for(let t=0;o|=(127&e[i])<<7*t,i+=1,0!=(128&e[i]);t++);}1===n&&(t=P.parseSeuqneceHeader(e.subarray(i,i+o))),i+=o}return t}static parseSeuqneceHeader(e){let t=new f(e);const i=t.readBits(3),n=(t.readBool(),t.readBool());let a=!0,r=0,o=0;const s=[];if(n)s.push({operating_point_idc:0,level:t.readBits(5),tier:0});else{if(t.readBool()){const e=t.readBits(32),i=t.readBits(32),n=t.readBool();if(n){let e=0;for(;0===t.readBits(1);)e+=1;e>=32||t.readBits(e)}o=e,r=i,a=n,t.readBool()&&(t.readBits(5),t.readBits(32),t.readBits(5),t.readBits(5))}const e=t.readBool(),i=t.readBits(5);for(let n=0;n<=i;n++){const i=t.readBits(12),n=t.readBits(5),a=n>7?t.readBits(1):0;s.push({operating_point_idc:i,level:n,tier:a}),e&&t.readBool()&&t.readBits(4)}}const{level:l,tier:c}=s[0],d=t.readBits(4),u=t.readBits(4),h=t.readBits(d+1)+1,x=t.readBits(u+1)+1;let p=!1;n||(p=t.readBool()),p&&(t.readBits(4),t.readBits(4)),t.readBool(),t.readBool(),t.readBool();let m=!1,_=2;n||(t.readBool(),t.readBool(),t.readBool(),t.readBool(),m=t.readBool(),m&&(t.readBool(),t.readBool()),_=t.readBool()?2:t.readBits(1),_&&(t.readBool()||t.readBits(1)),m&&t.readBits(3)),t.readBool(),t.readBool(),t.readBool();const g=t.readBool();let v=8;v=2===i&&g?t.readBool()?12:10:g?10:8;let y=!1;1!==i&&(y=t.readBool()),t.readBool()&&(t.readBits(8),t.readBits(8),t.readBits(8));let S=1,b=1;return y?(t.readBits(1),S=1,b=1):(t.readBits(1),0===i?(S=1,b=1):1===i?(S=0,b=0):12===v?t.readBits(1)&&t.readBits(1):(S=1,b=0),S&&b&&t.readBits(2),t.readBits(1)),t.readBool(),t.destroy(),t=null,{codec_mimetype:`av01.${i}.${P.getLevelString(l,c)}.${v.toString(10).padStart(2,"0")}`,level:l,tier:c,level_string:P.getLevelString(l,c),profile_idc:i,profile_string:`${i}`,bit_depth:v,ref_frames:1,chroma_format:P.getChromaFormat(y,S,b),chroma_format_string:P.getChromaFormatString(y,S,b),frame_rate:{fixed:a,fps:r/o,fps_den:o,fps_num:r},sar_ratio:{width:1,height:1},codec_size:{width:h,height:x},present_size:{width:1*h,height:x}}}static getLevelString(e,t){return`${e.toString(10).padStart(2,"0")}${0===t?"M":"H"}`}static getChromaFormat(e,t,i){return e?0:0===t&&0===i?3:1===t&&0===i?2:1===t&&1===i?1:Number.NaN}static getChromaFormatString(e,t,i){return e?"4:0:0":0===t&&0===i?"4:4:4":1===t&&0===i?"4:2:2":1===t&&1===i?"4:2:0":"Unknown"}}const E=P;class C{constructor(e,t){this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new o.Z,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}destroy(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}static probe(e){const t=new Uint8Array(e);if(t.byteLength<9)return{needMoreData:!0};const i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;const n=(4&t[4])>>>2!=0,a=0!=(1&t[4]),r=(o=t)[5]<<24|o[6]<<16|o[7]<<8|o[8];var o;return r<9?i:{match:!0,consumed:r,dataOffset:r,hasAudioTrack:n,hasVideoTrack:a}}bindDataSource(e){return e.onDataArrival=this.parseChunks.bind(this),this}get onTrackMetadata(){return this._onTrackMetadata}set onTrackMetadata(e){this._onTrackMetadata=e}get onMediaInfo(){return this._onMediaInfo}set onMediaInfo(e){this._onMediaInfo=e}get onMetaDataArrived(){return this._onMetaDataArrived}set onMetaDataArrived(e){this._onMetaDataArrived=e}get onScriptDataArrived(){return this._onScriptDataArrived}set onScriptDataArrived(e){this._onScriptDataArrived=e}get onError(){return this._onError}set onError(e){this._onError=e}get onDataAvailable(){return this._onDataAvailable}set onDataAvailable(e){this._onDataAvailable=e}get timestampBase(){return this._timestampBase}set timestampBase(e){this._timestampBase=e}get overridedDuration(){return this._duration}set overridedDuration(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo&&(this._mediaInfo.duration=e)}set overridedHasAudio(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo&&(this._mediaInfo.hasAudio=e)}set overridedHasVideo(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo&&(this._mediaInfo.hasVideo=e)}resetMediaInfo(){this._mediaInfo=new o.Z}_isInitialMetadataDispatched(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched}parseChunks(e,t){var i,n;if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new c.rT("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let r=0;const o=this._littleEndian;if(0===t){if(!(e.byteLength>13))return 0;{const t=C.probe(e);r=(null==t?void 0:t.dataOffset)||0}}for(this._firstParse&&(this._firstParse=!1,t+r!==this._dataOffset&&a.Z.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(e,r).getUint32(0,!o)&&a.Z.w(this.TAG,"PrevTagSize0 !== 0 !!!"),r+=4);re.byteLength)break;const n=i.getUint8(0),s=16777215&i.getUint32(0,!o);if(r+11+s+4>e.byteLength)break;if(8!==n&&9!==n&&18!==n){a.Z.w(this.TAG,`Unsupported tag type ${n}, skipped`),r+=11+s+4;continue}const l=i.getUint8(4),c=i.getUint8(5),d=i.getUint8(6)|c<<8|l<<16|i.getUint8(7)<<24;0!=(16777215&i.getUint32(7,!o))&&a.Z.w(this.TAG,"Meet tag which has StreamID != 0!");const u=r+11;switch(n){case 8:this._parseAudioData(e,u,s,d);break;case 9:this._parseVideoData(e,u,s,d,t+r);break;case 18:this._parseScriptData(e,u,s)}const h=i.getUint32(11+s,!o);h!==11+s&&a.Z.w(this.TAG,`Invalid PrevTagSize ${h}`),r+=11+s+4}return this._isInitialMetadataDispatched()&&this._dispatch&&((null===(i=this._audioTrack)||void 0===i?void 0:i.length)||(null===(n=this._videoTrack)||void 0===n?void 0:n.length))&&this._onDataAvailable(this._audioTrack,this._videoTrack),r}_parseScriptData(e,t,i){var n,r,o;const s=h.parseScriptData(e,t,i);if(s.hasOwnProperty("onMetaData")){if(null==s.onMetaData||"object"!=typeof s.onMetaData)return void a.Z.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&a.Z.w(this.TAG,"Found another onMetaData tag!"),this._metadata=s;const e=null===(n=this._metadata)||void 0===n?void 0:n.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},e)),"boolean"==typeof(null==e?void 0:e.hasAudio)&&(this._hasAudioFlagOverrided||(this._hasAudio=e.hasAudio,this._mediaInfo&&(this._mediaInfo.hasAudio=this._hasAudio))),"boolean"==typeof(null==e?void 0:e.hasVideo)&&(this._hasVideoFlagOverrided||(this._hasVideo=e.hasVideo,this._mediaInfo&&(this._mediaInfo.hasVideo=this._hasVideo))),"number"==typeof(null==e?void 0:e.audiodatarate)&&this._mediaInfo&&(this._mediaInfo.audioDataRate=e.audiodatarate),"number"==typeof(null==e?void 0:e.videodatarate)&&this._mediaInfo&&(this._mediaInfo.videoDataRate=e.videodatarate),"number"==typeof(null==e?void 0:e.width)&&this._mediaInfo&&(this._mediaInfo.width=e.width),"number"==typeof(null==e?void 0:e.height)&&this._mediaInfo&&(this._mediaInfo.height=e.height),"number"==typeof(null==e?void 0:e.duration)){if(!this._durationOverrided){const t=Math.floor(e.duration*this._timescale);this._duration=t,this._mediaInfo&&(this._mediaInfo.duration=t)}}else this._mediaInfo&&(this._mediaInfo.duration=0);if("number"==typeof(null==e?void 0:e.framerate)){const t=Math.floor(1e3*e.framerate);if(t>0){const e=t/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=e,this._referenceFrameRate.fps_num=t,this._referenceFrameRate.fps_den=1e3,this._mediaInfo&&(this._mediaInfo.fps=e)}}if("object"==typeof(null==e?void 0:e.keyframes)){this._mediaInfo&&(this._mediaInfo.hasKeyframesIndex=!0);const t=e.keyframes;this._mediaInfo&&(this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(t)),e.keyframes=null}else this._mediaInfo&&(this._mediaInfo.hasKeyframesIndex=!1);this._dispatch=!1,this._mediaInfo&&(this._mediaInfo.metadata=e),a.Z.v(this.TAG,"Parsed onMetaData"),(null===(r=this._mediaInfo)||void 0===r?void 0:r.isComplete())&&(null===(o=this._onMediaInfo)||void 0===o||o.call(this,this._mediaInfo))}Object.keys(s).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},s))}_parseKeyframesIndex(e){const t=[],i=[];for(let n=1;n>>4;if(2!==_&&10!==_)return void(null===(r=this._onError)||void 0===r||r.call(this,m.Z.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+_));let g=0;const v=(12&p)>>>2;if(!(v>=0&&v<=4))return void(null===(o=this._onError)||void 0===o||o.call(this,m.Z.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+v));g=this._flvSoundRateTable[v];const y=1&p;let S=this._audioMetadata;const P=this._audioTrack;if(S||(!1!==this._hasAudio||this._hasAudioFlagOverrided||(this._hasAudio=!0,this._mediaInfo&&(this._mediaInfo.hasAudio=!0)),S=this._audioMetadata={},S.type="audio",S.id=null==P?void 0:P.id,S.timescale=this._timescale,S.duration=this._duration,S.audioSampleRate=g,S.channelCount=0===y?1:2),10===_){const r=this._parseAACAudioData(e,t+1,i-1);if(void 0===r)return;if(0===(null==r?void 0:r.packetType)){if(null==S?void 0:S.config){if(b(r.data.config,null==S?void 0:S.config))return;a.Z.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}const e=r.data;S.audioSampleRate=null==e?void 0:e.samplingRate,S.channelCount=null==e?void 0:e.channelCount,S.codec=null==e?void 0:e.codec,S.originalCodec=null==e?void 0:e.originalCodec,S.config=null==e?void 0:e.config,S.refSampleDuration=1024/S.audioSampleRate*S.timescale,a.Z.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&((null===(s=this._audioTrack)||void 0===s?void 0:s.length)||(null===(l=this._videoTrack)||void 0===l?void 0:l.length))&&(null===(c=this._onDataAvailable)||void 0===c||c.call(this,this._audioTrack,this._videoTrack)):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,null===(d=this._onTrackMetadata)||void 0===d||d.call(this,"audio",S);const t=this._mediaInfo;t.audioCodec=S.originalCodec||"",t.audioSampleRate=S.audioSampleRate,t.audioChannelCount=S.channelCount,t.hasVideo?null!=t.videoCodec&&(t.mimeType='video/x-flv; codecs="'+t.videoCodec+","+t.audioCodec+'"'):t.mimeType='video/x-flv; codecs="'+t.audioCodec+'"',(null==t?void 0:t.isComplete())&&(null===(u=this._onMediaInfo)||void 0===u||u.call(this,t))}else if(1===r.packetType){const e=this._timestampBase+n,t={unit:r.data,length:r.data.byteLength,dts:e,pts:e};P&&(null==P||P.samples.push(t),P.length+=(null===(h=null==r?void 0:r.data)||void 0===h?void 0:h.length)||0)}else a.Z.e(this.TAG,`Flv: Unsupported AAC data type ${r.packetType}`)}else if(2===_){if(!S.codec){const n=this._parseMP3AudioData(e,t+1,i-1,!0);if(void 0===n)return;S.audioSampleRate=n.samplingRate,S.channelCount=n.channelCount,S.codec=n.codec,S.originalCodec=n.originalCodec,S.refSampleDuration=1152/S.audioSampleRate*S.timescale,a.Z.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,null===(f=this._onTrackMetadata)||void 0===f||f.call(this,"audio",S);const r=this._mediaInfo;r.audioCodec=S.codec,r.audioSampleRate=S.audioSampleRate,r.audioChannelCount=S.channelCount,r.audioDataRate=n.bitRate,(null==r?void 0:r.hasVideo)?null!=r.videoCodec&&(r.mimeType='video/x-flv; codecs="'+r.videoCodec+","+r.audioCodec+'"'):r.mimeType='video/x-flv; codecs="'+r.audioCodec+'"',r.isComplete()&&(null===(x=this._onMediaInfo)||void 0===x||x.call(this,r))}const r=this._parseMP3AudioData(e,t+1,i-1,!1);if(void 0===r)return;const o=this._timestampBase+n,s={unit:r,length:r.byteLength,dts:o,pts:o};null==P||P.samples.push(s),P&&(P.length+=r.length)}}_parseAACAudioData(e,t,i){if(i<=1)return void a.Z.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");const n={},r=new Uint8Array(e,t,i);return n.packetType=r[0],0===r[0]?n.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):n.data=r.subarray(1),n}_parseAACAudioSpecificConfig(e,t,i){var n,a;const r=new Uint8Array(e,t,i);let o=null,s=0,l=0,c=0,d=null;if(s=l=r[0]>>>3,c=(7&r[0])<<1|r[1]>>>7,c<0||c>=this._mpegSamplingRates.length)return void(null===(n=this._onError)||void 0===n||n.call(this,m.Z.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!"));const u=this._mpegSamplingRates[c],h=(120&r[1])>>>3;if(h<0||h>=8)return void(null===(a=this._onError)||void 0===a||a.call(this,m.Z.FORMAT_ERROR,"Flv: AAC invalid channel configuration"));5===s&&(d=(7&r[1])<<1|r[2]>>>7,r[2]);const f=self.navigator.userAgent.toLowerCase();return f.includes("firefox")?c>=6?(s=5,o=new Array(4),d=c-3):(s=2,o=new Array(2),d=c):f.includes("android")?(s=2,o=new Array(2),d=c):(s=5,d=c,o=new Array(4),c>=6?d=c-3:1===h&&(s=2,o=new Array(2),d=c)),o[0]=s<<3,o[0]|=(15&c)>>>1,o[1]=(15&c)<<7,o[1]|=(15&h)<<3,5===s&&(o[1]|=(15&d)>>>1,o[2]=(1&d)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:u,channelCount:h,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+l}}_parseMP3AudioData(e,t,i,n){if(i<4)return void a.Z.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");this._littleEndian;const r=new Uint8Array(e,t,i);let o;if(n){if(255!==r[0])return;const e=r[1]>>>3&3,t=(6&r[1])>>1,i=(240&r[2])>>>4,n=(12&r[2])>>>2,a=3!=(r[3]>>>6&3)?2:1;let s=0,l=0;const c="mp3";switch(e){case 0:s=this._mpegAudioV25SampleRateTable[n];break;case 2:s=this._mpegAudioV20SampleRateTable[n];break;case 3:s=this._mpegAudioV10SampleRateTable[n]}switch(t){case 1:i>>4;if(0!=(128&l)){const a=15&l,o=String.fromCharCode(...new Uint8Array(e,t,i).slice(1,5));"hvc1"===o?this._parseEnhancedHEVCVideoPacket(e,t+5,i-5,n,r,c,a):"av01"===o?this._parseEnhancedAV1VideoPacket(e,t+5,i-5,n,r,c,a):null===(s=this._onError)||void 0===s||s.call(this,m.Z.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${o}`)}else{const a=15&l;7===a?this._parseAVCVideoPacket(e,t+1,i-1,n,r,c):12===a?this._parseHEVCVideoPacket(e,t+1,i-1,n,r,c):null===(o=this._onError)||void 0===o||o.call(this,m.Z.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${a}`)}}_parseAVCVideoPacket(e,t,i,n,r,o){var s;if(i<4)return void a.Z.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");const l=this._littleEndian,c=new DataView(e,t,i),d=c.getUint8(0),u=(16777215&c.getUint32(0,!l))<<8>>8;0===d?this._parseAVCDecoderConfigurationRecord(e,t+4,i-4):1===d?this._parseAVCVideoData(e,t+4,i-4,n,r,o,u):2===d||null===(s=this._onError)||void 0===s||s.call(this,m.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${d}`)}_parseHEVCVideoPacket(e,t,i,n,r,o){var s;if(i<4)return void a.Z.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");const l=this._littleEndian,c=new DataView(e,t,i),d=c.getUint8(0),u=(16777215&c.getUint32(0,!l))<<8>>8;0===d?this._parseHEVCDecoderConfigurationRecord(e,t+4,i-4):1===d?this._parseHEVCVideoData(e,t+4,i-4,n,r,o,u):2===d||null===(s=this._onError)||void 0===s||s.call(this,m.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${d}`)}_parseEnhancedHEVCVideoPacket(e,t,i,n,a,r,o){var s;const l=this._littleEndian,c=new DataView(e,t,i);if(0===o)this._parseHEVCDecoderConfigurationRecord(e,t,i);else if(1===o){const o=(4294967040&c.getUint32(0,!l))>>8;this._parseHEVCVideoData(e,t+3,i-3,n,a,r,o)}else 3===o?this._parseHEVCVideoData(e,t,i,n,a,r,0):2===o||null===(s=this._onError)||void 0===s||s.call(this,m.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${o}`)}_parseEnhancedAV1VideoPacket(e,t,i,n,a,r,o){var s,l;this._littleEndian,0===o?this._parseAV1CodecConfigurationRecord(e,t,i):1===o?this._parseAV1VideoData(e,t,i,n,a,r,0):5===o?null===(s=this._onError)||void 0===s||s.call(this,m.Z.FORMAT_ERROR,`Flv: Not Suported MP2T AV1 video packet type ${o}`):2===o||null===(l=this._onError)||void 0===l||l.call(this,m.Z.FORMAT_ERROR,`Flv: Invalid video packet type ${o}`)}_parseAVCDecoderConfigurationRecord(e,t,i){var n,r,o,s,l,c,d,u,h,f,x;if(i<7)return void a.Z.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");let _=this._videoMetadata;const g=this._videoTrack,v=this._littleEndian,y=new DataView(e,t,i);if(_){if(void 0!==_.avcc){const n=new Uint8Array(e,t,i);if(b(n,_.avcc))return;a.Z.w(this.TAG,"AVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1!==this._hasVideo||this._hasVideoFlagOverrided||(this._hasVideo=!0,this._mediaInfo&&(this._mediaInfo.hasVideo=!0)),_=this._videoMetadata={},_.type="video",_.id=null==g?void 0:g.id,_.timescale=this._timescale,_.duration=this._duration;const S=y.getUint8(0),P=y.getUint8(1);if(y.getUint8(2),y.getUint8(3),1!==S||0===P)return void(null===(n=this._onError)||void 0===n||n.call(this,m.Z.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord"));if(this._naluLengthSize=1+(3&y.getUint8(4)),3!==this._naluLengthSize&&4!==this._naluLengthSize)return void(null===(r=this._onError)||void 0===r||r.call(this,m.Z.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1)));const E=31&y.getUint8(5);if(0===E)return void(null===(o=this._onError)||void 0===o||o.call(this,m.Z.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS"));E>1&&a.Z.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${E}`);let C=6;for(let i=0;i1&&a.Z.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${T}`),C++;for(let e=0;e=i){a.Z.w(this.TAG,`Malformed Nalu near timestamp ${x}, offset = ${h}, dataSize = ${i}`);break}let n=c.getUint32(h,!l);if(3===f&&(n>>>=8),n>i-f)return void a.Z.w(this.TAG,`Malformed Nalus near timestamp ${x}, NaluSize > DataSize!`);const r=31&c.getUint8(h+f);5===r&&(p=!0);const o=new Uint8Array(e,t+h,f+n),s={type:r,data:o};d.push(s),u+=o.byteLength,h+=f+n}if(d.length){const e=this._videoTrack,t={units:d,length:u,isKeyframe:p,dts:x,cts:s,pts:x+s};p&&(t.fileposition=r),e&&(e.samples.push(t),e.length+=u)}}_parseHEVCVideoData(e,t,i,n,r,o,s){const l=this._littleEndian,c=new DataView(e,t,i),d=[];let u=0,h=0;const f=this._naluLengthSize,x=this._timestampBase+n;let p=1===o;for(;h=i){a.Z.w(this.TAG,`Malformed Nalu near timestamp ${x}, offset = ${h}, dataSize = ${i}`);break}let n=c.getUint32(h,!l);if(3===f&&(n>>>=8),n>i-f)return void a.Z.w(this.TAG,`Malformed Nalus near timestamp ${x}, NaluSize > DataSize!`);const r=31&c.getUint8(h+f);19!==r&&20!==r||(p=!0);const o=new Uint8Array(e,t+h,f+n),s={type:r,data:o};d.push(s),u+=o.byteLength,h+=f+n}if(d.length){const e=this._videoTrack,t={units:d,length:u,isKeyframe:p,dts:x,cts:s,pts:x+s};p&&(t.fileposition=r),e&&(null==e||e.samples.push(t),e.length+=u)}}_parseAV1VideoData(e,t,i,n,a,r,o){this._littleEndian;const s=[];let l=0;const c=this._timestampBase+n,d=1===r;if(l=i,s.push({unitType:0,data:new Uint8Array(e,t+0,i)}),s.length){const e=this._videoTrack,t={units:s,length:l,isKeyframe:d,dts:c,cts:o,pts:c+o};d&&(t.fileposition=a),e&&(null==e||e.samples.push(t),e.length+=l)}}}const T=C;class R{constructor(){}destroy(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onSMPTE2038Metadata=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null}}class w{constructor(){this.program_pmt_pid={}}}var I,D,k,F;!function(e){e[e.kMPEG1Audio=3]="kMPEG1Audio",e[e.kMPEG2Audio=4]="kMPEG2Audio",e[e.kPESPrivateData=6]="kPESPrivateData",e[e.kADTSAAC=15]="kADTSAAC",e[e.kLOASAAC=17]="kLOASAAC",e[e.kAC3=129]="kAC3",e[e.kEAC3=135]="kEAC3",e[e.kID3=21]="kID3",e[e.kSCTE35=134]="kSCTE35",e[e.kH264=27]="kH264",e[e.kH265=36]="kH265"}(I||(I={}));class A{constructor(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.scte_35_pids={},this.smpte2038_pids={}}}class M{}class L{}class B{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0,this.random_access_indicator=0}}!function(e){e[e.kUnspecified=0]="kUnspecified",e[e.kSliceNonIDR=1]="kSliceNonIDR",e[e.kSliceDPA=2]="kSliceDPA",e[e.kSliceDPB=3]="kSliceDPB",e[e.kSliceDPC=4]="kSliceDPC",e[e.kSliceIDR=5]="kSliceIDR",e[e.kSliceSEI=6]="kSliceSEI",e[e.kSliceSPS=7]="kSliceSPS",e[e.kSlicePPS=8]="kSlicePPS",e[e.kSliceAUD=9]="kSliceAUD",e[e.kEndOfSequence=10]="kEndOfSequence",e[e.kEndOfStream=11]="kEndOfStream",e[e.kFiller=12]="kFiller",e[e.kSPSExt=13]="kSPSExt",e[e.kReserved0=14]="kReserved0"}(D||(D={}));class O{}class j{constructor(e){const t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}class N{constructor(e){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.Z.e(this.TAG,"Could not find H264 startcode until payload end!")}findNextStartCodeOffset(e){let t=e;const i=this.data_;for(;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;const e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===n)return t;t++}}readNextNaluPayload(){const e=this.data_;let t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_startcode_offset_;i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;const n=31&e[i],a=(128&e[i])>>>7,r=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=r,n>=D.kReserved0)continue;if(0!==a)continue;const o=e.subarray(i,r);t=new O,t.type=n,t.data=o}return t}}class U{constructor(e,t,i){let n=8+e.byteLength+1+2+t.byteLength,a=!1;66!==e[3]&&77!==e[3]&&88!==e[3]&&(a=!0,n+=4);const r=this.data=new Uint8Array(n);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;const o=e.byteLength;r[6]=o>>>8,r[7]=255&o;let s=8;r.set(e,8),s+=o,r[s]=1;const l=t.byteLength;r[s+1]=l>>>8,r[s+2]=255&l,r.set(t,s+3),s+=3+l,a&&(r[s]=252|i.chroma_format_idc,r[s+1]=248|i.bit_depth_luma-8,r[s+2]=248|i.bit_depth_chroma-8,r[s+3]=0,s+=4)}getData(){return this.data}}!function(e){e[e.kNull=0]="kNull",e[e.kAACMain=1]="kAACMain",e[e.kAAC_LC=2]="kAAC_LC",e[e.kAAC_SSR=3]="kAAC_SSR",e[e.kAAC_LTP=4]="kAAC_LTP",e[e.kAAC_SBR=5]="kAAC_SBR",e[e.kAAC_Scalable=6]="kAAC_Scalable",e[e.kLayer1=32]="kLayer1",e[e.kLayer2=33]="kLayer2",e[e.kLayer3=34]="kLayer3"}(k||(k={})),function(e){e[e.k96000Hz=0]="k96000Hz",e[e.k88200Hz=1]="k88200Hz",e[e.k64000Hz=2]="k64000Hz",e[e.k48000Hz=3]="k48000Hz",e[e.k44100Hz=4]="k44100Hz",e[e.k32000Hz=5]="k32000Hz",e[e.k24000Hz=6]="k24000Hz",e[e.k22050Hz=7]="k22050Hz",e[e.k16000Hz=8]="k16000Hz",e[e.k12000Hz=9]="k12000Hz",e[e.k11025Hz=10]="k11025Hz",e[e.k8000Hz=11]="k8000Hz",e[e.k7350Hz=12]="k7350Hz"}(F||(F={}));const z=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class H{}class V extends H{}class Z{constructor(e){this.TAG="AACADTSParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.Z.e(this.TAG,"Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e;const i=this.data_;for(;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095==(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){const e=this.data_;let t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_;const n=(8&e[i+1])>>>3,a=(6&e[i+1])>>>1,r=1&e[i+1],o=(192&e[i+2])>>>6,s=(60&e[i+2])>>>2,l=(1&e[i+2])<<2|(192&e[i+3])>>>6,c=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+c>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const d=1===r?7:9,u=c-d;i+=d;const h=this.findNextSyncwordOffset(i+u);if(this.current_syncword_offset_=h,0!==n&&1!==n||0!==a)continue;const f=e.subarray(i,i+u);t=new H,t.audio_object_type=o+1,t.sampling_freq_index=s,t.sampling_frequency=z[s],t.channel_config=l,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class W{constructor(e){this.TAG="AACLOASParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.Z.e(this.TAG,"Could not found LOAS syncword until payload end")}findNextSyncwordOffset(e){let t=e;const i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695==(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){const t=e.readBits(2);let i=0;for(let n=0;n<=t;n++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){const t=this.data_;let i=null;for(;null==i&&!this.eof_flag_;){const n=this.current_syncword_offset_,r=(31&t[n+1])<<8|t[n+2];if(n+3+r>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const o=new f(t.subarray(n+3,n+3+r));let s=null;if(o.readBool()){if(null==e){a.Z.w(this.TAG,"StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(n+3+r),o.destroy();continue}s=e}else{const e=o.readBool();if(e&&o.readBool()){a.Z.e(this.TAG,"audioMuxVersionA is Not Supported"),o.destroy();break}if(e&&this.getLATMValue(o),!o.readBool()){a.Z.e(this.TAG,"allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){a.Z.e(this.TAG,"more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){a.Z.e(this.TAG,"more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){a.Z.e(this.TAG,"more than 2 numLayer Not Supported"),o.destroy();break}let t=e?this.getLATMValue(o):0;const i=o.readBits(5);t-=5;const n=o.readBits(4);t-=4;const r=o.readBits(4);t-=4,o.readBits(3),t-=3,t>0&&o.readBits(t);const l=o.readBits(3);if(0!==l){a.Z.e(this.TAG,`frameLengthType = ${l}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();const c=o.readBool();if(c)if(e)this.getLATMValue(o);else{let e=0;for(;;){e<<=8;const t=o.readBool();if(e+=o.readByte(),!t)break}console.log(e)}o.readBool()&&o.readByte(),s=new V,s.audio_object_type=i,s.sampling_freq_index=n,s.sampling_frequency=z[s.sampling_freq_index],s.channel_config=r,s.other_data_present=c}let l=0;for(;;){const e=o.readByte();if(l+=e,255!==e)break}const c=new Uint8Array(l);for(let e=0;e=6?(n=5,t=new Array(4),o=a-3):(n=2,t=new Array(2),o=a):s.includes("android")?(n=2,t=new Array(2),o=a):(n=5,o=a,t=new Array(4),a>=6?o=a-3:1===r&&(n=2,t=new Array(2),o=a)),t[0]=n<<3,t[0]|=(15&a)>>>1,t[1]=(15&a)<<7,t[1]|=(15&r)<<3,5===n&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=z[a],this.channel_count=r,this.codec_mimetype="mp4a.40."+n.toString(),this.original_codec_mimetype="mp4a.40."+i.toString()}}class Y{}class X{}var J;!function(e){e[e.kSpliceNull=0]="kSpliceNull",e[e.kSpliceSchedule=4]="kSpliceSchedule",e[e.kSpliceInsert=5]="kSpliceInsert",e[e.kTimeSignal=6]="kTimeSignal",e[e.kBandwidthReservation=7]="kBandwidthReservation",e[e.kPrivateCommand=255]="kPrivateCommand"}(J||(J={}));const q=e=>{const t=e.readBool();return t?(e.readBits(6),{time_specified_flag:t,pts_time:4*e.readBits(31)+e.readBits(2)}):(e.readBits(7),{time_specified_flag:t})},K=e=>{const t=e.readBool();return e.readBits(6),{auto_return:t,duration:4*e.readBits(31)+e.readBits(2)}},$=(e,t)=>{const i=t.readBits(8);return e?{component_tag:i}:{component_tag:i,splice_time:q(t)}},Q=e=>({component_tag:e.readBits(8),utc_splice_time:e.readBits(32)}),ee=e=>{const t=e.readBits(32),i=e.readBool();e.readBits(7);const n={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return n;if(n.out_of_network_indicator=e.readBool(),n.program_splice_flag=e.readBool(),n.duration_flag=e.readBool(),e.readBits(5),n.program_splice_flag)n.utc_splice_time=e.readBits(32);else{n.component_count=e.readBits(8),n.components=[];for(let t=0;t({descriptor_tag:e,descriptor_length:t,identifier:i,provider_avail_id:n.readBits(32)}),ie=(e,t,i,n)=>{const a=n.readBits(8),r=n.readBits(3);n.readBits(5);let o="";for(let e=0;e{const t=e.readBits(8);return e.readBits(7),{component_tag:t,pts_offset:4*e.readBits(31)+e.readBits(2)}},ae=(e,t,i,n)=>{const a=n.readBits(32),r=n.readBool();n.readBits(7);const o={descriptor_tag:e,descriptor_length:t,identifier:i,segmentation_event_id:a,segmentation_event_cancel_indicator:r};if(r)return o;if(o.program_segmentation_flag=n.readBool(),o.segmentation_duration_flag=n.readBool(),o.delivery_not_restricted_flag=n.readBool(),o.delivery_not_restricted_flag?n.readBits(5):(o.web_delivery_allowed_flag=n.readBool(),o.no_regional_blackout_flag=n.readBool(),o.archive_allowed_flag=n.readBool(),o.device_restrictions=n.readBits(2)),!o.program_segmentation_flag){o.component_count=n.readBits(8),o.components=[];for(let e=0;e({descriptor_tag:e,descriptor_length:t,identifier:i,TAI_seconds:n.readBits(48),TAI_ns:n.readBits(32),UTC_offset:n.readBits(16)}),oe=e=>({component_tag:e.readBits(8),ISO_code:String.fromCharCode(e.readBits(8),e.readBits(8),e.readBits(8)),Bit_Stream_Mode:e.readBits(3),Num_Channels:e.readBits(4),Full_Srvc_Audio:e.readBool()}),se=(e,t,i,n)=>{const a=n.readBits(4),r=[];for(let e=0;e=i.byteLength)return this.eof_flag_=!0,i.byteLength;const e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===n)return t;t++}}readNextNaluPayload(){const e=this.data_;let t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_startcode_offset_;i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;const n=e[i]>>1&63,a=(128&e[i])>>>7,r=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=r,0!==a)continue;const o=e.subarray(i,r);t=new ce,t.type=n,t.data=o}return t}}class he{constructor(e,t,i,n){const a=23+(5+e.byteLength)+(5+t.byteLength)+(5+i.byteLength),r=this.data=new Uint8Array(a);r[0]=1,r[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,r[2]=n.general_profile_compatibility_flags_1,r[3]=n.general_profile_compatibility_flags_2,r[4]=n.general_profile_compatibility_flags_3,r[5]=n.general_profile_compatibility_flags_4,r[6]=n.general_constraint_indicator_flags_1,r[7]=n.general_constraint_indicator_flags_2,r[8]=n.general_constraint_indicator_flags_3,r[9]=n.general_constraint_indicator_flags_4,r[10]=n.general_constraint_indicator_flags_5,r[11]=n.general_constraint_indicator_flags_6,r[12]=n.general_level_idc,r[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,r[14]=255&n.min_spatial_segmentation_idc,r[15]=252|3&n.parallelismType,r[16]=252|3&n.chroma_format_idc,r[17]=248|7&n.bit_depth_luma_minus8,r[18]=248|7&n.bit_depth_chroma_minus8,r[19]=0,r[20]=0,r[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,r[22]=3,r[23]=128|le.kSliceVPS,r[24]=0,r[25]=1,r[26]=(65280&e.byteLength)>>8,r[27]=(255&e.byteLength)>>0,r.set(e,28),r[23+(5+e.byteLength)+0]=128|le.kSliceSPS,r[23+(5+e.byteLength)+1]=0,r[23+(5+e.byteLength)+2]=1,r[23+(5+e.byteLength)+3]=(65280&t.byteLength)>>8,r[23+(5+e.byteLength)+4]=(255&t.byteLength)>>0,r.set(t,23+(5+e.byteLength)+5),r[23+(5+e.byteLength+5+t.byteLength)+0]=128|le.kSlicePPS,r[23+(5+e.byteLength+5+t.byteLength)+1]=0,r[23+(5+e.byteLength+5+t.byteLength)+2]=1,r[23+(5+e.byteLength+5+t.byteLength)+3]=(65280&i.byteLength)>>8,r[23+(5+e.byteLength+5+t.byteLength)+4]=(255&i.byteLength)>>0,r.set(i,23+(5+e.byteLength+5+t.byteLength)+5)}getData(){return this.data}}class fe{}class xe{}class pe{}const me=[[64,64,80,80,96,96,112,112,128,128,160,160,192,192,224,224,256,256,320,320,384,384,448,448,512,512,640,640,768,768,896,896,1024,1024,1152,1152,1280,1280],[69,70,87,88,104,105,121,122,139,140,174,175,208,209,243,244,278,279,348,349,417,418,487,488,557,558,696,697,835,836,975,976,1114,1115,1253,1254,1393,1394],[96,96,120,120,144,144,168,168,192,192,240,240,288,288,336,336,384,384,480,480,576,576,672,672,768,768,960,960,1152,1152,1344,1344,1536,1536,1728,1728,1920,1920]];class _e{constructor(e){this.TAG="AC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.Z.e(this.TAG,"Could not found AC3 syncword until payload end")}findNextSyncwordOffset(e){let t=e;const i=this.data_;for(;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]<<0))return t;t++}}readNextAC3Frame(){const e=this.data_;let t=null;for(;null==t&&!this.eof_flag_;){const i=this.current_syncword_offset_,n=e[i+4]>>6,a=[48e3,44200,33e3][n],r=63&e[i+4],o=2*me[n][r];if(i+o>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const s=this.findNextSyncwordOffset(i+o);this.current_syncword_offset_=s;const l=e[i+5]>>3,c=7&e[i+5],d=e[i+6]>>5;let u=0;0!=(1&d)&&1!==d&&(u+=2),0!=(4&d)&&(u+=2),2===d&&(u+=2);const h=(e[i+6]<<8|e[i+7]<<0)>>12-u&1,f=[2,1,2,3,3,4,4,5][d]+h;t=new pe,t.sampling_frequency=a,t.channel_count=f,t.channel_mode=d,t.bit_stream_identification=l,t.low_frequency_effects_channel_on=h,t.bit_stream_mode=c,t.frame_size_code=r,t.data=e.subarray(i,i+o)}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class ge{constructor(e){let t=[];t=[e.sampling_rate_code<<6|e.bit_stream_identification<<1|e.bit_stream_mode>>2,(3&e.bit_stream_mode)<<6|e.channel_mode<<3|e.low_frequency_effects_channel_on<<2|e.frame_size_code>>4,e.frame_size_code<<4&224],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.bit_stream_mode=e.bit_stream_mode,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ac-3",this.original_codec_mimetype="ac-3"}}class ve{}class ye{constructor(e){this.TAG="EAC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.Z.e(this.TAG,"Could not found AC3 syncword until payload end")}findNextSyncwordOffset(e){let t=e;const i=this.data_;for(;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]<<0))return t;t++}}readNextEAC3Frame(){const e=this.data_;let t=null;for(;null==t&&!this.eof_flag_;){const i=this.current_syncword_offset_,n=new f(e.subarray(i+2)),a=(n.readBits(2),n.readBits(3),n.readBits(11)+1<<1);let r=n.readBits(2),o=null,s=null;3===r?(r=n.readBits(2),o=[24e3,22060,16e3][r],s=3):(o=[48e3,44100,32e3][r],s=n.readBits(2));const l=n.readBits(3),c=n.readBits(1),d=n.readBits(5);if(i+a>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}const u=this.findNextSyncwordOffset(i+a);this.current_syncword_offset_=u;const h=[2,1,2,3,3,4,4,5][l]+c;n.destroy(),t=new ve,t.sampling_frequency=o,t.channel_count=h,t.channel_mode=l,t.bit_stream_identification=d,t.low_frequency_effects_channel_on=c,t.frame_size=a,t.num_blks=[1,2,3,6][s],t.data=e.subarray(i,i+a)}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Se{constructor(e){let t=[];const i=Math.floor(e.frame_size*e.sampling_frequency/(16*e.num_blks));t=[255&i,248&i,e.sampling_rate_code<<6|e.bit_stream_identification<<1|0,0|e.channel_mode<<1|e.low_frequency_effects_channel_on<<0,0],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.num_blks=e.num_blks,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ec-3",this.original_codec_mimetype="ec-3"}}const be=class extends R{constructor(e,t){super(),this.TAG="TSDemuxer",this.first_parse_=!0,this.media_info_=new o.Z,this.timescale_=90,this.duration_=0,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:void 0,sps:void 0,pps:void 0,details:void 0},this.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},this.aac_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this.ts_packet_size_=e.ts_packet_size,this.sync_offset_=e.sync_offset,this.config_=t}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,super.destroy()}static probe(e){const t=new Uint8Array(e);let i=-1,n=188;if(t.byteLength<=3*n)return{needMoreData:!0};for(;-1===i;){const e=Math.min(1e3,t.byteLength-3*n);for(let a=0;a=4?(a.Z.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),i-=4):204===n&&a.Z.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:n,sync_offset:i})}bindDataSource(e){return e.onDataArrival=this.parseChunks.bind(this),this}resetMediaInfo(){this.media_info_=new o.Z}parseChunks(e,t){var i;if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new c.rT("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let n=0;for(this.first_parse_&&(this.first_parse_=!1,n=this.sync_offset_);n+this.ts_packet_size_<=e.byteLength;){const r=t+n;192===this.ts_packet_size_&&(n+=4);const o=new Uint8Array(e,n,188),s=o[0];if(71!==s){a.Z.e(this.TAG,`sync_byte = ${s}, not 0x47`);break}const l=(64&o[1])>>>6,c=(o[1],(31&o[1])<<8|o[2]),d=(48&o[3])>>>4,u=15&o[3];let h={},f=4;if(2===d||3===d){const t=o[4];if(5+t===188){n+=188,204===this.ts_packet_size_&&(n+=16);continue}t>0&&(h=this.parseAdaptationField(e,n+4,1+t)),f=5+t}if(1===d||3===d)if(0===c||c===this.current_pmt_pid_||void 0!==this.pmt_&&this.pmt_.pid_stream_type[c]===I.kSCTE35){const t=188-f;this.handleSectionSlice(e,n+f,t,{pid:c,file_position:r,payload_unit_start_indicator:l,continuity_conunter:u,random_access_indicator:h.random_access_indicator})}else if(void 0!==(null===(i=this.pmt_)||void 0===i?void 0:i.pid_stream_type[c])){const t=188-f,i=this.pmt_.pid_stream_type[c];(c===this.pmt_.common_pids.h264||c===this.pmt_.common_pids.h265||c===this.pmt_.common_pids.adts_aac||c===this.pmt_.common_pids.loas_aac||c===this.pmt_.common_pids.ac3||c===this.pmt_.common_pids.eac3||c===this.pmt_.common_pids.opus||c===this.pmt_.common_pids.mp3||this.pmt_.pes_private_data_pids[c]||this.pmt_.timed_id3_pids[c])&&this.handlePESSlice(e,n+f,t,{pid:c,stream_type:i,file_position:r,payload_unit_start_indicator:l,continuity_conunter:u,random_access_indicator:h.random_access_indicator})}n+=188,204===this.ts_packet_size_&&(n+=16)}return this.dispatchAudioVideoMediaSegment(),n}parseAdaptationField(e,t,i){const n=new Uint8Array(e,t,i),r=n[0];return r>0?r>183?(a.Z.w(this.TAG,`Illegal adaptation_field_length: ${r}`),{}):{discontinuity_indicator:(128&n[1])>>>7,random_access_indicator:(64&n[1])>>>6,elementary_stream_priority_indicator:(32&n[1])>>>5}:{}}handleSectionSlice(e,t,i,n){const a=new Uint8Array(e,t,i);let r=this.section_slice_queues_?this.section_slice_queues_[n.pid]:{};if(n.payload_unit_start_indicator){const o=a[0];if(void 0!==r&&0!==(null==r?void 0:r.total_length)){const a=new Uint8Array(e,t+1,Math.min(i,o));r.slices.push(a),r.total_length+=a.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,n):this.clearSlices(r,n)}for(let s=1+o;s=r.expected_length&&this.clearSlices(r,n),s+=l.byteLength}}else if(void 0!==r&&0!==r.total_length){const a=new Uint8Array(e,t,Math.min(i,r.expected_length-r.total_length));r.slices.push(a),r.total_length+=a.byteLength,r.total_length===r.expected_length?this.emitSectionSlices(r,n):r.total_length>=r.expected_length&&this.clearSlices(r,n)}}handlePESSlice(e,t,i,n){const r=new Uint8Array(e,t,i),o=r[0]<<16|r[1]<<8|r[2],s=(r[3],r[4]<<8|r[5]);if(n.payload_unit_start_indicator){if(1!==o)return void a.Z.e(this.TAG,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);const e=this.pes_slice_queues_[n.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?this.emitPESSlices(e,n):this.clearSlices(e,n)),this.pes_slice_queues_&&(this.pes_slice_queues_[n.pid]=new B,this.pes_slice_queues_[n.pid].file_position=n.file_position,this.pes_slice_queues_[n.pid].random_access_indicator=n.random_access_indicator)}if(void 0===this.pes_slice_queues_[n.pid])return;const l=this.pes_slice_queues_[n.pid];l.slices.push(r),n.payload_unit_start_indicator&&(l.expected_length=0===s?0:s+6),l.total_length+=r.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,n):l.expected_length>0&&l.expected_length>>6,o=t[8];let s,l;2!==i&&3!==i||(s=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,l=3===i?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:s);const c=9+o;let d;if(0!==r){if(r<3+o)return void a.Z.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=r-3-o}else d=t.byteLength-c;const u=t.subarray(c,c+d);switch(e.stream_type){case I.kMPEG1Audio:case I.kMPEG2Audio:this.parseMP3Payload(u,s);break;case I.kPESPrivateData:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(u,s):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(u,s):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(u,s):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(u,s,l,e.pid,n):this.parsePESPrivateDataPayload(u,s,l,e.pid,n);break;case I.kADTSAAC:this.parseADTSAACPayload(u,s);break;case I.kLOASAAC:this.parseLOASAACPayload(u,s);break;case I.kAC3:this.parseAC3Payload(u,s);break;case I.kEAC3:this.parseEAC3Payload(u,s);break;case I.kID3:this.parseTimedID3MetadataPayload(u,s,l,e.pid,n);break;case I.kH264:this.parseH264Payload(u,s,l,e.file_position,e.random_access_indicator);break;case I.kH265:this.parseH265Payload(u,s,l,e.file_position,e.random_access_indicator)}}else if((188===n||191===n||240===n||241===n||255===n||242===n||248===n)&&e.stream_type===I.kPESPrivateData){const i=6;let a;a=0!==r?r:t.byteLength-i;const o=t.subarray(i,i+a);this.parsePESPrivateDataPayload(o,void 0,void 0,e.pid,n)}}else a.Z.e(this.TAG,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)}parsePAT(e){const t=e[0];if(0!==t)return void a.Z.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);const i=(15&e[1])<<8|e[2],n=(e[3],e[4],(62&e[5])>>>1),r=1&e[5],o=e[6];e[7];let s=null;if(1===r&&0===o)s=new w,s.version_number=n;else if(s=this.pat_,null==s)return;const l=i-5-4;let c=-1,d=-1;for(let t=8;t<8+l;t+=4){const i=e[t]<<8|e[t+1],n=(31&e[t+2])<<8|e[t+3];0===i?s.network_pid=n:(s.program_pmt_pid[i]=n,-1===c&&(c=i),-1===d&&(d=n))}1===r&&0===o&&(void 0===this.pat_&&a.Z.v(this.TAG,`Parsed first PAT: ${JSON.stringify(s)}`),this.pat_=s,this.current_program_=c,this.current_pmt_pid_=d)}parsePMT(e){const t=e[0];if(2!==t)return void a.Z.e(this.TAG,`parsePMT: table_id ${t} is not corresponded to PMT!`);const i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],r=(62&e[5])>>>1,o=1&e[5],s=e[6];e[7];let l=null;if(1===o&&0===s)l=new A,l.program_number=n,l.version_number=r,this.program_pmt_map_[n]=l;else if(l=this.program_pmt_map_[n],null==l)return;e[8],e[9];const c=(15&e[10])<<8|e[11],d=12+c,u=i-9-c-4;for(let t=d;t0){for(let i=t+5;i{var t,i,n,a,r,o;const s=new f(e),l=s.readBits(8),c=s.readBool(),d=s.readBool();s.readBits(2);const u=s.readBits(12),h=s.readBits(8),x=s.readBool(),p=s.readBits(6),m=4*s.readBits(31)+s.readBits(2),_=s.readBits(8),g=s.readBits(12),v=s.readBits(12),y=s.readBits(8);let S=null;y===J.kSpliceNull?S={}:y===J.kSpliceSchedule?S=(e=>{const t=e.readBits(8),i=[];for(let n=0;n{const t=e.readBits(32),i=e.readBool();e.readBits(7);const n={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return n;if(n.out_of_network_indicator=e.readBool(),n.program_splice_flag=e.readBool(),n.duration_flag=e.readBool(),n.splice_immediate_flag=e.readBool(),e.readBits(4),n.program_splice_flag&&!n.splice_immediate_flag&&(n.splice_time=q(e)),!n.program_splice_flag){n.component_count=e.readBits(8),n.components=[];for(let t=0;t({splice_time:q(e)}))(s):y===J.kBandwidthReservation?S={}:y===J.kPrivateCommand?S=((e,t)=>{const i=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8)),n=new Uint8Array(e-4);for(let i=0;i1&&(a.Z.w(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}const l=new Z(e);let c=null,d=s,u=0;for(;null!=(c=l.readNextAACFrame());){o=1024/c.sampling_frequency*1e3;const e={codec:"aac",data:c};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)):(this.audio_metadata_={codec:"aac",audio_object_type:c.audio_object_type,sampling_freq_index:c.sampling_freq_index,sampling_frequency:c.sampling_frequency,channel_config:c.channel_config},this.dispatchAudioInitSegment(e)),u=d;const t=Math.floor(d),i={unit:c.data,length:c.data.byteLength,pts:t,dts:t};this.audio_track_&&(null===(r=this.audio_track_)||void 0===r||r.samples.push(i),this.audio_track_.length+=c.data.byteLength),d+=o}l.hasIncompleteData()&&(this.aac_last_incomplete_data_=l.getIncompleteData()),u&&(this.aac_last_sample_pts_=u)}parseLOASAACPayload(e,t){var i,n,r;if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){const t=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);t.set(this.aac_last_incomplete_data_,0),t.set(e,this.aac_last_incomplete_data_.byteLength),e=t}let o,s=0;if(void 0!==t&&(s=t/this.timescale_),"aac"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec)){if(void 0===t&&void 0!==this.aac_last_sample_pts_)o=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.aac_last_sample_pts_+o;else if(void 0===t)return void a.Z.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){o=1024/this.audio_metadata_.sampling_frequency*1e3;const e=this.aac_last_sample_pts_+o;Math.abs(e-s)>1&&(a.Z.w(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}const l=new W(e);let c=null,d=s,u=0;for(;null!=(c=l.readNextAACFrame(null!==(n=this.loas_previous_frame)&&void 0!==n?n:void 0));){this.loas_previous_frame=c,o=1024/c.sampling_frequency*1e3;const e={codec:"aac",data:c};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)):(this.audio_metadata_={codec:"aac",audio_object_type:c.audio_object_type,sampling_freq_index:c.sampling_freq_index,sampling_frequency:c.sampling_frequency,channel_config:c.channel_config},this.dispatchAudioInitSegment(e)),u=d;const t=Math.floor(d),i={unit:c.data,length:c.data.byteLength,pts:t,dts:t};this.audio_track_&&(null===(r=this.audio_track_)||void 0===r||r.samples.push(i),this.audio_track_.length+=c.data.byteLength),d+=o}l.hasIncompleteData()&&(this.aac_last_incomplete_data_=l.getIncompleteData()),u&&(this.aac_last_sample_pts_=u)}parseAC3Payload(e,t){var i,n;if(this.has_video_&&!this.video_init_segment_dispatched_)return;let r,o=0;if(void 0!==t&&(o=t/this.timescale_),"ac-3"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec))if(void 0===t&&void 0!==this.aac_last_sample_pts_)r=1536/this.audio_metadata_.sampling_frequency*1e3,o=this.aac_last_sample_pts_+r;else if(void 0===t)return void a.Z.w(this.TAG,"AC3: Unknown pts");const s=new _e(e);let l=null,c=o,d=0;for(;null!=(l=s.readNextAC3Frame());){r=1536/l.sampling_frequency*1e3;const e={codec:"ac-3",data:l};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)):(this.audio_metadata_={codec:"ac-3",sampling_frequency:l.sampling_frequency,bit_stream_identification:l.bit_stream_identification,bit_stream_mode:l.bit_stream_mode,low_frequency_effects_channel_on:l.low_frequency_effects_channel_on,channel_mode:l.channel_mode},this.dispatchAudioInitSegment(e)),d=c;const t=Math.floor(c),i={unit:l.data,length:l.data.byteLength,pts:t,dts:t};this.audio_track_&&(null===(n=this.audio_track_)||void 0===n||n.samples.push(i),this.audio_track_.length+=l.data.byteLength),c+=r}d&&(this.aac_last_sample_pts_=d)}parseEAC3Payload(e,t){var i,n;if(this.has_video_&&!this.video_init_segment_dispatched_)return;let r,o=0;if(void 0!==t&&(o=t/this.timescale_),"ec-3"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec))if(void 0===t&&void 0!==this.aac_last_sample_pts_)r=256*(this.audio_metadata_.num_blks||0)/(this.audio_metadata_.sampling_frequency||0)*1e3,o=this.aac_last_sample_pts_+r;else if(void 0===t)return void a.Z.w(this.TAG,"EAC3: Unknown pts");const s=new ye(e);let l=null,c=o,d=0;for(;null!=(l=s.readNextEAC3Frame());){r=1536/l.sampling_frequency*1e3;const e={codec:"ec-3",data:l};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)):(this.audio_metadata_={codec:"ec-3",sampling_frequency:l.sampling_frequency,bit_stream_identification:l.bit_stream_identification,low_frequency_effects_channel_on:l.low_frequency_effects_channel_on,num_blks:l.num_blks,channel_mode:l.channel_mode},this.dispatchAudioInitSegment(e)),d=c;const t=Math.floor(c),i={unit:l.data,length:l.data.byteLength,pts:t,dts:t};this.audio_track_&&(null===(n=this.audio_track_)||void 0===n||n.samples.push(i),this.audio_track_.length+=l.data.byteLength),c+=r}d&&(this.aac_last_sample_pts_=d)}parseOpusPayload(e,t){var i,n;if(this.has_video_&&!this.video_init_segment_dispatched_)return;let r,o=0;if(void 0!==t&&(o=t/this.timescale_),"opus"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec))if(void 0===t&&void 0!==this.aac_last_sample_pts_)r=20,o=this.aac_last_sample_pts_+r;else if(void 0===t)return void a.Z.w(this.TAG,"Opus: Unknown pts");let s=o,l=0;for(let t=0;t>>3&3,s=(6&e[1])>>1;e[2];const l=(12&e[2])>>>2,c=3!=(e[3]>>>6&3)?2:1;let d=0,u=34;switch(o){case 0:d=r[l];break;case 2:d=a[l];break;case 3:d=n[l]}switch(s){case 1:u=34;break;case 2:u=33;break;case 3:u=32}const h=new xe;h.object_type=u,h.sample_rate=d,h.channel_count=c,h.data=e;const f={codec:"mp3",data:h};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(f)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(f)):(this.audio_metadata_={codec:"mp3",object_type:u,sample_rate:d,channel_count:c},this.dispatchAudioInitSegment(f));const x={unit:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_};this.audio_track_&&(null===(i=this.audio_track_)||void 0===i||i.samples.push(x),this.audio_track_.length+=e.byteLength)}detectAudioMetadataChange(e){var t,i,n,r;if(e.codec!==(null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec))return a.Z.v(this.TAG,`Audio: Audio Codecs changed from ${null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return a.Z.v(this.TAG,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return a.Z.v(this.TAG,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return a.Z.v(this.TAG,`AAC: Channel configuration changed from ${null===(n=this.audio_metadata_)||void 0===n?void 0:n.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==this.audio_metadata_.sampling_frequency)return a.Z.v(this.TAG,`AC3: Sampling Frequency changed from ${null===(r=this.audio_metadata_)||void 0===r?void 0:r.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return a.Z.v(this.TAG,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return a.Z.v(this.TAG,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return a.Z.v(this.TAG,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return a.Z.v(this.TAG,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==this.audio_metadata_.sample_rate)return a.Z.v(this.TAG,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return a.Z.v(this.TAG,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){const t=e.data;if(t.object_type!==this.audio_metadata_.object_type)return a.Z.v(this.TAG,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==this.audio_metadata_.sample_rate)return a.Z.v(this.TAG,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return a.Z.v(this.TAG,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1}dispatchAudioInitSegment(e){var t,i,n,r,o,s;const l={type:"audio"};if(l.id=null===(t=this.audio_track_)||void 0===t?void 0:t.id,l.timescale=1e3,l.duration=this.duration_,"aac"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec)){const t="aac"===e.codec?e.data:null,i=new G(t);l.audioSampleRate=i.sampling_rate,l.channelCount=i.channel_count,l.codec=i.codec_mimetype,l.originalCodec=i.original_codec_mimetype,l.config=i.config,l.refSampleDuration=1024/l.audioSampleRate*l.timescale}else if("ac-3"===(null===(n=this.audio_metadata_)||void 0===n?void 0:n.codec)){const t="ac-3"===e.codec?e.data:null,i=new ge(t);l.audioSampleRate=i.sampling_rate,l.channelCount=i.channel_count,l.codec=i.codec_mimetype,l.originalCodec=i.original_codec_mimetype,l.config=i.config,l.refSampleDuration=1536/l.audioSampleRate*l.timescale}else if("ec-3"===(null===(r=this.audio_metadata_)||void 0===r?void 0:r.codec)){const t="ec-3"===e.codec?e.data:null,i=new Se(t);l.audioSampleRate=i.sampling_rate,l.channelCount=i.channel_count,l.codec=i.codec_mimetype,l.originalCodec=i.original_codec_mimetype,l.config=i.config,l.refSampleDuration=256*i.num_blks/l.audioSampleRate*l.timescale}else"opus"===(null===(o=this.audio_metadata_)||void 0===o?void 0:o.codec)?(l.audioSampleRate=this.audio_metadata_.sample_rate,l.channelCount=this.audio_metadata_.channel_count,l.channelConfigCode=this.audio_metadata_.channel_config_code,l.codec="opus",l.originalCodec="opus",l.config=void 0,l.refSampleDuration=20):"mp3"===(null===(s=this.audio_metadata_)||void 0===s?void 0:s.codec)&&(l.audioSampleRate=this.audio_metadata_.sample_rate,l.channelCount=this.audio_metadata_.channel_count,l.codec="mp3",l.originalCodec="mp3",l.config=void 0);this.audio_init_segment_dispatched_||a.Z.v(this.TAG,`Generated first AudioSpecificConfig for mimeType: ${l.codec}`),this.onTrackMetadata&&this.onTrackMetadata("audio",l),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;const c=this.media_info_;c.hasAudio=!0,c.audioCodec=l.originalCodec,c.audioSampleRate=l.audioSampleRate,c.audioChannelCount=l.channelCount,c.hasVideo&&c.videoCodec?c.mimeType=`video/mp2t; codecs="${c.videoCodec},${c.audioCodec}"`:c.mimeType=`video/mp2t; codecs="${c.audioCodec}"`,c.isComplete()&&this.onMediaInfo&&this.onMediaInfo(c)}dispatchPESPrivateDataDescriptor(e,t,i){const n=new X;n.pid=e,n.stream_type=t,n.descriptor=i,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(n)}parsePESPrivateDataPayload(e,t,i,n,a){const r=new Y;if(r.pid=n,r.stream_id=a,r.len=e.byteLength,r.data=e,void 0!==t){const e=Math.floor(t/this.timescale_);r.pts=e}else r.nearest_pts=this.aac_last_sample_pts_;if(void 0!==i){const e=Math.floor(i/this.timescale_);r.dts=e}this.onPESPrivateData&&this.onPESPrivateData(r)}parseTimedID3MetadataPayload(e,t,i,n,a){const r=new Y;if(r.pid=n,r.stream_id=a,r.len=e.byteLength,r.data=e,void 0!==t){const e=Math.floor(t/this.timescale_);r.pts=e}if(void 0!==i){const e=Math.floor(i/this.timescale_);r.dts=e}this.onTimedID3Metadata&&this.onTimedID3Metadata(r)}parseSMPTE2038MetadataPayload(e,t,i,n,a){const r=new fe;if(r.pid=n,r.stream_id=a,r.len=e.byteLength,r.data=e,void 0!==t){const e=Math.floor(t/this.timescale_);r.pts=e}if(r.nearest_pts=this.aac_last_sample_pts_,void 0!==i){const e=Math.floor(i/this.timescale_);r.dts=e}r.ancillaries=(e=>{let t=new f(e),i=0;const n=[];for(;i+=6,0===t.readBits(6);){const e=t.readBool();i+=1;const a=t.readBits(11);i+=11;const r=t.readBits(12);i+=12;const o=255&t.readBits(10);i+=10;const s=255&t.readBits(10);i+=10;const l=255&t.readBits(10);i+=10;const c=new Uint8Array(l);for(let e=0;e>>24&255,n[1]=i>>>16&255,n[2]=i>>>8&255,n[3]=255&i,n.set(e,4);let o=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return Ee.box(Ee.types.trak,Ee.tkhd(e),Ee.mdia(e))}static tkhd(e){const t=e.id,i=e.duration,n=e.presentWidth,a=e.presentHeight;return Ee.box(Ee.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,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,n>>>8&255,255&n,0,0,a>>>8&255,255&a,0,0]))}static mdia(e){return Ee.box(Ee.types.mdia,Ee.mdhd(e),Ee.hdlr(e),Ee.minf(e))}static mdhd(e){const t=e.timescale,i=e.duration;return Ee.box(Ee.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?Ee.constants.HDLR_AUDIO:Ee.constants.HDLR_VIDEO,Ee.box(Ee.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?Ee.box(Ee.types.smhd,Ee.constants.SMHD):Ee.box(Ee.types.vmhd,Ee.constants.VMHD),Ee.box(Ee.types.minf,t,Ee.dinf(),Ee.stbl(e))}static dinf(){return Ee.box(Ee.types.dinf,Ee.box(Ee.types.dref,Ee.constants.DREF))}static stbl(e){return Ee.box(Ee.types.stbl,Ee.stsd(e),Ee.box(Ee.types.stts,Ee.constants.STTS),Ee.box(Ee.types.stsc,Ee.constants.STSC),Ee.box(Ee.types.stsz,Ee.constants.STSZ),Ee.box(Ee.types.stco,Ee.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.mp3(e)):"ac-3"===e.codec?Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.ac3(e)):"ec-3"===e.codec?Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.ec3(e)):"opus"===e.codec?Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.Opus(e)):Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.mp4a(e)):"video"===e.type&&e.codec.startsWith("hvc1")?Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.hvc1(e)):"video"===e.type&&e.codec.startsWith("av01")?Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.av01(e)):Ee.box(Ee.types.stsd,Ee.constants.STSD_PREFIX,Ee.avc1(e))}static mp3(e){const t=e.channelCount,i=e.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Ee.box(Ee.types[".mp3"],n)}static mp4a(e){const t=e.channelCount,i=e.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Ee.box(Ee.types.mp4a,n,Ee.esds(e))}static ac3(e){var t;const i=e.channelCount,n=e.audioSampleRate,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return Ee.box(Ee.types["ac-3"],a,Ee.box(Ee.types.dac3,new Uint8Array(null!==(t=e.config)&&void 0!==t?t:[])))}static ec3(e){var t;const i=e.channelCount,n=e.audioSampleRate,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return Ee.box(Ee.types["ec-3"],a,Ee.box(Ee.types.dec3,new Uint8Array(null!==(t=e.config)&&void 0!==t?t:[])))}static esds(e){var t;const i=null!==(t=e.config)&&void 0!==t?t:[],n=i.length,a=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(i).concat([6,1,2]));return Ee.box(Ee.types.esds,a)}static Opus(e){const t=e.channelCount,i=e.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Ee.box(Ee.types.Opus,n,Ee.dOps(e))}static dOps(e){const t=e.channelCount,i=e.channelConfigCode,n=e.audioSampleRate;let a=[];switch(i){case 1:case 2:a=[0];break;case 0:a=[255,1,1,0,1];break;case 128:a=[255,2,0,0,1];break;case 3:a=[1,2,1,0,2,1];break;case 4:a=[1,2,2,0,1,2,3];break;case 5:a=[1,3,2,0,4,1,2,3];break;case 6:a=[1,4,2,0,4,1,2,3,5];break;case 7:a=[1,4,2,0,4,1,2,3,5,6];break;case 8:a=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:a=[1,1,2,0,1];break;case 131:a=[1,1,3,0,1,2];break;case 132:a=[1,1,4,0,1,2,3];break;case 133:a=[1,1,5,0,1,2,3,4];break;case 134:a=[1,1,6,0,1,2,3,4,5];break;case 135:a=[1,1,7,0,1,2,3,4,5,6];break;case 136:a=[1,1,8,0,1,2,3,4,5,6,7]}const r=new Uint8Array([0,t,0,0,n>>>24&255,n>>>17&255,n>>>8&255,n>>>0&255,0,0,...a]);return Ee.box(Ee.types.dOps,r)}static avc1(e){const t=e.avcc,i=e.codecWidth,n=e.codecHeight,a=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,i>>>8&255,255&i,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return Ee.box(Ee.types.avc1,a,Ee.box(Ee.types.avcC,t))}static hvc1(e){const t=e.hvcc,i=e.codecWidth,n=e.codecHeight,a=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,i>>>8&255,255&i,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return Ee.box(Ee.types.hvc1,a,Ee.box(Ee.types.hvcC,t))}static av01(e){var t,i;const n=e.av1c,a=null!==(t=e.codecWidth)&&void 0!==t?t:192,r=null!==(i=e.codecHeight)&&void 0!==i?i:108,o=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,a>>>8&255,255&a,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return Ee.box(Ee.types.av01,o,Ee.box(Ee.types.av1C,n))}static mvex(e){return Ee.box(Ee.types.mvex,Ee.trex(e))}static trex(e){const t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return Ee.box(Ee.types.trex,i)}static moof(e,t){return Ee.box(Ee.types.moof,Ee.mfhd(e.sequenceNumber),Ee.traf(e,t))}static mfhd(e){const t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return Ee.box(Ee.types.mfhd,t)}static traf(e,t){const i=e.id,n=Ee.box(Ee.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),a=Ee.box(Ee.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),r=Ee.sdtp(e),o=Ee.trun(e,r.byteLength+16+16+8+16+8+8);return Ee.box(Ee.types.traf,n,a,o,r)}static sdtp(e){const t=e.samples||[],i=t.length,n=new Uint8Array(4+i);for(let e=0;e>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*e)}return Ee.box(Ee.types.trun,r)}static mdat(e){return Ee.box(Ee.types.mdat,e)}}Ee.constants={FTYP:new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),STSD_PREFIX:new Uint8Array([0,0,0,0,0,0,0,1]),STTS:Pe,STSC:Pe,STCO:Pe,STSZ:new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),HDLR_VIDEO: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]),HDLR_AUDIO: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]),DREF:new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),SMHD:new Uint8Array([0,0,0,0,0,0,0,0]),VMHD:new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},Ee.init();const Ce=Ee,Te=class{static getSilentFrame(e,t){if("mp4a.40.2"===e){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]);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])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}};var Re=i(68);const we=class{constructor(e){var t;this.TAG="MP4Remuxer",this._fillSilentAfterSeek=!1,this._config=e,this._isLive=!!e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new Re.J1("audio"),this._videoSegmentInfoList=new Re.J1("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!r.Z.chrome||!(r.Z.version&&r.Z.version.major<50||r.Z.version&&50===r.Z.version.major&&((null===(t=r.Z.version)||void 0===t?void 0:t.build)||0)<2661)),this._fillSilentAfterSeek=!(!r.Z.msedge&&!r.Z.msie),this._mp3UseMpegAudio=!r.Z.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}destroy(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}bindDataSource(e){var t;return e.onDataAvailable=null===(t=this.remux)||void 0===t?void 0:t.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}get onInitSegment(){return this._onInitSegment}set onInitSegment(e){this._onInitSegment=e}get onMediaSegment(){return this._onMediaSegment}set onMediaSegment(e){this._onMediaSegment=e}insertDiscontinuity(){this._audioNextDts=this._videoNextDts=void 0}seek(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}remux(e,t){if(!this._onMediaSegment)throw new c.rT("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)}_onTrackMetadataReceived(e,t){let i=null,n="mp4",a=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(n="mpeg",a="",i=new Uint8Array):i=Ce.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=Ce.generateInitSegment(t)}if(!this._onInitSegment)throw new c.rT("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:a,container:`${e}/${n}`,mediaDuration:t.duration})}_calculateDtsBase(e,t){var i,n;this._dtsBaseInited||((null===(i=null==e?void 0:e.samples)||void 0===i?void 0:i.length)&&(this._audioDtsBase=e.samples[0].dts),(null===(n=null==t?void 0:t.samples)||void 0===n?void 0:n.length)&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}getTimestampBase(){if(this._dtsBaseInited)return this._dtsBase}flushStashedSamples(){const e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=null==e?void 0:e.length);const n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(n.samples.push(t),n.length=null==t?void 0:t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(n,!0)}_remuxAudio(e,t){var i,n,o,s,l,c,d;if(null==this._audioMeta)return;const u=e,h=u.samples;let f,x=-1,p=-1;const m=this._audioMeta.refSampleDuration,_="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,g=this._dtsBaseInited&&void 0===this._audioNextDts;let v=!1;if(!h||0===h.length)return;if(1===h.length&&!t)return;let y=0,S=null,b=0;_?(y=0,b=u.length):(y=8,b=8+u.length);let P=null;if(h.length>1&&(P=h.pop(),b-=P.length),null!=this._audioStashedLastSample){const e=this._audioStashedLastSample;this._audioStashedLastSample=null,h.unshift(e),b+=e.length}null!=P&&(this._audioStashedLastSample=P);const E=h[0].dts-this._dtsBase;if(this._audioNextDts)f=E-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())f=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(v=!0);else{const e=this._audioSegmentInfoList.getLastSampleBefore(E);if(null!=e){let t=E-(e.originalDts+e.duration);t<=3&&(t=0),f=E-(e.dts+e.duration+t)}else f=0}if(v){const e=E-f,t=this._videoSegmentInfoList.getLastSegmentBefore(E);if(null!=t&&t.beginDts=t*(m||0)&&this._fillAudioTimestampGap&&!r.Z.safari){u=!0;const t=Math.floor(f/(m||0));a.Z.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: ${n} ms, curRefDts: ${e} ms, dtsCorrection: ${Math.round(f)} ms, generate: ${t} frames`),d=Math.floor(e),_=Math.floor(e+(m||0))-d;let r=Te.getSilentFrame(null===(o=this._audioMeta)||void 0===o?void 0:o.originalCodec,this._audioMeta.channelCount);null==r&&(a.Z.w(this.TAG,`Unable to generate silent frame for ${null===(s=this._audioMeta)||void 0===s?void 0:s.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),r=i),p=[];for(let i=0;i=1?null===(l=C[C.length-1])||void 0===l?void 0:l.duration:Math.floor(m||0),this._audioNextDts=d+_;-1===x&&(x=d),C.push({dts:d,pts:d,cts:0,unit:t.unit,size:null===(c=t.unit)||void 0===c?void 0:c.byteLength,duration:_,originalDts:n,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),u&&C.push.apply(C,p)}}if(0===C.length)return u.samples=[],void(u.length=0);_?S=new Uint8Array(b):(S=new Uint8Array(b),S[0]=b>>>24&255,S[1]=b>>>16&255,S[2]=b>>>8&255,S[3]=255&b,S.set(Ce.types.mdat,4));for(let e=0;e1&&(x=r.pop(),f-=x.length),null!=this._videoStashedLastSample){const e=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(e),f+=(null==e?void 0:e.length)||0}null!=x&&(this._videoStashedLastSample=x);const p=r[0].dts-this._dtsBase;if(this._videoNextDts)o=p-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{const e=this._videoSegmentInfoList.getLastSampleBefore(p);if(null!=e){let t=p-(e.originalDts+e.duration);t<=3&&(t=0),o=p-(e.dts+e.duration+t)}else o=0}const m=new Re.Yy,_=[];for(let e=0;e=1?_[_.length-1].duration:Math.floor((null===(i=this._videoMeta)||void 0===i?void 0:i.refSampleDuration)||0),a){const e=new Re.Wk(l,u,h,t.dts,!0);e.fileposition=t.fileposition,m.appendSyncPoint(e)}_.push({dts:l,pts:u,cts:d,units:t.units,size:t.length,isKeyframe:a,duration:h,originalDts:n,flags:{isLeading:0,dependsOn:a?2:1,isDependedOn:a?1:0,hasRedundancy:0,isNonSync:a?0:1}})}h=new Uint8Array(f),h[0]=f>>>24&255,h[1]=f>>>16&255,h[2]=f>>>8&255,h[3]=255&f,h.set(Ce.types.mdat,4);for(let e=0;e<_.length;e++){const t=_[e].units;for(;null==t?void 0:t.length;){const e=t.shift(),i=null==e?void 0:e.data;h.set(i,u),u+=i.byteLength}}const g=_[_.length-1];if(l=g.dts+g.duration,d=g.pts+g.duration,this._videoNextDts=l,m.beginDts=s,m.endDts=l,m.beginPts=c,m.endPts=d,m.originalBeginDts=_[0].originalDts,m.originalEndDts=g.originalDts+g.duration,m.firstSample=new Re.Wk(_[0].dts,_[0].pts,_[0].duration,_[0].originalDts,!!_[0].isKeyframe),m.lastSample=new Re.Wk(g.dts,g.pts,g.duration,g.originalDts,!!g.isKeyframe),this._isLive||this._videoSegmentInfoList.append(m),a.samples=_,a.sequenceNumber++,this._forceFirstIDR){const e=_[0].flags;e.dependsOn=2,e.isNonSync=0}const v=Ce.moof(a,s);a.samples=[],a.length=0,null===(n=this._onMediaSegment)||void 0===n||n.call(this,"video",{type:"video",data:this._mergeBoxes(v,h).buffer,sampleCount:_.length,info:m})}_mergeBoxes(e,t){const i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i}};var Ie=i(575),De=i(473);const ke=class{constructor(e,t){var i;this.TAG="TransmuxingController",this._emitter=new n.EventEmitter,this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;let a=0;null===(i=this._mediaDataSource.segments)||void 0===i||i.forEach((i=>{i.timestampBase=a,a+=i.duration,i.cors=e.cors,i.withCredentials=e.withCredentials,t.referrerPolicy&&(i.referrerPolicy=t.referrerPolicy)})),isNaN(a)||this._mediaDataSource.duration===a||(this._mediaDataSource.duration=a),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}destroy(){var e,t,i;this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(null===(e=this._ioctl)||void 0===e||e.destroy(),this._ioctl=null),this._demuxer&&(null===(t=this._demuxer)||void 0===t||t.destroy(),this._demuxer=null),this._remuxer&&(null===(i=this._remuxer)||void 0===i||i.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null}on(e,t){this._emitter.addListener(e,t)}off(e,t){this._emitter.removeListener(e,t)}start(){this._loadSegment(0),this._enableStatisticsReporter()}_loadSegment(e,t){var i,n,a;if(this._currentSegmentIndex=e,null===(i=this._mediaDataSource)||void 0===i?void 0:i.segments){const i=null===(n=this._mediaDataSource)||void 0===n?void 0:n.segments[e],r=this._ioctl=new Ie.Z(i,this._config,e);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?null===(a=this._demuxer)||void 0===a||a.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(t)}}stop(){this._internalAbort(),this._disableStatisticsReporter()}_internalAbort(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}pause(){var e;(null===(e=this._ioctl)||void 0===e?void 0:e.isWorking())&&(this._ioctl.pause(),this._disableStatisticsReporter())}resume(){var e;(null===(e=this._ioctl)||void 0===e?void 0:e.isPaused())&&(this._ioctl.resume(),this._enableStatisticsReporter())}seek(e){var t,i,n,a,r,o,s,l,c,d,u,h,f,x;if(null==this._mediaInfo||!(null===(t=this._mediaInfo)||void 0===t?void 0:t.isSeekable()))return;const p=this._searchSegmentIndexContains(e);if(p===this._currentSegmentIndex){const t=(null===(i=this._mediaInfo)||void 0===i?void 0:i.segments)?null===(n=this._mediaInfo)||void 0===n?void 0:n.segments[p]:{};if(void 0===t)this._pendingSeekTime=e;else{const i=null==t?void 0:t.getNearestKeyframe(e);null===(a=this._remuxer)||void 0===a||a.seek(null==i?void 0:i.milliseconds),null===(r=this._ioctl)||void 0===r||r.seek(null==i?void 0:i.fileposition),this._pendingResolveSeekPoint=null==i?void 0:i.milliseconds}}else{const t=(null===(o=this._mediaInfo)||void 0===o?void 0:o.segments)?null===(s=this._mediaInfo)||void 0===s?void 0:s.segments[p]:{};if(void 0===t)this._pendingSeekTime=e,this._internalAbort(),null===(l=this._remuxer)||void 0===l||l.seek(),null===(c=this._remuxer)||void 0===c||c.insertDiscontinuity(),this._loadSegment(p);else{const i=t.getNearestKeyframe(e);this._internalAbort(),null===(d=this._remuxer)||void 0===d||d.seek(e),null===(u=this._remuxer)||void 0===u||u.insertDiscontinuity(),this._demuxer&&(null===(h=this._demuxer)||void 0===h||h.resetMediaInfo(),this._demuxer.timestampBase=(null===(f=this._mediaDataSource)||void 0===f?void 0:f.segments)?null===(x=this._mediaDataSource)||void 0===x?void 0:x.segments[p].timestampBase:0),this._loadSegment(p,null==i?void 0:i.fileposition),this._pendingResolveSeekPoint=null==i?void 0:i.milliseconds,this._reportSegmentMediaInfo(p)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(e){var t;const i=this._mediaDataSource.segments;let n=((null==i?void 0:i.length)||0)-1;if(0===((null==i?void 0:i.length)||0))return n;for(let a=0;a<((null==i?void 0:i.length)||0);a++)if(i&&e<((null===(t=i[a])||void 0===t?void 0:t.timestampBase)||0)){n=a-1;break}return n}_onInitChunkArrival(e,t){var i,n,r,o,s;let l=0;if(t>0)null===(i=this._demuxer)||void 0===i||i.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments?null===(n=this._mediaDataSource.segments[this._currentSegmentIndex])||void 0===n?void 0:n.timestampBase:0,l=(null===(r=this._demuxer)||void 0===r?void 0:r.parseChunks(e,t))||0;else{let i=null;i=T.probe(e),i.match&&(this._setupFLVDemuxerRemuxer(i),l=(null===(o=this._demuxer)||void 0===o?void 0:o.parseChunks(e,t))||0),i.match||(null==i?void 0:i.needMoreData)||(i=be.probe(e),i.match&&(this._setupTSDemuxerRemuxer(i),l=(null===(s=this._demuxer)||void 0===s?void 0:s.parseChunks(e,t))||0)),i.match||(null==i?void 0:i.needMoreData)||(i=null,a.Z.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then((()=>{this._internalAbort()})),this._emitter.emit(De.Z.DEMUX_ERROR,m.Z.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return l}_setupFLVDemuxerRemuxer(e){var t;this._demuxer=new T(e,this._config),this._remuxer||(this._remuxer=new we(this._config));const i=this._mediaDataSource;void 0===i.duration||isNaN(i.duration)||(this._demuxer.overridedDuration=i.duration),"boolean"==typeof i.hasAudio&&(this._demuxer.overridedHasAudio=i.hasAudio),"boolean"==typeof i.hasVideo&&(this._demuxer.overridedHasVideo=i.hasVideo),i.segments&&this._demuxer&&this._remuxer&&(this._demuxer.timestampBase=null===(t=null==i?void 0:i.segments[this._currentSegmentIndex])||void 0===t?void 0:t.timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this))}_setupTSDemuxerRemuxer(e){const t=this._demuxer=new be(e,this._config);this._remuxer||(this._remuxer=new we(this._config)),t.onError=this._onDemuxException.bind(this),t.onMediaInfo=this._onMediaInfo.bind(this),t.onMetaDataArrived=this._onMetaDataArrived.bind(this),t.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),t.onSMPTE2038Metadata=this._onSMPTE2038Metadata.bind(this),t.onSCTE35Metadata=this._onSCTE35Metadata.bind(this),t.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),t.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)}_onMediaInfo(e){var t,i;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=(null===(i=null===(t=this._mediaDataSource)||void 0===t?void 0:t.segments)||void 0===i?void 0:i.length)||0,Object.setPrototypeOf(this._mediaInfo,o.Z.prototype));const n=Object.assign({},e);Object.setPrototypeOf(n,o.Z.prototype),this._mediaInfo.segments&&(this._mediaInfo.segments[this._currentSegmentIndex]=n),this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((()=>{const e=this._pendingSeekTime;this._pendingSeekTime=null,this.seek(e)}))}_onMetaDataArrived(e){this._emitter.emit(De.Z.METADATA_ARRIVED,e)}_onScriptDataArrived(e){this._emitter.emit(De.Z.SCRIPTDATA_ARRIVED,e)}_onTimedID3Metadata(e){var t;const i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.dts&&(e.dts-=i),this._emitter.emit(De.Z.TIMED_ID3_METADATA_ARRIVED,e))}_onSMPTE2038Metadata(e){var t;const i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.dts&&(e.dts-=i),void 0!==e.nearest_pts&&(e.nearest_pts-=i),this._emitter.emit(De.Z.SMPTE2038_METADATA_ARRIVED,e))}_onSCTE35Metadata(e){var t;const i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.nearest_pts&&(e.nearest_pts-=i),this._emitter.emit(De.Z.SCTE35_METADATA_ARRIVED,e))}_onPESPrivateDataDescriptor(e){this._emitter.emit(De.Z.PES_PRIVATE_DATA_DESCRIPTOR,e)}_onPESPrivateData(e){var t;const i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.nearest_pts&&(e.nearest_pts-=i),void 0!==e.dts&&(e.dts-=i),this._emitter.emit(De.Z.PES_PRIVATE_DATA_ARRIVED,e))}_onIOSeeked(){var e;null===(e=this._remuxer)||void 0===e||e.insertDiscontinuity()}_onIOComplete(e){var t,i;const n=e+1;n<((null===(i=null===(t=this._mediaDataSource)||void 0===t?void 0:t.segments)||void 0===i?void 0:i.length)||0)?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(n)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(De.Z.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(e){var t;const i=null===(t=this._ioctl)||void 0===t?void 0:t.extraData;this._mediaDataSource.segments&&(this._mediaDataSource.segments[i].redirectedURL=e)}_onIORecoveredEarlyEof(){this._emitter.emit(De.Z.RECOVERED_EARLY_EOF)}_onIOException(e,t){a.Z.e(this.TAG,`IOException: type = ${e}, code = ${t.code}, msg = ${t.msg}`),this._emitter.emit(De.Z.IO_ERROR,e,t),this._disableStatisticsReporter()}_onDemuxException(e,t){a.Z.e(this.TAG,`DemuxException: type = ${e}, info = ${t}`),this._emitter.emit(De.Z.DEMUX_ERROR,e,t)}_onRemuxerInitSegmentArrival(e,t){this._emitter.emit(De.Z.INIT_SEGMENT,e,t)}_onRemuxerMediaSegmentArrival(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(De.Z.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){const e=t.info.syncPoints;let i=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,r.Z.safari&&e.length>0&&e[0].originalDts===i&&(i=e[0].pts),this._emitter.emit(De.Z.RECOMMEND_SEEKPOINT,i)}}_enableStatisticsReporter(){null==this._statisticsReporter&&this._reportStatisticsInfo&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}_disableStatisticsReporter(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}_reportSegmentMediaInfo(e){var t,i,n,a;const r=(null===(t=this._mediaInfo)||void 0===t?void 0:t.segments)?null===(i=this._mediaInfo)||void 0===i?void 0:i.segments[e]:{},o=Object.assign({},r);o.duration=null===(n=this._mediaInfo)||void 0===n?void 0:n.duration,o.segmentCount=null===(a=this._mediaInfo)||void 0===a?void 0:a.segmentCount,delete o.segments,delete o.keyframesIndex,this._emitter.emit(De.Z.MEDIA_INFO,o)}_reportStatisticsInfo(){var e,t,i,n,a,r;const o={};o.url=null===(e=this._ioctl)||void 0===e?void 0:e.currentURL,o.hasRedirect=null===(t=this._ioctl)||void 0===t?void 0:t.hasRedirect,o.hasRedirect&&(o.redirectedURL=null===(i=this._ioctl)||void 0===i?void 0:i.currentRedirectedURL),o.speed=null===(n=this._ioctl)||void 0===n?void 0:n.currentSpeed,o.loaderType=null===(a=this._ioctl)||void 0===a?void 0:a.loaderType,o.currentSegmentIndex=this._currentSegmentIndex,o.totalSegmentCount=null===(r=this._mediaDataSource.segments)||void 0===r?void 0:r.length,this._emitter.emit(De.Z.STATISTICS_INFO,o)}}},473:(e,t,i)=>{i.d(t,{Z:()=>n});const n={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},638:(e,t,i)=>{var n=i(278),a=i(943),r=i(473);let o=null;const s=function(e,t){self.postMessage({msg:"logcat_callback",data:{type:e,logcat:t}})};function l(e,t){const i={msg:r.Z.INIT_SEGMENT,data:{type:e,data:t}};self.postMessage(i,[t.data])}function c(e,t){const i={msg:r.Z.MEDIA_SEGMENT,data:{type:e,data:t}};self.postMessage(i,[t.data])}function d(){const e={msg:r.Z.LOADING_COMPLETE};self.postMessage(e)}function u(){const e={msg:r.Z.RECOVERED_EARLY_EOF};self.postMessage(e)}function h(e){const t={msg:r.Z.MEDIA_INFO,data:e};self.postMessage(t)}function f(e){const t={msg:r.Z.METADATA_ARRIVED,data:e};self.postMessage(t)}function x(e){const t={msg:r.Z.SCRIPTDATA_ARRIVED,data:e};self.postMessage(t)}function p(e){const t={msg:r.Z.TIMED_ID3_METADATA_ARRIVED,data:e};self.postMessage(t)}function m(e){const t={msg:r.Z.SMPTE2038_METADATA_ARRIVED,data:e};self.postMessage(t)}function _(e){const t={msg:r.Z.SCTE35_METADATA_ARRIVED,data:e};self.postMessage(t)}function g(e){const t={msg:r.Z.PES_PRIVATE_DATA_DESCRIPTOR,data:e};self.postMessage(t)}function v(e){const t={msg:r.Z.PES_PRIVATE_DATA_ARRIVED,data:e};self.postMessage(t)}function y(e){const t={msg:r.Z.STATISTICS_INFO,data:e};self.postMessage(t)}function S(e,t){self.postMessage({msg:r.Z.IO_ERROR,data:{type:e,info:t}})}function b(e,t){self.postMessage({msg:r.Z.DEMUX_ERROR,data:{type:e,info:t}})}function P(e){self.postMessage({msg:r.Z.RECOMMEND_SEEKPOINT,data:e})}self.addEventListener("message",(function(e){switch(e.data.cmd){case"init":o=new a.Z(e.data.param[0],e.data.param[1]),o.on(r.Z.IO_ERROR,S),o.on(r.Z.DEMUX_ERROR,b),o.on(r.Z.INIT_SEGMENT,l),o.on(r.Z.MEDIA_SEGMENT,c),o.on(r.Z.LOADING_COMPLETE,d),o.on(r.Z.RECOVERED_EARLY_EOF,u),o.on(r.Z.MEDIA_INFO,h),o.on(r.Z.METADATA_ARRIVED,f),o.on(r.Z.SCRIPTDATA_ARRIVED,x),o.on(r.Z.TIMED_ID3_METADATA_ARRIVED,p),o.on(r.Z.SMPTE2038_METADATA_ARRIVED,m),o.on(r.Z.SCTE35_METADATA_ARRIVED,_),o.on(r.Z.PES_PRIVATE_DATA_DESCRIPTOR,g),o.on(r.Z.PES_PRIVATE_DATA_ARRIVED,v),o.on(r.Z.STATISTICS_INFO,y),o.on(r.Z.RECOMMEND_SEEKPOINT,P);break;case"destroy":o&&(o.destroy(),o=null),self.postMessage({msg:"destroyed"});break;case"start":null==o||o.start();break;case"stop":null==o||o.stop();break;case"seek":null==o||o.seek(e.data.param);break;case"pause":null==o||o.pause();break;case"resume":null==o||o.resume();break;case"logging_config":{const t=e.data.param;n.Z.applyConfig(t),!0===t.enableCallback?n.Z.addLogListener(s):n.Z.removeLogListener(s);break}}}))},898:(e,t,i)=>{i.d(t,{Z:()=>n});const n={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},578:(e,t,i)=>{i.d(t,{default:()=>U});var n=i(575);const a={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0,url:void 0,redirectedURL:void 0,cors:!1};function r(){return Object.assign({},a)}class o{static supportMSEH264Playback(){var e;return null===(e=window.MediaSource)||void 0===e?void 0:e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}static supportMSEH265Playback(){var e;return null===(e=window.MediaSource)||void 0===e?void 0:e.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"')}static supportNetworkStreamIO(){const e=new n.Z({},r()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"===t||"xhr-moz-chunked-loader"===t}static getNetworkLoaderTypeName(){const e=new n.Z({},r()),t=e.loaderType;return e.destroy(),t}static supportNativeMediaPlayback(e){void 0===o.videoElement&&(o.videoElement=window.document.createElement("video"));const t=o.videoElement.canPlayType(e);return"probably"===t||"maybe"===t}static getFeatureList(){const e={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return e.msePlayback=o.supportMSEH264Playback(),e.networkStreamIO=o.supportNetworkStreamIO(),e.networkLoaderName=o.getNetworkLoaderTypeName()||"",e.mseLivePlayback=e.msePlayback&&e.networkStreamIO,e.mseH265Playback=o.supportMSEH265Playback(),e.nativeMP4H264Playback=o.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),e.nativeMP4H265Playback=o.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),e.nativeWebmVP8Playback=o.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),e.nativeWebmVP9Playback=o.supportNativeMediaPlayback('video/webm; codecs="vp9"'),e}}const s=o;var l=i(108),c=i(99),d=i(645),u=i(479);const h={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info"},f=function(){const e=ENTRY_MODULE,t={};function i(n){if(t[n])return t[n].exports;const a=t[n]={exports:{}};return e[n](a,a.exports,i),a.exports}i.m=e,i.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(const n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("[object Object]"===Object.prototype.toString.call(globalThis))return globalThis;try{return this||new Function("return this")()}catch(e){if("[object Object]"===Object.prototype.toString.call(window))return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};const n=i(ENTRY_MODULE);return n.default||n};f.toString();const x="[\\.|\\-|\\+|\\w|/|@]+",p="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+x+").*?\\)";function m(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function _(e,t,n){const a={};a[n]=[];const r=t.toString(),o=r.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||r.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!o)return a;const s=o[1];let l,c=new RegExp("(\\\\n|\\W)"+m(s)+p,"g");for(;l=c.exec(r);)"dll-reference"!==l[3]&&a[n].push(l[3]);for(c=new RegExp("\\("+m(s)+'\\("(dll-reference\\s('+x+'))"\\)\\)'+p,"g");l=c.exec(r);)e[l[2]]||(a[n].push(l[1]),e[l[2]]=i(l[1]).m),a[l[2]]=a[l[2]]||[],a[l[2]].push(l[4]);const d=Object.keys(a);for(let e=0;et||e[i].length>0),!1)}function v(e,t,i,n){const a=e[n].map((e=>`"${e}": ${t[n][e].toString()}`)).join(","),r=f.toString().split("ENTRY_MODULE");return`${r[0]}{${a}}${r[1]}"${i}"${r[2]}`}var y=i(278),S=i(943),b=i(473),P=i(994);const E=class{constructor(e,t){if(this.TAG="Transmuxer",this._workerDestroying=!1,this._controller=null,this._emitter=new c.EventEmitter,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=this._worker=function(e,t){t=t||{};const n={main:i.m},a=t.all?{main:Object.keys(n.main)}:function(e,t){const i={main:[t]},n={main:[]},a={main:{}};for(;g(i);){const t=Object.keys(i);for(let r=0;r"main"!==e)).forEach((e=>{let t=0;for(;a[e][t];)t++;a[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",r+=`var ${e} = (${v(a,n,t,modules)})();\n`})),r+=`(${v(a,n,e,"main")})();`;const o=new window.Blob([r],{type:"text/javascript"});if(t.bare)return o;const s=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(o),l=new window.Worker(s);return l.objectURL=s,l}(638),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},y.Z.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:y.Z.getConfig()})}catch(i){d.Z.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new S.Z(e,t)}else this._controller=new S.Z(e,t);if(this._controller){const e=this._controller;null==e||e.on(b.Z.IO_ERROR,this._onIOError.bind(this)),null==e||e.on(b.Z.DEMUX_ERROR,this._onDemuxError.bind(this)),null==e||e.on(b.Z.INIT_SEGMENT,this._onInitSegment.bind(this)),null==e||e.on(b.Z.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),null==e||e.on(b.Z.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),null==e||e.on(b.Z.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),null==e||e.on(b.Z.MEDIA_INFO,this._onMediaInfo.bind(this)),null==e||e.on(b.Z.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),null==e||e.on(b.Z.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),null==e||e.on(b.Z.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),null==e||e.on(b.Z.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),null==e||e.on(b.Z.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),null==e||e.on(b.Z.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),null==e||e.on(b.Z.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),null==e||e.on(b.Z.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),null==e||e.on(b.Z.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){var e;this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),y.Z.removeListener(this.e.onLoggingConfigChanged),this.e=null):(null===(e=this._controller)||void 0===e||e.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}on(e,t){this._emitter.addListener(e,t)}off(e,t){this._emitter.removeListener(e,t)}hasWorker(){return null!=this._worker}open(){var e;this._worker?this._worker.postMessage({cmd:"start"}):null===(e=this._controller)||void 0===e||e.start()}close(){var e;this._worker?this._worker.postMessage({cmd:"stop"}):null===(e=this._controller)||void 0===e||e.stop()}seek(e){var t;this._worker?this._worker.postMessage({cmd:"seek",param:e}):null===(t=this._controller)||void 0===t||t.seek(e)}pause(){var e;this._worker?this._worker.postMessage({cmd:"pause"}):null===(e=this._controller)||void 0===e||e.pause()}resume(){var e;this._worker?this._worker.postMessage({cmd:"resume"}):null===(e=this._controller)||void 0===e||e.resume()}_onInitSegment(e,t){Promise.resolve().then((()=>{this._emitter.emit(b.Z.INIT_SEGMENT,e,t)}))}_onMediaSegment(e,t){Promise.resolve().then((()=>{this._emitter.emit(b.Z.MEDIA_SEGMENT,e,t)}))}_onLoadingComplete(){Promise.resolve().then((()=>{this._emitter.emit(b.Z.LOADING_COMPLETE)}))}_onRecoveredEarlyEof(){Promise.resolve().then((()=>{this._emitter.emit(b.Z.RECOVERED_EARLY_EOF)}))}_onMediaInfo(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.MEDIA_INFO,e)}))}_onMetaDataArrived(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.METADATA_ARRIVED,e)}))}_onScriptDataArrived(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.SCRIPTDATA_ARRIVED,e)}))}_onTimedID3MetadataArrived(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.TIMED_ID3_METADATA_ARRIVED,e)}))}_onSMPTE2038MetadataArrived(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.SMPTE2038_METADATA_ARRIVED,e)}))}_onSCTE35MetadataArrived(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.SCTE35_METADATA_ARRIVED,e)}))}_onPESPrivateDataDescriptor(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.PES_PRIVATE_DATA_DESCRIPTOR,e)}))}_onPESPrivateDataArrived(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.PES_PRIVATE_DATA_ARRIVED,e)}))}_onStatisticsInfo(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.STATISTICS_INFO,e)}))}_onIOError(e,t){Promise.resolve().then((()=>{this._emitter.emit(b.Z.IO_ERROR,e,t)}))}_onDemuxError(e,t){Promise.resolve().then((()=>{this._emitter.emit(b.Z.DEMUX_ERROR,e,t)}))}_onRecommendSeekpoint(e){Promise.resolve().then((()=>{this._emitter.emit(b.Z.RECOMMEND_SEEKPOINT,e)}))}_onLoggingConfigChanged(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})}_onWorkerMessage(e){const t=e.data,i=null==t?void 0:t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case b.Z.INIT_SEGMENT:case b.Z.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case b.Z.LOADING_COMPLETE:case b.Z.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case b.Z.MEDIA_INFO:Object.setPrototypeOf(i,P.Z.prototype),this._emitter.emit(t.msg,i);break;case b.Z.METADATA_ARRIVED:case b.Z.SCRIPTDATA_ARRIVED:case b.Z.TIMED_ID3_METADATA_ARRIVED:case b.Z.SMPTE2038_METADATA_ARRIVED:case b.Z.SCTE35_METADATA_ARRIVED:case b.Z.PES_PRIVATE_DATA_DESCRIPTOR:case b.Z.PES_PRIVATE_DATA_ARRIVED:case b.Z.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case b.Z.IO_ERROR:case b.Z.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case b.Z.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":d.Z.emitter.emit("log",i.type,i.logcat)}}},C="error",T="source_open",R="update_end",w="buffer_full";var I=i(68),D=i(411);const k=class{constructor(e){this.TAG="MSEController",this._config=e,this._emitter=new c.EventEmitter,this._config.isLive&&void 0===this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new I.Vn}destroy(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}on(e,t){this._emitter.addListener(e,t)}off(e,t){this._emitter.removeListener(e,t)}attachMediaElement(e){if(this._mediaSource)throw new D.rT("MediaSource has been attached to an HTMLMediaElement!");const t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL}detachMediaElement(){if(this._mediaSource){const e=this._mediaSource;for(const t in this._sourceBuffers){const i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;const n=this._sourceBuffers[t];if(n){if("closed"!==e.readyState){try{e.removeSourceBuffer(n)}catch(e){d.Z.e(this.TAG,e.message)}null==n||n.removeEventListener("error",this.e.onSourceBufferError),null==n||n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){d.Z.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}appendInitSegment(e,t){var i;if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);const n=e;let a=`${n.container}`;n.codec&&n.codec.length>0&&(a+=`;codecs=${n.codec}`);let r=!1;if(d.Z.v(this.TAG,"Received Initialization Segment, mimeType: "+a),this._lastInitSegments[n.type]=n,a!==this._mimeTypes[n.type]){if(this._mimeTypes[n.type])d.Z.v(this.TAG,`Notice: ${n.type} mimeType changed, origin: ${this._mimeTypes[n.type]||""}, target: ${a}`);else{r=!0;try{const e=this._sourceBuffers[n.type]=this._mediaSource.addSourceBuffer(a);e.addEventListener("error",this.e.onSourceBufferError),e.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return d.Z.e(this.TAG,e.message),void this._emitter.emit(C,{code:e.code,msg:e.message})}}this._mimeTypes[n.type]=a}t||this._pendingSegments[n.type].push(n),r||this._sourceBuffers[n.type]&&!(null===(i=this._sourceBuffers[n.type])||void 0===i?void 0:i.updating)&&this._doAppendSegments(),u.Z.safari&&"audio/mpeg"===n.container&&n.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=n.mediaDuration/1e3,this._updateMediaSourceDuration())}appendMediaSegment(e){const t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();const i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}seek(e){var t,i;for(const n in this._sourceBuffers){if(!this._sourceBuffers[n])continue;const a=this._sourceBuffers[n];if("open"===(null===(t=this._mediaSource)||void 0===t?void 0:t.readyState))try{null==a||a.abort()}catch(e){d.Z.e(this.TAG,e.message)}this._idrList.clear();const r=this._pendingSegments[n];if(r.splice(0,r.length),"closed"!==(null===(i=this._mediaSource)||void 0===i?void 0:i.readyState)){if(a){for(let e=0;e=1&&i-e.start(0)>=((null===(t=this._config)||void 0===t?void 0:t.autoCleanupMaxBackwardDuration)||0))return!0}}return!1}_doCleanupSourceBuffer(){var e,t,i;const n=null===(e=this._mediaElement)||void 0===e?void 0:e.currentTime;for(const e in this._sourceBuffers){const a=this._sourceBuffers[e];if(a){const r=a.buffered;let o=!1;for(let a=0;a=((null===(t=this._config)||void 0===t?void 0:t.autoCleanupMaxBackwardDuration)||0)){o=!0;const t=n-((null===(i=this._config)||void 0===i?void 0:i.autoCleanupMinBackwardDuration)||0);this._pendingRemoveRanges[e].push({start:s,end:t})}}else l0&&(isNaN(r)||o>r)&&(d.Z.v(this.TAG,`Update MediaSource duration from ${r} to ${o}`),this._mediaSource.duration=o),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}_doRemoveRanges(){var e;for(const t in this._pendingRemoveRanges){if(!this._sourceBuffers[t]||(null===(e=this._sourceBuffers[t])||void 0===e?void 0:e.updating))continue;const i=this._sourceBuffers[t],n=this._pendingRemoveRanges[t];for(;n.length&&!(null==i?void 0:i.updating);){const e=n.shift();null==i||i.remove(e.start,e.end)}}}_doAppendSegments(){var e,t,i;const n=this._pendingSegments;for(const a in n)if(this._sourceBuffers[a]&&!(null===(e=this._sourceBuffers[a])||void 0===e?void 0:e.updating)&&n[a].length>0){const e=n[a].shift();if(null==e?void 0:e.timestampOffset){const i=(null===(t=this._sourceBuffers[a])||void 0===t?void 0:t.timestampOffset)||0,n=e.timestampOffset/1e3;Math.abs(i-n)>.1&&(d.Z.v(this.TAG,`Update MPEG audio timestampOffset from ${i} to ${n}`),this._sourceBuffers[a]&&(this._sourceBuffers[a].timestampOffset=n)),delete e.timestampOffset}if(!e.data||0===e.data.byteLength)continue;try{null===(i=this._sourceBuffers[a])||void 0===i||i.appendBuffer(e.data),this._isBufferFull=!1,"video"===a&&e.hasOwnProperty("info")&&this._idrList.appendArray(e.info.syncPoints)}catch(t){this._pendingSegments[a].unshift(e),22===t.code?(this._isBufferFull||this._emitter.emit(w),this._isBufferFull=!0):(d.Z.e(this.TAG,t.message),this._emitter.emit(C,{code:t.code,msg:t.message}))}}}_onSourceOpen(){var e;if(d.Z.v(this.TAG,"MediaSource onSourceOpen"),null===(e=this._mediaSource)||void 0===e||e.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0){const e=this._pendingSourceBufferInit;for(;e.length;){const t=e.shift();this.appendInitSegment(t,!0)}}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(T)}_onSourceEnded(){d.Z.v(this.TAG,"MediaSource onSourceEnded")}_onSourceClose(){d.Z.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}_hasPendingSegments(){const e=this._pendingSegments;return e.video.length>0||e.audio.length>0}_hasPendingRemoveRanges(){const e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0}_onSourceBufferUpdateEnd(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(R)}_onSourceBufferError(e){d.Z.e(this.TAG,`SourceBuffer Error: ${e}`)}};var F=i(898);const A={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},M={NETWORK_EXCEPTION:l.nm.EXCEPTION,NETWORK_STATUS_CODE_INVALID:l.nm.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:l.nm.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:l.nm.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:F.Z.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:F.Z.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:F.Z.CODEC_UNSUPPORTED};const L=class{constructor(e,t){var i,n,a;this.TAG="MSEPlayer",this._type="MSEPlayer",this._emitter=new c.EventEmitter,this._config=r(),"object"==typeof t&&Object.assign(this._config,t);const o=e.type.toLowerCase();if("mse"!==o&&"mpegts"!==o&&"m2ts"!==o&&"flv"!==o)throw new D.OC("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");e.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;const s=u.Z.chrome&&(u.Z.version&&(null===(i=u.Z.version)||void 0===i?void 0:i.major)<50||u.Z.version&&50===(null===(n=null===u.Z||void 0===u.Z?void 0:u.Z.version)||void 0===n?void 0:n.major)&&((null===(a=null===u.Z||void 0===u.Z?void 0:u.Z.version)||void 0===a?void 0:a.build)||-1)<2661);this._alwaysSeekKeyframe=!!(s||u.Z.msedge||u.Z.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}destroy(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(e,t){e===h.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((()=>{this._emitter.emit(h.MEDIA_INFO,this.mediaInfo)})):e===h.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((()=>{this._emitter.emit(h.STATISTICS_INFO,this.statisticsInfo)})),this._emitter.addListener(e,t)}off(e,t){this._emitter.removeListener(e,t)}attachMediaElement(e){var t,i,n,a,r;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new k(this._config),null===(t=this._msectl)||void 0===t||t.on(R,this._onmseUpdateEnd.bind(this)),null===(i=this._msectl)||void 0===i||i.on(w,this._onmseBufferFull.bind(this)),null===(n=this._msectl)||void 0===n||n.on(T,(()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())})),null===(a=this._msectl)||void 0===a||a.on(C,(e=>{this._emitter.emit(h.ERROR,A.MEDIA_ERROR,M.MEDIA_MSE_ERROR,e)})),null===(r=this._msectl)||void 0===r||r.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}detachMediaElement(){var e;this._mediaElement&&(null===(e=this._msectl)||void 0===e||e.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}load(){if(!this._mediaElement)throw new D.rT("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new D.rT("MSEPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(!this._config.deferLoadAfterSourceOpen||this._mseSourceOpened?(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new E(this._mediaDataSource,this._config),this._transmuxer.on(b.Z.INIT_SEGMENT,((e,t)=>{var i;null===(i=this._msectl)||void 0===i||i.appendInitSegment(t)})),this._transmuxer.on(b.Z.MEDIA_SEGMENT,((e,t)=>{var i,n,a;if(null===(i=this._msectl)||void 0===i||i.appendMediaSegment(t),this._config.lazyLoad&&!this._config.isLive){const e=null===(n=this._mediaElement)||void 0===n?void 0:n.currentTime;t.info.endDts>=1e3*(e+((null===(a=this._config)||void 0===a?void 0:a.lazyLoadMaxDuration)||0))&&null==this._progressChecker&&(d.Z.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}})),this._transmuxer.on(b.Z.LOADING_COMPLETE,(()=>{var e;null===(e=this._msectl)||void 0===e||e.endOfStream(),this._emitter.emit(h.LOADING_COMPLETE)})),this._transmuxer.on(b.Z.RECOVERED_EARLY_EOF,(()=>{this._emitter.emit(h.RECOVERED_EARLY_EOF)})),this._transmuxer.on(b.Z.IO_ERROR,((e,t)=>{this._emitter.emit(h.ERROR,A.NETWORK_ERROR,e,t)})),this._transmuxer.on(b.Z.DEMUX_ERROR,((e,t)=>{this._emitter.emit(h.ERROR,A.MEDIA_ERROR,e,{code:-1,msg:t})})),this._transmuxer.on(b.Z.MEDIA_INFO,(e=>{this._mediaInfo=e,this._emitter.emit(h.MEDIA_INFO,Object.assign({},e))})),this._transmuxer.on(b.Z.METADATA_ARRIVED,(e=>{this._emitter.emit(h.METADATA_ARRIVED,e)})),this._transmuxer.on(b.Z.SCRIPTDATA_ARRIVED,(e=>{this._emitter.emit(h.SCRIPTDATA_ARRIVED,e)})),this._transmuxer.on(b.Z.TIMED_ID3_METADATA_ARRIVED,(e=>{this._emitter.emit(h.TIMED_ID3_METADATA_ARRIVED,e)})),this._transmuxer.on(b.Z.SMPTE2038_METADATA_ARRIVED,(e=>{this._emitter.emit(h.SMPTE2038_METADATA_ARRIVED,e)})),this._transmuxer.on(b.Z.SCTE35_METADATA_ARRIVED,(e=>{this._emitter.emit(h.SCTE35_METADATA_ARRIVED,e)})),this._transmuxer.on(b.Z.PES_PRIVATE_DATA_DESCRIPTOR,(e=>{this._emitter.emit(h.PES_PRIVATE_DATA_DESCRIPTOR,e)})),this._transmuxer.on(b.Z.PES_PRIVATE_DATA_ARRIVED,(e=>{this._emitter.emit(h.PES_PRIVATE_DATA_ARRIVED,e)})),this._transmuxer.on(b.Z.STATISTICS_INFO,(e=>{this._statisticsInfo=this._fillStatisticsInfo(e),this._emitter.emit(h.STATISTICS_INFO,Object.assign({},this._statisticsInfo))})),this._transmuxer.on(b.Z.RECOMMEND_SEEKPOINT,(e=>{this._mediaElement&&!this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e/1e3)})),this._transmuxer.open()):this._hasPendingLoad=!0)}unload(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}play(){var e;return function(e,t,i,n){return new(i||(i=Promise))((function(a,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){return yield null===(e=this._mediaElement)||void 0===e?void 0:e.play()}))}pause(){var e;null===(e=this._mediaElement)||void 0===e||e.pause()}get type(){return this._type}get buffered(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.buffered}get duration(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.duration}get volume(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.volume}set volume(e){this._mediaElement&&(this._mediaElement.volume=e)}get muted(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.muted}set muted(e){this._mediaElement&&(this._mediaElement.muted=e)}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e}get mediaInfo(){return Object.assign({},this._mediaInfo)}get statisticsInfo(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}_fillStatisticsInfo(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;let t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){const e=this._mediaElement.getVideoPlaybackQuality();i=e.totalVideoFrames,n=e.droppedVideoFrames}else void 0!==this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e}_onmseUpdateEnd(){var e,t,i,n;const a=null===(e=this._mediaElement)||void 0===e?void 0:e.buffered,r=(null===(t=this._mediaElement)||void 0===t?void 0:t.currentTime)||0;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&(null==a?void 0:a.length)>0&&!(null===(i=this._mediaElement)||void 0===i?void 0:i.paused)){const e=a.end(a.length-1);if(e>((null===(n=this._config)||void 0===n?void 0:n.liveBufferLatencyMaxLatency)||0)&&e-r>(this._config.liveBufferLatencyMaxLatency||0)){const t=e-(this._config.liveBufferLatencyMinRemain||0);this.currentTime=t}}if(!this._config.lazyLoad||this._config.isLive)return;let o=0;for(let e=0;e=r+(this._config.lazyLoadMaxDuration||0)&&null==this._progressChecker&&(d.Z.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}_onmseBufferFull(){d.Z.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()}_suspendTransmuxer(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}_checkProgressAndResume(){var e,t,i;const n=(null===(e=this._mediaElement)||void 0===e?void 0:e.currentTime)||0,a=null===(t=this._mediaElement)||void 0===t?void 0:t.buffered;let r=!1;for(let e=0;e=t&&n=i-(this._config.lazyLoadRecoverDuration||0)&&(r=!0);break}}r&&(window.clearInterval(this._progressChecker),this._progressChecker=null,r&&(d.Z.v(this.TAG,"Continue loading from paused position"),null===(i=this._transmuxer)||void 0===i||i.resume()))}_isTimepointBuffered(e){var t;const i=null===(t=this._mediaElement)||void 0===t?void 0:t.buffered;for(let t=0;t=n&&e0){const t=(null===(i=this._mediaElement)||void 0===i?void 0:i.buffered).start(0);(t<1&&e0&&t.currentTime0){const e=r.start(0);if(e<1&&a{this._emitter.emit(h.MEDIA_INFO,this.mediaInfo)})):e===h.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((()=>{this._emitter.emit(h.STATISTICS_INFO,this.statisticsInfo)})),this._emitter.addListener(e,t)}off(e,t){this._emitter.removeListener(e,t)}attachMediaElement(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}detachMediaElement(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}load(){var e;if(!this._mediaElement)throw new D.rT("HTMLMediaElement must be attached before load()!");this._mediaElement.src=(null===(e=this._mediaDataSource)||void 0===e?void 0:e.url)||"",this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}unload(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}play(){var e;return function(e,t,i,n){return new(i||(i=Promise))((function(a,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){return yield null===(e=this._mediaElement)||void 0===e?void 0:e.play()}))}pause(){var e;null===(e=this._mediaElement)||void 0===e||e.pause()}get type(){return this._type}get buffered(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.buffered}get duration(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.duration}get volume(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.volume}set volume(e){this._mediaElement&&(this._mediaElement.volume=e)}get muted(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.muted}set muted(e){this._mediaElement&&(this._mediaElement.muted=e)}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e}get mediaInfo(){const e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e}get statisticsInfo(){const e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;let t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){const e=this._mediaElement.getVideoPlaybackQuality();i=e.totalVideoFrames,n=e.droppedVideoFrames}else void 0!==this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e}_onvLoadedMetadata(e){null!=this._pendingSeekTime&&(this._mediaElement&&(this._mediaElement.currentTime=this._pendingSeekTime),this._pendingSeekTime=null),this._emitter.emit(h.MEDIA_INFO,this.mediaInfo)}_reportStatisticsInfo(){this._emitter.emit(h.STATISTICS_INFO,this.statisticsInfo)}},O={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32},j=["h264","h265"],N={createPlayer:function(e,t){(null==e?void 0:e.url)&&(e.url=(e=>{const t=e.split("?"),i=new URLSearchParams(t[1]);return i.delete("vc"),i.set("vc",j.reduce(((e,t)=>e+(O[t]||0)),0).toString()),t[0]+"?"+i.toString()})(e.url));const i=e;if(null==i||"object"!=typeof i)throw new D.OC("MediaDataSource must be an javascript object!");if(!Object.prototype.hasOwnProperty.call(i,"type"))throw new D.OC("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"mse":case"mpegts":case"m2ts":case"flv":return new L(i,t);default:return new B(i,t)}},isSupported:function(){return s.supportMSEH264Playback()},getFeatureList:function(){return s.getFeatureList()},BaseLoader:l.fp,LoaderStatus:l.GM,LoaderErrors:l.nm,version:"",Events:h,ErrorTypes:A,ErrorDetails:M,MSEPlayer:L,NativePlayer:B,LoggingControl:y.Z};Object.defineProperty(N,"version",{enumerable:!0,get:function(){return"2.0.0"}});const U=N},607:(e,t,i)=>{e.exports=i(578).default},575:(e,t,i)=>{i.d(t,{Z:()=>g});var n=i(645);const a=class{constructor(){var e;this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,(null===(e=self.performance)||void 0===e?void 0:e.now)?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let e=(this._now()-this._lastCheckpoint)/1e3;return 0===e&&(e=1),this._intervalBytes/e/1024}get lastSecondKBps(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}get averageKBps(){const e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024}};var r=i(108),o=i(479),s=i(411);class l extends r.fp{static isSupported(){var e;try{const t=o.Z.msedge&&((null===(e=null===o.Z||void 0===o.Z?void 0:o.Z.version)||void 0===e?void 0:e.minor)||0)>=15048&&!o.Z.webkit,i=!o.Z.msedge||t;return self.fetch&&self.ReadableStream&&i}catch(e){return!1}}constructor(e,t){super("fetch-stream-loader"),this.TAG="FetchStreamLoader",this._seekHandler=e,this._config=t,this._needStash=!0,this._requestAbort=!1,this._abortController=null,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),super.destroy()}open(e,t){this._dataSource=e,this._range=t;let i=e.url;this._config.reuseRedirectedURL&&void 0!==e.redirectedURL&&(i=e.redirectedURL);const n=this._seekHandler.getConfig(i,t),a=new self.Headers;if("object"==typeof n.headers){const e=n.headers;for(const t in e)e.hasOwnProperty(t)&&a.append(t,e[t])}const o={method:"GET",headers:a,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(const e in this._config.headers)a.append(e,this._config.headers[e]);e.cors||(o.mode="same-origin"),e.withCredentials&&(o.credentials="include"),(null==e?void 0:e.referrerPolicy)&&(o.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,this._abortController&&(o.signal=this._abortController.signal)),this._status=r.GM.kConnecting,self.fetch(n.url,o).then((e=>{var t,i;if(this._requestAbort)return this._status=r.GM.kIdle,void(null===(t=e.body)||void 0===t||t.cancel());if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==n.url&&this._onURLRedirect){const t=this._seekHandler.removeURLParameters(e.url);this._onURLRedirect(t)}const t=e.headers.get("Content-Length");return null!=t&&(this._contentLength=parseInt(t),0!==this._contentLength&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,null===(i=e.body)||void 0===i?void 0:i.getReader())}if(this._status=r.GM.kError,!this._onError)throw new s.OZ("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);this._onError(r.nm.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((e=>{var t;if(!(null===(t=this._abortController)||void 0===t?void 0:t.signal.aborted)){if(this._status=r.GM.kError,!this._onError)throw e;this._onError(r.nm.EXCEPTION,{code:-1,msg:e.message})}}))}abort(){var e;if(this._requestAbort=!0,(this._status!==r.GM.kBuffering||!o.Z.chrome)&&this._abortController)try{null===(e=this._abortController)||void 0===e||e.abort()}catch(e){}}_pump(e){return e.read().then((t=>{var i,n,a,o;if(t.done)if(null!==this._contentLength&&this._receivedLength{var t,i;if(null===(i=null===(t=this._abortController)||void 0===t?void 0:t.signal)||void 0===i?void 0:i.aborted)return void(this._status=r.GM.kComplete);if(11===e.code&&o.Z.msedge)return;this._status=r.GM.kError;let n=0,a=null;if(19!==e.code&&"network error"!==e.message||!(null===this._contentLength||null!==this._contentLength&&this._receivedLength299)){if(this._status=r.GM.kError,!this._onError)throw new s.OZ("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(r.nm.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=r.GM.kBuffering}}_onProgress(e){var t;if(this._status===r.GM.kError)return;null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));const i=e.target.response,n=((null===(t=this._range)||void 0===t?void 0:t.from)||0)+this._receivedLength;this._receivedLength+=i.byteLength,this._onDataArrival&&this._onDataArrival(i,n,this._receivedLength)}_onLoadEnd(e){this._requestAbort?this._requestAbort=!1:this._status!==r.GM.kError&&(this._status=r.GM.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}_onXhrError(e){this._status=r.GM.kError;let t=0,i=null;if(this._contentLength&&e.loaded=this._contentLength&&(a=((null===(t=this._range)||void 0===t?void 0:t.from)||0)+this._contentLength-1),this._currentRequestRange={from:n,to:a},this._internalOpen(this._dataSource,this._currentRequestRange)}_internalOpen(e,t){this._lastTimeLoaded=0;let i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));const n=this._seekHandler.getConfig(i,t);this._currentRequestURL=n.url;const a=this._xhr=new XMLHttpRequest;if(a.open("GET",n.url,!0),a.responseType="arraybuffer",a.onreadystatechange=this._onReadyStateChange.bind(this),a.onprogress=this._onProgress.bind(this),a.onload=this._onLoad.bind(this),a.onerror=this._onXhrError.bind(this),e.withCredentials&&(a.withCredentials=!0),"object"==typeof n.headers){const e=n.headers;for(const t in e)e.hasOwnProperty(t)&&a.setRequestHeader(t,e[t])}if("object"==typeof this._config.headers){const e=this._config.headers;for(const t in e)e.hasOwnProperty(t)&&a.setRequestHeader(t,e[t])}a.send()}abort(){this._requestAbort=!0,this._internalAbort(),this._status=r.GM.kComplete}_internalAbort(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}_onReadyStateChange(e){const t=e.target;if(2===t.readyState){if(null!=t.responseURL){const e=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&e!==this._currentRedirectedURL&&(this._currentRedirectedURL=e,this._onURLRedirect&&this._onURLRedirect(e))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=r.GM.kBuffering}else{if(this._status=r.GM.kError,!this._onError)throw new s.OZ("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(r.nm.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}}_onProgress(e){if(this._status===r.GM.kError)return;if(null===this._contentLength){let t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;const i=e.total;this._internalAbort(),null!=i&&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=(this._totalLength||0)-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}const t=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(t)}_normalizeSpeed(e){const t=this._chunkSizeKBList,i=t.length-1;let n=0,a=0,r=i;if(e=t[n]&&e=3&&(t=this._speedSampler.currentKBps)),0!==t){const e=this._normalizeSpeed(t);this._currentSpeedNormalized!==e&&(this._currentSpeedNormalized=e,this._currentChunkSizeKB=e)}const i=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=i.byteLength;let a=!1;null!=this._contentLength&&this._receivedLength0&&this._receivedLength{this._dispatchArrayBuffer(null==t?void 0:t.result)},t.readAsArrayBuffer(e.data)}else{this._status=r.GM.kError;const t={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new s.OZ(t.msg);this._onError(r.nm.EXCEPTION,t)}}_dispatchArrayBuffer(e){const t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}_onWebSocketError(e){this._status=r.GM.kError;const t={code:e.code,msg:e.message};if(!this._onError)throw new s.OZ(t.msg);this._onError(r.nm.EXCEPTION,t)}}const p=x,m=class{constructor(e){this._zeroStart=e||!1}getConfig(e,t){const i={};if(0!==t.from||-1!==t.to){let e;e=-1!==t.to?`bytes=${t.from.toString()}-${t.to.toString()}`:`bytes=${t.from.toString()}-`,i.Range=e}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}}removeURLParameters(e){return e}},_=class{constructor(e,t){this._startName=e,this._endName=t}getConfig(e,t){let i=e;if(0!==t.from||-1!==t.to){let e=!0;i.includes("?")||(i+="?",e=!1),e&&(i+="&"),i+=`${this._startName}=${t.from.toString()}`,-1!==t.to&&(i+=`&${this._endName}=${t.to.toString()}`)}return{url:i,headers:{}}}removeURLParameters(e){const t=e.split("?")[0];let i;const n=e.indexOf("?");-1!==n&&(i=e.substring(n+1));let a="";if(void 0!==i&&i.length>0){const e=i.split("&");for(let t=0;t0;i[0]!==this._startName&&i[0]!==this._endName&&(n&&(a+="&"),a+=e[t])}}return 0===a.length?t:t+"?"+a}},g=class{constructor(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=65536,void 0!==t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,t.enableStashBuffer||(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url||""),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new a,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}destroy(){var e,t,i;(null===(e=this._loader)||void 0===e?void 0:e.isWorking())&&(null===(t=this._loader)||void 0===t||t.abort()),null===(i=this._loader)||void 0===i||i.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}isWorking(){var e;return(null===(e=this._loader)||void 0===e?void 0:e.isWorking())&&!this._paused}isPaused(){return this._paused}get status(){var e;return null===(e=this._loader)||void 0===e?void 0:e.status}get extraData(){return this._extraData}set extraData(e){this._extraData=e}get onDataArrival(){return this._onDataArrival}set onDataArrival(e){this._onDataArrival=e}get onSeeked(){return this._onSeeked}set onSeeked(e){this._onSeeked=e}get onError(){return this._onError}set onError(e){this._onError=e}get onComplete(){return this._onComplete}set onComplete(e){this._onComplete=e}get onRedirect(){return this._onRedirect}set onRedirect(e){this._onRedirect=e}get onRecoveredEarlyEof(){return this._onRecoveredEarlyEof}set onRecoveredEarlyEof(e){this._onRecoveredEarlyEof=e}get currentURL(){var e;return null===(e=this._dataSource)||void 0===e?void 0:e.url}get hasRedirect(){var e;return null!=this._redirectedURL||void 0!==(null===(e=this._dataSource)||void 0===e?void 0:e.redirectedURL)}get currentRedirectedURL(){var e;return this._redirectedURL||(null===(e=this._dataSource)||void 0===e?void 0:e.redirectedURL)}get currentSpeed(){var e,t;return this._loaderClass===f?null===(e=this._loader)||void 0===e?void 0:e.currentSpeed:null===(t=this._speedSampler)||void 0===t?void 0:t.lastSecondKBps}get loaderType(){var e;return null===(e=this._loader)||void 0===e?void 0:e.type}_selectSeekHandler(){const e=this._config;if("range"===e.seekType)this._seekHandler=new m(!!this._config.rangeLoadZeroStart);else if("param"===e.seekType){const t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new _(t,i)}else{if("custom"!==e.seekType)throw new s.OC(`Invalid seekType in config: ${(null==e?void 0:e.seekType)||""}`);if("function"!=typeof e.customSeekHandler)throw new s.OC("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}}_selectLoader(){var e;if(null!=this._config.customLoader)this._loaderClass=(null===(e=this._config)||void 0===e?void 0:e.customLoader)||null;else if(this._isWebSocketURL)this._loaderClass=p;else if(c.isSupported())this._loaderClass=c;else if(u.isSupported())this._loaderClass=u;else{if(!f.isSupported())throw new s.OZ("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=f}}_createLoader(){var e;this._loaderClass&&(this._loader=new this._loaderClass(this._seekHandler,this._config),(null===(e=this._loader)||void 0===e?void 0:e.needStashBuffer)||(this._enableStash=!1),this._loader&&(this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)))}open(e){var t,i;this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),null===(t=this._speedSampler)||void 0===t||t.reset(),e||(this._fullRequestFlag=!0),null===(i=this._loader)||void 0===i||i.open(this._dataSource,Object.assign({},this._currentRange))}abort(){var e;null===(e=this._loader)||void 0===e||e.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}pause(){var e,t;this.isWorking()&&(null===(e=this._loader)||void 0===e||e.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange&&(this._currentRange.to=this._stashByteStart-1)):this._resumeFrom=((null===(t=this._currentRange)||void 0===t?void 0:t.to)||0)+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}resume(){if(this._paused){this._paused=!1;const e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}}seek(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)}_internalSeek(e,t){var i,n,a,r;(null===(i=this._loader)||void 0===i?void 0:i.isWorking())&&(null===(n=this._loader)||void 0===n||n.abort()),this._flushStashBuffer(t),null===(a=this._loader)||void 0===a||a.destroy(),this._loader=null;const o={from:e,to:-1};this._currentRange={from:o.from,to:-1},null===(r=this._speedSampler)||void 0===r||r.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,o),this._onSeeked&&this._onSeeked()}updateUrl(e){if(!e||"string"!=typeof e||0===e.length)throw new s.OC("Url must be a non-empty string!");this._dataSource.url=e}_expandBuffer(e){let t=this._stashSize;for(;t+10485760){const e=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(e,0)}this._stashBuffer=i,this._bufferSize=t}_normalizeSpeed(e){const t=this._speedNormalizeList,i=t.length-1;let n=0,a=0,r=i;if(e=t[n]&&e=512&&e<=1024?Math.floor(1.5*e):2*e,t>8192&&(t=8192);const i=1024*t+1048576;this._bufferSize0){const t=this._stashBuffer.slice(0,this._stashUsed),n=this._dispatchChunks(t,this._stashByteStart);if(n0){const e=new Uint8Array(t,n);i.set(e,0),this._stashUsed=e.byteLength,this._stashByteStart+=n}}else this._stashUsed=0,this._stashByteStart+=n;this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),i=new Uint8Array(this._stashBuffer,0,this._bufferSize)),i.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{const n=this._dispatchChunks(e,t);if(nthis._bufferSize&&(this._expandBuffer(a),i=new Uint8Array(this._stashBuffer,0,this._bufferSize)),i.set(new Uint8Array(e,n),0),this._stashUsed+=a,this._stashByteStart=t+n}}}else if(0===this._stashUsed){const i=this._dispatchChunks(e,t);if(ithis._bufferSize&&this._expandBuffer(n),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(e,i),0),this._stashUsed+=n,this._stashByteStart=t+i}}else{this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength);const t=new Uint8Array(this._stashBuffer,0,this._bufferSize);t.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;const i=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(i0){const e=new Uint8Array(this._stashBuffer,i);t.set(e,0)}this._stashUsed-=i,this._stashByteStart+=i}}_flushStashBuffer(e){if(this._stashUsed>0){const t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),a=t.byteLength-i;if(i0){const e=new Uint8Array(this._stashBuffer,0,this._bufferSize),n=new Uint8Array(t,i);e.set(n,0),this._stashUsed=n.byteLength,this._stashByteStart+=i}return 0}n.Z.w(this.TAG,`${a} bytes unconsumed data remain when flush buffer, dropped`)}return this._stashUsed=0,this._stashByteStart=0,a}return 0}_onLoaderComplete(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}_onLoaderError(e,t){var i;switch(n.Z.e(this.TAG,`Loader error, code = ${t.code}, msg = ${t.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=r.nm.UNRECOVERABLE_EARLY_EOF),e){case r.nm.EARLY_EOF:if(!this._config.isLive&&this._totalLength){const e=((null===(i=this._currentRange)||void 0===i?void 0:i.to)||0)+1;return void(e{i.d(t,{GM:()=>a,fp:()=>o,nm:()=>r});var n=i(411);const a={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},r={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};class o{constructor(e){this._type=e||"undefined",this._status=a.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}destroy(){this._status=a.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}isWorking(){return this._status===a.kConnecting||this._status===a.kBuffering}get type(){return this._type}get status(){return this._status}get needStashBuffer(){return this._needStash}get onContentLengthKnown(){return this._onContentLengthKnown}set onContentLengthKnown(e){this._onContentLengthKnown=e}get onURLRedirect(){return this._onURLRedirect}set onURLRedirect(e){this._onURLRedirect=e}get onDataArrival(){return this._onDataArrival}set onDataArrival(e){this._onDataArrival=e}get onError(){return this._onError}set onError(e){this._onError=e}get onComplete(){return this._onComplete}set onComplete(e){this._onComplete=e}open(e,t){throw new n.do("Unimplemented abstract function!")}abort(){throw new n.do("Unimplemented abstract function!")}}},479:(e,t,i)=>{i.d(t,{Z:()=>a});const n={};!function(){const e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.includes("trident")&&/(rv)(?::| )([\w.]+)/.exec(e)||!e.includes("compatible")&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],a={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},r={};if(a.browser){r[a.browser]=!0;const e=a.majorVersion.split(".");r.version={major:parseInt(a.majorVersion,10),string:a.version},e.length>1&&(r.version.minor=parseInt(e[1],10)),e.length>2&&(r.version.build=parseInt(e[2],10))}if(a.platform&&(r[a.platform]=!0),(r.chrome||r.opr||r.safari)&&(r.webkit=!0),r.rv||r.iemobile){r.rv&&delete r.rv;const e="msie";a.browser=e,r[e]=!0}if(r.edge){delete r.edge;const e="msedge";a.browser=e,r[e]=!0}if(r.opr){const e="opera";a.browser=e,r[e]=!0}if(r.safari&&r.android){const e="android";a.browser=e,r[e]=!0}r.name=a.browser,r.platform=a.platform;for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e];Object.assign(n,r)}();const a=n},411:(e,t,i)=>{i.d(t,{OC:()=>r,OZ:()=>n,do:()=>o,rT:()=>a});class n{constructor(e){this.name="RuntimeException",this._message=e}get message(){return this._message}toString(){return this.name+": "+this.message}}class a extends n{constructor(e){super(e),this.name="IllegalStateException"}}class r extends n{constructor(e){super(e),this.name="InvalidArgumentException"}}class o extends n{constructor(e){super(e),this.name="NotImplementedException"}}},645:(e,t,i)=>{i.d(t,{Z:()=>r});var n=i(99);class a{static e(e,t){var i;e&&!a.FORCE_GLOBAL_TAG||(e=a.GLOBAL_TAG);const n=`[${e}] > ${t}`;a.ENABLE_CALLBACK&&(null===(i=a.emitter)||void 0===i||i.emit("log","error",n)),a.ENABLE_ERROR&&(console.error?console.error(n):console.warn?console.warn(n):console.log(n))}static i(e,t){e&&!a.FORCE_GLOBAL_TAG||(e=a.GLOBAL_TAG);const i=`[${e}] > ${t}`;a.ENABLE_CALLBACK&&a.emitter.emit("log","info",i),a.ENABLE_INFO&&(console.info?console.info(i):console.log(i))}static w(e,t){e&&!a.FORCE_GLOBAL_TAG||(e=a.GLOBAL_TAG);const i=`[${e}] > ${t}`;a.ENABLE_CALLBACK&&a.emitter.emit("log","warn",i),a.ENABLE_WARN&&(console.warn?console.warn(i):console.log(i))}static d(e,t){var i;e&&!a.FORCE_GLOBAL_TAG||(e=a.GLOBAL_TAG);const n=`[${e}] > ${t}`;a.ENABLE_CALLBACK&&(null===(i=a.emitter)||void 0===i||i.emit("log","debug",n)),a.ENABLE_DEBUG&&(console.debug?console.debug(n):console.log(n))}static v(e,t){var i;e&&!a.FORCE_GLOBAL_TAG||(e=a.GLOBAL_TAG);const n=`[${e}] > ${t}`;a.ENABLE_CALLBACK&&(null===(i=a.emitter)||void 0===i||i.emit("log","verbose",n)),a.ENABLE_VERBOSE&&console.log(n)}}a.FORCE_GLOBAL_TAG=!1,a.GLOBAL_TAG="mpegts.js",a.ENABLE_CALLBACK=!1,a.emitter=new n.EventEmitter,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!0,a.ENABLE_WARN=!0,a.ENABLE_DEBUG=!0,a.ENABLE_VERBOSE=!0;const r=a},278:(e,t,i)=>{i.d(t,{Z:()=>o});var n=i(99),a=i(645);class r{static get forceGlobalTag(){return a.Z.FORCE_GLOBAL_TAG}static set forceGlobalTag(e){a.Z.FORCE_GLOBAL_TAG=e,r._notifyChange()}static get globalTag(){return a.Z.GLOBAL_TAG}static set globalTag(e){a.Z.GLOBAL_TAG=e,r._notifyChange()}static get enableAll(){return a.Z.ENABLE_VERBOSE&&a.Z.ENABLE_DEBUG&&a.Z.ENABLE_INFO&&a.Z.ENABLE_WARN&&a.Z.ENABLE_ERROR}static set enableAll(e){a.Z.ENABLE_VERBOSE=e,a.Z.ENABLE_DEBUG=e,a.Z.ENABLE_INFO=e,a.Z.ENABLE_WARN=e,a.Z.ENABLE_ERROR=e,r._notifyChange()}static get enableDebug(){return a.Z.ENABLE_DEBUG}static set enableDebug(e){a.Z.ENABLE_DEBUG=e,r._notifyChange()}static get enableVerbose(){return a.Z.ENABLE_VERBOSE}static set enableVerbose(e){a.Z.ENABLE_VERBOSE=e,r._notifyChange()}static get enableInfo(){return a.Z.ENABLE_INFO}static set enableInfo(e){a.Z.ENABLE_INFO=e,r._notifyChange()}static get enableWarn(){return a.Z.ENABLE_WARN}static set enableWarn(e){a.Z.ENABLE_WARN=e,r._notifyChange()}static get enableError(){return a.Z.ENABLE_ERROR}static set enableError(e){a.Z.ENABLE_ERROR=e,r._notifyChange()}static getConfig(){return{globalTag:a.Z.GLOBAL_TAG,forceGlobalTag:a.Z.FORCE_GLOBAL_TAG,enableVerbose:a.Z.ENABLE_VERBOSE,enableDebug:a.Z.ENABLE_DEBUG,enableInfo:a.Z.ENABLE_INFO,enableWarn:a.Z.ENABLE_WARN,enableError:a.Z.ENABLE_ERROR,enableCallback:a.Z.ENABLE_CALLBACK}}static applyConfig(e){a.Z.GLOBAL_TAG=e.globalTag,a.Z.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.Z.ENABLE_VERBOSE=e.enableVerbose,a.Z.ENABLE_DEBUG=e.enableDebug,a.Z.ENABLE_INFO=e.enableInfo,a.Z.ENABLE_WARN=e.enableWarn,a.Z.ENABLE_ERROR=e.enableError,a.Z.ENABLE_CALLBACK=!!e.enableCallback}static _notifyChange(){const e=r.emitter;if(e.listenerCount("change")>0){const t=r.getConfig();e.emit("change",t)}}static registerListener(e){r.emitter.addListener("change",e)}static removeListener(e){r.emitter.removeListener("change",e)}static addLogListener(e){a.Z.emitter.addListener("log",e),a.Z.emitter.listenerCount("log")>0&&(a.Z.ENABLE_CALLBACK=!0,r._notifyChange())}static removeLogListener(e){a.Z.emitter.removeListener("log",e),0===a.Z.emitter.listenerCount("log")&&(a.Z.ENABLE_CALLBACK=!1,r._notifyChange())}}r.emitter=new n.EventEmitter;const o=r}},t={};function i(n){var a=t[n];if(void 0!==a)return a.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}return i.m=e,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i(607)})()))}({exports:{}});!function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i"']/g,J=RegExp(Y.source),q=RegExp(X.source),K=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,ae=RegExp(ne.source),re=/^\s+/,oe=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,le=/\{\n\/\* \[wrapped with (.+)\] \*/,ce=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,xe=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,me=/^0b[01]+$/i,_e=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,be=/['\n\r\u2028\u2029\\]/g,Pe="\\ud800-\\udfff",Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ce="\\u2700-\\u27bf",Te="a-z\\xdf-\\xf6\\xf8-\\xff",Re="A-Z\\xc0-\\xd6\\xd8-\\xde",we="\\ufe0e\\ufe0f",Ie="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",De="['’]",ke="["+Pe+"]",Fe="["+Ie+"]",Ae="["+Ee+"]",Me="\\d+",Le="["+Ce+"]",Be="["+Te+"]",Oe="[^"+Pe+Ie+Me+Ce+Te+Re+"]",je="\\ud83c[\\udffb-\\udfff]",Ne="[^"+Pe+"]",Ue="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",He="["+Re+"]",Ve="\\u200d",Ze="(?:"+Be+"|"+Oe+")",We="(?:"+He+"|"+Oe+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",Ye="(?:['’](?:D|LL|M|RE|S|T|VE))?",Xe="(?:"+Ae+"|"+je+")"+"?",Je="["+we+"]?",qe=Je+Xe+("(?:"+Ve+"(?:"+[Ne,Ue,ze].join("|")+")"+Je+Xe+")*"),Ke="(?:"+[Le,Ue,ze].join("|")+")"+qe,$e="(?:"+[Ne+Ae+"?",Ae,Ue,ze,ke].join("|")+")",Qe=RegExp(De,"g"),et=RegExp(Ae,"g"),tt=RegExp(je+"(?="+je+")|"+$e+qe,"g"),it=RegExp([He+"?"+Be+"+"+Ge+"(?="+[Fe,He,"$"].join("|")+")",We+"+"+Ye+"(?="+[Fe,He+Ze,"$"].join("|")+")",He+"?"+Ze+"+"+Ge,He+"+"+Ye,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Me,Ke].join("|"),"g"),nt=RegExp("["+Ve+Pe+Ee+we+"]"),at=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,st={};st[L]=st[B]=st[O]=st[j]=st[N]=st[U]=st[z]=st[H]=st[V]=!0,st[m]=st[_]=st[A]=st[g]=st[M]=st[v]=st[y]=st[S]=st[P]=st[E]=st[C]=st[R]=st[I]=st[D]=st[F]=!1;var lt={};lt[m]=lt[_]=lt[A]=lt[M]=lt[g]=lt[v]=lt[L]=lt[B]=lt[O]=lt[j]=lt[N]=lt[P]=lt[E]=lt[C]=lt[R]=lt[I]=lt[D]=lt[k]=lt[U]=lt[z]=lt[H]=lt[V]=!0,lt[y]=lt[S]=lt[F]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dt=parseFloat,ut=parseInt,ht="object"==typeof w&&w&&w.Object===Object&&w,ft="object"==typeof self&&self&&self.Object===Object&&self,xt=ht||ft||Function("return this")(),pt=t&&!t.nodeType&&t,mt=pt&&e&&!e.nodeType&&e,_t=mt&&mt.exports===pt,gt=_t&&ht.process,vt=function(){try{var e=mt&&mt.require&&mt.require("util").types;return e||gt&>.binding&>.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,St=vt&&vt.isDate,bt=vt&&vt.isMap,Pt=vt&&vt.isRegExp,Et=vt&&vt.isSet,Ct=vt&&vt.isTypedArray;function Tt(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}function Rt(e,t,i,n){for(var a=-1,r=null==e?0:e.length;++a-1}function At(e,t,i){for(var n=-1,a=null==e?0:e.length;++n-1;);return i}function ii(e,t){for(var i=e.length;i--&&Ht(t,e[i],0)>-1;);return i}var ni=Yt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ai=Yt({"&":"&","<":"<",">":">",'"':""","'":"'"});function ri(e){return"\\"+ct[e]}function oi(e){return nt.test(e)}function si(e){var t=-1,i=Array(e.size);return e.forEach((function(e,n){i[++t]=[n,e]})),i}function li(e,t){return function(i){return e(t(i))}}function ci(e,t){for(var i=-1,n=e.length,a=0,o=[];++i",""":'"',"'":"'"});var mi=function e(t){var w,oe=(t=null==t?xt:mi.defaults(xt.Object(),t,mi.pick(xt,rt))).Array,Pe=t.Date,Ee=t.Error,Ce=t.Function,Te=t.Math,Re=t.Object,we=t.RegExp,Ie=t.String,De=t.TypeError,ke=oe.prototype,Fe=Ce.prototype,Ae=Re.prototype,Me=t["__core-js_shared__"],Le=Fe.toString,Be=Ae.hasOwnProperty,Oe=0,je=(w=/[^.]+$/.exec(Me&&Me.keys&&Me.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",Ne=Ae.toString,Ue=Le.call(Re),ze=xt._,He=we("^"+Le.call(Be).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=_t?t.Buffer:i,Ze=t.Symbol,We=t.Uint8Array,Ge=Ve?Ve.allocUnsafe:i,Ye=li(Re.getPrototypeOf,Re),Xe=Re.create,Je=Ae.propertyIsEnumerable,qe=ke.splice,Ke=Ze?Ze.isConcatSpreadable:i,$e=Ze?Ze.iterator:i,tt=Ze?Ze.toStringTag:i,nt=function(){try{var e=hr(Re,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==xt.clearTimeout&&t.clearTimeout,ht=Pe&&Pe.now!==xt.Date.now&&Pe.now,ft=t.setTimeout!==xt.setTimeout&&t.setTimeout,pt=Te.ceil,mt=Te.floor,gt=Re.getOwnPropertySymbols,vt=Ve?Ve.isBuffer:i,Nt=t.isFinite,Yt=ke.join,_i=li(Re.keys,Re),gi=Te.max,vi=Te.min,yi=Pe.now,Si=t.parseInt,bi=Te.random,Pi=ke.reverse,Ei=hr(t,"DataView"),Ci=hr(t,"Map"),Ti=hr(t,"Promise"),Ri=hr(t,"Set"),wi=hr(t,"WeakMap"),Ii=hr(Re,"create"),Di=wi&&new wi,ki={},Fi=jr(Ei),Ai=jr(Ci),Mi=jr(Ti),Li=jr(Ri),Bi=jr(wi),Oi=Ze?Ze.prototype:i,ji=Oi?Oi.valueOf:i,Ni=Oi?Oi.toString:i;function Ui(e){if(is(e)&&!Wo(e)&&!(e instanceof Zi)){if(e instanceof Vi)return e;if(Be.call(e,"__wrapped__"))return Nr(e)}return new Vi(e)}var zi=function(){function e(){}return function(t){if(!ts(t))return{};if(Xe)return Xe(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Hi(){}function Vi(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Zi(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=x,this.__views__=[]}function Wi(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function cn(e,t,n,a,r,o){var s,l=1&t,c=2&t,d=4&t;if(n&&(s=r?n(e,a,r,o):n(e)),s!==i)return s;if(!ts(e))return e;var u=Wo(e);if(u){if(s=function(e){var t=e.length,i=new e.constructor(t);t&&"string"==typeof e[0]&&Be.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!l)return Da(e,s)}else{var h=pr(e),f=h==S||h==b;if(Jo(e))return Ea(e,l);if(h==C||h==m||f&&!r){if(s=c||f?{}:_r(e),!l)return c?function(e,t){return ka(e,xr(e),t)}(e,function(e,t){return e&&ka(t,As(t),e)}(s,e)):function(e,t){return ka(e,fr(e),t)}(e,rn(s,e))}else{if(!lt[h])return r?e:{};s=function(e,t,i){var n=e.constructor;switch(t){case A:return Ca(e);case g:case v:return new n(+e);case M:return function(e,t){var i=t?Ca(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,i);case L:case B:case O:case j:case N:case U:case z:case H:case V:return Ta(e,i);case P:return new n;case E:case D:return new n(e);case R:return function(e){var t=new e.constructor(e.source,xe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case I:return new n;case k:return a=e,ji?Re(ji.call(a)):{}}var a}(e,h,l)}}o||(o=new Ji);var x=o.get(e);if(x)return x;o.set(e,s),ss(e)?e.forEach((function(i){s.add(cn(i,t,n,i,e,o))})):ns(e)&&e.forEach((function(i,a){s.set(a,cn(i,t,n,a,e,o))}));var p=u?i:(d?c?rr:ar:c?As:Fs)(e);return wt(p||e,(function(i,a){p&&(i=e[a=i]),tn(s,a,cn(i,t,n,a,e,o))})),s}function dn(e,t,n){var a=n.length;if(null==e)return!a;for(e=Re(e);a--;){var r=n[a],o=t[r],s=e[r];if(s===i&&!(r in e)||!o(s))return!1}return!0}function un(e,t,a){if("function"!=typeof e)throw new De(n);return kr((function(){e.apply(i,a)}),t)}function hn(e,t,i,n){var a=-1,r=Ft,o=!0,s=e.length,l=[],c=t.length;if(!s)return l;i&&(t=Mt(t,$t(i))),n?(r=At,o=!1):t.length>=200&&(r=ei,o=!1,t=new Xi(t));e:for(;++a-1},Gi.prototype.set=function(e,t){var i=this.__data__,n=nn(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this},Yi.prototype.clear=function(){this.size=0,this.__data__={hash:new Wi,map:new(Ci||Gi),string:new Wi}},Yi.prototype.delete=function(e){var t=dr(this,e).delete(e);return this.size-=t?1:0,t},Yi.prototype.get=function(e){return dr(this,e).get(e)},Yi.prototype.has=function(e){return dr(this,e).has(e)},Yi.prototype.set=function(e,t){var i=dr(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this},Xi.prototype.add=Xi.prototype.push=function(e){return this.__data__.set(e,a),this},Xi.prototype.has=function(e){return this.__data__.has(e)},Ji.prototype.clear=function(){this.__data__=new Gi,this.size=0},Ji.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},Ji.prototype.get=function(e){return this.__data__.get(e)},Ji.prototype.has=function(e){return this.__data__.has(e)},Ji.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Gi){var n=i.__data__;if(!Ci||n.length<199)return n.push([e,t]),this.size=++i.size,this;i=this.__data__=new Yi(n)}return i.set(e,t),this.size=i.size,this};var fn=Ma(Sn),xn=Ma(bn,!0);function pn(e,t){var i=!0;return fn(e,(function(e,n,a){return i=!!t(e,n,a)})),i}function mn(e,t,n){for(var a=-1,r=e.length;++a0&&i(s)?t>1?gn(s,t-1,i,n,a):Lt(a,s):n||(a[a.length]=s)}return a}var vn=La(),yn=La(!0);function Sn(e,t){return e&&vn(e,t,Fs)}function bn(e,t){return e&&yn(e,t,Fs)}function Pn(e,t){return kt(t,(function(t){return $o(e[t])}))}function En(e,t){for(var n=0,a=(t=ya(t,e)).length;null!=e&&nt}function wn(e,t){return null!=e&&Be.call(e,t)}function In(e,t){return null!=e&&t in Re(e)}function Dn(e,t,n){for(var a=n?At:Ft,r=e[0].length,o=e.length,s=o,l=oe(o),c=1/0,d=[];s--;){var u=e[s];s&&t&&(u=Mt(u,$t(t))),c=vi(u.length,c),l[s]=!n&&(t||r>=120&&u.length>=120)?new Xi(s&&u):i}u=e[0];var h=-1,f=l[0];e:for(;++h=s?l:l*("desc"==i[n]?-1:1)}return e.index-t.index}(e,t,i)}))}function Gn(e,t,i){for(var n=-1,a=t.length,r={};++n-1;)s!==e&&qe.call(s,l,1),qe.call(e,l,1);return e}function Xn(e,t){for(var i=e?t.length:0,n=i-1;i--;){var a=t[i];if(i==n||a!==r){var r=a;vr(a)?qe.call(e,a,1):ha(e,a)}}return e}function Jn(e,t){return e+mt(bi()*(t-e+1))}function qn(e,t){var i="";if(!e||t<1||t>h)return i;do{t%2&&(i+=e),(t=mt(t/2))&&(e+=e)}while(t);return i}function Kn(e,t){return Fr(Rr(e,t,al),e+"")}function $n(e){return Ki(zs(e))}function Qn(e,t){var i=zs(e);return Lr(i,ln(t,0,i.length))}function ea(e,t,n,a){if(!ts(e))return e;for(var r=-1,o=(t=ya(t,e)).length,s=o-1,l=e;null!=l&&++ra?0:a+t),(i=i>a?a:i)<0&&(i+=a),a=t>i?0:i-t>>>0,t>>>=0;for(var r=oe(a);++n>>1,o=e[r];null!==o&&!cs(o)&&(i?o<=t:o=200){var c=t?null:qa(e);if(c)return di(c);o=!1,a=ei,l=new Xi}else l=t?[]:s;e:for(;++n=a?e:aa(e,t,n)}var Pa=ct||function(e){return xt.clearTimeout(e)};function Ea(e,t){if(t)return e.slice();var i=e.length,n=Ge?Ge(i):new e.constructor(i);return e.copy(n),n}function Ca(e){var t=new e.constructor(e.byteLength);return new We(t).set(new We(e)),t}function Ta(e,t){var i=t?Ca(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}function Ra(e,t){if(e!==t){var n=e!==i,a=null===e,r=e==e,o=cs(e),s=t!==i,l=null===t,c=t==t,d=cs(t);if(!l&&!d&&!o&&e>t||o&&s&&c&&!l&&!d||a&&s&&c||!n&&c||!r)return 1;if(!a&&!o&&!d&&e1?n[r-1]:i,s=r>2?n[2]:i;for(o=e.length>3&&"function"==typeof o?(r--,o):i,s&&yr(n[0],n[1],s)&&(o=r<3?i:o,r=1),t=Re(t);++a-1?r[o?t[s]:s]:i}}function Ua(e){return nr((function(t){var a=t.length,r=a,o=Vi.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new De(n);if(o&&!l&&"wrapper"==sr(s))var l=new Vi([],!0)}for(r=l?r:a;++r1&&v.reverse(),h&&dl))return!1;var d=o.get(e),u=o.get(t);if(d&&u)return d==t&&u==e;var h=-1,f=!0,x=2&n?new Xi:i;for(o.set(e,t),o.set(t,e);++h-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(i>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return wt(p,(function(i){var n="_."+i[0];t&i[1]&&!Ft(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(le);return t?t[1].split(ce):[]}(n),i)))}function Mr(e){var t=0,n=0;return function(){var a=yi(),r=16-(a-n);if(n=a,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Lr(e,t){var n=-1,a=e.length,r=a-1;for(t=t===i?a:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ro(e,n)}));function fo(e){var t=Ui(e);return t.__chain__=!0,t}function xo(e,t){return t(e)}var po=nr((function(e){var t=e.length,n=t?e[0]:0,a=this.__wrapped__,r=function(t){return sn(t,e)};return!(t>1||this.__actions__.length)&&a instanceof Zi&&vr(n)?((a=a.slice(n,+n+(t?1:0))).__actions__.push({func:xo,args:[r],thisArg:i}),new Vi(a,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(r)}));var mo=Fa((function(e,t,i){Be.call(e,i)?++e[i]:on(e,i,1)}));var _o=Na(Vr),go=Na(Zr);function vo(e,t){return(Wo(e)?wt:fn)(e,cr(t,3))}function yo(e,t){return(Wo(e)?It:xn)(e,cr(t,3))}var So=Fa((function(e,t,i){Be.call(e,i)?e[i].push(t):on(e,i,[t])}));var bo=Kn((function(e,t,i){var n=-1,a="function"==typeof t,r=Yo(e)?oe(e.length):[];return fn(e,(function(e){r[++n]=a?Tt(t,e,i):kn(e,t,i)})),r})),Po=Fa((function(e,t,i){on(e,i,t)}));function Eo(e,t){return(Wo(e)?Mt:Un)(e,cr(t,3))}var Co=Fa((function(e,t,i){e[i?0:1].push(t)}),(function(){return[[],[]]}));var To=Kn((function(e,t){if(null==e)return[];var i=t.length;return i>1&&yr(e,t[0],t[1])?t=[]:i>2&&yr(t[0],t[1],t[2])&&(t=[t[0]]),Wn(e,gn(t,1),[])})),Ro=ht||function(){return xt.Date.now()};function wo(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,$a(e,c,i,i,i,i,t)}function Io(e,t){var a;if("function"!=typeof t)throw new De(n);return e=ps(e),function(){return--e>0&&(a=t.apply(this,arguments)),e<=1&&(t=i),a}}var Do=Kn((function(e,t,i){var n=1;if(i.length){var a=ci(i,lr(Do));n|=s}return $a(e,n,t,i,a)})),ko=Kn((function(e,t,i){var n=3;if(i.length){var a=ci(i,lr(ko));n|=s}return $a(t,n,e,i,a)}));function Fo(e,t,a){var r,o,s,l,c,d,u=0,h=!1,f=!1,x=!0;if("function"!=typeof e)throw new De(n);function p(t){var n=r,a=o;return r=o=i,u=t,l=e.apply(a,n)}function m(e){var n=e-d;return d===i||n>=t||n<0||f&&e-u>=s}function _(){var e=Ro();if(m(e))return g(e);c=kr(_,function(e){var i=t-(e-d);return f?vi(i,s-(e-u)):i}(e))}function g(e){return c=i,x&&r?p(e):(r=o=i,l)}function v(){var e=Ro(),n=m(e);if(r=arguments,o=this,d=e,n){if(c===i)return function(e){return u=e,c=kr(_,t),h?p(e):l}(d);if(f)return Pa(c),c=kr(_,t),p(d)}return c===i&&(c=kr(_,t)),l}return t=_s(t)||0,ts(a)&&(h=!!a.leading,s=(f="maxWait"in a)?gi(_s(a.maxWait)||0,t):s,x="trailing"in a?!!a.trailing:x),v.cancel=function(){c!==i&&Pa(c),u=0,r=d=o=c=i},v.flush=function(){return c===i?l:g(Ro())},v}var Ao=Kn((function(e,t){return un(e,1,t)})),Mo=Kn((function(e,t,i){return un(e,_s(t)||0,i)}));function Lo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new De(n);var i=function(){var n=arguments,a=t?t.apply(this,n):n[0],r=i.cache;if(r.has(a))return r.get(a);var o=e.apply(this,n);return i.cache=r.set(a,o)||r,o};return i.cache=new(Lo.Cache||Yi),i}function Bo(e){if("function"!=typeof e)throw new De(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Lo.Cache=Yi;var Oo=Sa((function(e,t){var i=(t=1==t.length&&Wo(t[0])?Mt(t[0],$t(cr())):Mt(gn(t,1),$t(cr()))).length;return Kn((function(n){for(var a=-1,r=vi(n.length,i);++a=t})),Zo=Fn(function(){return arguments}())?Fn:function(e){return is(e)&&Be.call(e,"callee")&&!Je.call(e,"callee")},Wo=oe.isArray,Go=yt?$t(yt):function(e){return is(e)&&Tn(e)==A};function Yo(e){return null!=e&&es(e.length)&&!$o(e)}function Xo(e){return is(e)&&Yo(e)}var Jo=vt||_l,qo=St?$t(St):function(e){return is(e)&&Tn(e)==v};function Ko(e){if(!is(e))return!1;var t=Tn(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function $o(e){if(!ts(e))return!1;var t=Tn(e);return t==S||t==b||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qo(e){return"number"==typeof e&&e==ps(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function is(e){return null!=e&&"object"==typeof e}var ns=bt?$t(bt):function(e){return is(e)&&pr(e)==P};function as(e){return"number"==typeof e||is(e)&&Tn(e)==E}function rs(e){if(!is(e)||Tn(e)!=C)return!1;var t=Ye(e);if(null===t)return!0;var i=Be.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Le.call(i)==Ue}var os=Pt?$t(Pt):function(e){return is(e)&&Tn(e)==R};var ss=Et?$t(Et):function(e){return is(e)&&pr(e)==I};function ls(e){return"string"==typeof e||!Wo(e)&&is(e)&&Tn(e)==D}function cs(e){return"symbol"==typeof e||is(e)&&Tn(e)==k}var ds=Ct?$t(Ct):function(e){return is(e)&&es(e.length)&&!!st[Tn(e)]};var us=Ya(Nn),hs=Ya((function(e,t){return e<=t}));function fs(e){if(!e)return[];if(Yo(e))return ls(e)?fi(e):Da(e);if($e&&e[$e])return function(e){for(var t,i=[];!(t=e.next()).done;)i.push(t.value);return i}(e[$e]());var t=pr(e);return(t==P?si:t==I?di:zs)(e)}function xs(e){return e?(e=_s(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ps(e){var t=xs(e),i=t%1;return t==t?i?t-i:t:0}function ms(e){return e?ln(ps(e),0,x):0}function _s(e){if("number"==typeof e)return e;if(cs(e))return f;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var i=me.test(e);return i||ge.test(e)?ut(e.slice(2),i?2:8):pe.test(e)?f:+e}function gs(e){return ka(e,As(e))}function vs(e){return null==e?"":da(e)}var ys=Aa((function(e,t){if(Er(t)||Yo(t))ka(t,Fs(t),e);else for(var i in t)Be.call(t,i)&&tn(e,i,t[i])})),Ss=Aa((function(e,t){ka(t,As(t),e)})),bs=Aa((function(e,t,i,n){ka(t,As(t),e,n)})),Ps=Aa((function(e,t,i,n){ka(t,Fs(t),e,n)})),Es=nr(sn);var Cs=Kn((function(e,t){e=Re(e);var n=-1,a=t.length,r=a>2?t[2]:i;for(r&&yr(t[0],t[1],r)&&(a=1);++n1),t})),ka(e,rr(e),i),n&&(i=cn(i,7,tr));for(var a=t.length;a--;)ha(i,t[a]);return i}));var Os=nr((function(e,t){return null==e?{}:function(e,t){return Gn(e,t,(function(t,i){return ws(e,i)}))}(e,t)}));function js(e,t){if(null==e)return{};var i=Mt(rr(e),(function(e){return[e]}));return t=cr(t),Gn(e,i,(function(e,i){return t(e,i[0])}))}var Ns=Ka(Fs),Us=Ka(As);function zs(e){return null==e?[]:Qt(e,Fs(e))}var Hs=Oa((function(e,t,i){return t=t.toLowerCase(),e+(i?Vs(t):t)}));function Vs(e){return Ks(vs(e).toLowerCase())}function Zs(e){return(e=vs(e))&&e.replace(ye,ni).replace(et,"")}var Ws=Oa((function(e,t,i){return e+(i?"-":"")+t.toLowerCase()})),Gs=Oa((function(e,t,i){return e+(i?" ":"")+t.toLowerCase()})),Ys=Ba("toLowerCase");var Xs=Oa((function(e,t,i){return e+(i?"_":"")+t.toLowerCase()}));var Js=Oa((function(e,t,i){return e+(i?" ":"")+Ks(t)}));var qs=Oa((function(e,t,i){return e+(i?" ":"")+t.toUpperCase()})),Ks=Ba("toUpperCase");function $s(e,t,n){return e=vs(e),(t=n?i:t)===i?function(e){return at.test(e)}(e)?function(e){return e.match(it)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Qs=Kn((function(e,t){try{return Tt(e,i,t)}catch(e){return Ko(e)?e:new Ee(e)}})),el=nr((function(e,t){return wt(t,(function(t){t=Or(t),on(e,t,Do(e[t],e))})),e}));function tl(e){return function(){return e}}var il=Ua(),nl=Ua(!0);function al(e){return e}function rl(e){return Bn("function"==typeof e?e:cn(e,1))}var ol=Kn((function(e,t){return function(i){return kn(i,e,t)}})),sl=Kn((function(e,t){return function(i){return kn(e,i,t)}}));function ll(e,t,i){var n=Fs(t),a=Pn(t,n);null!=i||ts(t)&&(a.length||!n.length)||(i=t,t=e,e=this,a=Pn(t,Fs(t)));var r=!(ts(i)&&"chain"in i&&!i.chain),o=$o(e);return wt(a,(function(i){var n=t[i];e[i]=n,o&&(e.prototype[i]=function(){var t=this.__chain__;if(r||t){var i=e(this.__wrapped__);return(i.__actions__=Da(this.__actions__)).push({func:n,args:arguments,thisArg:e}),i.__chain__=t,i}return n.apply(e,Lt([this.value()],arguments))})})),e}function cl(){}var dl=Za(Mt),ul=Za(Dt),hl=Za(jt);function fl(e){return Sr(e)?Gt(Or(e)):function(e){return function(t){return En(t,e)}}(e)}var xl=Ga(),pl=Ga(!0);function ml(){return[]}function _l(){return!1}var gl=Va((function(e,t){return e+t}),0),vl=Ja("ceil"),yl=Va((function(e,t){return e/t}),1),Sl=Ja("floor");var bl,Pl=Va((function(e,t){return e*t}),1),El=Ja("round"),Cl=Va((function(e,t){return e-t}),0);return Ui.after=function(e,t){if("function"!=typeof t)throw new De(n);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},Ui.ary=wo,Ui.assign=ys,Ui.assignIn=Ss,Ui.assignInWith=bs,Ui.assignWith=Ps,Ui.at=Es,Ui.before=Io,Ui.bind=Do,Ui.bindAll=el,Ui.bindKey=ko,Ui.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wo(e)?e:[e]},Ui.chain=fo,Ui.chunk=function(e,t,n){t=(n?yr(e,t,n):t===i)?1:gi(ps(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var r=0,o=0,s=oe(pt(a/t));rr?0:r+n),(a=a===i||a>r?r:ps(a))<0&&(a+=r),a=n>a?0:ms(a);n>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!os(t))&&!(t=da(t))&&oi(e)?ba(fi(e),0,n):e.split(t,n):[]},Ui.spread=function(e,t){if("function"!=typeof e)throw new De(n);return t=null==t?0:gi(ps(t),0),Kn((function(i){var n=i[t],a=ba(i,0,t);return n&&Lt(a,n),Tt(e,this,a)}))},Ui.tail=function(e){var t=null==e?0:e.length;return t?aa(e,1,t):[]},Ui.take=function(e,t,n){return e&&e.length?aa(e,0,(t=n||t===i?1:ps(t))<0?0:t):[]},Ui.takeRight=function(e,t,n){var a=null==e?0:e.length;return a?aa(e,(t=a-(t=n||t===i?1:ps(t)))<0?0:t,a):[]},Ui.takeRightWhile=function(e,t){return e&&e.length?xa(e,cr(t,3),!1,!0):[]},Ui.takeWhile=function(e,t){return e&&e.length?xa(e,cr(t,3)):[]},Ui.tap=function(e,t){return t(e),e},Ui.throttle=function(e,t,i){var a=!0,r=!0;if("function"!=typeof e)throw new De(n);return ts(i)&&(a="leading"in i?!!i.leading:a,r="trailing"in i?!!i.trailing:r),Fo(e,t,{leading:a,maxWait:t,trailing:r})},Ui.thru=xo,Ui.toArray=fs,Ui.toPairs=Ns,Ui.toPairsIn=Us,Ui.toPath=function(e){return Wo(e)?Mt(e,Or):cs(e)?[e]:Da(Br(vs(e)))},Ui.toPlainObject=gs,Ui.transform=function(e,t,i){var n=Wo(e),a=n||Jo(e)||ds(e);if(t=cr(t,4),null==i){var r=e&&e.constructor;i=a?n?new r:[]:ts(e)&&$o(r)?zi(Ye(e)):{}}return(a?wt:Sn)(e,(function(e,n,a){return t(i,e,n,a)})),i},Ui.unary=function(e){return wo(e,1)},Ui.union=to,Ui.unionBy=io,Ui.unionWith=no,Ui.uniq=function(e){return e&&e.length?ua(e):[]},Ui.uniqBy=function(e,t){return e&&e.length?ua(e,cr(t,2)):[]},Ui.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ua(e,i,t):[]},Ui.unset=function(e,t){return null==e||ha(e,t)},Ui.unzip=ao,Ui.unzipWith=ro,Ui.update=function(e,t,i){return null==e?e:fa(e,t,va(i))},Ui.updateWith=function(e,t,n,a){return a="function"==typeof a?a:i,null==e?e:fa(e,t,va(n),a)},Ui.values=zs,Ui.valuesIn=function(e){return null==e?[]:Qt(e,As(e))},Ui.without=oo,Ui.words=$s,Ui.wrap=function(e,t){return jo(va(t),e)},Ui.xor=so,Ui.xorBy=lo,Ui.xorWith=co,Ui.zip=uo,Ui.zipObject=function(e,t){return _a(e||[],t||[],tn)},Ui.zipObjectDeep=function(e,t){return _a(e||[],t||[],ea)},Ui.zipWith=ho,Ui.entries=Ns,Ui.entriesIn=Us,Ui.extend=Ss,Ui.extendWith=bs,ll(Ui,Ui),Ui.add=gl,Ui.attempt=Qs,Ui.camelCase=Hs,Ui.capitalize=Vs,Ui.ceil=vl,Ui.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=_s(n))==n?n:0),t!==i&&(t=(t=_s(t))==t?t:0),ln(_s(e),t,n)},Ui.clone=function(e){return cn(e,4)},Ui.cloneDeep=function(e){return cn(e,5)},Ui.cloneDeepWith=function(e,t){return cn(e,5,t="function"==typeof t?t:i)},Ui.cloneWith=function(e,t){return cn(e,4,t="function"==typeof t?t:i)},Ui.conformsTo=function(e,t){return null==t||dn(e,t,Fs(t))},Ui.deburr=Zs,Ui.defaultTo=function(e,t){return null==e||e!=e?t:e},Ui.divide=yl,Ui.endsWith=function(e,t,n){e=vs(e),t=da(t);var a=e.length,r=n=n===i?a:ln(ps(n),0,a);return(n-=t.length)>=0&&e.slice(n,r)==t},Ui.eq=zo,Ui.escape=function(e){return(e=vs(e))&&q.test(e)?e.replace(X,ai):e},Ui.escapeRegExp=function(e){return(e=vs(e))&&ae.test(e)?e.replace(ne,"\\$&"):e},Ui.every=function(e,t,n){var a=Wo(e)?Dt:pn;return n&&yr(e,t,n)&&(t=i),a(e,cr(t,3))},Ui.find=_o,Ui.findIndex=Vr,Ui.findKey=function(e,t){return Ut(e,cr(t,3),Sn)},Ui.findLast=go,Ui.findLastIndex=Zr,Ui.findLastKey=function(e,t){return Ut(e,cr(t,3),bn)},Ui.floor=Sl,Ui.forEach=vo,Ui.forEachRight=yo,Ui.forIn=function(e,t){return null==e?e:vn(e,cr(t,3),As)},Ui.forInRight=function(e,t){return null==e?e:yn(e,cr(t,3),As)},Ui.forOwn=function(e,t){return e&&Sn(e,cr(t,3))},Ui.forOwnRight=function(e,t){return e&&bn(e,cr(t,3))},Ui.get=Rs,Ui.gt=Ho,Ui.gte=Vo,Ui.has=function(e,t){return null!=e&&mr(e,t,wn)},Ui.hasIn=ws,Ui.head=Gr,Ui.identity=al,Ui.includes=function(e,t,i,n){e=Yo(e)?e:zs(e),i=i&&!n?ps(i):0;var a=e.length;return i<0&&(i=gi(a+i,0)),ls(e)?i<=a&&e.indexOf(t,i)>-1:!!a&&Ht(e,t,i)>-1},Ui.indexOf=function(e,t,i){var n=null==e?0:e.length;if(!n)return-1;var a=null==i?0:ps(i);return a<0&&(a=gi(n+a,0)),Ht(e,t,a)},Ui.inRange=function(e,t,n){return t=xs(t),n===i?(n=t,t=0):n=xs(n),function(e,t,i){return e>=vi(t,i)&&e=-9007199254740991&&e<=h},Ui.isSet=ss,Ui.isString=ls,Ui.isSymbol=cs,Ui.isTypedArray=ds,Ui.isUndefined=function(e){return e===i},Ui.isWeakMap=function(e){return is(e)&&pr(e)==F},Ui.isWeakSet=function(e){return is(e)&&"[object WeakSet]"==Tn(e)},Ui.join=function(e,t){return null==e?"":Yt.call(e,t)},Ui.kebabCase=Ws,Ui.last=qr,Ui.lastIndexOf=function(e,t,n){var a=null==e?0:e.length;if(!a)return-1;var r=a;return n!==i&&(r=(r=ps(n))<0?gi(a+r,0):vi(r,a-1)),t==t?function(e,t,i){for(var n=i+1;n--;)if(e[n]===t)return n;return n}(e,t,r):zt(e,Zt,r,!0)},Ui.lowerCase=Gs,Ui.lowerFirst=Ys,Ui.lt=us,Ui.lte=hs,Ui.max=function(e){return e&&e.length?mn(e,al,Rn):i},Ui.maxBy=function(e,t){return e&&e.length?mn(e,cr(t,2),Rn):i},Ui.mean=function(e){return Wt(e,al)},Ui.meanBy=function(e,t){return Wt(e,cr(t,2))},Ui.min=function(e){return e&&e.length?mn(e,al,Nn):i},Ui.minBy=function(e,t){return e&&e.length?mn(e,cr(t,2),Nn):i},Ui.stubArray=ml,Ui.stubFalse=_l,Ui.stubObject=function(){return{}},Ui.stubString=function(){return""},Ui.stubTrue=function(){return!0},Ui.multiply=Pl,Ui.nth=function(e,t){return e&&e.length?Zn(e,ps(t)):i},Ui.noConflict=function(){return xt._===this&&(xt._=ze),this},Ui.noop=cl,Ui.now=Ro,Ui.pad=function(e,t,i){e=vs(e);var n=(t=ps(t))?hi(e):0;if(!t||n>=t)return e;var a=(t-n)/2;return Wa(mt(a),i)+e+Wa(pt(a),i)},Ui.padEnd=function(e,t,i){e=vs(e);var n=(t=ps(t))?hi(e):0;return t&&nt){var a=e;e=t,t=a}if(n||e%1||t%1){var r=bi();return vi(e+r*(t-e+dt("1e-"+((r+"").length-1))),t)}return Jn(e,t)},Ui.reduce=function(e,t,i){var n=Wo(e)?Bt:Xt,a=arguments.length<3;return n(e,cr(t,4),i,a,fn)},Ui.reduceRight=function(e,t,i){var n=Wo(e)?Ot:Xt,a=arguments.length<3;return n(e,cr(t,4),i,a,xn)},Ui.repeat=function(e,t,n){return t=(n?yr(e,t,n):t===i)?1:ps(t),qn(vs(e),t)},Ui.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ui.result=function(e,t,n){var a=-1,r=(t=ya(t,e)).length;for(r||(r=1,e=i);++ah)return[];var i=x,n=vi(e,x);t=cr(t),e-=x;for(var a=qt(n,t);++i=o)return e;var l=n-hi(a);if(l<1)return a;var c=s?ba(s,0,l).join(""):e.slice(0,l);if(r===i)return c+a;if(s&&(l+=c.length-l),os(r)){if(e.slice(l).search(r)){var d,u=c;for(r.global||(r=we(r.source,vs(xe.exec(r))+"g")),r.lastIndex=0;d=r.exec(u);)var h=d.index;c=c.slice(0,h===i?l:h)}}else if(e.indexOf(da(r),l)!=l){var f=c.lastIndexOf(r);f>-1&&(c=c.slice(0,f))}return c+a},Ui.unescape=function(e){return(e=vs(e))&&J.test(e)?e.replace(Y,pi):e},Ui.uniqueId=function(e){var t=++Oe;return vs(e)+t},Ui.upperCase=qs,Ui.upperFirst=Ks,Ui.each=vo,Ui.eachRight=yo,Ui.first=Gr,ll(Ui,(bl={},Sn(Ui,(function(e,t){Be.call(Ui.prototype,t)||(bl[t]=e)})),bl),{chain:!1}),Ui.VERSION="4.17.21",wt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ui[e].placeholder=Ui})),wt(["drop","take"],(function(e,t){Zi.prototype[e]=function(n){n=n===i?1:gi(ps(n),0);var a=this.__filtered__&&!t?new Zi(this):this.clone();return a.__filtered__?a.__takeCount__=vi(n,a.__takeCount__):a.__views__.push({size:vi(n,x),type:e+(a.__dir__<0?"Right":"")}),a},Zi.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),wt(["filter","map","takeWhile"],(function(e,t){var i=t+1,n=1==i||3==i;Zi.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:cr(e,3),type:i}),t.__filtered__=t.__filtered__||n,t}})),wt(["head","last"],(function(e,t){var i="take"+(t?"Right":"");Zi.prototype[e]=function(){return this[i](1).value()[0]}})),wt(["initial","tail"],(function(e,t){var i="drop"+(t?"":"Right");Zi.prototype[e]=function(){return this.__filtered__?new Zi(this):this[i](1)}})),Zi.prototype.compact=function(){return this.filter(al)},Zi.prototype.find=function(e){return this.filter(e).head()},Zi.prototype.findLast=function(e){return this.reverse().find(e)},Zi.prototype.invokeMap=Kn((function(e,t){return"function"==typeof e?new Zi(this):this.map((function(i){return kn(i,e,t)}))})),Zi.prototype.reject=function(e){return this.filter(Bo(cr(e)))},Zi.prototype.slice=function(e,t){e=ps(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Zi(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ps(t))<0?n.dropRight(-t):n.take(t-e)),n)},Zi.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Zi.prototype.toArray=function(){return this.take(x)},Sn(Zi.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),r=Ui[a?"take"+("last"==t?"Right":""):t],o=a||/^find/.test(t);r&&(Ui.prototype[t]=function(){var t=this.__wrapped__,s=a?[1]:arguments,l=t instanceof Zi,c=s[0],d=l||Wo(t),u=function(e){var t=r.apply(Ui,Lt([e],s));return a&&h?t[0]:t};d&&n&&"function"==typeof c&&1!=c.length&&(l=d=!1);var h=this.__chain__,f=!!this.__actions__.length,x=o&&!h,p=l&&!f;if(!o&&d){t=p?t:new Zi(this);var m=e.apply(t,s);return m.__actions__.push({func:xo,args:[u],thisArg:i}),new Vi(m,h)}return x&&p?e.apply(this,s):(m=this.thru(u),x?a?m.value()[0]:m.value():m)})})),wt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ke[e],i=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ui.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var a=this.value();return t.apply(Wo(a)?a:[],e)}return this[i]((function(i){return t.apply(Wo(i)?i:[],e)}))}})),Sn(Zi.prototype,(function(e,t){var i=Ui[t];if(i){var n=i.name+"";Be.call(ki,n)||(ki[n]=[]),ki[n].push({name:t,func:i})}})),ki[za(i,2).name]=[{name:"wrapper",func:i}],Zi.prototype.clone=function(){var e=new Zi(this.__wrapped__);return e.__actions__=Da(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Da(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Da(this.__views__),e},Zi.prototype.reverse=function(){if(this.__filtered__){var e=new Zi(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Zi.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,i=Wo(e),n=t<0,a=i?e.length:0,r=function(e,t,i){var n=-1,a=i.length;for(;++n=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ui.prototype.plant=function(e){for(var t,n=this;n instanceof Hi;){var a=Nr(n);a.__index__=0,a.__values__=i,t?r.__wrapped__=a:t=a;var r=a;n=n.__wrapped__}return r.__wrapped__=e,t},Ui.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Zi){var t=e;return this.__actions__.length&&(t=new Zi(this)),(t=t.reverse()).__actions__.push({func:xo,args:[eo],thisArg:i}),new Vi(t,this.__chain__)}return this.thru(eo)},Ui.prototype.toJSON=Ui.prototype.valueOf=Ui.prototype.value=function(){return pa(this.__wrapped__,this.__actions__)},Ui.prototype.first=Ui.prototype.head,$e&&(Ui.prototype[$e]=function(){return this}),Ui}();mt?((mt.exports=mi)._=mi,pt._=mi):xt._=mi}).call(w)}(D,D.exports);var k=I(D.exports),F=function(){function e(t,i){r(this,e),this.id=i,this.jSPlugin=t,this.state={play:!1,loading:!1,text:""},this.loadingSetText=this.loadingSetText}return s(e,[{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}},{key:"setPlayStatus",value:function(e){this.state=Object.assign(this.state,e)}},{key:"loadingStart",value:function(e){var t=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(t),t.innerHTML="@keyframes antRotate {to {transform: rotate(400deg);transform-origin:50% 50%;}} .loading {display: inline-block;z-index: 1000;-webkit-animation: antRotate 1s infinite linear;animation: antRotate 1s infinite linear;}";var i=e,n=document.getElementById(i),a=n.offsetWidth,r=n.offsetHeight,o=n.offsetLeft;this.jSPlugin.isInspect&&"map"==this.jSPlugin.Theme.inspectMode&&(o=0),document.getElementById("".concat(e,"-loading-id-0"))&&document.getElementById("".concat(e,"-loading-id-0")).parentNode.removeChild(document.getElementById("".concat(e,"-loading-id-0"))),console.log("loading-id-0---------------");var s=document.createElement("div");s.setAttribute("id","".concat(e,"-loading-id-0"));var l="position:absolute;outline:none;pointer-events:none;";console.log("this.jSPlugin",this.jSPlugin),l+="width: 100%;background-size: cover; background-repeat:no-repeat;",l+="height: 100%;",l+="top:0;",l+="left:"+o+"px;",s.setAttribute("style",l),s.style.height=r,s.setAttribute("class","loading-container"),n.style.position="relative",this.jSPlugin.isInspect&&"map"==this.jSPlugin.Theme.inspectMode&&(n.style.position="absolute"),n.appendChild(s);var c=document.createElement("div"),d=document.createElement("div");c.setAttribute("class","loading-item"),c.setAttribute("id","".concat(e,"-loading-item-0"));l="display:inline-flex;pointer-events:none;flex-direction:column;justify-content:center;align-items: center;width:100%;height:"+r+"px;outline:none;vertical-align: top;position:absolute;";function u(e,t,i,n){return{top:parseInt(n/i,10)*(e/i),left:n%i*(t/i)}}l+="left:"+u(r,a,1,0).left+"px;",l+="top:"+u(r,a,1,0).top+"px;",c.setAttribute("style",l);var h=1,f=document.createElement("div");d.innerHTML="",d.style.color="#fff",f.setAttribute("class","loading"),f.setAttribute("id","loading-icon");var x='';!this.jSPlugin.isMobile&&this.jSPlugin.isCall&&(h=this.jSPlugin.width/1024,x='')),f.innerHTML=x,c.appendChild(f),c.appendChild(d),s.appendChild(c)}},{key:"loadingStop",value:function(e){var t=document.getElementById("".concat(e,"-loading-item-0"));t&&document.getElementById("loading-icon")&&t.removeChild(document.getElementById("loading-icon"))}},{key:"loadingSetText",value:function(e){var t=this;if(this.loadingClearText(),document.getElementById("".concat(this.id,"-loading-item-0"))){var i=document.getElementById("".concat(this.id,"-loading-item-0")),n=document.getElementById("".concat(this.id,"-loading-item-0")).childNodes[1];if(n||(i.style.height="100%",(n=document.createElement("div")).innerHTML=e.text,i.appendChild(n)),n.id="".concat(this.id,"-loading-item-txt"),n.innerHTML=e.text,n.style.fontSize="14px",!this.jSPlugin.isMobile&&this.jSPlugin.isCall){var a=this.jSPlugin.width/1024;n.style.fontSize="".concat(28*a,"px"),n.style.marginTop="16px"}if(this.jSPlugin.isCall&&1==e.type){var r=document.getElementById("".concat(this.id,"-loading-item-txt")),o=document.createElement("div");o.style="margin-bottom: 8px;width:24px;height:24px;",o.innerHTML='\n \n \n \n \n \n \n \n ',i.insertBefore(o,r)}if(n.style.color=e.color||"#FFFFFF",this.state.text=e.text,e.delayClear)var s=setTimeout((function(){t.loadingClearText(),clearTimeout(s)}),parseInt(e.delayClear))}}},{key:"loadingSetTextWithBtn",value:function(e){var t=this;this.loadingClear(),console.log(this.jSPlugin);var i=!!this.jSPlugin.Theme.call&&this.jSPlugin.Theme.call.themeData||null;(i&&(0===i.customConfig.bellPoster||"onCall"===this.jSPlugin.Theme.call.bellStatus)||e.mask)&&document.getElementById("".concat(this.id,"-loading-id-0"))&&(document.getElementById("".concat(this.id,"-loading-id-0")).style.background=e.maskStyle||"rgba(0,0,0,0.7)");var n=document.getElementById("".concat(this.id,"-loading-item-0"));if(n){n.style.height="100%",n.style["pointer-events"]="auto";var a=document.createElement("div");if(a.id="".concat(this.id,"-loading-item-txt"),a.innerHTML=e.text,a.title=e.text,a.style.color=e.color||"#FFFFFF",e.isMobile){var r=14*(this.jSPlugin.width/375);a.style.fontSize=r+"px"}else{var o=28*(this.jSPlugin.width/1024);a.style.fontSize=o+"px"}if(this.jSPlugin.isInspect&&(a.style="text-align: center; color: white; font-size: 14px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis; width: 70%;"),n.appendChild(a),e.type&&2==e.type){var s=8,l=24;if(e.isMobile){l=24*(this.jSPlugin.width/375)}else{var c=this.jSPlugin.width/1024;s=c<1?16*c:16,l=40*c}var d=document.getElementById("".concat(this.id,"-loading-item-txt"));(f=document.createElement("div")).style="margin-bottom: ".concat(s,"px;width:").concat(l,"px;height:").concat(l,"px;"),f.innerHTML='\n \n \n \n \n \n \n \n '),n.insertBefore(f,d)}else{var u=document.createElement("div");if(u.id="".concat(this.id,"-loading-item-btn-wrap"),u.innerHTML='\n
').concat(e.btnName,'
\n \n \n \n '),e.isMobile)1==e.type?u.style="color:white;width:100px;height:30px;border-radius: 10px;background: rgba(255,255,255,0.25);text-align:center;line-height:30px;margin-top:9px;font-size:14px;-webkit-tap-highlight-color: transparent;":u.style="border: 1px solid rgba(204,204,204,1);color:white;width:80px;height:24px;border-radius: 12px;background: rgba(255,255,255,0.1);text-align:center;line-height:24px;margin-top:20px;font-size:12px;-webkit-tap-highlight-color: transparent;";else{var h=this.jSPlugin.width/1024;u.style="color:#648FFC;margin-top:16px;cursor: pointer;font-size:".concat(24*h,"px;"),this.jSPlugin.isInspect&&"video"==this.jSPlugin.Theme.inspectMode&&(u.style="border: 1px solid rgba(255,255,255,1);color:white; cursor: pointer;text-align: center;width:80px;height:32px;border-radius:2px; text-align:center;line-height:32px;margin-top:16px;font-size:14px;-webkit-tap-highlight-color: transparent;")}if(n.appendChild(u),e.isMobile&&1==e.type){var f,x=document.getElementById("".concat(this.id,"-loading-item-txt"));(f=document.createElement("div")).style="margin-bottom: 8px;width:24px;height:24px;",f.innerHTML='\n \n \n \n \n \n \n \n ',n.insertBefore(f,x)}document.getElementById("".concat(this.id,"-loading-item-btn-wrap"))&&(document.getElementById("".concat(this.id,"-loading-item-btn-wrap")).onclick=function(){t.jSPlugin.play(),t.loadingClear(),t.loadingStart(t.id),t.loadingSetText({text:"视频加载中"})})}this.state.text=e.text,e.delayClear&&setTimeout((function(){t.loadingClearText()}),parseInt(e.delayClear))}}},{key:"loadingClearText",value:function(){if(document.getElementById("".concat(this.id,"-loading-item-0"))){var e=document.getElementById("".concat(this.id,"-loading-item-0")).childNodes;e.length>1?e[1].parentNode.removeChild(e[1]):e[0]&&e[0].parentNode.removeChild(e[0])}}},{key:"loadingClear",value:function(){if(document.getElementById("".concat(this.id,"-loading-item-0"))){for(var e=document.getElementById("".concat(this.id,"-loading-item-0")).childNodes,t=e.length-1;t>=0;t--)e[t].parentNode.removeChild(e[t]);document.getElementById("".concat(this.id,"-loading-id-0"))&&(document.getElementById("".concat(this.id,"-loading-id-0")).style.background="none"),document.getElementById("loading-icon")&&document.getElementById("loading-icon").parentNode.removeChild(document.getElementById("loading-icon"))}}},{key:"loadingEnd",value:function(){var e=document.getElementById("".concat(this.id,"-loading-item-0"));if(e){e.parentNode.removeChild(e);var t=document.getElementById("".concat(this.id,"-loading-id-0"));t&&0===t.children.length&&t.parentNode.removeChild(t)}document.getElementById("".concat(this.id,"-loading-item-0")).style.background="none"}}]),e}(),A=function(){function e(t,i){r(this,e),this.id=i,this.jSPlugin=t,this.timer=null,this.state={play:!1,loading:!1}}return s(e,[{key:"default",value:function(e,t){var i=this,n="msgId",a=t||document.getElementById("".concat(this.id,"-wrap"));document.getElementById("".concat(this.id,"-").concat(n))&&a.removeChild(document.getElementById("".concat(this.id,"-").concat(n)));var r=document.createElement("div");r.id="".concat(this.id,"-").concat(n),r.style="position: absolute;top: 50%;left:calc(50% - ".concat(14*e.length/2,"px);padding: 4px 16px;background: #00000080;color: #FFFFFF;font-size: 14px"),r.innerHTML=e,a.appendChild(r),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){var e=document.getElementById("".concat(i.id,"-").concat(n));a&&e&&a.removeChild(e)}),2e3)}}]),e}(),M={stream:{1001:"vtm地址或端口非法",1002:"vtm生成文件描述符失败",1003:"vtm设置文件描述符非阻塞失败",1004:"vtm设置文件描述符阻塞失败",1005:"vtm解析服务器ip失败",1006:"vtm描述符select失败",1007:"vtm文件描述符不在可读中",1008:"vtm网络发生错误getsockopt",1009:"vtm描述符select超时",1101:"proxy地址或端口非法",1102:"proxy生成文件描述符失败",1103:"proxy设置文件描述符非阻塞失败",1104:"proxy设置文件描述符阻塞失败",1105:"proxy解析服务器ip失败",1106:"proxy描述符select失败",1107:"proxy文件描述符不在可读中",1108:"proxy网络发生错误getsockopt",1109:"proxy描述符select超时",1201:"vtdu地址或端口非法",1202:"vtdu生成文件描述符失败",1203:"vtdu设置文件描述符非阻塞失败",1204:"vtdu设置文件描述符阻塞失败",1205:"vtdu解析服务器ip失败",1206:"vtdu描述符select失败",1207:"vtdu文件描述符不在可读中",1208:"vtdu网络发生错误getsockopt",1209:"vtdu描述符select超时",5e3:"cas回复信令,发现内存已经释放(和设备之间异常断开)",5400:"私有化协议vtm检测私有化协议中码流类型小于0或者设备序列号为空等非法参数场景返回(app不重试取流)",5402:"回放找不到录像文件",5403:"操作码或信令密钥与设备不匹配",5404:"设备不在线",5405:"流媒体向设备发送或接受信令超时/cas响应超时",5406:"token失效",5407:"客户端的URL格式错误",5409:"预览开启隐私保护",5410:"设备达到最大连接数",5411:"token无权限",5412:"session不存在",5413:"验证token异常",5415:"设备通道错",5416:"设备资源受限",5451:"设备不支持的码流类型",5452:"设备链接流媒体服务器失败",5454:"流媒体中关于设备取流会话不存在",5455:"设备通道未关联",5456:"设备通道关联设备不在线",5457:"客户端不支持端到端加密",5458:"设备不支持当前并发ECDH密",5459:"VTDU 处理ECDH 加密失败",5460:"流媒体中关于设备取流会话不存在",5492:"设备不支持的命令",5500:"服务器处理失败",5501:"流媒体vtdu达到最大负载,请扩容",5503:"vtm返回分配vtdu失败",5504:"流媒体vtdu达到最大负载",5505:"vtm ecdh解密失败",5506:"vtm 返回IPC不支持取流",5530:"机房故障不可用",5544:"设备返回无视频源",5545:"视频分享时间已经结束",5546:"vtdu返回达到取流并发路数限制",5547:"vtdu返回开放平台用户并发限制",5556:"ticket校验失败",5557:"回放服务器等待流头超时",5558:"查找录像开始时间错误",5560:"群组分享取流二次验证失败",5561:"分享群组用户被锁住",5562:"群组分享用户权限变更",5563:"认证服务连接失败",5564:"认证超时",5566:"不在分享时间内预览",5567:"分享通道被锁定",5568:"未找到认证类型",5569:"认证返回的参数异常",5600:"分享设备不在分享时间内",5601:"群组分享用户没权限",5602:"群组分享权限变更",5610:"接收流头失败",5620:"心跳超时",5701:"cas信令返回格式错误",5702:"SPGW请求Cas、Status透传超时",5703:"SPGW请求http不通",6001:"客户端参数出错",6099:"客户端默认错误",6101:"不支持的命令",6102:"设备流头发送失败",6103:"cas/设备返回错误1",6104:"cas/设备返回错误-1",6105:"设备返回错误码3",6106:"设备返回错误码4",6107:"设备返回错误码5",6108:"cas信令回应重复",6109:"视频广场取消分享",6110:"设备信令默认错误",6501:"设备数据链路和实际链路不匹配",6502:"设备数据链路重复建立连接",6503:"设备数据链路端口不匹配",6504:"缓存设备数据链路失败(内存块不足)",6505:"设备发送确认头消息重复",6506:"设备数据先于确定头部到达",6508:"设备数据头部长度非法",6509:"索引找不到设备数据管理块",6510:"设备数据链路vtdu内存块协议状态不匹配",6511:"设备数据头部没有streamkey错误",6512:"设备数据头部非法",6513:"设备数据长度过小",6514:"设备老协议推流头部没有streamkey错误",6515:"设备老协议推流数据非法",6516:"设备老协议索引找不到内存管理块",6517:"设备老协议推流数据非法",6518:"设备数据包过大",6519:"设备推流链路网络不稳定",6520:"设备推流链路网络不稳定",6700:"异常数据",6701:"回放结束",7001:"与相应服务连接失败",7002:"与相应服务连接失败",7003:"与相应服务连接失败",7004:"与相应服务连接失败",7005:"VTDU连接失败,或VTDU侧断开连接",7006:"vtm断开连接",7007:"客户端发送缓冲区满(上行带宽太小)",9e3:"无效包,包过大",9001:"地址不合法",9002:"缺少端口",9048:"免费版并发数达到上限,请升级企业版使用多并发能力","0001":"通用错误返回","0002":"入参为空指针","0003":"入参值无效","0004":"信令消息解析非法","0005":"内存资源不足","0006":"协议格式不对或者消息体长度超过STREAM_MAX_MSGBODY_LEN","0007":"设备序列号长度不合法","0008":"取流url长度不合法","0009":"解析vtm返回vtdu地址不合法","0010":"解析vtm返回级联vtdu地址不合法","0011":"解析vtm返回会话标识长度不合法","0012":"vtdu返回流头长度不合法","0013":"vtdu会话长度非法","0014":"回调函数未注册","0015":"vtdu成功响应未携带会话标识","0016":"vtdu成功响应未携带流头","0017":"无数据流,尚未使用","0018":"信令消息体PB解析失败","0019":"信令消息体PB封装失败","0020":"申请系统内存资源失败","0021":"vtdu地址尚未获取到","0022":"客户端尚未支持","0023":"获取系统socket资源失败","0024":"上层填充的StreamSsnId不匹配","0025":"链接服务器失败","0026":"客户端请求未收到服务端应答","0027":"链路断开","0028":"没有取流链接","0029":"流成功停止","0030":"客户端防串流校验失败","0031":"应用层tcp粘包处理缓冲区满","0032":"无效状态迁移","0033":"无效客户端状态","0034":"向vtm取流流媒体信息请求超时","0035":"向代理取流请求超时","0036":"向代理保活取流请求超时","0037":"向vtdu取流请求超时","0038":"向vtdu保活取流请求超时"},server:{ptz:{start:{200:"",10001:"操作失败",10002:"账号异常,操作失败",10005:"账号异常,操作失败",20002:"设备不存在,请检查设备连接情况",20006:"操作失败,请检查设备网络情况",20007:"操作失败,请检查设备在线情况",20008:"操作过于频繁,稍后再试",20014:"操作失败",20032:"通道不存在请检查设备连接情况",49999:"操作失败,请重试",6e4:"操作失败,设备不支持该操作",60001:"操作失败,用户无权限",60002:"设备已旋转到上限位",60003:"设备已旋转到下限位",60004:"设备已旋转到左限位",60005:"设备已旋转到右限位",60006:"操作失败,请重试",60009:"设备正在操作中",60020:"操作失败"},stop:{200:"",10001:"操作失败",10002:"账号异常,操作失败",10005:"账号异常,操作失败",20002:"设备不存在,请检查设备连接情况",20006:"操作失败,请检查设备网络情况",20007:"操作失败,请检查设备在线情况",20008:"操作过于频繁,稍后再试",20014:"操作失败",20032:"通道不存在请检查设备连接情况",49999:"操作失败,请重试",6e4:"操作失败,设备不支持该操作",60001:"操作失败,用户无权限",60006:"操作失败,请重试",60009:"设备正在操作中",60020:"操作失败"}},talk:{200:"",10001:"播放失败",10002:"账号异常,操作失败",10031:"账号异常,操作失败",20002:"设备不存在请检查设备连接情况",60059:"播放失败"},time:{200:"",10001:"播放失败",10002:"账号异常,播放失败",10004:"账号异常,播放失败",10005:"账号异常,播放失败",10011:"播放失败",10013:"账号异常,播放失败",10030:"播放失败",20002:"设备不存在请检查设备连接情况",20014:"播放失败",20032:"设备不存在请检查设备连接情况",49999:"播放失败请重试",60024:"播放失败请重试"}},client:{default:{BTN_RETRY:"重试",BTN_RELOAD:"重新加载",LOADING:"加载中,请稍后",TIMEFORMAT_ERROR:"时间格式有误,请确认"},init:{USE_MULTITHREADING_WARING:"您当前浏览器可以开启谷歌实验室多线程特性,获取更好播放体验,避免浏览器卡顿及崩溃,详见",OPEN_INSTRUCTIONS:"开启说明",INIT_FINSHED:"初始化播放器完成",INIT_SUCCESS:"初始化播放器成功"},play:{GET_PLAYURL_FAILED:"获取播放地址失败",VIDEO_LOADING:"视频加载中",DISCONNECT:"连接断开,请重试",DEVICE_ENCRYPTED:"设备已加密",NO_RECORD:"未找到录像片段",PLAY_FAILED:"播放失败,请检查设备及客户端网络",PLAY_SUCCESS:"播放成功",STOP_SUCCESS:"停止成功",CHANGE_PLAYURL_SUCCESS:"切换播放地址成功",CHANGE_PLAYURL_FAILED:"切换播放地址失败",GET_OSD_TIME:"获取OSD时间",GET_OSD_TIME_FAILED:"获取OSD时间失败",SET_POSTER:"设置播放器封面",RESIZE:"调整播放器尺寸",SPEED:"倍速播放",GET_SPEED:"获取当前播放速率",MAX_SPEED_LIMIT:"播放速度最大为4倍速度",MIN_SPEED_LIMIT:"播放速度最小为1倍速度",SEEK_CANNOT_CROSS_DAYS:"seek时间不能跨日期",SEEK_TIMEFORMAT_ERROR:"seek时间格式错误",PAUSE:"暂停",PAUSE_FAILED:"暂停失败",RESUME:"恢复播放",RESUME_FAILED:"恢复播放失败"},call:{CALL_END:"通话已结束",USER_DO_NOT_OWN_DEVICE:"loadingSetTextWithBtn"},cloudRecord:{NO_CLOUD_RECORD:"该设备在当天没有云录制的录像"},videoLevel:{CHANGE_VIDEO_LEVEL:"切换清晰度",GET_VIDEO_LEVEL_LIST:"获取设备支持的清晰度列表",PLEASE_INPUT_RIGHT_VIDEO_LEVEL:"请输入正确的清度"},theme:{RESET_THEME:"重置主题",BTN_PLAY:"播放/结束播放",BTN_SOUND:"声音",BTN_RECORDVIDEO:"录屏",BTN_CAPTURE:"截图",BTN_TALK:"对讲",BTN_ZOOM:"电子放大",BTN_3D_ZOOM:"3D定位",BTN_PTZ:"云台控制",BTN_EXPEND:"全局全屏",BTN_WEBEXPEND:"网页全屏",BTN_HD:"画面清晰度",BTN_SPEED:"回放倍速",BTN_CLOUDREC:"云存储回放",BTN_CLOUDRECORD:"云录制",BTN_REC:"本地存储",DEVICE_NAME:"设备名称",DEVICE_ID:"设备序列号"},capture:{CAPTURE_SUCCESS:"截图成功",CAPTURE_FAILED:"截图失败"},record:{START_RECORD_SUCCESS:"开始录制成功",START_RECORD_FAILED:"开始录制失败",STOP_RECORD_SUCCESS:"停止录制成功",STOP_RECORD_FAILED:"停止录制失败"},sound:{OPEN_SOUND:"开启声音",CLOSE_SOUND:"关闭声音"},zoom:{ZOOM:"电子放大",START_ZOOM:"开启电子放大",CLOSE_ZOOM:"关闭电子放大","3D_ZOOM":"3D定位","3D_ZOOM_DISABLE":"未启用3D定位功能","3D_ZOOM_FAILED":"3D定位失败,请重试",START_3D_ZOOM:"开启3D定位",CLOSE_3D_ZOOM:"关闭3D定位",DEVICE_NOT_SUPPORT_3D_ZOOM:"当前设备不支持3D定位功能","3D_ZOOM_ACTIVED":"3D定位已处于开启状态","3D_ZOOM_NOT_ACTIVED":"未启用3D定位功能","3D_ZOOM_CLOSED":"3D定位已处于关闭状态",CHANGE_ZOOM_TYPE:"改变缩放模式"},fullscreen:{FULLSCREEN:"全局全屏",FULLSCREEN_EXIT:"退出全局全屏",GET_WEB_FULLSCREEN_STATUS:"获取浏览器网页全屏状态",WEB_FULLSCREEN:"开启网页全屏",WEB_FULLSCREEN_EXIT:"退出网页全屏"},destroy:{DESTROY:"销毁"},capacity:{GET_CAPACITY:"获取设备能力级",GET_CAPACITY_FAILED:"获取设备能力级失败"},ptz:{GET_PTZ_STATUS:"获取当前云台状态",GET_PTZ_STATUS_FAILED:"未加载Theme模块,无法获取云台状态",MOBILE_HIDE_PTZ:"移动端,非全屏状态不展示云台",OPTION_PTZ_FAILED:"未加载Theme模块,无法操作云台"},mirror:{MIRROR:"镜像翻转",MIRROR_TYPE_ERROR:"翻转参数类型错误"},FEC:{CHANGE_FEC_TYPE:"切换鱼眼矫正类型",DEVICE_NOT_SUPPORT:"设备不支持鱼眼模式",TYPE_NOT_SUPPORT:"鱼眼矫正类型暂时不支持",FEC_SUPPORT_VERSION:"当前只有V3软解支持鱼眼矫正",NO_CANVAS_ID:"鱼眼矫正类型需要分屏,但是没有传正确的分屏的canvas id",SET_FEC_PARAMS:"设置3D矫正视角参数",GET_FEC_PARAMS:"获取3D矫正视角参数",SET_FEC_PARAMS_FAILED:"该矫正类型不能设置3D矫正视角参数",GET_FEC_PARAMS_FAILED:"该矫正类型不能获取3D矫正视角参数",GET_FEC_PARAMS_SUPPORT_VERSION:"当前只有V3软解支持鱼眼矫正获取3D矫正视角参数"},watermark:{SET_WATERMARK:"设置水印"}}},L={color:"red",backgroundColor:"red",activeColor:"red",btnList:[{btnKey:"ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-0",iconId:"deviceID",part:"left",defaultActive:1,isrender:1,themeId:"934f270c08b14e928bf0c2ae8e1a937d"},{btnKey:"ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-header-1",iconId:"deviceName",part:"left",defaultActive:1,isrender:1,themeId:"934f270c08b14e928bf0c2ae8e1a937d"}]},B={color:"blue",backgroundColor:"blue",activeColor:"blue",btnList:[{btnKey:"ade5d065a113432e8091a1c5bc819c57-934f270c08b14e928bf0c2ae8e1a937d-footer-0",iconId:"play",part:"left",defaultActive:0,isrender:0,themeId:"934f270c08b14e928bf0c2ae8e1a937d"}]},O=function e(t){this.jsPlugin=t;var i={isMouseDown:!1,isOver:!1,mousePosition:null,oldTime:null,nowTime:t.nowTime||null,moved:null,hoverTime:"2018-12-07 12:00:00",hoverLeft:0,timeTipShow:!1,randomNum:123,timeWidthTbls:[60,1800,3600,86400],timeUnits:["范围: 1分钟; 单位: 秒","范围: 30分钟; 单位: 分钟","范围: 1小时; 单位: 分钟","范围: 1天; 单位: 小时","范围: 3天; 单位: 小时"],drawPen:null,timeSection:[],canvasWidth:null,canvasHeight:null,timeTips:null},n=this;Object.keys(i).forEach((function(e){n[e]=i[e]})),this.options={width:this.canvasWidth,height:48,time:(new Date).getTime(),timeSection:[],timeWidth:0},e.prototype.subTime=function(e){return e<10?"0"+e:e},e.prototype.tranTime=function(e){var t=e;if(e){var i=new Date(e);t=i.getFullYear()+"/"+(i.getMonth()+1)+"/"+i.getDate()+" "+this.subTime(i.getHours())+":"+this.subTime(i.getMinutes())+":"+this.subTime(i.getSeconds())}return t},e.prototype.init=function(e){var t=this.options;return new Promise((function(i,a){e.width&&document.getElementById(e.id).setAttribute("width",parseInt(e.width,10)+"px"),n.randomNum=(Math.random()+"").split(".").join(""),n.timeWidthTblIndex=t.timeWidth;var r=document.getElementById("".concat(n.jsPlugin.id,"-canvas"));n.drawPen=r.getContext("2d"),n.nowTime=e.nowTime,n.timeSection=t.timeSection||[],n.canvasWidth=r.offsetWidth,n.canvasHeight=r.offsetHeight,n.updata(),document.getElementById("".concat(n.jsPlugin.id,"-canvas")).addEventListener("mousemove",(function(e){n.options.readOnly||n.mousemove(e)})),document.getElementById("".concat(n.jsPlugin.id,"-canvas")).addEventListener("mouseover",(function(e){n.options.readOnly||n.mouseover(e)})),document.getElementById("".concat(n.jsPlugin.id,"-canvas")).addEventListener("mouseleave",(function(e){n.options.readOnly||n.mouseleave(e)})),document.getElementById("".concat(n.jsPlugin.id,"-canvas")).addEventListener("mousedown",(function(e){n.options.readOnly||n.mousedown(e)})),document.getElementById("".concat(n.jsPlugin.id,"-canvas")).addEventListener("mouseup",(function(t){if(!n.options.readOnly){var i=e.onChange;n.mouseUpFn(t,i)}})),i()}))},e.prototype.setWidth=function(e){e.width&&(document.getElementById(e.id).width=e.width,document.getElementById("".concat(e.id,"-canvas")).width=e.width,document.getElementById("".concat(e.id,"-canvas-container")).width=e.width,n.canvasWidth=e.width,n.updata({time:n.nowTime||new Date}))},e.prototype.mousemove=function(e){if(this.isMouseDown&&this.isOver){var t=this.mousePosition-e.pageX;if(0===t)return;var i=0;switch(this.timeWidth){case 60:i=.1;break;case 1800:i=3;break;case 3600:i=90;break;case 86400:i=120}var n=new Date(this.oldTime).getTime()+t*i*1e3;this.updata({time:n}),this.moved=!0}else{var a=parseInt(document.getElementById("".concat(this.jsPlugin.id,"-canvas-container")).offsetLeft,10);this.mousePosition=e.pageX-a,this.updata()}},e.prototype.mousedown=function(e){this.isMouseDown=!0,this.mousePosition=e.pageX,this.oldTime=this.nowTime},e.prototype.mouseover=function(e){this.isOver=!0},e.prototype.mouseleave=function(e){this.isOver=!1,this.isMouseDown=!1,this.updata()},e.prototype.changeSize=function(e){console.log("changeSize",e),this.options.timeWidth=e,this.updata({timeWidth:e})},e.prototype.mouseUpFn=function(e,t){if(this.isMouseDown&&(this.isMouseDown=!1,this.moved)){this.moved=!1;var i=new Date(this.nowTime).getFullYear()+"/"+(new Date(this.nowTime).getMonth()+1)+"/"+new Date(this.nowTime).getDate()+" "+this.subTime(new Date(this.nowTime).getHours())+":"+this.subTime(new Date(this.nowTime).getMinutes())+":"+this.subTime(new Date(this.nowTime).getSeconds());this.nowTime=new Date(i),this.updata({time:this.nowTime}),this.oldTime=this.nowTime,console.log("nowTime",new Date(this.nowTime),i),t(this.nowTime)}},e.prototype.readOnly=function(e){console.log("更改为只读"),this.options.readOnly=!0,document.getElementById("".concat(this.jsPlugin.id,"-canvas")).style.cursor="not-allowed"},e.prototype.unReadOnly=function(e){console.log("更改为只读"),this.options.readOnly=!1,document.getElementById("".concat(this.jsPlugin.id,"-canvas")).style.cursor="pointer"},e.prototype.run=function(e){n.isMouseDown||n.updata(e)},e.prototype.getTime=function(e){console.log("this",this),console.log("当前时间",new Date(this.nowTime))},e.prototype.updata=function(e){e=e||{},n.nowTime=e.time||n.nowTime,n.timeSection=e.timeSection||n.timeSection,n.timeWidthTblIndex=e.timeWidth||n.timeWidthTblIndex,n.timeWidth=n.timeWidthTbls[e.timeWidth||n.timeWidthTblIndex],n.timeUnit=n.timeUnits[e.timeWidth||n.timeWidthTblIndex],0===e.timeWidth&&(n.timeWidthTblIndex=0,n.timeWidth=n.timeWidthTbls[0],n.timeUnit=n.timeUnits[0]),n.drawPen.fillStyle="#000000",n.drawPen.fillRect(0,0,n.canvasWidth,n.canvasHeight),n.drawScale(),n.drawRecord(),n.drawOtherMsg()},e.prototype.drawSolidLine=function(e,t,i,n,a,r){this.drawPen.save(),this.drawPen.strokeStyle=r,this.drawPen.lineWidth=a,this.drawPen.beginPath(),this.drawPen.moveTo(e,t),this.drawPen.lineTo(i,n),this.drawPen.stroke(),this.drawPen.restore()},e.prototype.drawString=function(e,t,i,n,a){this.drawPen.font="12px serif",this.drawPen.fillStyle="#ffffff",this.drawPen.textAlign=n||"left",this.drawPen.fillText(e,t,i+10)},e.prototype.drawScale=function(){var e=this,t="rgba(255,255,255)",i=new Date(e.nowTime),n=i.getSeconds(),a=i.getMinutes(),r=i.getHours(),o=i.getDate(),s=0;switch(e.timeWidth){case 60:var l=parseInt(e.canvasWidth/10);i.setSeconds(i.getSeconds()-parseInt(l/2,10)),o=i.getDate(),r=i.getHours(),a=i.getMinutes(),n=i.getSeconds();for(var c=0;ct.canvasWidth&&(n=t.canvasWidth),n<=0&&(n=0),n}},e.prototype.drawOtherMsg=function(){this.drawSolidLine(this.canvasWidth/2,0,this.canvasWidth/2,this.canvasHeight,2,"#1890FF"),this.drawPen.shadowBlur=0,this.isOver&&!this.isMouseDown?(this.mouseTime=this.mousePosition/this.canvasWidth*this.timeWidth*1e3+this.nowTime-this.timeWidth/2*1e3,this.mouseString=this.tranTime(this.mouseTime),this.hoverTime=this.mouseString,this.hoverLeft=this.mousePosition-60,this.timeTipShow=!0):this.timeTipShow=!1}},j="https://open.ys7.com",N=256,U=1536,z=2304,H=[{place:3,name:"鱼眼不矫正",type:0,correctType:0},{place:3,name:"360°全景",type:1,correctType:768},{place:3,name:"4分屏",type:4,correctList:[{correctType:N,x:.25,y:.25},{correctType:N,x:.75,y:.25},{correctType:N,x:.25,y:.75},{correctType:N,x:.75,y:.75}],correctType:N},{place:3,name:"柱状",type:5,correctType:U,viewParam:{x:0,y:0}}],V=[{place:1,name:"鱼眼不矫正",type:0,correctType:0},{place:1,name:"360°全景",type:1,correctType:768},{place:1,name:"4分屏",type:2,correctList:[{correctType:N,x:.25,y:.25},{correctType:N,x:.75,y:.25},{correctType:N,x:.25,y:.75},{correctType:N,x:.75,y:.75}],correctType:N},{place:1,name:"广角",type:4,correctType:z}];var Z=j,W=function(){function e(t){return r(this,e),e.instant?e.instant:(Z=t||Z,e.instant=this)}return s(e,[{key:"setDomain",value:function(e){Z=e||Z}},{key:"fetch",value:function(e){function t(t,i){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){return e="string"==typeof e?/^http/.test(e)?e:Z+e:e,new Promise((function(i,n){fetch(e,t).then((function(e){try{return e.json()}catch(e){n({code:-1,msg:"data json parse error"})}})).then((function(e){200==+e.code||e.meta&&200===e.meta.code?i(e):n(e)})).catch((function(e){n(e)}))}))}))}]),e}();function G(e){var t=e.slice(0,4),i=e.slice(4,6),n=e.slice(6,8),a=e.slice(8,10),r=e.slice(10,12),o=e.slice(12,14);return new Date("".concat(t,"/").concat(i,"/").concat(n," ").concat(a,":").concat(r,":").concat(o))}function Y(e,t){var i,n,a={startTime:t.startTime?new Date(t.startTime).Format("yyyy-MM-dd hh:mm:ss"):void 0,endTime:t.startTime?new Date(t.endTime).Format("yyyy-MM-dd hh:mm:ss"):void 0,spaceId:t.spaceId},r=Object.keys(a).reduce((function(e,t){return null==a[t]?e:e+="&".concat(t,"=").concat(encodeURIComponent(a[t]))}),"").replace("&",""),o=e.env.domain+"/api/service/cloudrecord/video/info/list?".concat(r);return(i=o,n={method:"get",headers:{accessToken:t.accessToken,deviceSerial:t.deviceSerial,localIndex:t.channelNo}},new Promise((function(e,t){fetch(i,n).then((function(e){return e.json()})).then((function(i){200==+i.code||i.meta&&200===i.meta.code?e(i):t(i)})).catch((function(e){t(e)}))}))).then((function(e){return e.data=(e.data||[]).map((function(e){return e.endTime=G(e.stopTime).getTime(),e.startTime=G(e.startTime).getTime(),e.busType=7,e})),e}))}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(t<=-24||t>=24)&&(t=0);var i=e.slice(0,4),n=e.slice(4,6),a=e.slice(6,8),r=e.slice(8,10),o=e.slice(10,12),s=e.slice(12,14),l=new Date(Date.UTC(i,n-1,a,r,o,s));l.setHours(l.getHours()+t),l>new Date&&(l=new Date);var c=l.getUTCFullYear(),d=("0"+(l.getUTCMonth()+1)).slice(-2),u=("0"+l.getUTCDate()).slice(-2),h=("0"+l.getUTCHours()).slice(-2),f=("0"+l.getUTCMinutes()).slice(-2),x=("0"+l.getUTCSeconds()).slice(-2);return new Date("".concat(c,"/").concat(d,"/").concat(u," ").concat(h,":").concat(f,":").concat(x))}l(W,"instant",void 0);var J=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(t<=-24||t>=24)&&(t=0);var i=60*t*60*1e3,n=e.getTime()+i;return new Date(n)},q=function(){function e(t){if(r(this,e),this.jSPlugin=t,!document.getElementById("".concat(this.jSPlugin.id,"-audioControls")))return!1;this.currentTimeWidth=0,this.date=new Date,this.datepickerVisible=!1,this.seekTimer=null,this.disabled=!1,this.isSeeking=!1,this.seekFrequency=2e3,this.recList=[],this.lastDate=null,this.nowTime=null,this.jSPlugin.params&&this.jSPlugin.params.seekFrequency&&(this.seekFrequency=this.jSPlugin.params.seekFrequency),this.recInit()}return s(e,[{key:"recInit",value:function(){var e=this;if(!document.getElementById("".concat(this.jSPlugin.id,"-audioControls")))return!1;this.currentTimeWidth=0;var t=parseInt(getComputedStyle(document.getElementById(this.jSPlugin.id)).width,10)-100,i=document.createElement("div");i.style="display:inline-block;height:48px;",i.id=this.jSPlugin.id+"-canvas-container";var n=document.createElement("canvas");n.id=this.jSPlugin.id+"-canvas",n.className="time-line-body",n.height="48",n.width=t,n.style="display:inline-block;",n.innerHTML="该浏览器不支持canvas",i.appendChild(n),g(i,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")));var a=document.createElement("div");a.className="timeline-controls",a.style="display:flex;width:100px;height:48px;text-align:center;line-height: 48px;vertical-align: top;background: #000000;";var r='\n
\n \n \n add\n \n \n \n \n \n \n \n \n \n \n \n \n \n reduce\n \n \n \n \n \n \n \n \n
\n\n\n');a.innerHTML=r,g(a,i),this.timeLine=new O(this.jSPlugin);var o=this;this.timeLine.init({id:this.jSPlugin.id+"-canvas",width:t,nowTime:this.nowTime,onChange:function(t){console.log("time",t,new Date(t).Format("yyyyMMddhhmmss"));var i=new Date(t).Format("yyyyMMddhhmmss");if(console.log("----------------this.jSPlugin.url",e.jSPlugin.url),e.jSPlugin.Theme&&e.jSPlugin.Theme.decoderState.state.recordvideo&&(e.jSPlugin.Theme.setDecoderState({recordvideo:!1}),"cloud.rec"===P(e.jSPlugin.url).type&&e.jSPlugin.stopSave()),"cloud.rec"===P(e.jSPlugin.url).type||e.jSPlugin.useSeek&&e.jSPlugin.capacity&&"1"==e.jSPlugin.capacity.support_seek_playback)e.isSeeking||o.recList.length>0&&(new Date(t).valueOf()>=o.lastDate?e.jSPlugin.pluginStatus.loadingSetText({text:"seek回放未找到录像片段",color:"red",delayClear:2e3}):e.unSyncTimeLine().then((function(){e.isSeeking=!0,e.jSPlugin.pluginStatus.loadingStart(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),e.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),e.jSPlugin.Theme.setDisabled(!0),e.jSPlugin._tempSeekTime=t,e.jSPlugin.seek(i.substr(8,6),"235959").then((function(){var i=setInterval((function(){e.jSPlugin._destroy?clearInterval(i):e.jSPlugin.getOSDTime().then((function(n){var a=new Date(t).valueOf()/1e3;if(console.log("seek时间同步:",new Date(1e3*n.data).Format("hh:mm:ss"),new Date(1e3*a).Format("hh:mm:ss"),n.data>=a),n.data>=a-2){if(e.isSeeking=!1,e.syncTimeLine(),clearInterval(i),e.jSPlugin.pluginStatus.loadingStop(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),e.jSPlugin.pluginStatus.loadingClear(),e.jSPlugin.Theme.setDisabled(!1),e.jSPlugin._tempSeekTime=null,e.jSPlugin.Theme)e.jSPlugin.Theme.decoderState.state.sound&&e.jSPlugin.openSound();o.jSPlugin.waterMark_JSPlugin&&o.jSPlugin.setWaterMarkFont(o.jSPlugin.waterMark_JSPlugin)}}))}),1e3)}))})));else{var n=function(){setTimeout((function(){e.disabled=!1}),e.seekFrequency)},a=e.jSPlugin.Theme.decoderState.state.play,r=function(t){e.disabled=!0,a?e.unSyncTimeLine().then((function(){e.jSPlugin.pluginStatus.loadingStart(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),e.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),e.jSPlugin.Theme.setDisabled(!0),e.jSPlugin.pause(i).then((function(){console.log("暂停成功"),e.jSPlugin.resume(i).then((function(i){console.log("恢复成功:",i),e.jSPlugin.Theme&&e.jSPlugin.Theme.setDecoderState({play:!0}),e.jSPlugin.Theme&&e.jSPlugin.Theme.decoderState.state.sound&&e.jSPlugin.openSound(),t&&t(),e.syncTimeLine(),e.jSPlugin.pluginStatus.loadingStop(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),e.jSPlugin.pluginStatus.loadingClear(),e.jSPlugin.Theme.setDisabled(!1),o.jSPlugin.waterMark_JSPlugin&&o.jSPlugin.setWaterMarkFont(o.jSPlugin.waterMark_JSPlugin)})).catch((function(e){console.log("恢复失败",e)}))})).catch((function(){console.log("暂停失败"),e.jSPlugin.resume(i).then((function(i){console.log("恢复成功"),e.jSPlugin.Theme&&e.jSPlugin.Theme.setDecoderState({play:!0}),t&&t(),e.syncTimeLine(),e.jSPlugin.pluginStatus.loadingStop(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),e.jSPlugin.pluginStatus.loadingClear(),e.jSPlugin.Theme.setDisabled(!1),o.jSPlugin.waterMark_JSPlugin&&o.jSPlugin.setWaterMarkFont(o.jSPlugin.waterMark_JSPlugin)})).catch((function(e){console.log("恢复失败",e)}))}))})):e.unSyncTimeLine().then((function(){e.jSPlugin.pluginStatus.loadingStart(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),e.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),e.jSPlugin.Theme.setDisabled(!0),e.jSPlugin.pause(i).then((function(){console.log("暂停成功"),e.jSPlugin.resume(i).then((function(i){e.jSPlugin.Theme&&e.jSPlugin.Theme.setDecoderState({play:!0}),e.jSPlugin.Theme&&e.jSPlugin.Theme.decoderState.state.sound&&e.jSPlugin.openSound(),t&&t(),e.syncTimeLine(),e.jSPlugin.pluginStatus.loadingStop(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),e.jSPlugin.pluginStatus.loadingClear(),e.jSPlugin.Theme.setDisabled(!1)})).catch((function(e){console.log("恢复失败",e)}))})).catch((function(){console.log("暂停失败"),e.jSPlugin.resume(i).then((function(i){e.jSPlugin.Theme&&e.jSPlugin.Theme.setDecoderState({play:!0}),t&&t(),e.syncTimeLine(),e.jSPlugin.pluginStatus.loadingStop(e.jSPlugin.id),e.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),e.jSPlugin.pluginStatus.loadingClear(),e.jSPlugin.Theme.setDisabled(!1)})).catch((function(e){console.log("恢复失败",e)}))}))})),e.jSPlugin.Theme&&e.jSPlugin.Theme.decoderState&&e.jSPlugin.Theme.decoderState.state&&e.jSPlugin.Theme.decoderState.state.zoom&&(e.jSPlugin.Theme.setDecoderState({zoom:!1}),e.jSPlugin.Zoom.stopZoom())};e.disabled?(console.log("操作频繁,等待2秒后执行"),e.seekTimer&&clearTimeout(e.seekTimer),e.seekTimer=setTimeout((function(){r(n)}),e.seekFrequency)):r(n)}}}).then((function(){e.syncTimeLine(),console.log(e.timeLine)}));var s,l,c=this;s=c.jSPlugin,l=document.getElementById("".concat(s.id,"-wrap")),p("".concat(s.staticPath,"/rec/datepicker.min.css")),x("".concat(s.staticPath,"/rec/jquery.min.js"),(function(e){x("".concat(e.staticPath,"/rec/datepicker.js"),(function(e){x("".concat(e.staticPath,"/rec/datepicker.zh-CN.js"),(function(e){var t=l.getElementsByClassName("datepicker-container")[0];!t&&$("#".concat(e.id,"-datepicker")).datepicker&&$("#".concat(e.id,"-datepicker")).datepicker({autoShow:!1,autoHide:!0,autoPick:!0,language:"zh-CN",date:new Date(_("begin",e.params.url).replace(/(\d{4})(\d{2})(\d{2})/,"$1-$2-$3"))||new Date,format:"yyyy-mm-dd",endDate:new Date,inline:!0,container:l}),(t=l.getElementsByClassName("datepicker-container")[0])&&(t.style.display="none"),c.datepickerVisible=!1,$("#".concat(e.id,"-datepicker")).on("pick.datepicker",(function(i){if(console.log("重新选择日期",i.date,new Date(i.date).Format("yyyyMMddhhmmss"),new Date(document.getElementById("".concat(e.id,"-datepicker")).value).Format("yyyyMMdd")),i.date>new Date||new Date(i.date).Format("yyyyMMddhhmmss")===new Date(document.getElementById("".concat(e.id,"-datepicker")).value).Format("yyyyMMdd"))i.preventDefault();else{var n=new Date(i.date).Format("yyyy-MM-dd");document.getElementById("".concat(e.id,"-datepicker")).value=n,e.eventEmitter.emit("recStartTimeChange",{code:0,data:{time:n}}),c.renderRec(i.date),e.Theme.decoderState&&e.Theme.decoderState.state?e.Theme.decoderState.state.cloudRec?e.changePlayUrl({begin:new Date(i.date).Format("yyyyMMddhhmmss"),type:"cloud.rec"},(function(){}),!1):e.Theme.decoderState.state.rec?e.changePlayUrl({begin:new Date(i.date).Format("yyyyMMddhhmmss"),type:"rec"},(function(){}),!1):e.changePlayUrl({begin:new Date(i.date).Format("yyyyMMddhhmmss")},(function(){}),!1):e.changePlayUrl({begin:new Date(i.date).Format("yyyyMMddhhmmss")},(function(){}),!1)}t&&(t.style.display="none"),c.datepickerVisible=!1,e.Theme&&e.Theme.decoderState&&e.Theme.decoderState.state&&e.Theme.decoderState.state.zoom&&(e.Theme.setDecoderState({zoom:!1}),e.Zoom.stopZoom())})),$("#".concat(e.id,"-datepicker")).off("click").on("click",(function(e){console.log("点击日期"),c.datepickerVisible?t&&(t.style.display="none"):t&&(t.style.display="inline"),c.datepickerVisible=!c.datepickerVisible}))}),(function(){}),e)}),(function(){}),e)}),(function(){}),s),document.getElementById("".concat(this.jSPlugin.id,"-timeline-scale-add")).onclick=function(){e.unSyncTimeLine().then((function(){e.currentTimeWidth<3&&e.timeLine.changeSize(++e.currentTimeWidth),e.syncTimeLine()}))},document.getElementById("".concat(this.jSPlugin.id,"-timeline-scale-sub")).onclick=function(){e.unSyncTimeLine().then((function(){e.currentTimeWidth>0&&e.timeLine.changeSize(--e.currentTimeWidth),e.syncTimeLine()}))};var d=_("begin",this.jSPlugin.url)||(new Date).Format("yyyyMMdd");d=X(d,_("timeZone",this.jSPlugin.url)?parseInt(_("timeZone",this.jSPlugin.url)):0),this.renderRec(d.Format("yyyy-MM-dd")),this.observer=new MutationObserver((function(e,t){}));var u=document.getElementById("".concat(this.jSPlugin.id));this.observer.observe(u,{attributes:!0,attributeOldValue:!0,attributeFilter:["style"]})}},{key:"setDatepickerDate",value:function(e){var t=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));if(t){var i=t.getElementsByClassName("datepicker-container")[0];if(i){var n=i;n.parentNode.removeChild(n),document.getElementById("".concat(this.jSPlugin.id,"-datepicker")).value=e.replace(/(\d{4})(\d{2})(\d{2})/,"$1-$2-$3"),$("#".concat(this.jSPlugin.id,"-datepicker")).datepicker({autoShow:!1,autoHide:!0,autoPick:!0,language:"zh-CN",defaultDate:e,format:"yyyy-mm-dd",endDate:new Date,inline:!0,container:document.getElementById("".concat(this.jSPlugin.id,"-wrap"))})}}}},{key:"datepickerHide",value:function(){var e=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));e&&(e.getElementsByClassName("datepicker-container")[0].style.display="none");this.datepickerVisible=!1}},{key:"datepickerShow",value:function(){var e=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));e&&(e.getElementsByClassName("datepicker-container")[0].style.display="inline");this.datepickerVisible=!0}},{key:"recAutoSize",value:function(e){var t=this,i=this,n=parseInt(getComputedStyle(document.getElementById(i.jSPlugin.id)).width,10)-100;document.getElementById("".concat(this.jSPlugin.id,"-canvas"))&&n!==parseInt(document.getElementById("".concat(i.jSPlugin.id,"-canvas")).width)&&i.unSyncTimeLine().then((function(){i.timeLine.setWidth({id:"".concat(t.jSPlugin.id),width:n}),i.syncTimeLine(),e&&e()}))}},{key:"syncTimeLine",value:function(){var e=this;this.jSPlugin.recTimer&&clearInterval(this.jSPlugin.recTimer),Array.isArray(window.recTimer)&&window.recTimer.map((function(e){clearInterval(e)})),window.recTimer=[];var t=this;this.jSPlugin.recTimer=setInterval((function(){t.jSPlugin.getOSDTime().then((function(i){var n=i.data;if(-1===n)console.log("获取播放时间错误");else if(n>0){var a=new Date(n>1e12?n:1e3*n);e.nowTime=a,t.timeLine.run({time:a})}})).catch((function(e){var i=t.jSPlugin.Theme.decoderState.state.pauseDate;t.timeLine.run({time:t.timeLine.nowTime||i})}))}),1e3),window.recTimer.push(this.jSPlugin.recTimer)}},{key:"unSyncTimeLine",value:function(){var e=this;return new Promise((function(t,i){e.jSPlugin.recTimer&&(clearInterval(e.jSPlugin.recTimer),e.jSPlugin.recTimer=null),Array.isArray(window.recTimer)&&(window.recTimer.map((function(e){clearInterval(e)})),window.recTimer=[]),t()}))}},{key:"renderRec",value:function(e){var t=this;this.date=e;var i=this,n=new Date(new Date(e).Format("yyyy-MM-dd 00:00:00").replace(/-/g,"/")).getTime();console.log("%c---------------renderRec-----------------------","font-size: 20px; color:red;",this.jSPlugin.timeZone),this.jSPlugin.timeZone&&-1===this.jSPlugin.url.indexOf(".cloud")&&(n=new Date(J(new Date(n),this.jSPlugin.timeZone).Format("yyyy-MM-dd 00:00:00").replace(/-/g,"/")).getTime());var a=new Date(new Date(n).Format("yyyy-MM-dd 23:59:59").replace(/-/g,"/")).getTime();if(this.timeLine.getRecord([],n,a),this.jSPlugin._isCloudRecord&&-1!==this.jSPlugin.url.indexOf(".cloud")&&"7"===_("busType",this.jSPlugin.url)){var r={accessToken:this.jSPlugin.accessToken,deviceSerial:P(this.jSPlugin.url).deviceSerial,channelNo:P(this.jSPlugin.url).channelNo,startTime:n,endTime:a,spaceId:this.jSPlugin._spaceId};Y(this.jSPlugin,r).then((function(e){if(e.data&&e.data.length>0){var r=e.data;i.recList=r,i.lastDate=r[r.length-1].endTime,t.timeLine.getRecord(r,n,a)}}))}else{var o={accessToken:this.jSPlugin.accessToken,recType:"cloud.rec"===P(this.jSPlugin.url).type?1:2,deviceSerial:P(this.jSPlugin.url).deviceSerial,channelNo:P(this.jSPlugin.url).channelNo,startTime:n,endTime:a,version:"2.0"},s=this.jSPlugin.env.domain+"/api/lapp/video/by/time";C(s,"POST",o,"",(function(e){if(e.data&&e.data.files&&e.data.files.length>0){var r=e.data.files,s=(new Date).getTime(),l=e.data.isAll;if(i.recList=r,i.lastDate=r[r.length-1].endTime,l)t.timeLine.getRecord(r,n,a);else{!function e(){o.startTime=s,C(this.jSPlugin.env.domain+"/api/lapp/video/by/time","POST",o,"",(function(t){t.data&&t.data.files&&t.data.files.length>0?0==t.data.isAll?(t.data.files&&(r=r.concat(t.data.files),i.recList=r,i.lastDate=r[r.length-1].endTime),s=t.data.nextFileTime>0?t.data.nextFileTime:(new Date).getTime(),e()):(console.log("云存储执行渲染片段"),i.timeLine.getRecord(r,n,a)):i.timeLine.getRecord(r,n,a)}))}()}t.timeLine.run({time:new Date(n)})}else e.data&&e.data.length>0&&(console.log("获取本地录像片段成功",e),i.recList=e.data,i.lastDate=e.data[e.data.length-1].endTime,i.timeLine.getRecord(e.data,n,a),i.timeLine.run({time:new Date(n)}))}))}}}]),e}(),K=function(e){console.log("执行TimeLine - params",e),this.state={id:e.id,start:"00:00:00",end:"24:00:00",current:0,timelag:30,timeArr:[],availTimeLine:[],scrollTop:0,index:0,date:"",noTimeLineTxt:"",disabled:!1};var t=this;this.setState=function(e){Object.keys(e).forEach((function(i){t.state[i]=e[i],"scrollTop"===i&&document.getElementById("time-line-item").parentNode.scrollTo(0,e[i]),"current"===i&&(document.getElementById("time-line-current").innerHTML=e[i])}))},this.setDisabled=function(e){this.setState({disabled:e}),document.getElementById("time-line-item").parentNode.style.overflowY=e?"hidden":"scroll"},this.timeToSecond=function(e){var t=e.split(":"),i=Number(t[0]),n=Number(t[1]),a=Number(t[2]);return 60*i*60+60*n+(a||0)},this.minuteToTime=function(e){var t=Math.floor(e/60),i=e%60;return(t>9?t:"0"+t)+":"+(i>9?i:"0"+i)},this.timeToMinute=function(e){var t=e.split(":");return 60*Number(t[0])+Number(t[1])},this.getPlayParam=e.getPlayParam,this.checkIsAppleDevice=function(){var e=navigator.userAgent,t=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),i=e.indexOf("iPad")>-1,n=e.indexOf("iPhone")>-1||e.indexOf("Mac")>-1;return!!(t||i||n)},this.checkIsHarmonyOS=function(){return navigator.userAgent.indexOf("ohos")>-1},this.checkIsHarmonyOS()?(document.getElementById("time-line-item").parentNode.addEventListener("touchstart",(function(){if(t.state.disabled)return!1;e.ontouchstart()}),!1),document.getElementById("time-line-item").parentNode.addEventListener("touchmove",(function(){if(t.state.disabled)return!1;e.ontouchmove()}),!1),document.getElementById("time-line-item").parentNode.addEventListener("touchend",(function(){if(t.state.disabled)return!1;var i;new Promise((function(e,t){var n=-1;i=setInterval((function(){var t=document.getElementById("time-line-item").parentNode.scrollTop;t!==n?(console.log("scolling",t,n),n=t):(console.log("scoll stop",t,n),clearInterval(i),e(t))}),100)})).then((function(e){console.log("scollPromise: then",e,t),t.rectTopTotime(e),console.log("页面滚动实际高度",e,t.state),t.getPlayParam({current:t.state.current})})),e.ontouchend()}),!1)):(document.getElementById("time-line-item").parentNode.ontouchstart=function(){if(t.state.disabled)return!1;e.ontouchstart()},document.getElementById("time-line-item").parentNode.ontouchmove=function(){if(t.state.disabled)return!1;e.ontouchmove()},document.getElementById("time-line-item").parentNode.ontouchend=function(){if(t.state.disabled)return!1;var i;new Promise((function(e,t){var n=-1;i=setInterval((function(){var t=document.getElementById("time-line-item").parentNode.scrollTop;t!==n?(console.log("scolling",t,n),n=t):(console.log("scoll stop",t,n),clearInterval(i),e(t))}),100)})).then((function(e){console.log("scollPromise: then",e,t),t.rectTopTotime(e),console.log("页面滚动实际高度",e,t.state),t.getPlayParam({current:t.state.current})})),e.ontouchend()}),this.matchTimeDot()};K.prototype.changeScale=function(e){this.setState({timelag:e}),this.matchTimeDot()},K.prototype.setDateLine=function(e,t){e.length>0?(void 0===t&&(t=e.length-1),this.setState({availTimeLine:e,start:e[t].st,end:e[t].et,current:e[t].st}),console.log("this.state",this.state),this.matchRecTimeDot(),this.primaryOffsetH()):(this.setState({availTimeLine:[]}),console.log("this.state",this.state),this.matchRecTimeDot())},K.prototype.matchTimeDot=function(){var e=this.state,t=e.start,i=e.end,n=e.timelag;e.availTimeLine,console.log("start",t,"end",i);for(var a=[],r=this.timeToMinute(i),o=r=Math.floor(r/n)*n;o>=0;){var s=0,l=0;o==r&&(s=70),0==o&&(l=230);var c=this.minuteToTime(o);a.push({id:o,current:c,label:"a"+o,marginTop:s,marginBottom:l,recArr:[]}),o-=n}this.setState({timeArr:a}),this.renderDateLine()},K.prototype.matchRecTimeDot=function(){var e=this.state,t=e.start,i=e.end,n=e.timelag,a=e.availTimeLine,r=e.timeArr;console.log("start",t,"end",i);var o=[],s=a.length;if(0===s)for(var l=0;lu&&r[l].id')})),a+="
').concat(e.current,"
"),i.innerHTML=a,n.appendChild(i)}))},K.prototype.primaryOffsetH=function(){var e=this.state,t=e.start,i=e.timelag,n=e.timeArr[0].current,a=this.timeToSecond(n)-this.timeToSecond(t),r=Math.ceil(a/i)+60;this.setState({scrollTop:r}),console.log("起始偏移量",r)},K.prototype.currentOffsetH=function(){var e=this.state,t=e.current,i=e.timelag,n=e.timeArr[0].current,a=this.timeToSecond(n)-this.timeToSecond(t),r=Math.ceil(a/i)+60;this.setState({scrollTop:r})},K.prototype.rectTopTotime=function(e){var t,i,n=this.state.timelag,a=Math.floor(e/60),r=e-60*a;if(console.log("index:",a,"offsetH:",r),0==r)t=this.state.timeArr[a-1].current,i=0;else{var o=this.state.timeArr[a].current,s=this.timeToMinute(o),l=(60-r)*n,c=Math.floor(l/60)+s,d=60*Math.floor(l/60);i=Math.ceil(l-d),t=this.minuteToTime(c)}this.setState({current:t+":"+(i>9?i:"0"+i),scrollTop:e})},K.prototype.stepScrollTimeLine=function(e){this.setState({current:e}),this.currentOffsetH()},K.prototype.secondCountDown=function(e){var t=this.state.current.split(":"),i=60*Number(t[0])*60+60*Number(t[1])+Number(t[2])+1,n=Math.floor(i/3600),a=Math.floor((i-3600*n)/60),r=i-3600*n-60*a;this.setState({current:(n>9?n:"0"+n)+":"+(a>9?a:"0"+a)+":"+(r>9?r:"0"+r)})};var Q=K;function ee(e){var t=new Date(e),i=t.getHours(),n=t.getMinutes(),a=t.getSeconds();return(i>9?i:"0"+i)+":"+(n>9?n:"0"+n)+":"+(a>9?a:"0"+a)}Date.prototype.Format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var i in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),t)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[i]:("00"+t[i]).substr((""+t[i]).length)));return e};var te=function(){function e(t,i,n){var a=this;r(this,e),this.changeRecSpeed=i,this.resetMobileZoomStatus=n,this.isMobile=!0,this.jSPlugin=t,this.date=(new Date).Format("yyyy-MM-dd"),this.begin=((new Date).Format("yyyy-MM-dd")+" 00:00:00").replace(/-/g,"/"),this.end=((new Date).Format("yyyy-MM-dd")+" 23:59:59").replace(/-/g,"/"),this.initBegin=null,this.initEnd=null,this.type=P(this.jSPlugin.url).type,this.operating=!1,this.seekTimer=null,this.disabled=!1,this.seekFrequency=2e3,this.recList=[],this.isSeeking=!1,this.jSPlugin.params&&this.jSPlugin.params.seekFrequency&&(this.seekFrequency=this.jSPlugin.params.seekFrequency);var o=document.createElement("style");if(o.innerHTML='\n body{\n padding: 0;\n margin: 0;\n }\n .time-line-container {\n text-align: left;\n height: 300px;\n /* outline: 1px solid red; */\n /* background: gray; */\n position: relative;\n /* padding-top: 60px; */\n margin-top: 20px;\n }\n\n .time-line-container .time-line-item-container {\n display: inline-block;\n /* height: 400px; */\n width: 30%;\n /* background: indianred; */\n overflow-y: scroll;\n overflow-x: hidden;\n /* padding-top: 60px; */\n height: 300px;\n box-sizing: border-box;\n white-space: nowrap;\n position: relative;\n }\n\n .time-line-container .time-line-item-container::-webkit-scrollbar {\n width: 0px;\n /*滚动条宽度*/\n height: 0px;\n /*滚动条高度*/\n }\n\n .time-line-item .time-item {\n position: relative;\n box-sizing: border-box;\n height: 60px;\n font-size: 12px;\n color: rgb(150, 150, 150);\n border-right: 6px solid;\n border-right-color: #ddd;\n }\n\n .time-line-item .time-item .scale {\n width: 6px;\n height: 9px;\n border-bottom: 1px solid #ccc;\n float: right;\n clear: both;\n }\n\n .time-line-item .time-item .item-unavail {\n width: 6px;\n position: absolute;\n left: 100%;\n background-color: #ddd;\n }\n\n .time-line-container .current-time {\n position: absolute;\n left: 0;\n top: 40px;\n height: 29px;\n /* line-height: 58px; */\n border-bottom: 1px solid #648FFC;\n width: 60%;\n margin-left: 26%;\n }\n\n .time-line-container .current-time .current-time-bg {\n position: relative;\n top: 15px;\n width: 100px;\n height: 29px;\n line-height: 29px;\n left: -70px;\n font-size: 12px;\n color: #2C2C2C;\n }\n\n .time-line-container .current-time .current-time-bg::before {\n content: \'\';\n display: inline-block;\n width: 6px;\n height: 6px;\n border-radius: 100%;\n background: #648FFC;\n top: 11px;\n position: absolute;\n right: 30px;\n }\n\n .date-switch-container {\n height: 40px;\n position: relative;\n text-align: center;\n margin: 20px 10px;\n }\n\n .date-switch-container .current-date {\n line-height: 40px;\n height: 22px;\n font-size: 16px;\n color: #2C2C2C;\n text-align: center;\n font-weight: bold;\n }\n\n .date-container {\n width: 40px;\n height: 40px;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n .rec-type-container {\n display: flex;\n justify-content: space-between;\n }\n\n .rec-type-container .rec-type-text {\n padding: 0 15px;\n font-size: 12px;\n color: #2C2C2C;\n }\n\n .rec-type-container .rec-type-switch {\n padding: 0 20px;\n }\n\n .date-container input {\n position: absolute;\n opacity: 0;\n display: inline-block;\n width: 40px;\n height: 40px;\n z-index: 10;\n left: 0;\n }\n\n .date-container label {\n position: absolute;\n left: 0;\n top: 0;\n /* display: none; */\n z-index: 0;\n }\n\n .date-icon {\n display: inline-block;\n width: 40px;\n height: 40px;\n background: url(\'https://resource.eziot.com/group2/M00/00/6A/CtwQF2F6VieAQrU9AAABP-_Nsqo949.png\') no-repeat 100% 100%;\n }\n .select-container {\n padding: 10px;\n display: flex;\n justify-content: space-between;\n }\n\n .advice {\n height: 24px;\n width: 70px;\n display: flex;\n justify-content: space-between;\n line-height: 24px;\n background: #F8F8F8;\n border-radius: 8px;\n }\n\n .advice span {\n width: 40px;\n display: inline-block;\n }\n\n input[type="checkbox"]:not(:checked)+.advice span:first-child {\n box-shadow: 0px 2px 5px 0px rgb(23 45 101 / 20%);\n border-radius: 8px;\n text-align: center;\n\n }\n\n input[type="checkbox"]:checked+.advice span:last-child {\n box-shadow: 0px 2px 5px 0px rgb(23 45 101 / 20%);\n border-radius: 8px;\n text-align: center;\n }\n\n input[type="checkbox"]:not(:checked)+.advice span:first-child svg {\n fill: #648FFC !important;\n }\n\n input[type="checkbox"]:checked+.advice span:last-child svg {\n fill: #648FFC !important;\n }',document.getElementsByTagName("head")[0].appendChild(o),_("begin",this.jSPlugin.url)){var s=_("begin",this.jSPlugin.url);this.date=s.slice(0,4)+"/"+s.slice(4,6)+"/"+s.slice(6,8),this.begin=this.date+" ".concat(s.slice(8,10)||"00",":").concat(s.slice(10,12)||"00",":").concat(s.slice(12,14)||"00"),this.end=this.date+" 23:59:59",this.initBegin=this.begin}if(_("end",this.jSPlugin.url)){var l=_("end",this.jSPlugin.url);this.end=this.date+" ".concat(l.slice(8,10)||"23",":").concat(l.slice(10,12)||"59",":").concat(l.slice(12,14)||"59"),this.initEnd=this.end}var c=document.createElement("div");c.id="date-switch-container-wrap",c.className="date-switch-container-wrap",c.style="",c.innerHTML='\n
\n
今日录像
\n
\n \n \n
\n
\n '),g(c,document.getElementById("".concat(this.jSPlugin.id,"-wrap")));var d=document.createElement("div");d.id="rec-type-container-wrap",d.className="rec-type-container-wrap",d.style="",d.innerHTML='\n
\n
0个录像
\n
\n \n
\n
\n ',g(d,c);var u=document.createElement("div");u.id="mobile-rec-wrap",u.className="mobileRec-wrap",u.style="",u.innerHTML='\n
\n
\n
00:00:00
\n
\n
\n
\n
\n
\n
\n ',g(u,d);this.TimeLineOBJ=new Q({id:"time-line-item",getPlayParam:function(e){var t=a;console.log("子组件传值到父组件",e,e.current,a.date);var i=e.current,n=new Date(a.date).Format("yyyyMMdd").substr(0,8)+(e.current?i.replace(/:/g,""):e.current.replace(/:/g,""));if("cloud.rec"===a.type||a.jSPlugin.useSeek&&a.jSPlugin.capacity&&"1"==a.jSPlugin.capacity.support_seek_playback)a.isSeeking||t.recList.length>0&&(new Date("".concat(a.date," ").concat(e.current)).valueOf()>=t.lastDate?(a.jSPlugin.pluginStatus.loadingSetText({text:"seek回放未找到录像片段",color:"red",delayClear:2e3}),a.syncTimeLine()):a.unSyncTimeLine().then((function(){a.isSeeking=!0,a.jSPlugin.pluginStatus.loadingStart(a.jSPlugin.id),a.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),a.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),a.jSPlugin.Theme.setDisabled(!0),a.jSPlugin.seek(n.substr(8,6),"235959").then((function(){var e=setInterval((function(){a.jSPlugin.getOSDTime().then((function(i){console.log("seek时间同步:",new Date(1e3*i.data).Format("yyyyMMddhhmmss"),n,new Date(1e3*i.data).Format("yyyyMMddhhmmss")>=n),new Date(1e3*i.data).Format("yyyyMMddhhmmss")>=n&&(a.isSeeking=!1,a.syncTimeLine(),clearInterval(e),a.jSPlugin.pluginStatus.loadingStop(a.jSPlugin.id),a.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),a.jSPlugin.pluginStatus.loadingClear(),a.jSPlugin.Theme.setDisabled(!1),a.jSPlugin.waterMark_JSPlugin&&t.jSPlugin.setWaterMarkFont(t.jSPlugin.waterMark_JSPlugin))}))}),1e3)}))})));else{var r=function(){setTimeout((function(){a.disabled=!1}),a.seekFrequency)},o=a.jSPlugin.Theme.decoderState.state.play,s=function(e){a.disabled=!0,a.jSPlugin.pluginStatus.loadingStart(a.jSPlugin.id),a.jSPlugin.pluginStatus.setPlayStatus({loading:!0}),a.jSPlugin.pluginStatus.loadingSetText({text:"加载中,请稍后"}),a.jSPlugin.Theme.setDisabled(!0),o?a.unSyncTimeLine().then((function(){a.jSPlugin.pause(n).then((function(){console.log("暂停成功"),a.jSPlugin.resume(n).then((function(i){console.log("恢复成功"),a.syncTimeLine(),a.jSPlugin.pluginStatus.loadingStop(a.jSPlugin.id),a.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),a.jSPlugin.pluginStatus.loadingClear(),a.jSPlugin.Theme.setDisabled(!1),a.jSPlugin.waterMark_JSPlugin&&t.jSPlugin.setWaterMarkFont(t.jSPlugin.waterMark_JSPlugin),e&&e()}))})).catch((function(){console.log("暂停失败"),a.jSPlugin.resume(n).then((function(t){console.log("恢复成功"),a.syncTimeLine(),a.jSPlugin.pluginStatus.loadingStop(a.jSPlugin.id),a.jSPlugin.pluginStatus.setPlayStatus({loading:!1}),a.jSPlugin.pluginStatus.loadingClear(),a.jSPlugin.Theme.setDisabled(!1),e&&e()}))}))})):a.unSyncTimeLine().then((function(){a.jSPlugin.resume(n).then((function(t){console.log("恢复成功"),a.syncTimeLine(),e&&e()}))}))};a.disabled?(console.log("操作频繁,等待2秒后执行"),a.seekTimer&&clearTimeout(a.seekTimer),a.seekTimer=setTimeout((function(){s(r)}),a.seekFrequency)):s(r)}},ontouchstart:function(){a.operating=!0,a.unSyncTimeLine()},ontouchmove:function(){0==a.operating&&(a.operating=!0,a.unSyncTimeLine())},ontouchend:function(){a.operating=!1}}),this.fetchDeviceRec(),document.getElementById("date").addEventListener("change",(function(e){console.log("日期变化",e.target.value);var t=e.target.value,i=parseInt(new Date(t).Format("yyyy/MM/dd").replace(/\//g,"")),n=new Date;i>parseInt(n.Format("yyyy/MM/dd").replace(/\//g,""))?document.getElementById("date").value=new Date(a.date.replace(/\//g,"-")||n.Format("yyyy-MM-dd")).Format("yyyy-MM-dd"):(a.date=new Date(t).Format("yyyy/MM/dd"),a.begin=a.date+" 00:00:00",a.end=a.date+" 23:59:59",a.jSPlugin.changePlayUrl({type:a.type,begin:"".concat(new Date(a.date).Format("yyyyMMdd"),"000000")}).then((function(e){setTimeout((function(){var e=document.getElementById("date");e&&(e.value=t)}),0)})),a.changeRecSpeed(1),a.resetMobileZoomStatus())})),document.getElementById("cloudType").checked="rec"===this.type,document.getElementById("cloudType").addEventListener("change",(function(e){var t=e.target.checked?2:1;a.type=e.target.checked?"rec":"cloud.rec",console.log("recType",t),a.jSPlugin.changePlayUrl({type:a.type,begin:"".concat(new Date(a.date).Format("yyyyMMdd"),"000000")}).then((function(){console.log("切换类型成功"),a.syncTimeLine(),a.changeRecSpeed(1),a.resetMobileZoomStatus()}),(function(e){console.log("err",e)})).catch((function(e){console.log(e)}))})),this.syncTimeLine()}return s(e,[{key:"fetchDeviceRec",value:function(){var e=this,t=function(t){var i=t.length;document.getElementById("recCount").innerHTML=i;for(var n=[],a=i-1;a>=0;a--){var r=t[a],o=ee(r.endTime),s=ee(r.startTime);n.push({st:s,et:o})}e.TimeLineOBJ.setDateLine(n)},i=new FormData,n=this;i.append("deviceSerial",P(this.jSPlugin.url).deviceSerial),i.append("channelNo",P(this.jSPlugin.url).channelNo),i.append("accessToken",this.jSPlugin.accessToken),i.append("recType","cloud.rec"===this.type?1:2);var a=_("timeZone",this.jSPlugin.url);if(a<=23&&a>=-23&&"cloud.rec"!==this.type){var r=X(new Date(this.begin).Format("yyyyMMddhhmmss"),+a);i.append("startTime",new Date(r.Format("yyyy/MM/dd")+" 00:00:00").getTime()),i.append("endTime",new Date(r.Format("yyyy/MM/dd")+" 23:59:59").getTime()),this.date=r.Format("yyyy/MM/dd")}else i.append("startTime",new Date(this.begin).getTime()),i.append("endTime",new Date(this.end).getTime());fetch(this.jSPlugin.env.domain+"/api/lapp/video/by/time",{method:"POST",body:i}).then((function(e){return e.json()})).then((function(e){if(200==e.code&&e.data){var i;i=e.data,n.recList=i,n.lastDate=i[i.length-1].endTime,t(i)}else t([])}))}},{key:"syncTimeLine",value:function(){var e=this;this.jSPlugin.recTimer&&clearInterval(this.jSPlugin.recTimer),Array.isArray(window.recTimer)&&window.recTimer.map((function(e){clearInterval(e)})),window.recTimer=[];var t=this;this.jSPlugin.recTimer=setInterval((function(){if(e.operating)return console.log("操作中"),!1;e.jSPlugin.getOSDTime().then((function(e){e.data>0&&t.TimeLineOBJ.stepScrollTimeLine(function(e){var t=new Date(e),i=t.getHours(),n=t.getMinutes(),a=t.getSeconds();return(i>9?i:"0"+i)+":"+(n>9?n:"0"+n)+":"+(a>9?a:"0"+a)}(1e3*e.data))})).catch((function(e){console.log("err:-----",e),console.log("未找到当前获取播放时间,等待中...")}))}),1e3),window.recTimer.push(this.jSPlugin.recTimer)}},{key:"unSyncTimeLine",value:function(){var e=this;return new Promise((function(t,i){e.jSPlugin.recTimer&&(clearInterval(e.jSPlugin.recTimer),e.jSPlugin.recTimer=null),Array.isArray(window.recTimer)&&(window.recTimer.map((function(e){clearInterval(e)})),window.recTimer=[]),t()}))}}]),e}(),ie=function(){function e(t){var i=this;if(r(this,e),this.jSPlugin=t,this.pluginStatus=new F(this,this.jSPlugin.id),this.showPtz=!1,console.log("云台初始化"),document.getElementById(this.jSPlugin.id+"-ez-ptz-item"))return!1;var n=document.createElement("div");n.id=this.jSPlugin.id+"-ez-ptz-item",n.className="ez-ptz-wrap",n.style="display:none;";var a=document.createElement("style");a.innerHTML="\n .ez-ptz-container {\n position: relative;\n width: 80px;\n height: 80px;\n background: rgba(255, 255, 255, 0.70);\n box-shadow: 0px 0px 33px 4px rgb(0 0 0 / 15%);\n border: 1px solid rgba(255, 255, 255, 0.70);\n border-radius: 100%;\n cursor: pointer;\n overflow: hidden;\n user-select: none;\n }\n .ez-ptz-container .ez-ptz-icon.top {\n width: 0;\n height: 0;\n border-left: 4px solid transparent;\n border-right: 4px solid transparent;\n border-bottom: 8px solid #999999;\n position: absolute;\n display: inline-block;\n left: calc(50% - 4px);\n top: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.top.active {\n border-bottom-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom {\n width: 0;\n height: 0;\n border-left: 4px solid transparent;\n border-right: 4px solid transparent;\n border-top: 8px solid #999999;\n position: absolute;\n display: inline-block;\n left: calc(50% - 4px);\n bottom: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom.active {\n border-top-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.right {\n width: 0;\n height: 0;\n border-top: 4px solid transparent;\n border-bottom: 4px solid transparent;\n border-left: 8px solid #999999;\n position: absolute;\n display: inline-block;\n top: calc(50% - 4px);\n right: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.right.active {\n border-left-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.left {\n width: 0;\n height: 0;\n border-top: 4px solid transparent;\n border-bottom: 4px solid transparent;\n border-right: 8px solid #999999;\n position: absolute;\n display: inline-block;\n top: calc(50% - 4px);\n left: 2px;\n }\n\n .ez-ptz-container .ez-ptz-icon.left.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.top-left {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n top: calc(25% - 4px);\n left: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.top-left.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.left-bottom {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n bottom: calc(25% - 4px);\n left: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.left-bottom.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom-right {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n bottom: calc(25% - 4px);\n right: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.bottom-right.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-icon.right-top {\n width: 4px;\n height: 4px;\n border-radius: 50%;\n position: absolute;\n display: inline-block;\n top: calc(25% - 4px);\n right: 16px;\n background: #999999;\n }\n\n .ez-ptz-container .ez-ptz-icon.right-top.active {\n border-right-color: #407AFF;\n }\n\n .ez-ptz-container .ez-ptz-main.center {\n width: 23px;\n height: 23px;\n background: #407AFF;\n border-radius: 100%;\n top: calc(50% - 12.4px);\n left: calc(50% - 12.4px);\n position: absolute;\n }\n\n .ez-ptz-wrap {\n position: absolute;\n right: 0px;\n top: 0;\n width: 85px;\n height: 100%;\n padding: 0 20px;\n flex-direction: column;\n justify-content: center;\n background: rgba(0,0,0,0.9);\n box-sizing: content-box !important;\n }\n\n .ez-ptz-close {\n position: absolute;\n color: #FFFFFF;\n top: 0;\n right: 0px;\n }\n\n .ez-ptzspeed-progress-line{\n height: 1px;\n background: #ffffff;\n margin: 16px 0 8px;\n display: flex;\n justify-content: space-between;\n }\n\n .ez-ptzspeed-progress-line-dot{\n width: 5px;\n height: 5px;\n border: 2px solid #ffffff;\n border-radius: 50%;\n background: #ffffff;\n margin: -3px 0;\n cursor: pointer;\n }\n\n .ez-ptzspeed-progress-line-dot.active{\n border-color: #407AFF;\n }\n \n .ez-ptzspeed-progress-points{\n display: flex;\n justify-content: space-between;\n }\n\n .ez-ptzspeed-progress-points-slow{\n cursor: pointer;\n color: #ffffff;\n }\n\n .ez-ptzspeed-progress-points-mid{\n cursor: pointer;\n color: #ffffff;\n }\n\n .ez-ptzspeed-progress-points-fast{\n cursor: pointer;\n color: #ffffff;\n }\n\n .ez-ptzbtn-container{\n width: 100%;\n height:".concat(t.isMobile?"60px":"18px",";\n margin-top: 14px;\n display: ").concat(t.isMobile?"block":"flex",";\n }\n\n .ez-ptzbtn-focal,\n .ez-ptzbtn-zoom{\n width: ").concat(t.isMobile?"100%":"50%",";\n height: 20px;\n display: flex;\n border: 1px solid rgba(255,255,255,0.5);\n border-radius: 10px;\n padding-bottom: 0px;\n box-sizing: content-box;\n }\n\n .ez-ptzbtn-zoom-add,\n .ez-ptzbtn-zoom-sub,\n .ez-ptzbtn-focal-add,\n .ez-ptzbtn-focal-sub{\n width: ").concat(t.isMobile?"50%":"24px",";\n height: 20px;\n cursor: pointer;\n text-align: center;\n }\n\n .ez-ptzbtn-zoom{\n margin: ").concat(t.isMobile?"0 0 8px":"0 4px 0 0",";\n }\n\n .ez-ptzbtn-zoom-add{\n border-right: 1px solid rgba(255,255,255,0.5);\n }\n\n .ez-ptzbtn-focal-add{\n border-right: 1px solid rgba(255,255,255,0.5);\n }\n "),document.getElementsByTagName("head")[0].appendChild(a),n.innerHTML='\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n 慢\n
\n
\n 中\n
\n
\n 快\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n '),document.getElementById("".concat(t.id,"-wrap")).appendChild(n),document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).onmousedown=function(e){e.preventDefault(),e.stopPropagation(),console.log("点击开始"),i._handlePtzTouch(e,"start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).onmouseup=function(e){e.preventDefault(),e.stopPropagation(),console.log("触摸结束"),i._handlePtzTouch(e,"stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),console.log("触摸开始"),i._handlePtzTouch(e,"start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).ontouchend=function(e){e.preventDefault(),e.stopPropagation(),console.log("触摸结束",e),i._handlePtzTouch(e,"stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzspeed-container")).onmouseup=function(e){e.target.id&&(e.target.id.indexOf("slow")>-1&&(i.jSPlugin.ptzSpeed=i.jSPlugin.ptzSpeedOptions?i.jSPlugin.ptzSpeedOptions.slow:1,document.getElementById("ptzspeed-slow-dot").classList.add("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),e.target.id.indexOf("mid")>-1&&(i.jSPlugin.ptzSpeed=i.jSPlugin.ptzSpeedOptions?i.jSPlugin.ptzSpeedOptions.mid:3,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.add("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),e.target.id.indexOf("fast")>-1&&(i.jSPlugin.ptzSpeed=i.jSPlugin.ptzSpeedOptions?i.jSPlugin.ptzSpeedOptions.fast:7,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.add("active")))},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzspeed-container")).ontouchend=function(e){e.target.id&&(e.target.id.indexOf("slow")>-1&&(i.jSPlugin.ptzSpeed=i.jSPlugin.ptzSpeedOptions?i.jSPlugin.ptzSpeedOptions.slow:1,document.getElementById("ptzspeed-slow-dot").classList.add("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),e.target.id.indexOf("mid")>-1&&(i.jSPlugin.ptzSpeed=i.jSPlugin.ptzSpeedOptions?i.jSPlugin.ptzSpeedOptions.mid:3,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.add("active"),document.getElementById("ptzspeed-fast-dot").classList.remove("active")),e.target.id.indexOf("fast")>-1&&(i.jSPlugin.ptzSpeed=i.jSPlugin.ptzSpeedOptions?i.jSPlugin.ptzSpeedOptions.fast:7,document.getElementById("ptzspeed-slow-dot").classList.remove("active"),document.getElementById("ptzspeed-mid-dot").classList.remove("active"),document.getElementById("ptzspeed-fast-dot").classList.add("active")))},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).onmousedown=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).onmouseup=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).onmousedown=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).onmouseup=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","sub","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).onmousedown=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).onmouseup=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).onmousedown=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).onmouseup=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","sub","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-add")).ontouchend=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-zoom-sub")).ontouchend=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("zoom","sub","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","add","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-add")).ontouchend=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","add","stop")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).ontouchstart=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","sub","start")},document.getElementById("".concat(this.jSPlugin.id,"-ez-ptzbtn-focal-sub")).ontouchend=function(e){e.preventDefault(),e.stopPropagation(),i._handleBtnTouch("focal","sub","stop")}}return s(e,[{key:"show",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item")).style="display: flex;box-sizing: content-box;"),this.showPtz=!0,this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("openPtz",{eventType:"openPtz",code:0,target:this,msg:"开启云台"})}},{key:"hide",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item")).style="display: none"),this.showPtz=!1,this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("closePtz",{eventType:"closePtz",code:0,target:this,msg:"关闭云台"})}},{key:"_handlePtzTouch",value:function(e,t){var i=this,n=document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).getBoundingClientRect(),a=n.left+41,r=n.top+41,o=e.x||e.changedTouches[0].clientX,s=e.y||e.changedTouches[0].clientY,l=0,c=this.jSPlugin.env.domain+"/api/lapp/device/ptz/start",d=0;function u(e,t){var i=Math.atan2(t,e);i<0&&(i+=2*Math.PI);var n=i*(180/Math.PI)-225-12.5;return n<0&&(n+=360),Math.floor(n/45)+1}if(/^rotate\(90/.test(document.getElementById("".concat(this.jSPlugin.id,"-wrap")).style.transform))switch(u(o-a,s-r)){case 1:l=2,d=90;break;case 2:l=4,d=135;break;case 3:l=0,d=180;break;case 4:l=6,d=225;break;case 5:l=3,d=270;break;case 6:l=7,d=315;break;case 7:l=1,d=0;break;case 8:l=5,d=45}else switch(u(o-a,s-r)){case 1:l=0,d=180;break;case 2:l=6,d=225;break;case 3:l=3,d=270;break;case 4:l=7,d=315;break;case 5:l=1,d=0;break;case 6:l=5,d=45;break;case 7:l=2,d=90;break;case 8:l=4,d=135}document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).style="background-image:linear-gradient(".concat(d,"deg, #4277FF 0%, rgba(100,143,252,0.00) 30%)"),"stop"===t&&(c=this.jSPlugin.env.domain+"/api/lapp/device/ptz/stop",document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-container")).style="");var h=new FormData;h.append("deviceSerial",P(this.jSPlugin.url).deviceSerial),h.append("channelNo",P(this.jSPlugin.url).channelNo),h.append("speed",this.jSPlugin.ptzSpeed),h.append("direction",l),h.append("accessToken",this.jSPlugin.accessToken),fetch(c,{method:"POST",body:h}).then((function(e){return e.json()})).then((function(e){if("start"===t&&200!=e.code){console.log(e.code,i.jSPlugin.i18n.t("server.ptz."+t+"."+e.code));var n=i.jSPlugin.i18n.t("server.ptz."+t+"."+e.code)||e.msg;i.pluginStatus.loadingSetText({text:n,color:"red",delayClear:2e3})}60005!=e.code&&60002!=e.code&&60003!=e.code&&60004!=e.code&&60006!=e.code||(document.getElementById("".concat(i.jSPlugin.id,"-ez-ptz-container")).style="background-image:linear-gradient(".concat(d,"deg, #f45656 0%, rgba(100,143,252,0.00) 30%)"))})).catch((function(e){console.log("云台调用异常",e)}))}},{key:"_handleBtnTouch",value:function(e,t,i){var n=this,a=8;a="zoom"===e?"add"===t?8:9:"add"===t?10:11;var r=this.jSPlugin.env.domain+"/api/lapp/device/ptz/start";"stop"===i&&(r=this.jSPlugin.env.domain+"/api/lapp/device/ptz/stop");var o=new FormData;o.append("deviceSerial",P(this.jSPlugin.url).deviceSerial),o.append("channelNo",P(this.jSPlugin.url).channelNo),o.append("speed",this.jSPlugin.ptzSpeed),o.append("direction",a),o.append("accessToken",this.jSPlugin.accessToken),fetch(r,{method:"POST",body:o}).then((function(e){return e.json()})).then((function(t){"start"===i&&200!=t.code&&(6e4==t.code||60006==t.code?n.pluginStatus.loadingSetText({text:"zoom"===e?"当前设备不支持物理缩放":"当前设备不支持变焦",color:"red",delayClear:2e3}):n.pluginStatus.loadingSetText({text:t.msg,color:"red",delayClear:2e3}))})).catch((function(e){}))}}]),e}();function ne(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}!function(e,t){e.exports=function(){function e(t,i,n){function a(o,s){if(!i[o]){if(!t[o]){if(!s&&ne)return ne(o);if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[o]={exports:{}};t[o][0].call(c.exports,(function(e){return a(t[o][1][e]||e)}),c,c.exports,e,t,i,n)}return i[o].exports}for(var r=ne,o=0;o0&&void 0!==arguments[0]?arguments[0]:{}).window,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},i=n.log,c=n.detectBrowser(e),d={browserDetails:c,commonShim:l,extractVersion:n.extractVersion,disableLog:n.disableLog,disableWarnings:n.disableWarnings};switch(c.browser){case"chrome":if(!a||!a.shimPeerConnection||!t.shimChrome)return i("Chrome shim is not included in this adapter release."),d;i("adapter.js shimming chrome."),d.browserShim=a,a.shimGetUserMedia(e),a.shimMediaStream(e),a.shimPeerConnection(e),a.shimOnTrack(e),a.shimAddTrackRemoveTrack(e),a.shimGetSendersWithDtmf(e),a.shimGetStats(e),a.shimSenderReceiverGetStats(e),a.fixNegotiationNeeded(e),l.shimRTCIceCandidate(e),l.shimConnectionState(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e),l.removeAllowExtmapMixed(e);break;case"firefox":if(!o||!o.shimPeerConnection||!t.shimFirefox)return i("Firefox shim is not included in this adapter release."),d;i("adapter.js shimming firefox."),d.browserShim=o,o.shimGetUserMedia(e),o.shimPeerConnection(e),o.shimOnTrack(e),o.shimRemoveStream(e),o.shimSenderGetStats(e),o.shimReceiverGetStats(e),o.shimRTCDataChannel(e),o.shimAddTransceiver(e),o.shimCreateOffer(e),o.shimCreateAnswer(e),l.shimRTCIceCandidate(e),l.shimConnectionState(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e);break;case"edge":if(!r||!r.shimPeerConnection||!t.shimEdge)return i("MS edge shim is not included in this adapter release."),d;i("adapter.js shimming edge."),d.browserShim=r,r.shimGetUserMedia(e),r.shimGetDisplayMedia(e),r.shimPeerConnection(e),r.shimReplaceTrack(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e);break;case"safari":if(!s||!t.shimSafari)return i("Safari shim is not included in this adapter release."),d;i("adapter.js shimming safari."),d.browserShim=s,s.shimRTCIceServerUrls(e),s.shimCreateOfferLegacy(e),s.shimCallbacksAPI(e),s.shimLocalStreamsAPI(e),s.shimRemoteStreamsAPI(e),s.shimTrackEventTransceiver(e),s.shimGetUserMedia(e),l.shimRTCIceCandidate(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e),l.removeAllowExtmapMixed(e);break;default:i("Unsupported browser!")}return d}},{"./chrome/chrome_shim":3,"./common_shim":6,"./edge/edge_shim":7,"./firefox/firefox_shim":11,"./safari/safari_shim":14,"./utils":15}],3:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var n="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)},r=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}});var o=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return o.shimGetDisplayMedia}}),i.shimMediaStream=d,i.shimOnTrack=u,i.shimGetSendersWithDtmf=h,i.shimGetStats=f,i.shimSenderReceiverGetStats=x,i.shimAddTrackRemoveTrackWithNative=p,i.shimAddTrackRemoveTrack=m,i.shimPeerConnection=_,i.fixNegotiationNeeded=g;var s=l(e("../utils.js"));function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function d(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function u(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var i=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var a=void 0;a=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var r=new Event("track");r.track=n.track,r.receiver=a,r.transceiver={receiver:a},r.streams=[t.stream],i.dispatchEvent(r)})),t.stream.getTracks().forEach((function(n){var a=void 0;a=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var r=new Event("track");r.track=n,r.receiver=a,r.transceiver={receiver:a},r.streams=[t.stream],i.dispatchEvent(r)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else s.wrapPeerConnectionEvent(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function h(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var a=i.apply(this,arguments);return a||(a=t(this,e),this._senders.push(a)),a};var a=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){a.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((function(e){i._senders.push(t(i,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var i=t._senders.find((function(t){return t.track===e}));i&&t._senders.splice(t._senders.indexOf(i),1)}))}}else if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function f(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),n=i[0],a=i[1],r=i[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var o=function(e){var t={};return e.result().forEach((function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){i[t]=e.stat(t)})),t[i.id]=i})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var l=function(e){a(s(o(e)))};return t.apply(this,[l,n])}return new Promise((function(i,n){t.apply(e,[function(e){i(s(o(e)))},n])})).then(a,r)}}}function x(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return s.filterStats(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var a=e.RTCPeerConnection.prototype.getReceivers;a&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),s.wrapPeerConnectionEvent(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return s.filterStats(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t=arguments[0],i=void 0,n=void 0,a=void 0;return this.getSenders().forEach((function(e){e.track===t&&(i?a=!0:i=e)})),this.getReceivers().forEach((function(e){return e.track===t&&(n?a=!0:n=e),e.track===t})),a||i&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return r.apply(this,arguments)}}}}function p(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(n)&&this._shimmedLocalStreams[i.id].push(n):this._shimmedLocalStreams[i.id]=[i,n],n};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){var i=t.getSenders().find((function(t){return t.track===e}));if(i)throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();i.apply(this,arguments);var a=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(a)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var a=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(i){var n=t._shimmedLocalStreams[i].indexOf(e);-1!==n&&t._shimmedLocalStreams[i].splice(n,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]})),a.apply(this,arguments)}}function m(e){if(e.RTCPeerConnection){var t=s.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return p(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){var t=i.getSenders().find((function(t){return t.track===e}));if(t)throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var a=new e.MediaStream(t.getTracks());this._streams[t.id]=a,this._reverseStreams[a.id]=t,t=a}n.apply(this,[t])};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var a=[].slice.call(arguments,1);if(1!==a.length||!a[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var r=this.getSenders().find((function(e){return e.track===t}));if(r)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var o=this._streams[i.id];if(o)o.addTrack(t),Promise.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[i.id]=s,this._reverseStreams[s.id]=i,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],n=c({},t,(function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?i.apply(this,[function(i){var n=l(e,i);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then((function(t){return l(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var r=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=d(this,arguments[0]),r.apply(this,arguments)):r.apply(this,arguments)};var o=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=o.get.apply(this);return""===e.type?e:l(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var i=void 0;Object.keys(this._streams).forEach((function(n){t._streams[n].getTracks().find((function(t){return e.track===t}))&&(i=t._streams[n])})),i&&(1===i.getTracks().length?this.removeStream(this._reverseStreams[i.id]):i.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function l(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],a=e._streams[n.id];i=i.replace(new RegExp(a.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function d(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],a=e._streams[n.id];i=i.replace(new RegExp(n.id,"g"),a.id)})),new RTCSessionDescription({type:t.type,sdp:i})}}function _(e){var t=s.detectBrowser(e);if(!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection){t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],n=c({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var i=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?t.version<78&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}}function g(e){s.wrapPeerConnectionEvent(e,"negotiationneeded",(function(e){if("stable"===e.target.signalingState)return e}))}},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(e,t,i){function n(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((function(t){var n=i.video&&i.video.width,a=i.video&&i.video.height,r=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:r||3}},n&&(i.video.mandatory.maxWidth=n),a&&(i.video.mandatory.maxHeight=a),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=n},{}],5:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)};i.shimGetUserMedia=l;var r=o(e("../utils.js"));function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}var s=r.log;function l(e){var t=e&&e.navigator;if(t.mediaDevices){var i=r.detectBrowser(e),a=function(e){if("object"!==(void 0===e?"undefined":n(e))||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var a="object"===n(e[i])?e[i]:{ideal:e[i]};void 0!==a.exact&&"number"==typeof a.exact&&(a.min=a.max=a.exact);var r=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==a.ideal){t.optional=t.optional||[];var o={};"number"==typeof a.ideal?(o[r("min",i)]=a.ideal,t.optional.push(o),(o={})[r("max",i)]=a.ideal,t.optional.push(o)):(o[r("",i)]=a.ideal,t.optional.push(o))}void 0!==a.exact&&"number"!=typeof a.exact?(t.mandatory=t.mandatory||{},t.mandatory[r("",i)]=a.exact):["min","max"].forEach((function(e){void 0!==a[e]&&(t.mandatory=t.mandatory||{},t.mandatory[r(e,i)]=a[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,r){if(i.version>=61)return r(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===n(e.audio)){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=a(e.audio)}if(e&&"object"===n(e.video)){var l=e.video.facingMode;l=l&&("object"===(void 0===l?"undefined":n(l))?l:{ideal:l});var c=i.version<66;if(l&&("user"===l.exact||"environment"===l.exact||"user"===l.ideal||"environment"===l.ideal)&&(!t.mediaDevices.getSupportedConstraints||!t.mediaDevices.getSupportedConstraints().facingMode||c)){delete e.video.facingMode;var d=void 0;if("environment"===l.exact||"environment"===l.ideal?d=["back","rear"]:"user"!==l.exact&&"user"!==l.ideal||(d=["front"]),d)return t.mediaDevices.enumerateDevices().then((function(t){t=t.filter((function(e){return"videoinput"===e.kind}));var i=t.find((function(e){return d.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!i&&t.length&&d.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=l.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=a(e.video),s("chrome: "+JSON.stringify(e)),r(e)}))}e.video=a(e.video)}return s("chrome: "+JSON.stringify(e)),r(e)},l=function(e){return i.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},c=function(e,i,n){o(e,(function(e){t.webkitGetUserMedia(e,i,(function(e){n&&n(l(e))}))}))};if(t.getUserMedia=c.bind(t),t.mediaDevices.getUserMedia){var d=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return o(e,(function(e){return d(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(l(e))}))}))}}}}},{"../utils.js":15}],6:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)};i.shimRTCIceCandidate=c,i.shimMaxMessageSize=d,i.shimSendThrowTypeError=u,i.shimConnectionState=h,i.removeAllowExtmapMixed=f;var r=l(e("sdp")),o=s(e("./utils"));function s(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===(void 0===e?"undefined":n(e))&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var i=new t(e),a=r.default.parseCandidate(e.candidate),o=Object.assign(i,a);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,o.wrapPeerConnectionEvent(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function d(e){if(e.RTCPeerConnection){var t=o.detectBrowser(e);"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=r.default.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=r.default.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i},a=function(e){var i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},s=function(e,i){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var a=r.default.matchPrefix(e.sdp,"a=max-message-size:");return a.length>0?n=parseInt(a[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(n=2147483637),n},l=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76&&"plan-b"===this.getConfiguration().sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0}),i(arguments[0])){var e=n(arguments[0]),r=a(e),o=s(arguments[0],e),c=void 0;c=0===r&&0===o?Number.POSITIVE_INFINITY:0===r||0===o?Math.max(r,o):Math.min(r,o);var d={};Object.defineProperty(d,"maxMessageSize",{get:function(){return c}}),this._sctp=d}return l.apply(this,arguments)}}}function u(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},o.wrapPeerConnectionEvent(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var n=arguments[0],a=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&a>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}}function h(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function f(e){if(e.RTCPeerConnection){var t=o.detectBrowser(e);if(!("chrome"===t.browser&&t.version>=71)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){return e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")&&(e.sdp=e.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n")),i.apply(this,arguments)}}}}},{"./utils":15,sdp:17}],7:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var n=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return n.shimGetUserMedia}});var a=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),i.shimPeerConnection=d,i.shimReplaceTrack=u;var r=c(e("../utils")),o=e("./filtericeservers"),s=l(e("rtcpeerconnection-shim"));function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function d(e){var t=r.detectBrowser(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var i=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){i.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var n=(0,s.default)(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=(0,o.filterIceServers)(e.iceServers,t.version),r.log("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function u(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.filterIceServers=r;var n=a(e("../utils"));function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function r(e,t){var i=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&n.deprecated("RTCIceServer.url","RTCIceServer.urls");var a="string"==typeof t;return a&&(t=[t]),t=t.filter((function(e){if(0===e.indexOf("stun:"))return!1;var t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!i?(i=!0,!0):t&&!i})),delete e.url,e.urls=a?t[0]:t,!!t.length}}))}},{"../utils":15}],9:[function(e,t,i){function n(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=n},{}],10:[function(e,t,i){function n(e){var t=e&&e.navigator,i=function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}},n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch((function(e){return Promise.reject(i(e))}))}}Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetUserMedia=n},{}],11:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var n="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)},r=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}});var o=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return o.shimGetDisplayMedia}}),i.shimOnTrack=d,i.shimPeerConnection=u,i.shimSenderGetStats=h,i.shimReceiverGetStats=f,i.shimRemoveStream=x,i.shimRTCDataChannel=p,i.shimAddTransceiver=m,i.shimCreateOffer=_,i.shimCreateAnswer=g;var s=l(e("../utils"));function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function d(e){"object"===(void 0===e?"undefined":n(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function u(e){var t=s.detectBrowser(e);if("object"===(void 0===e?"undefined":n(e))&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){if(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],n=c({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]})),t.version<68){var i=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}var a={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],n=e[1],o=e[2];return r.apply(this,[i||null]).then((function(e){if(t.version<53&&!n)try{e.forEach((function(e){e.type=a[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,i){e.set(i,Object.assign({},t,{type:a[t.type]||t.type}))}))}return e})).then(n,o)}}}function h(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function f(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i}),s.wrapPeerConnectionEvent(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function x(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;s.deprecated("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function p(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function m(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],i=e&&"sendEncodings"in e;i&&e.sendEncodings.forEach((function(e){if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(i){var a=n.sender,r=a.getParameters();"encodings"in r||(r.encodings=e.sendEncodings,this.setParametersPromises.push(a.setParameters(r).catch((function(){}))))}return n})}}function _(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=this,i=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(e,i)})).finally((function(){e.setParametersPromises=[]})):t.apply(this,arguments)}}}function g(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=this,i=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(e,i)})).finally((function(){e.setParametersPromises=[]})):t.apply(this,arguments)}}}},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(e,t,i){function n(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=n},{}],13:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)};i.shimGetUserMedia=s;var r=o(e("../utils"));function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function s(e){var t=r.detectBrowser(e),i=e&&e.navigator,a=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,n){r.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},s=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===(void 0===e?"undefined":n(e))&&"object"===n(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),s(e)},a&&a.prototype.getSettings){var l=a.prototype.getSettings;a.prototype.getSettings=function(){var e=l.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(a&&a.prototype.applyConstraints){var c=a.prototype.applyConstraints;a.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===(void 0===e?"undefined":n(e))&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}},{"../utils":15}],14:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":a(e)};i.shimLocalStreamsAPI=s,i.shimRemoteStreamsAPI=l,i.shimCallbacksAPI=c,i.shimGetUserMedia=d,i.shimConstraints=u,i.shimRTCIceServerUrls=h,i.shimTrackEventTransceiver=f,i.shimCreateOfferLegacy=x;var r=o(e("../utils"));function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function s(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(i,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(i,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){var i=arguments[1];return i&&(this._localStreams?this._localStreams.includes(i)||this._localStreams.push(i):this._localStreams=[i]),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function l(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}}))}),t.apply(e,arguments)}}}function c(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,i=t.createOffer,a=t.createAnswer,r=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],a=i.apply(this,[n]);return t?(a.then(e,t),Promise.resolve()):a},t.createAnswer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=a.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n};var l=function(e,t,i){var n=r.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n};t.setLocalDescription=l,l=function(e,t,i){var n=o.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n},t.setRemoteDescription=l,l=function(e,t,i){var n=s.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n},t.addIceCandidate=l}}function d(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,n=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return n(u(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,n){t.mediaDevices.getUserMedia(e).then(i,n)}.bind(t))}function u(e){return e&&void 0!==e.video?Object.assign({},e,{video:r.compactObject(e.video)}):e}function h(e){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var n=[],a=0;a=i&&parseInt(n[i],10)}function c(e,t,i){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,a=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return a.apply(this,arguments);var r=function(e){var t=i(e);t&&n(t)};return this._eventMap=this._eventMap||{},this._eventMap[n]=r,a.apply(this,[e,r])};var r=n.removeEventListener;n.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[i])return r.apply(this,arguments);var n=this._eventMap[i];return delete this._eventMap[i],r.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function d(e){return"boolean"!=typeof e?new Error("Argument type: "+(void 0===e?"undefined":n(e))+". Please use a boolean."):(o=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function u(e){return"boolean"!=typeof e?new Error("Argument type: "+(void 0===e?"undefined":n(e))+". Please use a boolean."):(s=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function h(){if("object"===("undefined"==typeof window?"undefined":n(window))){if(o)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function f(e,t){s&&console.warn(e+" is deprecated, please use "+t+" instead.")}function x(e){var t=e.navigator,i={browser:null,version:null};if(void 0===e||!e.navigator)return i.browser="Not a browser.",i;if(t.mozGetUserMedia)i.browser="firefox",i.version=l(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)i.browser="chrome",i.version=l(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))i.browser="edge",i.version=l(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!t.userAgent.match(/AppleWebKit\/(\d+)\./))return i.browser="Not a supported browser.",i;i.browser="safari",i.version=l(t.userAgent,/AppleWebKit\/(\d+)\./,1),i.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return i}function p(e){return"[object Object]"===Object.prototype.toString.call(e)}function m(e){return p(e)?Object.keys(e).reduce((function(t,i){var n=p(e[i]),a=n?m(e[i]):e[i],o=n&&!Object.keys(a).length;return void 0===a||o?t:Object.assign(t,r({},i,a))}),{}):e}function _(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?_(e,e.get(t[n]),i):n.endsWith("Ids")&&t[n].forEach((function(t){_(e,e.get(t),i)}))})))}function g(e,t,i){var n=i?"outbound-rtp":"inbound-rtp",a=new Map;if(null===t)return a;var r=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&r.push(e)})),r.forEach((function(t){e.forEach((function(i){i.type===n&&i.trackId===t.id&&_(e,i,a)}))})),a}},{}],16:[function(e,t,i){var n=e("sdp");function a(e){return{inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type}function r(e,t,i,a,r){var o=n.writeRtpDescription(e.kind,t);if(o+=n.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":r||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=s;var l="msid:"+(a?a.id:"-")+" "+s+"\r\n";o+="a="+l,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+l,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+l,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"),o}function o(e,t){var i=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var a="string"==typeof n;return a&&(n=[n]),n=n.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||i?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(i=!0,!0)})),delete e.url,e.urls=a?n[0]:n,!!n.length}}))}function s(e,t){var i={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var i=0;i0;s--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:i.iceServers,gatherPolicy:i.iceTransportPolicy}));else i.iceCandidatePoolSize=0;this._config=i,this.transceivers=[],this._sdpSessionId=n.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(f.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(f.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),f.prototype.onicecandidate=null,f.prototype.onaddstream=null,f.prototype.ontrack=null,f.prototype.onremovestream=null,f.prototype.onsignalingstatechange=null,f.prototype.oniceconnectionstatechange=null,f.prototype.onconnectionstatechange=null,f.prototype.onicegatheringstatechange=null,f.prototype.onnegotiationneeded=null,f.prototype.ondatachannel=null,f.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},f.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},f.prototype.getConfiguration=function(){return this._config},f.prototype.getLocalStreams=function(){return this.localStreams},f.prototype.getRemoteStreams=function(){return this.remoteStreams},f.prototype._createTransceiver=function(e,t){var i=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&i)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var a=this._createIceAndDtlsTransports();n.iceTransport=a.iceTransport,n.dtlsTransport=a.dtlsTransport}return t||this.transceivers.push(n),n},f.prototype.addTrack=function(t,i){if(this._isClosed)throw d("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n,a=this.transceivers.find((function(e){return e.track===t}));if(a)throw d("InvalidAccessError","Track already exists.");for(var r=0;r=15025)e.getTracks().forEach((function(t){i.addTrack(t,e)}));else{var n=e.clone();e.getTracks().forEach((function(e,t){var i=n.getTracks()[t];e.addEventListener("enabled",(function(e){i.enabled=e.enabled}))})),n.getTracks().forEach((function(e){i.addTrack(e,n)}))}},f.prototype.removeTrack=function(t){if(this._isClosed)throw d("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var i=this.transceivers.find((function(e){return e.rtpSender===t}));if(!i)throw d("InvalidAccessError","Sender was not created by this connection.");var n=i.stream;i.rtpSender.stop(),i.rtpSender=null,i.track=null,i.stream=null;var a=this.transceivers.map((function(e){return e.stream}));-1===a.indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},f.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var i=t.getSenders().find((function(t){return t.track===e}));i&&t.removeTrack(i)}))},f.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},f.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},f.prototype._createIceGatherer=function(t,i){var n=this;if(i&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var a=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(a,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var i=!e.candidate||0===Object.keys(e.candidate).length;a.state=i?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},a.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),a},f.prototype._gather=function(t,i){var a=this,r=this.transceivers[i].iceGatherer;if(!r.onlocalcandidate){var o=this.transceivers[i].bufferedCandidateEvents;this.transceivers[i].bufferedCandidateEvents=null,r.removeEventListener("localcandidate",this.transceivers[i].bufferCandidates),r.onlocalcandidate=function(e){if(!(a.usingBundle&&i>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:i};var s=e.candidate,l=!s||0===Object.keys(s).length;if(l)"new"!==r.state&&"gathering"!==r.state||(r.state="completed");else{"new"===r.state&&(r.state="gathering"),s.component=1,s.ufrag=r.getLocalParameters().usernameFragment;var c=n.writeCandidate(s);o.candidate=Object.assign(o.candidate,n.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var d=n.getMediaSections(a._localDescription.sdp);d[o.candidate.sdpMLineIndex]+=l?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",a._localDescription.sdp=n.getDescription(a._localDescription.sdp)+d.join("");var u=a.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==a.iceGatheringState&&(a.iceGatheringState="gathering",a._emitGatheringStateChange()),l||a._dispatchEvent("icecandidate",o),u&&(a._dispatchEvent("icecandidate",new Event("icecandidate")),a.iceGatheringState="complete",a._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){r.onlocalcandidate(e)}))}),0)}},f.prototype._createIceAndDtlsTransports=function(){var t=this,i=new e.RTCIceTransport(null);i.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(i);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:i,dtlsTransport:n}},f.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var i=this.transceivers[e].iceTransport;i&&(delete i.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},f.prototype._transceive=function(e,i,a){var r=s(e.localCapabilities,e.remoteCapabilities);i&&e.rtpSender&&(r.encodings=e.sendEncodingParameters,r.rtcp={cname:n.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(r.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(r)),a&&e.rtpReceiver&&r.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?r.encodings=e.recvEncodingParameters:r.encodings=[{}],r.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(r.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(r.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(r))},f.prototype.setLocalDescription=function(e){var t,i,a=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(d("TypeError",'Unsupported type "'+e.type+'"'));if(!l("setLocalDescription",e.type,a.signalingState)||a._isClosed)return Promise.reject(d("InvalidStateError","Can not set local "+e.type+" in state "+a.signalingState));if("offer"===e.type)t=n.splitSections(e.sdp),i=t.shift(),t.forEach((function(e,t){var i=n.parseRtpParameters(e);a.transceivers[t].localCapabilities=i})),a.transceivers.forEach((function(e,t){a._gather(e.mid,t)}));else if("answer"===e.type){t=n.splitSections(a._remoteDescription.sdp),i=t.shift();var r=n.matchPrefix(i,"a=ice-lite").length>0;t.forEach((function(e,t){var o=a.transceivers[t],l=o.iceGatherer,c=o.iceTransport,d=o.dtlsTransport,u=o.localCapabilities,h=o.remoteCapabilities;if(!(n.isRejected(e)&&0===n.matchPrefix(e,"a=bundle-only").length||o.rejected)){var f=n.getIceParameters(e,i),x=n.getDtlsParameters(e,i);r&&(x.role="server"),a.usingBundle&&0!==t||(a._gather(o.mid,t),"new"===c.state&&c.start(l,f,r?"controlling":"controlled"),"new"===d.state&&d.start(x));var p=s(u,h);a._transceive(o,p.codecs.length>0,!1)}}))}return a._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?a._updateSignalingState("have-local-offer"):a._updateSignalingState("stable"),Promise.resolve()},f.prototype.setRemoteDescription=function(a){var r=this;if(-1===["offer","answer"].indexOf(a.type))return Promise.reject(d("TypeError",'Unsupported type "'+a.type+'"'));if(!l("setRemoteDescription",a.type,r.signalingState)||r._isClosed)return Promise.reject(d("InvalidStateError","Can not set remote "+a.type+" in state "+r.signalingState));var o={};r.remoteStreams.forEach((function(e){o[e.id]=e}));var f=[],x=n.splitSections(a.sdp),p=x.shift(),m=n.matchPrefix(p,"a=ice-lite").length>0,_=n.matchPrefix(p,"a=group:BUNDLE ").length>0;r.usingBundle=_;var g=n.matchPrefix(p,"a=ice-options:")[0];return r.canTrickleIceCandidates=!!g&&g.substr(14).split(" ").indexOf("trickle")>=0,x.forEach((function(l,d){var h=n.splitLines(l),x=n.getKind(l),g=n.isRejected(l)&&0===n.matchPrefix(l,"a=bundle-only").length,v=h[0].substr(2).split(" ")[2],y=n.getDirection(l,p),S=n.parseMsid(l),b=n.getMid(l)||n.generateIdentifier();if(g||"application"===x&&("DTLS/SCTP"===v||"UDP/DTLS/SCTP"===v))r.transceivers[d]={mid:b,kind:x,protocol:v,rejected:!0};else{var P,E,C,T,R,w,I,D,k;!g&&r.transceivers[d]&&r.transceivers[d].rejected&&(r.transceivers[d]=r._createTransceiver(x,!0));var F,A,M=n.parseRtpParameters(l);g||(F=n.getIceParameters(l,p),(A=n.getDtlsParameters(l,p)).role="client"),I=n.parseRtpEncodingParameters(l);var L=n.parseRtcpParameters(l),B=n.matchPrefix(l,"a=end-of-candidates",p).length>0,O=n.matchPrefix(l,"a=candidate:").map((function(e){return n.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===a.type||"answer"===a.type)&&!g&&_&&d>0&&r.transceivers[d]&&(r._disposeIceAndDtlsTransports(d),r.transceivers[d].iceGatherer=r.transceivers[0].iceGatherer,r.transceivers[d].iceTransport=r.transceivers[0].iceTransport,r.transceivers[d].dtlsTransport=r.transceivers[0].dtlsTransport,r.transceivers[d].rtpSender&&r.transceivers[d].rtpSender.setTransport(r.transceivers[0].dtlsTransport),r.transceivers[d].rtpReceiver&&r.transceivers[d].rtpReceiver.setTransport(r.transceivers[0].dtlsTransport)),"offer"!==a.type||g){if("answer"===a.type&&!g){E=(P=r.transceivers[d]).iceGatherer,C=P.iceTransport,T=P.dtlsTransport,R=P.rtpReceiver,w=P.sendEncodingParameters,D=P.localCapabilities,r.transceivers[d].recvEncodingParameters=I,r.transceivers[d].remoteCapabilities=M,r.transceivers[d].rtcpParameters=L,O.length&&"new"===C.state&&(!m&&!B||_&&0!==d?O.forEach((function(e){c(P.iceTransport,e)})):C.setRemoteCandidates(O)),_&&0!==d||("new"===C.state&&C.start(E,F,"controlling"),"new"===T.state&&T.start(A));var j=s(P.localCapabilities,P.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length;!j&&P.sendEncodingParameters[0].rtx&&delete P.sendEncodingParameters[0].rtx,r._transceive(P,"sendrecv"===y||"recvonly"===y,"sendrecv"===y||"sendonly"===y),!R||"sendrecv"!==y&&"sendonly"!==y?delete P.rtpReceiver:(k=R.track,S?(o[S.stream]||(o[S.stream]=new e.MediaStream),i(k,o[S.stream]),f.push([k,R,o[S.stream]])):(o.default||(o.default=new e.MediaStream),i(k,o.default),f.push([k,R,o.default])))}}else{(P=r.transceivers[d]||r._createTransceiver(x)).mid=b,P.iceGatherer||(P.iceGatherer=r._createIceGatherer(d,_)),O.length&&"new"===P.iceTransport.state&&(!B||_&&0!==d?O.forEach((function(e){c(P.iceTransport,e)})):P.iceTransport.setRemoteCandidates(O)),D=e.RTCRtpReceiver.getCapabilities(x),t<15019&&(D.codecs=D.codecs.filter((function(e){return"rtx"!==e.name}))),w=P.sendEncodingParameters||[{ssrc:1001*(2*d+2)}];var N,U=!1;"sendrecv"===y||"sendonly"===y?(U=!P.rtpReceiver,R=P.rtpReceiver||new e.RTCRtpReceiver(P.dtlsTransport,x),U&&(k=R.track,S&&"-"===S.stream||(S?(o[S.stream]||(o[S.stream]=new e.MediaStream,Object.defineProperty(o[S.stream],"id",{get:function(){return S.stream}})),Object.defineProperty(k,"id",{get:function(){return S.track}}),N=o[S.stream]):(o.default||(o.default=new e.MediaStream),N=o.default)),N&&(i(k,N),P.associatedRemoteMediaStreams.push(N)),f.push([k,R,N]))):P.rtpReceiver&&P.rtpReceiver.track&&(P.associatedRemoteMediaStreams.forEach((function(e){var t=e.getTracks().find((function(e){return e.id===P.rtpReceiver.track.id}));t&&u(t,e)})),P.associatedRemoteMediaStreams=[]),P.localCapabilities=D,P.remoteCapabilities=M,P.rtpReceiver=R,P.rtcpParameters=L,P.sendEncodingParameters=w,P.recvEncodingParameters=I,r._transceive(r.transceivers[d],!1,U)}}})),void 0===r._dtlsRole&&(r._dtlsRole="offer"===a.type?"active":"passive"),r._remoteDescription={type:a.type,sdp:a.sdp},"offer"===a.type?r._updateSignalingState("have-remote-offer"):r._updateSignalingState("stable"),Object.keys(o).forEach((function(t){var i=o[t];if(i.getTracks().length){if(-1===r.remoteStreams.indexOf(i)){r.remoteStreams.push(i);var n=new Event("addstream");n.stream=i,e.setTimeout((function(){r._dispatchEvent("addstream",n)}))}f.forEach((function(e){var t=e[0],n=e[1];i.id===e[2].id&&h(r,t,n,[i])}))}})),f.forEach((function(e){e[2]||h(r,e[0],e[1],[])})),e.setTimeout((function(){r&&r.transceivers&&r.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},f.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},f.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},f.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},f.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var i=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",i)}},f.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var i=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",i)}},f.prototype.createOffer=function(){var i=this;if(i._isClosed)return Promise.reject(d("InvalidStateError","Can not call createOffer after close"));var a=i.transceivers.filter((function(e){return"audio"===e.kind})).length,o=i.transceivers.filter((function(e){return"video"===e.kind})).length,s=arguments[0];if(s){if(s.mandatory||s.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==s.offerToReceiveAudio&&(a=!0===s.offerToReceiveAudio?1:!1===s.offerToReceiveAudio?0:s.offerToReceiveAudio),void 0!==s.offerToReceiveVideo&&(o=!0===s.offerToReceiveVideo?1:!1===s.offerToReceiveVideo?0:s.offerToReceiveVideo)}for(i.transceivers.forEach((function(e){"audio"===e.kind?--a<0&&(e.wantReceive=!1):"video"===e.kind&&--o<0&&(e.wantReceive=!1)}));a>0||o>0;)a>0&&(i._createTransceiver("audio"),a--),o>0&&(i._createTransceiver("video"),o--);var l=n.writeSessionBoilerplate(i._sdpSessionId,i._sdpSessionVersion++);i.transceivers.forEach((function(a,r){var o=a.track,s=a.kind,l=a.mid||n.generateIdentifier();a.mid=l,a.iceGatherer||(a.iceGatherer=i._createIceGatherer(r,i.usingBundle));var c=e.RTCRtpSender.getCapabilities(s);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),a.remoteCapabilities&&a.remoteCapabilities.codecs&&a.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(a.remoteCapabilities&&a.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var d=a.sendEncodingParameters||[{ssrc:1001*(2*r+1)}];o&&t>=15019&&"video"===s&&!d[0].rtx&&(d[0].rtx={ssrc:d[0].ssrc+1}),a.wantReceive&&(a.rtpReceiver=new e.RTCRtpReceiver(a.dtlsTransport,s)),a.localCapabilities=c,a.sendEncodingParameters=d})),"max-compat"!==i._config.bundlePolicy&&(l+="a=group:BUNDLE "+i.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),l+="a=ice-options:trickle\r\n",i.transceivers.forEach((function(e,t){l+=r(e,e.localCapabilities,"offer",e.stream,i._dtlsRole),l+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===i.iceGatheringState||0!==t&&i.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,l+="a="+n.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(l+="a=end-of-candidates\r\n"))}));var c=new e.RTCSessionDescription({type:"offer",sdp:l});return Promise.resolve(c)},f.prototype.createAnswer=function(){var i=this;if(i._isClosed)return Promise.reject(d("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==i.signalingState&&"have-local-pranswer"!==i.signalingState)return Promise.reject(d("InvalidStateError","Can not call createAnswer in signalingState "+i.signalingState));var a=n.writeSessionBoilerplate(i._sdpSessionId,i._sdpSessionVersion++);i.usingBundle&&(a+="a=group:BUNDLE "+i.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n";var o=n.getMediaSections(i._remoteDescription.sdp).length;i.transceivers.forEach((function(e,n){if(!(n+1>o)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?a+="m=application 0 DTLS/SCTP 5000\r\n":a+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?a+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(a+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(a+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var l;e.stream&&("audio"===e.kind?l=e.stream.getAudioTracks()[0]:"video"===e.kind&&(l=e.stream.getVideoTracks()[0]),l&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}));var c=s(e.localCapabilities,e.remoteCapabilities),d=c.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length;!d&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,a+=r(e,c,"answer",e.stream,i._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(a+="a=rtcp-rsize\r\n")}}));var l=new e.RTCSessionDescription({type:"answer",sdp:a});return Promise.resolve(l)},f.prototype.addIceCandidate=function(e){var t,i=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(a,r){if(!i._remoteDescription)return r(d("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var s=0;s0?n.parseCandidate(e.candidate):{};if("tcp"===u.protocol&&(0===u.port||9===u.port))return a();if(u.component&&1!==u.component)return a();if((0===o||o>0&&l.iceTransport!==i.transceivers[0].iceTransport)&&!c(l.iceTransport,u))return r(d("OperationError","Can not add ICE candidate"));var h=e.candidate.trim();0===h.indexOf("a=")&&(h=h.substr(2)),(t=n.getMediaSections(i._remoteDescription.sdp))[o]+="a="+(u.type?h:"end-of-candidates")+"\r\n",i._remoteDescription.sdp=n.getDescription(i._remoteDescription.sdp)+t.join("")}else for(var f=0;f0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},n.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},n.parseFmtp=function(e){for(var t,i={},n=e.substr(e.indexOf(" ")+1).split(";"),a=0;a-1?(i.attribute=e.substr(t+1,n-t-1),i.value=e.substr(n+1)):i.attribute=e.substr(t+1),i},n.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},n.getMid=function(e){var t=n.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},n.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},n.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:n.matchPrefix(e+t,"a=fingerprint:").map(n.parseFingerprint)}},n.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},n.getIceParameters=function(e,t){var i=n.splitLines(e);return{usernameFragment:(i=i.concat(n.splitLines(t))).filter((function(e){return 0===e.indexOf("a=ice-ufrag:")}))[0].substr(12),password:i.filter((function(e){return 0===e.indexOf("a=ice-pwd:")}))[0].substr(10)}},n.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},n.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=n.splitLines(e)[0].split(" "),a=3;a0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){i+=n.writeRtpMap(e),i+=n.writeFmtp(e),i+=n.writeRtcpFb(e)}));var a=0;return t.codecs.forEach((function(e){e.maxptime>a&&(a=e.maxptime)})),a>0&&(i+="a=maxptime:"+a+"\r\n"),i+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach((function(e){i+=n.writeExtmap(e)})),i},n.parseRtpEncodingParameters=function(e){var t,i=[],a=n.parseRtpParameters(e),r=-1!==a.fecMechanisms.indexOf("RED"),o=-1!==a.fecMechanisms.indexOf("ULPFEC"),s=n.matchPrefix(e,"a=ssrc:").map((function(e){return n.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),l=s.length>0&&s[0].ssrc,c=n.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));c.length>0&&c[0].length>1&&c[0][0]===l&&(t=c[0][1]),a.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:l,codecPayloadType:parseInt(e.parameters.apt,10)};l&&t&&(n.rtx={ssrc:t}),i.push(n),r&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:l,mechanism:o?"red+ulpfec":"red"},i.push(n))}})),0===i.length&&l&&i.push({ssrc:l});var d=n.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,i.forEach((function(e){e.maxBitrate=d}))),i},n.parseRtcpParameters=function(e){var t={},i=n.matchPrefix(e,"a=ssrc:").map((function(e){return n.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(t.cname=i.value,t.ssrc=i.ssrc);var a=n.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=a.length>0,t.compound=0===a.length;var r=n.matchPrefix(e,"a=rtcp-mux");return t.mux=r.length>0,t},n.parseMsid=function(e){var t,i=n.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(t=i[0].substr(7).split(" "))[0],track:t[1]};var a=n.matchPrefix(e,"a=ssrc:").map((function(e){return n.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return a.length>0?{stream:(t=a[0].value.split(" "))[0],track:t[1]}:void 0},n.parseSctpDescription=function(e){var t,i=n.parseMLine(e),a=n.matchPrefix(e,"a=max-message-size:");a.length>0&&(t=parseInt(a[0].substr(19),10)),isNaN(t)&&(t=65536);var r=n.matchPrefix(e,"a=sctp-port:");if(r.length>0)return{port:parseInt(r[0].substr(12),10),protocol:i.fmt,maxMessageSize:t};if(n.matchPrefix(e,"a=sctpmap:").length>0){var o=n.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(o[0],10),protocol:o[1],maxMessageSize:t}}},n.writeSctpDescription=function(e,t){var i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},n.generateSessionId=function(){return Math.random().toString().substr(2,21)},n.writeSessionBoilerplate=function(e,t,i){var a=void 0!==t?t:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||n.generateSessionId())+" "+a+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},n.writeMediaSection=function(e,t,i,a){var r=n.writeRtpDescription(e.kind,t);if(r+=n.writeIceParameters(e.iceGatherer.getLocalParameters()),r+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":"active"),r+="a=mid:"+e.mid+"\r\n",e.direction?r+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?r+="a=sendrecv\r\n":e.rtpSender?r+="a=sendonly\r\n":e.rtpReceiver?r+="a=recvonly\r\n":r+="a=inactive\r\n",e.rtpSender){var o="msid:"+a.id+" "+e.rtpSender.track.id+"\r\n";r+="a="+o,r+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o,e.sendEncodingParameters[0].rtx&&(r+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o,r+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return r+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(r+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"),r},n.getDirection=function(e,t){for(var i=n.splitLines(e),a=0;a=26&&e<=t||re.extension.isInstalled()}return!0};var ae={extensionId:"hapfgfdkleiggjjpfpenajgdnfckjpaj",isInstalled:function(){return null!==document.querySelector("#janus-extension-installed")},getScreen:function(e){var t=window.setTimeout((function(){var t=new Error("NavigatorUserMediaError");return t.name='The required Chrome extension is not installed: click here to install it. (NOTE: this will need you to refresh the page)',e(t)}),1e3);this.cache[t]=e,window.postMessage({type:"janusGetScreen",id:t},"*")},init:function(){var e={};this.cache=e,window.addEventListener("message",(function(t){if(t.origin==window.location.origin)if("janusGotScreen"==t.data.type&&e[t.data.id]){var i=e[t.data.id];if(delete e[t.data.id],""===t.data.sourceId){var n=new Error("NavigatorUserMediaError");n.name="You cancelled the request for permission, giving up...",i(n)}else i(null,t.data.sourceId)}else"janusGetScreenPending"==t.data.type&&(console.log("clearing ",t.data.id),window.clearTimeout(t.data.id))}))}};function re(e){if(void 0===re.initDone)return e.error("Library not initialized"),{};if(!re.isWebrtcSupported())return e.error("WebRTC not supported by this browser"),{};if(re.log("Library initialized: "+re.initDone),(e=e||{}).success="function"==typeof e.success?e.success:re.noop,e.error="function"==typeof e.error?e.error:re.noop,e.destroyed="function"==typeof e.destroyed?e.destroyed:re.noop,null===e.server||void 0===e.server)return e.error("Invalid server url"),{};var t=!1,i=null,n={},r=null,o=null,s=0,l=e.server;re.isArray(l)?(re.log("Multiple servers provided ("+l.length+"), will use the first that works"),l=null,o=e.server,re.debug(o)):0===l.indexOf("ws")?(t=!0,re.log("Using WebSockets to contact Janus: "+l)):(t=!1,re.log("Using REST API to contact Janus: "+l));var c=e.iceServers;null==c&&(c=[{urls:"stun:stun.l.google.com:19302"}]);var d=e.iceTransportPolicy,u=e.bundlePolicy,h=e.ipv6;null==h&&(h=!1);var f=!1;void 0!==e.withCredentials&&null!==e.withCredentials&&(f=!0===e.withCredentials);var x=10;void 0!==e.max_poll_events&&null!==e.max_poll_events&&(x=e.max_poll_events),x<1&&(x=1);var p=null;void 0!==e.token&&null!==e.token&&(p=e.token);var m=null;void 0!==e.apisecret&&null!==e.apisecret&&(m=e.apisecret),this.destroyOnUnload=!0,void 0!==e.destroyOnUnload&&null!==e.destroyOnUnload&&(this.destroyOnUnload=!0===e.destroyOnUnload);var _=25e3;void 0!==e.keepAlivePeriod&&null!==e.keepAlivePeriod&&(_=e.keepAlivePeriod),isNaN(_)&&(_=25e3);var g=6e4;function v(e){var t={high:9e5,medium:3e5,low:1e5};return null!=e&&(e.high&&(t.high=e.high),e.medium&&(t.medium=e.medium),e.low&&(t.low=e.low)),t}void 0!==e.longPollTimeout&&null!==e.longPollTimeout&&(g=e.longPollTimeout),isNaN(g)&&(g=6e4);var y=!1,S=null,b={},P=this,E=0,C={};function T(){if(null!=S)if(re.debug("Long poll..."),y){var t=l+"/"+S+"?rid="+(new Date).getTime();null!=x&&(t=t+"&maxev="+x),null!=p&&(t=t+"&token="+encodeURIComponent(p)),null!=m&&(t=t+"&apisecret="+encodeURIComponent(m)),re.httpAPICall(t,{verb:"GET",withCredentials:f,success:R,timeout:g,error:function(t,i){if(re.error(t+":",i),++E>3)return y=!1,void e.error("Lost connection to the server (is it down?)");T()}})}else re.warn("Is the server down? (connected=false)")}function R(e,n){if(E=0,t||null==S||!0===n||T(),t||!re.isArray(e))if("keepalive"!==e.rtcgw)if("ack"!==e.rtcgw)if("success"!==e.rtcgw)if("trickle"===e.rtcgw){if(null==(l=e.sender))return void re.warn("Missing sender...");if(null==(d=b[l]))return void re.debug("This handle is not attached to this session");var a=e.candidate;re.debug("Got a trickled candidate on session "+S),re.debug(a);var r=d.webrtcStuff;r.pc&&r.remoteSdp?(re.debug("Adding remote candidate:",a),a&&!0!==a.completed?r.pc.addIceCandidate(a):r.pc.addIceCandidate(re.endOfCandidates)):(re.debug("We didn't do setRemoteDescription (trickle got here before the offer?), caching candidate"),r.candidates||(r.candidates=[]),r.candidates.push(a),re.debug(r.candidates))}else{if("webrtcup"===e.rtcgw)return re.debug("Got a webrtcup event on session "+S),re.debug(e),null==(l=e.sender)?void re.warn("Missing sender..."):null==(d=b[l])?void re.debug("This handle is not attached to this session"):void d.webrtcState(!0);if("hangup"===e.rtcgw){if(re.debug("Got a hangup event on session "+S),re.debug(e),null==(l=e.sender))return void re.warn("Missing sender...");if(null==(d=b[l]))return void re.debug("This handle is not attached to this session");d.webrtcState(!1,e.reason),d.hangup()}else if("detached"===e.rtcgw){if(re.debug("Got a detached event on session "+S),re.debug(e),null==(l=e.sender))return void re.warn("Missing sender...");if(null==(d=b[l]))return;d.detached=!0,d.ondetached(),d.detach()}else if("media"===e.rtcgw){if(re.debug("Got a media event on session "+S),re.debug(e),null==(l=e.sender))return void re.warn("Missing sender...");if(null==(d=b[l]))return void re.debug("This handle is not attached to this session");d.mediaState(e.type,e.receiving)}else if("slowlink"===e.rtcgw){if(re.debug("Got a slowlink event on session "+S),re.debug(e),null==(l=e.sender))return void re.warn("Missing sender...");if(null==(d=b[l]))return void re.debug("This handle is not attached to this session");d.slowLink(e.uplink,e.lost)}else{if("error"===e.rtcgw){var o,s;if(re.error("Ooops: "+e.error.code+" "+e.error.reason),re.debug(e),null!=(o=e.transaction))null!=(s=C[o])&&s(e),delete C[o];return}if("event"===e.rtcgw){var l;if(re.debug("Got a plugin event on session "+S),re.debug(e),null==(l=e.sender))return void re.warn("Missing sender...");var c=e.plugindata;if(null==c)return void re.warn("Missing plugindata...");re.debug(" -- Event is coming from "+l+" ("+c.plugin+")");var d,u=c.data;if(re.debug(u),null==(d=b[l]))return void re.warn("This handle is not attached to this session");var h=e.jsep;null!=h&&(re.debug("Handling SDP as well..."),re.debug(h));var f=d.onmessage;null!=f?(re.debug("Notifying application..."),f(u,h)):re.debug("No provided notification callback")}else{if("timeout"===e.rtcgw)return re.error("Timeout on session "+S),re.debug(e),void(t&&i.close(3504,"Gateway timeout"));re.warn("Unknown message/event '"+e.rtcgw+"' on session "+S),re.debug(e)}}}else re.debug("Got a success on session "+S),re.debug(e),null!=(o=e.transaction)&&(null!=(s=C[o])&&s(e),delete C[o]);else re.debug("Got an ack on session "+S),re.debug(e),null!=(o=e.transaction)&&(null!=(s=C[o])&&s(e),delete C[o]);else re.vdebug("Got a keepalive on session "+S);else for(var x=0;x data channel: "+i),"open"===i){if(r.dataChannel[t].pending&&r.dataChannel[t].pending.length>0){for(var n in re.log("Sending pending messages on <"+t+">:",r.dataChannel[t].pending.length),r.dataChannel[t].pending){var o=r.dataChannel[t].pending[n];re.log("Sending string on data channel <"+t+">: "+o),r.dataChannel[t].send(o)}r.dataChannel[t].pending=[]}a.ondataopen(t)}};r.dataChannel[t]=i||r.pc.createDataChannel(t,{ordered:!1}),r.dataChannel[t].onmessage=function(e){re.log("Received message on data channel:",e);var t=e.target.label;a.ondata(e.data,t)},r.dataChannel[t].onopen=o,r.dataChannel[t].onclose=o,r.dataChannel[t].onerror=function(e){re.error("Got error on data channel:",e)},r.dataChannel[t].pending=[],n&&r.dataChannel[t].pending.push(n)}else re.warn("Invalid handle")}function A(e,t){(t=t||{}).success="function"==typeof t.success?t.success:re.noop,t.error="function"==typeof t.error?t.error:re.noop;var i=b[e];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return re.warn("Invalid handle"),void t.error("Invalid handle");var n=i.webrtcStuff,a=t.text;if(null==a)return re.warn("Invalid text"),void t.error("Invalid text");var r=t.label?t.label:re.dataChanDefaultLabel;return n.dataChannel[r]?"open"!==n.dataChannel[r].readyState?(n.dataChannel[r].pending.push(a),void t.success()):(re.log("Sending string on data channel <"+r+">: "+a),n.dataChannel[r].send(a),void t.success()):(F(e,r,!1,a),void t.success())}function M(e,t){(t=t||{}).success="function"==typeof t.success?t.success:re.noop,t.error="function"==typeof t.error?t.error:re.noop;var i=b[e];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return re.warn("Invalid handle"),void t.error("Invalid handle");var n=i.webrtcStuff;if(null===n.dtmfSender||void 0===n.dtmfSender){if(void 0!==n.pc&&null!==n.pc){var a=n.pc.getSenders().find((function(e){return e.track&&"audio"===e.track.kind}));if(!a)return re.warn("Invalid DTMF configuration (no audio track)"),void t.error("Invalid DTMF configuration (no audio track)");n.dtmfSender=a.dtmf,n.dtmfSender&&(re.log("Created DTMF Sender"),n.dtmfSender.ontonechange=function(e){re.debug("Sent DTMF tone: "+e.tone)})}if(null===n.dtmfSender||void 0===n.dtmfSender)return re.warn("Invalid DTMF configuration"),void t.error("Invalid DTMF configuration")}var r=t.dtmf;if(null==r)return re.warn("Invalid DTMF parameters"),void t.error("Invalid DTMF parameters");var o=r.tones;if(null==o)return re.warn("Invalid DTMF string"),void t.error("Invalid DTMF string");var s=r.duration;null==s&&(s=500);var l=r.gap;null==l&&(l=50),re.debug("Sending DTMF string "+o+" (duration "+s+"ms, gap "+l+"ms)"),n.dtmfSender.insertDTMF(o,s,l),t.success()}function L(e,n){(n=n||{}).success="function"==typeof n.success?n.success:re.noop,n.error="function"==typeof n.error?n.error:re.noop;var a=!0;void 0!==n.asyncRequest&&null!==n.asyncRequest&&(a=!0===n.asyncRequest);var r=!0;void 0!==n.noRequest&&null!==n.noRequest&&(r=!0===n.noRequest),re.log("Destroying handle "+e+" (async="+a+")"),Z(e);var o=b[e];if(null==o||o.detached)return delete b[e],void n.success();if(r)return delete b[e],void n.success();if(!y)return re.warn("Is the server down? (connected=false)"),void n.error("Is the server down? (connected=false)");var s={rtcgw:"detach",transaction:re.randomString(12)};if(null!==o.token&&void 0!==o.token&&(s.token=o.token),null!=m&&(s.apisecret=m),t)return s.session_id=S,s.handle_id=e,i.send(JSON.stringify(s)),delete b[e],void n.success();re.httpAPICall(l+"/"+S+"/"+e,{verb:"POST",async:a,withCredentials:f,body:s,success:function(t){re.log("Destroyed handle:"),re.debug(t),"success"!==t.rtcgw&&re.error("Ooops: "+t.error.code+" "+t.error.reason),delete b[e],n.success()},error:function(t,i){re.error(t+":",i),delete b[e],n.success()}})}function B(e,t,i,n,r){var o=b[e];if(null==o||null===o.webrtcStuff||void 0===o.webrtcStuff)return re.warn("Invalid handle"),void n.error("Invalid handle");var s=o.webrtcStuff;re.debug("streamsDone:",r),r&&(re.debug(" -- Audio tracks:",r.getAudioTracks()),re.debug(" -- Video tracks:",r.getVideoTracks()));var l=!1;if(s.myStream&&i.update&&!s.streamExternal){if((!i.update&&W(i)||i.update&&(i.addAudio||i.replaceAudio))&&r.getAudioTracks()&&r.getAudioTracks().length)if(s.myStream.addTrack(r.getAudioTracks()[0]),re.unifiedPlan){re.log((i.replaceAudio?"Replacing":"Adding")+" audio track:",r.getAudioTracks()[0]);var f=null;if((p=s.pc.getTransceivers())&&p.length>0)for(var x in p){if((_=p[x]).sender&&_.sender.track&&"audio"===_.sender.track.kind||_.receiver&&_.receiver.track&&"audio"===_.receiver.track.kind){f=_;break}}f&&f.sender?f.sender.replaceTrack(r.getAudioTracks()[0]):s.pc.addTrack(r.getAudioTracks()[0],r)}else re.log((i.replaceAudio?"Replacing":"Adding")+" audio track:",r.getAudioTracks()[0]),s.pc.addTrack(r.getAudioTracks()[0],r);if((!i.update&&Y(i)||i.update&&(i.addVideo||i.replaceVideo))&&r.getVideoTracks()&&r.getVideoTracks().length)if(s.myStream.addTrack(r.getVideoTracks()[0]),re.unifiedPlan){re.log((i.replaceVideo?"Replacing":"Adding")+" video track:",r.getVideoTracks()[0]);var p,m=null;if((p=s.pc.getTransceivers())&&p.length>0)for(var x in p){var _;if((_=p[x]).sender&&_.sender.track&&"video"===_.sender.track.kind||_.receiver&&_.receiver.track&&"video"===_.receiver.track.kind){m=_;break}}m&&m.sender?m.sender.replaceTrack(r.getVideoTracks()[0]):s.pc.addTrack(r.getVideoTracks()[0],r)}else re.log((i.replaceVideo?"Replacing":"Adding")+" video track:",r.getVideoTracks()[0]),s.pc.addTrack(r.getVideoTracks()[0],r)}else s.myStream=r,l=!0;if(!s.pc){var g={iceServers:c,iceTransportPolicy:d,bundlePolicy:u};"chrome"===re.webRTCAdapter.browserDetails.browser&&(g.sdpSemantics=re.webRTCAdapter.browserDetails.version<72?"plan-b":"unified-plan");var y={optional:[{DtlsSrtpKeyAgreement:!0}]};if(!0===h&&y.optional.push({googIPv6:!0}),n.rtcConstraints&&"object"===a(n.rtcConstraints))for(var x in re.debug("Adding custom PeerConnection constraints:",n.rtcConstraints),n.rtcConstraints)y.optional.push(n.rtcConstraints[x]);"edge"===re.webRTCAdapter.browserDetails.browser&&(g.bundlePolicy="max-bundle"),re.log("Creating PeerConnection"),re.debug(y),s.pc=new RTCPeerConnection(g,y),re.debug(s.pc),s.pc.getStats&&(s.volume={},s.bitrate.value="0 kbits/sec"),re.log("Preparing local SDP and gathering candidates (trickle="+s.trickle+")"),s.pc.oniceconnectionstatechange=function(e){s.pc&&o.iceState(s.pc.iceConnectionState)},s.pc.onicecandidate=function(t){if(null==t.candidate||"edge"===re.webRTCAdapter.browserDetails.browser&&t.candidate.candidate.indexOf("endOfCandidates")>0)re.log("End of candidates."),s.iceDone=!0,!0===s.trickle?k(e,{completed:!0}):function(e,t){t=t||{},t.success="function"==typeof t.success?t.success:re.noop,t.error="function"==typeof t.error?t.error:re.noop;var i=b[e];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return void re.warn("Invalid handle, not sending anything");var n=i.webrtcStuff;if(re.log("Sending offer/answer SDP..."),null===n.mySdp||void 0===n.mySdp)return void re.warn("Local SDP instance is invalid, not sending anything...");n.mySdp={type:n.pc.localDescription.type,sdp:n.pc.localDescription.sdp},!1===n.trickle&&(n.mySdp.trickle=!1);re.debug(t),n.sdpSent=!0,t.success(n.mySdp)}(e,n);else{var i={candidate:t.candidate.candidate,sdpMid:t.candidate.sdpMid,sdpMLineIndex:t.candidate.sdpMLineIndex};!0===s.trickle&&k(e,i)}},s.pc.ontrack=function(e){re.log("Handling Remote Track"),re.debug(e),e.streams&&(s.remoteStream=e.streams[0],o.onremotestream(s.remoteStream),e.track.onended||(re.log("Adding onended callback to track:",e.track),e.track.onended=function(e){re.log("Remote track muted/removed:",e),s.remoteStream&&(s.remoteStream.removeTrack(e.target),o.onremotestream(s.remoteStream))},e.track.onmute=e.track.onended,e.track.onunmute=function(e){re.log("Remote track flowing again:",e);try{s.remoteStream.addTrack(e.target),o.onremotestream(s.remoteStream)}catch(e){re.error(e)}}))}}if(l&&null!=r){re.log("Adding local stream");var S=!0===n.simulcast2;r.getTracks().forEach((function(e){if(re.log("Adding local track:",e),S)if("audio"===e.kind)s.pc.addTrack(e,r);else{re.log("Enabling rid-based simulcasting:",e);var t=v(n.simulcastMaxBitrates);s.pc.addTransceiver(e,{direction:"sendrecv",streams:[r],sendEncodings:[{rid:"h",active:!0,maxBitrate:t.high},{rid:"m",active:!0,maxBitrate:t.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:t.low,scaleResolutionDownBy:4}]})}else s.pc.addTrack(e,r)}))}(function(e){if(re.debug("isDataEnabled:",e),"edge"==re.webRTCAdapter.browserDetails.browser)return re.warn("Edge doesn't support data channels yet"),!1;return null!=e&&!0===e.data})(i)&&!s.dataChannel[re.dataChanDefaultLabel]&&(re.log("Creating data channel"),F(e,re.dataChanDefaultLabel,!1),s.pc.ondatachannel=function(t){re.log("Data channel created by Janus:",t),F(e,t.channel.label,t.channel)}),s.myStream&&o.onlocalstream(s.myStream),null==t?function(e,t,i){i=i||{},i.success="function"==typeof i.success?i.success:re.noop,i.error="function"==typeof i.error?i.error:re.noop,i.customizeSdp="function"==typeof i.customizeSdp?i.customizeSdp:re.noop;var n=b[e];if(null==n||null===n.webrtcStuff||void 0===n.webrtcStuff)return re.warn("Invalid handle"),void i.error("Invalid handle");var a=n.webrtcStuff,r=!0===i.simulcast;r?re.log("Creating offer (iceDone="+a.iceDone+", simulcast="+r+")"):re.log("Creating offer (iceDone="+a.iceDone+")");var o={};if(re.unifiedPlan){var s=null,l=null,c=a.pc.getTransceivers();if(c&&c.length>0)for(var d in c){var u=c[d];u.sender&&u.sender.track&&"audio"===u.sender.track.kind||u.receiver&&u.receiver.track&&"audio"===u.receiver.track.kind?s||(s=u):(u.sender&&u.sender.track&&"video"===u.sender.track.kind||u.receiver&&u.receiver.track&&"video"===u.receiver.track.kind)&&(l||(l=u))}var h=W(t),f=G(t);h||f?h&&f?s&&(s.setDirection?s.setDirection("sendrecv"):s.direction="sendrecv",re.log("Setting audio transceiver to sendrecv:",s)):h&&!f?s&&(s.setDirection?s.setDirection("sendonly"):s.direction="sendonly",re.log("Setting audio transceiver to sendonly:",s)):!h&&f&&(s?(s.setDirection?s.setDirection("recvonly"):s.direction="recvonly",re.log("Setting audio transceiver to recvonly:",s)):(s=a.pc.addTransceiver("audio",{direction:"recvonly"}),re.log("Adding recvonly audio transceiver:",s))):t.removeAudio&&s&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive",re.log("Setting audio transceiver to inactive:",s));var x=Y(t),p=X(t);x||p?x&&p?l&&(l.setDirection?l.setDirection("sendrecv"):l.direction="sendrecv",re.log("Setting video transceiver to sendrecv:",l)):x&&!p?l&&(l.setDirection?l.setDirection("sendonly"):l.direction="sendonly",re.log("Setting video transceiver to sendonly:",l)):!x&&p&&(l?(l.setDirection?l.setDirection("recvonly"):l.direction="recvonly",re.log("Setting video transceiver to recvonly:",l)):(l=a.pc.addTransceiver("video",{direction:"recvonly"}),re.log("Adding recvonly video transceiver:",l))):t.removeVideo&&l&&(l.setDirection?l.setDirection("inactive"):l.direction="inactive",re.log("Setting video transceiver to inactive:",l))}else o.offerToReceiveAudio=G(t),o.offerToReceiveVideo=X(t);var m=!0===i.iceRestart;m&&(o.iceRestart=!0);re.debug(o);var _=Y(t);if(_&&r&&"firefox"===re.webRTCAdapter.browserDetails.browser){re.log("Enabling Simulcasting for Firefox (RID)");var g=a.pc.getSenders().find((function(e){return"video"==e.track.kind}));if(g){var y=g.getParameters();y||(y={});var S=v(i.simulcastMaxBitrates);y.encodings=[{rid:"h",active:!0,maxBitrate:S.high},{rid:"m",active:!0,maxBitrate:S.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:S.low,scaleResolutionDownBy:4}],g.setParameters(y)}}a.pc.createOffer(o).then((function(e){re.debug(e);var t={type:e.type,sdp:e.sdp};i.customizeSdp(t),e.sdp=t.sdp,re.log("Setting local description"),_&&r&&("chrome"===re.webRTCAdapter.browserDetails.browser||"safari"===re.webRTCAdapter.browserDetails.browser?(re.log("Enabling Simulcasting for Chrome (SDP munging)"),e.sdp=function(e){for(var t=e.split("\r\n"),i=!1,n=[-1],a=[-1],r=null,o=null,s=null,l=null,c=-1,d=0;d-1){c=d;break}}else if(i){var u=t[d].match(/a=ssrc-group:FID (\d+) (\d+)/);if(u)n[0]=u[1],a[0]=u[2],t.splice(d,1),d--;else{if(n[0]){if((x=t[d].match("a=ssrc:"+n[0]+" cname:(.+)"))&&(r=x[1]),(x=t[d].match("a=ssrc:"+n[0]+" msid:(.+)"))&&(o=x[1]),(x=t[d].match("a=ssrc:"+n[0]+" mslabel:(.+)"))&&(s=x[1]),(x=t[d].match("a=ssrc:"+n[0]+" label:(.+)"))&&(l=x[1]),0===t[d].indexOf("a=ssrc:"+a[0])){t.splice(d,1),d--;continue}if(0===t[d].indexOf("a=ssrc:"+n[0])){t.splice(d,1),d--;continue}}0!=t[d].length||(t.splice(d,1),d--)}}}if(n[0]<0){c=-1,i=!1;for(d=0;d-1){c=d;break}}else if(i){if(n[0]<0){var f=t[d].match(/a=ssrc:(\d+)/);if(f){n[0]=f[1],t.splice(d,1),d--;continue}}else{var x;if((x=t[d].match("a=ssrc:"+n[0]+" cname:(.+)"))&&(r=x[1]),(x=t[d].match("a=ssrc:"+n[0]+" msid:(.+)"))&&(o=x[1]),(x=t[d].match("a=ssrc:"+n[0]+" mslabel:(.+)"))&&(s=x[1]),(x=t[d].match("a=ssrc:"+n[0]+" label:(.+)"))&&(l=x[1]),0===t[d].indexOf("a=ssrc:"+a[0])){t.splice(d,1),d--;continue}if(0===t[d].indexOf("a=ssrc:"+n[0])){t.splice(d,1),d--;continue}}0!=t[d].length||(t.splice(d,1),d--)}}}if(n[0]<0)return re.warn("Couldn't find the video SSRC, simulcasting NOT enabled"),e;c<0&&(c=t.length);n[1]=Math.floor(4294967295*Math.random()),n[2]=Math.floor(4294967295*Math.random()),a[1]=Math.floor(4294967295*Math.random()),a[2]=Math.floor(4294967295*Math.random());for(d=0;d0){for(var a=0;a0)for(var d in c){var u=c[d];u.sender&&u.sender.track&&"audio"===u.sender.track.kind||u.receiver&&u.receiver.track&&"audio"===u.receiver.track.kind?s||(s=u):(u.sender&&u.sender.track&&"video"===u.sender.track.kind||u.receiver&&u.receiver.track&&"video"===u.receiver.track.kind)&&(l||(l=u))}var h=W(t),f=G(t);if(h||f){if(h&&f){if(s)try{s.setDirection?s.setDirection("sendrecv"):s.direction="sendrecv",re.log("Setting audio transceiver to sendrecv:",s)}catch(e){re.error(e)}}else if(h&&!f)try{s&&(s.setDirection?s.setDirection("sendonly"):s.direction="sendonly",re.log("Setting audio transceiver to sendonly:",s))}catch(e){re.error(e)}else if(!h&&f)if(s)try{s.setDirection?s.setDirection("recvonly"):s.direction="recvonly",re.log("Setting audio transceiver to recvonly:",s)}catch(e){re.error(e)}else s=a.pc.addTransceiver("audio",{direction:"recvonly"}),re.log("Adding recvonly audio transceiver:",s)}else if(t.removeAudio&&s)try{s.setDirection?s.setDirection("inactive"):s.direction="inactive",re.log("Setting audio transceiver to inactive:",s)}catch(e){re.error(e)}var x=Y(t),p=X(t);if(x||p){if(x&&p){if(l)try{l.setDirection?l.setDirection("sendrecv"):l.direction="sendrecv",re.log("Setting video transceiver to sendrecv:",l)}catch(e){re.error(e)}}else if(x&&!p){if(l)try{l.setDirection?l.setDirection("sendonly"):l.direction="sendonly",re.log("Setting video transceiver to sendonly:",l)}catch(e){re.error(e)}}else if(!x&&p)if(l)try{l.setDirection?l.setDirection("recvonly"):l.direction="recvonly",re.log("Setting video transceiver to recvonly:",l)}catch(e){re.error(e)}else l=a.pc.addTransceiver("video",{direction:"recvonly"}),re.log("Adding recvonly video transceiver:",l)}else if(t.removeVideo&&l)try{l.setDirection?l.setDirection("inactive"):l.direction="inactive",re.log("Setting video transceiver to inactive:",l)}catch(e){re.error(e)}}else o="firefox"==re.webRTCAdapter.browserDetails.browser||"edge"==re.webRTCAdapter.browserDetails.browser?{offerToReceiveAudio:G(t),offerToReceiveVideo:X(t)}:{mandatory:{OfferToReceiveAudio:G(t),OfferToReceiveVideo:X(t)}};re.debug(o);var m=Y(t);if(m&&r&&"firefox"===re.webRTCAdapter.browserDetails.browser){re.log("Enabling Simulcasting for Firefox (RID)");var _=a.pc.getSenders()[1];re.log(_);var g=_.getParameters();re.log(g);var y=v(i.simulcastMaxBitrates);_.setParameters({encodings:[{rid:"high",active:!0,priority:"high",maxBitrate:y.high},{rid:"medium",active:!0,priority:"medium",maxBitrate:y.medium},{rid:"low",active:!0,priority:"low",maxBitrate:y.low}]})}a.pc.createAnswer(o).then((function(e){re.debug(e);var t={type:e.type,sdp:e.sdp};i.customizeSdp(t),e.sdp=t.sdp,re.log("Setting local description"),m&&r&&("chrome"===re.webRTCAdapter.browserDetails.browser?re.warn("simulcast=true, but this is an answer, and video breaks in Chrome if we enable it"):"firefox"!==re.webRTCAdapter.browserDetails.browser&&re.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring")),a.mySdp=e.sdp,a.pc.setLocalDescription(e).catch(i.error),a.mediaConstraints=o,a.iceDone||a.trickle?i.success(e):re.log("Waiting for all candidates...")}),i.error)}(e,i,n)}),n.error)}function O(e,t,i){(i=i||{}).success="function"==typeof i.success?i.success:re.noop,i.error="function"==typeof i.error?i.error:V;var n=i.jsep;if(t&&n)return re.error("Provided a JSEP to a createOffer"),void i.error("Provided a JSEP to a createOffer");if(!(t||n&&n.type&&n.sdp))return re.error("A valid JSEP is required for createAnswer"),void i.error("A valid JSEP is required for createAnswer");i.media=i.media||{audio:!0,video:!0};var r=i.media,o=b[e];if(null==o||null===o.webrtcStuff||void 0===o.webrtcStuff)return re.warn("Invalid handle"),void i.error("Invalid handle");var s,l=o.webrtcStuff;if(l.trickle=(s=i.trickle,re.debug("isTrickleEnabled:",s),null==s||!0===s),void 0===l.pc||null===l.pc)r.update=!1,r.keepAudio=!1,r.keepVideo=!1;else if(void 0!==l.pc&&null!==l.pc){if(re.log("Updating existing media session"),r.update=!0,null!==i.stream&&void 0!==i.stream)i.stream!==l.myStream&&re.log("Renegotiation involves a new external stream");else{if(r.addAudio){if(r.keepAudio=!1,r.replaceAudio=!1,r.removeAudio=!1,r.audioSend=!0,l.myStream&&l.myStream.getAudioTracks()&&l.myStream.getAudioTracks().length)return re.error("Can't add audio stream, there already is one"),void i.error("Can't add audio stream, there already is one")}else r.removeAudio?(r.keepAudio=!1,r.replaceAudio=!1,r.addAudio=!1,r.audioSend=!1):r.replaceAudio&&(r.keepAudio=!1,r.addAudio=!1,r.removeAudio=!1,r.audioSend=!0);if(null===l.myStream||void 0===l.myStream?(r.replaceAudio&&(r.keepAudio=!1,r.replaceAudio=!1,r.addAudio=!0,r.audioSend=!0),W(r)&&(r.keepAudio=!1,r.addAudio=!0)):null===l.myStream.getAudioTracks()||void 0===l.myStream.getAudioTracks()||0===l.myStream.getAudioTracks().length?(r.replaceAudio&&(r.keepAudio=!1,r.replaceAudio=!1,r.addAudio=!0,r.audioSend=!0),W(r)&&(r.keepVideo=!1,r.addAudio=!0)):!W(r)||r.removeAudio||r.replaceAudio||(r.keepAudio=!0),r.addVideo){if(r.keepVideo=!1,r.replaceVideo=!1,r.removeVideo=!1,r.videoSend=!0,l.myStream&&l.myStream.getVideoTracks()&&l.myStream.getVideoTracks().length)return re.error("Can't add video stream, there already is one"),void i.error("Can't add video stream, there already is one")}else r.removeVideo?(r.keepVideo=!1,r.replaceVideo=!1,r.addVideo=!1,r.videoSend=!1):r.replaceVideo&&(r.keepVideo=!1,r.addVideo=!1,r.removeVideo=!1,r.videoSend=!0);null===l.myStream||void 0===l.myStream||null===l.myStream.getVideoTracks()||void 0===l.myStream.getVideoTracks()||0===l.myStream.getVideoTracks().length?(r.replaceVideo&&(r.keepVideo=!1,r.replaceVideo=!1,r.addVideo=!0,r.videoSend=!0),Y(r)&&(r.keepVideo=!1,r.addVideo=!0)):!Y(r)||r.removeVideo||r.replaceVideo||(r.keepVideo=!0),r.addData&&(r.data=!0)}if(W(r)&&r.keepAudio&&Y(r)&&r.keepVideo)return o.consentDialog(!1),void B(e,n,r,i,l.myStream)}if(r.update&&!l.streamExternal){if(r.removeAudio||r.replaceAudio){if(l.myStream&&l.myStream.getAudioTracks()&&l.myStream.getAudioTracks().length){var c=l.myStream.getAudioTracks()[0];re.log("Removing audio track:",c),l.myStream.removeTrack(c);try{c.stop()}catch(e){}}if(l.pc.getSenders()&&l.pc.getSenders().length){var d=!0;if(r.replaceAudio&&re.unifiedPlan&&(d=!1),d)for(var u in l.pc.getSenders()){(c=l.pc.getSenders()[u])&&c.track&&"audio"===c.track.kind&&(re.log("Removing audio sender:",c),l.pc.removeTrack(c))}}}if(r.removeVideo||r.replaceVideo){if(l.myStream&&l.myStream.getVideoTracks()&&l.myStream.getVideoTracks().length){c=l.myStream.getVideoTracks()[0];re.log("Removing video track:",c),l.myStream.removeTrack(c);try{c.stop()}catch(e){}}if(l.pc.getSenders()&&l.pc.getSenders().length){var h=!0;if(r.replaceVideo&&re.unifiedPlan&&(h=!1),h)for(var u in l.pc.getSenders()){(c=l.pc.getSenders()[u])&&c.track&&"video"===c.track.kind&&(re.log("Removing video sender:",c),l.pc.removeTrack(c))}}}}if(null!==i.stream&&void 0!==i.stream){var f=i.stream;if(re.log("MediaStream provided by the application"),re.debug(f),r.update&&l.myStream&&l.myStream!==i.stream&&!l.streamExternal){try{var x=l.myStream.getTracks();for(var p in x){var m=x[p];re.log(m),null!=m&&m.stop()}}catch(e){}l.myStream=null}return l.streamExternal=!0,o.consentDialog(!1),void B(e,n,r,i,f)}if(W(r)||Y(r)){if(!re.isGetUserMediaAvailable())return void i.error("getUserMedia not available");var _={mandatory:{},optional:[]};o.consentDialog(!0);var g=W(r);!0===g&&null!=r&&null!=r&&"object"===a(r.audio)&&(g=r.audio);var v=Y(r);if(!0===v&&null!=r&&null!=r){var y=!0===i.simulcast,S=!0===i.simulcast2;if(!y&&!S||n||void 0!==r.video&&!1!==r.video||(r.video="hires"),r.video&&"screen"!=r.video&&"window"!=r.video)if("object"===a(r.video))v=r.video;else{var P=0,E=0;"lowres"===r.video?(E=240,P=320):"lowres-16:9"===r.video?(E=180,P=320):"hires"===r.video||"hires-16:9"===r.video||"hdres"===r.video?(E=720,P=1280):"fhdres"===r.video?(E=1080,P=1920):"4kres"===r.video?(E=2160,P=3840):"stdres"===r.video?(E=480,P=640):"stdres-16:9"===r.video?(E=360,P=640):(re.log("Default video setting is stdres 4:3"),E=480,P=640),re.log("Adding media constraint:",r.video),v={height:{ideal:E},width:{ideal:P}},re.log("Adding video constraint:",v)}else if("screen"===r.video||"window"===r.video){var C=function(t,a){o.consentDialog(!1),t?i.error(t):B(e,n,r,i,a)},T=function(e,t,i){re.log("Adding media constraint (screen capture)"),re.debug(e),navigator.mediaDevices.getUserMedia(e).then((function(e){i?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(i){e.addTrack(i.getAudioTracks()[0]),t(null,e)})):t(null,e)})).catch((function(e){o.consentDialog(!1),t(e)}))};if(r.screenshareFrameRate||(r.screenshareFrameRate=3),navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return void navigator.mediaDevices.getDisplayMedia({video:!0}).then((function(t){o.consentDialog(!1),W(r)&&!r.keepAudio?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(a){t.addTrack(a.getAudioTracks()[0]),B(e,n,r,i,t)})):B(e,n,r,i,t)}),(function(e){o.consentDialog(!1),i.error(e)}));if("chrome"===re.webRTCAdapter.browserDetails.browser){var R=re.webRTCAdapter.browserDetails.version,w=33;window.navigator.userAgent.match("Linux")&&(w=35),R>=26&&R<=w?(_={video:{mandatory:{googLeakyBucket:!0,maxWidth:window.screen.width,maxHeight:window.screen.height,minFrameRate:r.screenshareFrameRate,maxFrameRate:r.screenshareFrameRate,chromeMediaSource:"screen"}},audio:W(r)&&!r.keepAudio},T(_,C)):re.extension.getScreen((function(e,t){if(e)return o.consentDialog(!1),i.error(e);(_={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",maxWidth:window.screen.width,maxHeight:window.screen.height,minFrameRate:r.screenshareFrameRate,maxFrameRate:r.screenshareFrameRate},optional:[{googLeakyBucket:!0},{googTemporalLayeredScreencast:!0}]}}).video.mandatory.chromeMediaSourceId=t,T(_,C,W(r)&&!r.keepAudio)}))}else if("firefox"===re.webRTCAdapter.browserDetails.browser){if(!(re.webRTCAdapter.browserDetails.version>=33)){var I=new Error("NavigatorUserMediaError");return I.name="Your version of Firefox does not support screen sharing, please install Firefox 33 (or more recent versions)",o.consentDialog(!1),void i.error(I)}_={video:{mozMediaSource:r.video,mediaSource:r.video},audio:W(r)&&!r.keepAudio},T(_,(function(e,t){if(C(e,t),!e)var i=t.currentTime,n=window.setInterval((function(){t||window.clearInterval(n),t.currentTime==i&&(window.clearInterval(n),t.onended&&t.onended()),i=t.currentTime}),500)}))}return}}null!=r&&"screen"===r.video||navigator.mediaDevices.enumerateDevices().then((function(t){var s=t.some((function(e){return"audioinput"===e.kind})),l=function(e){if(re.debug("isScreenSendEnabled:",e),null==e)return!1;if("object"!==a(e.video)||"object"!==a(e.video.mandatory))return!1;var t=e.video.mandatory;if(t.chromeMediaSource)return"desktop"===t.chromeMediaSource||"screen"===t.chromeMediaSource;if(t.mozMediaSource)return"window"===t.mozMediaSource||"screen"===t.mozMediaSource;if(t.mediaSource)return"window"===t.mediaSource||"screen"===t.mediaSource;return!1}(r)||t.some((function(e){return"videoinput"===e.kind})),c=W(r),d=Y(r),u=function(e){return re.debug("isAudioSendRequired:",e),null!=e&&(!1!==e.audio&&!1!==e.audioSend&&(void 0!==e.failIfNoAudio&&null!==e.failIfNoAudio&&!0===e.failIfNoAudio))}(r),h=function(e){return re.debug("isVideoSendRequired:",e),null!=e&&(!1!==e.video&&!1!==e.videoSend&&(void 0!==e.failIfNoVideo&&null!==e.failIfNoVideo&&!0===e.failIfNoVideo))}(r);if(c||d||u||h){var x=!!c&&s,p=!!d&&l;if(!x&&!p)return o.consentDialog(!1),i.error("No capture device found"),!1;if(!x&&u)return o.consentDialog(!1),i.error("Audio capture is required, but no capture device found"),!1;if(!p&&h)return o.consentDialog(!1),i.error("Video capture is required, but no capture device found"),!1}var m={audio:!(!s||r.keepAudio)&&g,video:!(!l||r.keepVideo)&&v};re.debug("getUserMedia constraints",m),m.audio||m.video?navigator.mediaDevices.getUserMedia(m).then((function(t){o.consentDialog(!1),B(e,n,r,i,t)})).catch((function(e){o.consentDialog(!1),i.error({code:e.code,name:e.name,message:e.message})})):(o.consentDialog(!1),B(e,n,r,i,f))})).catch((function(e){o.consentDialog(!1),i.error("enumerateDevices error",e)}))}else B(e,n,r,i)}function j(e,t){(t=t||{}).success="function"==typeof t.success?t.success:re.noop,t.error="function"==typeof t.error?t.error:V;var i=t.jsep,n=b[e];if(null==n||null===n.webrtcStuff||void 0===n.webrtcStuff)return re.warn("Invalid handle"),void t.error("Invalid handle");var a=n.webrtcStuff;if(null!=i){if(null===a.pc)return re.warn("Wait, no PeerConnection?? if this is an answer, use createAnswer and not handleRemoteJsep"),void t.error("No PeerConnection: if this is an answer, use createAnswer and not handleRemoteJsep");a.pc.setRemoteDescription(i).then((function(){if(re.log("Remote description accepted!"),a.remoteSdp=i.sdp,a.candidates&&a.candidates.length>0){for(var e=0;e-1)&&"inbound-rtp"===e.type&&e.id.indexOf("rtcp")<0?t=!0:"ssrc"!=e.type||!e.bytesReceived||"VP8"!==e.googCodecName&&""!==e.googCodecName||(t=!0),t)if(i.bitrate.bsnow=e.bytesReceived,i.bitrate.tsnow=e.timestamp,null===i.bitrate.bsbefore||null===i.bitrate.tsbefore)i.bitrate.bsbefore=i.bitrate.bsnow,i.bitrate.tsbefore=i.bitrate.tsnow;else{var n=i.bitrate.tsnow-i.bitrate.tsbefore;"safari"==re.webRTCAdapter.browserDetails.browser&&(n/=1e3);var a=Math.round(8*(i.bitrate.bsnow-i.bitrate.bsbefore)/n);"safari"===re.webRTCAdapter.browserDetails.browser&&(a=parseInt(a/1e3)),i.bitrate.value=a+" kbits/sec",i.bitrate.bsbefore=i.bitrate.bsnow,i.bitrate.tsbefore=i.bitrate.tsnow}}}))}))}),1e3),"0 kbits/sec"):i.bitrate.value:(re.warn("Getting the video bitrate unsupported by browser"),"Feature unsupported by browser")}function V(e){re.error("WebRTC error:",e)}function Z(e,n){re.log("Cleaning WebRTC stuff");var a=b[e];if(null!=a){var r=a.webrtcStuff;if(null!=r){if(!0===n){var o={rtcgw:"hangup",transaction:re.randomString(12)};null!==a.token&&void 0!==a.token&&(o.token=a.token),null!=m&&(o.apisecret=m),re.debug("Sending hangup request (handle="+e+"):"),re.debug(o),t?(o.session_id=S,o.handle_id=e,i.send(JSON.stringify(o))):re.httpAPICall(l+"/"+S+"/"+e,{verb:"POST",withCredentials:f,body:o})}r.remoteStream=null,r.volume&&(r.volume.local&&r.volume.local.timer&&clearInterval(r.volume.local.timer),r.volume.remote&&r.volume.remote.timer&&clearInterval(r.volume.remote.timer)),r.volume={},r.bitrate.timer&&clearInterval(r.bitrate.timer),r.bitrate.timer=null,r.bitrate.bsnow=null,r.bitrate.bsbefore=null,r.bitrate.tsnow=null,r.bitrate.tsbefore=null,r.bitrate.value=null;try{if(!r.streamExternal&&null!==r.myStream&&void 0!==r.myStream){re.log("Stopping local stream tracks");var s=r.myStream.getTracks();for(var c in s){var d=s[c];re.log(d),null!=d&&d.stop()}}}catch(e){}r.streamExternal=!1,r.myStream=null;try{r.pc.close()}catch(e){}r.pc=null,r.candidates=null,r.mySdp=null,r.remoteSdp=null,r.iceDone=!1,r.dataChannel={},r.dtmfSender=null}a.oncleanup()}}function W(e){return re.debug("isAudioSendEnabled:",e),null==e||!1!==e.audio&&(void 0===e.audioSend||null===e.audioSend||!0===e.audioSend)}function G(e){return re.debug("isAudioRecvEnabled:",e),null==e||!1!==e.audio&&(void 0===e.audioRecv||null===e.audioRecv||!0===e.audioRecv)}function Y(e){return re.debug("isVideoSendEnabled:",e),null==e||!1!==e.video&&(void 0===e.videoSend||null===e.videoSend||!0===e.videoSend)}function X(e){return re.debug("isVideoRecvEnabled:",e),null==e||!1!==e.video&&(void 0===e.videoRecv||null===e.videoRecv||!0===e.videoRecv)}I(e),this.getServer=function(){return l},this.isConnected=function(){return y},this.reconnect=function(e){(e=e||{}).success="function"==typeof e.success?e.success:re.noop,e.error="function"==typeof e.error?e.error:re.noop,e.reconnect=!0,I(e)},this.getSessionId=function(){return S},this.destroy=function(a){!function(a){a=a||{},a.success="function"==typeof a.success?a.success:re.noop;var o=!0;void 0!==a.asyncRequest&&null!==a.asyncRequest&&(o=!0===a.asyncRequest);var s=!0;void 0!==a.notifyDestroyed&&null!==a.notifyDestroyed&&(s=!0===a.notifyDestroyed);var c=!1;void 0!==a.cleanupHandles&&null!==a.cleanupHandles&&(c=!0===a.cleanupHandles);if(re.log("Destroying session "+S+" (async="+o+")"),!y)return re.warn("Is the server down? (connected=false)"),void a.success();if(null==S)return re.warn("No session to destroy"),a.success(),void(s&&e.destroyed());if(c)for(var d in b)L(d,{noRequest:!0});var u={rtcgw:"destroy",transaction:re.randomString(12)};null!=p&&(u.token=p);null!=m&&(u.apisecret=m);if(t){u.session_id=S;var h=function(){for(var e in n)i.removeEventListener(e,n[e]);i.removeEventListener("message",x),i.removeEventListener("error",_),r&&clearTimeout(r),i.close()},x=function(t){var i=JSON.parse(t.data);i.session_id==u.session_id&&i.transaction==u.transaction&&(h(),a.success(),s&&e.destroyed())},_=function(t){h(),a.error("Failed to destroy the server: Is the server down?"),s&&e.destroyed()};return i.addEventListener("message",x),i.addEventListener("error",_),void i.send(JSON.stringify(u))}re.httpAPICall(l+"/"+S,{verb:"POST",async:o,withCredentials:f,body:u,success:function(t){re.log("Destroyed session:"),re.debug(t),S=null,y=!1,"success"!==t.rtcgw&&re.error("Ooops: "+t.error.code+" "+t.error.reason),a.success(),s&&e.destroyed()},error:function(t,i){re.error(t+":",i),S=null,y=!1,a.success(),s&&e.destroyed()}})}(a)},this.attach=function(e){!function(e){if(e=e||{},e.success="function"==typeof e.success?e.success:re.noop,e.error="function"==typeof e.error?e.error:re.noop,e.consentDialog="function"==typeof e.consentDialog?e.consentDialog:re.noop,e.iceState="function"==typeof e.iceState?e.iceState:re.noop,e.mediaState="function"==typeof e.mediaState?e.mediaState:re.noop,e.webrtcState="function"==typeof e.webrtcState?e.webrtcState:re.noop,e.slowLink="function"==typeof e.slowLink?e.slowLink:re.noop,e.onmessage="function"==typeof e.onmessage?e.onmessage:re.noop,e.onlocalstream="function"==typeof e.onlocalstream?e.onlocalstream:re.noop,e.onremotestream="function"==typeof e.onremotestream?e.onremotestream:re.noop,e.ondata="function"==typeof e.ondata?e.ondata:re.noop,e.ondataopen="function"==typeof e.ondataopen?e.ondataopen:re.noop,e.oncleanup="function"==typeof e.oncleanup?e.oncleanup:re.noop,e.ondetached="function"==typeof e.ondetached?e.ondetached:re.noop,!y)return re.warn("Is the server down? (connected=false)"),void e.error("Is the server down? (connected=false)");var n=e.plugin;if(null==n)return re.error("Invalid plugin"),void e.error("Invalid plugin");var a=e.opaqueId,r=e.token?e.token:p,o=re.randomString(12),s={rtcgw:"attach",plugin:n,opaque_id:a,transaction:o};null!=r&&(s.token=r);null!=m&&(s.apisecret=m);if(t)return C[o]=function(t){if(re.debug(t),"success"!==t.rtcgw)return re.error("Ooops: "+t.error.code+" "+t.error.reason),void e.error("Ooops: "+t.error.code+" "+t.error.reason);var i=t.data.id;re.log("Created handle: "+i);var a={session:P,plugin:n,id:i,token:r,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,remoteStream:null,mySdp:null,mediaConstraints:null,pc:null,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,volume:{value:null,timer:null},bitrate:{value:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,timer:null}},getId:function(){return i},getPlugin:function(){return n},getVolume:function(){return N(i,!0)},getRemoteVolume:function(){return N(i,!0)},getLocalVolume:function(){return N(i,!1)},isAudioMuted:function(){return U(i,!1)},muteAudio:function(){return z(i,!1,!0)},unmuteAudio:function(){return z(i,!1,!1)},isVideoMuted:function(){return U(i,!0)},muteVideo:function(){return z(i,!0,!0)},unmuteVideo:function(){return z(i,!0,!1)},getBitrate:function(){return H(i)},send:function(e){D(i,e)},data:function(e){A(i,e)},dtmf:function(e){M(i,e)},consentDialog:e.consentDialog,iceState:e.iceState,mediaState:e.mediaState,webrtcState:e.webrtcState,slowLink:e.slowLink,onmessage:e.onmessage,createOffer:function(e){O(i,!0,e)},createAnswer:function(e){O(i,!1,e)},handleRemoteJsep:function(e){j(i,e)},onlocalstream:e.onlocalstream,onremotestream:e.onremotestream,ondata:e.ondata,ondataopen:e.ondataopen,oncleanup:e.oncleanup,ondetached:e.ondetached,hangup:function(e){Z(i,!0===e)},detach:function(e){L(i,e)}};b[i]=a,e.success(a)},s.session_id=S,void i.send(JSON.stringify(s));re.httpAPICall(l+"/"+S,{verb:"POST",withCredentials:f,body:s,success:function(t){if(re.debug(t),"success"!==t.rtcgw)return re.error("Ooops: "+t.error.code+" "+t.error.reason),void e.error("Ooops: "+t.error.code+" "+t.error.reason);var i=t.data.id;re.log("Created handle: "+i);var a={session:P,plugin:n,id:i,token:r,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,remoteStream:null,mySdp:null,mediaConstraints:null,pc:null,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,volume:{value:null,timer:null},bitrate:{value:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,timer:null}},getId:function(){return i},getPlugin:function(){return n},getVolume:function(){return N(i,!0)},getRemoteVolume:function(){return N(i,!0)},getLocalVolume:function(){return N(i,!1)},isAudioMuted:function(){return U(i,!1)},muteAudio:function(){return z(i,!1,!0)},unmuteAudio:function(){return z(i,!1,!1)},isVideoMuted:function(){return U(i,!0)},muteVideo:function(){return z(i,!0,!0)},unmuteVideo:function(){return z(i,!0,!1)},getBitrate:function(){return H(i)},send:function(e){D(i,e)},data:function(e){A(i,e)},dtmf:function(e){M(i,e)},consentDialog:e.consentDialog,iceState:e.iceState,mediaState:e.mediaState,webrtcState:e.webrtcState,slowLink:e.slowLink,onmessage:e.onmessage,createOffer:function(e){O(i,!0,e)},createAnswer:function(e){O(i,!1,e)},handleRemoteJsep:function(e){j(i,e)},onlocalstream:e.onlocalstream,onremotestream:e.onremotestream,ondata:e.ondata,ondataopen:e.ondataopen,oncleanup:e.oncleanup,ondetached:e.ondetached,hangup:function(e){Z(i,!0===e)},detach:function(e){L(i,e)}};b[i]=a,e.success(a)},error:function(e,t){re.error(e+":",t)}})}(e)}}re.useDefaultDependencies=function(e){var t=e&&e.fetch||fetch,i=e&&e.Promise||Promise,n=e&&e.WebSocket||WebSocket;return{newWebSocket:function(e,t){return new n(e,t)},extension:e&&e.extension||ae,isArray:function(e){return Array.isArray(e)},webRTCAdapter:e&&e.adapter||window.adapter,httpAPICall:function(e,n){var r={method:n.verb,headers:{Accept:"application/json, text/plain, */*"},cache:"no-cache"};"POST"===n.verb&&(r.headers["Content-Type"]="application/json"),void 0!==n.withCredentials&&(r.credentials=!0===n.withCredentials?"include":n.withCredentials?n.withCredentials:"omit"),void 0!==n.body&&(r.body=JSON.stringify(n.body));var o=t(e,r).catch((function(e){return i.reject({message:"Probably a network error, is the server down?",error:e})}));if(void 0!==n.timeout){var s=new i((function(e,t){var i=setTimeout((function(){return clearTimeout(i),t({message:"Request timed out",timeout:n.timeout})}),n.timeout)}));o=i.race([o,s])}return o.then((function(e){return e.ok?a(n.success)===a(re.noop)?e.json().then((function(e){n.success(e)})).catch((function(t){return i.reject({message:"Failed to parse response body",error:t,response:e})})):void 0:i.reject({message:"API call failed",response:e})})).catch((function(e){a(n.error)===a(re.noop)&&n.error(e.message||"<< internal error >>",e)})),o}}},re.useOldDependencies=function(e){var t=e&&e.jQuery||jQuery,i=e&&e.WebSocket||WebSocket;return{newWebSocket:function(e,t){return new i(e,t)},isArray:function(e){return t.isArray(e)},extension:e&&e.extension||ae,webRTCAdapter:e&&e.adapter||adapter,httpAPICall:function(e,i){var n=void 0!==i.body?{contentType:"application/json",data:JSON.stringify(i.body)}:{},r=void 0!==i.withCredentials?{xhrFields:{withCredentials:i.withCredentials}}:{};return t.ajax(t.extend(n,r,{url:e,type:i.verb,cache:!1,dataType:"json",async:i.async,timeout:i.timeout,success:function(e){a(i.success)===a(re.noop)&&i.success(e)},error:function(e,t,n){a(i.error)===a(re.noop)&&i.error(t,n)}}))}}},re.noop=function(){},re.dataChanDefaultLabel="JanusDataChannel",re.endOfCandidates=null,re.init=function(e){if((e=e||{}).callback="function"==typeof e.callback?e.callback:re.noop,!0===re.initDone)e.callback();else{if("undefined"!=typeof console&&void 0!==console.log||(console={log:function(){}}),re.trace=re.noop,re.debug=re.noop,re.vdebug=re.noop,re.log=re.noop,re.warn=re.noop,re.error=re.noop,!0===e.debug||"all"===e.debug)re.trace=console.trace.bind(console),re.debug=console.debug.bind(console),re.vdebug=console.debug.bind(console),re.log=console.log.bind(console),re.warn=console.warn.bind(console),re.error=console.error.bind(console);else if(Array.isArray(e.debug))for(var t in e.debug){var i=e.debug[t];switch(i){case"trace":re.trace=console.trace.bind(console);break;case"debug":re.debug=console.debug.bind(console);break;case"vdebug":re.vdebug=console.debug.bind(console);break;case"log":re.log=console.log.bind(console);break;case"warn":re.warn=console.warn.bind(console);break;case"error":re.error=console.error.bind(console);break;default:console.error("Unknown debugging option '"+i+"' (supported: 'trace', 'debug', 'vdebug', 'log', warn', 'error')")}}re.log("Initializing library");var n=e.dependencies||re.useDefaultDependencies();re.isArray=n.isArray,re.webRTCAdapter=n.webRTCAdapter,re.httpAPICall=n.httpAPICall,re.newWebSocket=n.newWebSocket,re.extension=n.extension,re.extension.init(),re.listDevices=function(e,t){e="function"==typeof e?e:re.noop,null==t&&(t={audio:!0,video:!0}),re.isGetUserMediaAvailable()?navigator.mediaDevices.getUserMedia(t).then((function(t){navigator.mediaDevices.enumerateDevices().then((function(i){re.debug(i),e(i);try{var n=t.getTracks();for(var a in n){var r=n[a];null!=r&&r.stop()}}catch(e){}}))})).catch((function(t){re.error(t),e([])})):(re.warn("navigator.mediaDevices unavailable"),e([]))},re.attachMediaStream=function(e,t){"chrome"===re.webRTCAdapter.browserDetails.browser?re.webRTCAdapter.browserDetails.version>=52?e.srcObject=t:re.error("Error attaching stream to element"):e.srcObject=t},re.reattachMediaStream=function(e,t){"chrome"===re.webRTCAdapter.browserDetails.browser?re.webRTCAdapter.browserDetails.version>=52?e.srcObject=t.srcObject:void 0!==e.src?e.src=t.src:re.error("Error reattaching stream to element"):e.srcObject=t.srcObject};var a=["iPad","iPhone","iPod"].indexOf(navigator.platform)>=0?"pagehide":"beforeunload",r=window["on"+a];if(window.addEventListener(a,(function(e){for(var t in re.log("Closing window"),re.sessions)null!==re.sessions[t]&&void 0!==re.sessions[t]&&re.sessions[t].destroyOnUnload&&(re.log("Destroying session "+t),re.sessions[t].destroy({asyncRequest:!1,notifyDestroyed:!1}));r&&"function"==typeof r&&r()})),re.safariVp8=!1,"safari"===re.webRTCAdapter.browserDetails.browser&&re.webRTCAdapter.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){for(var t in RTCRtpSender.getCapabilities("video").codecs){var o=RTCRtpSender.getCapabilities("video").codecs[t];if(o&&o.mimeType&&"video/vp8"===o.mimeType.toLowerCase()){re.safariVp8=!0;break}}re.safariVp8?re.log("This version of Safari supports VP8"):re.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu")}else{var s=new RTCPeerConnection({},{});s.createOffer({offerToReceiveVideo:!0}).then((function(e){re.safariVp8=-1!==e.sdp.indexOf("VP8"),re.safariVp8?re.log("This version of Safari supports VP8"):re.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu"),s.close(),s=null}))}if(re.unifiedPlan=!1,"firefox"===re.webRTCAdapter.browserDetails.browser&&re.webRTCAdapter.browserDetails.version>=59)re.unifiedPlan=!0;else if("chrome"===re.webRTCAdapter.browserDetails.browser&&re.webRTCAdapter.browserDetails.version<72)re.unifiedPlan=!1;else if("undefined"==typeof RTCRtpTransceiver||"currentDirection"in RTCRtpTransceiver.prototype){var l=new RTCPeerConnection;try{l.addTransceiver("audio"),re.unifiedPlan=!0}catch(e){}l.close()}else re.unifiedPlan=!1;re.initDone=!0,e.callback()}},re.isWebrtcSupported=function(){return void 0!==window.RTCPeerConnection&&null!==window.RTCPeerConnection},re.isGetUserMediaAvailable=function(){return void 0!==navigator.mediaDevices&&null!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia&&null!==navigator.mediaDevices.getUserMedia},re.randomString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="",n=0;n-1&&n.ttsUrl.indexOf("8664")>-1&&(window.EZUIKit.opt.ttsUrl=window.EZUIKit.opt.ttsUrl.replace("8664","8665")),window.EZUIKit.opt.deviceSerial=P(t.jSPlugin.url).deviceSerial,window.EZUIKit.opt.channelNo=t.talkChannelNo||"0";var s="talk?dev="+window.EZUIKit.opt.deviceSerial+"&chann="+window.EZUIKit.opt.channelNo+"&encodetype=2";window.EZUIKit.opt.talkLink=window.EZUIKit.opt.ttsUrl.split("?")[0]+"/"+s,n.ttsUrl.indexOf("gb28181")>-1&&(window.EZUIKit.opt.talkType="gb28181"),e&&e(n.ttsUrl.indexOf("gb28181")>-1||-1!==window.EZUIKit.opt.deviceSerial.indexOf(":")),window.EZUIKit.opt.stream=n.stream,window.startTalk(),t.jSPlugin.eventEmitter&&t.jSPlugin.eventEmitter.emit("startTalk",{eventType:"startTalk",code:0,target:t,msg:"开启对讲"})}}else console.log(i.code,t.jSPlugin.i18n.t("server.talk."+i.code)),t.pluginStatus.loadingSetText({text:t.jSPlugin.i18n.t("server.talk."+i.code)||i.msg,color:"red",delayClear:2e3}),t.jSPlugin.eventEmitter&&t.jSPlugin.eventEmitter.emit("startTalk",{eventType:"startTalk",code:-1,target:t,msg:t.jSPlugin.i18n.t("server.talk."+i.code)||i.msg}),"function"==typeof t.jSPlugin.params.handleError&&t.jSPlugin.params.handleError({msg:i.msg,retcode:i.code,id:t.jSPlugin.params.id,type:"handleError"})})).catch((function(e){console.log("err",e)}))})).catch((function(e){console.log("对讲开启失败:",e)}))}},{key:"stopTalk",value:function(){window.stopTalk(),this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("stopTalk",{eventType:"stopTalk",code:0,target:this,msg:"结束对讲"}),document.getElementById("myaudio")&&document.getElementById("myaudio").srcObject&&document.getElementById("myaudio").srcObject.getTracks()[0].stop()}},{key:"changeTalkChannelNo",value:function(e){window.EZUIKit.opt&&window.EZUIKit.opt.channelNo&&(this.talkChannelNo=e,window.EZUIKit.opt.channelNo=e)}}]),e}(),he=function(){function e(t){var i=this;r(this,e),this.jSPlugin=t,this.pluginStatus=new F(this,this.jSPlugin.id);var n=document.createElement("style");n.innerHTML="\n body{\n padding: 0;\n margin: 0;\n }\n #mobile-ez-ptz-container {\n display: inline-block;\n width: 375px;\n text-align: center;\n }\n .live-ptz-title{\n height: 25px;\n font-size: 18px;\n color: #2c2c2c;\n text-align: center;\n font-weight: 700;\n margin: 24px 0 12px;\n }\n .live-ptz-intro {\n margin-bottom: 24px;\n color: #aaaaaa;\n }\n .mobile-ez-ptz-wrap {\n background-image: linear-gradient(180deg, #f6f8ff 0%, #ededed6b 50%)\n }\n #mobile-ez-ptz-container .mobile-ez-ptz-container {\n position: relative;\n width: 260px;\n height: 260px;\n background: rgba(255, 255, 255, 0.80);\n border: 1px solid rgba(255, 255, 255, 0.80);\n border-radius: 100%;\n cursor: pointer;\n overflow: hidden;\n margin: auto;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.top {\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n left: calc(50% - 6px);\n top: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.top.active {\n border-bottom-color: #1890FF;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.bottom {\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-top: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n left: calc(50% - 6px);\n bottom: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.bottom.active {\n border-top-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.right {\n width: 0;\n height: 0;\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n border-left: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n top: calc(50% - 6px);\n right: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.right.active {\n border-left-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.left {\n width: 0;\n height: 0;\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n border-right: 6px solid #aaaaaa;\n position: absolute;\n display: inline-block;\n top: calc(50% - 6px);\n left: 10px;\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .mobile-ez-ptz-icon.left.active {\n border-right-color: #1890FF;\n\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-container .ez-ptz-main.center {\n width: 52px;\n height: 52px;\n background: #FFFFFF;\n border: 2px solid #eee;\n border-radius: 100%;\n top: calc(50% - 26px);\n left: calc(50% - 26px);\n position: absolute;\n /* box-shadow: 0px -39px 40px 6px #1890ff; */\n }\n\n #mobile-ez-ptz-container .mobile-ez-ptz-wrap {\n display: inline-block;\n padding: 24px 24px;\n border-radius: 100%;\n overflow: hidden;\n }\n\n #mobile-ez-ptz-container .ez-ptz-close {\n position: absolute;\n color: #FFFFFF;\n top: 0;\n right: 0px;\n }",document.getElementsByTagName("head")[0].appendChild(n);var a=document.createElement("div");a.className="mobile-ez-ptz-container",a.id="mobile-ez-ptz-container",a.style="display:inline-block;width: ".concat(this.jSPlugin.width,"px;text-align:center;");var o=document.createElement("div");o.className="live-ptz-title",o.id="live-ptz-title",o.innerHTML="云台控制",document.getElementById("live-ptz-title")||a.appendChild(o);var s=document.createElement("div");s.className="live-ptz-intro",s.id="live-ptz-intro",s.innerHTML="请通过操控云台来调整摄像机视角",document.getElementById("live-ptz-intro")||a.appendChild(s);var l=document.createElement("div");l.id="mobile-ez-ptz-item",l.className="mobile-ez-ptz-wrap",l.innerHTML='\n
\n
\n
\n
\n
\n
\n
\n ',document.getElementById("mobile-ez-ptz-item")||a.appendChild(l),g(a,document.getElementById("".concat(this.jSPlugin.id,"-wrap"))),document.getElementById("mobile-ez-ptz-item").ontouchstart=function(e){e.preventDefault(),console.log("触摸开始"),i._handlePtzTouch(e,"start")},document.getElementById("mobile-ez-ptz-item").ontouchend=function(e){e.preventDefault(),console.log("触摸结束",e),i._handlePtzTouch(e,"stop")},document.getElementById("mobile-ez-ptz-item").onmousedown=function(e){e.preventDefault(),console.log("触摸开始"),i._handlePtzTouch(e,"start")},document.getElementById("mobile-ez-ptz-item").onmouseup=function(e){e.preventDefault(),console.log("触摸结束",e),i._handlePtzTouch(e,"stop")}}return s(e,[{key:"show",value:function(){document.getElementById("mobile-ez-ptz-item").style="display: inline-block"}},{key:"hide",value:function(){document.getElementById("mobile-ez-ptz-item").style="display: none"}},{key:"_handlePtzTouch",value:function(e,t){var i=this,n=document.getElementById("mobile-ez-ptz-item").getBoundingClientRect(),a=n.left+130,r=n.top+130,o=(e.x||e.changedTouches[0].clientX)-a,s=(e.y||e.changedTouches[0].clientY)-r,l=0,c=this.jSPlugin.env.domain+"/api/lapp/device/ptz/start";Math.abs(o)>Math.abs(s)?o>0?(l=3,document.getElementsByClassName("mobile-ez-ptz-icon")[3].className=document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("default","active")):(l=2,document.getElementsByClassName("mobile-ez-ptz-icon")[1].className=document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("default","active")):s>0?(l=1,document.getElementsByClassName("mobile-ez-ptz-icon")[2].className=document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("default","active")):(l=0,document.getElementsByClassName("mobile-ez-ptz-icon")[0].className=document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("default","active")),document.getElementById("mobile-ez-ptz-item").style="background-image:linear-gradient(".concat(0===l?180:1===l?0:2===l?90:270,"deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)"),"stop"===t&&(c=this.jSPlugin.env.domain+"/api/lapp/device/ptz/stop",document.getElementById("mobile-ez-ptz-item").style="",document.getElementsByClassName("mobile-ez-ptz-icon")[3].className=document.getElementsByClassName("mobile-ez-ptz-icon")[3].className.replace("active","default"),document.getElementsByClassName("mobile-ez-ptz-icon")[1].className=document.getElementsByClassName("mobile-ez-ptz-icon")[1].className.replace("active","default"),document.getElementsByClassName("mobile-ez-ptz-icon")[2].className=document.getElementsByClassName("mobile-ez-ptz-icon")[2].className.replace("active","default"),document.getElementsByClassName("mobile-ez-ptz-icon")[0].className=document.getElementsByClassName("mobile-ez-ptz-icon")[0].className.replace("active","default"));var d=new FormData;d.append("deviceSerial",P(this.jSPlugin.url).deviceSerial),d.append("channelNo",P(this.jSPlugin.url).channelNo),d.append("speed",1),d.append("direction",l),d.append("accessToken",this.jSPlugin.accessToken),fetch(c,{method:"POST",body:d}).then((function(e){return e.json()})).then((function(e){if(200==e.code);else{console.log(e.code,i.jSPlugin.i18n.t("server.ptz."+t+"."+e.code));var n=i.jSPlugin.i18n.t("server.ptz."+t+"."+e.code)||e.msg;i.pluginStatus.loadingSetText({text:n,color:"red",delayClear:2e3}),60005!=e.code&&60002!=e.code&&60003!=e.code&&60004!=e.code||(document.getElementById("mobile-ez-ptz-item").style="background-image:linear-gradient(".concat(0===l?180:1===l?0:2===l?90:270,"deg, #f45656 0%, rgba(100,143,252,0.00) 50%)"))}})).catch((function(e){console.log("云台调用异常",e)}))}}]),e}(),fe={header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",iconId:"deviceID",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",iconId:"deviceName",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",iconId:"cloudRec",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",iconId:"rec",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"}]},footer:{color:"#FFFFFF",backgroundColor:"rgb(0 0 0 / 0%)",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-0",iconId:"play",part:"left",defaultActive:1,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-1",iconId:"capturePicture",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-2",iconId:"sound",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-3",iconId:"pantile",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-4",iconId:"recordvideo",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-5",iconId:"talk",part:"left",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-6",iconId:"hd",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-7",iconId:"webExpend",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-footer-8",iconId:"expend",part:"right",defaultActive:0,isrender:0,themeId:"f7896c8942c9476fb439370dd974f1c0"}]}},xe={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:1},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:1},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},pe={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:1},{iconId:"rec",part:"right",defaultActive:0,isrender:1}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"speed",part:"right",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},me={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:1},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"speed",part:"right",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:1},{iconId:"webExpend",part:"right",defaultActive:0,isrender:1},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},_e={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-0",iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-1",iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-2",iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-f7896c8942c9476fb439370dd974f1c0-header-3",iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:1},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},ge={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:0},{iconId:"deviceName",part:"left",defaultActive:0,isrender:0},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:0},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:0},{iconId:"sound",part:"left",defaultActive:1,isrender:0},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:0},{iconId:"talk",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:0}]}}},ve={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:0},{iconId:"talk",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},ye={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:1},{iconId:"deviceName",part:"left",defaultActive:0,isrender:1},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:1},{iconId:"cloudRecord",part:"right",defaultActive:0,isrender:1},{iconId:"rec",part:"right",defaultActive:0,isrender:1}]},footer:{color:"#FFFFFF",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:1},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:1},{iconId:"sound",part:"left",defaultActive:1,isrender:1},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:1},{iconId:"zoom",part:"left",defaultActive:0,isrender:1},{iconId:"speed",part:"right",defaultActive:0,isrender:1},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:1},{iconId:"expend",part:"right",defaultActive:0,isrender:1}]}}},Se={data:{header:{color:"#FFFFFF",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{iconId:"deviceID",part:"left",defaultActive:0,isrender:0},{iconId:"deviceName",part:"left",defaultActive:0,isrender:0},{iconId:"cloudRec",part:"right",defaultActive:0,isrender:0},{iconId:"rec",part:"right",defaultActive:0,isrender:0}]},footer:{color:"#FFFFFF",backgroundColor:"#00000080",activeColor:"#1890FF",btnList:[{iconId:"play",part:"left",defaultActive:1,isrender:0},{iconId:"capturePicture",part:"left",defaultActive:0,isrender:0},{iconId:"sound",part:"left",defaultActive:1,isrender:0},{iconId:"pantile",part:"left",defaultActive:0,isrender:0},{iconId:"recordvideo",part:"left",defaultActive:0,isrender:0},{iconId:"talk",part:"left",defaultActive:0,isrender:0},{iconId:"zoom",part:"left",defaultActive:0,isrender:0},{iconId:"speed",part:"right",defaultActive:0,isrender:0},{iconId:"hd",part:"right",defaultActive:0,isrender:0},{iconId:"webExpend",part:"right",defaultActive:0,isrender:0},{iconId:"expend",part:"right",defaultActive:0,isrender:0}]}}},be=[{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"pcLive",themeIntro:"PC直播全量版",themeName:"PC直播全量版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:me.data.header,footer:me.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"security",themeIntro:"PC直播安防版",themeName:"PC直播安防版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:_e.data.header,footer:_e.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"voice",themeIntro:"PC直播语音版",themeName:"PC直播语音版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:ve.data.header,footer:ve.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"simple",themeIntro:"PC直播极简版",themeName:"PC直播极简版",themeType:"webLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"",header:ge.data.header,footer:ge.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"pcRec",themeIntro:"PC回放全量版",themeName:"PC回放全量版",themeType:"webRec",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_DmANlElAAA-xyivSaw030.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:ye.data.header,footer:ye.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"mobileLive",themeIntro:"Mobile直播全量版",themeName:"Mobile直播全量版",themeType:"mobileLive",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:xe.data.header,footer:xe.data.footer},{autoFocus:5,createTime:"2021-06-14T08:04:37.000Z",themeId:"mobileRec",themeIntro:"Mobile回放全量版",themeName:"Mobile回放全量版",themeType:"mobileRec",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",poster:"https://resource.eziot.com/group1/M00/00/89/CtwQEmLl8r-AZU7wAAETKlvgerU237.png",header:pe.data.header,footer:pe.data.footer},{autoFocus:0,createTime:"2021-06-14T08:04:37.000Z",themeId:"miniRec",themeIntro:"Mobile回放全量版",themeName:"Mobile回放全量版",themeType:"mobileRec",updateTime:"2021-06-14T08:04:37.000Z",label:"官方",labelPic:"https://resource.eziot.com/group1/M00/00/8A/CtwQEmLr_GmAL5IhAABZs1vUK0s564.png",poster:"",header:Se.data.header,footer:Se.data.footer}],Pe=function(){function e(t){var i=this;r(this,e),this.jSPlugin=t,this.enableZoom=!1,this.videoWidth=1920,this.videoHeight=1080,this.currentScale=1,this.currentPosition={x:0,y:0,xPercent:.1,yPercent:.1,xCurrentVideo:0,yCurrentVideo:0,left:0,top:0,right:1920,bottom:1080},this.clientRect=document.getElementById(t.id).getBoundingClientRect(),this.DOM=document.getElementById(t.id);var n=document.createElement("div");n.id="".concat(t.id,"-zoom-container");var a=document.getElementById("".concat(t.id,"-audioControls")),o=48;a&&(o=a.offsetHeight);var s=t.isMobile?"\n -webkit-transform: scale(0.8);\n -moz-transform: scale(0.8);\n -ms-transform: scale(0.8);\n transform: scale(0.8);\n transform-origin: left bottom;":"";n.style="position: absolute;\n display:none;\n left: 12px;\n bottom: ".concat(t.isMobile?"".concat(o+6,"px"):"80px",";\n ").concat(s,"\n ");var l='\n \n
2.0X
\n
\n \n \n 放大\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n \n \n 缩小\n \n \n \n \n \n \n \n \n \n \n
\n \n ');if(n.innerHTML=l,document.getElementById("".concat(t.id,"-audioControls-left"))&&(document.getElementById("".concat(t.id,"-audioControls-left")).parentNode.appendChild(n),document.getElementById("".concat(t.id,"-addScale")).onclick=function(){i.addScale()},document.getElementById("".concat(t.id,"-subScale")).onclick=function(){i.subScale()}),t.jSPlugin)try{var c=t.jSPlugin._JSPlayM4_GetFrameInfo(0);this.videoWidth=c.width||t.width,this.videoHeight=c.height||t.height,this.currentPosition.right=c.width,this.currentPosition.bottom=c.height,t.jSPlugin.bEZoom=!0}catch(e){}this._event()}return s(e,[{key:"_event",value:function(){var e=this,t=setInterval((function(){var i=document.getElementById("".concat(e.jSPlugin.id,"-container-0"));clearInterval(t),e.jSPlugin.isMobile?i&&(i.addEventListener("touchstart",(function(t){return e.onTouchstart(t)})),i.addEventListener("touchend",(function(t){return e.onTouchend(t)}))):i&&(i.addEventListener("mousedown",(function(t){return e.onMouseDown(t)})),i.addEventListener("mouseup",(function(t){return e.onMouseUp(t)})))}),100)}},{key:"onMouseDown",value:function(e){if(1===this.currentScale)return!1;this.moveX=e.clientX,this.moveY=e.clientY}},{key:"onMouseUp",value:function(e){var t=this.currentPosition;if(1===this.currentScale)return!1;t.left=t.left-(e.clientX-this.moveX),t.top=t.top-(e.clientY-this.moveY),this.doScale()}},{key:"onTouchstart",value:function(e){if(1===this.currentScale)return!1;if(this.jSPlugin.use3DZoom||1===this.currentScale)return!1;if(!this.jSPlugin.beforeMobileZoomVerify())return!1;if(!this.inited){var t=this.jSPlugin.jSPlugin._JSPlayM4_GetFrameInfo(0);this.videoWidth=t.width,this.videoHeight=t.height,this.currentPosition.left=0,this.currentPosition.top=0,this.isMobileFullScreen?(this.currentPosition.right=t.height,this.currentPosition.bottom=t.width):(this.currentPosition.right=t.width,this.currentPosition.bottom=t.height),this.inited=!0}var i=e.touches[0];if(i){var n={clientX:0,clientY:0};n.clientX=i.clientX,n.clientY=i.clientY,this.point1=n}}},{key:"onTouchend",value:function(e){var t=this,i=this.currentPosition;if(1===this.currentScale)return!1;var n=e.changedTouches[0];this.isMobileFullScreen?(i.left=i.left-(n.clientY-t.point1.clientY),i.top=i.top+(n.clientX-t.point1.clientX)):(i.left=i.left-(n.clientX-t.point1.clientX),i.top=i.top-(n.clientY-t.point1.clientY)),t.doScale()}},{key:"renderDot",value:function(){var e=this.currentScale;document.getElementById("".concat(this.jSPlugin.id,"-scale-value"))&&(document.getElementById("".concat(this.jSPlugin.id,"-scale-value")).innerHTML="".concat(e,".0X")),document.getElementById("".concat(this.jSPlugin.id,"-line-dot"))&&(document.getElementById("".concat(this.jSPlugin.id,"-line-dot")).style.height="".concat((e-1)/7*100,"%")),document.getElementById("".concat(this.jSPlugin.id,"-scale-body-line-dot"))&&(document.getElementById("".concat(this.jSPlugin.id,"-scale-body-line-dot")).style.bottom="calc(".concat((e-1)/7*100,"% - 3px)"))}},{key:"getTopMostElement",value:function(e,t,i){var n=e?e.getBoundingClientRect():null,a=t?t.getBoundingClientRect():null,r=i?i.getBoundingClientRect():null;if(!n&&!a&&!r)return null;if(!n)return a.topthis.videoWidth-this.videoWidth/t&&(e.left=this.videoWidth-this.videoWidth/t),e.right=e.left+this.videoWidth/t,e.top=e.top+e.yPercent*(e.bottom-e.top)-this.videoHeight/t*.5,e.top<=0?e.top=0:e.top>this.videoHeight-this.videoHeight/t&&(e.top=this.videoHeight-this.videoHeight/t),e.bottom=e.top+this.videoHeight/t,e.left=parseInt(e.left,10),e.right=parseInt(e.right,10),e.top=parseInt(e.top,10),e.bottom=parseInt(e.bottom,10);try{e.left0&&void 0!==arguments[0]?arguments[0]:1;this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("zoomAdd",{eventType:"zoomAdd",code:1,target:this,msg:"执行放大"});var t=this.currentScale,i=this.currentPosition;return t>=8?(console.log("达到最大倍率了"),this.jSPlugin.Message&&this.jSPlugin.Message.default("已经放大到最大倍数8.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):(this.currentScale=this.currentScale+e,this.currentScale>8?(console.log("超出最大倍率"),this.jSPlugin.Message&&this.jSPlugin.Message.default("超出最大倍率8.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):(i.xPercent=.5,i.yPercent=.5,void this.doScale()))}},{key:"subScale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.jSPlugin.eventEmitter&&this.jSPlugin.eventEmitter.emit("zoomSub",{eventType:"zoomSub",code:1,target:this,msg:"执行缩小"});var t=this.currentScale,i=this.currentPosition;return t<=1?(console.log("达到最小倍率了"),this.jSPlugin.Message&&this.jSPlugin.Message.default("已经缩小到最小倍数1.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):t<=1?(console.log("达到最小倍率了"),!1):(this.currentScale=this.currentScale-e,this.currentScale<1?(console.log("超出最小倍率"),this.jSPlugin.Message&&this.jSPlugin.Message.default("超出最小倍率1.0X",document.getElementById("".concat(this.jSPlugin.id))),!1):(i.xPercent=.5,i.yPercent=.5,void this.doScale()))}},{key:"_JSPlayM4_SetDisplayRegion",value:function(e,t,i,n,a){this.jSPlugin&&this.jSPlugin.jSPlugin&&this.jSPlugin.jSPlugin._JSPlayM4_SetDisplayRegion(e,t,i,n,a,this.isMobileFullScreen)}},{key:"isMobileFullScreen",get:function(){return!!(T()&&this.jSPlugin.Theme&&this.jSPlugin.Theme.decoderState&&this.jSPlugin.Theme.decoderState.state.expend)}}]),e}(),Ee=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},s="";o=Object.assign(o,r);var l=new Headers;Object.keys(o).map((function(e){l.append(e,o[e])})),o=l,Object.keys(Object.assign({},i)).forEach((function(e){var t=i[e];"string"==typeof i[e]&&(t=i[e].replace("%","%25")),void 0!==i[e]&&(s+="&".concat(e,"=").concat(encodeURIComponent(t)))})),s.length>0&&(s=-1!==["GET","PUT","DELETE"].indexOf(t.toUpperCase())?"?".concat(s.slice(1)):s.slice(1));var c=e+(-1!==["GET","PUT","DELETE"].indexOf(t.toUpperCase())?s:""),d={headers:o,method:t};"POST"===t&&(d.body=s),"POST"===t&&r&&"application/json"===r["Content-Type"]&&(d.body=JSON.stringify(i)),"GET"===t&&(-1===c.indexOf("?")?c+="?_r=".concat(Math.random()):c+="&_r=".concat(Math.random())),fetch(c,d).then((function(e){var t=e.headers.get("content-type");return t&&-1!==t.indexOf("application/json")?e.json():e.text()})).then((function(e){n&&n(e)})).catch((function(e){a&&a(e)}))},Ce=function(e,t,i,n,a,r){return'\n\n \n \n \n \n \n\n')},Te=function(e,t,i,n,a,r){return'\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n')},Re=[{name:"高清",level:"0",streamType:1,icon:Ce},{name:"标清",level:"1",streamType:1,icon:Te}],we=[{name:"高清",level:"hd",streamType:1,icon:Ce},{name:"标清",level:"sd",streamType:2,icon:Te}],Ie=function(e,t,i,n){var a="".concat(e.env.domain,"/api/service/media/template/getDetail?accessToken=").concat(e.accessToken,"&id=").concat(t);fetch(a,{method:"GET"}).then((function(e){return e.json()})).then((function(e){var t;console.log("get theme data",e),t=e,console.log(t),t.meta&&i(t)})).catch((function(e){var t;t=e,console.log(t),n(t)}))};function De(e){var t=new W,i=new FormData;for(var n in e)i.append(n,e[n]);return t.fetch("/api/lapp/device/info",{method:"POST",body:i})}var ke=function(e){var t="";return Object.keys(e).map((function(i,n){t+="".concat(i,":").concat(e[i]).concat(n0&&(this.autoFocus=parseInt(this.themeData.autoFocus),this.startAutoFocus(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).addEventListener("click",(function(){document.getElementById("".concat(e.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),e.startAutoFocus()}))),this.setDecoderState({cloudRec:"cloud.rec"===P(this.jSPlugin.url).type,rec:"rec"===P(this.jSPlugin.url).type,type:P(this.jSPlugin.url).type});else if(!this.themeInited)var a=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(a),e.jSPlugin.play(),e.themeInited=!0)}),50);k.findIndex(this.themeData.footer.btnList,(function(e){return"zoom"===e.iconId&&e.isrender>0}))>=0&&(this.isMobile&&!this.jSPlugin.use3DZoom&&(this.jSPlugin.beforeMobileZoomVerify=function(){return!!e.decoderState.state.play}),this.jSPlugin.Zoom=new Pe(this.jSPlugin)),setTimeout((function(){document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen||e.jSPlugin.jSPlugin.JS_Resize(e.jSPlugin.width,e.jSPlugin.height-e._extendHeadeTimeLinrHight(!1,!1))}),50)}},{key:"setDecoderState",value:function(e){var t=this,i=this.themeData,n=i.header,a=i.footer;Object.keys(e).map((function(i,r){var o="#FFFFFF",s="#FFFFFF";switch(-1===n.btnList.findIndex((function(e){return e.iconId===i}))?(o=a.color.replace("-diy",""),s=a.activeColor.replace("-diy","")):(o=n.color.replace("-diy",""),s=a.activeColor.replace("-diy","")),i){case"play":e[i]?document.getElementById("".concat(t.jSPlugin.id,"-play"))&&(document.getElementById("".concat(t.jSPlugin.id,"-play-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-play-content")).children[0].children[1].style="display:none",document.getElementById("".concat(t.jSPlugin.id,"-play")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-play-content")).childNodes[0].children[0].style.fill=e[i]?s:o):document.getElementById("".concat(t.jSPlugin.id,"-play"))&&(document.getElementById("".concat(t.jSPlugin.id,"-play-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-play-content")).children[0].children[0].style="display:none",document.getElementById("".concat(t.jSPlugin.id,"-play")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-play-content")).childNodes[0].children[1].style.fill=e[i]?s:o);break;case"sound":document.getElementById("".concat(t.jSPlugin.id,"-sound"))&&(e[i]?(document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:none",document.getElementById("".concat(t.jSPlugin.id,"-sound")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).childNodes[0].children[1].style.fill=e[i]?s:o):(document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:none",document.getElementById("".concat(t.jSPlugin.id,"-sound")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-sound-content")).childNodes[0].children[0].style.fill=e[i]?s:o));break;case"recordvideo":document.getElementById("".concat(t.jSPlugin.id,"-recordvideo"))&&(document.getElementById("".concat(t.jSPlugin.id,"-recordvideo")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-recordvideo-content")).childNodes[0].style.fill=e[i]?s:o,e[i]?t.countTime("add",0):t.countTime("destroy",0));break;case"talk":document.getElementById("".concat(t.jSPlugin.id,"-talk"))&&(document.getElementById("".concat(t.jSPlugin.id,"-talk")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-talk-content")).childNodes[1].style.fill=e[i]?s:o);break;case"zoom":document.getElementById("".concat(t.jSPlugin.id,"-zoom"))&&(document.getElementById("".concat(t.jSPlugin.id,"-zoom")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-zoom-content")).childNodes[1].style.fill=e[i]?s:o);break;case"pantile":document.getElementById("".concat(t.jSPlugin.id,"-pantile"))&&(document.getElementById("".concat(t.jSPlugin.id,"-pantile")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-pantile-content")).childNodes[0].style.fill=e[i]?s:o);break;case"webExpend":e[i]?(document.getElementById("".concat(t.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-webExpend-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-webExpend-content")).children[0].children[0].style="display:none"),document.getElementById("".concat(t.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-expend")).className="disabled")):(document.getElementById("".concat(t.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-webExpend-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-webExpend-content")).children[0].children[1].style="display:none"),document.getElementById("".concat(t.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-expend")).className="")),document.getElementById("".concat(t.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-webExpend")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-webExpend-content")).childNodes[0].childNodes[0].style.fill=e[i]?s:o,document.getElementById("".concat(t.jSPlugin.id,"-webExpend-content")).childNodes[0].childNodes[1].style.fill=e[i]?s:o);break;case"capturePicture":document.getElementById("".concat(t.jSPlugin.id,"-capturePicture"))&&(document.getElementById("".concat(t.jSPlugin.id,"-capturePicture")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-capturePicture-content")).childNodes[0].style.fill=e[i]?s:o);break;case"expend":e[i]?(document.getElementById("".concat(t.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-expend-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-expend-content")).children[0].children[0].style="display:none"),document.getElementById("".concat(t.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-webExpend")).className="disabled")):(document.getElementById("".concat(t.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-expend-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(t.jSPlugin.id,"-expend-content")).children[0].children[1].style="display:none"),document.getElementById("".concat(t.jSPlugin.id,"-webExpend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-webExpend")).className="")),document.getElementById("".concat(t.jSPlugin.id,"-expend"))&&(document.getElementById("".concat(t.jSPlugin.id,"-expend")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-expend-content")).childNodes[0].childNodes[0].style.fill=e[i]?s:o,document.getElementById("".concat(t.jSPlugin.id,"-expend-content")).childNodes[0].childNodes[1].style.fill=e[i]?s:o);break;case"hd":break;case"speed":if(document.getElementById("".concat(t.jSPlugin.id,"-speed"))){var l=document.getElementById("".concat(t.jSPlugin.id,"-speed-content")).children[1].children[0];"not-allowed"!==l.style.cursor&&(l.style.color=e[i]?s:o,l.style.borderColor=e[i]?s:o)}document.getElementById("".concat(t.jSPlugin.id,"-select-mask"))&&(t.isMobile&&e[i]?document.getElementById("".concat(t.jSPlugin.id,"-select-mask")).style.display="block":document.getElementById("".concat(t.jSPlugin.id,"-select-mask")).style.display="none");break;case"cloudRec":document.getElementById("".concat(t.jSPlugin.id,"-cloudRec"))&&(document.getElementById("".concat(t.jSPlugin.id,"-cloudRec")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-cloudRec-content")).children[0].children[0].style.fill=e[i]?s:o),document.getElementById("".concat(t.jSPlugin.id,"-rec"))&&(document.getElementById("".concat(t.jSPlugin.id,"-rec")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-rec-content")).children[0].children[0].style.fill=e[i]?o:s);break;case"cloudRecord":var c=document.getElementById("".concat(t.jSPlugin.id,"-cloudRecord"));c&&(c.className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-cloudRecord-content")).children[0].children[0].style.fill=e[i]?s:o),document.getElementById("".concat(t.jSPlugin.id,"-rec"))&&(document.getElementById("".concat(t.jSPlugin.id,"-rec")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-rec-content")).children[0].children[0].style.fill=e[i]?o:s);break;case"rec":document.getElementById("".concat(t.jSPlugin.id,"-cloudRec"))&&(document.getElementById("".concat(t.jSPlugin.id,"-cloudRec")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-cloudRec-content")).children[0].children[0].style.fill=e[i]?o:s),document.getElementById("".concat(t.jSPlugin.id,"-cloudRecord"))&&(document.getElementById("".concat(t.jSPlugin.id,"-cloudRecord")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-cloudRecord-content")).children[0].children[0].style.fill=e[i]?o:s),document.getElementById("".concat(t.jSPlugin.id,"-rec"))&&(document.getElementById("".concat(t.jSPlugin.id,"-rec")).className=e[i]?"active":"",document.getElementById("".concat(t.jSPlugin.id,"-rec-content")).children[0].children[0].style.fill=e[i]?s:o)}t.decoderState.state=Object.assign(t.decoderState.state,e)}))}},{key:"startAutoFocus",value:function(){var e=this,t=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(e.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*t)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer)}},{key:"hideFooter",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.display="none")}},{key:"showFooter",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.display="block")}},{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}},{key:"renderFooter",value:function(e,t){var i=this,n=this.matchBtn(e),a=document.createElement("div");a.className="theme-icon-item",a.innerHTML="".concat('')+'
')).concat(n.domString,"
")+"
",a.onclick=function(e){if(i.decoderState.state.isEditing)return!1;n.onclick(e)},n.onmouseenter&&(a.onmouseenter=function(e){if(i.decoderState.state.isEditing)return!1;n.onmouseenter(e)}),n.onmouseleave&&(a.onmouseleave=function(e){if(i.decoderState.state.isEditing)return!1;n.onmouseleave(e)});var r=document.createElement("span");r.className="icon-move left",r.innerHTML=''),r.onclick=function(){i.editIcon(n.id,"left","footer")},a.appendChild(r);var o=document.createElement("span");o.className="icon-move right",o.innerHTML=''),o.onclick=function(){i.editIcon(n.id,"right","footer")},a.appendChild(o);var s=document.createElement("span");s.className="icon-move close",s.innerHTML='')+'',s.onclick=function(){i.editIcon(n.id,"delete","footer")},a.appendChild(s),"left"===t?document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).childNodes[0].appendChild(a):document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).childNodes[1].appendChild(a)}},{key:"editIcon",value:function(e,t,i){console.log("编辑组件",e,t,i);var n=this.themeData;console.log("themeData",this.themeData);var a=this.themeData[i].btnList,r=k.findIndex(a,(function(t){return t.iconId===e})),o=a[r];switch(t){case"delete":if("rec"===e){if(-1===k.findIndex(a,(function(e){return"cloudRec"===e.iconId&&1==e.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1}else if("cloudRec"===e&&-1===k.findIndex(a,(function(e){return"rec"===e.iconId&&1==e.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1;a[r].isrender=0;break;case"right":for(var s=-1,l=r+1;l=0;d--)if(a[d].part===a[r].part&&1==a[d].isrender){c=d;break}-1!==c&&(a[r]=a[c],a[c]=o)}n[i].btnList=a,this.changeTheme(n)}},{key:"renderHeader",value:function(e,t){var i=this,n=this.matchBtn(e),a=document.createElement("div");a.className="theme-icon-item",a.style="max-width:50%;",a.innerHTML="".concat('')+'')).concat(n.domString,"")+'',a.onclick=function(e){if(i.decoderState.state.isEditing)return!1;n.onclick(e)};var r=document.createElement("span");r.className="icon-move close",r.innerHTML='')+'',r.onclick=function(){i.editIcon(n.id,"delete","header")},a.appendChild(r),"left"===t?document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[0].appendChild(a):document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[1].appendChild(a)}},{key:"countTime",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var n=document.createElement("div");n.id=this.jSPlugin.id+"time-area",n.className="time-area",n.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(n)}if(this.countTimer&&clearInterval(this.countTimer),"add"===e){var a=t;document.getElementById(i.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++a,document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML=function(e){var t=parseInt(e),i=0,n=0,a="00",r="00",o="00";t>59&&(i=parseInt(t/60),t=parseInt(t%60),i>59&&(n=parseInt(i/60),i=parseInt(i%60)));return a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),o=parseInt(n)>9?parseInt(n):"0"+parseInt(n),n>0?o+":"+r+":"+a:i>0?r+":"+a:"00:"+a}(a)}),1e3)}else"destroy"===e&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(i.jSPlugin.id+"time-area")&&(document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(i.jSPlugin.id+"time-area").style.display="none"))}},{key:"setDisabled",value:function(e){var t=this.decoderState.state.sound,i=e?"cursor: not-allowed; color: gray; fill: gray; ":"cursor: default";null!=document.getElementById("".concat(this.jSPlugin.id,t?"-sound-icon":"-nosound-icon"))&&document.getElementById("".concat(this.jSPlugin.id,t?"-sound-icon":"-nosound-icon")).setAttribute("style",e?"cursor: not-allowed; color: gray; fill: gray;":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-recordvideo-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-recordvideo-icon")).setAttribute("style",i),null!=document.getElementById("".concat(this.jSPlugin.id,"-capturePicture-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-capturePicture-icon")).setAttribute("style",i),null!=document.getElementById("".concat(this.jSPlugin.id,"-talk-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-talk-icon")).setAttribute("style",i),this.allowZoom||null!=document.getElementById("".concat(this.jSPlugin.id,"-zoom-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-zoom-icon")).setAttribute("style",i),document.getElementById("".concat(this.jSPlugin.id,"-pantile-icon"))&&"none"!=document.getElementById("".concat(this.jSPlugin.id,"-pantile-icon")).style.display&&document.getElementById("".concat(this.jSPlugin.id,"-pantile-icon")).setAttribute("style",i);var n=document.getElementsByClassName("".concat(this.jSPlugin.id,"-select-quality-btn"));if(n.length)for(var a=0;a'+'')+'')+'',o.onclick=function(){var e=t.decoderState.state,i=e.play,n=e.isEditing,a=e.rec,r=e.cloudRec,o=e.recordvideo,s=e.pantile;if(n)return!1;Array.isArray(window.recTimer)&&window.recTimer.map((function(e){clearInterval(e)})),i?(a||r?(t.Rec&&t.Rec.unSyncTimeLine(),t.jSPlugin.pause().then((function(){t.setDecoderState({play:!i}),t.setDisabled(i)}))):(t.jSPlugin.stop().then((function(){t.setDecoderState({play:!i}),t.setDisabled(i)})),t.jSPlugin.Zoom.stopZoom(),t.jSPlugin.close3DZoom()),o&&t.setDecoderState({recordvideo:!1})):(a||r?(t.Rec&&t.Rec.syncTimeLine(),t.jSPlugin.resume().then((function(){t.setDecoderState({play:!i}),t.setDisabled(i)}))):t.jSPlugin.play().then((function(){t.setDecoderState({play:!i}),t.setDisabled(i)})),t.jSPlugin.use3DZoom&&t.resetMobileZoomStatus()),t.jSPlugin.use3DZoom?(t.setDecoderState({zoom:!1}),t.allowZoom=!1):t.allowZoom=a||r,s&&t.Ptz&&(t.Ptz.hide(),t.setDecoderState({pantile:!1})),document.getElementById("".concat(t.jSPlugin.id,"-speedSelect"))&&(document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.display="none"),t.setDecoderState({speed:!1})};break;case"sound":o.title=this.jSPlugin.i18n.t("client.theme.BTN_SOUND"),o.id=e,o.domString=''+'')+'\n \n \n \n \n ')+"",o.onclick=function(){var e=t.decoderState.state,i=e.play,n=e.sound,a=e.talk,r=e.pantile;i&&!a&&(n?(t.jSPlugin.closeSound(),t.setDecoderState({sound:!1})):(t.jSPlugin.openSound(),t.setDecoderState({sound:!0})),r&&t.Ptz&&(t.Ptz.hide(),t.setDecoderState({pantile:!1})))};break;case"recordvideo":if(f)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_RECORDVIDEO"),o.id=e,o.domString='')+'',o.onclick=function(){var e=t.decoderState.state,i=e.play,n=e.recordvideo;i&&(n?(t.jSPlugin.stopSave(),t.setDecoderState({recordvideo:!1})):(t.jSPlugin.startSave("".concat((new Date).getTime())),t.setDecoderState({recordvideo:!0})))};break;case"capturePicture":if(f)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_CAPTURE"),o.id=e,o.domString='')+'',o.onclick=function(){t.decoderState.state.play?t.jSPlugin.capturePicture("".concat((new Date).getTime()),!0):console.log("视频未播放,无法截图")};break;case"talk":if(f)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_TALK"),o.id=e,o.domString="
"+'')+'',o.onclick=function(){var e=t.decoderState.state,i=e.talk,n=e.sound;if(e.play)if(i){console.log("结束对讲"),t.setDecoderState({talk:!1}),t.jSPlugin.Talk.stopTalk();var a=k.findIndex(t.themeData.footer.btnList,(function(e){return"sound"===e.iconId&&1===e.isrender&&1===e.defaultActive}))>-1;t.themeData&&a&&(t.jSPlugin.openSound(),t.setDecoderState({sound:!0}))}else console.log("开始对讲"),t.setDecoderState({talk:!0}),t.jSPlugin.Talk.startTalk((function(e){n&&!e&&(t.jSPlugin.closeSound(),t.setDecoderState({sound:!1}))}))};break;case"zoom":if(f)break;o.title=this.jSPlugin.use3DZoom?this.jSPlugin.i18n.t("client.theme.BTN_3D_ZOOM"):this.jSPlugin.i18n.t("client.theme.BTN_ZOOM"),o.id=e,o.domString="
"+'\n \n \n \n \n '),o.onclick=function(){var e=t.decoderState.state,i=e.zoom,n=e.play,a=e.rec,r=e.cloudRec;if(t.jSPlugin.use3DZoom){if(!n)return!1;i?t.jSPlugin.close3DZoom():t.jSPlugin.enable3DZoom()}else{if(t.zoomDisable||!a&&!r&&!n)return!1;i?(console.log("结束电子放大"),t.jSPlugin.Zoom.stopZoom()):(console.log("开始电子放大"),t.jSPlugin.Zoom.startZoom())}t.setDecoderState({zoom:!i})};break;case"pantile":if(f)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_PTZ"),o.id=e,o.domString='')+'',o.onclick=function(){var e=t.decoderState.state,i=e.play,n=e.pantile,a=e.expend;if(i)if(n)console.log("隐藏云台"),t.Ptz.hide(),t.setDecoderState({pantile:!1});else{if(t.isMobile&&!a)return console.log("移动端,非全屏状态不展示云台"),!1;console.log("显示云台"),t.Ptz.show(),t.setDecoderState({pantile:!0})}};break;case"expend":o.title=this.jSPlugin.i18n.t("client.theme.BTN_EXPEND"),o.id=e,o.domString='')+''+'\n '),o.onclick=function(){var e=t.decoderState.state;e.webExpend;var i=e.expend;e.zoom;var n=e.pantile;if(i)if(t.isMobile){var a=t._extendHeadeTimeLinrHight(!1,!0),r=document.getElementById("".concat(t.jSPlugin.id,"-headControl"));document.getElementById("".concat(t.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(t.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-32px"),r&&(r.style.position="relative"),function(e,t,i){var n="";n+="width:"+t+"px;",n+="height:"+i+"px;",n+="-webkit-transform: none; transform: none;",n+="-webkit-transform-origin: 0 0;",n+="transform-origin: 0 0;",e.style.cssText=n}(document.getElementById("".concat(t.jSPlugin.id,"-wrap")),t.jSPlugin.width,t.jSPlugin.height),t.jSPlugin.jSPlugin.JS_Resize(t.jSPlugin.width,t.jSPlugin.height-a),n&&t.Ptz&&(t.Ptz.hide(),t.setDecoderState({pantile:!1})),t.jSPlugin.fullScreenWidth=t.jSPlugin.width,t.jSPlugin.fullScreenHeight=t.jSPlugin.height,t.jSPlugin.Zoom.currentScale,t.jSPlugin.Zoom&&t.jSPlugin.Zoom.handleFullscreen&&t.jSPlugin.Zoom.handleFullscreen(!i,t.jSPlugin.width,t.jSPlugin.height),document.getElementById("".concat(t.jSPlugin.id,"-pantile-icon"))&&(document.getElementById("".concat(t.jSPlugin.id,"-pantile-icon")).style.display="none")}else b();else if(console.log("执行全局全屏"),t.isMobile){var o=t._extendHeadeTimeLinrHight(!1,!0);y(document.getElementById("".concat(t.jSPlugin.id,"-wrap")));var s=document.documentElement.clientWidth,l=document.documentElement.clientHeight;document.getElementById("".concat(t.jSPlugin.id)).style["backface-visibility"]="hidden",t.jSPlugin.jSPlugin.JS_Resize(l,s-o,!0),t.jSPlugin.fullScreenWidth=l,t.jSPlugin.fullScreenHeight=s-o,t.jSPlugin.Zoom.currentScale,t.jSPlugin.Zoom&&t.jSPlugin.Zoom.handleFullscreen&&t.jSPlugin.Zoom.handleFullscreen(!i,l,s-o),document.getElementById("".concat(t.jSPlugin.id,"-pantile-icon"))&&(document.getElementById("".concat(t.jSPlugin.id,"-pantile-icon")).style.display="block")}else{s=window.screen.width,l=window.screen.height;S(document.getElementById("".concat(t.jSPlugin.id))).then((function(e){t.jSPlugin.jSPlugin.JS_Resize(s,l),t.jSPlugin.fullScreenWidth=s,t.jSPlugin.fullScreenHeight=l})).catch((function(e){console.log(e)})),t.jSPlugin.close3DZoom(),t.setDecoderState({speed:!1})}t.setDecoderState({expend:!i})};break;case"webExpend":if(f)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_WEBEXPEND"),o.id=e,o.domString='')+''+'",o.onclick=function(){var e=t.decoderState.state,i=e.webExpend,n=e.expend;if(e.zoom,n)return console.log("正在全局全屏"),!1;if(Array.isArray(window.recTimer)&&window.recTimer.map((function(e){clearInterval(e)})),i)console.log("取消网页全屏"),b();else{var a=window.screen.width,r=window.screen.height;console.log("执行网页全屏"),S(document.getElementById("".concat(t.jSPlugin.id,"-wrap"))).then((function(){t.jSPlugin.jSPlugin.JS_Resize(a,r-t._extendHeadeTimeLinrHight(!1,!1))}))}t.jSPlugin.Theme.Rec&&setTimeout((function(){t.jSPlugin.Theme.Rec.recAutoSize((function(){t.jSPlugin.Zoom.currentScale>1&&t.jSPlugin.Zoom.currentScale}))}),100),t.setDecoderState({webExpend:!i})};break;case"hd":if(f)break;var x="".concat(this.jSPlugin.id,"-select-quality"),p="".concat(x,"-item");return o.title=this.jSPlugin.i18n.t("client.theme.BTN_HD"),o.id=e,o.domString='\n \x3c!-- 由接口返回生成 --\x3e\n '),o.onclick=function(e){var i=t.decoderState.state,n=i.hd,a=i.expend,r=i.recordvideo,o=i.play,s=i.hdList,l=i.zoom,c=i.pantile;if(e.stopPropagation(),o){var d=e.target.id,u=e.target.getAttribute("data-type");if(0===d.indexOf(x)){if(n.type+""!==u){var h=s.find((function(e){return e.level+""===u}));if(h&&(h.streamType!==n.streamType||h.level+""!=n.level+"")){t.jSPlugin.changeVideoLevel(h),t.setDecoderState({hd:h}),l&&t.jSPlugin.Zoom.stopZoom();var f=document.getElementById("".concat(t.jSPlugin.id,"-hdSelect-icon")),p=document.getElementById("".concat(t.jSPlugin.id,"-sdSelect-icon"));f&&(f.style.display=["hd","0"].includes(h.level)?"block":"none"),p&&(p.style.display=["sd","1"].includes(h.level)?"block":"none")}}t.resetMobileZoomStatus(),r&&t.setDecoderState({recordvideo:!1})}t.showHD=!t.showHD,document.getElementById("".concat(t.jSPlugin.id,"-hdSelect"))&&(document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.display="none"===document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.display?"block":"none",t.isMobile&&(document.getElementById("".concat(t.jSPlugin.id,"-select-hd-mask")).style.display="none"===document.getElementById("".concat(t.jSPlugin.id,"-select-hd-mask")).style.display?"block":"none"),t.themeData.autoFocus>0&&("none"===document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.display?t.startAutoFocus():t.stopAutoFocus())),t.isMobile&&a&&t.showHD?document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).className="hd speed-select mobile expend":document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).className=t.isMobile?"hd speed-select mobile":"speed-select",t.isMobile&&(a?(document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.bottom="env(safe-area-inset-bottom)",document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.bottom="constant(safe-area-inset-bottom)"):(document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.bottom="calc(constant(safe-area-inset-bottom) + 80px)",document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.bottom="calc(env(safe-area-inset-bottom) + 80px)")),c&&t.Ptz&&(t.Ptz.hide(),t.setDecoderState({pantile:!1}))}},(s=this.jSPlugin.env.domain,l=this.jSPlugin.accessToken,d=this.jSPlugin.deviceSerial,u=this.jSPlugin.channelNo,h="".concat(s,"/api/service/device/capacity/video/quality?accessToken=").concat(l,"&deviceSerial=").concat(d,"&channelNo=").concat(u),fetch(h,{method:"GET"}).then((function(e){return e.json()})).then((function(e){return e.meta&&200===e.meta.code&&e.data&&e.data.length>0&&e.data.find((function(e){return 2===e.streamTypeIn}))?we:Re})).catch((function(){return Re}))).then((function(e){var i=e;t.setDecoderState({hdList:i});var n=t.jSPlugin.url.indexOf("hd.live")>-1?i[0]:i[1];t.setDecoderState({hd:n});var r=document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")),s=document.getElementById("".concat(t.jSPlugin.id,"-hdSelect-icon-warp"));r&&(r.innerHTML="\n ".concat(c(i).reverse().map((function(e){if(e.name&&null!=e.level)return'
  • ').concat(e.name,"
  • ")})).join(""),'\n
  • 取消
  • \n ')),s&&("object"===a(t.decoderState.state.hd)&&"function"==typeof t.decoderState.state.hd.icon?s.innerHTML="\n ".concat(i.map((function(e){if(e.name&&"function"==typeof e.icon)return e.icon(t.jSPlugin.id,x,o.color,t.jSPlugin.width,Fe,t.decoderState.state.hd)})).join(""),'\n \n '):"object"===a(t.decoderState.state.hd)&&"string"==typeof t.decoderState.state.hd.name&&$(s).prepend('
    ').concat(t.decoderState.state.hd.name,"
    ")))})),o;case"speed":if(f)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_SPEED"),o.id=e,o.domString='"+'\n
    ').concat(1===this.nextRate?"倍速":"".concat(this.nextRate,"倍").replace("3","0.5"),"
    \n ")+'')+"
    ",o.onclick=function(e){var i=t.decoderState.state,n=i.speed,a=i.expend,r=i.play;if(e.stopPropagation(),!r)return!1;if(!n&&t.isMobile&&(document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).className=a?"speed speed-select mobile expend":"speed speed-select mobile"),t.isMobile&&(a?(document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.bottom="constant(safe-area-inset-bottom)",document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.bottom="env(safe-area-inset-bottom)"):(document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.bottom="calc(constant(safe-area-inset-bottom) + 80px)",document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.bottom="calc(env(safe-area-inset-bottom) + 80px)")),t.nextRate=1,e.target.id)switch(e.target.id){case"".concat(t.jSPlugin.id,"-select-speed1"):console.log("倍速1"),t.nextRate=1,t.jSPlugin.jSPlugin.JS_Speed(t.nextRate),t.changeRecSpeed(1),t.jSPlugin.speed=1,t.setDecoderState({speed:!n});break;case"".concat(t.jSPlugin.id,"-select-speed2"):console.log("倍速2"),t.nextRate=2,t.jSPlugin.jSPlugin.JS_Speed(t.nextRate),t.changeRecSpeed(2),t.jSPlugin.speed=2,t.setDecoderState({speed:!n});break;case"".concat(t.jSPlugin.id,"-select-speed4"):console.log("倍速4"),t.nextRate=4,t.jSPlugin.jSPlugin.JS_Speed(t.nextRate),t.changeRecSpeed(4),t.jSPlugin.speed=4,t.setDecoderState({speed:!n});break;case"".concat(t.jSPlugin.id,"-select-speed05"):console.log("倍速05"),t.nextRate=3,t.jSPlugin.jSPlugin.JS_Speed(t.nextRate),t.changeRecSpeed(.5),t.jSPlugin.speed=.5,t.setDecoderState({speed:!n});break;default:t.isMobile?t.setDecoderState({speed:!n}):t.setDecoderState({speed:!0})}t.isMobile&&e.target.id==="".concat(t.jSPlugin.id,"-speed-text")?document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.display="block":document.getElementById("".concat(t.jSPlugin.id,"-speedSelect"))&&(document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.display="none"===document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.display?"block":"none"),t.setDecoderState({speed:!n}),t.themeData.autoFocus>0&&("none"===document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.display?t.startAutoFocus():t.stopAutoFocus())};break;case"deviceName":o.title=this.jSPlugin.i18n.t("client.theme.DEVICE_NAME"),o.id=e,o.domString="".concat(this.jSPlugin.i18n.t("client.theme.DEVICE_NAME"),""),o.onclick=function(){};break;case"deviceID":o.title=this.jSPlugin.i18n.t("client.theme.BTN_SPEED"),o.id=e,o.domString="".concat(this.jSPlugin.i18n.t("client.theme.BTN_SPEED"),""),o.onclick=function(){};break;case"cloudRec":if(this.jSPlugin._isCloudRecord)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_CLOUDREC"),o.id=e,o.domString='\n \n \n\t\n\t\n\t\n \n \n '),o.onclick=function(){console.log("点击云回放"),t.setDecoderState({type:"cloud.rec",cloudRec:!0,rec:!1}),t.jSPlugin.eventEmitter.emit("recTypeChange",{eventType:"recTypeChange",code:0,data:{type:"cloud"}}),t.jSPlugin.changePlayUrl({type:"cloud.rec"},(function(){var e=_("begin",t.jSPlugin.url)||(new Date).Format("yyyyMMdd");t.Rec.renderRec("".concat(e.slice(0,4),"-").concat(e.slice(4,6),"-").concat(e.slice(6,8))),t.decoderState.state.zoom&&(t.setDecoderState({zoom:!1}),t.jSPlugin.Zoom.stopZoom(),t.jSPlugin.close3DZoom())}),!1)};break;case"cloudRecord":if(!this.jSPlugin._isCloudRecord)break;o.title=this.jSPlugin.i18n.t("client.theme.BTN_CLOUDRECORD"),o.id=e,o.domString=' \n\n\n\t\n\t\n\t\n\t'),o.onclick=function(){console.log("点击云录制"),t.setDecoderState({type:"cloud.rec",cloudRec:!0,rec:!1}),t.jSPlugin.eventEmitter.emit("recTypeChange",{eventType:"recTypeChange",code:0,data:{type:"cloudRecord"}}),t.jSPlugin.url.replace(/rec\??|cloud.rec\??/,"cloud.rec?busType=7"),t.jSPlugin.changePlayUrl({type:"cloud.rec"},(function(){t.jSPlugin._isCloudRecord&&t.changeTheme("pcRec");var e=_("begin",t.jSPlugin.url)||(new Date).Format("yyyyMMdd");t.Rec.renderRec("".concat(e.slice(0,4),"-").concat(e.slice(4,6),"-").concat(e.slice(6,8))),t.decoderState.state.zoom&&(t.setDecoderState({zoom:!1}),t.jSPlugin.Zoom.stopZoom(),t.jSPlugin.close3DZoom())}),!1)};break;case"rec":o.title=this.jSPlugin.i18n.t("client.theme.BTN_CLOUDRECORD"),o.id=e,o.domString='\n \n \n \n\n\n\n \n \n '),o.onclick=function(){console.log("点击本地回放"),t.setDecoderState({type:"rec",cloudRec:!1,rec:!0}),t.jSPlugin.eventEmitter.emit("recTypeChange",{eventType:"recTypeChange",code:0,data:{type:"local"}}),t.jSPlugin.changePlayUrl({type:"rec"},(function(){console.log("---------本地回放"),t.jSPlugin._isCloudRecord&&t.changeTheme("pcRec");var e=_("begin",t.jSPlugin.url)||(new Date).Format("yyyyMMdd");t.Rec.renderRec("".concat(e.slice(0,4),"-").concat(e.slice(4,6),"-").concat(e.slice(6,8))),t.decoderState.state.zoom&&(t.setDecoderState({zoom:!1}),t.jSPlugin.Zoom.stopZoom(),t.jSPlugin.close3DZoom())}),!1)}}return o}},{key:"_warpFullScreen",value:function(){var e=this,t=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),i=this,n=function(){var t=i.decoderState.state,n=t.webExpend,a=t.expend,r=t.zoom;document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen?n?e.jSPlugin.eventEmitter&&e.jSPlugin.eventEmitter.emit("fullScreen",{eventType:"fullScreen",code:0,target:e,msg:"web 全屏"}):a&&(i.setDecoderState({expend:!1}),r&&i.jSPlugin.use3DZoom&&i.jSPlugin.enable3DZoom(),e.jSPlugin.eventEmitter&&e.jSPlugin.eventEmitter.emit("fullScreen",{eventType:"fullScreen",code:0,target:e,msg:"全局全屏"})):(i.jSPlugin.jSPlugin.JS_Resize(i.jSPlugin.width,i.jSPlugin.height-e._extendHeadeTimeLinrHight(!1,!1)),e.jSPlugin.eventEmitter&&e.jSPlugin.eventEmitter.emit("cancelFullScreen",{eventType:"cancelFullScreen",code:0,target:e,msg:"退出全局全屏"})),e.setDecoderState({speed:!1})};["fullscreenchange","webkitfullscreenchange","mozfullscreenchange"].forEach((function(e){t.removeEventListener(e,n),t.addEventListener(e,n)}))}},{key:"changeRecSpeed",value:function(e){var t=this,i=function(e){if(console.log("setLiActive",e),!document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")))return!1;document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[0].className=document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[0].className.replace("active","default"),document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[1].className=document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[1].className.replace("active","default"),document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[2].className=document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[2].className.replace("active","default"),document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[3].className=document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[3].className.replace("active","default"),document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[e].className=document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).childNodes[e].className.replace("default","active")},n="1";switch(e){case 1:i(2),n="倍速";break;case 2:i(1),n="".concat(e,"倍");break;case 4:i(0),n="".concat(e,"倍");break;case.5:i(3),n="".concat(e,"倍");break;default:i(2),n="".concat(e,"倍")}document.getElementById("".concat(this.jSPlugin.id,"-speed-text"))&&(document.getElementById("".concat(this.jSPlugin.id,"-speed-text")).innerHTML=n)}},{key:"initThemeData",value:function(){var e=this,t=this.themeData,i=t.header,n=t.footer,a=this.jSPlugin.id;if(this.header=L,this.footer=B,this.isNeedRenderHeader=k.findIndex(i.btnList,(function(e){return e.isrender>0}))>=0&&"miniRec"!=this.jSPlugin.id,this.isMobile&&(this.isNeedRenderHeader=k.findIndex(i.btnList,(function(e){return e.isrender>0&&"deviceID"===e.iconId||e.isrender>0&&"deviceName"===e.iconId}))>=0&&"miniRec"!=this.jSPlugin.id),this.isNeedRenderFooter=k.findIndex(n.btnList,(function(e){return e.isrender>0}))>=0&&"miniRec"!=this.jSPlugin.id,console.log("miniRec:"+this.jSPlugin.themeId),this.isNeedRenderTimeLine=k.findIndex(i.btnList,(function(e){return"cloudRec"===e.iconId&&1===e.isrender||"rec"===e.iconId&&1===e.isrender}))>=0&&!this.jSPlugin.disabledTimeLine&&"miniRec"!=this.jSPlugin.id,["date-switch-container-wrap","rec-type-container-wrap","mobile-rec-wrap","mobile-ez-ptz-container"].forEach((function(e,t){document.getElementById(e)&&document.getElementById(e).parentElement.removeChild(document.getElementById(e))})),this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var r=document.createElement("div");r.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),r.setAttribute("class","header-controls"),r.innerHTML="
    ");var o={height:this.jSPlugin.width>Fe?"48px":"32px","line-height":this.jSPlugin.width>Fe?"48px":"32px",display:"flex","justify-content":"space-between",top:0,"z-index":1,background:"#000000",color:"#FFFFFF",width:"100%"};r.style=ke(o),document.getElementById("".concat(a,"-wrap")).insertBefore(r,document.getElementById(a));var s=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(s)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));if(this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-".concat(this.jSPlugin.width>Fe?48:32,"px"),document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='"));else{var l=document.createElement("div");l.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),l.setAttribute("class","ez-iframe-footer-container");var c={"min-height":this.jSPlugin.width>Fe?"48px":"32px","max-height":this.jSPlugin.width>Fe?"96px":"80px",position:"relative","margin-top":this.jSPlugin.width>Fe?"-48px":"-32px",display:"flex","flex-wrap":"wrap","justify-content":"space-between","z-index":999,top:0,color:"#FFFFFF",width:"100%"};l.style=ke(c),l.innerHTML='"),g(l,document.getElementById(a))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));if(this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))){document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=i.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=i.color;var d,u=h(i.btnList);try{for(u.s();!(d=u.n()).done;){var f=d.value;if(f.isrender)try{this.renderHeader(f.iconId,f.part)}catch(e){}}}catch(e){u.e(e)}finally{u.f()}}if(this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))){document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=n.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=n.color;var x,p=h(n.btnList);try{for(p.s();!(x=p.n()).done;){var m=x.value;if(m.isrender)try{this.renderFooter(m.iconId,m.part)}catch(e){}}}catch(e){p.e(e)}finally{p.f()}}if(console.log("this.isNeedRenderTimeLine:"+this.isNeedRenderTimeLine),this.isNeedRenderTimeLine)if(this.isMobile)document.getElementById("".concat(this.jSPlugin.id,"-headControl-right"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl-right")).style.display="none"),this.Rec=new te(this.jSPlugin,this.changeRecSpeed,this.resetMobileZoomStatus);else{this.Rec?this.Rec.recInit():(this.jSPlugin.decoderState=this.decoderState,this.jSPlugin.setDecoderState=this.setDecoderState,this.Rec=new q(this.jSPlugin));var _=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(_)}),50)}k.findIndex(this.themeData.footer.btnList,(function(e){return"pantile"===e.iconId&&1===e.isrender}))>=0&&!this.jSPlugin.disabledPTZ&&(this.isMobile&&(this.MobilePtz=new he(this.jSPlugin)),this.Ptz=new ie(this.jSPlugin));var v=function(){var t=e,i=t.decoderState.state,n=i.expend,a=i.zoom,r=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen;t.Rec&&window.randomNum==t.jSPlugin.randomNum&&setTimeout((function(){t.Rec.recAutoSize((function(){if(t.jSPlugin.Zoom.currentScale>1){var e=t.jSPlugin.Zoom.currentScale;t.jSPlugin.Zoom.stopZoom(),setTimeout((function(){t.jSPlugin.Zoom.startZoom(),t.jSPlugin.Zoom.currentScale=e,t.jSPlugin.Zoom.doScale(e)}),200)}}))}),100),r||(n&&a&&t.jSPlugin.use3DZoom&&t.jSPlugin.enable3DZoom(),t.setDecoderState({webExpend:!1,expend:!1})),document.getElementById("".concat(t.jSPlugin.id,"-hdSelect"))&&(document.getElementById("".concat(t.jSPlugin.id,"-hdSelect")).style.display="none"),document.getElementById("".concat(t.jSPlugin.id,"-speedSelect"))&&(document.getElementById("".concat(t.jSPlugin.id,"-speedSelect")).style.display="none"),t.isMobile&&(document.getElementById("".concat(t.jSPlugin.id,"-select-hd-mask"))&&(document.getElementById("".concat(t.jSPlugin.id,"-select-hd-mask")).style.display="none"),document.getElementById("".concat(t.jSPlugin.id,"-select-mask"))&&(document.getElementById("".concat(t.jSPlugin.id,"-select-mask")).style.display="none")),t.themeData.autoFocus>0&&t.startAutoFocus()};if(["fullscreenchange","webkitfullscreenchange","mozfullscreenchange"].forEach((function(e,t){window.onFullscreenChange&&document.removeEventListener(e,window.onFullscreenChange),document.addEventListener(e,v),window.onFullscreenChange=v})),this.themeData.poster){this.jSPlugin.poster=this.themeData.poster;var y=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(y),e.jSPlugin.setPoster(e.themeData.poster))}),50)}this.inited=!0,this.getDeviceInfo(),this.renderThemeData()}},{key:"resetMobileZoomStatus",value:function(){if(this.isMobile){var e=document.getElementById("".concat(this.jSPlugin.id,"-zoom-container"));e&&e.style&&"none"!=e.style.display&&(console.log("结束电子放大"),e.style.display="none"),this.jSPlugin.jSPlugin.Zoom&&this.jSPlugin.jSPlugin.Zoom.resetZoom()}}},{key:"getDeviceInfo",value:function(e){var t=this;De({accessToken:this.jSPlugin.accessToken,deviceSerial:P(this.jSPlugin.url).deviceSerial}).then((function(i){i.data&&(e&&e(i),document.getElementById("".concat(t.jSPlugin.id,"-deviceName-content"))&&(document.getElementById("".concat(t.jSPlugin.id,"-deviceName-content")).style.maxWidth="100%",document.getElementById("".concat(t.jSPlugin.id,"-deviceName-content")).style.overflow="hidden",document.getElementById("".concat(t.jSPlugin.id,"-deviceName-content")).style.textOverflow="ellipsis",document.getElementById("".concat(t.jSPlugin.id,"-deviceName-content")).style.whiteSpace="nowrap",document.getElementById("".concat(t.jSPlugin.id,"-deviceName-content")).innerHTML=i.data.deviceName),document.getElementById("".concat(t.jSPlugin.id,"-deviceID-content"))&&(document.getElementById("".concat(t.jSPlugin.id,"-deviceID-content")).style.maxWidth="100%",document.getElementById("".concat(t.jSPlugin.id,"-deviceID-content")).style.overflow="hidden",document.getElementById("".concat(t.jSPlugin.id,"-deviceID-content")).style.textOverflow="ellipsis",document.getElementById("".concat(t.jSPlugin.id,"-deviceID-content")).style.whiteSpace="nowrap",document.getElementById("".concat(t.jSPlugin.id,"-deviceID-content")).innerHTML=P(t.jSPlugin.url).deviceSerial))})).catch((function(e){console.log("获取设备信息失败",e)}))}},{key:"editStart",value:function(e){var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));i&&i.setAttribute("class","header-controls themeEditing"),t&&t.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(e){var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));i&&i.setAttribute("class","header-controls"),t&&t.setAttribute("class","footer-controls"),this.setDecoderState({isEditing:!1})}},{key:"webExpend",value:function(){var e=this,t=this.decoderState.state;t.webExpend;var i=t.expend;return!!t.play&&(i?(console.log("正在全局全屏"),!1):(console.log("执行网页全屏"),void S(document.getElementById("".concat(this.jSPlugin.id,"-wrap"))).then((function(t){e.jSPlugin.jSPlugin.JS_Resize(window.screen.width,window.screen.height-e._extendHeadeTimeLinrHight(!1,!1))})).catch((function(e){console.log(e)}))))}},{key:"expend",value:function(){var e=this,t=this.decoderState.state,i=t.webExpend;if(!t.play)return!1;if(i)return console.log("正在网站全屏"),!1;if(console.log("执行全局全屏"),this.isMobile){y(document.getElementById("".concat(this.jSPlugin.id,"-wrap")));var n=document.documentElement.clientWidth,a=document.documentElement.clientHeight;document.getElementById("".concat(this.jSPlugin.id)).style["backface-visibility"]="hidden",this.jSPlugin.jSPlugin.JS_Resize(a,n-this._extendHeadeTimeLinrHight(!1,!0))}else{S(document.getElementById("".concat(this.jSPlugin.id))).then((function(t){e.jSPlugin.jSPlugin.JS_Resize(window.screen.width,window.screen.height)})).catch((function(e){console.log(e)}))}}},{key:"_extendHeadeTimeLinrHight",value:function(e,t){var i=0,n=0,a=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));a&&!e&&(i=parseInt(getComputedStyle(a).height,10));var r=document.getElementById("".concat(this.jSPlugin.id,"-canvas-container"));return r&&!t&&(n=parseInt(window.getComputedStyle(r).height,10)),i+n}},{key:"disabledFECBtn",value:function(){var e=["".concat(this.jSPlugin.id,"-capturePicture"),"".concat(this.jSPlugin.id,"-capturePicture-content"),"".concat(this.jSPlugin.id,"-capturePicture-icon"),"".concat(this.jSPlugin.id,"-recordvideo"),"".concat(this.jSPlugin.id,"-recordvideo-content"),"".concat(this.jSPlugin.id,"-recordvideo-icon"),"".concat(this.jSPlugin.id,"-zoom"),"".concat(this.jSPlugin.id,"-zoom-content"),"".concat(this.jSPlugin.id,"-zoom-icon")],t=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));if(this.jSPlugin.use3DZoom?this.jSPlugin.close3DZoom():this.jSPlugin.Zoom.stopZoom(),this.setDecoderState({zoom:!1}),t){var i,n=h(e);try{for(n.s();!(i=n.n()).done;){var a=i.value,r=t.querySelector("#".concat(a));r&&(r.style.display="none")}}catch(e){n.e(e)}finally{n.f()}}}},{key:"resumeFECBtn",value:function(){var e=["".concat(this.jSPlugin.id,"-capturePicture"),"".concat(this.jSPlugin.id,"-capturePicture-content"),"".concat(this.jSPlugin.id,"-capturePicture-icon"),"".concat(this.jSPlugin.id,"-recordvideo"),"".concat(this.jSPlugin.id,"-recordvideo-content"),"".concat(this.jSPlugin.id,"-recordvideo-icon"),"".concat(this.jSPlugin.id,"-zoom"),"".concat(this.jSPlugin.id,"-zoom-content"),"".concat(this.jSPlugin.id,"-zoom-icon")],t=document.getElementById("".concat(this.jSPlugin.id,"-wrap"));if(t){var i,n=h(e);try{for(n.s();!(i=n.n()).done;){var a=i.value,r=t.querySelector("#".concat(a));r&&(r.style.display="")}}catch(e){n.e(e)}finally{n.f()}}}},{key:"destroy",value:function(){var e=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));e&&(e.innerHTML="");var t=document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"));this._removeElement(t);var i=document.getElementById("".concat(this.jSPlugin.id,"-ez-ptz-item"));this._removeElement(i);var n=document.getElementById("mobile-ez-ptz-container");this._removeElement(n);var a=document.getElementById("date-switch-container-wrap");this._removeElement(a);var r=document.getElementById("rec-type-container-wrap");this._removeElement(r);var o=document.getElementById("mobile-rec-wrap");this._removeElement(o)}},{key:"_removeElement",value:function(e){e&&e.parentNode&&e.parentNode.removeChild(e)}}]),e}(),Me=function(){function e(t,i){r(this,e),this.jSPlugin=t,this.isMobile=i,this.timer=null,this.initToastCustom()}return s(e,[{key:"initToastCustom",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom"))?document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom")).style.display="none":this.randerToast()}},{key:"randerToast",value:function(){var e=this.jSPlugin.width,t=1;t=this.isMobile?e/375||1:e/1024||1;var i=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),n=document.createElement("div");n.style="display:none;position:absolute;top:0;width: 100%;align-items: center;justify-content: center;",n.id="".concat(this.jSPlugin.id,"-wrap-Toast-custom"),this.isMobile?n.innerHTML='
    \n
    \n '):n.innerHTML='
    \n
    \n '),i.insertBefore(n,document.getElementById(this.jSPlugin.id))}},{key:"initToastContent",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;console.log("content----------------",e),this.timer=null,document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom"))?(document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-wrap-Toast-custom-content")).innerText=e||"",this.timer=setTimeout((function(){document.getElementById("".concat(t.jSPlugin.id,"-wrap"))&&document.getElementById("".concat(t.jSPlugin.id,"-wrap-Toast-custom"))&&document.getElementById("".concat(t.jSPlugin.id,"-wrap")).removeChild(document.getElementById("".concat(t.jSPlugin.id,"-wrap-Toast-custom")))}),i)):(this.randerToast(),this.initToastContent(e))}}]),e}(),Le=function(e,t,i){var n=new FormData;n.append("deviceSerial",P(e.url).deviceSerial),n.append("cmd","open"),e.accessToken;var a="".concat(e.env.domain,"/api/v3/device/acs/remote/door?accessToken=").concat(e.accessToken);fetch(a,{method:"POST",body:n}).then((function(e){return e.json()})).then((function(e){console.log("get theme data",e),function(e){console.log(e),t(e)}(e)})).catch((function(e){var t;t=e,console.log(t),i(t)}))},Be=function(e,t,i){var n={accessToken:e.accessToken,pageStart:0,pageSize:4,default:!0,voiceName:"轻应用语音文件"},a="".concat(e.env.domain,"/api/lapp/voice/query");Ee(a,"POST",n,(function(e){console.log(e),t(e)}),(function(e){console.log(e),i(e)}),{"Content-Type":"application/x-www-form-urlencoded"})},Oe=function(e,t,i,n){var a="".concat(e.env.domain,"/api/lapp/voice/send"),r=new FormData;r.append("deviceSerial",P(e.url).deviceSerial),r.append("accessToken",e.accessToken),r.append("channelNo",P(e.url).channelNo||1),r.append("fileUrl",t),fetch(a,{method:"POST",body:r}).then((function(e){return e.json()})).then((function(e){!function(e){console.log(e),i(e)}(e)})).catch((function(e){var t;t=e,console.log(t),n(t)}))},je=function(){function e(t,i){r(this,e),this.jSPlugin=t,this.videoWidth=t.width,this.switchFooter=i,this.sendLoadingStats=!1,this.toastCustom=new Me(t,!1),this.quickReplyList=["你好,请将快递放在门口","你好,稍等","你好,请将快递放入小区快递柜","你好,请将外卖放在门口"],this.initQuickReply()}return s(e,[{key:"initQuickReply",value:function(){document.getElementById("pc-quickReply-back")||this.renderQuickReply(),document.getElementById("pc-quickReply-back-item-0")||this.getQuickReplyList()}},{key:"renderQuickReply",value:function(){var e=this,t=this.videoWidth/1024||1,i=document.createElement("div");i.style="width:100%;",i.innerHTML='
    \n
    \n
    \n \n 返回\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n 返回\n
    \n
    \n \n \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply")).appendChild(i),document.getElementById("pc-quickReply-back").onclick=function(){e.switchFooter("onBell")}}},{key:"matchQuickReplyBtn",value:function(){var e=this,t=this.videoWidth/1024||1,i=document.getElementById("pc-quickReply-content");this.quickReplyList&&this.quickReplyList.length>0&&this.quickReplyList.forEach((function(n,a){var r=document.createElement("div");r.id="pc-quickReply-back-item-".concat(a),r.style="margin: ".concat(8*t,"px 0 ").concat(8*t,"px ").concat(8*t,"px;cursor: pointer;\n padding: 0 ").concat(20*t,"px;min-height: ").concat(64*t,"px;width:calc(50% - ").concat(16*t,"px);\n display: inline-block;background: rgba(0,0,0,0.70);border-radius: 8px;text-align: center;\n box-sizing: border-box;font-size:").concat(24*t,"px;color: rgba(255,255,255,0.90);"),r.innerHTML='
    \n ').concat(n.voiceName,"\n
    "),r.onclick=function(){e.sendLoadingStats||(console.log("item:"+n),e.sendQuickReply(n,a))},i.appendChild(r)}))}},{key:"setBtnCheckLoading",value:function(e,t){var i=this.videoWidth/1024||1;if(t>-1){document.getElementById("pc-quickReply-back-item-".concat(t));var n=document.getElementById("pc-quickReply-back-item-box-".concat(t)),a=document.getElementById("pc-quickReply-name-".concat(t));if(1==e){var r=document.getElementById("pc-quickReply-icon-loading-".concat(t));r&&a&&n.removeChild(r)}else if(a){var o=document.createElement("span");o.id="pc-quickReply-icon-loading-".concat(t),o.style="vertical-align: middle;margin-right:".concat(16*i,"px;"),o.innerHTML=''),n.insertBefore(o,a)}}}},{key:"getQuickReplyList",value:function(){var e=this;console.log("getQuickReplyList"),this.madeLoadingDom(0);Be(this.jSPlugin,(function(t){if(t&&200==t.code){var i=t.data||[],n=[];t.data.forEach((function(e,t){n=e.voiceName.split("_"),i[t].voiceName=n[1]})),e.quickReplyList=i,setTimeout((function(){e.madeLoadingDom(2)}),500)}else e.madeLoadingDom(1)}),(function(t){console.log(t),e.madeLoadingDom(1)}))}},{key:"madeLoadingDom",value:function(e){var t=this,i=this.videoWidth/1024||1;if(0==e){if(document.getElementById("pc-quickReply-content").style.display="none",document.getElementById("pc-quickReply-loaderror").style.display="none",document.getElementById("pc-quickReply-loading").style.display="block",!document.getElementById("pc-quickReply-loading-box")){var n=document.createElement("div");n.id="pc-quickReply-loading-box",n.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: column;",n.innerHTML='
    \n \n
    \n
    加载中…
    '),document.getElementById("pc-quickReply-loading").appendChild(n)}}else if(1==e){if(document.getElementById("pc-quickReply-content").style.display="none",document.getElementById("pc-quickReply-loading").style.display="none",document.getElementById("pc-quickReply-loaderror").style.display="block",!document.getElementById("pc-quickReply-loaderror-box")){var a=document.createElement("div");a.id="pc-quickReply-loaderror-box",a.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: column;",a.innerHTML='
    快速回复加载失败
    \n
    重新加载
    '),document.getElementById("pc-quickReply-loaderror").appendChild(a),document.getElementById("pc-quickReply-loaderror-reload").onclick=function(){t.getQuickReplyList()}}}else document.getElementById("pc-quickReply-loading").style.display="none",document.getElementById("pc-quickReply-loaderror").style.display="none",document.getElementById("pc-quickReply-content").style.display="block",this.matchQuickReplyBtn()}},{key:"sendQuickReply",value:function(e,t){var i=this;this.sendLoadingStats=!0,this.setBtnCheckLoading(0,t);Oe(this.jSPlugin,e.fileUrl,(function(e){i.sendLoadingStats=!1,i.setBtnCheckLoading(1,t),e&&200==e.code?i.toastCustom.initToastContent("快捷回复成功"):i.toastCustom.initToastContent("快捷回复失败,请重试"),i.switchFooter("onBell")}),(function(e){console.log(e),i.sendLoadingStats=!1,i.setBtnCheckLoading(1,t),i.toastCustom.initToastContent("快捷回复失败,请重试"),i.switchFooter("onBell")}))}}]),e}(),Ne=function(){function e(t,i){r(this,e),this.jSPlugin=t,this.videoWidth=t.width,this.switchFooter=i,this.toastCustom=new Me(t,!1),this.lockStatus=!1,this.initRemoteUnlock()}return s(e,[{key:"initRemoteUnlock",value:function(){document.getElementById("pc-remoteUnlock-back")?this.madeSlideEvent():this.renderRemoteUnlock()}},{key:"renderRemoteUnlock",value:function(){var e=this,t=this.videoWidth/1024||1,i=document.createElement("div");i.style="width:100%;",i.id="pc-remoteUnlock-box",i.innerHTML='
    \n
    \n
    \n \n 返回\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n 返回\n
    \n
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock")).appendChild(i),document.getElementById("pc-remoteUnlock-back").onclick=function(){e.goback()},this.renderRemoteUnlockSlide()}},{key:"renderRemoteUnlockSlide",value:function(){var e=this.videoWidth/1024||1,t=document.getElementById("pc-remoteUnlock-content"),i=document.createElement("div");i.id="pc-remoteUnlock-content-slide",i.style="width: 100%;display: flex;justify-content: center;cursor: pointer;",i.innerHTML='
    \n
    \n
    右滑开锁
    \n
    \n \n \n \n \n \n \n \n \n \n
    \n
    '),t.appendChild(i),this.madeSlideEvent()}},{key:"getOffsetLeft",value:function(e){var t=0;do{t+=e.offsetLeft,e=e.parentNode}while(e.parentNode);return t}},{key:"madeSlideEvent",value:function(){var e=this.videoWidth/1024||1,t=document.getElementById("".concat(this.jSPlugin.id)),i=this.getOffsetLeft(t),n=document.getElementById("pc-remoteUnlock-slide-box"),a=document.getElementById("pc-remoteUnlock-slide-bgColor"),r=document.getElementById("pc-remoteUnlock-slide-tips"),o=document.getElementById("pc-remoteUnlock-slide-ball"),s=this;o.onmousedown=function(t){var l=(t=t||window.event).offsetX;o.style.transition="",a.style.transition="",document.onmouseup=function(){console.log("--------------onmouseup"),s.lockStatus||(a.style.width="0px",o.style.left=8*e+"px",o.style.transition="left 0.6s linear",a.style.transition="width 0.6s linear"),document.onmouseup=null,document.onmousemove=null},document.onmousemove=function(t){t=t||window.event;console.log("videoDom",i);var c=t.pageX-n.offsetLeft-l-i,d=n.clientWidth-o.clientWidth-8*e;c<=0&&(c=0),c>=d&&(c=d),o.style.left=c+"px",c!=d||s.lockStatus||s.lockStatus||(s.lockStatus=!0,document.getElementById("slide-ball-start").style.display="none",document.getElementById("slide-ball-end").style.display="inline",a.style.width=n.clientWidth+"px",a.style.backgroundColor="#598FFF",n.style.border="0",o.style.backgroundColor="#ffffff",r.textContent="正在开锁",o.onmousedown=null,document.onmousemove=null,s.sendRemoteUnlockApi())}}}},{key:"resetRemoteUnlockSlide",value:function(){var e=document.getElementById("pc-remoteUnlock-box"),t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock"));e&&t&&t.removeChild(e)}},{key:"sendRemoteUnlockApi",value:function(){var e=this;console.log("下发远程开锁");Le(this.jSPlugin,(function(t){t&&200==t.code?e.toastCustom.initToastContent("开锁成功"):e.toastCustom.initToastContent("开锁失败,请重试"),e.goback()}),(function(t){console.log(t),e.toastCustom.initToastContent("开锁失败,请重试"),e.goback()}))}},{key:"goback",value:function(){this.switchFooter("onCall"),this.resetRemoteUnlockSlide()}}]),e}(),Ue={customConfig:{defaultMicro:0,defaultPlay:0,maxTalkTime:0,bellPoster:0,maxBellTime:0},header:{onBell:{color:"#2c2c2c",backgroundColor:"#00000000 linear-gradient(180deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.00) 100%)",activeColor:"#1890FF",autoFocus:0,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"ringStatus",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]},onCall:{color:"#2c2c2c",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"callStatus",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#ffffff",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]}},footer:{onBell:{color:"#ffffff",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"quickReply",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"rejection",part:"left",defaultActive:0,isrender:1,color:"#2C2C2C",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"answer",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-3",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]},onCall:{color:"#2c2c2c",backgroundColor:"rgba(0,0,0,0.8)",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"mute",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"hangUp",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]}}},ze=function(e){var t="";return Object.keys(e).map((function(i,n){t+="".concat(i,":").concat(e[i]).concat(n1&&void 0!==arguments[1])||arguments[1],i=o.themeData,n=i.header,a=i.footer,r=null;if("onCall"==e){console.log("接听"),o.bellStatus="onCall",o.switchFooter("onCall"),a[o.bellStatus].btnList.map((function(e,t){e.isrender&&o.renderFooter(e.iconId,e),"mute"==e.iconId&&(r=e)})),n[o.bellStatus].btnList.map((function(e,t){e.isrender&&o.renderHeader(e.iconId,e)}));var s=document.getElementById("".concat(o.jSPlugin.id,"-header-onBell"));s&&s.parentElement.removeChild(s),1==o.themeData.customConfig.bellPoster&&document.getElementById("bellring-icon")&&document.getElementById("".concat(o.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),0==o.themeData.customConfig.defaultMicro&&r?o.muteCommon(r):o.setDecoderState({mute:!1},r.backgroundColor),o.removeBellRing()}else console.log("响铃"),o.bellStatus="onBell",o.jSPlugin.Theme.changeTheme(o.themeData,t)})),this.jSPlugin=t,this.videoWidth=t.width,this.videoHeight=t.height,this.themeData=i,this.setDecoderState=n,this.decoderState=a,this.isNeedRenderHeader=!1,this.isNeedRenderFooter=!1,this.autoFocus=0,this.autoFocusTimer=null,this.bellStatus="onBell",this.recordTimer=null,this.nextRate=1,this.themeInited=!1,this.inited=!1,this.activeThemeStatus=!0,this.activeThemeStatusTxt="模板未激活",this.toastCustom=new Me(t,!1)}return s(e,[{key:"initBellRing",value:function(){var e=this,t=this.decoderState.state,i=t.play,n=t.isEditing;t.rejection;var a=this.videoWidth/1024;this.maxBellTime=1e3*this.themeData.customConfig.maxBellTime;var r=document.getElementById("bellring"),o=document.getElementById("bellring-audio");if(!r&&!o){if(this.jSPlugin.isNeedBellRing){var s=document.createElement("div");s.id="bellring",s.innerHTML='
    \n \n
    ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(s)}if(1!=this.themeData.customConfig.bellPoster||n)document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"));else{var l=(this.videoHeight-180*a)/2,c=document.createElement("div");c.id="bellring-icon",c.style="position: absolute;pointer-events: none;background: none;width: 100%;\n position: absolute;top: ".concat(l,"px;display: flex;align-items: center;justify-content: center;"),c.innerHTML='
    \n
    \n \n icon/响铃\n \n \n \n \n \n
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(c),i&&"onBell"==this.bellStatus&&this.jSPlugin.pause()}setTimeout((function(){var t=e.decoderState.state,i=t.isEditing,n=t.rejection;"onBell"!=e.bellStatus||n||(e.removeBellRing(),i||e.answerOvertime())}),this.maxBellTime)}}},{key:"removeBellRing",value:function(){document.getElementById("bellring")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring")),document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"))}},{key:"matchBtn",value:function(e,t){var i=this,n=this.themeData,a=n.header,r=n.footer,o=this.decoderState.state,s=o.mute,l=o.rejection,c={title:"",id:"",domString:"",color:"#FFFFFF",activeColor:"#FFFFFF",onclick:function(){},onmoveleft:function(){},onmoveright:function(){},onremove:function(){}};-1===a[this.bellStatus].btnList.findIndex((function(t){return t.iconId===e}))?(c.color=r[this.bellStatus].color,c.backgroundColor=r[this.bellStatus].backgroundColor,c.activeColor=r[this.bellStatus].activeColor):(c.color=a[this.bellStatus].color,c.backgroundColor=a[this.bellStatus].backgroundColor,c.activeColor=a[this.bellStatus].activeColor);var d=this.videoWidth/6;this.videoWidth;var u=this.videoWidth/1024||1;switch(e){case"ringStatus":return c.title=this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,c.id=e,c.domString='').concat(this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,""),c.onclick=function(){},c;case"deviceCategory":return c.title="设备名称",c.id=e,c.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),c.onclick=function(){},c;case"callStatus":return c.title="通话中",c.id=e,c.domString='通话中'),c.onclick=function(){},c;case"deviceCategory":return c.title="设备名称",c.id=e,c.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),c.onclick=function(){},c;case"rejection":return c.title="拒绝",c.id=e,c.domString='
    \n
    \n \n 拒绝\n \n \n \n \n \n
    \n
    拒绝
    \n
    '),c.onclick=function(){var e=i.decoderState.state,t=e.play,n=e.isEditing,a=e.rejection;if(n||a)return!1;console.log("拒绝"),t&&i.jSPlugin.stop(),i.removeBellRing(),i.setDecoderState({play:!1,rejection:!0}),i.rejectionStatusDispose(),"function"==typeof i.jSPlugin.hangUpCallback&&i.jSPlugin.hangUpCallback("rejection")},c;case"quickReply":return c.title="快捷回复",c.id=e,c.domString='
    \n
    \n \n 快捷回复\n \n \n \n \n \n
    \n
    快捷回复
    \n
    '),c.onclick=function(){if(i.decoderState.state.rejection)return!1;console.log("快捷回复"),i.switchFooter("quickReply"),i.quickReplyEle=new je(i.jSPlugin,i.switchFooter)},c;case"answer":return c.title="接听",c.id=e,c.domString='
    \n
    \n \n 接听\n \n \n \n \n \n
    \n
    接听
    \n
    '),c.onclick=function(){var e=i.decoderState.state,n=e.play,o=e.isEditing,s=e.talk,l=e.sound,c=e.rejection;if(o||c)return!1;console.log("接听"),i.jSPlugin.pluginStatus.loadingClear(),n||(i.jSPlugin.pluginStatus.loadingStart(i.jSPlugin.id),i.jSPlugin.pluginStatus.loadingSetText({text:"视频加载中"}),i.jSPlugin.play(),i.setDecoderState({play:!n})),s||1!=i.themeData.customConfig.defaultMicro||(i.setDecoderState({talk:!0,mute:!1}),l&&i.jSPlugin.closeSound(),i.jSPlugin.Talk.startTalk()),i.setDecoderState({sound:!1}),i.bellStatus="onCall",i.switchFooter("onCall"),r[i.bellStatus].btnList.map((function(e,t){e.isrender&&i.renderFooter(e.iconId,e)})),a[i.bellStatus].btnList.map((function(e,t){e.isrender&&i.renderHeader(e.iconId,e)}));var d=document.getElementById("".concat(i.jSPlugin.id,"-header-onBell"));d&&d.parentElement.removeChild(d),1==i.themeData.customConfig.bellPoster&&(document.getElementById("bellring-icon")&&document.getElementById("".concat(i.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),i.jSPlugin.setPoster("")),0==i.themeData.customConfig.defaultMicro&&(i.muteCommon(t),i.jSPlugin.openSound(),i.setDecoderState({sound:!0})),i.removeBellRing(),i.maxTalkTime=1e3*i.themeData.customConfig.maxTalkTime*60;var u=i;setTimeout((function(){s&&(console.log("结束对讲"),u.setDecoderState({talk:!1}),u.jSPlugin.Talk.stopTalk()),n&&(u.jSPlugin.stop(),u.setDecoderState({play:!n})),i.rejectionStatusDispose(),i.remoteUnlockEle&&i.remoteUnlockEle.goback(),"function"==typeof i.jSPlugin.hangUpCallback&&i.jSPlugin.hangUpCallback("hangUp")}),i.maxTalkTime)},c;case"remoteUnlock":return c.title="远程开锁",c.id=e,c.domString='
    \n
    \n \n 开锁\n \n \n \n \n \n
    \n
    远程开锁
    \n
    '),c.onclick=function(){var e=i.decoderState.state,t=e.isEditing,n=e.rejection;if(t||"onBell"==i.bellStatus||n)return!1;console.log("远程开锁"),i.switchFooter("remoteUnlock"),i.remoteUnlockEle=new Ne(i.jSPlugin,i.switchFooter)},c;case"mute":return c.title="静音",c.id=e,c.domString='
    \n
    \n \n 静音\n \n \n \n \n \n
    \n
    静音
    \n
    '),c.onclick=function(){var e=i.decoderState.state,n=e.talk,a=e.sound;if(e.play,e.rejection)return!1;console.log("静音"),n?(console.log("结束对讲"),i.setDecoderState({talk:!1,mute:!0},t.backgroundColor),i.jSPlugin.Talk.stopTalk(),i.jSPlugin.openSound(),i.setDecoderState({sound:!0})):(console.log("开始对讲"),i.setDecoderState({talk:!0,mute:!1},t.backgroundColor),a&&(i.jSPlugin.closeSound(),i.setDecoderState({sound:!1})),i.jSPlugin.Talk.startTalk())},c;case"hangUp":return c.title="挂断",c.id=e,c.domString='
    \n
    \n \n 挂断\n \n \n \n \n \n
    \n
    挂断
    \n
    '),c.onclick=function(){var e=i.decoderState.state,t=e.talk,n=e.play,a=e.sound;if(e.rejection)return!1;t&&(console.log("结束对讲"),i.setDecoderState({talk:!1}),i.jSPlugin.Talk.stopTalk()),n&&(i.jSPlugin.stop(),i.setDecoderState({play:!n})),a&&(i.jSPlugin.closeSound(),i.setDecoderState({sound:!1})),(n||t)&&(console.log("挂断"),i.removeBellRing(),i.rejectionStatusDispose(),"function"==typeof i.jSPlugin.hangUpCallback&&i.jSPlugin.hangUpCallback("hangUp"))},c;default:return c}}},{key:"answerOvertime",value:function(){this.toastCustom.initToastContent("应答超时");var e=this.decoderState.state.play;console.log("应答超时"),e&&this.jSPlugin.stop(),this.setDecoderState({play:!1,rejection:!0}),this.rejectionStatusDispose(),this.switchFooter("onBell"),"function"==typeof this.jSPlugin.hangUpCallback&&this.jSPlugin.hangUpCallback("rejection")}},{key:"rejectionStatusDispose",value:function(){var e=this,t=this.themeData.footer,i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),a=document.getElementById("header-".concat(this.bellStatus,"-ringStatus"));"onBell"==this.bellStatus?(i.innerHTML="",i.style.color="#ffffff"):(n.innerHTML="",n.style.color="#ffffff"),console.log("rejectionStatusDispose"),this.setDecoderState({rejection:!0}),t[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderFooter(t.iconId,t)})),a.innerText="通话已结束",this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"通话已结束",color:"white",isMobile:!1,type:2})}},{key:"userNoDevice",value:function(){var e=this;this.removeBellRing(),this.setDecoderState({rejection:!0});var t=this.themeData.footer,i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));"onBell"==this.bellStatus?(i.innerHTML="",i.style.color="#ffffff"):(n.innerHTML="",n.style.color="#ffffff"),console.log("userNoDevice"),this.setDecoderState({rejection:!0}),t[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderFooter(t.iconId,t)})),this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"该用户不拥有该设备",color:"white",isMobile:!1,type:2})}},{key:"renderHeader",value:function(e,t){var i=this,n=this.videoWidth/1024||1,a=this.matchBtn(e,t);if(document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content"))){var r=document.createElement("span");r.innerHTML="".concat(a.domString),document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content")).appendChild(r)}else{var o=document.createElement("div");o.id="".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus),o.style="max-width:50%;position:relative;",o.innerHTML='\n ').concat(a.domString,"\n "),o.onclick=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;a.onclick(e)},document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[0].appendChild(o)}}},{key:"renderFooter",value:function(e,t){var i=this,n=this.decoderState.state.mute;if(console.log("-------------renderFooter"),"remoteUnlock"==e&&this.jSPlugin.capacity&&(!this.jSPlugin.capacity.support_unlock||0==this.jSPlugin.capacity.support_unlock))return!1;var a=this.matchBtn(e,t),r=this.videoWidth/6,o=document.createElement("div");o.className="theme-icon-item",this.jSPlugin.isWebConsole?o.style="padding:0 ".concat(.1*r,"px;"):o.style="padding:0 ".concat(.1*r,"px;cursor: pointer;"),o.innerHTML="".concat('')+'
    ')).concat(a.domString,"
    ")+"
    ",o.onclick=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;a.onclick(e)},a.onmouseenter&&(o.onmouseenter=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;a.onmouseenter(e)}),a.onmouseleave&&(o.onmouseleave=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;a.onmouseleave(e)});var s=this.videoWidth/597,l=document.createElement("span");l.className="icon-move left",l.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),l.onclick=function(){i.editIcon(a.id,"left","footer")},o.appendChild(l);var c=document.createElement("span");if(c.className="icon-move right",c.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),c.onclick=function(){i.editIcon(a.id,"right","footer")},o.appendChild(c),"answer"==e||"rejection"==e||"hangUp"==e);else{var d=document.createElement("span");d.className="icon-move close",d.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),d.onclick=function(){i.editIcon(a.id,"delete","footer")},o.appendChild(d)}"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).appendChild(o):document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).appendChild(o),this.decoderState.state.isEditing&&"mute"==e&&"onCall"==this.bellStatus&&(0!=this.themeData.customConfig.defaultMicro||n?this.setDecoderState({mute:!1},t.backgroundColor):this.setDecoderState({mute:!0},t.backgroundColor))}},{key:"switchFooter",value:function(e){var t={};switch(this.themeData&&(t=this.themeData.footer),e){case"onBell":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply")).style.display="none"),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"))?"none"==document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex"):document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex";break;case"onCall":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display="flex",this.themeData&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=t[this.bellStatus].color);break;case"quickReply":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReply")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none";break;case"remoteUnlock":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-remoteUnlock")).style.display="flex"}}},{key:"initThemeData",value:function(){var e=this;console.log("-------------initThemeData");var t=this.decoderState.state.isEditing,i=this.themeData,n=i.header,a=i.footer,r=this.jSPlugin.id,o=this.videoWidth/1024;if(this.isNeedRenderHeader=k.findIndex(n[this.bellStatus].btnList,(function(e){return e.isrender>0}))>=0,this.isNeedRenderFooter=k.findIndex(a[this.bellStatus].btnList,(function(e){return e.isrender>0}))>=0,this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var s=document.createElement("div");s.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),s.setAttribute("class","header-controls"),s.innerHTML="
    "),console.log(this.jSPlugin.height);var l=.2*this.jSPlugin.height+"px",c={height:l,display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#FFFFFF",width:"100%",position:"relative","margin-bottom":"-"+l,"align-items":"center",background:"transparent linear-gradient(180deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.00) 100%)"};s.style=ze(c),document.getElementById("".concat(r,"-wrap")).insertBefore(s,document.getElementById(r));var d=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(d)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));var u=.3*this.jSPlugin.height;if(this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-".concat(u,"px"),"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n '):document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n '));else{var h=document.createElement("div");h.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),h.setAttribute("class","ez-iframe-footer-container");var f={"min-height":u+"px","max-height":u+"px",position:"relative","margin-top":"-"+u+"px",display:"flex","flex-wrap":"wrap","justify-content":"space-between","z-index":999,top:0,color:"#FFFFFF",width:"100%","align-items":"center","background-image":"linear-gradient(180deg, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.60) 100%)","font-size":24*o+"px"};h.style=ze(f),h.innerHTML='\n \n \n \n \n '),g(h,document.getElementById(r))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));if(this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=n[this.bellStatus].backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=n[this.bellStatus].color,n[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderHeader(t.iconId,t)}))),this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=a[this.bellStatus].backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=a[this.bellStatus].color,a[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderFooter(t.iconId,t)}))),1==this.themeData.customConfig.bellPoster&&!t){this.jSPlugin.poster="https://resource.eziot.com/group1/M00/00/B8/CtwQEmPbGh2AVJB-ABDcYtyw5gk899.svg";var x=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(x),e.jSPlugin.setPoster(e.jSPlugin.poster))}),50)}this.activeThemeStatus&&(this.initBellRing(),window.addEventListener("click",this.autoPlayRing)),this.inited=!0,this.getCallDeviceInfo()}},{key:"renderThemeData",value:function(){var e=this,t=this.decoderState.state.isEditing,i=this.themeData,n=i.header,a=i.footer;if(this.isNeedRenderHeader&&n&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=n[this.bellStatus].backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=n[this.bellStatus].color.replace("-diy",""),n[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.setDecoderState(l({},t.iconId,e.decoderState.state[t.iconId]))}))),this.isNeedRenderFooter&&a)document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=a[this.bellStatus].backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=a[this.bellStatus].color.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=a[this.bellStatus].color.replace("-diy",""),a[this.bellStatus].btnList.map((function(i,n){if(i.isrender&&e.setDecoderState(l({},i.iconId,e.decoderState.state[i.iconId])),0==n&&!e.themeInited&&e.activeThemeStatus)var a=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(a),1!=e.themeData.customConfig.bellPoster||t?e.jSPlugin.play():e.jSPlugin.pluginStatus.loadingClear(),e.themeInited=!0)}),50)})),-1!==this.jSPlugin.url.indexOf("hd.live")&&this.setDecoderState({hd:!0}),this.themeData.autoFocus>0&&(this.autoFocus=parseInt(this.themeData.autoFocus),this.startAutoFocus(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).addEventListener("click",(function(){e.stopAutoFocus()}))),this.setDecoderState({cloudRec:"cloud.rec"===P(this.jSPlugin.url).type,rec:"rec"===P(this.jSPlugin.url).type,type:P(this.jSPlugin.url).type});else if(!this.themeInited&&this.activeThemeStatus)var r=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(r),e.themeData&&e.themeData.customConfig&&1==e.themeData.customConfig.bellPoster&&!t?e.jSPlugin.pluginStatus.loadingClear():e.jSPlugin.play(),e.themeInited=!0)}),50);var o=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(o),e.jSPlugin.reSize(e.jSPlugin.params.width,e.jSPlugin.params.height))}),50)}},{key:"setThemeData",value:function(e,t){this.themeData=e,"onCall"==t&&(this.bellStatus="onCall")}},{key:"startAutoFocus",value:function(){var e=this,t=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(e.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*t)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.startAutoFocus()}},{key:"editIcon",value:function(e,t,i){console.log("编辑组件",e,t,i);var n=this.themeData;console.log("themeData",this.themeData);var a=this.themeData[i][this.bellStatus].btnList,r=k.findIndex(a,(function(t){return t.iconId===e})),o=a[r];switch(t){case"delete":a[r].isrender=0;break;case"right":for(var s=-1,l=r+1;l=0;d--)if(a[d].part===a[r].part&&1==a[d].isrender){c=d;break}-1!==c&&(a[r]=a[c],a[c]=o)}console.log("new btnList",a),n[i][this.bellStatus].btnList=a,this.jSPlugin.Theme.changeTheme(n)}},{key:"countTime",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var n=document.createElement("div");n.id=this.jSPlugin.id+"time-area",n.className="time-area",n.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(n)}if(this.countTimer&&clearInterval(this.countTimer),"add"===e){var a=t;document.getElementById(i.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++a,document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML=function(e){var t=parseInt(e),i=0,n=0,a="00",r="00",o="00";t>59&&(i=parseInt(t/60),t=parseInt(t%60),i>59&&(n=parseInt(i/60),i=parseInt(i%60)));return a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),o=parseInt(n)>9?parseInt(n):"0"+parseInt(n),n>0?o+":"+r+":"+a:i>0?r+":"+a:"00:"+a}(a)}),1e3)}else"destroy"===e&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(i.jSPlugin.id+"time-area")&&(document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(i.jSPlugin.id+"time-area").style.display="none"))}},{key:"editStart",value:function(e){console.log("----------editStart2");var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));document.getElementById("".concat(this.jSPlugin.id,"-headControl")),t&&t.setAttribute("class","footer-controls themeEditing"),i&&i.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(e){console.log("----------editEnd2");var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-headControl")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));i&&i.setAttribute("class","header-controls"),t&&t.setAttribute("class","footer-controls"),n&&n.setAttribute("class","footer-controls")}},{key:"fetchThemeData",value:function(e){var t=this;Ie(this.jSPlugin,e,(function(e){0==e.meta.code&&e.data?(t.activeThemeStatus=!0,t.themeData=e.data,e.data.header&&(t.themeData.header=e.data.header,t.themeData.header[t.bellStatus].btnList=t.themeData.header[t.bellStatus].btnList.sort((function(e,t){return e.btnKey.split("-")[3]-t.btnKey.split("-")[3]}))),e.data.footer&&(t.themeData.footer=e.data.footer,t.themeData.footer[t.bellStatus].btnList=t.themeData.footer[t.bellStatus].btnList.sort((function(e,t){return e.btnKey.split("-")[3]-t.btnKey.split("-")[3]}))),t.jSPlugin.capacity?(t.initThemeData(),t.renderThemeData()):setTimeout((function(){t.initThemeData(),t.renderThemeData()}),300)):(t.activeThemeStatus=!1,t.jSPlugin.pluginStatus.loadingClear(),t.setDecoderState({rejection:!0}),"111021"==e.meta.code?(t.jSPlugin.pluginStatus.loadingSetText({text:"无效的模板id",color:"#fff"}),t.activeThemeStatusTxt="无效的模板id"):"111023"==e.meta.code?(t.jSPlugin.pluginStatus.loadingSetText({text:"您的试用特权已到期,需前往轻应用控制台购买后使用。",color:"#fff"}),t.activeThemeStatusTxt="试用特权已到期"):(t.jSPlugin.pluginStatus.loadingSetText({text:"模板未激活,请先在开放平台轻应用控制台购买模板",color:"#fff"}),t.activeThemeStatusTxt="模板未激活"),t.themeData=Ue,t.initThemeData(),t.renderThemeData())}),(function(){t.renderThemeData()}))}},{key:"getCallDeviceInfo",value:function(){var e=this;this.videoWidth,De({accessToken:this.jSPlugin.accessToken,deviceSerial:P(this.jSPlugin.url).deviceSerial}).then((function(t){console.log("---------getCallDeviceInfo"),e.deviceInfoData=t.data,t.data.isEncrypt&&setTimeout((function(){e.jSPlugin.pluginStatus.loadingClear(),e.jSPlugin.pluginStatus.loadingSetText({text:"视频已加密",color:"#fff"})}),500),document.getElementById("header-".concat(e.bellStatus,"-deviceCategory"))&&(document.getElementById("header-".concat(e.bellStatus,"-deviceCategory")).innerText=""+t.data.deviceName)})).catch((function(t){20018!=t.code||e.jSPlugin.isWebConsole||e.userNoDevice(),console.log("获取设备信息失败",t)}))}},{key:"setHeaderText",value:function(e){var t=this.videoWidth/1024||1;document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content"))&&(document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content")).innerHTML='').concat(e,'').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"",""))}}]),e}(),Ve=function(){function e(t,i){r(this,e),this.jSPlugin=t,this.heightPop=i||366,this.initPopupCustom()}return s(e,[{key:"initPopupCustom",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom"))?document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom")).style.display="flex":this.randerPopup()}},{key:"randerPopup",value:function(){var e=this,t=document.documentElement.clientWidth/375||1,i=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(i),i.innerHTML="@keyframes slideContentUp {0% {bottom: -".concat(366*t,"px;}\n 25% {bottom: -").concat(244*t,"px;}\n 50% {bottom: -").concat(122*t,"px;}\n 100% {bottom:0;}} .open-popup{animation:slideContentUp 0.3s 1 linear; -webkit-animation: slideContentUp 0.3s 1 linear;}");var n=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),a=document.createElement("div");a.style="display:flex;",a.id="".concat(this.jSPlugin.id,"-wrap-popup-custom"),a.innerHTML='
    \n
    \n
    \n
    \n
    \n \n icon/close\n \n \n \n \n \n \n \n
    \n \n
    \n
    \n
    \n '),n.appendChild(a),document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom-mask")).onclick=function(){e.closePopupCustom()},document.getElementById("".concat(this.jSPlugin.id,"-popup-board-close")).onclick=function(){e.closePopupCustom()}}},{key:"closePopupCustom",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){})();var e=document.getElementById("".concat(this.jSPlugin.id,"-wrap")),t=document.getElementById("".concat(this.jSPlugin.id,"-wrap-popup-custom"));e&&t&&e.removeChild(t)}},{key:"initPopupContent",value:function(e,t){document.getElementById("popup-board-title-content").innerText=e||"",t&&document.getElementById("".concat(this.jSPlugin.id,"-popup-board-content")).appendChild(t)}}]),e}(),Ze=function(){function e(t,i,n){r(this,e),this.jSPlugin=t,this.videoWidth=n,this.switchFooter=i,this.toastCustom=new Me(t,!0),this.sendLoadingStats=!1,this.quickReplyList=["你好,请将快递放在门口","你好,稍等","你好,请将快递放入小区快递柜","你好,请将外卖放在门口"],this.popupCustom=new Ve(t,366),document.getElementById("mobile-quickReply-list")||(this.popupCustom.initPopupContent("快捷回复",this.renderQuickReply()),this.initQuickReply())}return s(e,[{key:"initQuickReply",value:function(){document.getElementById("mobile-quickReply-list-item-0")||this.getQuickReplyList()}},{key:"renderQuickReply",value:function(){document.documentElement.clientWidth;var e=document.createElement("div");return e.style="width:100%;",e.id="mobile-quickReply-list",e.innerHTML='
    \n \n ',e}},{key:"matchQuickReplyBtn",value:function(){var e=this,t=this.videoWidth/375||1,i=document.getElementById("mobile-quickReply-content");this.quickReplyList&&this.quickReplyList.length>0&&this.quickReplyList.forEach((function(n,a){var r=document.createElement("div");r.id="mobile-quickReply-list-item-".concat(a),r.style="margin: ".concat(14*t,"px 0;\n padding: ").concat(12*t,"px ").concat(15*t,"px;min-height: ").concat(50*t,"px;width:100%;\n background: #ffffff;border-radius: ").concat(25*t,"px;display: flex;align-items: center;\n box-sizing: border-box;font-size:").concat(16*t,"px;color: #2c2c2c;"),r.innerHTML='\n \n icon/快捷回复播放\n \n \n \n \n \n ').concat(n.voiceName,""),r.onclick=function(){console.log("item:"+n),e.sendLoadingStats||(e.setBtnCheckStatus(a),e.sendQuickReply(n))},i.appendChild(r)}))}},{key:"setBtnCheckStatus",value:function(e){var t=this,i="";this.quickReplyList.forEach((function(n,a){i=document.getElementById("mobile-quickReply-list-item-".concat(a)),a==e?(i.style.background="#F4F6FC",i.style.color="#648FFC",t.setBtnCheckLoding(0,a)):(i.style.background="#ffffff",i.style.color="#2c2c2c")}))}},{key:"setBtnCheckLoding",value:function(e,t){console.log(t);var i=this.videoWidth/375||1;if(t>-1){var n=document.getElementById("mobile-quickReply-list-item-".concat(t)),a=document.getElementById("mobile-quickReply-name-".concat(t)),r=document.getElementById("mobile-quickReply-icon-".concat(t));if(1==e){if(document.getElementById("mobile-quickReply-icon-loading-".concat(t))&&a){var o=document.createElement("span");o.id="mobile-quickReply-icon-".concat(t),o.style="height:".concat(24*i,"px;"),o.innerHTML='\n \n icon/快捷回复播放\n \n \n \n \n \n '),n.insertBefore(o,a)}}else if(r&&a){n.removeChild(r);var s=document.createElement("span");s.id="mobile-quickReply-icon-loading-".concat(t),s.style="height:".concat(20*i,"px;width: ").concat(24*i,"px;"),s.innerHTML=''),n.insertBefore(s,a)}}}},{key:"getQuickReplyList",value:function(){var e=this;console.log("getQuickReplyList"),this.madeLoadingDom(0);Be(this.jSPlugin,(function(t){if(t&&200==t.code){var i=t.data||[],n=[];t.data.forEach((function(e,t){n=e.voiceName.split("_"),i[t].voiceName=n[1]})),e.quickReplyList=i,setTimeout((function(){e.madeLoadingDom(2)}),500)}else e.madeLoadingDom(1)}),(function(t){console.log(t),e.madeLoadingDom(1)}))}},{key:"madeLoadingDom",value:function(e){var t=this,i=this.videoWidth/375||1;if(0==e){if(document.getElementById("mobile-quickReply-content").style.display="none",document.getElementById("mobile-quickReply-loaderror").style.display="none",document.getElementById("mobile-quickReply-loading").style.display="block",!document.getElementById("mobile-quickReply-loading-box")){var n=document.createElement("div");n.id="mobile-quickReply-loading-box",n.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: row;",n.innerHTML='
    \n \n
    \n
    正在加载,请稍候
    '),document.getElementById("mobile-quickReply-loading").appendChild(n)}}else if(1==e){if(document.getElementById("mobile-quickReply-content").style.display="none",document.getElementById("mobile-quickReply-loading").style.display="none",document.getElementById("mobile-quickReply-loaderror").style.display="block",!document.getElementById("mobile-quickReply-loaderror-box")){var a=document.createElement("div");a.id="mobile-quickReply-loaderror-box",a.style="width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: column;",a.innerHTML='
    \n \n
    \n
    \n 加载失败 \n 点击重试\n
    '),document.getElementById("mobile-quickReply-loaderror").appendChild(a),document.getElementById("mobile-quickReply-loaderror-reload").onclick=function(){t.getQuickReplyList()}}}else document.getElementById("mobile-quickReply-loading").style.display="none",document.getElementById("mobile-quickReply-loaderror").style.display="none",document.getElementById("mobile-quickReply-content").style.display="block",this.matchQuickReplyBtn()}},{key:"sendQuickReply",value:function(e){var t=this;this.sendLoadingStats=!0;Oe(this.jSPlugin,e.fileUrl,(function(e){t.sendLoadingStats=!1,e&&200==e.code?t.toastCustom.initToastContent("快捷回复成功"):t.toastCustom.initToastContent("快捷回复失败,请重试"),t.popupCustom.closePopupCustom()}),(function(e){console.log(e),t.sendLoadingStats=!1,t.toastCustom.initToastContent("快捷回复失败,请重试"),t.popupCustom.closePopupCustom()}))}},{key:"closeQuickReplyEle",value:function(){this.popupCustom.closePopupCustom()}}]),e}(),We=function(){function e(t,i,n){r(this,e),this.jSPlugin=t,this.videoWidth=n,this.switchFooter=i,this.toastCustom=new Me(t,!0),this.lockStatus=!1,this.popupCustom=new Ve(t,265),this.popupCustom.initPopupContent("远程开锁",this.renderRemoteUnlock()),this.renderRemoteUnlockSlide()}return s(e,[{key:"initRemoteUnlock",value:function(){document.getElementById("mobile-remoteUnlock-content")?this.madeSlideEvent():this.renderRemoteUnlock()}},{key:"renderRemoteUnlock",value:function(){var e=this.videoWidth/1024||1,t=document.createElement("div");return t.style="width:100%;",t.id="mobile-remoteUnlock-box",t.innerHTML='
    \n
    \n
    '),t}},{key:"renderRemoteUnlockSlide",value:function(){var e=this.videoWidth/375||1,t=document.getElementById("mobile-remoteUnlock-content"),i=document.createElement("div");i.id="mobile-remoteUnlock-content-slide",i.style="width: 100%;display: flex;justify-content: center;padding: 0 ".concat(15*e,"px"),i.innerHTML='
    \n
    \n
    右滑开锁
    \n
    \n \n icon/箭头向右\n \n \n \n \n \n \n
    \n
    '),t.appendChild(i),this.madeSlideEvent()}},{key:"madeSlideEvent",value:function(){var e=this.videoWidth/375||1,t=document.getElementById("mobile-remoteUnlock-slide-box"),i=document.getElementById("mobile-remoteUnlock-slide-bgColor"),n=document.getElementById("mobile-remoteUnlock-slide-tips"),a=document.getElementById("mobile-remoteUnlock-slide-ball"),r=this;a.ontouchstart=function(o){console.log("ontouchstart");var s=(o=o||window.event).touches[0].pageX;a.style.transition="",i.style.transition="",document.ontouchmove=function(o){var l=(o=o||window.event).touches[0].pageX-t.offsetLeft-s,c=t.clientWidth-a.clientWidth-8*e;l<=0&&(l=0),l>=c&&(l=c),a.style.left=l+"px",l!=c||r.lockStatus||(r.lockStatus=!0,document.getElementById("slide-ball-start").style.display="none",document.getElementById("slide-ball-end").style.display="inline",i.style.width=t.clientWidth+"px",i.style.backgroundColor="#598FFF",t.style.border="0",a.style.backgroundColor="#ffffff",n.textContent="正在开锁",n.style.color="#ffffff",a.ontouchstart=null,r.sendRemoteUnlockApi())},document.ontouchend=function(){r.lockStatus||(i.style.width="0px",a.style.left=8*e+"px",a.style.transition="left 0.6s linear",i.style.transition="width 0.6s linear"),document.ontouchend=null,document.ontouchmove=null}}}},{key:"resetRemoteUnlockSlide",value:function(){var e=this.videoWidth/1024||1;this.lockStatus=!1;var t=document.getElementById("mobile-remoteUnlock-slide-box"),i=document.getElementById("mobile-remoteUnlock-slide-bgColor"),n=document.getElementById("mobile-remoteUnlock-slide-tips"),a=document.getElementById("mobile-remoteUnlock-slide-ball");i.style.width="0px",a.style.left=8*e+"px",n.textContent="右滑开锁",n.style.color="#666666",document.getElementById("slide-ball-start").style.display="inline",document.getElementById("slide-ball-end").style.display="none",i.style.backgroundColor="#FFFFFF",t.style.border="1px solid rgba(255,255,255,1)",a.style.backgroundColor="#598FFF"}},{key:"sendRemoteUnlockApi",value:function(){var e=this;console.log("下发远程开锁");Le(this.jSPlugin,(function(t){t&&200==t.code?e.toastCustom.initToastContent("开锁成功"):e.toastCustom.initToastContent("开锁失败,请重试"),e.popupCustom.closePopupCustom()}),(function(t){console.log(t),e.toastCustom.initToastContent("开锁失败,请重试"),e.popupCustom.closePopupCustom()}))}},{key:"closeRemoteUnlock",value:function(){this.popupCustom.closePopupCustom()}}]),e}(),Ge={customConfig:{defaultMicro:0,defaultPlay:0,maxTalkTime:0,bellPoster:0,maxBellTime:0},header:{onBell:{color:"#2c2c2c",backgroundColor:"#00000000 linear-gradient(180deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.00) 100%)",activeColor:"#1890FF",autoFocus:0,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"ringStatus",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]},onCall:{color:"#2c2c2c",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-0",iconId:"callStatus",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-header-1",iconId:"deviceCategory",part:"left",defaultActive:0,isrender:1,color:"#2c2c2c",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793"}]}},footer:{onBell:{color:"#2c2c2c",backgroundColor:"#00000000",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"quickReply",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"rejection",part:"left",defaultActive:0,isrender:1,color:"#2C2C2C",themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"answer",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-3",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]},onCall:{color:"#2c2c2c",backgroundColor:"#00000080",activeColor:"#1890FF",autoFocus:5,btnList:[{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-0",iconId:"mute",part:"left",defaultActive:1,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-1",iconId:"hangUp",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"},{btnKey:"c1cbc1d4e86d49a0981f54beea95280a-4412dc7a9f7b471a9a3e9a8fb625c793-footer-2",iconId:"remoteUnlock",part:"left",defaultActive:0,isrender:1,themeId:"4412dc7a9f7b471a9a3e9a8fb625c793",backgroundColor:"#cccccc"}]}}},Ye=function(e){var t="";return Object.keys(e).map((function(i,n){t+="".concat(i,":").concat(e[i]).concat(n1&&void 0!==arguments[1])||arguments[1],i=o.themeData,n=i.header,a=i.footer,r=null;if("onCall"==e){console.log("接听"),o.bellStatus="onCall",o.switchFooter("onCall"),a[o.bellStatus].btnList.map((function(e,t){e.isrender&&o.renderFooter(e.iconId,e),"mute"==e.iconId&&(r=e)})),n[o.bellStatus].btnList.map((function(e,t){e.isrender&&o.renderHeader(e.iconId,e)}));var s=document.getElementById("".concat(o.jSPlugin.id,"-header-onBell"));s&&s.parentElement.removeChild(s),1==o.themeData.customConfig.bellPoster&&document.getElementById("bellring-icon")&&document.getElementById("".concat(o.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),0==o.themeData.customConfig.defaultMicro&&r?o.muteCommon(r):o.setDecoderState({mute:!1},r.backgroundColor),o.removeBellRing(),o.miniRecCloseClick()}else console.log("响铃"),o.bellStatus="onBell",o.jSPlugin.Theme.changeTheme(o.themeData,t)})),l(this,"muteCommon",(function(e){var t=o.decoderState.state,i=t.talk,n=t.sound;i?(console.log("结束对讲"),o.setDecoderState({talk:!1,mute:!0},e.backgroundColor),o.jSPlugin.Talk.stopTalk(),n||o.jSPlugin.openSound(),o.setDecoderState({sound:!0})):(o.setDecoderState({talk:!1,mute:!0},e.backgroundColor),n||o.jSPlugin.openSound(),o.setDecoderState({sound:!0}))})),l(this,"autoPlayRing",(function(){console.log("autoPlayRing");var e=document.getElementById("bellring-audio");e&&(e.muted=!1,e.src="https://resource.eziot.com/group2/M00/00/8F/CtwQFmPbWnOAGuT5AAHZihhCJEM230.mp3",e.paused&&e.play()),o.checkIsAppleDevice()||!1?window.removeEventListener("touchstart",o.autoPlayRing):window.removeEventListener("click",o.autoPlayRing)})),this.jSPlugin=t,this.videoWidth=t.width,this.videoHeight=t.height,this.themeData=i,this.setDecoderState=n,this.decoderState=a,this.isNeedRenderHeader=!1,this.isNeedRenderFooter=!1,this.autoFocus=0,this.autoFocusTimer=null,this.bellStatus="onBell",this.recordTimer=null,this.nextRate=1,this.themeInited=!1,this.inited=!1,this.miniRecStatus="rec",this.activeThemeStatus=!0,this.activeThemeStatusTxt="模板未激活",this.miniRecNum=0,this.toastCustom=new Me(t,!0)}return s(e,[{key:"initBellRing",value:function(){var e=this,t=this.decoderState.state,i=t.play,n=t.isEditing,a=this.videoWidth,r=a/375;this.maxBellTime=1e3*this.themeData.customConfig.maxBellTime;var o=document.getElementById("bellring"),s=document.getElementById("bellring-audio");if(!o&&!s){if(this.jSPlugin.isNeedBellRing){var l=document.createElement("div");l.id="bellring",l.innerHTML='
    \n \n
    ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(l)}if(1!=this.themeData.customConfig.bellPoster||n)document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"));else{var c=1.8*a,d=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(d=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+.1*c+6);var u=d+(this.videoHeight-130*r)/2,h=document.createElement("div");h.id="bellring-icon",h.style="position: absolute;pointer-events: none;background: none;width: 100%;\n position: absolute;top: ".concat(u,"px;display: flex;align-items: center;justify-content: center;"),h.innerHTML='
    \n
    \n \n icon/响铃\n \n \n \n \n \n
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(h),i&&"onBell"==this.bellStatus&&this.jSPlugin.pause()}setTimeout((function(){var t=e.decoderState.state,i=t.isEditing,n=t.rejection;"onBell"!=e.bellStatus||n||(e.removeBellRing(),i||e.answerOvertime())}),this.maxBellTime)}}},{key:"removeBellRing",value:function(){document.getElementById("bellring")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring")),document.getElementById("bellring-icon")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon"))}},{key:"getMiniCallTimeUrl",value:function(){if(console.log("--------------getMiniCallTimeUrl"),-1!==this.jSPlugin.url.indexOf("hd.live")?this.recUrl=this.jSPlugin.url.replace("hd.live","rec"):this.recUrl=this.jSPlugin.url.replace("live","rec"),this.jSPlugin.callTime){var e=parseInt(this.jSPlugin.callTime),t=e+5e3,i=new Date(e-1e4).Format("yyyyMMddhhmmss"),n=new Date(t).Format("yyyyMMddhhmmss");this.recUrl="".concat(this.recUrl,"?begin=").concat(i,"&end=").concat(n),console.log("recurl="+this.recUrl)}}},{key:"initMiniRec",value:function(){var e=this,t=this,i=this.videoWidth,n=i/375,a=1.8*i,r=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(r=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+.1*a+6);var o=r+this.videoHeight+10*n;if(console.log(r),document.getElementById("miniRecbox"))document.getElementById("miniRecbox")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniRecbox")),document.getElementById("miniClose")&&document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniClose")),this.initMiniRec();else{var s=document.createElement("div");s.id="miniRecbox",s.style="-webkit-border-radius: 8px;border-radius: 8px;overflow: hidden;position: absolute;top: ".concat(o,"px;right: ").concat(9*n,"px;"),s.innerHTML='
    ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(s),this.getMiniCallTimeUrl();var l={domain:j};this.miniRecPlayer=new Mh({id:"miniRec",width:160*n,height:90*n,template:"miniRec",url:this.recUrl,accessToken:this.jSPlugin.accessToken,handleError:function(i){console.log("小窗口handleError------------",i),i&&6701==i.retcode?(e.miniRecNum=e.miniRecNum+1,console.log("小窗口miniRecNum-----------------",e.miniRecNum),e.miniRecNum<5?t.miniRecPlayer.changePlayUrl({type:"miniRec"}):(console.log("小窗口------------------已播放5次,关闭小窗口"),t.miniRecCloseClick())):(console.log("小窗口------------------播放失败,关闭小窗口"),t.miniRecCloseClick())},env:this.jSPlugin.env||l});var c=document.createElement("div");c.id="miniClose",c.style="position: absolute;top: ".concat(o+8,"px;right: ").concat(16*n,"px;"),c.innerHTML='
    \n \n close\n \n \n \n \n \n \n \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(c),document.getElementById("miniClose-btn").onclick=function(){t.miniRecCloseClick()}}}},{key:"initMiniImageRec",value:function(){console.log("initMiniImageRec");var e=this.videoWidth/375,t=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(t=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+26);var i=t+this.videoHeight+10*e;if(document.getElementById("miniRecbox"))document.getElementById("miniRecbox").style.top=i+"px",document.getElementById("miniClose").style.top=i+8+"px";else{var n=document.createElement("div");n.id="miniRecbox",n.style="-webkit-border-radius: 8px;border-radius: 8px;overflow: hidden;position: absolute;\n top: ".concat(i,"px;\n right: ").concat(9*e,"px;\n user-select: none;\n "),n.innerHTML='
    \n \n
    示意小窗位置
    \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(n);var a=document.createElement("div");a.id="miniClose",a.style="z-index: 4;position: absolute;top: ".concat(i+8,"px;right: ").concat(16*e,"px;"),a.innerHTML='
    \n \n close\n \n \n \n \n \n \n \n
    '),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(a),document.getElementById("miniClose-btn").onclick=function(){}}}},{key:"miniRecCloseClick",value:function(){document.getElementById("miniRecbox")&&(console.log("---------------------miniRecCloseClick"),"rec"==this.miniRecStatus&&(this.miniRecPlayer&&this.miniRecPlayer.stop(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniClose")),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).removeChild(document.getElementById("miniRecbox"))))}},{key:"miniRecSwitchClick",value:function(){console.log("---------------小窗口切换");var e=this.decoderState.state.isEditing,t=this.videoWidth,i=t/375,n=1.8*t,a=6;document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(a=document.getElementById("".concat(this.jSPlugin.id,"-headControl")).offsetHeight+.1*n+6),console.log("headerHeight-------",a);var r=a+this.videoHeight+10*i;if(console.log("videoTop-------",r),"rec"==this.miniRecStatus){this.miniRecStatus="live",e?(document.getElementById("miniRec-embed").style.width=this.jSPlugin.width+"px",document.getElementById("miniRec-embed").style.height=this.jSPlugin.height+"px",document.getElementById("miniRec").style.width=this.jSPlugin.width+"px",document.getElementById("miniRec").style.height=this.jSPlugin.height+"px"):this.miniRecPlayer.reSize(this.jSPlugin.width,this.jSPlugin.height),this.jSPlugin.reSize(160*i,90*i);var o=this.videoHeight+10*i,s=.2*n-90*i-10*i;document.getElementById("".concat(this.jSPlugin.id,"-wrap")).style.width=this.videoWidth+"px",document.getElementById("".concat(this.jSPlugin.id)).style.marginTop=o+"px",document.getElementById("".concat(this.jSPlugin.id)).style.marginLeft=t-160*i-9+"px",document.getElementById("".concat(this.jSPlugin.id)).style.overflow="hidden",document.getElementById("".concat(this.jSPlugin.id)).style.borderRadius="8px",document.getElementById("miniRecbox").style.top=a+"px",document.getElementById("miniRecbox").style.left="0",document.getElementById("miniRecbox").style.right="0",document.getElementById("miniRecbox").style.borderRadius="0px",document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop=s+"px"}else console.log(this.jSPlugin.width),this.miniRecStatus="rec",e?(document.getElementById("miniRec-embed").style.width=160*i+"px",document.getElementById("miniRec-embed").style.height=90*i+"px",document.getElementById("miniRec").style.width=160*i+"px",document.getElementById("miniRec").style.height=90*i+"px"):this.miniRecPlayer.reSize(160*i,90*i),this.jSPlugin.reSize(this.videoWidth,this.videoHeight),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).style.width=this.videoWidth+NaN,document.getElementById("".concat(this.jSPlugin.id)).style.marginTop="0",document.getElementById("".concat(this.jSPlugin.id)).style.marginLeft="0",document.getElementById("".concat(this.jSPlugin.id)).style.overflow="hidden",document.getElementById("".concat(this.jSPlugin.id)).style.borderRadius="0px",document.getElementById("miniRecbox").style.top=r+"px",document.getElementById("miniRecbox").style.right="9px",document.getElementById("miniRecbox").style.left="auto",document.getElementById("miniRecbox").style.borderRadius="8px",document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop=.2*n+"px"}},{key:"matchBtn",value:function(e,t){var i=this,n=this.themeData,a=n.header,r=n.footer,o=this.decoderState.state,s=o.mute,l=o.rejection;document.documentElement.clientHeight;var c=this.videoWidth/375,d=this.videoWidth/375||1,u={title:"",id:"",domString:"",color:"#FFFFFF",activeColor:"#FFFFFF",onclick:function(){},onmoveleft:function(){},onmoveright:function(){},onremove:function(){}};-1===a[this.bellStatus].btnList.findIndex((function(t){return t.iconId===e}))?(u.color=r[this.bellStatus].color,u.backgroundColor=r[this.bellStatus].backgroundColor,u.activeColor=r[this.bellStatus].activeColor):(u.color=a[this.bellStatus].color,u.backgroundColor=a[this.bellStatus].backgroundColor,u.activeColor=a[this.bellStatus].activeColor);var h=this.videoWidth/4;switch(e){case"ringStatus":return u.title=this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,u.id=e,u.domString='').concat(this.activeThemeStatus?"有人按门铃":this.activeThemeStatusTxt,""),u.onclick=function(){},u;case"deviceCategory":return u.title="设备名称",u.id=e,u.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),u.onclick=function(){},u;case"callStatus":return u.title="通话中",u.id=e,u.domString='通话中'),u.onclick=function(){},u;case"deviceCategory":return u.title="设备名称",u.id=e,u.domString='').concat(this.deviceInfoData&&this.deviceInfoData.deviceName||"设备名称",""),u.onclick=function(){},u;case"rejection":return u.title="拒绝",u.id=e,u.domString='
    \n
    \n \n 拒绝\n \n \n \n \n \n
    \n
    拒绝
    \n
    '),u.onclick=function(){var e=i,t=i.decoderState.state,n=t.play,a=t.isEditing,r=t.rejection;if(a||r)return!1;console.log("拒绝"),n&&i.jSPlugin.stop(),i.removeBellRing(),i.setDecoderState({play:!1,rejection:!0}),e.miniRecCloseClick(),i.rejectionStatusDispose(),"function"==typeof i.jSPlugin.hangUpCallback&&i.jSPlugin.hangUpCallback("rejection")},u;case"quickReply":return u.title="快捷回复",u.id=e,u.domString='
    \n
    \n \n 快捷回复\n \n \n \n \n \n
    \n
    快捷回复
    \n
    '),u.onclick=function(){var e=i.decoderState.state,t=e.isEditing,n=e.rejection;if(t||n)return!1;console.log("快捷回复"),i.switchFooter("quickReply"),i.quickReplyEle=new Ze(i.jSPlugin,i.switchFooter,i.videoWidth)},u;case"answer":return u.title="接听",u.id=e,u.domString='
    \n
    \n \n 接听\n \n \n \n \n \n
    \n
    接听
    \n
    '),u.onclick=function(){var e=i.decoderState.state,n=e.play,o=e.isEditing,s=e.talk,l=e.sound,c=e.rejection;if(o||c)return!1;console.log("接听"),i.jSPlugin.pluginStatus.loadingClear(),i.bellStatus="onCall",i.switchFooter("onCall"),r[i.bellStatus].btnList.map((function(e,t){e.isrender&&i.renderFooter(e.iconId,e)})),a[i.bellStatus].btnList.map((function(e,t){e.isrender&&i.renderHeader(e.iconId,e)}));var d=document.getElementById("".concat(i.jSPlugin.id,"-header-onBell"));d&&d.parentElement.removeChild(d),1==i.themeData.customConfig.bellPoster&&(document.getElementById("bellring-icon")&&document.getElementById("".concat(i.jSPlugin.id,"-wrap")).removeChild(document.getElementById("bellring-icon")),i.jSPlugin.setPoster("")),i.removeBellRing(),i.miniRecCloseClick(),n||(i.jSPlugin.pluginStatus.loadingStart(i.jSPlugin.id),i.jSPlugin.pluginStatus.loadingSetText({text:"视频加载中"}),i.jSPlugin.play(),i.setDecoderState({play:!n})),s||1!=i.themeData.customConfig.defaultMicro||(i.setDecoderState({talk:!0,mute:!1}),l&&i.jSPlugin.closeSound(),i.jSPlugin.Talk.startTalk()),i.setDecoderState({sound:!1}),0==i.themeData.customConfig.defaultMicro&&(i.muteCommon(t),i.jSPlugin.openSound(),i.setDecoderState({sound:!0})),i.maxTalkTime=1e3*i.themeData.customConfig.maxTalkTime*60;var u=i;setTimeout((function(){s&&(console.log("结束对讲"),u.setDecoderState({talk:!1}),u.jSPlugin.Talk.stopTalk()),n&&(u.jSPlugin.stop(),u.setDecoderState({play:!n})),i.rejectionStatusDispose(),i.remoteUnlockEle&&i.remoteUnlockEle.closeRemoteUnlock(),"function"==typeof i.jSPlugin.hangUpCallback&&i.jSPlugin.hangUpCallback("hangUp")}),i.maxTalkTime)},u;case"remoteUnlock":return u.title="远程开锁",u.id=e,u.domString='
    \n
    \n \n 开锁\n \n \n \n \n \n
    \n
    远程开锁
    \n
    '),u.onclick=function(){var e=i.decoderState.state,t=e.isEditing;e.play;var n=e.rejection;if(t||"onBell"==i.bellStatus||n)return!1;console.log("远程开锁"),i.switchFooter("remoteUnlock"),i.remoteUnlockEle=new We(i.jSPlugin,i.switchFooter,i.videoWidth)},u;case"mute":return u.title="静音",u.id=e,u.domString='
    \n
    \n \n icon/静音\n \n \n \n \n \n
    \n
    静音
    \n
    '),u.onclick=function(){var e=i.decoderState.state,n=e.talk,a=e.sound;if(e.play,e.rejection)return!1;console.log("静音"),n?(console.log("结束对讲"),i.setDecoderState({talk:!1,mute:!0},t.backgroundColor),i.jSPlugin.Talk.stopTalk(),i.jSPlugin.openSound(),i.setDecoderState({sound:!0})):(console.log("开始对讲"),i.setDecoderState({talk:!0,mute:!1},t.backgroundColor),a&&(i.jSPlugin.closeSound(),i.setDecoderState({sound:!1})),i.jSPlugin.Talk.startTalk())},u;case"hangUp":return u.title="挂断",u.id=e,u.domString='
    \n
    \n \n 挂断\n \n \n \n \n \n
    \n
    挂断
    \n
    '),u.onclick=function(){var e=i,t=i.decoderState.state,n=t.talk,a=t.play;if(t.rejection)return!1;n&&(console.log("结束对讲"),i.setDecoderState({talk:!1}),i.jSPlugin.Talk.stopTalk()),a&&(i.jSPlugin.stop(),i.setDecoderState({play:!a})),(a||n)&&(e.miniRecCloseClick(),console.log("挂断"),i.rejectionStatusDispose(),"function"==typeof i.jSPlugin.hangUpCallback&&i.jSPlugin.hangUpCallback("hangUp"))},u;default:return u}}},{key:"answerOvertime",value:function(){this.toastCustom.initToastContent("应答超时");var e=this.decoderState.state.play;console.log("应答超时"),e&&this.jSPlugin.stop(),this.setDecoderState({play:!1,rejection:!0}),this.miniRecCloseClick(),this.rejectionStatusDispose(),this.quickReplyEle&&this.quickReplyEle.closeQuickReplyEle(),"function"==typeof this.jSPlugin.hangUpCallback&&this.jSPlugin.hangUpCallback("rejection")}},{key:"rejectionStatusDispose",value:function(){var e=this,t=this.themeData.footer,i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),a=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")),r=document.getElementById("header-".concat(this.bellStatus,"-ringStatus"));"onBell"==this.bellStatus?(i.innerHTML="",a.innerHTML="",i.style.color="#2C2C2C"):(n.innerHTML="",n.style.color="#2C2C2C"),console.log("rejectionStatusDispose"),this.setDecoderState({rejection:!0}),t[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderFooter(t.iconId,t)})),r.innerText="通话已结束",this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"通话已结束",color:"white",isMobile:!0,type:2})}},{key:"userNoDevice",value:function(){var e=this;this.removeBellRing(),this.setDecoderState({rejection:!0});var t=this.themeData.footer,i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),a=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn"));"onBell"==this.bellStatus?(i.innerHTML="",a.innerHTML="",i.style.color="#2C2C2C"):(n.innerHTML="",n.style.color="#2C2C2C"),console.log("userNoDevice"),this.setDecoderState({rejection:!0}),t[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderFooter(t.iconId,t)})),this.jSPlugin.pluginStatus.loadingClear(),this.jSPlugin.pluginStatus.loadingSetTextWithBtn({text:"该用户不拥有该设备",color:"white",isMobile:!0,type:2})}},{key:"renderHeader",value:function(e,t){var i=this,n=this.matchBtn(e,t);if(document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content"))){var a=document.createElement("span");a.innerHTML="".concat(n.domString),document.getElementById("".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus,"-content")).appendChild(a)}else{var r=document.createElement("div");r.id="".concat(this.jSPlugin.id,"-header-").concat(this.bellStatus),r.style="max-width:50%;position:relative;",r.innerHTML='\n ').concat(n.domString,"\n "),r.onclick=function(e){if(i.decoderState.state.isEditing)return!1;n.onclick(e)},document.getElementById("".concat(this.jSPlugin.id,"-headControl")).childNodes[0].appendChild(r)}}},{key:"renderFooter",value:function(e,t){var i=this,n=this.decoderState.state.mute;if("remoteUnlock"==e&&this.jSPlugin.capacity&&(!this.jSPlugin.capacity.support_unlock||0==this.jSPlugin.capacity.support_unlock))return!1;var a=this.matchBtn(e,t),r=this.videoWidth/4,o=document.createElement("div");if(o.className="theme-icon-item","quickReply"!==a.id&&(o.style="width:".concat(.66*r,"px;padding:0 ").concat(.12*r,"px;box-sizing: content-box;-webkit-tap-highlight-color:transparent;")),o.innerHTML="".concat('')+'
    ')).concat(a.domString,"
    ")+"
    ",o.onclick=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;a.onclick(e)},a.onmouseenter&&(o.onmouseenter=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;a.onmouseenter(e)}),a.onmouseleave&&(o.onmouseleave=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;a.onmouseleave(e)}),"quickReply"!=e){var s=document.createElement("span");s.className="icon-move left",s.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),s.onclick=function(){i.editIcon(a.id,"left","footer")},o.appendChild(s);var l=document.createElement("span");l.className="icon-move right",l.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),l.onclick=function(){i.editIcon(a.id,"right","footer")},o.appendChild(l)}if("answer"==e||"rejection"==e||"hangUp"==e);else{var c=document.createElement("span");c.className="icon-move close",c.innerHTML='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),c.onclick=function(){i.editIcon(a.id,"delete","footer")},o.appendChild(c)}"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).appendChild(o):(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).appendChild(o),"quickReply"===a.id&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")).appendChild(o)),this.decoderState.state.isEditing&&"mute"==e&&"onCall"==this.bellStatus&&(0!=this.themeData.customConfig.defaultMicro||n?this.setDecoderState({mute:!1},t.backgroundColor):this.setDecoderState({mute:!0},t.backgroundColor))}},{key:"switchFooter",value:function(e){var t=this.themeData.footer;switch(e){case"onBell":document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"))?"none"==document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-btn-quickReply")).style.display="flex"):(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-quickReplyBtn")).style.display="flex",document.getElementById("".concat(this.jSPlugin.id,"-btn-quickReply")).style.display="flex");break;case"onCall":document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-btn-quickReply")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.display="flex",this.themeData&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=t[this.bellStatus].color)}}},{key:"initThemeData",value:function(){var e=this;console.log("-------------initThemeData");var t=this.themeData,i=t.header,n=t.footer,a=this.decoderState.state.isEditing,r=this.videoWidth,o=r/375,s=1.8*r,c=this.jSPlugin.id;if(this.isNeedRenderHeader=k.findIndex(i[this.bellStatus].btnList,(function(e){return e.isrender>0}))>=0,this.isNeedRenderFooter=k.findIndex(n[this.bellStatus].btnList,(function(e){return e.isrender>0}))>=0,this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var d=document.createElement("div");d.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),d.setAttribute("class","header-controls"),d.innerHTML="
    "),console.log(this.jSPlugin.height),this.jSPlugin.height;var u=l(l({display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#FFFFFF",width:"100%",position:"relative","margin-bottom":.1*s+"px","align-items":"center","text-align":"center","font-size":"24ox"},"color","#2c2c2c"),"margin-top","6px");d.style=Ye(u),document.getElementById("".concat(c,"-wrap")).insertBefore(d,document.getElementById(c));var h=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(h)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));if(this.jSPlugin.height,this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="".concat(.2*s,"px"),"onCall"==this.bellStatus?document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n \n '):document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).innerHTML='\n \n \n \n \n \n '));else{var f=document.createElement("div");f.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),f.setAttribute("class","ez-iframe-footer-container");var x={position:"relative","margin-top":.2*s+"px",display:"flex","flex-wrap":"wrap","justify-content":"space-between","z-index":999,top:0,color:"#FFFFFF",width:"100%","align-items":"center","font-size":"12px"};f.style=Ye(x),f.innerHTML='\n \n \n \n \n \n '),g(f,document.getElementById(c))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));if(this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&i[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderHeader(t.iconId,t)})),this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=n[this.bellStatus].backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=n[this.bellStatus].color,n[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.renderFooter(t.iconId,t)}))),1!=this.themeData.customConfig.bellPoster||a)this.jSPlugin.setPoster("");else{this.jSPlugin.poster="https://resource.eziot.com/group1/M00/00/B8/CtwQEmPbGh2AVJB-ABDcYtyw5gk899.svg";var p=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(p),e.jSPlugin.setPoster(e.jSPlugin.poster))}),50)}this.activeThemeStatus&&(this.initBellRing(),this.checkIsAppleDevice()||!1?window.addEventListener("touchstart",this.autoPlayRing):window.addEventListener("click",this.autoPlayRing));this.inited=!0,this.getCallDeviceInfo()}},{key:"checkIsAppleDevice",value:function(){var e=navigator.userAgent,t=!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),i=e.indexOf("iPad")>-1,n=e.indexOf("iPhone")>-1||e.indexOf("Mac")>-1;return!!(t||i||n)}},{key:"renderThemeData",value:function(){var e=this,t=this.themeData,i=t.header,n=t.footer,a=this.decoderState.state.isEditing;if(this.isNeedRenderHeader&&i&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=i[this.bellStatus].color.replace("-diy",""),i[this.bellStatus].btnList.map((function(t,i){t.isrender&&e.setDecoderState(l({},t.iconId,e.decoderState.state[t.iconId]))}))),this.isNeedRenderFooter&&n)document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=n[this.bellStatus].backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=n[this.bellStatus].color.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")).style.color=n[this.bellStatus].color.replace("-diy",""),n[this.bellStatus].btnList.map((function(t,i){if(t.isrender&&e.setDecoderState(l({},t.iconId,e.decoderState.state[t.iconId])),console.log("-------------activeThemeStatus"),0==i&&!e.themeInited&&e.activeThemeStatus)var n=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(n),1!=e.themeData.customConfig.bellPoster||a?e.jSPlugin.play():e.jSPlugin.pluginStatus.loadingClear(),e.themeInited=!0)}),50)})),-1!==this.jSPlugin.url.indexOf("hd.live")&&this.setDecoderState({hd:!0}),this.themeData.autoFocus>0&&(this.autoFocus=parseInt(this.themeData.autoFocus),this.startAutoFocus(),document.getElementById("".concat(this.jSPlugin.id,"-wrap")).addEventListener("click",(function(){e.stopAutoFocus()}))),this.setDecoderState({cloudRec:"cloud.rec"===P(this.jSPlugin.url).type,rec:"rec"===P(this.jSPlugin.url).type,type:P(this.jSPlugin.url).type});else if(!this.themeInited&&this.activeThemeStatus)var r=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(r),e.themeData&&e.themeData.customConfig&&1==e.themeData.customConfig.bellPoster&&!a?e.jSPlugin.pluginStatus.loadingClear():e.jSPlugin.play(),e.themeInited=!0)}),50);var o=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(o),e.jSPlugin.reSize(e.jSPlugin.params.width,e.jSPlugin.params.height))}),50);a||this.jSPlugin.isWebConsole?1==this.themeData.customConfig.miniWinRec?this.initMiniImageRec():this.miniRecCloseClick():setTimeout((function(){"onBell"==e.bellStatus&&e.jSPlugin.capacity&&1==e.jSPlugin.capacity.support_doorcall_playback&&(console.log("小窗口initMiniRec-------------设备能力集成功"),1==e.themeData.customConfig.miniWinRec&&(console.log("小窗口initMiniRec---------------画中画设置已开启"),(!e.deviceInfoData||e.deviceInfoData&&!e.deviceInfoData.isEncrypt)&&(console.log("小窗口initMiniRec---------------设备未加密"),e.miniRecNum=0,e.initMiniRec())))}),1e3)}},{key:"setThemeData",value:function(e,t){this.themeData=e,"onCall"==t&&(this.bellStatus="onCall")}},{key:"startAutoFocus",value:function(){var e=this,t=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(e.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*t)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.startAutoFocus()}},{key:"editIcon",value:function(e,t,i){console.log("编辑组件",e,t,i);var n=this.themeData;console.log("themeData",this.themeData);var a=this.themeData[i][this.bellStatus].btnList,r=k.findIndex(a,(function(t){return t.iconId===e})),o=a[r];switch(t){case"delete":a[r].isrender=0;break;case"right":for(var s=-1,l=r+1;l=0;d--)if(a[d].part===a[r].part&&1==a[d].isrender){c=d;break}-1!==c&&(a[r]=a[c],a[c]=o)}console.log("new btnList",a),n[i][this.bellStatus].btnList=a,this.jSPlugin.Theme.changeTheme(n)}},{key:"countTime",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var n=document.createElement("div");n.id=this.jSPlugin.id+"time-area",n.className="time-area",n.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(n)}if(this.countTimer&&clearInterval(this.countTimer),"add"===e){var a=t;document.getElementById(i.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++a,document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML=function(e){var t=parseInt(e),i=0,n=0,a="00",r="00",o="00";t>59&&(i=parseInt(t/60),t=parseInt(t%60),i>59&&(n=parseInt(i/60),i=parseInt(i%60)));return a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),o=parseInt(n)>9?parseInt(n):"0"+parseInt(n),n>0?o+":"+r+":"+a:i>0?r+":"+a:"00:"+a}(a)}),1e3)}else"destroy"===e&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(i.jSPlugin.id+"time-area")&&(document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(i.jSPlugin.id+"time-area").style.display="none"))}},{key:"editStart",value:function(e){console.log("----------editStart1");var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));document.getElementById("".concat(this.jSPlugin.id,"-headControl")),t&&t.setAttribute("class","footer-controls themeEditing"),i&&i.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(e){console.log("----------editEnd1");var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-headControl")),n=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall"));i&&i.setAttribute("class","header-controls"),t&&t.setAttribute("class","footer-controls"),n&&n.setAttribute("class","footer-controls")}},{key:"fetchThemeData",value:function(e){var t=this;switch(this.jSPlugin.themeId){case"pcLive":case"pcRec":case"mobileLive":case"mobileRec":case"miniRec":break;default:Ie(this.jSPlugin,e,(function(e){0==e.meta.code&&e.data?(t.activeThemeStatus=!0,t.themeData=e.data,e.data.header&&(t.themeData.header=e.data.header,t.themeData.header[t.bellStatus].btnList=t.themeData.header[t.bellStatus].btnList.sort((function(e,t){return e.btnKey.split("-")[3]-t.btnKey.split("-")[3]}))),e.data.footer&&(t.themeData.footer=e.data.footer,t.themeData.footer[t.bellStatus].btnList=t.themeData.footer[t.bellStatus].btnList.sort((function(e,t){return e.btnKey.split("-")[3]-t.btnKey.split("-")[3]}))),t.jSPlugin.capacity?(t.initThemeData(),t.renderThemeData()):setTimeout((function(){t.initThemeData(),t.renderThemeData()}),300)):(t.activeThemeStatus=!1,t.jSPlugin.pluginStatus.loadingClear(),t.setDecoderState({rejection:!0}),"111021"==e.meta.code?(t.jSPlugin.pluginStatus.loadingSetText({text:"无效的模板id",color:"#fff",type:1}),t.activeThemeStatusTxt="无效的模板id"):"111023"==e.meta.code?(t.jSPlugin.pluginStatus.loadingSetText({text:"您的试用特权已到期,需前往轻应用控制台购买后使用。",color:"#fff",type:1}),t.activeThemeStatusTxt="试用特权已到期"):(t.jSPlugin.pluginStatus.loadingSetText({text:"模板未激活,请先在开放平台轻应用控制台购买模板",color:"#fff",type:1}),t.activeThemeStatusTxt="模板未激活"),t.themeData=Ge,t.initThemeData(),t.renderThemeData())}),(function(){t.renderThemeData()}))}}},{key:"getCallDeviceInfo",value:function(){var e=this;this.videoWidth,De({accessToken:this.jSPlugin.accessToken,deviceSerial:P(this.jSPlugin.url).deviceSerial}).then((function(t){t.data&&(e.deviceInfoData=t.data,t.data.isEncrypt&&(console.log("小窗口miniRecCloseClick------------设备已加密"),e.miniRecCloseClick(),setTimeout((function(){e.jSPlugin.pluginStatus.loadingClear(),e.jSPlugin.pluginStatus.loadingSetText({text:"视频已加密",color:"#fff"})}),1e3)),document.getElementById("header-".concat(e.bellStatus,"-deviceCategory"))&&(document.getElementById("header-".concat(e.bellStatus,"-deviceCategory")).innerText=""+t.data.deviceName))})).catch((function(t){console.log("获取设备信息失败",t),20018!=t.code||e.jSPlugin.isWebConsole||e.userNoDevice()}))}},{key:"setHeaderText",value:function(e){console.log("setHeaderText");var t=this.videoWidth/375||1;document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content"))&&(document.getElementById("".concat(this.jSPlugin.id,"-deviceCategory-content")).innerHTML='').concat(e,'').concat(this.deviceInfoData&&this.deviceInfoData.category||"",""))}}]),e}(),Je=function(){function e(t){if(r(this,e),this.jSPlugin=t,this.videoWidth=t.width,this.autoFocus=0,this.autoFocusTimer=null,this.decoderState={state:{isEditing:!1,play:!1,sound:!1,recordvideo:!1,recordCount:"00:00",talk:!1,mute:!1,rejection:!1,cloudRec:"cloud.rec"===P(t.url).type,rec:"rec"===P(t.url).type,type:P(t.url).type}},console.log("matchEzopenUrl(jSPlugin.url)",P(t.url),this.decoderState.state),this.isMobile=navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),void 0!==t.isMobile&&(this.isMobile=t.isMobile),this.themeData={},"themeData"==this.jSPlugin.themeId&&(this.themeData=this.jSPlugin.params.themeData),this.jSPlugin.themeId)if(this.isMobile?this.call=new Xe(this.jSPlugin,this.themeData,this.setDecoderState,this.decoderState):this.call=new He(this.jSPlugin,this.themeData,this.setDecoderState,this.decoderState),"themeData"===this.jSPlugin.themeId)this.themeData=this.jSPlugin.params.themeData,this.call.initThemeData(),this.call.renderThemeData();else this.call.fetchThemeData(this.jSPlugin.themeId);this.jSPlugin.Talk||(this.jSPlugin.Talk=new ue(this.jSPlugin)),p("".concat(this.jSPlugin.staticPath,"/speed/speed.css")),p("".concat(this.jSPlugin.staticPath,"/css/theme.css"))}return s(e,[{key:"changeTheme",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"onBell";if("string"==typeof e)switch(this.jSPlugin.themeId=e,this.jSPlugin.themeId){case"pcLive":case"mobileCall":case"webCall":this.call.initThemeData(),this.call.renderThemeData();break;default:this.call.fetchThemeData(e)}else"object"===a(e)&&(this.themeData=e,this.call.setThemeData(e,i),this.call.initThemeData(),this.call.renderThemeData(),this.decoderState.state.isEditing&&t&&this.call.editStart());this.jSPlugin&&this.jSPlugin.handleThemeChange&&this.jSPlugin.handleThemeChange(e)}},{key:"setDecoderState",value:function(e,t){var i=this,n=this.themeData;n.header,n.footer,Object.keys(e).map((function(n){if("mute"===n)document.getElementById("".concat(i.jSPlugin.id,"-icon-mute"))&&(console.log("mute"),e[n]?(document.getElementById("".concat(i.jSPlugin.id,"-icon-mute")).style.background=t,document.getElementById("".concat(i.jSPlugin.id,"-icon-mute")).style.border=" 1px solid ".concat(t),document.getElementById("icon-mute-path").style.fill="#ffffff"):(document.getElementById("".concat(i.jSPlugin.id,"-icon-mute")).style.background="#ffffff",document.getElementById("".concat(i.jSPlugin.id,"-icon-mute")).style.border="1px solid ".concat(t),document.getElementById("icon-mute-path").style.fill=t));i.decoderState.state=Object.assign(i.decoderState.state,e)}))}},{key:"startAutoFocus",value:function(){var e=this,t=this.autoFocus;this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.autoFocusTimer=setTimeout((function(){document.getElementById("".concat(e.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.opacity=0,document.getElementById("".concat(e.jSPlugin.id,"-audioControls")).style.pointerEvents="none")}),1e3*t)}},{key:"stopAutoFocus",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.opacity=1,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.pointerEvents="all"),this.autoFocusTimer&&clearTimeout(this.autoFocusTimer),this.startAutoFocus()}},{key:"toString",value:function(){return"".concat(this.coreX,"-").concat(this.coreY)}},{key:"editIcon",value:function(e,t,i){console.log("编辑组件",e,t,i);var n=this.themeData;console.log("themeData",this.themeData);var a=this.themeData[i].btnList,r=k.findIndex(a,(function(t){return t.iconId===e})),o=a[r];switch(t){case"delete":if("rec"===e){if(-1===k.findIndex(a,(function(e){return"cloudRec"===e.iconId&&1==e.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1}else if("cloudRec"===e&&-1===k.findIndex(a,(function(e){return"rec"===e.iconId&&1==e.isrender})))return this.jSPlugin.Message&&this.jSPlugin.Message.default("必须选中一种存储介质"),!1;a[r].isrender=0;break;case"right":for(var s=-1,l=r+1;l=0;d--)if(a[d].part===a[r].part&&1==a[d].isrender){c=d;break}-1!==c&&(a[r]=a[c],a[c]=o)}console.log("new btnList",a),n[i].btnList=a,this.changeTheme(n)}},{key:"countTime",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this;if(!document.getElementById(this.jSPlugin.id+"time-area")){var n=document.createElement("div");n.id=this.jSPlugin.id+"time-area",n.className="time-area",n.innerHTML='00:00',document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).appendChild(n)}if(this.countTimer&&clearInterval(this.countTimer),"add"===e){var a=t;document.getElementById(i.jSPlugin.id+"time-area").style.display="flex",this.countTimer=setInterval((function(){++a,document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML=function(e){var t=parseInt(e),i=0,n=0,a="00",r="00",o="00";t>59&&(i=parseInt(t/60),t=parseInt(t%60),i>59&&(n=parseInt(i/60),i=parseInt(i%60)));return a=parseInt(t)>9?parseInt(t):"0"+parseInt(t),r=parseInt(i)>9?parseInt(i):"0"+parseInt(i),o=parseInt(n)>9?parseInt(n):"0"+parseInt(n),n>0?o+":"+r+":"+a:i>0?r+":"+a:"00:"+a}(a)}),1e3)}else"destroy"===e&&(this.countTimer&&clearInterval(this.countTimer),this.countTimer=void 0,document.getElementById(i.jSPlugin.id+"time-area")&&(document.getElementById(i.jSPlugin.id+"time-area").children[1].innerHTML="00:00",document.getElementById(i.jSPlugin.id+"time-area").style.display="none"))}},{key:"editStart",value:function(e){var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-audioControls-onCall")),n=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));n&&n.setAttribute("class","header-controls themeEditing"),t&&t.setAttribute("class","footer-controls themeEditing"),i&&i.setAttribute("class","footer-controls themeEditing"),this.setDecoderState({isEditing:!0})}},{key:"editEnd",value:function(e){var t=document.getElementById("".concat(this.jSPlugin.id,"-audioControls")),i=document.getElementById("".concat(this.jSPlugin.id,"-headControl"));i&&i.setAttribute("class","header-controls"),t&&t.setAttribute("class","footer-controls"),this.setDecoderState({isEditing:!1})}},{key:"setDisabled",value:function(e){}},{key:"getDeviceInfo",value:function(){var e=this,t=this.videoWidth/1024||1;De({accessToken:this.jSPlugin.accessToken,deviceSerial:P(this.jSPlugin.url).deviceSerial}).then((function(i){200==i.code&&i.data&&document.getElementById("".concat(e.jSPlugin.id,"-deviceCategory-content"))&&(document.getElementById("".concat(e.jSPlugin.id,"-deviceCategory-content")).style.maxWidth="100%",document.getElementById("".concat(e.jSPlugin.id,"-deviceCategory-content")).style.overflow="hidden",document.getElementById("".concat(e.jSPlugin.id,"-deviceCategory-content")).style.textOverflow="ellipsis",document.getElementById("".concat(e.jSPlugin.id,"-deviceCategory-content")).style.whiteSpace="nowrap",document.getElementById("".concat(e.jSPlugin.id,"-deviceCategory-content")).innerHTML='有人按门铃').concat(i.data.category,""))})).catch((function(e){console.log("获取设备信息失败",e)}))}}]),e}(),qe=function(){function e(t){r(this,e),this.jSPlugin=t;var i=window["EZUIKIT_TIMER_INTERVAL_".concat(t.id)];i&&Object.keys(i).length>0&&this.resetTimer(),window["EZUIKIT_TIMER_INTERVAL_".concat(t.id)]={}}return s(e,[{key:"createInterval",value:function(e,t,i){window["EZUIKIT_TIMER_INTERVAL_".concat(this.jSPlugin.id)][e]=setInterval(t,i)}},{key:"clearTimer",value:function(e){var t=window["EZUIKIT_TIMER_INTERVAL_".concat(this.jSPlugin.id)];t[e]&&(clearInterval(t[e]),delete t[e])}},{key:"resetTimer",value:function(){var e=window["EZUIKIT_TIMER_INTERVAL_".concat(this.jSPlugin.id)];for(var t in e)clearInterval(e[t]),delete e[t]}}]),e}(),Ke=s((function e(t){var i=this;r(this,e),l(this,"initMap",(function(){var e=i,t=i.videoWidth,n=i.videoHeight;if(document.getElementById("".concat(i.jSPlugin.id,"-miniRecbox")))document.getElementById("".concat(i.jSPlugin.id,"-wrap")).removeChild(document.getElementById("".concat(i.jSPlugin.id,"-miniRecbox"))),i.initMap();else{var a=document.createElement("div");a.id="".concat(i.jSPlugin.id,"-miniRecbox"),a.style=";position: absolute; bottom:96px;right:".concat(i.jSPlugin.inspectVideoWidth,"px;"),a.innerHTML='
    '),document.getElementById("".concat(i.jSPlugin.id,"-wrap")).insertBefore(a,document.getElementById("".concat(i.jSPlugin.id,"-ez-iframe-footer-container"))),e.map=e.loadMap("".concat(i.jSPlugin.id,"-mapbox"))}return e.map})),l(this,"loadMap",(function(e){var t=new BMapGL.Map(e);return t.centerAndZoom(new BMapGL.Point(116.297611,40.047363),15),t.enableScrollWheelZoom(!0),t})),l(this,"createCircle",(function(e,t,n,a){var r=new BMapGL.Point(e,t),o=new BMapGL.Marker(r,{title:a});if(i.map.addOverlay(o),0!=n){var s=new BMapGL.Circle(new BMapGL.Point(e,t),n,{strokeColor:"#ff4d4f",strokeWeight:4,strokeOpacity:1,strokeStyle:"dashed",fillOpacity:0});i.map.addOverlay(s)}})),l(this,"createInspectPoints",(function(e){e.map((function(e){i.createCircle(e.longitude,e.latitude,e.radius,e.inspectPointName)}))})),l(this,"createPolygon",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#407AFF",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"solid",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"407AFF",s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=[];e.split(";").map((function(e){var t=e.split(",");l.push(new BMapGL.Point(t[0],t[1]))})),i.inspectRange=new BMapGL.Polygon(l,{strokeColor:t,strokeWeight:a,strokeOpacity:r,strokeStyle:n,fillOpacity:s,fillColor:o}),i.map.addOverlay(i.inspectRange)})),l(this,"createTrack",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#18C796",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"solid",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:500,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,u=arguments.length>10&&void 0!==arguments[10]&&arguments[10],h=[];if(e.map((function(e){var t=!1;i.currentTrack.length>0&&i.currentTrack.map((function(i){i.longitude===e.longitude&&i.latitude===e.latitude&&i.reportTime===e.reportTime&&(t=!0)})),t||(0==h.length&&i.currentTrack.length>0&&h.push(new BMapGL.Point(i.currentTrack[i.currentTrack.length-1].longitude,i.currentTrack[i.currentTrack.length-1].latitude)),h.push(new BMapGL.Point(e.longitude,e.latitude)))})),0!=h.length){var f=new BMapGL.Polyline(h,{strokeColor:n,strokeWeight:r,strokeOpacity:o,strokeStyle:a,fillOpacity:s});if(t?(i.map.addOverlay(f),i.map.centerAndZoom(h[h.length-1],15)):(i.trackAni=new BMapGLLib.TrackAnimation(i.map,f,{overallView:u,tilt:l,duration:c,delay:d}),i.trackAni.start()),i.currentTrack=e,i.currentTrack.length>0&&i.currentTrack.length>0){var x=new BMapGL.Point(i.currentTrack[0].longitude,i.currentTrack[0].latitude);if(i.startPoint=new BMapGL.Marker(x,{icon:new BMapGL.Icon("".concat(i.jSPlugin.staticPath,"/imgs/start.png"),new BMapGL.Size(32,47)),offset:new BMapGL.Size(0,-17)}),i.map.addOverlay(i.startPoint),1==i.currentTrack.length)return;var p=new BMapGL.Point(i.currentTrack[i.currentTrack.length-1].longitude,i.currentTrack[i.currentTrack.length-1].latitude);i.endPoint&&i.map.removeOverlay(i.endPoint),setTimeout((function(){i.endPoint=new BMapGL.Marker(p,{icon:new BMapGL.Icon("".concat(i.jSPlugin.staticPath,"/imgs/end.png"),new BMapGL.Size(30,30))}),i.map.addOverlay(i.endPoint)}),t?0:c)}}})),l(this,"centerToTrack",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;i.currentTrack.length>0&&(1==i.currentTrack.length?i.map.centerAndZoom(new BMapGL.Point(i.currentTrack[0].longitude,i.currentTrack[0].latitude),e):i.map.centerAndZoom(new BMapGL.Point(i.currentTrack[i.currentTrack.length-1].longitude,i.currentTrack[i.currentTrack.length-1].latitude),e))})),this.jSPlugin=t,this.videoWidth=t.width,this.videoHeight=t.height,this.toastCustom=new Me(t,!1),this.currentTrack=[],this.startPoint=null,this.endPoint=null,this.trackAni=null,this.inspectRange=null,this.map=this.initMap()})),$e=s((function e(t){var i=this;r(this,e),l(this,"init",(function(){var e=i;if(i.videoWidth,i.videoHeight,document.getElementById("".concat(i.jSPlugin.id,"-inspect-global-box")))document.getElementById("".concat(i.jSPlugin.id,"-inspect-global-box"))&&document.getElementById("".concat(i.jSPlugin.id,"-wrap")).removeChild(document.getElementById("".concat(i.jSPlugin.id,"-inspect-global-box"))),e.init();else{var t=document.createElement("div");t.id="".concat(i.jSPlugin.id,"-inspect-global-box"),t.style=";position: absolute; left:0; top: 0; width: 100%; height: 100%; z-index: 10000; background: #fff;",t.innerHTML='
    \n
    \n
    \n
    加载中…
    \n
    \n '),document.getElementById("".concat(i.jSPlugin.id,"-wrap")).appendChild(t)}})),l(this,"deviceErrorInfo",(function(e,t){var n=Object.assign({tips:"",refreshBtn:"",refreshShow:!1},e);if(document.getElementById("".concat(i.jSPlugin.id,"-no-inspect-box")))document.getElementById("".concat(i.jSPlugin.id,"-no-inspect-box"))&&document.getElementById("".concat(i.jSPlugin.id,"-inspect-global-box")).removeChild(document.getElementById("".concat(i.jSPlugin.id,"-no-inspect-box"))),i.deviceErrorInfo(e,t);else{i.videoHeight;var a=document.createElement("div");a.id="".concat(i.jSPlugin.id,"-no-inspect-box"),a.style="width:100%;height:100%; background: #ffffff; display: flex; justify-content: center; align-items: center",a.innerHTML='
    \n
    \n \n
    \n
    '.concat(n.tips,'
    \n \n
    \n "),document.getElementById("".concat(i.jSPlugin.id,"-inspect-global-box")).appendChild(a),document.getElementById("".concat(i.jSPlugin.id,"-inspect-device-status-refresh")).addEventListener("click",(function(){t&&t()}))}})),l(this,"globalContainerToggle",(function(e,t){document.getElementById(e)&&(document.getElementById(e).style.display=t?"flex":"none")})),this.jSPlugin=t,this.videoWidth=t.width,this.videoHeight=t.height,this.toastCustom=new Me(t,!1),this.init()})),Qe=function(){function e(i){r(this,e),this.timer=null;var n={wrapNode:document.body,time:2e3,content:"",type:"info",center:!1,top:8};this.params=t(t({},n),i),this.init()}return s(e,[{key:"init",value:function(){var e=this;this.timer=null;var t=this.params,i=t.wrapNode,n=t.content,a=t.time,r=t.type,o=t.center,s=t.top;this.wrapNode=i;var l=document.createElement("div");l.setAttribute("class","ezuikit-message"),o?l.setAttribute("style","top: 50%; transform: translateY(-50%);"):l.setAttribute("style","top: ".concat(s||0,"px;")),this.wrapNode.appendChild(l),this.initMessageContent(r,n,l),0!==a&&(this.timer=setTimeout((function(){e.wrapNode.removeChild(l)}),a||2e3))}},{key:"initMessageContent",value:function(e,t,i){var n=document.createElement("div");n.setAttribute("class","ezuikit-message-notice"),n.innerHTML='\n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\t').concat("warning"===e?'':"","\n\t\t\t\t\t\t").concat("info"===e?'':"","\n\t\t\t\t\t\t").concat("error"===e?'':"","\n\t\t\t\t\t\t").concat("success"===e?'':"","\n\t\t\t\t\t\n\t\t\t\t\t").concat(t,"\n\t\t\t\t
    \n\t\t\t
    \n\t\t\t"),i.appendChild(n)}}]),e}(),et=function(){function e(i){r(this,e);this.params=t(t({},{id:"",width:"100%",height:"100%",preview:!0,showIcon:!0,src:"",alt:"",fallback:"https://img.ys7.com/group32/M00/81/9D/CtxIA2HnrGyADm_jAAAFfWjIDJs811.png"}),i),this.id=Math.random().toString(36).substr(2),this.init()}return s(e,[{key:"init",value:function(){var e=this.params,t=e.id,i=e.width,n=e.height,a=e.preview;if(document.getElementById(t)){var r=document.createElement("div");r.setAttribute("class","ezuikit-image"),r.setAttribute("style","width:".concat(i,";height:").concat(n,";")),document.getElementById(t).appendChild(r),this.initImage(r),a&&this.initPreview(r)}}},{key:"previewImg",value:function(){var e=this.params,t=e.src,i=e.alt,n=e.fallback,a=document.createElement("div");a.setAttribute("id",this.id+"-preview"),a.setAttribute("class","ezuikit-image-preview"),a.innerHTML='\n\t\t\t
    \n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t
    \n\t\t\t');var r=document.createElement("img");r.setAttribute("class","ezuikit-image-preview-img"),r.setAttribute("alt",i),r.setAttribute("src",t),r.addEventListener("error",(function(){r.setAttribute("src",n)})),document.body.appendChild(a),a.querySelector(".ezuikit-image-preview-img-main").appendChild(r),document.getElementById(this.id+"-ezuikit-image-preview-operations").addEventListener("click",(function(){document.body.removeChild(a)}))}},{key:"initImage",value:function(e){var t=this.params,i=t.src,n=t.alt,a=t.fallback,r=document.createElement("img");r.setAttribute("class","ezuikit-image-img"),r.setAttribute("alt",n),r.setAttribute("src",i),r.addEventListener("error",(function(){r.setAttribute("src",a)})),e.appendChild(r)}},{key:"initPreview",value:function(e){var t=this,i=this.params.showIcon,n=document.createElement("div");n.setAttribute("class","ezuikit-image-mask"),i&&(n.innerHTML='\n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t预览\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t\t'),e.appendChild(n),e.onclick=function(){t.previewImg()}}}]),e}(),tt=function(){function e(i){r(this,e);this.params=t(t({},{id:"",parentNodeId:"",title:"",content:"",placement:"top",cancelText:"取消",arrowPointAtCenter:!1,okText:"确定",onCancel:function(){},onConfirm:function(){}}),i),this.initState=!1,this.init(i)}return s(e,[{key:"init",value:function(){var e=this,t=this.params,i=t.id,n=t.content,a=t.placement,r=t.title,o=document.getElementById(i);if(o){var s=document.createElement("div");if(s.setAttribute("id",i+"-popover"),s.setAttribute("class","ezuikit-popover"),s.setAttribute("style","display:none;"),s.innerHTML='\n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t'.concat(r?'
    '.concat(r,"
    "):"",'\n\t\t\t\t\t\t
    ').concat(n,"
    \n\t\t\t\t\t
    \n\t\t\t\t"),!document.getElementById(i+"-popover")){var l=document.body;this.params.parentNodeId&&(l=document.getElementById(this.params.parentNodeId)),l.appendChild(s),this.renderPopover(s,o,a)}document.body.addEventListener("click",(function(t){e.addEventListenerFn(t)}))}}},{key:"addEventListenerFn",value:function(e){var t=this.params.id,i=document.getElementById(t),n=document.getElementById(t+"-popover");i&&e.target!==i&&!i.contains(e.target)&&n&&e.target!==n&&!n.contains(e.target)&&this.hidePopover()}},{key:"hidePopover",value:function(){var e=this.params.id,t=document.getElementById(e+"-popover");t&&document.body.removeChild(t)}},{key:"renderPopover",value:function(e,t,i,n,a){e.style.display="block";var r=t.getBoundingClientRect(),o=r.top,s=r.left,l=r.width,c=r.height,d=e.getBoundingClientRect(),u=d.width,h=d.height;n&&(u=n),a&&(h=a);var f=document.body;this.params.parentNodeId&&(f=document.getElementById(this.params.parentNodeId));var x=this.params.arrowPointAtCenter,p=0,m=0,_=e.getElementsByClassName("ezuikit-popover-arrow")[0],g=_.getBoundingClientRect(),v=g.width,y=g.height;if(x){var S=0,b=0;switch(i){case"top":default:S=u/2,b=h;break;case"bottom":S=u/2,b=0;break;case"left":S=u,b=h/2;break;case"right":S=0,b=h/2;break;case"topLeft":S=(l-v)/2,b=h;break;case"topRight":S=u-(l+v)/2,b=h;break;case"bottomLeft":S=(l-v)/2,b=0;break;case"bottomRight":S=u-(l+v)/2,b=0;break;case"leftTop":S=u,b=(c-y)/2;break;case"leftBottom":S=u,b=h-(c+y)/2;break;case"rightTop":S=0,b=(c-10)/2;break;case"rightBottom":S=0,b=h-(c+y)/2}_.style.left=S+"px",_.style.top=b+"px"}switch(i){case"top":p=-(h+y),m=(l-u)/2,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-top");break;case"bottom":p=c-y/2,m=(l-u)/2,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-bottom");break;case"left":p=(c-h)/2,m=-(u+v/2),e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-left");break;case"right":p=(c-h)/2,m=l-v/2,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-right");break;case"topLeft":p=-(h+y),m=0,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-topLeft");break;case"topRight":p=-(h+y),m=l-u,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-topRight");break;case"bottomLeft":p=c-y/2,m=0,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-bottomLeft");break;case"bottomRight":p=c-y/2,m=l-u,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-bottomRight");break;case"leftTop":p=0,m=-(u+v/2),e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-leftTop");break;case"leftBottom":p=c-h,m=-(u+v/2),e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-leftBottom");break;case"rightTop":p=0,m=l-v/2,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-rightTop");break;case"rightBottom":p=c-h,m=l-v/2,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-rightBottom");break;default:p=-h,m=(l-u)/2,e.setAttribute("class","ezuikit-popover ezuikit-popover-placement-top")}var P=document.documentElement.scrollTop||document.body.scrollTop,E=document.documentElement.scrollLeft||document.body.scrollLeft;e.style.top=o+P+p+"px",e.style.left=s+E+m+"px";var C=e.getBoundingClientRect(),T=f===document.body?{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}:f.getBoundingClientRect(),R=i;C.leftT.right&&(R=(R=R.replace("Left","Right")).replace("left","right")),C.topT.bottom&&(R=(R=R.replace("Bottom","Top")).replace("bottom","top")),R!==i&&this.renderPopover(e,t,R,u,h)}}]),e}(),it=function(){function e(i){r(this,e);this.params=t(t({},{id:"",content:"",placement:"top",cancelText:"取消",arrowPointAtCenter:!1,okText:"确定",onCancel:function(){},onConfirm:function(){}}),i),this.PopconfirmDom=null,this.init(i)}return s(e,[{key:"init",value:function(){var e=this,i=this.params,n=i.content,a=i.cancelText,r=i.okText,o=i.onCancel,s=i.onConfirm,l=document.createElement("div");l.innerHTML='\n
    \n
    \n\t\t\t\t\t\n \t\n \n\t\t\t\t\t\n
    \n
    \n
    \n ');var c=document.createElement("button");c.className="ezuikit-btn ezuikit-cancel-btn",c.innerText=a;var d=document.createElement("button");return d.className="ezuikit-btn ezuikit-ok-btn ezuikit-btn-primary",d.innerText=r,l.querySelector(".ezuikit-popover-buttons").appendChild(c),l.querySelector(".ezuikit-popover-buttons").appendChild(d),this.PopconfirmDom=new tt(t(t({},this.params),{},{content:l.innerHTML})),document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-cancel-btn")&&(document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-cancel-btn").onclick=function(){o?o():e.hide()}),document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-ok-btn")&&(document.getElementById("".concat(this.params.id,"-popover")).querySelector(".ezuikit-ok-btn").onclick=function(){s?s():e.hide()}),this.PopconfirmDom}},{key:"hide",value:function(){this.PopconfirmDom.hidePopover()}}]),e}(),nt=function(){function e(i){r(this,e);this.params=t(t({},{id:"",width:"100%",height:"100%",preview:!0,poster:"",fallback:"https://img.ys7.com/group32/M00/81/9D/CtxIA2HnrGyADm_jAAAFfWjIDJs811.png",src:""}),i),this.id=Math.random().toString(36).substr(2),this.init()}return s(e,[{key:"init",value:function(){var e=this.params,t=e.id,i=e.width,n=e.height,a=e.preview;if(document.getElementById(t)){var r=document.createElement("div");r.setAttribute("class","ezuikit-video"),r.setAttribute("style","width:".concat(i,";height:").concat(n,";")),document.getElementById(t).appendChild(r),this.initVideo(r),a&&this.initPreview(r)}}},{key:"previewVideo",value:function(){var e=this.params.src,t=document.createElement("div");t.setAttribute("id",this.id+"-preview"),t.setAttribute("class","ezuikit-image-video"),t.innerHTML='\n\t\t\t
    \n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t
    \n\t\t\t'),document.body.appendChild(t),document.getElementById(this.id+"-ezuikit-video-preview-operations").addEventListener("click",(function(){document.body.removeChild(t)}))}},{key:"initVideo",value:function(e){var t=this.params,i=t.poster,n=t.fallback,a=document.createElement("img");a.setAttribute("class","ezuikit-video-img"),a.setAttribute("src",i),a.addEventListener("error",(function(){a.setAttribute("src",n)})),e.appendChild(a)}},{key:"initPreview",value:function(e){var t=this,i=document.createElement("div");i.setAttribute("class","ezuikit-video-mask"),i.innerHTML='\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
    \n\t\t\t',e.appendChild(i),e.onclick=function(){t.previewVideo()}}}]),e}(),at=function(e,t,i,n){var a={accessToken:e.accessToken,inspectRecordId:t,page:0},r="".concat(e.env.domain,"/api/service/devicekit/bodycamera/device/trace");Ee(r,"GET",a,(function(e){i&&i(e)}),(function(e){n&&n(e)}),{"Content-Type":"application/x-www-form-urlencoded"})},rt=function(e,t,i,n){var a={accessToken:e.accessToken,deviceSerial:P(e.url).deviceSerial,validateCode:P(e.url).validCode,channelNo:P(e.url).channelNo,evidenceFileType:t},r="".concat(e.env.domain,"/api/service/devicekit/common/file/evidence");Ee(r,"POST",a,(function(e){i&&i(e)}),(function(e){n&&n(e)}),{"Content-Type":"application/x-www-form-urlencoded"})},ot=function(e,t,i,n){var a={accessToken:e.accessToken,taskId:t},r="".concat(e.env.domain,"/api/service/devicekit/opencloud/task/info");Ee(r,"GET",a,(function(e){i&&i(e)}),(function(e){n&&n(e)}),{"Content-Type":"application/x-www-form-urlencoded"})};var st=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){};r(this,e),this.jSPlugin=t,this.currentEventInfo=i,this.inspectInfo=t.Theme.inspect.inspectInfo,this.type=a,this.timer=n,this.startTime=1e3,this.videoRecordingStatus=!0,this.saveSuccessCallback=o,this.init()}return s(e,[{key:"init",value:function(){this.renderEventDetail(),this.eventDetailDomEvent()}},{key:"show",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-wrap")).setAttribute("class","inspect-event-detail-wrap show")}},{key:"hide",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-wrap")).setAttribute("class","inspect-event-detail-wrap"),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-box")).innerHTML=""}},{key:"validationEventTag",value:function(){return 0==document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).value.length?(document.getElementById("".concat(this.jSPlugin.id,"-event-tag-error")).style.display="block",document.getElementById("".concat(this.jSPlugin.id,"-event-tag-error")).innerHTML="请输入事件标签",document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).setAttribute("class","ezuikit-input input-has-error"),!1):(document.getElementById("".concat(this.jSPlugin.id,"-event-tag-error")).style.display="none",document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).setAttribute("class","ezuikit-input"),!0)}},{key:"renderVideo",value:function(e,t,i){var n=this;if(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview")).innerHTML="",1===e||2===e){if(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview")).innerHTML='\n
    \n
    \n
    \n
    \n 视频正在存储中…\n
    \n '),1!==this.type){var a=this.currentEventInfo.evidenceId;this.timer.clearTimer("videoRecordingStatusTimer"),this.timer.createInterval("videoRecordingStatusTimer",(function(){ot(n.jSPlugin,a,(function(e){if(e.meta&&200===e.meta.code){var t=e.data,i=t.taskStatus,a=t.fileUrl,r=t.videoCoverPic||"".concat(n.jSPlugin.staticPath,"/imgs/bg.svg");n.renderVideo(i,r,a)}}))}),1e3)}}else 4===e||5===e||6===e||7===e?(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview")).innerHTML='\n
    \n
    \n \n
    \n 视频存储失败\n
    \n '),this.timer.clearTimer("videoRecordingStatusTimer")):0!==e&&3!==e||(new nt({id:"".concat(this.jSPlugin.id,"-inspectEventDetail-videoPreview"),poster:t,fallback:"".concat(this.jSPlugin.staticPath,"/imgs/bg.svg"),src:i}),this.timer.clearTimer("videoRecordingStatusTimer"))}},{key:"renderEventDetail",value:function(){var e=this,t=this.currentEventInfo,i=t.evidenceFileType,n=t.fileUrl,a=t.taskStatus,r=t.videoCoverPic,o=document.createElement("div");o.setAttribute("class","inspectEventDetail");var s="";if(s=1===i?r||"".concat(this.jSPlugin.staticPath,"/imgs/bg.svg"):n||"".concat(this.jSPlugin.staticPath,"/imgs/bg.svg"),o.innerHTML='\n
    \n
    \n \n
    \n
    ').concat(1===this.type?"编辑":"").concat(0===i?"图片存证":"视频存证",'
    \n
    \n
    \n ').concat(0===i?'
    \n

    图片已取证,请填写存证信息:

    \n
    \n
    '):'
    \n \n
    \n \n
    00:00:00
    \n
    \n \n
    \n
    \n

    视频已取证:

    \n
    \n
    \n
    '),'\n \n
    \n \n '),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-detail-box")).appendChild(o),1===this.type?document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML="".concat(1===i?this.currentEventInfo.eventBeginTime+" ~ "+this.currentEventInfo.eventEndTime:this.currentEventInfo.eventTime):(document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML="".concat((new Date).Format("yyyy-MM-dd hh:mm:ss")).concat(1===i?" ~ -":""),1===i&&document.getElementById("".concat(this.jSPlugin.id,"-video-recording-time"))&&this.videoRecordingStatus&&(0===this.type&&document.getElementById("".concat(this.jSPlugin.id,"-event-ok")).setAttribute("disabled","disabled"),this.timer.createInterval("videoRecordingTimer",(function(){var t,i,n,a;e.startTime&&(document.getElementById("".concat(e.jSPlugin.id,"-video-recording-time")).innerHTML=(t=e.startTime,i=parseInt(t%864e5/36e5),n=parseInt(t%36e5/6e4),a=parseInt(t%6e4/1e3),(i<10?"0".concat(i):i)+":"+(n<10?"0".concat(n):n)+":"+(a<10?"0".concat(a):a))),e.startTime+=1e3,e.startTime>e.jSPlugin.inspectRecordingDuration&&(document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).click(),e.timer&&e.timer.clearTimer("videoRecordingTimer"))}),1e3))),1===i){var l=this.currentEventInfo&&this.currentEventInfo.fileUrl;this.renderVideo(a,s,l)}else new et({id:"".concat(this.jSPlugin.id,"-inspectEventDetail-picUrl"),src:s,fallback:"".concat(this.jSPlugin.staticPath,"/imgs/fallback.svg"),showIcon:!1});this.show()}},{key:"eventDetailDomEvent",value:function(){var e=this,t=this.currentEventInfo,i=t.evidenceFileType,n=t.evidenceId;document.getElementById("".concat(this.jSPlugin.id,"-event-cancel")).addEventListener("click",(function(t){e.cancelPopover=new it({id:"".concat(e.jSPlugin.id,"-event-cancel"),content:"确定要取消吗?".concat(1===e.type?"取消后编辑的内容将不会保存。":"取消后对应存证也将删除。"),placement:"topRight",arrowPointAtCenter:!0,onCancel:function(){e.cancelPopover.hide()},onConfirm:function(){1===i&&(e.videoRecordingStatus&&0===e.type&&(e.timer&&e.timer.clearTimer("videoRecordingTimer"),e.startTime=1e3,document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).click()),e.timer.clearTimer("videoRecordingStatusTimer")),e.cancelPopover.hide(),e.hide()}})})),document.getElementById("".concat(this.jSPlugin.id,"-event-ok")).addEventListener("click",(function(){if(e.validationEventTag()){var t=e.currentEventInfo,i=t.evidenceFileType,n=t.evidenceId,a=e.inspectInfo,r=a.inspectRecordId,o=a.inspectPerson,s=document.getElementById("".concat(e.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML,l={inspectRecordId:r,depositaryOfficer:o,evidenceFileId:n,evidenceFileType:i,eventType:document.getElementById("".concat(e.jSPlugin.id,"-event-tag")).value,eventRemark:document.getElementById("".concat(e.jSPlugin.id,"-event-remark")).value};1===i&&(l.eventBeginTime=s.split("~")[0].trim(),l.eventEndTime=s.split("~")[1].trim(),e.timer.clearTimer("videoRecordingStatusTimer")),0===i&&(l.eventTime=s),1===e.type&&(l.inspectEventId=e.currentEventInfo.inspectEventId,delete l.depositaryOfficer,delete l.eventTime,delete l.eventBeginTime,delete l.eventEndTime,delete l.evidenceFileId,delete l.evidenceFileType,function(e,t,i,n){var a={accessToken:e.accessToken,inspectRecordId:"",inspectEventId:"",eventType:"",eventRemark:""},r=Object.assign(a,t),o="".concat(e.env.domain,"/api/service/devicekit/bodycamera/inspect/event/update");Ee(o,"POST",r,(function(e){i&&i(e)}),(function(e){n&&n(e)}),{"Content-Type":"application/x-www-form-urlencoded"})}(e.jSPlugin,l,(function(t){t.meta&&200===t.meta.code?(e.hide(),e.saveSuccessCallback&&e.saveSuccessCallback({eventType:l.eventType,eventRemark:l.eventRemark})):new Qe({type:"error",content:"保存失败,".concat(t.meta&&t.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){new Qe({type:"error",content:"保存失败,请稍后重试!",wrapNode:document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-box")),top:40})}))),0===e.type&&function(e,t,i,n){var a={accessToken:e.accessToken,inspectRecordId:"",eventType:"",evidenceFileId:"",eventTime:"",eventBeginTime:"",eventEndTime:"",depositaryOfficer:"",eventRemark:"",evidenceFileType:""},r=Object.assign(a,t),o="".concat(e.env.domain,"/api/service/devicekit/bodycamera/inspect/event");Ee(o,"POST",r,(function(e){i&&i(e)}),(function(e){n&&n(e)}),{"Content-Type":"application/x-www-form-urlencoded"})}(e.jSPlugin,l,(function(t){t.meta&&200===t.meta.code?(e.hide(),e.saveSuccessCallback&&e.saveSuccessCallback()):new Qe({type:"error",content:"保存失败,".concat(t.meta&&t.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){new Qe({type:"error",content:"保存失败,请稍后重试!",wrapNode:document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-box")),top:40})}))}})),document.getElementById("".concat(this.jSPlugin.id,"-inspectEventDetail-back")).addEventListener("click",(function(){e.backPopover=new it({id:"".concat(e.jSPlugin.id,"-inspectEventDetail-back"),content:"确定要返回吗?".concat(1===e.type?"返回后编辑的内容将不会保存。":"返回后对应存证也将删除。"),placement:"bottomRight",arrowPointAtCenter:!0,onCancel:function(){e.backPopover.hide()},onConfirm:function(){1===i&&(e.videoRecordingStatus&&0===e.type&&(e.timer&&e.timer.clearTimer("videoRecordingTimer"),e.startTime=1e3,document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).click()),e.timer.clearTimer("videoRecordingStatusTimer")),e.backPopover.hide(),e.hide()}})})),document.getElementById("".concat(this.jSPlugin.id,"-video-recording-stop-btn"))&&document.getElementById("".concat(this.jSPlugin.id,"-video-recording-stop-btn")).addEventListener("click",(function(){document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).setAttribute("class","inspectEventDetail-stop-btn ezuikit-btn ezuikit-btn-loading"),document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).querySelector(".ezuikit-btn-loading-icon").style.display="inline-block",function(e,t,i,n){var a={accessToken:e.accessToken,taskId:t},r="".concat(e.env.domain,"/api/v3/open/cloud/video/frame/stop");Ee(r,"POST",a,(function(e){i&&i(e)}),(function(e){n&&n(e)}),{"Content-Type":"application/x-www-form-urlencoded"})}(e.jSPlugin,n,(function(t){document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn"))&&(document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).setAttribute("class","inspectEventDetail-stop-btn ezuikit-btn"),document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).querySelector(".ezuikit-btn-loading-icon").style.display="none"),t.meta&&200===t.meta.code?ot(e.jSPlugin,n,(function(t){if(t.meta&&200===t.meta.code){var i=t.data,n=i.taskStatus,a=i.fileUrl,r=i.videoCoverPic;e.timer&&e.timer.clearTimer("videoRecordingTimer");var o=r||"".concat(e.jSPlugin.staticPath,"/imgs/bg.svg");e.renderVideo(n,o,a),document.getElementById("".concat(e.jSPlugin.id,"-inspectEventDetail-content-video-info")).style.display="block",document.getElementById("".concat(e.jSPlugin.id,"-inspectEventDetail-content-video-timer")).style.display="none";var s=document.getElementById("".concat(e.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML;document.getElementById("".concat(e.jSPlugin.id,"-inspectEventDetail-content-info-time")).innerHTML="".concat(s.split("~")[0]," ~ ").concat((new Date).Format("yyyy-MM-dd hh:mm:ss")),e.videoRecordingStatus=!1,document.getElementById("".concat(e.jSPlugin.id,"-event-ok")).removeAttribute("disabled")}})):new Qe({type:"error",content:"停止录制失败,请稍后重试!",wrapNode:document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn"))&&(document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).setAttribute("class","inspectEventDetail-stop-btn ezuikit-btn"),document.getElementById("".concat(e.jSPlugin.id,"-video-recording-stop-btn")).querySelector(".ezuikit-btn-loading-icon").style.display="none"),new Qe({type:"error",content:"停止录制失败,请稍后重试!",wrapNode:document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-box")),top:40})}))})),document.getElementById("".concat(this.jSPlugin.id,"-event-tag")).addEventListener("input",(function(){e.validationEventTag()})),document.getElementById("".concat(this.jSPlugin.id,"-event-remark")).addEventListener("input",(function(e){var t=e.target.value;e.target.parentNode.setAttribute("data-count","".concat(t.length," / 100"))})),document.getElementById("".concat(this.jSPlugin.id,"-event-remark")).addEventListener("focus",(function(e){e.target.parentNode.setAttribute("class","ezuikit-input-textarea ezuikit-input-textarea-show-count ezuikit-input-textarea-focus")})),document.getElementById("".concat(this.jSPlugin.id,"-event-remark")).addEventListener("blur",(function(e){e.target.parentNode.setAttribute("class","ezuikit-input-textarea ezuikit-input-textarea-show-count")}))}}]),e}(),lt=function(){function e(t,i,n){var a=this;r(this,e),l(this,"hideDelEConfirm",(function(){for(var e=0;e\n

    巡检事件

    \n
    \n
    \n \n \n 图片存证\n \n \n \n 视频存证\n
    \n
    \n \n \n \n
    \n
    \n \n
    \n
    \n
    \n \n

    暂无事件

    \n
    \n \n \n
    \n

    巡检事件

    \n
    \n
    \n '),document.getElementById("".concat(a.jSPlugin.id,"-wrap")).appendChild(t),a.jSPlugin.Theme.decoderState.state.play?a.enableEvidenceBtn():a.disableEvidenceBtn(),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-img")).onclick=function(){a.listLoading||a.startEvidence||(a.startEvidence=!0,a.hideDelEConfirm(),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-img")).setAttribute("class","ezuikit-btn ezuikit-btn-primary ezuikit-btn-loading"),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-img")).querySelector(".ezuikit-btn-loading-icon").style.display="inline-block",rt(a.jSPlugin,0,(function(e){a.startEvidence=!1,document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-img")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-img")).querySelector(".ezuikit-btn-loading-icon").style.display="none",e.meta&&200===e.meta.code?new st(a.jSPlugin,e.data,a.timer,0,(function(){a.initEvent(),new Qe({type:"success",content:"保存成功",wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})})):new Qe({type:"error",content:"图片存证失败,".concat(e.meta&&e.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){a.startEvidence=!1,document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-img")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-img")).querySelector(".ezuikit-btn-loading-icon").style.display="none",new Qe({type:"error",content:"图片存证失败,请稍后重试!",wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})})))},document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-video")).onclick=function(){a.listLoading||a.startEvidence||(a.startEvidence=!0,a.hideDelEConfirm(),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-video")).setAttribute("class","ezuikit-btn ezuikit-btn-primary ezuikit-btn-loading"),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-video")).querySelector(".ezuikit-btn-loading-icon").style.display="inline-block",rt(a.jSPlugin,1,(function(e){a.startEvidence=!1,document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-video")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-video")).querySelector(".ezuikit-btn-loading-icon").style.display="none",e.meta&&200===e.meta.code?new st(a.jSPlugin,e.data,a.timer,0,(function(){a.initEvent(),new Qe({type:"success",content:"保存成功",wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})})):new Qe({type:"error",content:"视频存证失败,".concat(e.meta&&e.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){a.startEvidence=!1,document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-video")).setAttribute("class","ezuikit-btn ezuikit-btn-primary"),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-video")).querySelector(".ezuikit-btn-loading-icon").style.display="none",new Qe({type:"error",content:"视频存证失败,请稍后重试!",wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})})))},document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-list-refresh")).onclick=function(){a.listLoading||a.startEvidence||(a.hideDelEConfirm(),document.getElementById("".concat(a.jSPlugin.id,"-inspect-loading")).style.display="block",document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-list-wrap")).style.display="none",document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-list-nodata-wrap")).style.display="none",e.initEvent())}}})),l(this,"renderList",(function(e){document.getElementById("".concat(a.jSPlugin.id,"-inspect-loading")).style.display="none";var t=e.data||[];if(t.length>0){document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-list-wrap")).style.display="block",document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-list-nodata-wrap")).style.display="none";for(var i=function(){var i=document.createElement("div");i.setAttribute("class","inspect-event-item");var r=t[n];i.setAttribute("id","".concat(a.jSPlugin.id,"-inspect-event-item-").concat(r.inspectEventId)),i.innerHTML="",document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-list-wrap-main")).appendChild(i);var o,s=document.createElement("div");s.setAttribute("class","inspect-event-item-header-wrap"),1==r.evidenceFileType&&(o="".concat(r.eventBeginTime.split(" ")[1],"~").concat(r.eventEndTime.split(" ")[1])),0==r.evidenceFileType&&(o="".concat(r.eventTime.split(" ")[1]));var l="";1===r.evidenceFileType&&(1===r.taskStatus||2===r.taskStatus?l="storage":4===r.taskStatus||5===r.taskStatus||6===r.taskStatus||7===r.taskStatus?l="storage-error":0!==r.taskStatus&&3!==r.taskStatus||(l="storage-success")),s.innerHTML='\n
    \n
    \n \n \n \n \n \n \n \n \n \n ').concat(o||"-",'\n
    \n
    \n \n \n \n \n
    \n
    \n '),i.appendChild(s),s.onclick=function(e){"none"===s.querySelector(".inspect-event-item-header-toggle-up").style.display?(s.querySelector(".inspect-event-item-header-toggle-up").style.display="block",s.querySelector(".inspect-event-item-header-toggle-down").style.display="none",i.querySelector(".inspect-event-item-body").style.display="block"):(s.querySelector(".inspect-event-item-header-toggle-up").style.display="none",s.querySelector(".inspect-event-item-header-toggle-down").style.display="block",i.querySelector(".inspect-event-item-body").style.display="none")};var c=document.createElement("div");c.setAttribute("class","inspect-event-item-body"),c.style.display="none";var d=(1===r.evidenceFileType?r.videoCoverPic:r.fileUrl)||"".concat(a.jSPlugin.staticPath,"/imgs/bg.svg");c.innerHTML='\n
    \n
    \n
    \n ').concat(r.eventType,"\n
    \n
    \n "),i.appendChild(c),1==r.evidenceFileType&&(1===r.taskStatus||2===r.taskStatus?document.getElementById("".concat(a.jSPlugin.id,"-inspect-view-").concat(r.inspectEventId)).innerHTML='\n
    \n
    \n
    \n
    \n 视频正在存储中…\n
    \n '):4===r.taskStatus?document.getElementById("".concat(a.jSPlugin.id,"-inspect-view-").concat(r.inspectEventId)).innerHTML='\n
    \n
    \n \n
    \n 视频存储失败\n
    \n '):0!==r.taskStatus&&3!==r.taskStatus||new nt({id:"".concat(a.jSPlugin.id,"-inspect-view-").concat(r.inspectEventId),src:r.fileUrl,poster:d,fallback:"".concat(a.jSPlugin.staticPath,"/imgs/bg.svg")})),0==r.evidenceFileType&&new et({id:"".concat(a.jSPlugin.id,"-inspect-view-").concat(r.inspectEventId),src:d,fallback:"".concat(a.jSPlugin.staticPath,"/imgs/bg.svg"),showIcon:!1});var u=document.createElement("div");u.setAttribute("class","inspect-event-item-body-info-opr");var h=document.createElement("span");h.setAttribute("class","inspect-event-item-body-info-opr-icon"),h.innerHTML='\n \n ',u.appendChild(h);var f=document.createElement("span");f.setAttribute("class","inspect-event-item-body-info-opr-icon"),f.id="".concat(a.jSPlugin.id,"-inspect-event-del-").concat(r.inspectEventId),f.innerHTML=' \n \n ',u.appendChild(f),h.onclick=function(e){a.startEvidence||new st(a.jSPlugin,r,a.timer,1,(function(e){new Qe({type:"success",content:"保存成功",wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40}),r=Object.assign(r,e),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-item-").concat(r.inspectEventId)).querySelector(".inspect-event-item-body-info-tag-label").innerHTML=r.eventType,document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-item-").concat(r.inspectEventId)).querySelector(".inspect-event-item-body-info-tag-label").setAttribute("title",r.eventType)}))},f.onclick=function(e){a.startEvidence||(a.delE=new it({id:"".concat(a.jSPlugin.id,"-inspect-event-del-").concat(r.inspectEventId),content:"确定要删除该事件吗?",placement:"topRight",arrowPointAtCenter:!0,onCancel:function(){a.delE.hide()},onConfirm:function(){!function(e,t,i,n){var a={accessToken:e.accessToken,inspectEventId:""},r=Object.assign(a,t),o="".concat(e.env.domain,"/api/service/devicekit/bodycamera/inspect/event/delete");Ee(o,"POST",r,(function(e){i&&i(e)}),(function(e){n&&n(e)}),{"Content-Type":"application/x-www-form-urlencoded"})}(a.jSPlugin,{inspectEventId:r.inspectEventId},(function(e){e.meta&&200===e.meta.code?(a.delE.hide(),a.initEvent(),setTimeout((function(){new Qe({type:"success",content:"删除成功",wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})}),10)):new Qe({type:"error",content:"删除失败,".concat(e.meta&&e.meta.message||"请稍后重试!"),wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})}),(function(){new Qe({type:"error",content:"删除失败,请稍后重试!",wrapNode:document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-box")),top:40})}))}}),a.delEConfirmList.push(a.delE))},i.querySelector(".inspect-event-item-body-info").appendChild(u),document.getElementById("".concat(a.jSPlugin.id,"-inspect-event-list-wrap")).onscroll=function(t){var i=t.target;a.hideDelEConfirm(),i.scrollTop+i.offsetHeight>=i.scrollHeight-48&&!a.listLoading&&(e.start+1)*e.size0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,n=this;n.listLoading=!0,0===t?n.initRender(t):document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-list-more-loading")).style.display="flex";var a=function(t){new Qe({type:"error",content:t.meta&&t.meta.message||"列表获取失败,请稍后重试!",wrapNode:document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-box")),top:40}),n.renderList({})};!function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,a=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,o={accessToken:e.accessToken,inspectRecordId:t,pageStart:i,pageSize:n},s="".concat(e.env.domain,"/api/service/devicekit/bodycamera/inspect/event/page");Ee(s,"GET",o,(function(e){a&&a(e)}),(function(e){r&&r(e)}),{"Content-Type":"application/x-www-form-urlencoded"})}(n.jSPlugin,n.inspectRecordId,t,i,(function(t){n.listLoading=!1,document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-list-more-loading")).style.display="none",t.meta&&200===t.meta.code?n.renderList(t.data||{}):a(t)}),(function(t){n.listLoading=!1,document.getElementById("".concat(e.jSPlugin.id,"-inspect-event-list-more-loading")).style.display="none",a(t)}))}},{key:"disableEvidenceBtn",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-img")).setAttribute("disabled","disabled"),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-video")).setAttribute("disabled","disabled")}},{key:"enableEvidenceBtn",value:function(){document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-img")).removeAttribute("disabled"),document.getElementById("".concat(this.jSPlugin.id,"-inspect-event-video")).removeAttribute("disabled")}}]),e}(),ct=function(){function e(t,i,n,a,o){var s=this;r(this,e),l(this,"createLocationControl",(function(){var e=s;function t(){this.defaultAnchor=BMAP_ANCHOR_BOTTOM_LEFT,this.defaultOffset=new BMapGL.Size(40,105)}return t.prototype=new BMapGL.Control,t.prototype.initialize=function(t){var i=document.createElement("div");return i.style.cssText="width: 26px;height: 26px;display: flex;align-items: center;justify-content: center; box-shadow: 1px 2px 1px rgb(0 0 0 / 15%); background: #fff; cursor: pointer;",i.id="".concat(e.jSPlugin.id,"-location-btn"),i.innerHTML='\n \n ',i.onclick=function(t){setTimeout((function(){e.inspectMapWin.centerToTrack(18)}),100)},t.getContainer().appendChild(i),i},new t})),l(this,"initSwithcBtn",(function(){var e=document.createElement("div");e.id="".concat(s.jSPlugin.id,"-miniSwitch"),e.style="cursor: pointer;position: absolute; bottom: 106px; right: ".concat(s.jSPlugin.inspectVideoWidth+10,"px; z-index: 999;"),e.innerHTML="
    \n \n 大小窗切换\n \n \n \n \n \n
    '),document.getElementById("".concat(s.jSPlugin.id,"-wrap")).appendChild(e),document.getElementById("".concat(s.jSPlugin.id,"-miniSwitch-btn")).onclick=function(){k.throttle((function(){return s.miniRecSwitchClick()}),1e3)()}})),l(this,"initMiniWinToggleBtn",(function(){var e=.3333*s.videoWidth,t=.3333*s.videoHeight,i=document.createElement("div");i.id="".concat(s.jSPlugin.id,"-miniToggle"),i.style="cursor: pointer;position: absolute; bottom: ".concat(t/2+96-30,"px; right: ").concat(s.jSPlugin.inspectVideoWidth+e,"px; z-index: 999; height:60px; box-sizing: border-box; padding-top: 20px; text-align: center; width:20px; overflow: hidden; background: #000000; border-radius: 2px 0px 0px 2px; opacity: 0.7;"),i.innerHTML="
    \n \n \n \n \n
    '),document.getElementById("".concat(s.jSPlugin.id,"-wrap")).appendChild(i),document.getElementById("".concat(s.jSPlugin.id,"-miniToggle")).onclick=function(){s.miniWinToggleClick()}})),l(this,"init",(function(){s.initSwithcBtn(),s.initMiniWinToggleBtn()})),l(this,"setStyleListByIds",(function(e){e.map((function(e){var t=document.getElementById(e.id);t&&Object.keys(e.styleList).map((function(i){t.style[i]=e.styleList[i]}))}))})),this.jSPlugin=t,this.inspectMode=i,this.inspectMapWin=n,this.changeInspectMode=a,this.videoWidth=t.width,this.videoHeight=t.height,this.minWinStatus="open",this.decoderState=o,this.ZoomControl=new BMapGL.ZoomControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT,offset:new BMapGL.Size(40,50)}),this.LocationControl=this.createLocationControl(),this.NavigationControl3D=new BMapGL.NavigationControl3D({anchor:BMAP_ANCHOR_BOTTOM_LEFT,offset:new BMapGL.Size(28,105)}),this.init()}return s(e,[{key:"miniWinToggleClick",value:function(){var e=.3333*this.jSPlugin.width;"open"===this.minWinStatus?(this.setStyleListByIds([{id:"video"===this.inspectMode?"".concat(this.jSPlugin.id,"-mapbox"):"".concat(this.jSPlugin.id),styleList:{width:"0px"}},{id:"".concat(this.jSPlugin.id,"-miniSwitch"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-miniToggle"),styleList:{right:"".concat(this.jSPlugin.inspectVideoWidth,"px")}},{id:"".concat(this.jSPlugin.id,"-min-win-close-icon"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-min-win-open-icon"),styleList:{display:"inline-block"}}]),this.minWinStatus="close"):(this.setStyleListByIds([{id:"video"===this.inspectMode?"".concat(this.jSPlugin.id,"-mapbox"):"".concat(this.jSPlugin.id),styleList:{width:e+"px"}},{id:"".concat(this.jSPlugin.id,"-miniSwitch"),styleList:{display:"block"}},{id:"".concat(this.jSPlugin.id,"-miniToggle"),styleList:{right:"".concat(this.jSPlugin.inspectVideoWidth+e,"px")}},{id:"".concat(this.jSPlugin.id,"-min-win-close-icon"),styleList:{display:"inline-block"}},{id:"".concat(this.jSPlugin.id,"-min-win-open-icon"),styleList:{display:"none"}}]),this.minWinStatus="open")}},{key:"miniRecSwitchClick",value:function(){var e=this,t=.3333*this.jSPlugin.width,i=.3333*this.jSPlugin.height;"video"===this.inspectMode?(this.jSPlugin.Zoom&&this.jSPlugin.Zoom.stopZoom(),this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-mapbox"),styleList:{width:this.jSPlugin.width+"px",height:this.jSPlugin.height+"px",marginBottom:"-40px"}},{id:"".concat(this.jSPlugin.id,"-ez-iframe-footer-container"),styleList:{top:this.jSPlugin.height+"px"}},{id:"".concat(this.jSPlugin.id),styleList:{position:"absolute",zIndex:"100",bottom:"96px",right:"".concat(this.jSPlugin.inspectVideoWidth,"px"),overflow:"hidden"}}]),this.jSPlugin.Theme.inspect.reSizeVideo(t,i),this.inspectMode="map",this.changeInspectMode("map"),this.inspectMapWin.map.addControl(this.NavigationControl3D),this.inspectMapWin.map.addControl(this.LocationControl),this.inspectMapWin.map.addControl(this.ZoomControl),this.inspectMapWin.map.addOverlay(this.inspectMapWin.inspectRange),document.getElementById("".concat(this.jSPlugin.id,"-loading-item-btn-wrap"))&&this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-loading-item-btn"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-svg"),styleList:{display:"block"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-wrap"),styleList:{border:"none",width:"32px",height:"14px"}}]),setTimeout((function(){e.inspectMapWin.centerToTrack(18)}),100)):(this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-mapbox"),styleList:{width:t+"px",height:i+"px",marginBottom:"0"}},{id:"".concat(this.jSPlugin.id,"-ez-iframe-footer-container"),styleList:{top:"0px"}},{id:"".concat(this.jSPlugin.id),styleList:{position:"relative",zIndex:"0",bottom:"0",right:"0"}}]),this.jSPlugin.Theme.inspect.reSizeVideo(this.jSPlugin.width,this.jSPlugin.height),this.inspectMode="video",this.changeInspectMode("video"),this.inspectMapWin.map.removeControl(this.ZoomControl),this.inspectMapWin.map.removeControl(this.NavigationControl3D),this.inspectMapWin.map.removeControl(this.LocationControl),this.inspectMapWin.map.removeOverlay(this.inspectMapWin.inspectRange),document.getElementById("".concat(this.jSPlugin.id,"-loading-item-btn-wrap"))&&this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-loading-item-btn"),styleList:{display:"block"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-svg"),styleList:{display:"none"}},{id:"".concat(this.jSPlugin.id,"-loading-item-btn-wrap"),styleList:{border:"1px solid rgb(255, 255, 255)",width:"80px",height:"32px",color:"#fff","text-align":"center","line-height":"32px","font-size":"14px"}}]),setTimeout((function(){e.inspectMapWin.centerToTrack()}),100),this.jSPlugin.Zoom&&this.decoderState.state.play&&this.jSPlugin.Zoom.startZoom()),this.setStyleListByIds([{id:"".concat(this.jSPlugin.id,"-wrap"),styleList:{width:this.jSPlugin.width+this.jSPlugin.inspectVideoWidth+"px",height:this.jSPlugin.height+this.jSPlugin.inspectVideoHeight+"px"}}])}}]),e}(),dt={customConfig:{defaultMicro:0,defaultPlay:0,maxTalkTime:0,bellPoster:0,maxBellTime:0,inspectInfo:{color:"#000000",backgroundColor:"#ffffff",activeColor:"#1890FF",btnList:[{btnKey:"inspectName",iconId:"inspectName",part:"left",defaultActive:0,isrender:1,color:"#262626"},{btnKey:"inspectBeginTime",iconId:"inspectBeginTime",part:"left",defaultActive:0,isrender:1,color:"#262626"},{btnKey:"inspectPerson",iconId:"inspectPerson",part:"right",defaultActive:0,isrender:1,color:"#262626"}]}},header:{color:"#2c2c2c",backgroundColor:"#000000",activeColor:"#1890FF",btnList:[{btnKey:"deviceName",iconId:"deviceName",part:"left",defaultActive:0,isrender:1,color:"#ffffff"},{btnKey:"inspectTime",iconId:"inspectTime",part:"left",defaultActive:0,isrender:1,color:"#ffffff"},{btnKey:"signalType",iconId:"signalType",part:"right",defaultActive:0,isrender:1,color:"#ffffff"},{btnKey:"batteryStatus",iconId:"batteryStatus",part:"right",defaultActive:0,isrender:1,color:"#ffffff"}]},footer:{color:"#ffffff",backgroundColor:"#000000",activeColor:"blue",btnList:[{btnKey:"talk",iconId:"talk",part:"left",defaultActive:1,isrender:1,backgroundColor:"#cccccc"},{btnKey:"sound",iconId:"sound",part:"left",defaultActive:1,isrender:1,backgroundColor:"#cccccc"}]}},ut=function(e){var t="";return Object.keys(e).map((function(i,n){t+="".concat(i,":").concat(e[i]).concat(n\n \n ':"".concat(e,""):null}},{key:"renderBatteryStatus",value:function(e){return e&&0!=e?'\n
    \n ').concat(e,'%\n
    \n
    \n
    \n \n \n \n
    \n '):null}},{key:"renderInspectTime",value:function(e){if(!e)return null;var t,i,n,a,r=e.split(" "),o=r[0].split("-"),s=r[1].split(":"),l=new Date(o[0],o[1]-1,o[2],s[0],s[1],s[2]),c=(new Date).getTime()-new Date(l).getTime();return'\n \n '.concat((t=c,i=parseInt(t%864e5/36e5),n=parseInt(t%36e5/6e4),a=parseInt(t%6e4/1e3),(i<10?"0".concat(i):i)+":"+(n<10?"0".concat(n):n)+":"+(a<10?"0".concat(a):a)),"\n ")}},{key:"matchBtn",value:function(e,t){var i=this,n=this.themeData,a=n.customConfig,r=n.header,o=n.footer,s=a.inspectInfo,l={title:"",id:"",domString:"",color:"#FFFFFF",activeColor:"#FFFFFF",onclick:function(){},onmoveleft:function(){},onmoveright:function(){},onremove:function(){}},c=s.btnList.findIndex((function(t){return t.iconId===e}));switch(-1!==c?(l.color=s.color,l.backgroundColor=s.backgroundColor,l.activeColor=s.activeColor):-1!==(c=r.btnList.findIndex((function(t){return t.iconId===e})))?(l.color=r.color,l.backgroundColor=r.backgroundColor,l.activeColor=r.activeColor):(l.color=o.color,l.backgroundColor=o.backgroundColor,l.activeColor=o.activeColor),e){case"inspectName":return l.title="巡检名称",l.id=e,l.domString='巡检名称'),l.onclick=function(){},l;case"inspectBeginTime":return l.title="巡检开始时间",l.id=e,l.domString='巡检开始时间:-'),l.onclick=function(){},l;case"inspectPerson":return l.title="本地巡检员",l.id=e,l.domString='本地巡检员:-'),l.onclick=function(){},l;case"deviceName":return l.title="设备名称",l.id=e,l.domString='设备名称'),l.onclick=function(){},l;case"inspectTime":return l.title="巡检时长",l.id=e,l.domString='巡检时长:-'),l.onclick=function(){},l;case"signalType":return l.title="信号类型",l.id=e,l.domString=''),l.onclick=function(){},l;case"batteryStatus":return l.title="设备电量",l.id=e,l.domString=''),l.onclick=function(){},l;case"talk":return l.title="对讲",l.id=e,l.domString="
    "+'')+''+'对讲'),l.onclick=function(){var e=i.decoderState.state,t=e.talk,n=e.sound;if(e.play)if(t){console.log("结束对讲"),i.setDecoderState({talk:!1}),i.jSPlugin.Talk.stopTalk();var a=k.findIndex(i.themeData.footer.btnList,(function(e){return"sound"===e.iconId&&1===e.isrender&&1===e.defaultActive}))>-1;i.themeData&&a&&(i.jSPlugin.openSound(),i.setDecoderState({sound:!0}))}else console.log("开始对讲"),i.setDecoderState({talk:!0}),i.jSPlugin.Talk.startTalk((function(e){n&&!e&&(i.jSPlugin.closeSound(),i.setDecoderState({sound:!1}))}))},l;case"sound":return l.title="音量",l.id=e,l.domString=''+'')+'\n \n \n \n \n ')+'音量'),l.onclick=function(){var e=i.decoderState.state,t=e.play,n=e.sound,a=e.talk;t&&!a&&(n?(i.jSPlugin.closeSound(),i.setDecoderState({sound:!1})):(i.jSPlugin.openSound(),i.setDecoderState({sound:!0})))},l;default:return l}}},{key:"renderInspectInfo",value:function(e,t){var i=this.matchBtn(e,t),n=document.createElement("sapn");n.innerHTML="".concat(i.domString),"left"===t.part?document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl-left")).appendChild(n):document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl-right")).appendChild(n)}},{key:"renderHeader",value:function(e,t){var i=this.matchBtn(e,t),n=document.createElement("span");n.className="".concat(this.jSPlugin.id,"-header-content"),n.style="display: flex; align-items: center; ",n.innerHTML="\n ".concat(i.domString,"\n "),"left"===t.part?document.getElementById("".concat(this.jSPlugin.id,"-headControl-left")).appendChild(n):document.getElementById("".concat(this.jSPlugin.id,"-headControl-right")).appendChild(n)}},{key:"renderFooter",value:function(e,t){var i=this,n=this.matchBtn(e,t),a=this.videoWidth/6,r=document.createElement("div");r.className="theme-icon-item",this.jSPlugin.isWebConsole?r.style="padding:0 ".concat(.1*a,"px;"):r.style="padding:0 ".concat(.1*a,"px;cursor: pointer;"),r.innerHTML="".concat('')+'
    ')).concat(n.domString,"
    ")+"
    ",r.onclick=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;n.onclick(e)},n.onmouseenter&&(r.onmouseenter=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;n.onmouseenter(e)}),n.onmouseleave&&(r.onmouseleave=function(e){if(i.decoderState.state.isEditing||!i.activeThemeStatus)return!1;n.onmouseleave(e)}),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).appendChild(r)}},{key:"initThemeData",value:function(){var e=this,t=this.themeData,i=t.customConfig,n=t.header,a=t.footer,r=i.inspectInfo,o=this.jSPlugin.id;if(this.isNeedRenderInspectInfo=k.findIndex(r.btnList,(function(e){return e.isrender>0}))>=0,this.isNeedRenderHeader=k.findIndex(n.btnList,(function(e){return e.isrender>0}))>=0,this.isNeedRenderFooter=k.findIndex(a.btnList,(function(e){return e.isrender>0}))>=0,this.isNeedRenderInspectInfo)if(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")))document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).innerHTML="
    ");else{var s=document.createElement("div");s.setAttribute("id","".concat(this.jSPlugin.id,"-inspectInfoControl")),s.setAttribute("class","inspectInfo-controls"),s.innerHTML="
    ");var l={height:"58px",display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#000000",width:"".concat(this.jSPlugin.width+290,"px"),position:"relative","align-items":"center",background:"#ffffff","border-bottom":"1px solid #D9D9D9","box-sizing":"border-box"};s.style=ut(l),document.getElementById("".concat(o,"-wrap")).insertBefore(s,document.getElementById(this.jSPlugin.id));var c=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(c)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")));if(this.isNeedRenderHeader)if(document.getElementById("".concat(this.jSPlugin.id,"-headControl")))document.getElementById("".concat(this.jSPlugin.id,"-headControl")).innerHTML="
    ");else{var d=document.createElement("div");d.setAttribute("id","".concat(this.jSPlugin.id,"-headControl")),d.setAttribute("class","header-controls"),d.innerHTML="
    ");var u={height:"56px",display:"flex","justify-content":"space-between",top:0,"z-index":999,color:"#FFFFFF",width:this.jSPlugin.width+"px",padding:"0 16px","box-sizing":"border-box",position:"relative","align-items":"center",background:"#000000"};d.style=ut(u),document.getElementById("".concat(o,"-wrap")).insertBefore(d,document.getElementById(o));var h=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&clearInterval(h)}),50)}else document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&document.getElementById("".concat(this.jSPlugin.id,"-headControl")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-headControl")));if(this.isNeedRenderFooter)if(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")))document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.marginTop="-".concat("56px","px"));else{var f=document.createElement("div");f.setAttribute("id","".concat(this.jSPlugin.id,"-ez-iframe-footer-container")),f.setAttribute("class","ez-iframe-footer-container");var x={position:"relative",display:"flex",height:"56px","flex-wrap":"wrap","justify-content":"center","z-index":999,top:0,color:"#FFFFFF",width:this.jSPlugin.width+"px","align-items":"center","background-color":"#000000","font-size":"14px"};f.style=ut(x),f.innerHTML='\n
    \n
    \n
    \n "),g(f,document.getElementById(o))}else document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container"))&&document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).parentElement.removeChild(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")));this.isNeedRenderInspectInfo&&document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.background=r.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.color=r.color,r.btnList.map((function(t,i){t.isrender&&e.renderInspectInfo(t.iconId,t)}))),this.isNeedRenderHeader&&document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=n.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=n.color,n.btnList.map((function(t,i){t.isrender&&e.renderHeader(t.iconId,t)}))),this.isNeedRenderFooter&&document.getElementById("".concat(this.jSPlugin.id,"-audioControls"))&&(document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=a.backgroundColor,document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=a.color,a.btnList.map((function(t,i){t.isrender&&e.renderFooter(t.iconId,t)}))),this.inspectMapWin=new Ke(this.jSPlugin),this.inspectSmallWin=new ct(this.jSPlugin,this.inspectMode,this.inspectMapWin,this.changeInspectMode,this.decoderState)}},{key:"renderThemeData",value:function(){var e=this,t=this.decoderState.state.isEditing,i=this.themeData,n=i.inspectInfo,a=i.header,r=i.footer;if(this.isNeedRenderInspectInfo&&n&&(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.background=n.backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.color=n.color.replace("-diy",""),n.btnList.map((function(t,i){t.isrender&&e.setDecoderState(l({},t.iconId,e.decoderState.state[t.iconId]))}))),this.isNeedRenderHeader&&a&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.background=a.backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.color=a.color.replace("-diy",""),a.btnList&&a.btnList.map((function(t,i){t.isrender&&e.setDecoderState(l({},t.iconId,e.decoderState.state[t.iconId]))}))),this.isNeedRenderFooter&&r)document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.background=r.backgroundColor.replace("-diy",""),document.getElementById("".concat(this.jSPlugin.id,"-audioControls")).style.color=r.color.replace("-diy",""),r.btnList.map((function(i,n){if(i.isrender&&e.setDecoderState(l({},i.iconId,e.decoderState.state[i.iconId])),0==n&&!e.themeInited&&e.activeThemeStatus)var a=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(a),1!=e.themeData.customConfig.bellPoster||t?e.jSPlugin.play():e.jSPlugin.pluginStatus.loadingClear(),e.themeInited=!0)}),50)})),this.setDecoderState({cloudRec:"cloud.rec"===P(this.jSPlugin.url).type,rec:"rec"===P(this.jSPlugin.url).type,type:P(this.jSPlugin.url).type});else if(!this.themeInited&&this.activeThemeStatus)var o=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(o),e.themeData&&e.themeData.customConfig&&1==e.themeData.customConfig.bellPoster&&!t?e.jSPlugin.pluginStatus.loadingClear():e.jSPlugin.play(),e.themeInited=!0)}),50);var s=setInterval((function(){window.EZUIKit[e.jSPlugin.id].state.EZUIKitPlayer.init&&(clearInterval(s),e.reSizeVideo(e.videoWidth,e.videoHeight))}),50);this.jSPlugin.Zoom||(this.jSPlugin.Zoom=new Pe(this.jSPlugin)),this.getInspectDevInfo(this.jSPlugin,!0,!1)}},{key:"getInspectRecord",value:function(){var e=this;!function(e,t,i){var n={accessToken:e.accessToken,deviceSerial:P(e.url).deviceSerial},a="".concat(e.env.domain,"/api/service/devicekit/bodycamera/inspect/detail/latest");Ee(a,"GET",n,(function(e){t&&t(e)}),(function(e){i&&i(e)}),{"Content-Type":"application/x-www-form-urlencoded"})}(this.jSPlugin,(function(t){if(200==t.meta.code&&t.data){var i=t.data;i.inspectRange&&e.inspectMapWin.createPolygon(i.inspectRange,"#407AFF","dashed",4,1,"#407AFF",.08),i.inspectPoints&&i.inspectPoints.length>0&&e.inspectMapWin.createInspectPoints(i.inspectPoints),"video"===e.inspectMode&&e.inspectMapWin.map.removeOverlay(e.inspectMapWin.inspectRange),document.getElementById("".concat(e.jSPlugin.id,"-inspectInfo-inspectName"))&&i.inspectName&&(document.getElementById("".concat(e.jSPlugin.id,"-inspectInfo-inspectName")).innerText=""+i.inspectName),document.getElementById("".concat(e.jSPlugin.id,"-inspectInfo-inspectBeginTime"))&&i.beginTime&&(document.getElementById("".concat(e.jSPlugin.id,"-inspectInfo-inspectBeginTime")).innerText="巡检开始时间:"+i.beginTime),document.getElementById("".concat(e.jSPlugin.id,"-header-inspectTime"))&&e.timer.createInterval("InspectTimer",(function(){document.getElementById("".concat(e.jSPlugin.id,"-header-inspectTime")).innerHTML=e.renderInspectTime(i.beginTime)}),1e3),document.getElementById("".concat(e.jSPlugin.id,"-inspectInfo-inspectPerson"))&&i.inspectPerson&&(document.getElementById("".concat(e.jSPlugin.id,"-inspectInfo-inspectPerson")).innerText="本地巡检员:"+i.inspectPerson),e.inspectInfo=i,i.inspectRecordId&&at(e.jSPlugin,i.inspectRecordId,(function(t){200==t.meta.code&&t.data&&(e.inspectMapWin.createTrack(t.data,!0),e.timer.createInterval("TraceTimer",(function(){i.inspectRecordId&&at(e.jSPlugin,i.inspectRecordId,(function(t){200==t.meta.code&&t.data&&e.inspectMapWin.createTrack(t.data,!1)}),(function(){}))}),5e3))}),(function(){})),e.InspectEvent=new lt(e.jSPlugin,i.inspectRecordId,e.timer)}}),(function(e){}))}},{key:"getInspectDevInfo",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];!function(e,t,i){var n={accessToken:e.accessToken,deviceSerial:P(e.url).deviceSerial},a="".concat(e.env.domain,"/api/service/devicekit/bodycamera");Ee(a,"GET",n,(function(e){t&&t(e)}),(function(e){i&&i(e)}),{"Content-Type":"application/x-www-form-urlencoded"})}(e,(function(a){a.meta&&200==a.meta.code&&a.data?1===a.data.status?(n&&!t.decoderState.state.play&&(t.jSPlugin.pluginStatus.loadingStart(t.jSPlugin.id),t.jSPlugin.pluginStatus.loadingSetText({text:"视频加载中"}),t.jSPlugin.play()),t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-global-box"),!1),document.getElementById("".concat(t.jSPlugin.id,"-header-deviceName"))&&(document.getElementById("".concat(t.jSPlugin.id,"-header-deviceName")).innerText="".concat(a.data.deviceName,"(").concat(a.data.deviceSerial,")"),document.getElementById("".concat(t.jSPlugin.id,"-header-deviceName")).setAttribute("title","".concat(a.data.deviceName,"(").concat(a.data.deviceSerial,")"))),document.getElementById("".concat(t.jSPlugin.id,"-header-signalType"))&&(document.getElementById("".concat(t.jSPlugin.id,"-header-signalType")).innerHTML=t.renderSignalType(a.data.signalType)),document.getElementById("".concat(t.jSPlugin.id,"-header-batteryStatus"))&&(document.getElementById("".concat(t.jSPlugin.id,"-header-batteryStatus")).innerHTML=t.renderBatteryStatus(a.data.batteryStatus)),t.timer.createInterval("InspectDevInfoTimer",(function(){t.getInspectDevInfo(e,!1,!1)}),3e5),i&&t.getInspectRecord()):(t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-loading-box"),!1),t.jSPlugin.stop(),t.globalContainer.deviceErrorInfo({tips:"当前设备未在巡检中",refreshBtn:"刷新",refreshShow:!0},(function(){t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-no-inspect-box"),!1),t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-loading-box"),!0),t.getInspectDevInfo(e,!0,!0)}))):(t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-loading-box"),!1),t.jSPlugin.stop(),t.globalContainer.deviceErrorInfo({tips:a.meta.message,refreshShow:!1}))}),(function(){t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-global-box"),!1)}))}},{key:"fetchThemeData",value:function(e){var t=this;Ie(this.jSPlugin,e,(function(e){if(0!==e.meta.code||!e.data)return t.activeThemeStatus=!1,t.jSPlugin.pluginStatus.loadingClear(),"111021"==e.meta.code?(t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-loading-box"),!1),t.jSPlugin.stop(),t.globalContainer.deviceErrorInfo({tips:"无效的模板id",refreshBtn:"刷新",refreshShow:!1}),void(t.activeThemeStatusTxt="无效的模板id")):"111023"==e.meta.code?(t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-loading-box"),!1),t.jSPlugin.stop(),t.globalContainer.deviceErrorInfo({tips:"您的试用特权已到期,需前往轻应用控制台购买后使用。",refreshBtn:"刷新",refreshShow:!1}),void(t.activeThemeStatusTxt="试用特权已到期")):(t.globalContainer.globalContainerToggle("".concat(t.jSPlugin.id,"-inspect-loading-box"),!1),t.jSPlugin.stop(),t.globalContainer.deviceErrorInfo({tips:"模板未激活,请先在开放平台轻应用控制台购买模板",refreshBtn:"刷新",refreshShow:!1}),void(t.activeThemeStatusTxt="模板未激活"));t.activeThemeStatus=!0,t.themeData=e.data,t.jSPlugin.capacity?(t.initThemeData(),t.renderThemeData()):setTimeout((function(){t.initThemeData(),t.renderThemeData()}),300)}),(function(){t.themeData=dt,t.themeData.header&&(t.themeData.header.btnList=t.themeData.header.btnList.sort((function(e,t){return e.btnKey.split("-")[3]-t.btnKey.split("-")[3]}))),t.themeData.footer&&(t.themeData.footer.btnList=t.themeData.footer.btnList.sort((function(e,t){return e.btnKey.split("-")[3]-t.btnKey.split("-")[3]}))),t.initThemeData(),t.renderThemeData()}))}},{key:"reSizeVideo",value:function(e,t){if(document.getElementById("".concat(this.jSPlugin.id)).style.width=e+"px",document.getElementById("".concat(this.jSPlugin.id)).style.height=t+"px",this.jSPlugin&&this.jSPlugin.bPlay)this.jSPlugin.JS_Resize(e,t);else{document.getElementById("".concat(this.jSPlugin.id,"-player"))&&(document.getElementById("".concat(this.jSPlugin.id,"-player")).width=e,document.getElementById("".concat(this.jSPlugin.id,"-player")).height=t,document.getElementById("".concat(this.jSPlugin.id,"-player")).style.width=e+"px",document.getElementById("".concat(this.jSPlugin.id,"-player")).style.height=t+"px",document.getElementById("".concat(this.jSPlugin.id,"-container-0")).style.height=t+"px");var i=1;if(document.getElementById("".concat(this.jSPlugin.id,"canvas0")))navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)&&(i=2),document.getElementById("".concat(this.jSPlugin.id,"canvas0")).style.width=e*i+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas0")).style.height=t*i+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas0")).width=e*i,document.getElementById("".concat(this.jSPlugin.id,"canvas0")).height=t*i,document.getElementById("".concat(this.jSPlugin.id,"canvas0")).parentNode.style.width=e*i+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas0")).parentNode.style.height=t*i+"px",document.getElementById("".concat(this.jSPlugin.id,"canvas_draw0")).height=t*i}}},{key:"reSize",value:function(e,t){var i=.3333*e,n=.3333*t;document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-inspectInfoControl")).style.width=e+this.jSPlugin.inspectVideoWidth+"px"),document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-headControl")).style.width=e+"px"),document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.width=e+"px"),"video"===this.jSPlugin.Theme.inspectMode?(this.reSizeVideo(e,t),document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.top=0),document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.width=i+"px",document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.height=n+"px"):(document.getElementById("".concat(this.jSPlugin.id,"-headControl"))&&(document.getElementById("".concat(this.jSPlugin.id,"-ez-iframe-footer-container")).style.top=t+"px"),this.reSizeVideo(i,n),document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.width=e+"px",document.getElementById("".concat(this.jSPlugin.id,"-mapbox")).style.height=t+"px"),document.getElementById("".concat(this.jSPlugin.id,"-miniToggle")).style.bottom=n/2+96-30+"px",document.getElementById("".concat(this.jSPlugin.id,"-miniToggle")).style.right=this.jSPlugin.inspectVideoWidth+i+"px"}}]),e}(),xt=function(){function e(t){var i=this;if(r(this,e),l(this,"changeInspectMode",(function(e){i.inspectMode=e})),this.jSPlugin=t,this.videoWidth=t.width,this.videoHeight=t.height,this.inspectMode="video",this.autoFocus=0,this.decoderState={state:{isEditing:!1,play:!1,sound:!1,recordvideo:!1,recordCount:"00:00",talk:!1,mute:!1,rejection:!1,cloudRec:"cloud.rec"===P(t.url).type,rec:"rec"===P(t.url).type,type:P(t.url).type}},this.isMobile=navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),void 0!==t.isMobile&&(this.isMobile=t.isMobile),this.themeData=dt,"themeData"==this.jSPlugin.themeId&&(this.themeData=this.jSPlugin.params.themeData),this.timer||(this.timer=new qe(t)),this.jSPlugin.themeId)if(this.isMobile||(this.inspect=new ft(this.jSPlugin,this.themeData,this.setDecoderState,this.decoderState,this.inspectMode,this.changeInspectMode,this.timer)),"themeData"===this.jSPlugin.themeId)this.themeData=this.jSPlugin.params.themeData,this.inspect.initThemeData(),this.inspect.renderThemeData();else this.inspect.fetchThemeData(this.jSPlugin.themeId);this.jSPlugin.Talk||(this.jSPlugin.Talk=new ue(this.jSPlugin)),p("".concat(this.jSPlugin.staticPath,"/css/theme.css")),p("".concat(this.jSPlugin.staticPath,"/css/component.css")),p("".concat(this.jSPlugin.staticPath,"/css/inspectTheme.css"))}return s(e,[{key:"setDecoderState",value:function(e,t){var i=this,n="#FFFFFF",a="#1890FF";Object.keys(e).map((function(t){switch(t){case"talk":document.getElementById("".concat(i.jSPlugin.id,"-talk"))&&(document.getElementById("".concat(i.jSPlugin.id,"-talk")).className=e[t]?"active":"",document.getElementById("".concat(i.jSPlugin.id,"-talk-content")).childNodes[1].style.fill=e[t]?a:n,document.getElementById("".concat(i.jSPlugin.id,"-talk-content")).childNodes[2].style.color=e[t]?a:n);break;case"sound":document.getElementById("".concat(i.jSPlugin.id,"-sound"))&&(e[t]?(document.getElementById("".concat(i.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:inline-block",document.getElementById("".concat(i.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:none",document.getElementById("".concat(i.jSPlugin.id,"-sound")).className=e[t]?"active":"",document.getElementById("".concat(i.jSPlugin.id,"-sound-content")).childNodes[0].children[1].style.fill=e[t]?a:n,document.getElementById("".concat(i.jSPlugin.id,"-sound-label")).style.color=e[t]?a:n):(document.getElementById("".concat(i.jSPlugin.id,"-sound-content")).children[0].children[0].style="display:inline-block",document.getElementById("".concat(i.jSPlugin.id,"-sound-content")).children[0].children[1].style="display:none",document.getElementById("".concat(i.jSPlugin.id,"-sound")).className=e[t]?"active":"",document.getElementById("".concat(i.jSPlugin.id,"-sound-label")).style.color=e[t]?a:n))}i.decoderState.state=Object.assign(i.decoderState.state,e)}))}},{key:"setDisabled",value:function(e){var t=this.decoderState.state,i=t.sound;t.hd,null!=document.getElementById("".concat(this.jSPlugin.id,i?"-sound-icon":"-nosound-icon"))&&document.getElementById("".concat(this.jSPlugin.id,i?"-sound-icon":"-nosound-icon")).setAttribute("style",e?"cursor: not-allowed;fill: gray":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-sound-label"))&&document.getElementById("".concat(this.jSPlugin.id,"-sound-label")).setAttribute("style",e?"cursor: not-allowed; color: gray":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-talk-icon"))&&document.getElementById("".concat(this.jSPlugin.id,"-talk-icon")).setAttribute("style",e?"cursor: not-allowed;fill: gray":"cursor: default"),null!=document.getElementById("".concat(this.jSPlugin.id,"-talk-label"))&&document.getElementById("".concat(this.jSPlugin.id,"-talk-label")).setAttribute("style",e?"cursor: not-allowed; color: gray":"cursor: default")}},{key:"inspectEnding",value:function(){var e=document.createElement("div");e.id="".concat(this.jSPlugin.id,"-inspect-ending-box"),e.style="width:100%; position: absolute; z-index: 10000; top:58px; bottom:0; left:0; background: #ffffff;",e.innerHTML='
    \n
    \n
    \n \n
    \n
    巡检已结束
    \n
    \n
    \n ',document.getElementById("".concat(this.jSPlugin.id,"-wrap")).appendChild(e),this.jSPlugin.Zoom&&this.jSPlugin.Zoom.stopZoom()}}]),e}(),pt=function(){function e(){r(this,e),this.events={}}return s(e,[{key:"on",value:function(e,t){e&&t&&(this.events[e]=this.events[e]||[],this.events[e].push(t))}},{key:"emit",value:function(e,t){e&&this.events[e]&&this.events[e].forEach((function(e){return e(t)}))}},{key:"off",value:function(e,t){e&&t&&this.events[e]&&this.events[e].splice(this.events[e].indexOf(t),1)}},{key:"once",value:function(e,t){var i=this;this.on(e,(function n(){var a=Array.prototype.slice.call(arguments);t.apply(null,a),i.off(e,n)}))}},{key:"removeAllListener",value:function(){this.events={}}}]),e}();!function(e,t){"object"===("undefined"==typeof module?"undefined":a(module))&&"object"===a(module.exports)?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("EZUIPlayer requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:void 0,(function(e,t){function i(e,t){for(var i=document.getElementsByTagName("head")[0].getElementsByTagName("script"),n=!1,a=0;a0&&(e+="&controls="+t.controls.join(","))),t.websocketParams&&(e+="&websocketParams="+JSON.stringify(t.websocketParams)),e;case"standard":return o+"/ezopen/h5/iframe?bSupporDoubleClickFull=0&url="+l.opt.url.replace("?","&")+"&autoplay="+l.opt.autoplay+"&audio="+l.opt.audio+"&accessToken="+t.accessToken+"&templete=1&id="+c+"&decoderVersion="+l.opt.decoderVersion;case"security":return o+"/ezopen/h5/iframe_se?bSupporDoubleClickFull=0&url="+l.opt.url.replace("?","&")+"&autoplay="+l.opt.autoplay+"&audio="+l.opt.audio+"&accessToken="+t.accessToken+"&templete=0&id="+c+"&decoderVersion="+l.opt.decoderVersion;case"theme":return e=o+"/jssdk/theme.html?url=".concat(t.url,"&accessToken=").concat(t.accessToken,"&id=").concat(c,"&isMobile=").concat(t.isMobile),void 0!==t.isMobile&&(e+="&isMobile="+t.isMobile),void 0!==t.autoplay&&(e+="&autoplay="+t.autoplay),void 0!==t.domain&&"https://test12open.ys7.com"==t.domain&&(e+="&env=test12"),void 0!==t.env&&void 0!==t.env.domain&&"https://test12open.ys7.com"==t.env.domain&&(e+="&env=test12"),void 0!==t.header&&(e+="&header="+t.header),e;default:return o+"/ezopen/h5/iframe?bSupporDoubleClickFull=0&url="+l.opt.url.replace("?","&")+"&autoplay="+l.opt.autoplay+"&audio="+l.opt.audio+"&accessToken="+t.accessToken+"&templete=0&id="+c+"&decoderVersion="+l.opt.decoderVersion}}();var h=document.getElementById(c).offsetHeight,f=document.getElementById(c).offsetWidth;t.height&&(h=parseInt(t.height),/\%$/.test(t.height)&&(f=document.getElementById(c).offsetWidth*(parseInt(t.height)/100))),t.width&&(f=parseInt(t.width),/\%$/.test(t.width)&&(f=document.getElementById(c).offsetWidth*(parseInt(t.width)/100))),u.width=f,u.height=h,u.id="EZUIKitPlayer-"+c,u.setAttribute("allowfullscreen",!0),u.setAttribute("allow","autoplay"),u.setAttribute("frameborder",0),d.appendChild(u);var x=l.opt.filePath+"/js/jquery.js";i(x,(function(){i("https://open.ys7.com/assets/layer/layer.js",(function(){if(_().headerContainer){var a=document.createElement("div");a.setAttribute("class","panel-top");var s=document.createElement("div");if(s.setAttribute("class","contros"),a.appendChild(s),d.insertBefore(a,u),_().capturePictureModule){var c=document.createElement("span");c.innerHTML=' ',c.onclick=function(){l.capturePicture()},s.appendChild(c)}if(console.log("matchHeaderOpt().saveModule",_().saveModule),_().saveModule){var h=document.createElement("span");h.innerHTML=' ',h.onclick=function(){l.startSave(),document.getElementById("startSave").setAttribute("class","icon hide"),document.getElementById("stopSave").setAttribute("class","icon")},s.appendChild(h);var f=document.createElement("span");f.innerHTML=' ',f.onclick=function(){l.stopSave(),document.getElementById("stopSave").setAttribute("class","icon hide"),document.getElementById("startSave").setAttribute("class","icon")},s.appendChild(f)}if(_().zoomModule){var x=document.createElement("span");x.innerHTML=' ',x.onclick=function(){l.enableZoom(),document.getElementById("enableZoom").setAttribute("class","icon hide"),document.getElementById("closeZoom").setAttribute("class","icon")},s.appendChild(x);var p=document.createElement("span");p.innerHTML=' ',p.onclick=function(){l.closeZoom(),document.getElementById("closeZoom").setAttribute("class","icon hide"),document.getElementById("enableZoom").setAttribute("class","icon")},s.appendChild(p)}}function m(){var e={footerContainer:!1,talkModule:!1,broadcastModule:!1,hdModule:!1,fullScreenModule:!1};switch(l.opt.template){case"simple":case"standard":var i;if(t.footer&&t.footer instanceof Array)e={footerContainer:!0,talkModule:-1!==(i=t.footer).indexOf("talk"),broadcastModule:-1!==i.indexOf("broadcast"),hdModule:-1!==i.indexOf("hd"),fullScreenModule:-1!==i.indexOf("fullScreen")};break;case"security":break;case"voice":e={footerContainer:!0,talkModule:!0,broadcastModule:!0,hdModule:!0,fullScreenModule:!0}}return e}function _(){var e={headerContainer:!1,capturePictureModule:!1,saveModule:!1,zoomModule:!1};switch(l.opt.template){case"simple":if(t.header&&t.header instanceof Array){var i=t.header;e={headerContainer:!0,capturePictureModule:-1!==i.indexOf("capturePicture"),saveModule:-1!==i.indexOf("save"),zoomModule:-1!==i.indexOf("zoom")}}break;case"standard":case"security":break;case"voice":e={headerContainer:!0,capturePictureModule:!0,saveModule:!0,zoomModule:!0}}return e}if(m().footerContainer||-1!==l.opt.plugin.indexOf("talk")){var g=l.opt.filePath+"/npm/css/recoder.css",v=l.opt.filePath+"/npm/js/recoder.js",y=l.opt.filePath+"/recorder.js";if(function(e,t){for(var i=document.getElementsByTagName("head")[0].getElementsByTagName("link"),n=!1,a=0;a0?(i--,document.getElementById("time-area").innerHTML=n(i)):(clearInterval(r.state.countTimer),r.state.countTimer=void 0,console.log("倒计时结束,开启声音"))}),1e3)}else"destory"===e&&(clearInterval(r.state.countTimer),r.state.countTimer=void 0,document.getElementById("time-area").innerHTML="00:00");function n(e){var t,i,n,a=parseInt(e),r=0,o=0;return a>59&&(r=parseInt(a/60),a=parseInt(a%60),r>59&&(o=parseInt(r/60),r=parseInt(r%60))),t=parseInt(a)>9?parseInt(a):"0"+parseInt(a),i=parseInt(r)>9?parseInt(r):"0"+parseInt(r),n=parseInt(o)>9?parseInt(o):"0"+parseInt(o),o>0?n+":"+i+":"+t:r>0?i+":"+t:"00:"+t}},b=document.createElement("div");if(b.setAttribute("class","audio-controls"),d.appendChild(b),m().hdModule||m().fullScreenModule){var P=document.createElement("div");if(P.setAttribute("class","contros"),b.appendChild(P),m().hdModule){var E=document.createElement("span");E.setAttribute("id","video-hd"),E.innerHTML=-1===l.opt.url.indexOf(".hd")?"标清":"高清",E.onclick=function(){if(l.opt.videoLoading)return layer.msg("视频加载中,请稍后"),!1;var e=l.stop();l.opt.videoLoading=!0,e.then((function(e){l.opt.videoLoading=!1,-1===l.opt.url.indexOf(".hd")?(l.opt.url=l.opt.url.replace(".live",".hd.live"),E.innerHTML=-1===l.opt.url.indexOf(".hd")?"标清":"高清"):(l.opt.url=l.opt.url.replace(".hd.live",".live"),E.innerHTML=-1===l.opt.url.indexOf(".hd")?"标清":"高清"),l.play(l.opt.url)})).catch((function(e){console.log("error",e)}))},P.appendChild(E)}if(m().fullScreenModule){var C=document.createElement("span");C.setAttribute("class","hide"),C.setAttribute("id","ezuikit-open-sound"),C.setAttribute("title","打开声音"),C.setAttribute("style","vertical-align: top;"),C.innerHTML='',C.onclick=function(){l.openSound(0),C.setAttribute("class","hide"),T.setAttribute("class","")};var T=document.createElement("span");C.setAttribute("id","ezuikit-close-sound"),T.setAttribute("class","hide"),T.setAttribute("title","关闭声音"),T.setAttribute("style","vertical-align: top;"),T.innerHTML='',T.onclick=function(){l.closeSound(0),C.setAttribute("class",""),T.setAttribute("class","hide")},P.appendChild(C),P.appendChild(T)}if(1==l.opt.audio?T.setAttribute("class",""):(C.setAttribute("class",""),l.closeSound(0)),m().fullScreenModule){var R=document.createElement("span");R.setAttribute("title","全屏"),R.setAttribute("style","vertical-align: top;"),R.innerHTML=' ',R.onclick=function(){l.fullScreen()},P.appendChild(R)}}if(m().talkModule){var w=document.createElement("div"),I=document.createElement("div");w.setAttribute("class","ptp-talk off"),w.innerHTML=' 开启对讲',w.onclick=function(){if(console.log("EZUIKit.state.countTimer",r.state.countTimer),r.state.countTimer)return e.layer.msg("语音设备正忙,请稍后重试"),!1;S("add",0),console.log("开始对讲,关闭声音"),l.closeSound(0),console.log(l.opt),l.startTalk(),this.setAttribute("class","ptp-talk off hide"),I.setAttribute("class","ptp-talk on")},I.setAttribute("class","ptp-talk on hide"),I.innerHTML=' 关闭对讲',I.onclick=function(){console.log(l.opt),l.stopTalk(),S("destory",0),l.openSound(0),this.setAttribute("class","ptp-talk on hide"),w.setAttribute("class","ptp-talk off")},b.appendChild(w),b.appendChild(I)}if(m().broadcastModule){var D=function e(t){n(o+"/api/lapp/voice/query","POST",{accessToken:l.opt.accessToken,pageStart:t,pageSize:r.state.pageSize,default:r.state.fetchDefaultList?"true":"false"},0,(function(i){console.log("data",i),200==i.code&&(k(i.data,5),r.state.page=i.page.page,0!=t||0!=i.data.length||r.state.fetchDefaultList||(r.state.fetchDefaultList=!0,e(0)))}))},k=function(e){if(console.log("renderVoliceList",e),e&&e.length>0){for(var t=0;t"+(e[t].voiceName.length>10?e[t].voiceName.substr(0,10)+"...":e[t].voiceName)+"",document.getElementsByClassName("voice-list-ul")[0].append(i),i.onclick=function(e){console.log("点击元素",e.target,e.target.dataset.url);var t=e.target.dataset.url,i=e.target.dataset.time;F(t,i)}}e.length===r.state.pageSize?document.getElementById("voice-list-end").innerHTML="向下滚动加载更多":document.getElementById("voice-list-end").innerHTML="没有更多数据了"}},F=function(t,i){console.log("播放语音",t,i),n(o+"/api/lapp/voice/send","POST",{accessToken:l.opt.accessToken,deviceSerial:l.opt.deviceSerial,channelNo:l.opt.channelNo,fileUrl:t},0,(function(t){console.log("data.data",t.data),200==t.code?S("sub",parseInt(i)):"10001"==t.code?e.layer.msg("未找到当前语音"):e.layer.msg(t.msg||"发送失败,请稍后再试")}))},A=document.createElement("div"),M=document.createElement("div");A.setAttribute("class","broadcast off"),M.setAttribute("class","broadcast on hide"),A.innerHTML=' 语音播报',A.onclick=function(){this.setAttribute("class","broadcast off hide"),M.setAttribute("class","broadcast on")},M.innerHTML='
    自定义语音
    语音播报',M.onclick=function(){this.setAttribute("class","broadcast on hide"),A.setAttribute("class","broadcast off")},b.appendChild(A),b.appendChild(M),document.getElementById("voice-custom").onclick=function(){console.log("显示自定义语音"),L.setAttribute("class","speak off")},D(0);var L=document.createElement("div"),B=document.createElement("div");L.setAttribute("class","speak off hide"),B.setAttribute("class","speak on hide"),L.setAttribute("id","startSpeak"),B.setAttribute("id","stopSpeak"),L.innerHTML=' 按住说话',B.innerHTML=' 松开发送',b.appendChild(L),b.appendChild(B),document.getElementById("voice-list").onscroll=function(e){var t=this.scrollHeight;console.log("sum",t,this.scrollTop,document.getElementById("voice-list").clientHeight),t<=this.scrollTop+this.clientHeight&&(console.log("拖动到底,执行加载",r.state.page),D(++r.state.page))};var O,j=document.createElement("div");j.setAttribute("class","time-area"),j.setAttribute("id","time-area"),j.innerHTML="00:00",b.appendChild(j),document.getElementById("startSpeak").onmousedown=function(){if(r.state.countTimer)return e.layer.msg("语音设备正忙,请稍后重试"),!1;var t;function i(i){var n=t.createMediaStreamSource(i);O=new e.Recorder(n)}console.log("按住说话"),L.setAttribute("class","speak off hide"),B.setAttribute("class","speak on"),function(){console.log("run init");try{e.AudioContext=e.AudioContext||e.webkitAudioContext,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia,e.URL=e.URL||e.webkitURL,t=new AudioContext,console.log("Audio context set up."),console.log("navigator.getUserMedia "+(navigator.getUserMedia?"available.":"not present!"))}catch(t){console.log("err",t),e.layer.msg("No web audio support in this browser!")}navigator.getUserMedia({audio:!0},i,(function(e){console.log("No live audio input: "+e)}))}(),S("add",0),setTimeout((function(){r.state.recodeTime=0,O&&O.record()}),1e3),r.state.recodeTimer&&clearInterval(r.state.recodeTimer),r.state.recodeTimer=setInterval((function(){r.state.recodeTime>=59?(l.stopTalk(),S("destory",0),this.setAttribute("class","ptp-talk on hide"),w.setAttribute("class","ptp-talk off"),e.layer.msg("不超过1分钟")):r.state.recodeTime=r.state.recodeTime+1}),1e3)},document.getElementById("stopSpeak").onmouseup=function(){console.log("松开发送"),B.setAttribute("class","speak on hide"),function(){if(S("destory",0),r.state.recodeTime<1)return e.layer.msg("说话时间过短"),clearInterval(r.state.recodeTimer),!1;clearInterval(r.state.recodeTimer),function(){try{O&&O.stop(),O&&O.exportWAV((function(t){if(console.log("wav_file",t),t.size<1e3)return e.layer.msg("录音失败,请重试"),r.state.recodeTime=0,!1;S("sub",r.state.recodeTime+2);var i=new FormData;function a(t){console.log("data.data",t.data),200==t.code?S("sub",r.state.recodeTime+2):"10001"==t.code?e.layer.msg("未找到当前语音"):e.layer.msg(t.msg||"发送失败,请稍后再试")}i.append("voiceFile",t),i.append("accessToken",l.opt.accessToken),i.append("deviceSerial",l.opt.deviceSerial),i.append("channelNo",l.opt.channelNo),n(o+"/api/lapp/voice/sendonce","POST",{voiceFile:t,accessToken:l.opt.accessToken,deviceSerial:l.opt.deviceSerial,channelNo:l.opt.channelNo},0,a)})),O&&O.clear()}catch(e){console.log(e)}}()}()}}}}}))}));l=this;function p(e){l.opt.fullScreenStatus=e?1:0,t.fullScreenChangeCallBack&&t.fullScreenChangeCallBack({data:e,id:l.opt.id})}e.addEventListener("message",(function(i){i.origin;var n=l.opt.id;if(i.data.type)switch(i.data.type){case"openSound":n==i.data.id&&t.openSoundCallBack&&t.openSoundCallBack(i.data);break;case"closeSound":n==i.data.id&&t.closeSoundCallBack&&t.closeSoundCallBack(i.data);break;case"capturePicture":n==i.data.id&&t.capturePictureCallBack&&t.capturePictureCallBack(i.data);break;case"startSave":n==i.data.id&&t.startSaveCallBack&&t.startSaveCallBack(i.data);break;case"stopSave":n==i.data.id&&t.stopSaveCallBack&&t.stopSaveCallBack(i.data);break;case"fullScreen":n==i.data.id&&t.fullScreenCallBack&&t.fullScreenCallBack(i.data);break;case"getOSDTime":n==i.data.id&&t.getOSDTimeCallBack&&t.getOSDTimeCallBack(i.data);break;case"handleSuccess":n==i.data.id&&t.handleSuccess&&t.handleSuccess(i.data);break;case"handleError":n==i.data.id&&t.handleError&&t.handleError(i.data);break;case"dblclick":n==i.data.id&&l.opt.bSupporDoubleClickFull&&(0===l.opt.fullScreenStatus?l.fullScreen():l.cancelFullScreen());break;case"startTalk":l.startTalk(),l.closeSound();break;case"stopTalk":l.stopTalk(),l.openSound();break;case"clickEventHandle":console.log("event.data",i.data),t.clickEventHandle&&t.clickEventHandle(i.data);break;case"removeEventHandle":t.removeEventHandle&&t.removeEventHandle(i.data);break;case"esc":t.clickEventHandle&&t.clickEventHandle(i.data);break;case"iframeFullScreen":if(n==i.data.id){!function(t){var i=t.requestFullScreen||t.webkitRequestFullScreen||t.mozRequestFullScreen||t.msRequestFullScreen;if(i)i.call(t);else if(void 0!==e.ActiveXObject){var n=new ActiveXObject("WScript.Shell");null!==n&&n.SendKeys("{F11}")}}(document.getElementById("EZUIKitPlayer-"+i.data.id))}}})),void 0!==document.fullScreen?document.addEventListener("fullscreenchange",(function(){p(document.fullscreen||!1)})):void 0!==document.webkitIsFullScreen?document.addEventListener("webkitfullscreenchange",(function(){p(document.webkitIsFullScreen||!1)})):void 0!==document.mozFullScreen&&document.addEventListener("mozfullscreenchange",(function(){p(document.mozFullScreen||!1)}))};return c.prototype.play=function(t){var i="EZUIKitPlayer-"+this.opt.id,n=document.getElementById(i).contentWindow;"object"===a(t)&&t.url&&(this.opt.url=t.url),"object"===a(t)&&t.accessToken&&(this.opt.accessToken=t.accessToken),"string"==typeof t&&(this.opt.url=t),n.postMessage({action:"play",accessToken:this.opt.accessToken,url:this.opt.url},o+"/ezopen/h5/iframe");var r=this;return this.opt.videoLoading=!0,new Promise((function(t,i){e.addEventListener("message",(function(e){r.opt.id==e.data.id&&"handleSuccess"===e.data.type&&(setTimeout((function(){r.opt.videoLoading=!1}),1e3),t(e.data))}))}))},c.prototype.stop=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("stop",o+"/ezopen/h5/iframe");var i=this;return new Promise((function(t,n){e.addEventListener("message",(function(e){i.opt.id==e.data.id&&"stop"===e.data.type&&t(e.data)}))}))},c.prototype.openSound=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("openSound",o+"/ezopen/h5/iframe");var i=this;return new Promise((function(t,n){e.addEventListener("message",(function(e){i.opt.id==e.data.id&&"openSound"===e.data.type&&t(e.data)}))}))},c.prototype.closeSound=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("closeSound",o+"/ezopen/h5/iframe");var i=this;return new Promise((function(t,n){e.addEventListener("message",(function(e){i.opt.id==e.data.id&&"closeSound"===e.data.type&&t(e.data)}))}))},c.prototype.startSave=function(t){var i="EZUIKitPlayer-"+this.opt.id;document.getElementById(i).contentWindow.postMessage({action:"startSave",fileName:t||"default"},o+"/ezopen/h5/iframe");var n=this;return new Promise((function(t,i){e.addEventListener("message",(function(e){n.opt.id==e.data.id&&"startSave"===e.data.type&&t(e.data)}))}))},c.prototype.stopSave=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("stopSave",o+"/ezopen/h5/iframe");var i=this;return new Promise((function(t,n){e.addEventListener("message",(function(e){i.opt.id==e.data.id&&"stopSave"===e.data.type&&t(e.data)}))}))},c.prototype.fullScreen=function(){if(1===this.opt.fullScreenStatus)return!1;var t="EZUIKitPlayer-"+this.opt.id,i=document.getElementById(t).contentWindow;if(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)){var n=document.documentElement.clientWidth,a=document.documentElement.clientHeight,r=(document.body,"");r+="width:"+a+"px;",r+="height:"+n+"px;",r+="-webkit-transform: rotate(90deg); transform: rotate(90deg);",r+="-webkit-transform-origin: "+n/2+"px "+n/2+"px;",r+="transform-origin: "+n/2+"px "+n/2+"px;",r+="position: fixed;top: 0;left: 0;z-index:10",document.getElementById(t).style.cssText=r,setTimeout((function(){i.postMessage("autoResize",o+"/ezopen/h5/iframe")}),500)}else{!function(t){var i=t.requestFullScreen||t.webkitRequestFullScreen||t.mozRequestFullScreen||t.msRequestFullScreen;if(i)i.call(t);else if(void 0!==e.ActiveXObject){var n=new ActiveXObject("WScript.Shell");null!==n&&n.SendKeys("{F11}")}}(document.getElementById(t))}this.params.fullScreenCallBack&&this.params.fullScreenCallBack(this.opt.id),this.opt.fullScreenStatus=1},c.prototype.cancelFullScreen=function(){if(0===this.opt.fullScreenStatus)return!1;var e="EZUIKitPlayer-"+this.opt.id,t=document.getElementById(e).contentWindow;if(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)){var i=document.getElementById(e).width,n=document.getElementById(e).height,a=(document.body,"");a+="width:"+i+"px;",a+="height:"+n+"px;",a+="-webkit-transform: none; transform: none;",a+="-webkit-transform-origin: 0 0;",a+="transform-origin: 0 0;",document.getElementById(e).style.cssText=a,setTimeout((function(){t.postMessage("autoResize",o+"/ezopen/h5/iframe")}),500);var r=e+"cancel-full-screen",s=document.getElementById(r);s&&document.body.removeChild(s)}else document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen&&document.mozCancelFullScreen();this.params.cancelFullScreenCallBack&&this.params.cancelFullScreenCallBack(this.opt.id),this.opt.fullScreenStatus=0},c.prototype.capturePicture=function(t,i){var n="EZUIKitPlayer-"+this.opt.id;document.getElementById(n).contentWindow.postMessage({action:"capturePicture",fileName:t||"default",isUndownload:i},o+"/ezopen/h5/iframe");var a=this;return new Promise((function(t,i){e.addEventListener("message",(function(e){a.opt.id==e.data.id&&"capturePicture"===e.data.type&&t(e.data)}))}))},c.prototype.enableZoom=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("enableZoom",o+"/ezopen/h5/iframe")},c.prototype.closeZoom=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("closeZoom",o+"/ezopen/h5/iframe")},c.prototype.getOSDTime=function(){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage("getOSDTime",o+"/ezopen/h5/iframe");var i=this;return new Promise((function(t,n){e.addEventListener("message",(function(e){i.opt.id==e.data.id&&"getOSDTime"===e.data.type&&t(e.data)}))}))},c.prototype.autoResize=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("autoResize",o+"/ezopen/h5/iframe")},c.prototype.reSize=function(e,t){var i="EZUIKitPlayer-"+this.opt.id,n=document.getElementById(i).contentWindow,a=document.getElementById(this.opt.id);a.style.width=e+"px",a.style.height=t+"px",document.getElementById(this.opt.id).style.width=e+"px",document.getElementById(this.opt.id).style.height=t+"px";var r=document.getElementById(i);r.setAttribute("width",e),r.setAttribute("height",t),r.style.width=e+"px",r.style.height=t+"px",setTimeout((function(){n.postMessage({action:"autoResize"},o+"/ezopen/h5/iframe")}),500)},c.prototype.startTalk=function(){console.log("执行开始对讲"),console.log(this.opt);var t=this;r.opt=this.opt,e.EZUIKit&&(e.EZUIKit.opt=this.opt);n(t.opt.apiDomain,"POST",{accessToken:t.opt.accessToken,deviceSerial:t.opt.deviceSerial,channelNo:t.opt.channelNo},0,(function(i){if(200==i.code){var n=i.data;if(n){var a=n.rtcUrl;-1===a.indexOf("ws")&&(a=a.replace("https","wss").replace("rtcgw","rtcgw-ws")),t.opt.rtcUrl=a,t.opt.ttsUrl="tts://"+n.ttsUrl;var r="talk://"+t.opt.deviceSerial+":0:"+t.opt.channelNo+":cas.ys7.com:6500";t.opt.talkLink=t.opt.ttsUrl+"/"+r,t.opt.stream=n.stream,e.startTalk()}}}))},c.prototype.stopTalk=function(){console.log("执行结束对讲"),e.stopTalk()},c.prototype.edit=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage("edit",o+"/ezopen/h5/iframe")},c.prototype.btnReRender=function(e){var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage({action:"btnReRender",data:e},o+"/ezopen/h5/iframe")},c.prototype.changePlayUrl=function(e){e.deviceSerial&&(this.opt.deviceSerial=e.deviceSerial),e.channelNo&&(this.opt.channelNo=e.channelNo),e.accessToken&&(this.opt.accessToken=e.accessToken);var t="EZUIKitPlayer-"+this.opt.id;document.getElementById(t).contentWindow.postMessage({action:"changePlayUrl",data:e},o+"/ezopen/h5/iframe")},c.prototype.fetchThemeData=function(){var e="EZUIKitPlayer-"+this.opt.id;document.getElementById(e).contentWindow.postMessage({action:"fetchThemeData"},o+"/ezopen/h5/iframe")},c.prototype.setThemeData=function(e,t,i){var n="EZUIKitPlayer-"+this.opt.id;document.getElementById(n).contentWindow.postMessage({action:"setThemeData",data:{accessToken:e,header:t,footer:i}},o+"/ezopen/h5/iframe")},r.EZUIKitPlayer=c,e.EZUIKitV3=r,r}));var mt=EZUIKitV3,_t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=void 0,a=void 0,r=void 0,o=[];return function(){var l=function(e){return"function"==typeof e?e():e}(t),c=(new Date).getTime(),d=!n||c-n>l;n=c;for(var u=arguments.length,h=Array(u),f=0;f */ !function(){var e;function t(e){var t=0;return function(){return t>>0)+"_",a=0;return function e(i){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(i||"")+"_"+a++,i)}})),r("Symbol.iterator",(function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var n="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),r=0;r0&&n>0){var r=e.left/i,o=e.top/n,s=e.right/i,l=e.bottom/n;a=new Float32Array([s,o,r,o,s,l,r,l])}else a=new Float32Array([1,0,0,0,1,1,0,1]);var c=this.texturePosBuffer;t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferSubData(t.ARRAY_BUFFER,0,a),t.bindBuffer(t.ARRAY_BUFFER,null)},e.prototype.SR_Destroy=function(){var e=this.contextGL,t=this.YUVProgram;e.deleteProgram(t);var i=this.vertexPosBuffer,n=this.texturePosBuffer;e.deleteBuffer(i),e.deleteBuffer(n);var a=this.yTextureRef,r=this.uTextureRef,o=this.vTextureRef;e.deleteTexture(a),e.deleteTexture(r),e.deleteTexture(o)},e}();var bt=function(){function e(e,t){for(var i=0;i0&&t-1 in e)}S.fn=S.prototype={jquery:y,constructor:S,length:0,toArray:function(){return r.call(this)},get:function(e){return null==e?r.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(e){return this.pushStack(S.map(this,(function(t,i){return e.call(t,i,t)})))},slice:function(){return this.pushStack(r.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,i=+e+(e<0?t:0);return this.pushStack(i>=0&&i+~]|"+B+")"+B+"*"),Z=new RegExp("="+B+"*([^\\]'\"]*?)"+B+"*\\]","g"),W=new RegExp(N),G=new RegExp("^"+O+"$"),Y={ID:new RegExp("^#("+O+")"),CLASS:new RegExp("^\\.("+O+")"),TAG:new RegExp("^("+O+"|[*])"),ATTR:new RegExp("^"+j),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+B+"*(even|odd|(([+-]|)(\\d*)n|)"+B+"*(?:([+-]|)"+B+"*(\\d+)|))"+B+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+B+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+B+"*((?:-\\d)?\\d*)"+B+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,q=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,Q=new RegExp("\\\\([\\da-f]{1,6}"+B+"?|("+B+")|.)","ig"),ee=function(e,t,i){var n="0x"+t-65536;return n!=n||i?t:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ne=function(){h()},ae=ge((function(e){return!0===e.disabled&&("form"in e||"label"in e)}),{dir:"parentNode",next:"legend"});try{F.apply(I=A.call(S.childNodes),S.childNodes),I[S.childNodes.length].nodeType}catch(e){F={apply:I.length?function(e,t){k.apply(e,A.call(t))}:function(e,t){for(var i=e.length,n=0;e[i++]=t[n++];);e.length=i-1}}}function re(e,t,n,a){var r,s,c,d,u,x,_,g=t&&t.ownerDocument,b=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==b&&9!==b&&11!==b)return n;if(!a&&((t?t.ownerDocument||t:S)!==f&&h(t),t=t||f,p)){if(11!==b&&(u=K.exec(e)))if(r=u[1]){if(9===b){if(!(c=t.getElementById(r)))return n;if(c.id===r)return n.push(c),n}else if(g&&(c=g.getElementById(r))&&v(t,c)&&c.id===r)return n.push(c),n}else{if(u[2])return F.apply(n,t.getElementsByTagName(e)),n;if((r=u[3])&&i.getElementsByClassName&&t.getElementsByClassName)return F.apply(n,t.getElementsByClassName(r)),n}if(i.qsa&&!T[e+" "]&&(!m||!m.test(e))){if(1!==b)g=t,_=e;else if("object"!==t.nodeName.toLowerCase()){for((d=t.getAttribute("id"))?d=d.replace(te,ie):t.setAttribute("id",d=y),s=(x=o(e)).length;s--;)x[s]="#"+d+" "+_e(x[s]);_=x.join(","),g=$.test(e)&&pe(t.parentNode)||t}if(_)try{return F.apply(n,g.querySelectorAll(_)),n}catch(e){}finally{d===y&&t.removeAttribute("id")}}}return l(e.replace(z,"$1"),t,n,a)}function oe(){var e=[];return function t(i,a){return e.push(i+" ")>n.cacheLength&&delete t[e.shift()],t[i+" "]=a}}function se(e){return e[y]=!0,e}function le(e){var t=f.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ce(e,t){for(var i=e.split("|"),a=i.length;a--;)n.attrHandle[i[a]]=t}function de(e,t){var i=t&&e,n=i&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(n)return n;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function ue(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function he(e){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===e}}function fe(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ae(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function xe(e){return se((function(t){return t=+t,se((function(i,n){for(var a,r=e([],i.length,t),o=r.length;o--;)i[a=r[o]]&&(i[a]=!(n[a]=i[a]))}))}))}function pe(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in i=re.support={},r=re.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},h=re.setDocument=function(e){var t,a,o=e?e.ownerDocument||e:S;return o!==f&&9===o.nodeType&&o.documentElement?(x=(f=o).documentElement,p=!r(f),S!==f&&(a=f.defaultView)&&a.top!==a&&(a.addEventListener?a.addEventListener("unload",ne,!1):a.attachEvent&&a.attachEvent("onunload",ne)),i.attributes=le((function(e){return e.className="i",!e.getAttribute("className")})),i.getElementsByTagName=le((function(e){return e.appendChild(f.createComment("")),!e.getElementsByTagName("*").length})),i.getElementsByClassName=q.test(f.getElementsByClassName),i.getById=le((function(e){return x.appendChild(e).id=y,!f.getElementsByName||!f.getElementsByName(y).length})),i.getById?(n.filter.ID=function(e){var t=e.replace(Q,ee);return function(e){return e.getAttribute("id")===t}},n.find.ID=function(e,t){if(void 0!==t.getElementById&&p){var i=t.getElementById(e);return i?[i]:[]}}):(n.filter.ID=function(e){var t=e.replace(Q,ee);return function(e){var i=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return i&&i.value===t}},n.find.ID=function(e,t){if(void 0!==t.getElementById&&p){var i,n,a,r=t.getElementById(e);if(r){if((i=r.getAttributeNode("id"))&&i.value===e)return[r];for(a=t.getElementsByName(e),n=0;r=a[n++];)if((i=r.getAttributeNode("id"))&&i.value===e)return[r]}return[]}}),n.find.TAG=i.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):i.qsa?t.querySelectorAll(e):void 0}:function(e,t){var i,n=[],a=0,r=t.getElementsByTagName(e);if("*"===e){for(;i=r[a++];)1===i.nodeType&&n.push(i);return n}return r},n.find.CLASS=i.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&p)return t.getElementsByClassName(e)},_=[],m=[],(i.qsa=q.test(f.querySelectorAll))&&(le((function(e){x.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+B+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+B+"*(?:value|"+L+")"),e.querySelectorAll("[id~="+y+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+y+"+*").length||m.push(".#.+[+~]")})),le((function(e){e.innerHTML="";var t=f.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+B+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),x.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")}))),(i.matchesSelector=q.test(g=x.matches||x.webkitMatchesSelector||x.mozMatchesSelector||x.oMatchesSelector||x.msMatchesSelector))&&le((function(e){i.disconnectedMatch=g.call(e,"*"),g.call(e,"[s!='']:x"),_.push("!=",N)})),m=m.length&&new RegExp(m.join("|")),_=_.length&&new RegExp(_.join("|")),t=q.test(x.compareDocumentPosition),v=t||q.test(x.contains)?function(e,t){var i=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(i.contains?i.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},R=t?function(e,t){if(e===t)return u=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!i.sortDetached&&t.compareDocumentPosition(e)===n?e===f||e.ownerDocument===S&&v(S,e)?-1:t===f||t.ownerDocument===S&&v(S,t)?1:d?M(d,e)-M(d,t):0:4&n?-1:1)}:function(e,t){if(e===t)return u=!0,0;var i,n=0,a=e.parentNode,r=t.parentNode,o=[e],s=[t];if(!a||!r)return e===f?-1:t===f?1:a?-1:r?1:d?M(d,e)-M(d,t):0;if(a===r)return de(e,t);for(i=e;i=i.parentNode;)o.unshift(i);for(i=t;i=i.parentNode;)s.unshift(i);for(;o[n]===s[n];)n++;return n?de(o[n],s[n]):o[n]===S?-1:s[n]===S?1:0},f):f},re.matches=function(e,t){return re(e,null,null,t)},re.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&h(e),t=t.replace(Z,"='$1']"),i.matchesSelector&&p&&!T[t+" "]&&(!_||!_.test(t))&&(!m||!m.test(t)))try{var n=g.call(e,t);if(n||i.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return re(t,f,null,[e]).length>0},re.contains=function(e,t){return(e.ownerDocument||e)!==f&&h(e),v(e,t)},re.attr=function(e,t){(e.ownerDocument||e)!==f&&h(e);var a=n.attrHandle[t.toLowerCase()],r=a&&w.call(n.attrHandle,t.toLowerCase())?a(e,t,!p):void 0;return void 0!==r?r:i.attributes||!p?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},re.escape=function(e){return(e+"").replace(te,ie)},re.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},re.uniqueSort=function(e){var t,n=[],a=0,r=0;if(u=!i.detectDuplicates,d=!i.sortStable&&e.slice(0),e.sort(R),u){for(;t=e[r++];)t===e[r]&&(a=n.push(r));for(;a--;)e.splice(n[a],1)}return d=null,e},a=re.getText=function(e){var t,i="",n=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=a(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[n++];)i+=a(t);return i},n=re.selectors={cacheLength:50,createPseudo:se,match:Y,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Q,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Q,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||re.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&re.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return Y.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&W.test(i)&&(t=o(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Q,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+B+")"+e+"("+B+"|$)"))&&E(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,i){return function(n){var a=re.attr(n,e);return null==a?"!="===t:!t||(a+="","="===t?a===i:"!="===t?a!==i:"^="===t?i&&0===a.indexOf(i):"*="===t?i&&a.indexOf(i)>-1:"$="===t?i&&a.slice(-i.length)===i:"~="===t?(" "+a.replace(U," ")+" ").indexOf(i)>-1:"|="===t&&(a===i||a.slice(0,i.length+1)===i+"-"))}},CHILD:function(e,t,i,n,a){var r="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===n&&0===a?function(e){return!!e.parentNode}:function(t,i,l){var c,d,u,h,f,x,p=r!==o?"nextSibling":"previousSibling",m=t.parentNode,_=s&&t.nodeName.toLowerCase(),g=!l&&!s,v=!1;if(m){if(r){for(;p;){for(h=t;h=h[p];)if(s?h.nodeName.toLowerCase()===_:1===h.nodeType)return!1;x=p="only"===e&&!x&&"nextSibling"}return!0}if(x=[o?m.firstChild:m.lastChild],o&&g){for(v=(f=(c=(d=(u=(h=m)[y]||(h[y]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]||[])[0]===b&&c[1])&&c[2],h=f&&m.childNodes[f];h=++f&&h&&h[p]||(v=f=0)||x.pop();)if(1===h.nodeType&&++v&&h===t){d[e]=[b,f,v];break}}else if(g&&(v=f=(c=(d=(u=(h=t)[y]||(h[y]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]||[])[0]===b&&c[1]),!1===v)for(;(h=++f&&h&&h[p]||(v=f=0)||x.pop())&&((s?h.nodeName.toLowerCase()!==_:1!==h.nodeType)||!++v||(g&&((d=(u=h[y]||(h[y]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]=[b,v]),h!==t)););return(v-=a)===n||v%n==0&&v/n>=0}}},PSEUDO:function(e,t){var i,a=n.pseudos[e]||n.setFilters[e.toLowerCase()]||re.error("unsupported pseudo: "+e);return a[y]?a(t):a.length>1?(i=[e,e,"",t],n.setFilters.hasOwnProperty(e.toLowerCase())?se((function(e,i){for(var n,r=a(e,t),o=r.length;o--;)e[n=M(e,r[o])]=!(i[n]=r[o])})):function(e){return a(e,0,i)}):a}},pseudos:{not:se((function(e){var t=[],i=[],n=s(e.replace(z,"$1"));return n[y]?se((function(e,t,i,a){for(var r,o=n(e,null,a,[]),s=e.length;s--;)(r=o[s])&&(e[s]=!(t[s]=r))})):function(e,a,r){return t[0]=e,n(t,null,r,i),t[0]=null,!i.pop()}})),has:se((function(e){return function(t){return re(e,t).length>0}})),contains:se((function(e){return e=e.replace(Q,ee),function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}})),lang:se((function(e){return G.test(e||"")||re.error("unsupported lang: "+e),e=e.replace(Q,ee).toLowerCase(),function(t){var i;do{if(i=p?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(i=i.toLowerCase())===e||0===i.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var i=e.location&&e.location.hash;return i&&i.slice(1)===t.id},root:function(e){return e===x},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:fe(!1),disabled:fe(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!n.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return X.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:xe((function(){return[0]})),last:xe((function(e,t){return[t-1]})),eq:xe((function(e,t,i){return[i<0?i+t:i]})),even:xe((function(e,t){for(var i=0;i=0;)e.push(n);return e})),gt:xe((function(e,t,i){for(var n=i<0?i+t:i;++n1?function(t,i,n){for(var a=e.length;a--;)if(!e[a](t,i,n))return!1;return!0}:e[0]}function ye(e,t,i,n,a){for(var r,o=[],s=0,l=e.length,c=null!=t;s-1&&(r[c]=!(o[c]=u))}}else _=ye(_===o?_.splice(x,_.length):_),a?a(null,o,_,l):F.apply(o,_)}))}function be(e){for(var t,i,a,r=e.length,o=n.relative[e[0].type],s=o||n.relative[" "],l=o?1:0,d=ge((function(e){return e===t}),s,!0),u=ge((function(e){return M(t,e)>-1}),s,!0),h=[function(e,i,n){var a=!o&&(n||i!==c)||((t=i).nodeType?d(e,i,n):u(e,i,n));return t=null,a}];l1&&ve(h),l>1&&_e(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),i,l0,a=e.length>0,r=function(r,o,s,l,d){var u,x,m,_=0,g="0",v=r&&[],y=[],S=c,P=r||a&&n.find.TAG("*",d),E=b+=null==S?1:Math.random()||.1,C=P.length;for(d&&(c=o===f||o||d);g!==C&&null!=(u=P[g]);g++){if(a&&u){for(x=0,o||u.ownerDocument===f||(h(u),s=!p);m=e[x++];)if(m(u,o||f,s)){l.push(u);break}d&&(b=E)}i&&((u=!m&&u)&&_--,r&&v.push(u))}if(_+=g,i&&g!==_){for(x=0;m=t[x++];)m(v,y,o,s);if(r){if(_>0)for(;g--;)v[g]||y[g]||(y[g]=D.call(l));y=ye(y)}F.apply(l,y),d&&!r&&y.length>0&&_+t.length>1&&re.uniqueSort(l)}return d&&(b=E,c=S),v};return i?se(r):r}(r,a)),s.selector=e}return s},l=re.select=function(e,t,i,a){var r,l,c,d,u,h="function"==typeof e&&e,f=!a&&o(e=h.selector||e);if(i=i||[],1===f.length){if((l=f[0]=f[0].slice(0)).length>2&&"ID"===(c=l[0]).type&&9===t.nodeType&&p&&n.relative[l[1].type]){if(!(t=(n.find.ID(c.matches[0].replace(Q,ee),t)||[])[0]))return i;h&&(t=t.parentNode),e=e.slice(l.shift().value.length)}for(r=Y.needsContext.test(e)?0:l.length;r--&&(c=l[r],!n.relative[d=c.type]);)if((u=n.find[d])&&(a=u(c.matches[0].replace(Q,ee),$.test(l[0].type)&&pe(t.parentNode)||t))){if(l.splice(r,1),!(e=a.length&&_e(l)))return F.apply(i,a),i;break}}return(h||s(e,f))(a,t,!p,i,!t||$.test(e)&&pe(t.parentNode)||t),i},i.sortStable=y.split("").sort(R).join("")===y,i.detectDuplicates=!!u,h(),i.sortDetached=le((function(e){return 1&e.compareDocumentPosition(f.createElement("fieldset"))})),le((function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")}))||ce("type|href|height|width",(function(e,t,i){if(!i)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),i.attributes&&le((function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||ce("value",(function(e,t,i){if(!i&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),le((function(e){return null==e.getAttribute("disabled")}))||ce(L,(function(e,t,i){var n;if(!i)return!0===e[t]?t.toLowerCase():(n=e.getAttributeNode(t))&&n.specified?n.value:null})),re}(e);S.find=E,S.expr=E.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=E.uniqueSort,S.text=E.getText,S.isXMLDoc=E.isXML,S.contains=E.contains,S.escapeSelector=E.escape;var C=function(e,t,i){for(var n=[],a=void 0!==i;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(a&&S(e).is(i))break;n.push(e)}return n},T=function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i},R=S.expr.match.needsContext;function w(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var I=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,t,i){return p(t)?S.grep(e,(function(e,n){return!!t.call(e,n,e)!==i})):t.nodeType?S.grep(e,(function(e){return e===t!==i})):"string"!=typeof t?S.grep(e,(function(e){return l.call(t,e)>-1!==i})):S.filter(t,e,i)}S.filter=function(e,t,i){var n=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?S.find.matchesSelector(n,e)?[n]:[]:S.find.matches(e,S.grep(t,(function(e){return 1===e.nodeType})))},S.fn.extend({find:function(e){var t,i,n=this.length,a=this;if("string"!=typeof e)return this.pushStack(S(e).filter((function(){for(t=0;t1?S.uniqueSort(i):i},filter:function(e){return this.pushStack(D(this,e||[],!1))},not:function(e){return this.pushStack(D(this,e||[],!0))},is:function(e){return!!D(this,"string"==typeof e&&R.test(e)?S(e):e||[],!1).length}});var k,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,i){var a,r;if(!e)return this;if(i=i||k,"string"==typeof e){if(!(a="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:F.exec(e))||!a[1]&&t)return!t||t.jquery?(t||i).find(e):this.constructor(t).find(e);if(a[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(a[1],t&&t.nodeType?t.ownerDocument||t:n,!0)),I.test(a[1])&&S.isPlainObject(t))for(a in t)p(this[a])?this[a](t[a]):this.attr(a,t[a]);return this}return(r=n.getElementById(a[2]))&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):p(e)?void 0!==i.ready?i.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,k=S(n);var A=/^(?:parents|prev(?:Until|All))/,M={children:!0,contents:!0,next:!0,prev:!0};function L(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}S.fn.extend({has:function(e){var t=S(e,this),i=t.length;return this.filter((function(){for(var e=0;e-1:1===i.nodeType&&S.find.matchesSelector(i,e))){r.push(i);break}return this.pushStack(r.length>1?S.uniqueSort(r):r)},index:function(e){return e?"string"==typeof e?l.call(S(e),this[0]):l.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return C(e,"parentNode")},parentsUntil:function(e,t,i){return C(e,"parentNode",i)},next:function(e){return L(e,"nextSibling")},prev:function(e){return L(e,"previousSibling")},nextAll:function(e){return C(e,"nextSibling")},prevAll:function(e){return C(e,"previousSibling")},nextUntil:function(e,t,i){return C(e,"nextSibling",i)},prevUntil:function(e,t,i){return C(e,"previousSibling",i)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return w(e,"iframe")?e.contentDocument:(w(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},(function(e,t){S.fn[e]=function(i,n){var a=S.map(this,t,i);return"Until"!==e.slice(-5)&&(n=i),n&&"string"==typeof n&&(a=S.filter(n,a)),this.length>1&&(M[e]||S.uniqueSort(a),A.test(e)&&a.reverse()),this.pushStack(a)}}));var B=/[^\x20\t\r\n\f]+/g;function O(e){return e}function j(e){throw e}function N(e,t,i,n){var a;try{e&&p(a=e.promise)?a.call(e).done(t).fail(i):e&&p(a=e.then)?a.call(e,t,i):t.apply(void 0,[e].slice(n))}catch(e){i.apply(void 0,[e])}}S.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return S.each(e.match(B)||[],(function(e,i){t[i]=!0})),t}(e):S.extend({},e);var t,i,n,a,r=[],o=[],s=-1,l=function(){for(a=a||e.once,n=t=!0;o.length;s=-1)for(i=o.shift();++s-1;)r.splice(i,1),i<=s&&s--})),this},has:function(e){return e?S.inArray(e,r)>-1:r.length>0},empty:function(){return r&&(r=[]),this},disable:function(){return a=o=[],r=i="",this},disabled:function(){return!r},lock:function(){return a=o=[],i||t||(r=i=""),this},locked:function(){return!!a},fireWith:function(e,i){return a||(i=[e,(i=i||[]).slice?i.slice():i],o.push(i),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},S.extend({Deferred:function(t){var i=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],n="pending",a={state:function(){return n},always:function(){return r.done(arguments).fail(arguments),this},catch:function(e){return a.then(null,e)},pipe:function(){var e=arguments;return S.Deferred((function(t){S.each(i,(function(i,n){var a=p(e[n[4]])&&e[n[4]];r[n[1]]((function(){var e=a&&a.apply(this,arguments);e&&p(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[n[0]+"With"](this,a?[e]:arguments)}))})),e=null})).promise()},then:function(t,n,a){var r=0;function o(t,i,n,a){return function(){var s=this,l=arguments,c=function(){var e,c;if(!(t=r&&(n!==j&&(s=void 0,l=[e]),i.rejectWith(s,l))}};t?d():(S.Deferred.getStackHook&&(d.stackTrace=S.Deferred.getStackHook()),e.setTimeout(d))}}return S.Deferred((function(e){i[0][3].add(o(0,e,p(a)?a:O,e.notifyWith)),i[1][3].add(o(0,e,p(t)?t:O)),i[2][3].add(o(0,e,p(n)?n:j))})).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},r={};return S.each(i,(function(e,t){var o=t[2],s=t[5];a[t[1]]=o.add,s&&o.add((function(){n=s}),i[3-e][2].disable,i[3-e][3].disable,i[0][2].lock,i[0][3].lock),o.add(t[3].fire),r[t[0]]=function(){return r[t[0]+"With"](this===r?void 0:this,arguments),this},r[t[0]+"With"]=o.fireWith})),a.promise(r),t&&t.call(r,r),r},when:function(e){var t=arguments.length,i=t,n=Array(i),a=r.call(arguments),o=S.Deferred(),s=function(e){return function(i){n[e]=this,a[e]=arguments.length>1?r.call(arguments):i,--t||o.resolveWith(n,a)}};if(t<=1&&(N(e,o.done(s(i)).resolve,o.reject,!t),"pending"===o.state()||p(a[i]&&a[i].then)))return o.then();for(;i--;)N(a[i],s(i),o.reject);return o.promise()}});var U=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(t,i){e.console&&e.console.warn&&t&&U.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,i)},S.readyException=function(t){e.setTimeout((function(){throw t}))};var z=S.Deferred();function H(){n.removeEventListener("DOMContentLoaded",H),e.removeEventListener("load",H),S.ready()}S.fn.ready=function(e){return z.then(e).catch((function(e){S.readyException(e)})),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0,!0!==e&&--S.readyWait>0||z.resolveWith(n,[S]))}}),S.ready.then=z.then,"complete"===n.readyState||"loading"!==n.readyState&&!n.documentElement.doScroll?e.setTimeout(S.ready):(n.addEventListener("DOMContentLoaded",H),e.addEventListener("load",H));var V=function(e,t,i,n,a,r,o){var s=0,l=e.length,c=null==i;if("object"===v(i))for(s in a=!0,i)V(e,t,s,i[s],!0,r,o);else if(void 0!==n&&(a=!0,p(n)||(o=!0),c&&(o?(t.call(e,n),t=null):(c=t,t=function(e,t,i){return c.call(S(e),i)})),t))for(;s1,null,!0)},removeData:function(e){return this.each((function(){K.remove(this,e)}))}}),S.extend({queue:function(e,t,i){var n;if(e)return t=(t||"fx")+"queue",n=q.get(e,t),i&&(!n||Array.isArray(i)?n=q.access(e,t,S.makeArray(i)):n.push(i)),n||[]},dequeue:function(e,t){t=t||"fx";var i=S.queue(e,t),n=i.length,a=i.shift(),r=S._queueHooks(e,t);"inprogress"===a&&(a=i.shift(),n--),a&&("fx"===t&&i.unshift("inprogress"),delete r.stop,a.call(e,(function(){S.dequeue(e,t)}),r)),!n&&r&&r.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return q.get(e,i)||q.access(e,i,{empty:S.Callbacks("once memory").add((function(){q.remove(e,[t+"queue",i])}))})}}),S.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,fe={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function xe(e,t){var i;return i=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&w(e,t)?S.merge([e],i):i}function pe(e,t){for(var i=0,n=e.length;i-1)a&&a.push(r);else if(c=S.contains(r.ownerDocument,r),o=xe(u.appendChild(r),"script"),c&&pe(o),i)for(d=0;r=o[d++];)he.test(r.type||"")&&i.push(r);return u}me=n.createDocumentFragment().appendChild(n.createElement("div")),(_e=n.createElement("input")).setAttribute("type","radio"),_e.setAttribute("checked","checked"),_e.setAttribute("name","t"),me.appendChild(_e),x.checkClone=me.cloneNode(!0).cloneNode(!0).lastChild.checked,me.innerHTML="",x.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var ye=n.documentElement,Se=/^key/,be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Pe=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function Ce(){return!1}function Te(){try{return n.activeElement}catch(e){}}function Re(e,t,i,n,a,r){var o,s;if("object"==typeof t){for(s in"string"!=typeof i&&(n=n||i,i=void 0),t)Re(e,s,i,n,t[s],r);return e}if(null==n&&null==a?(a=i,n=i=void 0):null==a&&("string"==typeof i?(a=n,n=void 0):(a=n,n=i,i=void 0)),!1===a)a=Ce;else if(!a)return e;return 1===r&&(o=a,a=function(e){return S().off(e),o.apply(this,arguments)},a.guid=o.guid||(o.guid=S.guid++)),e.each((function(){S.event.add(this,t,a,n,i)}))}S.event={global:{},add:function(e,t,i,n,a){var r,o,s,l,c,d,u,h,f,x,p,m=q.get(e);if(m)for(i.handler&&(i=(r=i).handler,a=r.selector),a&&S.find.matchesSelector(ye,a),i.guid||(i.guid=S.guid++),(l=m.events)||(l=m.events={}),(o=m.handle)||(o=m.handle=function(t){return void 0!==S&&S.event.triggered!==t.type?S.event.dispatch.apply(e,arguments):void 0}),c=(t=(t||"").match(B)||[""]).length;c--;)f=p=(s=Pe.exec(t[c])||[])[1],x=(s[2]||"").split(".").sort(),f&&(u=S.event.special[f]||{},f=(a?u.delegateType:u.bindType)||f,u=S.event.special[f]||{},d=S.extend({type:f,origType:p,data:n,handler:i,guid:i.guid,selector:a,needsContext:a&&S.expr.match.needsContext.test(a),namespace:x.join(".")},r),(h=l[f])||((h=l[f]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(e,n,x,o)||e.addEventListener&&e.addEventListener(f,o)),u.add&&(u.add.call(e,d),d.handler.guid||(d.handler.guid=i.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),S.event.global[f]=!0)},remove:function(e,t,i,n,a){var r,o,s,l,c,d,u,h,f,x,p,m=q.hasData(e)&&q.get(e);if(m&&(l=m.events)){for(c=(t=(t||"").match(B)||[""]).length;c--;)if(f=p=(s=Pe.exec(t[c])||[])[1],x=(s[2]||"").split(".").sort(),f){for(u=S.event.special[f]||{},h=l[f=(n?u.delegateType:u.bindType)||f]||[],s=s[2]&&new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=r=h.length;r--;)d=h[r],!a&&p!==d.origType||i&&i.guid!==d.guid||s&&!s.test(d.namespace)||n&&n!==d.selector&&("**"!==n||!d.selector)||(h.splice(r,1),d.selector&&h.delegateCount--,u.remove&&u.remove.call(e,d));o&&!h.length&&(u.teardown&&!1!==u.teardown.call(e,x,m.handle)||S.removeEvent(e,f,m.handle),delete l[f])}else for(f in l)S.event.remove(e,f+t[c],i,n,!0);S.isEmptyObject(l)&&q.remove(e,"handle events")}},dispatch:function(e){var t,i,n,a,r,o,s=S.event.fix(e),l=new Array(arguments.length),c=(q.get(this,"events")||{})[s.type]||[],d=S.event.special[s.type]||{};for(l[0]=s,t=1;t=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==e.type||!0!==c.disabled)){for(r=[],o={},i=0;i-1:S.find(a,this,null,[c]).length),o[a]&&r.push(n);r.length&&s.push({elem:c,handlers:r})}return c=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,Ie=/\s*$/g;function Fe(e,t){return w(e,"table")&&w(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Ae(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var i,n,a,r,o,s,l,c;if(1===t.nodeType){if(q.hasData(e)&&(r=q.access(e),o=q.set(t,r),c=r.events))for(a in delete o.handle,o.events={},c)for(i=0,n=c[a].length;i1&&"string"==typeof m&&!x.checkClone&&De.test(m))return e.each((function(a){var r=e.eq(a);_&&(t[0]=m.call(this,a,r.html())),Oe(r,t,i,n)}));if(h&&(r=(a=ve(t,e[0].ownerDocument,!1,e,n)).firstChild,1===a.childNodes.length&&(a=r),r||n)){for(l=(s=S.map(xe(a,"script"),Ae)).length;u")},clone:function(e,t,i){var n,a,r,o,s=e.cloneNode(!0),l=S.contains(e.ownerDocument,e);if(!(x.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(o=xe(s),n=0,a=(r=xe(e)).length;n0&&pe(o,!l&&xe(e,"script")),s},cleanData:function(e){for(var t,i,n,a=S.event.special,r=0;void 0!==(i=e[r]);r++)if(X(i)){if(t=i[q.expando]){if(t.events)for(n in t.events)a[n]?S.event.remove(i,n):S.removeEvent(i,n,t.handle);i[q.expando]=void 0}i[K.expando]&&(i[K.expando]=void 0)}}}),S.fn.extend({detach:function(e){return je(this,e,!0)},remove:function(e){return je(this,e)},text:function(e){return V(this,(function(e){return void 0===e?S.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Oe(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Fe(this,e).appendChild(e)}))},prepend:function(){return Oe(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Fe(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Oe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Oe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(xe(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return S.clone(this,e,t)}))},html:function(e){return V(this,(function(e){var t=this[0]||{},i=0,n=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ie.test(e)&&!fe[(ue.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;i=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-r-l-s-.5))),l}function Qe(e,t,i){var n=Ue(e),a=He(e,t,n),r="border-box"===S.css(e,"boxSizing",!1,n),o=r;if(Ne.test(a)){if(!i)return a;a="auto"}return o=o&&(x.boxSizingReliable()||a===e.style[t]),("auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,n))&&(a=e["offset"+t[0].toUpperCase()+t.slice(1)],o=!0),(a=parseFloat(a)||0)+$e(e,t,i||(r?"border":"content"),o,n,a)+"px"}function et(e,t,i,n,a){return new et.prototype.init(e,t,i,n,a)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=He(e,"opacity");return""===i?"1":i}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,i,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var a,r,o,s=Y(t),l=We.test(t),c=e.style;if(l||(t=qe(s)),o=S.cssHooks[t]||S.cssHooks[s],void 0===i)return o&&"get"in o&&void 0!==(a=o.get(e,!1,n))?a:c[t];"string"==(r=typeof i)&&(a=ie.exec(i))&&a[1]&&(i=oe(e,t,a),r="number"),null!=i&&i==i&&("number"===r&&(i+=a&&a[3]||(S.cssNumber[s]?"":"px")),x.clearCloneStyle||""!==i||0!==t.indexOf("background")||(c[t]="inherit"),o&&"set"in o&&void 0===(i=o.set(e,i,n))||(l?c.setProperty(t,i):c[t]=i))}},css:function(e,t,i,n){var a,r,o,s=Y(t);return We.test(t)||(t=qe(s)),(o=S.cssHooks[t]||S.cssHooks[s])&&"get"in o&&(a=o.get(e,!0,i)),void 0===a&&(a=He(e,t,n)),"normal"===a&&t in Ye&&(a=Ye[t]),""===i||i?(r=parseFloat(a),!0===i||isFinite(r)?r||0:a):a}}),S.each(["height","width"],(function(e,t){S.cssHooks[t]={get:function(e,i,n){if(i)return!Ze.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Qe(e,t,n):re(e,Ge,(function(){return Qe(e,t,n)}))},set:function(e,i,n){var a,r=Ue(e),o="border-box"===S.css(e,"boxSizing",!1,r),s=n&&$e(e,t,n,o,r);return o&&x.scrollboxSize()===r.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(r[t])-$e(e,t,"border",!1,r)-.5)),s&&(a=ie.exec(i))&&"px"!==(a[3]||"px")&&(e.style[t]=i,i=S.css(e,t)),Ke(0,i,s)}}})),S.cssHooks.marginLeft=Ve(x.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(He(e,"marginLeft"))||e.getBoundingClientRect().left-re(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),S.each({margin:"",padding:"",border:"Width"},(function(e,t){S.cssHooks[e+t]={expand:function(i){for(var n=0,a={},r="string"==typeof i?i.split(" "):[i];n<4;n++)a[e+ne[n]+t]=r[n]||r[n-2]||r[0];return a}},"margin"!==e&&(S.cssHooks[e+t].set=Ke)})),S.fn.extend({css:function(e,t){return V(this,(function(e,t,i){var n,a,r={},o=0;if(Array.isArray(t)){for(n=Ue(e),a=t.length;o1)}}),S.Tween=et,et.prototype={constructor:et,init:function(e,t,i,n,a,r){this.elem=e,this.prop=i,this.easing=a||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=r||(S.cssNumber[i]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,i=et.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):et.propHooks._default.set(this),this}},et.prototype.init.prototype=et.prototype,et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[S.cssProps[e.prop]]&&!S.cssHooks[e.prop]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}},et.propHooks.scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=et.prototype.init,S.fx.step={};var tt,it,nt=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function rt(){it&&(!1===n.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(rt):e.setTimeout(rt,S.fx.interval),S.fx.tick())}function ot(){return e.setTimeout((function(){tt=void 0})),tt=Date.now()}function st(e,t){var i,n=0,a={height:e};for(t=t?1:0;n<4;n+=2-t)a["margin"+(i=ne[n])]=a["padding"+i]=e;return t&&(a.opacity=a.width=e),a}function lt(e,t,i){for(var n,a=(ct.tweeners[t]||[]).concat(ct.tweeners["*"]),r=0,o=a.length;r1)},removeAttr:function(e){return this.each((function(){S.removeAttr(this,e)}))}}),S.extend({attr:function(e,t,i){var n,a,r=e.nodeType;if(3!==r&&8!==r&&2!==r)return void 0===e.getAttribute?S.prop(e,t,i):(1===r&&S.isXMLDoc(e)||(a=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?dt:void 0)),void 0!==i?null===i?void S.removeAttr(e,t):a&&"set"in a&&void 0!==(n=a.set(e,i,t))?n:(e.setAttribute(t,i+""),i):a&&"get"in a&&null!==(n=a.get(e,t))?n:null==(n=S.find.attr(e,t))?void 0:n)},attrHooks:{type:{set:function(e,t){if(!x.radioValue&&"radio"===t&&w(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}},removeAttr:function(e,t){var i,n=0,a=t&&t.match(B);if(a&&1===e.nodeType)for(;i=a[n++];)e.removeAttribute(i)}}),dt={set:function(e,t,i){return!1===t?S.removeAttr(e,i):e.setAttribute(i,i),i}},S.each(S.expr.match.bool.source.match(/\w+/g),(function(e,t){var i=ut[t]||S.find.attr;ut[t]=function(e,t,n){var a,r,o=t.toLowerCase();return n||(r=ut[o],ut[o]=a,a=null!=i(e,t,n)?o:null,ut[o]=r),a}}));var ht=/^(?:input|select|textarea|button)$/i,ft=/^(?:a|area)$/i;function xt(e){return(e.match(B)||[]).join(" ")}function pt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(B)||[]}S.fn.extend({prop:function(e,t){return V(this,S.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[S.propFix[e]||e]}))}}),S.extend({prop:function(e,t,i){var n,a,r=e.nodeType;if(3!==r&&8!==r&&2!==r)return 1===r&&S.isXMLDoc(e)||(t=S.propFix[t]||t,a=S.propHooks[t]),void 0!==i?a&&"set"in a&&void 0!==(n=a.set(e,i,t))?n:e[t]=i:a&&"get"in a&&null!==(n=a.get(e,t))?n:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||ft.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),x.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){S.propFix[this.toLowerCase()]=this})),S.fn.extend({addClass:function(e){var t,i,n,a,r,o,s,l=0;if(p(e))return this.each((function(t){S(this).addClass(e.call(this,t,pt(this)))}));if((t=mt(e)).length)for(;i=this[l++];)if(a=pt(i),n=1===i.nodeType&&" "+xt(a)+" "){for(o=0;r=t[o++];)n.indexOf(" "+r+" ")<0&&(n+=r+" ");a!==(s=xt(n))&&i.setAttribute("class",s)}return this},removeClass:function(e){var t,i,n,a,r,o,s,l=0;if(p(e))return this.each((function(t){S(this).removeClass(e.call(this,t,pt(this)))}));if(!arguments.length)return this.attr("class","");if((t=mt(e)).length)for(;i=this[l++];)if(a=pt(i),n=1===i.nodeType&&" "+xt(a)+" "){for(o=0;r=t[o++];)for(;n.indexOf(" "+r+" ")>-1;)n=n.replace(" "+r+" "," ");a!==(s=xt(n))&&i.setAttribute("class",s)}return this},toggleClass:function(e,t){var i=typeof e,n="string"===i||Array.isArray(e);return"boolean"==typeof t&&n?t?this.addClass(e):this.removeClass(e):p(e)?this.each((function(i){S(this).toggleClass(e.call(this,i,pt(this),t),t)})):this.each((function(){var t,a,r,o;if(n)for(a=0,r=S(this),o=mt(e);t=o[a++];)r.hasClass(t)?r.removeClass(t):r.addClass(t);else void 0!==e&&"boolean"!==i||((t=pt(this))&&q.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":q.get(this,"__className__")||""))}))},hasClass:function(e){var t,i,n=0;for(t=" "+e+" ";i=this[n++];)if(1===i.nodeType&&(" "+xt(pt(i))+" ").indexOf(t)>-1)return!0;return!1}});var _t=/\r/g;S.fn.extend({val:function(e){var t,i,n,a=this[0];return arguments.length?(n=p(e),this.each((function(i){var a;1===this.nodeType&&(null==(a=n?e.call(this,i,S(this).val()):e)?a="":"number"==typeof a?a+="":Array.isArray(a)&&(a=S.map(a,(function(e){return null==e?"":e+""}))),(t=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,a,"value")||(this.value=a))}))):a?(t=S.valHooks[a.type]||S.valHooks[a.nodeName.toLowerCase()])&&"get"in t&&void 0!==(i=t.get(a,"value"))?i:"string"==typeof(i=a.value)?i.replace(_t,""):null==i?"":i:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:xt(S.text(e))}},select:{get:function(e){var t,i,n,a=e.options,r=e.selectedIndex,o="select-one"===e.type,s=o?null:[],l=o?r+1:a.length;for(n=r<0?l:o?r:0;n-1)&&(i=!0);return i||(e.selectedIndex=-1),r}}}}),S.each(["radio","checkbox"],(function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=S.inArray(S(e).val(),t)>-1}},x.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),x.focusin="onfocusin"in e;var gt=/^(?:focusinfocus|focusoutblur)$/,vt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(t,i,a,r){var o,s,l,c,d,h,f,x,_=[a||n],g=u.call(t,"type")?t.type:t,v=u.call(t,"namespace")?t.namespace.split("."):[];if(s=x=l=a=a||n,3!==a.nodeType&&8!==a.nodeType&&!gt.test(g+S.event.triggered)&&(g.indexOf(".")>-1&&(v=g.split("."),g=v.shift(),v.sort()),d=g.indexOf(":")<0&&"on"+g,(t=t[S.expando]?t:new S.Event(g,"object"==typeof t&&t)).isTrigger=r?2:3,t.namespace=v.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=a),i=null==i?[t]:S.makeArray(i,[t]),f=S.event.special[g]||{},r||!f.trigger||!1!==f.trigger.apply(a,i))){if(!r&&!f.noBubble&&!m(a)){for(c=f.delegateType||g,gt.test(c+g)||(s=s.parentNode);s;s=s.parentNode)_.push(s),l=s;l===(a.ownerDocument||n)&&_.push(l.defaultView||l.parentWindow||e)}for(o=0;(s=_[o++])&&!t.isPropagationStopped();)x=s,t.type=o>1?c:f.bindType||g,(h=(q.get(s,"events")||{})[t.type]&&q.get(s,"handle"))&&h.apply(s,i),(h=d&&s[d])&&h.apply&&X(s)&&(t.result=h.apply(s,i),!1===t.result&&t.preventDefault());return t.type=g,r||t.isDefaultPrevented()||f._default&&!1!==f._default.apply(_.pop(),i)||!X(a)||d&&p(a[g])&&!m(a)&&((l=a[d])&&(a[d]=null),S.event.triggered=g,t.isPropagationStopped()&&x.addEventListener(g,vt),a[g](),t.isPropagationStopped()&&x.removeEventListener(g,vt),S.event.triggered=void 0,l&&(a[d]=l)),t.result}},simulate:function(e,t,i){var n=S.extend(new S.Event,i,{type:e,isSimulated:!0});S.event.trigger(n,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each((function(){S.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var i=this[0];if(i)return S.event.trigger(e,t,i,!0)}}),x.focusin||S.each({focus:"focusin",blur:"focusout"},(function(e,t){var i=function(e){S.event.simulate(t,e.target,S.event.fix(e))};S.event.special[t]={setup:function(){var n=this.ownerDocument||this,a=q.access(n,t);a||n.addEventListener(e,i,!0),q.access(n,t,(a||0)+1)},teardown:function(){var n=this.ownerDocument||this,a=q.access(n,t)-1;a?q.access(n,t,a):(n.removeEventListener(e,i,!0),q.remove(n,t))}}}));var yt=e.location,St=Date.now(),bt=/\?/;S.parseXML=function(t){var i;if(!t||"string"!=typeof t)return null;try{i=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){i=void 0}return i&&!i.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+t),i};var Pt=/\[\]$/,Et=/\r?\n/g,Ct=/^(?:submit|button|image|reset|file)$/i,Tt=/^(?:input|select|textarea|keygen)/i;function Rt(e,t,i,n){var a;if(Array.isArray(t))S.each(t,(function(t,a){i||Pt.test(e)?n(e,a):Rt(e+"["+("object"==typeof a&&null!=a?t:"")+"]",a,i,n)}));else if(i||"object"!==v(t))n(e,t);else for(a in t)Rt(e+"["+a+"]",t[a],i,n)}S.param=function(e,t){var i,n=[],a=function(e,t){var i=p(t)?t():t;n[n.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==i?"":i)};if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,(function(){a(this.name,this.value)}));else for(i in e)Rt(i,e[i],t,a);return n.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&Tt.test(this.nodeName)&&!Ct.test(e)&&(this.checked||!de.test(e))})).map((function(e,t){var i=S(this).val();return null==i?null:Array.isArray(i)?S.map(i,(function(e){return{name:t.name,value:e.replace(Et,"\r\n")}})):{name:t.name,value:i.replace(Et,"\r\n")}})).get()}});var wt=/%20/g,It=/#.*$/,Dt=/([?&])_=[^&]*/,kt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,At=/^\/\//,Mt={},Lt={},Bt="*/".concat("*"),Ot=n.createElement("a");function jt(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var n,a=0,r=t.toLowerCase().match(B)||[];if(p(i))for(;n=r[a++];)"+"===n[0]?(n=n.slice(1)||"*",(e[n]=e[n]||[]).unshift(i)):(e[n]=e[n]||[]).push(i)}}function Nt(e,t,i,n){var a={},r=e===Lt;function o(s){var l;return a[s]=!0,S.each(e[s]||[],(function(e,s){var c=s(t,i,n);return"string"!=typeof c||r||a[c]?r?!(l=c):void 0:(t.dataTypes.unshift(c),o(c),!1)})),l}return o(t.dataTypes[0])||!a["*"]&&o("*")}function Ut(e,t){var i,n,a=S.ajaxSettings.flatOptions||{};for(i in t)void 0!==t[i]&&((a[i]?e:n||(n={}))[i]=t[i]);return n&&S.extend(!0,e,n),e}Ot.href=yt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(yt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Bt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ut(Ut(e,S.ajaxSettings),t):Ut(S.ajaxSettings,e)},ajaxPrefilter:jt(Mt),ajaxTransport:jt(Lt),ajax:function(t,i){"object"==typeof t&&(i=t,t=void 0),i=i||{};var a,r,o,s,l,c,d,u,h,f,x=S.ajaxSetup({},i),p=x.context||x,m=x.context&&(p.nodeType||p.jquery)?S(p):S.event,_=S.Deferred(),g=S.Callbacks("once memory"),v=x.statusCode||{},y={},b={},P="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(d){if(!s)for(s={};t=kt.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return d?o:null},setRequestHeader:function(e,t){return null==d&&(e=b[e.toLowerCase()]=b[e.toLowerCase()]||e,y[e]=t),this},overrideMimeType:function(e){return null==d&&(x.mimeType=e),this},statusCode:function(e){var t;if(e)if(d)E.always(e[E.status]);else for(t in e)v[t]=[v[t],e[t]];return this},abort:function(e){var t=e||P;return a&&a.abort(t),C(0,t),this}};if(_.promise(E),x.url=((t||x.url||yt.href)+"").replace(At,yt.protocol+"//"),x.type=i.method||i.type||x.method||x.type,x.dataTypes=(x.dataType||"*").toLowerCase().match(B)||[""],null==x.crossDomain){c=n.createElement("a");try{c.href=x.url,c.href=c.href,x.crossDomain=Ot.protocol+"//"+Ot.host!=c.protocol+"//"+c.host}catch(e){x.crossDomain=!0}}if(x.data&&x.processData&&"string"!=typeof x.data&&(x.data=S.param(x.data,x.traditional)),Nt(Mt,x,i,E),d)return E;for(h in(u=S.event&&x.global)&&0==S.active++&&S.event.trigger("ajaxStart"),x.type=x.type.toUpperCase(),x.hasContent=!Ft.test(x.type),r=x.url.replace(It,""),x.hasContent?x.data&&x.processData&&0===(x.contentType||"").indexOf("application/x-www-form-urlencoded")&&(x.data=x.data.replace(wt,"+")):(f=x.url.slice(r.length),x.data&&(x.processData||"string"==typeof x.data)&&(r+=(bt.test(r)?"&":"?")+x.data,delete x.data),!1===x.cache&&(r=r.replace(Dt,"$1"),f=(bt.test(r)?"&":"?")+"_="+St+++f),x.url=r+f),x.ifModified&&(S.lastModified[r]&&E.setRequestHeader("If-Modified-Since",S.lastModified[r]),S.etag[r]&&E.setRequestHeader("If-None-Match",S.etag[r])),(x.data&&x.hasContent&&!1!==x.contentType||i.contentType)&&E.setRequestHeader("Content-Type",x.contentType),E.setRequestHeader("Accept",x.dataTypes[0]&&x.accepts[x.dataTypes[0]]?x.accepts[x.dataTypes[0]]+("*"!==x.dataTypes[0]?", "+Bt+"; q=0.01":""):x.accepts["*"]),x.headers)E.setRequestHeader(h,x.headers[h]);if(x.beforeSend&&(!1===x.beforeSend.call(p,E,x)||d))return E.abort();if(P="abort",g.add(x.complete),E.done(x.success),E.fail(x.error),a=Nt(Lt,x,i,E)){if(E.readyState=1,u&&m.trigger("ajaxSend",[E,x]),d)return E;x.async&&x.timeout>0&&(l=e.setTimeout((function(){E.abort("timeout")}),x.timeout));try{d=!1,a.send(y,C)}catch(e){if(d)throw e;C(-1,e)}}else C(-1,"No Transport");function C(t,i,n,s){var c,h,f,y,b,P=i;d||(d=!0,l&&e.clearTimeout(l),a=void 0,o=s||"",E.readyState=t>0?4:0,c=t>=200&&t<300||304===t,n&&(y=function(e,t,i){for(var n,a,r,o,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=e.mimeType||t.getResponseHeader("Content-Type"));if(n)for(a in s)if(s[a]&&s[a].test(n)){l.unshift(a);break}if(l[0]in i)r=l[0];else{for(a in i){if(!l[0]||e.converters[a+" "+l[0]]){r=a;break}o||(o=a)}r=r||o}if(r)return r!==l[0]&&l.unshift(r),i[r]}(x,E,n)),y=function(e,t,i,n){var a,r,o,s,l,c={},d=e.dataTypes.slice();if(d[1])for(o in e.converters)c[o.toLowerCase()]=e.converters[o];for(r=d.shift();r;)if(e.responseFields[r]&&(i[e.responseFields[r]]=t),!l&&n&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=r,r=d.shift())if("*"===r)r=l;else if("*"!==l&&l!==r){if(!(o=c[l+" "+r]||c["* "+r]))for(a in c)if((s=a.split(" "))[1]===r&&(o=c[l+" "+s[0]]||c["* "+s[0]])){!0===o?o=c[a]:!0!==c[a]&&(r=s[0],d.unshift(s[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+l+" to "+r}}}return{state:"success",data:t}}(x,y,E,c),c?(x.ifModified&&((b=E.getResponseHeader("Last-Modified"))&&(S.lastModified[r]=b),(b=E.getResponseHeader("etag"))&&(S.etag[r]=b)),204===t||"HEAD"===x.type?P="nocontent":304===t?P="notmodified":(P=y.state,h=y.data,c=!(f=y.error))):(f=P,!t&&P||(P="error",t<0&&(t=0))),E.status=t,E.statusText=(i||P)+"",c?_.resolveWith(p,[h,P,E]):_.rejectWith(p,[E,P,f]),E.statusCode(v),v=void 0,u&&m.trigger(c?"ajaxSuccess":"ajaxError",[E,x,c?h:f]),g.fireWith(p,[E,P]),u&&(m.trigger("ajaxComplete",[E,x]),--S.active||S.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,i){return S.get(e,t,i,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],(function(e,t){S[t]=function(e,i,n,a){return p(i)&&(a=a||n,n=i,i=void 0),S.ajax(S.extend({url:e,type:t,dataType:a,data:i,success:n},S.isPlainObject(e)&&e))}})),S._evalUrl=function(e){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(p(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return p(e)?this.each((function(t){S(this).wrapInner(e.call(this,t))})):this.each((function(){var t=S(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)}))},wrap:function(e){var t=p(e);return this.each((function(i){S(this).wrapAll(t?e.call(this,i):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){S(this).replaceWith(this.childNodes)})),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var zt={0:200,1223:204},Ht=S.ajaxSettings.xhr();x.cors=!!Ht&&"withCredentials"in Ht,x.ajax=Ht=!!Ht,S.ajaxTransport((function(t){var i,n;if(x.cors||Ht&&!t.crossDomain)return{send:function(a,r){var o,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)s[o]=t.xhrFields[o];for(o in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||a["X-Requested-With"]||(a["X-Requested-With"]="XMLHttpRequest"),a)s.setRequestHeader(o,a[o]);i=function(e){return function(){i&&(i=n=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?r(0,"error"):r(s.status,s.statusText):r(zt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=i(),n=s.onerror=s.ontimeout=i("error"),void 0!==s.onabort?s.onabort=n:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout((function(){i&&n()}))},i=i("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(i)throw e}},abort:function(){i&&i()}}})),S.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),S.ajaxTransport("script",(function(e){var t,i;if(e.crossDomain)return{send:function(a,r){t=S("