diff --git a/.gitignore b/.gitignore index a96e7033..dc957c41 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,3 @@ npm-debug.log* # Dependency directories node_modules/ -# generated files -dist/ -src/browser/plugin.min.js -www/www.min.js diff --git a/dist/cordova-plugin-qrscanner-lib.min.js b/dist/cordova-plugin-qrscanner-lib.min.js new file mode 100644 index 00000000..46bde0c0 --- /dev/null +++ b/dist/cordova-plugin-qrscanner-lib.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("QRScanner",[],t):"object"==typeof exports?exports.QRScanner=t():e.QRScanner=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=14)}([function(e,t,n){"use strict";var r=!0,i={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,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],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),n=new Map,r=0;URL.createObjectURL=function(t){if("getTracks"in t){var i="polyblob:"+ ++r;return n.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),n.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=n.get(e)||null,i.set.apply(this,[e])}});var a=HTMLMediaElement.prototype.setAttribute;HTMLMediaElement.prototype.setAttribute=function(){return 2===arguments.length&&"src"===(""+arguments[0]).toLowerCase()&&(this.srcObject=n.get(arguments[1])||null),a.apply(this,arguments)}}}};e.exports={log:i.log,disableLog:i.disableLog,browserDetails:i.detectBrowser(),extractVersion:i.extractVersion,shimCreateObjectURL:i.shimCreateObjectURL,detectBrowser:i.detectBrowser.bind(i)}},function(e,t,n){n(5);var r=n(3);e.exports=function(){function e(e){e.getTracks().forEach(function(e){e.stop()})}function t(t){function n(e,t,n,r){var i={audio:!1,video:{}};return i.video.deviceId={exact:e},t&&(i.video.facingMode={exact:t}),n&&(i.video.width={exact:n}),r&&(i.video.height={exact:r}),i}function r(t){return new Promise(function(n){return t.reduce(function(t,n){return t.then(function(t){return t.found?t:(t.nextConstraint=n,window.navigator.mediaDevices.getUserMedia(t.nextConstraint).then(function(n){return e(n),t.found=!0,t},function(){return t}))})},Promise.resolve({found:!1,nextConstraint:{}})).then(function(e){n(e.found?e.nextConstraint:null)})})}var i=Y.map(function(e){return n(t,e)}),a=Q.map(function(e){return n(t,null,e)}),o=Q.map(function(e){return n(t,null,null,e)});return r(i).then(function(e){return r(a).then(function(n){return r(o).then(function(r){return{deviceId:t,facingMode:null===e?null:e.video.facingMode.exact,width:null===n?null:n.video.width.exact,height:null===r?null:r.video.height.exact}})})})}function n(){return window.navigator.mediaDevices.enumerateDevices().then(function(e){return e.filter(function(e){return"videoinput"===e.kind}).map(function(e){return e.deviceId})}).then(function(e){var n=[];return e.forEach(function(e){n.push(t(e))}),Promise.all(n)}).then(function(e){return e.filter(function(e){if(null!==e&&null!==e.width&&null!==e.height)return!0}).sort(function(e,t){return t.width-e.width})}).then(function(e){for(var t=null,n=null,r=0;r0?(t=e[0],e.splice(0,1)):t=!1),n=e.length>0&&e[0],{backCamera:t,frontCamera:n}})}function i(){return null!==B}function a(){e(B),B=null}function o(){return document.getElementById(I.preview)}function s(){return document.getElementById(I.still)}function c(){return j}function d(){return 1===j?_:A}function u(){var e=s();e&&(e.style.visibility="visible",U=!1)}function h(){var e=s();e&&(e.style.visibility="hidden",U=!0)}function f(){return null!==A}function l(){return!!A&&!!_}function p(){return{authorized:null!==A&&!1!==A?"1":"0",denied:"0",restricted:"0",prepared:f()?"1":"0",scanning:F?"1":"0",previewing:U?"1":"0",showing:o()?"1":"0",lightEnabled:"0",canOpenSettings:"0",canEnableLight:"0",canChangeCamera:l()?"1":"0",currentCamera:j.toString()}}function w(e,t){var n=c(),r=d();window.navigator.mediaDevices.getUserMedia({audio:!1,video:{deviceId:{exact:r.deviceId},width:{ideal:r.width},height:{ideal:r.height}}}).then(function(t){B=t,o().src=URL.createObjectURL(t),e(p())},function(e){t(n?4:3)})}function m(e){var t=document.createElement("canvas"),n=d();t.height=n.height,t.width=n.width;var r=t.getContext("2d");return r.drawImage(e,0,0,n.width,n.height),{canvas:t,context:r}}function v(e){var t=m(e);return t.context.getImageData(0,0,t.canvas.width,t.canvas.height)}function g(e){return m(e).canvas.toDataURL("image/png")}function b(e,t){if(null===G){var i=new Blob([r],{type:"text/javascript"});G=new Worker(URL.createObjectURL(i))}if(!o()){var a=document.createElement("video");a.setAttribute("autoplay","autoplay"),a.setAttribute("id",I.preview),a.setAttribute("style","display:block;position:fixed;top:50%;left:50%;width:auto;height:auto;min-width:100%;min-height:100%;z-index:"+N.preview+";-moz-transform: translateX(-50%) translateY(-50%);-webkit-transform: translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);background-size:cover;background-position:50% 50%;background-color:#FFF;"),a.addEventListener("loadeddata",function(){h()});var s=document.createElement("div");s.setAttribute("id",I.still),s.setAttribute("style","display:block;position:fixed;top:50%;left:50%;visibility: hidden;width:auto;height:auto;min-width:100%;min-height:100%;z-index:"+N.still+";-moz-transform: translateX(-50%) translateY(-50%);-webkit-transform: translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);background-size:cover;background-position:50% 50%;background-color:#FFF;"),document.body.appendChild(a),document.body.appendChild(s)}null===A?n().then(function(n){A=n.backCamera,_=n.frontCamera,!1!==A?e():t(5)},function(e){t(0)}):!1===A?t(5):e()}function y(e,t){b(function(){e(p())},t)}function C(e,t){function n(){i()?e(p()):w(e,t)}f()?n():b(function(){n()},t)}function P(e,t){i()&&a();var n=o();n&&(n.src=""),e(p())}function k(e,t){C(function(n){var r=o(),i=!1;F=!0,G.onmessage=function(t){var n=t.data;n.result&&!i&&(i=!0,V=null,e(n.result))},(V=function(){G.postMessage(v(r)),null!==X&&X();var e=window.QRScanner_SCAN_INTERVAL||130;z=window.setTimeout(V,e),X=function(e){window.clearTimeout(z),z=null,X=null,e&&t(6)}})()},t)}function S(e,t){null!==X&&X(!0),F=!1,"function"==typeof e&&e(p())}function T(e,t){if(null,i()){null!==X&&X();var n=o();n.pause();var r=new Image;r.src=g(n),s().style.backgroundImage="url("+r.src+")",u(),a(),e(p())}else e(p())}function E(e,t){null!==V&&V(),C(e,t)}function R(e,t){t(7)}function M(e,t){t(7)}function x(e,t,n){var r=n[0],i=f();r!==j?i&&1===r&&!l()?t(4):(j=r,i?(P(function(e){null}),C(e,t)):e(p())):e(p())}function O(e,t){t(8)}function D(e,t){e(p())}function L(e,t){S(),i()&&a(),A=null,_=null;var n=o(),r=s();n&&n.remove(),r&&r.remove(),e(p())}var I={preview:"cordova-plugin-qrscanner-video-preview",still:"cordova-plugin-qrscanner-still"},N={preview:-100,still:-99},A=null,_=null,j=0,B=null,F=!1,U=!1,G=null,V=null,z=null,X=null,Q=[5120,4096,3840,3440,3200,3072,3e3,2880,2800,2736,2732,2560,2538,2400,2304,2160,2100,2048,2e3,1920,1856,1824,1800,1792,1776,1728,1700,1680,1600,1536,1440,1400,1392,1366,1344,1334,1280,1200,1152,1136,1120,1080,1050,1024,1e3,960,900,854,848,832,800,768,750,720,640,624,600,576,544,540,512,480,320,240],Y=["environment","user"];return{prepare:y,show:C,hide:P,scan:k,cancelScan:S,pausePreview:T,resumePreview:E,enableLight:R,disableLight:M,useCamera:x,openSettings:O,getStatus:D,destroy:L}}},function(e,t){e.exports=function(e){function t(e){switch(e){case"1":return!0;case"0":return!1;default:throw new Error("QRScanner plugin returned an invalid boolean number-string: "+e)}}function n(e){return{authorized:t(e.authorized),denied:t(e.denied),restricted:t(e.restricted),prepared:t(e.prepared),scanning:t(e.scanning),previewing:t(e.previewing),showing:t(e.showing),lightEnabled:t(e.lightEnabled),canOpenSettings:t(e.canOpenSettings),canEnableLight:t(e.canEnableLight),canChangeCamera:t(e.canChangeCamera),currentCamera:parseInt(e.currentCamera)}}function r(){var e=document.body;e.style&&(e.style.backgroundColor="rgba(0,0,0,0.01)",e.style.backgroundImage="",setTimeout(function(){e.style.backgroundColor="transparent"},1),e.parentNode&&e.parentNode.style&&(e.parentNode.style.backgroundColor="transparent",e.parentNode.style.backgroundImage=""))}function i(e){return e?function(t){var n=parseInt(t),r={};switch(n){case 0:r={name:"UNEXPECTED_ERROR",code:0,_message:"QRScanner experienced an unexpected error."};break;case 1:r={name:"CAMERA_ACCESS_DENIED",code:1,_message:"The user denied camera access."};break;case 2:r={name:"CAMERA_ACCESS_RESTRICTED",code:2,_message:"Camera access is restricted."};break;case 3:r={name:"BACK_CAMERA_UNAVAILABLE",code:3,_message:"The back camera is unavailable."};break;case 4:r={name:"FRONT_CAMERA_UNAVAILABLE",code:4,_message:"The front camera is unavailable."};break;case 5:r={name:"CAMERA_UNAVAILABLE",code:5,_message:"The camera is unavailable."};break;case 6:r={name:"SCAN_CANCELED",code:6,_message:"Scan was canceled."};break;case 7:r={name:"LIGHT_UNAVAILABLE",code:7,_message:"The device light is unavailable."};break;case 8:r={name:"OPEN_SETTINGS_UNAVAILABLE",code:8,_message:"The device is unable to open settings."};break;default:r={name:"UNEXPECTED_ERROR",code:0,_message:"QRScanner returned an invalid error code."}}e(r)}:null}function a(e){return e?function(t){e(null,n(t))}:null}function o(e,t){return e?function(i){t&&r(),e(n(i))}:null}return{prepare:function(t){e.exec(a(t),i(t),"QRScanner","prepare",[])},destroy:function(t){e.exec(o(t,!0),null,"QRScanner","destroy",[])},scan:function(t){if(!t)throw new Error("No callback provided to scan method.");var n=function(e){t(null,e)};e.exec(n,i(t),"QRScanner","scan",[])},cancelScan:function(t){e.exec(o(t),null,"QRScanner","cancelScan",[])},show:function(t){e.exec(o(t,!0),null,"QRScanner","show",[])},hide:function(t){e.exec(o(t,!0),null,"QRScanner","hide",[])},pausePreview:function(t){e.exec(o(t),null,"QRScanner","pausePreview",[])},resumePreview:function(t){e.exec(o(t),null,"QRScanner","resumePreview",[])},enableLight:function(t){e.exec(a(t),i(t),"QRScanner","enableLight",[])},disableLight:function(t){e.exec(a(t),i(t),"QRScanner","disableLight",[])},useCamera:function(t,n){e.exec(a(n),i(n),"QRScanner","useCamera",[t])},useFrontCamera:function(t){t?this.useCamera(1,t):e.exec(null,null,"QRScanner","useCamera",[1])},useBackCamera:function(t){t?this.useCamera(0,t):e.exec(null,null,"QRScanner","useCamera",[0])},openSettings:function(t){t?e.exec(a(t),i(t),"QRScanner","openSettings",[]):e.exec(null,null,"QRScanner","openSettings",[])},getStatus:function(t){if(!t)throw new Error("No callback provided to getStatus method.");e.exec(o(t),null,"QRScanner","getStatus",[])}}}},function(e,t){e.exports='!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=19)}([function(t,e,n){"use strict";function i(){this.imagedata=null,this.width=0,this.height=0,this.qrCodeSymbol=null,this.debug=!1,this.callback=null}function r(t,e){return t>=0?t>>e:(t>>e)+(2<<~e)}n.d(e,"b",function(){return s}),e.a=i,e.c=r;var o=n(14),a=n(13),s={};s.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],i.prototype.decode=function(t,e){var n=function(){try{this.error=void 0,this.result=this.process(this.imagedata)}catch(t){this.error=t,this.result=void 0}return null!=this.callback&&this.callback(this.error,this.result),this.result}.bind(this);if(void 0!=t&&void 0!=t.width)this.width=t.width,this.height=t.height,this.imagedata={data:e||t.data},this.imagedata.width=t.width,this.imagedata.height=t.height,n();else{if("undefined"==typeof Image)throw new Error("This source format is not supported in your environment, you need to pass an image buffer with width and height (see https://github.com/edi9999/jsqrcode/blob/master/test/qrcode.js)");var i=new Image;i.crossOrigin="Anonymous",i.onload=function(){var t=document.createElement("canvas"),e=t.getContext("2d"),r=document.getElementById("out-canvas");if(null!=r){var o=r.getContext("2d");o.clearRect(0,0,320,240),o.drawImage(i,0,0,320,240)}t.width=i.width,t.height=i.height,e.drawImage(i,0,0),this.width=i.width,this.height=i.height;try{this.imagedata=e.getImageData(0,0,i.width,i.height)}catch(t){if(this.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!",null!=this.callback)return this.callback(null,this.result)}n()}.bind(this),i.src=t}},i.prototype.decode_utf8=function(t){return decodeURIComponent(escape(t))},i.prototype.process=function(t){for(var e=(new Date).getTime(),n=this.grayScaleToBitmap(this.grayscale(t)),i=new o.a(n),r=i.detect(),s=a.a.decode(r.bits),h=s.DataByte,f="",w=0;wi[s][a][1]&&(i[s][a][1]=w)}}for(var u=new Array(4),l=0;l<4;l++)u[l]=new Array(4);for(var a=0;a<4;a++)for(var s=0;s<4;s++)u[s][a]=Math.floor((i[s][a][0]+i[s][a][1])/2);return u},i.prototype.grayScaleToBitmap=function(t){for(var e=this.getMiddleBrightnessPerArea(t),n=e.length,i=Math.floor(t.width/n),r=Math.floor(t.height/n),o=0;o>5;0!=(31&t)&&n++,this.rowSize=n,this.bits=new Array(n*e);for(var i=0;i>5);return 0!=(1&n.i(r.c)(this.bits[i],31&t))},i.prototype.set_Renamed=function(t,e){var n=e*this.rowSize+(t>>5);this.bits[n]|=1<<(31&t)},i.prototype.flip=function(t,e){var n=e*this.rowSize+(t>>5);this.bits[n]^=1<<(31&t)},i.prototype.clear=function(){for(var t=this.bits.length,e=0;ethis.height||r>this.width)throw"The region must fit inside the matrix";for(var a=e;a>5)]|=1<<(31&h)}},function(t,e,n){"use strict";function i(t){this.errorCorrectionLevel=o.a.forBits(t>>3&3),this.dataMask=7&t}e.a=i;var r=n(0),o=n(15),a=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],s=[0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4];i.prototype.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|this.dataMask},i.prototype.Equals=function(t){var e=t;return this.errorCorrectionLevel==e.errorCorrectionLevel&&this.dataMask==e.dataMask},i.numBitsDiffering=function(t,e){return t^=e,s[15&t]+s[15&n.i(r.c)(t,4)]+s[15&n.i(r.c)(t,8)]+s[15&n.i(r.c)(t,12)]+s[15&n.i(r.c)(t,16)]+s[15&n.i(r.c)(t,20)]+s[15&n.i(r.c)(t,24)]+s[15&n.i(r.c)(t,28)]},i.decodeFormatInformation=function(t){var e=i.doDecodeFormatInformation(t);return null!=e?e:i.doDecodeFormatInformation(21522^t)},i.doDecodeFormatInformation=function(t){for(var e=4294967295,n=0,r=0;r=256&&(e^=t);for(var n=0;n<255;n++)this.logTable[this.expTable[n]]=n;var i=new Array(1);i[0]=0,this.zero=new r.a(this,new Array(i));var o=new Array(1);o[0]=1,this.one=new r.a(this,new Array(o))}e.a=i;var r=n(4);Object.defineProperty(i.prototype,"Zero",{get:function(){return this.zero}}),Object.defineProperty(i.prototype,"One",{get:function(){return this.one}}),i.prototype.buildMonomial=function(t,e){if(t<0)throw"System.ArgumentException";if(0==e)return this.zero;for(var n=new Array(t+1),i=0;i1&&0==e[0]){for(var i=1;in.length){var r=e;e=n,n=r}for(var o=new Array(n.length),a=n.length-e.length,s=0;s=t.Degree&&!n.Zero;){var o=n.Degree-t.Degree,a=this.field.multiply(n.getCoefficient(n.Degree),r),s=t.multiplyByMonomial(o,a),h=this.field.buildMonomial(o,a);e=e.addOrSubtract(h),n=n.addOrSubtract(s)}return[e,n]}},function(t,e,n){"use strict";function i(t,e){this.count=t,this.dataCodewords=e}function r(t,e,n){this.ecCodewordsPerBlock=t,this.ecBlocks=n?[e,n]:[e]}function o(t,e,n,i,r,o){this.versionNumber=t,this.alignmentPatternCenters=e,this.ecBlocks=[n,i,r,o];for(var a=0,s=n.ecCodewordsPerBlock,h=n.getECBlocks(),f=0;f6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e},o.prototype.getECBlocksForLevel=function(t){return this.ecBlocks[t.ordinal()]},o.VERSION_DECODE_INFO=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017],o.VERSIONS=function(){return[new o(1,[],new r(7,new i(1,19)),new r(10,new i(1,16)),new r(13,new i(1,13)),new r(17,new i(1,9))),new o(2,[6,18],new r(10,new i(1,34)),new r(16,new i(1,28)),new r(22,new i(1,22)),new r(28,new i(1,16))),new o(3,[6,22],new r(15,new i(1,55)),new r(26,new i(1,44)),new r(18,new i(2,17)),new r(22,new i(2,13))),new o(4,[6,26],new r(20,new i(1,80)),new r(18,new i(2,32)),new r(26,new i(2,24)),new r(16,new i(4,9))),new o(5,[6,30],new r(26,new i(1,108)),new r(24,new i(2,43)),new r(18,new i(2,15),new i(2,16)),new r(22,new i(2,11),new i(2,12))),new o(6,[6,34],new r(18,new i(2,68)),new r(16,new i(4,27)),new r(24,new i(4,19)),new r(28,new i(4,15))),new o(7,[6,22,38],new r(20,new i(2,78)),new r(18,new i(4,31)),new r(18,new i(2,14),new i(4,15)),new r(26,new i(4,13),new i(1,14))),new o(8,[6,24,42],new r(24,new i(2,97)),new r(22,new i(2,38),new i(2,39)),new r(22,new i(4,18),new i(2,19)),new r(26,new i(4,14),new i(2,15))),new o(9,[6,26,46],new r(30,new i(2,116)),new r(22,new i(3,36),new i(2,37)),new r(20,new i(4,16),new i(4,17)),new r(24,new i(4,12),new i(4,13))),new o(10,[6,28,50],new r(18,new i(2,68),new i(2,69)),new r(26,new i(4,43),new i(1,44)),new r(24,new i(6,19),new i(2,20)),new r(28,new i(6,15),new i(2,16))),new o(11,[6,30,54],new r(20,new i(4,81)),new r(30,new i(1,50),new i(4,51)),new r(28,new i(4,22),new i(4,23)),new r(24,new i(3,12),new i(8,13))),new o(12,[6,32,58],new r(24,new i(2,92),new i(2,93)),new r(22,new i(6,36),new i(2,37)),new r(26,new i(4,20),new i(6,21)),new r(28,new i(7,14),new i(4,15))),new o(13,[6,34,62],new r(26,new i(4,107)),new r(22,new i(8,37),new i(1,38)),new r(24,new i(8,20),new i(4,21)),new r(22,new i(12,11),new i(4,12))),new o(14,[6,26,46,66],new r(30,new i(3,115),new i(1,116)),new r(24,new i(4,40),new i(5,41)),new r(20,new i(11,16),new i(5,17)),new r(24,new i(11,12),new i(5,13))),new o(15,[6,26,48,70],new r(22,new i(5,87),new i(1,88)),new r(24,new i(5,41),new i(5,42)),new r(30,new i(5,24),new i(7,25)),new r(24,new i(11,12),new i(7,13))),new o(16,[6,26,50,74],new r(24,new i(5,98),new i(1,99)),new r(28,new i(7,45),new i(3,46)),new r(24,new i(15,19),new i(2,20)),new r(30,new i(3,15),new i(13,16))),new o(17,[6,30,54,78],new r(28,new i(1,107),new i(5,108)),new r(28,new i(10,46),new i(1,47)),new r(28,new i(1,22),new i(15,23)),new r(28,new i(2,14),new i(17,15))),new o(18,[6,30,56,82],new r(30,new i(5,120),new i(1,121)),new r(26,new i(9,43),new i(4,44)),new r(28,new i(17,22),new i(1,23)),new r(28,new i(2,14),new i(19,15))),new o(19,[6,30,58,86],new r(28,new i(3,113),new i(4,114)),new r(26,new i(3,44),new i(11,45)),new r(26,new i(17,21),new i(4,22)),new r(26,new i(9,13),new i(16,14))),new o(20,[6,34,62,90],new r(28,new i(3,107),new i(5,108)),new r(26,new i(3,41),new i(13,42)),new r(30,new i(15,24),new i(5,25)),new r(28,new i(15,15),new i(10,16))),new o(21,[6,28,50,72,94],new r(28,new i(4,116),new i(4,117)),new r(26,new i(17,42)),new r(28,new i(17,22),new i(6,23)),new r(30,new i(19,16),new i(6,17))),new o(22,[6,26,50,74,98],new r(28,new i(2,111),new i(7,112)),new r(28,new i(17,46)),new r(30,new i(7,24),new i(16,25)),new r(24,new i(34,13))),new o(23,[6,30,54,74,102],new r(30,new i(4,121),new i(5,122)),new r(28,new i(4,47),new i(14,48)),new r(30,new i(11,24),new i(14,25)),new r(30,new i(16,15),new i(14,16))),new o(24,[6,28,54,80,106],new r(30,new i(6,117),new i(4,118)),new r(28,new i(6,45),new i(14,46)),new r(30,new i(11,24),new i(16,25)),new r(30,new i(30,16),new i(2,17))),new o(25,[6,32,58,84,110],new r(26,new i(8,106),new i(4,107)),new r(28,new i(8,47),new i(13,48)),new r(30,new i(7,24),new i(22,25)),new r(30,new i(22,15),new i(13,16))),new o(26,[6,30,58,86,114],new r(28,new i(10,114),new i(2,115)),new r(28,new i(19,46),new i(4,47)),new r(28,new i(28,22),new i(6,23)),new r(30,new i(33,16),new i(4,17))),new o(27,[6,34,62,90,118],new r(30,new i(8,122),new i(4,123)),new r(28,new i(22,45),new i(3,46)),new r(30,new i(8,23),new i(26,24)),new r(30,new i(12,15),new i(28,16))),new o(28,[6,26,50,74,98,122],new r(30,new i(3,117),new i(10,118)),new r(28,new i(3,45),new i(23,46)),new r(30,new i(4,24),new i(31,25)),new r(30,new i(11,15),new i(31,16))),new o(29,[6,30,54,78,102,126],new r(30,new i(7,116),new i(7,117)),new r(28,new i(21,45),new i(7,46)),new r(30,new i(1,23),new i(37,24)),new r(30,new i(19,15),new i(26,16))),new o(30,[6,26,52,78,104,130],new r(30,new i(5,115),new i(10,116)),new r(28,new i(19,47),new i(10,48)),new r(30,new i(15,24),new i(25,25)),new r(30,new i(23,15),new i(25,16))),new o(31,[6,30,56,82,108,134],new r(30,new i(13,115),new i(3,116)),new r(28,new i(2,46),new i(29,47)),new r(30,new i(42,24),new i(1,25)),new r(30,new i(23,15),new i(28,16))),new o(32,[6,34,60,86,112,138],new r(30,new i(17,115)),new r(28,new i(10,46),new i(23,47)),new r(30,new i(10,24),new i(35,25)),new r(30,new i(19,15),new i(35,16))),new o(33,[6,30,58,86,114,142],new r(30,new i(17,115),new i(1,116)),new r(28,new i(14,46),new i(21,47)),new r(30,new i(29,24),new i(19,25)),new r(30,new i(11,15),new i(46,16))),new o(34,[6,34,62,90,118,146],new r(30,new i(13,115),new i(6,116)),new r(28,new i(14,46),new i(23,47)),new r(30,new i(44,24),new i(7,25)),new r(30,new i(59,16),new i(1,17))),new o(35,[6,30,54,78,102,126,150],new r(30,new i(12,121),new i(7,122)),new r(28,new i(12,47),new i(26,48)),new r(30,new i(39,24),new i(14,25)),new r(30,new i(22,15),new i(41,16))),new o(36,[6,24,50,76,102,128,154],new r(30,new i(6,121),new i(14,122)),new r(28,new i(6,47),new i(34,48)),new r(30,new i(46,24),new i(10,25)),new r(30,new i(2,15),new i(64,16))),new o(37,[6,28,54,80,106,132,158],new r(30,new i(17,122),new i(4,123)),new r(28,new i(29,46),new i(14,47)),new r(30,new i(49,24),new i(10,25)),new r(30,new i(24,15),new i(46,16))),new o(38,[6,32,58,84,110,136,162],new r(30,new i(4,122),new i(18,123)),new r(28,new i(13,46),new i(32,47)),new r(30,new i(48,24),new i(14,25)),new r(30,new i(42,15),new i(32,16))),new o(39,[6,26,54,82,110,138,166],new r(30,new i(20,117),new i(4,118)),new r(28,new i(40,47),new i(7,48)),new r(30,new i(43,24),new i(22,25)),new r(30,new i(10,15),new i(67,16))),new o(40,[6,30,58,86,114,142,170],new r(30,new i(19,118),new i(6,119)),new r(28,new i(18,47),new i(31,48)),new r(30,new i(34,24),new i(34,25)),new r(30,new i(20,15),new i(61,16)))]}(),o.getVersionForNumber=function(t){if(t<1||t>40)throw"ArgumentException";return o.VERSIONS[t-1]},o.getProvisionalVersionForDimension=function(t){if(t%4!=1)throw"Error getProvisionalVersionForDimension";try{return o.getVersionForNumber(t-17>>2)}catch(t){throw"Error getVersionForNumber"}},o.decodeVersionInformation=function(t){for(var e=4294967295,n=0,i=0;i=n)return!1;return!0},r.prototype.crossCheckVertical=function(t,e,n,i){var r=this.image,o=r.height,a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;for(var s=t;s>=0&&r.data[e+s*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&!r.data[e+s*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;sn)return NaN;for(;sn)return NaN;var h=a[0]+a[1]+a[2];return 5*Math.abs(h-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},r.prototype.handlePossibleCenter=function(t,e,n){var r=t[0]+t[1]+t[2],o=this.centerFromEnd(t,n),a=this.crossCheckVertical(e,Math.floor(o),2*t[1],r);if(!isNaN(a)){for(var s=(t[0]+t[1]+t[2])/3,h=this.possibleCenters.length,f=0;f>1),o=[0,0,0],a=0;a>1:-(a+1>>1));o[0]=0,o[1]=0,o[2]=0;for(var h=e;h=0;n--)t=this.copyBit(8,n,t);if(this.parsedFormatInfo=r.a.decodeFormatInformation(t),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var i=this.bitMatrix.Dimension;t=0;for(var o=i-8,e=i-1;e>=o;e--)t=this.copyBit(e,8,t);for(var n=i-7;n>2;if(e<=6)return o.a.getVersionForNumber(e);for(var n=0,i=t-11,r=5;r>=0;r--)for(var a=t-9;a>=i;a--)n=this.copyBit(a,r,n);if(this.parsedVersion=o.a.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==t)return this.parsedVersion;n=0;for(var a=5;a>=0;a--)for(var r=t-9;r>=i;r--)n=this.copyBit(a,r,n);if(this.parsedVersion=o.a.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==t)return this.parsedVersion;throw"Error readVersion"},i.prototype.readCodewords=function(){var t=this.readFormatInformation(),e=this.readVersion(),n=a.a.forReference(t.dataMask),i=this.bitMatrix.Dimension;n.unmaskBitMatrix(this.bitMatrix,i);for(var r=e.buildFunctionPattern(),o=!0,s=new Array(e.totalCodewords),h=0,f=0,w=0,u=i-1;u>0;u-=2){6==u&&u--;for(var l=0;l=0;){if(h[p].codewords.length==d)break;p--}p++;for(var g=d-r.ecCodewordsPerBlock,v=0,s=0;s=10&&e<=26?this.dataLengthMode=1:e>=27&&e<=40&&(this.dataLengthMode=2)}e.a=i;var r=n(0);i.prototype.getNextBits=function(t){var e=0;if(t>this.bitPointer-t+1,this.bitPointer-=t,e}if(t>8-(t-(this.bitPointer+1)),this.bitPointer=this.bitPointer-t%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),e}if(t>8-(t-(this.bitPointer+1+8))),this.bitPointer=this.bitPointer-(t-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),e}return 0},i.prototype.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},i.prototype.getDataLength=function(t){for(var e=0;;){if(t>>e==1)break;e++}return this.getNextBits(r.b.sizeOfDataLengthInfo[this.dataLengthMode][e])},i.prototype.getRomanAndFigureString=function(t){var e=t,n=0,i="",r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];do{if(e>1){n=this.getNextBits(11);var o=Math.floor(n/45),a=n%45;i+=r[o],i+=r[a],e-=2}else 1==e&&(n=this.getNextBits(6),i+=r[n],e-=1)}while(e>0);return i},i.prototype.getFigureString=function(t){var e=t,n=0,i="";do{e>=3?(n=this.getNextBits(10),n<100&&(i+="0"),n<10&&(i+="0"),e-=3):2==e?(n=this.getNextBits(7),n<10&&(i+="0"),e-=2):1==e&&(n=this.getNextBits(4),e-=1),i+=n}while(e>0);return i},i.prototype.get8bitByteArray=function(t){var e=t,n=0,i=[];do{n=this.getNextBits(8),i.push(n),e--}while(e>0);return i},i.prototype.getKanjiString=function(t){var e=t,n=0,i="";do{n=this.getNextBits(13);var r=n%192,o=n/192,a=(o<<8)+r,s=0;s=a+33088<=40956?a+33088:a+49472,i+=String.fromCharCode(s),e--}while(e>0);return i},Object.defineProperty(i.prototype,"DataByte",{get:function(){for(var t=[];;){var e=this.NextMode();if(0==e){if(t.length>0)break;throw"Empty data block"}if(1!=e&&2!=e&&4!=e&&8!=e&&7!=e)throw"Invalid mode: "+e+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";var n=this.getDataLength(e);if(n<1)throw"Invalid data length: "+n;switch(e){case 1:for(var i=this.getFigureString(n),r=new Array(i.length),o=0;o7)throw"System.ArgumentException";return l.DATA_MASKS[t]},l.DATA_MASKS=[new i,new r,new o,new a,new s,new h,new f,new w],e.a=l},function(t,e,n){"use strict";var i=n(18),r=n(3),o=n(9),a=n(10),s=n(11),h={};h.rsDecoder=new i.a(r.a.QR_CODE_FIELD),h.correctErrors=function(t,e){for(var n=t.length,i=new Array(n),r=0;rMath.abs(n-t);if(r){var o=t;t=e,e=o,o=n,n=i,i=o}for(var a=Math.abs(n-t),s=Math.abs(i-e),h=-a>>1,f=e0){if(c==i)break;c+=f,h-=a}}var m=n-t,b=i-e;return Math.sqrt(m*m+b*b)},o.prototype.sizeOfBlackWhiteBlackRunBothWays=function(t,e,n,i){var r=this.sizeOfBlackWhiteBlackRun(t,e,n,i),o=1,a=t-(n-t);a<0?(o=t/(t-a),a=0):a>=this.image.width&&(o=(this.image.width-1-t)/(a-t),a=this.image.width-1);var s=Math.floor(e-(i-e)*o);return o=1,s<0?(o=e/(e-s),s=0):s>=this.image.height&&(o=(this.image.height-1-e)/(s-e),s=this.image.height-1),a=Math.floor(t+(a-t)*o),(r+=this.sizeOfBlackWhiteBlackRun(t,e,a,s))-1},o.prototype.calculateModuleSizeOneWay=function(t,e){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y)),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},o.prototype.calculateModuleSize=function(t,e,n){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,n))/2},o.prototype.distance=function(t,e){var n=t.X-e.X,i=t.Y-e.Y;return Math.sqrt(n*n+i*i)},o.prototype.computeDimension=function(t,e,n,i){var r=Math.round(this.distance(t,e)/i),o=Math.round(this.distance(t,n)/i),a=7+(r+o>>1);switch(3&a){case 0:a++;break;case 2:a--;break;case 3:throw"Error"}return a},o.prototype.findAlignmentInRegion=function(t,e,n,i){var r=Math.floor(i*t),o=Math.max(0,e-r),a=Math.min(this.image.width-1,e+r);if(a-o<3*t)throw"Error";var h=Math.max(0,n-r),f=Math.min(this.image.height-1,n+r);return new s.a(this.image,o,h,a-o,f-h,t,this.resultPointCallback).find()},o.prototype.createTransform=function(t,e,n,r,o){var a,s,h,f,w=o-3.5;return null!=r?(a=r.X,s=r.Y,h=f=w-3):(a=e.X-t.X+n.X,s=e.Y-t.Y+n.Y,h=f=w),i.quadrilateralToQuadrilateral(3.5,3.5,w,3.5,h,f,3.5,w,t.X,t.Y,e.X,e.Y,a,s,n.X,n.Y)},o.prototype.sampleGrid=function(t,e,n){return h.a.sampleGrid3(t,n,e)},o.prototype.processFinderPatternInfo=function(t){var e=t.topLeft,n=t.topRight,i=t.bottomLeft,o=this.calculateModuleSize(e,n,i);if(o<1)throw"Error";var s=this.computeDimension(e,n,i,o),h=a.a.getProvisionalVersionForDimension(s),f=h.DimensionForVersion-7,w=null;if(h.alignmentPatternCenters.length>0)for(var u=n.X-e.X+i.X,l=n.Y-e.Y+i.Y,c=1-3/f,d=Math.floor(e.X+c*(u-e.X)),p=Math.floor(e.Y+c*(l-e.Y)),g=4;g<=16;g<<=1){w=this.findAlignmentInRegion(o,d,p,g);break}var v,m=this.createTransform(e,n,i,w,s),b=this.sampleGrid(this.image,m,s);return v=null==w?[i,e,n]:[i,e,n,w],new r(b,v)},o.prototype.detect=function(){var t=(new f.a).findFinderPattern(this.image);return this.processFinderPatternInfo(t)}},function(t,e,n){"use strict";function i(t,e,n){this.ordinal_Renamed_Field=t,this.bits=e,this.name=n}e.a=i,i.prototype.ordinal=function(){return this.ordinal_Renamed_Field},i.forBits=function(t){if(t<0||t>=r.length)throw"ArgumentException";return r[t]};var r=[new i(1,0,"M"),new i(0,1,"L"),new i(3,2,"H"),new i(2,3,"Q")]},function(t,e,n){"use strict";function i(t){function e(t,e){var n=t.X-e.X,i=t.Y-e.Y;return Math.sqrt(n*n+i*i)}var n,i,r,o=e(t[0],t[1]),a=e(t[1],t[2]),s=e(t[0],t[2]);if(a>=o&&a>=s?(i=t[0],n=t[1],r=t[2]):s>=a&&s>=o?(i=t[1],n=t[0],r=t[2]):(i=t[2],n=t[0],r=t[1]),function(t,e,n){var i=e.x,r=e.y;return(n.x-i)*(t.y-r)-(n.y-r)*(t.x-i)}(n,i,r)<0){var h=n;n=r,r=h}t[0]=n,t[1]=i,t[2]=r}function r(t,e,n){this.x=t,this.y=e,this.count=1,this.estimatedModuleSize=n}function o(t){this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}function a(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=[0,0,0,0,0],this.resultPointCallback=null}e.a=a;Object.defineProperty(r.prototype,"X",{get:function(){return this.x}}),Object.defineProperty(r.prototype,"Y",{get:function(){return this.y}}),r.prototype.incrementCount=function(){this.count++},r.prototype.aboutEquals=function(t,e,n){if(Math.abs(e-this.y)<=t&&Math.abs(n-this.x)<=t){var i=Math.abs(t-this.estimatedModuleSize);return i<=1||i/this.estimatedModuleSize<=1}return!1},Object.defineProperty(a.prototype,"CrossCheckStateCount",{get:function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}}),a.prototype.foundPatternCross=function(t){for(var e=0,n=0;n<5;n++){var i=t[n];if(0==i)return!1;e+=i}if(e<7)return!1;var r=Math.floor((e<<8)/7),o=Math.floor(r/2);return Math.abs(r-(t[0]<<8))=0&&r.data[e+s*r.width];)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!r.data[e+s*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&r.data[e+s*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s=n)return NaN;for(;s=n)return NaN;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},a.prototype.crossCheckHorizontal=function(t,e,n,i){for(var r=this.image,o=r.width,a=this.CrossCheckStateCount,s=t;s>=0&&r.data[s+e*r.width];)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!r.data[s+e*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&r.data[s+e*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s=n)return NaN;for(;s=n)return NaN;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-i)>=i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},a.prototype.handlePossibleCenter=function(t,e,n){var i=t[0]+t[1]+t[2]+t[3]+t[4],o=this.centerFromEnd(t,n),a=this.crossCheckVertical(e,Math.floor(o),t[2],i);if(!isNaN(a)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(a),t[2],i),!isNaN(o))){for(var s=i/7,h=!1,f=this.possibleCenters.length,w=0;w3){for(var e=0,n=0,i=0;i=0;i--){var h=this.possibleCenters[i];Math.abs(h.estimatedModuleSize-o)>s&&this.possibleCenters.splice(i,1)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(t,e){return t.count>e.count?-1:t.count=2){if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.X-i.X)-Math.abs(e.Y-i.Y))/2);e=i}}return 0},a.prototype.haveMultiplyConfirmedCenters=function(){for(var t=0,e=0,n=this.possibleCenters.length,i=0;i=2&&(t++,e+=r.estimatedModuleSize)}if(t<3)return!1;for(var o=e/n,a=0,i=0;is[2]&&(h+=l-s[2]-r,w=n-1)}else{do{w++}while(wn||s<-1||s>i)throw"Error.checkAndNudgePoints ";r=!1,-1==a?(e[o]=0,r=!0):a==n&&(e[o]=n-1,r=!0),-1==s?(e[o+1]=0,r=!0):s==i&&(e[o+1]=i-1,r=!0)}r=!0;for(var o=e.length-2;o>=0&&r;o-=2){var a=Math.floor(e[o]),s=Math.floor(e[o+1]);if(a<-1||a>n||s<-1||s>i)throw"Error.checkAndNudgePoints ";r=!1,-1==a?(e[o]=0,r=!0):a==n&&(e[o]=n-1,r=!0),-1==s?(e[o+1]=0,r=!0):s==i&&(e[o+1]=i-1,r=!0)}},r.sampleGrid3=function(t,e,n){for(var o=new i.a(e),a=new Array(e<<1),s=0;s>1),a[w+1]=f;n.transformPoints1(a),r.checkAndNudgePoints(t,a);try{for(var w=0;w>1,s)}}catch(t){throw"Error.checkAndNudgePoints"}}return o},e.a=r},function(t,e,n){"use strict";function i(t){this.field=t}e.a=i;var r=n(3),o=n(4);i.prototype.decode=function(t,e){for(var n=new o.a(this.field,t),i=new Array(e),a=0;a=Math.floor(n/2);){var w=r,u=a,l=h;if(r=o,a=s,h=f,r.Zero)throw"r_{i-1} was zero";o=w;for(var c=this.field.Zero,d=r.getCoefficient(r.Degree),p=this.field.inverse(d);o.Degree>=r.Degree&&!o.Zero;){var g=o.Degree-r.Degree,v=this.field.multiply(o.getCoefficient(o.Degree),p);c=c.addOrSubtract(this.field.buildMonomial(g,v)),o=o.addOrSubtract(r.multiplyByMonomial(g,v))}s=c.multiply1(a).addOrSubtract(u),f=c.multiply1(h).addOrSubtract(l)}var m=f.getCoefficient(0);if(0==m)throw"ReedSolomonException sigmaTilde(0) was zero";var b=this.field.inverse(m);return[f.multiply2(b),o.multiply2(b)]},i.prototype.findErrorLocations=function(t){var e=t.Degree;if(1==e)return new Array(t.getCoefficient(1));for(var n=new Array(e),i=0,r=1;r<256&&i0?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,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},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){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},r.getIceParameters=function(e,t){var n=r.splitLines(e);return n=n.concat(r.splitLines(t)),{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)}},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(" "),a=3;a0?"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),a=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),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),a&&(r=JSON.parse(JSON.stringify(r)),r.fec={ssrc:t,mechanism:o?"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 a=r.matchPrefix(e,"a=rtcp-mux");return t.mux=a.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 a=r.writeRtpDescription(e.kind,t);if(a+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),a+="a=mid:"+e.mid+"\r\n",e.direction?a+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";a+="a="+o,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),a},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof arguments[0]))return t.apply(this,[]);var o=function(e){var t={};return e.result().forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),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){a[1](s(o(e)))};return t.apply(this,[c,arguments[0]])}return new Promise(function(e,n){t.apply(i,[function(t){e(s(o(t)))},n])}).then(n,r)},i.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){var t=RTCPeerConnection.prototype[e];RTCPeerConnection.prototype[e]=function(){var e=arguments,n=this,r=new Promise(function(r,i){t.apply(n,[e[0],r,i])});return e.length<2?r:r.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 n=1===arguments.length?arguments[0]:void 0;return new Promise(function(r,i){t.apply(e,[r,i,n])})}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 n=RTCPeerConnection.prototype.addIceCandidate;RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}};e.exports={shimMediaStream:a.shimMediaStream,shimOnTrack:a.shimOnTrack,shimGetSendersWithDtmf:a.shimGetSendersWithDtmf,shimSourceObject:a.shimSourceObject,shimPeerConnection:a.shimPeerConnection,shimGetUserMedia:n(7)}},function(e,t,n){"use strict";var r=n(0).log,i=n(0).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(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var a={};"number"==typeof r.ideal?(a[i("min",n)]=r.ideal,t.optional.push(a),a={},a[i("max",n)]=r.ideal,t.optional.push(a)):(a[i("",n)]=r.ideal,t.optional.push(a))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},t=function(t,n){if(t=JSON.parse(JSON.stringify(t)),t&&t.audio&&(t.audio=e(t.audio)),t&&"object"==typeof t.video){var a=t.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});var o=i.version<61;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode||o)){delete t.video.facingMode;var s;if("environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return navigator.mediaDevices.enumerateDevices().then(function(i){i=i.filter(function(e){return"videoinput"===e.kind});var o=i.find(function(e){return s.some(function(t){return-1!==e.label.toLowerCase().indexOf(t)})});return!o&&i.length&&-1!==s.indexOf("back")&&(o=i[i.length-1]),o&&(t.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),t.video=e(t.video),r("chrome: "+JSON.stringify(t)),n(t)})}t.video=e(t.video)}return r("chrome: "+JSON.stringify(t)),n(t)},n=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}}},a=function(e,r,i){t(e,function(e){navigator.webkitGetUserMedia(e,r,function(e){i(n(e))})})};navigator.getUserMedia=a;var o=function(e){return new Promise(function(t,n){navigator.getUserMedia(e,t,n)})};if(navigator.mediaDevices||(navigator.mediaDevices={getUserMedia:o,enumerateDevices:function(){return new Promise(function(e){var t={audio:"audioinput",video:"videoinput"};return MediaStreamTrack.getSources(function(n){e(n.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(n(e))})})}}else navigator.mediaDevices.getUserMedia=function(e){return o(e)};void 0===navigator.mediaDevices.addEventListener&&(navigator.mediaDevices.addEventListener=function(){r("Dummy mediaDevices.addEventListener called.")}),void 0===navigator.mediaDevices.removeEventListener&&(navigator.mediaDevices.removeEventListener=function(){r("Dummy mediaDevices.removeEventListener called.")})}},function(e,t,n){"use strict";var r=n(0).browserDetails,i=n(10);e.exports={shimGetUserMedia:n(9),shimPeerConnection:function(){if(window.RTCIceGatherer&&(window.RTCIceCandidate||(window.RTCIceCandidate=function(e){return e}),window.RTCSessionDescription||(window.RTCSessionDescription=function(e){return e}),r.version<15025)){var e=Object.getOwnPropertyDescriptor(MediaStreamTrack.prototype,"enabled");Object.defineProperty(MediaStreamTrack.prototype,"enabled",{set:function(t){e.set.call(this,t);var n=new Event("enabled");n.enabled=t,this.dispatchEvent(n)}})}window.RTCPeerConnection=i(r.version)},shimReplaceTrack:function(){!window.RTCRtpSender||"replaceTrack"in RTCRtpSender.prototype||(RTCRtpSender.prototype.replaceTrack=RTCRtpSender.prototype.setTrack)}}},function(e,t,n){"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(n){return t(n).catch(function(t){return Promise.reject(e(t))})}}},function(e,t,n){"use strict";function r(e){var t=e.filter(function(e){return"audio"===e.kind}),n=e.filter(function(e){return"video"===e.kind});for(e=[];t.length||n.length;)t.length&&e.push(t.shift()),n.length&&e.push(n.shift());return e}function i(e,t){var n=!1;return e=JSON.parse(JSON.stringify(e)),e.filter(function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||n?0===e.indexOf("stun:")&&t>=14393:(n=!0,!0)}),delete e.url,e.urls=i?r[0]:r,!!r.length}return!1})}function a(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,wantReceive:!0};if(this.usingBundle&&t)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var r=this._createIceAndDtlsTransports();n.iceTransport=r.iceTransport,n.dtlsTransport=r.dtlsTransport}return this.transceivers.push(n),n},t.prototype.addTrack=function(e,t){for(var n,r=0;r=15025)this.localStreams.push(t),t.getTracks().forEach(function(e){n.addTrack(e,t)});else{var r=t.clone();t.getTracks().forEach(function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",function(e){n.enabled=e.enabled})}),r.getTracks().forEach(function(e){n.addTrack(e,r)}),this.localStreams.push(r)}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 n=this,r=new RTCIceGatherer(n.iceOptions);return r.onlocalcandidate=function(i){var a=new Event("icecandidate");a.candidate={sdpMid:e,sdpMLineIndex:t};var o=i.candidate,c=!o||0===Object.keys(o).length;c?void 0===r.state&&(r.state="completed"):(o.component=1,a.candidate.candidate=s.writeCandidate(o));var d=s.splitSections(n.localDescription.sdp);d[a.candidate.sdpMLineIndex+1]+=c?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",n.localDescription.sdp=d.join("");var u=n._pendingOffer?n._pendingOffer:n.transceivers,h=u.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});switch(n.iceGatheringState){case"new":c||n._localIceCandidatesBuffer.push(a),c&&h&&n._localIceCandidatesBuffer.push(new Event("icecandidate"));break;case"gathering":n._emitBufferedCandidates(),c||(n.dispatchEvent(a),null!==n.onicecandidate&&n.onicecandidate(a)),h&&(n.dispatchEvent(new Event("icecandidate")),null!==n.onicecandidate&&n.onicecandidate(new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},r},t.prototype._createIceAndDtlsTransports=function(){var e=this,t=new RTCIceTransport(null);t.onicestatechange=function(){e._updateConnectionState()};var n=new RTCDtlsTransport(t);return n.ondtlsstatechange=function(){e._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),e._updateConnectionState()},{iceTransport:t,dtlsTransport:n}},t.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlssttatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},t.prototype._transceive=function(t,n,r){var i=a(t.localCapabilities,t.remoteCapabilities);n&&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)),r&&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(!o("setLocalDescription",e.type,this.signalingState)){var n=new Error("Can not set local "+e.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 r,i;if("offer"===e.type)this._pendingOffer&&(r=s.splitSections(e.sdp),i=r.shift(),r.forEach(function(e,n){var r=s.parseRtpParameters(e);t._pendingOffer[n].localCapabilities=r}),this.transceivers=this._pendingOffer,delete this._pendingOffer);else if("answer"===e.type){r=s.splitSections(t.remoteDescription.sdp),i=r.shift();var c=s.matchPrefix(i,"a=ice-lite").length>0;r.forEach(function(e,n){var r=t.transceivers[n],o=r.iceGatherer,d=r.iceTransport,u=r.dtlsTransport,h=r.localCapabilities,f=r.remoteCapabilities;if(!s.isRejected(e)&&!r.isDatachannel){var l=s.getIceParameters(e,i),p=s.getDtlsParameters(e,i);c&&(p.role="server"),t.usingBundle&&0!==n||(d.start(o,l,c?"controlling":"controlled"),u.start(p));var w=a(h,f);t._transceive(r,w.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 h=Promise.resolve();return h.then(function(){d||("new"===t.iceGatheringState&&(t.iceGatheringState="gathering",t._emitGatheringStateChange()),window.setTimeout(t._emitBufferedCandidates.bind(t),500))}),h},t.prototype.setRemoteDescription=function(t){var n=this;if(!o("setRemoteDescription",t.type,this.signalingState)){var r=new Error("Can not set remote "+t.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 i={},a=[],c=s.splitSections(t.sdp),d=c.shift(),u=s.matchPrefix(d,"a=ice-lite").length>0,h=s.matchPrefix(d,"a=group:BUNDLE ").length>0;this.usingBundle=h;var f=s.matchPrefix(d,"a=ice-options:")[0];switch(this.canTrickleIceCandidates=!!f&&f.substr(14).split(" ").indexOf("trickle")>=0,c.forEach(function(r,o){var c=s.splitLines(r),f=s.getKind(r),l=s.isRejected(r),p=c[0].substr(2).split(" ")[2],w=s.getDirection(r,d),m=s.parseMsid(r),v=s.getMid(r)||s.generateIdentifier();if("application"===f&&"DTLS/SCTP"===p)return void(n.transceivers[o]={mid:v,isDatachannel:!0});var g,b,y,C,P,k,S,T,E,R,M,x=s.parseRtpParameters(r);l||(R=s.getIceParameters(r,d),M=s.getDtlsParameters(r,d),M.role="client"),S=s.parseRtpEncodingParameters(r);var O=s.parseRtcpParameters(r),D=s.matchPrefix(r,"a=end-of-candidates",d).length>0,L=s.matchPrefix(r,"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||(h&&o>0&&(n._disposeIceAndDtlsTransports(o),n.transceivers[o].iceGatherer=n.transceivers[0].iceGatherer,n.transceivers[o].iceTransport=n.transceivers[0].iceTransport,n.transceivers[o].dtlsTransport=n.transceivers[0].dtlsTransport,n.transceivers[o].rtpSender&&n.transceivers[o].rtpSender.setTransport(n.transceivers[0].dtlsTransport),n.transceivers[o].rtpReceiver&&n.transceivers[o].rtpReceiver.setTransport(n.transceivers[0].dtlsTransport)),g=n.transceivers[o],b=g.iceGatherer,y=g.iceTransport,C=g.dtlsTransport,P=g.rtpReceiver,k=g.sendEncodingParameters,T=g.localCapabilities,n.transceivers[o].recvEncodingParameters=S,n.transceivers[o].remoteCapabilities=x,n.transceivers[o].rtcpParameters=O,(u||D)&&L.length&&y.setRemoteCandidates(L),h&&0!==o||(y.start(b,R,"controlling"),C.start(M)),n._transceive(g,"sendrecv"===w||"recvonly"===w,"sendrecv"===w||"sendonly"===w),!P||"sendrecv"!==w&&"sendonly"!==w?delete g.rtpReceiver:(E=P.track,m?(i[m.stream]||(i[m.stream]=new MediaStream),i[m.stream].addTrack(E),a.push([E,P,i[m.stream]])):(i.default||(i.default=new MediaStream),i.default.addTrack(E),a.push([E,P,i.default])))):(g=n.transceivers[o]||n._createTransceiver(f),g.mid=v,g.iceGatherer||(g.iceGatherer=h&&o>0?n.transceivers[0].iceGatherer:n._createIceGatherer(v,o)),!D||h&&0!==o||g.iceTransport.setRemoteCandidates(L),T=RTCRtpReceiver.getCapabilities(f),e<15019&&(T.codecs=T.codecs.filter(function(e){return"rtx"!==e.name})),k=[{ssrc:1001*(2*o+2)}],"sendrecv"!==w&&"sendonly"!==w||(P=new RTCRtpReceiver(g.dtlsTransport,f),E=P.track,m?(i[m.stream]||(i[m.stream]=new MediaStream,Object.defineProperty(i[m.stream],"id",{get:function(){return m.stream}})),Object.defineProperty(E,"id",{get:function(){return m.track}}),i[m.stream].addTrack(E),a.push([E,P,i[m.stream]])):(i.default||(i.default=new MediaStream),i.default.addTrack(E),a.push([E,P,i.default]))),g.localCapabilities=T,g.remoteCapabilities=x,g.rtpReceiver=P,g.rtcpParameters=O,g.sendEncodingParameters=k,g.recvEncodingParameters=S,n._transceive(n.transceivers[o],!1,"sendrecv"===w||"sendonly"===w))}),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){n.remoteStreams.push(t);var r=new Event("addstream");r.stream=t,n.dispatchEvent(r),null!==n.onaddstream&&window.setTimeout(function(){n.onaddstream(r)},0),a.forEach(function(e){var r=e[0],i=e[1];if(t.id===e[2].id){var a=new Event("track");a.track=r,a.receiver=i,a.streams=[t],n.dispatchEvent(a),null!==n.ontrack&&window.setTimeout(function(){n.ontrack(a)},0)}})}}),window.setTimeout(function(){n&&n.transceivers&&n.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&&!0!==this.needNegotiation&&(this.needNegotiation=!0,window.setTimeout(function(){if(!1!==e.needNegotiation){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,n={new:0,closed:0,connecting:0,checking:0,connected:0,completed:0,failed:0};if(this.transceivers.forEach(function(e){n[e.iceTransport.state]++,n[e.dtlsTransport.state]++}),n.connected+=n.completed,e="new",n.failed>0?e="failed":n.connecting>0||n.checking>0?e="connecting":n.disconnected>0?e="disconnected":n.new>0?e="new":(n.connected>0||n.completed>0)&&(e="connected"),e!==t.iceConnectionState){t.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this.dispatchEvent(r),null!==this.oniceconnectionstatechange&&this.oniceconnectionstatechange(r)}},t.prototype.createOffer=function(){var t=this;if(this._pendingOffer)throw new Error("createOffer called while there is a pending offer.");var n;1===arguments.length&&"function"!=typeof arguments[0]?n=arguments[0]:3===arguments.length&&(n=arguments[2]);var i=this.transceivers.filter(function(e){return"audio"===e.kind}).length,a=this.transceivers.filter(function(e){return"video"===e.kind}).length;if(n){if(n.mandatory||n.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==n.offerToReceiveAudio&&(i=!0===n.offerToReceiveAudio?1:!1===n.offerToReceiveAudio?0:n.offerToReceiveAudio),void 0!==n.offerToReceiveVideo&&(a=!0===n.offerToReceiveVideo?1:!1===n.offerToReceiveVideo?0:n.offerToReceiveVideo)}for(this.transceivers.forEach(function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--a<0&&(e.wantReceive=!1)});i>0||a>0;)i>0&&(this._createTransceiver("audio"),i--),a>0&&(this._createTransceiver("video"),a--);var o=r(this.transceivers),c=s.writeSessionBoilerplate();o.forEach(function(n,r){var i=n.track,a=n.kind,c=s.generateIdentifier();n.mid=c,n.iceGatherer||(n.iceGatherer=t.usingBundle&&r>0?o[0].iceGatherer:t._createIceGatherer(c,r));var d=RTCRtpSender.getCapabilities(a);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*r+1)}];i&&e>=15019&&"video"===a&&(u[0].rtx={ssrc:1001*(2*r+1)+1}),n.wantReceive&&(n.rtpReceiver=new RTCRtpReceiver(n.dtlsTransport,a)),n.localCapabilities=d,n.sendEncodingParameters=u}),"max-compat"!==this._config.bundlePolicy&&(c+="a=group:BUNDLE "+o.map(function(e){return e.mid}).join(" ")+"\r\n"),c+="a=ice-options:trickle\r\n",o.forEach(function(e,t){c+=s.writeMediaSection(e,e.localCapabilities,"offer",e.stream),c+="a=rtcp-rsize\r\n"}),this._pendingOffer=o;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(n,r){if(n.isDatachannel)return void(t+="m=application 0 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=mid:"+n.mid+"\r\n");if(n.stream){var i;"audio"===n.kind?i=n.stream.getAudioTracks()[0]:"video"===n.kind&&(i=n.stream.getVideoTracks()[0]),i&&e>=15019&&"video"===n.kind&&(n.sendEncodingParameters[0].rtx={ssrc:1001*(2*r+2)+1})}var o=a(n.localCapabilities,n.remoteCapabilities);!o.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&n.sendEncodingParameters[0].rtx&&delete n.sendEncodingParameters[0].rtx,t+=s.writeMediaSection(n,o,"answer",n.stream),n.rtcpParameters&&n.rtcpParameters.reducedSize&&(t+="a=rtcp-rsize\r\n")});var n=new RTCSessionDescription({type:"answer",sdp:t});return arguments.length&&"function"==typeof arguments[0]&&window.setTimeout(arguments[0],0,n),Promise.resolve(n)},t.prototype.addIceCandidate=function(e){if(e){var t=e.sdpMLineIndex;if(e.sdpMid)for(var n=0;n0?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();r.iceTransport.addRemoteCandidate(i);var a=s.splitSections(this.remoteDescription.sdp);a[t+1]+=(i.type?e.candidate.trim():"a=end-of-candidates")+"\r\n",this.remoteDescription.sdp=a.join("")}}else for(var o=0;o1&&"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(n){t[n]&&e.push(t[n].getStats())})});var t=arguments.length>1&&"function"==typeof arguments[1]&&arguments[1],n=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(r){var i=new Map;Promise.all(e).then(function(e){e.forEach(function(e){Object.keys(e).forEach(function(t){e[t].type=n(e[t]),i.set(t,e[t])})}),t&&window.setTimeout(t,0,i),r(i)})})},t}},function(e,t,n){"use strict";var r=n(0).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 n=new Event("track");n.track=t,n.receiver={track:t},n.streams=[e.stream],this.dispatchEvent(n)}.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(r.version<38&&e&&e.iceServers){for(var n=[],i=0;i=0)){this._streams.push(t);var n=new Event("addstream");n.stream=e.streams[0],this.dispatchEvent(n)}}.bind(this))}})},shimCallbacksAPI:function(){if("object"==typeof window&&window.RTCPeerConnection){var e=RTCPeerConnection.prototype,t=e.createOffer,n=e.createAnswer,r=e.setLocalDescription,i=e.setRemoteDescription,a=e.addIceCandidate;e.createOffer=function(e,n){var r=arguments.length>=2?arguments[2]:arguments[0],i=t.apply(this,[r]);return n?(i.then(e,n),Promise.resolve()):i},e.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var o=function(e,t,n){var i=r.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i};e.setLocalDescription=o,o=function(e,t,n){var r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},e.setRemoteDescription=o,o=function(e,t,n){var r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},e.addIceCandidate=o}},shimGetUserMedia:function(){navigator.getUserMedia||(navigator.webkitGetUserMedia?navigator.getUserMedia=navigator.webkitGetUserMedia.bind(navigator):navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&(navigator.getUserMedia=function(e,t,n){navigator.mediaDevices.getUserMedia(e).then(t,n)}.bind(navigator)))}};e.exports={shimCallbacksAPI:r.shimCallbacksAPI,shimAddStream:r.shimAddStream,shimOnAddStream:r.shimOnAddStream,shimGetUserMedia:r.shimGetUserMedia}},function(e,t,n){function r(){function e(e){return"function"==typeof e?e:function(){}}var t=n(2),r=n(1),i=r(),a={prepare:i.prepare,show:i.show,hide:i.hide,scan:i.scan,cancelScan:i.cancelScan,pausePreview:i.pausePreview,resumePreview:i.resumePreview,enableLight:i.enableLight,disableLight:i.disableLight,useCamera:i.useCamera,openSettings:i.openSettings,getStatus:i.getStatus,destroy:i.destroy};return t({exec:function(t,n,r,i,o){if("QRScanner"!==r||!a[i])return n(0);o?a[i](e(t),e(n),o):a[i](e(t),e(n))}})}e.exports=new r}])}); +//# sourceMappingURL=cordova-plugin-qrscanner-lib.min.js.map \ No newline at end of file diff --git a/dist/cordova-plugin-qrscanner-lib.min.js.map b/dist/cordova-plugin-qrscanner-lib.min.js.map new file mode 100644 index 00000000..37671d59 --- /dev/null +++ b/dist/cordova-plugin-qrscanner-lib.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///cordova-plugin-qrscanner-lib.min.js","webpack:///webpack/bootstrap 93abf133c0670beedd53","webpack:///./~/webrtc-adapter/src/js/utils.js","webpack:///./src/browser/src/createQRScannerInternal.js","webpack:///./src/common/src/createQRScannerAdapter.js","webpack:///./src/browser/worker.min.js","webpack:///./~/sdp/sdp.js","webpack:///./~/webrtc-adapter/src/js/adapter_core.js","webpack:///./~/webrtc-adapter/src/js/chrome/chrome_shim.js","webpack:///./~/webrtc-adapter/src/js/chrome/getusermedia.js","webpack:///./~/webrtc-adapter/src/js/edge/edge_shim.js","webpack:///./~/webrtc-adapter/src/js/edge/getusermedia.js","webpack:///./~/webrtc-adapter/src/js/edge/rtcpeerconnection_shim.js","webpack:///./~/webrtc-adapter/src/js/firefox/firefox_shim.js","webpack:///./~/webrtc-adapter/src/js/firefox/getusermedia.js","webpack:///./~/webrtc-adapter/src/js/safari/safari_shim.js","webpack:///./src/browser/src/library.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","logDisabled_","utils","disableLog","bool","Error","log","window","console","apply","arguments","extractVersion","uastring","expr","pos","match","length","parseInt","detectBrowser","result","browser","version","navigator","mozGetUserMedia","userAgent","webkitGetUserMedia","webkitRTCPeerConnection","mediaDevices","shimCreateObjectURL","HTMLMediaElement","nativeCreateObjectURL","URL","createObjectURL","bind","nativeRevokeObjectURL","revokeObjectURL","streams","Map","newId","stream","url","set","delete","dsc","getOwnPropertyDescriptor","srcObject","nativeSetAttribute","setAttribute","toLowerCase","browserDetails","workerScript","killStream","mediaStream","getTracks","forEach","track","stop","getCameraSpecsById","deviceId","getConstraintObj","facingMode","width","height","obj","audio","video","exact","getFirstResolvingConstraint","constraintsBestToWorst","Promise","resolveBestConstraints","reduce","chain","next","then","searchState","found","nextConstraint","getUserMedia","resolve","facingModeConstraints","facingModes","map","mode","widthConstraints","standardWidthsAndHeights","heightConstraints","facingModeSpecs","widthSpecs","heightSpecs","chooseCameras","enumerateDevices","mediaDeviceInfoList","filter","elem","kind","videoDeviceIds","searches","id","push","all","cameraSpecsArray","camera","sort","a","b","bestToWorstCameras","backCamera","frontCamera","splice","mediaStreamIsActive","activeMediaStream","killActiveMediaStream","getVideoPreview","document","getElementById","ELEMENTS","preview","getImg","still","getCurrentCameraIndex","currentCamera","getCurrentCamera","bringStillToFront","img","style","visibility","previewing","bringPreviewToFront","isInitialized","canChangeCamera","calcStatus","authorized","denied","restricted","prepared","scanning","showing","lightEnabled","canOpenSettings","canEnableLight","toString","startCamera","success","error","currentCameraIndex","ideal","src","err","getTempCanvasAndContext","videoElement","tempCanvas","createElement","tempCanvasContext","getContext","drawImage","canvas","context","getCurrentImageData","snapshot","getImageData","captureCurrentFrame","toDataURL","initialize","scanWorker","workerBlob","Blob","type","Worker","videoPreview","ZINDEXES","addEventListener","stillImg","body","appendChild","cameras","prepare","show","showCamera","hide","scan","ignore","returned","onmessage","event","data","thisScanCycle","postMessage","cancelNextScan","SCAN_INTERVAL","QRScanner_SCAN_INTERVAL","nextScan","setTimeout","sendError","clearTimeout","cancelScan","pausePreview","pause","Image","backgroundImage","resumePreview","enableLight","disableLight","useCamera","array","requestedCamera","initialized","status","openSettings","getStatus","destroy","remove","cordova","stringToBool","string","convertStatus","statusDictionary","clearBackground","backgroundColor","parentNode","errorCallback","callback","errorCode","QRScannerError","code","_message","successCallback","statusDict","doneCallback","clear","exec","index","useFrontCamera","useBackCamera","SDPUtils","generateIdentifier","Math","random","substr","localCName","splitLines","blob","trim","split","line","splitSections","part","matchPrefix","prefix","indexOf","parseCandidate","parts","substring","candidate","foundation","component","protocol","priority","ip","port","relatedAddress","relatedPort","tcpType","writeCandidate","sdp","toUpperCase","join","parseIceOptions","parseRtpMap","parsed","payloadType","shift","clockRate","numChannels","writeRtpMap","codec","pt","undefined","preferredPayloadType","parseExtmap","direction","uri","writeExtmap","headerExtension","preferredId","parseFmtp","kv","j","writeFmtp","parameters","keys","params","param","parseRtcpFb","parameter","writeRtcpFb","lines","rtcpFeedback","fb","parseSsrcMedia","sp","ssrc","colon","attribute","getMid","mediaSection","mid","parseFingerprint","algorithm","getDtlsParameters","sessionpart","role","fingerprints","writeDtlsParameters","setupType","fp","getIceParameters","concat","usernameFragment","password","writeIceParameters","parseRtpParameters","description","codecs","headerExtensions","fecMechanisms","rtcp","mline","rtpmapline","fmtps","writeRtpDescription","caps","maxptime","extension","parseRtpEncodingParameters","secondarySsrc","encodingParameters","hasRed","hasUlpfec","ssrcs","primarySsrc","flows","apt","encParam","codecPayloadType","rtx","JSON","parse","stringify","fec","mechanism","bandwidth","maxBitrate","parseRtcpParameters","rtcpParameters","remoteSsrc","cname","rsize","reducedSize","compound","mux","parseMsid","spec","planB","writeSessionBoilerplate","writeMediaSection","transceiver","iceGatherer","getLocalParameters","dtlsTransport","rtpSender","rtpReceiver","msid","sendEncodingParameters","getDirection","getKind","isRejected","logging","chromeShim","edgeShim","firefoxShim","safariShim","shimPeerConnection","browserShim","shimGetUserMedia","shimMediaStream","shimSourceObject","shimOnTrack","shimGetSendersWithDtmf","shimReplaceTrack","shimCallbacksAPI","shimAddStream","shimOnAddStream","MediaStream","webkitMediaStream","RTCPeerConnection","_ontrack","f","self","removeEventListener","_ontrackpoly","e","te","receiver","getReceivers","find","r","Event","dispatchEvent","getSenders","_senders","origAddStream","addStream","origRemoveStream","removeStream","addTrack","pc","signalingState","DOMException","slice","t","_streams","oldStream","newStream","sender","dtmf","_dtmf","createDTMFSender","_srcObject","OrigPeerConnection","pcConfig","pcConstraints","iceServers","newIceServers","server","warn","urls","generateCertificate","iceTransportPolicy","iceTransports","origGetStats","getStats","selector","args","fixChromeStats_","response","standardReport","report","standardStats","timestamp","localcandidate","remotecandidate","names","stat","makeMapStats","stats","key","successCallbackWrapper_","reject","method","nativeMethod","promise","opts","RTCIceCandidate","RTCSessionDescription","nativeAddIceCandidate","addIceCandidate","constraintsToChrome_","mandatory","optional","cc","min","max","oldname_","charAt","oc","mix","advanced","shimConstraints_","constraints","func","face","getSupportedFacingModeLies","getSupportedConstraints","matches","devices","dev","some","label","shimError_","ConstraintNotSatisfiedError","PermissionDeniedError","TrackStartError","message","constraint","constraintName","getUserMedia_","onSuccess","onError","getUserMediaPromise_","kinds","MediaStreamTrack","getSources","device","groupId","echoCancellation","frameRate","origGetUserMedia","cs","getAudioTracks","getVideoTracks","shimRTCPeerConnection","RTCIceGatherer","origMSTEnabled","ev","enabled","RTCRtpSender","replaceTrack","setTrack","catch","sortTracks","tracks","audioTracks","videoTracks","filterIceServers","edgeVersion","hasTurn","isString","getCommonCapabilities","localCapabilities","remoteCapabilities","commonCapabilities","findCodecByPayloadType","rtxCapabilityMatches","lRtx","rRtx","lCodecs","rCodecs","lCodec","rCodec","lHeaderExtension","rHeaderExtension","isActionAllowedInSignalingState","action","offer","setLocalDescription","setRemoteDescription","answer","config","_eventTarget","createDocumentFragment","needNegotiation","onicecandidate","onaddstream","ontrack","onremovestream","onsignalingstatechange","oniceconnectionstatechange","onicegatheringstatechange","onnegotiationneeded","ondatachannel","canTrickleIceCandidates","localStreams","remoteStreams","getLocalStreams","getRemoteStreams","localDescription","remoteDescription","iceConnectionState","iceGatheringState","iceOptions","gatherPolicy","usingBundle","bundlePolicy","_config","transceivers","_localIceCandidatesBuffer","_emitGatheringStateChange","_emitBufferedCandidates","sections","sdpMLineIndex","every","state","iceGatheringStateChange","getConfiguration","_createTransceiver","hasBundleTransport","iceTransport","recvEncodingParameters","wantReceive","transports","_createIceAndDtlsTransports","_maybeFireNegotiationNeeded","clonedStream","clone","idx","clonedTrack","_createIceGatherer","onlocalcandidate","evt","sdpMid","cand","end","_pendingOffer","complete","RTCIceTransport","onicestatechange","_updateConnectionState","RTCDtlsTransport","ondtlsstatechange","onerror","writable","_disposeIceAndDtlsTransports","ondtlssttatechange","_transceive","send","recv","encodings","receive","isIceLite","isDatachannel","remoteIceParameters","remoteDtlsParameters","start","_updateSignalingState","TypeError","hasCallback","cb","receiverList","rejected","remoteMsid","isComplete","cands","setTransport","setRemoteCandidates","default","RTCRtpReceiver","getCapabilities","sid","item","trackEvent","getRemoteCandidates","addRemoteCandidate","close","newState","states","new","closed","connecting","checking","connected","completed","failed","disconnected","createOffer","offerOptions","numAudioTracks","numVideoTracks","offerToReceiveAudio","offerToReceiveVideo","desc","createAnswer","localTrack","mLineIndex","promises","fixStatsType","inboundrtp","outboundrtp","candidatepair","results","res","mozSrcObject","mozRTCPeerConnection","newServer","username","credential","mozRTCSessionDescription","mozRTCIceCandidate","modernStatsTypes","nativeGetStats","onSucc","onErr","assign","InternalError","NotSupportedError","SecurityError","The operation is insecure.","constraintsToFF37_","require","orgEnumerateDevices","_onaddstream","_onaddstreampoly","failureCallback","options","withCallback","errcb","QRScanner","getFunc","createQRScannerAdapter","createQRScannerInternal","internal","functionList","className","functionName","inputArray"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,eAAAH,GACA,gBAAAC,SACAA,QAAA,UAAAD,IAEAD,EAAA,UAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAA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QD,EAASM,GgBh2IjC,QAAAitB,KAuBA,QAAAC,GAAA5d,GACA,wBAAAA,GACAA,EAEA,aA1BA,GAAA6d,GAAAntB,EAAA,GACAotB,EAAAptB,EAAA,GAEAqtB,EAAAD,IACAE,GACA7gB,QAAA4gB,EAAA5gB,QACAC,KAAA2gB,EAAA3gB,KACAE,KAAAygB,EAAAzgB,KACAC,KAAAwgB,EAAAxgB,KACAe,WAAAyf,EAAAzf,WACAC,aAAAwf,EAAAxf,aACAI,cAAAof,EAAApf,cACAC,YAAAmf,EAAAnf,YACAC,aAAAkf,EAAAlf,aACAC,UAAAif,EAAAjf,UACAK,aAAA4e,EAAA5e,aACAC,UAAA2e,EAAA3e,UACAC,QAAA0e,EAAA1e,QA8BA,OADAwe,IAZApd,KAAA,SAAAJ,EAAAN,EAAAke,EAAAC,EAAAC,GACA,iBAAAF,IAAAD,EAAAE,GACA,MAAAne,GAAA,EAEAoe,GACAH,EAAAE,GAAAN,EAAAvd,GAAAud,EAAA7d,GAAAoe,GAEAH,EAAAE,GAAAN,EAAAvd,GAAAud,EAAA7d,OASA1P,EAAAD,QAAA,GAAAutB","file":"cordova-plugin-qrscanner-lib.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"QRScanner\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"QRScanner\"] = factory();\n\telse\n\t\troot[\"QRScanner\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"QRScanner\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"QRScanner\"] = factory();\n\telse\n\t\troot[\"QRScanner\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 14);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n\nvar logDisabled_ = true;\n\n// Utility methods.\nvar utils = {\n disableLog: function(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n logDisabled_ = bool;\n return (bool) ? 'adapter.js logging disabled' :\n 'adapter.js logging enabled';\n },\n\n log: function() {\n if (typeof window === 'object') {\n if (logDisabled_) {\n return;\n }\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n console.log.apply(console, arguments);\n }\n }\n },\n\n /**\n * Extract browser version out of the provided user agent string.\n *\n * @param {!string} uastring userAgent string.\n * @param {!string} expr Regular expression used as match criteria.\n * @param {!number} pos position in the version string to be returned.\n * @return {!number} browser version.\n */\n extractVersion: function(uastring, expr, pos) {\n var match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n },\n\n /**\n * Browser detector.\n *\n * @return {object} result containing browser and version\n * properties.\n */\n detectBrowser: function() {\n // Returned result object.\n var result = {};\n result.browser = null;\n result.version = null;\n\n // Fail early if it's not a browser\n if (typeof window === 'undefined' || !window.navigator) {\n result.browser = 'Not a browser.';\n return result;\n }\n\n // Firefox.\n if (navigator.mozGetUserMedia) {\n result.browser = 'firefox';\n result.version = this.extractVersion(navigator.userAgent,\n /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia) {\n // Chrome, Chromium, Webview, Opera, all use the chrome shim for now\n if (window.webkitRTCPeerConnection) {\n result.browser = 'chrome';\n result.version = this.extractVersion(navigator.userAgent,\n /Chrom(e|ium)\\/(\\d+)\\./, 2);\n } else { // Safari (in an unpublished version) or unknown webkit-based.\n if (navigator.userAgent.match(/Version\\/(\\d+).(\\d+)/)) {\n result.browser = 'safari';\n result.version = this.extractVersion(navigator.userAgent,\n /AppleWebKit\\/(\\d+)\\./, 1);\n } else { // unknown webkit-based browser.\n result.browser = 'Unsupported webkit-based browser ' +\n 'with GUM support but no WebRTC support.';\n return result;\n }\n }\n } else if (navigator.mediaDevices &&\n navigator.userAgent.match(/Edge\\/(\\d+).(\\d+)$/)) { // Edge.\n result.browser = 'edge';\n result.version = this.extractVersion(navigator.userAgent,\n /Edge\\/(\\d+).(\\d+)$/, 2);\n } else if (navigator.mediaDevices &&\n navigator.userAgent.match(/AppleWebKit\\/(\\d+)\\./)) {\n // Safari, with webkitGetUserMedia removed.\n result.browser = 'safari';\n result.version = this.extractVersion(navigator.userAgent,\n /AppleWebKit\\/(\\d+)\\./, 1);\n } else { // Default fallthrough: not supported.\n result.browser = 'Not a supported browser.';\n return result;\n }\n\n return result;\n },\n\n // shimCreateObjectURL must be called before shimSourceObject to avoid loop.\n\n shimCreateObjectURL: function() {\n if (!(typeof window === 'object' && window.HTMLMediaElement &&\n 'srcObject' in window.HTMLMediaElement.prototype)) {\n // Only shim CreateObjectURL using srcObject if srcObject exists.\n return undefined;\n }\n\n var nativeCreateObjectURL = URL.createObjectURL.bind(URL);\n var nativeRevokeObjectURL = URL.revokeObjectURL.bind(URL);\n var streams = new Map(), newId = 0;\n\n URL.createObjectURL = function(stream) {\n if ('getTracks' in stream) {\n var url = 'polyblob:' + (++newId);\n streams.set(url, stream);\n console.log('URL.createObjectURL(stream) is deprecated! ' +\n 'Use elem.srcObject = stream instead!');\n return url;\n }\n return nativeCreateObjectURL(stream);\n };\n URL.revokeObjectURL = function(url) {\n nativeRevokeObjectURL(url);\n streams.delete(url);\n };\n\n var dsc = Object.getOwnPropertyDescriptor(window.HTMLMediaElement.prototype,\n 'src');\n Object.defineProperty(window.HTMLMediaElement.prototype, 'src', {\n get: function() {\n return dsc.get.apply(this);\n },\n set: function(url) {\n this.srcObject = streams.get(url) || null;\n return dsc.set.apply(this, [url]);\n }\n });\n\n var nativeSetAttribute = HTMLMediaElement.prototype.setAttribute;\n HTMLMediaElement.prototype.setAttribute = function() {\n if (arguments.length === 2 &&\n ('' + arguments[0]).toLowerCase() === 'src') {\n this.srcObject = streams.get(arguments[1]) || null;\n }\n return nativeSetAttribute.apply(this, arguments);\n };\n }\n};\n\n// Export.\nmodule.exports = {\n log: utils.log,\n disableLog: utils.disableLog,\n browserDetails: utils.detectBrowser(),\n extractVersion: utils.extractVersion,\n shimCreateObjectURL: utils.shimCreateObjectURL,\n detectBrowser: utils.detectBrowser.bind(utils)\n};\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n__webpack_require__(5);\nvar workerScript = __webpack_require__(3);\n\nmodule.exports = function(){\n\n var ELEMENTS = {\n preview: 'cordova-plugin-qrscanner-video-preview',\n still: 'cordova-plugin-qrscanner-still'\n };\n var ZINDEXES = {\n preview: -100,\n still: -99\n };\n var backCamera = null;\n var frontCamera = null;\n var currentCamera = 0;\n var activeMediaStream = null;\n var scanning = false;\n var previewing = false;\n var scanWorker = null;\n var thisScanCycle = null;\n var nextScan = null;\n var cancelNextScan = null;\n\n // standard screen widths/heights, from 4k down to 320x240\n // widths and heights are each tested separately to account for screen rotation\n var standardWidthsAndHeights = [\n 5120, 4096, 3840, 3440, 3200, 3072, 3000, 2880, 2800, 2736, 2732, 2560,\n 2538, 2400, 2304, 2160, 2100, 2048, 2000, 1920, 1856, 1824, 1800, 1792,\n 1776, 1728, 1700, 1680, 1600, 1536, 1440, 1400, 1392, 1366, 1344, 1334,\n 1280, 1200, 1152, 1136, 1120, 1080, 1050, 1024, 1000, 960, 900, 854, 848,\n 832, 800, 768, 750, 720, 640, 624, 600, 576, 544, 540, 512, 480, 320, 240\n ];\n\n var facingModes = [\n 'environment',\n 'user'\n ];\n\n //utils\n function killStream(mediaStream){\n mediaStream.getTracks().forEach(function(track){\n track.stop();\n });\n }\n\n // For performance, we test best-to-worst constraints. Once we find a match,\n // we move to the next test. Since `ConstraintNotSatisfiedError`s are thrown\n // much faster than streams can be started and stopped, the scan is much\n // faster, even though it may iterate through more constraint objects.\n function getCameraSpecsById(deviceId){\n\n // return a getUserMedia Constraints\n function getConstraintObj(deviceId, facingMode, width, height){\n var obj = { audio: false, video: {} };\n obj.video.deviceId = {exact: deviceId};\n if(facingMode) {\n obj.video.facingMode = {exact: facingMode};\n }\n if(width) {\n obj.video.width = {exact: width};\n }\n if(height) {\n obj.video.height = {exact: height};\n }\n return obj;\n }\n\n var facingModeConstraints = facingModes.map(function(mode){\n \treturn getConstraintObj(deviceId, mode);\n });\n var widthConstraints = standardWidthsAndHeights.map(function(width){\n \treturn getConstraintObj(deviceId, null, width);\n });\n var heightConstraints = standardWidthsAndHeights.map(function(height){\n \treturn getConstraintObj(deviceId, null, null, height);\n });\n\n // create a promise which tries to resolve the best constraints for this deviceId\n // rather than reject, failures return a value of `null`\n function getFirstResolvingConstraint(constraintsBestToWorst){\n return new Promise(function(resolveBestConstraints){\n // build a chain of promises which either resolves or continues searching\n return constraintsBestToWorst.reduce(function(chain, next){\n return chain.then(function(searchState){\n if(searchState.found){\n // The best working constraint was found. Skip further tests.\n return searchState;\n } else {\n searchState.nextConstraint = next;\n return window.navigator.mediaDevices.getUserMedia(searchState.nextConstraint).then(function(mediaStream){\n // We found the first working constraint object, now we can stop\n // the stream and short-circuit the search.\n killStream(mediaStream);\n searchState.found = true;\n return searchState;\n }, function(){\n // didn't get a media stream. The search continues:\n return searchState;\n });\n }\n });\n }, Promise.resolve({\n // kick off the search:\n found: false,\n nextConstraint: {}\n })).then(function(searchState){\n if(searchState.found){\n resolveBestConstraints(searchState.nextConstraint);\n } else {\n resolveBestConstraints(null);\n }\n });\n });\n }\n\n return getFirstResolvingConstraint(facingModeConstraints).then(function(facingModeSpecs){\n return getFirstResolvingConstraint(widthConstraints).then(function(widthSpecs){\n return getFirstResolvingConstraint(heightConstraints).then(function(heightSpecs){\n return {\n deviceId: deviceId,\n facingMode: facingModeSpecs === null ? null : facingModeSpecs.video.facingMode.exact,\n width: widthSpecs === null ? null : widthSpecs.video.width.exact,\n height: heightSpecs === null ? null : heightSpecs.video.height.exact\n };\n });\n });\n });\n }\n\n function chooseCameras(){\n var devices = window.navigator.mediaDevices.enumerateDevices();\n return devices.then(function(mediaDeviceInfoList){\n var videoDeviceIds = mediaDeviceInfoList.filter(function(elem){\n return elem.kind === 'videoinput';\n }).map(function(elem){\n return elem.deviceId;\n });\n return videoDeviceIds;\n }).then(function(videoDeviceIds){\n // there is no standardized way for us to get the specs of each camera\n // (due to concerns over user fingerprinting), so we're forced to\n // iteratively test each camera for it's capabilities\n var searches = [];\n videoDeviceIds.forEach(function(id){\n searches.push(getCameraSpecsById(id));\n });\n return Promise.all(searches);\n }).then(function(cameraSpecsArray){\n return cameraSpecsArray.filter(function(camera){\n // filter out any cameras where width and height could not be captured\n if(camera !== null && camera.width !== null && camera.height !== null){\n return true;\n }\n }).sort(function(a, b){\n // sort cameras from highest resolution (by width) to lowest\n return b.width - a.width;\n });\n }).then(function(bestToWorstCameras){\n var backCamera = null,\n frontCamera = null;\n // choose backCamera\n for(var i = 0; i < bestToWorstCameras.length; i++){\n if (bestToWorstCameras[i].facingMode === 'environment'){\n backCamera = bestToWorstCameras[i];\n // (shouldn't be used for frontCamera)\n bestToWorstCameras.splice(i, 1);\n break;\n }\n }\n // if no back-facing cameras were found, choose the highest resolution\n if(backCamera === null){\n if(bestToWorstCameras.length > 0){\n backCamera = bestToWorstCameras[0];\n // (shouldn't be used for frontCamera)\n bestToWorstCameras.splice(0, 1);\n } else {\n // user doesn't have any available cameras\n backCamera = false;\n }\n }\n if(bestToWorstCameras.length > 0){\n // frontCamera should simply be the next-best resolution camera\n frontCamera = bestToWorstCameras[0];\n } else {\n // user doesn't have any more cameras\n frontCamera = false;\n }\n return {\n backCamera: backCamera,\n frontCamera: frontCamera\n };\n });\n }\n\n function mediaStreamIsActive(){\n return activeMediaStream !== null;\n }\n\n function killActiveMediaStream(){\n killStream(activeMediaStream);\n activeMediaStream = null;\n }\n\n function getVideoPreview(){\n return document.getElementById(ELEMENTS.preview);\n }\n\n function getImg(){\n return document.getElementById(ELEMENTS.still);\n }\n\n function getCurrentCameraIndex(){\n return currentCamera;\n }\n\n function getCurrentCamera(){\n return currentCamera === 1 ? frontCamera : backCamera;\n }\n\n function bringStillToFront(){\n var img = getImg();\n if(img){\n img.style.visibility = 'visible';\n previewing = false;\n }\n }\n\n function bringPreviewToFront(){\n var img = getImg();\n if(img){\n img.style.visibility = 'hidden';\n previewing = true;\n }\n }\n\n function isInitialized(){\n return backCamera !== null;\n }\n\n function canChangeCamera(){\n return !!backCamera && !!frontCamera;\n }\n\n function calcStatus(){\n return {\n // !authorized means the user either has no camera or has denied access.\n // This would leave a value of `null` before prepare(), and `false` after.\n authorized: (backCamera !== null && backCamera !== false)? '1': '0',\n // No applicable API\n denied: '0',\n // No applicable API\n restricted: '0',\n prepared: isInitialized() ? '1' : '0',\n scanning: scanning? '1' : '0',\n previewing: previewing? '1' : '0',\n // We leave this true after prepare() to match the mobile experience as\n // closely as possible. (Without additional covering, the preview will\n // always be visible to the user).\n showing: getVideoPreview()? '1' : '0',\n // No applicable API\n lightEnabled: '0',\n // No applicable API\n canOpenSettings: '0',\n // No applicable API\n canEnableLight: '0',\n canChangeCamera: canChangeCamera() ? '1' : '0',\n currentCamera: currentCamera.toString()\n };\n }\n\n function startCamera(success, error){\n var currentCameraIndex = getCurrentCameraIndex();\n var currentCamera = getCurrentCamera();\n window.navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n deviceId: {exact: currentCamera.deviceId},\n width: {ideal: currentCamera.width},\n height: {ideal: currentCamera.height}\n }\n }).then(function(mediaStream){\n activeMediaStream = mediaStream;\n var video = getVideoPreview();\n video.src = URL.createObjectURL(mediaStream);\n success(calcStatus());\n }, function(err){\n // something bad happened\n err = null;\n var code = currentCameraIndex? 4 : 3;\n error(code); // FRONT_CAMERA_UNAVAILABLE : BACK_CAMERA_UNAVAILABLE\n });\n }\n\n function getTempCanvasAndContext(videoElement){\n var tempCanvas = document.createElement('canvas');\n var camera = getCurrentCamera();\n tempCanvas.height = camera.height;\n tempCanvas.width = camera.width;\n var tempCanvasContext = tempCanvas.getContext('2d');\n tempCanvasContext.drawImage(videoElement, 0, 0, camera.width, camera.height);\n return {\n canvas: tempCanvas,\n context: tempCanvasContext\n };\n }\n\n function getCurrentImageData(videoElement){\n var snapshot = getTempCanvasAndContext(videoElement);\n return snapshot.context.getImageData(0, 0, snapshot.canvas.width, snapshot.canvas.height);\n }\n\n // take a screenshot of the video preview with a temp canvas\n function captureCurrentFrame(videoElement){\n return getTempCanvasAndContext(videoElement).canvas.toDataURL('image/png');\n }\n\n function initialize(success, error){\n if(scanWorker === null){\n var workerBlob = new Blob([workerScript],{type: \"text/javascript\"});\n scanWorker = new Worker(URL.createObjectURL(workerBlob));\n }\n if(!getVideoPreview()){\n // prepare DOM (sync)\n var videoPreview = document.createElement('video');\n videoPreview.setAttribute('autoplay', 'autoplay');\n videoPreview.setAttribute('id', ELEMENTS.preview);\n videoPreview.setAttribute('style', 'display:block;position:fixed;top:50%;left:50%;' +\n 'width:auto;height:auto;min-width:100%;min-height:100%;z-index:' + ZINDEXES.preview +\n ';-moz-transform: translateX(-50%) translateY(-50%);-webkit-transform: ' +\n 'translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);' +\n 'background-size:cover;background-position:50% 50%;background-color:#FFF;');\n videoPreview.addEventListener('loadeddata', function(){\n bringPreviewToFront();\n });\n\n var stillImg = document.createElement('div');\n stillImg.setAttribute('id', ELEMENTS.still);\n stillImg.setAttribute('style', 'display:block;position:fixed;top:50%;left:50%;visibility: hidden;' +\n 'width:auto;height:auto;min-width:100%;min-height:100%;z-index:' + ZINDEXES.still +\n ';-moz-transform: translateX(-50%) translateY(-50%);-webkit-transform: ' +\n 'translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);' +\n 'background-size:cover;background-position:50% 50%;background-color:#FFF;');\n\n document.body.appendChild(videoPreview);\n document.body.appendChild(stillImg);\n }\n if(backCamera === null){\n // set instance cameras\n chooseCameras().then(function(cameras){\n backCamera = cameras.backCamera;\n frontCamera = cameras.frontCamera;\n if(backCamera !== false){\n success();\n } else {\n error(5); // CAMERA_UNAVAILABLE\n }\n }, function(err){\n // something bad happened\n err = null;\n error(0); // UNEXPECTED_ERROR\n });\n } else if (backCamera === false){\n error(5); // CAMERA_UNAVAILABLE\n } else {\n success();\n }\n }\n\n /*\n * --- Begin Public API ---\n */\n\n function prepare(success, error){\n initialize(function(){\n // return status on success\n success(calcStatus());\n },\n // pass errors through\n error);\n }\n\n function show(success, error){\n function showCamera(){\n if(!mediaStreamIsActive()){\n startCamera(success, error);\n } else {\n success(calcStatus());\n }\n }\n if(!isInitialized()){\n initialize(function(){\n // on successful initialization, attempt to showCamera\n showCamera();\n },\n // pass errors through\n error);\n } else {\n showCamera();\n }\n }\n\n function hide(success, error){\n error = null; // should never error\n if(mediaStreamIsActive()){\n killActiveMediaStream();\n }\n var video = getVideoPreview();\n if(video){\n video.src = '';\n }\n success(calcStatus());\n }\n\n function scan(success, error) {\n // initialize and start video preview if not already active\n show(function(ignore){\n // ignore success output – `scan` method callback should be passed the decoded data\n ignore = null;\n var video = getVideoPreview();\n var returned = false;\n scanning = true;\n scanWorker.onmessage = function(event){\n var obj = event.data;\n if(obj.result && !returned){\n returned = true;\n thisScanCycle = null;\n success(obj.result);\n }\n };\n thisScanCycle = function(){\n scanWorker.postMessage(getCurrentImageData(video));\n if(cancelNextScan !== null){\n // avoid race conditions, always clear before starting a cycle\n cancelNextScan();\n }\n // interval in milliseconds at which to try decoding the QR code\n var SCAN_INTERVAL = window.QRScanner_SCAN_INTERVAL || 130;\n // this value can be adjusted on-the-fly (while a scan is active) to\n // balance scan speed vs. CPU/power usage\n nextScan = window.setTimeout(thisScanCycle, SCAN_INTERVAL);\n cancelNextScan = function(sendError){\n window.clearTimeout(nextScan);\n nextScan = null;\n cancelNextScan = null;\n if(sendError){\n error(6); // SCAN_CANCELED\n }\n };\n };\n thisScanCycle();\n }, error);\n }\n\n function cancelScan(success, error){\n error = null; // should never error\n if(cancelNextScan !== null){\n cancelNextScan(true);\n }\n scanning = false;\n if(typeof success === \"function\"){\n success(calcStatus());\n }\n }\n\n function pausePreview(success, error){\n error = null; // should never error\n if(mediaStreamIsActive()){\n // pause scanning too\n if(cancelNextScan !== null){\n cancelNextScan();\n }\n var video = getVideoPreview();\n video.pause();\n var img = new Image();\n img.src = captureCurrentFrame(video);\n getImg().style.backgroundImage = 'url(' + img.src + ')';\n bringStillToFront();\n // kill the active stream to turn off the privacy light (the screenshot\n // in the stillImg will remain visible)\n killActiveMediaStream();\n success(calcStatus());\n } else {\n success(calcStatus());\n }\n }\n\n function resumePreview(success, error){\n // if a scan was happening, resume it\n if(thisScanCycle !== null){\n thisScanCycle();\n }\n show(success, error);\n }\n\n function enableLight(success, error){\n error(7); //LIGHT_UNAVAILABLE\n }\n\n function disableLight(success, error){\n error(7); //LIGHT_UNAVAILABLE\n }\n\n function useCamera(success, error, array){\n var requestedCamera = array[0];\n var initialized = isInitialized();\n if(requestedCamera !== currentCamera){\n if(initialized && requestedCamera === 1 && !canChangeCamera()){\n error(4); //FRONT_CAMERA_UNAVAILABLE\n } else {\n currentCamera = requestedCamera;\n if(initialized){\n hide(function(status){\n // Don't need this one\n status = null;\n });\n show(success, error);\n } else {\n success(calcStatus());\n }\n }\n } else {\n success(calcStatus());\n }\n }\n\n function openSettings(success, error){\n error(8); //OPEN_SETTINGS_UNAVAILABLE\n }\n\n function getStatus(success, error){\n error = null; // should never error\n success(calcStatus());\n }\n\n // Reset all instance variables to their original state.\n // This method might be useful in cases where a new camera is available, and\n // the application needs to force the plugin to chooseCameras() again.\n function destroy(success, error){\n error = null; // should never error\n cancelScan();\n if(mediaStreamIsActive()){\n killActiveMediaStream();\n }\n backCamera = null;\n frontCamera = null;\n var preview = getVideoPreview();\n var still = getImg();\n if(preview){\n preview.remove();\n }\n if(still){\n still.remove();\n }\n success(calcStatus());\n }\n\n return {\n prepare: prepare,\n show: show,\n hide: hide,\n scan: scan,\n cancelScan: cancelScan,\n pausePreview: pausePreview,\n resumePreview: resumePreview,\n enableLight: enableLight,\n disableLight: disableLight,\n useCamera: useCamera,\n openSettings: openSettings,\n getStatus: getStatus,\n destroy: destroy\n };\n};\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = function createQRScanner(cordova){\n// The native implementations should return their status as ['string':'string']\n// dictionaries. Boolean values are encoded to '0' and '1', respectively.\nfunction stringToBool(string) {\n switch (string) {\n case '1':\n return true;\n case '0':\n return false;\n default:\n throw new Error('QRScanner plugin returned an invalid boolean number-string: ' + string);\n }\n}\n\n// Converts the returned ['string':'string'] dictionary to a status object.\nfunction convertStatus(statusDictionary) {\n return {\n authorized: stringToBool(statusDictionary.authorized),\n denied: stringToBool(statusDictionary.denied),\n restricted: stringToBool(statusDictionary.restricted),\n prepared: stringToBool(statusDictionary.prepared),\n scanning: stringToBool(statusDictionary.scanning),\n previewing: stringToBool(statusDictionary.previewing),\n showing: stringToBool(statusDictionary.showing),\n lightEnabled: stringToBool(statusDictionary.lightEnabled),\n canOpenSettings: stringToBool(statusDictionary.canOpenSettings),\n canEnableLight: stringToBool(statusDictionary.canEnableLight),\n canChangeCamera: stringToBool(statusDictionary.canChangeCamera),\n currentCamera: parseInt(statusDictionary.currentCamera)\n };\n}\n\n// Simple utility method to ensure the background is transparent. Used by the\n// plugin to force re-rendering immediately after the native webview background\n// is made transparent.\nfunction clearBackground() {\n var body = document.body;\n if (body.style) {\n body.style.backgroundColor = 'rgba(0,0,0,0.01)';\n body.style.backgroundImage = '';\n setTimeout(function() {\n body.style.backgroundColor = 'transparent';\n }, 1);\n if (body.parentNode && body.parentNode.style) {\n body.parentNode.style.backgroundColor = 'transparent';\n body.parentNode.style.backgroundImage = '';\n }\n }\n}\n\nfunction errorCallback(callback) {\n if (!callback) {\n return null;\n }\n return function(error) {\n var errorCode = parseInt(error);\n var QRScannerError = {};\n switch (errorCode) {\n case 0:\n QRScannerError = {\n name: 'UNEXPECTED_ERROR',\n code: 0,\n _message: 'QRScanner experienced an unexpected error.'\n };\n break;\n case 1:\n QRScannerError = {\n name: 'CAMERA_ACCESS_DENIED',\n code: 1,\n _message: 'The user denied camera access.'\n };\n break;\n case 2:\n QRScannerError = {\n name: 'CAMERA_ACCESS_RESTRICTED',\n code: 2,\n _message: 'Camera access is restricted.'\n };\n break;\n case 3:\n QRScannerError = {\n name: 'BACK_CAMERA_UNAVAILABLE',\n code: 3,\n _message: 'The back camera is unavailable.'\n };\n break;\n case 4:\n QRScannerError = {\n name: 'FRONT_CAMERA_UNAVAILABLE',\n code: 4,\n _message: 'The front camera is unavailable.'\n };\n break;\n case 5:\n QRScannerError = {\n name: 'CAMERA_UNAVAILABLE',\n code: 5,\n _message: 'The camera is unavailable.'\n };\n break;\n case 6:\n QRScannerError = {\n name: 'SCAN_CANCELED',\n code: 6,\n _message: 'Scan was canceled.'\n };\n break;\n case 7:\n QRScannerError = {\n name: 'LIGHT_UNAVAILABLE',\n code: 7,\n _message: 'The device light is unavailable.'\n };\n break;\n case 8:\n // Open settings is only available on iOS 8.0+.\n QRScannerError = {\n name: 'OPEN_SETTINGS_UNAVAILABLE',\n code: 8,\n _message: 'The device is unable to open settings.'\n };\n break;\n default:\n QRScannerError = {\n name: 'UNEXPECTED_ERROR',\n code: 0,\n _message: 'QRScanner returned an invalid error code.'\n };\n break;\n }\n callback(QRScannerError);\n };\n}\n\nfunction successCallback(callback) {\n if (!callback) {\n return null;\n }\n return function(statusDict) {\n callback(null, convertStatus(statusDict));\n };\n}\n\nfunction doneCallback(callback, clear) {\n if (!callback) {\n return null;\n }\n return function(statusDict) {\n if (clear) {\n clearBackground();\n }\n callback(convertStatus(statusDict));\n };\n}\n\nreturn {\n prepare: function(callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'prepare', []);\n },\n destroy: function(callback) {\n cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'destroy', []);\n },\n scan: function(callback) {\n if (!callback) {\n throw new Error('No callback provided to scan method.');\n }\n var success = function(result) {\n callback(null, result);\n };\n cordova.exec(success, errorCallback(callback), 'QRScanner', 'scan', []);\n },\n cancelScan: function(callback) {\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'cancelScan', []);\n },\n show: function(callback) {\n cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'show', []);\n },\n hide: function(callback) {\n cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'hide', []);\n },\n pausePreview: function(callback) {\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'pausePreview', []);\n },\n resumePreview: function(callback) {\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'resumePreview', []);\n },\n enableLight: function(callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'enableLight', []);\n },\n disableLight: function(callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'disableLight', []);\n },\n useCamera: function(index, callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'useCamera', [index]);\n },\n useFrontCamera: function(callback) {\n var frontCamera = 1;\n if (callback) {\n this.useCamera(frontCamera, callback);\n } else {\n cordova.exec(null, null, 'QRScanner', 'useCamera', [frontCamera]);\n }\n },\n useBackCamera: function(callback) {\n var backCamera = 0;\n if (callback) {\n this.useCamera(backCamera, callback);\n } else {\n cordova.exec(null, null, 'QRScanner', 'useCamera', [backCamera]);\n }\n },\n openSettings: function(callback) {\n if (callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'openSettings', []);\n } else {\n cordova.exec(null, null, 'QRScanner', 'openSettings', []);\n }\n },\n getStatus: function(callback) {\n if (!callback) {\n throw new Error('No callback provided to getStatus method.');\n }\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'getStatus', []);\n }\n};\n};\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\nmodule.exports = \"!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,\\\"a\\\",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p=\\\"\\\",e(e.s=19)}([function(t,e,n){\\\"use strict\\\";function i(){this.imagedata=null,this.width=0,this.height=0,this.qrCodeSymbol=null,this.debug=!1,this.callback=null}function r(t,e){return t>=0?t>>e:(t>>e)+(2<<~e)}n.d(e,\\\"b\\\",function(){return s}),e.a=i,e.c=r;var o=n(14),a=n(13),s={};s.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],i.prototype.decode=function(t,e){var n=function(){try{this.error=void 0,this.result=this.process(this.imagedata)}catch(t){this.error=t,this.result=void 0}return null!=this.callback&&this.callback(this.error,this.result),this.result}.bind(this);if(void 0!=t&&void 0!=t.width)this.width=t.width,this.height=t.height,this.imagedata={data:e||t.data},this.imagedata.width=t.width,this.imagedata.height=t.height,n();else{if(\\\"undefined\\\"==typeof Image)throw new Error(\\\"This source format is not supported in your environment, you need to pass an image buffer with width and height (see https://github.com/edi9999/jsqrcode/blob/master/test/qrcode.js)\\\");var i=new Image;i.crossOrigin=\\\"Anonymous\\\",i.onload=function(){var t=document.createElement(\\\"canvas\\\"),e=t.getContext(\\\"2d\\\"),r=document.getElementById(\\\"out-canvas\\\");if(null!=r){var o=r.getContext(\\\"2d\\\");o.clearRect(0,0,320,240),o.drawImage(i,0,0,320,240)}t.width=i.width,t.height=i.height,e.drawImage(i,0,0),this.width=i.width,this.height=i.height;try{this.imagedata=e.getImageData(0,0,i.width,i.height)}catch(t){if(this.result=\\\"Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!\\\",null!=this.callback)return this.callback(null,this.result)}n()}.bind(this),i.src=t}},i.prototype.decode_utf8=function(t){return decodeURIComponent(escape(t))},i.prototype.process=function(t){for(var e=(new Date).getTime(),n=this.grayScaleToBitmap(this.grayscale(t)),i=new o.a(n),r=i.detect(),s=a.a.decode(r.bits),h=s.DataByte,f=\\\"\\\",w=0;wi[s][a][1]&&(i[s][a][1]=w)}}for(var u=new Array(4),l=0;l<4;l++)u[l]=new Array(4);for(var a=0;a<4;a++)for(var s=0;s<4;s++)u[s][a]=Math.floor((i[s][a][0]+i[s][a][1])/2);return u},i.prototype.grayScaleToBitmap=function(t){for(var e=this.getMiddleBrightnessPerArea(t),n=e.length,i=Math.floor(t.width/n),r=Math.floor(t.height/n),o=0;o>5;0!=(31&t)&&n++,this.rowSize=n,this.bits=new Array(n*e);for(var i=0;i>5);return 0!=(1&n.i(r.c)(this.bits[i],31&t))},i.prototype.set_Renamed=function(t,e){var n=e*this.rowSize+(t>>5);this.bits[n]|=1<<(31&t)},i.prototype.flip=function(t,e){var n=e*this.rowSize+(t>>5);this.bits[n]^=1<<(31&t)},i.prototype.clear=function(){for(var t=this.bits.length,e=0;ethis.height||r>this.width)throw\\\"The region must fit inside the matrix\\\";for(var a=e;a>5)]|=1<<(31&h)}},function(t,e,n){\\\"use strict\\\";function i(t){this.errorCorrectionLevel=o.a.forBits(t>>3&3),this.dataMask=7&t}e.a=i;var r=n(0),o=n(15),a=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],s=[0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4];i.prototype.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|this.dataMask},i.prototype.Equals=function(t){var e=t;return this.errorCorrectionLevel==e.errorCorrectionLevel&&this.dataMask==e.dataMask},i.numBitsDiffering=function(t,e){return t^=e,s[15&t]+s[15&n.i(r.c)(t,4)]+s[15&n.i(r.c)(t,8)]+s[15&n.i(r.c)(t,12)]+s[15&n.i(r.c)(t,16)]+s[15&n.i(r.c)(t,20)]+s[15&n.i(r.c)(t,24)]+s[15&n.i(r.c)(t,28)]},i.decodeFormatInformation=function(t){var e=i.doDecodeFormatInformation(t);return null!=e?e:i.doDecodeFormatInformation(21522^t)},i.doDecodeFormatInformation=function(t){for(var e=4294967295,n=0,r=0;r=256&&(e^=t);for(var n=0;n<255;n++)this.logTable[this.expTable[n]]=n;var i=new Array(1);i[0]=0,this.zero=new r.a(this,new Array(i));var o=new Array(1);o[0]=1,this.one=new r.a(this,new Array(o))}e.a=i;var r=n(4);Object.defineProperty(i.prototype,\\\"Zero\\\",{get:function(){return this.zero}}),Object.defineProperty(i.prototype,\\\"One\\\",{get:function(){return this.one}}),i.prototype.buildMonomial=function(t,e){if(t<0)throw\\\"System.ArgumentException\\\";if(0==e)return this.zero;for(var n=new Array(t+1),i=0;i1&&0==e[0]){for(var i=1;in.length){var r=e;e=n,n=r}for(var o=new Array(n.length),a=n.length-e.length,s=0;s=t.Degree&&!n.Zero;){var o=n.Degree-t.Degree,a=this.field.multiply(n.getCoefficient(n.Degree),r),s=t.multiplyByMonomial(o,a),h=this.field.buildMonomial(o,a);e=e.addOrSubtract(h),n=n.addOrSubtract(s)}return[e,n]}},function(t,e,n){\\\"use strict\\\";function i(t,e){this.count=t,this.dataCodewords=e}function r(t,e,n){this.ecCodewordsPerBlock=t,this.ecBlocks=n?[e,n]:[e]}function o(t,e,n,i,r,o){this.versionNumber=t,this.alignmentPatternCenters=e,this.ecBlocks=[n,i,r,o];for(var a=0,s=n.ecCodewordsPerBlock,h=n.getECBlocks(),f=0;f6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e},o.prototype.getECBlocksForLevel=function(t){return this.ecBlocks[t.ordinal()]},o.VERSION_DECODE_INFO=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017],o.VERSIONS=function(){return[new o(1,[],new r(7,new i(1,19)),new r(10,new i(1,16)),new r(13,new i(1,13)),new r(17,new i(1,9))),new o(2,[6,18],new r(10,new i(1,34)),new r(16,new i(1,28)),new r(22,new i(1,22)),new r(28,new i(1,16))),new o(3,[6,22],new r(15,new i(1,55)),new r(26,new i(1,44)),new r(18,new i(2,17)),new r(22,new i(2,13))),new o(4,[6,26],new r(20,new i(1,80)),new r(18,new i(2,32)),new r(26,new i(2,24)),new r(16,new i(4,9))),new o(5,[6,30],new r(26,new i(1,108)),new r(24,new i(2,43)),new r(18,new i(2,15),new i(2,16)),new r(22,new i(2,11),new i(2,12))),new o(6,[6,34],new r(18,new i(2,68)),new r(16,new i(4,27)),new r(24,new i(4,19)),new r(28,new i(4,15))),new o(7,[6,22,38],new r(20,new i(2,78)),new r(18,new i(4,31)),new r(18,new i(2,14),new i(4,15)),new r(26,new i(4,13),new i(1,14))),new o(8,[6,24,42],new r(24,new i(2,97)),new r(22,new i(2,38),new i(2,39)),new r(22,new i(4,18),new i(2,19)),new r(26,new i(4,14),new i(2,15))),new o(9,[6,26,46],new r(30,new i(2,116)),new r(22,new i(3,36),new i(2,37)),new r(20,new i(4,16),new i(4,17)),new r(24,new i(4,12),new i(4,13))),new o(10,[6,28,50],new r(18,new i(2,68),new i(2,69)),new r(26,new i(4,43),new i(1,44)),new r(24,new i(6,19),new i(2,20)),new r(28,new i(6,15),new i(2,16))),new o(11,[6,30,54],new r(20,new i(4,81)),new r(30,new i(1,50),new i(4,51)),new r(28,new i(4,22),new i(4,23)),new r(24,new i(3,12),new i(8,13))),new o(12,[6,32,58],new r(24,new i(2,92),new i(2,93)),new r(22,new i(6,36),new i(2,37)),new r(26,new i(4,20),new i(6,21)),new r(28,new i(7,14),new i(4,15))),new o(13,[6,34,62],new r(26,new i(4,107)),new r(22,new i(8,37),new i(1,38)),new r(24,new i(8,20),new i(4,21)),new r(22,new i(12,11),new i(4,12))),new o(14,[6,26,46,66],new r(30,new i(3,115),new i(1,116)),new r(24,new i(4,40),new i(5,41)),new r(20,new i(11,16),new i(5,17)),new r(24,new i(11,12),new i(5,13))),new o(15,[6,26,48,70],new r(22,new i(5,87),new i(1,88)),new r(24,new i(5,41),new i(5,42)),new r(30,new i(5,24),new i(7,25)),new r(24,new i(11,12),new i(7,13))),new o(16,[6,26,50,74],new r(24,new i(5,98),new i(1,99)),new r(28,new i(7,45),new i(3,46)),new r(24,new i(15,19),new i(2,20)),new r(30,new i(3,15),new i(13,16))),new o(17,[6,30,54,78],new r(28,new i(1,107),new i(5,108)),new r(28,new i(10,46),new i(1,47)),new r(28,new i(1,22),new i(15,23)),new r(28,new i(2,14),new i(17,15))),new o(18,[6,30,56,82],new r(30,new i(5,120),new i(1,121)),new r(26,new i(9,43),new i(4,44)),new r(28,new i(17,22),new i(1,23)),new r(28,new i(2,14),new i(19,15))),new o(19,[6,30,58,86],new r(28,new i(3,113),new i(4,114)),new r(26,new i(3,44),new i(11,45)),new r(26,new i(17,21),new i(4,22)),new r(26,new i(9,13),new i(16,14))),new o(20,[6,34,62,90],new r(28,new i(3,107),new i(5,108)),new r(26,new i(3,41),new i(13,42)),new r(30,new i(15,24),new i(5,25)),new r(28,new i(15,15),new i(10,16))),new o(21,[6,28,50,72,94],new r(28,new i(4,116),new i(4,117)),new r(26,new i(17,42)),new r(28,new i(17,22),new i(6,23)),new r(30,new i(19,16),new i(6,17))),new o(22,[6,26,50,74,98],new r(28,new i(2,111),new i(7,112)),new r(28,new i(17,46)),new r(30,new i(7,24),new i(16,25)),new r(24,new i(34,13))),new o(23,[6,30,54,74,102],new r(30,new i(4,121),new i(5,122)),new r(28,new i(4,47),new i(14,48)),new r(30,new i(11,24),new i(14,25)),new r(30,new i(16,15),new i(14,16))),new o(24,[6,28,54,80,106],new r(30,new i(6,117),new i(4,118)),new r(28,new i(6,45),new i(14,46)),new r(30,new i(11,24),new i(16,25)),new r(30,new i(30,16),new i(2,17))),new o(25,[6,32,58,84,110],new r(26,new i(8,106),new i(4,107)),new r(28,new i(8,47),new i(13,48)),new r(30,new i(7,24),new i(22,25)),new r(30,new i(22,15),new i(13,16))),new o(26,[6,30,58,86,114],new r(28,new i(10,114),new i(2,115)),new r(28,new i(19,46),new i(4,47)),new r(28,new i(28,22),new i(6,23)),new r(30,new i(33,16),new i(4,17))),new o(27,[6,34,62,90,118],new r(30,new i(8,122),new i(4,123)),new r(28,new i(22,45),new i(3,46)),new r(30,new i(8,23),new i(26,24)),new r(30,new i(12,15),new i(28,16))),new o(28,[6,26,50,74,98,122],new r(30,new i(3,117),new i(10,118)),new r(28,new i(3,45),new i(23,46)),new r(30,new i(4,24),new i(31,25)),new r(30,new i(11,15),new i(31,16))),new o(29,[6,30,54,78,102,126],new r(30,new i(7,116),new i(7,117)),new r(28,new i(21,45),new i(7,46)),new r(30,new i(1,23),new i(37,24)),new r(30,new i(19,15),new i(26,16))),new o(30,[6,26,52,78,104,130],new r(30,new i(5,115),new i(10,116)),new r(28,new i(19,47),new i(10,48)),new r(30,new i(15,24),new i(25,25)),new r(30,new i(23,15),new i(25,16))),new o(31,[6,30,56,82,108,134],new r(30,new i(13,115),new i(3,116)),new r(28,new i(2,46),new i(29,47)),new r(30,new i(42,24),new i(1,25)),new r(30,new i(23,15),new i(28,16))),new o(32,[6,34,60,86,112,138],new r(30,new i(17,115)),new r(28,new i(10,46),new i(23,47)),new r(30,new i(10,24),new i(35,25)),new r(30,new i(19,15),new i(35,16))),new o(33,[6,30,58,86,114,142],new r(30,new i(17,115),new i(1,116)),new r(28,new i(14,46),new i(21,47)),new r(30,new i(29,24),new i(19,25)),new r(30,new i(11,15),new i(46,16))),new o(34,[6,34,62,90,118,146],new r(30,new i(13,115),new i(6,116)),new r(28,new i(14,46),new i(23,47)),new r(30,new i(44,24),new i(7,25)),new r(30,new i(59,16),new i(1,17))),new o(35,[6,30,54,78,102,126,150],new r(30,new i(12,121),new i(7,122)),new r(28,new i(12,47),new i(26,48)),new r(30,new i(39,24),new i(14,25)),new r(30,new i(22,15),new i(41,16))),new o(36,[6,24,50,76,102,128,154],new r(30,new i(6,121),new i(14,122)),new r(28,new i(6,47),new i(34,48)),new r(30,new i(46,24),new i(10,25)),new r(30,new i(2,15),new i(64,16))),new o(37,[6,28,54,80,106,132,158],new r(30,new i(17,122),new i(4,123)),new r(28,new i(29,46),new i(14,47)),new r(30,new i(49,24),new i(10,25)),new r(30,new i(24,15),new i(46,16))),new o(38,[6,32,58,84,110,136,162],new r(30,new i(4,122),new i(18,123)),new r(28,new i(13,46),new i(32,47)),new r(30,new i(48,24),new i(14,25)),new r(30,new i(42,15),new i(32,16))),new o(39,[6,26,54,82,110,138,166],new r(30,new i(20,117),new i(4,118)),new r(28,new i(40,47),new i(7,48)),new r(30,new i(43,24),new i(22,25)),new r(30,new i(10,15),new i(67,16))),new o(40,[6,30,58,86,114,142,170],new r(30,new i(19,118),new i(6,119)),new r(28,new i(18,47),new i(31,48)),new r(30,new i(34,24),new i(34,25)),new r(30,new i(20,15),new i(61,16)))]}(),o.getVersionForNumber=function(t){if(t<1||t>40)throw\\\"ArgumentException\\\";return o.VERSIONS[t-1]},o.getProvisionalVersionForDimension=function(t){if(t%4!=1)throw\\\"Error getProvisionalVersionForDimension\\\";try{return o.getVersionForNumber(t-17>>2)}catch(t){throw\\\"Error getVersionForNumber\\\"}},o.decodeVersionInformation=function(t){for(var e=4294967295,n=0,i=0;i=n)return!1;return!0},r.prototype.crossCheckVertical=function(t,e,n,i){var r=this.image,o=r.height,a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;for(var s=t;s>=0&&r.data[e+s*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&!r.data[e+s*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;sn)return NaN;for(;sn)return NaN;var h=a[0]+a[1]+a[2];return 5*Math.abs(h-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},r.prototype.handlePossibleCenter=function(t,e,n){var r=t[0]+t[1]+t[2],o=this.centerFromEnd(t,n),a=this.crossCheckVertical(e,Math.floor(o),2*t[1],r);if(!isNaN(a)){for(var s=(t[0]+t[1]+t[2])/3,h=this.possibleCenters.length,f=0;f>1),o=[0,0,0],a=0;a>1:-(a+1>>1));o[0]=0,o[1]=0,o[2]=0;for(var h=e;h=0;n--)t=this.copyBit(8,n,t);if(this.parsedFormatInfo=r.a.decodeFormatInformation(t),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var i=this.bitMatrix.Dimension;t=0;for(var o=i-8,e=i-1;e>=o;e--)t=this.copyBit(e,8,t);for(var n=i-7;n>2;if(e<=6)return o.a.getVersionForNumber(e);for(var n=0,i=t-11,r=5;r>=0;r--)for(var a=t-9;a>=i;a--)n=this.copyBit(a,r,n);if(this.parsedVersion=o.a.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==t)return this.parsedVersion;n=0;for(var a=5;a>=0;a--)for(var r=t-9;r>=i;r--)n=this.copyBit(a,r,n);if(this.parsedVersion=o.a.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==t)return this.parsedVersion;throw\\\"Error readVersion\\\"},i.prototype.readCodewords=function(){var t=this.readFormatInformation(),e=this.readVersion(),n=a.a.forReference(t.dataMask),i=this.bitMatrix.Dimension;n.unmaskBitMatrix(this.bitMatrix,i);for(var r=e.buildFunctionPattern(),o=!0,s=new Array(e.totalCodewords),h=0,f=0,w=0,u=i-1;u>0;u-=2){6==u&&u--;for(var l=0;l=0;){if(h[p].codewords.length==d)break;p--}p++;for(var g=d-r.ecCodewordsPerBlock,v=0,s=0;s=10&&e<=26?this.dataLengthMode=1:e>=27&&e<=40&&(this.dataLengthMode=2)}e.a=i;var r=n(0);i.prototype.getNextBits=function(t){var e=0;if(t>this.bitPointer-t+1,this.bitPointer-=t,e}if(t>8-(t-(this.bitPointer+1)),this.bitPointer=this.bitPointer-t%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),e}if(t>8-(t-(this.bitPointer+1+8))),this.bitPointer=this.bitPointer-(t-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),e}return 0},i.prototype.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},i.prototype.getDataLength=function(t){for(var e=0;;){if(t>>e==1)break;e++}return this.getNextBits(r.b.sizeOfDataLengthInfo[this.dataLengthMode][e])},i.prototype.getRomanAndFigureString=function(t){var e=t,n=0,i=\\\"\\\",r=[\\\"0\\\",\\\"1\\\",\\\"2\\\",\\\"3\\\",\\\"4\\\",\\\"5\\\",\\\"6\\\",\\\"7\\\",\\\"8\\\",\\\"9\\\",\\\"A\\\",\\\"B\\\",\\\"C\\\",\\\"D\\\",\\\"E\\\",\\\"F\\\",\\\"G\\\",\\\"H\\\",\\\"I\\\",\\\"J\\\",\\\"K\\\",\\\"L\\\",\\\"M\\\",\\\"N\\\",\\\"O\\\",\\\"P\\\",\\\"Q\\\",\\\"R\\\",\\\"S\\\",\\\"T\\\",\\\"U\\\",\\\"V\\\",\\\"W\\\",\\\"X\\\",\\\"Y\\\",\\\"Z\\\",\\\" \\\",\\\"$\\\",\\\"%\\\",\\\"*\\\",\\\"+\\\",\\\"-\\\",\\\".\\\",\\\"/\\\",\\\":\\\"];do{if(e>1){n=this.getNextBits(11);var o=Math.floor(n/45),a=n%45;i+=r[o],i+=r[a],e-=2}else 1==e&&(n=this.getNextBits(6),i+=r[n],e-=1)}while(e>0);return i},i.prototype.getFigureString=function(t){var e=t,n=0,i=\\\"\\\";do{e>=3?(n=this.getNextBits(10),n<100&&(i+=\\\"0\\\"),n<10&&(i+=\\\"0\\\"),e-=3):2==e?(n=this.getNextBits(7),n<10&&(i+=\\\"0\\\"),e-=2):1==e&&(n=this.getNextBits(4),e-=1),i+=n}while(e>0);return i},i.prototype.get8bitByteArray=function(t){var e=t,n=0,i=[];do{n=this.getNextBits(8),i.push(n),e--}while(e>0);return i},i.prototype.getKanjiString=function(t){var e=t,n=0,i=\\\"\\\";do{n=this.getNextBits(13);var r=n%192,o=n/192,a=(o<<8)+r,s=0;s=a+33088<=40956?a+33088:a+49472,i+=String.fromCharCode(s),e--}while(e>0);return i},Object.defineProperty(i.prototype,\\\"DataByte\\\",{get:function(){for(var t=[];;){var e=this.NextMode();if(0==e){if(t.length>0)break;throw\\\"Empty data block\\\"}if(1!=e&&2!=e&&4!=e&&8!=e&&7!=e)throw\\\"Invalid mode: \\\"+e+\\\" in (block:\\\"+this.blockPointer+\\\" bit:\\\"+this.bitPointer+\\\")\\\";var n=this.getDataLength(e);if(n<1)throw\\\"Invalid data length: \\\"+n;switch(e){case 1:for(var i=this.getFigureString(n),r=new Array(i.length),o=0;o7)throw\\\"System.ArgumentException\\\";return l.DATA_MASKS[t]},l.DATA_MASKS=[new i,new r,new o,new a,new s,new h,new f,new w],e.a=l},function(t,e,n){\\\"use strict\\\";var i=n(18),r=n(3),o=n(9),a=n(10),s=n(11),h={};h.rsDecoder=new i.a(r.a.QR_CODE_FIELD),h.correctErrors=function(t,e){for(var n=t.length,i=new Array(n),r=0;rMath.abs(n-t);if(r){var o=t;t=e,e=o,o=n,n=i,i=o}for(var a=Math.abs(n-t),s=Math.abs(i-e),h=-a>>1,f=e0){if(c==i)break;c+=f,h-=a}}var m=n-t,b=i-e;return Math.sqrt(m*m+b*b)},o.prototype.sizeOfBlackWhiteBlackRunBothWays=function(t,e,n,i){var r=this.sizeOfBlackWhiteBlackRun(t,e,n,i),o=1,a=t-(n-t);a<0?(o=t/(t-a),a=0):a>=this.image.width&&(o=(this.image.width-1-t)/(a-t),a=this.image.width-1);var s=Math.floor(e-(i-e)*o);return o=1,s<0?(o=e/(e-s),s=0):s>=this.image.height&&(o=(this.image.height-1-e)/(s-e),s=this.image.height-1),a=Math.floor(t+(a-t)*o),(r+=this.sizeOfBlackWhiteBlackRun(t,e,a,s))-1},o.prototype.calculateModuleSizeOneWay=function(t,e){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y)),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},o.prototype.calculateModuleSize=function(t,e,n){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,n))/2},o.prototype.distance=function(t,e){var n=t.X-e.X,i=t.Y-e.Y;return Math.sqrt(n*n+i*i)},o.prototype.computeDimension=function(t,e,n,i){var r=Math.round(this.distance(t,e)/i),o=Math.round(this.distance(t,n)/i),a=7+(r+o>>1);switch(3&a){case 0:a++;break;case 2:a--;break;case 3:throw\\\"Error\\\"}return a},o.prototype.findAlignmentInRegion=function(t,e,n,i){var r=Math.floor(i*t),o=Math.max(0,e-r),a=Math.min(this.image.width-1,e+r);if(a-o<3*t)throw\\\"Error\\\";var h=Math.max(0,n-r),f=Math.min(this.image.height-1,n+r);return new s.a(this.image,o,h,a-o,f-h,t,this.resultPointCallback).find()},o.prototype.createTransform=function(t,e,n,r,o){var a,s,h,f,w=o-3.5;return null!=r?(a=r.X,s=r.Y,h=f=w-3):(a=e.X-t.X+n.X,s=e.Y-t.Y+n.Y,h=f=w),i.quadrilateralToQuadrilateral(3.5,3.5,w,3.5,h,f,3.5,w,t.X,t.Y,e.X,e.Y,a,s,n.X,n.Y)},o.prototype.sampleGrid=function(t,e,n){return h.a.sampleGrid3(t,n,e)},o.prototype.processFinderPatternInfo=function(t){var e=t.topLeft,n=t.topRight,i=t.bottomLeft,o=this.calculateModuleSize(e,n,i);if(o<1)throw\\\"Error\\\";var s=this.computeDimension(e,n,i,o),h=a.a.getProvisionalVersionForDimension(s),f=h.DimensionForVersion-7,w=null;if(h.alignmentPatternCenters.length>0)for(var u=n.X-e.X+i.X,l=n.Y-e.Y+i.Y,c=1-3/f,d=Math.floor(e.X+c*(u-e.X)),p=Math.floor(e.Y+c*(l-e.Y)),g=4;g<=16;g<<=1){w=this.findAlignmentInRegion(o,d,p,g);break}var v,m=this.createTransform(e,n,i,w,s),b=this.sampleGrid(this.image,m,s);return v=null==w?[i,e,n]:[i,e,n,w],new r(b,v)},o.prototype.detect=function(){var t=(new f.a).findFinderPattern(this.image);return this.processFinderPatternInfo(t)}},function(t,e,n){\\\"use strict\\\";function i(t,e,n){this.ordinal_Renamed_Field=t,this.bits=e,this.name=n}e.a=i,i.prototype.ordinal=function(){return this.ordinal_Renamed_Field},i.forBits=function(t){if(t<0||t>=r.length)throw\\\"ArgumentException\\\";return r[t]};var r=[new i(1,0,\\\"M\\\"),new i(0,1,\\\"L\\\"),new i(3,2,\\\"H\\\"),new i(2,3,\\\"Q\\\")]},function(t,e,n){\\\"use strict\\\";function i(t){function e(t,e){var n=t.X-e.X,i=t.Y-e.Y;return Math.sqrt(n*n+i*i)}var n,i,r,o=e(t[0],t[1]),a=e(t[1],t[2]),s=e(t[0],t[2]);if(a>=o&&a>=s?(i=t[0],n=t[1],r=t[2]):s>=a&&s>=o?(i=t[1],n=t[0],r=t[2]):(i=t[2],n=t[0],r=t[1]),function(t,e,n){var i=e.x,r=e.y;return(n.x-i)*(t.y-r)-(n.y-r)*(t.x-i)}(n,i,r)<0){var h=n;n=r,r=h}t[0]=n,t[1]=i,t[2]=r}function r(t,e,n){this.x=t,this.y=e,this.count=1,this.estimatedModuleSize=n}function o(t){this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}function a(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=[0,0,0,0,0],this.resultPointCallback=null}e.a=a;Object.defineProperty(r.prototype,\\\"X\\\",{get:function(){return this.x}}),Object.defineProperty(r.prototype,\\\"Y\\\",{get:function(){return this.y}}),r.prototype.incrementCount=function(){this.count++},r.prototype.aboutEquals=function(t,e,n){if(Math.abs(e-this.y)<=t&&Math.abs(n-this.x)<=t){var i=Math.abs(t-this.estimatedModuleSize);return i<=1||i/this.estimatedModuleSize<=1}return!1},Object.defineProperty(a.prototype,\\\"CrossCheckStateCount\\\",{get:function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}}),a.prototype.foundPatternCross=function(t){for(var e=0,n=0;n<5;n++){var i=t[n];if(0==i)return!1;e+=i}if(e<7)return!1;var r=Math.floor((e<<8)/7),o=Math.floor(r/2);return Math.abs(r-(t[0]<<8))=0&&r.data[e+s*r.width];)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!r.data[e+s*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&r.data[e+s*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s=n)return NaN;for(;s=n)return NaN;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},a.prototype.crossCheckHorizontal=function(t,e,n,i){for(var r=this.image,o=r.width,a=this.CrossCheckStateCount,s=t;s>=0&&r.data[s+e*r.width];)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!r.data[s+e*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&r.data[s+e*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s=n)return NaN;for(;s=n)return NaN;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-i)>=i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},a.prototype.handlePossibleCenter=function(t,e,n){var i=t[0]+t[1]+t[2]+t[3]+t[4],o=this.centerFromEnd(t,n),a=this.crossCheckVertical(e,Math.floor(o),t[2],i);if(!isNaN(a)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(a),t[2],i),!isNaN(o))){for(var s=i/7,h=!1,f=this.possibleCenters.length,w=0;w3){for(var e=0,n=0,i=0;i=0;i--){var h=this.possibleCenters[i];Math.abs(h.estimatedModuleSize-o)>s&&this.possibleCenters.splice(i,1)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(t,e){return t.count>e.count?-1:t.count=2){if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.X-i.X)-Math.abs(e.Y-i.Y))/2);e=i}}return 0},a.prototype.haveMultiplyConfirmedCenters=function(){for(var t=0,e=0,n=this.possibleCenters.length,i=0;i=2&&(t++,e+=r.estimatedModuleSize)}if(t<3)return!1;for(var o=e/n,a=0,i=0;is[2]&&(h+=l-s[2]-r,w=n-1)}else{do{w++}while(wn||s<-1||s>i)throw\\\"Error.checkAndNudgePoints \\\";r=!1,-1==a?(e[o]=0,r=!0):a==n&&(e[o]=n-1,r=!0),-1==s?(e[o+1]=0,r=!0):s==i&&(e[o+1]=i-1,r=!0)}r=!0;for(var o=e.length-2;o>=0&&r;o-=2){var a=Math.floor(e[o]),s=Math.floor(e[o+1]);if(a<-1||a>n||s<-1||s>i)throw\\\"Error.checkAndNudgePoints \\\";r=!1,-1==a?(e[o]=0,r=!0):a==n&&(e[o]=n-1,r=!0),-1==s?(e[o+1]=0,r=!0):s==i&&(e[o+1]=i-1,r=!0)}},r.sampleGrid3=function(t,e,n){for(var o=new i.a(e),a=new Array(e<<1),s=0;s>1),a[w+1]=f;n.transformPoints1(a),r.checkAndNudgePoints(t,a);try{for(var w=0;w>1,s)}}catch(t){throw\\\"Error.checkAndNudgePoints\\\"}}return o},e.a=r},function(t,e,n){\\\"use strict\\\";function i(t){this.field=t}e.a=i;var r=n(3),o=n(4);i.prototype.decode=function(t,e){for(var n=new o.a(this.field,t),i=new Array(e),a=0;a=Math.floor(n/2);){var w=r,u=a,l=h;if(r=o,a=s,h=f,r.Zero)throw\\\"r_{i-1} was zero\\\";o=w;for(var c=this.field.Zero,d=r.getCoefficient(r.Degree),p=this.field.inverse(d);o.Degree>=r.Degree&&!o.Zero;){var g=o.Degree-r.Degree,v=this.field.multiply(o.getCoefficient(o.Degree),p);c=c.addOrSubtract(this.field.buildMonomial(g,v)),o=o.addOrSubtract(r.multiplyByMonomial(g,v))}s=c.multiply1(a).addOrSubtract(u),f=c.multiply1(h).addOrSubtract(l)}var m=f.getCoefficient(0);if(0==m)throw\\\"ReedSolomonException sigmaTilde(0) was zero\\\";var b=this.field.inverse(m);return[f.multiply2(b),o.multiply2(b)]},i.prototype.findErrorLocations=function(t){var e=t.Degree;if(1==e)return new Array(t.getCoefficient(1));for(var n=new Array(e),i=0,r=1;r<256&&i 0 ? 'm=' + part : part).trim() + '\\r\\n';\n });\n};\n\n// Returns lines that start with a certain prefix.\nSDPUtils.matchPrefix = function(blob, prefix) {\n return SDPUtils.splitLines(blob).filter(function(line) {\n return line.indexOf(prefix) === 0;\n });\n};\n\n// Parses an ICE candidate line. Sample input:\n// candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8\n// rport 55996\"\nSDPUtils.parseCandidate = function(line) {\n var parts;\n // Parse both variants.\n if (line.indexOf('a=candidate:') === 0) {\n parts = line.substring(12).split(' ');\n } else {\n parts = line.substring(10).split(' ');\n }\n\n var candidate = {\n foundation: parts[0],\n component: parts[1],\n protocol: parts[2].toLowerCase(),\n priority: parseInt(parts[3], 10),\n ip: parts[4],\n port: parseInt(parts[5], 10),\n // skip parts[6] == 'typ'\n type: parts[7]\n };\n\n for (var i = 8; i < parts.length; i += 2) {\n switch (parts[i]) {\n case 'raddr':\n candidate.relatedAddress = parts[i + 1];\n break;\n case 'rport':\n candidate.relatedPort = parseInt(parts[i + 1], 10);\n break;\n case 'tcptype':\n candidate.tcpType = parts[i + 1];\n break;\n default: // extension handling, in particular ufrag\n candidate[parts[i]] = parts[i + 1];\n break;\n }\n }\n return candidate;\n};\n\n// Translates a candidate object into SDP candidate attribute.\nSDPUtils.writeCandidate = function(candidate) {\n var sdp = [];\n sdp.push(candidate.foundation);\n sdp.push(candidate.component);\n sdp.push(candidate.protocol.toUpperCase());\n sdp.push(candidate.priority);\n sdp.push(candidate.ip);\n sdp.push(candidate.port);\n\n var type = candidate.type;\n sdp.push('typ');\n sdp.push(type);\n if (type !== 'host' && candidate.relatedAddress &&\n candidate.relatedPort) {\n sdp.push('raddr');\n sdp.push(candidate.relatedAddress); // was: relAddr\n sdp.push('rport');\n sdp.push(candidate.relatedPort); // was: relPort\n }\n if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {\n sdp.push('tcptype');\n sdp.push(candidate.tcpType);\n }\n return 'candidate:' + sdp.join(' ');\n};\n\n// Parses an ice-options line, returns an array of option tags.\n// a=ice-options:foo bar\nSDPUtils.parseIceOptions = function(line) {\n return line.substr(14).split(' ');\n}\n\n// Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input:\n// a=rtpmap:111 opus/48000/2\nSDPUtils.parseRtpMap = function(line) {\n var parts = line.substr(9).split(' ');\n var parsed = {\n payloadType: parseInt(parts.shift(), 10) // was: id\n };\n\n parts = parts[0].split('/');\n\n parsed.name = parts[0];\n parsed.clockRate = parseInt(parts[1], 10); // was: clockrate\n // was: channels\n parsed.numChannels = parts.length === 3 ? parseInt(parts[2], 10) : 1;\n return parsed;\n};\n\n// Generate an a=rtpmap line from RTCRtpCodecCapability or\n// RTCRtpCodecParameters.\nSDPUtils.writeRtpMap = function(codec) {\n var pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate +\n (codec.numChannels !== 1 ? '/' + codec.numChannels : '') + '\\r\\n';\n};\n\n// Parses an a=extmap line (headerextension from RFC 5285). Sample input:\n// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset\n// a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset\nSDPUtils.parseExtmap = function(line) {\n var parts = line.substr(9).split(' ');\n return {\n id: parseInt(parts[0], 10),\n direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',\n uri: parts[1]\n };\n};\n\n// Generates a=extmap line from RTCRtpHeaderExtensionParameters or\n// RTCRtpHeaderExtension.\nSDPUtils.writeExtmap = function(headerExtension) {\n return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) +\n (headerExtension.direction && headerExtension.direction !== 'sendrecv'\n ? '/' + headerExtension.direction\n : '') +\n ' ' + headerExtension.uri + '\\r\\n';\n};\n\n// Parses an ftmp line, returns dictionary. Sample input:\n// a=fmtp:96 vbr=on;cng=on\n// Also deals with vbr=on; cng=on\nSDPUtils.parseFmtp = function(line) {\n var parsed = {};\n var kv;\n var parts = line.substr(line.indexOf(' ') + 1).split(';');\n for (var j = 0; j < parts.length; j++) {\n kv = parts[j].trim().split('=');\n parsed[kv[0].trim()] = kv[1];\n }\n return parsed;\n};\n\n// Generates an a=ftmp line from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeFmtp = function(codec) {\n var line = '';\n var pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.parameters && Object.keys(codec.parameters).length) {\n var params = [];\n Object.keys(codec.parameters).forEach(function(param) {\n params.push(param + '=' + codec.parameters[param]);\n });\n line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\\r\\n';\n }\n return line;\n};\n\n// Parses an rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:\n// a=rtcp-fb:98 nack rpsi\nSDPUtils.parseRtcpFb = function(line) {\n var parts = line.substr(line.indexOf(' ') + 1).split(' ');\n return {\n type: parts.shift(),\n parameter: parts.join(' ')\n };\n};\n// Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeRtcpFb = function(codec) {\n var lines = '';\n var pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.rtcpFeedback && codec.rtcpFeedback.length) {\n // FIXME: special handling for trr-int?\n codec.rtcpFeedback.forEach(function(fb) {\n lines += 'a=rtcp-fb:' + pt + ' ' + fb.type +\n (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') +\n '\\r\\n';\n });\n }\n return lines;\n};\n\n// Parses an RFC 5576 ssrc media attribute. Sample input:\n// a=ssrc:3735928559 cname:something\nSDPUtils.parseSsrcMedia = function(line) {\n var sp = line.indexOf(' ');\n var parts = {\n ssrc: parseInt(line.substr(7, sp - 7), 10)\n };\n var colon = line.indexOf(':', sp);\n if (colon > -1) {\n parts.attribute = line.substr(sp + 1, colon - sp - 1);\n parts.value = line.substr(colon + 1);\n } else {\n parts.attribute = line.substr(sp + 1);\n }\n return parts;\n};\n\n// Extracts the MID (RFC 5888) from a media section.\n// returns the MID or undefined if no mid line was found.\nSDPUtils.getMid = function(mediaSection) {\n var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];\n if (mid) {\n return mid.substr(6);\n }\n}\n\nSDPUtils.parseFingerprint = function(line) {\n var parts = line.substr(14).split(' ');\n return {\n algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge.\n value: parts[1]\n };\n};\n\n// Extracts DTLS parameters from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the fingerprint line as input. See also getIceParameters.\nSDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {\n var lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=fingerprint:');\n // Note: a=setup line is ignored since we use the 'auto' role.\n // Note2: 'algorithm' is not case sensitive except in Edge.\n return {\n role: 'auto',\n fingerprints: lines.map(SDPUtils.parseFingerprint)\n };\n};\n\n// Serializes DTLS parameters to SDP.\nSDPUtils.writeDtlsParameters = function(params, setupType) {\n var sdp = 'a=setup:' + setupType + '\\r\\n';\n params.fingerprints.forEach(function(fp) {\n sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\\r\\n';\n });\n return sdp;\n};\n// Parses ICE information from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the ice-ufrag and ice-pwd lines as input.\nSDPUtils.getIceParameters = function(mediaSection, sessionpart) {\n var lines = SDPUtils.splitLines(mediaSection);\n // Search in session part, too.\n lines = lines.concat(SDPUtils.splitLines(sessionpart));\n var iceParameters = {\n usernameFragment: lines.filter(function(line) {\n return line.indexOf('a=ice-ufrag:') === 0;\n })[0].substr(12),\n password: lines.filter(function(line) {\n return line.indexOf('a=ice-pwd:') === 0;\n })[0].substr(10)\n };\n return iceParameters;\n};\n\n// Serializes ICE parameters to SDP.\nSDPUtils.writeIceParameters = function(params) {\n return 'a=ice-ufrag:' + params.usernameFragment + '\\r\\n' +\n 'a=ice-pwd:' + params.password + '\\r\\n';\n};\n\n// Parses the SDP media section and returns RTCRtpParameters.\nSDPUtils.parseRtpParameters = function(mediaSection) {\n var description = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: [],\n rtcp: []\n };\n var lines = SDPUtils.splitLines(mediaSection);\n var mline = lines[0].split(' ');\n for (var i = 3; i < mline.length; i++) { // find all codecs from mline[3..]\n var pt = mline[i];\n var rtpmapline = SDPUtils.matchPrefix(\n mediaSection, 'a=rtpmap:' + pt + ' ')[0];\n if (rtpmapline) {\n var codec = SDPUtils.parseRtpMap(rtpmapline);\n var fmtps = SDPUtils.matchPrefix(\n mediaSection, 'a=fmtp:' + pt + ' ');\n // Only the first a=fmtp: is considered.\n codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};\n codec.rtcpFeedback = SDPUtils.matchPrefix(\n mediaSection, 'a=rtcp-fb:' + pt + ' ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.push(codec);\n // parse FEC mechanisms from rtpmap lines.\n switch (codec.name.toUpperCase()) {\n case 'RED':\n case 'ULPFEC':\n description.fecMechanisms.push(codec.name.toUpperCase());\n break;\n default: // only RED and ULPFEC are recognized as FEC mechanisms.\n break;\n }\n }\n }\n SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function(line) {\n description.headerExtensions.push(SDPUtils.parseExtmap(line));\n });\n // FIXME: parse rtcp.\n return description;\n};\n\n// Generates parts of the SDP media section describing the capabilities /\n// parameters.\nSDPUtils.writeRtpDescription = function(kind, caps) {\n var sdp = '';\n\n // Build the mline.\n sdp += 'm=' + kind + ' ';\n sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.\n sdp += ' UDP/TLS/RTP/SAVPF ';\n sdp += caps.codecs.map(function(codec) {\n if (codec.preferredPayloadType !== undefined) {\n return codec.preferredPayloadType;\n }\n return codec.payloadType;\n }).join(' ') + '\\r\\n';\n\n sdp += 'c=IN IP4 0.0.0.0\\r\\n';\n sdp += 'a=rtcp:9 IN IP4 0.0.0.0\\r\\n';\n\n // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.\n caps.codecs.forEach(function(codec) {\n sdp += SDPUtils.writeRtpMap(codec);\n sdp += SDPUtils.writeFmtp(codec);\n sdp += SDPUtils.writeRtcpFb(codec);\n });\n var maxptime = 0;\n caps.codecs.forEach(function(codec) {\n if (codec.maxptime > maxptime) {\n maxptime = codec.maxptime;\n }\n });\n if (maxptime > 0) {\n sdp += 'a=maxptime:' + maxptime + '\\r\\n';\n }\n sdp += 'a=rtcp-mux\\r\\n';\n\n caps.headerExtensions.forEach(function(extension) {\n sdp += SDPUtils.writeExtmap(extension);\n });\n // FIXME: write fecMechanisms.\n return sdp;\n};\n\n// Parses the SDP media section and returns an array of\n// RTCRtpEncodingParameters.\nSDPUtils.parseRtpEncodingParameters = function(mediaSection) {\n var encodingParameters = [];\n var description = SDPUtils.parseRtpParameters(mediaSection);\n var hasRed = description.fecMechanisms.indexOf('RED') !== -1;\n var hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;\n\n // filter a=ssrc:... cname:, ignore PlanB-msid\n var ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(function(line) {\n return SDPUtils.parseSsrcMedia(line);\n })\n .filter(function(parts) {\n return parts.attribute === 'cname';\n });\n var primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;\n var secondarySsrc;\n\n var flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID')\n .map(function(line) {\n var parts = line.split(' ');\n parts.shift();\n return parts.map(function(part) {\n return parseInt(part, 10);\n });\n });\n if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {\n secondarySsrc = flows[0][1];\n }\n\n description.codecs.forEach(function(codec) {\n if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {\n var encParam = {\n ssrc: primarySsrc,\n codecPayloadType: parseInt(codec.parameters.apt, 10),\n rtx: {\n ssrc: secondarySsrc\n }\n };\n encodingParameters.push(encParam);\n if (hasRed) {\n encParam = JSON.parse(JSON.stringify(encParam));\n encParam.fec = {\n ssrc: secondarySsrc,\n mechanism: hasUlpfec ? 'red+ulpfec' : 'red'\n };\n encodingParameters.push(encParam);\n }\n }\n });\n if (encodingParameters.length === 0 && primarySsrc) {\n encodingParameters.push({\n ssrc: primarySsrc\n });\n }\n\n // we support both b=AS and b=TIAS but interpret AS as TIAS.\n var bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');\n if (bandwidth.length) {\n if (bandwidth[0].indexOf('b=TIAS:') === 0) {\n bandwidth = parseInt(bandwidth[0].substr(7), 10);\n } else if (bandwidth[0].indexOf('b=AS:') === 0) {\n bandwidth = parseInt(bandwidth[0].substr(5), 10);\n }\n encodingParameters.forEach(function(params) {\n params.maxBitrate = bandwidth;\n });\n }\n return encodingParameters;\n};\n\n// parses http://draft.ortc.org/#rtcrtcpparameters*\nSDPUtils.parseRtcpParameters = function(mediaSection) {\n var rtcpParameters = {};\n\n var cname;\n // Gets the first SSRC. Note that with RTX there might be multiple\n // SSRCs.\n var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(function(line) {\n return SDPUtils.parseSsrcMedia(line);\n })\n .filter(function(obj) {\n return obj.attribute === 'cname';\n })[0];\n if (remoteSsrc) {\n rtcpParameters.cname = remoteSsrc.value;\n rtcpParameters.ssrc = remoteSsrc.ssrc;\n }\n\n // Edge uses the compound attribute instead of reducedSize\n // compound is !reducedSize\n var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');\n rtcpParameters.reducedSize = rsize.length > 0;\n rtcpParameters.compound = rsize.length === 0;\n\n // parses the rtcp-mux attrіbute.\n // Note that Edge does not support unmuxed RTCP.\n var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');\n rtcpParameters.mux = mux.length > 0;\n\n return rtcpParameters;\n};\n\n// parses either a=msid: or a=ssrc:... msid lines and returns\n// the id of the MediaStream and MediaStreamTrack.\nSDPUtils.parseMsid = function(mediaSection) {\n var parts;\n var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');\n if (spec.length === 1) {\n parts = spec[0].substr(7).split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(function(line) {\n return SDPUtils.parseSsrcMedia(line);\n })\n .filter(function(parts) {\n return parts.attribute === 'msid';\n });\n if (planB.length > 0) {\n parts = planB[0].value.split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n};\n\nSDPUtils.writeSessionBoilerplate = function() {\n // FIXME: sess-id should be an NTP timestamp.\n return 'v=0\\r\\n' +\n 'o=thisisadapterortc 8169639915646943137 2 IN IP4 127.0.0.1\\r\\n' +\n 's=-\\r\\n' +\n 't=0 0\\r\\n';\n};\n\nSDPUtils.writeMediaSection = function(transceiver, caps, type, stream) {\n var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);\n\n // Map ICE parameters (ufrag, pwd) to SDP.\n sdp += SDPUtils.writeIceParameters(\n transceiver.iceGatherer.getLocalParameters());\n\n // Map DTLS parameters to SDP.\n sdp += SDPUtils.writeDtlsParameters(\n transceiver.dtlsTransport.getLocalParameters(),\n type === 'offer' ? 'actpass' : 'active');\n\n sdp += 'a=mid:' + transceiver.mid + '\\r\\n';\n\n if (transceiver.direction) {\n sdp += 'a=' + transceiver.direction + '\\r\\n';\n } else if (transceiver.rtpSender && transceiver.rtpReceiver) {\n sdp += 'a=sendrecv\\r\\n';\n } else if (transceiver.rtpSender) {\n sdp += 'a=sendonly\\r\\n';\n } else if (transceiver.rtpReceiver) {\n sdp += 'a=recvonly\\r\\n';\n } else {\n sdp += 'a=inactive\\r\\n';\n }\n\n if (transceiver.rtpSender) {\n // spec.\n var msid = 'msid:' + stream.id + ' ' +\n transceiver.rtpSender.track.id + '\\r\\n';\n sdp += 'a=' + msid;\n\n // for Chrome.\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +\n ' ' + msid;\n if (transceiver.sendEncodingParameters[0].rtx) {\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +\n ' ' + msid;\n sdp += 'a=ssrc-group:FID ' +\n transceiver.sendEncodingParameters[0].ssrc + ' ' +\n transceiver.sendEncodingParameters[0].rtx.ssrc +\n '\\r\\n';\n }\n }\n // FIXME: this should be written by writeRtpDescription.\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +\n ' cname:' + SDPUtils.localCName + '\\r\\n';\n if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +\n ' cname:' + SDPUtils.localCName + '\\r\\n';\n }\n return sdp;\n};\n\n// Gets the direction from the mediaSection or the sessionpart.\nSDPUtils.getDirection = function(mediaSection, sessionpart) {\n // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.\n var lines = SDPUtils.splitLines(mediaSection);\n for (var i = 0; i < lines.length; i++) {\n switch (lines[i]) {\n case 'a=sendrecv':\n case 'a=sendonly':\n case 'a=recvonly':\n case 'a=inactive':\n return lines[i].substr(2);\n default:\n // FIXME: What should happen here?\n }\n }\n if (sessionpart) {\n return SDPUtils.getDirection(sessionpart);\n }\n return 'sendrecv';\n};\n\nSDPUtils.getKind = function(mediaSection) {\n var lines = SDPUtils.splitLines(mediaSection);\n var mline = lines[0].split(' ');\n return mline[0].substr(2);\n};\n\nSDPUtils.isRejected = function(mediaSection) {\n return mediaSection.split(' ', 2)[1] === '0';\n};\n\n// Expose public methods.\nmodule.exports = SDPUtils;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n\n\n// Shimming starts here.\n(function() {\n // Utils.\n var utils = __webpack_require__(0);\n var logging = utils.log;\n var browserDetails = utils.browserDetails;\n // Export to the adapter global object visible in the browser.\n module.exports.browserDetails = browserDetails;\n module.exports.extractVersion = utils.extractVersion;\n module.exports.disableLog = utils.disableLog;\n\n // Uncomment the line below if you want logging to occur, including logging\n // for the switch statement below. Can also be turned on in the browser via\n // adapter.disableLog(false), but then logging from the switch statement below\n // will not appear.\n // require('./utils').disableLog(false);\n\n // Browser shims.\n var chromeShim = __webpack_require__(6) || null;\n var edgeShim = __webpack_require__(8) || null;\n var firefoxShim = __webpack_require__(11) || null;\n var safariShim = __webpack_require__(13) || null;\n\n // Shim browser if found.\n switch (browserDetails.browser) {\n case 'chrome':\n if (!chromeShim || !chromeShim.shimPeerConnection) {\n logging('Chrome shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming chrome.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = chromeShim;\n\n chromeShim.shimGetUserMedia();\n chromeShim.shimMediaStream();\n utils.shimCreateObjectURL();\n chromeShim.shimSourceObject();\n chromeShim.shimPeerConnection();\n chromeShim.shimOnTrack();\n chromeShim.shimGetSendersWithDtmf();\n break;\n case 'firefox':\n if (!firefoxShim || !firefoxShim.shimPeerConnection) {\n logging('Firefox shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming firefox.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = firefoxShim;\n\n firefoxShim.shimGetUserMedia();\n utils.shimCreateObjectURL();\n firefoxShim.shimSourceObject();\n firefoxShim.shimPeerConnection();\n firefoxShim.shimOnTrack();\n break;\n case 'edge':\n if (!edgeShim || !edgeShim.shimPeerConnection) {\n logging('MS edge shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming edge.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = edgeShim;\n\n edgeShim.shimGetUserMedia();\n utils.shimCreateObjectURL();\n edgeShim.shimPeerConnection();\n edgeShim.shimReplaceTrack();\n break;\n case 'safari':\n if (!safariShim) {\n logging('Safari shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming safari.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = safariShim;\n\n safariShim.shimCallbacksAPI();\n safariShim.shimAddStream();\n safariShim.shimOnAddStream();\n safariShim.shimGetUserMedia();\n break;\n default:\n logging('Unsupported browser!');\n }\n})();\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\nvar logging = __webpack_require__(0).log;\nvar browserDetails = __webpack_require__(0).browserDetails;\n\nvar chromeShim = {\n shimMediaStream: function() {\n window.MediaStream = window.MediaStream || window.webkitMediaStream;\n },\n\n shimOnTrack: function() {\n if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in\n window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {\n get: function() {\n return this._ontrack;\n },\n set: function(f) {\n var self = this;\n if (this._ontrack) {\n this.removeEventListener('track', this._ontrack);\n this.removeEventListener('addstream', this._ontrackpoly);\n }\n this.addEventListener('track', this._ontrack = f);\n this.addEventListener('addstream', this._ontrackpoly = function(e) {\n // onaddstream does not fire when a track is added to an existing\n // stream. But stream.onaddtrack is implemented so we use that.\n e.stream.addEventListener('addtrack', function(te) {\n var receiver;\n if (RTCPeerConnection.prototype.getReceivers) {\n receiver = self.getReceivers().find(function(r) {\n return r.track.id === te.track.id;\n });\n } else {\n receiver = {track: te.track};\n }\n\n var event = new Event('track');\n event.track = te.track;\n event.receiver = receiver;\n event.streams = [e.stream];\n self.dispatchEvent(event);\n });\n e.stream.getTracks().forEach(function(track) {\n var receiver;\n if (RTCPeerConnection.prototype.getReceivers) {\n receiver = self.getReceivers().find(function(r) {\n return r.track.id === track.id;\n });\n } else {\n receiver = {track: track};\n }\n var event = new Event('track');\n event.track = track;\n event.receiver = receiver;\n event.streams = [e.stream];\n this.dispatchEvent(event);\n }.bind(this));\n }.bind(this));\n }\n });\n }\n },\n\n shimGetSendersWithDtmf: function() {\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('getSenders' in RTCPeerConnection.prototype) &&\n 'createDTMFSender' in RTCPeerConnection.prototype) {\n RTCPeerConnection.prototype.getSenders = function() {\n return this._senders || [];\n };\n var origAddStream = RTCPeerConnection.prototype.addStream;\n var origRemoveStream = RTCPeerConnection.prototype.removeStream;\n\n if (!RTCPeerConnection.prototype.addTrack) {\n RTCPeerConnection.prototype.addTrack = function(track, stream) {\n var pc = this;\n if (pc.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n var streams = [].slice.call(arguments, 1);\n if (streams.length !== 1 ||\n !streams[0].getTracks().find(function(t) {\n return t === track;\n })) {\n // this is not fully correct but all we can manage without\n // [[associated MediaStreams]] internal slot.\n throw new DOMException(\n 'The adapter.js addTrack polyfill only supports a single ' +\n ' stream which is associated with the specified track.',\n 'NotSupportedError');\n }\n\n pc._senders = pc._senders || [];\n var alreadyExists = pc._senders.find(function(t) {\n return t.track === track;\n });\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n\n pc._streams = pc._streams || {};\n var oldStream = pc._streams[stream.id];\n if (oldStream) {\n oldStream.addTrack(track);\n pc.removeStream(oldStream);\n pc.addStream(oldStream);\n } else {\n var newStream = new MediaStream([track]);\n pc._streams[stream.id] = newStream;\n pc.addStream(newStream);\n }\n\n var sender = {\n track: track,\n get dtmf() {\n if (this._dtmf === undefined) {\n if (track.kind === 'audio') {\n this._dtmf = pc.createDTMFSender(track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n }\n };\n pc._senders.push(sender);\n return sender;\n };\n }\n RTCPeerConnection.prototype.addStream = function(stream) {\n var pc = this;\n pc._senders = pc._senders || [];\n origAddStream.apply(pc, [stream]);\n stream.getTracks().forEach(function(track) {\n pc._senders.push({\n track: track,\n get dtmf() {\n if (this._dtmf === undefined) {\n if (track.kind === 'audio') {\n this._dtmf = pc.createDTMFSender(track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n }\n });\n });\n };\n\n RTCPeerConnection.prototype.removeStream = function(stream) {\n var pc = this;\n pc._senders = pc._senders || [];\n origRemoveStream.apply(pc, [stream]);\n stream.getTracks().forEach(function(track) {\n var sender = pc._senders.find(function(s) {\n return s.track === track;\n });\n if (sender) {\n pc._senders.splice(pc._senders.indexOf(sender), 1); // remove sender\n }\n });\n };\n }\n },\n\n shimSourceObject: function() {\n if (typeof window === 'object') {\n if (window.HTMLMediaElement &&\n !('srcObject' in window.HTMLMediaElement.prototype)) {\n // Shim the srcObject property, once, when HTMLMediaElement is found.\n Object.defineProperty(window.HTMLMediaElement.prototype, 'srcObject', {\n get: function() {\n return this._srcObject;\n },\n set: function(stream) {\n var self = this;\n // Use _srcObject as a private property for this shim\n this._srcObject = stream;\n if (this.src) {\n URL.revokeObjectURL(this.src);\n }\n\n if (!stream) {\n this.src = '';\n return undefined;\n }\n this.src = URL.createObjectURL(stream);\n // We need to recreate the blob url when a track is added or\n // removed. Doing it manually since we want to avoid a recursion.\n stream.addEventListener('addtrack', function() {\n if (self.src) {\n URL.revokeObjectURL(self.src);\n }\n self.src = URL.createObjectURL(stream);\n });\n stream.addEventListener('removetrack', function() {\n if (self.src) {\n URL.revokeObjectURL(self.src);\n }\n self.src = URL.createObjectURL(stream);\n });\n }\n });\n }\n }\n },\n\n shimPeerConnection: function() {\n // The RTCPeerConnection object.\n if (!window.RTCPeerConnection) {\n window.RTCPeerConnection = function(pcConfig, pcConstraints) {\n // Translate iceTransportPolicy to iceTransports,\n // see https://code.google.com/p/webrtc/issues/detail?id=4869\n // this was fixed in M56 along with unprefixing RTCPeerConnection.\n logging('PeerConnection');\n if (pcConfig && pcConfig.iceTransportPolicy) {\n pcConfig.iceTransports = pcConfig.iceTransportPolicy;\n }\n\n return new webkitRTCPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = webkitRTCPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n if (webkitRTCPeerConnection.generateCertificate) {\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get: function() {\n return webkitRTCPeerConnection.generateCertificate;\n }\n });\n }\n } else {\n // migrate from non-spec RTCIceServer.url to RTCIceServer.urls\n var OrigPeerConnection = RTCPeerConnection;\n window.RTCPeerConnection = function(pcConfig, pcConstraints) {\n if (pcConfig && pcConfig.iceServers) {\n var newIceServers = [];\n for (var i = 0; i < pcConfig.iceServers.length; i++) {\n var server = pcConfig.iceServers[i];\n if (!server.hasOwnProperty('urls') &&\n server.hasOwnProperty('url')) {\n console.warn('RTCIceServer.url is deprecated! Use urls instead.');\n server = JSON.parse(JSON.stringify(server));\n server.urls = server.url;\n newIceServers.push(server);\n } else {\n newIceServers.push(pcConfig.iceServers[i]);\n }\n }\n pcConfig.iceServers = newIceServers;\n }\n return new OrigPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get: function() {\n return OrigPeerConnection.generateCertificate;\n }\n });\n }\n\n var origGetStats = RTCPeerConnection.prototype.getStats;\n RTCPeerConnection.prototype.getStats = function(selector,\n successCallback, errorCallback) {\n var self = this;\n var args = arguments;\n\n // If selector is a function then we are in the old style stats so just\n // pass back the original getStats format to avoid breaking old users.\n if (arguments.length > 0 && typeof selector === 'function') {\n return origGetStats.apply(this, arguments);\n }\n\n // When spec-style getStats is supported, return those when called with\n // either no arguments or the selector argument is null.\n if (origGetStats.length === 0 && (arguments.length === 0 ||\n typeof arguments[0] !== 'function')) {\n return origGetStats.apply(this, []);\n }\n\n var fixChromeStats_ = function(response) {\n var standardReport = {};\n var reports = response.result();\n reports.forEach(function(report) {\n var standardStats = {\n id: report.id,\n timestamp: report.timestamp,\n type: {\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n }[report.type] || report.type\n };\n report.names().forEach(function(name) {\n standardStats[name] = report.stat(name);\n });\n standardReport[standardStats.id] = standardStats;\n });\n\n return standardReport;\n };\n\n // shim getStats with maplike support\n var makeMapStats = function(stats) {\n return new Map(Object.keys(stats).map(function(key) {\n return [key, stats[key]];\n }));\n };\n\n if (arguments.length >= 2) {\n var successCallbackWrapper_ = function(response) {\n args[1](makeMapStats(fixChromeStats_(response)));\n };\n\n return origGetStats.apply(this, [successCallbackWrapper_,\n arguments[0]]);\n }\n\n // promise-support\n return new Promise(function(resolve, reject) {\n origGetStats.apply(self, [\n function(response) {\n resolve(makeMapStats(fixChromeStats_(response)));\n }, reject]);\n }).then(successCallback, errorCallback);\n };\n\n // add promise support -- natively available in Chrome 51\n if (browserDetails.version < 51) {\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n var args = arguments;\n var self = this;\n var promise = new Promise(function(resolve, reject) {\n nativeMethod.apply(self, [args[0], resolve, reject]);\n });\n if (args.length < 2) {\n return promise;\n }\n return promise.then(function() {\n args[1].apply(null, []);\n },\n function(err) {\n if (args.length >= 3) {\n args[2].apply(null, [err]);\n }\n });\n };\n });\n }\n\n // promise support for createOffer and createAnswer. Available (without\n // bugs) since M52: crbug/619289\n if (browserDetails.version < 52) {\n ['createOffer', 'createAnswer'].forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n var self = this;\n if (arguments.length < 1 || (arguments.length === 1 &&\n typeof arguments[0] === 'object')) {\n var opts = arguments.length === 1 ? arguments[0] : undefined;\n return new Promise(function(resolve, reject) {\n nativeMethod.apply(self, [resolve, reject, opts]);\n });\n }\n return nativeMethod.apply(this, arguments);\n };\n });\n }\n\n // shim implicit creation of RTCSessionDescription/RTCIceCandidate\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n RTCIceCandidate : RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n };\n });\n\n // support for addIceCandidate(null or undefined)\n var nativeAddIceCandidate =\n RTCPeerConnection.prototype.addIceCandidate;\n RTCPeerConnection.prototype.addIceCandidate = function() {\n if (!arguments[0]) {\n if (arguments[1]) {\n arguments[1].apply(null);\n }\n return Promise.resolve();\n }\n return nativeAddIceCandidate.apply(this, arguments);\n };\n }\n};\n\n\n// Expose public methods.\nmodule.exports = {\n shimMediaStream: chromeShim.shimMediaStream,\n shimOnTrack: chromeShim.shimOnTrack,\n shimGetSendersWithDtmf: chromeShim.shimGetSendersWithDtmf,\n shimSourceObject: chromeShim.shimSourceObject,\n shimPeerConnection: chromeShim.shimPeerConnection,\n shimGetUserMedia: __webpack_require__(7)\n};\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\nvar logging = __webpack_require__(0).log;\nvar browserDetails = __webpack_require__(0).browserDetails;\n\n// Expose public methods.\nmodule.exports = function() {\n var constraintsToChrome_ = function(c) {\n if (typeof c !== 'object' || c.mandatory || c.optional) {\n return c;\n }\n var cc = {};\n Object.keys(c).forEach(function(key) {\n if (key === 'require' || key === 'advanced' || key === 'mediaSource') {\n return;\n }\n var r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};\n if (r.exact !== undefined && typeof r.exact === 'number') {\n r.min = r.max = r.exact;\n }\n var oldname_ = function(prefix, name) {\n if (prefix) {\n return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n }\n return (name === 'deviceId') ? 'sourceId' : name;\n };\n if (r.ideal !== undefined) {\n cc.optional = cc.optional || [];\n var oc = {};\n if (typeof r.ideal === 'number') {\n oc[oldname_('min', key)] = r.ideal;\n cc.optional.push(oc);\n oc = {};\n oc[oldname_('max', key)] = r.ideal;\n cc.optional.push(oc);\n } else {\n oc[oldname_('', key)] = r.ideal;\n cc.optional.push(oc);\n }\n }\n if (r.exact !== undefined && typeof r.exact !== 'number') {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_('', key)] = r.exact;\n } else {\n ['min', 'max'].forEach(function(mix) {\n if (r[mix] !== undefined) {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_(mix, key)] = r[mix];\n }\n });\n }\n });\n if (c.advanced) {\n cc.optional = (cc.optional || []).concat(c.advanced);\n }\n return cc;\n };\n\n var shimConstraints_ = function(constraints, func) {\n constraints = JSON.parse(JSON.stringify(constraints));\n if (constraints && constraints.audio) {\n constraints.audio = constraintsToChrome_(constraints.audio);\n }\n if (constraints && typeof constraints.video === 'object') {\n // Shim facingMode for mobile & surface pro.\n var face = constraints.video.facingMode;\n face = face && ((typeof face === 'object') ? face : {ideal: face});\n var getSupportedFacingModeLies = browserDetails.version < 61;\n\n if ((face && (face.exact === 'user' || face.exact === 'environment' ||\n face.ideal === 'user' || face.ideal === 'environment')) &&\n !(navigator.mediaDevices.getSupportedConstraints &&\n navigator.mediaDevices.getSupportedConstraints().facingMode &&\n !getSupportedFacingModeLies)) {\n delete constraints.video.facingMode;\n var matches;\n if (face.exact === 'environment' || face.ideal === 'environment') {\n matches = ['back', 'rear'];\n } else if (face.exact === 'user' || face.ideal === 'user') {\n matches = ['front'];\n }\n if (matches) {\n // Look for matches in label, or use last cam for back (typical).\n return navigator.mediaDevices.enumerateDevices()\n .then(function(devices) {\n devices = devices.filter(function(d) {\n return d.kind === 'videoinput';\n });\n var dev = devices.find(function(d) {\n return matches.some(function(match) {\n return d.label.toLowerCase().indexOf(match) !== -1;\n });\n });\n if (!dev && devices.length && matches.indexOf('back') !== -1) {\n dev = devices[devices.length - 1]; // more likely the back cam\n }\n if (dev) {\n constraints.video.deviceId = face.exact ? {exact: dev.deviceId} :\n {ideal: dev.deviceId};\n }\n constraints.video = constraintsToChrome_(constraints.video);\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n });\n }\n }\n constraints.video = constraintsToChrome_(constraints.video);\n }\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n };\n\n var shimError_ = function(e) {\n return {\n name: {\n ConstraintNotSatisfiedError: 'OverconstrainedError',\n PermissionDeniedError: 'NotAllowedError',\n TrackStartError: 'NotReadableError'\n }[e.name] || e.name,\n message: e.message,\n constraint: e.constraintName,\n toString: function() {\n return this.name + (this.message && ': ') + this.message;\n }\n };\n };\n\n var getUserMedia_ = function(constraints, onSuccess, onError) {\n shimConstraints_(constraints, function(c) {\n navigator.webkitGetUserMedia(c, onSuccess, function(e) {\n onError(shimError_(e));\n });\n });\n };\n\n navigator.getUserMedia = getUserMedia_;\n\n // Returns the result of getUserMedia as a Promise.\n var getUserMediaPromise_ = function(constraints) {\n return new Promise(function(resolve, reject) {\n navigator.getUserMedia(constraints, resolve, reject);\n });\n };\n\n if (!navigator.mediaDevices) {\n navigator.mediaDevices = {\n getUserMedia: getUserMediaPromise_,\n enumerateDevices: function() {\n return new Promise(function(resolve) {\n var kinds = {audio: 'audioinput', video: 'videoinput'};\n return MediaStreamTrack.getSources(function(devices) {\n resolve(devices.map(function(device) {\n return {label: device.label,\n kind: kinds[device.kind],\n deviceId: device.id,\n groupId: ''};\n }));\n });\n });\n },\n getSupportedConstraints: function() {\n return {\n deviceId: true, echoCancellation: true, facingMode: true,\n frameRate: true, height: true, width: true\n };\n }\n };\n }\n\n // A shim for getUserMedia method on the mediaDevices object.\n // TODO(KaptenJansson) remove once implemented in Chrome stable.\n if (!navigator.mediaDevices.getUserMedia) {\n navigator.mediaDevices.getUserMedia = function(constraints) {\n return getUserMediaPromise_(constraints);\n };\n } else {\n // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia\n // function which returns a Promise, it does not accept spec-style\n // constraints.\n var origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(cs) {\n return shimConstraints_(cs, function(c) {\n return origGetUserMedia(c).then(function(stream) {\n if (c.audio && !stream.getAudioTracks().length ||\n c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach(function(track) {\n track.stop();\n });\n throw new DOMException('', 'NotFoundError');\n }\n return stream;\n }, function(e) {\n return Promise.reject(shimError_(e));\n });\n });\n };\n }\n\n // Dummy devicechange event methods.\n // TODO(KaptenJansson) remove once implemented in Chrome stable.\n if (typeof navigator.mediaDevices.addEventListener === 'undefined') {\n navigator.mediaDevices.addEventListener = function() {\n logging('Dummy mediaDevices.addEventListener called.');\n };\n }\n if (typeof navigator.mediaDevices.removeEventListener === 'undefined') {\n navigator.mediaDevices.removeEventListener = function() {\n logging('Dummy mediaDevices.removeEventListener called.');\n };\n }\n};\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n\nvar browserDetails = __webpack_require__(0).browserDetails;\nvar shimRTCPeerConnection = __webpack_require__(10);\n\nmodule.exports = {\n shimGetUserMedia: __webpack_require__(9),\n shimPeerConnection: function() {\n if (window.RTCIceGatherer) {\n // ORTC defines an RTCIceCandidate object but no constructor.\n // Not implemented in Edge.\n if (!window.RTCIceCandidate) {\n window.RTCIceCandidate = function(args) {\n return args;\n };\n }\n // ORTC does not have a session description object but\n // other browsers (i.e. Chrome) that will support both PC and ORTC\n // in the future might have this defined already.\n if (!window.RTCSessionDescription) {\n window.RTCSessionDescription = function(args) {\n return args;\n };\n }\n // this adds an additional event listener to MediaStrackTrack that signals\n // when a tracks enabled property was changed. Workaround for a bug in\n // addStream, see below. No longer required in 15025+\n if (browserDetails.version < 15025) {\n var origMSTEnabled = Object.getOwnPropertyDescriptor(\n MediaStreamTrack.prototype, 'enabled');\n Object.defineProperty(MediaStreamTrack.prototype, 'enabled', {\n set: function(value) {\n origMSTEnabled.set.call(this, value);\n var ev = new Event('enabled');\n ev.enabled = value;\n this.dispatchEvent(ev);\n }\n });\n }\n }\n window.RTCPeerConnection = shimRTCPeerConnection(browserDetails.version);\n },\n shimReplaceTrack: function() {\n // ORTC has replaceTrack -- https://github.com/w3c/ortc/issues/614\n if (window.RTCRtpSender && !('replaceTrack' in RTCRtpSender.prototype)) {\n RTCRtpSender.prototype.replaceTrack = RTCRtpSender.prototype.setTrack;\n }\n }\n};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n\n// Expose public methods.\nmodule.exports = function() {\n var shimError_ = function(e) {\n return {\n name: {PermissionDeniedError: 'NotAllowedError'}[e.name] || e.name,\n message: e.message,\n constraint: e.constraint,\n toString: function() {\n return this.name;\n }\n };\n };\n\n // getUserMedia error shim.\n var origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n return origGetUserMedia(c).catch(function(e) {\n return Promise.reject(shimError_(e));\n });\n };\n};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n\nvar SDPUtils = __webpack_require__(4);\n\n// sort tracks such that they follow an a-v-a-v...\n// pattern.\nfunction sortTracks(tracks) {\n var audioTracks = tracks.filter(function(track) {\n return track.kind === 'audio';\n });\n var videoTracks = tracks.filter(function(track) {\n return track.kind === 'video';\n });\n tracks = [];\n while (audioTracks.length || videoTracks.length) {\n if (audioTracks.length) {\n tracks.push(audioTracks.shift());\n }\n if (videoTracks.length) {\n tracks.push(videoTracks.shift());\n }\n }\n return tracks;\n}\n\n// Edge does not like\n// 1) stun:\n// 2) turn: that does not have all of turn:host:port?transport=udp\n// 3) turn: with ipv6 addresses\n// 4) turn: occurring muliple times\nfunction filterIceServers(iceServers, edgeVersion) {\n var hasTurn = false;\n iceServers = JSON.parse(JSON.stringify(iceServers));\n return iceServers.filter(function(server) {\n if (server && (server.urls || server.url)) {\n var urls = server.urls || server.url;\n if (server.url && !server.urls) {\n console.warn('RTCIceServer.url is deprecated! Use urls instead.');\n }\n var isString = typeof urls === 'string';\n if (isString) {\n urls = [urls];\n }\n urls = urls.filter(function(url) {\n var validTurn = url.indexOf('turn:') === 0 &&\n url.indexOf('transport=udp') !== -1 &&\n url.indexOf('turn:[') === -1 &&\n !hasTurn;\n\n if (validTurn) {\n hasTurn = true;\n return true;\n }\n return url.indexOf('stun:') === 0 && edgeVersion >= 14393;\n });\n\n delete server.url;\n server.urls = isString ? urls[0] : urls;\n return !!urls.length;\n }\n return false;\n });\n}\n\n// Determines the intersection of local and remote capabilities.\nfunction getCommonCapabilities(localCapabilities, remoteCapabilities) {\n var commonCapabilities = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: []\n };\n\n var findCodecByPayloadType = function(pt, codecs) {\n pt = parseInt(pt, 10);\n for (var i = 0; i < codecs.length; i++) {\n if (codecs[i].payloadType === pt ||\n codecs[i].preferredPayloadType === pt) {\n return codecs[i];\n }\n }\n };\n\n var rtxCapabilityMatches = function(lRtx, rRtx, lCodecs, rCodecs) {\n var lCodec = findCodecByPayloadType(lRtx.parameters.apt, lCodecs);\n var rCodec = findCodecByPayloadType(rRtx.parameters.apt, rCodecs);\n return lCodec && rCodec &&\n lCodec.name.toLowerCase() === rCodec.name.toLowerCase();\n };\n\n localCapabilities.codecs.forEach(function(lCodec) {\n for (var i = 0; i < remoteCapabilities.codecs.length; i++) {\n var rCodec = remoteCapabilities.codecs[i];\n if (lCodec.name.toLowerCase() === rCodec.name.toLowerCase() &&\n lCodec.clockRate === rCodec.clockRate) {\n if (lCodec.name.toLowerCase() === 'rtx' &&\n lCodec.parameters && rCodec.parameters.apt) {\n // for RTX we need to find the local rtx that has a apt\n // which points to the same local codec as the remote one.\n if (!rtxCapabilityMatches(lCodec, rCodec,\n localCapabilities.codecs, remoteCapabilities.codecs)) {\n continue;\n }\n }\n rCodec = JSON.parse(JSON.stringify(rCodec)); // deepcopy\n // number of channels is the highest common number of channels\n rCodec.numChannels = Math.min(lCodec.numChannels,\n rCodec.numChannels);\n // push rCodec so we reply with offerer payload type\n commonCapabilities.codecs.push(rCodec);\n\n // determine common feedback mechanisms\n rCodec.rtcpFeedback = rCodec.rtcpFeedback.filter(function(fb) {\n for (var j = 0; j < lCodec.rtcpFeedback.length; j++) {\n if (lCodec.rtcpFeedback[j].type === fb.type &&\n lCodec.rtcpFeedback[j].parameter === fb.parameter) {\n return true;\n }\n }\n return false;\n });\n // FIXME: also need to determine .parameters\n // see https://github.com/openpeer/ortc/issues/569\n break;\n }\n }\n });\n\n localCapabilities.headerExtensions.forEach(function(lHeaderExtension) {\n for (var i = 0; i < remoteCapabilities.headerExtensions.length;\n i++) {\n var rHeaderExtension = remoteCapabilities.headerExtensions[i];\n if (lHeaderExtension.uri === rHeaderExtension.uri) {\n commonCapabilities.headerExtensions.push(rHeaderExtension);\n break;\n }\n }\n });\n\n // FIXME: fecMechanisms\n return commonCapabilities;\n}\n\n// is action=setLocalDescription with type allowed in signalingState\nfunction isActionAllowedInSignalingState(action, type, signalingState) {\n return {\n offer: {\n setLocalDescription: ['stable', 'have-local-offer'],\n setRemoteDescription: ['stable', 'have-remote-offer']\n },\n answer: {\n setLocalDescription: ['have-remote-offer', 'have-local-pranswer'],\n setRemoteDescription: ['have-local-offer', 'have-remote-pranswer']\n }\n }[type][action].indexOf(signalingState) !== -1;\n}\n\nmodule.exports = function(edgeVersion) {\n var RTCPeerConnection = function(config) {\n var self = this;\n\n var _eventTarget = document.createDocumentFragment();\n ['addEventListener', 'removeEventListener', 'dispatchEvent']\n .forEach(function(method) {\n self[method] = _eventTarget[method].bind(_eventTarget);\n });\n\n this.needNegotiation = false;\n\n this.onicecandidate = null;\n this.onaddstream = null;\n this.ontrack = null;\n this.onremovestream = null;\n this.onsignalingstatechange = null;\n this.oniceconnectionstatechange = null;\n this.onicegatheringstatechange = null;\n this.onnegotiationneeded = null;\n this.ondatachannel = null;\n this.canTrickleIceCandidates = null;\n\n this.localStreams = [];\n this.remoteStreams = [];\n this.getLocalStreams = function() {\n return self.localStreams;\n };\n this.getRemoteStreams = function() {\n return self.remoteStreams;\n };\n\n this.localDescription = new RTCSessionDescription({\n type: '',\n sdp: ''\n });\n this.remoteDescription = new RTCSessionDescription({\n type: '',\n sdp: ''\n });\n this.signalingState = 'stable';\n this.iceConnectionState = 'new';\n this.iceGatheringState = 'new';\n\n this.iceOptions = {\n gatherPolicy: 'all',\n iceServers: []\n };\n if (config && config.iceTransportPolicy) {\n switch (config.iceTransportPolicy) {\n case 'all':\n case 'relay':\n this.iceOptions.gatherPolicy = config.iceTransportPolicy;\n break;\n default:\n // don't set iceTransportPolicy.\n break;\n }\n }\n this.usingBundle = config && config.bundlePolicy === 'max-bundle';\n\n if (config && config.iceServers) {\n this.iceOptions.iceServers = filterIceServers(config.iceServers,\n edgeVersion);\n }\n this._config = config || {};\n\n // per-track iceGathers, iceTransports, dtlsTransports, rtpSenders, ...\n // everything that is needed to describe a SDP m-line.\n this.transceivers = [];\n\n // since the iceGatherer is currently created in createOffer but we\n // must not emit candidates until after setLocalDescription we buffer\n // them in this array.\n this._localIceCandidatesBuffer = [];\n };\n\n RTCPeerConnection.prototype._emitGatheringStateChange = function() {\n var event = new Event('icegatheringstatechange');\n this.dispatchEvent(event);\n if (this.onicegatheringstatechange !== null) {\n this.onicegatheringstatechange(event);\n }\n };\n\n RTCPeerConnection.prototype._emitBufferedCandidates = function() {\n var self = this;\n var sections = SDPUtils.splitSections(self.localDescription.sdp);\n // FIXME: need to apply ice candidates in a way which is async but\n // in-order\n this._localIceCandidatesBuffer.forEach(function(event) {\n var end = !event.candidate || Object.keys(event.candidate).length === 0;\n if (end) {\n for (var j = 1; j < sections.length; j++) {\n if (sections[j].indexOf('\\r\\na=end-of-candidates\\r\\n') === -1) {\n sections[j] += 'a=end-of-candidates\\r\\n';\n }\n }\n } else {\n sections[event.candidate.sdpMLineIndex + 1] +=\n 'a=' + event.candidate.candidate + '\\r\\n';\n }\n self.localDescription.sdp = sections.join('');\n self.dispatchEvent(event);\n if (self.onicecandidate !== null) {\n self.onicecandidate(event);\n }\n if (!event.candidate && self.iceGatheringState !== 'complete') {\n var complete = self.transceivers.every(function(transceiver) {\n return transceiver.iceGatherer &&\n transceiver.iceGatherer.state === 'completed';\n });\n if (complete && self.iceGatheringStateChange !== 'complete') {\n self.iceGatheringState = 'complete';\n self._emitGatheringStateChange();\n }\n }\n });\n this._localIceCandidatesBuffer = [];\n };\n\n RTCPeerConnection.prototype.getConfiguration = function() {\n return this._config;\n };\n\n // internal helper to create a transceiver object.\n // (whih is not yet the same as the WebRTC 1.0 transceiver)\n RTCPeerConnection.prototype._createTransceiver = function(kind) {\n var hasBundleTransport = this.transceivers.length > 0;\n var transceiver = {\n track: null,\n iceGatherer: null,\n iceTransport: null,\n dtlsTransport: null,\n localCapabilities: null,\n remoteCapabilities: null,\n rtpSender: null,\n rtpReceiver: null,\n kind: kind,\n mid: null,\n sendEncodingParameters: null,\n recvEncodingParameters: null,\n stream: null,\n wantReceive: true\n };\n if (this.usingBundle && hasBundleTransport) {\n transceiver.iceTransport = this.transceivers[0].iceTransport;\n transceiver.dtlsTransport = this.transceivers[0].dtlsTransport;\n } else {\n var transports = this._createIceAndDtlsTransports();\n transceiver.iceTransport = transports.iceTransport;\n transceiver.dtlsTransport = transports.dtlsTransport;\n }\n this.transceivers.push(transceiver);\n return transceiver;\n };\n\n RTCPeerConnection.prototype.addTrack = function(track, stream) {\n var transceiver;\n for (var i = 0; i < this.transceivers.length; i++) {\n if (!this.transceivers[i].track &&\n this.transceivers[i].kind === track.kind) {\n transceiver = this.transceivers[i];\n }\n }\n if (!transceiver) {\n transceiver = this._createTransceiver(track.kind);\n }\n\n transceiver.track = track;\n transceiver.stream = stream;\n transceiver.rtpSender = new RTCRtpSender(track,\n transceiver.dtlsTransport);\n\n this._maybeFireNegotiationNeeded();\n return transceiver.rtpSender;\n };\n\n RTCPeerConnection.prototype.addStream = function(stream) {\n var self = this;\n if (edgeVersion >= 15025) {\n this.localStreams.push(stream);\n stream.getTracks().forEach(function(track) {\n self.addTrack(track, stream);\n });\n } else {\n // Clone is necessary for local demos mostly, attaching directly\n // to two different senders does not work (build 10547).\n // Fixed in 15025 (or earlier)\n var clonedStream = stream.clone();\n stream.getTracks().forEach(function(track, idx) {\n var clonedTrack = clonedStream.getTracks()[idx];\n track.addEventListener('enabled', function(event) {\n clonedTrack.enabled = event.enabled;\n });\n });\n clonedStream.getTracks().forEach(function(track) {\n self.addTrack(track, clonedStream);\n });\n this.localStreams.push(clonedStream);\n }\n this._maybeFireNegotiationNeeded();\n };\n\n RTCPeerConnection.prototype.removeStream = function(stream) {\n var idx = this.localStreams.indexOf(stream);\n if (idx > -1) {\n this.localStreams.splice(idx, 1);\n this._maybeFireNegotiationNeeded();\n }\n };\n\n RTCPeerConnection.prototype.getSenders = function() {\n return this.transceivers.filter(function(transceiver) {\n return !!transceiver.rtpSender;\n })\n .map(function(transceiver) {\n return transceiver.rtpSender;\n });\n };\n\n RTCPeerConnection.prototype.getReceivers = function() {\n return this.transceivers.filter(function(transceiver) {\n return !!transceiver.rtpReceiver;\n })\n .map(function(transceiver) {\n return transceiver.rtpReceiver;\n });\n };\n\n // Create ICE gatherer and hook it up.\n RTCPeerConnection.prototype._createIceGatherer = function(mid,\n sdpMLineIndex) {\n var self = this;\n var iceGatherer = new RTCIceGatherer(self.iceOptions);\n iceGatherer.onlocalcandidate = function(evt) {\n var event = new Event('icecandidate');\n event.candidate = {sdpMid: mid, sdpMLineIndex: sdpMLineIndex};\n\n var cand = evt.candidate;\n var end = !cand || Object.keys(cand).length === 0;\n // Edge emits an empty object for RTCIceCandidateComplete‥\n if (end) {\n // polyfill since RTCIceGatherer.state is not implemented in\n // Edge 10547 yet.\n if (iceGatherer.state === undefined) {\n iceGatherer.state = 'completed';\n }\n } else {\n // RTCIceCandidate doesn't have a component, needs to be added\n cand.component = 1;\n event.candidate.candidate = SDPUtils.writeCandidate(cand);\n }\n\n // update local description.\n var sections = SDPUtils.splitSections(self.localDescription.sdp);\n if (!end) {\n sections[event.candidate.sdpMLineIndex + 1] +=\n 'a=' + event.candidate.candidate + '\\r\\n';\n } else {\n sections[event.candidate.sdpMLineIndex + 1] +=\n 'a=end-of-candidates\\r\\n';\n }\n self.localDescription.sdp = sections.join('');\n var transceivers = self._pendingOffer ? self._pendingOffer :\n self.transceivers;\n var complete = transceivers.every(function(transceiver) {\n return transceiver.iceGatherer &&\n transceiver.iceGatherer.state === 'completed';\n });\n\n // Emit candidate if localDescription is set.\n // Also emits null candidate when all gatherers are complete.\n switch (self.iceGatheringState) {\n case 'new':\n if (!end) {\n self._localIceCandidatesBuffer.push(event);\n }\n if (end && complete) {\n self._localIceCandidatesBuffer.push(\n new Event('icecandidate'));\n }\n break;\n case 'gathering':\n self._emitBufferedCandidates();\n if (!end) {\n self.dispatchEvent(event);\n if (self.onicecandidate !== null) {\n self.onicecandidate(event);\n }\n }\n if (complete) {\n self.dispatchEvent(new Event('icecandidate'));\n if (self.onicecandidate !== null) {\n self.onicecandidate(new Event('icecandidate'));\n }\n self.iceGatheringState = 'complete';\n self._emitGatheringStateChange();\n }\n break;\n case 'complete':\n // should not happen... currently!\n break;\n default: // no-op.\n break;\n }\n };\n return iceGatherer;\n };\n\n // Create ICE transport and DTLS transport.\n RTCPeerConnection.prototype._createIceAndDtlsTransports = function() {\n var self = this;\n var iceTransport = new RTCIceTransport(null);\n iceTransport.onicestatechange = function() {\n self._updateConnectionState();\n };\n\n var dtlsTransport = new RTCDtlsTransport(iceTransport);\n dtlsTransport.ondtlsstatechange = function() {\n self._updateConnectionState();\n };\n dtlsTransport.onerror = function() {\n // onerror does not set state to failed by itself.\n Object.defineProperty(dtlsTransport, 'state',\n {value: 'failed', writable: true});\n self._updateConnectionState();\n };\n\n return {\n iceTransport: iceTransport,\n dtlsTransport: dtlsTransport\n };\n };\n\n // Destroy ICE gatherer, ICE transport and DTLS transport.\n // Without triggering the callbacks.\n RTCPeerConnection.prototype._disposeIceAndDtlsTransports = function(\n sdpMLineIndex) {\n var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;\n if (iceGatherer) {\n delete iceGatherer.onlocalcandidate;\n delete this.transceivers[sdpMLineIndex].iceGatherer;\n }\n var iceTransport = this.transceivers[sdpMLineIndex].iceTransport;\n if (iceTransport) {\n delete iceTransport.onicestatechange;\n delete this.transceivers[sdpMLineIndex].iceTransport;\n }\n var dtlsTransport = this.transceivers[sdpMLineIndex].dtlsTransport;\n if (dtlsTransport) {\n delete dtlsTransport.ondtlssttatechange;\n delete dtlsTransport.onerror;\n delete this.transceivers[sdpMLineIndex].dtlsTransport;\n }\n };\n\n // Start the RTP Sender and Receiver for a transceiver.\n RTCPeerConnection.prototype._transceive = function(transceiver,\n send, recv) {\n var params = getCommonCapabilities(transceiver.localCapabilities,\n transceiver.remoteCapabilities);\n if (send && transceiver.rtpSender) {\n params.encodings = transceiver.sendEncodingParameters;\n params.rtcp = {\n cname: SDPUtils.localCName,\n compound: transceiver.rtcpParameters.compound\n };\n if (transceiver.recvEncodingParameters.length) {\n params.rtcp.ssrc = transceiver.recvEncodingParameters[0].ssrc;\n }\n transceiver.rtpSender.send(params);\n }\n if (recv && transceiver.rtpReceiver) {\n // remove RTX field in Edge 14942\n if (transceiver.kind === 'video'\n && transceiver.recvEncodingParameters\n && edgeVersion < 15019) {\n transceiver.recvEncodingParameters.forEach(function(p) {\n delete p.rtx;\n });\n }\n params.encodings = transceiver.recvEncodingParameters;\n params.rtcp = {\n cname: transceiver.rtcpParameters.cname,\n compound: transceiver.rtcpParameters.compound\n };\n if (transceiver.sendEncodingParameters.length) {\n params.rtcp.ssrc = transceiver.sendEncodingParameters[0].ssrc;\n }\n transceiver.rtpReceiver.receive(params);\n }\n };\n\n RTCPeerConnection.prototype.setLocalDescription = function(description) {\n var self = this;\n\n if (!isActionAllowedInSignalingState('setLocalDescription',\n description.type, this.signalingState)) {\n var e = new Error('Can not set local ' + description.type +\n ' in state ' + this.signalingState);\n e.name = 'InvalidStateError';\n if (arguments.length > 2 && typeof arguments[2] === 'function') {\n window.setTimeout(arguments[2], 0, e);\n }\n return Promise.reject(e);\n }\n\n var sections;\n var sessionpart;\n if (description.type === 'offer') {\n // FIXME: What was the purpose of this empty if statement?\n // if (!this._pendingOffer) {\n // } else {\n if (this._pendingOffer) {\n // VERY limited support for SDP munging. Limited to:\n // * changing the order of codecs\n sections = SDPUtils.splitSections(description.sdp);\n sessionpart = sections.shift();\n sections.forEach(function(mediaSection, sdpMLineIndex) {\n var caps = SDPUtils.parseRtpParameters(mediaSection);\n self._pendingOffer[sdpMLineIndex].localCapabilities = caps;\n });\n this.transceivers = this._pendingOffer;\n delete this._pendingOffer;\n }\n } else if (description.type === 'answer') {\n sections = SDPUtils.splitSections(self.remoteDescription.sdp);\n sessionpart = sections.shift();\n var isIceLite = SDPUtils.matchPrefix(sessionpart,\n 'a=ice-lite').length > 0;\n sections.forEach(function(mediaSection, sdpMLineIndex) {\n var transceiver = self.transceivers[sdpMLineIndex];\n var iceGatherer = transceiver.iceGatherer;\n var iceTransport = transceiver.iceTransport;\n var dtlsTransport = transceiver.dtlsTransport;\n var localCapabilities = transceiver.localCapabilities;\n var remoteCapabilities = transceiver.remoteCapabilities;\n\n var rejected = SDPUtils.isRejected(mediaSection);\n\n if (!rejected && !transceiver.isDatachannel) {\n var remoteIceParameters = SDPUtils.getIceParameters(\n mediaSection, sessionpart);\n var remoteDtlsParameters = SDPUtils.getDtlsParameters(\n mediaSection, sessionpart);\n if (isIceLite) {\n remoteDtlsParameters.role = 'server';\n }\n\n if (!self.usingBundle || sdpMLineIndex === 0) {\n iceTransport.start(iceGatherer, remoteIceParameters,\n isIceLite ? 'controlling' : 'controlled');\n dtlsTransport.start(remoteDtlsParameters);\n }\n\n // Calculate intersection of capabilities.\n var params = getCommonCapabilities(localCapabilities,\n remoteCapabilities);\n\n // Start the RTCRtpSender. The RTCRtpReceiver for this\n // transceiver has already been started in setRemoteDescription.\n self._transceive(transceiver,\n params.codecs.length > 0,\n false);\n }\n });\n }\n\n this.localDescription = {\n type: description.type,\n sdp: description.sdp\n };\n switch (description.type) {\n case 'offer':\n this._updateSignalingState('have-local-offer');\n break;\n case 'answer':\n this._updateSignalingState('stable');\n break;\n default:\n throw new TypeError('unsupported type \"' + description.type +\n '\"');\n }\n\n // If a success callback was provided, emit ICE candidates after it\n // has been executed. Otherwise, emit callback after the Promise is\n // resolved.\n var hasCallback = arguments.length > 1 &&\n typeof arguments[1] === 'function';\n if (hasCallback) {\n var cb = arguments[1];\n window.setTimeout(function() {\n cb();\n if (self.iceGatheringState === 'new') {\n self.iceGatheringState = 'gathering';\n self._emitGatheringStateChange();\n }\n self._emitBufferedCandidates();\n }, 0);\n }\n var p = Promise.resolve();\n p.then(function() {\n if (!hasCallback) {\n if (self.iceGatheringState === 'new') {\n self.iceGatheringState = 'gathering';\n self._emitGatheringStateChange();\n }\n // Usually candidates will be emitted earlier.\n window.setTimeout(self._emitBufferedCandidates.bind(self), 500);\n }\n });\n return p;\n };\n\n RTCPeerConnection.prototype.setRemoteDescription = function(description) {\n var self = this;\n\n if (!isActionAllowedInSignalingState('setRemoteDescription',\n description.type, this.signalingState)) {\n var e = new Error('Can not set remote ' + description.type +\n ' in state ' + this.signalingState);\n e.name = 'InvalidStateError';\n if (arguments.length > 2 && typeof arguments[2] === 'function') {\n window.setTimeout(arguments[2], 0, e);\n }\n return Promise.reject(e);\n }\n\n var streams = {};\n var receiverList = [];\n var sections = SDPUtils.splitSections(description.sdp);\n var sessionpart = sections.shift();\n var isIceLite = SDPUtils.matchPrefix(sessionpart,\n 'a=ice-lite').length > 0;\n var usingBundle = SDPUtils.matchPrefix(sessionpart,\n 'a=group:BUNDLE ').length > 0;\n this.usingBundle = usingBundle;\n var iceOptions = SDPUtils.matchPrefix(sessionpart,\n 'a=ice-options:')[0];\n if (iceOptions) {\n this.canTrickleIceCandidates = iceOptions.substr(14).split(' ')\n .indexOf('trickle') >= 0;\n } else {\n this.canTrickleIceCandidates = false;\n }\n\n sections.forEach(function(mediaSection, sdpMLineIndex) {\n var lines = SDPUtils.splitLines(mediaSection);\n var kind = SDPUtils.getKind(mediaSection);\n var rejected = SDPUtils.isRejected(mediaSection);\n var protocol = lines[0].substr(2).split(' ')[2];\n\n var direction = SDPUtils.getDirection(mediaSection, sessionpart);\n var remoteMsid = SDPUtils.parseMsid(mediaSection);\n\n var mid = SDPUtils.getMid(mediaSection) || SDPUtils.generateIdentifier();\n\n // Reject datachannels which are not implemented yet.\n if (kind === 'application' && protocol === 'DTLS/SCTP') {\n self.transceivers[sdpMLineIndex] = {\n mid: mid,\n isDatachannel: true\n };\n return;\n }\n\n var transceiver;\n var iceGatherer;\n var iceTransport;\n var dtlsTransport;\n var rtpReceiver;\n var sendEncodingParameters;\n var recvEncodingParameters;\n var localCapabilities;\n\n var track;\n // FIXME: ensure the mediaSection has rtcp-mux set.\n var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection);\n var remoteIceParameters;\n var remoteDtlsParameters;\n if (!rejected) {\n remoteIceParameters = SDPUtils.getIceParameters(mediaSection,\n sessionpart);\n remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection,\n sessionpart);\n remoteDtlsParameters.role = 'client';\n }\n recvEncodingParameters =\n SDPUtils.parseRtpEncodingParameters(mediaSection);\n\n var rtcpParameters = SDPUtils.parseRtcpParameters(mediaSection);\n\n var isComplete = SDPUtils.matchPrefix(mediaSection,\n 'a=end-of-candidates', sessionpart).length > 0;\n var cands = SDPUtils.matchPrefix(mediaSection, 'a=candidate:')\n .map(function(cand) {\n return SDPUtils.parseCandidate(cand);\n })\n .filter(function(cand) {\n return cand.component === '1' || cand.component === 1;\n });\n if (description.type === 'offer' && !rejected) {\n transceiver = self.transceivers[sdpMLineIndex] ||\n self._createTransceiver(kind);\n transceiver.mid = mid;\n\n if (!transceiver.iceGatherer) {\n transceiver.iceGatherer = usingBundle && sdpMLineIndex > 0 ?\n self.transceivers[0].iceGatherer :\n self._createIceGatherer(mid, sdpMLineIndex);\n }\n\n if (isComplete && (!usingBundle || sdpMLineIndex === 0)) {\n transceiver.iceTransport.setRemoteCandidates(cands);\n }\n\n localCapabilities = RTCRtpReceiver.getCapabilities(kind);\n\n // filter RTX until additional stuff needed for RTX is implemented\n // in adapter.js\n if (edgeVersion < 15019) {\n localCapabilities.codecs = localCapabilities.codecs.filter(\n function(codec) {\n return codec.name !== 'rtx';\n });\n }\n\n sendEncodingParameters = [{\n ssrc: (2 * sdpMLineIndex + 2) * 1001\n }];\n\n if (direction === 'sendrecv' || direction === 'sendonly') {\n rtpReceiver = new RTCRtpReceiver(transceiver.dtlsTransport,\n kind);\n\n track = rtpReceiver.track;\n // FIXME: does not work with Plan B.\n if (remoteMsid) {\n if (!streams[remoteMsid.stream]) {\n streams[remoteMsid.stream] = new MediaStream();\n Object.defineProperty(streams[remoteMsid.stream], 'id', {\n get: function() {\n return remoteMsid.stream;\n }\n });\n }\n Object.defineProperty(track, 'id', {\n get: function() {\n return remoteMsid.track;\n }\n });\n streams[remoteMsid.stream].addTrack(track);\n receiverList.push([track, rtpReceiver,\n streams[remoteMsid.stream]]);\n } else {\n if (!streams.default) {\n streams.default = new MediaStream();\n }\n streams.default.addTrack(track);\n receiverList.push([track, rtpReceiver, streams.default]);\n }\n }\n\n transceiver.localCapabilities = localCapabilities;\n transceiver.remoteCapabilities = remoteCapabilities;\n transceiver.rtpReceiver = rtpReceiver;\n transceiver.rtcpParameters = rtcpParameters;\n transceiver.sendEncodingParameters = sendEncodingParameters;\n transceiver.recvEncodingParameters = recvEncodingParameters;\n\n // Start the RTCRtpReceiver now. The RTPSender is started in\n // setLocalDescription.\n self._transceive(self.transceivers[sdpMLineIndex],\n false,\n direction === 'sendrecv' || direction === 'sendonly');\n } else if (description.type === 'answer' && !rejected) {\n if (usingBundle && sdpMLineIndex > 0) {\n self._disposeIceAndDtlsTransports(sdpMLineIndex);\n self.transceivers[sdpMLineIndex].iceGatherer =\n self.transceivers[0].iceGatherer;\n self.transceivers[sdpMLineIndex].iceTransport =\n self.transceivers[0].iceTransport;\n self.transceivers[sdpMLineIndex].dtlsTransport =\n self.transceivers[0].dtlsTransport;\n if (self.transceivers[sdpMLineIndex].rtpSender) {\n self.transceivers[sdpMLineIndex].rtpSender.setTransport(\n self.transceivers[0].dtlsTransport);\n }\n if (self.transceivers[sdpMLineIndex].rtpReceiver) {\n self.transceivers[sdpMLineIndex].rtpReceiver.setTransport(\n self.transceivers[0].dtlsTransport);\n }\n }\n transceiver = self.transceivers[sdpMLineIndex];\n iceGatherer = transceiver.iceGatherer;\n iceTransport = transceiver.iceTransport;\n dtlsTransport = transceiver.dtlsTransport;\n rtpReceiver = transceiver.rtpReceiver;\n sendEncodingParameters = transceiver.sendEncodingParameters;\n localCapabilities = transceiver.localCapabilities;\n\n self.transceivers[sdpMLineIndex].recvEncodingParameters =\n recvEncodingParameters;\n self.transceivers[sdpMLineIndex].remoteCapabilities =\n remoteCapabilities;\n self.transceivers[sdpMLineIndex].rtcpParameters = rtcpParameters;\n\n if ((isIceLite || isComplete) && cands.length) {\n iceTransport.setRemoteCandidates(cands);\n }\n if (!usingBundle || sdpMLineIndex === 0) {\n iceTransport.start(iceGatherer, remoteIceParameters,\n 'controlling');\n dtlsTransport.start(remoteDtlsParameters);\n }\n\n self._transceive(transceiver,\n direction === 'sendrecv' || direction === 'recvonly',\n direction === 'sendrecv' || direction === 'sendonly');\n\n if (rtpReceiver &&\n (direction === 'sendrecv' || direction === 'sendonly')) {\n track = rtpReceiver.track;\n if (remoteMsid) {\n if (!streams[remoteMsid.stream]) {\n streams[remoteMsid.stream] = new MediaStream();\n }\n streams[remoteMsid.stream].addTrack(track);\n receiverList.push([track, rtpReceiver, streams[remoteMsid.stream]]);\n } else {\n if (!streams.default) {\n streams.default = new MediaStream();\n }\n streams.default.addTrack(track);\n receiverList.push([track, rtpReceiver, streams.default]);\n }\n } else {\n // FIXME: actually the receiver should be created later.\n delete transceiver.rtpReceiver;\n }\n }\n });\n\n this.remoteDescription = {\n type: description.type,\n sdp: description.sdp\n };\n switch (description.type) {\n case 'offer':\n this._updateSignalingState('have-remote-offer');\n break;\n case 'answer':\n this._updateSignalingState('stable');\n break;\n default:\n throw new TypeError('unsupported type \"' + description.type +\n '\"');\n }\n Object.keys(streams).forEach(function(sid) {\n var stream = streams[sid];\n if (stream.getTracks().length) {\n self.remoteStreams.push(stream);\n var event = new Event('addstream');\n event.stream = stream;\n self.dispatchEvent(event);\n if (self.onaddstream !== null) {\n window.setTimeout(function() {\n self.onaddstream(event);\n }, 0);\n }\n\n receiverList.forEach(function(item) {\n var track = item[0];\n var receiver = item[1];\n if (stream.id !== item[2].id) {\n return;\n }\n var trackEvent = new Event('track');\n trackEvent.track = track;\n trackEvent.receiver = receiver;\n trackEvent.streams = [stream];\n self.dispatchEvent(trackEvent);\n if (self.ontrack !== null) {\n window.setTimeout(function() {\n self.ontrack(trackEvent);\n }, 0);\n }\n });\n }\n });\n\n // check whether addIceCandidate({}) was called within four seconds after\n // setRemoteDescription.\n window.setTimeout(function() {\n if (!(self && self.transceivers)) {\n return;\n }\n self.transceivers.forEach(function(transceiver) {\n if (transceiver.iceTransport &&\n transceiver.iceTransport.state === 'new' &&\n transceiver.iceTransport.getRemoteCandidates().length > 0) {\n console.warn('Timeout for addRemoteCandidate. Consider sending ' +\n 'an end-of-candidates notification');\n transceiver.iceTransport.addRemoteCandidate({});\n }\n });\n }, 4000);\n\n if (arguments.length > 1 && typeof arguments[1] === 'function') {\n window.setTimeout(arguments[1], 0);\n }\n return Promise.resolve();\n };\n\n RTCPeerConnection.prototype.close = function() {\n this.transceivers.forEach(function(transceiver) {\n /* not yet\n if (transceiver.iceGatherer) {\n transceiver.iceGatherer.close();\n }\n */\n if (transceiver.iceTransport) {\n transceiver.iceTransport.stop();\n }\n if (transceiver.dtlsTransport) {\n transceiver.dtlsTransport.stop();\n }\n if (transceiver.rtpSender) {\n transceiver.rtpSender.stop();\n }\n if (transceiver.rtpReceiver) {\n transceiver.rtpReceiver.stop();\n }\n });\n // FIXME: clean up tracks, local streams, remote streams, etc\n this._updateSignalingState('closed');\n };\n\n // Update the signaling state.\n RTCPeerConnection.prototype._updateSignalingState = function(newState) {\n this.signalingState = newState;\n var event = new Event('signalingstatechange');\n this.dispatchEvent(event);\n if (this.onsignalingstatechange !== null) {\n this.onsignalingstatechange(event);\n }\n };\n\n // Determine whether to fire the negotiationneeded event.\n RTCPeerConnection.prototype._maybeFireNegotiationNeeded = function() {\n var self = this;\n if (this.signalingState !== 'stable' || this.needNegotiation === true) {\n return;\n }\n this.needNegotiation = true;\n window.setTimeout(function() {\n if (self.needNegotiation === false) {\n return;\n }\n self.needNegotiation = false;\n var event = new Event('negotiationneeded');\n self.dispatchEvent(event);\n if (self.onnegotiationneeded !== null) {\n self.onnegotiationneeded(event);\n }\n }, 0);\n };\n\n // Update the connection state.\n RTCPeerConnection.prototype._updateConnectionState = function() {\n var self = this;\n var newState;\n var states = {\n 'new': 0,\n closed: 0,\n connecting: 0,\n checking: 0,\n connected: 0,\n completed: 0,\n failed: 0\n };\n this.transceivers.forEach(function(transceiver) {\n states[transceiver.iceTransport.state]++;\n states[transceiver.dtlsTransport.state]++;\n });\n // ICETransport.completed and connected are the same for this purpose.\n states.connected += states.completed;\n\n newState = 'new';\n if (states.failed > 0) {\n newState = 'failed';\n } else if (states.connecting > 0 || states.checking > 0) {\n newState = 'connecting';\n } else if (states.disconnected > 0) {\n newState = 'disconnected';\n } else if (states.new > 0) {\n newState = 'new';\n } else if (states.connected > 0 || states.completed > 0) {\n newState = 'connected';\n }\n\n if (newState !== self.iceConnectionState) {\n self.iceConnectionState = newState;\n var event = new Event('iceconnectionstatechange');\n this.dispatchEvent(event);\n if (this.oniceconnectionstatechange !== null) {\n this.oniceconnectionstatechange(event);\n }\n }\n };\n\n RTCPeerConnection.prototype.createOffer = function() {\n var self = this;\n if (this._pendingOffer) {\n throw new Error('createOffer called while there is a pending offer.');\n }\n var offerOptions;\n if (arguments.length === 1 && typeof arguments[0] !== 'function') {\n offerOptions = arguments[0];\n } else if (arguments.length === 3) {\n offerOptions = arguments[2];\n }\n\n var numAudioTracks = this.transceivers.filter(function(t) {\n return t.kind === 'audio';\n }).length;\n var numVideoTracks = this.transceivers.filter(function(t) {\n return t.kind === 'video';\n }).length;\n\n // Determine number of audio and video tracks we need to send/recv.\n if (offerOptions) {\n // Reject Chrome legacy constraints.\n if (offerOptions.mandatory || offerOptions.optional) {\n throw new TypeError(\n 'Legacy mandatory/optional constraints not supported.');\n }\n if (offerOptions.offerToReceiveAudio !== undefined) {\n if (offerOptions.offerToReceiveAudio === true) {\n numAudioTracks = 1;\n } else if (offerOptions.offerToReceiveAudio === false) {\n numAudioTracks = 0;\n } else {\n numAudioTracks = offerOptions.offerToReceiveAudio;\n }\n }\n if (offerOptions.offerToReceiveVideo !== undefined) {\n if (offerOptions.offerToReceiveVideo === true) {\n numVideoTracks = 1;\n } else if (offerOptions.offerToReceiveVideo === false) {\n numVideoTracks = 0;\n } else {\n numVideoTracks = offerOptions.offerToReceiveVideo;\n }\n }\n }\n\n this.transceivers.forEach(function(transceiver) {\n if (transceiver.kind === 'audio') {\n numAudioTracks--;\n if (numAudioTracks < 0) {\n transceiver.wantReceive = false;\n }\n } else if (transceiver.kind === 'video') {\n numVideoTracks--;\n if (numVideoTracks < 0) {\n transceiver.wantReceive = false;\n }\n }\n });\n\n // Create M-lines for recvonly streams.\n while (numAudioTracks > 0 || numVideoTracks > 0) {\n if (numAudioTracks > 0) {\n this._createTransceiver('audio');\n numAudioTracks--;\n }\n if (numVideoTracks > 0) {\n this._createTransceiver('video');\n numVideoTracks--;\n }\n }\n // reorder tracks\n var transceivers = sortTracks(this.transceivers);\n\n var sdp = SDPUtils.writeSessionBoilerplate();\n transceivers.forEach(function(transceiver, sdpMLineIndex) {\n // For each track, create an ice gatherer, ice transport,\n // dtls transport, potentially rtpsender and rtpreceiver.\n var track = transceiver.track;\n var kind = transceiver.kind;\n var mid = SDPUtils.generateIdentifier();\n transceiver.mid = mid;\n\n if (!transceiver.iceGatherer) {\n transceiver.iceGatherer = self.usingBundle && sdpMLineIndex > 0 ?\n transceivers[0].iceGatherer :\n self._createIceGatherer(mid, sdpMLineIndex);\n }\n\n var localCapabilities = RTCRtpSender.getCapabilities(kind);\n // filter RTX until additional stuff needed for RTX is implemented\n // in adapter.js\n if (edgeVersion < 15019) {\n localCapabilities.codecs = localCapabilities.codecs.filter(\n function(codec) {\n return codec.name !== 'rtx';\n });\n }\n localCapabilities.codecs.forEach(function(codec) {\n // work around https://bugs.chromium.org/p/webrtc/issues/detail?id=6552\n // by adding level-asymmetry-allowed=1\n if (codec.name === 'H264' &&\n codec.parameters['level-asymmetry-allowed'] === undefined) {\n codec.parameters['level-asymmetry-allowed'] = '1';\n }\n });\n\n // generate an ssrc now, to be used later in rtpSender.send\n var sendEncodingParameters = [{\n ssrc: (2 * sdpMLineIndex + 1) * 1001\n }];\n if (track) {\n // add RTX\n if (edgeVersion >= 15019 && kind === 'video') {\n sendEncodingParameters[0].rtx = {\n ssrc: (2 * sdpMLineIndex + 1) * 1001 + 1\n };\n }\n }\n\n if (transceiver.wantReceive) {\n transceiver.rtpReceiver = new RTCRtpReceiver(transceiver.dtlsTransport,\n kind);\n }\n\n transceiver.localCapabilities = localCapabilities;\n transceiver.sendEncodingParameters = sendEncodingParameters;\n });\n\n // always offer BUNDLE and dispose on return if not supported.\n if (this._config.bundlePolicy !== 'max-compat') {\n sdp += 'a=group:BUNDLE ' + transceivers.map(function(t) {\n return t.mid;\n }).join(' ') + '\\r\\n';\n }\n sdp += 'a=ice-options:trickle\\r\\n';\n\n transceivers.forEach(function(transceiver, sdpMLineIndex) {\n sdp += SDPUtils.writeMediaSection(transceiver,\n transceiver.localCapabilities, 'offer', transceiver.stream);\n sdp += 'a=rtcp-rsize\\r\\n';\n });\n\n this._pendingOffer = transceivers;\n var desc = new RTCSessionDescription({\n type: 'offer',\n sdp: sdp\n });\n if (arguments.length && typeof arguments[0] === 'function') {\n window.setTimeout(arguments[0], 0, desc);\n }\n return Promise.resolve(desc);\n };\n\n RTCPeerConnection.prototype.createAnswer = function() {\n var sdp = SDPUtils.writeSessionBoilerplate();\n if (this.usingBundle) {\n sdp += 'a=group:BUNDLE ' + this.transceivers.map(function(t) {\n return t.mid;\n }).join(' ') + '\\r\\n';\n }\n this.transceivers.forEach(function(transceiver, sdpMLineIndex) {\n if (transceiver.isDatachannel) {\n sdp += 'm=application 0 DTLS/SCTP 5000\\r\\n' +\n 'c=IN IP4 0.0.0.0\\r\\n' +\n 'a=mid:' + transceiver.mid + '\\r\\n';\n return;\n }\n\n // FIXME: look at direction.\n if (transceiver.stream) {\n var localTrack;\n if (transceiver.kind === 'audio') {\n localTrack = transceiver.stream.getAudioTracks()[0];\n } else if (transceiver.kind === 'video') {\n localTrack = transceiver.stream.getVideoTracks()[0];\n }\n if (localTrack) {\n // add RTX\n if (edgeVersion >= 15019 && transceiver.kind === 'video') {\n transceiver.sendEncodingParameters[0].rtx = {\n ssrc: (2 * sdpMLineIndex + 2) * 1001 + 1\n };\n }\n }\n }\n\n // Calculate intersection of capabilities.\n var commonCapabilities = getCommonCapabilities(\n transceiver.localCapabilities,\n transceiver.remoteCapabilities);\n\n var hasRtx = commonCapabilities.codecs.filter(function(c) {\n return c.name.toLowerCase() === 'rtx';\n }).length;\n if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {\n delete transceiver.sendEncodingParameters[0].rtx;\n }\n\n sdp += SDPUtils.writeMediaSection(transceiver, commonCapabilities,\n 'answer', transceiver.stream);\n if (transceiver.rtcpParameters &&\n transceiver.rtcpParameters.reducedSize) {\n sdp += 'a=rtcp-rsize\\r\\n';\n }\n });\n\n var desc = new RTCSessionDescription({\n type: 'answer',\n sdp: sdp\n });\n if (arguments.length && typeof arguments[0] === 'function') {\n window.setTimeout(arguments[0], 0, desc);\n }\n return Promise.resolve(desc);\n };\n\n RTCPeerConnection.prototype.addIceCandidate = function(candidate) {\n if (!candidate) {\n for (var j = 0; j < this.transceivers.length; j++) {\n this.transceivers[j].iceTransport.addRemoteCandidate({});\n if (this.usingBundle) {\n return Promise.resolve();\n }\n }\n } else {\n var mLineIndex = candidate.sdpMLineIndex;\n if (candidate.sdpMid) {\n for (var i = 0; i < this.transceivers.length; i++) {\n if (this.transceivers[i].mid === candidate.sdpMid) {\n mLineIndex = i;\n break;\n }\n }\n }\n var transceiver = this.transceivers[mLineIndex];\n if (transceiver) {\n var cand = Object.keys(candidate.candidate).length > 0 ?\n SDPUtils.parseCandidate(candidate.candidate) : {};\n // Ignore Chrome's invalid candidates since Edge does not like them.\n if (cand.protocol === 'tcp' && (cand.port === 0 || cand.port === 9)) {\n return Promise.resolve();\n }\n // Ignore RTCP candidates, we assume RTCP-MUX.\n if (cand.component &&\n !(cand.component === '1' || cand.component === 1)) {\n return Promise.resolve();\n }\n transceiver.iceTransport.addRemoteCandidate(cand);\n\n // update the remoteDescription.\n var sections = SDPUtils.splitSections(this.remoteDescription.sdp);\n sections[mLineIndex + 1] += (cand.type ? candidate.candidate.trim()\n : 'a=end-of-candidates') + '\\r\\n';\n this.remoteDescription.sdp = sections.join('');\n }\n }\n if (arguments.length > 1 && typeof arguments[1] === 'function') {\n window.setTimeout(arguments[1], 0);\n }\n return Promise.resolve();\n };\n\n RTCPeerConnection.prototype.getStats = function() {\n var promises = [];\n this.transceivers.forEach(function(transceiver) {\n ['rtpSender', 'rtpReceiver', 'iceGatherer', 'iceTransport',\n 'dtlsTransport'].forEach(function(method) {\n if (transceiver[method]) {\n promises.push(transceiver[method].getStats());\n }\n });\n });\n var cb = arguments.length > 1 && typeof arguments[1] === 'function' &&\n arguments[1];\n var fixStatsType = function(stat) {\n return {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n }[stat.type] || stat.type;\n };\n return new Promise(function(resolve) {\n // shim getStats with maplike support\n var results = new Map();\n Promise.all(promises).then(function(res) {\n res.forEach(function(result) {\n Object.keys(result).forEach(function(id) {\n result[id].type = fixStatsType(result[id]);\n results.set(id, result[id]);\n });\n });\n if (cb) {\n window.setTimeout(cb, 0, results);\n }\n resolve(results);\n });\n });\n };\n return RTCPeerConnection;\n};\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n\nvar browserDetails = __webpack_require__(0).browserDetails;\n\nvar firefoxShim = {\n shimOnTrack: function() {\n if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in\n window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {\n get: function() {\n return this._ontrack;\n },\n set: function(f) {\n if (this._ontrack) {\n this.removeEventListener('track', this._ontrack);\n this.removeEventListener('addstream', this._ontrackpoly);\n }\n this.addEventListener('track', this._ontrack = f);\n this.addEventListener('addstream', this._ontrackpoly = function(e) {\n e.stream.getTracks().forEach(function(track) {\n var event = new Event('track');\n event.track = track;\n event.receiver = {track: track};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n }.bind(this));\n }.bind(this));\n }\n });\n }\n },\n\n shimSourceObject: function() {\n // Firefox has supported mozSrcObject since FF22, unprefixed in 42.\n if (typeof window === 'object') {\n if (window.HTMLMediaElement &&\n !('srcObject' in window.HTMLMediaElement.prototype)) {\n // Shim the srcObject property, once, when HTMLMediaElement is found.\n Object.defineProperty(window.HTMLMediaElement.prototype, 'srcObject', {\n get: function() {\n return this.mozSrcObject;\n },\n set: function(stream) {\n this.mozSrcObject = stream;\n }\n });\n }\n }\n },\n\n shimPeerConnection: function() {\n if (typeof window !== 'object' || !(window.RTCPeerConnection ||\n window.mozRTCPeerConnection)) {\n return; // probably media.peerconnection.enabled=false in about:config\n }\n // The RTCPeerConnection object.\n if (!window.RTCPeerConnection) {\n window.RTCPeerConnection = function(pcConfig, pcConstraints) {\n if (browserDetails.version < 38) {\n // .urls is not supported in FF < 38.\n // create RTCIceServers with a single url.\n if (pcConfig && pcConfig.iceServers) {\n var newIceServers = [];\n for (var i = 0; i < pcConfig.iceServers.length; i++) {\n var server = pcConfig.iceServers[i];\n if (server.hasOwnProperty('urls')) {\n for (var j = 0; j < server.urls.length; j++) {\n var newServer = {\n url: server.urls[j]\n };\n if (server.urls[j].indexOf('turn') === 0) {\n newServer.username = server.username;\n newServer.credential = server.credential;\n }\n newIceServers.push(newServer);\n }\n } else {\n newIceServers.push(pcConfig.iceServers[i]);\n }\n }\n pcConfig.iceServers = newIceServers;\n }\n }\n return new mozRTCPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = mozRTCPeerConnection.prototype;\n\n // wrap static methods. Currently just generateCertificate.\n if (mozRTCPeerConnection.generateCertificate) {\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get: function() {\n return mozRTCPeerConnection.generateCertificate;\n }\n });\n }\n\n window.RTCSessionDescription = mozRTCSessionDescription;\n window.RTCIceCandidate = mozRTCIceCandidate;\n }\n\n // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n RTCIceCandidate : RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n };\n });\n\n // support for addIceCandidate(null or undefined)\n var nativeAddIceCandidate =\n RTCPeerConnection.prototype.addIceCandidate;\n RTCPeerConnection.prototype.addIceCandidate = function() {\n if (!arguments[0]) {\n if (arguments[1]) {\n arguments[1].apply(null);\n }\n return Promise.resolve();\n }\n return nativeAddIceCandidate.apply(this, arguments);\n };\n\n // shim getStats with maplike support\n var makeMapStats = function(stats) {\n var map = new Map();\n Object.keys(stats).forEach(function(key) {\n map.set(key, stats[key]);\n map[key] = stats[key];\n });\n return map;\n };\n\n var modernStatsTypes = {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n };\n\n var nativeGetStats = RTCPeerConnection.prototype.getStats;\n RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {\n return nativeGetStats.apply(this, [selector || null])\n .then(function(stats) {\n if (browserDetails.version < 48) {\n stats = makeMapStats(stats);\n }\n if (browserDetails.version < 53 && !onSucc) {\n // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach(function(stat) {\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n }\n // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n stats.forEach(function(stat, i) {\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n }\n return stats;\n })\n .then(onSucc, onErr);\n };\n }\n};\n\n// Expose public methods.\nmodule.exports = {\n shimOnTrack: firefoxShim.shimOnTrack,\n shimSourceObject: firefoxShim.shimSourceObject,\n shimPeerConnection: firefoxShim.shimPeerConnection,\n shimGetUserMedia: __webpack_require__(12)\n};\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n\nvar logging = __webpack_require__(0).log;\nvar browserDetails = __webpack_require__(0).browserDetails;\n\n// Expose public methods.\nmodule.exports = function() {\n var shimError_ = function(e) {\n return {\n name: {\n InternalError: 'NotReadableError',\n NotSupportedError: 'TypeError',\n PermissionDeniedError: 'NotAllowedError',\n SecurityError: 'NotAllowedError'\n }[e.name] || e.name,\n message: {\n 'The operation is insecure.': 'The request is not allowed by the ' +\n 'user agent or the platform in the current context.'\n }[e.message] || e.message,\n constraint: e.constraint,\n toString: function() {\n return this.name + (this.message && ': ') + this.message;\n }\n };\n };\n\n // getUserMedia constraints shim.\n var getUserMedia_ = function(constraints, onSuccess, onError) {\n var constraintsToFF37_ = function(c) {\n if (typeof c !== 'object' || c.require) {\n return c;\n }\n var require = [];\n Object.keys(c).forEach(function(key) {\n if (key === 'require' || key === 'advanced' || key === 'mediaSource') {\n return;\n }\n var r = c[key] = (typeof c[key] === 'object') ?\n c[key] : {ideal: c[key]};\n if (r.min !== undefined ||\n r.max !== undefined || r.exact !== undefined) {\n require.push(key);\n }\n if (r.exact !== undefined) {\n if (typeof r.exact === 'number') {\n r. min = r.max = r.exact;\n } else {\n c[key] = r.exact;\n }\n delete r.exact;\n }\n if (r.ideal !== undefined) {\n c.advanced = c.advanced || [];\n var oc = {};\n if (typeof r.ideal === 'number') {\n oc[key] = {min: r.ideal, max: r.ideal};\n } else {\n oc[key] = r.ideal;\n }\n c.advanced.push(oc);\n delete r.ideal;\n if (!Object.keys(r).length) {\n delete c[key];\n }\n }\n });\n if (require.length) {\n c.require = require;\n }\n return c;\n };\n constraints = JSON.parse(JSON.stringify(constraints));\n if (browserDetails.version < 38) {\n logging('spec: ' + JSON.stringify(constraints));\n if (constraints.audio) {\n constraints.audio = constraintsToFF37_(constraints.audio);\n }\n if (constraints.video) {\n constraints.video = constraintsToFF37_(constraints.video);\n }\n logging('ff37: ' + JSON.stringify(constraints));\n }\n return navigator.mozGetUserMedia(constraints, onSuccess, function(e) {\n onError(shimError_(e));\n });\n };\n\n // Returns the result of getUserMedia as a Promise.\n var getUserMediaPromise_ = function(constraints) {\n return new Promise(function(resolve, reject) {\n getUserMedia_(constraints, resolve, reject);\n });\n };\n\n // Shim for mediaDevices on older versions.\n if (!navigator.mediaDevices) {\n navigator.mediaDevices = {getUserMedia: getUserMediaPromise_,\n addEventListener: function() { },\n removeEventListener: function() { }\n };\n }\n navigator.mediaDevices.enumerateDevices =\n navigator.mediaDevices.enumerateDevices || function() {\n return new Promise(function(resolve) {\n var infos = [\n {kind: 'audioinput', deviceId: 'default', label: '', groupId: ''},\n {kind: 'videoinput', deviceId: 'default', label: '', groupId: ''}\n ];\n resolve(infos);\n });\n };\n\n if (browserDetails.version < 41) {\n // Work around http://bugzil.la/1169665\n var orgEnumerateDevices =\n navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);\n navigator.mediaDevices.enumerateDevices = function() {\n return orgEnumerateDevices().then(undefined, function(e) {\n if (e.name === 'NotFoundError') {\n return [];\n }\n throw e;\n });\n };\n }\n if (browserDetails.version < 49) {\n var origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n return origGetUserMedia(c).then(function(stream) {\n // Work around https://bugzil.la/802326\n if (c.audio && !stream.getAudioTracks().length ||\n c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach(function(track) {\n track.stop();\n });\n throw new DOMException('The object can not be found here.',\n 'NotFoundError');\n }\n return stream;\n }, function(e) {\n return Promise.reject(shimError_(e));\n });\n };\n }\n navigator.getUserMedia = function(constraints, onSuccess, onError) {\n if (browserDetails.version < 44) {\n return getUserMedia_(constraints, onSuccess, onError);\n }\n // Replace Firefox 44+'s deprecation warning with unprefixed version.\n console.warn('navigator.getUserMedia has been replaced by ' +\n 'navigator.mediaDevices.getUserMedia');\n navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);\n };\n};\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n\nvar safariShim = {\n // TODO: DrAlex, should be here, double check against LayoutTests\n\n // TODO: once the back-end for the mac port is done, add.\n // TODO: check for webkitGTK+\n // shimPeerConnection: function() { },\n\n shimAddStream: function() {\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('addStream' in window.RTCPeerConnection.prototype)) {\n RTCPeerConnection.prototype.addStream = function(stream) {\n var self = this;\n stream.getTracks().forEach(function(track) {\n self.addTrack(track, stream);\n });\n };\n }\n },\n shimOnAddStream: function() {\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('onaddstream' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {\n get: function() {\n return this._onaddstream;\n },\n set: function(f) {\n if (this._onaddstream) {\n this.removeEventListener('addstream', this._onaddstream);\n this.removeEventListener('track', this._onaddstreampoly);\n }\n this.addEventListener('addstream', this._onaddstream = f);\n this.addEventListener('track', this._onaddstreampoly = function(e) {\n var stream = e.streams[0];\n if (!this._streams) {\n this._streams = [];\n }\n if (this._streams.indexOf(stream) >= 0) {\n return;\n }\n this._streams.push(stream);\n var event = new Event('addstream');\n event.stream = e.streams[0];\n this.dispatchEvent(event);\n }.bind(this));\n }\n });\n }\n },\n shimCallbacksAPI: function() {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n var prototype = RTCPeerConnection.prototype;\n var createOffer = prototype.createOffer;\n var createAnswer = prototype.createAnswer;\n var setLocalDescription = prototype.setLocalDescription;\n var setRemoteDescription = prototype.setRemoteDescription;\n var addIceCandidate = prototype.addIceCandidate;\n\n prototype.createOffer = function(successCallback, failureCallback) {\n var options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n var promise = createOffer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n prototype.createAnswer = function(successCallback, failureCallback) {\n var options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n var promise = createAnswer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n var withCallback = function(description, successCallback, failureCallback) {\n var promise = setLocalDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setLocalDescription = withCallback;\n\n withCallback = function(description, successCallback, failureCallback) {\n var promise = setRemoteDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setRemoteDescription = withCallback;\n\n withCallback = function(candidate, successCallback, failureCallback) {\n var promise = addIceCandidate.apply(this, [candidate]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.addIceCandidate = withCallback;\n },\n shimGetUserMedia: function() {\n if (!navigator.getUserMedia) {\n if (navigator.webkitGetUserMedia) {\n navigator.getUserMedia = navigator.webkitGetUserMedia.bind(navigator);\n } else if (navigator.mediaDevices &&\n navigator.mediaDevices.getUserMedia) {\n navigator.getUserMedia = function(constraints, cb, errcb) {\n navigator.mediaDevices.getUserMedia(constraints)\n .then(cb, errcb);\n }.bind(navigator);\n }\n }\n }\n};\n\n// Expose public methods.\nmodule.exports = {\n shimCallbacksAPI: safariShim.shimCallbacksAPI,\n shimAddStream: safariShim.shimAddStream,\n shimOnAddStream: safariShim.shimOnAddStream,\n shimGetUserMedia: safariShim.shimGetUserMedia\n // TODO\n // shimPeerConnection: safariShim.shimPeerConnection\n};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\nfunction QRScanner() {\n var createQRScannerAdapter = __webpack_require__(2);\n var createQRScannerInternal = __webpack_require__(1);\n\n var internal = createQRScannerInternal();\n var functionList = {\n prepare: internal.prepare,\n show: internal.show,\n hide: internal.hide,\n scan: internal.scan,\n cancelScan: internal.cancelScan,\n pausePreview: internal.pausePreview,\n resumePreview: internal.resumePreview,\n enableLight: internal.enableLight,\n disableLight: internal.disableLight,\n useCamera: internal.useCamera,\n openSettings: internal.openSettings,\n getStatus: internal.getStatus,\n destroy: internal.destroy\n };\n\n // always returns an executable function for use by the internal component\n // if a callback is provided, use it\n function getFunc(callback){\n if(typeof callback === \"function\"){\n return callback;\n }\n return function(){\n // callback is not needed\n return;\n };\n }\n\n // shim cordova's functionality for library usage\n var shimCordova = {\n exec: function(successCallback, errorCallback, className, functionName, inputArray){\n if(className !== 'QRScanner' || !functionList[functionName]){\n return errorCallback(0);\n }\n if(inputArray){\n functionList[functionName](getFunc(successCallback), getFunc(errorCallback), inputArray);\n } else {\n functionList[functionName](getFunc(successCallback), getFunc(errorCallback));\n }\n }\n };\n\n var adapter = createQRScannerAdapter(shimCordova);\n return adapter;\n}\n\nmodule.exports = new QRScanner();\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// cordova-plugin-qrscanner-lib.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 14);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 93abf133c0670beedd53","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\n\nvar logDisabled_ = true;\n\n// Utility methods.\nvar utils = {\n disableLog: function(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n logDisabled_ = bool;\n return (bool) ? 'adapter.js logging disabled' :\n 'adapter.js logging enabled';\n },\n\n log: function() {\n if (typeof window === 'object') {\n if (logDisabled_) {\n return;\n }\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n console.log.apply(console, arguments);\n }\n }\n },\n\n /**\n * Extract browser version out of the provided user agent string.\n *\n * @param {!string} uastring userAgent string.\n * @param {!string} expr Regular expression used as match criteria.\n * @param {!number} pos position in the version string to be returned.\n * @return {!number} browser version.\n */\n extractVersion: function(uastring, expr, pos) {\n var match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n },\n\n /**\n * Browser detector.\n *\n * @return {object} result containing browser and version\n * properties.\n */\n detectBrowser: function() {\n // Returned result object.\n var result = {};\n result.browser = null;\n result.version = null;\n\n // Fail early if it's not a browser\n if (typeof window === 'undefined' || !window.navigator) {\n result.browser = 'Not a browser.';\n return result;\n }\n\n // Firefox.\n if (navigator.mozGetUserMedia) {\n result.browser = 'firefox';\n result.version = this.extractVersion(navigator.userAgent,\n /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia) {\n // Chrome, Chromium, Webview, Opera, all use the chrome shim for now\n if (window.webkitRTCPeerConnection) {\n result.browser = 'chrome';\n result.version = this.extractVersion(navigator.userAgent,\n /Chrom(e|ium)\\/(\\d+)\\./, 2);\n } else { // Safari (in an unpublished version) or unknown webkit-based.\n if (navigator.userAgent.match(/Version\\/(\\d+).(\\d+)/)) {\n result.browser = 'safari';\n result.version = this.extractVersion(navigator.userAgent,\n /AppleWebKit\\/(\\d+)\\./, 1);\n } else { // unknown webkit-based browser.\n result.browser = 'Unsupported webkit-based browser ' +\n 'with GUM support but no WebRTC support.';\n return result;\n }\n }\n } else if (navigator.mediaDevices &&\n navigator.userAgent.match(/Edge\\/(\\d+).(\\d+)$/)) { // Edge.\n result.browser = 'edge';\n result.version = this.extractVersion(navigator.userAgent,\n /Edge\\/(\\d+).(\\d+)$/, 2);\n } else if (navigator.mediaDevices &&\n navigator.userAgent.match(/AppleWebKit\\/(\\d+)\\./)) {\n // Safari, with webkitGetUserMedia removed.\n result.browser = 'safari';\n result.version = this.extractVersion(navigator.userAgent,\n /AppleWebKit\\/(\\d+)\\./, 1);\n } else { // Default fallthrough: not supported.\n result.browser = 'Not a supported browser.';\n return result;\n }\n\n return result;\n },\n\n // shimCreateObjectURL must be called before shimSourceObject to avoid loop.\n\n shimCreateObjectURL: function() {\n if (!(typeof window === 'object' && window.HTMLMediaElement &&\n 'srcObject' in window.HTMLMediaElement.prototype)) {\n // Only shim CreateObjectURL using srcObject if srcObject exists.\n return undefined;\n }\n\n var nativeCreateObjectURL = URL.createObjectURL.bind(URL);\n var nativeRevokeObjectURL = URL.revokeObjectURL.bind(URL);\n var streams = new Map(), newId = 0;\n\n URL.createObjectURL = function(stream) {\n if ('getTracks' in stream) {\n var url = 'polyblob:' + (++newId);\n streams.set(url, stream);\n console.log('URL.createObjectURL(stream) is deprecated! ' +\n 'Use elem.srcObject = stream instead!');\n return url;\n }\n return nativeCreateObjectURL(stream);\n };\n URL.revokeObjectURL = function(url) {\n nativeRevokeObjectURL(url);\n streams.delete(url);\n };\n\n var dsc = Object.getOwnPropertyDescriptor(window.HTMLMediaElement.prototype,\n 'src');\n Object.defineProperty(window.HTMLMediaElement.prototype, 'src', {\n get: function() {\n return dsc.get.apply(this);\n },\n set: function(url) {\n this.srcObject = streams.get(url) || null;\n return dsc.set.apply(this, [url]);\n }\n });\n\n var nativeSetAttribute = HTMLMediaElement.prototype.setAttribute;\n HTMLMediaElement.prototype.setAttribute = function() {\n if (arguments.length === 2 &&\n ('' + arguments[0]).toLowerCase() === 'src') {\n this.srcObject = streams.get(arguments[1]) || null;\n }\n return nativeSetAttribute.apply(this, arguments);\n };\n }\n};\n\n// Export.\nmodule.exports = {\n log: utils.log,\n disableLog: utils.disableLog,\n browserDetails: utils.detectBrowser(),\n extractVersion: utils.extractVersion,\n shimCreateObjectURL: utils.shimCreateObjectURL,\n detectBrowser: utils.detectBrowser.bind(utils)\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/utils.js\n// module id = 0\n// module chunks = 0","require('webrtc-adapter');\nvar workerScript = require(\"raw-loader!../worker.min.js\");\n\nmodule.exports = function(){\n\n var ELEMENTS = {\n preview: 'cordova-plugin-qrscanner-video-preview',\n still: 'cordova-plugin-qrscanner-still'\n };\n var ZINDEXES = {\n preview: -100,\n still: -99\n };\n var backCamera = null;\n var frontCamera = null;\n var currentCamera = 0;\n var activeMediaStream = null;\n var scanning = false;\n var previewing = false;\n var scanWorker = null;\n var thisScanCycle = null;\n var nextScan = null;\n var cancelNextScan = null;\n\n // standard screen widths/heights, from 4k down to 320x240\n // widths and heights are each tested separately to account for screen rotation\n var standardWidthsAndHeights = [\n 5120, 4096, 3840, 3440, 3200, 3072, 3000, 2880, 2800, 2736, 2732, 2560,\n 2538, 2400, 2304, 2160, 2100, 2048, 2000, 1920, 1856, 1824, 1800, 1792,\n 1776, 1728, 1700, 1680, 1600, 1536, 1440, 1400, 1392, 1366, 1344, 1334,\n 1280, 1200, 1152, 1136, 1120, 1080, 1050, 1024, 1000, 960, 900, 854, 848,\n 832, 800, 768, 750, 720, 640, 624, 600, 576, 544, 540, 512, 480, 320, 240\n ];\n\n var facingModes = [\n 'environment',\n 'user'\n ];\n\n //utils\n function killStream(mediaStream){\n mediaStream.getTracks().forEach(function(track){\n track.stop();\n });\n }\n\n // For performance, we test best-to-worst constraints. Once we find a match,\n // we move to the next test. Since `ConstraintNotSatisfiedError`s are thrown\n // much faster than streams can be started and stopped, the scan is much\n // faster, even though it may iterate through more constraint objects.\n function getCameraSpecsById(deviceId){\n\n // return a getUserMedia Constraints\n function getConstraintObj(deviceId, facingMode, width, height){\n var obj = { audio: false, video: {} };\n obj.video.deviceId = {exact: deviceId};\n if(facingMode) {\n obj.video.facingMode = {exact: facingMode};\n }\n if(width) {\n obj.video.width = {exact: width};\n }\n if(height) {\n obj.video.height = {exact: height};\n }\n return obj;\n }\n\n var facingModeConstraints = facingModes.map(function(mode){\n \treturn getConstraintObj(deviceId, mode);\n });\n var widthConstraints = standardWidthsAndHeights.map(function(width){\n \treturn getConstraintObj(deviceId, null, width);\n });\n var heightConstraints = standardWidthsAndHeights.map(function(height){\n \treturn getConstraintObj(deviceId, null, null, height);\n });\n\n // create a promise which tries to resolve the best constraints for this deviceId\n // rather than reject, failures return a value of `null`\n function getFirstResolvingConstraint(constraintsBestToWorst){\n return new Promise(function(resolveBestConstraints){\n // build a chain of promises which either resolves or continues searching\n return constraintsBestToWorst.reduce(function(chain, next){\n return chain.then(function(searchState){\n if(searchState.found){\n // The best working constraint was found. Skip further tests.\n return searchState;\n } else {\n searchState.nextConstraint = next;\n return window.navigator.mediaDevices.getUserMedia(searchState.nextConstraint).then(function(mediaStream){\n // We found the first working constraint object, now we can stop\n // the stream and short-circuit the search.\n killStream(mediaStream);\n searchState.found = true;\n return searchState;\n }, function(){\n // didn't get a media stream. The search continues:\n return searchState;\n });\n }\n });\n }, Promise.resolve({\n // kick off the search:\n found: false,\n nextConstraint: {}\n })).then(function(searchState){\n if(searchState.found){\n resolveBestConstraints(searchState.nextConstraint);\n } else {\n resolveBestConstraints(null);\n }\n });\n });\n }\n\n return getFirstResolvingConstraint(facingModeConstraints).then(function(facingModeSpecs){\n return getFirstResolvingConstraint(widthConstraints).then(function(widthSpecs){\n return getFirstResolvingConstraint(heightConstraints).then(function(heightSpecs){\n return {\n deviceId: deviceId,\n facingMode: facingModeSpecs === null ? null : facingModeSpecs.video.facingMode.exact,\n width: widthSpecs === null ? null : widthSpecs.video.width.exact,\n height: heightSpecs === null ? null : heightSpecs.video.height.exact\n };\n });\n });\n });\n }\n\n function chooseCameras(){\n var devices = window.navigator.mediaDevices.enumerateDevices();\n return devices.then(function(mediaDeviceInfoList){\n var videoDeviceIds = mediaDeviceInfoList.filter(function(elem){\n return elem.kind === 'videoinput';\n }).map(function(elem){\n return elem.deviceId;\n });\n return videoDeviceIds;\n }).then(function(videoDeviceIds){\n // there is no standardized way for us to get the specs of each camera\n // (due to concerns over user fingerprinting), so we're forced to\n // iteratively test each camera for it's capabilities\n var searches = [];\n videoDeviceIds.forEach(function(id){\n searches.push(getCameraSpecsById(id));\n });\n return Promise.all(searches);\n }).then(function(cameraSpecsArray){\n return cameraSpecsArray.filter(function(camera){\n // filter out any cameras where width and height could not be captured\n if(camera !== null && camera.width !== null && camera.height !== null){\n return true;\n }\n }).sort(function(a, b){\n // sort cameras from highest resolution (by width) to lowest\n return b.width - a.width;\n });\n }).then(function(bestToWorstCameras){\n var backCamera = null,\n frontCamera = null;\n // choose backCamera\n for(var i = 0; i < bestToWorstCameras.length; i++){\n if (bestToWorstCameras[i].facingMode === 'environment'){\n backCamera = bestToWorstCameras[i];\n // (shouldn't be used for frontCamera)\n bestToWorstCameras.splice(i, 1);\n break;\n }\n }\n // if no back-facing cameras were found, choose the highest resolution\n if(backCamera === null){\n if(bestToWorstCameras.length > 0){\n backCamera = bestToWorstCameras[0];\n // (shouldn't be used for frontCamera)\n bestToWorstCameras.splice(0, 1);\n } else {\n // user doesn't have any available cameras\n backCamera = false;\n }\n }\n if(bestToWorstCameras.length > 0){\n // frontCamera should simply be the next-best resolution camera\n frontCamera = bestToWorstCameras[0];\n } else {\n // user doesn't have any more cameras\n frontCamera = false;\n }\n return {\n backCamera: backCamera,\n frontCamera: frontCamera\n };\n });\n }\n\n function mediaStreamIsActive(){\n return activeMediaStream !== null;\n }\n\n function killActiveMediaStream(){\n killStream(activeMediaStream);\n activeMediaStream = null;\n }\n\n function getVideoPreview(){\n return document.getElementById(ELEMENTS.preview);\n }\n\n function getImg(){\n return document.getElementById(ELEMENTS.still);\n }\n\n function getCurrentCameraIndex(){\n return currentCamera;\n }\n\n function getCurrentCamera(){\n return currentCamera === 1 ? frontCamera : backCamera;\n }\n\n function bringStillToFront(){\n var img = getImg();\n if(img){\n img.style.visibility = 'visible';\n previewing = false;\n }\n }\n\n function bringPreviewToFront(){\n var img = getImg();\n if(img){\n img.style.visibility = 'hidden';\n previewing = true;\n }\n }\n\n function isInitialized(){\n return backCamera !== null;\n }\n\n function canChangeCamera(){\n return !!backCamera && !!frontCamera;\n }\n\n function calcStatus(){\n return {\n // !authorized means the user either has no camera or has denied access.\n // This would leave a value of `null` before prepare(), and `false` after.\n authorized: (backCamera !== null && backCamera !== false)? '1': '0',\n // No applicable API\n denied: '0',\n // No applicable API\n restricted: '0',\n prepared: isInitialized() ? '1' : '0',\n scanning: scanning? '1' : '0',\n previewing: previewing? '1' : '0',\n // We leave this true after prepare() to match the mobile experience as\n // closely as possible. (Without additional covering, the preview will\n // always be visible to the user).\n showing: getVideoPreview()? '1' : '0',\n // No applicable API\n lightEnabled: '0',\n // No applicable API\n canOpenSettings: '0',\n // No applicable API\n canEnableLight: '0',\n canChangeCamera: canChangeCamera() ? '1' : '0',\n currentCamera: currentCamera.toString()\n };\n }\n\n function startCamera(success, error){\n var currentCameraIndex = getCurrentCameraIndex();\n var currentCamera = getCurrentCamera();\n window.navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n deviceId: {exact: currentCamera.deviceId},\n width: {ideal: currentCamera.width},\n height: {ideal: currentCamera.height}\n }\n }).then(function(mediaStream){\n activeMediaStream = mediaStream;\n var video = getVideoPreview();\n video.src = URL.createObjectURL(mediaStream);\n success(calcStatus());\n }, function(err){\n // something bad happened\n err = null;\n var code = currentCameraIndex? 4 : 3;\n error(code); // FRONT_CAMERA_UNAVAILABLE : BACK_CAMERA_UNAVAILABLE\n });\n }\n\n function getTempCanvasAndContext(videoElement){\n var tempCanvas = document.createElement('canvas');\n var camera = getCurrentCamera();\n tempCanvas.height = camera.height;\n tempCanvas.width = camera.width;\n var tempCanvasContext = tempCanvas.getContext('2d');\n tempCanvasContext.drawImage(videoElement, 0, 0, camera.width, camera.height);\n return {\n canvas: tempCanvas,\n context: tempCanvasContext\n };\n }\n\n function getCurrentImageData(videoElement){\n var snapshot = getTempCanvasAndContext(videoElement);\n return snapshot.context.getImageData(0, 0, snapshot.canvas.width, snapshot.canvas.height);\n }\n\n // take a screenshot of the video preview with a temp canvas\n function captureCurrentFrame(videoElement){\n return getTempCanvasAndContext(videoElement).canvas.toDataURL('image/png');\n }\n\n function initialize(success, error){\n if(scanWorker === null){\n var workerBlob = new Blob([workerScript],{type: \"text/javascript\"});\n scanWorker = new Worker(URL.createObjectURL(workerBlob));\n }\n if(!getVideoPreview()){\n // prepare DOM (sync)\n var videoPreview = document.createElement('video');\n videoPreview.setAttribute('autoplay', 'autoplay');\n videoPreview.setAttribute('id', ELEMENTS.preview);\n videoPreview.setAttribute('style', 'display:block;position:fixed;top:50%;left:50%;' +\n 'width:auto;height:auto;min-width:100%;min-height:100%;z-index:' + ZINDEXES.preview +\n ';-moz-transform: translateX(-50%) translateY(-50%);-webkit-transform: ' +\n 'translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);' +\n 'background-size:cover;background-position:50% 50%;background-color:#FFF;');\n videoPreview.addEventListener('loadeddata', function(){\n bringPreviewToFront();\n });\n\n var stillImg = document.createElement('div');\n stillImg.setAttribute('id', ELEMENTS.still);\n stillImg.setAttribute('style', 'display:block;position:fixed;top:50%;left:50%;visibility: hidden;' +\n 'width:auto;height:auto;min-width:100%;min-height:100%;z-index:' + ZINDEXES.still +\n ';-moz-transform: translateX(-50%) translateY(-50%);-webkit-transform: ' +\n 'translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);' +\n 'background-size:cover;background-position:50% 50%;background-color:#FFF;');\n\n document.body.appendChild(videoPreview);\n document.body.appendChild(stillImg);\n }\n if(backCamera === null){\n // set instance cameras\n chooseCameras().then(function(cameras){\n backCamera = cameras.backCamera;\n frontCamera = cameras.frontCamera;\n if(backCamera !== false){\n success();\n } else {\n error(5); // CAMERA_UNAVAILABLE\n }\n }, function(err){\n // something bad happened\n err = null;\n error(0); // UNEXPECTED_ERROR\n });\n } else if (backCamera === false){\n error(5); // CAMERA_UNAVAILABLE\n } else {\n success();\n }\n }\n\n /*\n * --- Begin Public API ---\n */\n\n function prepare(success, error){\n initialize(function(){\n // return status on success\n success(calcStatus());\n },\n // pass errors through\n error);\n }\n\n function show(success, error){\n function showCamera(){\n if(!mediaStreamIsActive()){\n startCamera(success, error);\n } else {\n success(calcStatus());\n }\n }\n if(!isInitialized()){\n initialize(function(){\n // on successful initialization, attempt to showCamera\n showCamera();\n },\n // pass errors through\n error);\n } else {\n showCamera();\n }\n }\n\n function hide(success, error){\n error = null; // should never error\n if(mediaStreamIsActive()){\n killActiveMediaStream();\n }\n var video = getVideoPreview();\n if(video){\n video.src = '';\n }\n success(calcStatus());\n }\n\n function scan(success, error) {\n // initialize and start video preview if not already active\n show(function(ignore){\n // ignore success output – `scan` method callback should be passed the decoded data\n ignore = null;\n var video = getVideoPreview();\n var returned = false;\n scanning = true;\n scanWorker.onmessage = function(event){\n var obj = event.data;\n if(obj.result && !returned){\n returned = true;\n thisScanCycle = null;\n success(obj.result);\n }\n };\n thisScanCycle = function(){\n scanWorker.postMessage(getCurrentImageData(video));\n if(cancelNextScan !== null){\n // avoid race conditions, always clear before starting a cycle\n cancelNextScan();\n }\n // interval in milliseconds at which to try decoding the QR code\n var SCAN_INTERVAL = window.QRScanner_SCAN_INTERVAL || 130;\n // this value can be adjusted on-the-fly (while a scan is active) to\n // balance scan speed vs. CPU/power usage\n nextScan = window.setTimeout(thisScanCycle, SCAN_INTERVAL);\n cancelNextScan = function(sendError){\n window.clearTimeout(nextScan);\n nextScan = null;\n cancelNextScan = null;\n if(sendError){\n error(6); // SCAN_CANCELED\n }\n };\n };\n thisScanCycle();\n }, error);\n }\n\n function cancelScan(success, error){\n error = null; // should never error\n if(cancelNextScan !== null){\n cancelNextScan(true);\n }\n scanning = false;\n if(typeof success === \"function\"){\n success(calcStatus());\n }\n }\n\n function pausePreview(success, error){\n error = null; // should never error\n if(mediaStreamIsActive()){\n // pause scanning too\n if(cancelNextScan !== null){\n cancelNextScan();\n }\n var video = getVideoPreview();\n video.pause();\n var img = new Image();\n img.src = captureCurrentFrame(video);\n getImg().style.backgroundImage = 'url(' + img.src + ')';\n bringStillToFront();\n // kill the active stream to turn off the privacy light (the screenshot\n // in the stillImg will remain visible)\n killActiveMediaStream();\n success(calcStatus());\n } else {\n success(calcStatus());\n }\n }\n\n function resumePreview(success, error){\n // if a scan was happening, resume it\n if(thisScanCycle !== null){\n thisScanCycle();\n }\n show(success, error);\n }\n\n function enableLight(success, error){\n error(7); //LIGHT_UNAVAILABLE\n }\n\n function disableLight(success, error){\n error(7); //LIGHT_UNAVAILABLE\n }\n\n function useCamera(success, error, array){\n var requestedCamera = array[0];\n var initialized = isInitialized();\n if(requestedCamera !== currentCamera){\n if(initialized && requestedCamera === 1 && !canChangeCamera()){\n error(4); //FRONT_CAMERA_UNAVAILABLE\n } else {\n currentCamera = requestedCamera;\n if(initialized){\n hide(function(status){\n // Don't need this one\n status = null;\n });\n show(success, error);\n } else {\n success(calcStatus());\n }\n }\n } else {\n success(calcStatus());\n }\n }\n\n function openSettings(success, error){\n error(8); //OPEN_SETTINGS_UNAVAILABLE\n }\n\n function getStatus(success, error){\n error = null; // should never error\n success(calcStatus());\n }\n\n // Reset all instance variables to their original state.\n // This method might be useful in cases where a new camera is available, and\n // the application needs to force the plugin to chooseCameras() again.\n function destroy(success, error){\n error = null; // should never error\n cancelScan();\n if(mediaStreamIsActive()){\n killActiveMediaStream();\n }\n backCamera = null;\n frontCamera = null;\n var preview = getVideoPreview();\n var still = getImg();\n if(preview){\n preview.remove();\n }\n if(still){\n still.remove();\n }\n success(calcStatus());\n }\n\n return {\n prepare: prepare,\n show: show,\n hide: hide,\n scan: scan,\n cancelScan: cancelScan,\n pausePreview: pausePreview,\n resumePreview: resumePreview,\n enableLight: enableLight,\n disableLight: disableLight,\n useCamera: useCamera,\n openSettings: openSettings,\n getStatus: getStatus,\n destroy: destroy\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/browser/src/createQRScannerInternal.js\n// module id = 1\n// module chunks = 0","module.exports = function createQRScanner(cordova){\n// The native implementations should return their status as ['string':'string']\n// dictionaries. Boolean values are encoded to '0' and '1', respectively.\nfunction stringToBool(string) {\n switch (string) {\n case '1':\n return true;\n case '0':\n return false;\n default:\n throw new Error('QRScanner plugin returned an invalid boolean number-string: ' + string);\n }\n}\n\n// Converts the returned ['string':'string'] dictionary to a status object.\nfunction convertStatus(statusDictionary) {\n return {\n authorized: stringToBool(statusDictionary.authorized),\n denied: stringToBool(statusDictionary.denied),\n restricted: stringToBool(statusDictionary.restricted),\n prepared: stringToBool(statusDictionary.prepared),\n scanning: stringToBool(statusDictionary.scanning),\n previewing: stringToBool(statusDictionary.previewing),\n showing: stringToBool(statusDictionary.showing),\n lightEnabled: stringToBool(statusDictionary.lightEnabled),\n canOpenSettings: stringToBool(statusDictionary.canOpenSettings),\n canEnableLight: stringToBool(statusDictionary.canEnableLight),\n canChangeCamera: stringToBool(statusDictionary.canChangeCamera),\n currentCamera: parseInt(statusDictionary.currentCamera)\n };\n}\n\n// Simple utility method to ensure the background is transparent. Used by the\n// plugin to force re-rendering immediately after the native webview background\n// is made transparent.\nfunction clearBackground() {\n var body = document.body;\n if (body.style) {\n body.style.backgroundColor = 'rgba(0,0,0,0.01)';\n body.style.backgroundImage = '';\n setTimeout(function() {\n body.style.backgroundColor = 'transparent';\n }, 1);\n if (body.parentNode && body.parentNode.style) {\n body.parentNode.style.backgroundColor = 'transparent';\n body.parentNode.style.backgroundImage = '';\n }\n }\n}\n\nfunction errorCallback(callback) {\n if (!callback) {\n return null;\n }\n return function(error) {\n var errorCode = parseInt(error);\n var QRScannerError = {};\n switch (errorCode) {\n case 0:\n QRScannerError = {\n name: 'UNEXPECTED_ERROR',\n code: 0,\n _message: 'QRScanner experienced an unexpected error.'\n };\n break;\n case 1:\n QRScannerError = {\n name: 'CAMERA_ACCESS_DENIED',\n code: 1,\n _message: 'The user denied camera access.'\n };\n break;\n case 2:\n QRScannerError = {\n name: 'CAMERA_ACCESS_RESTRICTED',\n code: 2,\n _message: 'Camera access is restricted.'\n };\n break;\n case 3:\n QRScannerError = {\n name: 'BACK_CAMERA_UNAVAILABLE',\n code: 3,\n _message: 'The back camera is unavailable.'\n };\n break;\n case 4:\n QRScannerError = {\n name: 'FRONT_CAMERA_UNAVAILABLE',\n code: 4,\n _message: 'The front camera is unavailable.'\n };\n break;\n case 5:\n QRScannerError = {\n name: 'CAMERA_UNAVAILABLE',\n code: 5,\n _message: 'The camera is unavailable.'\n };\n break;\n case 6:\n QRScannerError = {\n name: 'SCAN_CANCELED',\n code: 6,\n _message: 'Scan was canceled.'\n };\n break;\n case 7:\n QRScannerError = {\n name: 'LIGHT_UNAVAILABLE',\n code: 7,\n _message: 'The device light is unavailable.'\n };\n break;\n case 8:\n // Open settings is only available on iOS 8.0+.\n QRScannerError = {\n name: 'OPEN_SETTINGS_UNAVAILABLE',\n code: 8,\n _message: 'The device is unable to open settings.'\n };\n break;\n default:\n QRScannerError = {\n name: 'UNEXPECTED_ERROR',\n code: 0,\n _message: 'QRScanner returned an invalid error code.'\n };\n break;\n }\n callback(QRScannerError);\n };\n}\n\nfunction successCallback(callback) {\n if (!callback) {\n return null;\n }\n return function(statusDict) {\n callback(null, convertStatus(statusDict));\n };\n}\n\nfunction doneCallback(callback, clear) {\n if (!callback) {\n return null;\n }\n return function(statusDict) {\n if (clear) {\n clearBackground();\n }\n callback(convertStatus(statusDict));\n };\n}\n\nreturn {\n prepare: function(callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'prepare', []);\n },\n destroy: function(callback) {\n cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'destroy', []);\n },\n scan: function(callback) {\n if (!callback) {\n throw new Error('No callback provided to scan method.');\n }\n var success = function(result) {\n callback(null, result);\n };\n cordova.exec(success, errorCallback(callback), 'QRScanner', 'scan', []);\n },\n cancelScan: function(callback) {\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'cancelScan', []);\n },\n show: function(callback) {\n cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'show', []);\n },\n hide: function(callback) {\n cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'hide', []);\n },\n pausePreview: function(callback) {\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'pausePreview', []);\n },\n resumePreview: function(callback) {\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'resumePreview', []);\n },\n enableLight: function(callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'enableLight', []);\n },\n disableLight: function(callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'disableLight', []);\n },\n useCamera: function(index, callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'useCamera', [index]);\n },\n useFrontCamera: function(callback) {\n var frontCamera = 1;\n if (callback) {\n this.useCamera(frontCamera, callback);\n } else {\n cordova.exec(null, null, 'QRScanner', 'useCamera', [frontCamera]);\n }\n },\n useBackCamera: function(callback) {\n var backCamera = 0;\n if (callback) {\n this.useCamera(backCamera, callback);\n } else {\n cordova.exec(null, null, 'QRScanner', 'useCamera', [backCamera]);\n }\n },\n openSettings: function(callback) {\n if (callback) {\n cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'openSettings', []);\n } else {\n cordova.exec(null, null, 'QRScanner', 'openSettings', []);\n }\n },\n getStatus: function(callback) {\n if (!callback) {\n throw new Error('No callback provided to getStatus method.');\n }\n cordova.exec(doneCallback(callback), null, 'QRScanner', 'getStatus', []);\n }\n};\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/common/src/createQRScannerAdapter.js\n// module id = 2\n// module chunks = 0","module.exports = \"!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,\\\"a\\\",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p=\\\"\\\",e(e.s=19)}([function(t,e,n){\\\"use strict\\\";function i(){this.imagedata=null,this.width=0,this.height=0,this.qrCodeSymbol=null,this.debug=!1,this.callback=null}function r(t,e){return t>=0?t>>e:(t>>e)+(2<<~e)}n.d(e,\\\"b\\\",function(){return s}),e.a=i,e.c=r;var o=n(14),a=n(13),s={};s.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],i.prototype.decode=function(t,e){var n=function(){try{this.error=void 0,this.result=this.process(this.imagedata)}catch(t){this.error=t,this.result=void 0}return null!=this.callback&&this.callback(this.error,this.result),this.result}.bind(this);if(void 0!=t&&void 0!=t.width)this.width=t.width,this.height=t.height,this.imagedata={data:e||t.data},this.imagedata.width=t.width,this.imagedata.height=t.height,n();else{if(\\\"undefined\\\"==typeof Image)throw new Error(\\\"This source format is not supported in your environment, you need to pass an image buffer with width and height (see https://github.com/edi9999/jsqrcode/blob/master/test/qrcode.js)\\\");var i=new Image;i.crossOrigin=\\\"Anonymous\\\",i.onload=function(){var t=document.createElement(\\\"canvas\\\"),e=t.getContext(\\\"2d\\\"),r=document.getElementById(\\\"out-canvas\\\");if(null!=r){var o=r.getContext(\\\"2d\\\");o.clearRect(0,0,320,240),o.drawImage(i,0,0,320,240)}t.width=i.width,t.height=i.height,e.drawImage(i,0,0),this.width=i.width,this.height=i.height;try{this.imagedata=e.getImageData(0,0,i.width,i.height)}catch(t){if(this.result=\\\"Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!\\\",null!=this.callback)return this.callback(null,this.result)}n()}.bind(this),i.src=t}},i.prototype.decode_utf8=function(t){return decodeURIComponent(escape(t))},i.prototype.process=function(t){for(var e=(new Date).getTime(),n=this.grayScaleToBitmap(this.grayscale(t)),i=new o.a(n),r=i.detect(),s=a.a.decode(r.bits),h=s.DataByte,f=\\\"\\\",w=0;wi[s][a][1]&&(i[s][a][1]=w)}}for(var u=new Array(4),l=0;l<4;l++)u[l]=new Array(4);for(var a=0;a<4;a++)for(var s=0;s<4;s++)u[s][a]=Math.floor((i[s][a][0]+i[s][a][1])/2);return u},i.prototype.grayScaleToBitmap=function(t){for(var e=this.getMiddleBrightnessPerArea(t),n=e.length,i=Math.floor(t.width/n),r=Math.floor(t.height/n),o=0;o>5;0!=(31&t)&&n++,this.rowSize=n,this.bits=new Array(n*e);for(var i=0;i>5);return 0!=(1&n.i(r.c)(this.bits[i],31&t))},i.prototype.set_Renamed=function(t,e){var n=e*this.rowSize+(t>>5);this.bits[n]|=1<<(31&t)},i.prototype.flip=function(t,e){var n=e*this.rowSize+(t>>5);this.bits[n]^=1<<(31&t)},i.prototype.clear=function(){for(var t=this.bits.length,e=0;ethis.height||r>this.width)throw\\\"The region must fit inside the matrix\\\";for(var a=e;a>5)]|=1<<(31&h)}},function(t,e,n){\\\"use strict\\\";function i(t){this.errorCorrectionLevel=o.a.forBits(t>>3&3),this.dataMask=7&t}e.a=i;var r=n(0),o=n(15),a=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],s=[0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4];i.prototype.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|this.dataMask},i.prototype.Equals=function(t){var e=t;return this.errorCorrectionLevel==e.errorCorrectionLevel&&this.dataMask==e.dataMask},i.numBitsDiffering=function(t,e){return t^=e,s[15&t]+s[15&n.i(r.c)(t,4)]+s[15&n.i(r.c)(t,8)]+s[15&n.i(r.c)(t,12)]+s[15&n.i(r.c)(t,16)]+s[15&n.i(r.c)(t,20)]+s[15&n.i(r.c)(t,24)]+s[15&n.i(r.c)(t,28)]},i.decodeFormatInformation=function(t){var e=i.doDecodeFormatInformation(t);return null!=e?e:i.doDecodeFormatInformation(21522^t)},i.doDecodeFormatInformation=function(t){for(var e=4294967295,n=0,r=0;r=256&&(e^=t);for(var n=0;n<255;n++)this.logTable[this.expTable[n]]=n;var i=new Array(1);i[0]=0,this.zero=new r.a(this,new Array(i));var o=new Array(1);o[0]=1,this.one=new r.a(this,new Array(o))}e.a=i;var r=n(4);Object.defineProperty(i.prototype,\\\"Zero\\\",{get:function(){return this.zero}}),Object.defineProperty(i.prototype,\\\"One\\\",{get:function(){return this.one}}),i.prototype.buildMonomial=function(t,e){if(t<0)throw\\\"System.ArgumentException\\\";if(0==e)return this.zero;for(var n=new Array(t+1),i=0;i1&&0==e[0]){for(var i=1;in.length){var r=e;e=n,n=r}for(var o=new Array(n.length),a=n.length-e.length,s=0;s=t.Degree&&!n.Zero;){var o=n.Degree-t.Degree,a=this.field.multiply(n.getCoefficient(n.Degree),r),s=t.multiplyByMonomial(o,a),h=this.field.buildMonomial(o,a);e=e.addOrSubtract(h),n=n.addOrSubtract(s)}return[e,n]}},function(t,e,n){\\\"use strict\\\";function i(t,e){this.count=t,this.dataCodewords=e}function r(t,e,n){this.ecCodewordsPerBlock=t,this.ecBlocks=n?[e,n]:[e]}function o(t,e,n,i,r,o){this.versionNumber=t,this.alignmentPatternCenters=e,this.ecBlocks=[n,i,r,o];for(var a=0,s=n.ecCodewordsPerBlock,h=n.getECBlocks(),f=0;f6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e},o.prototype.getECBlocksForLevel=function(t){return this.ecBlocks[t.ordinal()]},o.VERSION_DECODE_INFO=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017],o.VERSIONS=function(){return[new o(1,[],new r(7,new i(1,19)),new r(10,new i(1,16)),new r(13,new i(1,13)),new r(17,new i(1,9))),new o(2,[6,18],new r(10,new i(1,34)),new r(16,new i(1,28)),new r(22,new i(1,22)),new r(28,new i(1,16))),new o(3,[6,22],new r(15,new i(1,55)),new r(26,new i(1,44)),new r(18,new i(2,17)),new r(22,new i(2,13))),new o(4,[6,26],new r(20,new i(1,80)),new r(18,new i(2,32)),new r(26,new i(2,24)),new r(16,new i(4,9))),new o(5,[6,30],new r(26,new i(1,108)),new r(24,new i(2,43)),new r(18,new i(2,15),new i(2,16)),new r(22,new i(2,11),new i(2,12))),new o(6,[6,34],new r(18,new i(2,68)),new r(16,new i(4,27)),new r(24,new i(4,19)),new r(28,new i(4,15))),new o(7,[6,22,38],new r(20,new i(2,78)),new r(18,new i(4,31)),new r(18,new i(2,14),new i(4,15)),new r(26,new i(4,13),new i(1,14))),new o(8,[6,24,42],new r(24,new i(2,97)),new r(22,new i(2,38),new i(2,39)),new r(22,new i(4,18),new i(2,19)),new r(26,new i(4,14),new i(2,15))),new o(9,[6,26,46],new r(30,new i(2,116)),new r(22,new i(3,36),new i(2,37)),new r(20,new i(4,16),new i(4,17)),new r(24,new i(4,12),new i(4,13))),new o(10,[6,28,50],new r(18,new i(2,68),new i(2,69)),new r(26,new i(4,43),new i(1,44)),new r(24,new i(6,19),new i(2,20)),new r(28,new i(6,15),new i(2,16))),new o(11,[6,30,54],new r(20,new i(4,81)),new r(30,new i(1,50),new i(4,51)),new r(28,new i(4,22),new i(4,23)),new r(24,new i(3,12),new i(8,13))),new o(12,[6,32,58],new r(24,new i(2,92),new i(2,93)),new r(22,new i(6,36),new i(2,37)),new r(26,new i(4,20),new i(6,21)),new r(28,new i(7,14),new i(4,15))),new o(13,[6,34,62],new r(26,new i(4,107)),new r(22,new i(8,37),new i(1,38)),new r(24,new i(8,20),new i(4,21)),new r(22,new i(12,11),new i(4,12))),new o(14,[6,26,46,66],new r(30,new i(3,115),new i(1,116)),new r(24,new i(4,40),new i(5,41)),new r(20,new i(11,16),new i(5,17)),new r(24,new i(11,12),new i(5,13))),new o(15,[6,26,48,70],new r(22,new i(5,87),new i(1,88)),new r(24,new i(5,41),new i(5,42)),new r(30,new i(5,24),new i(7,25)),new r(24,new i(11,12),new i(7,13))),new o(16,[6,26,50,74],new r(24,new i(5,98),new i(1,99)),new r(28,new i(7,45),new i(3,46)),new r(24,new i(15,19),new i(2,20)),new r(30,new i(3,15),new i(13,16))),new o(17,[6,30,54,78],new r(28,new i(1,107),new i(5,108)),new r(28,new i(10,46),new i(1,47)),new r(28,new i(1,22),new i(15,23)),new r(28,new i(2,14),new i(17,15))),new o(18,[6,30,56,82],new r(30,new i(5,120),new i(1,121)),new r(26,new i(9,43),new i(4,44)),new r(28,new i(17,22),new i(1,23)),new r(28,new i(2,14),new i(19,15))),new o(19,[6,30,58,86],new r(28,new i(3,113),new i(4,114)),new r(26,new i(3,44),new i(11,45)),new r(26,new i(17,21),new i(4,22)),new r(26,new i(9,13),new i(16,14))),new o(20,[6,34,62,90],new r(28,new i(3,107),new i(5,108)),new r(26,new i(3,41),new i(13,42)),new r(30,new i(15,24),new i(5,25)),new r(28,new i(15,15),new i(10,16))),new o(21,[6,28,50,72,94],new r(28,new i(4,116),new i(4,117)),new r(26,new i(17,42)),new r(28,new i(17,22),new i(6,23)),new r(30,new i(19,16),new i(6,17))),new o(22,[6,26,50,74,98],new r(28,new i(2,111),new i(7,112)),new r(28,new i(17,46)),new r(30,new i(7,24),new i(16,25)),new r(24,new i(34,13))),new o(23,[6,30,54,74,102],new r(30,new i(4,121),new i(5,122)),new r(28,new i(4,47),new i(14,48)),new r(30,new i(11,24),new i(14,25)),new r(30,new i(16,15),new i(14,16))),new o(24,[6,28,54,80,106],new r(30,new i(6,117),new i(4,118)),new r(28,new i(6,45),new i(14,46)),new r(30,new i(11,24),new i(16,25)),new r(30,new i(30,16),new i(2,17))),new o(25,[6,32,58,84,110],new r(26,new i(8,106),new i(4,107)),new r(28,new i(8,47),new i(13,48)),new r(30,new i(7,24),new i(22,25)),new r(30,new i(22,15),new i(13,16))),new o(26,[6,30,58,86,114],new r(28,new i(10,114),new i(2,115)),new r(28,new i(19,46),new i(4,47)),new r(28,new i(28,22),new i(6,23)),new r(30,new i(33,16),new i(4,17))),new o(27,[6,34,62,90,118],new r(30,new i(8,122),new i(4,123)),new r(28,new i(22,45),new i(3,46)),new r(30,new i(8,23),new i(26,24)),new r(30,new i(12,15),new i(28,16))),new o(28,[6,26,50,74,98,122],new r(30,new i(3,117),new i(10,118)),new r(28,new i(3,45),new i(23,46)),new r(30,new i(4,24),new i(31,25)),new r(30,new i(11,15),new i(31,16))),new o(29,[6,30,54,78,102,126],new r(30,new i(7,116),new i(7,117)),new r(28,new i(21,45),new i(7,46)),new r(30,new i(1,23),new i(37,24)),new r(30,new i(19,15),new i(26,16))),new o(30,[6,26,52,78,104,130],new r(30,new i(5,115),new i(10,116)),new r(28,new i(19,47),new i(10,48)),new r(30,new i(15,24),new i(25,25)),new r(30,new i(23,15),new i(25,16))),new o(31,[6,30,56,82,108,134],new r(30,new i(13,115),new i(3,116)),new r(28,new i(2,46),new i(29,47)),new r(30,new i(42,24),new i(1,25)),new r(30,new i(23,15),new i(28,16))),new o(32,[6,34,60,86,112,138],new r(30,new i(17,115)),new r(28,new i(10,46),new i(23,47)),new r(30,new i(10,24),new i(35,25)),new r(30,new i(19,15),new i(35,16))),new o(33,[6,30,58,86,114,142],new r(30,new i(17,115),new i(1,116)),new r(28,new i(14,46),new i(21,47)),new r(30,new i(29,24),new i(19,25)),new r(30,new i(11,15),new i(46,16))),new o(34,[6,34,62,90,118,146],new r(30,new i(13,115),new i(6,116)),new r(28,new i(14,46),new i(23,47)),new r(30,new i(44,24),new i(7,25)),new r(30,new i(59,16),new i(1,17))),new o(35,[6,30,54,78,102,126,150],new r(30,new i(12,121),new i(7,122)),new r(28,new i(12,47),new i(26,48)),new r(30,new i(39,24),new i(14,25)),new r(30,new i(22,15),new i(41,16))),new o(36,[6,24,50,76,102,128,154],new r(30,new i(6,121),new i(14,122)),new r(28,new i(6,47),new i(34,48)),new r(30,new i(46,24),new i(10,25)),new r(30,new i(2,15),new i(64,16))),new o(37,[6,28,54,80,106,132,158],new r(30,new i(17,122),new i(4,123)),new r(28,new i(29,46),new i(14,47)),new r(30,new i(49,24),new i(10,25)),new r(30,new i(24,15),new i(46,16))),new o(38,[6,32,58,84,110,136,162],new r(30,new i(4,122),new i(18,123)),new r(28,new i(13,46),new i(32,47)),new r(30,new i(48,24),new i(14,25)),new r(30,new i(42,15),new i(32,16))),new o(39,[6,26,54,82,110,138,166],new r(30,new i(20,117),new i(4,118)),new r(28,new i(40,47),new i(7,48)),new r(30,new i(43,24),new i(22,25)),new r(30,new i(10,15),new i(67,16))),new o(40,[6,30,58,86,114,142,170],new r(30,new i(19,118),new i(6,119)),new r(28,new i(18,47),new i(31,48)),new r(30,new i(34,24),new i(34,25)),new r(30,new i(20,15),new i(61,16)))]}(),o.getVersionForNumber=function(t){if(t<1||t>40)throw\\\"ArgumentException\\\";return o.VERSIONS[t-1]},o.getProvisionalVersionForDimension=function(t){if(t%4!=1)throw\\\"Error getProvisionalVersionForDimension\\\";try{return o.getVersionForNumber(t-17>>2)}catch(t){throw\\\"Error getVersionForNumber\\\"}},o.decodeVersionInformation=function(t){for(var e=4294967295,n=0,i=0;i=n)return!1;return!0},r.prototype.crossCheckVertical=function(t,e,n,i){var r=this.image,o=r.height,a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;for(var s=t;s>=0&&r.data[e+s*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&!r.data[e+s*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;sn)return NaN;for(;sn)return NaN;var h=a[0]+a[1]+a[2];return 5*Math.abs(h-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},r.prototype.handlePossibleCenter=function(t,e,n){var r=t[0]+t[1]+t[2],o=this.centerFromEnd(t,n),a=this.crossCheckVertical(e,Math.floor(o),2*t[1],r);if(!isNaN(a)){for(var s=(t[0]+t[1]+t[2])/3,h=this.possibleCenters.length,f=0;f>1),o=[0,0,0],a=0;a>1:-(a+1>>1));o[0]=0,o[1]=0,o[2]=0;for(var h=e;h=0;n--)t=this.copyBit(8,n,t);if(this.parsedFormatInfo=r.a.decodeFormatInformation(t),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var i=this.bitMatrix.Dimension;t=0;for(var o=i-8,e=i-1;e>=o;e--)t=this.copyBit(e,8,t);for(var n=i-7;n>2;if(e<=6)return o.a.getVersionForNumber(e);for(var n=0,i=t-11,r=5;r>=0;r--)for(var a=t-9;a>=i;a--)n=this.copyBit(a,r,n);if(this.parsedVersion=o.a.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==t)return this.parsedVersion;n=0;for(var a=5;a>=0;a--)for(var r=t-9;r>=i;r--)n=this.copyBit(a,r,n);if(this.parsedVersion=o.a.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==t)return this.parsedVersion;throw\\\"Error readVersion\\\"},i.prototype.readCodewords=function(){var t=this.readFormatInformation(),e=this.readVersion(),n=a.a.forReference(t.dataMask),i=this.bitMatrix.Dimension;n.unmaskBitMatrix(this.bitMatrix,i);for(var r=e.buildFunctionPattern(),o=!0,s=new Array(e.totalCodewords),h=0,f=0,w=0,u=i-1;u>0;u-=2){6==u&&u--;for(var l=0;l=0;){if(h[p].codewords.length==d)break;p--}p++;for(var g=d-r.ecCodewordsPerBlock,v=0,s=0;s=10&&e<=26?this.dataLengthMode=1:e>=27&&e<=40&&(this.dataLengthMode=2)}e.a=i;var r=n(0);i.prototype.getNextBits=function(t){var e=0;if(t>this.bitPointer-t+1,this.bitPointer-=t,e}if(t>8-(t-(this.bitPointer+1)),this.bitPointer=this.bitPointer-t%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),e}if(t>8-(t-(this.bitPointer+1+8))),this.bitPointer=this.bitPointer-(t-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),e}return 0},i.prototype.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},i.prototype.getDataLength=function(t){for(var e=0;;){if(t>>e==1)break;e++}return this.getNextBits(r.b.sizeOfDataLengthInfo[this.dataLengthMode][e])},i.prototype.getRomanAndFigureString=function(t){var e=t,n=0,i=\\\"\\\",r=[\\\"0\\\",\\\"1\\\",\\\"2\\\",\\\"3\\\",\\\"4\\\",\\\"5\\\",\\\"6\\\",\\\"7\\\",\\\"8\\\",\\\"9\\\",\\\"A\\\",\\\"B\\\",\\\"C\\\",\\\"D\\\",\\\"E\\\",\\\"F\\\",\\\"G\\\",\\\"H\\\",\\\"I\\\",\\\"J\\\",\\\"K\\\",\\\"L\\\",\\\"M\\\",\\\"N\\\",\\\"O\\\",\\\"P\\\",\\\"Q\\\",\\\"R\\\",\\\"S\\\",\\\"T\\\",\\\"U\\\",\\\"V\\\",\\\"W\\\",\\\"X\\\",\\\"Y\\\",\\\"Z\\\",\\\" \\\",\\\"$\\\",\\\"%\\\",\\\"*\\\",\\\"+\\\",\\\"-\\\",\\\".\\\",\\\"/\\\",\\\":\\\"];do{if(e>1){n=this.getNextBits(11);var o=Math.floor(n/45),a=n%45;i+=r[o],i+=r[a],e-=2}else 1==e&&(n=this.getNextBits(6),i+=r[n],e-=1)}while(e>0);return i},i.prototype.getFigureString=function(t){var e=t,n=0,i=\\\"\\\";do{e>=3?(n=this.getNextBits(10),n<100&&(i+=\\\"0\\\"),n<10&&(i+=\\\"0\\\"),e-=3):2==e?(n=this.getNextBits(7),n<10&&(i+=\\\"0\\\"),e-=2):1==e&&(n=this.getNextBits(4),e-=1),i+=n}while(e>0);return i},i.prototype.get8bitByteArray=function(t){var e=t,n=0,i=[];do{n=this.getNextBits(8),i.push(n),e--}while(e>0);return i},i.prototype.getKanjiString=function(t){var e=t,n=0,i=\\\"\\\";do{n=this.getNextBits(13);var r=n%192,o=n/192,a=(o<<8)+r,s=0;s=a+33088<=40956?a+33088:a+49472,i+=String.fromCharCode(s),e--}while(e>0);return i},Object.defineProperty(i.prototype,\\\"DataByte\\\",{get:function(){for(var t=[];;){var e=this.NextMode();if(0==e){if(t.length>0)break;throw\\\"Empty data block\\\"}if(1!=e&&2!=e&&4!=e&&8!=e&&7!=e)throw\\\"Invalid mode: \\\"+e+\\\" in (block:\\\"+this.blockPointer+\\\" bit:\\\"+this.bitPointer+\\\")\\\";var n=this.getDataLength(e);if(n<1)throw\\\"Invalid data length: \\\"+n;switch(e){case 1:for(var i=this.getFigureString(n),r=new Array(i.length),o=0;o7)throw\\\"System.ArgumentException\\\";return l.DATA_MASKS[t]},l.DATA_MASKS=[new i,new r,new o,new a,new s,new h,new f,new w],e.a=l},function(t,e,n){\\\"use strict\\\";var i=n(18),r=n(3),o=n(9),a=n(10),s=n(11),h={};h.rsDecoder=new i.a(r.a.QR_CODE_FIELD),h.correctErrors=function(t,e){for(var n=t.length,i=new Array(n),r=0;rMath.abs(n-t);if(r){var o=t;t=e,e=o,o=n,n=i,i=o}for(var a=Math.abs(n-t),s=Math.abs(i-e),h=-a>>1,f=e0){if(c==i)break;c+=f,h-=a}}var m=n-t,b=i-e;return Math.sqrt(m*m+b*b)},o.prototype.sizeOfBlackWhiteBlackRunBothWays=function(t,e,n,i){var r=this.sizeOfBlackWhiteBlackRun(t,e,n,i),o=1,a=t-(n-t);a<0?(o=t/(t-a),a=0):a>=this.image.width&&(o=(this.image.width-1-t)/(a-t),a=this.image.width-1);var s=Math.floor(e-(i-e)*o);return o=1,s<0?(o=e/(e-s),s=0):s>=this.image.height&&(o=(this.image.height-1-e)/(s-e),s=this.image.height-1),a=Math.floor(t+(a-t)*o),(r+=this.sizeOfBlackWhiteBlackRun(t,e,a,s))-1},o.prototype.calculateModuleSizeOneWay=function(t,e){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y)),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},o.prototype.calculateModuleSize=function(t,e,n){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,n))/2},o.prototype.distance=function(t,e){var n=t.X-e.X,i=t.Y-e.Y;return Math.sqrt(n*n+i*i)},o.prototype.computeDimension=function(t,e,n,i){var r=Math.round(this.distance(t,e)/i),o=Math.round(this.distance(t,n)/i),a=7+(r+o>>1);switch(3&a){case 0:a++;break;case 2:a--;break;case 3:throw\\\"Error\\\"}return a},o.prototype.findAlignmentInRegion=function(t,e,n,i){var r=Math.floor(i*t),o=Math.max(0,e-r),a=Math.min(this.image.width-1,e+r);if(a-o<3*t)throw\\\"Error\\\";var h=Math.max(0,n-r),f=Math.min(this.image.height-1,n+r);return new s.a(this.image,o,h,a-o,f-h,t,this.resultPointCallback).find()},o.prototype.createTransform=function(t,e,n,r,o){var a,s,h,f,w=o-3.5;return null!=r?(a=r.X,s=r.Y,h=f=w-3):(a=e.X-t.X+n.X,s=e.Y-t.Y+n.Y,h=f=w),i.quadrilateralToQuadrilateral(3.5,3.5,w,3.5,h,f,3.5,w,t.X,t.Y,e.X,e.Y,a,s,n.X,n.Y)},o.prototype.sampleGrid=function(t,e,n){return h.a.sampleGrid3(t,n,e)},o.prototype.processFinderPatternInfo=function(t){var e=t.topLeft,n=t.topRight,i=t.bottomLeft,o=this.calculateModuleSize(e,n,i);if(o<1)throw\\\"Error\\\";var s=this.computeDimension(e,n,i,o),h=a.a.getProvisionalVersionForDimension(s),f=h.DimensionForVersion-7,w=null;if(h.alignmentPatternCenters.length>0)for(var u=n.X-e.X+i.X,l=n.Y-e.Y+i.Y,c=1-3/f,d=Math.floor(e.X+c*(u-e.X)),p=Math.floor(e.Y+c*(l-e.Y)),g=4;g<=16;g<<=1){w=this.findAlignmentInRegion(o,d,p,g);break}var v,m=this.createTransform(e,n,i,w,s),b=this.sampleGrid(this.image,m,s);return v=null==w?[i,e,n]:[i,e,n,w],new r(b,v)},o.prototype.detect=function(){var t=(new f.a).findFinderPattern(this.image);return this.processFinderPatternInfo(t)}},function(t,e,n){\\\"use strict\\\";function i(t,e,n){this.ordinal_Renamed_Field=t,this.bits=e,this.name=n}e.a=i,i.prototype.ordinal=function(){return this.ordinal_Renamed_Field},i.forBits=function(t){if(t<0||t>=r.length)throw\\\"ArgumentException\\\";return r[t]};var r=[new i(1,0,\\\"M\\\"),new i(0,1,\\\"L\\\"),new i(3,2,\\\"H\\\"),new i(2,3,\\\"Q\\\")]},function(t,e,n){\\\"use strict\\\";function i(t){function e(t,e){var n=t.X-e.X,i=t.Y-e.Y;return Math.sqrt(n*n+i*i)}var n,i,r,o=e(t[0],t[1]),a=e(t[1],t[2]),s=e(t[0],t[2]);if(a>=o&&a>=s?(i=t[0],n=t[1],r=t[2]):s>=a&&s>=o?(i=t[1],n=t[0],r=t[2]):(i=t[2],n=t[0],r=t[1]),function(t,e,n){var i=e.x,r=e.y;return(n.x-i)*(t.y-r)-(n.y-r)*(t.x-i)}(n,i,r)<0){var h=n;n=r,r=h}t[0]=n,t[1]=i,t[2]=r}function r(t,e,n){this.x=t,this.y=e,this.count=1,this.estimatedModuleSize=n}function o(t){this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}function a(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=[0,0,0,0,0],this.resultPointCallback=null}e.a=a;Object.defineProperty(r.prototype,\\\"X\\\",{get:function(){return this.x}}),Object.defineProperty(r.prototype,\\\"Y\\\",{get:function(){return this.y}}),r.prototype.incrementCount=function(){this.count++},r.prototype.aboutEquals=function(t,e,n){if(Math.abs(e-this.y)<=t&&Math.abs(n-this.x)<=t){var i=Math.abs(t-this.estimatedModuleSize);return i<=1||i/this.estimatedModuleSize<=1}return!1},Object.defineProperty(a.prototype,\\\"CrossCheckStateCount\\\",{get:function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}}),a.prototype.foundPatternCross=function(t){for(var e=0,n=0;n<5;n++){var i=t[n];if(0==i)return!1;e+=i}if(e<7)return!1;var r=Math.floor((e<<8)/7),o=Math.floor(r/2);return Math.abs(r-(t[0]<<8))=0&&r.data[e+s*r.width];)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!r.data[e+s*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&r.data[e+s*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s=n)return NaN;for(;s=n)return NaN;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},a.prototype.crossCheckHorizontal=function(t,e,n,i){for(var r=this.image,o=r.width,a=this.CrossCheckStateCount,s=t;s>=0&&r.data[s+e*r.width];)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!r.data[s+e*r.width]&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&r.data[s+e*r.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s=n)return NaN;for(;s=n)return NaN;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-i)>=i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},a.prototype.handlePossibleCenter=function(t,e,n){var i=t[0]+t[1]+t[2]+t[3]+t[4],o=this.centerFromEnd(t,n),a=this.crossCheckVertical(e,Math.floor(o),t[2],i);if(!isNaN(a)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(a),t[2],i),!isNaN(o))){for(var s=i/7,h=!1,f=this.possibleCenters.length,w=0;w3){for(var e=0,n=0,i=0;i=0;i--){var h=this.possibleCenters[i];Math.abs(h.estimatedModuleSize-o)>s&&this.possibleCenters.splice(i,1)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(t,e){return t.count>e.count?-1:t.count=2){if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.X-i.X)-Math.abs(e.Y-i.Y))/2);e=i}}return 0},a.prototype.haveMultiplyConfirmedCenters=function(){for(var t=0,e=0,n=this.possibleCenters.length,i=0;i=2&&(t++,e+=r.estimatedModuleSize)}if(t<3)return!1;for(var o=e/n,a=0,i=0;is[2]&&(h+=l-s[2]-r,w=n-1)}else{do{w++}while(wn||s<-1||s>i)throw\\\"Error.checkAndNudgePoints \\\";r=!1,-1==a?(e[o]=0,r=!0):a==n&&(e[o]=n-1,r=!0),-1==s?(e[o+1]=0,r=!0):s==i&&(e[o+1]=i-1,r=!0)}r=!0;for(var o=e.length-2;o>=0&&r;o-=2){var a=Math.floor(e[o]),s=Math.floor(e[o+1]);if(a<-1||a>n||s<-1||s>i)throw\\\"Error.checkAndNudgePoints \\\";r=!1,-1==a?(e[o]=0,r=!0):a==n&&(e[o]=n-1,r=!0),-1==s?(e[o+1]=0,r=!0):s==i&&(e[o+1]=i-1,r=!0)}},r.sampleGrid3=function(t,e,n){for(var o=new i.a(e),a=new Array(e<<1),s=0;s>1),a[w+1]=f;n.transformPoints1(a),r.checkAndNudgePoints(t,a);try{for(var w=0;w>1,s)}}catch(t){throw\\\"Error.checkAndNudgePoints\\\"}}return o},e.a=r},function(t,e,n){\\\"use strict\\\";function i(t){this.field=t}e.a=i;var r=n(3),o=n(4);i.prototype.decode=function(t,e){for(var n=new o.a(this.field,t),i=new Array(e),a=0;a=Math.floor(n/2);){var w=r,u=a,l=h;if(r=o,a=s,h=f,r.Zero)throw\\\"r_{i-1} was zero\\\";o=w;for(var c=this.field.Zero,d=r.getCoefficient(r.Degree),p=this.field.inverse(d);o.Degree>=r.Degree&&!o.Zero;){var g=o.Degree-r.Degree,v=this.field.multiply(o.getCoefficient(o.Degree),p);c=c.addOrSubtract(this.field.buildMonomial(g,v)),o=o.addOrSubtract(r.multiplyByMonomial(g,v))}s=c.multiply1(a).addOrSubtract(u),f=c.multiply1(h).addOrSubtract(l)}var m=f.getCoefficient(0);if(0==m)throw\\\"ReedSolomonException sigmaTilde(0) was zero\\\";var b=this.field.inverse(m);return[f.multiply2(b),o.multiply2(b)]},i.prototype.findErrorLocations=function(t){var e=t.Degree;if(1==e)return new Array(t.getCoefficient(1));for(var n=new Array(e),i=0,r=1;r<256&&i 0 ? 'm=' + part : part).trim() + '\\r\\n';\n });\n};\n\n// Returns lines that start with a certain prefix.\nSDPUtils.matchPrefix = function(blob, prefix) {\n return SDPUtils.splitLines(blob).filter(function(line) {\n return line.indexOf(prefix) === 0;\n });\n};\n\n// Parses an ICE candidate line. Sample input:\n// candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8\n// rport 55996\"\nSDPUtils.parseCandidate = function(line) {\n var parts;\n // Parse both variants.\n if (line.indexOf('a=candidate:') === 0) {\n parts = line.substring(12).split(' ');\n } else {\n parts = line.substring(10).split(' ');\n }\n\n var candidate = {\n foundation: parts[0],\n component: parts[1],\n protocol: parts[2].toLowerCase(),\n priority: parseInt(parts[3], 10),\n ip: parts[4],\n port: parseInt(parts[5], 10),\n // skip parts[6] == 'typ'\n type: parts[7]\n };\n\n for (var i = 8; i < parts.length; i += 2) {\n switch (parts[i]) {\n case 'raddr':\n candidate.relatedAddress = parts[i + 1];\n break;\n case 'rport':\n candidate.relatedPort = parseInt(parts[i + 1], 10);\n break;\n case 'tcptype':\n candidate.tcpType = parts[i + 1];\n break;\n default: // extension handling, in particular ufrag\n candidate[parts[i]] = parts[i + 1];\n break;\n }\n }\n return candidate;\n};\n\n// Translates a candidate object into SDP candidate attribute.\nSDPUtils.writeCandidate = function(candidate) {\n var sdp = [];\n sdp.push(candidate.foundation);\n sdp.push(candidate.component);\n sdp.push(candidate.protocol.toUpperCase());\n sdp.push(candidate.priority);\n sdp.push(candidate.ip);\n sdp.push(candidate.port);\n\n var type = candidate.type;\n sdp.push('typ');\n sdp.push(type);\n if (type !== 'host' && candidate.relatedAddress &&\n candidate.relatedPort) {\n sdp.push('raddr');\n sdp.push(candidate.relatedAddress); // was: relAddr\n sdp.push('rport');\n sdp.push(candidate.relatedPort); // was: relPort\n }\n if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {\n sdp.push('tcptype');\n sdp.push(candidate.tcpType);\n }\n return 'candidate:' + sdp.join(' ');\n};\n\n// Parses an ice-options line, returns an array of option tags.\n// a=ice-options:foo bar\nSDPUtils.parseIceOptions = function(line) {\n return line.substr(14).split(' ');\n}\n\n// Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input:\n// a=rtpmap:111 opus/48000/2\nSDPUtils.parseRtpMap = function(line) {\n var parts = line.substr(9).split(' ');\n var parsed = {\n payloadType: parseInt(parts.shift(), 10) // was: id\n };\n\n parts = parts[0].split('/');\n\n parsed.name = parts[0];\n parsed.clockRate = parseInt(parts[1], 10); // was: clockrate\n // was: channels\n parsed.numChannels = parts.length === 3 ? parseInt(parts[2], 10) : 1;\n return parsed;\n};\n\n// Generate an a=rtpmap line from RTCRtpCodecCapability or\n// RTCRtpCodecParameters.\nSDPUtils.writeRtpMap = function(codec) {\n var pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate +\n (codec.numChannels !== 1 ? '/' + codec.numChannels : '') + '\\r\\n';\n};\n\n// Parses an a=extmap line (headerextension from RFC 5285). Sample input:\n// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset\n// a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset\nSDPUtils.parseExtmap = function(line) {\n var parts = line.substr(9).split(' ');\n return {\n id: parseInt(parts[0], 10),\n direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',\n uri: parts[1]\n };\n};\n\n// Generates a=extmap line from RTCRtpHeaderExtensionParameters or\n// RTCRtpHeaderExtension.\nSDPUtils.writeExtmap = function(headerExtension) {\n return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) +\n (headerExtension.direction && headerExtension.direction !== 'sendrecv'\n ? '/' + headerExtension.direction\n : '') +\n ' ' + headerExtension.uri + '\\r\\n';\n};\n\n// Parses an ftmp line, returns dictionary. Sample input:\n// a=fmtp:96 vbr=on;cng=on\n// Also deals with vbr=on; cng=on\nSDPUtils.parseFmtp = function(line) {\n var parsed = {};\n var kv;\n var parts = line.substr(line.indexOf(' ') + 1).split(';');\n for (var j = 0; j < parts.length; j++) {\n kv = parts[j].trim().split('=');\n parsed[kv[0].trim()] = kv[1];\n }\n return parsed;\n};\n\n// Generates an a=ftmp line from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeFmtp = function(codec) {\n var line = '';\n var pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.parameters && Object.keys(codec.parameters).length) {\n var params = [];\n Object.keys(codec.parameters).forEach(function(param) {\n params.push(param + '=' + codec.parameters[param]);\n });\n line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\\r\\n';\n }\n return line;\n};\n\n// Parses an rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:\n// a=rtcp-fb:98 nack rpsi\nSDPUtils.parseRtcpFb = function(line) {\n var parts = line.substr(line.indexOf(' ') + 1).split(' ');\n return {\n type: parts.shift(),\n parameter: parts.join(' ')\n };\n};\n// Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeRtcpFb = function(codec) {\n var lines = '';\n var pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.rtcpFeedback && codec.rtcpFeedback.length) {\n // FIXME: special handling for trr-int?\n codec.rtcpFeedback.forEach(function(fb) {\n lines += 'a=rtcp-fb:' + pt + ' ' + fb.type +\n (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') +\n '\\r\\n';\n });\n }\n return lines;\n};\n\n// Parses an RFC 5576 ssrc media attribute. Sample input:\n// a=ssrc:3735928559 cname:something\nSDPUtils.parseSsrcMedia = function(line) {\n var sp = line.indexOf(' ');\n var parts = {\n ssrc: parseInt(line.substr(7, sp - 7), 10)\n };\n var colon = line.indexOf(':', sp);\n if (colon > -1) {\n parts.attribute = line.substr(sp + 1, colon - sp - 1);\n parts.value = line.substr(colon + 1);\n } else {\n parts.attribute = line.substr(sp + 1);\n }\n return parts;\n};\n\n// Extracts the MID (RFC 5888) from a media section.\n// returns the MID or undefined if no mid line was found.\nSDPUtils.getMid = function(mediaSection) {\n var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];\n if (mid) {\n return mid.substr(6);\n }\n}\n\nSDPUtils.parseFingerprint = function(line) {\n var parts = line.substr(14).split(' ');\n return {\n algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge.\n value: parts[1]\n };\n};\n\n// Extracts DTLS parameters from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the fingerprint line as input. See also getIceParameters.\nSDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {\n var lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=fingerprint:');\n // Note: a=setup line is ignored since we use the 'auto' role.\n // Note2: 'algorithm' is not case sensitive except in Edge.\n return {\n role: 'auto',\n fingerprints: lines.map(SDPUtils.parseFingerprint)\n };\n};\n\n// Serializes DTLS parameters to SDP.\nSDPUtils.writeDtlsParameters = function(params, setupType) {\n var sdp = 'a=setup:' + setupType + '\\r\\n';\n params.fingerprints.forEach(function(fp) {\n sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\\r\\n';\n });\n return sdp;\n};\n// Parses ICE information from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the ice-ufrag and ice-pwd lines as input.\nSDPUtils.getIceParameters = function(mediaSection, sessionpart) {\n var lines = SDPUtils.splitLines(mediaSection);\n // Search in session part, too.\n lines = lines.concat(SDPUtils.splitLines(sessionpart));\n var iceParameters = {\n usernameFragment: lines.filter(function(line) {\n return line.indexOf('a=ice-ufrag:') === 0;\n })[0].substr(12),\n password: lines.filter(function(line) {\n return line.indexOf('a=ice-pwd:') === 0;\n })[0].substr(10)\n };\n return iceParameters;\n};\n\n// Serializes ICE parameters to SDP.\nSDPUtils.writeIceParameters = function(params) {\n return 'a=ice-ufrag:' + params.usernameFragment + '\\r\\n' +\n 'a=ice-pwd:' + params.password + '\\r\\n';\n};\n\n// Parses the SDP media section and returns RTCRtpParameters.\nSDPUtils.parseRtpParameters = function(mediaSection) {\n var description = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: [],\n rtcp: []\n };\n var lines = SDPUtils.splitLines(mediaSection);\n var mline = lines[0].split(' ');\n for (var i = 3; i < mline.length; i++) { // find all codecs from mline[3..]\n var pt = mline[i];\n var rtpmapline = SDPUtils.matchPrefix(\n mediaSection, 'a=rtpmap:' + pt + ' ')[0];\n if (rtpmapline) {\n var codec = SDPUtils.parseRtpMap(rtpmapline);\n var fmtps = SDPUtils.matchPrefix(\n mediaSection, 'a=fmtp:' + pt + ' ');\n // Only the first a=fmtp: is considered.\n codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};\n codec.rtcpFeedback = SDPUtils.matchPrefix(\n mediaSection, 'a=rtcp-fb:' + pt + ' ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.push(codec);\n // parse FEC mechanisms from rtpmap lines.\n switch (codec.name.toUpperCase()) {\n case 'RED':\n case 'ULPFEC':\n description.fecMechanisms.push(codec.name.toUpperCase());\n break;\n default: // only RED and ULPFEC are recognized as FEC mechanisms.\n break;\n }\n }\n }\n SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function(line) {\n description.headerExtensions.push(SDPUtils.parseExtmap(line));\n });\n // FIXME: parse rtcp.\n return description;\n};\n\n// Generates parts of the SDP media section describing the capabilities /\n// parameters.\nSDPUtils.writeRtpDescription = function(kind, caps) {\n var sdp = '';\n\n // Build the mline.\n sdp += 'm=' + kind + ' ';\n sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.\n sdp += ' UDP/TLS/RTP/SAVPF ';\n sdp += caps.codecs.map(function(codec) {\n if (codec.preferredPayloadType !== undefined) {\n return codec.preferredPayloadType;\n }\n return codec.payloadType;\n }).join(' ') + '\\r\\n';\n\n sdp += 'c=IN IP4 0.0.0.0\\r\\n';\n sdp += 'a=rtcp:9 IN IP4 0.0.0.0\\r\\n';\n\n // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.\n caps.codecs.forEach(function(codec) {\n sdp += SDPUtils.writeRtpMap(codec);\n sdp += SDPUtils.writeFmtp(codec);\n sdp += SDPUtils.writeRtcpFb(codec);\n });\n var maxptime = 0;\n caps.codecs.forEach(function(codec) {\n if (codec.maxptime > maxptime) {\n maxptime = codec.maxptime;\n }\n });\n if (maxptime > 0) {\n sdp += 'a=maxptime:' + maxptime + '\\r\\n';\n }\n sdp += 'a=rtcp-mux\\r\\n';\n\n caps.headerExtensions.forEach(function(extension) {\n sdp += SDPUtils.writeExtmap(extension);\n });\n // FIXME: write fecMechanisms.\n return sdp;\n};\n\n// Parses the SDP media section and returns an array of\n// RTCRtpEncodingParameters.\nSDPUtils.parseRtpEncodingParameters = function(mediaSection) {\n var encodingParameters = [];\n var description = SDPUtils.parseRtpParameters(mediaSection);\n var hasRed = description.fecMechanisms.indexOf('RED') !== -1;\n var hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;\n\n // filter a=ssrc:... cname:, ignore PlanB-msid\n var ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(function(line) {\n return SDPUtils.parseSsrcMedia(line);\n })\n .filter(function(parts) {\n return parts.attribute === 'cname';\n });\n var primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;\n var secondarySsrc;\n\n var flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID')\n .map(function(line) {\n var parts = line.split(' ');\n parts.shift();\n return parts.map(function(part) {\n return parseInt(part, 10);\n });\n });\n if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {\n secondarySsrc = flows[0][1];\n }\n\n description.codecs.forEach(function(codec) {\n if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {\n var encParam = {\n ssrc: primarySsrc,\n codecPayloadType: parseInt(codec.parameters.apt, 10),\n rtx: {\n ssrc: secondarySsrc\n }\n };\n encodingParameters.push(encParam);\n if (hasRed) {\n encParam = JSON.parse(JSON.stringify(encParam));\n encParam.fec = {\n ssrc: secondarySsrc,\n mechanism: hasUlpfec ? 'red+ulpfec' : 'red'\n };\n encodingParameters.push(encParam);\n }\n }\n });\n if (encodingParameters.length === 0 && primarySsrc) {\n encodingParameters.push({\n ssrc: primarySsrc\n });\n }\n\n // we support both b=AS and b=TIAS but interpret AS as TIAS.\n var bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');\n if (bandwidth.length) {\n if (bandwidth[0].indexOf('b=TIAS:') === 0) {\n bandwidth = parseInt(bandwidth[0].substr(7), 10);\n } else if (bandwidth[0].indexOf('b=AS:') === 0) {\n bandwidth = parseInt(bandwidth[0].substr(5), 10);\n }\n encodingParameters.forEach(function(params) {\n params.maxBitrate = bandwidth;\n });\n }\n return encodingParameters;\n};\n\n// parses http://draft.ortc.org/#rtcrtcpparameters*\nSDPUtils.parseRtcpParameters = function(mediaSection) {\n var rtcpParameters = {};\n\n var cname;\n // Gets the first SSRC. Note that with RTX there might be multiple\n // SSRCs.\n var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(function(line) {\n return SDPUtils.parseSsrcMedia(line);\n })\n .filter(function(obj) {\n return obj.attribute === 'cname';\n })[0];\n if (remoteSsrc) {\n rtcpParameters.cname = remoteSsrc.value;\n rtcpParameters.ssrc = remoteSsrc.ssrc;\n }\n\n // Edge uses the compound attribute instead of reducedSize\n // compound is !reducedSize\n var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');\n rtcpParameters.reducedSize = rsize.length > 0;\n rtcpParameters.compound = rsize.length === 0;\n\n // parses the rtcp-mux attrіbute.\n // Note that Edge does not support unmuxed RTCP.\n var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');\n rtcpParameters.mux = mux.length > 0;\n\n return rtcpParameters;\n};\n\n// parses either a=msid: or a=ssrc:... msid lines and returns\n// the id of the MediaStream and MediaStreamTrack.\nSDPUtils.parseMsid = function(mediaSection) {\n var parts;\n var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');\n if (spec.length === 1) {\n parts = spec[0].substr(7).split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(function(line) {\n return SDPUtils.parseSsrcMedia(line);\n })\n .filter(function(parts) {\n return parts.attribute === 'msid';\n });\n if (planB.length > 0) {\n parts = planB[0].value.split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n};\n\nSDPUtils.writeSessionBoilerplate = function() {\n // FIXME: sess-id should be an NTP timestamp.\n return 'v=0\\r\\n' +\n 'o=thisisadapterortc 8169639915646943137 2 IN IP4 127.0.0.1\\r\\n' +\n 's=-\\r\\n' +\n 't=0 0\\r\\n';\n};\n\nSDPUtils.writeMediaSection = function(transceiver, caps, type, stream) {\n var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);\n\n // Map ICE parameters (ufrag, pwd) to SDP.\n sdp += SDPUtils.writeIceParameters(\n transceiver.iceGatherer.getLocalParameters());\n\n // Map DTLS parameters to SDP.\n sdp += SDPUtils.writeDtlsParameters(\n transceiver.dtlsTransport.getLocalParameters(),\n type === 'offer' ? 'actpass' : 'active');\n\n sdp += 'a=mid:' + transceiver.mid + '\\r\\n';\n\n if (transceiver.direction) {\n sdp += 'a=' + transceiver.direction + '\\r\\n';\n } else if (transceiver.rtpSender && transceiver.rtpReceiver) {\n sdp += 'a=sendrecv\\r\\n';\n } else if (transceiver.rtpSender) {\n sdp += 'a=sendonly\\r\\n';\n } else if (transceiver.rtpReceiver) {\n sdp += 'a=recvonly\\r\\n';\n } else {\n sdp += 'a=inactive\\r\\n';\n }\n\n if (transceiver.rtpSender) {\n // spec.\n var msid = 'msid:' + stream.id + ' ' +\n transceiver.rtpSender.track.id + '\\r\\n';\n sdp += 'a=' + msid;\n\n // for Chrome.\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +\n ' ' + msid;\n if (transceiver.sendEncodingParameters[0].rtx) {\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +\n ' ' + msid;\n sdp += 'a=ssrc-group:FID ' +\n transceiver.sendEncodingParameters[0].ssrc + ' ' +\n transceiver.sendEncodingParameters[0].rtx.ssrc +\n '\\r\\n';\n }\n }\n // FIXME: this should be written by writeRtpDescription.\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +\n ' cname:' + SDPUtils.localCName + '\\r\\n';\n if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {\n sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +\n ' cname:' + SDPUtils.localCName + '\\r\\n';\n }\n return sdp;\n};\n\n// Gets the direction from the mediaSection or the sessionpart.\nSDPUtils.getDirection = function(mediaSection, sessionpart) {\n // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.\n var lines = SDPUtils.splitLines(mediaSection);\n for (var i = 0; i < lines.length; i++) {\n switch (lines[i]) {\n case 'a=sendrecv':\n case 'a=sendonly':\n case 'a=recvonly':\n case 'a=inactive':\n return lines[i].substr(2);\n default:\n // FIXME: What should happen here?\n }\n }\n if (sessionpart) {\n return SDPUtils.getDirection(sessionpart);\n }\n return 'sendrecv';\n};\n\nSDPUtils.getKind = function(mediaSection) {\n var lines = SDPUtils.splitLines(mediaSection);\n var mline = lines[0].split(' ');\n return mline[0].substr(2);\n};\n\nSDPUtils.isRejected = function(mediaSection) {\n return mediaSection.split(' ', 2)[1] === '0';\n};\n\n// Expose public methods.\nmodule.exports = SDPUtils;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/sdp/sdp.js\n// module id = 4\n// module chunks = 0","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n\n'use strict';\n\n// Shimming starts here.\n(function() {\n // Utils.\n var utils = require('./utils');\n var logging = utils.log;\n var browserDetails = utils.browserDetails;\n // Export to the adapter global object visible in the browser.\n module.exports.browserDetails = browserDetails;\n module.exports.extractVersion = utils.extractVersion;\n module.exports.disableLog = utils.disableLog;\n\n // Uncomment the line below if you want logging to occur, including logging\n // for the switch statement below. Can also be turned on in the browser via\n // adapter.disableLog(false), but then logging from the switch statement below\n // will not appear.\n // require('./utils').disableLog(false);\n\n // Browser shims.\n var chromeShim = require('./chrome/chrome_shim') || null;\n var edgeShim = require('./edge/edge_shim') || null;\n var firefoxShim = require('./firefox/firefox_shim') || null;\n var safariShim = require('./safari/safari_shim') || null;\n\n // Shim browser if found.\n switch (browserDetails.browser) {\n case 'chrome':\n if (!chromeShim || !chromeShim.shimPeerConnection) {\n logging('Chrome shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming chrome.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = chromeShim;\n\n chromeShim.shimGetUserMedia();\n chromeShim.shimMediaStream();\n utils.shimCreateObjectURL();\n chromeShim.shimSourceObject();\n chromeShim.shimPeerConnection();\n chromeShim.shimOnTrack();\n chromeShim.shimGetSendersWithDtmf();\n break;\n case 'firefox':\n if (!firefoxShim || !firefoxShim.shimPeerConnection) {\n logging('Firefox shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming firefox.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = firefoxShim;\n\n firefoxShim.shimGetUserMedia();\n utils.shimCreateObjectURL();\n firefoxShim.shimSourceObject();\n firefoxShim.shimPeerConnection();\n firefoxShim.shimOnTrack();\n break;\n case 'edge':\n if (!edgeShim || !edgeShim.shimPeerConnection) {\n logging('MS edge shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming edge.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = edgeShim;\n\n edgeShim.shimGetUserMedia();\n utils.shimCreateObjectURL();\n edgeShim.shimPeerConnection();\n edgeShim.shimReplaceTrack();\n break;\n case 'safari':\n if (!safariShim) {\n logging('Safari shim is not included in this adapter release.');\n return;\n }\n logging('adapter.js shimming safari.');\n // Export to the adapter global object visible in the browser.\n module.exports.browserShim = safariShim;\n\n safariShim.shimCallbacksAPI();\n safariShim.shimAddStream();\n safariShim.shimOnAddStream();\n safariShim.shimGetUserMedia();\n break;\n default:\n logging('Unsupported browser!');\n }\n})();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/adapter_core.js\n// module id = 5\n// module chunks = 0","\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\nvar logging = require('../utils.js').log;\nvar browserDetails = require('../utils.js').browserDetails;\n\nvar chromeShim = {\n shimMediaStream: function() {\n window.MediaStream = window.MediaStream || window.webkitMediaStream;\n },\n\n shimOnTrack: function() {\n if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in\n window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {\n get: function() {\n return this._ontrack;\n },\n set: function(f) {\n var self = this;\n if (this._ontrack) {\n this.removeEventListener('track', this._ontrack);\n this.removeEventListener('addstream', this._ontrackpoly);\n }\n this.addEventListener('track', this._ontrack = f);\n this.addEventListener('addstream', this._ontrackpoly = function(e) {\n // onaddstream does not fire when a track is added to an existing\n // stream. But stream.onaddtrack is implemented so we use that.\n e.stream.addEventListener('addtrack', function(te) {\n var receiver;\n if (RTCPeerConnection.prototype.getReceivers) {\n receiver = self.getReceivers().find(function(r) {\n return r.track.id === te.track.id;\n });\n } else {\n receiver = {track: te.track};\n }\n\n var event = new Event('track');\n event.track = te.track;\n event.receiver = receiver;\n event.streams = [e.stream];\n self.dispatchEvent(event);\n });\n e.stream.getTracks().forEach(function(track) {\n var receiver;\n if (RTCPeerConnection.prototype.getReceivers) {\n receiver = self.getReceivers().find(function(r) {\n return r.track.id === track.id;\n });\n } else {\n receiver = {track: track};\n }\n var event = new Event('track');\n event.track = track;\n event.receiver = receiver;\n event.streams = [e.stream];\n this.dispatchEvent(event);\n }.bind(this));\n }.bind(this));\n }\n });\n }\n },\n\n shimGetSendersWithDtmf: function() {\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('getSenders' in RTCPeerConnection.prototype) &&\n 'createDTMFSender' in RTCPeerConnection.prototype) {\n RTCPeerConnection.prototype.getSenders = function() {\n return this._senders || [];\n };\n var origAddStream = RTCPeerConnection.prototype.addStream;\n var origRemoveStream = RTCPeerConnection.prototype.removeStream;\n\n if (!RTCPeerConnection.prototype.addTrack) {\n RTCPeerConnection.prototype.addTrack = function(track, stream) {\n var pc = this;\n if (pc.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n var streams = [].slice.call(arguments, 1);\n if (streams.length !== 1 ||\n !streams[0].getTracks().find(function(t) {\n return t === track;\n })) {\n // this is not fully correct but all we can manage without\n // [[associated MediaStreams]] internal slot.\n throw new DOMException(\n 'The adapter.js addTrack polyfill only supports a single ' +\n ' stream which is associated with the specified track.',\n 'NotSupportedError');\n }\n\n pc._senders = pc._senders || [];\n var alreadyExists = pc._senders.find(function(t) {\n return t.track === track;\n });\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n\n pc._streams = pc._streams || {};\n var oldStream = pc._streams[stream.id];\n if (oldStream) {\n oldStream.addTrack(track);\n pc.removeStream(oldStream);\n pc.addStream(oldStream);\n } else {\n var newStream = new MediaStream([track]);\n pc._streams[stream.id] = newStream;\n pc.addStream(newStream);\n }\n\n var sender = {\n track: track,\n get dtmf() {\n if (this._dtmf === undefined) {\n if (track.kind === 'audio') {\n this._dtmf = pc.createDTMFSender(track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n }\n };\n pc._senders.push(sender);\n return sender;\n };\n }\n RTCPeerConnection.prototype.addStream = function(stream) {\n var pc = this;\n pc._senders = pc._senders || [];\n origAddStream.apply(pc, [stream]);\n stream.getTracks().forEach(function(track) {\n pc._senders.push({\n track: track,\n get dtmf() {\n if (this._dtmf === undefined) {\n if (track.kind === 'audio') {\n this._dtmf = pc.createDTMFSender(track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n }\n });\n });\n };\n\n RTCPeerConnection.prototype.removeStream = function(stream) {\n var pc = this;\n pc._senders = pc._senders || [];\n origRemoveStream.apply(pc, [stream]);\n stream.getTracks().forEach(function(track) {\n var sender = pc._senders.find(function(s) {\n return s.track === track;\n });\n if (sender) {\n pc._senders.splice(pc._senders.indexOf(sender), 1); // remove sender\n }\n });\n };\n }\n },\n\n shimSourceObject: function() {\n if (typeof window === 'object') {\n if (window.HTMLMediaElement &&\n !('srcObject' in window.HTMLMediaElement.prototype)) {\n // Shim the srcObject property, once, when HTMLMediaElement is found.\n Object.defineProperty(window.HTMLMediaElement.prototype, 'srcObject', {\n get: function() {\n return this._srcObject;\n },\n set: function(stream) {\n var self = this;\n // Use _srcObject as a private property for this shim\n this._srcObject = stream;\n if (this.src) {\n URL.revokeObjectURL(this.src);\n }\n\n if (!stream) {\n this.src = '';\n return undefined;\n }\n this.src = URL.createObjectURL(stream);\n // We need to recreate the blob url when a track is added or\n // removed. Doing it manually since we want to avoid a recursion.\n stream.addEventListener('addtrack', function() {\n if (self.src) {\n URL.revokeObjectURL(self.src);\n }\n self.src = URL.createObjectURL(stream);\n });\n stream.addEventListener('removetrack', function() {\n if (self.src) {\n URL.revokeObjectURL(self.src);\n }\n self.src = URL.createObjectURL(stream);\n });\n }\n });\n }\n }\n },\n\n shimPeerConnection: function() {\n // The RTCPeerConnection object.\n if (!window.RTCPeerConnection) {\n window.RTCPeerConnection = function(pcConfig, pcConstraints) {\n // Translate iceTransportPolicy to iceTransports,\n // see https://code.google.com/p/webrtc/issues/detail?id=4869\n // this was fixed in M56 along with unprefixing RTCPeerConnection.\n logging('PeerConnection');\n if (pcConfig && pcConfig.iceTransportPolicy) {\n pcConfig.iceTransports = pcConfig.iceTransportPolicy;\n }\n\n return new webkitRTCPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = webkitRTCPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n if (webkitRTCPeerConnection.generateCertificate) {\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get: function() {\n return webkitRTCPeerConnection.generateCertificate;\n }\n });\n }\n } else {\n // migrate from non-spec RTCIceServer.url to RTCIceServer.urls\n var OrigPeerConnection = RTCPeerConnection;\n window.RTCPeerConnection = function(pcConfig, pcConstraints) {\n if (pcConfig && pcConfig.iceServers) {\n var newIceServers = [];\n for (var i = 0; i < pcConfig.iceServers.length; i++) {\n var server = pcConfig.iceServers[i];\n if (!server.hasOwnProperty('urls') &&\n server.hasOwnProperty('url')) {\n console.warn('RTCIceServer.url is deprecated! Use urls instead.');\n server = JSON.parse(JSON.stringify(server));\n server.urls = server.url;\n newIceServers.push(server);\n } else {\n newIceServers.push(pcConfig.iceServers[i]);\n }\n }\n pcConfig.iceServers = newIceServers;\n }\n return new OrigPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get: function() {\n return OrigPeerConnection.generateCertificate;\n }\n });\n }\n\n var origGetStats = RTCPeerConnection.prototype.getStats;\n RTCPeerConnection.prototype.getStats = function(selector,\n successCallback, errorCallback) {\n var self = this;\n var args = arguments;\n\n // If selector is a function then we are in the old style stats so just\n // pass back the original getStats format to avoid breaking old users.\n if (arguments.length > 0 && typeof selector === 'function') {\n return origGetStats.apply(this, arguments);\n }\n\n // When spec-style getStats is supported, return those when called with\n // either no arguments or the selector argument is null.\n if (origGetStats.length === 0 && (arguments.length === 0 ||\n typeof arguments[0] !== 'function')) {\n return origGetStats.apply(this, []);\n }\n\n var fixChromeStats_ = function(response) {\n var standardReport = {};\n var reports = response.result();\n reports.forEach(function(report) {\n var standardStats = {\n id: report.id,\n timestamp: report.timestamp,\n type: {\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n }[report.type] || report.type\n };\n report.names().forEach(function(name) {\n standardStats[name] = report.stat(name);\n });\n standardReport[standardStats.id] = standardStats;\n });\n\n return standardReport;\n };\n\n // shim getStats with maplike support\n var makeMapStats = function(stats) {\n return new Map(Object.keys(stats).map(function(key) {\n return [key, stats[key]];\n }));\n };\n\n if (arguments.length >= 2) {\n var successCallbackWrapper_ = function(response) {\n args[1](makeMapStats(fixChromeStats_(response)));\n };\n\n return origGetStats.apply(this, [successCallbackWrapper_,\n arguments[0]]);\n }\n\n // promise-support\n return new Promise(function(resolve, reject) {\n origGetStats.apply(self, [\n function(response) {\n resolve(makeMapStats(fixChromeStats_(response)));\n }, reject]);\n }).then(successCallback, errorCallback);\n };\n\n // add promise support -- natively available in Chrome 51\n if (browserDetails.version < 51) {\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n var args = arguments;\n var self = this;\n var promise = new Promise(function(resolve, reject) {\n nativeMethod.apply(self, [args[0], resolve, reject]);\n });\n if (args.length < 2) {\n return promise;\n }\n return promise.then(function() {\n args[1].apply(null, []);\n },\n function(err) {\n if (args.length >= 3) {\n args[2].apply(null, [err]);\n }\n });\n };\n });\n }\n\n // promise support for createOffer and createAnswer. Available (without\n // bugs) since M52: crbug/619289\n if (browserDetails.version < 52) {\n ['createOffer', 'createAnswer'].forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n var self = this;\n if (arguments.length < 1 || (arguments.length === 1 &&\n typeof arguments[0] === 'object')) {\n var opts = arguments.length === 1 ? arguments[0] : undefined;\n return new Promise(function(resolve, reject) {\n nativeMethod.apply(self, [resolve, reject, opts]);\n });\n }\n return nativeMethod.apply(this, arguments);\n };\n });\n }\n\n // shim implicit creation of RTCSessionDescription/RTCIceCandidate\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n RTCIceCandidate : RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n };\n });\n\n // support for addIceCandidate(null or undefined)\n var nativeAddIceCandidate =\n RTCPeerConnection.prototype.addIceCandidate;\n RTCPeerConnection.prototype.addIceCandidate = function() {\n if (!arguments[0]) {\n if (arguments[1]) {\n arguments[1].apply(null);\n }\n return Promise.resolve();\n }\n return nativeAddIceCandidate.apply(this, arguments);\n };\n }\n};\n\n\n// Expose public methods.\nmodule.exports = {\n shimMediaStream: chromeShim.shimMediaStream,\n shimOnTrack: chromeShim.shimOnTrack,\n shimGetSendersWithDtmf: chromeShim.shimGetSendersWithDtmf,\n shimSourceObject: chromeShim.shimSourceObject,\n shimPeerConnection: chromeShim.shimPeerConnection,\n shimGetUserMedia: require('./getusermedia')\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/chrome/chrome_shim.js\n// module id = 6\n// module chunks = 0","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\nvar logging = require('../utils.js').log;\nvar browserDetails = require('../utils.js').browserDetails;\n\n// Expose public methods.\nmodule.exports = function() {\n var constraintsToChrome_ = function(c) {\n if (typeof c !== 'object' || c.mandatory || c.optional) {\n return c;\n }\n var cc = {};\n Object.keys(c).forEach(function(key) {\n if (key === 'require' || key === 'advanced' || key === 'mediaSource') {\n return;\n }\n var r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};\n if (r.exact !== undefined && typeof r.exact === 'number') {\n r.min = r.max = r.exact;\n }\n var oldname_ = function(prefix, name) {\n if (prefix) {\n return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n }\n return (name === 'deviceId') ? 'sourceId' : name;\n };\n if (r.ideal !== undefined) {\n cc.optional = cc.optional || [];\n var oc = {};\n if (typeof r.ideal === 'number') {\n oc[oldname_('min', key)] = r.ideal;\n cc.optional.push(oc);\n oc = {};\n oc[oldname_('max', key)] = r.ideal;\n cc.optional.push(oc);\n } else {\n oc[oldname_('', key)] = r.ideal;\n cc.optional.push(oc);\n }\n }\n if (r.exact !== undefined && typeof r.exact !== 'number') {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_('', key)] = r.exact;\n } else {\n ['min', 'max'].forEach(function(mix) {\n if (r[mix] !== undefined) {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_(mix, key)] = r[mix];\n }\n });\n }\n });\n if (c.advanced) {\n cc.optional = (cc.optional || []).concat(c.advanced);\n }\n return cc;\n };\n\n var shimConstraints_ = function(constraints, func) {\n constraints = JSON.parse(JSON.stringify(constraints));\n if (constraints && constraints.audio) {\n constraints.audio = constraintsToChrome_(constraints.audio);\n }\n if (constraints && typeof constraints.video === 'object') {\n // Shim facingMode for mobile & surface pro.\n var face = constraints.video.facingMode;\n face = face && ((typeof face === 'object') ? face : {ideal: face});\n var getSupportedFacingModeLies = browserDetails.version < 61;\n\n if ((face && (face.exact === 'user' || face.exact === 'environment' ||\n face.ideal === 'user' || face.ideal === 'environment')) &&\n !(navigator.mediaDevices.getSupportedConstraints &&\n navigator.mediaDevices.getSupportedConstraints().facingMode &&\n !getSupportedFacingModeLies)) {\n delete constraints.video.facingMode;\n var matches;\n if (face.exact === 'environment' || face.ideal === 'environment') {\n matches = ['back', 'rear'];\n } else if (face.exact === 'user' || face.ideal === 'user') {\n matches = ['front'];\n }\n if (matches) {\n // Look for matches in label, or use last cam for back (typical).\n return navigator.mediaDevices.enumerateDevices()\n .then(function(devices) {\n devices = devices.filter(function(d) {\n return d.kind === 'videoinput';\n });\n var dev = devices.find(function(d) {\n return matches.some(function(match) {\n return d.label.toLowerCase().indexOf(match) !== -1;\n });\n });\n if (!dev && devices.length && matches.indexOf('back') !== -1) {\n dev = devices[devices.length - 1]; // more likely the back cam\n }\n if (dev) {\n constraints.video.deviceId = face.exact ? {exact: dev.deviceId} :\n {ideal: dev.deviceId};\n }\n constraints.video = constraintsToChrome_(constraints.video);\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n });\n }\n }\n constraints.video = constraintsToChrome_(constraints.video);\n }\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n };\n\n var shimError_ = function(e) {\n return {\n name: {\n ConstraintNotSatisfiedError: 'OverconstrainedError',\n PermissionDeniedError: 'NotAllowedError',\n TrackStartError: 'NotReadableError'\n }[e.name] || e.name,\n message: e.message,\n constraint: e.constraintName,\n toString: function() {\n return this.name + (this.message && ': ') + this.message;\n }\n };\n };\n\n var getUserMedia_ = function(constraints, onSuccess, onError) {\n shimConstraints_(constraints, function(c) {\n navigator.webkitGetUserMedia(c, onSuccess, function(e) {\n onError(shimError_(e));\n });\n });\n };\n\n navigator.getUserMedia = getUserMedia_;\n\n // Returns the result of getUserMedia as a Promise.\n var getUserMediaPromise_ = function(constraints) {\n return new Promise(function(resolve, reject) {\n navigator.getUserMedia(constraints, resolve, reject);\n });\n };\n\n if (!navigator.mediaDevices) {\n navigator.mediaDevices = {\n getUserMedia: getUserMediaPromise_,\n enumerateDevices: function() {\n return new Promise(function(resolve) {\n var kinds = {audio: 'audioinput', video: 'videoinput'};\n return MediaStreamTrack.getSources(function(devices) {\n resolve(devices.map(function(device) {\n return {label: device.label,\n kind: kinds[device.kind],\n deviceId: device.id,\n groupId: ''};\n }));\n });\n });\n },\n getSupportedConstraints: function() {\n return {\n deviceId: true, echoCancellation: true, facingMode: true,\n frameRate: true, height: true, width: true\n };\n }\n };\n }\n\n // A shim for getUserMedia method on the mediaDevices object.\n // TODO(KaptenJansson) remove once implemented in Chrome stable.\n if (!navigator.mediaDevices.getUserMedia) {\n navigator.mediaDevices.getUserMedia = function(constraints) {\n return getUserMediaPromise_(constraints);\n };\n } else {\n // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia\n // function which returns a Promise, it does not accept spec-style\n // constraints.\n var origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(cs) {\n return shimConstraints_(cs, function(c) {\n return origGetUserMedia(c).then(function(stream) {\n if (c.audio && !stream.getAudioTracks().length ||\n c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach(function(track) {\n track.stop();\n });\n throw new DOMException('', 'NotFoundError');\n }\n return stream;\n }, function(e) {\n return Promise.reject(shimError_(e));\n });\n });\n };\n }\n\n // Dummy devicechange event methods.\n // TODO(KaptenJansson) remove once implemented in Chrome stable.\n if (typeof navigator.mediaDevices.addEventListener === 'undefined') {\n navigator.mediaDevices.addEventListener = function() {\n logging('Dummy mediaDevices.addEventListener called.');\n };\n }\n if (typeof navigator.mediaDevices.removeEventListener === 'undefined') {\n navigator.mediaDevices.removeEventListener = function() {\n logging('Dummy mediaDevices.removeEventListener called.');\n };\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/chrome/getusermedia.js\n// module id = 7\n// module chunks = 0","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\n\nvar browserDetails = require('../utils').browserDetails;\nvar shimRTCPeerConnection = require('./rtcpeerconnection_shim');\n\nmodule.exports = {\n shimGetUserMedia: require('./getusermedia'),\n shimPeerConnection: function() {\n if (window.RTCIceGatherer) {\n // ORTC defines an RTCIceCandidate object but no constructor.\n // Not implemented in Edge.\n if (!window.RTCIceCandidate) {\n window.RTCIceCandidate = function(args) {\n return args;\n };\n }\n // ORTC does not have a session description object but\n // other browsers (i.e. Chrome) that will support both PC and ORTC\n // in the future might have this defined already.\n if (!window.RTCSessionDescription) {\n window.RTCSessionDescription = function(args) {\n return args;\n };\n }\n // this adds an additional event listener to MediaStrackTrack that signals\n // when a tracks enabled property was changed. Workaround for a bug in\n // addStream, see below. No longer required in 15025+\n if (browserDetails.version < 15025) {\n var origMSTEnabled = Object.getOwnPropertyDescriptor(\n MediaStreamTrack.prototype, 'enabled');\n Object.defineProperty(MediaStreamTrack.prototype, 'enabled', {\n set: function(value) {\n origMSTEnabled.set.call(this, value);\n var ev = new Event('enabled');\n ev.enabled = value;\n this.dispatchEvent(ev);\n }\n });\n }\n }\n window.RTCPeerConnection = shimRTCPeerConnection(browserDetails.version);\n },\n shimReplaceTrack: function() {\n // ORTC has replaceTrack -- https://github.com/w3c/ortc/issues/614\n if (window.RTCRtpSender && !('replaceTrack' in RTCRtpSender.prototype)) {\n RTCRtpSender.prototype.replaceTrack = RTCRtpSender.prototype.setTrack;\n }\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/edge/edge_shim.js\n// module id = 8\n// module chunks = 0","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\n\n// Expose public methods.\nmodule.exports = function() {\n var shimError_ = function(e) {\n return {\n name: {PermissionDeniedError: 'NotAllowedError'}[e.name] || e.name,\n message: e.message,\n constraint: e.constraint,\n toString: function() {\n return this.name;\n }\n };\n };\n\n // getUserMedia error shim.\n var origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n return origGetUserMedia(c).catch(function(e) {\n return Promise.reject(shimError_(e));\n });\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/edge/getusermedia.js\n// module id = 9\n// module chunks = 0","/*\n * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\n\nvar SDPUtils = require('sdp');\n\n// sort tracks such that they follow an a-v-a-v...\n// pattern.\nfunction sortTracks(tracks) {\n var audioTracks = tracks.filter(function(track) {\n return track.kind === 'audio';\n });\n var videoTracks = tracks.filter(function(track) {\n return track.kind === 'video';\n });\n tracks = [];\n while (audioTracks.length || videoTracks.length) {\n if (audioTracks.length) {\n tracks.push(audioTracks.shift());\n }\n if (videoTracks.length) {\n tracks.push(videoTracks.shift());\n }\n }\n return tracks;\n}\n\n// Edge does not like\n// 1) stun:\n// 2) turn: that does not have all of turn:host:port?transport=udp\n// 3) turn: with ipv6 addresses\n// 4) turn: occurring muliple times\nfunction filterIceServers(iceServers, edgeVersion) {\n var hasTurn = false;\n iceServers = JSON.parse(JSON.stringify(iceServers));\n return iceServers.filter(function(server) {\n if (server && (server.urls || server.url)) {\n var urls = server.urls || server.url;\n if (server.url && !server.urls) {\n console.warn('RTCIceServer.url is deprecated! Use urls instead.');\n }\n var isString = typeof urls === 'string';\n if (isString) {\n urls = [urls];\n }\n urls = urls.filter(function(url) {\n var validTurn = url.indexOf('turn:') === 0 &&\n url.indexOf('transport=udp') !== -1 &&\n url.indexOf('turn:[') === -1 &&\n !hasTurn;\n\n if (validTurn) {\n hasTurn = true;\n return true;\n }\n return url.indexOf('stun:') === 0 && edgeVersion >= 14393;\n });\n\n delete server.url;\n server.urls = isString ? urls[0] : urls;\n return !!urls.length;\n }\n return false;\n });\n}\n\n// Determines the intersection of local and remote capabilities.\nfunction getCommonCapabilities(localCapabilities, remoteCapabilities) {\n var commonCapabilities = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: []\n };\n\n var findCodecByPayloadType = function(pt, codecs) {\n pt = parseInt(pt, 10);\n for (var i = 0; i < codecs.length; i++) {\n if (codecs[i].payloadType === pt ||\n codecs[i].preferredPayloadType === pt) {\n return codecs[i];\n }\n }\n };\n\n var rtxCapabilityMatches = function(lRtx, rRtx, lCodecs, rCodecs) {\n var lCodec = findCodecByPayloadType(lRtx.parameters.apt, lCodecs);\n var rCodec = findCodecByPayloadType(rRtx.parameters.apt, rCodecs);\n return lCodec && rCodec &&\n lCodec.name.toLowerCase() === rCodec.name.toLowerCase();\n };\n\n localCapabilities.codecs.forEach(function(lCodec) {\n for (var i = 0; i < remoteCapabilities.codecs.length; i++) {\n var rCodec = remoteCapabilities.codecs[i];\n if (lCodec.name.toLowerCase() === rCodec.name.toLowerCase() &&\n lCodec.clockRate === rCodec.clockRate) {\n if (lCodec.name.toLowerCase() === 'rtx' &&\n lCodec.parameters && rCodec.parameters.apt) {\n // for RTX we need to find the local rtx that has a apt\n // which points to the same local codec as the remote one.\n if (!rtxCapabilityMatches(lCodec, rCodec,\n localCapabilities.codecs, remoteCapabilities.codecs)) {\n continue;\n }\n }\n rCodec = JSON.parse(JSON.stringify(rCodec)); // deepcopy\n // number of channels is the highest common number of channels\n rCodec.numChannels = Math.min(lCodec.numChannels,\n rCodec.numChannels);\n // push rCodec so we reply with offerer payload type\n commonCapabilities.codecs.push(rCodec);\n\n // determine common feedback mechanisms\n rCodec.rtcpFeedback = rCodec.rtcpFeedback.filter(function(fb) {\n for (var j = 0; j < lCodec.rtcpFeedback.length; j++) {\n if (lCodec.rtcpFeedback[j].type === fb.type &&\n lCodec.rtcpFeedback[j].parameter === fb.parameter) {\n return true;\n }\n }\n return false;\n });\n // FIXME: also need to determine .parameters\n // see https://github.com/openpeer/ortc/issues/569\n break;\n }\n }\n });\n\n localCapabilities.headerExtensions.forEach(function(lHeaderExtension) {\n for (var i = 0; i < remoteCapabilities.headerExtensions.length;\n i++) {\n var rHeaderExtension = remoteCapabilities.headerExtensions[i];\n if (lHeaderExtension.uri === rHeaderExtension.uri) {\n commonCapabilities.headerExtensions.push(rHeaderExtension);\n break;\n }\n }\n });\n\n // FIXME: fecMechanisms\n return commonCapabilities;\n}\n\n// is action=setLocalDescription with type allowed in signalingState\nfunction isActionAllowedInSignalingState(action, type, signalingState) {\n return {\n offer: {\n setLocalDescription: ['stable', 'have-local-offer'],\n setRemoteDescription: ['stable', 'have-remote-offer']\n },\n answer: {\n setLocalDescription: ['have-remote-offer', 'have-local-pranswer'],\n setRemoteDescription: ['have-local-offer', 'have-remote-pranswer']\n }\n }[type][action].indexOf(signalingState) !== -1;\n}\n\nmodule.exports = function(edgeVersion) {\n var RTCPeerConnection = function(config) {\n var self = this;\n\n var _eventTarget = document.createDocumentFragment();\n ['addEventListener', 'removeEventListener', 'dispatchEvent']\n .forEach(function(method) {\n self[method] = _eventTarget[method].bind(_eventTarget);\n });\n\n this.needNegotiation = false;\n\n this.onicecandidate = null;\n this.onaddstream = null;\n this.ontrack = null;\n this.onremovestream = null;\n this.onsignalingstatechange = null;\n this.oniceconnectionstatechange = null;\n this.onicegatheringstatechange = null;\n this.onnegotiationneeded = null;\n this.ondatachannel = null;\n this.canTrickleIceCandidates = null;\n\n this.localStreams = [];\n this.remoteStreams = [];\n this.getLocalStreams = function() {\n return self.localStreams;\n };\n this.getRemoteStreams = function() {\n return self.remoteStreams;\n };\n\n this.localDescription = new RTCSessionDescription({\n type: '',\n sdp: ''\n });\n this.remoteDescription = new RTCSessionDescription({\n type: '',\n sdp: ''\n });\n this.signalingState = 'stable';\n this.iceConnectionState = 'new';\n this.iceGatheringState = 'new';\n\n this.iceOptions = {\n gatherPolicy: 'all',\n iceServers: []\n };\n if (config && config.iceTransportPolicy) {\n switch (config.iceTransportPolicy) {\n case 'all':\n case 'relay':\n this.iceOptions.gatherPolicy = config.iceTransportPolicy;\n break;\n default:\n // don't set iceTransportPolicy.\n break;\n }\n }\n this.usingBundle = config && config.bundlePolicy === 'max-bundle';\n\n if (config && config.iceServers) {\n this.iceOptions.iceServers = filterIceServers(config.iceServers,\n edgeVersion);\n }\n this._config = config || {};\n\n // per-track iceGathers, iceTransports, dtlsTransports, rtpSenders, ...\n // everything that is needed to describe a SDP m-line.\n this.transceivers = [];\n\n // since the iceGatherer is currently created in createOffer but we\n // must not emit candidates until after setLocalDescription we buffer\n // them in this array.\n this._localIceCandidatesBuffer = [];\n };\n\n RTCPeerConnection.prototype._emitGatheringStateChange = function() {\n var event = new Event('icegatheringstatechange');\n this.dispatchEvent(event);\n if (this.onicegatheringstatechange !== null) {\n this.onicegatheringstatechange(event);\n }\n };\n\n RTCPeerConnection.prototype._emitBufferedCandidates = function() {\n var self = this;\n var sections = SDPUtils.splitSections(self.localDescription.sdp);\n // FIXME: need to apply ice candidates in a way which is async but\n // in-order\n this._localIceCandidatesBuffer.forEach(function(event) {\n var end = !event.candidate || Object.keys(event.candidate).length === 0;\n if (end) {\n for (var j = 1; j < sections.length; j++) {\n if (sections[j].indexOf('\\r\\na=end-of-candidates\\r\\n') === -1) {\n sections[j] += 'a=end-of-candidates\\r\\n';\n }\n }\n } else {\n sections[event.candidate.sdpMLineIndex + 1] +=\n 'a=' + event.candidate.candidate + '\\r\\n';\n }\n self.localDescription.sdp = sections.join('');\n self.dispatchEvent(event);\n if (self.onicecandidate !== null) {\n self.onicecandidate(event);\n }\n if (!event.candidate && self.iceGatheringState !== 'complete') {\n var complete = self.transceivers.every(function(transceiver) {\n return transceiver.iceGatherer &&\n transceiver.iceGatherer.state === 'completed';\n });\n if (complete && self.iceGatheringStateChange !== 'complete') {\n self.iceGatheringState = 'complete';\n self._emitGatheringStateChange();\n }\n }\n });\n this._localIceCandidatesBuffer = [];\n };\n\n RTCPeerConnection.prototype.getConfiguration = function() {\n return this._config;\n };\n\n // internal helper to create a transceiver object.\n // (whih is not yet the same as the WebRTC 1.0 transceiver)\n RTCPeerConnection.prototype._createTransceiver = function(kind) {\n var hasBundleTransport = this.transceivers.length > 0;\n var transceiver = {\n track: null,\n iceGatherer: null,\n iceTransport: null,\n dtlsTransport: null,\n localCapabilities: null,\n remoteCapabilities: null,\n rtpSender: null,\n rtpReceiver: null,\n kind: kind,\n mid: null,\n sendEncodingParameters: null,\n recvEncodingParameters: null,\n stream: null,\n wantReceive: true\n };\n if (this.usingBundle && hasBundleTransport) {\n transceiver.iceTransport = this.transceivers[0].iceTransport;\n transceiver.dtlsTransport = this.transceivers[0].dtlsTransport;\n } else {\n var transports = this._createIceAndDtlsTransports();\n transceiver.iceTransport = transports.iceTransport;\n transceiver.dtlsTransport = transports.dtlsTransport;\n }\n this.transceivers.push(transceiver);\n return transceiver;\n };\n\n RTCPeerConnection.prototype.addTrack = function(track, stream) {\n var transceiver;\n for (var i = 0; i < this.transceivers.length; i++) {\n if (!this.transceivers[i].track &&\n this.transceivers[i].kind === track.kind) {\n transceiver = this.transceivers[i];\n }\n }\n if (!transceiver) {\n transceiver = this._createTransceiver(track.kind);\n }\n\n transceiver.track = track;\n transceiver.stream = stream;\n transceiver.rtpSender = new RTCRtpSender(track,\n transceiver.dtlsTransport);\n\n this._maybeFireNegotiationNeeded();\n return transceiver.rtpSender;\n };\n\n RTCPeerConnection.prototype.addStream = function(stream) {\n var self = this;\n if (edgeVersion >= 15025) {\n this.localStreams.push(stream);\n stream.getTracks().forEach(function(track) {\n self.addTrack(track, stream);\n });\n } else {\n // Clone is necessary for local demos mostly, attaching directly\n // to two different senders does not work (build 10547).\n // Fixed in 15025 (or earlier)\n var clonedStream = stream.clone();\n stream.getTracks().forEach(function(track, idx) {\n var clonedTrack = clonedStream.getTracks()[idx];\n track.addEventListener('enabled', function(event) {\n clonedTrack.enabled = event.enabled;\n });\n });\n clonedStream.getTracks().forEach(function(track) {\n self.addTrack(track, clonedStream);\n });\n this.localStreams.push(clonedStream);\n }\n this._maybeFireNegotiationNeeded();\n };\n\n RTCPeerConnection.prototype.removeStream = function(stream) {\n var idx = this.localStreams.indexOf(stream);\n if (idx > -1) {\n this.localStreams.splice(idx, 1);\n this._maybeFireNegotiationNeeded();\n }\n };\n\n RTCPeerConnection.prototype.getSenders = function() {\n return this.transceivers.filter(function(transceiver) {\n return !!transceiver.rtpSender;\n })\n .map(function(transceiver) {\n return transceiver.rtpSender;\n });\n };\n\n RTCPeerConnection.prototype.getReceivers = function() {\n return this.transceivers.filter(function(transceiver) {\n return !!transceiver.rtpReceiver;\n })\n .map(function(transceiver) {\n return transceiver.rtpReceiver;\n });\n };\n\n // Create ICE gatherer and hook it up.\n RTCPeerConnection.prototype._createIceGatherer = function(mid,\n sdpMLineIndex) {\n var self = this;\n var iceGatherer = new RTCIceGatherer(self.iceOptions);\n iceGatherer.onlocalcandidate = function(evt) {\n var event = new Event('icecandidate');\n event.candidate = {sdpMid: mid, sdpMLineIndex: sdpMLineIndex};\n\n var cand = evt.candidate;\n var end = !cand || Object.keys(cand).length === 0;\n // Edge emits an empty object for RTCIceCandidateComplete‥\n if (end) {\n // polyfill since RTCIceGatherer.state is not implemented in\n // Edge 10547 yet.\n if (iceGatherer.state === undefined) {\n iceGatherer.state = 'completed';\n }\n } else {\n // RTCIceCandidate doesn't have a component, needs to be added\n cand.component = 1;\n event.candidate.candidate = SDPUtils.writeCandidate(cand);\n }\n\n // update local description.\n var sections = SDPUtils.splitSections(self.localDescription.sdp);\n if (!end) {\n sections[event.candidate.sdpMLineIndex + 1] +=\n 'a=' + event.candidate.candidate + '\\r\\n';\n } else {\n sections[event.candidate.sdpMLineIndex + 1] +=\n 'a=end-of-candidates\\r\\n';\n }\n self.localDescription.sdp = sections.join('');\n var transceivers = self._pendingOffer ? self._pendingOffer :\n self.transceivers;\n var complete = transceivers.every(function(transceiver) {\n return transceiver.iceGatherer &&\n transceiver.iceGatherer.state === 'completed';\n });\n\n // Emit candidate if localDescription is set.\n // Also emits null candidate when all gatherers are complete.\n switch (self.iceGatheringState) {\n case 'new':\n if (!end) {\n self._localIceCandidatesBuffer.push(event);\n }\n if (end && complete) {\n self._localIceCandidatesBuffer.push(\n new Event('icecandidate'));\n }\n break;\n case 'gathering':\n self._emitBufferedCandidates();\n if (!end) {\n self.dispatchEvent(event);\n if (self.onicecandidate !== null) {\n self.onicecandidate(event);\n }\n }\n if (complete) {\n self.dispatchEvent(new Event('icecandidate'));\n if (self.onicecandidate !== null) {\n self.onicecandidate(new Event('icecandidate'));\n }\n self.iceGatheringState = 'complete';\n self._emitGatheringStateChange();\n }\n break;\n case 'complete':\n // should not happen... currently!\n break;\n default: // no-op.\n break;\n }\n };\n return iceGatherer;\n };\n\n // Create ICE transport and DTLS transport.\n RTCPeerConnection.prototype._createIceAndDtlsTransports = function() {\n var self = this;\n var iceTransport = new RTCIceTransport(null);\n iceTransport.onicestatechange = function() {\n self._updateConnectionState();\n };\n\n var dtlsTransport = new RTCDtlsTransport(iceTransport);\n dtlsTransport.ondtlsstatechange = function() {\n self._updateConnectionState();\n };\n dtlsTransport.onerror = function() {\n // onerror does not set state to failed by itself.\n Object.defineProperty(dtlsTransport, 'state',\n {value: 'failed', writable: true});\n self._updateConnectionState();\n };\n\n return {\n iceTransport: iceTransport,\n dtlsTransport: dtlsTransport\n };\n };\n\n // Destroy ICE gatherer, ICE transport and DTLS transport.\n // Without triggering the callbacks.\n RTCPeerConnection.prototype._disposeIceAndDtlsTransports = function(\n sdpMLineIndex) {\n var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;\n if (iceGatherer) {\n delete iceGatherer.onlocalcandidate;\n delete this.transceivers[sdpMLineIndex].iceGatherer;\n }\n var iceTransport = this.transceivers[sdpMLineIndex].iceTransport;\n if (iceTransport) {\n delete iceTransport.onicestatechange;\n delete this.transceivers[sdpMLineIndex].iceTransport;\n }\n var dtlsTransport = this.transceivers[sdpMLineIndex].dtlsTransport;\n if (dtlsTransport) {\n delete dtlsTransport.ondtlssttatechange;\n delete dtlsTransport.onerror;\n delete this.transceivers[sdpMLineIndex].dtlsTransport;\n }\n };\n\n // Start the RTP Sender and Receiver for a transceiver.\n RTCPeerConnection.prototype._transceive = function(transceiver,\n send, recv) {\n var params = getCommonCapabilities(transceiver.localCapabilities,\n transceiver.remoteCapabilities);\n if (send && transceiver.rtpSender) {\n params.encodings = transceiver.sendEncodingParameters;\n params.rtcp = {\n cname: SDPUtils.localCName,\n compound: transceiver.rtcpParameters.compound\n };\n if (transceiver.recvEncodingParameters.length) {\n params.rtcp.ssrc = transceiver.recvEncodingParameters[0].ssrc;\n }\n transceiver.rtpSender.send(params);\n }\n if (recv && transceiver.rtpReceiver) {\n // remove RTX field in Edge 14942\n if (transceiver.kind === 'video'\n && transceiver.recvEncodingParameters\n && edgeVersion < 15019) {\n transceiver.recvEncodingParameters.forEach(function(p) {\n delete p.rtx;\n });\n }\n params.encodings = transceiver.recvEncodingParameters;\n params.rtcp = {\n cname: transceiver.rtcpParameters.cname,\n compound: transceiver.rtcpParameters.compound\n };\n if (transceiver.sendEncodingParameters.length) {\n params.rtcp.ssrc = transceiver.sendEncodingParameters[0].ssrc;\n }\n transceiver.rtpReceiver.receive(params);\n }\n };\n\n RTCPeerConnection.prototype.setLocalDescription = function(description) {\n var self = this;\n\n if (!isActionAllowedInSignalingState('setLocalDescription',\n description.type, this.signalingState)) {\n var e = new Error('Can not set local ' + description.type +\n ' in state ' + this.signalingState);\n e.name = 'InvalidStateError';\n if (arguments.length > 2 && typeof arguments[2] === 'function') {\n window.setTimeout(arguments[2], 0, e);\n }\n return Promise.reject(e);\n }\n\n var sections;\n var sessionpart;\n if (description.type === 'offer') {\n // FIXME: What was the purpose of this empty if statement?\n // if (!this._pendingOffer) {\n // } else {\n if (this._pendingOffer) {\n // VERY limited support for SDP munging. Limited to:\n // * changing the order of codecs\n sections = SDPUtils.splitSections(description.sdp);\n sessionpart = sections.shift();\n sections.forEach(function(mediaSection, sdpMLineIndex) {\n var caps = SDPUtils.parseRtpParameters(mediaSection);\n self._pendingOffer[sdpMLineIndex].localCapabilities = caps;\n });\n this.transceivers = this._pendingOffer;\n delete this._pendingOffer;\n }\n } else if (description.type === 'answer') {\n sections = SDPUtils.splitSections(self.remoteDescription.sdp);\n sessionpart = sections.shift();\n var isIceLite = SDPUtils.matchPrefix(sessionpart,\n 'a=ice-lite').length > 0;\n sections.forEach(function(mediaSection, sdpMLineIndex) {\n var transceiver = self.transceivers[sdpMLineIndex];\n var iceGatherer = transceiver.iceGatherer;\n var iceTransport = transceiver.iceTransport;\n var dtlsTransport = transceiver.dtlsTransport;\n var localCapabilities = transceiver.localCapabilities;\n var remoteCapabilities = transceiver.remoteCapabilities;\n\n var rejected = SDPUtils.isRejected(mediaSection);\n\n if (!rejected && !transceiver.isDatachannel) {\n var remoteIceParameters = SDPUtils.getIceParameters(\n mediaSection, sessionpart);\n var remoteDtlsParameters = SDPUtils.getDtlsParameters(\n mediaSection, sessionpart);\n if (isIceLite) {\n remoteDtlsParameters.role = 'server';\n }\n\n if (!self.usingBundle || sdpMLineIndex === 0) {\n iceTransport.start(iceGatherer, remoteIceParameters,\n isIceLite ? 'controlling' : 'controlled');\n dtlsTransport.start(remoteDtlsParameters);\n }\n\n // Calculate intersection of capabilities.\n var params = getCommonCapabilities(localCapabilities,\n remoteCapabilities);\n\n // Start the RTCRtpSender. The RTCRtpReceiver for this\n // transceiver has already been started in setRemoteDescription.\n self._transceive(transceiver,\n params.codecs.length > 0,\n false);\n }\n });\n }\n\n this.localDescription = {\n type: description.type,\n sdp: description.sdp\n };\n switch (description.type) {\n case 'offer':\n this._updateSignalingState('have-local-offer');\n break;\n case 'answer':\n this._updateSignalingState('stable');\n break;\n default:\n throw new TypeError('unsupported type \"' + description.type +\n '\"');\n }\n\n // If a success callback was provided, emit ICE candidates after it\n // has been executed. Otherwise, emit callback after the Promise is\n // resolved.\n var hasCallback = arguments.length > 1 &&\n typeof arguments[1] === 'function';\n if (hasCallback) {\n var cb = arguments[1];\n window.setTimeout(function() {\n cb();\n if (self.iceGatheringState === 'new') {\n self.iceGatheringState = 'gathering';\n self._emitGatheringStateChange();\n }\n self._emitBufferedCandidates();\n }, 0);\n }\n var p = Promise.resolve();\n p.then(function() {\n if (!hasCallback) {\n if (self.iceGatheringState === 'new') {\n self.iceGatheringState = 'gathering';\n self._emitGatheringStateChange();\n }\n // Usually candidates will be emitted earlier.\n window.setTimeout(self._emitBufferedCandidates.bind(self), 500);\n }\n });\n return p;\n };\n\n RTCPeerConnection.prototype.setRemoteDescription = function(description) {\n var self = this;\n\n if (!isActionAllowedInSignalingState('setRemoteDescription',\n description.type, this.signalingState)) {\n var e = new Error('Can not set remote ' + description.type +\n ' in state ' + this.signalingState);\n e.name = 'InvalidStateError';\n if (arguments.length > 2 && typeof arguments[2] === 'function') {\n window.setTimeout(arguments[2], 0, e);\n }\n return Promise.reject(e);\n }\n\n var streams = {};\n var receiverList = [];\n var sections = SDPUtils.splitSections(description.sdp);\n var sessionpart = sections.shift();\n var isIceLite = SDPUtils.matchPrefix(sessionpart,\n 'a=ice-lite').length > 0;\n var usingBundle = SDPUtils.matchPrefix(sessionpart,\n 'a=group:BUNDLE ').length > 0;\n this.usingBundle = usingBundle;\n var iceOptions = SDPUtils.matchPrefix(sessionpart,\n 'a=ice-options:')[0];\n if (iceOptions) {\n this.canTrickleIceCandidates = iceOptions.substr(14).split(' ')\n .indexOf('trickle') >= 0;\n } else {\n this.canTrickleIceCandidates = false;\n }\n\n sections.forEach(function(mediaSection, sdpMLineIndex) {\n var lines = SDPUtils.splitLines(mediaSection);\n var kind = SDPUtils.getKind(mediaSection);\n var rejected = SDPUtils.isRejected(mediaSection);\n var protocol = lines[0].substr(2).split(' ')[2];\n\n var direction = SDPUtils.getDirection(mediaSection, sessionpart);\n var remoteMsid = SDPUtils.parseMsid(mediaSection);\n\n var mid = SDPUtils.getMid(mediaSection) || SDPUtils.generateIdentifier();\n\n // Reject datachannels which are not implemented yet.\n if (kind === 'application' && protocol === 'DTLS/SCTP') {\n self.transceivers[sdpMLineIndex] = {\n mid: mid,\n isDatachannel: true\n };\n return;\n }\n\n var transceiver;\n var iceGatherer;\n var iceTransport;\n var dtlsTransport;\n var rtpReceiver;\n var sendEncodingParameters;\n var recvEncodingParameters;\n var localCapabilities;\n\n var track;\n // FIXME: ensure the mediaSection has rtcp-mux set.\n var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection);\n var remoteIceParameters;\n var remoteDtlsParameters;\n if (!rejected) {\n remoteIceParameters = SDPUtils.getIceParameters(mediaSection,\n sessionpart);\n remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection,\n sessionpart);\n remoteDtlsParameters.role = 'client';\n }\n recvEncodingParameters =\n SDPUtils.parseRtpEncodingParameters(mediaSection);\n\n var rtcpParameters = SDPUtils.parseRtcpParameters(mediaSection);\n\n var isComplete = SDPUtils.matchPrefix(mediaSection,\n 'a=end-of-candidates', sessionpart).length > 0;\n var cands = SDPUtils.matchPrefix(mediaSection, 'a=candidate:')\n .map(function(cand) {\n return SDPUtils.parseCandidate(cand);\n })\n .filter(function(cand) {\n return cand.component === '1' || cand.component === 1;\n });\n if (description.type === 'offer' && !rejected) {\n transceiver = self.transceivers[sdpMLineIndex] ||\n self._createTransceiver(kind);\n transceiver.mid = mid;\n\n if (!transceiver.iceGatherer) {\n transceiver.iceGatherer = usingBundle && sdpMLineIndex > 0 ?\n self.transceivers[0].iceGatherer :\n self._createIceGatherer(mid, sdpMLineIndex);\n }\n\n if (isComplete && (!usingBundle || sdpMLineIndex === 0)) {\n transceiver.iceTransport.setRemoteCandidates(cands);\n }\n\n localCapabilities = RTCRtpReceiver.getCapabilities(kind);\n\n // filter RTX until additional stuff needed for RTX is implemented\n // in adapter.js\n if (edgeVersion < 15019) {\n localCapabilities.codecs = localCapabilities.codecs.filter(\n function(codec) {\n return codec.name !== 'rtx';\n });\n }\n\n sendEncodingParameters = [{\n ssrc: (2 * sdpMLineIndex + 2) * 1001\n }];\n\n if (direction === 'sendrecv' || direction === 'sendonly') {\n rtpReceiver = new RTCRtpReceiver(transceiver.dtlsTransport,\n kind);\n\n track = rtpReceiver.track;\n // FIXME: does not work with Plan B.\n if (remoteMsid) {\n if (!streams[remoteMsid.stream]) {\n streams[remoteMsid.stream] = new MediaStream();\n Object.defineProperty(streams[remoteMsid.stream], 'id', {\n get: function() {\n return remoteMsid.stream;\n }\n });\n }\n Object.defineProperty(track, 'id', {\n get: function() {\n return remoteMsid.track;\n }\n });\n streams[remoteMsid.stream].addTrack(track);\n receiverList.push([track, rtpReceiver,\n streams[remoteMsid.stream]]);\n } else {\n if (!streams.default) {\n streams.default = new MediaStream();\n }\n streams.default.addTrack(track);\n receiverList.push([track, rtpReceiver, streams.default]);\n }\n }\n\n transceiver.localCapabilities = localCapabilities;\n transceiver.remoteCapabilities = remoteCapabilities;\n transceiver.rtpReceiver = rtpReceiver;\n transceiver.rtcpParameters = rtcpParameters;\n transceiver.sendEncodingParameters = sendEncodingParameters;\n transceiver.recvEncodingParameters = recvEncodingParameters;\n\n // Start the RTCRtpReceiver now. The RTPSender is started in\n // setLocalDescription.\n self._transceive(self.transceivers[sdpMLineIndex],\n false,\n direction === 'sendrecv' || direction === 'sendonly');\n } else if (description.type === 'answer' && !rejected) {\n if (usingBundle && sdpMLineIndex > 0) {\n self._disposeIceAndDtlsTransports(sdpMLineIndex);\n self.transceivers[sdpMLineIndex].iceGatherer =\n self.transceivers[0].iceGatherer;\n self.transceivers[sdpMLineIndex].iceTransport =\n self.transceivers[0].iceTransport;\n self.transceivers[sdpMLineIndex].dtlsTransport =\n self.transceivers[0].dtlsTransport;\n if (self.transceivers[sdpMLineIndex].rtpSender) {\n self.transceivers[sdpMLineIndex].rtpSender.setTransport(\n self.transceivers[0].dtlsTransport);\n }\n if (self.transceivers[sdpMLineIndex].rtpReceiver) {\n self.transceivers[sdpMLineIndex].rtpReceiver.setTransport(\n self.transceivers[0].dtlsTransport);\n }\n }\n transceiver = self.transceivers[sdpMLineIndex];\n iceGatherer = transceiver.iceGatherer;\n iceTransport = transceiver.iceTransport;\n dtlsTransport = transceiver.dtlsTransport;\n rtpReceiver = transceiver.rtpReceiver;\n sendEncodingParameters = transceiver.sendEncodingParameters;\n localCapabilities = transceiver.localCapabilities;\n\n self.transceivers[sdpMLineIndex].recvEncodingParameters =\n recvEncodingParameters;\n self.transceivers[sdpMLineIndex].remoteCapabilities =\n remoteCapabilities;\n self.transceivers[sdpMLineIndex].rtcpParameters = rtcpParameters;\n\n if ((isIceLite || isComplete) && cands.length) {\n iceTransport.setRemoteCandidates(cands);\n }\n if (!usingBundle || sdpMLineIndex === 0) {\n iceTransport.start(iceGatherer, remoteIceParameters,\n 'controlling');\n dtlsTransport.start(remoteDtlsParameters);\n }\n\n self._transceive(transceiver,\n direction === 'sendrecv' || direction === 'recvonly',\n direction === 'sendrecv' || direction === 'sendonly');\n\n if (rtpReceiver &&\n (direction === 'sendrecv' || direction === 'sendonly')) {\n track = rtpReceiver.track;\n if (remoteMsid) {\n if (!streams[remoteMsid.stream]) {\n streams[remoteMsid.stream] = new MediaStream();\n }\n streams[remoteMsid.stream].addTrack(track);\n receiverList.push([track, rtpReceiver, streams[remoteMsid.stream]]);\n } else {\n if (!streams.default) {\n streams.default = new MediaStream();\n }\n streams.default.addTrack(track);\n receiverList.push([track, rtpReceiver, streams.default]);\n }\n } else {\n // FIXME: actually the receiver should be created later.\n delete transceiver.rtpReceiver;\n }\n }\n });\n\n this.remoteDescription = {\n type: description.type,\n sdp: description.sdp\n };\n switch (description.type) {\n case 'offer':\n this._updateSignalingState('have-remote-offer');\n break;\n case 'answer':\n this._updateSignalingState('stable');\n break;\n default:\n throw new TypeError('unsupported type \"' + description.type +\n '\"');\n }\n Object.keys(streams).forEach(function(sid) {\n var stream = streams[sid];\n if (stream.getTracks().length) {\n self.remoteStreams.push(stream);\n var event = new Event('addstream');\n event.stream = stream;\n self.dispatchEvent(event);\n if (self.onaddstream !== null) {\n window.setTimeout(function() {\n self.onaddstream(event);\n }, 0);\n }\n\n receiverList.forEach(function(item) {\n var track = item[0];\n var receiver = item[1];\n if (stream.id !== item[2].id) {\n return;\n }\n var trackEvent = new Event('track');\n trackEvent.track = track;\n trackEvent.receiver = receiver;\n trackEvent.streams = [stream];\n self.dispatchEvent(trackEvent);\n if (self.ontrack !== null) {\n window.setTimeout(function() {\n self.ontrack(trackEvent);\n }, 0);\n }\n });\n }\n });\n\n // check whether addIceCandidate({}) was called within four seconds after\n // setRemoteDescription.\n window.setTimeout(function() {\n if (!(self && self.transceivers)) {\n return;\n }\n self.transceivers.forEach(function(transceiver) {\n if (transceiver.iceTransport &&\n transceiver.iceTransport.state === 'new' &&\n transceiver.iceTransport.getRemoteCandidates().length > 0) {\n console.warn('Timeout for addRemoteCandidate. Consider sending ' +\n 'an end-of-candidates notification');\n transceiver.iceTransport.addRemoteCandidate({});\n }\n });\n }, 4000);\n\n if (arguments.length > 1 && typeof arguments[1] === 'function') {\n window.setTimeout(arguments[1], 0);\n }\n return Promise.resolve();\n };\n\n RTCPeerConnection.prototype.close = function() {\n this.transceivers.forEach(function(transceiver) {\n /* not yet\n if (transceiver.iceGatherer) {\n transceiver.iceGatherer.close();\n }\n */\n if (transceiver.iceTransport) {\n transceiver.iceTransport.stop();\n }\n if (transceiver.dtlsTransport) {\n transceiver.dtlsTransport.stop();\n }\n if (transceiver.rtpSender) {\n transceiver.rtpSender.stop();\n }\n if (transceiver.rtpReceiver) {\n transceiver.rtpReceiver.stop();\n }\n });\n // FIXME: clean up tracks, local streams, remote streams, etc\n this._updateSignalingState('closed');\n };\n\n // Update the signaling state.\n RTCPeerConnection.prototype._updateSignalingState = function(newState) {\n this.signalingState = newState;\n var event = new Event('signalingstatechange');\n this.dispatchEvent(event);\n if (this.onsignalingstatechange !== null) {\n this.onsignalingstatechange(event);\n }\n };\n\n // Determine whether to fire the negotiationneeded event.\n RTCPeerConnection.prototype._maybeFireNegotiationNeeded = function() {\n var self = this;\n if (this.signalingState !== 'stable' || this.needNegotiation === true) {\n return;\n }\n this.needNegotiation = true;\n window.setTimeout(function() {\n if (self.needNegotiation === false) {\n return;\n }\n self.needNegotiation = false;\n var event = new Event('negotiationneeded');\n self.dispatchEvent(event);\n if (self.onnegotiationneeded !== null) {\n self.onnegotiationneeded(event);\n }\n }, 0);\n };\n\n // Update the connection state.\n RTCPeerConnection.prototype._updateConnectionState = function() {\n var self = this;\n var newState;\n var states = {\n 'new': 0,\n closed: 0,\n connecting: 0,\n checking: 0,\n connected: 0,\n completed: 0,\n failed: 0\n };\n this.transceivers.forEach(function(transceiver) {\n states[transceiver.iceTransport.state]++;\n states[transceiver.dtlsTransport.state]++;\n });\n // ICETransport.completed and connected are the same for this purpose.\n states.connected += states.completed;\n\n newState = 'new';\n if (states.failed > 0) {\n newState = 'failed';\n } else if (states.connecting > 0 || states.checking > 0) {\n newState = 'connecting';\n } else if (states.disconnected > 0) {\n newState = 'disconnected';\n } else if (states.new > 0) {\n newState = 'new';\n } else if (states.connected > 0 || states.completed > 0) {\n newState = 'connected';\n }\n\n if (newState !== self.iceConnectionState) {\n self.iceConnectionState = newState;\n var event = new Event('iceconnectionstatechange');\n this.dispatchEvent(event);\n if (this.oniceconnectionstatechange !== null) {\n this.oniceconnectionstatechange(event);\n }\n }\n };\n\n RTCPeerConnection.prototype.createOffer = function() {\n var self = this;\n if (this._pendingOffer) {\n throw new Error('createOffer called while there is a pending offer.');\n }\n var offerOptions;\n if (arguments.length === 1 && typeof arguments[0] !== 'function') {\n offerOptions = arguments[0];\n } else if (arguments.length === 3) {\n offerOptions = arguments[2];\n }\n\n var numAudioTracks = this.transceivers.filter(function(t) {\n return t.kind === 'audio';\n }).length;\n var numVideoTracks = this.transceivers.filter(function(t) {\n return t.kind === 'video';\n }).length;\n\n // Determine number of audio and video tracks we need to send/recv.\n if (offerOptions) {\n // Reject Chrome legacy constraints.\n if (offerOptions.mandatory || offerOptions.optional) {\n throw new TypeError(\n 'Legacy mandatory/optional constraints not supported.');\n }\n if (offerOptions.offerToReceiveAudio !== undefined) {\n if (offerOptions.offerToReceiveAudio === true) {\n numAudioTracks = 1;\n } else if (offerOptions.offerToReceiveAudio === false) {\n numAudioTracks = 0;\n } else {\n numAudioTracks = offerOptions.offerToReceiveAudio;\n }\n }\n if (offerOptions.offerToReceiveVideo !== undefined) {\n if (offerOptions.offerToReceiveVideo === true) {\n numVideoTracks = 1;\n } else if (offerOptions.offerToReceiveVideo === false) {\n numVideoTracks = 0;\n } else {\n numVideoTracks = offerOptions.offerToReceiveVideo;\n }\n }\n }\n\n this.transceivers.forEach(function(transceiver) {\n if (transceiver.kind === 'audio') {\n numAudioTracks--;\n if (numAudioTracks < 0) {\n transceiver.wantReceive = false;\n }\n } else if (transceiver.kind === 'video') {\n numVideoTracks--;\n if (numVideoTracks < 0) {\n transceiver.wantReceive = false;\n }\n }\n });\n\n // Create M-lines for recvonly streams.\n while (numAudioTracks > 0 || numVideoTracks > 0) {\n if (numAudioTracks > 0) {\n this._createTransceiver('audio');\n numAudioTracks--;\n }\n if (numVideoTracks > 0) {\n this._createTransceiver('video');\n numVideoTracks--;\n }\n }\n // reorder tracks\n var transceivers = sortTracks(this.transceivers);\n\n var sdp = SDPUtils.writeSessionBoilerplate();\n transceivers.forEach(function(transceiver, sdpMLineIndex) {\n // For each track, create an ice gatherer, ice transport,\n // dtls transport, potentially rtpsender and rtpreceiver.\n var track = transceiver.track;\n var kind = transceiver.kind;\n var mid = SDPUtils.generateIdentifier();\n transceiver.mid = mid;\n\n if (!transceiver.iceGatherer) {\n transceiver.iceGatherer = self.usingBundle && sdpMLineIndex > 0 ?\n transceivers[0].iceGatherer :\n self._createIceGatherer(mid, sdpMLineIndex);\n }\n\n var localCapabilities = RTCRtpSender.getCapabilities(kind);\n // filter RTX until additional stuff needed for RTX is implemented\n // in adapter.js\n if (edgeVersion < 15019) {\n localCapabilities.codecs = localCapabilities.codecs.filter(\n function(codec) {\n return codec.name !== 'rtx';\n });\n }\n localCapabilities.codecs.forEach(function(codec) {\n // work around https://bugs.chromium.org/p/webrtc/issues/detail?id=6552\n // by adding level-asymmetry-allowed=1\n if (codec.name === 'H264' &&\n codec.parameters['level-asymmetry-allowed'] === undefined) {\n codec.parameters['level-asymmetry-allowed'] = '1';\n }\n });\n\n // generate an ssrc now, to be used later in rtpSender.send\n var sendEncodingParameters = [{\n ssrc: (2 * sdpMLineIndex + 1) * 1001\n }];\n if (track) {\n // add RTX\n if (edgeVersion >= 15019 && kind === 'video') {\n sendEncodingParameters[0].rtx = {\n ssrc: (2 * sdpMLineIndex + 1) * 1001 + 1\n };\n }\n }\n\n if (transceiver.wantReceive) {\n transceiver.rtpReceiver = new RTCRtpReceiver(transceiver.dtlsTransport,\n kind);\n }\n\n transceiver.localCapabilities = localCapabilities;\n transceiver.sendEncodingParameters = sendEncodingParameters;\n });\n\n // always offer BUNDLE and dispose on return if not supported.\n if (this._config.bundlePolicy !== 'max-compat') {\n sdp += 'a=group:BUNDLE ' + transceivers.map(function(t) {\n return t.mid;\n }).join(' ') + '\\r\\n';\n }\n sdp += 'a=ice-options:trickle\\r\\n';\n\n transceivers.forEach(function(transceiver, sdpMLineIndex) {\n sdp += SDPUtils.writeMediaSection(transceiver,\n transceiver.localCapabilities, 'offer', transceiver.stream);\n sdp += 'a=rtcp-rsize\\r\\n';\n });\n\n this._pendingOffer = transceivers;\n var desc = new RTCSessionDescription({\n type: 'offer',\n sdp: sdp\n });\n if (arguments.length && typeof arguments[0] === 'function') {\n window.setTimeout(arguments[0], 0, desc);\n }\n return Promise.resolve(desc);\n };\n\n RTCPeerConnection.prototype.createAnswer = function() {\n var sdp = SDPUtils.writeSessionBoilerplate();\n if (this.usingBundle) {\n sdp += 'a=group:BUNDLE ' + this.transceivers.map(function(t) {\n return t.mid;\n }).join(' ') + '\\r\\n';\n }\n this.transceivers.forEach(function(transceiver, sdpMLineIndex) {\n if (transceiver.isDatachannel) {\n sdp += 'm=application 0 DTLS/SCTP 5000\\r\\n' +\n 'c=IN IP4 0.0.0.0\\r\\n' +\n 'a=mid:' + transceiver.mid + '\\r\\n';\n return;\n }\n\n // FIXME: look at direction.\n if (transceiver.stream) {\n var localTrack;\n if (transceiver.kind === 'audio') {\n localTrack = transceiver.stream.getAudioTracks()[0];\n } else if (transceiver.kind === 'video') {\n localTrack = transceiver.stream.getVideoTracks()[0];\n }\n if (localTrack) {\n // add RTX\n if (edgeVersion >= 15019 && transceiver.kind === 'video') {\n transceiver.sendEncodingParameters[0].rtx = {\n ssrc: (2 * sdpMLineIndex + 2) * 1001 + 1\n };\n }\n }\n }\n\n // Calculate intersection of capabilities.\n var commonCapabilities = getCommonCapabilities(\n transceiver.localCapabilities,\n transceiver.remoteCapabilities);\n\n var hasRtx = commonCapabilities.codecs.filter(function(c) {\n return c.name.toLowerCase() === 'rtx';\n }).length;\n if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {\n delete transceiver.sendEncodingParameters[0].rtx;\n }\n\n sdp += SDPUtils.writeMediaSection(transceiver, commonCapabilities,\n 'answer', transceiver.stream);\n if (transceiver.rtcpParameters &&\n transceiver.rtcpParameters.reducedSize) {\n sdp += 'a=rtcp-rsize\\r\\n';\n }\n });\n\n var desc = new RTCSessionDescription({\n type: 'answer',\n sdp: sdp\n });\n if (arguments.length && typeof arguments[0] === 'function') {\n window.setTimeout(arguments[0], 0, desc);\n }\n return Promise.resolve(desc);\n };\n\n RTCPeerConnection.prototype.addIceCandidate = function(candidate) {\n if (!candidate) {\n for (var j = 0; j < this.transceivers.length; j++) {\n this.transceivers[j].iceTransport.addRemoteCandidate({});\n if (this.usingBundle) {\n return Promise.resolve();\n }\n }\n } else {\n var mLineIndex = candidate.sdpMLineIndex;\n if (candidate.sdpMid) {\n for (var i = 0; i < this.transceivers.length; i++) {\n if (this.transceivers[i].mid === candidate.sdpMid) {\n mLineIndex = i;\n break;\n }\n }\n }\n var transceiver = this.transceivers[mLineIndex];\n if (transceiver) {\n var cand = Object.keys(candidate.candidate).length > 0 ?\n SDPUtils.parseCandidate(candidate.candidate) : {};\n // Ignore Chrome's invalid candidates since Edge does not like them.\n if (cand.protocol === 'tcp' && (cand.port === 0 || cand.port === 9)) {\n return Promise.resolve();\n }\n // Ignore RTCP candidates, we assume RTCP-MUX.\n if (cand.component &&\n !(cand.component === '1' || cand.component === 1)) {\n return Promise.resolve();\n }\n transceiver.iceTransport.addRemoteCandidate(cand);\n\n // update the remoteDescription.\n var sections = SDPUtils.splitSections(this.remoteDescription.sdp);\n sections[mLineIndex + 1] += (cand.type ? candidate.candidate.trim()\n : 'a=end-of-candidates') + '\\r\\n';\n this.remoteDescription.sdp = sections.join('');\n }\n }\n if (arguments.length > 1 && typeof arguments[1] === 'function') {\n window.setTimeout(arguments[1], 0);\n }\n return Promise.resolve();\n };\n\n RTCPeerConnection.prototype.getStats = function() {\n var promises = [];\n this.transceivers.forEach(function(transceiver) {\n ['rtpSender', 'rtpReceiver', 'iceGatherer', 'iceTransport',\n 'dtlsTransport'].forEach(function(method) {\n if (transceiver[method]) {\n promises.push(transceiver[method].getStats());\n }\n });\n });\n var cb = arguments.length > 1 && typeof arguments[1] === 'function' &&\n arguments[1];\n var fixStatsType = function(stat) {\n return {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n }[stat.type] || stat.type;\n };\n return new Promise(function(resolve) {\n // shim getStats with maplike support\n var results = new Map();\n Promise.all(promises).then(function(res) {\n res.forEach(function(result) {\n Object.keys(result).forEach(function(id) {\n result[id].type = fixStatsType(result[id]);\n results.set(id, result[id]);\n });\n });\n if (cb) {\n window.setTimeout(cb, 0, results);\n }\n resolve(results);\n });\n });\n };\n return RTCPeerConnection;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/edge/rtcpeerconnection_shim.js\n// module id = 10\n// module chunks = 0","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\n\nvar browserDetails = require('../utils').browserDetails;\n\nvar firefoxShim = {\n shimOnTrack: function() {\n if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in\n window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {\n get: function() {\n return this._ontrack;\n },\n set: function(f) {\n if (this._ontrack) {\n this.removeEventListener('track', this._ontrack);\n this.removeEventListener('addstream', this._ontrackpoly);\n }\n this.addEventListener('track', this._ontrack = f);\n this.addEventListener('addstream', this._ontrackpoly = function(e) {\n e.stream.getTracks().forEach(function(track) {\n var event = new Event('track');\n event.track = track;\n event.receiver = {track: track};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n }.bind(this));\n }.bind(this));\n }\n });\n }\n },\n\n shimSourceObject: function() {\n // Firefox has supported mozSrcObject since FF22, unprefixed in 42.\n if (typeof window === 'object') {\n if (window.HTMLMediaElement &&\n !('srcObject' in window.HTMLMediaElement.prototype)) {\n // Shim the srcObject property, once, when HTMLMediaElement is found.\n Object.defineProperty(window.HTMLMediaElement.prototype, 'srcObject', {\n get: function() {\n return this.mozSrcObject;\n },\n set: function(stream) {\n this.mozSrcObject = stream;\n }\n });\n }\n }\n },\n\n shimPeerConnection: function() {\n if (typeof window !== 'object' || !(window.RTCPeerConnection ||\n window.mozRTCPeerConnection)) {\n return; // probably media.peerconnection.enabled=false in about:config\n }\n // The RTCPeerConnection object.\n if (!window.RTCPeerConnection) {\n window.RTCPeerConnection = function(pcConfig, pcConstraints) {\n if (browserDetails.version < 38) {\n // .urls is not supported in FF < 38.\n // create RTCIceServers with a single url.\n if (pcConfig && pcConfig.iceServers) {\n var newIceServers = [];\n for (var i = 0; i < pcConfig.iceServers.length; i++) {\n var server = pcConfig.iceServers[i];\n if (server.hasOwnProperty('urls')) {\n for (var j = 0; j < server.urls.length; j++) {\n var newServer = {\n url: server.urls[j]\n };\n if (server.urls[j].indexOf('turn') === 0) {\n newServer.username = server.username;\n newServer.credential = server.credential;\n }\n newIceServers.push(newServer);\n }\n } else {\n newIceServers.push(pcConfig.iceServers[i]);\n }\n }\n pcConfig.iceServers = newIceServers;\n }\n }\n return new mozRTCPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = mozRTCPeerConnection.prototype;\n\n // wrap static methods. Currently just generateCertificate.\n if (mozRTCPeerConnection.generateCertificate) {\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get: function() {\n return mozRTCPeerConnection.generateCertificate;\n }\n });\n }\n\n window.RTCSessionDescription = mozRTCSessionDescription;\n window.RTCIceCandidate = mozRTCIceCandidate;\n }\n\n // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n var nativeMethod = RTCPeerConnection.prototype[method];\n RTCPeerConnection.prototype[method] = function() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n RTCIceCandidate : RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n };\n });\n\n // support for addIceCandidate(null or undefined)\n var nativeAddIceCandidate =\n RTCPeerConnection.prototype.addIceCandidate;\n RTCPeerConnection.prototype.addIceCandidate = function() {\n if (!arguments[0]) {\n if (arguments[1]) {\n arguments[1].apply(null);\n }\n return Promise.resolve();\n }\n return nativeAddIceCandidate.apply(this, arguments);\n };\n\n // shim getStats with maplike support\n var makeMapStats = function(stats) {\n var map = new Map();\n Object.keys(stats).forEach(function(key) {\n map.set(key, stats[key]);\n map[key] = stats[key];\n });\n return map;\n };\n\n var modernStatsTypes = {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n };\n\n var nativeGetStats = RTCPeerConnection.prototype.getStats;\n RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {\n return nativeGetStats.apply(this, [selector || null])\n .then(function(stats) {\n if (browserDetails.version < 48) {\n stats = makeMapStats(stats);\n }\n if (browserDetails.version < 53 && !onSucc) {\n // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach(function(stat) {\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n }\n // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n stats.forEach(function(stat, i) {\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n }\n return stats;\n })\n .then(onSucc, onErr);\n };\n }\n};\n\n// Expose public methods.\nmodule.exports = {\n shimOnTrack: firefoxShim.shimOnTrack,\n shimSourceObject: firefoxShim.shimSourceObject,\n shimPeerConnection: firefoxShim.shimPeerConnection,\n shimGetUserMedia: require('./getusermedia')\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/firefox/firefox_shim.js\n// module id = 11\n// module chunks = 0","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n /* eslint-env node */\n'use strict';\n\nvar logging = require('../utils').log;\nvar browserDetails = require('../utils').browserDetails;\n\n// Expose public methods.\nmodule.exports = function() {\n var shimError_ = function(e) {\n return {\n name: {\n InternalError: 'NotReadableError',\n NotSupportedError: 'TypeError',\n PermissionDeniedError: 'NotAllowedError',\n SecurityError: 'NotAllowedError'\n }[e.name] || e.name,\n message: {\n 'The operation is insecure.': 'The request is not allowed by the ' +\n 'user agent or the platform in the current context.'\n }[e.message] || e.message,\n constraint: e.constraint,\n toString: function() {\n return this.name + (this.message && ': ') + this.message;\n }\n };\n };\n\n // getUserMedia constraints shim.\n var getUserMedia_ = function(constraints, onSuccess, onError) {\n var constraintsToFF37_ = function(c) {\n if (typeof c !== 'object' || c.require) {\n return c;\n }\n var require = [];\n Object.keys(c).forEach(function(key) {\n if (key === 'require' || key === 'advanced' || key === 'mediaSource') {\n return;\n }\n var r = c[key] = (typeof c[key] === 'object') ?\n c[key] : {ideal: c[key]};\n if (r.min !== undefined ||\n r.max !== undefined || r.exact !== undefined) {\n require.push(key);\n }\n if (r.exact !== undefined) {\n if (typeof r.exact === 'number') {\n r. min = r.max = r.exact;\n } else {\n c[key] = r.exact;\n }\n delete r.exact;\n }\n if (r.ideal !== undefined) {\n c.advanced = c.advanced || [];\n var oc = {};\n if (typeof r.ideal === 'number') {\n oc[key] = {min: r.ideal, max: r.ideal};\n } else {\n oc[key] = r.ideal;\n }\n c.advanced.push(oc);\n delete r.ideal;\n if (!Object.keys(r).length) {\n delete c[key];\n }\n }\n });\n if (require.length) {\n c.require = require;\n }\n return c;\n };\n constraints = JSON.parse(JSON.stringify(constraints));\n if (browserDetails.version < 38) {\n logging('spec: ' + JSON.stringify(constraints));\n if (constraints.audio) {\n constraints.audio = constraintsToFF37_(constraints.audio);\n }\n if (constraints.video) {\n constraints.video = constraintsToFF37_(constraints.video);\n }\n logging('ff37: ' + JSON.stringify(constraints));\n }\n return navigator.mozGetUserMedia(constraints, onSuccess, function(e) {\n onError(shimError_(e));\n });\n };\n\n // Returns the result of getUserMedia as a Promise.\n var getUserMediaPromise_ = function(constraints) {\n return new Promise(function(resolve, reject) {\n getUserMedia_(constraints, resolve, reject);\n });\n };\n\n // Shim for mediaDevices on older versions.\n if (!navigator.mediaDevices) {\n navigator.mediaDevices = {getUserMedia: getUserMediaPromise_,\n addEventListener: function() { },\n removeEventListener: function() { }\n };\n }\n navigator.mediaDevices.enumerateDevices =\n navigator.mediaDevices.enumerateDevices || function() {\n return new Promise(function(resolve) {\n var infos = [\n {kind: 'audioinput', deviceId: 'default', label: '', groupId: ''},\n {kind: 'videoinput', deviceId: 'default', label: '', groupId: ''}\n ];\n resolve(infos);\n });\n };\n\n if (browserDetails.version < 41) {\n // Work around http://bugzil.la/1169665\n var orgEnumerateDevices =\n navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);\n navigator.mediaDevices.enumerateDevices = function() {\n return orgEnumerateDevices().then(undefined, function(e) {\n if (e.name === 'NotFoundError') {\n return [];\n }\n throw e;\n });\n };\n }\n if (browserDetails.version < 49) {\n var origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n return origGetUserMedia(c).then(function(stream) {\n // Work around https://bugzil.la/802326\n if (c.audio && !stream.getAudioTracks().length ||\n c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach(function(track) {\n track.stop();\n });\n throw new DOMException('The object can not be found here.',\n 'NotFoundError');\n }\n return stream;\n }, function(e) {\n return Promise.reject(shimError_(e));\n });\n };\n }\n navigator.getUserMedia = function(constraints, onSuccess, onError) {\n if (browserDetails.version < 44) {\n return getUserMedia_(constraints, onSuccess, onError);\n }\n // Replace Firefox 44+'s deprecation warning with unprefixed version.\n console.warn('navigator.getUserMedia has been replaced by ' +\n 'navigator.mediaDevices.getUserMedia');\n navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/firefox/getusermedia.js\n// module id = 12\n// module chunks = 0","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n'use strict';\nvar safariShim = {\n // TODO: DrAlex, should be here, double check against LayoutTests\n\n // TODO: once the back-end for the mac port is done, add.\n // TODO: check for webkitGTK+\n // shimPeerConnection: function() { },\n\n shimAddStream: function() {\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('addStream' in window.RTCPeerConnection.prototype)) {\n RTCPeerConnection.prototype.addStream = function(stream) {\n var self = this;\n stream.getTracks().forEach(function(track) {\n self.addTrack(track, stream);\n });\n };\n }\n },\n shimOnAddStream: function() {\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('onaddstream' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {\n get: function() {\n return this._onaddstream;\n },\n set: function(f) {\n if (this._onaddstream) {\n this.removeEventListener('addstream', this._onaddstream);\n this.removeEventListener('track', this._onaddstreampoly);\n }\n this.addEventListener('addstream', this._onaddstream = f);\n this.addEventListener('track', this._onaddstreampoly = function(e) {\n var stream = e.streams[0];\n if (!this._streams) {\n this._streams = [];\n }\n if (this._streams.indexOf(stream) >= 0) {\n return;\n }\n this._streams.push(stream);\n var event = new Event('addstream');\n event.stream = e.streams[0];\n this.dispatchEvent(event);\n }.bind(this));\n }\n });\n }\n },\n shimCallbacksAPI: function() {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n var prototype = RTCPeerConnection.prototype;\n var createOffer = prototype.createOffer;\n var createAnswer = prototype.createAnswer;\n var setLocalDescription = prototype.setLocalDescription;\n var setRemoteDescription = prototype.setRemoteDescription;\n var addIceCandidate = prototype.addIceCandidate;\n\n prototype.createOffer = function(successCallback, failureCallback) {\n var options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n var promise = createOffer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n prototype.createAnswer = function(successCallback, failureCallback) {\n var options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n var promise = createAnswer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n var withCallback = function(description, successCallback, failureCallback) {\n var promise = setLocalDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setLocalDescription = withCallback;\n\n withCallback = function(description, successCallback, failureCallback) {\n var promise = setRemoteDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setRemoteDescription = withCallback;\n\n withCallback = function(candidate, successCallback, failureCallback) {\n var promise = addIceCandidate.apply(this, [candidate]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.addIceCandidate = withCallback;\n },\n shimGetUserMedia: function() {\n if (!navigator.getUserMedia) {\n if (navigator.webkitGetUserMedia) {\n navigator.getUserMedia = navigator.webkitGetUserMedia.bind(navigator);\n } else if (navigator.mediaDevices &&\n navigator.mediaDevices.getUserMedia) {\n navigator.getUserMedia = function(constraints, cb, errcb) {\n navigator.mediaDevices.getUserMedia(constraints)\n .then(cb, errcb);\n }.bind(navigator);\n }\n }\n }\n};\n\n// Expose public methods.\nmodule.exports = {\n shimCallbacksAPI: safariShim.shimCallbacksAPI,\n shimAddStream: safariShim.shimAddStream,\n shimOnAddStream: safariShim.shimOnAddStream,\n shimGetUserMedia: safariShim.shimGetUserMedia\n // TODO\n // shimPeerConnection: safariShim.shimPeerConnection\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/webrtc-adapter/src/js/safari/safari_shim.js\n// module id = 13\n// module chunks = 0","function QRScanner() {\n var createQRScannerAdapter = require('../../common/src/createQRScannerAdapter.js');\n var createQRScannerInternal = require('./createQRScannerInternal.js');\n\n var internal = createQRScannerInternal();\n var functionList = {\n prepare: internal.prepare,\n show: internal.show,\n hide: internal.hide,\n scan: internal.scan,\n cancelScan: internal.cancelScan,\n pausePreview: internal.pausePreview,\n resumePreview: internal.resumePreview,\n enableLight: internal.enableLight,\n disableLight: internal.disableLight,\n useCamera: internal.useCamera,\n openSettings: internal.openSettings,\n getStatus: internal.getStatus,\n destroy: internal.destroy\n };\n\n // always returns an executable function for use by the internal component\n // if a callback is provided, use it\n function getFunc(callback){\n if(typeof callback === \"function\"){\n return callback;\n }\n return function(){\n // callback is not needed\n return;\n };\n }\n\n // shim cordova's functionality for library usage\n var shimCordova = {\n exec: function(successCallback, errorCallback, className, functionName, inputArray){\n if(className !== 'QRScanner' || !functionList[functionName]){\n return errorCallback(0);\n }\n if(inputArray){\n functionList[functionName](getFunc(successCallback), getFunc(errorCallback), inputArray);\n } else {\n functionList[functionName](getFunc(successCallback), getFunc(errorCallback));\n }\n }\n };\n\n var adapter = createQRScannerAdapter(shimCordova);\n return adapter;\n}\n\nmodule.exports = new QRScanner();\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/browser/src/library.js\n// module id = 14\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index 795e0824..6ed09ccb 100755 --- a/plugin.xml +++ b/plugin.xml @@ -15,7 +15,6 @@ - diff --git a/src/android/QRScanner.java b/src/android/QRScanner.java index f2e37d7d..62d1c2df 100755 --- a/src/android/QRScanner.java +++ b/src/android/QRScanner.java @@ -24,7 +24,7 @@ import org.json.JSONObject; import android.hardware.Camera; import android.provider.Settings; -import android.support.v4.app.ActivityCompat; +import androidx.core.app.ActivityCompat; import android.view.ViewGroup; import android.widget.FrameLayout; diff --git a/src/android/qrscanner.gradle b/src/android/qrscanner.gradle index df682e76..6188e342 100644 --- a/src/android/qrscanner.gradle +++ b/src/android/qrscanner.gradle @@ -3,8 +3,8 @@ repositories { } dependencies { - compile 'com.journeyapps:zxing-android-embedded:3.3.0' - compile 'com.android.support:appcompat-v7:23.1.0' + implementation 'com.journeyapps:zxing-android-embedded:3.3.0' + implementation 'com.android.support:appcompat-v7:23.1.0' } android { diff --git a/www/www.min.js b/www/www.min.js new file mode 100644 index 00000000..2469e9e5 --- /dev/null +++ b/www/www.min.js @@ -0,0 +1,344 @@ +cordova.define("cordova-plugin-qrscanner.QRScanner", function(require, exports, module) { +// This file is generated by `npm run build`. + +/*global exports:false*/ +/*jshint unused:false */ +// remap parameter names from cordova.define +// see `externals` in webpack.cordova.config.js +var cordovaRequire = require; +var cordovaExports = exports; +var cordovaModule = module; +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 18); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 1: +/***/ (function(module, exports) { + +module.exports = cordovaModule; + +/***/ }), + +/***/ 18: +/***/ (function(module, exports, __webpack_require__) { + +var globalCordova = __webpack_require__(4); +var cordovaModule = __webpack_require__(1); + +var createQRScannerAdapter = __webpack_require__(3); + +// pass in global cordova object to expose cordova.exec +var QRScannerAdapter = createQRScannerAdapter(globalCordova); +cordovaModule.exports = QRScannerAdapter; + + +/***/ }), + +/***/ 3: +/***/ (function(module, exports) { + +module.exports = function createQRScanner(cordova){ +// The native implementations should return their status as ['string':'string'] +// dictionaries. Boolean values are encoded to '0' and '1', respectively. +function stringToBool(string) { + switch (string) { + case '1': + return true; + case '0': + return false; + default: + throw new Error('QRScanner plugin returned an invalid boolean number-string: ' + string); + } +} + +// Converts the returned ['string':'string'] dictionary to a status object. +function convertStatus(statusDictionary) { + return { + authorized: stringToBool(statusDictionary.authorized), + denied: stringToBool(statusDictionary.denied), + restricted: stringToBool(statusDictionary.restricted), + prepared: stringToBool(statusDictionary.prepared), + scanning: stringToBool(statusDictionary.scanning), + previewing: stringToBool(statusDictionary.previewing), + showing: stringToBool(statusDictionary.showing), + lightEnabled: stringToBool(statusDictionary.lightEnabled), + canOpenSettings: stringToBool(statusDictionary.canOpenSettings), + canEnableLight: stringToBool(statusDictionary.canEnableLight), + canChangeCamera: stringToBool(statusDictionary.canChangeCamera), + currentCamera: parseInt(statusDictionary.currentCamera) + }; +} + +// Simple utility method to ensure the background is transparent. Used by the +// plugin to force re-rendering immediately after the native webview background +// is made transparent. +function clearBackground() { + var body = document.body; + if (body.style) { + body.style.backgroundColor = 'rgba(0,0,0,0.01)'; + body.style.backgroundImage = ''; + setTimeout(function() { + body.style.backgroundColor = 'transparent'; + }, 1); + if (body.parentNode && body.parentNode.style) { + body.parentNode.style.backgroundColor = 'transparent'; + body.parentNode.style.backgroundImage = ''; + } + } +} + +function errorCallback(callback) { + if (!callback) { + return null; + } + return function(error) { + var errorCode = parseInt(error); + var QRScannerError = {}; + switch (errorCode) { + case 0: + QRScannerError = { + name: 'UNEXPECTED_ERROR', + code: 0, + _message: 'QRScanner experienced an unexpected error.' + }; + break; + case 1: + QRScannerError = { + name: 'CAMERA_ACCESS_DENIED', + code: 1, + _message: 'The user denied camera access.' + }; + break; + case 2: + QRScannerError = { + name: 'CAMERA_ACCESS_RESTRICTED', + code: 2, + _message: 'Camera access is restricted.' + }; + break; + case 3: + QRScannerError = { + name: 'BACK_CAMERA_UNAVAILABLE', + code: 3, + _message: 'The back camera is unavailable.' + }; + break; + case 4: + QRScannerError = { + name: 'FRONT_CAMERA_UNAVAILABLE', + code: 4, + _message: 'The front camera is unavailable.' + }; + break; + case 5: + QRScannerError = { + name: 'CAMERA_UNAVAILABLE', + code: 5, + _message: 'The camera is unavailable.' + }; + break; + case 6: + QRScannerError = { + name: 'SCAN_CANCELED', + code: 6, + _message: 'Scan was canceled.' + }; + break; + case 7: + QRScannerError = { + name: 'LIGHT_UNAVAILABLE', + code: 7, + _message: 'The device light is unavailable.' + }; + break; + case 8: + // Open settings is only available on iOS 8.0+. + QRScannerError = { + name: 'OPEN_SETTINGS_UNAVAILABLE', + code: 8, + _message: 'The device is unable to open settings.' + }; + break; + default: + QRScannerError = { + name: 'UNEXPECTED_ERROR', + code: 0, + _message: 'QRScanner returned an invalid error code.' + }; + break; + } + callback(QRScannerError); + }; +} + +function successCallback(callback) { + if (!callback) { + return null; + } + return function(statusDict) { + callback(null, convertStatus(statusDict)); + }; +} + +function doneCallback(callback, clear) { + if (!callback) { + return null; + } + return function(statusDict) { + if (clear) { + clearBackground(); + } + callback(convertStatus(statusDict)); + }; +} + +return { + prepare: function(callback) { + cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'prepare', []); + }, + destroy: function(callback) { + cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'destroy', []); + }, + scan: function(callback) { + if (!callback) { + throw new Error('No callback provided to scan method.'); + } + var success = function(result) { + callback(null, result); + }; + cordova.exec(success, errorCallback(callback), 'QRScanner', 'scan', []); + }, + cancelScan: function(callback) { + cordova.exec(doneCallback(callback), null, 'QRScanner', 'cancelScan', []); + }, + show: function(callback) { + cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'show', []); + }, + hide: function(callback) { + cordova.exec(doneCallback(callback, true), null, 'QRScanner', 'hide', []); + }, + pausePreview: function(callback) { + cordova.exec(doneCallback(callback), null, 'QRScanner', 'pausePreview', []); + }, + resumePreview: function(callback) { + cordova.exec(doneCallback(callback), null, 'QRScanner', 'resumePreview', []); + }, + enableLight: function(callback) { + cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'enableLight', []); + }, + disableLight: function(callback) { + cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'disableLight', []); + }, + useCamera: function(index, callback) { + cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'useCamera', [index]); + }, + useFrontCamera: function(callback) { + var frontCamera = 1; + if (callback) { + this.useCamera(frontCamera, callback); + } else { + cordova.exec(null, null, 'QRScanner', 'useCamera', [frontCamera]); + } + }, + useBackCamera: function(callback) { + var backCamera = 0; + if (callback) { + this.useCamera(backCamera, callback); + } else { + cordova.exec(null, null, 'QRScanner', 'useCamera', [backCamera]); + } + }, + openSettings: function(callback) { + if (callback) { + cordova.exec(successCallback(callback), errorCallback(callback), 'QRScanner', 'openSettings', []); + } else { + cordova.exec(null, null, 'QRScanner', 'openSettings', []); + } + }, + getStatus: function(callback) { + if (!callback) { + throw new Error('No callback provided to getStatus method.'); + } + cordova.exec(doneCallback(callback), null, 'QRScanner', 'getStatus', []); + } +}; +}; + + +/***/ }), + +/***/ 4: +/***/ (function(module, exports) { + +module.exports = cordova; + +/***/ }) + +/******/ }); +});