store.js
92.7 KB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xdystore=t():e.xdystore=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(2)},function(e,t){"use strict";var r=!0,n={disableLog:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},log:function(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},extractVersion:function(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)},detectBrowser:function(){var e={};if(e.browser=null,e.version=null,"undefined"==typeof window||!window.navigator)return e.browser="Not a browser.",e;if(navigator.mozGetUserMedia)e.browser="firefox",e.version=this.extractVersion(navigator.userAgent,/Firefox\/(\d+)\./,1);else if(navigator.webkitGetUserMedia)if(window.webkitRTCPeerConnection)e.browser="chrome",e.version=this.extractVersion(navigator.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!navigator.userAgent.match(/Version\/(\d+).(\d+)/))return e.browser="Unsupported webkit-based browser with GUM support but no WebRTC support.",e;e.browser="safari",e.version=this.extractVersion(navigator.userAgent,/AppleWebKit\/(\d+)\./,1)}else if(navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=this.extractVersion(navigator.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!navigator.mediaDevices||!navigator.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=this.extractVersion(navigator.userAgent,/AppleWebKit\/(\d+)\./,1)}return e},shimCreateObjectURL:function(){if("object"==typeof window&&window.HTMLMediaElement&&"srcObject"in window.HTMLMediaElement.prototype){var e=URL.createObjectURL.bind(URL),t=URL.revokeObjectURL.bind(URL),r=new Map,n=0;URL.createObjectURL=function(t){if("getTracks"in t){var i="polyblob:"+ ++n;return r.set(i,t),console.log("URL.createObjectURL(stream) is deprecated! Use elem.srcObject = stream instead!"),i}return e(t)},URL.revokeObjectURL=function(e){t(e),r.delete(e)};var i=Object.getOwnPropertyDescriptor(window.HTMLMediaElement.prototype,"src");Object.defineProperty(window.HTMLMediaElement.prototype,"src",{get:function(){return i.get.apply(this)},set:function(e){return this.srcObject=r.get(e)||null,i.set.apply(this,[e])}});var o=HTMLMediaElement.prototype.setAttribute;HTMLMediaElement.prototype.setAttribute=function(){return 2===arguments.length&&"src"===(""+arguments[0]).toLowerCase()&&(this.srcObject=r.get(arguments[1])||null),o.apply(this,arguments)}}}};e.exports={log:n.log,disableLog:n.disableLog,browserDetails:n.detectBrowser(),extractVersion:n.extractVersion,shimCreateObjectURL:n.shimCreateObjectURL,detectBrowser:n.detectBrowser.bind(n)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var i=r(4),o=n(i),a=r(3),s=n(a);r(6);var c=o.default.createInstance({name:"xdy",version:"1.0",size:104857600,storeName:"XDY",description:"A XDY LOCAL STOREAGE."});e.exports={get:function(e,t){c.getItem(e,t)},set:function(e,t,r){c.setItem(e,t,r)},getDevices:function(e){function t(){s.default.load(function(){e(null,{cameras:s.default.videoInputDevices,camEnabled:s.default.isWebsiteHasWebcamPermissions,microphones:s.default.audioInputDevices,micEnabled:s.default.isWebsiteHasMicrophonePermissions,speakers:s.default.audioOutputDevices})})}navigator.getUserMedia({video:!0,audio:!0},function(e){e&&e.getTracks().forEach(function(t){t.stop(),e.removeTrack(t)}),t()},function(){t()})}}},function(e,t,r){var n,i;(function(r,o){!function(){"use strict";function a(){var e,t,r,n=(y.appVersion,y.userAgent),i=y.appName,o=""+parseFloat(y.appVersion),a=parseInt(y.appVersion,10);if(S){i="Opera";try{o=y.userAgent.split("OPR/")[1].split(" ")[0],a=o.split(".")[0]}catch(e){o="0.0.0.0",a=0}}else E?(t=n.indexOf("MSIE"),i="IE",o=n.substring(t+5)):k?(t=n.indexOf("Chrome"),i="Chrome",o=n.substring(t+7)):T?(t=n.indexOf("Safari"),i="Safari",o=n.substring(t+7),(t=n.indexOf("Version"))!==-1&&(o=n.substring(t+8))):C?(t=n.indexOf("Firefox"),i="Firefox",o=n.substring(t+8)):(e=n.lastIndexOf(" ")+1)<(t=n.lastIndexOf("/"))&&(i=n.substring(e,t),o=n.substring(t+1),i.toLowerCase()===i.toUpperCase()&&(i=y.appName));return b&&(i="Edge",o=parseInt(y.userAgent.match(/Edge\/(\d+).(\d+)$/)[2],10).toString()),(r=o.indexOf(";"))!==-1&&(o=o.substring(0,r)),(r=o.indexOf(" "))!==-1&&(o=o.substring(0,r)),a=parseInt(""+o,10),isNaN(a)&&(o=""+parseFloat(y.appVersion),a=parseInt(y.appVersion,10)),{fullVersion:o,version:a,name:i,isPrivateBrowsing:!1}}function s(e,t){var r=0,n=50,i=!1,o=window.setInterval(function(){e()&&(window.clearInterval(o),t(i)),r++>n&&(window.clearInterval(o),i=!0,t(i))},10)}function c(e){var t=e.toLowerCase();if(0===t.indexOf("msie")&&0===t.indexOf("trident"))return!1;var r=/(?:msie|rv:)\s?([\d\.]+)/.exec(t);return!!(r&&parseInt(r[1],10)>=10)}function d(e){var t;try{if(window.webkitRequestFileSystem)window.webkitRequestFileSystem(window.TEMPORARY,1,function(){t=!1},function(e){t=!0});else if(window.indexedDB&&/Firefox/.test(window.navigator.userAgent)){var r;try{r=window.indexedDB.open("test"),r.onerror=function(){return!0}}catch(e){t=!0}"undefined"==typeof t&&s(function(){return"done"===r.readyState},function(e){e||(t=!r.result)})}else if(c(window.navigator.userAgent)){t=!1;try{window.indexedDB||(t=!0)}catch(e){t=!0}}else if(window.localStorage&&/Safari/.test(window.navigator.userAgent)){try{window.localStorage.setItem("test",1)}catch(e){t=!0}"undefined"==typeof t&&(t=!1,window.localStorage.removeItem("test"))}}catch(e){t=!1}s(function(){return"undefined"!=typeof t},function(r){e(t)})}function u(){var e="-",t=y.appVersion,r=y.userAgent,n=e,i=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 3.11",r:/Win16/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}];for(var o in i){var a=i[o];if(a.r.test(r)){n=a.s;break}}var s=e;switch(/Windows/.test(n)&&(/Windows (.*)/.test(n)&&(s=/Windows (.*)/.exec(n)[1]),n="Windows"),n){case"Mac OS X":/Mac OS X (10[\.\_\d]+)/.test(r)&&(s=/Mac OS X (10[\.\_\d]+)/.exec(r)[1]);break;case"Android":/Android ([\.\_\d]+)/.test(r)&&(s=/Android ([\.\_\d]+)/.exec(r)[1]);break;case"iOS":/OS (\d+)_(\d+)_?(\d+)?/.test(r)&&(s=/OS (\d+)_(\d+)_?(\d+)?/.exec(t),s=s[1]+"."+s[2]+"."+(0|s[3]))}return{osName:n,osVersion:s}}function f(e){e=(e||y.userAgent).toLowerCase();var t=e.match(/android\s([0-9\.]*)/);return!!t&&t[1]}function p(e){G.isWebRTCSupported&&(G.isORTCSupported||l(function(t){e(t.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)?"Local: "+t:"Public: "+t)}))}function l(e){function t(t){var n=/([0-9]{1,3}(\.[0-9]{1,3}){3})/,i=n.exec(t);if(!i)return void console.warn("Could not match IP address in",t);var o=i[1];void 0===r[o]&&e(o),r[o]=!0}var r={},n=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,i=!!window.webkitRTCPeerConnection;if(!n){var o=document.getElementById("iframe");if(!o)throw"NOTE: you need to have an iframe in the page right above the script tag.";var a=o.contentWindow;n=a.RTCPeerConnection||a.mozRTCPeerConnection||a.webkitRTCPeerConnection,i=!!a.webkitRTCPeerConnection}if(n){var s,c={optional:[{RtpDataChannels:!0}]};i&&(s={iceServers:[{urls:"stun:stun.services.mozilla.com"}]},"undefined"!=typeof G&&G.browser.isFirefox&&G.browser.version<=38&&(s[0]={url:s[0].urls}));var d=new n(s,c);d.onicecandidate=function(e){e.candidate&&t(e.candidate.candidate)},d.createDataChannel(""),d.createOffer(function(e){d.setLocalDescription(e,function(){},function(){})},function(){}),setTimeout(function(){var e=d.localDescription.sdp.split("\n");e.forEach(function(e){0===e.indexOf("a=candidate:")&&t(e)})},1e3)}}function v(e){if(!A)return void(e&&e());if(!y.enumerateDevices&&window.MediaStreamTrack&&window.MediaStreamTrack.getSources&&(y.enumerateDevices=window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack)),!y.enumerateDevices&&y.enumerateDevices&&(y.enumerateDevices=y.enumerateDevices.bind(y)),!y.enumerateDevices)return void(e&&e());I=[],M=[],j=[],L=[],W=!1,F=!1;var t={};y.enumerateDevices(function(r){r.forEach(function(e){var r={};for(var n in e)try{"function"!=typeof e[n]&&(r[n]=e[n])}catch(e){}t[r.deviceId]||("audio"===r.kind&&(r.kind="audioinput"),"video"===r.kind&&(r.kind="videoinput"),r.deviceId||(r.deviceId=r.id),r.id||(r.id=r.deviceId),r.label?("videoinput"!==r.kind||F||(F=!0),"audioinput"!==r.kind||W||(W=!0)):(r.label="Please invoke getUserMedia once.","https:"!==location.protocol&&document.domain.search&&document.domain.search(/localhost|127.0./g)===-1&&(r.label="HTTPs is required to get label of this "+r.kind+" device.")),"audioinput"===r.kind&&(N=!0,M.indexOf(r)===-1&&M.push(r)),"audiooutput"===r.kind&&(U=!0,j.indexOf(r)===-1&&j.push(r)),"videoinput"===r.kind&&(B=!0,L.indexOf(r)===-1&&L.push(r)),I.push(r),t[r.deviceId]=r)}),"undefined"!=typeof G&&(G.MediaDevices=I,G.hasMicrophone=N,G.hasSpeakers=U,G.hasWebcam=B,G.isWebsiteHasWebcamPermissions=F,G.isWebsiteHasMicrophonePermissions=W,G.audioInputDevices=M,G.audioOutputDevices=j,G.videoInputDevices=L),e&&e()})}var h="Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45",m="object"==typeof r&&"object"==typeof r.versions&&r.versions.node;if(m){var g=r.versions.node.toString().replace("v","");h="Nodejs/"+g+" (NodeOS) AppleWebKit/"+g+" (KHTML, like Gecko) Nodejs/"+g+" Nodejs/"+g}!function(e){"undefined"==typeof window&&("undefined"==typeof window&&"undefined"!=typeof o?(o.navigator={userAgent:h,getUserMedia:function(){}},e.window=o):"undefined"==typeof window,"undefined"==typeof document&&(e.document={},document.createElement=document.captureStream=document.mozCaptureStream=function(){return{}}),"undefined"==typeof location&&(e.location={protocol:"file:",href:"",hash:""}),"undefined"==typeof screen&&(e.screen={width:0,height:0}))}("undefined"!=typeof o?o:window);var y=window.navigator;"undefined"!=typeof y?("undefined"!=typeof y.webkitGetUserMedia&&(y.getUserMedia=y.webkitGetUserMedia),"undefined"!=typeof y.mozGetUserMedia&&(y.getUserMedia=y.mozGetUserMedia)):y={getUserMedia:function(){},userAgent:h};var w=!!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i.test(y.userAgent||""),b=!(y.userAgent.indexOf("Edge")===-1||!y.msSaveOrOpenBlob&&!y.msSaveBlob),S=!!window.opera||y.userAgent.indexOf(" OPR/")>=0,C="undefined"!=typeof window.InstallTrigger,T=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,k=!!window.chrome&&!S,E=!!document.documentMode&&!b,R={Android:function(){return y.userAgent.match(/Android/i)},BlackBerry:function(){return y.userAgent.match(/BlackBerry|BB10/i)},iOS:function(){return y.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return y.userAgent.match(/Opera Mini/i)},Windows:function(){return y.userAgent.match(/IEMobile/i)},any:function(){return R.Android()||R.BlackBerry()||R.iOS()||R.Opera()||R.Windows()},getOsName:function(){var e="Unknown OS";return R.Android()&&(e="Android"),R.BlackBerry()&&(e="BlackBerry"),R.iOS()&&(e="iOS"),R.Opera()&&(e="Opera Mini"),R.Windows()&&(e="Windows"),e}},P="Unknown OS",O="Unknown OS Version",x=u();x&&x.osName&&"-"!=x.osName?(P=x.osName,O=x.osVersion):R.any()&&(P=R.getOsName(),"Android"==P&&(O=f()));var m="object"==typeof r&&"object"==typeof r.versions&&r.versions.node;"Unknown OS"===P&&m&&(P="Nodejs",O=r.versions.node.toString().replace("v",""));var D=!1,_=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach(function(e){!D&&e in document.createElement("canvas")&&(D=!0),!_&&e in document.createElement("video")&&(_=!0)});var I=[],M=[],j=[],L=[];y.mediaDevices&&y.mediaDevices.enumerateDevices&&(y.enumerateDevices=function(e){y.mediaDevices.enumerateDevices().then(e).catch(function(){e([])})});var A=!1;"undefined"!=typeof MediaStreamTrack&&"getSources"in MediaStreamTrack?A=!0:y.mediaDevices&&y.mediaDevices.enumerateDevices&&(A=!0);var N=!1,U=!1,B=!1,W=!1,F=!1;v();var G=window.DetectRTC||{};G.browser=a(),d(function(e){G.browser.isPrivateBrowsing=!!e}),G.browser["is"+G.browser.name]=!0,G.osName=P,G.osVersion=O;var z=("object"==typeof r&&"object"==typeof r.versions&&r.versions["node-webkit"],!1);["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection","RTCIceGatherer"].forEach(function(e){z||e in window&&(z=!0)}),G.isWebRTCSupported=z,G.isORTCSupported="undefined"!=typeof RTCIceGatherer;var V=!1;G.browser.isChrome&&G.browser.version>=35?V=!0:G.browser.isFirefox&&G.browser.version>=34&&(V=!0),"https:"!==location.protocol&&(V=!1),G.isScreenCapturingSupported=V;var H={isSupported:!1,isCreateMediaStreamSourceSupported:!1};["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"].forEach(function(e){H.isSupported||e in window&&(H.isSupported=!0,window[e]&&"createMediaStreamSource"in window[e].prototype&&(H.isCreateMediaStreamSourceSupported=!0))}),G.isAudioContextSupported=H.isSupported,G.isCreateMediaStreamSourceSupported=H.isCreateMediaStreamSourceSupported;var q=!1;G.browser.isChrome&&G.browser.version>31&&(q=!0),G.isRtpDataChannelsSupported=q;var X=!1;G.browser.isFirefox&&G.browser.version>28?X=!0:G.browser.isChrome&&G.browser.version>25?X=!0:G.browser.isOpera&&G.browser.version>=11&&(X=!0),G.isSctpDataChannelsSupported=X,G.isMobileDevice=w;var J=!1;y.getUserMedia?J=!0:y.mediaDevices&&y.mediaDevices.getUserMedia&&(J=!0),G.browser.isChrome&&G.browser.version>=46&&"https:"!==location.protocol&&(J="Requires HTTPs"),"Nodejs"===G.osName&&(J=!1),G.isGetUserMediaSupported=J;var K="";if(screen.width){var Q=screen.width?screen.width:"",Y=screen.height?screen.height:"";K+=""+Q+" x "+Y}G.displayResolution=K,G.isCanvasSupportsStreamCapturing=D,G.isVideoSupportsStreamCapturing=_,"Chrome"==G.browser.name&&G.browser.version>=53&&(G.isCanvasSupportsStreamCapturing||(G.isCanvasSupportsStreamCapturing="Requires chrome flag: enable-experimental-web-platform-features"),G.isVideoSupportsStreamCapturing||(G.isVideoSupportsStreamCapturing="Requires chrome flag: enable-experimental-web-platform-features")),G.DetectLocalIPAddress=p,G.isWebSocketsSupported="WebSocket"in window&&2===window.WebSocket.CLOSING,G.isWebSocketsBlocked=!G.isWebSocketsSupported,"Nodejs"===G.osName&&(G.isWebSocketsSupported=!0,G.isWebSocketsBlocked=!1),G.checkWebSocketsSupport=function(e){e=e||function(){};try{var t=new WebSocket("wss://echo.websocket.org:443/");t.onopen=function(){G.isWebSocketsBlocked=!1,e(),t.close(),t=null},t.onerror=function(){G.isWebSocketsBlocked=!0,e()}}catch(t){G.isWebSocketsBlocked=!0,e()}},G.load=function(e){e=e||function(){},v(e)},G.MediaDevices=I,G.hasMicrophone=N,G.hasSpeakers=U,G.hasWebcam=B,G.isWebsiteHasWebcamPermissions=F,G.isWebsiteHasMicrophonePermissions=W,G.audioInputDevices=M,G.audioOutputDevices=j,G.videoInputDevices=L;var $=!1;"setSinkId"in document.createElement("video")&&($=!0),G.isSetSinkIdSupported=$;var Z=!1;G.browser.isFirefox&&"undefined"!=typeof mozRTCPeerConnection?"getSenders"in mozRTCPeerConnection.prototype&&(Z=!0):G.browser.isChrome&&"undefined"!=typeof webkitRTCPeerConnection&&"getSenders"in webkitRTCPeerConnection.prototype&&(Z=!0),G.isRTPSenderReplaceTracksSupported=Z;var ee=!1;G.browser.isFirefox&&G.browser.version>38&&(ee=!0),G.isRemoteStreamProcessingSupported=ee;var te=!1;"undefined"!=typeof MediaStreamTrack&&"applyConstraints"in MediaStreamTrack.prototype&&(te=!0),G.isApplyConstraintsSupported=te;var re=!1;G.browser.isFirefox&&G.browser.version>=43&&(re=!0),G.isMultiMonitorScreenCapturingSupported=re,G.isPromisesSupported=!!("Promise"in window),"undefined"==typeof G&&(window.DetectRTC={});var ne=window.MediaStream;"undefined"==typeof ne&&"undefined"!=typeof webkitMediaStream&&(ne=webkitMediaStream),"undefined"!=typeof ne?G.MediaStream=Object.keys(ne.prototype):G.MediaStream=!1,"undefined"!=typeof MediaStreamTrack?G.MediaStreamTrack=Object.keys(MediaStreamTrack.prototype):G.MediaStreamTrack=!1;var ie=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;"undefined"!=typeof ie?G.RTCPeerConnection=Object.keys(ie.prototype):G.RTCPeerConnection=!1,window.DetectRTC=G,e.exports=G,n=[],i=function(){return G}.apply(t,n),!(void 0!==i&&(e.exports=i))}()}).call(t,r(15),function(){return this}())},function(e,t,r){var n,n;(function(t){!function(t){e.exports=t()}(function(){return function e(t,r,i){function o(s,c){if(!r[s]){if(!t[s]){var d="function"==typeof n&&n;if(!c&&d)return n(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var f=r[s]={exports:{}};t[s][0].call(f.exports,function(e){var r=t[s][1][e];return o(r?r:e)},f,f.exports,e,t,r,i)}return r[s].exports}for(var a="function"==typeof n&&n,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(e,r,n){(function(e){"use strict";function t(){u=!0;for(var e,t,r=f.length;r;){for(t=f,f=[],e=-1;++e<r;)t[e]();r=f.length}u=!1}function n(e){1!==f.push(e)||u||i()}var i,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var a=0,s=new o(t),c=e.document.createTextNode("");s.observe(c,{characterData:!0}),i=function(){c.data=a=++a%2}}else if(e.setImmediate||"undefined"==typeof e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var r=e.document.createElement("script");r.onreadystatechange=function(){t(),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},e.document.documentElement.appendChild(r)}:function(){setTimeout(t,0)};else{var d=new e.MessageChannel;d.port1.onmessage=t,i=function(){d.port2.postMessage(0)}}var u,f=[];r.exports=n}).call(this,"undefined"!=typeof t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){"use strict";function n(){}function i(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=y,this.queue=[],this.outcome=void 0,e!==n&&c(this,e)}function o(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function a(e,t,r){v(function(){var n;try{n=t(r)}catch(t){return h.reject(e,t)}n===e?h.reject(e,new TypeError("Cannot resolve promise with itself")):h.resolve(e,n)})}function s(e){var t=e&&e.then;if(e&&"object"==typeof e&&"function"==typeof t)return function(){t.apply(e,arguments)}}function c(e,t){function r(t){o||(o=!0,h.reject(e,t))}function n(t){o||(o=!0,h.resolve(e,t))}function i(){t(n,r)}var o=!1,a=d(i);"error"===a.status&&r(a.value)}function d(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}function u(e){return e instanceof this?e:h.resolve(new this(n),e)}function f(e){var t=new this(n);return h.reject(t,e)}function p(e){function t(e,t){function n(e){a[t]=e,++s!==i||o||(o=!0,h.resolve(d,a))}r.resolve(e).then(n,function(e){o||(o=!0,h.reject(d,e))})}var r=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=new Array(i),s=0,c=-1,d=new this(n);++c<i;)t(e[c],c);return d}function l(e){function t(e){r.resolve(e).then(function(e){o||(o=!0,h.resolve(s,e))},function(e){o||(o=!0,h.reject(s,e))})}var r=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=-1,s=new this(n);++a<i;)t(e[a]);return s}var v=e(1),h={},m=["REJECTED"],g=["FULFILLED"],y=["PENDING"];t.exports=r=i,i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){if("function"!=typeof e&&this.state===g||"function"!=typeof t&&this.state===m)return this;var r=new this.constructor(n);if(this.state!==y){var i=this.state===g?e:t;a(r,i,this.outcome)}else this.queue.push(new o(r,e,t));return r},o.prototype.callFulfilled=function(e){h.resolve(this.promise,e)},o.prototype.otherCallFulfilled=function(e){a(this.promise,this.onFulfilled,e)},o.prototype.callRejected=function(e){h.reject(this.promise,e)},o.prototype.otherCallRejected=function(e){a(this.promise,this.onRejected,e)},h.resolve=function(e,t){var r=d(s,t);if("error"===r.status)return h.reject(e,r.value);var n=r.value;if(n)c(e,n);else{e.state=g,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},h.reject=function(e,t){e.state=m,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},r.resolve=u,r.reject=f,r.all=p,r.race=l},{1:1}],3:[function(e,r,n){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,"undefined"!=typeof t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){}}function o(){try{if(!ae)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&fetch.toString().indexOf("[native code")!==-1;return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function a(){return"function"==typeof openDatabase}function s(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&localStorage.setItem}catch(e){return!1}}function c(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,n=new r,i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}function d(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}function p(e){return new de(function(t){var r=e.transaction(ue,"readwrite"),n=c([""]);r.objectStore(ue).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}function l(e){return"boolean"==typeof se?de.resolve(se):p(e).then(function(e){return se=e})}function v(e){var t=ce[e.name],r={};r.promise=new de(function(e){r.resolve=e}),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then(function(){return r.promise}):t.dbReady=r.promise}function h(e){var t=ce[e.name],r=t.deferredOperations.pop();r&&r.resolve()}function m(e,t){return new de(function(r,n){if(e.db){if(!t)return r(e.db);v(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var o=ae.open.apply(ae,i);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(ue)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){r(o.result),h(e)}})}function g(e){return m(e,!1)}function y(e){return m(e,!0)}function w(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function b(e){return new de(function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)})}function S(e){var t=f(atob(e.data));return c([t],{type:e.type})}function C(e){return e&&e.__local_forage_encoded_blob}function T(e){var t=this,r=t._initReady().then(function(){var e=ce[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return u(r,e,e),r}function k(e){function t(){return de.resolve()}var r=this,n={db:null};if(e)for(var i in e)n[i]=e[i];ce||(ce={});var o=ce[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},ce[n.name]=o),o.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=T);for(var a=[],s=0;s<o.forages.length;s++){var c=o.forages[s];c!==r&&a.push(c._initReady().catch(t))}var d=o.forages.slice(0);return de.all(a).then(function(){return n.db=o.db,g(n)}).then(function(e){return n.db=e,w(n,r._defaultConfig.version)?y(n):e}).then(function(e){n.db=o.db=e,r._dbInfo=n;for(var t=0;t<d.length;t++){var i=d[t];i!==r&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}})}function E(e,t){var r=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var n=new de(function(t,n){r.ready().then(function(){var i=r._dbInfo,o=i.db.transaction(i.storeName,"readonly").objectStore(i.storeName),a=o.get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),C(e)&&(e=S(e)),t(e)},a.onerror=function(){n(a.error)}}).catch(n)});return d(n,t),n}function R(e,t){var r=this,n=new de(function(t,n){r.ready().then(function(){var i=r._dbInfo,o=i.db.transaction(i.storeName,"readonly").objectStore(i.storeName),a=o.openCursor(),s=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;C(n)&&(n=S(n));var i=e(n,r.key,s++);void 0!==i?t(i):r.continue()}else t()},a.onerror=function(){n(a.error)}}).catch(n)});return d(n,t),n}function P(e,t,r){var n=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var i=new de(function(r,i){var o;n.ready().then(function(){return o=n._dbInfo,"[object Blob]"===fe.call(t)?l(o.db).then(function(e){return e?t:b(t)}):t}).then(function(t){var n=o.db.transaction(o.storeName,"readwrite"),a=n.objectStore(o.storeName),s=a.put(t,e);null===t&&(t=void 0),n.oncomplete=function(){void 0===t&&(t=null),r(t)},n.onabort=n.onerror=function(){var e=s.error?s.error:s.transaction.error;i(e)}}).catch(i)});return d(i,r),i}function O(e,t){var r=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var n=new de(function(t,n){r.ready().then(function(){var i=r._dbInfo,o=i.db.transaction(i.storeName,"readwrite"),a=o.objectStore(i.storeName),s=a.delete(e);o.oncomplete=function(){t()},o.onerror=function(){n(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;n(e)}}).catch(n)});return d(n,t),n}function x(e){var t=this,r=new de(function(e,r){t.ready().then(function(){var n=t._dbInfo,i=n.db.transaction(n.storeName,"readwrite"),o=i.objectStore(n.storeName),a=o.clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;r(e)}}).catch(r)});return d(r,e),r}function D(e){var t=this,r=new de(function(e,r){t.ready().then(function(){var n=t._dbInfo,i=n.db.transaction(n.storeName,"readonly").objectStore(n.storeName),o=i.count();o.onsuccess=function(){e(o.result)},o.onerror=function(){r(o.error)}}).catch(r)});return d(r,e),r}function _(e,t){var r=this,n=new de(function(t,n){return e<0?void t(null):void r.ready().then(function(){var i=r._dbInfo,o=i.db.transaction(i.storeName,"readonly").objectStore(i.storeName),a=!1,s=o.openCursor();s.onsuccess=function(){var r=s.result;return r?void(0===e?t(r.key):a?t(r.key):(a=!0,r.advance(e))):void t(null)},s.onerror=function(){n(s.error)}}).catch(n)});return d(n,t),n}function I(e){var t=this,r=new de(function(e,r){t.ready().then(function(){var n=t._dbInfo,i=n.db.transaction(n.storeName,"readonly").objectStore(n.storeName),o=i.openCursor(),a=[];o.onsuccess=function(){var t=o.result;return t?(a.push(t.key),void t.continue()):void e(a)},o.onerror=function(){r(o.error)}}).catch(r)});return d(r,e),r}function M(e){var t,r,n,i,o,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var d=new ArrayBuffer(a),u=new Uint8Array(d);for(t=0;t<s;t+=4)r=le.indexOf(e[t]),n=le.indexOf(e[t+1]),i=le.indexOf(e[t+2]),o=le.indexOf(e[t+3]),u[c++]=r<<2|n>>4,u[c++]=(15&n)<<4|i>>2,u[c++]=(3&i)<<6|63&o;return d}function j(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=le[r[t]>>2],n+=le[(3&r[t])<<4|r[t+1]>>4],n+=le[(15&r[t+1])<<2|r[t+2]>>6],n+=le[63&r[t+2]];return r.length%3===2?n=n.substring(0,n.length-1)+"=":r.length%3===1&&(n=n.substring(0,n.length-2)+"=="),n}function L(e,t){var r="";if(e&&(r=De.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===De.call(e.buffer))){var n,i=me;e instanceof ArrayBuffer?(n=e,i+=ye):(n=e.buffer,"[object Int8Array]"===r?i+=be:"[object Uint8Array]"===r?i+=Se:"[object Uint8ClampedArray]"===r?i+=Ce:"[object Int16Array]"===r?i+=Te:"[object Uint16Array]"===r?i+=Ee:"[object Int32Array]"===r?i+=ke:"[object Uint32Array]"===r?i+=Re:"[object Float32Array]"===r?i+=Pe:"[object Float64Array]"===r?i+=Oe:t(new Error("Failed to get type for BinaryArray"))),t(i+j(n))}else if("[object Blob]"===r){var o=new FileReader;o.onload=function(){var r=ve+e.type+"~"+j(this.result);t(me+we+r)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}}function A(e){if(e.substring(0,ge)!==me)return JSON.parse(e);var t,r=e.substring(xe),n=e.substring(ge,xe);if(n===we&&he.test(r)){var i=r.match(he);t=i[1],r=r.substring(i[0].length)}var o=M(r);switch(n){case ye:return o;case we:return c([o],{type:t});case be:return new Int8Array(o);case Se:return new Uint8Array(o);case Ce:return new Uint8ClampedArray(o);case Te:return new Int16Array(o);case Ee:return new Uint16Array(o);case ke:return new Int32Array(o);case Re:return new Uint32Array(o);case Pe:return new Float32Array(o);case Oe:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}}function N(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new de(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(i){i.executeSql("CREATE TABLE IF NOT EXISTS "+r.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){t._dbInfo=r,e()},function(e,t){n(t)})})});return r.serializer=_e,i}function U(e,t){
var r=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var n=new de(function(t,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(r){r.executeSql("SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return d(n,t),n}function B(e,t){var r=this,n=new de(function(t,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(r){r.executeSql("SELECT * FROM "+i.storeName,[],function(r,n){for(var o=n.rows,a=o.length,s=0;s<a;s++){var c=o.item(s),d=c.value;if(d&&(d=i.serializer.deserialize(d)),d=e(d,c.key,s+1),void 0!==d)return void t(d)}t()},function(e,t){n(t)})})}).catch(n)});return d(n,t),n}function W(e,t,r,n){var i=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var o=new de(function(o,a){i.ready().then(function(){void 0===t&&(t=null);var s=t,c=i._dbInfo;c.serializer.serialize(t,function(t,d){d?a(d):c.db.transaction(function(r){r.executeSql("INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){o(s)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void o(W.apply(i,[e,s,r,n-1]));a(t)}})})}).catch(a)});return d(o,r),o}function F(e,t,r){return W.apply(this,[e,t,r,1])}function G(e,t){var r=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var n=new de(function(t,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(r){r.executeSql("DELETE FROM "+i.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return d(n,t),n}function z(e){var t=this,r=new de(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){t.executeSql("DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return d(r,e),r}function V(e){var t=this,r=new de(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){t.executeSql("SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return d(r,e),r}function H(e,t){var r=this,n=new de(function(t,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(r){r.executeSql("SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return d(n,t),n}function q(e){var t=this,r=new de(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){t.executeSql("SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)},function(e,t){r(t)})})}).catch(r)});return d(r,e),r}function X(e){var t=this,r={};if(e)for(var n in e)r[n]=e[n];return r.keyPrefix=r.name+"/",r.storeName!==t._defaultConfig.storeName&&(r.keyPrefix+=r.storeName+"/"),t._dbInfo=r,r.serializer=_e,de.resolve()}function J(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return d(r,e),r}function K(e,t){var r=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return d(n,t),n}function Q(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,o=localStorage.length,a=1,s=0;s<o;s++){var c=localStorage.key(s);if(0===c.indexOf(n)){var d=localStorage.getItem(c);if(d&&(d=t.serializer.deserialize(d)),d=e(d,c.substring(i),a++),void 0!==d)return d}}});return d(n,t),n}function Y(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return d(n,t),n}function $(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++)0===localStorage.key(i).indexOf(e.keyPrefix)&&n.push(localStorage.key(i).substring(e.keyPrefix.length));return n});return d(r,e),r}function Z(e){var t=this,r=t.keys().then(function(e){return e.length});return d(r,e),r}function ee(e,t){var r=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var n=r.ready().then(function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)});return d(n,t),n}function te(e,t,r){var n=this;"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e));var i=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new de(function(i,o){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)o(n);else try{localStorage.setItem(a.keyPrefix+e,t),i(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}})})});return d(i,r),i}function re(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function ne(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(We(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}function ie(e){for(var t in Le)if(Le.hasOwnProperty(t)&&Le[t]===e)return!0;return!1}var oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae=i();"undefined"==typeof Promise&&e(3);var se,ce,de=Promise,ue="local-forage-detect-blob-support",fe=Object.prototype.toString,pe={_driver:"asyncStorage",_initStorage:k,iterate:R,getItem:E,setItem:P,removeItem:O,clear:x,length:D,key:_,keys:I},le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ve="~~local_forage_type~",he=/^~~local_forage_type~([^~]+)~/,me="__lfsc__:",ge=me.length,ye="arbf",we="blob",be="si08",Se="ui08",Ce="uic8",Te="si16",ke="si32",Ee="ur16",Re="ui32",Pe="fl32",Oe="fl64",xe=ge+ye.length,De=Object.prototype.toString,_e={serialize:L,deserialize:A,stringToBuffer:M,bufferToString:j},Ie={_driver:"webSQLStorage",_initStorage:N,iterate:B,getItem:U,setItem:F,removeItem:G,clear:z,length:V,key:H,keys:q},Me={_driver:"localStorageWrapper",_initStorage:X,iterate:Q,getItem:K,setItem:te,removeItem:ee,clear:J,length:Z,key:Y,keys:$},je={},Le={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},Ae=[Le.INDEXEDDB,Le.WEBSQL,Le.LOCALSTORAGE],Ne=["clear","getItem","iterate","key","keys","length","removeItem","setItem"],Ue={description:"",driver:Ae.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},Be={};Be[Le.INDEXEDDB]=o(),Be[Le.WEBSQL]=a(),Be[Le.LOCALSTORAGE]=s();var We=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Fe=function(){function e(t){n(this,e),this.INDEXEDDB=Le.INDEXEDDB,this.LOCALSTORAGE=Le.LOCALSTORAGE,this.WEBSQL=Le.WEBSQL,this._defaultConfig=ne({},Ue),this._config=ne({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===("undefined"==typeof e?"undefined":oe(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new de(function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver"),o=new Error("Custom driver name already in use: "+e._driver);if(!e._driver)return void r(i);if(ie(e._driver))return void r(o);for(var a=Ne.concat("_initStorage"),s=0;s<a.length;s++){var c=a[s];if(!c||!e[c]||"function"!=typeof e[c])return void r(i)}var d=de.resolve(!0);"_support"in e&&(d=e._support&&"function"==typeof e._support?e._support():de.resolve(!!e._support)),d.then(function(r){Be[n]=r,je[n]=e,t()},r)}catch(e){r(e)}});return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=this,i=de.resolve().then(function(){if(!ie(e)){if(je[e])return je[e];throw new Error("Driver not found.")}switch(e){case n.INDEXEDDB:return pe;case n.LOCALSTORAGE:return Me;case n.WEBSQL:return Ie}});return u(i,t,r),i},e.prototype.getSerializer=function(e){var t=de.resolve(_e);return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){function n(){a._config.driver=a.driver()}function i(e){return a._extend(e),n(),a._ready=a._initStorage(a._config),a._ready}function o(e){return function(){function t(){for(;r<e.length;){var o=e[r];return r++,a._dbInfo=null,a._ready=null,a.getDriver(o).then(i).catch(t)}n();var s=new Error("No available storage method found.");return a._driverSet=de.reject(s),a._driverSet}var r=0;return t()}}var a=this;We(e)||(e=[e]);var s=this._getSupportedDrivers(e),c=null!==this._driverSet?this._driverSet.catch(function(){return de.resolve()}):de.resolve();return this._driverSet=c.then(function(){var e=s[0];return a._dbInfo=null,a._ready=null,a.getDriver(e).then(function(e){a._driver=e._driver,n(),a._wrapLibraryMethodsWithReady(),a._initDriver=o(s)})}).catch(function(){n();var e=new Error("No available storage method found.");return a._driverSet=de.reject(e),a._driverSet}),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!Be[e]},e.prototype._extend=function(e){ne(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0;e<Ne.length;e++)re(this,Ne[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),Ge=new Fe;t.exports=Ge},{3:3}]},{},[4])(4)})}).call(t,function(){return this}())},function(e,t){"use strict";var r={};r.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},r.splitSections=function(e){var t=e.split("\nm=");return t.map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},r.matchPrefix=function(e,t){return r.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},r.parseCandidate=function(e){var t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");for(var r={foundation:t[0],component:t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;default:r[t[n]]=t[n+1]}return r},r.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),"candidate:"+t.join(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.numChannels=3===t.length?parseInt(t[2],10):1,r},r.writeRtpMap=function(e){var t=e.payloadType;return void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType),"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==e.numChannels?"/"+e.numChannels:"")+"\r\n"},r.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)t=n[i].trim().split("="),r[t[0].trim()]=t[1];return r},r.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach(function(t){n.push(t+"="+e.parameters[t])}),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},r.getDtlsParameters=function(e,t){var n=r.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:n.map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),r},r.getIceParameters=function(e,t){var n=r.splitLines(e);n=n.concat(r.splitLines(t));var i={usernameFragment:n.filter(function(e){return 0===e.indexOf("a=ice-ufrag:")})[0].substr(12),password:n.filter(function(e){return 0===e.indexOf("a=ice-pwd:")})[0].substr(10)};return i},r.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(e),i=n[0].split(" "),o=3;o<i.length;o++){var a=i[o],s=r.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(s){var c=r.parseRtpMap(s),d=r.matchPrefix(e,"a=fmtp:"+a+" ");switch(c.parameters=d.length?r.parseFmtp(d[0]):{},c.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(r.parseRtcpFb),t.codecs.push(c),c.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(c.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(r.parseExtmap(e))}),t},r.writeRtpDescription=function(e,t){var n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)});var i=0;return t.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",t.headerExtensions.forEach(function(e){n+=r.writeExtmap(e)}),n},r.parseRtpEncodingParameters=function(e){var t,n=[],i=r.parseRtpParameters(e),o=i.fecMechanisms.indexOf("RED")!==-1,a=i.fecMechanisms.indexOf("ULPFEC")!==-1,s=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),c=s.length>0&&s[0].ssrc,d=r.matchPrefix(e,"a=ssrc-group:FID").map(function(e){var t=e.split(" ");return t.shift(),t.map(function(e){return parseInt(e,10)})});d.length>0&&d[0].length>1&&d[0][0]===c&&(t=d[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10),rtx:{ssrc:t}};n.push(r),o&&(r=JSON.parse(JSON.stringify(r)),r.fec={ssrc:t,mechanism:a?"red+ulpfec":"red"},n.push(r))}}),0===n.length&&c&&n.push({ssrc:c});var u=r.matchPrefix(e,"b=");return u.length&&(0===u[0].indexOf("b=TIAS:")?u=parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")&&(u=parseInt(u[0].substr(5),10)),n.forEach(function(e){e.maxBitrate=u})),n},r.parseRtcpParameters=function(e){var t={},n=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);var i=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.length;var o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.parseMsid=function(e){var t,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return t=n[0].substr(7).split(" "),{stream:t[0],track:t[1]};var i=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return i.length>0?(t=i[0].value.split(" "),{stream:t[0],track:t[1]}):void 0},r.writeSessionBoilerplate=function(){return"v=0\r\no=thisisadapterortc 8169639915646943137 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.writeMediaSection=function(e,t,n,i){var o=r.writeRtpDescription(e.kind,t);if(o+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",o+=e.direction?"a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?"a=sendrecv\r\n":e.rtpSender?"a=sendonly\r\n":e.rtpReceiver?"a=recvonly\r\n":"a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,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:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),o},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){var t=r.splitLines(e),n=t[0].split(" ");return n[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},e.exports=r},function(e,t,r){"use strict";!function(){var t=r(1),n=t.log,i=t.browserDetails;e.exports.browserDetails=i,e.exports.extractVersion=t.extractVersion,e.exports.disableLog=t.disableLog;var o=r(7)||null,a=r(9)||null,s=r(12)||null,c=r(14)||null;switch(i.browser){case"chrome":if(!o||!o.shimPeerConnection)return void n("Chrome shim is not included in this adapter release.");n("adapter.js shimming chrome."),e.exports.browserShim=o,o.shimGetUserMedia(),o.shimMediaStream(),t.shimCreateObjectURL(),o.shimSourceObject(),o.shimPeerConnection(),o.shimOnTrack(),o.shimGetSendersWithDtmf();break;case"firefox":if(!s||!s.shimPeerConnection)return void n("Firefox shim is not included in this adapter release.");n("adapter.js shimming firefox."),e.exports.browserShim=s,s.shimGetUserMedia(),t.shimCreateObjectURL(),s.shimSourceObject(),s.shimPeerConnection(),s.shimOnTrack();break;case"edge":if(!a||!a.shimPeerConnection)return void n("MS edge shim is not included in this adapter release.");n("adapter.js shimming edge."),e.exports.browserShim=a,a.shimGetUserMedia(),t.shimCreateObjectURL(),a.shimPeerConnection(),a.shimReplaceTrack();break;case"safari":if(!c)return void n("Safari shim is not included in this adapter release.");n("adapter.js shimming safari."),e.exports.browserShim=c,c.shimCallbacksAPI(),c.shimAddStream(),c.shimOnAddStream(),c.shimGetUserMedia();break;default:n("Unsupported browser!")}}()},function(e,t,r){"use strict";var n=r(1).log,i=r(1).browserDetails,o={shimMediaStream:function(){window.MediaStream=window.MediaStream||window.webkitMediaStream},shimOnTrack:function(){"object"!=typeof window||!window.RTCPeerConnection||"ontrack"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){var t=this;this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",function(r){var n;n=RTCPeerConnection.prototype.getReceivers?t.getReceivers().find(function(e){return e.track.id===r.track.id}):{track:r.track};var i=new Event("track");i.track=r.track,i.receiver=n,i.streams=[e.stream],t.dispatchEvent(i)}),e.stream.getTracks().forEach(function(r){var n;n=RTCPeerConnection.prototype.getReceivers?t.getReceivers().find(function(e){return e.track.id===r.id}):{track:r};var i=new Event("track");i.track=r,i.receiver=n,i.streams=[e.stream],this.dispatchEvent(i)}.bind(this))}.bind(this))}})},shimGetSendersWithDtmf:function(){if("object"==typeof window&&window.RTCPeerConnection&&!("getSenders"in RTCPeerConnection.prototype)&&"createDTMFSender"in RTCPeerConnection.prototype){RTCPeerConnection.prototype.getSenders=function(){return this._senders||[]};var e=RTCPeerConnection.prototype.addStream,t=RTCPeerConnection.prototype.removeStream;RTCPeerConnection.prototype.addTrack||(RTCPeerConnection.prototype.addTrack=function(e,t){var r=this;if("closed"===r.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find(function(t){return t===e}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");r._senders=r._senders||[];var i=r._senders.find(function(t){return t.track===e});if(i)throw new DOMException("Track already exists.","InvalidAccessError");r._streams=r._streams||{};var o=r._streams[t.id];if(o)o.addTrack(e),r.removeStream(o),r.addStream(o);else{var a=new MediaStream([e]);r._streams[t.id]=a,r.addStream(a)}var s={track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=r.createDTMFSender(e):this._dtmf=null),this._dtmf}};return r._senders.push(s),s}),RTCPeerConnection.prototype.addStream=function(t){var r=this;r._senders=r._senders||[],e.apply(r,[t]),t.getTracks().forEach(function(e){r._senders.push({track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=r.createDTMFSender(e):this._dtmf=null),this._dtmf}})})},RTCPeerConnection.prototype.removeStream=function(e){var r=this;r._senders=r._senders||[],t.apply(r,[e]),e.getTracks().forEach(function(e){var t=r._senders.find(function(t){return t.track===e});t&&r._senders.splice(r._senders.indexOf(t),1)})}}},shimSourceObject:function(){"object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(e){var t=this;return this._srcObject=e,this.src&&URL.revokeObjectURL(this.src),e?(this.src=URL.createObjectURL(e),e.addEventListener("addtrack",function(){t.src&&URL.revokeObjectURL(t.src),t.src=URL.createObjectURL(e)}),void e.addEventListener("removetrack",function(){t.src&&URL.revokeObjectURL(t.src),t.src=URL.createObjectURL(e)})):void(this.src="")}}))},shimPeerConnection:function(){if(window.RTCPeerConnection){var e=RTCPeerConnection;window.RTCPeerConnection=function(t,r){if(t&&t.iceServers){for(var n=[],i=0;i<t.iceServers.length;i++){var o=t.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(console.warn("RTCIceServer.url is deprecated! Use urls instead."),o=JSON.parse(JSON.stringify(o)),o.urls=o.url,n.push(o)):n.push(t.iceServers[i])}t.iceServers=n}return new e(t,r)},window.RTCPeerConnection.prototype=e.prototype,Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return e.generateCertificate}})}else window.RTCPeerConnection=function(e,t){return n("PeerConnection"),e&&e.iceTransportPolicy&&(e.iceTransports=e.iceTransportPolicy),new webkitRTCPeerConnection(e,t)},window.RTCPeerConnection.prototype=webkitRTCPeerConnection.prototype,webkitRTCPeerConnection.generateCertificate&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return webkitRTCPeerConnection.generateCertificate}});var t=RTCPeerConnection.prototype.getStats;RTCPeerConnection.prototype.getStats=function(e,r,n){var i=this,o=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof arguments[0]))return t.apply(this,[]);var a=function(e){var t={},r=e.result();return r.forEach(function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){r[t]=e.stat(t)}),t[r.id]=r}),t},s=function(e){return new Map(Object.keys(e).map(function(t){return[t,e[t]]}))};if(arguments.length>=2){var c=function(e){o[1](s(a(e)))};return t.apply(this,[c,arguments[0]])}return new Promise(function(e,r){t.apply(i,[function(t){e(s(a(t)))},r])}).then(r,n)},i.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=RTCPeerConnection.prototype[e];RTCPeerConnection.prototype[e]=function(){var e=arguments,r=this,n=new Promise(function(n,i){t.apply(r,[e[0],n,i])});return e.length<2?n:n.then(function(){e[1].apply(null,[])},function(t){e.length>=3&&e[2].apply(null,[t])})}}),i.version<52&&["createOffer","createAnswer"].forEach(function(e){var t=RTCPeerConnection.prototype[e];RTCPeerConnection.prototype[e]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var r=1===arguments.length?arguments[0]:void 0;return new Promise(function(n,i){t.apply(e,[n,i,r])})}return t.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=RTCPeerConnection.prototype[e];RTCPeerConnection.prototype[e]=function(){return arguments[0]=new("addIceCandidate"===e?RTCIceCandidate:RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}});var r=RTCPeerConnection.prototype.addIceCandidate;RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}};e.exports={shimMediaStream:o.shimMediaStream,shimOnTrack:o.shimOnTrack,shimGetSendersWithDtmf:o.shimGetSendersWithDtmf,shimSourceObject:o.shimSourceObject,shimPeerConnection:o.shimPeerConnection,shimGetUserMedia:r(8)}},function(e,t,r){"use strict";var n=r(1).log,i=r(1).browserDetails;e.exports=function(){var e=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),o={},o[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach(function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},t=function(t,r){if(t=JSON.parse(JSON.stringify(t)),t&&t.audio&&(t.audio=e(t.audio)),t&&"object"==typeof t.video){var o=t.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});var a=i.version<61;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode||a)){delete t.video.facingMode;var s;if("environment"===o.exact||"environment"===o.ideal?s=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(s=["front"]),s)return navigator.mediaDevices.enumerateDevices().then(function(i){i=i.filter(function(e){return"videoinput"===e.kind});var a=i.find(function(e){return s.some(function(t){return e.label.toLowerCase().indexOf(t)!==-1})});return!a&&i.length&&s.indexOf("back")!==-1&&(a=i[i.length-1]),a&&(t.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),t.video=e(t.video),n("chrome: "+JSON.stringify(t)),r(t)})}t.video=e(t.video)}return n("chrome: "+JSON.stringify(t)),r(t)},r=function(e){return{name:{ConstraintNotSatisfiedError:"OverconstrainedError",PermissionDeniedError:"NotAllowedError",TrackStartError:"NotReadableError"}[e.name]||e.name,message:e.message,constraint:e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},o=function(e,n,i){t(e,function(e){navigator.webkitGetUserMedia(e,n,function(e){i(r(e))})})};navigator.getUserMedia=o;var a=function(e){return new Promise(function(t,r){navigator.getUserMedia(e,t,r)})};if(navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:a,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(r){e(r.map(function(e){return{label:e.label,kind:t[e.kind],deviceId:e.id,groupId:""}}))})})},getSupportedConstraints:function(){return{deviceId:!0,echoCancellation:!0,facingMode:!0,frameRate:!0,height:!0,width:!0}}}),navigator.mediaDevices.getUserMedia){var s=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(e){return t(e,function(e){return s(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(r(e))})})}}else navigator.mediaDevices.getUserMedia=function(e){return a(e)};"undefined"==typeof navigator.mediaDevices.addEventListener&&(navigator.mediaDevices.addEventListener=function(){n("Dummy mediaDevices.addEventListener called.")}),"undefined"==typeof navigator.mediaDevices.removeEventListener&&(navigator.mediaDevices.removeEventListener=function(){n("Dummy mediaDevices.removeEventListener called.")})}},function(e,t,r){"use strict";var n=r(1).browserDetails,i=r(11);e.exports={shimGetUserMedia:r(10),shimPeerConnection:function(){if(window.RTCIceGatherer&&(window.RTCIceCandidate||(window.RTCIceCandidate=function(e){return e}),window.RTCSessionDescription||(window.RTCSessionDescription=function(e){return e}),n.version<15025)){var e=Object.getOwnPropertyDescriptor(MediaStreamTrack.prototype,"enabled");Object.defineProperty(MediaStreamTrack.prototype,"enabled",{set:function(t){e.set.call(this,t);var r=new Event("enabled");r.enabled=t,this.dispatchEvent(r)}})}window.RTCPeerConnection=i(n.version)},shimReplaceTrack:function(){!window.RTCRtpSender||"replaceTrack"in RTCRtpSender.prototype||(RTCRtpSender.prototype.replaceTrack=RTCRtpSender.prototype.setTrack)}}},function(e,t){"use strict";e.exports=function(){var e=function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}},t=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(r){return t(r).catch(function(t){
return Promise.reject(e(t))})}}},function(e,t,r){"use strict";function n(e){var t=e.filter(function(e){return"audio"===e.kind}),r=e.filter(function(e){return"video"===e.kind});for(e=[];t.length||r.length;)t.length&&e.push(t.shift()),r.length&&e.push(r.shift());return e}function i(e,t){var r=!1;return e=JSON.parse(JSON.stringify(e)),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 i="string"==typeof n;return i&&(n=[n]),n=n.filter(function(e){var n=0===e.indexOf("turn:")&&e.indexOf("transport=udp")!==-1&&e.indexOf("turn:[")===-1&&!r;return n?(r=!0,!0):0===e.indexOf("stun:")&&t>=14393}),delete e.url,e.urls=i?n[0]:n,!!n.length}return!1})}function o(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},i=function(e,t,r,i){var o=n(e.parameters.apt,r),a=n(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach(function(n){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(n.name.toLowerCase()===a.name.toLowerCase()&&n.clockRate===a.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&a.parameters.apt&&!i(n,a,e.codecs,t.codecs))continue;a=JSON.parse(JSON.stringify(a)),a.numChannels=Math.min(n.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter(function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var n=0;n<t.headerExtensions.length;n++){var i=t.headerExtensions[n];if(e.uri===i.uri){r.headerExtensions.push(i);break}}}),r}function a(e,t,r){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)!==-1}var s=r(5);e.exports=function(e){var t=function(t){var r=this,n=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){r[e]=n[e].bind(n)}),this.needNegotiation=!1,this.onicecandidate=null,this.onaddstream=null,this.ontrack=null,this.onremovestream=null,this.onsignalingstatechange=null,this.oniceconnectionstatechange=null,this.onicegatheringstatechange=null,this.onnegotiationneeded=null,this.ondatachannel=null,this.canTrickleIceCandidates=null,this.localStreams=[],this.remoteStreams=[],this.getLocalStreams=function(){return r.localStreams},this.getRemoteStreams=function(){return r.remoteStreams},this.localDescription=new RTCSessionDescription({type:"",sdp:""}),this.remoteDescription=new RTCSessionDescription({type:"",sdp:""}),this.signalingState="stable",this.iceConnectionState="new",this.iceGatheringState="new",this.iceOptions={gatherPolicy:"all",iceServers:[]},t&&t.iceTransportPolicy)switch(t.iceTransportPolicy){case"all":case"relay":this.iceOptions.gatherPolicy=t.iceTransportPolicy}this.usingBundle=t&&"max-bundle"===t.bundlePolicy,t&&t.iceServers&&(this.iceOptions.iceServers=i(t.iceServers,e)),this._config=t||{},this.transceivers=[],this._localIceCandidatesBuffer=[]};return t.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this.dispatchEvent(e),null!==this.onicegatheringstatechange&&this.onicegatheringstatechange(e)},t.prototype._emitBufferedCandidates=function(){var e=this,t=s.splitSections(e.localDescription.sdp);this._localIceCandidatesBuffer.forEach(function(r){var n=!r.candidate||0===Object.keys(r.candidate).length;if(n)for(var i=1;i<t.length;i++)t[i].indexOf("\r\na=end-of-candidates\r\n")===-1&&(t[i]+="a=end-of-candidates\r\n");else t[r.candidate.sdpMLineIndex+1]+="a="+r.candidate.candidate+"\r\n";if(e.localDescription.sdp=t.join(""),e.dispatchEvent(r),null!==e.onicecandidate&&e.onicecandidate(r),!r.candidate&&"complete"!==e.iceGatheringState){var o=e.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});o&&"complete"!==e.iceGatheringStateChange&&(e.iceGatheringState="complete",e._emitGatheringStateChange())}}),this._localIceCandidatesBuffer=[]},t.prototype.getConfiguration=function(){return this._config},t.prototype._createTransceiver=function(e){var t=this.transceivers.length>0,r={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,wantReceive:!0};if(this.usingBundle&&t)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();r.iceTransport=n.iceTransport,r.dtlsTransport=n.dtlsTransport}return this.transceivers.push(r),r},t.prototype.addTrack=function(e,t){for(var r,n=0;n<this.transceivers.length;n++)this.transceivers[n].track||this.transceivers[n].kind!==e.kind||(r=this.transceivers[n]);return r||(r=this._createTransceiver(e.kind)),r.track=e,r.stream=t,r.rtpSender=new RTCRtpSender(e,r.dtlsTransport),this._maybeFireNegotiationNeeded(),r.rtpSender},t.prototype.addStream=function(t){var r=this;if(e>=15025)this.localStreams.push(t),t.getTracks().forEach(function(e){r.addTrack(e,t)});else{var n=t.clone();t.getTracks().forEach(function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",function(e){r.enabled=e.enabled})}),n.getTracks().forEach(function(e){r.addTrack(e,n)}),this.localStreams.push(n)}this._maybeFireNegotiationNeeded()},t.prototype.removeStream=function(e){var t=this.localStreams.indexOf(e);t>-1&&(this.localStreams.splice(t,1),this._maybeFireNegotiationNeeded())},t.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},t.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},t.prototype._createIceGatherer=function(e,t){var r=this,n=new RTCIceGatherer(r.iceOptions);return n.onlocalcandidate=function(i){var o=new Event("icecandidate");o.candidate={sdpMid:e,sdpMLineIndex:t};var a=i.candidate,c=!a||0===Object.keys(a).length;c?void 0===n.state&&(n.state="completed"):(a.component=1,o.candidate.candidate=s.writeCandidate(a));var d=s.splitSections(r.localDescription.sdp);c?d[o.candidate.sdpMLineIndex+1]+="a=end-of-candidates\r\n":d[o.candidate.sdpMLineIndex+1]+="a="+o.candidate.candidate+"\r\n",r.localDescription.sdp=d.join("");var u=r._pendingOffer?r._pendingOffer:r.transceivers,f=u.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});switch(r.iceGatheringState){case"new":c||r._localIceCandidatesBuffer.push(o),c&&f&&r._localIceCandidatesBuffer.push(new Event("icecandidate"));break;case"gathering":r._emitBufferedCandidates(),c||(r.dispatchEvent(o),null!==r.onicecandidate&&r.onicecandidate(o)),f&&(r.dispatchEvent(new Event("icecandidate")),null!==r.onicecandidate&&r.onicecandidate(new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange());break;case"complete":}},n},t.prototype._createIceAndDtlsTransports=function(){var e=this,t=new RTCIceTransport(null);t.onicestatechange=function(){e._updateConnectionState()};var r=new RTCDtlsTransport(t);return r.ondtlsstatechange=function(){e._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),e._updateConnectionState()},{iceTransport:t,dtlsTransport:r}},t.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlssttatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},t.prototype._transceive=function(t,r,n){var i=o(t.localCapabilities,t.remoteCapabilities);r&&t.rtpSender&&(i.encodings=t.sendEncodingParameters,i.rtcp={cname:s.localCName,compound:t.rtcpParameters.compound},t.recvEncodingParameters.length&&(i.rtcp.ssrc=t.recvEncodingParameters[0].ssrc),t.rtpSender.send(i)),n&&t.rtpReceiver&&("video"===t.kind&&t.recvEncodingParameters&&e<15019&&t.recvEncodingParameters.forEach(function(e){delete e.rtx}),i.encodings=t.recvEncodingParameters,i.rtcp={cname:t.rtcpParameters.cname,compound:t.rtcpParameters.compound},t.sendEncodingParameters.length&&(i.rtcp.ssrc=t.sendEncodingParameters[0].ssrc),t.rtpReceiver.receive(i))},t.prototype.setLocalDescription=function(e){var t=this;if(!a("setLocalDescription",e.type,this.signalingState)){var r=new Error("Can not set local "+e.type+" in state "+this.signalingState);return r.name="InvalidStateError",arguments.length>2&&"function"==typeof arguments[2]&&window.setTimeout(arguments[2],0,r),Promise.reject(r)}var n,i;if("offer"===e.type)this._pendingOffer&&(n=s.splitSections(e.sdp),i=n.shift(),n.forEach(function(e,r){var n=s.parseRtpParameters(e);t._pendingOffer[r].localCapabilities=n}),this.transceivers=this._pendingOffer,delete this._pendingOffer);else if("answer"===e.type){n=s.splitSections(t.remoteDescription.sdp),i=n.shift();var c=s.matchPrefix(i,"a=ice-lite").length>0;n.forEach(function(e,r){var n=t.transceivers[r],a=n.iceGatherer,d=n.iceTransport,u=n.dtlsTransport,f=n.localCapabilities,p=n.remoteCapabilities,l=s.isRejected(e);if(!l&&!n.isDatachannel){var v=s.getIceParameters(e,i),h=s.getDtlsParameters(e,i);c&&(h.role="server"),t.usingBundle&&0!==r||(d.start(a,v,c?"controlling":"controlled"),u.start(h));var m=o(f,p);t._transceive(n,m.codecs.length>0,!1)}})}switch(this.localDescription={type:e.type,sdp:e.sdp},e.type){case"offer":this._updateSignalingState("have-local-offer");break;case"answer":this._updateSignalingState("stable");break;default:throw new TypeError('unsupported type "'+e.type+'"')}var d=arguments.length>1&&"function"==typeof arguments[1];if(d){var u=arguments[1];window.setTimeout(function(){u(),"new"===t.iceGatheringState&&(t.iceGatheringState="gathering",t._emitGatheringStateChange()),t._emitBufferedCandidates()},0)}var f=Promise.resolve();return f.then(function(){d||("new"===t.iceGatheringState&&(t.iceGatheringState="gathering",t._emitGatheringStateChange()),window.setTimeout(t._emitBufferedCandidates.bind(t),500))}),f},t.prototype.setRemoteDescription=function(t){var r=this;if(!a("setRemoteDescription",t.type,this.signalingState)){var n=new Error("Can not set remote "+t.type+" in state "+this.signalingState);return n.name="InvalidStateError",arguments.length>2&&"function"==typeof arguments[2]&&window.setTimeout(arguments[2],0,n),Promise.reject(n)}var i={},o=[],c=s.splitSections(t.sdp),d=c.shift(),u=s.matchPrefix(d,"a=ice-lite").length>0,f=s.matchPrefix(d,"a=group:BUNDLE ").length>0;this.usingBundle=f;var p=s.matchPrefix(d,"a=ice-options:")[0];switch(p?this.canTrickleIceCandidates=p.substr(14).split(" ").indexOf("trickle")>=0:this.canTrickleIceCandidates=!1,c.forEach(function(n,a){var c=s.splitLines(n),p=s.getKind(n),l=s.isRejected(n),v=c[0].substr(2).split(" ")[2],h=s.getDirection(n,d),m=s.parseMsid(n),g=s.getMid(n)||s.generateIdentifier();if("application"===p&&"DTLS/SCTP"===v)return void(r.transceivers[a]={mid:g,isDatachannel:!0});var y,w,b,S,C,T,k,E,R,P,O,x=s.parseRtpParameters(n);l||(P=s.getIceParameters(n,d),O=s.getDtlsParameters(n,d),O.role="client"),k=s.parseRtpEncodingParameters(n);var D=s.parseRtcpParameters(n),_=s.matchPrefix(n,"a=end-of-candidates",d).length>0,I=s.matchPrefix(n,"a=candidate:").map(function(e){return s.parseCandidate(e)}).filter(function(e){return"1"===e.component||1===e.component});"offer"!==t.type||l?"answer"!==t.type||l||(f&&a>0&&(r._disposeIceAndDtlsTransports(a),r.transceivers[a].iceGatherer=r.transceivers[0].iceGatherer,r.transceivers[a].iceTransport=r.transceivers[0].iceTransport,r.transceivers[a].dtlsTransport=r.transceivers[0].dtlsTransport,r.transceivers[a].rtpSender&&r.transceivers[a].rtpSender.setTransport(r.transceivers[0].dtlsTransport),r.transceivers[a].rtpReceiver&&r.transceivers[a].rtpReceiver.setTransport(r.transceivers[0].dtlsTransport)),y=r.transceivers[a],w=y.iceGatherer,b=y.iceTransport,S=y.dtlsTransport,C=y.rtpReceiver,T=y.sendEncodingParameters,E=y.localCapabilities,r.transceivers[a].recvEncodingParameters=k,r.transceivers[a].remoteCapabilities=x,r.transceivers[a].rtcpParameters=D,(u||_)&&I.length&&b.setRemoteCandidates(I),f&&0!==a||(b.start(w,P,"controlling"),S.start(O)),r._transceive(y,"sendrecv"===h||"recvonly"===h,"sendrecv"===h||"sendonly"===h),!C||"sendrecv"!==h&&"sendonly"!==h?delete y.rtpReceiver:(R=C.track,m?(i[m.stream]||(i[m.stream]=new MediaStream),i[m.stream].addTrack(R),o.push([R,C,i[m.stream]])):(i.default||(i.default=new MediaStream),i.default.addTrack(R),o.push([R,C,i.default])))):(y=r.transceivers[a]||r._createTransceiver(p),y.mid=g,y.iceGatherer||(y.iceGatherer=f&&a>0?r.transceivers[0].iceGatherer:r._createIceGatherer(g,a)),!_||f&&0!==a||y.iceTransport.setRemoteCandidates(I),E=RTCRtpReceiver.getCapabilities(p),e<15019&&(E.codecs=E.codecs.filter(function(e){return"rtx"!==e.name})),T=[{ssrc:1001*(2*a+2)}],"sendrecv"!==h&&"sendonly"!==h||(C=new RTCRtpReceiver(y.dtlsTransport,p),R=C.track,m?(i[m.stream]||(i[m.stream]=new MediaStream,Object.defineProperty(i[m.stream],"id",{get:function(){return m.stream}})),Object.defineProperty(R,"id",{get:function(){return m.track}}),i[m.stream].addTrack(R),o.push([R,C,i[m.stream]])):(i.default||(i.default=new MediaStream),i.default.addTrack(R),o.push([R,C,i.default]))),y.localCapabilities=E,y.remoteCapabilities=x,y.rtpReceiver=C,y.rtcpParameters=D,y.sendEncodingParameters=T,y.recvEncodingParameters=k,r._transceive(r.transceivers[a],!1,"sendrecv"===h||"sendonly"===h))}),this.remoteDescription={type:t.type,sdp:t.sdp},t.type){case"offer":this._updateSignalingState("have-remote-offer");break;case"answer":this._updateSignalingState("stable");break;default:throw new TypeError('unsupported type "'+t.type+'"')}return Object.keys(i).forEach(function(e){var t=i[e];if(t.getTracks().length){r.remoteStreams.push(t);var n=new Event("addstream");n.stream=t,r.dispatchEvent(n),null!==r.onaddstream&&window.setTimeout(function(){r.onaddstream(n)},0),o.forEach(function(e){var n=e[0],i=e[1];if(t.id===e[2].id){var o=new Event("track");o.track=n,o.receiver=i,o.streams=[t],r.dispatchEvent(o),null!==r.ontrack&&window.setTimeout(function(){r.ontrack(o)},0)}})}}),window.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),arguments.length>1&&"function"==typeof arguments[1]&&window.setTimeout(arguments[1],0),Promise.resolve()},t.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._updateSignalingState("closed")},t.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this.dispatchEvent(t),null!==this.onsignalingstatechange&&this.onsignalingstatechange(t)},t.prototype._maybeFireNegotiationNeeded=function(){var e=this;"stable"===this.signalingState&&this.needNegotiation!==!0&&(this.needNegotiation=!0,window.setTimeout(function(){if(e.needNegotiation!==!1){e.needNegotiation=!1;var t=new Event("negotiationneeded");e.dispatchEvent(t),null!==e.onnegotiationneeded&&e.onnegotiationneeded(t)}},0))},t.prototype._updateConnectionState=function(){var e,t=this,r={new:0,closed:0,connecting:0,checking:0,connected:0,completed:0,failed:0};if(this.transceivers.forEach(function(e){r[e.iceTransport.state]++,r[e.dtlsTransport.state]++}),r.connected+=r.completed,e="new",r.failed>0?e="failed":r.connecting>0||r.checking>0?e="connecting":r.disconnected>0?e="disconnected":r.new>0?e="new":(r.connected>0||r.completed>0)&&(e="connected"),e!==t.iceConnectionState){t.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this.dispatchEvent(n),null!==this.oniceconnectionstatechange&&this.oniceconnectionstatechange(n)}},t.prototype.createOffer=function(){var t=this;if(this._pendingOffer)throw new Error("createOffer called while there is a pending offer.");var r;1===arguments.length&&"function"!=typeof arguments[0]?r=arguments[0]:3===arguments.length&&(r=arguments[2]);var i=this.transceivers.filter(function(e){return"audio"===e.kind}).length,o=this.transceivers.filter(function(e){return"video"===e.kind}).length;if(r){if(r.mandatory||r.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==r.offerToReceiveAudio&&(i=r.offerToReceiveAudio===!0?1:r.offerToReceiveAudio===!1?0:r.offerToReceiveAudio),void 0!==r.offerToReceiveVideo&&(o=r.offerToReceiveVideo===!0?1:r.offerToReceiveVideo===!1?0:r.offerToReceiveVideo)}for(this.transceivers.forEach(function(e){"audio"===e.kind?(i--,i<0&&(e.wantReceive=!1)):"video"===e.kind&&(o--,o<0&&(e.wantReceive=!1))});i>0||o>0;)i>0&&(this._createTransceiver("audio"),i--),o>0&&(this._createTransceiver("video"),o--);var a=n(this.transceivers),c=s.writeSessionBoilerplate();a.forEach(function(r,n){var i=r.track,o=r.kind,c=s.generateIdentifier();r.mid=c,r.iceGatherer||(r.iceGatherer=t.usingBundle&&n>0?a[0].iceGatherer:t._createIceGatherer(c,n));var d=RTCRtpSender.getCapabilities(o);e<15019&&(d.codecs=d.codecs.filter(function(e){return"rtx"!==e.name})),d.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1")});var u=[{ssrc:1001*(2*n+1)}];i&&e>=15019&&"video"===o&&(u[0].rtx={ssrc:1001*(2*n+1)+1}),r.wantReceive&&(r.rtpReceiver=new RTCRtpReceiver(r.dtlsTransport,o)),r.localCapabilities=d,r.sendEncodingParameters=u}),"max-compat"!==this._config.bundlePolicy&&(c+="a=group:BUNDLE "+a.map(function(e){return e.mid}).join(" ")+"\r\n"),c+="a=ice-options:trickle\r\n",a.forEach(function(e,t){c+=s.writeMediaSection(e,e.localCapabilities,"offer",e.stream),c+="a=rtcp-rsize\r\n"}),this._pendingOffer=a;var d=new RTCSessionDescription({type:"offer",sdp:c});return arguments.length&&"function"==typeof arguments[0]&&window.setTimeout(arguments[0],0,d),Promise.resolve(d)},t.prototype.createAnswer=function(){var t=s.writeSessionBoilerplate();this.usingBundle&&(t+="a=group:BUNDLE "+this.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),this.transceivers.forEach(function(r,n){if(r.isDatachannel)return void(t+="m=application 0 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=mid:"+r.mid+"\r\n");if(r.stream){var i;"audio"===r.kind?i=r.stream.getAudioTracks()[0]:"video"===r.kind&&(i=r.stream.getVideoTracks()[0]),i&&e>=15019&&"video"===r.kind&&(r.sendEncodingParameters[0].rtx={ssrc:1001*(2*n+2)+1})}var a=o(r.localCapabilities,r.remoteCapabilities),c=a.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length;!c&&r.sendEncodingParameters[0].rtx&&delete r.sendEncodingParameters[0].rtx,t+=s.writeMediaSection(r,a,"answer",r.stream),r.rtcpParameters&&r.rtcpParameters.reducedSize&&(t+="a=rtcp-rsize\r\n")});var r=new RTCSessionDescription({type:"answer",sdp:t});return arguments.length&&"function"==typeof arguments[0]&&window.setTimeout(arguments[0],0,r),Promise.resolve(r)},t.prototype.addIceCandidate=function(e){if(e){var t=e.sdpMLineIndex;if(e.sdpMid)for(var r=0;r<this.transceivers.length;r++)if(this.transceivers[r].mid===e.sdpMid){t=r;break}var n=this.transceivers[t];if(n){var i=Object.keys(e.candidate).length>0?s.parseCandidate(e.candidate):{};if("tcp"===i.protocol&&(0===i.port||9===i.port))return Promise.resolve();if(i.component&&"1"!==i.component&&1!==i.component)return Promise.resolve();n.iceTransport.addRemoteCandidate(i);var o=s.splitSections(this.remoteDescription.sdp);o[t+1]+=(i.type?e.candidate.trim():"a=end-of-candidates")+"\r\n",this.remoteDescription.sdp=o.join("")}}else for(var a=0;a<this.transceivers.length;a++)if(this.transceivers[a].iceTransport.addRemoteCandidate({}),this.usingBundle)return Promise.resolve();return arguments.length>1&&"function"==typeof arguments[1]&&window.setTimeout(arguments[1],0),Promise.resolve()},t.prototype.getStats=function(){var e=[];this.transceivers.forEach(function(t){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(r){t[r]&&e.push(t[r].getStats())})});var t=arguments.length>1&&"function"==typeof arguments[1]&&arguments[1],r=function(e){return{inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};return new Promise(function(n){var i=new Map;Promise.all(e).then(function(e){e.forEach(function(e){Object.keys(e).forEach(function(t){e[t].type=r(e[t]),i.set(t,e[t])})}),t&&window.setTimeout(t,0,i),n(i)})})},t}},function(e,t,r){"use strict";var n=r(1).browserDetails,i={shimOnTrack:function(){"object"!=typeof window||!window.RTCPeerConnection||"ontrack"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.getTracks().forEach(function(t){var r=new Event("track");r.track=t,r.receiver={track:t},r.streams=[e.stream],this.dispatchEvent(r)}.bind(this))}.bind(this))}})},shimSourceObject:function(){"object"==typeof window&&(!window.HTMLMediaElement||"srcObject"in window.HTMLMediaElement.prototype||Object.defineProperty(window.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(e){this.mozSrcObject=e}}))},shimPeerConnection:function(){if("object"==typeof window&&(window.RTCPeerConnection||window.mozRTCPeerConnection)){window.RTCPeerConnection||(window.RTCPeerConnection=function(e,t){if(n.version<38&&e&&e.iceServers){for(var r=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];if(o.hasOwnProperty("urls"))for(var a=0;a<o.urls.length;a++){var s={url:o.urls[a]};0===o.urls[a].indexOf("turn")&&(s.username=o.username,s.credential=o.credential),r.push(s)}else r.push(e.iceServers[i])}e.iceServers=r}return new mozRTCPeerConnection(e,t)},window.RTCPeerConnection.prototype=mozRTCPeerConnection.prototype,mozRTCPeerConnection.generateCertificate&&Object.defineProperty(window.RTCPeerConnection,"generateCertificate",{get:function(){return mozRTCPeerConnection.generateCertificate}}),window.RTCSessionDescription=mozRTCSessionDescription,window.RTCIceCandidate=mozRTCIceCandidate),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=RTCPeerConnection.prototype[e];RTCPeerConnection.prototype[e]=function(){return arguments[0]=new("addIceCandidate"===e?RTCIceCandidate:RTCSessionDescription)(arguments[0]),t.apply(this,arguments)}});var e=RTCPeerConnection.prototype.addIceCandidate;RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())};var t=function(e){var t=new Map;return Object.keys(e).forEach(function(r){t.set(r,e[r]),t[r]=e[r]}),t},r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=RTCPeerConnection.prototype.getStats;RTCPeerConnection.prototype.getStats=function(e,o,a){return i.apply(this,[e||null]).then(function(e){if(n.version<48&&(e=t(e)),n.version<53&&!o)try{e.forEach(function(e){e.type=r[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach(function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(o,a)}}}};e.exports={shimOnTrack:i.shimOnTrack,shimSourceObject:i.shimSourceObject,shimPeerConnection:i.shimPeerConnection,shimGetUserMedia:r(13)}},function(e,t,r){"use strict";var n=r(1).log,i=r(1).browserDetails;e.exports=function(){var e=function(e){return{name:{InternalError:"NotReadableError",NotSupportedError:"TypeError",PermissionDeniedError:"NotAllowedError",SecurityError:"NotAllowedError"}[e.name]||e.name,message:{"The operation is insecure.":"The request is not allowed by the user agent or the platform in the current context."}[e.message]||e.message,constraint:e.constraint,toString:function(){return this.name+(this.message&&": ")+this.message}}},t=function(t,r,o){var a=function(e){if("object"!=typeof e||e.require)return e;var t=[];return Object.keys(e).forEach(function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n=e[r]="object"==typeof e[r]?e[r]:{ideal:e[r]};if(void 0===n.min&&void 0===n.max&&void 0===n.exact||t.push(r),void 0!==n.exact&&("number"==typeof n.exact?n.min=n.max=n.exact:e[r]=n.exact,delete n.exact),void 0!==n.ideal){e.advanced=e.advanced||[];var i={};"number"==typeof n.ideal?i[r]={min:n.ideal,max:n.ideal}:i[r]=n.ideal,e.advanced.push(i),delete n.ideal,Object.keys(n).length||delete e[r]}}}),t.length&&(e.require=t),e};return t=JSON.parse(JSON.stringify(t)),i.version<38&&(n("spec: "+JSON.stringify(t)),t.audio&&(t.audio=a(t.audio)),t.video&&(t.video=a(t.video)),n("ff37: "+JSON.stringify(t))),navigator.mozGetUserMedia(t,r,function(t){o(e(t))})},r=function(e){return new Promise(function(r,n){t(e,r,n)})};if(navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:r,addEventListener:function(){},removeEventListener:function(){}}),navigator.mediaDevices.enumerateDevices=navigator.mediaDevices.enumerateDevices||function(){return new Promise(function(e){var t=[{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}];e(t)})},i.version<41){var o=navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);navigator.mediaDevices.enumerateDevices=function(){return o().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}if(i.version<49){var a=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(t){return a(t).then(function(e){if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(function(e){e.stop()}),new DOMException("The object can not be found here.","NotFoundError");return e},function(t){return Promise.reject(e(t))})}}navigator.getUserMedia=function(e,r,n){return i.version<44?t(e,r,n):(console.warn("navigator.getUserMedia has been replaced by navigator.mediaDevices.getUserMedia"),void navigator.mediaDevices.getUserMedia(e).then(r,n))}}},function(e,t){"use strict";var r={shimAddStream:function(){"object"!=typeof window||!window.RTCPeerConnection||"addStream"in window.RTCPeerConnection.prototype||(RTCPeerConnection.prototype.addStream=function(e){var t=this;e.getTracks().forEach(function(r){t.addTrack(r,e)})})},shimOnAddStream:function(){"object"!=typeof window||!window.RTCPeerConnection||"onaddstream"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){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){var t=e.streams[0];if(this._streams||(this._streams=[]),!(this._streams.indexOf(t)>=0)){this._streams.push(t);var r=new Event("addstream");r.stream=e.streams[0],this.dispatchEvent(r)}}.bind(this))}})},shimCallbacksAPI:function(){if("object"==typeof window&&window.RTCPeerConnection){var e=RTCPeerConnection.prototype,t=e.createOffer,r=e.createAnswer,n=e.setLocalDescription,i=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(e,r){var n=arguments.length>=2?arguments[2]:arguments[0],i=t.apply(this,[n]);return r?(i.then(e,r),Promise.resolve()):i},e.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var a=function(e,t,r){var i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};e.setLocalDescription=a,a=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},e.setRemoteDescription=a,a=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},e.addIceCandidate=a}},shimGetUserMedia:function(){navigator.getUserMedia||(navigator.webkitGetUserMedia?navigator.getUserMedia=navigator.webkitGetUserMedia.bind(navigator):navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&(navigator.getUserMedia=function(e,t,r){navigator.mediaDevices.getUserMedia(e).then(t,r)}.bind(navigator)))}};e.exports={shimCallbacksAPI:r.shimCallbacksAPI,shimAddStream:r.shimAddStream,shimOnAddStream:r.shimOnAddStream,shimGetUserMedia:r.shimGetUserMedia}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(e){if(u===setTimeout)return setTimeout(e,0);if((u===r||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function o(e){if(f===clearTimeout)return clearTimeout(e);if((f===n||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){h&&l&&(h=!1,l.length?v=l.concat(v):m=-1,v.length&&s())}function s(){if(!h){var e=i(a);h=!0;for(var t=v.length;t;){for(l=v,v=[];++m<t;)l&&l[m].run();m=-1,t=v.length}l=null,h=!1,o(e)}}function c(e,t){this.fun=e,this.array=t}function d(){}var u,f,p=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:r}catch(e){u=r}try{f="function"==typeof clearTimeout?clearTimeout:n}catch(e){f=n}}();var l,v=[],h=!1,m=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];v.push(new c(e,t)),1!==v.length||h||i(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=d,p.addListener=d,p.once=d,p.off=d,p.removeListener=d,p.removeAllListeners=d,p.emit=d,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}}])});