virtual-keypad 5.15.1 → 5.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/src/receiver.js +5 -1
package/dist/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.virtualKeypad=t():e.virtualKeypad=t()}(self,(()=>(()=>{var e={660:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(15),o=n.n(r),i=n(645),s=n.n(i)()(o());s.push([e.id,"/* REMOTE KEYPAD STYLING */\n#keypad {\n position: absolute;\n width: 100%;\n height: 100vh;\n height: 100dvh;\n\n display: grid;\n grid-template-columns: 1fr;\n /* Make header text as big as the text, keys take up as much space as needed, and control keys take up bottom space */\n grid-template-rows: max-content auto;\n\n align-items: center;\n justify-content: center;\n\n font-family: sans-serif;\n}\n#keypad-header {\n height: 100%;\n font-size: 1.5rem;\n font-weight: normal;\n text-align: center;\n\n grid-row: 1;\n overflow-y: auto;\n\n border-radius: 0.5em;\n\n box-shadow: inset 2px 2px 4px #888888,\n inset -2px -2px 4px #fff;\n}\n#keypad-footer {\n position: absolute;\n font-size: smaller;\n width: 100%;\n bottom: 0;\n right: 0;\n}\n\n/* Grid of main keys themselves */\n#keypad-keys {\n /* Second row, within the keypad grid (ie whole page) */\n grid-row: 2;\n}\n/* Hide scrollbar */\n/* #keypad-keys::-webkit-scrollbar {\n display: none;\n} */\n\n.response-button {\n /* border: 1px solid red; */\n cursor: pointer;\n\n /* Center text within button */\n display: flex;\n align-items: center;\n justify-content: center;\n\n /* Curve corners of buttons */\n border-radius: min(25px, 15%);\n\n /* Style button text */\n /* font-size: 3rem; */\n font-size: xx-large;\n font-weight: 700;\n\n padding: 0;\n margin: 0;\n\n box-shadow: 1px 1px 2px #888888,\n -1px -1px 2px #fff;\n}\n.response-button:active {\n box-shadow: 1px 2px 2px 1px #999;\n background-color: #aaa;\n}\n\n/* Only do on a hover-enabled device, ie not a phone/tablet */\n@media (hover: hover) {\n .response-button:hover {\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n }\n}\n\n\n.response-button-label {\n text-align: center;\n /* color: #eeeeee; */\n}\n\n.noselect {\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Old versions of Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none; /* Non-prefixed version, currently\n supported by Chrome, Edge, Opera and Firefox */\n touch-action: none;\n}\n\n.unpressable {\n background-color: #aaaaaa;\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n pointer-events: none;\n user-select: none;\n}","",{version:3,sources:["webpack://./src/keypad.css"],names:[],mappings:"AAAA,0BAA0B;AAC1B;EACE,kBAAkB;EAClB,WAAW;EACX,aAAa;EACb,cAAc;;EAEd,aAAa;EACb,0BAA0B;EAC1B,qHAAqH;EACrH,oCAAoC;;EAEpC,mBAAmB;EACnB,uBAAuB;;EAEvB,uBAAuB;AACzB;AACA;EACE,YAAY;EACZ,iBAAiB;EACjB,mBAAmB;EACnB,kBAAkB;;EAElB,WAAW;EACX,gBAAgB;;EAEhB,oBAAoB;;EAEpB;sCACoC;AACtC;AACA;EACE,kBAAkB;EAClB,kBAAkB;EAClB,WAAW;EACX,SAAS;EACT,QAAQ;AACV;;AAEA,iCAAiC;AACjC;EACE,uDAAuD;EACvD,WAAW;AACb;AACA,mBAAmB;AACnB;;GAEG;;AAEH;EACE,2BAA2B;EAC3B,eAAe;;EAEf,8BAA8B;EAC9B,aAAa;EACb,mBAAmB;EACnB,uBAAuB;;EAEvB,6BAA6B;EAC7B,6BAA6B;;EAE7B,sBAAsB;EACtB,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;;EAEhB,UAAU;EACV,SAAS;;EAET;gCAC8B;AAChC;AACA;EACE,gCAAgC;EAChC,sBAAsB;AACxB;;AAEA,6DAA6D;AAC7D;EACE;IACE;wCACoC;EACtC;AACF;;;AAGA;EACE,kBAAkB;EAClB,oBAAoB;AACtB;;AAEA;EACE,2BAA2B,EAAE,eAAe;EAC5C,yBAAyB,EAAE,WAAW;EACtC,wBAAwB,EAAE,mBAAmB;EAC7C,sBAAsB,EAAE,4BAA4B;EACpD,qBAAqB,EAAE,2BAA2B;EAClD,iBAAiB,EAAE;kFAC6D;EAChF,kBAAkB;AACpB;;AAEA;EACE,yBAAyB;EACzB;sCACoC;EACpC,oBAAoB;EACpB,iBAAiB;AACnB",sourcesContent:["/* REMOTE KEYPAD STYLING */\n#keypad {\n position: absolute;\n width: 100%;\n height: 100vh;\n height: 100dvh;\n\n display: grid;\n grid-template-columns: 1fr;\n /* Make header text as big as the text, keys take up as much space as needed, and control keys take up bottom space */\n grid-template-rows: max-content auto;\n\n align-items: center;\n justify-content: center;\n\n font-family: sans-serif;\n}\n#keypad-header {\n height: 100%;\n font-size: 1.5rem;\n font-weight: normal;\n text-align: center;\n\n grid-row: 1;\n overflow-y: auto;\n\n border-radius: 0.5em;\n\n box-shadow: inset 2px 2px 4px #888888,\n inset -2px -2px 4px #fff;\n}\n#keypad-footer {\n position: absolute;\n font-size: smaller;\n width: 100%;\n bottom: 0;\n right: 0;\n}\n\n/* Grid of main keys themselves */\n#keypad-keys {\n /* Second row, within the keypad grid (ie whole page) */\n grid-row: 2;\n}\n/* Hide scrollbar */\n/* #keypad-keys::-webkit-scrollbar {\n display: none;\n} */\n\n.response-button {\n /* border: 1px solid red; */\n cursor: pointer;\n\n /* Center text within button */\n display: flex;\n align-items: center;\n justify-content: center;\n\n /* Curve corners of buttons */\n border-radius: min(25px, 15%);\n\n /* Style button text */\n /* font-size: 3rem; */\n font-size: xx-large;\n font-weight: 700;\n\n padding: 0;\n margin: 0;\n\n box-shadow: 1px 1px 2px #888888,\n -1px -1px 2px #fff;\n}\n.response-button:active {\n box-shadow: 1px 2px 2px 1px #999;\n background-color: #aaa;\n}\n\n/* Only do on a hover-enabled device, ie not a phone/tablet */\n@media (hover: hover) {\n .response-button:hover {\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n }\n}\n\n\n.response-button-label {\n text-align: center;\n /* color: #eeeeee; */\n}\n\n.noselect {\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Old versions of Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none; /* Non-prefixed version, currently\n supported by Chrome, Edge, Opera and Firefox */\n touch-action: none;\n}\n\n.unpressable {\n background-color: #aaaaaa;\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n pointer-events: none;\n user-select: none;\n}"],sourceRoot:""}]);const a=s},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var s=this[i][0];null!=s&&(o[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);r&&o[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},15:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}e.exports=function(e){var n,r,o=(r=4,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}}(n,r)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[1],s=o[3];if(!s)return i;if("function"==typeof btoa){var a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),l="/*# ".concat(c," */"),d=s.sources.map((function(e){return"/*# sourceURL=".concat(s.sourceRoot||"").concat(e," */")}));return[i].concat(d).concat([l]).join("\n")}return[i].join("\n")}},987:e=>{"use strict";var t={single_source_shortest_paths:function(e,n,r){var o={},i={};i[n]=0;var s,a,c,l,d,h,u,p=t.PriorityQueue.make();for(p.push(n,0);!p.empty();)for(c in a=(s=p.pop()).value,l=s.cost,d=e[a]||{})d.hasOwnProperty(c)&&(h=l+d[c],u=i[c],(void 0===i[c]||u>h)&&(i[c]=h,p.push(c,h),o[c]=a));if(void 0!==r&&void 0===i[r]){var f=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(f)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,n,r){var o=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,o={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(o[n]=r[n]);return o.queue=[],o.sorter=e.sorter||r.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},378:e=>{"use strict";e.exports=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var o=e.charCodeAt(r);if(o>=55296&&o<=56319&&n>r+1){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(o=1024*(o-55296)+i-56320+65536,r+=1)}o<128?t.push(o):o<2048?(t.push(o>>6|192),t.push(63&o|128)):o<55296||o>=57344&&o<65536?(t.push(o>>12|224),t.push(o>>6&63|128),t.push(63&o|128)):o>=65536&&o<=1114111?(t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(63&o|128)):t.push(239,191,189)}return new Uint8Array(t).buffer}},592:(e,t,n)=>{const r=n(138),o=n(115),i=n(907),s=n(776);function a(e,t,n,i,s){const a=[].slice.call(arguments,1),c=a.length,l="function"==typeof a[c-1];if(!l&&!r())throw new Error("Callback required as last argument");if(!l){if(c<1)throw new Error("Too few arguments provided");return 1===c?(n=t,t=i=void 0):2!==c||t.getContext||(i=n,n=t,t=void 0),new Promise((function(r,s){try{const s=o.create(n,i);r(e(s,t,i))}catch(e){s(e)}}))}if(c<2)throw new Error("Too few arguments provided");2===c?(s=n,n=t,t=i=void 0):3===c&&(t.getContext&&void 0===s?(s=i,i=void 0):(s=i,i=n,n=t,t=void 0));try{const r=o.create(n,i);s(null,e(r,t,i))}catch(e){s(e)}}t.create=o.create,t.toCanvas=a.bind(null,i.render),t.toDataURL=a.bind(null,i.renderToDataURL),t.toString=a.bind(null,(function(e,t,n){return s.render(e,n)}))},138:e=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},845:(e,t,n)=>{const r=n(242).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,n=r(e),o=145===n?26:2*Math.ceil((n-13)/(2*t-2)),i=[n-7];for(let e=1;e<t-1;e++)i[e]=i[e-1]-o;return i.push(6),i.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),o=r.length;for(let e=0;e<o;e++)for(let t=0;t<o;t++)0===e&&0===t||0===e&&t===o-1||e===o-1&&0===t||n.push([r[e],r[t]]);return n}},260:(e,t,n)=>{const r=n(910),o=["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"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=r.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*o.indexOf(this.data[t]);n+=o.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(o.indexOf(this.data[t]),6)},e.exports=i},245:e=>{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},280:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,n,r){const o=e*this.size+t;this.data[o]=n,r&&(this.reservedBit[o]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},424:(e,t,n)=>{const r=n(378),o=n(910);function i(e){this.mode=o.BYTE,"string"==typeof e&&(e=r(e)),this.data=new Uint8Array(e)}i.getBitsLength=function(e){return 8*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},e.exports=i},393:(e,t,n)=>{const r=n(908),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case r.L:return o[4*(e-1)+0];case r.M:return o[4*(e-1)+1];case r.Q:return o[4*(e-1)+2];case r.H:return o[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case r.L:return i[4*(e-1)+0];case r.M:return i[4*(e-1)+1];case r.Q:return i[4*(e-1)+2];case r.H:return i[4*(e-1)+3];default:return}}},908:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return n}}},526:(e,t,n)=>{const r=n(242).getSymbolSize;t.getPositions=function(e){const t=r(e);return[[0,0],[t-7,0],[0,t-7]]}},642:(e,t,n)=>{const r=n(242),o=r.getBCHDigit(1335);t.getEncodedBits=function(e,t){const n=e.bit<<3|t;let i=n<<10;for(;r.getBCHDigit(i)-o>=0;)i^=1335<<r.getBCHDigit(i)-o;return 21522^(n<<10|i)}},729:(e,t)=>{const n=new Uint8Array(512),r=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)n[t]=e,r[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)n[e]=n[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return r[e]},t.exp=function(e){return n[e]},t.mul=function(e,t){return 0===e||0===t?0:n[r[e]+r[t]]}},442:(e,t,n)=>{const r=n(910),o=n(242);function i(e){this.mode=r.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=o.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},e.exports=i},126:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function n(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let n=0,r=0,o=0,i=null,s=null;for(let a=0;a<t;a++){r=o=0,i=s=null;for(let c=0;c<t;c++){let t=e.get(a,c);t===i?r++:(r>=5&&(n+=r-5+3),i=t,r=1),t=e.get(c,a),t===s?o++:(o>=5&&(n+=o-5+3),s=t,o=1)}r>=5&&(n+=r-5+3),o>=5&&(n+=o-5+3)}return n},t.getPenaltyN2=function(e){const t=e.size;let n=0;for(let r=0;r<t-1;r++)for(let o=0;o<t-1;o++){const t=e.get(r,o)+e.get(r,o+1)+e.get(r+1,o)+e.get(r+1,o+1);4!==t&&0!==t||n++}return 3*n},t.getPenaltyN3=function(e){const t=e.size;let n=0,r=0,o=0;for(let i=0;i<t;i++){r=o=0;for(let s=0;s<t;s++)r=r<<1&2047|e.get(i,s),s>=10&&(1488===r||93===r)&&n++,o=o<<1&2047|e.get(s,i),s>=10&&(1488===o||93===o)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r<n;r++)t+=e.data[r];return 10*Math.abs(Math.ceil(100*t/n/5)-10)},t.applyMask=function(e,t){const r=t.size;for(let o=0;o<r;o++)for(let i=0;i<r;i++)t.isReserved(i,o)||t.xor(i,o,n(e,i,o))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let o=0,i=1/0;for(let s=0;s<r;s++){n(s),t.applyMask(s,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),r<i&&(i=r,o=s)}return o}},910:(e,t,n)=>{const r=n(114),o=n(7);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!r.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return o.testNumeric(e)?t.NUMERIC:o.testAlphanumeric(e)?t.ALPHANUMERIC:o.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return n}}},85:(e,t,n)=>{const r=n(910);function o(e){this.mode=r.NUMERIC,this.data=e.toString()}o.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const o=this.data.length-t;o>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*o+1))},e.exports=o},136:(e,t,n)=>{const r=n(729);t.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<t.length;i++)n[o+i]^=r.mul(e[o],t[i]);return n},t.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){const e=n[0];for(let o=0;o<t.length;o++)n[o]^=r.mul(t[o],e);let o=0;for(;o<n.length&&0===n[o];)o++;n=n.slice(o)}return n},t.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=t.mul(n,new Uint8Array([1,r.exp(o)]));return n}},115:(e,t,n)=>{const r=n(242),o=n(908),i=n(245),s=n(280),a=n(845),c=n(526),l=n(126),d=n(393),h=n(882),u=n(103),p=n(642),f=n(910),m=n(130);function g(e,t,n){const r=e.size,o=p.getEncodedBits(t,n);let i,s;for(i=0;i<15;i++)s=1==(o>>i&1),i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(r-15+i,8,s,!0),i<8?e.set(8,r-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(r-8,8,1,!0)}function y(e,t,n,o){let p;if(Array.isArray(e))p=m.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=m.rawSplit(e);r=u.getBestVersionForData(t,n)}p=m.fromString(e,r||40)}}const y=u.getBestVersionForData(p,n);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<y)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+y+".\n")}else t=y;const A=function(e,t,n){const o=new i;n.forEach((function(t){o.put(t.mode.bit,4),o.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(o)}));const s=8*(r.getSymbolTotalCodewords(e)-d.getTotalCodewordsCount(e,t));for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(0);const a=(s-o.getLengthInBits())/8;for(let e=0;e<a;e++)o.put(e%2?17:236,8);return function(e,t,n){const o=r.getSymbolTotalCodewords(t),i=o-d.getTotalCodewordsCount(t,n),s=d.getBlocksCount(t,n),a=s-o%s,c=Math.floor(o/s),l=Math.floor(i/s),u=l+1,p=c-l,f=new h(p);let m=0;const g=new Array(s),y=new Array(s);let A=0;const b=new Uint8Array(e.buffer);for(let e=0;e<s;e++){const t=e<a?l:u;g[e]=b.slice(m,m+t),y[e]=f.encode(g[e]),m+=t,A=Math.max(A,t)}const C=new Uint8Array(o);let v,w,V=0;for(v=0;v<A;v++)for(w=0;w<s;w++)v<g[w].length&&(C[V++]=g[w][v]);for(v=0;v<p;v++)for(w=0;w<s;w++)C[V++]=y[w][v];return C}(o,e,t)}(t,n,p),b=r.getSymbolSize(t),C=new s(b);return function(e,t){const n=e.size,r=c.getPositions(t);for(let t=0;t<r.length;t++){const o=r[t][0],i=r[t][1];for(let t=-1;t<=7;t++)if(!(o+t<=-1||n<=o+t))for(let r=-1;r<=7;r++)i+r<=-1||n<=i+r||(t>=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(o+t,i+r,!0,!0):e.set(o+t,i+r,!1,!0))}}(C,t),function(e){const t=e.size;for(let n=8;n<t-8;n++){const t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}(C),function(e,t){const n=a.getPositions(t);for(let t=0;t<n.length;t++){const r=n[t][0],o=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)-2===t||2===t||-2===n||2===n||0===t&&0===n?e.set(r+t,o+n,!0,!0):e.set(r+t,o+n,!1,!0)}}(C,t),g(C,n,0),t>=7&&function(e,t){const n=e.size,r=u.getEncodedBits(t);let o,i,s;for(let t=0;t<18;t++)o=Math.floor(t/3),i=t%3+n-8-3,s=1==(r>>t&1),e.set(o,i,s,!0),e.set(i,o,s,!0)}(C,t),function(e,t){const n=e.size;let r=-1,o=n-1,i=7,s=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!e.isReserved(o,a-n)){let r=!1;s<t.length&&(r=1==(t[s]>>>i&1)),e.set(o,a-n,r),i--,-1===i&&(s++,i=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}(C,A),isNaN(o)&&(o=l.getBestMask(C,g.bind(null,C,n))),l.applyMask(o,C),g(C,n,o),{modules:C,version:t,errorCorrectionLevel:n,maskPattern:o,segments:p}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,i,s=o.M;return void 0!==t&&(s=o.from(t.errorCorrectionLevel,o.M),n=u.from(t.version),i=l.from(t.maskPattern),t.toSJISFunc&&r.setToSJISFunction(t.toSJISFunc)),y(e,n,s,i)}},882:(e,t,n)=>{const r=n(136);function o(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}o.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=r.mod(t,this.genPoly),o=this.degree-n.length;if(o>0){const e=new Uint8Array(this.degree);return e.set(n,o),e}return n},e.exports=o},7:(e,t)=>{const n="[0-9]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+")(?:.|[\r\n]))+";t.KANJI=new RegExp(r,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(o,"g"),t.NUMERIC=new RegExp(n,"g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const i=new RegExp("^"+r+"$"),s=new RegExp("^"+n+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return s.test(e)},t.testAlphanumeric=function(e){return a.test(e)}},130:(e,t,n)=>{const r=n(910),o=n(85),i=n(260),s=n(424),a=n(442),c=n(7),l=n(242),d=n(987);function h(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){const r=[];let o;for(;null!==(o=e.exec(n));)r.push({data:o[0],index:o.index,mode:t,length:o[0].length});return r}function p(e){const t=u(c.NUMERIC,r.NUMERIC,e),n=u(c.ALPHANUMERIC,r.ALPHANUMERIC,e);let o,i;return l.isKanjiModeEnabled()?(o=u(c.BYTE,r.BYTE,e),i=u(c.KANJI,r.KANJI,e)):(o=u(c.BYTE_KANJI,r.BYTE,e),i=[]),t.concat(n,o,i).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function f(e,t){switch(t){case r.NUMERIC:return o.getBitsLength(e);case r.ALPHANUMERIC:return i.getBitsLength(e);case r.KANJI:return a.getBitsLength(e);case r.BYTE:return s.getBitsLength(e)}}function m(e,t){let n;const c=r.getBestModeForData(e);if(n=r.from(t,c),n!==r.BYTE&&n.bit<c.bit)throw new Error('"'+e+'" cannot be encoded with mode '+r.toString(n)+".\n Suggested mode is: "+r.toString(c));switch(n!==r.KANJI||l.isKanjiModeEnabled()||(n=r.BYTE),n){case r.NUMERIC:return new o(e);case r.ALPHANUMERIC:return new i(e);case r.KANJI:return new a(e);case r.BYTE:return new s(e)}}t.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(m(t,null)):t.data&&e.push(m(t.data,t.mode)),e}),[])},t.fromString=function(e,n){const o=function(e){const t=[];for(let n=0;n<e.length;n++){const o=e[n];switch(o.mode){case r.NUMERIC:t.push([o,{data:o.data,mode:r.ALPHANUMERIC,length:o.length},{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.ALPHANUMERIC:t.push([o,{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.KANJI:t.push([o,{data:o.data,mode:r.BYTE,length:h(o.data)}]);break;case r.BYTE:t.push([{data:o.data,mode:r.BYTE,length:h(o.data)}])}}return t}(p(e,l.isKanjiModeEnabled())),i=function(e,t){const n={},o={start:{}};let i=["start"];for(let s=0;s<e.length;s++){const a=e[s],c=[];for(let e=0;e<a.length;e++){const l=a[e],d=""+s+e;c.push(d),n[d]={node:l,lastCount:0},o[d]={};for(let e=0;e<i.length;e++){const s=i[e];n[s]&&n[s].node.mode===l.mode?(o[s][d]=f(n[s].lastCount+l.length,l.mode)-f(n[s].lastCount,l.mode),n[s].lastCount+=l.length):(n[s]&&(n[s].lastCount=l.length),o[s][d]=f(l.length,l.mode)+4+r.getCharCountIndicator(l.mode,t))}}i=c}for(let e=0;e<i.length;e++)o[i[e]].end=0;return{map:o,table:n}}(o,n),s=d.find_path(i.map,"start","end"),a=[];for(let e=1;e<s.length-1;e++)a.push(i.table[s[e]].node);return t.fromArray(a.reduce((function(e,t){const n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[]))},t.rawSplit=function(e){return t.fromArray(p(e,l.isKanjiModeEnabled()))}},242:(e,t)=>{let n;const r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return r[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},114:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},103:(e,t,n)=>{const r=n(242),o=n(393),i=n(908),s=n(910),a=n(114),c=r.getBCHDigit(7973);function l(e,t){return s.getCharCountIndicator(e,t)+4}function d(e,t){let n=0;return e.forEach((function(e){const r=l(e.mode,t);n+=r+e.getBitsLength()})),n}t.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,n){if(!a.isValid(e))throw new Error("Invalid QR Code version");void 0===n&&(n=s.BYTE);const i=8*(r.getSymbolTotalCodewords(e)-o.getTotalCodewordsCount(e,t));if(n===s.MIXED)return i;const c=i-l(n,e);switch(n){case s.NUMERIC:return Math.floor(c/10*3);case s.ALPHANUMERIC:return Math.floor(c/11*2);case s.KANJI:return Math.floor(c/13);case s.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,n){let r;const o=i.from(n,i.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(d(e,r)<=t.getCapacity(r,n,s.MIXED))return r}(e,o);if(0===e.length)return 1;r=e[0]}else r=e;return function(e,n,r){for(let o=1;o<=40;o++)if(n<=t.getCapacity(o,r,e))return o}(r.mode,r.getLength(),o)},t.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;r.getBCHDigit(t)-c>=0;)t^=7973<<r.getBCHDigit(t)-c;return e<<12|t}},907:(e,t,n)=>{const r=n(653);t.render=function(e,t,n){let o=n,i=t;void 0!==o||t&&t.getContext||(o=t,t=void 0),t||(i=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),o=r.getOptions(o);const s=r.getImageWidth(e.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return r.qrToImageData(c.data,e,o),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(a,i,s),a.putImageData(c,0,0),i},t.renderToDataURL=function(e,n,r){let o=r;void 0!==o||n&&n.getContext||(o=n,n=void 0),o||(o={});const i=t.render(e,n,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}},776:(e,t,n)=>{const r=n(653);function o(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function i(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}t.render=function(e,t,n){const s=r.getOptions(t),a=e.modules.size,c=e.modules.data,l=a+2*s.margin,d=s.color.light.a?"<path "+o(s.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+o(s.color.dark,"stroke")+' d="'+function(e,t,n){let r="",o=0,s=!1,a=0;for(let c=0;c<e.length;c++){const l=Math.floor(c%t),d=Math.floor(c/t);l||s||(s=!0),e[c]?(a++,c>0&&l>0&&e[c-1]||(r+=s?i("M",l+n,.5+d+n):i("m",o,0),o=0,s=!1),l+1<t&&e[c+1]||(r+=i("h",a),a=0)):o++}return r}(c,a,s.margin)+'"/>',u='viewBox="0 0 '+l+" "+l+'"',p='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+u+' shape-rendering="crispEdges">'+d+h+"</svg>\n";return"function"==typeof n&&n(null,p),p}},653:(e,t)=>{function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:r,scale:r?4:o,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const o=n.modules.size,i=n.modules.data,s=t.getScale(o,r),a=Math.floor((o+2*r.margin)*s),c=r.margin*s,l=[r.color.light,r.color.dark];for(let t=0;t<a;t++)for(let n=0;n<a;n++){let d=4*(t*a+n),h=r.color.light;t>=c&&n>=c&&t<a-c&&n<a-c&&(h=l[i[Math.floor((t-c)/s)*o+Math.floor((n-c)/s)]?1:0]),e[d++]=h.r,e[d++]=h.g,e[d++]=h.b,e[d]=h.a}}},539:e=>{"use strict";const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((e=>0===e.indexOf(n)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const r=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<r.length;e++)n=r[e].trim().split("="),t[n[0].trim()]=n[1];return t},t.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const r=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],o=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&o?{usernameFragment:r.substring(12),password:o.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" ");n.profile=r[2];for(let o=3;o<r.length;o++){const i=r[o],s=t.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(s){const r=t.parseRtpMap(s),o=t.matchPrefix(e,"a=fmtp:"+i+" ");switch(r.parameters=o.length?t.parseFmtp(o[0]):{},r.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(t.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{n.headerExtensions.push(t.parseExtmap(e))}));const o=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach((e=>{o.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),n},t.writeRtpDescription=function(e,n){let r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=n.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((e=>{r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));let o=0;return n.codecs.forEach((e=>{e.maxptime>o&&(o=e.maxptime)})),o>0&&(r+="a=maxptime:"+o+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((e=>{r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){const n=[],r=t.parseRtpParameters(e),o=-1!==r.fecMechanisms.indexOf("RED"),i=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const l=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));l.length>0&&l[0].length>1&&l[0][0]===a&&(c=l[0][1]),r.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),n.push(t),o&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:i?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&a&&n.push({ssrc:a});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,n.forEach((e=>{e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){const n={},r=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const o=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;const i=t.matchPrefix(e,"a=rtcp-mux");return n.mux=i.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const r=t.matchPrefix(e,"a=msid:");if(1===r.length)return n=r[0].substring(7).split(" "),{stream:n[0],track:n[1]};const o=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return o.length>0?(n=o[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),r=t.matchPrefix(e,"a=max-message-size:");let o;r.length>0&&(o=parseInt(r[0].substring(19),10)),isNaN(o)&&(o=65536);const i=t.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substring(12),10),protocol:n.fmt,maxMessageSize:o};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:o}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,r){let o;const i=void 0!==n?n:2;return o=e||t.generateSessionId(),"v=0\r\no="+(r||"thisisadapterortc")+" "+o+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const r=t.splitLines(e);for(let e=0;e<r.length;e++)switch(r[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[e].substring(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const n=t.splitLines(e)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){const n=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const n=t.splitLines(e);for(let e=0;e<n.length;e++)if(n[e].length<2||"="!==n[e].charAt(1))return!1;return!0},e.exports=t},379:(e,t,n)=>{"use strict";var r,o=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function s(e){for(var t=-1,n=0;n<i.length;n++)if(i[n].identifier===e){t=n;break}return t}function a(e,t){for(var n={},r=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=n[c]||0,d="".concat(c," ").concat(l);n[c]=l+1;var h=s(d),u={css:a[1],media:a[2],sourceMap:a[3]};-1!==h?(i[h].references++,i[h].updater(u)):i.push({identifier:d,updater:m(u,t),references:1}),r.push(d)}return r}function c(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var s=o(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var l,d=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function h(e,t,n,r){var o=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function u(e,t,n){var r=n.css,o=n.media,i=n.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var p=null,f=0;function m(e,t){var n,r,o;if(t.singleton){var i=f++;n=p||(p=c(t)),r=h.bind(null,n,i,!1),o=h.bind(null,n,i,!0)}else n=c(t),r=u.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r));var n=a(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var o=s(n[r]);i[o].references--}for(var c=a(e,t),l=0;l<n.length;l++){var d=s(n[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}n=c}}}},452:function(e,t){!function(e){"use strict";let t,n,r;try{t=new TextDecoder}catch(e){}let o=0;const i=57342,s=57343,a=57337,c={};let l,d,h,u,p,f,m,g={},y=0,A=0,b=[],C=[],v={useRecords:!1,mapsAsObjects:!0},w=!1,V=2;var k;try{new k("")}catch(e){V=1/0}class E{constructor(e){if(e&&(!e.keyMap&&!e._keyMap||e.useRecords||(e.useRecords=!1,e.mapsAsObjects=!0),!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,n]of Object.entries(e.keyMap))this.mapKey.set(n,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[n,r]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(n)?this._keyMap[n]:n,r);return t}decodeKeys(e){if(!this._keyMap||"Map"!=e.constructor.name)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach(((e,n)=>t[P(this._mapKey.has(n)?this._mapKey.get(n):n)]=e)),t}mapDecode(e,t){let n=this.decode(e);return this._keyMap&&"Array"===n.constructor.name?n.map((e=>this.decodeKeys(e))):n}decode(e,t){if(n)return Q((()=>(W(),this?this.decode(e,t):E.prototype.decode.call(v,e,t))));r=t>-1?t:e.length,o=0,A=0,d=null,h=null,n=e;try{f=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(n=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof E){if(g=this,p=this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return l=this.structures,_();(!l||l.length>0)&&(l=[])}else g=v,(!l||l.length>0)&&(l=[]),p=null;return _()}decodeMultiple(e,t){let n,r=0;try{let i=e.length;w=!0;let s=this?this.decode(e,i):$.decode(e,i);if(!t){for(n=[s];o<i;)r=o,n.push(_());return n}if(!1===t(s))return;for(;o<i;)if(r=o,!1===t(_()))return}catch(e){throw e.lastPosition=r,e.values=n,e}finally{w=!1,W()}}}function _(){try{let e=S();if(h){if(o>=h.postBundlePosition){let e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}o=h.postBundlePosition,h=null}if(o==r)l=null,n=null,u&&(u=null);else{if(o>r){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}if(!w)throw new Error("Data read, but end of buffer not reached")}return e}catch(e){throw W(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function S(){let e=n[o++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=n[o++];break;case 25:if(7==t)return function(){let e=n[o++],t=n[o++],r=(127&e)>>2;if(31===r)return t||3&e?NaN:128&e?-1/0:1/0;if(0===r){let n=((3&e)<<8|t)/(1<<24);return 128&e?-n:n}return D[3]=128&e|56+(r>>1),D[2]=(7&e)<<5|t>>3,D[1]=t<<5,D[0]=0,B[0]}();e=f.getUint16(o),o+=2;break;case 26:if(7==t){let e=f.getFloat32(o);if(g.useFloat32>2){let t=Z[(127&n[o])<<1|n[o+1]>>7];return o+=4,(t*e+(e>0?.5:-.5)>>0)/t}return o+=4,e}e=f.getUint32(o),o+=4;break;case 27:if(7==t){let e=f.getFloat64(o);return o+=8,e}if(t>1){if(f.getUint32(o)>0)throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");e=f.getUint32(o+4)}else g.int64AsNumber?(e=4294967296*f.getUint32(o),e+=f.getUint32(o+4)):e=f.getBigUint64(o);o+=8;break;case 31:switch(t){case 2:case 3:throw new Error("Indefinite length not supported for byte or text strings");case 4:let e,n=[],r=0;for(;(e=S())!=c;)n[r++]=e;return 4==t?n:3==t?n.join(""):Buffer.concat(n);case 5:let o;if(g.mapsAsObjects){let e={};if(g.keyMap)for(;(o=S())!=c;)e[P(g.decodeKey(o))]=S();else for(;(o=S())!=c;)e[P(o)]=S();return e}{m&&(g.mapsAsObjects=!0,m=!1);let e=new Map;if(g.keyMap)for(;(o=S())!=c;)e.set(g.decodeKey(o),S());else for(;(o=S())!=c;)e.set(o,S());return e}case 7:return c;default:throw new Error("Invalid major type for indefinite length "+t)}default:throw new Error("Unknown token "+e)}switch(t){case 0:return e;case 1:return~e;case 2:return u=e,g.copyBuffers?Uint8Array.prototype.slice.call(n,o,o+=u):n.subarray(o,o+=u);case 3:if(A>=o)return d.slice(o-y,(o+=e)-y);if(0==A&&r<140&&e<32){let t=e<16?x(e):function(e){let t=o,r=new Array(e);for(let i=0;i<e;i++){const e=n[o++];if((128&e)>0)return void(o=t);r[i]=e}return I.apply(String,r)}(e);if(null!=t)return t}return M(e);case 4:let t=new Array(e);for(let n=0;n<e;n++)t[n]=S();return t;case 5:if(g.mapsAsObjects){let t={};if(g.keyMap)for(let n=0;n<e;n++)t[P(g.decodeKey(S()))]=S();else for(let n=0;n<e;n++)t[P(S())]=S();return t}{m&&(g.mapsAsObjects=!0,m=!1);let t=new Map;if(g.keyMap)for(let n=0;n<e;n++)t.set(g.decodeKey(S()),S());else for(let n=0;n<e;n++)t.set(S(),S());return t}case 6:if(e>=a){let t=l[8191&e];if(t)return t.read||(t.read=R(t)),t.read();if(e<65536){if(e==s){let e=J(),t=S(),n=S();U(t,n);let r={};if(g.keyMap)for(let t=2;t<e;t++)r[P(g.decodeKey(n[t-2]))]=S();else for(let t=2;t<e;t++)r[P(n[t-2])]=S();return r}if(e==i){let e=J(),t=S();for(let n=2;n<e;n++)U(t++,S());return S()}if(e==a)return function(){let e=J(),t=o+S();for(let t=2;t<e;t++){let e=J();o+=e}let n=o;return o=t,h=[q(J()),q(J())],h.position0=0,h.position1=0,h.postBundlePosition=o,o=n,S()}();if(g.getShared&&(G(),t=l[8191&e],t))return t.read||(t.read=R(t)),t.read()}}let c=b[e];if(c)return c.handlesRead?c(S):c(S());{let t=S();for(let n=0;n<C.length;n++){let r=C[n](e,t);if(void 0!==r)return r}return new O(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(p||F())[e];if(void 0!==t)return t;throw new Error("Unknown token "+e)}default:if(isNaN(e)){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}throw new Error("Unknown CBOR token "+e)}var u}const T=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function R(e){return e.slowReads=0,function(){let e=n[o++];if(e&=31,e>23)switch(e){case 24:e=n[o++];break;case 25:e=f.getUint16(o),o+=2;break;case 26:e=f.getUint32(o),o+=4;break;default:throw new Error("Expected array header, but got "+n[o-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(S);t=t.next}if(this.slowReads++>=V){let n=this.length==e?this:this.slice(0,e);return t=g.keyMap?new k("r","return {"+n.map((e=>g.decodeKey(e))).map((e=>T.test(e)?P(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"):new k("r","return {"+n.map((e=>T.test(e)?P(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(S)}let r={};if(g.keyMap)for(let t=0;t<e;t++)r[P(g.decodeKey(this[t]))]=S();else for(let t=0;t<e;t++)r[P(this[t])]=S();return r}}function P(e){return"__proto__"===e?"__proto_":e}let M=q;function q(e){let r;if(e<16&&(r=x(e)))return r;if(e>64&&t)return t.decode(n.subarray(o,o+=e));const i=o+e,s=[];for(r="";o<i;){const e=n[o++];if(0==(128&e))s.push(e);else if(192==(224&e)){const t=63&n[o++];s.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&n[o++],r=63&n[o++];s.push((31&e)<<12|t<<6|r)}else if(240==(248&e)){let t=(7&e)<<18|(63&n[o++])<<12|(63&n[o++])<<6|63&n[o++];t>65535&&(t-=65536,s.push(t>>>10&1023|55296),t=56320|1023&t),s.push(t)}else s.push(e);s.length>=4096&&(r+=I.apply(String,s),s.length=0)}return s.length>0&&(r+=I.apply(String,s)),r}let I=String.fromCharCode;function x(e){if(e<4){if(e<2){if(0===e)return"";{let e=n[o++];return(128&e)>1?void(o-=1):I(e)}}{let t=n[o++],r=n[o++];if((128&t)>0||(128&r)>0)return void(o-=2);if(e<3)return I(t,r);let i=n[o++];return(128&i)>0?void(o-=3):I(t,r,i)}}{let t=n[o++],r=n[o++],i=n[o++],s=n[o++];if((128&t)>0||(128&r)>0||(128&i)>0||(128&s)>0)return void(o-=4);if(e<6){if(4===e)return I(t,r,i,s);{let e=n[o++];return(128&e)>0?void(o-=5):I(t,r,i,s,e)}}if(e<8){let a=n[o++],c=n[o++];if((128&a)>0||(128&c)>0)return void(o-=6);if(e<7)return I(t,r,i,s,a,c);let l=n[o++];return(128&l)>0?void(o-=7):I(t,r,i,s,a,c,l)}{let a=n[o++],c=n[o++],l=n[o++],d=n[o++];if((128&a)>0||(128&c)>0||(128&l)>0||(128&d)>0)return void(o-=8);if(e<10){if(8===e)return I(t,r,i,s,a,c,l,d);{let e=n[o++];return(128&e)>0?void(o-=9):I(t,r,i,s,a,c,l,d,e)}}if(e<12){let h=n[o++],u=n[o++];if((128&h)>0||(128&u)>0)return void(o-=10);if(e<11)return I(t,r,i,s,a,c,l,d,h,u);let p=n[o++];return(128&p)>0?void(o-=11):I(t,r,i,s,a,c,l,d,h,u,p)}{let h=n[o++],u=n[o++],p=n[o++],f=n[o++];if((128&h)>0||(128&u)>0||(128&p)>0||(128&f)>0)return void(o-=12);if(e<14){if(12===e)return I(t,r,i,s,a,c,l,d,h,u,p,f);{let e=n[o++];return(128&e)>0?void(o-=13):I(t,r,i,s,a,c,l,d,h,u,p,f,e)}}{let m=n[o++],g=n[o++];if((128&m)>0||(128&g)>0)return void(o-=14);if(e<15)return I(t,r,i,s,a,c,l,d,h,u,p,f,m,g);let y=n[o++];return(128&y)>0?void(o-=15):I(t,r,i,s,a,c,l,d,h,u,p,f,m,g,y)}}}}}let B=new Float32Array(1),D=new Uint8Array(B.buffer,0,4);new Array(4096);class O{constructor(e,t){this.value=e,this.tag=t}}b[0]=e=>new Date(e),b[1]=e=>new Date(Math.round(1e3*e)),b[2]=e=>{let t=BigInt(0);for(let n=0,r=e.byteLength;n<r;n++)t=BigInt(e[n])+t<<BigInt(8);return t},b[3]=e=>BigInt(-1)-b[2](e),b[4]=e=>+(e[1]+"e"+e[0]),b[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const U=(e,t)=>{let n=l[e-=57344];n&&n.isShared&&((l.restoreStructures||(l.restoreStructures=[]))[e]=n),l[e]=t,t.read=R(t)};b[105]=e=>{let t=e.length,n=e[1];U(e[0],n);let r={};for(let o=2;o<t;o++)r[P(n[o-2])]=e[o];return r},b[14]=e=>h?h[0].slice(h.position0,h.position0+=e):new O(e,14),b[15]=e=>h?h[1].slice(h.position1,h.position1+=e):new O(e,15);let j={Error,RegExp};b[27]=e=>(j[e[0]]||Error)(e[1],e[2]);const L=e=>{if(132!=n[o++])throw new Error("Packed values structure must be followed by a 4 element array");let t=e();return p=p?t.concat(p.slice(t.length)):t,p.prefixes=e(),p.suffixes=e(),e()};function N(e,t){return"string"==typeof e?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function F(){if(!p){if(!g.getShared)throw new Error("No packed values available");G()}return p}L.handlesRead=!0,b[51]=L,b[6]=e=>{if(!p){if(!g.getShared)return new O(e,6);G()}if("number"==typeof e)return p[16+(e>=0?2*e:-2*e-1)];throw new Error("No support for non-integer packed references yet")},b[28]=e=>{u||(u=new Map,u.id=0);let t,r=u.id++;t=n[o]>>5==4?[]:{};let i={target:t};u.set(r,i);let s=e();return i.used?Object.assign(t,s):(i.target=s,s)},b[28].handlesRead=!0,b[29]=e=>{let t=u.get(e);return t.used=!0,t.target},b[258]=e=>new Set(e),(b[259]=e=>(g.mapsAsObjects&&(g.mapsAsObjects=!1,m=!0),e())).handlesRead=!0;C.push(((e,t)=>e>=225&&e<=255?N(F().prefixes[e-224],t):e>=28704&&e<=32767?N(F().prefixes[e-28672],t):e>=1879052288&&e<=2147483647?N(F().prefixes[e-1879048192],t):e>=216&&e<=223?N(t,F().suffixes[e-216]):e>=27647&&e<=28671?N(t,F().suffixes[e-27639]):e>=1811940352&&e<=1879048191?N(t,F().suffixes[e-1811939328]):1399353956==e?{packedValues:p,structures:l.slice(0),version:t}:55799==e?t:void 0));const z=1==new Uint8Array(new Uint16Array([1]).buffer)[0],K=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?{name:"BigUint64Array"}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?{name:"BigInt64Array"}:BigInt64Array,Float32Array,Float64Array],H=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<K.length;e++)Y(K[e],H[e]);function Y(e,t){let n,r="get"+e.name.slice(0,-5);"function"==typeof e?n=e.BYTES_PER_ELEMENT:e=null;for(let o=0;o<2;o++){if(!o&&1==n)continue;let i=2==n?1:4==n?2:3;b[o?t:t-4]=1==n||o==z?n=>{if(!e)throw new Error("Could not find typed array for code "+t);return new e(Uint8Array.prototype.slice.call(n,0).buffer)}:n=>{if(!e)throw new Error("Could not find typed array for code "+t);let s=new DataView(n.buffer,n.byteOffset,n.byteLength),a=n.length>>i,c=new e(a),l=s[r];for(let e=0;e<a;e++)c[e]=l.call(s,e<<i,o);return c}}}function J(){let e=31&n[o++];if(e>23)switch(e){case 24:e=n[o++];break;case 25:e=f.getUint16(o),o+=2;break;case 26:e=f.getUint32(o),o+=4}return e}function G(){if(g.getShared){let e=Q((()=>(n=null,g.getShared())))||{},t=e.structures||[];g.sharedVersion=e.version,p=g.sharedValues=e.packedValues,!0===l?g.structures=l=t:l.splice.apply(l,[0,t.length].concat(t))}}function Q(e){let t=r,i=o,s=y,a=A,c=d,p=u,m=h,b=new Uint8Array(n.slice(0,r)),C=l,v=g,V=w,k=e();return r=t,o=i,y=s,A=a,d=c,u=p,h=m,n=b,w=V,l=C,g=v,f=new DataView(n.buffer,n.byteOffset,n.byteLength),k}function W(){n=null,u=null,l=null}const Z=new Array(147);for(let e=0;e<256;e++)Z[e]=+("1e"+Math.floor(45.15-.30103*e));let $=new E({useRecords:!1});const X=$.decode,ee=$.decodeMultiple,te={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let ne,re,oe;try{ne=new TextEncoder}catch(e){}const ie="object"==typeof globalThis&&globalThis.Buffer,se=void 0!==ie,ae=se?ie.allocUnsafeSlow:Uint8Array,ce=se?ie:Uint8Array,le=se?4294967296:2144337920;let de,he,ue,pe,fe=0,me=null;const ge=/[\u0080-\uFFFF]/,ye=Symbol("record-id");class Ae extends E{constructor(e){let t,n,r,o,i;super(e),this.offset=0,e=e||{};let s=ce.prototype.utf8Write?function(e,t,n){return he.utf8Write(e,t,n)}:!(!ne||!ne.encodeInto)&&function(e,t){return ne.encodeInto(e,he.subarray(t)).written},a=this,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(null==l&&(l=c?128:0),l>8190)throw new Error("Maximum maxSharedStructure is 8190");let d=e.sequential;d&&(l=0),this.structures||(this.structures=[]),this.saveStructures&&(this.saveShared=this.saveStructures);let h,u,p,f=e.sharedValues;if(f){p=Object.create(null);for(let e=0,t=f.length;e<t;e++)p[f[e]]=e}let m=[],g=0,y=0;this.mapEncode=function(e,t){return this._keyMap&&!this._mapped&&"Array"===e.constructor.name&&(e=e.map((e=>this.encodeKeys(e)))),this.encode(e,t)},this.encode=function(s,c){if(he||(he=new ae(8192),ue=new DataView(he.buffer,0,8192),fe=0),pe=he.length-10,pe-fe<2048?(he=new ae(he.length),ue=new DataView(he.buffer,0,he.length),pe=he.length-10,fe=0):c===Oe&&(fe=fe+7&2147483640),t=fe,a.useSelfDescribedHeader&&(ue.setUint32(fe,3654940416),fe+=3),i=a.structuredClone?new Map:null,a.bundleStrings&&"string"!=typeof s?(me=[],me.size=1/0):me=null,n=a.structures,n){if(n.uninitialized){let e=a.getShared()||{};a.structures=n=e.structures||[],a.sharedVersion=e.version;let t=a.sharedValues=e.packedValues;if(t){p={};for(let e=0,n=t.length;e<n;e++)p[t[e]]=e}}let e=n.length;if(e>l&&!d&&(e=l),!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,o=n.transitions;for(let n=0,i=e.length;n<i;n++){void 0===o[ye]&&(o[ye]=t);let i=e[n];r=o[i],r||(r=o[i]=Object.create(null)),o=r}o[ye]=1048576|t}}d||(n.nextId=e)}if(r&&(r=!1),o=n||[],u=p,e.pack){let t=new Map;if(t.values=[],t.encoder=a,t.maxValues=e.maxPrivatePackedValues||(p?16:1/0),t.objectMap=p||!1,t.samplingPackedValues=h,ke(s,t),t.values.length>0){he[fe++]=216,he[fe++]=51,ve(4);let e=t.values;A(e),ve(0),ve(0),u=Object.create(p||null);for(let t=0,n=e.length;t<n;t++)u[e[t]]=t}}de=c&je;try{if(de)return;if(A(s),me&&Te(t,A),a.offset=fe,i&&i.idsToInsert){fe+=2*i.idsToInsert.length,fe>pe&&C(fe),a.offset=fe;let e=function(e,t){let n,r=2*t.length,o=e.length-r;t.sort(((e,t)=>e.offset>t.offset?1:-1));for(let n=0;n<t.length;n++){let r=t[n];r.id=n;for(let t of r.references)e[t++]=n>>8,e[t]=255&n}for(;n=t.pop();){let t=n.offset;e.copyWithin(t+r,t,o),r-=2;let i=t+r;e[i++]=216,e[i++]=28,o=t}return e}(he.subarray(t,fe),i.idsToInsert);return i=null,e}return c&Oe?(he.start=t,he.end=fe,he):he.subarray(t,fe)}finally{if(n)if(y<10&&y++,n.length>l&&(n.length=l),g>1e4)n.transitions=null,y=0,g=0,m.length>0&&(m=[]);else if(m.length>0&&!d){for(let e=0,t=m.length;e<t;e++)m[e][ye]=void 0;m=[]}if(r&&a.saveShared){a.structures.length>l&&(a.structures=a.structures.slice(0,l));let e=he.subarray(t,fe);return!1===a.updateSharedData()?a.encode(s):e}c&Ue&&(fe=t)}},this.findCommonStringsToPack=()=>(h=new Map,p||(p=Object.create(null)),e=>{let t=e&&e.threshold||4,n=this.pack?e.maxPrivatePackedValues||16:0;f||(f=this.sharedValues=[]);for(let[e,o]of h)o.count>t&&(p[e]=n++,f.push(e),r=!0);for(;this.saveShared&&!1===this.updateSharedData(););h=null});const A=n=>{fe>pe&&(he=C(fe));var r,o=typeof n;if("string"===o){if(u){let t=u[n];if(t>=0)return void(t<16?he[fe++]=t+224:(he[fe++]=198,A(1&t?15-t>>1:t-16>>1)));if(h&&!e.pack){let e=h.get(n);e?e.count++:h.set(n,{count:1})}}let o,i=n.length;if(me&&i>=4&&i<1024){if((me.size+=i)>61440){let e,n=(me[0]?3*me[0].length+me[1].length:0)+10;fe+n>pe&&(he=C(fe+n)),he[fe++]=217,he[fe++]=223,he[fe++]=249,he[fe++]=me.position?132:130,he[fe++]=26,e=fe-t,fe+=4,me.position&&Te(t,A),me=["",""],me.size=0,me.position=e}let e=ge.test(n);return me[e?0:1]+=n,he[fe++]=e?206:207,void A(i)}o=i<32?1:i<256?2:i<65536?3:5;let a=3*i;if(fe+a>pe&&(he=C(fe+a)),i<64||!s){let e,t,s,a=fe+o;for(e=0;e<i;e++)t=n.charCodeAt(e),t<128?he[a++]=t:t<2048?(he[a++]=t>>6|192,he[a++]=63&t|128):55296==(64512&t)&&56320==(64512&(s=n.charCodeAt(e+1)))?(t=65536+((1023&t)<<10)+(1023&s),e++,he[a++]=t>>18|240,he[a++]=t>>12&63|128,he[a++]=t>>6&63|128,he[a++]=63&t|128):(he[a++]=t>>12|224,he[a++]=t>>6&63|128,he[a++]=63&t|128);r=a-fe-o}else r=s(n,fe+o,a);r<24?he[fe++]=96|r:r<256?(o<2&&he.copyWithin(fe+2,fe+1,fe+1+r),he[fe++]=120,he[fe++]=r):r<65536?(o<3&&he.copyWithin(fe+3,fe+2,fe+2+r),he[fe++]=121,he[fe++]=r>>8,he[fe++]=255&r):(o<5&&he.copyWithin(fe+5,fe+3,fe+3+r),he[fe++]=122,ue.setUint32(fe,r),fe+=4),fe+=r}else if("number"===o)if(this.alwaysUseFloat||n>>>0!==n)if(this.alwaysUseFloat||n>>0!==n){let e;if((e=this.useFloat32)>0&&n<4294967296&&n>=-2147483648){let t;if(he[fe++]=250,ue.setFloat32(fe,n),e<4||(t=n*Z[(127&he[fe])<<1|he[fe+1]>>7])>>0===t)return void(fe+=4);fe--}he[fe++]=251,ue.setFloat64(fe,n),fe+=8}else n>=-24?he[fe++]=31-n:n>=-256?(he[fe++]=56,he[fe++]=~n):n>=-65536?(he[fe++]=57,ue.setUint16(fe,~n),fe+=2):(he[fe++]=58,ue.setUint32(fe,~n),fe+=4);else n<24?he[fe++]=n:n<256?(he[fe++]=24,he[fe++]=n):n<65536?(he[fe++]=25,he[fe++]=n>>8,he[fe++]=255&n):(he[fe++]=26,ue.setUint32(fe,n),fe+=4);else if("object"===o)if(n){if(i){let e=i.get(n);if(e){if(he[fe++]=216,he[fe++]=29,he[fe++]=25,!e.references){let t=i.idsToInsert||(i.idsToInsert=[]);e.references=[],t.push(e)}return e.references.push(fe-t),void(fe+=2)}i.set(n,{offset:fe-t})}let e=n.constructor;if(e===Object)b(n,!0);else if(e===Array){(r=n.length)<24?he[fe++]=128|r:ve(r);for(let e=0;e<r;e++)A(n[e])}else if(e===Map)if((this.mapsAsObjects?!1!==this.useTag259ForMaps:this.useTag259ForMaps)&&(he[fe++]=217,he[fe++]=1,he[fe++]=3),(r=n.size)<24?he[fe++]=160|r:r<256?(he[fe++]=184,he[fe++]=r):r<65536?(he[fe++]=185,he[fe++]=r>>8,he[fe++]=255&r):(he[fe++]=186,ue.setUint32(fe,r),fe+=4),a.keyMap)for(let[e,t]of n)A(a.encodeKey(e)),A(t);else for(let[e,t]of n)A(e),A(t);else{for(let e=0,t=re.length;e<t;e++)if(n instanceof oe[e]){let t=re[e],r=t.tag;return null==r&&(r=t.getTag&&t.getTag.call(this,n)),r<24?he[fe++]=192|r:r<256?(he[fe++]=216,he[fe++]=r):r<65536?(he[fe++]=217,he[fe++]=r>>8,he[fe++]=255&r):r>-1&&(he[fe++]=218,ue.setUint32(fe,r),fe+=4),void t.encode.call(this,n,A,C)}if(n[Symbol.iterator]){if(de){let e=new Error("Iterable should be serialized as iterator");throw e.iteratorNotHandled=!0,e}he[fe++]=159;for(let e of n)A(e);return void(he[fe++]=255)}if(n[Symbol.asyncIterator]||Ve(n)){let e=new Error("Iterable/blob should be serialized as iterator");throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&n.toJSON){const e=n.toJSON();if(e!==n)return A(e)}b(n,!n.hasOwnProperty)}}else he[fe++]=246;else if("boolean"===o)he[fe++]=n?245:244;else if("bigint"===o){if(n<BigInt(1)<<BigInt(64)&&n>=0)he[fe++]=27,ue.setBigUint64(fe,n);else if(n>-(BigInt(1)<<BigInt(64))&&n<0)he[fe++]=59,ue.setBigUint64(fe,-n-BigInt(1));else{if(!this.largeBigIntToFloat)throw new RangeError(n+" was too large to fit in CBOR 64-bit integer format, set largeBigIntToFloat to convert to float-64");he[fe++]=251,ue.setFloat64(fe,Number(n))}fe+=8}else{if("undefined"!==o)throw new Error("Unknown type: "+o);he[fe++]=247}},b=!1===this.useRecords?this.variableMapSize?e=>{let t=Object.keys(e),n=Object.values(e),r=t.length;if(r<24?he[fe++]=160|r:r<256?(he[fe++]=184,he[fe++]=r):r<65536?(he[fe++]=185,he[fe++]=r>>8,he[fe++]=255&r):(he[fe++]=186,ue.setUint32(fe,r),fe+=4),a.keyMap)for(let e=0;e<r;e++)A(a.encodeKey(t[e])),A(n[e]);else for(let e=0;e<r;e++)A(t[e]),A(n[e])}:(e,n)=>{he[fe++]=185;let r=fe-t;fe+=2;let o=0;if(a.keyMap)for(let t in e)(n||e.hasOwnProperty(t))&&(A(a.encodeKey(t)),A(e[t]),o++);else for(let t in e)(n||e.hasOwnProperty(t))&&(A(t),A(e[t]),o++);he[r+++t]=o>>8,he[r+t]=255&o}:(e,t)=>{let n,i,s,a=o.transitions||(o.transitions=Object.create(null)),c=0,d=0;if(this.keyMap){s=Object.keys(e).map((e=>this.encodeKey(e))),d=s.length;for(let e=0;e<d;e++){let t=s[e];n=a[t],n||(n=a[t]=Object.create(null),c++),a=n}}else for(let r in e)(t||e.hasOwnProperty(r))&&(n=a[r],n||(1048576&a[ye]&&(i=65535&a[ye]),n=a[r]=Object.create(null),c++),a=n,d++);let h=a[ye];if(void 0!==h)h&=65535,he[fe++]=217,he[fe++]=h>>8|224,he[fe++]=255&h;else{if(s||(s=a.__keys__||(a.__keys__=Object.keys(e))),void 0===i?(h=o.nextId++,h||(h=0,o.nextId=1),h>=256&&(o.nextId=(h=l)+1)):h=i,o[h]=s,!(h<l)){if(a[ye]=h,ue.setUint32(fe,3655335680),fe+=3,c&&(g+=y*c),m.length>=256-l&&(m.shift()[ye]=void 0),m.push(a),ve(d+2),A(57344+h),A(s),null===t)return;for(let n in e)(t||e.hasOwnProperty(n))&&A(e[n]);return}he[fe++]=217,he[fe++]=h>>8|224,he[fe++]=255&h,a=o.transitions;for(let e=0;e<d;e++)(void 0===a[ye]||1048576&a[ye])&&(a[ye]=h),a=a[s[e]];a[ye]=1048576|h,r=!0}if(d<24?he[fe++]=128|d:ve(d),null!==t)for(let n in e)(t||e.hasOwnProperty(n))&&A(e[n])},C=e=>{let n;if(e>16777216){if(e-t>le)throw new Error("Encoded buffer would be larger than maximum buffer size");n=Math.min(le,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else n=1+(Math.max(e-t<<2,he.length-1)>>12)<<12;let r=new ae(n);return ue=new DataView(r.buffer,0,n),he.copy?he.copy(r,0,t,e):r.set(he.slice(t,e)),fe-=t,t=0,pe=r.length-10,he=r};let v=100,w=1e3;function*V(e,n,r){let o=e.constructor;if(o===Object){let t=!1!==a.useRecords;t?b(e,null):be(Object.keys(e).length,160);for(let r in e){let o=e[r];t||A(r),o&&"object"==typeof o?n[r]?yield*V(o,n[r]):yield*k(o,n,r):A(o)}}else if(o===Array){let r=e.length;ve(r);for(let o=0;o<r;o++){let r=e[o];r&&("object"==typeof r||fe-t>v)?n.element?yield*V(r,n.element):yield*k(r,n,"element"):A(r)}}else if(e[Symbol.iterator]){he[fe++]=159;for(let r of e)r&&("object"==typeof r||fe-t>v)?n.element?yield*V(r,n.element):yield*k(r,n,"element"):A(r);he[fe++]=255}else Ve(e)?(be(e.size,64),yield he.subarray(t,fe),yield e,E()):e[Symbol.asyncIterator]?(he[fe++]=159,yield he.subarray(t,fe),yield e,E(),he[fe++]=255):A(e);r&&fe>t?yield he.subarray(t,fe):fe-t>v&&(yield he.subarray(t,fe),E())}function*k(e,n,r){let o=fe-t;try{A(e),fe-t>v&&(yield he.subarray(t,fe),E())}catch(i){if(!i.iteratorNotHandled)throw i;n[r]={},fe=t+o,yield*V.call(this,e,n[r])}}function E(){v=w,a.encode(null,je)}function _(e,t,n){return v=t&&t.chunkThreshold?w=t.chunkThreshold:100,e&&"object"==typeof e?(a.encode(null,je),n(e,a.iterateProperties||(a.iterateProperties={}),!0)):[a.encode(e)]}async function*S(e,t){for(let n of V(e,t,!0)){let e=n.constructor;if(e===ce||e===Uint8Array)yield n;else if(Ve(n)){let e,t=n.stream().getReader();for(;!(e=await t.read()).done;)yield e.value}else if(n[Symbol.asyncIterator])for await(let e of n)E(),e?yield*S(e,t.async||(t.async={})):yield a.encode(e);else yield n}}this.encodeAsIterable=function(e,t){return _(e,t,V)},this.encodeAsAsyncIterable=function(e,t){return _(e,t,S)}}useBuffer(e){he=e,ue=new DataView(he.buffer,he.byteOffset,he.byteLength),fe=0}clearSharedData(){this.structures&&(this.structures=[]),this.sharedValues&&(this.sharedValues=void 0)}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),n=new Ce(t,this.sharedValues,this.sharedVersion),r=this.saveShared(n,(t=>(t&&t.version||0)==e));return!1===r?(n=this.getShared()||{},this.structures=n.structures||[],this.sharedValues=n.packedValues,this.sharedVersion=n.version,this.structures.nextId=this.structures.length):t.forEach(((e,t)=>this.structures[t]=e)),r}}function be(e,t){e<24?he[fe++]=t|e:e<256?(he[fe++]=24|t,he[fe++]=e):e<65536?(he[fe++]=25|t,he[fe++]=e>>8,he[fe++]=255&e):(he[fe++]=26|t,ue.setUint32(fe,e),fe+=4)}class Ce{constructor(e,t,n){this.structures=e,this.packedValues=t,this.version=n}}function ve(e){e<24?he[fe++]=128|e:e<256?(he[fe++]=152,he[fe++]=e):e<65536?(he[fe++]=153,he[fe++]=e>>8,he[fe++]=255&e):(he[fe++]=154,ue.setUint32(fe,e),fe+=4)}const we="undefined"==typeof Blob?function(){}:Blob;function Ve(e){if(e instanceof we)return!0;let t=e[Symbol.toStringTag];return"Blob"===t||"File"===t}function ke(e,t){switch(typeof e){case"string":if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let n=t.get(e);if(n)2==++n.count&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let n=t.samplingPackedValues.get(e);n?n.count++:t.samplingPackedValues.set(e,{count:1})}}break;case"object":if(e)if(e instanceof Array)for(let n=0,r=e.length;n<r;n++)ke(e[n],t);else{let r=!t.encoder.useRecords;for(var n in e)e.hasOwnProperty(n)&&(r&&ke(n,t),ke(e[n],t))}break;case"function":console.log(e)}}const Ee=1==new Uint8Array(new Uint16Array([1]).buffer)[0];function _e(e,t){return!Ee&&t>1&&(e-=4),{tag:e,encode:function(e,t){let n=e.byteLength,r=e.byteOffset||0,o=e.buffer||e;t(se?ie.from(o,r,n):new Uint8Array(o,r,n))}}}function Se(e,t){let n=e.byteLength;n<24?he[fe++]=64+n:n<256?(he[fe++]=88,he[fe++]=n):n<65536?(he[fe++]=89,he[fe++]=n>>8,he[fe++]=255&n):(he[fe++]=90,ue.setUint32(fe,n),fe+=4),fe+n>=he.length&&t(fe+n),he.set(e.buffer?e:new Uint8Array(e),fe),fe+=n}function Te(e,t){ue.setUint32(me.position+e,fe-me.position-e+1);let n=me;me=null,t(n[0]),t(n[1])}oe=[Date,Set,Error,RegExp,O,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?function(){}:BigInt64Array,Float32Array,Float64Array,Ce],re=[{tag:1,encode(e,t){let n=e.getTime()/1e3;(this.useTimestamp32||0===e.getMilliseconds())&&n>=0&&n<4294967296?(he[fe++]=26,ue.setUint32(fe,n),fe+=4):(he[fe++]=251,ue.setFloat64(fe,n),fe+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t(["RegExp",e.source,e.flags])}},{getTag:e=>e.tag,encode(e,t){t(e.value)}},{encode(e,t,n){Se(e,n)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||se&&!1!==this.tagUint8Array))return 64},encode(e,t,n){Se(e,n)}},_e(68,1),_e(69,2),_e(70,4),_e(71,8),_e(72,1),_e(77,2),_e(78,4),_e(79,8),_e(85,4),_e(86,8),{encode(e,t){let n=e.packedValues||[],r=e.structures||[];if(n.values.length>0){he[fe++]=216,he[fe++]=51,ve(4);let e=n.values;t(e),ve(0),ve(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,n=e.length;t<n;t++)packedObjectMap[e[t]]=t}if(r){ue.setUint32(fe,3655335424),fe+=3;let n=r.slice(0);n.unshift(57344),n.push(new O(e.version,1399353956)),t(n)}else t(new O(e.version,1399353956))}}];let Re=new Ae({useRecords:!1});const Pe=Re.encode,Me=Re.encodeAsIterable,qe=Re.encodeAsAsyncIterable,{NEVER:Ie,ALWAYS:xe,DECIMAL_ROUND:Be,DECIMAL_FIT:De}=te,Oe=512,Ue=1024,je=2048;e.ALWAYS=xe,e.DECIMAL_FIT=De,e.DECIMAL_ROUND=Be,e.Decoder=E,e.Encoder=Ae,e.FLOAT32_OPTIONS=te,e.NEVER=Ie,e.REUSE_BUFFER_MODE=Oe,e.Tag=O,e.addExtension=function(e){if(e.Class){if(!e.encode)throw new Error("Extension has no encode function");oe.unshift(e.Class),re.unshift(e)}!function(e){b[e.tag]=e.decode}(e)},e.clearSource=W,e.decode=X,e.decodeIter=function(e,t={}){if(!e||"object"!=typeof e)throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const n=new E(t);let r;const o=e=>{let t;r&&(e=Buffer.concat([r,e]),r=void 0);try{t=n.decodeMultiple(e)}catch(n){if(!n.incomplete)throw n;r=e.slice(n.lastPosition),t=n.values}return t};return"function"==typeof e[Symbol.iterator]?function*(){for(const t of e)yield*o(t)}():"function"==typeof e[Symbol.asyncIterator]?async function*(){for await(const t of e)yield*o(t)}():void 0},e.decodeMultiple=ee,e.encode=Pe,e.encodeAsAsyncIterable=qe,e.encodeAsIterable=Me,e.encodeIter=function(e,t={}){if(e&&"object"==typeof e){if("function"==typeof e[Symbol.iterator])return function*(e,t){const n=new Ae(t);for(const t of e)yield n.encode(t)}(e,t);if("function"==typeof e.then||"function"==typeof e[Symbol.asyncIterator])return async function*(e,t){const n=new Ae(t);for await(const t of e)yield n.encode(t)}(e,t);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable")},e.isNativeAccelerationEnabled=!1,e.roundFloat32=function(e){B[0]=e;let t=Z[(127&D[3])<<1|D[2]>>7];return(t*e+(e>0?.5:-.5)>>0)/t}}(t)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};return(()=>{"use strict";n.r(r),n.d(r,{Keypad:()=>gt,Receiver:()=>bt});var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>j,shimAddTrackRemoveTrack:()=>O,shimAddTrackRemoveTrackWithNative:()=>D,shimGetDisplayMedia:()=>P,shimGetSendersWithDtmf:()=>I,shimGetStats:()=>x,shimGetUserMedia:()=>R,shimMediaStream:()=>M,shimOnTrack:()=>q,shimPeerConnection:()=>U,shimSenderReceiverGetStats:()=>B});var t={};n.r(t),n.d(t,{shimAddTransceiver:()=>G,shimCreateAnswer:()=>Z,shimCreateOffer:()=>W,shimGetDisplayMedia:()=>N,shimGetParameters:()=>Q,shimGetUserMedia:()=>L,shimOnTrack:()=>F,shimPeerConnection:()=>z,shimRTCDataChannel:()=>J,shimReceiverGetStats:()=>H,shimRemoveStream:()=>Y,shimSenderGetStats:()=>K});var o={};n.r(o),n.d(o,{shimAudioContext:()=>se,shimCallbacksAPI:()=>ee,shimConstraints:()=>ne,shimCreateOfferLegacy:()=>ie,shimGetUserMedia:()=>te,shimLocalStreamsAPI:()=>$,shimRTCIceServerUrls:()=>re,shimRemoteStreamsAPI:()=>X,shimTrackEventTransceiver:()=>oe});var i={};n.r(i),n.d(i,{removeExtmapAllowMixed:()=>fe,shimAddIceCandidateNullOrEmpty:()=>me,shimConnectionState:()=>pe,shimMaxMessageSize:()=>he,shimParameterlessSetLocalDescription:()=>ge,shimRTCIceCandidate:()=>le,shimRTCIceCandidateRelayProtocol:()=>de,shimSendThrowTypeError:()=>ue});const s=e=>{const t=document.getElementById("keypad"),{keyHeightPx:n,cols:r,rows:o,widthPx:i,heightPx:s}=((e,t,n=.5)=>{let r;const o=e.clientWidth,i=e.clientHeight;let s=o*i;for(r=(-1+Math.sqrt(1+4*t*i/o))/(2*t/o),r=(-1+Math.sqrt(1+4*t*i*n/o))/(2*n*t/o);t>Math.floor(i/r-1)*Math.floor(o/(n*r));){const e=[i/Math.ceil(i/r),o/Math.ceil(o/(n*r))];for(let t=0;t<=e.length;t++)e[t]>=r&&(e[t]=0);r=Math.max(...e)}return s=i*o,{keyHeightPx:r,cols:Math.floor(o/(n*r)),rows:Math.floor(i/r-1),widthPx:o,heightPx:i}})(t,e,1),c=[...t.getElementsByClassName("response-button")],l=c.map((e=>"keypad-control-keys"===e.parentNode.id)),d=c.filter(((e,t)=>!l[t])).map(((e,t)=>[Math.floor(t/r),t%r])),h=s-(o*n+n),u=i-r*(1*n),p=Math.floor(h/2),f=Math.floor(u/2),m=[];let g,y=1/0,A=0;const b=l.filter((e=>e)).length;c.forEach(((e,t)=>{let r,o,c;if(e.style.position="fixed",l[t]){r=s-n,c=i/b-5,o=2.5+m.length*(c+5);const t=a(e,c,n-5);y=Math.min(t,y),m.push(e),e.style.borderRadius="25px",e.style.height=n-5+"px"}else{const t=n-5;c=1*t;const[i,s]=d[A];A+=1,r=i*t+5*(i+1)+p-2.5,o=s*c+5*(s+1)+f-2.5,g||(g=a(e,c,t)),e.style.height=t+"px",e.style.fontSize=t/2+"px"}e.style.width=c+"px",e.style.top=r+"px",e.style.left=o+"px",e.style.visibility="visible"})),m.forEach((e=>e.style.fontSize=y+"px"))},a=(e,t,n)=>{e.style.height="auto",e.style.width="auto",e.style.whiteSpace="nowrap",e.style.fontSize="20px";const r=1/(e.getBoundingClientRect().width/t),o=1/(e.getBoundingClientRect().height/n),i=Math.min(r,o);return Math.floor(20*i)};var c=n(379),l=n.n(c),d=n(660);l()(d.Z,{insert:"head",singleton:!1}),d.Z.locals;class h{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){const e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){const e=[];for(const t of this._parts)e.push(t);return function(e){let t=0;for(const n of e)t+=n.byteLength;const n=new Uint8Array(t);let r=0;for(const t of e){const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}(e).buffer}}function u(e){return new f(e).unpack()}function p(e){const t=new m,n=t.pack(e);return n instanceof Promise?n.then((()=>t.getBuffer())):t.getBuffer()}class f{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){const e=this.unpack_uint8();if(e<128)return e;if((224^e)<32)return(224^e)-32;let t;if((t=160^e)<=15)return this.unpack_raw(t);if((t=176^e)<=15)return this.unpack_string(t);if((t=144^e)<=15)return this.unpack_array(t);if((t=128^e)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:case 212:case 213:case 214:case 215:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){const e=255&this.dataView[this.index];return this.index++,e}unpack_uint16(){const e=this.read(2),t=256*(255&e[0])+(255&e[1]);return this.index+=2,t}unpack_uint32(){const e=this.read(4),t=256*(256*(256*e[0]+e[1])+e[2])+e[3];return this.index+=4,t}unpack_uint64(){const e=this.read(8),t=256*(256*(256*(256*(256*(256*(256*e[0]+e[1])+e[2])+e[3])+e[4])+e[5])+e[6])+e[7];return this.index+=8,t}unpack_int8(){const e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){const e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){const e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){const e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length<this.index+e)throw new Error(`BinaryPackFailure: index is out of range ${this.index} ${e} ${this.length}`);const t=this.dataBuffer.slice(this.index,this.index+e);return this.index+=e,t}unpack_string(e){const t=this.read(e);let n,r,o=0,i="";for(;o<e;)n=t[o],n<160?(r=n,o++):(192^n)<32?(r=(31&n)<<6|63&t[o+1],o+=2):(224^n)<16?(r=(15&n)<<12|(63&t[o+1])<<6|63&t[o+2],o+=3):(r=(7&n)<<18|(63&t[o+1])<<12|(63&t[o+2])<<6|63&t[o+3],o+=4),i+=String.fromCodePoint(r);return this.index+=e,i}unpack_array(e){const t=new Array(e);for(let n=0;n<e;n++)t[n]=this.unpack();return t}unpack_map(e){const t={};for(let n=0;n<e;n++)t[this.unpack()]=this.unpack();return t}unpack_float(){const e=this.unpack_uint32();return(0==e>>31?1:-1)*(8388607&e|8388608)*2**((e>>23&255)-127-23)}unpack_double(){const e=this.unpack_uint32(),t=(e>>20&2047)-1023;return(0==e>>31?1:-1)*((1048575&e|1048576)*2**(t-20)+this.unpack_uint32()*2**(t-52))}read(e){const t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw new Error("BinaryPackFailure: read index out of range")}}class m{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if("string"==typeof e)this.pack_string(e);else if("number"==typeof e)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if("boolean"==typeof e)!0===e?this._bufferBuilder.append(195):!1===e&&this._bufferBuilder.append(194);else if(void 0===e)this._bufferBuilder.append(192);else{if("object"!=typeof e)throw new Error(`Type "${typeof e}" not yet supported`);if(null===e)this._bufferBuilder.append(192);else{const t=e.constructor;if(e instanceof Array){const t=this.pack_array(e);if(t instanceof Promise)return t.then((()=>this._bufferBuilder.flush()))}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if("BYTES_PER_ELEMENT"in e){const t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else{if(e instanceof Blob)return e.arrayBuffer().then((e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()}));if(t!=Object&&!t.toString().startsWith("class"))throw new Error(`Type "${t.toString()}" not yet supported`);{const t=this.pack_object(e);if(t instanceof Promise)return t.then((()=>this._bufferBuilder.flush()))}}}}this._bufferBuilder.flush()}pack_bin(e){const t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(219),this.pack_uint32(t)}this._bufferBuilder.append_buffer(e)}pack_string(e){const t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else{if(!(n<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(217),this.pack_uint32(n)}this._bufferBuilder.append_buffer(t)}pack_array(e){const t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(221),this.pack_uint32(t)}const n=r=>{if(r<t){const t=this.pack(e[r]);return t instanceof Promise?t.then((()=>n(r+1))):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(255&e);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else{if(!(e>=0&&e<=0x10000000000000000))throw new Error("Invalid integer");this._bufferBuilder.append(207),this.pack_uint64(e)}}pack_double(e){let t=0;e<0&&(t=1,e=-e);const n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,o=Math.floor(r*2**52),i=2**32,s=t<<31|n+1023<<20|o/i&1048575,a=o%i;this._bufferBuilder.append(203),this.pack_int32(s),this.pack_int32(a)}pack_object(e){const t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else{if(!(n<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(223),this.pack_uint32(n)}const r=n=>{if(n<t.length){const o=t[n];if(e.hasOwnProperty(o)){this.pack(o);const t=this.pack(e[o]);if(t instanceof Promise)return t.then((()=>r(n+1)))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(255&e)}pack_uint32(e){const t=4294967295&e;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t)}pack_uint64(e){const t=e/2**32,n=e%2**32;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t),this._bufferBuilder.append((4278190080&n)>>>24),this._bufferBuilder.append((16711680&n)>>>16),this._bufferBuilder.append((65280&n)>>>8),this._bufferBuilder.append(255&n)}pack_int8(e){this._bufferBuilder.append(255&e)}pack_int16(e){this._bufferBuilder.append((65280&e)>>8),this._bufferBuilder.append(255&e)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((16711680&e)>>>16),this._bufferBuilder.append((65280&e)>>>8),this._bufferBuilder.append(255&e)}pack_int64(e){const t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t),this._bufferBuilder.append((4278190080&n)>>>24),this._bufferBuilder.append((16711680&n)>>>16),this._bufferBuilder.append((65280&n)>>>8),this._bufferBuilder.append(255&n)}constructor(){this._bufferBuilder=new h,this._textEncoder=new TextEncoder}}let g=!0,y=!0;function A(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function b(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,o=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return o.apply(this,arguments);const i=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,i),o.apply(this,[e,i])};const i=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return i.apply(this,arguments);if(!this._eventMap[t].has(n))return i.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,i.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function C(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(g=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function v(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(y=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function w(){if("object"==typeof window){if(g)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function V(e,t){y&&console.warn(e+" is deprecated, please use "+t+" instead.")}function k(e){return"[object Object]"===Object.prototype.toString.call(e)}function E(e){return k(e)?Object.keys(e).reduce((function(t,n){const r=k(e[n]),o=r?E(e[n]):e[n],i=r&&!Object.keys(o).length;return void 0===o||i?t:Object.assign(t,{[n]:o})}),{}):e}function _(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((r=>{r.endsWith("Id")?_(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((t=>{_(e,e.get(t),n)}))})))}function S(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",o=new Map;if(null===t)return o;const i=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&i.push(e)})),i.forEach((t=>{e.forEach((n=>{n.type===r&&n.trackId===t.id&&_(e,n,o)}))})),o}const T=w;function R(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const o=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||[];let e={};"number"==typeof r.ideal?(e[o("min",n)]=r.ideal,t.optional.push(e),e={},e[o("max",n)]=r.ideal,t.optional.push(e)):(e[o("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",n)]=r.exact):["min","max"].forEach((e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,n)]=r[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,o){if(t.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let i=e.video.facingMode;i=i&&("object"==typeof i?i:{ideal:i});const s=t.version<66;if(i&&("user"===i.exact||"environment"===i.exact||"user"===i.ideal||"environment"===i.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===i.exact||"environment"===i.ideal?t=["back","rear"]:"user"!==i.exact&&"user"!==i.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=i.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=r(e.video),T("chrome: "+JSON.stringify(e)),o(e)}))}e.video=r(e.video)}return T("chrome: "+JSON.stringify(e)),o(e)},i=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){o(e,(e=>{n.webkitGetUserMedia(e,t,(e=>{r&&r(i(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return o(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(i(e))))))}}}function P(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((t=>{const r=n.video&&n.video.width,o=n.video&&n.video.height,i=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:i||3}},r&&(n.video.mandatory.maxWidth=r),o&&(n.video.mandatory.maxHeight=o),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function M(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function q(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.track.id)):{track:n.track};const o=new Event("track");o.track=n.track,o.receiver=r,o.transceiver={receiver:r},o.streams=[t.stream],this.dispatchEvent(o)})),t.stream.getTracks().forEach((n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.id)):{track:n};const o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=[t.stream],this.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else b(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function I(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let o=n.apply(this,arguments);return o||(o=t(this,e),this._senders.push(o)),o};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function x(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const o=function(e){const t={};return e.result().forEach((e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{n[t]=e.stat(t)})),t[n.id]=n})),t},i=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const r=function(e){n(i(o(e)))};return t.apply(this,[r,e])}return new Promise(((e,n)=>{t.apply(this,[function(t){e(i(o(t)))},n])})).then(n,r)}}function B(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>S(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),b(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>S(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach((n=>{n.track===e&&(t?r=!0:t=n)})),this.getReceivers().forEach((t=>(t.track===e&&(n?r=!0:n=t),t.track===e))),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function D(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),o.apply(this,arguments)}}function O(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return D(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const o=e.RTCPeerConnection.prototype.removeStream;function i(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],o=e._streams[r.id];n=n.replace(new RegExp(o.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const o=this._streams[n.id];if(o)o.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=i(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then((e=>i(this,e)))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],o=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),o.id)})),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:i(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((t=>e.track===t))&&(t=this._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function U(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function j(e,t){b(e,"negotiationneeded",(e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}function L(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){V("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function N(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function F(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function z(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,o,i]=arguments;return r.apply(this,[e||null]).then((e=>{if(t.version<53&&!o)try{e.forEach((e=>{e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(o,i)}}function K(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function H(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),b(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Y(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){V("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function J(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function G(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const n=e.length>0;n&&e.forEach((e=>{if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return r})}function Q(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function W(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function Z(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function $(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((n=>t.call(this,n,e))),e.getVideoTracks().forEach((n=>t.call(this,n,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach((e=>{n.includes(e.track)&&this.removeTrack(e)}))})}}function X(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}))}),t.apply(e,arguments)}}}function ee(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,o=t.setLocalDescription,i=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],o=n.apply(this,[r]);return t?(o.then(e,t),Promise.resolve()):o},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],o=r.apply(this,[n]);return t?(o.then(e,t),Promise.resolve()):o};let a=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){const r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}function te(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(ne(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function ne(e){return e&&void 0!==e.video?Object.assign({},e,{video:E(e.video)}):e}function re(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];void 0===r.urls&&r.url?(V("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function oe(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ie(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function se(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var ae=n(539),ce=n.n(ae);function le(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const n=new t(e),r=ce().parseCandidate(e.candidate);for(const e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,b(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function de(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||b(e,"icecandidate",(e=>{if(e.candidate){const t=ce().parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function he(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=ce().splitSections(e.sdp);return t.shift(),t.some((e=>{const t=ce().parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const o=ce().matchPrefix(e.sdp,"a=max-message-size:");return o.length>0?r=parseInt(o[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let o;o=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const i={};Object.defineProperty(i,"maxMessageSize",{get:()=>o}),this._sctp=i}return n.apply(this,arguments)}}function ue(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],o=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&o>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},b(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function pe(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function fe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function me(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ge(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?n.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>n.apply(this,[e])))})}const ye=function({window:n}={},r={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const s=w,a=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=A(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=A(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=A(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(n),c={browserDetails:a,commonShim:i,extractVersion:A,disableLog:C,disableWarnings:v,sdp:ae};switch(a.browser){case"chrome":if(!e||!U||!r.shimChrome)return s("Chrome shim is not included in this adapter release."),c;if(null===a.version)return s("Chrome shim can not determine version, not shimming."),c;s("adapter.js shimming chrome."),c.browserShim=e,me(n,a),ge(n),R(n,a),M(n),U(n,a),q(n),O(n,a),I(n),x(n),B(n),j(n,a),le(n),de(n),pe(n),he(n,a),ue(n),fe(n,a);break;case"firefox":if(!t||!z||!r.shimFirefox)return s("Firefox shim is not included in this adapter release."),c;s("adapter.js shimming firefox."),c.browserShim=t,me(n,a),ge(n),L(n,a),z(n,a),F(n),Y(n),K(n),H(n),J(n),G(n),Q(n),W(n),Z(n),le(n),pe(n),he(n,a),ue(n);break;case"safari":if(!o||!r.shimSafari)return s("Safari shim is not included in this adapter release."),c;s("adapter.js shimming safari."),c.browserShim=o,me(n,a),ge(n),re(n),ie(n),ee(n),$(n),X(n),oe(n),te(n),se(n),le(n),de(n),he(n,a),ue(n),fe(n,a);break;default:s("Unsupported browser!")}return c}({window:"undefined"==typeof window?void 0:window}),Ae=ye;function be(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}n(452);class Ce{constructor(){this.chunkedMTU=16300,this._dataCount=1,this.chunk=e=>{const t=[],n=e.byteLength,r=Math.ceil(n/this.chunkedMTU);let o=0,i=0;for(;i<n;){const s=Math.min(n,i+this.chunkedMTU),a=e.slice(i,s),c={__peerData:this._dataCount,n:o,data:a,total:r};t.push(c),i=s,o++}return this._dataCount++,t}}}const ve=Ae.default||Ae,we=new class{isWebRTCSupported(){return"undefined"!=typeof RTCPeerConnection}isBrowserSupported(){const e=this.getBrowser(),t=this.getVersion();return!!this.supportedBrowsers.includes(e)&&("chrome"===e?t>=this.minChromeVersion:"firefox"===e?t>=this.minFirefoxVersion:"safari"===e&&!this.isIOS&&t>=this.minSafariVersion)}getBrowser(){return ve.browserDetails.browser}getVersion(){return ve.browserDetails.version||0}isUnifiedPlanSupported(){const e=this.getBrowser(),t=ve.browserDetails.version||0;if("chrome"===e&&t<this.minChromeVersion)return!1;if("firefox"===e&&t>=this.minFirefoxVersion)return!0;if(!window.RTCRtpTransceiver||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let n,r=!1;try{n=new RTCPeerConnection,n.addTransceiver("audio"),r=!0}catch(e){}finally{n&&n.close()}return r}toString(){return`Supports:\n browser:${this.getBrowser()}\n version:${this.getVersion()}\n isIOS:${this.isIOS}\n isWebRTCSupported:${this.isWebRTCSupported()}\n isBrowserSupported:${this.isBrowserSupported()}\n isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`}constructor(){this.isIOS="undefined"!=typeof navigator&&["iPad","iPhone","iPod"].includes(navigator.platform),this.supportedBrowsers=["firefox","chrome","safari"],this.minFirefoxVersion=59,this.minChromeVersion=72,this.minSafariVersion=605}},Ve=e=>!e||/^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(e),ke=()=>Math.random().toString(36).slice(2),Ee={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:["turn:eu-0.turn.peerjs.com:3478","turn:us-0.turn.peerjs.com:3478"],username:"peerjs",credential:"peerjsp"}],sdpSemantics:"unified-plan"},_e=new class extends Ce{noop(){}blobToArrayBuffer(e,t){const n=new FileReader;return n.onload=function(e){e.target&&t(e.target.result)},n.readAsArrayBuffer(e),n}binaryStringToArrayBuffer(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=255&e.charCodeAt(n);return t.buffer}isSecure(){return"https:"===location.protocol}constructor(...e){super(...e),this.CLOUD_HOST="0.peerjs.com",this.CLOUD_PORT=443,this.chunkedBrowsers={Chrome:1,chrome:1},this.defaultConfig=Ee,this.browser=we.getBrowser(),this.browserVersion=we.getVersion(),this.pack=p,this.unpack=u,this.supports=function(){const e={browser:we.isBrowserSupported(),webRTC:we.isWebRTCSupported(),audioVideo:!1,data:!1,binaryBlob:!1,reliable:!1};if(!e.webRTC)return e;let t;try{let n;t=new RTCPeerConnection(Ee),e.audioVideo=!0;try{n=t.createDataChannel("_PEERJSTEST",{ordered:!0}),e.data=!0,e.reliable=!!n.ordered;try{n.binaryType="blob",e.binaryBlob=!we.isIOS}catch(e){}}catch(e){}finally{n&&n.close()}}catch(e){}finally{t&&t.close()}return e}(),this.validateId=Ve,this.randomToken=ke}};var Se,Te;(Te=Se||(Se={}))[Te.Disabled=0]="Disabled",Te[Te.Errors=1]="Errors",Te[Te.Warnings=2]="Warnings",Te[Te.All=3]="All";var Re,Pe=new class{get logLevel(){return this._logLevel}set logLevel(e){this._logLevel=e}log(...e){this._logLevel>=3&&this._print(3,...e)}warn(...e){this._logLevel>=2&&this._print(2,...e)}error(...e){this._logLevel>=1&&this._print(1,...e)}setLogFunction(e){this._print=e}_print(e,...t){const n=["PeerJS: ",...t];for(const e in n)n[e]instanceof Error&&(n[e]="("+n[e].name+") "+n[e].message);e>=3?console.log(...n):e>=2?console.warn("WARNING",...n):e>=1&&console.error("ERROR",...n)}constructor(){this._logLevel=0}},Me=Object.prototype.hasOwnProperty,qe="~";function Ie(){}function xe(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function Be(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var i=new xe(n,r||e,o),s=qe?qe+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],i]:e._events[s].push(i):(e._events[s]=i,e._eventsCount++),e}function De(e,t){0==--e._eventsCount?e._events=new Ie:delete e._events[t]}function Oe(){this._events=new Ie,this._eventsCount=0}Object.create&&(Ie.prototype=Object.create(null),(new Ie).__proto__||(qe=!1)),Oe.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)Me.call(e,t)&&n.push(qe?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},Oe.prototype.listeners=function(e){var t=qe?qe+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,i=new Array(o);r<o;r++)i[r]=n[r].fn;return i},Oe.prototype.listenerCount=function(e){var t=qe?qe+e:e,n=this._events[t];return n?n.fn?1:n.length:0},Oe.prototype.emit=function(e,t,n,r,o,i){var s=qe?qe+e:e;if(!this._events[s])return!1;var a,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,r),!0;case 5:return l.fn.call(l.context,t,n,r,o),!0;case 6:return l.fn.call(l.context,t,n,r,o,i),!0}for(c=1,a=new Array(d-1);c<d;c++)a[c-1]=arguments[c];l.fn.apply(l.context,a)}else{var h,u=l.length;for(c=0;c<u;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,r);break;default:if(!a)for(h=1,a=new Array(d-1);h<d;h++)a[h-1]=arguments[h];l[c].fn.apply(l[c].context,a)}}return!0},Oe.prototype.on=function(e,t,n){return Be(this,e,t,n,!1)},Oe.prototype.once=function(e,t,n){return Be(this,e,t,n,!0)},Oe.prototype.removeListener=function(e,t,n,r){var o=qe?qe+e:e;if(!this._events[o])return this;if(!t)return De(this,o),this;var i=this._events[o];if(i.fn)i.fn!==t||r&&!i.once||n&&i.context!==n||De(this,o);else{for(var s=0,a=[],c=i.length;s<c;s++)(i[s].fn!==t||r&&!i[s].once||n&&i[s].context!==n)&&a.push(i[s]);a.length?this._events[o]=1===a.length?a[0]:a:De(this,o)}return this},Oe.prototype.removeAllListeners=function(e){var t;return e?(t=qe?qe+e:e,this._events[t]&&De(this,t)):(this._events=new Ie,this._eventsCount=0),this},Oe.prototype.off=Oe.prototype.removeListener,Oe.prototype.addListener=Oe.prototype.on,Oe.prefixed=qe,Oe.EventEmitter=Oe,Re=Oe;var Ue,je,Le,Ne,Fe,ze,Ke,He,Ye,Je,Ge,Qe,We,Ze,$e,Xe={};be(Xe,"ConnectionType",(()=>Ue)),be(Xe,"PeerErrorType",(()=>Le)),be(Xe,"BaseConnectionErrorType",(()=>Fe)),be(Xe,"DataConnectionErrorType",(()=>Ke)),be(Xe,"SerializationType",(()=>Ye)),be(Xe,"SocketEventType",(()=>Ge)),be(Xe,"ServerMessageType",(()=>We)),(je=Ue||(Ue={})).Data="data",je.Media="media",(Ne=Le||(Le={})).BrowserIncompatible="browser-incompatible",Ne.Disconnected="disconnected",Ne.InvalidID="invalid-id",Ne.InvalidKey="invalid-key",Ne.Network="network",Ne.PeerUnavailable="peer-unavailable",Ne.SslUnavailable="ssl-unavailable",Ne.ServerError="server-error",Ne.SocketError="socket-error",Ne.SocketClosed="socket-closed",Ne.UnavailableID="unavailable-id",Ne.WebRTC="webrtc",(ze=Fe||(Fe={})).NegotiationFailed="negotiation-failed",ze.ConnectionClosed="connection-closed",(He=Ke||(Ke={})).NotOpenYet="not-open-yet",He.MessageToBig="message-too-big",(Je=Ye||(Ye={})).Binary="binary",Je.BinaryUTF8="binary-utf8",Je.JSON="json",Je.None="raw",(Qe=Ge||(Ge={})).Message="message",Qe.Disconnected="disconnected",Qe.Error="error",Qe.Close="close",(Ze=We||(We={})).Heartbeat="HEARTBEAT",Ze.Candidate="CANDIDATE",Ze.Offer="OFFER",Ze.Answer="ANSWER",Ze.Open="OPEN",Ze.Error="ERROR",Ze.IdTaken="ID-TAKEN",Ze.InvalidKey="INVALID-KEY",Ze.Leave="LEAVE",Ze.Expire="EXPIRE",$e=JSON.parse('{"name":"peerjs","version":"1.5.3","keywords":["peerjs","webrtc","p2p","rtc"],"description":"PeerJS client","homepage":"https://peerjs.com","bugs":{"url":"https://github.com/peers/peerjs/issues"},"repository":{"type":"git","url":"https://github.com/peers/peerjs"},"license":"MIT","contributors":["Michelle Bu <michelle@michellebu.com>","afrokick <devbyru@gmail.com>","ericz <really.ez@gmail.com>","Jairo <kidandcat@gmail.com>","Jonas Gloning <34194370+jonasgloning@users.noreply.github.com>","Jairo Caro-Accino Viciana <jairo@galax.be>","Carlos Caballero <carlos.caballero.gonzalez@gmail.com>","hc <hheennrryy@gmail.com>","Muhammad Asif <capripio@gmail.com>","PrashoonB <prashoonbhattacharjee@gmail.com>","Harsh Bardhan Mishra <47351025+HarshCasper@users.noreply.github.com>","akotynski <aleksanderkotbury@gmail.com>","lmb <i@lmb.io>","Jairooo <jairocaro@msn.com>","Moritz Stückler <moritz.stueckler@gmail.com>","Simon <crydotsnakegithub@gmail.com>","Denis Lukov <denismassters@gmail.com>","Philipp Hancke <fippo@andyet.net>","Hans Oksendahl <hansoksendahl@gmail.com>","Jess <jessachandler@gmail.com>","khankuan <khankuan@gmail.com>","DUODVK <kurmanov.work@gmail.com>","XiZhao <kwang1imsa@gmail.com>","Matthias Lohr <matthias@lohr.me>","=frank tree <=frnktrb@googlemail.com>","Andre Eckardt <aeckardt@outlook.com>","Chris Cowan <agentme49@gmail.com>","Alex Chuev <alex@chuev.com>","alxnull <alxnull@e.mail.de>","Yemel Jardi <angel.jardi@gmail.com>","Ben Parnell <benjaminparnell.94@gmail.com>","Benny Lichtner <bennlich@gmail.com>","fresheneesz <bitetrudpublic@gmail.com>","bob.barstead@exaptive.com <bob.barstead@exaptive.com>","chandika <chandika@gmail.com>","emersion <contact@emersion.fr>","Christopher Van <cvan@users.noreply.github.com>","eddieherm <edhermoso@gmail.com>","Eduardo Pinho <enet4mikeenet@gmail.com>","Evandro Zanatta <ezanatta@tray.net.br>","Gardner Bickford <gardner@users.noreply.github.com>","Gian Luca <gianluca.cecchi@cynny.com>","PatrickJS <github@gdi2290.com>","jonnyf <github@jonathanfoss.co.uk>","Hizkia Felix <hizkifw@gmail.com>","Hristo Oskov <hristo.oskov@gmail.com>","Isaac Madwed <i.madwed@gmail.com>","Ilya Konanykhin <ilya.konanykhin@gmail.com>","jasonbarry <jasbarry@me.com>","Jonathan Burke <jonathan.burke.1311@googlemail.com>","Josh Hamit <josh.hamit@gmail.com>","Jordan Austin <jrax86@gmail.com>","Joel Wetzell <jwetzell@yahoo.com>","xizhao <kevin.wang@cloudera.com>","Alberto Torres <kungfoobar@gmail.com>","Jonathan Mayol <mayoljonathan@gmail.com>","Jefferson Felix <me@jsfelix.dev>","Rolf Erik Lekang <me@rolflekang.com>","Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>","Pepijn de Vos <pepijndevos@gmail.com>","JooYoung <qkdlql@naver.com>","Tobias Speicher <rootcommander@gmail.com>","Steve Blaurock <sblaurock@gmail.com>","Kyrylo Shegeda <shegeda@ualberta.ca>","Diwank Singh Tomer <singh@diwank.name>","Sören Balko <Soeren.Balko@gmail.com>","Arpit Solanki <solankiarpit1997@gmail.com>","Yuki Ito <yuki@gnnk.net>","Artur Zayats <zag2art@gmail.com>"],"funding":{"type":"opencollective","url":"https://opencollective.com/peer"},"collective":{"type":"opencollective","url":"https://opencollective.com/peer"},"files":["dist/*"],"sideEffects":["lib/global.ts","lib/supports.ts"],"main":"dist/bundler.cjs","module":"dist/bundler.mjs","browser-minified":"dist/peerjs.min.js","browser-unminified":"dist/peerjs.js","browser-minified-cbor":"dist/serializer.cbor.mjs","browser-minified-msgpack":"dist/serializer.msgpack.mjs","types":"dist/types.d.ts","engines":{"node":">= 14"},"targets":{"types":{"source":"lib/exports.ts"},"main":{"source":"lib/exports.ts","sourceMap":{"inlineSources":true}},"module":{"source":"lib/exports.ts","includeNodeModules":["eventemitter3"],"sourceMap":{"inlineSources":true}},"browser-minified":{"context":"browser","outputFormat":"global","optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-unminified":{"context":"browser","outputFormat":"global","optimize":false,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-minified-cbor":{"context":"browser","outputFormat":"esmodule","isLibrary":true,"optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15"},"source":"lib/dataconnection/StreamConnection/Cbor.ts"},"browser-minified-msgpack":{"context":"browser","outputFormat":"esmodule","isLibrary":true,"optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15"},"source":"lib/dataconnection/StreamConnection/MsgPack.ts"}},"scripts":{"contributors":"git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \\"chore(contributors): update and sort contributors list\\"","check":"tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit","watch":"parcel watch","build":"rm -rf dist && parcel build","prepublishOnly":"npm run build","test":"jest","test:watch":"jest --watch","coverage":"jest --coverage --collectCoverageFrom=\\"./lib/**\\"","format":"prettier --write .","format:check":"prettier --check .","semantic-release":"semantic-release","e2e":"wdio run e2e/wdio.local.conf.ts","e2e:bstack":"wdio run e2e/wdio.bstack.conf.ts"},"devDependencies":{"@parcel/config-default":"^2.9.3","@parcel/packager-ts":"^2.9.3","@parcel/transformer-typescript-tsc":"^2.9.3","@parcel/transformer-typescript-types":"^2.9.3","@semantic-release/changelog":"^6.0.1","@semantic-release/git":"^10.0.1","@swc/core":"^1.3.27","@swc/jest":"^0.2.24","@types/jasmine":"^4.3.4","@wdio/browserstack-service":"^8.11.2","@wdio/cli":"^8.11.2","@wdio/globals":"^8.11.2","@wdio/jasmine-framework":"^8.11.2","@wdio/local-runner":"^8.11.2","@wdio/spec-reporter":"^8.11.2","@wdio/types":"^8.10.4","http-server":"^14.1.1","jest":"^29.3.1","jest-environment-jsdom":"^29.3.1","mock-socket":"^9.0.0","parcel":"^2.9.3","prettier":"^3.0.0","semantic-release":"^21.0.0","ts-node":"^10.9.1","typescript":"^5.0.0","wdio-geckodriver-service":"^5.0.1"},"dependencies":{"@msgpack/msgpack":"^2.8.0","cbor-x":"1.5.4","eventemitter3":"^4.0.7","peerjs-js-binarypack":"^2.1.0","webrtc-adapter":"^8.0.0"},"alias":{"process":false,"buffer":false}}');class et extends Re.EventEmitter{constructor(e,t,n,r,o,i=5e3){super(),this.pingInterval=i,this._disconnected=!0,this._messagesQueue=[];const s=e?"wss://":"ws://";this._baseUrl=s+t+":"+n+r+"peerjs?key="+o}start(e,t){this._id=e;const n=`${this._baseUrl}&id=${e}&token=${t}`;!this._socket&&this._disconnected&&(this._socket=new WebSocket(n+"&version="+$e.version),this._disconnected=!1,this._socket.onmessage=e=>{let t;try{t=JSON.parse(e.data),Pe.log("Server message received:",t)}catch(t){return void Pe.log("Invalid server message",e.data)}this.emit(Ge.Message,t)},this._socket.onclose=e=>{this._disconnected||(Pe.log("Socket closed.",e),this._cleanup(),this._disconnected=!0,this.emit(Ge.Disconnected))},this._socket.onopen=()=>{this._disconnected||(this._sendQueuedMessages(),Pe.log("Socket open"),this._scheduleHeartbeat())})}_scheduleHeartbeat(){this._wsPingTimer=setTimeout((()=>{this._sendHeartbeat()}),this.pingInterval)}_sendHeartbeat(){if(!this._wsOpen())return void Pe.log("Cannot send heartbeat, because socket closed");const e=JSON.stringify({type:We.Heartbeat});this._socket.send(e),this._scheduleHeartbeat()}_wsOpen(){return!!this._socket&&1===this._socket.readyState}_sendQueuedMessages(){const e=[...this._messagesQueue];this._messagesQueue=[];for(const t of e)this.send(t)}send(e){if(this._disconnected)return;if(!this._id)return void this._messagesQueue.push(e);if(!e.type)return void this.emit(Ge.Error,"Invalid message");if(!this._wsOpen())return;const t=JSON.stringify(e);this._socket.send(t)}close(){this._disconnected||(this._cleanup(),this._disconnected=!0)}_cleanup(){this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(),this._socket=void 0),clearTimeout(this._wsPingTimer)}}class tt{constructor(e){this.connection=e}startConnection(e){const t=this._startPeerConnection();if(this.connection.peerConnection=t,this.connection.type===Ue.Media&&e._stream&&this._addTracksToConnection(e._stream,t),e.originator){const n=this.connection,r={ordered:!!e.reliable},o=t.createDataChannel(n.label,r);n._initializeDataChannel(o),this._makeOffer()}else this.handleSDP("OFFER",e.sdp)}_startPeerConnection(){Pe.log("Creating RTCPeerConnection.");const e=new RTCPeerConnection(this.connection.provider.options.config);return this._setupListeners(e),e}_setupListeners(e){const t=this.connection.peer,n=this.connection.connectionId,r=this.connection.type,o=this.connection.provider;Pe.log("Listening for ICE candidates."),e.onicecandidate=e=>{e.candidate&&e.candidate.candidate&&(Pe.log(`Received ICE candidates for ${t}:`,e.candidate),o.socket.send({type:We.Candidate,payload:{candidate:e.candidate,type:r,connectionId:n},dst:t}))},e.oniceconnectionstatechange=()=>{switch(e.iceConnectionState){case"failed":Pe.log("iceConnectionState is failed, closing connections to "+t),this.connection.emitError(Fe.NegotiationFailed,"Negotiation of connection to "+t+" failed."),this.connection.close();break;case"closed":Pe.log("iceConnectionState is closed, closing connections to "+t),this.connection.emitError(Fe.ConnectionClosed,"Connection to "+t+" closed."),this.connection.close();break;case"disconnected":Pe.log("iceConnectionState changed to disconnected on the connection with "+t);break;case"completed":e.onicecandidate=()=>{}}this.connection.emit("iceStateChanged",e.iceConnectionState)},Pe.log("Listening for data channel"),e.ondatachannel=e=>{Pe.log("Received data channel");const r=e.channel;o.getConnection(t,n)._initializeDataChannel(r)},Pe.log("Listening for remote stream"),e.ontrack=e=>{Pe.log("Received remote stream");const r=e.streams[0],i=o.getConnection(t,n);if(i.type===Ue.Media){const e=i;this._addStreamToMediaConnection(r,e)}}}cleanup(){Pe.log("Cleaning up PeerConnection to "+this.connection.peer);const e=this.connection.peerConnection;if(!e)return;this.connection.peerConnection=null,e.onicecandidate=e.oniceconnectionstatechange=e.ondatachannel=e.ontrack=()=>{};const t="closed"!==e.signalingState;let n=!1;const r=this.connection.dataChannel;r&&(n=!!r.readyState&&"closed"!==r.readyState),(t||n)&&e.close()}async _makeOffer(){const e=this.connection.peerConnection,t=this.connection.provider;try{const n=await e.createOffer(this.connection.options.constraints);Pe.log("Created offer."),this.connection.options.sdpTransform&&"function"==typeof this.connection.options.sdpTransform&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{await e.setLocalDescription(n),Pe.log("Set localDescription:",n,`for:${this.connection.peer}`);let r={sdp:n,type:this.connection.type,connectionId:this.connection.connectionId,metadata:this.connection.metadata};if(this.connection.type===Ue.Data){const e=this.connection;r={...r,label:e.label,reliable:e.reliable,serialization:e.serialization}}t.socket.send({type:We.Offer,payload:r,dst:this.connection.peer})}catch(e){"OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer"!=e&&(t.emitError(Le.WebRTC,e),Pe.log("Failed to setLocalDescription, ",e))}}catch(e){t.emitError(Le.WebRTC,e),Pe.log("Failed to createOffer, ",e)}}async _makeAnswer(){const e=this.connection.peerConnection,t=this.connection.provider;try{const n=await e.createAnswer();Pe.log("Created answer."),this.connection.options.sdpTransform&&"function"==typeof this.connection.options.sdpTransform&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{await e.setLocalDescription(n),Pe.log("Set localDescription:",n,`for:${this.connection.peer}`),t.socket.send({type:We.Answer,payload:{sdp:n,type:this.connection.type,connectionId:this.connection.connectionId},dst:this.connection.peer})}catch(e){t.emitError(Le.WebRTC,e),Pe.log("Failed to setLocalDescription, ",e)}}catch(e){t.emitError(Le.WebRTC,e),Pe.log("Failed to create answer, ",e)}}async handleSDP(e,t){t=new RTCSessionDescription(t);const n=this.connection.peerConnection,r=this.connection.provider;Pe.log("Setting remote description",t);const o=this;try{await n.setRemoteDescription(t),Pe.log(`Set remoteDescription:${e} for:${this.connection.peer}`),"OFFER"===e&&await o._makeAnswer()}catch(e){r.emitError(Le.WebRTC,e),Pe.log("Failed to setRemoteDescription, ",e)}}async handleCandidate(e){Pe.log("handleCandidate:",e);try{await this.connection.peerConnection.addIceCandidate(e),Pe.log(`Added ICE candidate for:${this.connection.peer}`)}catch(e){this.connection.provider.emitError(Le.WebRTC,e),Pe.log("Failed to handleCandidate, ",e)}}_addTracksToConnection(e,t){if(Pe.log(`add tracks from stream ${e.id} to peer connection`),!t.addTrack)return Pe.error("Your browser does't support RTCPeerConnection#addTrack. Ignored.");e.getTracks().forEach((n=>{t.addTrack(n,e)}))}_addStreamToMediaConnection(e,t){Pe.log(`add stream ${e.id} to media connection ${t.connectionId}`),t.addStream(e)}}class nt extends Re.EventEmitter{emitError(e,t){Pe.error("Error:",t),this.emit("error",new rt(`${e}`,t))}}class rt extends Error{constructor(e,t){"string"==typeof t?super(t):(super(),Object.assign(this,t)),this.type=e}}class ot extends nt{get open(){return this._open}constructor(e,t,n){super(),this.peer=e,this.provider=t,this.options=n,this._open=!1,this.metadata=n.metadata}}class it extends ot{static#e=this.ID_PREFIX="mc_";get type(){return Ue.Media}get localStream(){return this._localStream}get remoteStream(){return this._remoteStream}constructor(e,t,n){super(e,t,n),this._localStream=this.options._stream,this.connectionId=this.options.connectionId||it.ID_PREFIX+_e.randomToken(),this._negotiator=new tt(this),this._localStream&&this._negotiator.startConnection({_stream:this._localStream,originator:!0})}_initializeDataChannel(e){this.dataChannel=e,this.dataChannel.onopen=()=>{Pe.log(`DC#${this.connectionId} dc connection success`),this.emit("willCloseOnRemote")},this.dataChannel.onclose=()=>{Pe.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}addStream(e){Pe.log("Receiving stream",e),this._remoteStream=e,super.emit("stream",e)}handleMessage(e){const t=e.type,n=e.payload;switch(e.type){case We.Answer:this._negotiator.handleSDP(t,n.sdp),this._open=!0;break;case We.Candidate:this._negotiator.handleCandidate(n.candidate);break;default:Pe.warn(`Unrecognized message type:${t} from peer:${this.peer}`)}}answer(e,t={}){if(this._localStream)return void Pe.warn("Local stream already exists on this MediaConnection. Are you answering a call twice?");this._localStream=e,t&&t.sdpTransform&&(this.options.sdpTransform=t.sdpTransform),this._negotiator.startConnection({...this.options._payload,_stream:e});const n=this.provider._getMessages(this.connectionId);for(const e of n)this.handleMessage(e);this._open=!0}close(){this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this._localStream=null,this._remoteStream=null,this.provider&&(this.provider._removeConnection(this),this.provider=null),this.options&&this.options._stream&&(this.options._stream=null),this.open&&(this._open=!1,super.emit("close"))}}class st{constructor(e){this._options=e}_buildRequest(e){const t=this._options.secure?"https":"http",{host:n,port:r,path:o,key:i}=this._options,s=new URL(`${t}://${n}:${r}${o}${i}/${e}`);return s.searchParams.set("ts",`${Date.now()}${Math.random()}`),s.searchParams.set("version",$e.version),fetch(s.href,{referrerPolicy:this._options.referrerPolicy})}async retrieveId(){try{const e=await this._buildRequest("id");if(200!==e.status)throw new Error(`Error. Status:${e.status}`);return e.text()}catch(e){Pe.error("Error retrieving ID",e);let t="";throw"/"===this._options.path&&this._options.host!==_e.CLOUD_HOST&&(t=" If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."),new Error("Could not get an ID from the server."+t)}}async listAllPeers(){try{const e=await this._buildRequest("peers");if(200!==e.status){if(401===e.status){let e="";throw e=this._options.host===_e.CLOUD_HOST?"It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key.":"You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.",new Error("It doesn't look like you have permission to list peers IDs. "+e)}throw new Error(`Error. Status:${e.status}`)}return e.json()}catch(e){throw Pe.error("Error retrieving list peers",e),new Error("Could not get list peers from the server."+e)}}}class at extends ot{static#e=this.ID_PREFIX="dc_";static#t=this.MAX_BUFFERED_AMOUNT=8388608;get type(){return Ue.Data}constructor(e,t,n){super(e,t,n),this.connectionId=this.options.connectionId||at.ID_PREFIX+ke(),this.label=this.options.label||this.connectionId,this.reliable=!!this.options.reliable,this._negotiator=new tt(this),this._negotiator.startConnection(this.options._payload||{originator:!0,reliable:this.reliable})}_initializeDataChannel(e){this.dataChannel=e,this.dataChannel.onopen=()=>{Pe.log(`DC#${this.connectionId} dc connection success`),this._open=!0,this.emit("open")},this.dataChannel.onmessage=e=>{Pe.log(`DC#${this.connectionId} dc onmessage:`,e.data)},this.dataChannel.onclose=()=>{Pe.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}close(e){e?.flush?this.send({__peerData:{type:"close"}}):(this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this.provider&&(this.provider._removeConnection(this),this.provider=null),this.dataChannel&&(this.dataChannel.onopen=null,this.dataChannel.onmessage=null,this.dataChannel.onclose=null,this.dataChannel=null),this.open&&(this._open=!1,super.emit("close")))}send(e,t=!1){if(this.open)return this._send(e,t);this.emitError(Ke.NotOpenYet,"Connection is not open. You should listen for the `open` event before sending messages.")}async handleMessage(e){const t=e.payload;switch(e.type){case We.Answer:await this._negotiator.handleSDP(e.type,t.sdp);break;case We.Candidate:await this._negotiator.handleCandidate(t.candidate);break;default:Pe.warn("Unrecognized message type:",e.type,"from peer:",this.peer)}}}class ct extends at{get bufferSize(){return this._bufferSize}_initializeDataChannel(e){super._initializeDataChannel(e),this.dataChannel.binaryType="arraybuffer",this.dataChannel.addEventListener("message",(e=>this._handleDataMessage(e)))}_bufferedSend(e){!this._buffering&&this._trySend(e)||(this._buffer.push(e),this._bufferSize=this._buffer.length)}_trySend(e){if(!this.open)return!1;if(this.dataChannel.bufferedAmount>at.MAX_BUFFERED_AMOUNT)return this._buffering=!0,setTimeout((()=>{this._buffering=!1,this._tryBuffer()}),50),!1;try{this.dataChannel.send(e)}catch(e){return Pe.error(`DC#:${this.connectionId} Error when sending:`,e),this._buffering=!0,this.close(),!1}return!0}_tryBuffer(){if(!this.open)return;if(0===this._buffer.length)return;const e=this._buffer[0];this._trySend(e)&&(this._buffer.shift(),this._bufferSize=this._buffer.length,this._tryBuffer())}close(e){e?.flush?this.send({__peerData:{type:"close"}}):(this._buffer=[],this._bufferSize=0,super.close())}constructor(...e){super(...e),this._buffer=[],this._bufferSize=0,this._buffering=!1}}class lt extends ct{close(e){super.close(e),this._chunkedData={}}constructor(e,t,n){super(e,t,n),this.chunker=new Ce,this.serialization=Ye.Binary,this._chunkedData={}}_handleDataMessage({data:e}){const t=u(e),n=t.__peerData;if(n)return"close"===n.type?void this.close():void this._handleChunk(t);this.emit("data",t)}_handleChunk(e){const t=e.__peerData,n=this._chunkedData[t]||{data:[],count:0,total:e.total};if(n.data[e.n]=new Uint8Array(e.data),n.count++,this._chunkedData[t]=n,n.total===n.count){delete this._chunkedData[t];const e=function(e){let t=0;for(const n of e)t+=n.byteLength;const n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.byteLength;return n}(n.data);this._handleDataMessage({data:e})}}_send(e,t){const n=p(e);if(n instanceof Promise)return this._send_blob(n);!t&&n.byteLength>this.chunker.chunkedMTU?this._sendChunks(n):this._bufferedSend(n)}async _send_blob(e){const t=await e;t.byteLength>this.chunker.chunkedMTU?this._sendChunks(t):this._bufferedSend(t)}_sendChunks(e){const t=this.chunker.chunk(e);Pe.log(`DC#${this.connectionId} Try to send ${t.length} chunks...`);for(const e of t)this.send(e,!0)}}class dt extends ct{_handleDataMessage({data:e}){super.emit("data",e)}_send(e,t){this._bufferedSend(e)}constructor(...e){super(...e),this.serialization=Ye.None}}class ht extends ct{_handleDataMessage({data:e}){const t=this.parse(this.decoder.decode(e)),n=t.__peerData;n&&"close"===n.type?this.close():this.emit("data",t)}_send(e,t){const n=this.encoder.encode(this.stringify(e));n.byteLength>=_e.chunkedMTU?this.emitError(Ke.MessageToBig,"Message too big for JSON channel"):this._bufferedSend(n)}constructor(...e){super(...e),this.serialization=Ye.JSON,this.encoder=new TextEncoder,this.decoder=new TextDecoder,this.stringify=JSON.stringify,this.parse=JSON.parse}}class ut extends nt{static#e=this.DEFAULT_KEY="peerjs";get id(){return this._id}get options(){return this._options}get open(){return this._open}get socket(){return this._socket}get connections(){const e=Object.create(null);for(const[t,n]of this._connections)e[t]=n;return e}get destroyed(){return this._destroyed}get disconnected(){return this._disconnected}constructor(e,t){let n;super(),this._serializers={raw:dt,json:ht,binary:lt,"binary-utf8":lt,default:lt},this._id=null,this._lastServerId=null,this._destroyed=!1,this._disconnected=!1,this._open=!1,this._connections=new Map,this._lostMessages=new Map,e&&e.constructor==Object?t=e:e&&(n=e.toString()),t={debug:0,host:_e.CLOUD_HOST,port:_e.CLOUD_PORT,path:"/",key:ut.DEFAULT_KEY,token:_e.randomToken(),config:_e.defaultConfig,referrerPolicy:"strict-origin-when-cross-origin",serializers:{},...t},this._options=t,this._serializers={...this._serializers,...this.options.serializers},"/"===this._options.host&&(this._options.host=window.location.hostname),this._options.path&&("/"!==this._options.path[0]&&(this._options.path="/"+this._options.path),"/"!==this._options.path[this._options.path.length-1]&&(this._options.path+="/")),void 0===this._options.secure&&this._options.host!==_e.CLOUD_HOST?this._options.secure=_e.isSecure():this._options.host==_e.CLOUD_HOST&&(this._options.secure=!0),this._options.logFunction&&Pe.setLogFunction(this._options.logFunction),Pe.logLevel=this._options.debug||0,this._api=new st(t),this._socket=this._createServerConnection(),_e.supports.audioVideo||_e.supports.data?!n||_e.validateId(n)?n?this._initialize(n):this._api.retrieveId().then((e=>this._initialize(e))).catch((e=>this._abort(Le.ServerError,e))):this._delayedAbort(Le.InvalidID,`ID "${n}" is invalid`):this._delayedAbort(Le.BrowserIncompatible,"The current browser does not support WebRTC")}_createServerConnection(){const e=new et(this._options.secure,this._options.host,this._options.port,this._options.path,this._options.key,this._options.pingInterval);return e.on(Ge.Message,(e=>{this._handleMessage(e)})),e.on(Ge.Error,(e=>{this._abort(Le.SocketError,e)})),e.on(Ge.Disconnected,(()=>{this.disconnected||(this.emitError(Le.Network,"Lost connection to server."),this.disconnect())})),e.on(Ge.Close,(()=>{this.disconnected||this._abort(Le.SocketClosed,"Underlying socket is already closed.")})),e}_initialize(e){this._id=e,this.socket.start(e,this._options.token)}_handleMessage(e){const t=e.type,n=e.payload,r=e.src;switch(t){case We.Open:this._lastServerId=this.id,this._open=!0,this.emit("open",this.id);break;case We.Error:this._abort(Le.ServerError,n.msg);break;case We.IdTaken:this._abort(Le.UnavailableID,`ID "${this.id}" is taken`);break;case We.InvalidKey:this._abort(Le.InvalidKey,`API KEY "${this._options.key}" is invalid`);break;case We.Leave:Pe.log(`Received leave message from ${r}`),this._cleanupPeer(r),this._connections.delete(r);break;case We.Expire:this.emitError(Le.PeerUnavailable,`Could not connect to peer ${r}`);break;case We.Offer:{const e=n.connectionId;let t=this.getConnection(r,e);if(t&&(t.close(),Pe.warn(`Offer received for existing Connection ID:${e}`)),n.type===Ue.Media){const o=new it(r,this,{connectionId:e,_payload:n,metadata:n.metadata});t=o,this._addConnection(r,t),this.emit("call",o)}else{if(n.type!==Ue.Data)return void Pe.warn(`Received malformed connection type:${n.type}`);{const o=new this._serializers[n.serialization](r,this,{connectionId:e,_payload:n,metadata:n.metadata,label:n.label,serialization:n.serialization,reliable:n.reliable});t=o,this._addConnection(r,t),this.emit("connection",o)}}const o=this._getMessages(e);for(const e of o)t.handleMessage(e);break}default:{if(!n)return void Pe.warn(`You received a malformed message from ${r} of type ${t}`);const o=n.connectionId,i=this.getConnection(r,o);i&&i.peerConnection?i.handleMessage(e):o?this._storeMessage(o,e):Pe.warn("You received an unrecognized message:",e);break}}}_storeMessage(e,t){this._lostMessages.has(e)||this._lostMessages.set(e,[]),this._lostMessages.get(e).push(t)}_getMessages(e){const t=this._lostMessages.get(e);return t?(this._lostMessages.delete(e),t):[]}connect(e,t={}){if(t={serialization:"default",...t},this.disconnected)return Pe.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available."),void this.emitError(Le.Disconnected,"Cannot connect to new Peer after disconnecting from server.");const n=new this._serializers[t.serialization](e,this,t);return this._addConnection(e,n),n}call(e,t,n={}){if(this.disconnected)return Pe.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect."),void this.emitError(Le.Disconnected,"Cannot connect to new Peer after disconnecting from server.");if(!t)return void Pe.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");const r=new it(e,this,{...n,_stream:t});return this._addConnection(e,r),r}_addConnection(e,t){Pe.log(`add connection ${t.type}:${t.connectionId} to peerId:${e}`),this._connections.has(e)||this._connections.set(e,[]),this._connections.get(e).push(t)}_removeConnection(e){const t=this._connections.get(e.peer);if(t){const n=t.indexOf(e);-1!==n&&t.splice(n,1)}this._lostMessages.delete(e.connectionId)}getConnection(e,t){const n=this._connections.get(e);if(!n)return null;for(const e of n)if(e.connectionId===t)return e;return null}_delayedAbort(e,t){setTimeout((()=>{this._abort(e,t)}),0)}_abort(e,t){Pe.error("Aborting!"),this.emitError(e,t),this._lastServerId?this.disconnect():this.destroy()}destroy(){this.destroyed||(Pe.log(`Destroy peer with ID:${this.id}`),this.disconnect(),this._cleanup(),this._destroyed=!0,this.emit("close"))}_cleanup(){for(const e of this._connections.keys())this._cleanupPeer(e),this._connections.delete(e);this.socket.removeAllListeners()}_cleanupPeer(e){const t=this._connections.get(e);if(t)for(const e of t)e.close()}disconnect(){if(this.disconnected)return;const e=this.id;Pe.log(`Disconnect peer with ID:${e}`),this._disconnected=!0,this._open=!1,this.socket.close(),this._lastServerId=e,this._id=null,this.emit("disconnected",e)}reconnect(){if(this.disconnected&&!this.destroyed)Pe.log(`Attempting reconnection to server with ID ${this._lastServerId}`),this._disconnected=!1,this._initialize(this._lastServerId);else{if(this.destroyed)throw new Error("This peer cannot reconnect to the server. It has already been destroyed.");if(this.disconnected||this.open)throw new Error(`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`);Pe.error("In a hurry? We're still trying to make the initial connection!")}}listAllPeers(e=(e=>{})){this._api.listAllPeers().then((t=>e(t))).catch((e=>this._abort(Le.ServerError,e)))}}let pt;Symbol.for(null),pt="https://keypad.website/keypad?";class ft{constructor(e={keypadUrl:pt,targetElementId:null,onErrorReconnectMessage:"Connection lost. Please reconnect..."}){this.onErrorReconnectMessage=e.onErrorReconnectMessage,this.conn=null,this.lastPeerId=null,this.keypadUrl=e.hasOwnProperty("keypadUrl")?e.keypadUrl:pt,this.targetElement=e.hasOwnProperty("targetElementId")?e.targetElementId:null,this.ttd=e.hasOwnProperty("ttd")?e.hasOwnProperty("ttd"):6e4,this.heartbeatIntervalMs=e.hasOwnProperty("heartRate")?e.hasOwnProperty("heartRate"):1e4,this.lastHeartbeat=performance.now(),this.heartBeatInterval=void 0,this.heartCheckInterval=void 0,this.peer=new ut(null,{pingInterval:this.heartbeatIntervalMs,debug:2,config:{iceServers:[{urls:"stun:stun.relay.metered.ca:80"},{urls:"turn:global.relay.metered.ca:80",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"},{urls:"turn:global.relay.metered.ca:80?transport=tcp",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"},{urls:"turn:global.relay.metered.ca:443",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"},{urls:"turns:global.relay.metered.ca:443?transport=tcp",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"}]}}),this.alphabet=null,this.font=null,this.keypressFeedbackSound="data:audio/mpeg;base64,//uQZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAALAAATlgAXFxcXFxcXFxcuLi4uLi4uLi5FRUVFRUVFRUVdXV1dXV1dXV10dHR0dHR0dHSLi4uLi4uLi4uioqKioqKioqK6urq6urq6urrR0dHR0dHR0dHo6Ojo6Ojo6Oj///////////8AAAA5TEFNRTMuMTAwAaoAAAAALgYAABSAJAZbTgAAgAAAE5YfafL/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//uQZAAAA0YVyhVvQAAAAA0goAABGfWdITn6gAgAADSDAAAAAEWjAwMwMDMFBzCQsw8PMPCwUDgkNMpNzXEoSUTP3s6nJPd4z28k62JNdIwIUHj3nvynRempMmLAo/tff9/3IchyHIch/IxY3SUmG86enD4Pg+fgmfEAIQQcsP+oH//E7/+Ud/1HP/B9AAABMCFFFAAAwDgCyMCVAgQcBQmARAHw0AOGAUgFJgUoL8YKsEvqzGA1APJQAIGBNgDpoBRvQYb6EIGhIkmJg1QA0aH0H4GDBgJ4G55UBpM1AGgUG0wAgOBIUAYJGoGFQ4AkHitxzRSocGMwDYYCwJAWAICgBD8jhwlEqBNsMiAkCBpQY2FxpG61opmucDLrjKi6Fmk5oK9PWVh1DNFM2IaRH/q8mTQgTF4sk0bnv//zEuqRMjYycuuj///5wxZzIvLSMTUxYyZL////86ZBqh4D+QUIABcwBQBLMCmAeTA4wJowO8E2DAeYwQ8CWMDLBHDB1QpIxscoSMwBQJj/WZBA3O4mFMHIAGzAKAVgwmcG8OIV//uSZCIN9VQ4wgd/gAAAAA0g4AABD+S/Di5+qgAAADSAAAAEEzcNTC4yM0m41SLDHAJLSggBKwtKRwb6+IBi4ctbepDskh2KmAgA16NTNrON66ptO40mNa9ayZHVx7zmGPHktZb7vP9xLn4fr+9jeO//8P+z39///9T/////t+d6vf1+c6fP9Hv5cxg4aA4TgkGIYmLbYHGAxaCjHwlM0lwBC4zGwzVG+MFnGoTY8sn0w1MSHA09vAM8ssDCSYAykIABmeCI4AKDMDIRfGbFAjWE8h+BfIEfBoFCTQJUcA5ZIrQDjzQ+gWzxsjDLtE4s46kxjHZZom2SXfyj6uadvNvb0ee/3dX//01YAVKw/FoW3hDrwUDTAwDMVigy8rTYaRNKug2tzzBwxnAx/DOuMhFECAOxWsDO6kAwkdQFH0BiwIgYlAwCgdAwiZBBI1kCC5JcWwCQWMQ/JQnkVFkOVN8oku8yDkjbMiry+2rrLvW/MvT53q/yv+n2///dywQL8DRgOgsrBBi0LGcngZrCZgYxGEAoZ+IplUdGJ1ifHVRh5v/7kmRMDPOhJ0MTn6qAAAANIAAAARDEiQhOf0pAAAA0gAAABAdCcEnCwmbqA1JhbIFwYKEAUGAXgOJo45oXAyjT0MinMgXM2UNoNGyYeLN0ENORMgQC5EYAJlr4Z3L3lgaHG5VO0lWX1q92J3t9sWM+bu9/fe8/VT/L+zq9v+zr9/+//8r71SAAAA9tq0AA1hzXXdxmzgPWzJyU20wh4EDDUSzWI4x4rgMGBd+IImDoAiEBAMCJn2HpqAlRpDIZhbxxp2ASQcGVRJG6RC4xmaZHiYlYPKGGdEGJjIoa4YtICXGHRhGJg2QMkYJADRGfCMTZE5+4ze1gMF1k163DfQrNgh83G3zIYoMdC4wEOwcrzMxMMam0AlYxkKzOgqMDhUuUBgYIQOWiEgwYHAogAwXBAYHAKAVVm0ZW2J1Wno9taaAzuOSF34AjMUjdBOy+pjbpKCil9TG/hOWRkUkxad2pAAAGFlrIADgyUqh1syPqzGQRoUAEDDoFgKMDw7MVA2NJ1sKHaMVghBwfGAgOgJR0migMTBUODDQezBI5jGNQzXD/+5JkjYD20jDN67/kngAADSAAAAEXjN0dTv9SAAAANIAAAASwgEb7HKvHZpiFAM0Bgs8wPYBNNi8MMfMIKRGRlOETOErM6wMGpBTQHTjJEQaKEBoKmlLXGizd5Ax5W2Byh0X6R9YRJ2rQFSKzgZDB0DQDKJHDr/MoZRDsaleN+vVhpoVqzczvZYx+Hdbx1/MuWOZb///Vr1YX93I/6P9KAWAQE8pFZWkOCuFAO0EEAThJ4OYwBQMHIJgUUVrHHRwaURUkZ4YX6MYvO6EDvpgTJY6aVeR7mGcgzBgfQE2YCuA5H9adJQKBCAhAqA53/aS/bk0T1zjIhpmcjVumpqS/ZZ1v6TuOXxF1+49x5d5Knl/Luvw7ua/8P/DdWT+dOkhD5zhvqb0db/93/5AQAQsF3glyO4MAysKti2BGAAdE0L31C4EMAhEAgAu28hgMOFHwEgaYACAFHpko0GM0ia2Yx0/wmKECIhpq5poYK2CTmAQAMhgAQBKYAoARFUAhUQbKhIMAxAFG3eFpLns4drJbaY9+pDVDPZ/QKtLHKNCpsTA6//uSZIEE9GAuRhNfzIAAAA0gAAABEnjLFK588sAAADSAAAAEdTXMSKxfop3DPM5RNbal/EvU7p6/Ie/t93Z1v6OqEAzmEmBoIQcGTCwGMCghPwvOQgUwEbKMZBgNAwOPZioUiMIl/ACXRGoREDB0clmTLApMiq4x2azRlmMM7NijivBEQxUIGvMGdAsjAxgHcDSxgRZANSYAOAgYs0FXAnwaIl43xAcuEVEogHIiFKRHEuREzUfFfSOoEgRyTk8Isema00Fl0gzqujqL/ZT3Krfoq7r1H/AvWzp/yXv/3f/oA0GjFwIZS19BgKAsiCDxuUBAMZ8D6zIZAIFMChweF7GFbQAITYoiSSSvMRBoUJ5l4RGVzOa2hhmAr6mbNSaYcYlxgqAvmAaCEYDAE6yBgAFIpAsGADyaXw+/MSnONGVBjhuNW+/dbYnEQqJJNwIgainmo0TB3Ofkus/yHs5P3dnW/+ryf+QqTEFNRTMuMTAwqqqqqqqqqqqqAABjBgrdYuwIwHSioNCCFkYbBZpMaoVDIRMDhB326ByJkJgYuGdC4P/7kmSwDPT4N0MLn6SAAAANIAAAARDIpRJOePLAAAA0gAAABDAGIA0YOGJhoVGKx+YbQxu2mmHbCT5rII6wYW2ASgYFJDgHYBAIpMARM6WcpEFALUjnWoXbkbwf8AGkx+2FugJGw/l2gIK+vverzfFet8Re/kur09f/f/u6f/1GySAhOMFigxOOnJAAdLIIqmTCCa9ahACTDANMqFMLAIQjQw0EVbjH4aOuN8OAgFCBn0sS0GpU0IAjUJ3MCoPaDTTB4AwnIE7MGrBCjAcgE836g5kUx6AtCKkjKElvKarxnFzLOlKRocalMtnabKM6hpYW5TSrdLe1Kop3e+ZWtymHt445fv9Vfyy/Hn5Xv///v1bXt4M9Z7+o729b+K/4b6pMQU1FMy4xMDCqqqqqqqqqqqoAArJ2QY8DbERAFjDyZMdBUwYDwIEDHduP9KsmPhhMKGHR0ZzTg0NTB4kGhkYqgZ2MZGQRUYNHoGXBgA4HWYEoBbGCNgvJhVgV8ZJaR2GsQJb5g5gRMYD+BQmAhADQNAVRoA4EQAOXUBwAkYBsAVr/+5Jk0w/0GynDE59coAAADSAAAAEULMkADn9SAAAANIAAAATsdabY4ta/VUMV5DuqzWuVs3pSSLmoKyJqFQGpUi+IAy2PdQm57ZU/m8oR6dDu/KvzehHpx5O/KkuvNN/o39SX9fblC3lusxd7wMr2zmhS+YLExsQBmRRQGKE6HITacxM2hgy8ATH50NVDsxSlQMPDL4bNJAg7HUAIBQcOjCRbMBtAdDAAACkwB4EWMCzCGTGll+U7EVMUMoPCSjDHgWcwaECqP+mza0I1QpATkY0Sm3lwsB0q0C3xd6GWuF4jEAeiqacWb5bdVxJbap8YzlnZWta3hLq34RaGf5hj3/pZ3HveY/3ku7/5a/7Wf//9/92aGoPcO9Z3nep/9H+mTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgBOZ2IMSwdMDATGQhDC4ZXKRj8wGMxub0k5717G//uSZPaO9axfvJOfPEAAAA0gAAABFsja3g5/cEAAADSAAAAELQSBSmZKFYVCYsIjBA1MCgYxWdDkBzMRAEwgQDIIBMgFIzWQTUjgPK3c02lpDWsiqM0Ih0w6QzjB4BzMDcD4wFgEzAfAeQQs8TcsNydp+n5wlq8UapFM2auMpwfZrv475ll25Y5ll3mtzMuwCWO8Ocqe/lndv+j/b1f6/9QATU2x0wCPIAYTCoUHAxhIYX2MXBDC24mvTCAedLotPVa09tEZwuBrSZmkoXXBgkY2SmmPBjQkpGrwfaYZQGhQDcPACJNPw90xLlijCVZWUifsophFk7ww7v7fGk6gE/vB+l0VNkSFwo0bYXJC6gyQQEiwvlDzbHAhHpZLIQbJ1UxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUASWNHVvyNdkdcuCnNLhmA8HuRIHbo/1AhfJ9JZVctla8gMQwpDT96eCGcDAGg8qCCIBce3D8P35RGMZXL8gcmxBByacE9hDD09hNohydtFshlp7EeIe9aMiMe/P/7kmTNjPTPJLaLvPDwAAANIAAAAQ/obuBt+FJAAAA0gAAABEchD3bEIchgekEBmZYRmyPAM3j4DJ8fhgfmeIjtD4HTwPAiPgNGB+BAAjtCABG8AwMvgwAEo5cSIfzt69YYDMdo9RxSsKtgIcom1PMylIK9rWkMkKzctAIIkqXCTqLYAoUrBCJrAlHzJipaMuaPvWraLnsMj6ExUtGUZ0ZRnJ7Q6PrnS7VrsC55kSlRyTYjonPkkybMT2AyVMrbMrYly661bq13Fz0K2JlbEdH1zk9ocnsB09CcutLYmj71p7Q6PWDI+hMXWjJ06Mozk9odH0BkfQmLrRlGdE6M5JrhKJzZKPoSSephKVHJlGcmLhkZXJJ9CYnrRkqSmMZybKpMQU1FMy4xMDCqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+5Jk7QT0dTc4kxw0ogAADSAAAAEZOaLm5+WQSAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqglFJEIRoPjA2MDYyViqViCJxDHghjyPQ4ioUiYKw4EMzYZXAooDEE1y2zRpTu00acWUWWcacaUWYeWcacJAhYgWJFCRQGIFiBZZRZRZlw7s7PG////s7M7Ozs7M5xpRZR5RRpxZRZh5RRZRbRC1NP///9PKqqq4NNNNRKqJXTTTTVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//uSZIIP9BFGHYksMlIAAA0gAAABAAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ=="}displayUpdate=(e,t=!1)=>{if(document.getElementById(this.targetElement)){const n=document.getElementById(this.targetElement);if(t){const t=n.innerText;n.innerText=e+"\n"+t}else n.innerText=e}else console.log("MESSAGE: ",e)};onPeerDisconnected=()=>{this.displayUpdate(this.onErrorReconnectMessage);try{this.peer.id=this.lastPeerId,this.peer._lastServerId=this.lastPeerId,this.peer.reconnect()}catch(e){console.log(e)}};onPeerClose=()=>{this.displayUpdate("Connection closed"),this.conn=null};onPeerError=e=>{this.displayUpdate(e),alert(""+e)};parseParams=e=>{const t=e.get("font");return{alphabet:this.checkAlphabet(decodeURIComponent(e.get("alphabet")).split(",")),font:t,peerId:e.get("peerID")}};queryStringFromObject=e=>Object.keys(e).map((t=>t+"="+encodeURIComponent(e[t]))).join("&");checkAlphabet=e=>{let t;Array.isArray(e)?t=e:"string"==typeof e?t="SPACE"===e.toUpperCase()||"RETURN"==e.toUpperCase()?[e]:e.split(""):(console.error("Error! Alphabet must be specified as an array of symbols, including 'RETURN', 'SPACE'"),t=[]);const n=[...new Set(t)];return"SPACE"in n&&(n=mt(n,"SPACE")),"RETURN"in n&&(n=mt(n,"RETURN")),n};_setupHeartBeatIntervals=()=>{this.heartBeatInterval=setInterval((()=>this.conn?.send({message:"Heartbeat"})),this.heartbeatIntervalMs),this.heartCheckInterval=setInterval((()=>{performance.now()-this.lastHeartbeat>this.ttd&&(console.log("Closing connection due to lack of heartbeat."),this.conn?.close(),this.conn=void 0,clearInterval(this.heartBeatInterval),clearInterval(this.heartCheckInterval),this.heartBeatInterval=void 0,this.heartCheckInterval=void 0)}),this.ttd)}}const mt=(e,t)=>[...e.slice(0,e.indexOf(t)),...e.slice(e.indexOf(t)+1),t];class gt extends ft{constructor(e={keypadUrl:pt,targetElementId:null,visualResponseFeedback:!1}){super({keypadUrl:e.keypadUrl,targetElementId:e.targetElementId}),this.startTime=Date.now(),this.receiverPeerId=null,this.controlButtons=e.controlButtons??["SPACE","RETURN"];const t=this.parseParams(new URLSearchParams(window.location.search));this.receiverPeerId=t.peerId,this.pressFeedback=new Audio(this.keypressFeedbackSound),this.peer.on("open",this.#n),this.peer.on("connection",this.#r),this.peer.on("disconnected",this.onPeerDisconnected),this.peer.on("close",this.onPeerClose),this.peer.on("error",this.onPeerError),this.#o()}#n=e=>{null===this.peer.id?(console.log("Received null id from peer open"),this.peer.id=this.lastPeerId):this.lastPeerId=this.peer.id,this.#i()};#r=e=>{e.on("open",(function(){e.send({message:"Rejected",info:"Sender does not accept incoming connections"}),setTimeout((function(){e.close()}),500)}))};#s=e=>{switch(console.log("Data received: ",e),e.message){case"KeypadParameters":this.alphabet=e.alphabet,this.font=e.font,this.controlButtons=e.controlButtons,this.onErrorReconnectMessage=e.onErrorReconnectMessage,this.#a();break;case"UpdateHeader":document.getElementById("keypad-header").innerText=e.headerContent,document.getElementById("keypad-header").style.display=""===e.headerContent?"none":"block",this.headerMessage=e.headerContent,this.#a();break;case"UpdateFooter":document.getElementById("keypad-footer").innerText=e.headerContent,this.footerMessage=e.headerContent,this.#a();break;case"Update":e.hasOwnProperty("alphabet")||e.hasOwnProperty("font")||e.hasOwnProperty("controlButtons")?(this.alphabet=e.alphabet??this.alphabet,this.font=e.font??this.font,this.controlButtons=e.controlButtons??this.controlButtons):console.error('Error in parsing data received! Must set "alphabet" or "font" properties'),this.#a();break;case"Disable":e.hasOwnProperty("keys")?this.disableKeys(e.keys):this.disableKeys();break;case"Enable":e.hasOwnProperty("keys")?this.enableKeys(e.keys):this.enableKeys();break;case"Heartbeat":this.lastHeartbeat=performance.now();break;default:console.log("Message type: ",e.message)}};#i=()=>{this.conn&&this.conn.close(),this.conn=this.peer.connect(this.receiverPeerId,{reliable:!0}),console.log("Connection: ",this.conn),this.conn.on("open",this.#c),this.conn.on("data",this.#s),this.conn.on("close",(()=>console.log("Connection closed")))};#c=()=>{this.conn.send({message:"Handshake"}),this._setupHeartBeatIntervals()};#o=()=>{const e=document.createElement("div");e.setAttribute("id","keypad");const t=document.createElement("h1");t.setAttribute("id","keypad-header"),t.classList.add("noselect");const n=document.createElement("div");n.setAttribute("id","keypad-keys"),n.classList.add("keys");const r=document.createElement("div");r.setAttribute("id","keypad-control-keys"),r.classList.add("keys");const o=document.createElement("div");o.setAttribute("id","keypad-footer"),e.appendChild(t),n.appendChild(r),e.appendChild(n),e.appendChild(o),document.getElementById(this.targetElement)?(console.log("Specified target element successfully used."),document.getElementById(this.targetElement).appendChild(e)):(console.log("No target element used."),document.getElementsByTagName("main")[0].appendChild(e)),window.onbeforeunload=()=>{this.conn?.close(),console.log("closing connection on page unload.")},window.onvisibilitychange=()=>{this.conn?.close(),console.log("closing connection on page unload.")},window.onresize=()=>{console.count("Window resized."),s(this.alphabet?.length)},window.visualViewport&&(window.visualViewport.onresize=()=>{console.count("VisualViewport resized."),s(this.alphabet?.length)})};#a=()=>{const e=e=>{const t={message:"Keypress",sendId:this.peer.id,recvId:this.conn.peer,response:e.id,timeSent:Date.now(),elapsedStartToSend:Date.now()-window.startTime};this.conn&&this.conn.open?(this.conn.send(t),console.log("Keypress sent: ",t)):console.log("Connection is closed"),this.visualResponseFeedback&&this.visualFeedbackThenReset(alphabet,font)},t=t=>{let n=document.createElement("button");n.id=t,n.className="response-button",n.style.fontFamily=this.font,n.style.visibility="hidden";const r=document.getElementById("feedbackAudio");n.addEventListener("touchstart",(e=>{e.preventDefault(),console.log("touchstart event: ",e),r.play()})),n.addEventListener("mousedown",(e=>{e.preventDefault(),r.play()})),n.addEventListener("mouseup",(t=>{switch(t.preventDefault(),console.log("mouseup event: ",t),t.target.className){case"response-button-label noselect":e(t.target.parentElement);break;case"response-button":e(t.target)}})),n.addEventListener("touchmove",(e=>{e.preventDefault()})),n.addEventListener("touchend",(t=>{t.preventDefault();const n=document.elementFromPoint(t.changedTouches[0].clientX,t.changedTouches[0].clientY);switch(n?.className){case"response-button-label noselect":e(n?.parentElement);break;case"response-button":e(n)}}));let o=document.createElement("span");o.classList.add("response-button-label","noselect"),o.innerText=t,o.style.fontFamily=this.font,n.appendChild(o),this.controlButtons.map((e=>e.toLowerCase())).includes(t.toLowerCase())?document.querySelector("#keypad-control-keys").appendChild(n):document.querySelector("#keypad-keys").appendChild(n)},n=document.getElementById("keypad-header");n.innerText=this.headerMessage||"",n.style.display=""===n.innerText?"none":"block";const r=document.getElementById("keypad"),o=document.createElement("audio");o.id="feedbackAudio",o.src="onems.mp3",n.appendChild(o),r.style.fontFamily=this.font,this.clearKeys(),this.alphabet.forEach((e=>t(e))),setTimeout((()=>s(this.alphabet.length)),5)};visualFeedbackThenReset=(e=800)=>{this.interResponseKeypadMessaging(),setTimeout(defaultKeypadMessaging,e)};defaultKeypadMessaging=(e="")=>{const t=document.getElementById("keypad-header");""===e?t.style.display="none":(t.innerText=e,t.style.display="block"),[...document.getElementsByClassName("response-button")].forEach((e=>{e.classList.remove("unpressable","noselect")}))};interResponseKeypadMessaging=(e="Please fix your gaze on the + mark on your computer screen.")=>{document.getElementById("keypad-header").innerText=e,[...document.getElementsByClassName("response-button")].forEach((e=>{e.classList.add("unpressable","noselect")}))};clearKeys=()=>{document.querySelector("#keypad-keys").innerHTML="<div id='keypad-control-keys'></div>"};_getKeysElements=(e=[])=>{let t=[...document.querySelector("#keypad").getElementsByClassName("response-button")];return 0!==e.length&&(t=t.filter((t=>e.includes(t.id)))),t};disableKeys=(e=[])=>{this._getKeysElements(e).forEach((e=>{e.classList.add("unpressable"),e.classList.add("noselect"),e.setAttribute("inert","")}))};enableKeys=(e=[])=>{this._getKeysElements(e).forEach((e=>{e.classList.remove("unpressable"),e.classList.remove("noselect"),e.removeAttribute("inert")}))}}var yt=n(592);const At=()=>{};class bt extends ft{constructor(e,t=At,n=At,r=At,o=At,i=At){super({targetElementId:e.targetElementId,onErrorReconnectMessage:e.onErrorReconnectMessage}),e=this.#l(e),this.alphabet=this.checkAlphabet(e.alphabet),this.font=e.font,this.controlButtons=e.controlButtons,this.onErrorReconnectMessage=e.onErrorReconnectMessage??"Connection lost. Please reconnect...",this.onData=t,this.onHandshake=()=>{n(),this._setupHeartBeatIntervals()},this.onConnection=e=>{this.#d(e),r(e)},this.onClose=()=>{this.onPeerClose(),o()},this.onError=e=>{this.onPeerError(e),i(e)},this.peer.on("open",this.#n),this.peer.on("connection",this.onConnection),this.peer.on("disconnected",this.onPeerDisconnected),this.peer.on("close",this.onClose),this.peer.on("error",this.onError)}update=(e=undefined,t=undefined)=>{if(void 0!==e){const t=this.checkAlphabet(e);String(this.alphabet)!==String(t)&&this.displayUpdate("New alphabet: "+String(t),!0),this.alphabet=t}this.font=t??this.font;try{this.conn.send({message:"Update",alphabet:this.alphabet,font:this.font,peerID:this.peer.id})}catch(e){this.displayUpdate(`Error updating! Alphabet: ${String(this.alphabet)}, font: ${this.font}`,e),console.error(e)}};disableKeys=(e=undefined)=>{const t={message:"Disable"};e&&(t.keys=e);try{this.conn.send(t)}catch(t){this.displayUpdate(`Error disabling keys. Keys: ${e}`),console.error(t)}};enableKeys=(e=undefined)=>{const t={message:"Enable"};e&&(t.keys=e);try{this.conn.send(t)}catch(t){this.displayUpdate(`Error enabling keys. Keys: ${e}`),console.error(t)}};updateDisplayMessage=e=>{try{this.conn.send({message:"UpdateHeader",headerContent:e})}catch(e){this.displayUpdate("Error in updating message!"),console.error(e)}};updateFooterMessage=e=>{try{this.conn.send({message:"UpdateFooter",headerContent:e})}catch(e){this.displayUpdate("Error in updating footer message."),console.error(e)}};#l=e=>(e.hasOwnProperty("alphabet")?e.alphabet=this.checkAlphabet(e.alphabet):(console.error("Must provide 'alphabet' parameter to Receiver object. Defaulting to 'CDHKNORSVZ'"),e.alphabet="CDHKNORSVZ".split("")),e.hasOwnProperty("font")||(console.error("Must provide 'font' parameter to Receiver object. Defaulting to 'Arial'"),e.alphabet="Arial"),e);#n=e=>{null===this.id?(this.displayUpdate("Received null id from peer open"),this.peer.id=this.lastPeerId):this.lastPeerId=this.peer.id;const t={peerID:this.peer.id};let n=this.queryStringFromObject(t);const r=this.keypadUrl+n;this.qrURL=r,console.log(this.qrURL);const o=document.createElement("canvas");yt.toCanvas(o,r,(function(e){e&&console.error(e)})),this.qrURI=o.toDataURL(),document.getElementById(this.targetElement)?document.getElementById(this.targetElement).appendChild(o):console.log("Peer reachable at: ",r)};#d=e=>{this.conn&&this.conn.open?e.on("open",(function(){e.send({message:"Rejected",info:"Already connected to another client"}),setTimeout((function(){e.close()}),500)})):(this.conn=e,console.log("Connection: ",e),this.displayUpdate("[Connection established]",!0),this.#h())};#h=()=>{this.conn.on("data",(e=>{switch(console.log("Received data: ",e),e.message){case"Handshake":this.conn.send({message:"KeypadParameters",alphabet:this.alphabet,controlButtons:this.controlButtons,font:this.font,onErrorReconnectMessage:this.onErrorReconnectMessage}),this.onHandshake();break;case"Keypress":this.onData(e);break;case"Heartbeat":this.lastHeartbeat=performance.now();break;default:console.log("Message type: ",e.message)}})),this.conn.on("close",(()=>{this.onClose(),this.displayUpdate("Connection reset. Awaiting connection..."),this.conn=null}))}}})(),r})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.virtualKeypad=t():e.virtualKeypad=t()}(self,(()=>(()=>{var e={660:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(15),o=n.n(r),i=n(645),s=n.n(i)()(o());s.push([e.id,"/* REMOTE KEYPAD STYLING */\n#keypad {\n position: absolute;\n width: 100%;\n height: 100vh;\n height: 100dvh;\n\n display: grid;\n grid-template-columns: 1fr;\n /* Make header text as big as the text, keys take up as much space as needed, and control keys take up bottom space */\n grid-template-rows: max-content auto;\n\n align-items: center;\n justify-content: center;\n\n font-family: sans-serif;\n}\n#keypad-header {\n height: 100%;\n font-size: 1.5rem;\n font-weight: normal;\n text-align: center;\n\n grid-row: 1;\n overflow-y: auto;\n\n border-radius: 0.5em;\n\n box-shadow: inset 2px 2px 4px #888888,\n inset -2px -2px 4px #fff;\n}\n#keypad-footer {\n position: absolute;\n font-size: smaller;\n width: 100%;\n bottom: 0;\n right: 0;\n}\n\n/* Grid of main keys themselves */\n#keypad-keys {\n /* Second row, within the keypad grid (ie whole page) */\n grid-row: 2;\n}\n/* Hide scrollbar */\n/* #keypad-keys::-webkit-scrollbar {\n display: none;\n} */\n\n.response-button {\n /* border: 1px solid red; */\n cursor: pointer;\n\n /* Center text within button */\n display: flex;\n align-items: center;\n justify-content: center;\n\n /* Curve corners of buttons */\n border-radius: min(25px, 15%);\n\n /* Style button text */\n /* font-size: 3rem; */\n font-size: xx-large;\n font-weight: 700;\n\n padding: 0;\n margin: 0;\n\n box-shadow: 1px 1px 2px #888888,\n -1px -1px 2px #fff;\n}\n.response-button:active {\n box-shadow: 1px 2px 2px 1px #999;\n background-color: #aaa;\n}\n\n/* Only do on a hover-enabled device, ie not a phone/tablet */\n@media (hover: hover) {\n .response-button:hover {\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n }\n}\n\n\n.response-button-label {\n text-align: center;\n /* color: #eeeeee; */\n}\n\n.noselect {\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Old versions of Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none; /* Non-prefixed version, currently\n supported by Chrome, Edge, Opera and Firefox */\n touch-action: none;\n}\n\n.unpressable {\n background-color: #aaaaaa;\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n pointer-events: none;\n user-select: none;\n}","",{version:3,sources:["webpack://./src/keypad.css"],names:[],mappings:"AAAA,0BAA0B;AAC1B;EACE,kBAAkB;EAClB,WAAW;EACX,aAAa;EACb,cAAc;;EAEd,aAAa;EACb,0BAA0B;EAC1B,qHAAqH;EACrH,oCAAoC;;EAEpC,mBAAmB;EACnB,uBAAuB;;EAEvB,uBAAuB;AACzB;AACA;EACE,YAAY;EACZ,iBAAiB;EACjB,mBAAmB;EACnB,kBAAkB;;EAElB,WAAW;EACX,gBAAgB;;EAEhB,oBAAoB;;EAEpB;sCACoC;AACtC;AACA;EACE,kBAAkB;EAClB,kBAAkB;EAClB,WAAW;EACX,SAAS;EACT,QAAQ;AACV;;AAEA,iCAAiC;AACjC;EACE,uDAAuD;EACvD,WAAW;AACb;AACA,mBAAmB;AACnB;;GAEG;;AAEH;EACE,2BAA2B;EAC3B,eAAe;;EAEf,8BAA8B;EAC9B,aAAa;EACb,mBAAmB;EACnB,uBAAuB;;EAEvB,6BAA6B;EAC7B,6BAA6B;;EAE7B,sBAAsB;EACtB,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;;EAEhB,UAAU;EACV,SAAS;;EAET;gCAC8B;AAChC;AACA;EACE,gCAAgC;EAChC,sBAAsB;AACxB;;AAEA,6DAA6D;AAC7D;EACE;IACE;wCACoC;EACtC;AACF;;;AAGA;EACE,kBAAkB;EAClB,oBAAoB;AACtB;;AAEA;EACE,2BAA2B,EAAE,eAAe;EAC5C,yBAAyB,EAAE,WAAW;EACtC,wBAAwB,EAAE,mBAAmB;EAC7C,sBAAsB,EAAE,4BAA4B;EACpD,qBAAqB,EAAE,2BAA2B;EAClD,iBAAiB,EAAE;kFAC6D;EAChF,kBAAkB;AACpB;;AAEA;EACE,yBAAyB;EACzB;sCACoC;EACpC,oBAAoB;EACpB,iBAAiB;AACnB",sourcesContent:["/* REMOTE KEYPAD STYLING */\n#keypad {\n position: absolute;\n width: 100%;\n height: 100vh;\n height: 100dvh;\n\n display: grid;\n grid-template-columns: 1fr;\n /* Make header text as big as the text, keys take up as much space as needed, and control keys take up bottom space */\n grid-template-rows: max-content auto;\n\n align-items: center;\n justify-content: center;\n\n font-family: sans-serif;\n}\n#keypad-header {\n height: 100%;\n font-size: 1.5rem;\n font-weight: normal;\n text-align: center;\n\n grid-row: 1;\n overflow-y: auto;\n\n border-radius: 0.5em;\n\n box-shadow: inset 2px 2px 4px #888888,\n inset -2px -2px 4px #fff;\n}\n#keypad-footer {\n position: absolute;\n font-size: smaller;\n width: 100%;\n bottom: 0;\n right: 0;\n}\n\n/* Grid of main keys themselves */\n#keypad-keys {\n /* Second row, within the keypad grid (ie whole page) */\n grid-row: 2;\n}\n/* Hide scrollbar */\n/* #keypad-keys::-webkit-scrollbar {\n display: none;\n} */\n\n.response-button {\n /* border: 1px solid red; */\n cursor: pointer;\n\n /* Center text within button */\n display: flex;\n align-items: center;\n justify-content: center;\n\n /* Curve corners of buttons */\n border-radius: min(25px, 15%);\n\n /* Style button text */\n /* font-size: 3rem; */\n font-size: xx-large;\n font-weight: 700;\n\n padding: 0;\n margin: 0;\n\n box-shadow: 1px 1px 2px #888888,\n -1px -1px 2px #fff;\n}\n.response-button:active {\n box-shadow: 1px 2px 2px 1px #999;\n background-color: #aaa;\n}\n\n/* Only do on a hover-enabled device, ie not a phone/tablet */\n@media (hover: hover) {\n .response-button:hover {\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n }\n}\n\n\n.response-button-label {\n text-align: center;\n /* color: #eeeeee; */\n}\n\n.noselect {\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Old versions of Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none; /* Non-prefixed version, currently\n supported by Chrome, Edge, Opera and Firefox */\n touch-action: none;\n}\n\n.unpressable {\n background-color: #aaaaaa;\n box-shadow: inset 1px 1px 2px #888888,\n inset -1px -1px 2px #fff;\n pointer-events: none;\n user-select: none;\n}"],sourceRoot:""}]);const a=s},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var s=this[i][0];null!=s&&(o[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);r&&o[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},15:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}e.exports=function(e){var n,r,o=(r=4,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}}(n,r)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[1],s=o[3];if(!s)return i;if("function"==typeof btoa){var a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),l="/*# ".concat(c," */"),d=s.sources.map((function(e){return"/*# sourceURL=".concat(s.sourceRoot||"").concat(e," */")}));return[i].concat(d).concat([l]).join("\n")}return[i].join("\n")}},987:e=>{"use strict";var t={single_source_shortest_paths:function(e,n,r){var o={},i={};i[n]=0;var s,a,c,l,d,h,u,p=t.PriorityQueue.make();for(p.push(n,0);!p.empty();)for(c in a=(s=p.pop()).value,l=s.cost,d=e[a]||{})d.hasOwnProperty(c)&&(h=l+d[c],u=i[c],(void 0===i[c]||u>h)&&(i[c]=h,p.push(c,h),o[c]=a));if(void 0!==r&&void 0===i[r]){var f=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(f)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,n,r){var o=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,o={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(o[n]=r[n]);return o.queue=[],o.sorter=e.sorter||r.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},378:e=>{"use strict";e.exports=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var o=e.charCodeAt(r);if(o>=55296&&o<=56319&&n>r+1){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(o=1024*(o-55296)+i-56320+65536,r+=1)}o<128?t.push(o):o<2048?(t.push(o>>6|192),t.push(63&o|128)):o<55296||o>=57344&&o<65536?(t.push(o>>12|224),t.push(o>>6&63|128),t.push(63&o|128)):o>=65536&&o<=1114111?(t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(63&o|128)):t.push(239,191,189)}return new Uint8Array(t).buffer}},592:(e,t,n)=>{const r=n(138),o=n(115),i=n(907),s=n(776);function a(e,t,n,i,s){const a=[].slice.call(arguments,1),c=a.length,l="function"==typeof a[c-1];if(!l&&!r())throw new Error("Callback required as last argument");if(!l){if(c<1)throw new Error("Too few arguments provided");return 1===c?(n=t,t=i=void 0):2!==c||t.getContext||(i=n,n=t,t=void 0),new Promise((function(r,s){try{const s=o.create(n,i);r(e(s,t,i))}catch(e){s(e)}}))}if(c<2)throw new Error("Too few arguments provided");2===c?(s=n,n=t,t=i=void 0):3===c&&(t.getContext&&void 0===s?(s=i,i=void 0):(s=i,i=n,n=t,t=void 0));try{const r=o.create(n,i);s(null,e(r,t,i))}catch(e){s(e)}}t.create=o.create,t.toCanvas=a.bind(null,i.render),t.toDataURL=a.bind(null,i.renderToDataURL),t.toString=a.bind(null,(function(e,t,n){return s.render(e,n)}))},138:e=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},845:(e,t,n)=>{const r=n(242).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,n=r(e),o=145===n?26:2*Math.ceil((n-13)/(2*t-2)),i=[n-7];for(let e=1;e<t-1;e++)i[e]=i[e-1]-o;return i.push(6),i.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),o=r.length;for(let e=0;e<o;e++)for(let t=0;t<o;t++)0===e&&0===t||0===e&&t===o-1||e===o-1&&0===t||n.push([r[e],r[t]]);return n}},260:(e,t,n)=>{const r=n(910),o=["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"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=r.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*o.indexOf(this.data[t]);n+=o.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(o.indexOf(this.data[t]),6)},e.exports=i},245:e=>{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},280:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,n,r){const o=e*this.size+t;this.data[o]=n,r&&(this.reservedBit[o]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},424:(e,t,n)=>{const r=n(378),o=n(910);function i(e){this.mode=o.BYTE,"string"==typeof e&&(e=r(e)),this.data=new Uint8Array(e)}i.getBitsLength=function(e){return 8*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},e.exports=i},393:(e,t,n)=>{const r=n(908),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case r.L:return o[4*(e-1)+0];case r.M:return o[4*(e-1)+1];case r.Q:return o[4*(e-1)+2];case r.H:return o[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case r.L:return i[4*(e-1)+0];case r.M:return i[4*(e-1)+1];case r.Q:return i[4*(e-1)+2];case r.H:return i[4*(e-1)+3];default:return}}},908:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return n}}},526:(e,t,n)=>{const r=n(242).getSymbolSize;t.getPositions=function(e){const t=r(e);return[[0,0],[t-7,0],[0,t-7]]}},642:(e,t,n)=>{const r=n(242),o=r.getBCHDigit(1335);t.getEncodedBits=function(e,t){const n=e.bit<<3|t;let i=n<<10;for(;r.getBCHDigit(i)-o>=0;)i^=1335<<r.getBCHDigit(i)-o;return 21522^(n<<10|i)}},729:(e,t)=>{const n=new Uint8Array(512),r=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)n[t]=e,r[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)n[e]=n[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return r[e]},t.exp=function(e){return n[e]},t.mul=function(e,t){return 0===e||0===t?0:n[r[e]+r[t]]}},442:(e,t,n)=>{const r=n(910),o=n(242);function i(e){this.mode=r.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=o.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},e.exports=i},126:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function n(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let n=0,r=0,o=0,i=null,s=null;for(let a=0;a<t;a++){r=o=0,i=s=null;for(let c=0;c<t;c++){let t=e.get(a,c);t===i?r++:(r>=5&&(n+=r-5+3),i=t,r=1),t=e.get(c,a),t===s?o++:(o>=5&&(n+=o-5+3),s=t,o=1)}r>=5&&(n+=r-5+3),o>=5&&(n+=o-5+3)}return n},t.getPenaltyN2=function(e){const t=e.size;let n=0;for(let r=0;r<t-1;r++)for(let o=0;o<t-1;o++){const t=e.get(r,o)+e.get(r,o+1)+e.get(r+1,o)+e.get(r+1,o+1);4!==t&&0!==t||n++}return 3*n},t.getPenaltyN3=function(e){const t=e.size;let n=0,r=0,o=0;for(let i=0;i<t;i++){r=o=0;for(let s=0;s<t;s++)r=r<<1&2047|e.get(i,s),s>=10&&(1488===r||93===r)&&n++,o=o<<1&2047|e.get(s,i),s>=10&&(1488===o||93===o)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r<n;r++)t+=e.data[r];return 10*Math.abs(Math.ceil(100*t/n/5)-10)},t.applyMask=function(e,t){const r=t.size;for(let o=0;o<r;o++)for(let i=0;i<r;i++)t.isReserved(i,o)||t.xor(i,o,n(e,i,o))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let o=0,i=1/0;for(let s=0;s<r;s++){n(s),t.applyMask(s,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),r<i&&(i=r,o=s)}return o}},910:(e,t,n)=>{const r=n(114),o=n(7);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!r.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return o.testNumeric(e)?t.NUMERIC:o.testAlphanumeric(e)?t.ALPHANUMERIC:o.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return n}}},85:(e,t,n)=>{const r=n(910);function o(e){this.mode=r.NUMERIC,this.data=e.toString()}o.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const o=this.data.length-t;o>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*o+1))},e.exports=o},136:(e,t,n)=>{const r=n(729);t.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<t.length;i++)n[o+i]^=r.mul(e[o],t[i]);return n},t.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){const e=n[0];for(let o=0;o<t.length;o++)n[o]^=r.mul(t[o],e);let o=0;for(;o<n.length&&0===n[o];)o++;n=n.slice(o)}return n},t.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=t.mul(n,new Uint8Array([1,r.exp(o)]));return n}},115:(e,t,n)=>{const r=n(242),o=n(908),i=n(245),s=n(280),a=n(845),c=n(526),l=n(126),d=n(393),h=n(882),u=n(103),p=n(642),f=n(910),m=n(130);function g(e,t,n){const r=e.size,o=p.getEncodedBits(t,n);let i,s;for(i=0;i<15;i++)s=1==(o>>i&1),i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(r-15+i,8,s,!0),i<8?e.set(8,r-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(r-8,8,1,!0)}function y(e,t,n,o){let p;if(Array.isArray(e))p=m.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=m.rawSplit(e);r=u.getBestVersionForData(t,n)}p=m.fromString(e,r||40)}}const y=u.getBestVersionForData(p,n);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<y)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+y+".\n")}else t=y;const A=function(e,t,n){const o=new i;n.forEach((function(t){o.put(t.mode.bit,4),o.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(o)}));const s=8*(r.getSymbolTotalCodewords(e)-d.getTotalCodewordsCount(e,t));for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(0);const a=(s-o.getLengthInBits())/8;for(let e=0;e<a;e++)o.put(e%2?17:236,8);return function(e,t,n){const o=r.getSymbolTotalCodewords(t),i=o-d.getTotalCodewordsCount(t,n),s=d.getBlocksCount(t,n),a=s-o%s,c=Math.floor(o/s),l=Math.floor(i/s),u=l+1,p=c-l,f=new h(p);let m=0;const g=new Array(s),y=new Array(s);let A=0;const b=new Uint8Array(e.buffer);for(let e=0;e<s;e++){const t=e<a?l:u;g[e]=b.slice(m,m+t),y[e]=f.encode(g[e]),m+=t,A=Math.max(A,t)}const C=new Uint8Array(o);let v,w,V=0;for(v=0;v<A;v++)for(w=0;w<s;w++)v<g[w].length&&(C[V++]=g[w][v]);for(v=0;v<p;v++)for(w=0;w<s;w++)C[V++]=y[w][v];return C}(o,e,t)}(t,n,p),b=r.getSymbolSize(t),C=new s(b);return function(e,t){const n=e.size,r=c.getPositions(t);for(let t=0;t<r.length;t++){const o=r[t][0],i=r[t][1];for(let t=-1;t<=7;t++)if(!(o+t<=-1||n<=o+t))for(let r=-1;r<=7;r++)i+r<=-1||n<=i+r||(t>=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(o+t,i+r,!0,!0):e.set(o+t,i+r,!1,!0))}}(C,t),function(e){const t=e.size;for(let n=8;n<t-8;n++){const t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}(C),function(e,t){const n=a.getPositions(t);for(let t=0;t<n.length;t++){const r=n[t][0],o=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)-2===t||2===t||-2===n||2===n||0===t&&0===n?e.set(r+t,o+n,!0,!0):e.set(r+t,o+n,!1,!0)}}(C,t),g(C,n,0),t>=7&&function(e,t){const n=e.size,r=u.getEncodedBits(t);let o,i,s;for(let t=0;t<18;t++)o=Math.floor(t/3),i=t%3+n-8-3,s=1==(r>>t&1),e.set(o,i,s,!0),e.set(i,o,s,!0)}(C,t),function(e,t){const n=e.size;let r=-1,o=n-1,i=7,s=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!e.isReserved(o,a-n)){let r=!1;s<t.length&&(r=1==(t[s]>>>i&1)),e.set(o,a-n,r),i--,-1===i&&(s++,i=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}(C,A),isNaN(o)&&(o=l.getBestMask(C,g.bind(null,C,n))),l.applyMask(o,C),g(C,n,o),{modules:C,version:t,errorCorrectionLevel:n,maskPattern:o,segments:p}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,i,s=o.M;return void 0!==t&&(s=o.from(t.errorCorrectionLevel,o.M),n=u.from(t.version),i=l.from(t.maskPattern),t.toSJISFunc&&r.setToSJISFunction(t.toSJISFunc)),y(e,n,s,i)}},882:(e,t,n)=>{const r=n(136);function o(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}o.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=r.mod(t,this.genPoly),o=this.degree-n.length;if(o>0){const e=new Uint8Array(this.degree);return e.set(n,o),e}return n},e.exports=o},7:(e,t)=>{const n="[0-9]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+")(?:.|[\r\n]))+";t.KANJI=new RegExp(r,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(o,"g"),t.NUMERIC=new RegExp(n,"g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const i=new RegExp("^"+r+"$"),s=new RegExp("^"+n+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return s.test(e)},t.testAlphanumeric=function(e){return a.test(e)}},130:(e,t,n)=>{const r=n(910),o=n(85),i=n(260),s=n(424),a=n(442),c=n(7),l=n(242),d=n(987);function h(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){const r=[];let o;for(;null!==(o=e.exec(n));)r.push({data:o[0],index:o.index,mode:t,length:o[0].length});return r}function p(e){const t=u(c.NUMERIC,r.NUMERIC,e),n=u(c.ALPHANUMERIC,r.ALPHANUMERIC,e);let o,i;return l.isKanjiModeEnabled()?(o=u(c.BYTE,r.BYTE,e),i=u(c.KANJI,r.KANJI,e)):(o=u(c.BYTE_KANJI,r.BYTE,e),i=[]),t.concat(n,o,i).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function f(e,t){switch(t){case r.NUMERIC:return o.getBitsLength(e);case r.ALPHANUMERIC:return i.getBitsLength(e);case r.KANJI:return a.getBitsLength(e);case r.BYTE:return s.getBitsLength(e)}}function m(e,t){let n;const c=r.getBestModeForData(e);if(n=r.from(t,c),n!==r.BYTE&&n.bit<c.bit)throw new Error('"'+e+'" cannot be encoded with mode '+r.toString(n)+".\n Suggested mode is: "+r.toString(c));switch(n!==r.KANJI||l.isKanjiModeEnabled()||(n=r.BYTE),n){case r.NUMERIC:return new o(e);case r.ALPHANUMERIC:return new i(e);case r.KANJI:return new a(e);case r.BYTE:return new s(e)}}t.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(m(t,null)):t.data&&e.push(m(t.data,t.mode)),e}),[])},t.fromString=function(e,n){const o=function(e){const t=[];for(let n=0;n<e.length;n++){const o=e[n];switch(o.mode){case r.NUMERIC:t.push([o,{data:o.data,mode:r.ALPHANUMERIC,length:o.length},{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.ALPHANUMERIC:t.push([o,{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.KANJI:t.push([o,{data:o.data,mode:r.BYTE,length:h(o.data)}]);break;case r.BYTE:t.push([{data:o.data,mode:r.BYTE,length:h(o.data)}])}}return t}(p(e,l.isKanjiModeEnabled())),i=function(e,t){const n={},o={start:{}};let i=["start"];for(let s=0;s<e.length;s++){const a=e[s],c=[];for(let e=0;e<a.length;e++){const l=a[e],d=""+s+e;c.push(d),n[d]={node:l,lastCount:0},o[d]={};for(let e=0;e<i.length;e++){const s=i[e];n[s]&&n[s].node.mode===l.mode?(o[s][d]=f(n[s].lastCount+l.length,l.mode)-f(n[s].lastCount,l.mode),n[s].lastCount+=l.length):(n[s]&&(n[s].lastCount=l.length),o[s][d]=f(l.length,l.mode)+4+r.getCharCountIndicator(l.mode,t))}}i=c}for(let e=0;e<i.length;e++)o[i[e]].end=0;return{map:o,table:n}}(o,n),s=d.find_path(i.map,"start","end"),a=[];for(let e=1;e<s.length-1;e++)a.push(i.table[s[e]].node);return t.fromArray(a.reduce((function(e,t){const n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[]))},t.rawSplit=function(e){return t.fromArray(p(e,l.isKanjiModeEnabled()))}},242:(e,t)=>{let n;const r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return r[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},114:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},103:(e,t,n)=>{const r=n(242),o=n(393),i=n(908),s=n(910),a=n(114),c=r.getBCHDigit(7973);function l(e,t){return s.getCharCountIndicator(e,t)+4}function d(e,t){let n=0;return e.forEach((function(e){const r=l(e.mode,t);n+=r+e.getBitsLength()})),n}t.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,n){if(!a.isValid(e))throw new Error("Invalid QR Code version");void 0===n&&(n=s.BYTE);const i=8*(r.getSymbolTotalCodewords(e)-o.getTotalCodewordsCount(e,t));if(n===s.MIXED)return i;const c=i-l(n,e);switch(n){case s.NUMERIC:return Math.floor(c/10*3);case s.ALPHANUMERIC:return Math.floor(c/11*2);case s.KANJI:return Math.floor(c/13);case s.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,n){let r;const o=i.from(n,i.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(d(e,r)<=t.getCapacity(r,n,s.MIXED))return r}(e,o);if(0===e.length)return 1;r=e[0]}else r=e;return function(e,n,r){for(let o=1;o<=40;o++)if(n<=t.getCapacity(o,r,e))return o}(r.mode,r.getLength(),o)},t.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;r.getBCHDigit(t)-c>=0;)t^=7973<<r.getBCHDigit(t)-c;return e<<12|t}},907:(e,t,n)=>{const r=n(653);t.render=function(e,t,n){let o=n,i=t;void 0!==o||t&&t.getContext||(o=t,t=void 0),t||(i=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),o=r.getOptions(o);const s=r.getImageWidth(e.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return r.qrToImageData(c.data,e,o),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(a,i,s),a.putImageData(c,0,0),i},t.renderToDataURL=function(e,n,r){let o=r;void 0!==o||n&&n.getContext||(o=n,n=void 0),o||(o={});const i=t.render(e,n,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}},776:(e,t,n)=>{const r=n(653);function o(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function i(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}t.render=function(e,t,n){const s=r.getOptions(t),a=e.modules.size,c=e.modules.data,l=a+2*s.margin,d=s.color.light.a?"<path "+o(s.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+o(s.color.dark,"stroke")+' d="'+function(e,t,n){let r="",o=0,s=!1,a=0;for(let c=0;c<e.length;c++){const l=Math.floor(c%t),d=Math.floor(c/t);l||s||(s=!0),e[c]?(a++,c>0&&l>0&&e[c-1]||(r+=s?i("M",l+n,.5+d+n):i("m",o,0),o=0,s=!1),l+1<t&&e[c+1]||(r+=i("h",a),a=0)):o++}return r}(c,a,s.margin)+'"/>',u='viewBox="0 0 '+l+" "+l+'"',p='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+u+' shape-rendering="crispEdges">'+d+h+"</svg>\n";return"function"==typeof n&&n(null,p),p}},653:(e,t)=>{function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:r,scale:r?4:o,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const o=n.modules.size,i=n.modules.data,s=t.getScale(o,r),a=Math.floor((o+2*r.margin)*s),c=r.margin*s,l=[r.color.light,r.color.dark];for(let t=0;t<a;t++)for(let n=0;n<a;n++){let d=4*(t*a+n),h=r.color.light;t>=c&&n>=c&&t<a-c&&n<a-c&&(h=l[i[Math.floor((t-c)/s)*o+Math.floor((n-c)/s)]?1:0]),e[d++]=h.r,e[d++]=h.g,e[d++]=h.b,e[d]=h.a}}},539:e=>{"use strict";const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((e=>0===e.indexOf(n)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const r=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<r.length;e++)n=r[e].trim().split("="),t[n[0].trim()]=n[1];return t},t.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const r=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],o=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&o?{usernameFragment:r.substring(12),password:o.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" ");n.profile=r[2];for(let o=3;o<r.length;o++){const i=r[o],s=t.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(s){const r=t.parseRtpMap(s),o=t.matchPrefix(e,"a=fmtp:"+i+" ");switch(r.parameters=o.length?t.parseFmtp(o[0]):{},r.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+i+" ").map(t.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{n.headerExtensions.push(t.parseExtmap(e))}));const o=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach((e=>{o.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),n},t.writeRtpDescription=function(e,n){let r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=n.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((e=>{r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));let o=0;return n.codecs.forEach((e=>{e.maxptime>o&&(o=e.maxptime)})),o>0&&(r+="a=maxptime:"+o+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((e=>{r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){const n=[],r=t.parseRtpParameters(e),o=-1!==r.fecMechanisms.indexOf("RED"),i=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const l=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));l.length>0&&l[0].length>1&&l[0][0]===a&&(c=l[0][1]),r.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),n.push(t),o&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:i?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&a&&n.push({ssrc:a});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,n.forEach((e=>{e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){const n={},r=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const o=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;const i=t.matchPrefix(e,"a=rtcp-mux");return n.mux=i.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const r=t.matchPrefix(e,"a=msid:");if(1===r.length)return n=r[0].substring(7).split(" "),{stream:n[0],track:n[1]};const o=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return o.length>0?(n=o[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),r=t.matchPrefix(e,"a=max-message-size:");let o;r.length>0&&(o=parseInt(r[0].substring(19),10)),isNaN(o)&&(o=65536);const i=t.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substring(12),10),protocol:n.fmt,maxMessageSize:o};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:o}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,r){let o;const i=void 0!==n?n:2;return o=e||t.generateSessionId(),"v=0\r\no="+(r||"thisisadapterortc")+" "+o+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const r=t.splitLines(e);for(let e=0;e<r.length;e++)switch(r[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[e].substring(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const n=t.splitLines(e)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){const n=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const n=t.splitLines(e);for(let e=0;e<n.length;e++)if(n[e].length<2||"="!==n[e].charAt(1))return!1;return!0},e.exports=t},379:(e,t,n)=>{"use strict";var r,o=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function s(e){for(var t=-1,n=0;n<i.length;n++)if(i[n].identifier===e){t=n;break}return t}function a(e,t){for(var n={},r=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=n[c]||0,d="".concat(c," ").concat(l);n[c]=l+1;var h=s(d),u={css:a[1],media:a[2],sourceMap:a[3]};-1!==h?(i[h].references++,i[h].updater(u)):i.push({identifier:d,updater:m(u,t),references:1}),r.push(d)}return r}function c(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var s=o(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var l,d=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function h(e,t,n,r){var o=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function u(e,t,n){var r=n.css,o=n.media,i=n.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var p=null,f=0;function m(e,t){var n,r,o;if(t.singleton){var i=f++;n=p||(p=c(t)),r=h.bind(null,n,i,!1),o=h.bind(null,n,i,!0)}else n=c(t),r=u.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r));var n=a(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var o=s(n[r]);i[o].references--}for(var c=a(e,t),l=0;l<n.length;l++){var d=s(n[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}n=c}}}},452:function(e,t){!function(e){"use strict";let t,n,r;try{t=new TextDecoder}catch(e){}let o=0;const i=57342,s=57343,a=57337,c={};let l,d,h,u,p,f,m,g={},y=0,A=0,b=[],C=[],v={useRecords:!1,mapsAsObjects:!0},w=!1,V=2;var k;try{new k("")}catch(e){V=1/0}class E{constructor(e){if(e&&(!e.keyMap&&!e._keyMap||e.useRecords||(e.useRecords=!1,e.mapsAsObjects=!0),!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,n]of Object.entries(e.keyMap))this.mapKey.set(n,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[n,r]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(n)?this._keyMap[n]:n,r);return t}decodeKeys(e){if(!this._keyMap||"Map"!=e.constructor.name)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach(((e,n)=>t[P(this._mapKey.has(n)?this._mapKey.get(n):n)]=e)),t}mapDecode(e,t){let n=this.decode(e);return this._keyMap&&"Array"===n.constructor.name?n.map((e=>this.decodeKeys(e))):n}decode(e,t){if(n)return Q((()=>(W(),this?this.decode(e,t):E.prototype.decode.call(v,e,t))));r=t>-1?t:e.length,o=0,A=0,d=null,h=null,n=e;try{f=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){if(n=null,e instanceof Uint8Array)throw t;throw new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof E){if(g=this,p=this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return l=this.structures,_();(!l||l.length>0)&&(l=[])}else g=v,(!l||l.length>0)&&(l=[]),p=null;return _()}decodeMultiple(e,t){let n,r=0;try{let i=e.length;w=!0;let s=this?this.decode(e,i):$.decode(e,i);if(!t){for(n=[s];o<i;)r=o,n.push(_());return n}if(!1===t(s))return;for(;o<i;)if(r=o,!1===t(_()))return}catch(e){throw e.lastPosition=r,e.values=n,e}finally{w=!1,W()}}}function _(){try{let e=S();if(h){if(o>=h.postBundlePosition){let e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}o=h.postBundlePosition,h=null}if(o==r)l=null,n=null,u&&(u=null);else{if(o>r){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}if(!w)throw new Error("Data read, but end of buffer not reached")}return e}catch(e){throw W(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function S(){let e=n[o++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=n[o++];break;case 25:if(7==t)return function(){let e=n[o++],t=n[o++],r=(127&e)>>2;if(31===r)return t||3&e?NaN:128&e?-1/0:1/0;if(0===r){let n=((3&e)<<8|t)/(1<<24);return 128&e?-n:n}return D[3]=128&e|56+(r>>1),D[2]=(7&e)<<5|t>>3,D[1]=t<<5,D[0]=0,B[0]}();e=f.getUint16(o),o+=2;break;case 26:if(7==t){let e=f.getFloat32(o);if(g.useFloat32>2){let t=Z[(127&n[o])<<1|n[o+1]>>7];return o+=4,(t*e+(e>0?.5:-.5)>>0)/t}return o+=4,e}e=f.getUint32(o),o+=4;break;case 27:if(7==t){let e=f.getFloat64(o);return o+=8,e}if(t>1){if(f.getUint32(o)>0)throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");e=f.getUint32(o+4)}else g.int64AsNumber?(e=4294967296*f.getUint32(o),e+=f.getUint32(o+4)):e=f.getBigUint64(o);o+=8;break;case 31:switch(t){case 2:case 3:throw new Error("Indefinite length not supported for byte or text strings");case 4:let e,n=[],r=0;for(;(e=S())!=c;)n[r++]=e;return 4==t?n:3==t?n.join(""):Buffer.concat(n);case 5:let o;if(g.mapsAsObjects){let e={};if(g.keyMap)for(;(o=S())!=c;)e[P(g.decodeKey(o))]=S();else for(;(o=S())!=c;)e[P(o)]=S();return e}{m&&(g.mapsAsObjects=!0,m=!1);let e=new Map;if(g.keyMap)for(;(o=S())!=c;)e.set(g.decodeKey(o),S());else for(;(o=S())!=c;)e.set(o,S());return e}case 7:return c;default:throw new Error("Invalid major type for indefinite length "+t)}default:throw new Error("Unknown token "+e)}switch(t){case 0:return e;case 1:return~e;case 2:return u=e,g.copyBuffers?Uint8Array.prototype.slice.call(n,o,o+=u):n.subarray(o,o+=u);case 3:if(A>=o)return d.slice(o-y,(o+=e)-y);if(0==A&&r<140&&e<32){let t=e<16?x(e):function(e){let t=o,r=new Array(e);for(let i=0;i<e;i++){const e=n[o++];if((128&e)>0)return void(o=t);r[i]=e}return I.apply(String,r)}(e);if(null!=t)return t}return M(e);case 4:let t=new Array(e);for(let n=0;n<e;n++)t[n]=S();return t;case 5:if(g.mapsAsObjects){let t={};if(g.keyMap)for(let n=0;n<e;n++)t[P(g.decodeKey(S()))]=S();else for(let n=0;n<e;n++)t[P(S())]=S();return t}{m&&(g.mapsAsObjects=!0,m=!1);let t=new Map;if(g.keyMap)for(let n=0;n<e;n++)t.set(g.decodeKey(S()),S());else for(let n=0;n<e;n++)t.set(S(),S());return t}case 6:if(e>=a){let t=l[8191&e];if(t)return t.read||(t.read=R(t)),t.read();if(e<65536){if(e==s){let e=J(),t=S(),n=S();U(t,n);let r={};if(g.keyMap)for(let t=2;t<e;t++)r[P(g.decodeKey(n[t-2]))]=S();else for(let t=2;t<e;t++)r[P(n[t-2])]=S();return r}if(e==i){let e=J(),t=S();for(let n=2;n<e;n++)U(t++,S());return S()}if(e==a)return function(){let e=J(),t=o+S();for(let t=2;t<e;t++){let e=J();o+=e}let n=o;return o=t,h=[q(J()),q(J())],h.position0=0,h.position1=0,h.postBundlePosition=o,o=n,S()}();if(g.getShared&&(G(),t=l[8191&e],t))return t.read||(t.read=R(t)),t.read()}}let c=b[e];if(c)return c.handlesRead?c(S):c(S());{let t=S();for(let n=0;n<C.length;n++){let r=C[n](e,t);if(void 0!==r)return r}return new O(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(p||F())[e];if(void 0!==t)return t;throw new Error("Unknown token "+e)}default:if(isNaN(e)){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}throw new Error("Unknown CBOR token "+e)}var u}const T=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function R(e){return e.slowReads=0,function(){let e=n[o++];if(e&=31,e>23)switch(e){case 24:e=n[o++];break;case 25:e=f.getUint16(o),o+=2;break;case 26:e=f.getUint32(o),o+=4;break;default:throw new Error("Expected array header, but got "+n[o-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(S);t=t.next}if(this.slowReads++>=V){let n=this.length==e?this:this.slice(0,e);return t=g.keyMap?new k("r","return {"+n.map((e=>g.decodeKey(e))).map((e=>T.test(e)?P(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"):new k("r","return {"+n.map((e=>T.test(e)?P(e)+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}"),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(S)}let r={};if(g.keyMap)for(let t=0;t<e;t++)r[P(g.decodeKey(this[t]))]=S();else for(let t=0;t<e;t++)r[P(this[t])]=S();return r}}function P(e){return"__proto__"===e?"__proto_":e}let M=q;function q(e){let r;if(e<16&&(r=x(e)))return r;if(e>64&&t)return t.decode(n.subarray(o,o+=e));const i=o+e,s=[];for(r="";o<i;){const e=n[o++];if(0==(128&e))s.push(e);else if(192==(224&e)){const t=63&n[o++];s.push((31&e)<<6|t)}else if(224==(240&e)){const t=63&n[o++],r=63&n[o++];s.push((31&e)<<12|t<<6|r)}else if(240==(248&e)){let t=(7&e)<<18|(63&n[o++])<<12|(63&n[o++])<<6|63&n[o++];t>65535&&(t-=65536,s.push(t>>>10&1023|55296),t=56320|1023&t),s.push(t)}else s.push(e);s.length>=4096&&(r+=I.apply(String,s),s.length=0)}return s.length>0&&(r+=I.apply(String,s)),r}let I=String.fromCharCode;function x(e){if(e<4){if(e<2){if(0===e)return"";{let e=n[o++];return(128&e)>1?void(o-=1):I(e)}}{let t=n[o++],r=n[o++];if((128&t)>0||(128&r)>0)return void(o-=2);if(e<3)return I(t,r);let i=n[o++];return(128&i)>0?void(o-=3):I(t,r,i)}}{let t=n[o++],r=n[o++],i=n[o++],s=n[o++];if((128&t)>0||(128&r)>0||(128&i)>0||(128&s)>0)return void(o-=4);if(e<6){if(4===e)return I(t,r,i,s);{let e=n[o++];return(128&e)>0?void(o-=5):I(t,r,i,s,e)}}if(e<8){let a=n[o++],c=n[o++];if((128&a)>0||(128&c)>0)return void(o-=6);if(e<7)return I(t,r,i,s,a,c);let l=n[o++];return(128&l)>0?void(o-=7):I(t,r,i,s,a,c,l)}{let a=n[o++],c=n[o++],l=n[o++],d=n[o++];if((128&a)>0||(128&c)>0||(128&l)>0||(128&d)>0)return void(o-=8);if(e<10){if(8===e)return I(t,r,i,s,a,c,l,d);{let e=n[o++];return(128&e)>0?void(o-=9):I(t,r,i,s,a,c,l,d,e)}}if(e<12){let h=n[o++],u=n[o++];if((128&h)>0||(128&u)>0)return void(o-=10);if(e<11)return I(t,r,i,s,a,c,l,d,h,u);let p=n[o++];return(128&p)>0?void(o-=11):I(t,r,i,s,a,c,l,d,h,u,p)}{let h=n[o++],u=n[o++],p=n[o++],f=n[o++];if((128&h)>0||(128&u)>0||(128&p)>0||(128&f)>0)return void(o-=12);if(e<14){if(12===e)return I(t,r,i,s,a,c,l,d,h,u,p,f);{let e=n[o++];return(128&e)>0?void(o-=13):I(t,r,i,s,a,c,l,d,h,u,p,f,e)}}{let m=n[o++],g=n[o++];if((128&m)>0||(128&g)>0)return void(o-=14);if(e<15)return I(t,r,i,s,a,c,l,d,h,u,p,f,m,g);let y=n[o++];return(128&y)>0?void(o-=15):I(t,r,i,s,a,c,l,d,h,u,p,f,m,g,y)}}}}}let B=new Float32Array(1),D=new Uint8Array(B.buffer,0,4);new Array(4096);class O{constructor(e,t){this.value=e,this.tag=t}}b[0]=e=>new Date(e),b[1]=e=>new Date(Math.round(1e3*e)),b[2]=e=>{let t=BigInt(0);for(let n=0,r=e.byteLength;n<r;n++)t=BigInt(e[n])+t<<BigInt(8);return t},b[3]=e=>BigInt(-1)-b[2](e),b[4]=e=>+(e[1]+"e"+e[0]),b[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const U=(e,t)=>{let n=l[e-=57344];n&&n.isShared&&((l.restoreStructures||(l.restoreStructures=[]))[e]=n),l[e]=t,t.read=R(t)};b[105]=e=>{let t=e.length,n=e[1];U(e[0],n);let r={};for(let o=2;o<t;o++)r[P(n[o-2])]=e[o];return r},b[14]=e=>h?h[0].slice(h.position0,h.position0+=e):new O(e,14),b[15]=e=>h?h[1].slice(h.position1,h.position1+=e):new O(e,15);let j={Error,RegExp};b[27]=e=>(j[e[0]]||Error)(e[1],e[2]);const L=e=>{if(132!=n[o++])throw new Error("Packed values structure must be followed by a 4 element array");let t=e();return p=p?t.concat(p.slice(t.length)):t,p.prefixes=e(),p.suffixes=e(),e()};function N(e,t){return"string"==typeof e?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function F(){if(!p){if(!g.getShared)throw new Error("No packed values available");G()}return p}L.handlesRead=!0,b[51]=L,b[6]=e=>{if(!p){if(!g.getShared)return new O(e,6);G()}if("number"==typeof e)return p[16+(e>=0?2*e:-2*e-1)];throw new Error("No support for non-integer packed references yet")},b[28]=e=>{u||(u=new Map,u.id=0);let t,r=u.id++;t=n[o]>>5==4?[]:{};let i={target:t};u.set(r,i);let s=e();return i.used?Object.assign(t,s):(i.target=s,s)},b[28].handlesRead=!0,b[29]=e=>{let t=u.get(e);return t.used=!0,t.target},b[258]=e=>new Set(e),(b[259]=e=>(g.mapsAsObjects&&(g.mapsAsObjects=!1,m=!0),e())).handlesRead=!0;C.push(((e,t)=>e>=225&&e<=255?N(F().prefixes[e-224],t):e>=28704&&e<=32767?N(F().prefixes[e-28672],t):e>=1879052288&&e<=2147483647?N(F().prefixes[e-1879048192],t):e>=216&&e<=223?N(t,F().suffixes[e-216]):e>=27647&&e<=28671?N(t,F().suffixes[e-27639]):e>=1811940352&&e<=1879048191?N(t,F().suffixes[e-1811939328]):1399353956==e?{packedValues:p,structures:l.slice(0),version:t}:55799==e?t:void 0));const z=1==new Uint8Array(new Uint16Array([1]).buffer)[0],K=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?{name:"BigUint64Array"}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?{name:"BigInt64Array"}:BigInt64Array,Float32Array,Float64Array],H=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<K.length;e++)Y(K[e],H[e]);function Y(e,t){let n,r="get"+e.name.slice(0,-5);"function"==typeof e?n=e.BYTES_PER_ELEMENT:e=null;for(let o=0;o<2;o++){if(!o&&1==n)continue;let i=2==n?1:4==n?2:3;b[o?t:t-4]=1==n||o==z?n=>{if(!e)throw new Error("Could not find typed array for code "+t);return new e(Uint8Array.prototype.slice.call(n,0).buffer)}:n=>{if(!e)throw new Error("Could not find typed array for code "+t);let s=new DataView(n.buffer,n.byteOffset,n.byteLength),a=n.length>>i,c=new e(a),l=s[r];for(let e=0;e<a;e++)c[e]=l.call(s,e<<i,o);return c}}}function J(){let e=31&n[o++];if(e>23)switch(e){case 24:e=n[o++];break;case 25:e=f.getUint16(o),o+=2;break;case 26:e=f.getUint32(o),o+=4}return e}function G(){if(g.getShared){let e=Q((()=>(n=null,g.getShared())))||{},t=e.structures||[];g.sharedVersion=e.version,p=g.sharedValues=e.packedValues,!0===l?g.structures=l=t:l.splice.apply(l,[0,t.length].concat(t))}}function Q(e){let t=r,i=o,s=y,a=A,c=d,p=u,m=h,b=new Uint8Array(n.slice(0,r)),C=l,v=g,V=w,k=e();return r=t,o=i,y=s,A=a,d=c,u=p,h=m,n=b,w=V,l=C,g=v,f=new DataView(n.buffer,n.byteOffset,n.byteLength),k}function W(){n=null,u=null,l=null}const Z=new Array(147);for(let e=0;e<256;e++)Z[e]=+("1e"+Math.floor(45.15-.30103*e));let $=new E({useRecords:!1});const X=$.decode,ee=$.decodeMultiple,te={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let ne,re,oe;try{ne=new TextEncoder}catch(e){}const ie="object"==typeof globalThis&&globalThis.Buffer,se=void 0!==ie,ae=se?ie.allocUnsafeSlow:Uint8Array,ce=se?ie:Uint8Array,le=se?4294967296:2144337920;let de,he,ue,pe,fe=0,me=null;const ge=/[\u0080-\uFFFF]/,ye=Symbol("record-id");class Ae extends E{constructor(e){let t,n,r,o,i;super(e),this.offset=0,e=e||{};let s=ce.prototype.utf8Write?function(e,t,n){return he.utf8Write(e,t,n)}:!(!ne||!ne.encodeInto)&&function(e,t){return ne.encodeInto(e,he.subarray(t)).written},a=this,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(null==l&&(l=c?128:0),l>8190)throw new Error("Maximum maxSharedStructure is 8190");let d=e.sequential;d&&(l=0),this.structures||(this.structures=[]),this.saveStructures&&(this.saveShared=this.saveStructures);let h,u,p,f=e.sharedValues;if(f){p=Object.create(null);for(let e=0,t=f.length;e<t;e++)p[f[e]]=e}let m=[],g=0,y=0;this.mapEncode=function(e,t){return this._keyMap&&!this._mapped&&"Array"===e.constructor.name&&(e=e.map((e=>this.encodeKeys(e)))),this.encode(e,t)},this.encode=function(s,c){if(he||(he=new ae(8192),ue=new DataView(he.buffer,0,8192),fe=0),pe=he.length-10,pe-fe<2048?(he=new ae(he.length),ue=new DataView(he.buffer,0,he.length),pe=he.length-10,fe=0):c===Oe&&(fe=fe+7&2147483640),t=fe,a.useSelfDescribedHeader&&(ue.setUint32(fe,3654940416),fe+=3),i=a.structuredClone?new Map:null,a.bundleStrings&&"string"!=typeof s?(me=[],me.size=1/0):me=null,n=a.structures,n){if(n.uninitialized){let e=a.getShared()||{};a.structures=n=e.structures||[],a.sharedVersion=e.version;let t=a.sharedValues=e.packedValues;if(t){p={};for(let e=0,n=t.length;e<n;e++)p[t[e]]=e}}let e=n.length;if(e>l&&!d&&(e=l),!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,o=n.transitions;for(let n=0,i=e.length;n<i;n++){void 0===o[ye]&&(o[ye]=t);let i=e[n];r=o[i],r||(r=o[i]=Object.create(null)),o=r}o[ye]=1048576|t}}d||(n.nextId=e)}if(r&&(r=!1),o=n||[],u=p,e.pack){let t=new Map;if(t.values=[],t.encoder=a,t.maxValues=e.maxPrivatePackedValues||(p?16:1/0),t.objectMap=p||!1,t.samplingPackedValues=h,ke(s,t),t.values.length>0){he[fe++]=216,he[fe++]=51,ve(4);let e=t.values;A(e),ve(0),ve(0),u=Object.create(p||null);for(let t=0,n=e.length;t<n;t++)u[e[t]]=t}}de=c&je;try{if(de)return;if(A(s),me&&Te(t,A),a.offset=fe,i&&i.idsToInsert){fe+=2*i.idsToInsert.length,fe>pe&&C(fe),a.offset=fe;let e=function(e,t){let n,r=2*t.length,o=e.length-r;t.sort(((e,t)=>e.offset>t.offset?1:-1));for(let n=0;n<t.length;n++){let r=t[n];r.id=n;for(let t of r.references)e[t++]=n>>8,e[t]=255&n}for(;n=t.pop();){let t=n.offset;e.copyWithin(t+r,t,o),r-=2;let i=t+r;e[i++]=216,e[i++]=28,o=t}return e}(he.subarray(t,fe),i.idsToInsert);return i=null,e}return c&Oe?(he.start=t,he.end=fe,he):he.subarray(t,fe)}finally{if(n)if(y<10&&y++,n.length>l&&(n.length=l),g>1e4)n.transitions=null,y=0,g=0,m.length>0&&(m=[]);else if(m.length>0&&!d){for(let e=0,t=m.length;e<t;e++)m[e][ye]=void 0;m=[]}if(r&&a.saveShared){a.structures.length>l&&(a.structures=a.structures.slice(0,l));let e=he.subarray(t,fe);return!1===a.updateSharedData()?a.encode(s):e}c&Ue&&(fe=t)}},this.findCommonStringsToPack=()=>(h=new Map,p||(p=Object.create(null)),e=>{let t=e&&e.threshold||4,n=this.pack?e.maxPrivatePackedValues||16:0;f||(f=this.sharedValues=[]);for(let[e,o]of h)o.count>t&&(p[e]=n++,f.push(e),r=!0);for(;this.saveShared&&!1===this.updateSharedData(););h=null});const A=n=>{fe>pe&&(he=C(fe));var r,o=typeof n;if("string"===o){if(u){let t=u[n];if(t>=0)return void(t<16?he[fe++]=t+224:(he[fe++]=198,A(1&t?15-t>>1:t-16>>1)));if(h&&!e.pack){let e=h.get(n);e?e.count++:h.set(n,{count:1})}}let o,i=n.length;if(me&&i>=4&&i<1024){if((me.size+=i)>61440){let e,n=(me[0]?3*me[0].length+me[1].length:0)+10;fe+n>pe&&(he=C(fe+n)),he[fe++]=217,he[fe++]=223,he[fe++]=249,he[fe++]=me.position?132:130,he[fe++]=26,e=fe-t,fe+=4,me.position&&Te(t,A),me=["",""],me.size=0,me.position=e}let e=ge.test(n);return me[e?0:1]+=n,he[fe++]=e?206:207,void A(i)}o=i<32?1:i<256?2:i<65536?3:5;let a=3*i;if(fe+a>pe&&(he=C(fe+a)),i<64||!s){let e,t,s,a=fe+o;for(e=0;e<i;e++)t=n.charCodeAt(e),t<128?he[a++]=t:t<2048?(he[a++]=t>>6|192,he[a++]=63&t|128):55296==(64512&t)&&56320==(64512&(s=n.charCodeAt(e+1)))?(t=65536+((1023&t)<<10)+(1023&s),e++,he[a++]=t>>18|240,he[a++]=t>>12&63|128,he[a++]=t>>6&63|128,he[a++]=63&t|128):(he[a++]=t>>12|224,he[a++]=t>>6&63|128,he[a++]=63&t|128);r=a-fe-o}else r=s(n,fe+o,a);r<24?he[fe++]=96|r:r<256?(o<2&&he.copyWithin(fe+2,fe+1,fe+1+r),he[fe++]=120,he[fe++]=r):r<65536?(o<3&&he.copyWithin(fe+3,fe+2,fe+2+r),he[fe++]=121,he[fe++]=r>>8,he[fe++]=255&r):(o<5&&he.copyWithin(fe+5,fe+3,fe+3+r),he[fe++]=122,ue.setUint32(fe,r),fe+=4),fe+=r}else if("number"===o)if(this.alwaysUseFloat||n>>>0!==n)if(this.alwaysUseFloat||n>>0!==n){let e;if((e=this.useFloat32)>0&&n<4294967296&&n>=-2147483648){let t;if(he[fe++]=250,ue.setFloat32(fe,n),e<4||(t=n*Z[(127&he[fe])<<1|he[fe+1]>>7])>>0===t)return void(fe+=4);fe--}he[fe++]=251,ue.setFloat64(fe,n),fe+=8}else n>=-24?he[fe++]=31-n:n>=-256?(he[fe++]=56,he[fe++]=~n):n>=-65536?(he[fe++]=57,ue.setUint16(fe,~n),fe+=2):(he[fe++]=58,ue.setUint32(fe,~n),fe+=4);else n<24?he[fe++]=n:n<256?(he[fe++]=24,he[fe++]=n):n<65536?(he[fe++]=25,he[fe++]=n>>8,he[fe++]=255&n):(he[fe++]=26,ue.setUint32(fe,n),fe+=4);else if("object"===o)if(n){if(i){let e=i.get(n);if(e){if(he[fe++]=216,he[fe++]=29,he[fe++]=25,!e.references){let t=i.idsToInsert||(i.idsToInsert=[]);e.references=[],t.push(e)}return e.references.push(fe-t),void(fe+=2)}i.set(n,{offset:fe-t})}let e=n.constructor;if(e===Object)b(n,!0);else if(e===Array){(r=n.length)<24?he[fe++]=128|r:ve(r);for(let e=0;e<r;e++)A(n[e])}else if(e===Map)if((this.mapsAsObjects?!1!==this.useTag259ForMaps:this.useTag259ForMaps)&&(he[fe++]=217,he[fe++]=1,he[fe++]=3),(r=n.size)<24?he[fe++]=160|r:r<256?(he[fe++]=184,he[fe++]=r):r<65536?(he[fe++]=185,he[fe++]=r>>8,he[fe++]=255&r):(he[fe++]=186,ue.setUint32(fe,r),fe+=4),a.keyMap)for(let[e,t]of n)A(a.encodeKey(e)),A(t);else for(let[e,t]of n)A(e),A(t);else{for(let e=0,t=re.length;e<t;e++)if(n instanceof oe[e]){let t=re[e],r=t.tag;return null==r&&(r=t.getTag&&t.getTag.call(this,n)),r<24?he[fe++]=192|r:r<256?(he[fe++]=216,he[fe++]=r):r<65536?(he[fe++]=217,he[fe++]=r>>8,he[fe++]=255&r):r>-1&&(he[fe++]=218,ue.setUint32(fe,r),fe+=4),void t.encode.call(this,n,A,C)}if(n[Symbol.iterator]){if(de){let e=new Error("Iterable should be serialized as iterator");throw e.iteratorNotHandled=!0,e}he[fe++]=159;for(let e of n)A(e);return void(he[fe++]=255)}if(n[Symbol.asyncIterator]||Ve(n)){let e=new Error("Iterable/blob should be serialized as iterator");throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&n.toJSON){const e=n.toJSON();if(e!==n)return A(e)}b(n,!n.hasOwnProperty)}}else he[fe++]=246;else if("boolean"===o)he[fe++]=n?245:244;else if("bigint"===o){if(n<BigInt(1)<<BigInt(64)&&n>=0)he[fe++]=27,ue.setBigUint64(fe,n);else if(n>-(BigInt(1)<<BigInt(64))&&n<0)he[fe++]=59,ue.setBigUint64(fe,-n-BigInt(1));else{if(!this.largeBigIntToFloat)throw new RangeError(n+" was too large to fit in CBOR 64-bit integer format, set largeBigIntToFloat to convert to float-64");he[fe++]=251,ue.setFloat64(fe,Number(n))}fe+=8}else{if("undefined"!==o)throw new Error("Unknown type: "+o);he[fe++]=247}},b=!1===this.useRecords?this.variableMapSize?e=>{let t=Object.keys(e),n=Object.values(e),r=t.length;if(r<24?he[fe++]=160|r:r<256?(he[fe++]=184,he[fe++]=r):r<65536?(he[fe++]=185,he[fe++]=r>>8,he[fe++]=255&r):(he[fe++]=186,ue.setUint32(fe,r),fe+=4),a.keyMap)for(let e=0;e<r;e++)A(a.encodeKey(t[e])),A(n[e]);else for(let e=0;e<r;e++)A(t[e]),A(n[e])}:(e,n)=>{he[fe++]=185;let r=fe-t;fe+=2;let o=0;if(a.keyMap)for(let t in e)(n||e.hasOwnProperty(t))&&(A(a.encodeKey(t)),A(e[t]),o++);else for(let t in e)(n||e.hasOwnProperty(t))&&(A(t),A(e[t]),o++);he[r+++t]=o>>8,he[r+t]=255&o}:(e,t)=>{let n,i,s,a=o.transitions||(o.transitions=Object.create(null)),c=0,d=0;if(this.keyMap){s=Object.keys(e).map((e=>this.encodeKey(e))),d=s.length;for(let e=0;e<d;e++){let t=s[e];n=a[t],n||(n=a[t]=Object.create(null),c++),a=n}}else for(let r in e)(t||e.hasOwnProperty(r))&&(n=a[r],n||(1048576&a[ye]&&(i=65535&a[ye]),n=a[r]=Object.create(null),c++),a=n,d++);let h=a[ye];if(void 0!==h)h&=65535,he[fe++]=217,he[fe++]=h>>8|224,he[fe++]=255&h;else{if(s||(s=a.__keys__||(a.__keys__=Object.keys(e))),void 0===i?(h=o.nextId++,h||(h=0,o.nextId=1),h>=256&&(o.nextId=(h=l)+1)):h=i,o[h]=s,!(h<l)){if(a[ye]=h,ue.setUint32(fe,3655335680),fe+=3,c&&(g+=y*c),m.length>=256-l&&(m.shift()[ye]=void 0),m.push(a),ve(d+2),A(57344+h),A(s),null===t)return;for(let n in e)(t||e.hasOwnProperty(n))&&A(e[n]);return}he[fe++]=217,he[fe++]=h>>8|224,he[fe++]=255&h,a=o.transitions;for(let e=0;e<d;e++)(void 0===a[ye]||1048576&a[ye])&&(a[ye]=h),a=a[s[e]];a[ye]=1048576|h,r=!0}if(d<24?he[fe++]=128|d:ve(d),null!==t)for(let n in e)(t||e.hasOwnProperty(n))&&A(e[n])},C=e=>{let n;if(e>16777216){if(e-t>le)throw new Error("Encoded buffer would be larger than maximum buffer size");n=Math.min(le,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else n=1+(Math.max(e-t<<2,he.length-1)>>12)<<12;let r=new ae(n);return ue=new DataView(r.buffer,0,n),he.copy?he.copy(r,0,t,e):r.set(he.slice(t,e)),fe-=t,t=0,pe=r.length-10,he=r};let v=100,w=1e3;function*V(e,n,r){let o=e.constructor;if(o===Object){let t=!1!==a.useRecords;t?b(e,null):be(Object.keys(e).length,160);for(let r in e){let o=e[r];t||A(r),o&&"object"==typeof o?n[r]?yield*V(o,n[r]):yield*k(o,n,r):A(o)}}else if(o===Array){let r=e.length;ve(r);for(let o=0;o<r;o++){let r=e[o];r&&("object"==typeof r||fe-t>v)?n.element?yield*V(r,n.element):yield*k(r,n,"element"):A(r)}}else if(e[Symbol.iterator]){he[fe++]=159;for(let r of e)r&&("object"==typeof r||fe-t>v)?n.element?yield*V(r,n.element):yield*k(r,n,"element"):A(r);he[fe++]=255}else Ve(e)?(be(e.size,64),yield he.subarray(t,fe),yield e,E()):e[Symbol.asyncIterator]?(he[fe++]=159,yield he.subarray(t,fe),yield e,E(),he[fe++]=255):A(e);r&&fe>t?yield he.subarray(t,fe):fe-t>v&&(yield he.subarray(t,fe),E())}function*k(e,n,r){let o=fe-t;try{A(e),fe-t>v&&(yield he.subarray(t,fe),E())}catch(i){if(!i.iteratorNotHandled)throw i;n[r]={},fe=t+o,yield*V.call(this,e,n[r])}}function E(){v=w,a.encode(null,je)}function _(e,t,n){return v=t&&t.chunkThreshold?w=t.chunkThreshold:100,e&&"object"==typeof e?(a.encode(null,je),n(e,a.iterateProperties||(a.iterateProperties={}),!0)):[a.encode(e)]}async function*S(e,t){for(let n of V(e,t,!0)){let e=n.constructor;if(e===ce||e===Uint8Array)yield n;else if(Ve(n)){let e,t=n.stream().getReader();for(;!(e=await t.read()).done;)yield e.value}else if(n[Symbol.asyncIterator])for await(let e of n)E(),e?yield*S(e,t.async||(t.async={})):yield a.encode(e);else yield n}}this.encodeAsIterable=function(e,t){return _(e,t,V)},this.encodeAsAsyncIterable=function(e,t){return _(e,t,S)}}useBuffer(e){he=e,ue=new DataView(he.buffer,he.byteOffset,he.byteLength),fe=0}clearSharedData(){this.structures&&(this.structures=[]),this.sharedValues&&(this.sharedValues=void 0)}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),n=new Ce(t,this.sharedValues,this.sharedVersion),r=this.saveShared(n,(t=>(t&&t.version||0)==e));return!1===r?(n=this.getShared()||{},this.structures=n.structures||[],this.sharedValues=n.packedValues,this.sharedVersion=n.version,this.structures.nextId=this.structures.length):t.forEach(((e,t)=>this.structures[t]=e)),r}}function be(e,t){e<24?he[fe++]=t|e:e<256?(he[fe++]=24|t,he[fe++]=e):e<65536?(he[fe++]=25|t,he[fe++]=e>>8,he[fe++]=255&e):(he[fe++]=26|t,ue.setUint32(fe,e),fe+=4)}class Ce{constructor(e,t,n){this.structures=e,this.packedValues=t,this.version=n}}function ve(e){e<24?he[fe++]=128|e:e<256?(he[fe++]=152,he[fe++]=e):e<65536?(he[fe++]=153,he[fe++]=e>>8,he[fe++]=255&e):(he[fe++]=154,ue.setUint32(fe,e),fe+=4)}const we="undefined"==typeof Blob?function(){}:Blob;function Ve(e){if(e instanceof we)return!0;let t=e[Symbol.toStringTag];return"Blob"===t||"File"===t}function ke(e,t){switch(typeof e){case"string":if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let n=t.get(e);if(n)2==++n.count&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let n=t.samplingPackedValues.get(e);n?n.count++:t.samplingPackedValues.set(e,{count:1})}}break;case"object":if(e)if(e instanceof Array)for(let n=0,r=e.length;n<r;n++)ke(e[n],t);else{let r=!t.encoder.useRecords;for(var n in e)e.hasOwnProperty(n)&&(r&&ke(n,t),ke(e[n],t))}break;case"function":console.log(e)}}const Ee=1==new Uint8Array(new Uint16Array([1]).buffer)[0];function _e(e,t){return!Ee&&t>1&&(e-=4),{tag:e,encode:function(e,t){let n=e.byteLength,r=e.byteOffset||0,o=e.buffer||e;t(se?ie.from(o,r,n):new Uint8Array(o,r,n))}}}function Se(e,t){let n=e.byteLength;n<24?he[fe++]=64+n:n<256?(he[fe++]=88,he[fe++]=n):n<65536?(he[fe++]=89,he[fe++]=n>>8,he[fe++]=255&n):(he[fe++]=90,ue.setUint32(fe,n),fe+=4),fe+n>=he.length&&t(fe+n),he.set(e.buffer?e:new Uint8Array(e),fe),fe+=n}function Te(e,t){ue.setUint32(me.position+e,fe-me.position-e+1);let n=me;me=null,t(n[0]),t(n[1])}oe=[Date,Set,Error,RegExp,O,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,"undefined"==typeof BigUint64Array?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,"undefined"==typeof BigInt64Array?function(){}:BigInt64Array,Float32Array,Float64Array,Ce],re=[{tag:1,encode(e,t){let n=e.getTime()/1e3;(this.useTimestamp32||0===e.getMilliseconds())&&n>=0&&n<4294967296?(he[fe++]=26,ue.setUint32(fe,n),fe+=4):(he[fe++]=251,ue.setFloat64(fe,n),fe+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t(["RegExp",e.source,e.flags])}},{getTag:e=>e.tag,encode(e,t){t(e.value)}},{encode(e,t,n){Se(e,n)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||se&&!1!==this.tagUint8Array))return 64},encode(e,t,n){Se(e,n)}},_e(68,1),_e(69,2),_e(70,4),_e(71,8),_e(72,1),_e(77,2),_e(78,4),_e(79,8),_e(85,4),_e(86,8),{encode(e,t){let n=e.packedValues||[],r=e.structures||[];if(n.values.length>0){he[fe++]=216,he[fe++]=51,ve(4);let e=n.values;t(e),ve(0),ve(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,n=e.length;t<n;t++)packedObjectMap[e[t]]=t}if(r){ue.setUint32(fe,3655335424),fe+=3;let n=r.slice(0);n.unshift(57344),n.push(new O(e.version,1399353956)),t(n)}else t(new O(e.version,1399353956))}}];let Re=new Ae({useRecords:!1});const Pe=Re.encode,Me=Re.encodeAsIterable,qe=Re.encodeAsAsyncIterable,{NEVER:Ie,ALWAYS:xe,DECIMAL_ROUND:Be,DECIMAL_FIT:De}=te,Oe=512,Ue=1024,je=2048;e.ALWAYS=xe,e.DECIMAL_FIT=De,e.DECIMAL_ROUND=Be,e.Decoder=E,e.Encoder=Ae,e.FLOAT32_OPTIONS=te,e.NEVER=Ie,e.REUSE_BUFFER_MODE=Oe,e.Tag=O,e.addExtension=function(e){if(e.Class){if(!e.encode)throw new Error("Extension has no encode function");oe.unshift(e.Class),re.unshift(e)}!function(e){b[e.tag]=e.decode}(e)},e.clearSource=W,e.decode=X,e.decodeIter=function(e,t={}){if(!e||"object"!=typeof e)throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const n=new E(t);let r;const o=e=>{let t;r&&(e=Buffer.concat([r,e]),r=void 0);try{t=n.decodeMultiple(e)}catch(n){if(!n.incomplete)throw n;r=e.slice(n.lastPosition),t=n.values}return t};return"function"==typeof e[Symbol.iterator]?function*(){for(const t of e)yield*o(t)}():"function"==typeof e[Symbol.asyncIterator]?async function*(){for await(const t of e)yield*o(t)}():void 0},e.decodeMultiple=ee,e.encode=Pe,e.encodeAsAsyncIterable=qe,e.encodeAsIterable=Me,e.encodeIter=function(e,t={}){if(e&&"object"==typeof e){if("function"==typeof e[Symbol.iterator])return function*(e,t){const n=new Ae(t);for(const t of e)yield n.encode(t)}(e,t);if("function"==typeof e.then||"function"==typeof e[Symbol.asyncIterator])return async function*(e,t){const n=new Ae(t);for await(const t of e)yield n.encode(t)}(e,t);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable")},e.isNativeAccelerationEnabled=!1,e.roundFloat32=function(e){B[0]=e;let t=Z[(127&D[3])<<1|D[2]>>7];return(t*e+(e>0?.5:-.5)>>0)/t}}(t)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};return(()=>{"use strict";n.r(r),n.d(r,{Keypad:()=>gt,Receiver:()=>bt});var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>j,shimAddTrackRemoveTrack:()=>O,shimAddTrackRemoveTrackWithNative:()=>D,shimGetDisplayMedia:()=>P,shimGetSendersWithDtmf:()=>I,shimGetStats:()=>x,shimGetUserMedia:()=>R,shimMediaStream:()=>M,shimOnTrack:()=>q,shimPeerConnection:()=>U,shimSenderReceiverGetStats:()=>B});var t={};n.r(t),n.d(t,{shimAddTransceiver:()=>G,shimCreateAnswer:()=>Z,shimCreateOffer:()=>W,shimGetDisplayMedia:()=>N,shimGetParameters:()=>Q,shimGetUserMedia:()=>L,shimOnTrack:()=>F,shimPeerConnection:()=>z,shimRTCDataChannel:()=>J,shimReceiverGetStats:()=>H,shimRemoveStream:()=>Y,shimSenderGetStats:()=>K});var o={};n.r(o),n.d(o,{shimAudioContext:()=>se,shimCallbacksAPI:()=>ee,shimConstraints:()=>ne,shimCreateOfferLegacy:()=>ie,shimGetUserMedia:()=>te,shimLocalStreamsAPI:()=>$,shimRTCIceServerUrls:()=>re,shimRemoteStreamsAPI:()=>X,shimTrackEventTransceiver:()=>oe});var i={};n.r(i),n.d(i,{removeExtmapAllowMixed:()=>fe,shimAddIceCandidateNullOrEmpty:()=>me,shimConnectionState:()=>pe,shimMaxMessageSize:()=>he,shimParameterlessSetLocalDescription:()=>ge,shimRTCIceCandidate:()=>le,shimRTCIceCandidateRelayProtocol:()=>de,shimSendThrowTypeError:()=>ue});const s=e=>{const t=document.getElementById("keypad"),{keyHeightPx:n,cols:r,rows:o,widthPx:i,heightPx:s}=((e,t,n=.5)=>{let r;const o=e.clientWidth,i=e.clientHeight;let s=o*i;for(r=(-1+Math.sqrt(1+4*t*i/o))/(2*t/o),r=(-1+Math.sqrt(1+4*t*i*n/o))/(2*n*t/o);t>Math.floor(i/r-1)*Math.floor(o/(n*r));){const e=[i/Math.ceil(i/r),o/Math.ceil(o/(n*r))];for(let t=0;t<=e.length;t++)e[t]>=r&&(e[t]=0);r=Math.max(...e)}return s=i*o,{keyHeightPx:r,cols:Math.floor(o/(n*r)),rows:Math.floor(i/r-1),widthPx:o,heightPx:i}})(t,e,1),c=[...t.getElementsByClassName("response-button")],l=c.map((e=>"keypad-control-keys"===e.parentNode.id)),d=c.filter(((e,t)=>!l[t])).map(((e,t)=>[Math.floor(t/r),t%r])),h=s-(o*n+n),u=i-r*(1*n),p=Math.floor(h/2),f=Math.floor(u/2),m=[];let g,y=1/0,A=0;const b=l.filter((e=>e)).length;c.forEach(((e,t)=>{let r,o,c;if(e.style.position="fixed",l[t]){r=s-n,c=i/b-5,o=2.5+m.length*(c+5);const t=a(e,c,n-5);y=Math.min(t,y),m.push(e),e.style.borderRadius="25px",e.style.height=n-5+"px"}else{const t=n-5;c=1*t;const[i,s]=d[A];A+=1,r=i*t+5*(i+1)+p-2.5,o=s*c+5*(s+1)+f-2.5,g||(g=a(e,c,t)),e.style.height=t+"px",e.style.fontSize=t/2+"px"}e.style.width=c+"px",e.style.top=r+"px",e.style.left=o+"px",e.style.visibility="visible"})),m.forEach((e=>e.style.fontSize=y+"px"))},a=(e,t,n)=>{e.style.height="auto",e.style.width="auto",e.style.whiteSpace="nowrap",e.style.fontSize="20px";const r=1/(e.getBoundingClientRect().width/t),o=1/(e.getBoundingClientRect().height/n),i=Math.min(r,o);return Math.floor(20*i)};var c=n(379),l=n.n(c),d=n(660);l()(d.Z,{insert:"head",singleton:!1}),d.Z.locals;class h{constructor(){this.encoder=new TextEncoder,this._pieces=[],this._parts=[]}append_buffer(e){this.flush(),this._parts.push(e)}append(e){this._pieces.push(e)}flush(){if(this._pieces.length>0){const e=new Uint8Array(this._pieces);this._parts.push(e),this._pieces=[]}}toArrayBuffer(){const e=[];for(const t of this._parts)e.push(t);return function(e){let t=0;for(const n of e)t+=n.byteLength;const n=new Uint8Array(t);let r=0;for(const t of e){const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);n.set(e,r),r+=t.byteLength}return n}(e).buffer}}function u(e){return new f(e).unpack()}function p(e){const t=new m,n=t.pack(e);return n instanceof Promise?n.then((()=>t.getBuffer())):t.getBuffer()}class f{constructor(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}unpack(){const e=this.unpack_uint8();if(e<128)return e;if((224^e)<32)return(224^e)-32;let t;if((t=160^e)<=15)return this.unpack_raw(t);if((t=176^e)<=15)return this.unpack_string(t);if((t=144^e)<=15)return this.unpack_array(t);if((t=128^e)<=15)return this.unpack_map(t);switch(e){case 192:return null;case 193:case 212:case 213:case 214:case 215:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 216:return t=this.unpack_uint16(),this.unpack_string(t);case 217:return t=this.unpack_uint32(),this.unpack_string(t);case 218:return t=this.unpack_uint16(),this.unpack_raw(t);case 219:return t=this.unpack_uint32(),this.unpack_raw(t);case 220:return t=this.unpack_uint16(),this.unpack_array(t);case 221:return t=this.unpack_uint32(),this.unpack_array(t);case 222:return t=this.unpack_uint16(),this.unpack_map(t);case 223:return t=this.unpack_uint32(),this.unpack_map(t)}}unpack_uint8(){const e=255&this.dataView[this.index];return this.index++,e}unpack_uint16(){const e=this.read(2),t=256*(255&e[0])+(255&e[1]);return this.index+=2,t}unpack_uint32(){const e=this.read(4),t=256*(256*(256*e[0]+e[1])+e[2])+e[3];return this.index+=4,t}unpack_uint64(){const e=this.read(8),t=256*(256*(256*(256*(256*(256*(256*e[0]+e[1])+e[2])+e[3])+e[4])+e[5])+e[6])+e[7];return this.index+=8,t}unpack_int8(){const e=this.unpack_uint8();return e<128?e:e-256}unpack_int16(){const e=this.unpack_uint16();return e<32768?e:e-65536}unpack_int32(){const e=this.unpack_uint32();return e<2**31?e:e-2**32}unpack_int64(){const e=this.unpack_uint64();return e<2**63?e:e-2**64}unpack_raw(e){if(this.length<this.index+e)throw new Error(`BinaryPackFailure: index is out of range ${this.index} ${e} ${this.length}`);const t=this.dataBuffer.slice(this.index,this.index+e);return this.index+=e,t}unpack_string(e){const t=this.read(e);let n,r,o=0,i="";for(;o<e;)n=t[o],n<160?(r=n,o++):(192^n)<32?(r=(31&n)<<6|63&t[o+1],o+=2):(224^n)<16?(r=(15&n)<<12|(63&t[o+1])<<6|63&t[o+2],o+=3):(r=(7&n)<<18|(63&t[o+1])<<12|(63&t[o+2])<<6|63&t[o+3],o+=4),i+=String.fromCodePoint(r);return this.index+=e,i}unpack_array(e){const t=new Array(e);for(let n=0;n<e;n++)t[n]=this.unpack();return t}unpack_map(e){const t={};for(let n=0;n<e;n++)t[this.unpack()]=this.unpack();return t}unpack_float(){const e=this.unpack_uint32();return(0==e>>31?1:-1)*(8388607&e|8388608)*2**((e>>23&255)-127-23)}unpack_double(){const e=this.unpack_uint32(),t=(e>>20&2047)-1023;return(0==e>>31?1:-1)*((1048575&e|1048576)*2**(t-20)+this.unpack_uint32()*2**(t-52))}read(e){const t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw new Error("BinaryPackFailure: read index out of range")}}class m{getBuffer(){return this._bufferBuilder.toArrayBuffer()}pack(e){if("string"==typeof e)this.pack_string(e);else if("number"==typeof e)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if("boolean"==typeof e)!0===e?this._bufferBuilder.append(195):!1===e&&this._bufferBuilder.append(194);else if(void 0===e)this._bufferBuilder.append(192);else{if("object"!=typeof e)throw new Error(`Type "${typeof e}" not yet supported`);if(null===e)this._bufferBuilder.append(192);else{const t=e.constructor;if(e instanceof Array){const t=this.pack_array(e);if(t instanceof Promise)return t.then((()=>this._bufferBuilder.flush()))}else if(e instanceof ArrayBuffer)this.pack_bin(new Uint8Array(e));else if("BYTES_PER_ELEMENT"in e){const t=e;this.pack_bin(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}else if(e instanceof Date)this.pack_string(e.toString());else{if(e instanceof Blob)return e.arrayBuffer().then((e=>{this.pack_bin(new Uint8Array(e)),this._bufferBuilder.flush()}));if(t!=Object&&!t.toString().startsWith("class"))throw new Error(`Type "${t.toString()}" not yet supported`);{const t=this.pack_object(e);if(t instanceof Promise)return t.then((()=>this._bufferBuilder.flush()))}}}}this._bufferBuilder.flush()}pack_bin(e){const t=e.length;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this._bufferBuilder.append(218),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(219),this.pack_uint32(t)}this._bufferBuilder.append_buffer(e)}pack_string(e){const t=this._textEncoder.encode(e),n=t.length;if(n<=15)this.pack_uint8(176+n);else if(n<=65535)this._bufferBuilder.append(216),this.pack_uint16(n);else{if(!(n<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(217),this.pack_uint32(n)}this._bufferBuilder.append_buffer(t)}pack_array(e){const t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this._bufferBuilder.append(220),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(221),this.pack_uint32(t)}const n=r=>{if(r<t){const t=this.pack(e[r]);return t instanceof Promise?t.then((()=>n(r+1))):n(r+1)}};return n(0)}pack_integer(e){if(e>=-32&&e<=127)this._bufferBuilder.append(255&e);else if(e>=0&&e<=255)this._bufferBuilder.append(204),this.pack_uint8(e);else if(e>=-128&&e<=127)this._bufferBuilder.append(208),this.pack_int8(e);else if(e>=0&&e<=65535)this._bufferBuilder.append(205),this.pack_uint16(e);else if(e>=-32768&&e<=32767)this._bufferBuilder.append(209),this.pack_int16(e);else if(e>=0&&e<=4294967295)this._bufferBuilder.append(206),this.pack_uint32(e);else if(e>=-2147483648&&e<=2147483647)this._bufferBuilder.append(210),this.pack_int32(e);else if(e>=-0x8000000000000000&&e<=0x8000000000000000)this._bufferBuilder.append(211),this.pack_int64(e);else{if(!(e>=0&&e<=0x10000000000000000))throw new Error("Invalid integer");this._bufferBuilder.append(207),this.pack_uint64(e)}}pack_double(e){let t=0;e<0&&(t=1,e=-e);const n=Math.floor(Math.log(e)/Math.LN2),r=e/2**n-1,o=Math.floor(r*2**52),i=2**32,s=t<<31|n+1023<<20|o/i&1048575,a=o%i;this._bufferBuilder.append(203),this.pack_int32(s),this.pack_int32(a)}pack_object(e){const t=Object.keys(e),n=t.length;if(n<=15)this.pack_uint8(128+n);else if(n<=65535)this._bufferBuilder.append(222),this.pack_uint16(n);else{if(!(n<=4294967295))throw new Error("Invalid length");this._bufferBuilder.append(223),this.pack_uint32(n)}const r=n=>{if(n<t.length){const o=t[n];if(e.hasOwnProperty(o)){this.pack(o);const t=this.pack(e[o]);if(t instanceof Promise)return t.then((()=>r(n+1)))}return r(n+1)}};return r(0)}pack_uint8(e){this._bufferBuilder.append(e)}pack_uint16(e){this._bufferBuilder.append(e>>8),this._bufferBuilder.append(255&e)}pack_uint32(e){const t=4294967295&e;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t)}pack_uint64(e){const t=e/2**32,n=e%2**32;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t),this._bufferBuilder.append((4278190080&n)>>>24),this._bufferBuilder.append((16711680&n)>>>16),this._bufferBuilder.append((65280&n)>>>8),this._bufferBuilder.append(255&n)}pack_int8(e){this._bufferBuilder.append(255&e)}pack_int16(e){this._bufferBuilder.append((65280&e)>>8),this._bufferBuilder.append(255&e)}pack_int32(e){this._bufferBuilder.append(e>>>24&255),this._bufferBuilder.append((16711680&e)>>>16),this._bufferBuilder.append((65280&e)>>>8),this._bufferBuilder.append(255&e)}pack_int64(e){const t=Math.floor(e/2**32),n=e%2**32;this._bufferBuilder.append((4278190080&t)>>>24),this._bufferBuilder.append((16711680&t)>>>16),this._bufferBuilder.append((65280&t)>>>8),this._bufferBuilder.append(255&t),this._bufferBuilder.append((4278190080&n)>>>24),this._bufferBuilder.append((16711680&n)>>>16),this._bufferBuilder.append((65280&n)>>>8),this._bufferBuilder.append(255&n)}constructor(){this._bufferBuilder=new h,this._textEncoder=new TextEncoder}}let g=!0,y=!0;function A(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function b(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,o=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return o.apply(this,arguments);const i=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,i),o.apply(this,[e,i])};const i=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return i.apply(this,arguments);if(!this._eventMap[t].has(n))return i.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,i.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function C(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(g=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function v(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(y=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function w(){if("object"==typeof window){if(g)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function V(e,t){y&&console.warn(e+" is deprecated, please use "+t+" instead.")}function k(e){return"[object Object]"===Object.prototype.toString.call(e)}function E(e){return k(e)?Object.keys(e).reduce((function(t,n){const r=k(e[n]),o=r?E(e[n]):e[n],i=r&&!Object.keys(o).length;return void 0===o||i?t:Object.assign(t,{[n]:o})}),{}):e}function _(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((r=>{r.endsWith("Id")?_(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((t=>{_(e,e.get(t),n)}))})))}function S(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",o=new Map;if(null===t)return o;const i=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&i.push(e)})),i.forEach((t=>{e.forEach((n=>{n.type===r&&n.trackId===t.id&&_(e,n,o)}))})),o}const T=w;function R(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const o=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||[];let e={};"number"==typeof r.ideal?(e[o("min",n)]=r.ideal,t.optional.push(e),e={},e[o("max",n)]=r.ideal,t.optional.push(e)):(e[o("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",n)]=r.exact):["min","max"].forEach((e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,n)]=r[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,o){if(t.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let i=e.video.facingMode;i=i&&("object"==typeof i?i:{ideal:i});const s=t.version<66;if(i&&("user"===i.exact||"environment"===i.exact||"user"===i.ideal||"environment"===i.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===i.exact||"environment"===i.ideal?t=["back","rear"]:"user"!==i.exact&&"user"!==i.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=i.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=r(e.video),T("chrome: "+JSON.stringify(e)),o(e)}))}e.video=r(e.video)}return T("chrome: "+JSON.stringify(e)),o(e)},i=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){o(e,(e=>{n.webkitGetUserMedia(e,t,(e=>{r&&r(i(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return o(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(i(e))))))}}}function P(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((t=>{const r=n.video&&n.video.width,o=n.video&&n.video.height,i=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:i||3}},r&&(n.video.mandatory.maxWidth=r),o&&(n.video.mandatory.maxHeight=o),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function M(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function q(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.track.id)):{track:n.track};const o=new Event("track");o.track=n.track,o.receiver=r,o.transceiver={receiver:r},o.streams=[t.stream],this.dispatchEvent(o)})),t.stream.getTracks().forEach((n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.id)):{track:n};const o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=[t.stream],this.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else b(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function I(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let o=n.apply(this,arguments);return o||(o=t(this,e),this._senders.push(o)),o};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function x(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const o=function(e){const t={};return e.result().forEach((e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{n[t]=e.stat(t)})),t[n.id]=n})),t},i=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const r=function(e){n(i(o(e)))};return t.apply(this,[r,e])}return new Promise(((e,n)=>{t.apply(this,[function(t){e(i(o(t)))},n])})).then(n,r)}}function B(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>S(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),b(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>S(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach((n=>{n.track===e&&(t?r=!0:t=n)})),this.getReceivers().forEach((t=>(t.track===e&&(n?r=!0:n=t),t.track===e))),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function D(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),o.apply(this,arguments)}}function O(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return D(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const o=e.RTCPeerConnection.prototype.removeStream;function i(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],o=e._streams[r.id];n=n.replace(new RegExp(o.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const o=this._streams[n.id];if(o)o.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=i(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then((e=>i(this,e)))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],o=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),o.id)})),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:i(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((t=>e.track===t))&&(t=this._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function U(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function j(e,t){b(e,"negotiationneeded",(e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}function L(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){V("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function N(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function F(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function z(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,o,i]=arguments;return r.apply(this,[e||null]).then((e=>{if(t.version<53&&!o)try{e.forEach((e=>{e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(o,i)}}function K(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function H(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),b(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Y(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){V("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function J(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function G(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const n=e.length>0;n&&e.forEach((e=>{if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return r})}function Q(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function W(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function Z(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function $(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((n=>t.call(this,n,e))),e.getVideoTracks().forEach((n=>t.call(this,n,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach((e=>{n.includes(e.track)&&this.removeTrack(e)}))})}}function X(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}))}),t.apply(e,arguments)}}}function ee(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,o=t.setLocalDescription,i=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],o=n.apply(this,[r]);return t?(o.then(e,t),Promise.resolve()):o},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],o=r.apply(this,[n]);return t?(o.then(e,t),Promise.resolve()):o};let a=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){const r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}function te(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(ne(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function ne(e){return e&&void 0!==e.video?Object.assign({},e,{video:E(e.video)}):e}function re(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];void 0===r.urls&&r.url?(V("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function oe(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ie(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function se(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var ae=n(539),ce=n.n(ae);function le(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const n=new t(e),r=ce().parseCandidate(e.candidate);for(const e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,b(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function de(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||b(e,"icecandidate",(e=>{if(e.candidate){const t=ce().parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function he(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=ce().splitSections(e.sdp);return t.shift(),t.some((e=>{const t=ce().parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const o=ce().matchPrefix(e.sdp,"a=max-message-size:");return o.length>0?r=parseInt(o[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let o;o=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const i={};Object.defineProperty(i,"maxMessageSize",{get:()=>o}),this._sctp=i}return n.apply(this,arguments)}}function ue(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],o=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&o>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},b(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function pe(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function fe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function me(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ge(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?n.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>n.apply(this,[e])))})}const ye=function({window:n}={},r={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const s=w,a=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=A(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=A(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=A(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(n),c={browserDetails:a,commonShim:i,extractVersion:A,disableLog:C,disableWarnings:v,sdp:ae};switch(a.browser){case"chrome":if(!e||!U||!r.shimChrome)return s("Chrome shim is not included in this adapter release."),c;if(null===a.version)return s("Chrome shim can not determine version, not shimming."),c;s("adapter.js shimming chrome."),c.browserShim=e,me(n,a),ge(n),R(n,a),M(n),U(n,a),q(n),O(n,a),I(n),x(n),B(n),j(n,a),le(n),de(n),pe(n),he(n,a),ue(n),fe(n,a);break;case"firefox":if(!t||!z||!r.shimFirefox)return s("Firefox shim is not included in this adapter release."),c;s("adapter.js shimming firefox."),c.browserShim=t,me(n,a),ge(n),L(n,a),z(n,a),F(n),Y(n),K(n),H(n),J(n),G(n),Q(n),W(n),Z(n),le(n),pe(n),he(n,a),ue(n);break;case"safari":if(!o||!r.shimSafari)return s("Safari shim is not included in this adapter release."),c;s("adapter.js shimming safari."),c.browserShim=o,me(n,a),ge(n),re(n),ie(n),ee(n),$(n),X(n),oe(n),te(n),se(n),le(n),de(n),he(n,a),ue(n),fe(n,a);break;default:s("Unsupported browser!")}return c}({window:"undefined"==typeof window?void 0:window}),Ae=ye;function be(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}n(452);class Ce{constructor(){this.chunkedMTU=16300,this._dataCount=1,this.chunk=e=>{const t=[],n=e.byteLength,r=Math.ceil(n/this.chunkedMTU);let o=0,i=0;for(;i<n;){const s=Math.min(n,i+this.chunkedMTU),a=e.slice(i,s),c={__peerData:this._dataCount,n:o,data:a,total:r};t.push(c),i=s,o++}return this._dataCount++,t}}}const ve=Ae.default||Ae,we=new class{isWebRTCSupported(){return"undefined"!=typeof RTCPeerConnection}isBrowserSupported(){const e=this.getBrowser(),t=this.getVersion();return!!this.supportedBrowsers.includes(e)&&("chrome"===e?t>=this.minChromeVersion:"firefox"===e?t>=this.minFirefoxVersion:"safari"===e&&!this.isIOS&&t>=this.minSafariVersion)}getBrowser(){return ve.browserDetails.browser}getVersion(){return ve.browserDetails.version||0}isUnifiedPlanSupported(){const e=this.getBrowser(),t=ve.browserDetails.version||0;if("chrome"===e&&t<this.minChromeVersion)return!1;if("firefox"===e&&t>=this.minFirefoxVersion)return!0;if(!window.RTCRtpTransceiver||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let n,r=!1;try{n=new RTCPeerConnection,n.addTransceiver("audio"),r=!0}catch(e){}finally{n&&n.close()}return r}toString(){return`Supports:\n browser:${this.getBrowser()}\n version:${this.getVersion()}\n isIOS:${this.isIOS}\n isWebRTCSupported:${this.isWebRTCSupported()}\n isBrowserSupported:${this.isBrowserSupported()}\n isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`}constructor(){this.isIOS="undefined"!=typeof navigator&&["iPad","iPhone","iPod"].includes(navigator.platform),this.supportedBrowsers=["firefox","chrome","safari"],this.minFirefoxVersion=59,this.minChromeVersion=72,this.minSafariVersion=605}},Ve=e=>!e||/^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(e),ke=()=>Math.random().toString(36).slice(2),Ee={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:["turn:eu-0.turn.peerjs.com:3478","turn:us-0.turn.peerjs.com:3478"],username:"peerjs",credential:"peerjsp"}],sdpSemantics:"unified-plan"},_e=new class extends Ce{noop(){}blobToArrayBuffer(e,t){const n=new FileReader;return n.onload=function(e){e.target&&t(e.target.result)},n.readAsArrayBuffer(e),n}binaryStringToArrayBuffer(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=255&e.charCodeAt(n);return t.buffer}isSecure(){return"https:"===location.protocol}constructor(...e){super(...e),this.CLOUD_HOST="0.peerjs.com",this.CLOUD_PORT=443,this.chunkedBrowsers={Chrome:1,chrome:1},this.defaultConfig=Ee,this.browser=we.getBrowser(),this.browserVersion=we.getVersion(),this.pack=p,this.unpack=u,this.supports=function(){const e={browser:we.isBrowserSupported(),webRTC:we.isWebRTCSupported(),audioVideo:!1,data:!1,binaryBlob:!1,reliable:!1};if(!e.webRTC)return e;let t;try{let n;t=new RTCPeerConnection(Ee),e.audioVideo=!0;try{n=t.createDataChannel("_PEERJSTEST",{ordered:!0}),e.data=!0,e.reliable=!!n.ordered;try{n.binaryType="blob",e.binaryBlob=!we.isIOS}catch(e){}}catch(e){}finally{n&&n.close()}}catch(e){}finally{t&&t.close()}return e}(),this.validateId=Ve,this.randomToken=ke}};var Se,Te;(Te=Se||(Se={}))[Te.Disabled=0]="Disabled",Te[Te.Errors=1]="Errors",Te[Te.Warnings=2]="Warnings",Te[Te.All=3]="All";var Re,Pe=new class{get logLevel(){return this._logLevel}set logLevel(e){this._logLevel=e}log(...e){this._logLevel>=3&&this._print(3,...e)}warn(...e){this._logLevel>=2&&this._print(2,...e)}error(...e){this._logLevel>=1&&this._print(1,...e)}setLogFunction(e){this._print=e}_print(e,...t){const n=["PeerJS: ",...t];for(const e in n)n[e]instanceof Error&&(n[e]="("+n[e].name+") "+n[e].message);e>=3?console.log(...n):e>=2?console.warn("WARNING",...n):e>=1&&console.error("ERROR",...n)}constructor(){this._logLevel=0}},Me=Object.prototype.hasOwnProperty,qe="~";function Ie(){}function xe(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function Be(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var i=new xe(n,r||e,o),s=qe?qe+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],i]:e._events[s].push(i):(e._events[s]=i,e._eventsCount++),e}function De(e,t){0==--e._eventsCount?e._events=new Ie:delete e._events[t]}function Oe(){this._events=new Ie,this._eventsCount=0}Object.create&&(Ie.prototype=Object.create(null),(new Ie).__proto__||(qe=!1)),Oe.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)Me.call(e,t)&&n.push(qe?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},Oe.prototype.listeners=function(e){var t=qe?qe+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,i=new Array(o);r<o;r++)i[r]=n[r].fn;return i},Oe.prototype.listenerCount=function(e){var t=qe?qe+e:e,n=this._events[t];return n?n.fn?1:n.length:0},Oe.prototype.emit=function(e,t,n,r,o,i){var s=qe?qe+e:e;if(!this._events[s])return!1;var a,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,r),!0;case 5:return l.fn.call(l.context,t,n,r,o),!0;case 6:return l.fn.call(l.context,t,n,r,o,i),!0}for(c=1,a=new Array(d-1);c<d;c++)a[c-1]=arguments[c];l.fn.apply(l.context,a)}else{var h,u=l.length;for(c=0;c<u;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,r);break;default:if(!a)for(h=1,a=new Array(d-1);h<d;h++)a[h-1]=arguments[h];l[c].fn.apply(l[c].context,a)}}return!0},Oe.prototype.on=function(e,t,n){return Be(this,e,t,n,!1)},Oe.prototype.once=function(e,t,n){return Be(this,e,t,n,!0)},Oe.prototype.removeListener=function(e,t,n,r){var o=qe?qe+e:e;if(!this._events[o])return this;if(!t)return De(this,o),this;var i=this._events[o];if(i.fn)i.fn!==t||r&&!i.once||n&&i.context!==n||De(this,o);else{for(var s=0,a=[],c=i.length;s<c;s++)(i[s].fn!==t||r&&!i[s].once||n&&i[s].context!==n)&&a.push(i[s]);a.length?this._events[o]=1===a.length?a[0]:a:De(this,o)}return this},Oe.prototype.removeAllListeners=function(e){var t;return e?(t=qe?qe+e:e,this._events[t]&&De(this,t)):(this._events=new Ie,this._eventsCount=0),this},Oe.prototype.off=Oe.prototype.removeListener,Oe.prototype.addListener=Oe.prototype.on,Oe.prefixed=qe,Oe.EventEmitter=Oe,Re=Oe;var Ue,je,Le,Ne,Fe,ze,Ke,He,Ye,Je,Ge,Qe,We,Ze,$e,Xe={};be(Xe,"ConnectionType",(()=>Ue)),be(Xe,"PeerErrorType",(()=>Le)),be(Xe,"BaseConnectionErrorType",(()=>Fe)),be(Xe,"DataConnectionErrorType",(()=>Ke)),be(Xe,"SerializationType",(()=>Ye)),be(Xe,"SocketEventType",(()=>Ge)),be(Xe,"ServerMessageType",(()=>We)),(je=Ue||(Ue={})).Data="data",je.Media="media",(Ne=Le||(Le={})).BrowserIncompatible="browser-incompatible",Ne.Disconnected="disconnected",Ne.InvalidID="invalid-id",Ne.InvalidKey="invalid-key",Ne.Network="network",Ne.PeerUnavailable="peer-unavailable",Ne.SslUnavailable="ssl-unavailable",Ne.ServerError="server-error",Ne.SocketError="socket-error",Ne.SocketClosed="socket-closed",Ne.UnavailableID="unavailable-id",Ne.WebRTC="webrtc",(ze=Fe||(Fe={})).NegotiationFailed="negotiation-failed",ze.ConnectionClosed="connection-closed",(He=Ke||(Ke={})).NotOpenYet="not-open-yet",He.MessageToBig="message-too-big",(Je=Ye||(Ye={})).Binary="binary",Je.BinaryUTF8="binary-utf8",Je.JSON="json",Je.None="raw",(Qe=Ge||(Ge={})).Message="message",Qe.Disconnected="disconnected",Qe.Error="error",Qe.Close="close",(Ze=We||(We={})).Heartbeat="HEARTBEAT",Ze.Candidate="CANDIDATE",Ze.Offer="OFFER",Ze.Answer="ANSWER",Ze.Open="OPEN",Ze.Error="ERROR",Ze.IdTaken="ID-TAKEN",Ze.InvalidKey="INVALID-KEY",Ze.Leave="LEAVE",Ze.Expire="EXPIRE",$e=JSON.parse('{"name":"peerjs","version":"1.5.3","keywords":["peerjs","webrtc","p2p","rtc"],"description":"PeerJS client","homepage":"https://peerjs.com","bugs":{"url":"https://github.com/peers/peerjs/issues"},"repository":{"type":"git","url":"https://github.com/peers/peerjs"},"license":"MIT","contributors":["Michelle Bu <michelle@michellebu.com>","afrokick <devbyru@gmail.com>","ericz <really.ez@gmail.com>","Jairo <kidandcat@gmail.com>","Jonas Gloning <34194370+jonasgloning@users.noreply.github.com>","Jairo Caro-Accino Viciana <jairo@galax.be>","Carlos Caballero <carlos.caballero.gonzalez@gmail.com>","hc <hheennrryy@gmail.com>","Muhammad Asif <capripio@gmail.com>","PrashoonB <prashoonbhattacharjee@gmail.com>","Harsh Bardhan Mishra <47351025+HarshCasper@users.noreply.github.com>","akotynski <aleksanderkotbury@gmail.com>","lmb <i@lmb.io>","Jairooo <jairocaro@msn.com>","Moritz Stückler <moritz.stueckler@gmail.com>","Simon <crydotsnakegithub@gmail.com>","Denis Lukov <denismassters@gmail.com>","Philipp Hancke <fippo@andyet.net>","Hans Oksendahl <hansoksendahl@gmail.com>","Jess <jessachandler@gmail.com>","khankuan <khankuan@gmail.com>","DUODVK <kurmanov.work@gmail.com>","XiZhao <kwang1imsa@gmail.com>","Matthias Lohr <matthias@lohr.me>","=frank tree <=frnktrb@googlemail.com>","Andre Eckardt <aeckardt@outlook.com>","Chris Cowan <agentme49@gmail.com>","Alex Chuev <alex@chuev.com>","alxnull <alxnull@e.mail.de>","Yemel Jardi <angel.jardi@gmail.com>","Ben Parnell <benjaminparnell.94@gmail.com>","Benny Lichtner <bennlich@gmail.com>","fresheneesz <bitetrudpublic@gmail.com>","bob.barstead@exaptive.com <bob.barstead@exaptive.com>","chandika <chandika@gmail.com>","emersion <contact@emersion.fr>","Christopher Van <cvan@users.noreply.github.com>","eddieherm <edhermoso@gmail.com>","Eduardo Pinho <enet4mikeenet@gmail.com>","Evandro Zanatta <ezanatta@tray.net.br>","Gardner Bickford <gardner@users.noreply.github.com>","Gian Luca <gianluca.cecchi@cynny.com>","PatrickJS <github@gdi2290.com>","jonnyf <github@jonathanfoss.co.uk>","Hizkia Felix <hizkifw@gmail.com>","Hristo Oskov <hristo.oskov@gmail.com>","Isaac Madwed <i.madwed@gmail.com>","Ilya Konanykhin <ilya.konanykhin@gmail.com>","jasonbarry <jasbarry@me.com>","Jonathan Burke <jonathan.burke.1311@googlemail.com>","Josh Hamit <josh.hamit@gmail.com>","Jordan Austin <jrax86@gmail.com>","Joel Wetzell <jwetzell@yahoo.com>","xizhao <kevin.wang@cloudera.com>","Alberto Torres <kungfoobar@gmail.com>","Jonathan Mayol <mayoljonathan@gmail.com>","Jefferson Felix <me@jsfelix.dev>","Rolf Erik Lekang <me@rolflekang.com>","Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>","Pepijn de Vos <pepijndevos@gmail.com>","JooYoung <qkdlql@naver.com>","Tobias Speicher <rootcommander@gmail.com>","Steve Blaurock <sblaurock@gmail.com>","Kyrylo Shegeda <shegeda@ualberta.ca>","Diwank Singh Tomer <singh@diwank.name>","Sören Balko <Soeren.Balko@gmail.com>","Arpit Solanki <solankiarpit1997@gmail.com>","Yuki Ito <yuki@gnnk.net>","Artur Zayats <zag2art@gmail.com>"],"funding":{"type":"opencollective","url":"https://opencollective.com/peer"},"collective":{"type":"opencollective","url":"https://opencollective.com/peer"},"files":["dist/*"],"sideEffects":["lib/global.ts","lib/supports.ts"],"main":"dist/bundler.cjs","module":"dist/bundler.mjs","browser-minified":"dist/peerjs.min.js","browser-unminified":"dist/peerjs.js","browser-minified-cbor":"dist/serializer.cbor.mjs","browser-minified-msgpack":"dist/serializer.msgpack.mjs","types":"dist/types.d.ts","engines":{"node":">= 14"},"targets":{"types":{"source":"lib/exports.ts"},"main":{"source":"lib/exports.ts","sourceMap":{"inlineSources":true}},"module":{"source":"lib/exports.ts","includeNodeModules":["eventemitter3"],"sourceMap":{"inlineSources":true}},"browser-minified":{"context":"browser","outputFormat":"global","optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-unminified":{"context":"browser","outputFormat":"global","optimize":false,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-minified-cbor":{"context":"browser","outputFormat":"esmodule","isLibrary":true,"optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15"},"source":"lib/dataconnection/StreamConnection/Cbor.ts"},"browser-minified-msgpack":{"context":"browser","outputFormat":"esmodule","isLibrary":true,"optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15"},"source":"lib/dataconnection/StreamConnection/MsgPack.ts"}},"scripts":{"contributors":"git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \\"chore(contributors): update and sort contributors list\\"","check":"tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit","watch":"parcel watch","build":"rm -rf dist && parcel build","prepublishOnly":"npm run build","test":"jest","test:watch":"jest --watch","coverage":"jest --coverage --collectCoverageFrom=\\"./lib/**\\"","format":"prettier --write .","format:check":"prettier --check .","semantic-release":"semantic-release","e2e":"wdio run e2e/wdio.local.conf.ts","e2e:bstack":"wdio run e2e/wdio.bstack.conf.ts"},"devDependencies":{"@parcel/config-default":"^2.9.3","@parcel/packager-ts":"^2.9.3","@parcel/transformer-typescript-tsc":"^2.9.3","@parcel/transformer-typescript-types":"^2.9.3","@semantic-release/changelog":"^6.0.1","@semantic-release/git":"^10.0.1","@swc/core":"^1.3.27","@swc/jest":"^0.2.24","@types/jasmine":"^4.3.4","@wdio/browserstack-service":"^8.11.2","@wdio/cli":"^8.11.2","@wdio/globals":"^8.11.2","@wdio/jasmine-framework":"^8.11.2","@wdio/local-runner":"^8.11.2","@wdio/spec-reporter":"^8.11.2","@wdio/types":"^8.10.4","http-server":"^14.1.1","jest":"^29.3.1","jest-environment-jsdom":"^29.3.1","mock-socket":"^9.0.0","parcel":"^2.9.3","prettier":"^3.0.0","semantic-release":"^21.0.0","ts-node":"^10.9.1","typescript":"^5.0.0","wdio-geckodriver-service":"^5.0.1"},"dependencies":{"@msgpack/msgpack":"^2.8.0","cbor-x":"1.5.4","eventemitter3":"^4.0.7","peerjs-js-binarypack":"^2.1.0","webrtc-adapter":"^8.0.0"},"alias":{"process":false,"buffer":false}}');class et extends Re.EventEmitter{constructor(e,t,n,r,o,i=5e3){super(),this.pingInterval=i,this._disconnected=!0,this._messagesQueue=[];const s=e?"wss://":"ws://";this._baseUrl=s+t+":"+n+r+"peerjs?key="+o}start(e,t){this._id=e;const n=`${this._baseUrl}&id=${e}&token=${t}`;!this._socket&&this._disconnected&&(this._socket=new WebSocket(n+"&version="+$e.version),this._disconnected=!1,this._socket.onmessage=e=>{let t;try{t=JSON.parse(e.data),Pe.log("Server message received:",t)}catch(t){return void Pe.log("Invalid server message",e.data)}this.emit(Ge.Message,t)},this._socket.onclose=e=>{this._disconnected||(Pe.log("Socket closed.",e),this._cleanup(),this._disconnected=!0,this.emit(Ge.Disconnected))},this._socket.onopen=()=>{this._disconnected||(this._sendQueuedMessages(),Pe.log("Socket open"),this._scheduleHeartbeat())})}_scheduleHeartbeat(){this._wsPingTimer=setTimeout((()=>{this._sendHeartbeat()}),this.pingInterval)}_sendHeartbeat(){if(!this._wsOpen())return void Pe.log("Cannot send heartbeat, because socket closed");const e=JSON.stringify({type:We.Heartbeat});this._socket.send(e),this._scheduleHeartbeat()}_wsOpen(){return!!this._socket&&1===this._socket.readyState}_sendQueuedMessages(){const e=[...this._messagesQueue];this._messagesQueue=[];for(const t of e)this.send(t)}send(e){if(this._disconnected)return;if(!this._id)return void this._messagesQueue.push(e);if(!e.type)return void this.emit(Ge.Error,"Invalid message");if(!this._wsOpen())return;const t=JSON.stringify(e);this._socket.send(t)}close(){this._disconnected||(this._cleanup(),this._disconnected=!0)}_cleanup(){this._socket&&(this._socket.onopen=this._socket.onmessage=this._socket.onclose=null,this._socket.close(),this._socket=void 0),clearTimeout(this._wsPingTimer)}}class tt{constructor(e){this.connection=e}startConnection(e){const t=this._startPeerConnection();if(this.connection.peerConnection=t,this.connection.type===Ue.Media&&e._stream&&this._addTracksToConnection(e._stream,t),e.originator){const n=this.connection,r={ordered:!!e.reliable},o=t.createDataChannel(n.label,r);n._initializeDataChannel(o),this._makeOffer()}else this.handleSDP("OFFER",e.sdp)}_startPeerConnection(){Pe.log("Creating RTCPeerConnection.");const e=new RTCPeerConnection(this.connection.provider.options.config);return this._setupListeners(e),e}_setupListeners(e){const t=this.connection.peer,n=this.connection.connectionId,r=this.connection.type,o=this.connection.provider;Pe.log("Listening for ICE candidates."),e.onicecandidate=e=>{e.candidate&&e.candidate.candidate&&(Pe.log(`Received ICE candidates for ${t}:`,e.candidate),o.socket.send({type:We.Candidate,payload:{candidate:e.candidate,type:r,connectionId:n},dst:t}))},e.oniceconnectionstatechange=()=>{switch(e.iceConnectionState){case"failed":Pe.log("iceConnectionState is failed, closing connections to "+t),this.connection.emitError(Fe.NegotiationFailed,"Negotiation of connection to "+t+" failed."),this.connection.close();break;case"closed":Pe.log("iceConnectionState is closed, closing connections to "+t),this.connection.emitError(Fe.ConnectionClosed,"Connection to "+t+" closed."),this.connection.close();break;case"disconnected":Pe.log("iceConnectionState changed to disconnected on the connection with "+t);break;case"completed":e.onicecandidate=()=>{}}this.connection.emit("iceStateChanged",e.iceConnectionState)},Pe.log("Listening for data channel"),e.ondatachannel=e=>{Pe.log("Received data channel");const r=e.channel;o.getConnection(t,n)._initializeDataChannel(r)},Pe.log("Listening for remote stream"),e.ontrack=e=>{Pe.log("Received remote stream");const r=e.streams[0],i=o.getConnection(t,n);if(i.type===Ue.Media){const e=i;this._addStreamToMediaConnection(r,e)}}}cleanup(){Pe.log("Cleaning up PeerConnection to "+this.connection.peer);const e=this.connection.peerConnection;if(!e)return;this.connection.peerConnection=null,e.onicecandidate=e.oniceconnectionstatechange=e.ondatachannel=e.ontrack=()=>{};const t="closed"!==e.signalingState;let n=!1;const r=this.connection.dataChannel;r&&(n=!!r.readyState&&"closed"!==r.readyState),(t||n)&&e.close()}async _makeOffer(){const e=this.connection.peerConnection,t=this.connection.provider;try{const n=await e.createOffer(this.connection.options.constraints);Pe.log("Created offer."),this.connection.options.sdpTransform&&"function"==typeof this.connection.options.sdpTransform&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{await e.setLocalDescription(n),Pe.log("Set localDescription:",n,`for:${this.connection.peer}`);let r={sdp:n,type:this.connection.type,connectionId:this.connection.connectionId,metadata:this.connection.metadata};if(this.connection.type===Ue.Data){const e=this.connection;r={...r,label:e.label,reliable:e.reliable,serialization:e.serialization}}t.socket.send({type:We.Offer,payload:r,dst:this.connection.peer})}catch(e){"OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer"!=e&&(t.emitError(Le.WebRTC,e),Pe.log("Failed to setLocalDescription, ",e))}}catch(e){t.emitError(Le.WebRTC,e),Pe.log("Failed to createOffer, ",e)}}async _makeAnswer(){const e=this.connection.peerConnection,t=this.connection.provider;try{const n=await e.createAnswer();Pe.log("Created answer."),this.connection.options.sdpTransform&&"function"==typeof this.connection.options.sdpTransform&&(n.sdp=this.connection.options.sdpTransform(n.sdp)||n.sdp);try{await e.setLocalDescription(n),Pe.log("Set localDescription:",n,`for:${this.connection.peer}`),t.socket.send({type:We.Answer,payload:{sdp:n,type:this.connection.type,connectionId:this.connection.connectionId},dst:this.connection.peer})}catch(e){t.emitError(Le.WebRTC,e),Pe.log("Failed to setLocalDescription, ",e)}}catch(e){t.emitError(Le.WebRTC,e),Pe.log("Failed to create answer, ",e)}}async handleSDP(e,t){t=new RTCSessionDescription(t);const n=this.connection.peerConnection,r=this.connection.provider;Pe.log("Setting remote description",t);const o=this;try{await n.setRemoteDescription(t),Pe.log(`Set remoteDescription:${e} for:${this.connection.peer}`),"OFFER"===e&&await o._makeAnswer()}catch(e){r.emitError(Le.WebRTC,e),Pe.log("Failed to setRemoteDescription, ",e)}}async handleCandidate(e){Pe.log("handleCandidate:",e);try{await this.connection.peerConnection.addIceCandidate(e),Pe.log(`Added ICE candidate for:${this.connection.peer}`)}catch(e){this.connection.provider.emitError(Le.WebRTC,e),Pe.log("Failed to handleCandidate, ",e)}}_addTracksToConnection(e,t){if(Pe.log(`add tracks from stream ${e.id} to peer connection`),!t.addTrack)return Pe.error("Your browser does't support RTCPeerConnection#addTrack. Ignored.");e.getTracks().forEach((n=>{t.addTrack(n,e)}))}_addStreamToMediaConnection(e,t){Pe.log(`add stream ${e.id} to media connection ${t.connectionId}`),t.addStream(e)}}class nt extends Re.EventEmitter{emitError(e,t){Pe.error("Error:",t),this.emit("error",new rt(`${e}`,t))}}class rt extends Error{constructor(e,t){"string"==typeof t?super(t):(super(),Object.assign(this,t)),this.type=e}}class ot extends nt{get open(){return this._open}constructor(e,t,n){super(),this.peer=e,this.provider=t,this.options=n,this._open=!1,this.metadata=n.metadata}}class it extends ot{static#e=this.ID_PREFIX="mc_";get type(){return Ue.Media}get localStream(){return this._localStream}get remoteStream(){return this._remoteStream}constructor(e,t,n){super(e,t,n),this._localStream=this.options._stream,this.connectionId=this.options.connectionId||it.ID_PREFIX+_e.randomToken(),this._negotiator=new tt(this),this._localStream&&this._negotiator.startConnection({_stream:this._localStream,originator:!0})}_initializeDataChannel(e){this.dataChannel=e,this.dataChannel.onopen=()=>{Pe.log(`DC#${this.connectionId} dc connection success`),this.emit("willCloseOnRemote")},this.dataChannel.onclose=()=>{Pe.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}addStream(e){Pe.log("Receiving stream",e),this._remoteStream=e,super.emit("stream",e)}handleMessage(e){const t=e.type,n=e.payload;switch(e.type){case We.Answer:this._negotiator.handleSDP(t,n.sdp),this._open=!0;break;case We.Candidate:this._negotiator.handleCandidate(n.candidate);break;default:Pe.warn(`Unrecognized message type:${t} from peer:${this.peer}`)}}answer(e,t={}){if(this._localStream)return void Pe.warn("Local stream already exists on this MediaConnection. Are you answering a call twice?");this._localStream=e,t&&t.sdpTransform&&(this.options.sdpTransform=t.sdpTransform),this._negotiator.startConnection({...this.options._payload,_stream:e});const n=this.provider._getMessages(this.connectionId);for(const e of n)this.handleMessage(e);this._open=!0}close(){this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this._localStream=null,this._remoteStream=null,this.provider&&(this.provider._removeConnection(this),this.provider=null),this.options&&this.options._stream&&(this.options._stream=null),this.open&&(this._open=!1,super.emit("close"))}}class st{constructor(e){this._options=e}_buildRequest(e){const t=this._options.secure?"https":"http",{host:n,port:r,path:o,key:i}=this._options,s=new URL(`${t}://${n}:${r}${o}${i}/${e}`);return s.searchParams.set("ts",`${Date.now()}${Math.random()}`),s.searchParams.set("version",$e.version),fetch(s.href,{referrerPolicy:this._options.referrerPolicy})}async retrieveId(){try{const e=await this._buildRequest("id");if(200!==e.status)throw new Error(`Error. Status:${e.status}`);return e.text()}catch(e){Pe.error("Error retrieving ID",e);let t="";throw"/"===this._options.path&&this._options.host!==_e.CLOUD_HOST&&(t=" If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."),new Error("Could not get an ID from the server."+t)}}async listAllPeers(){try{const e=await this._buildRequest("peers");if(200!==e.status){if(401===e.status){let e="";throw e=this._options.host===_e.CLOUD_HOST?"It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key.":"You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.",new Error("It doesn't look like you have permission to list peers IDs. "+e)}throw new Error(`Error. Status:${e.status}`)}return e.json()}catch(e){throw Pe.error("Error retrieving list peers",e),new Error("Could not get list peers from the server."+e)}}}class at extends ot{static#e=this.ID_PREFIX="dc_";static#t=this.MAX_BUFFERED_AMOUNT=8388608;get type(){return Ue.Data}constructor(e,t,n){super(e,t,n),this.connectionId=this.options.connectionId||at.ID_PREFIX+ke(),this.label=this.options.label||this.connectionId,this.reliable=!!this.options.reliable,this._negotiator=new tt(this),this._negotiator.startConnection(this.options._payload||{originator:!0,reliable:this.reliable})}_initializeDataChannel(e){this.dataChannel=e,this.dataChannel.onopen=()=>{Pe.log(`DC#${this.connectionId} dc connection success`),this._open=!0,this.emit("open")},this.dataChannel.onmessage=e=>{Pe.log(`DC#${this.connectionId} dc onmessage:`,e.data)},this.dataChannel.onclose=()=>{Pe.log(`DC#${this.connectionId} dc closed for:`,this.peer),this.close()}}close(e){e?.flush?this.send({__peerData:{type:"close"}}):(this._negotiator&&(this._negotiator.cleanup(),this._negotiator=null),this.provider&&(this.provider._removeConnection(this),this.provider=null),this.dataChannel&&(this.dataChannel.onopen=null,this.dataChannel.onmessage=null,this.dataChannel.onclose=null,this.dataChannel=null),this.open&&(this._open=!1,super.emit("close")))}send(e,t=!1){if(this.open)return this._send(e,t);this.emitError(Ke.NotOpenYet,"Connection is not open. You should listen for the `open` event before sending messages.")}async handleMessage(e){const t=e.payload;switch(e.type){case We.Answer:await this._negotiator.handleSDP(e.type,t.sdp);break;case We.Candidate:await this._negotiator.handleCandidate(t.candidate);break;default:Pe.warn("Unrecognized message type:",e.type,"from peer:",this.peer)}}}class ct extends at{get bufferSize(){return this._bufferSize}_initializeDataChannel(e){super._initializeDataChannel(e),this.dataChannel.binaryType="arraybuffer",this.dataChannel.addEventListener("message",(e=>this._handleDataMessage(e)))}_bufferedSend(e){!this._buffering&&this._trySend(e)||(this._buffer.push(e),this._bufferSize=this._buffer.length)}_trySend(e){if(!this.open)return!1;if(this.dataChannel.bufferedAmount>at.MAX_BUFFERED_AMOUNT)return this._buffering=!0,setTimeout((()=>{this._buffering=!1,this._tryBuffer()}),50),!1;try{this.dataChannel.send(e)}catch(e){return Pe.error(`DC#:${this.connectionId} Error when sending:`,e),this._buffering=!0,this.close(),!1}return!0}_tryBuffer(){if(!this.open)return;if(0===this._buffer.length)return;const e=this._buffer[0];this._trySend(e)&&(this._buffer.shift(),this._bufferSize=this._buffer.length,this._tryBuffer())}close(e){e?.flush?this.send({__peerData:{type:"close"}}):(this._buffer=[],this._bufferSize=0,super.close())}constructor(...e){super(...e),this._buffer=[],this._bufferSize=0,this._buffering=!1}}class lt extends ct{close(e){super.close(e),this._chunkedData={}}constructor(e,t,n){super(e,t,n),this.chunker=new Ce,this.serialization=Ye.Binary,this._chunkedData={}}_handleDataMessage({data:e}){const t=u(e),n=t.__peerData;if(n)return"close"===n.type?void this.close():void this._handleChunk(t);this.emit("data",t)}_handleChunk(e){const t=e.__peerData,n=this._chunkedData[t]||{data:[],count:0,total:e.total};if(n.data[e.n]=new Uint8Array(e.data),n.count++,this._chunkedData[t]=n,n.total===n.count){delete this._chunkedData[t];const e=function(e){let t=0;for(const n of e)t+=n.byteLength;const n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.byteLength;return n}(n.data);this._handleDataMessage({data:e})}}_send(e,t){const n=p(e);if(n instanceof Promise)return this._send_blob(n);!t&&n.byteLength>this.chunker.chunkedMTU?this._sendChunks(n):this._bufferedSend(n)}async _send_blob(e){const t=await e;t.byteLength>this.chunker.chunkedMTU?this._sendChunks(t):this._bufferedSend(t)}_sendChunks(e){const t=this.chunker.chunk(e);Pe.log(`DC#${this.connectionId} Try to send ${t.length} chunks...`);for(const e of t)this.send(e,!0)}}class dt extends ct{_handleDataMessage({data:e}){super.emit("data",e)}_send(e,t){this._bufferedSend(e)}constructor(...e){super(...e),this.serialization=Ye.None}}class ht extends ct{_handleDataMessage({data:e}){const t=this.parse(this.decoder.decode(e)),n=t.__peerData;n&&"close"===n.type?this.close():this.emit("data",t)}_send(e,t){const n=this.encoder.encode(this.stringify(e));n.byteLength>=_e.chunkedMTU?this.emitError(Ke.MessageToBig,"Message too big for JSON channel"):this._bufferedSend(n)}constructor(...e){super(...e),this.serialization=Ye.JSON,this.encoder=new TextEncoder,this.decoder=new TextDecoder,this.stringify=JSON.stringify,this.parse=JSON.parse}}class ut extends nt{static#e=this.DEFAULT_KEY="peerjs";get id(){return this._id}get options(){return this._options}get open(){return this._open}get socket(){return this._socket}get connections(){const e=Object.create(null);for(const[t,n]of this._connections)e[t]=n;return e}get destroyed(){return this._destroyed}get disconnected(){return this._disconnected}constructor(e,t){let n;super(),this._serializers={raw:dt,json:ht,binary:lt,"binary-utf8":lt,default:lt},this._id=null,this._lastServerId=null,this._destroyed=!1,this._disconnected=!1,this._open=!1,this._connections=new Map,this._lostMessages=new Map,e&&e.constructor==Object?t=e:e&&(n=e.toString()),t={debug:0,host:_e.CLOUD_HOST,port:_e.CLOUD_PORT,path:"/",key:ut.DEFAULT_KEY,token:_e.randomToken(),config:_e.defaultConfig,referrerPolicy:"strict-origin-when-cross-origin",serializers:{},...t},this._options=t,this._serializers={...this._serializers,...this.options.serializers},"/"===this._options.host&&(this._options.host=window.location.hostname),this._options.path&&("/"!==this._options.path[0]&&(this._options.path="/"+this._options.path),"/"!==this._options.path[this._options.path.length-1]&&(this._options.path+="/")),void 0===this._options.secure&&this._options.host!==_e.CLOUD_HOST?this._options.secure=_e.isSecure():this._options.host==_e.CLOUD_HOST&&(this._options.secure=!0),this._options.logFunction&&Pe.setLogFunction(this._options.logFunction),Pe.logLevel=this._options.debug||0,this._api=new st(t),this._socket=this._createServerConnection(),_e.supports.audioVideo||_e.supports.data?!n||_e.validateId(n)?n?this._initialize(n):this._api.retrieveId().then((e=>this._initialize(e))).catch((e=>this._abort(Le.ServerError,e))):this._delayedAbort(Le.InvalidID,`ID "${n}" is invalid`):this._delayedAbort(Le.BrowserIncompatible,"The current browser does not support WebRTC")}_createServerConnection(){const e=new et(this._options.secure,this._options.host,this._options.port,this._options.path,this._options.key,this._options.pingInterval);return e.on(Ge.Message,(e=>{this._handleMessage(e)})),e.on(Ge.Error,(e=>{this._abort(Le.SocketError,e)})),e.on(Ge.Disconnected,(()=>{this.disconnected||(this.emitError(Le.Network,"Lost connection to server."),this.disconnect())})),e.on(Ge.Close,(()=>{this.disconnected||this._abort(Le.SocketClosed,"Underlying socket is already closed.")})),e}_initialize(e){this._id=e,this.socket.start(e,this._options.token)}_handleMessage(e){const t=e.type,n=e.payload,r=e.src;switch(t){case We.Open:this._lastServerId=this.id,this._open=!0,this.emit("open",this.id);break;case We.Error:this._abort(Le.ServerError,n.msg);break;case We.IdTaken:this._abort(Le.UnavailableID,`ID "${this.id}" is taken`);break;case We.InvalidKey:this._abort(Le.InvalidKey,`API KEY "${this._options.key}" is invalid`);break;case We.Leave:Pe.log(`Received leave message from ${r}`),this._cleanupPeer(r),this._connections.delete(r);break;case We.Expire:this.emitError(Le.PeerUnavailable,`Could not connect to peer ${r}`);break;case We.Offer:{const e=n.connectionId;let t=this.getConnection(r,e);if(t&&(t.close(),Pe.warn(`Offer received for existing Connection ID:${e}`)),n.type===Ue.Media){const o=new it(r,this,{connectionId:e,_payload:n,metadata:n.metadata});t=o,this._addConnection(r,t),this.emit("call",o)}else{if(n.type!==Ue.Data)return void Pe.warn(`Received malformed connection type:${n.type}`);{const o=new this._serializers[n.serialization](r,this,{connectionId:e,_payload:n,metadata:n.metadata,label:n.label,serialization:n.serialization,reliable:n.reliable});t=o,this._addConnection(r,t),this.emit("connection",o)}}const o=this._getMessages(e);for(const e of o)t.handleMessage(e);break}default:{if(!n)return void Pe.warn(`You received a malformed message from ${r} of type ${t}`);const o=n.connectionId,i=this.getConnection(r,o);i&&i.peerConnection?i.handleMessage(e):o?this._storeMessage(o,e):Pe.warn("You received an unrecognized message:",e);break}}}_storeMessage(e,t){this._lostMessages.has(e)||this._lostMessages.set(e,[]),this._lostMessages.get(e).push(t)}_getMessages(e){const t=this._lostMessages.get(e);return t?(this._lostMessages.delete(e),t):[]}connect(e,t={}){if(t={serialization:"default",...t},this.disconnected)return Pe.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available."),void this.emitError(Le.Disconnected,"Cannot connect to new Peer after disconnecting from server.");const n=new this._serializers[t.serialization](e,this,t);return this._addConnection(e,n),n}call(e,t,n={}){if(this.disconnected)return Pe.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect."),void this.emitError(Le.Disconnected,"Cannot connect to new Peer after disconnecting from server.");if(!t)return void Pe.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");const r=new it(e,this,{...n,_stream:t});return this._addConnection(e,r),r}_addConnection(e,t){Pe.log(`add connection ${t.type}:${t.connectionId} to peerId:${e}`),this._connections.has(e)||this._connections.set(e,[]),this._connections.get(e).push(t)}_removeConnection(e){const t=this._connections.get(e.peer);if(t){const n=t.indexOf(e);-1!==n&&t.splice(n,1)}this._lostMessages.delete(e.connectionId)}getConnection(e,t){const n=this._connections.get(e);if(!n)return null;for(const e of n)if(e.connectionId===t)return e;return null}_delayedAbort(e,t){setTimeout((()=>{this._abort(e,t)}),0)}_abort(e,t){Pe.error("Aborting!"),this.emitError(e,t),this._lastServerId?this.disconnect():this.destroy()}destroy(){this.destroyed||(Pe.log(`Destroy peer with ID:${this.id}`),this.disconnect(),this._cleanup(),this._destroyed=!0,this.emit("close"))}_cleanup(){for(const e of this._connections.keys())this._cleanupPeer(e),this._connections.delete(e);this.socket.removeAllListeners()}_cleanupPeer(e){const t=this._connections.get(e);if(t)for(const e of t)e.close()}disconnect(){if(this.disconnected)return;const e=this.id;Pe.log(`Disconnect peer with ID:${e}`),this._disconnected=!0,this._open=!1,this.socket.close(),this._lastServerId=e,this._id=null,this.emit("disconnected",e)}reconnect(){if(this.disconnected&&!this.destroyed)Pe.log(`Attempting reconnection to server with ID ${this._lastServerId}`),this._disconnected=!1,this._initialize(this._lastServerId);else{if(this.destroyed)throw new Error("This peer cannot reconnect to the server. It has already been destroyed.");if(this.disconnected||this.open)throw new Error(`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`);Pe.error("In a hurry? We're still trying to make the initial connection!")}}listAllPeers(e=(e=>{})){this._api.listAllPeers().then((t=>e(t))).catch((e=>this._abort(Le.ServerError,e)))}}let pt;Symbol.for(null),pt="https://keypad.website/keypad?";class ft{constructor(e={keypadUrl:pt,targetElementId:null,onErrorReconnectMessage:"Connection lost. Please reconnect..."}){this.onErrorReconnectMessage=e.onErrorReconnectMessage,this.conn=null,this.lastPeerId=null,this.keypadUrl=e.hasOwnProperty("keypadUrl")?e.keypadUrl:pt,this.targetElement=e.hasOwnProperty("targetElementId")?e.targetElementId:null,this.ttd=e.hasOwnProperty("ttd")?e.hasOwnProperty("ttd"):6e4,this.heartbeatIntervalMs=e.hasOwnProperty("heartRate")?e.hasOwnProperty("heartRate"):1e4,this.lastHeartbeat=performance.now(),this.heartBeatInterval=void 0,this.heartCheckInterval=void 0,this.peer=new ut(null,{pingInterval:this.heartbeatIntervalMs,debug:2,config:{iceServers:[{urls:"stun:stun.relay.metered.ca:80"},{urls:"turn:global.relay.metered.ca:80",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"},{urls:"turn:global.relay.metered.ca:80?transport=tcp",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"},{urls:"turn:global.relay.metered.ca:443",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"},{urls:"turns:global.relay.metered.ca:443?transport=tcp",username:"de884cfc34189cdf1a5dd616",credential:"IcOpouU9/TYBmpHU"}]}}),this.alphabet=null,this.font=null,this.keypressFeedbackSound="data:audio/mpeg;base64,//uQZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAALAAATlgAXFxcXFxcXFxcuLi4uLi4uLi5FRUVFRUVFRUVdXV1dXV1dXV10dHR0dHR0dHSLi4uLi4uLi4uioqKioqKioqK6urq6urq6urrR0dHR0dHR0dHo6Ojo6Ojo6Oj///////////8AAAA5TEFNRTMuMTAwAaoAAAAALgYAABSAJAZbTgAAgAAAE5YfafL/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//uQZAAAA0YVyhVvQAAAAA0goAABGfWdITn6gAgAADSDAAAAAEWjAwMwMDMFBzCQsw8PMPCwUDgkNMpNzXEoSUTP3s6nJPd4z28k62JNdIwIUHj3nvynRempMmLAo/tff9/3IchyHIch/IxY3SUmG86enD4Pg+fgmfEAIQQcsP+oH//E7/+Ud/1HP/B9AAABMCFFFAAAwDgCyMCVAgQcBQmARAHw0AOGAUgFJgUoL8YKsEvqzGA1APJQAIGBNgDpoBRvQYb6EIGhIkmJg1QA0aH0H4GDBgJ4G55UBpM1AGgUG0wAgOBIUAYJGoGFQ4AkHitxzRSocGMwDYYCwJAWAICgBD8jhwlEqBNsMiAkCBpQY2FxpG61opmucDLrjKi6Fmk5oK9PWVh1DNFM2IaRH/q8mTQgTF4sk0bnv//zEuqRMjYycuuj///5wxZzIvLSMTUxYyZL////86ZBqh4D+QUIABcwBQBLMCmAeTA4wJowO8E2DAeYwQ8CWMDLBHDB1QpIxscoSMwBQJj/WZBA3O4mFMHIAGzAKAVgwmcG8OIV//uSZCIN9VQ4wgd/gAAAAA0g4AABD+S/Di5+qgAAADSAAAAEEzcNTC4yM0m41SLDHAJLSggBKwtKRwb6+IBi4ctbepDskh2KmAgA16NTNrON66ptO40mNa9ayZHVx7zmGPHktZb7vP9xLn4fr+9jeO//8P+z39///9T/////t+d6vf1+c6fP9Hv5cxg4aA4TgkGIYmLbYHGAxaCjHwlM0lwBC4zGwzVG+MFnGoTY8sn0w1MSHA09vAM8ssDCSYAykIABmeCI4AKDMDIRfGbFAjWE8h+BfIEfBoFCTQJUcA5ZIrQDjzQ+gWzxsjDLtE4s46kxjHZZom2SXfyj6uadvNvb0ee/3dX//01YAVKw/FoW3hDrwUDTAwDMVigy8rTYaRNKug2tzzBwxnAx/DOuMhFECAOxWsDO6kAwkdQFH0BiwIgYlAwCgdAwiZBBI1kCC5JcWwCQWMQ/JQnkVFkOVN8oku8yDkjbMiry+2rrLvW/MvT53q/yv+n2///dywQL8DRgOgsrBBi0LGcngZrCZgYxGEAoZ+IplUdGJ1ifHVRh5v/7kmRMDPOhJ0MTn6qAAAANIAAAARDEiQhOf0pAAAA0gAAABAdCcEnCwmbqA1JhbIFwYKEAUGAXgOJo45oXAyjT0MinMgXM2UNoNGyYeLN0ENORMgQC5EYAJlr4Z3L3lgaHG5VO0lWX1q92J3t9sWM+bu9/fe8/VT/L+zq9v+zr9/+//8r71SAAAA9tq0AA1hzXXdxmzgPWzJyU20wh4EDDUSzWI4x4rgMGBd+IImDoAiEBAMCJn2HpqAlRpDIZhbxxp2ASQcGVRJG6RC4xmaZHiYlYPKGGdEGJjIoa4YtICXGHRhGJg2QMkYJADRGfCMTZE5+4ze1gMF1k163DfQrNgh83G3zIYoMdC4wEOwcrzMxMMam0AlYxkKzOgqMDhUuUBgYIQOWiEgwYHAogAwXBAYHAKAVVm0ZW2J1Wno9taaAzuOSF34AjMUjdBOy+pjbpKCil9TG/hOWRkUkxad2pAAAGFlrIADgyUqh1syPqzGQRoUAEDDoFgKMDw7MVA2NJ1sKHaMVghBwfGAgOgJR0migMTBUODDQezBI5jGNQzXD/+5JkjYD20jDN67/kngAADSAAAAEXjN0dTv9SAAAANIAAAASwgEb7HKvHZpiFAM0Bgs8wPYBNNi8MMfMIKRGRlOETOErM6wMGpBTQHTjJEQaKEBoKmlLXGizd5Ax5W2Byh0X6R9YRJ2rQFSKzgZDB0DQDKJHDr/MoZRDsaleN+vVhpoVqzczvZYx+Hdbx1/MuWOZb///Vr1YX93I/6P9KAWAQE8pFZWkOCuFAO0EEAThJ4OYwBQMHIJgUUVrHHRwaURUkZ4YX6MYvO6EDvpgTJY6aVeR7mGcgzBgfQE2YCuA5H9adJQKBCAhAqA53/aS/bk0T1zjIhpmcjVumpqS/ZZ1v6TuOXxF1+49x5d5Knl/Luvw7ua/8P/DdWT+dOkhD5zhvqb0db/93/5AQAQsF3glyO4MAysKti2BGAAdE0L31C4EMAhEAgAu28hgMOFHwEgaYACAFHpko0GM0ia2Yx0/wmKECIhpq5poYK2CTmAQAMhgAQBKYAoARFUAhUQbKhIMAxAFG3eFpLns4drJbaY9+pDVDPZ/QKtLHKNCpsTA6//uSZIEE9GAuRhNfzIAAAA0gAAABEnjLFK588sAAADSAAAAEdTXMSKxfop3DPM5RNbal/EvU7p6/Ie/t93Z1v6OqEAzmEmBoIQcGTCwGMCghPwvOQgUwEbKMZBgNAwOPZioUiMIl/ACXRGoREDB0clmTLApMiq4x2azRlmMM7NijivBEQxUIGvMGdAsjAxgHcDSxgRZANSYAOAgYs0FXAnwaIl43xAcuEVEogHIiFKRHEuREzUfFfSOoEgRyTk8Isema00Fl0gzqujqL/ZT3Krfoq7r1H/AvWzp/yXv/3f/oA0GjFwIZS19BgKAsiCDxuUBAMZ8D6zIZAIFMChweF7GFbQAITYoiSSSvMRBoUJ5l4RGVzOa2hhmAr6mbNSaYcYlxgqAvmAaCEYDAE6yBgAFIpAsGADyaXw+/MSnONGVBjhuNW+/dbYnEQqJJNwIgainmo0TB3Ofkus/yHs5P3dnW/+ryf+QqTEFNRTMuMTAwqqqqqqqqqqqqAABjBgrdYuwIwHSioNCCFkYbBZpMaoVDIRMDhB326ByJkJgYuGdC4P/7kmSwDPT4N0MLn6SAAAANIAAAARDIpRJOePLAAAA0gAAABDAGIA0YOGJhoVGKx+YbQxu2mmHbCT5rII6wYW2ASgYFJDgHYBAIpMARM6WcpEFALUjnWoXbkbwf8AGkx+2FugJGw/l2gIK+vverzfFet8Re/kur09f/f/u6f/1GySAhOMFigxOOnJAAdLIIqmTCCa9ahACTDANMqFMLAIQjQw0EVbjH4aOuN8OAgFCBn0sS0GpU0IAjUJ3MCoPaDTTB4AwnIE7MGrBCjAcgE836g5kUx6AtCKkjKElvKarxnFzLOlKRocalMtnabKM6hpYW5TSrdLe1Kop3e+ZWtymHt445fv9Vfyy/Hn5Xv///v1bXt4M9Z7+o729b+K/4b6pMQU1FMy4xMDCqqqqqqqqqqqoAArJ2QY8DbERAFjDyZMdBUwYDwIEDHduP9KsmPhhMKGHR0ZzTg0NTB4kGhkYqgZ2MZGQRUYNHoGXBgA4HWYEoBbGCNgvJhVgV8ZJaR2GsQJb5g5gRMYD+BQmAhADQNAVRoA4EQAOXUBwAkYBsAVr/+5Jk0w/0GynDE59coAAADSAAAAEULMkADn9SAAAANIAAAATsdabY4ta/VUMV5DuqzWuVs3pSSLmoKyJqFQGpUi+IAy2PdQm57ZU/m8oR6dDu/KvzehHpx5O/KkuvNN/o39SX9fblC3lusxd7wMr2zmhS+YLExsQBmRRQGKE6HITacxM2hgy8ATH50NVDsxSlQMPDL4bNJAg7HUAIBQcOjCRbMBtAdDAAACkwB4EWMCzCGTGll+U7EVMUMoPCSjDHgWcwaECqP+mza0I1QpATkY0Sm3lwsB0q0C3xd6GWuF4jEAeiqacWb5bdVxJbap8YzlnZWta3hLq34RaGf5hj3/pZ3HveY/3ku7/5a/7Wf//9/92aGoPcO9Z3nep/9H+mTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgBOZ2IMSwdMDATGQhDC4ZXKRj8wGMxub0k5717G//uSZPaO9axfvJOfPEAAAA0gAAABFsja3g5/cEAAADSAAAAELQSBSmZKFYVCYsIjBA1MCgYxWdDkBzMRAEwgQDIIBMgFIzWQTUjgPK3c02lpDWsiqM0Ih0w6QzjB4BzMDcD4wFgEzAfAeQQs8TcsNydp+n5wlq8UapFM2auMpwfZrv475ll25Y5ll3mtzMuwCWO8Ocqe/lndv+j/b1f6/9QATU2x0wCPIAYTCoUHAxhIYX2MXBDC24mvTCAedLotPVa09tEZwuBrSZmkoXXBgkY2SmmPBjQkpGrwfaYZQGhQDcPACJNPw90xLlijCVZWUifsophFk7ww7v7fGk6gE/vB+l0VNkSFwo0bYXJC6gyQQEiwvlDzbHAhHpZLIQbJ1UxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUASWNHVvyNdkdcuCnNLhmA8HuRIHbo/1AhfJ9JZVctla8gMQwpDT96eCGcDAGg8qCCIBce3D8P35RGMZXL8gcmxBByacE9hDD09hNohydtFshlp7EeIe9aMiMe/P/7kmTNjPTPJLaLvPDwAAANIAAAAQ/obuBt+FJAAAA0gAAABEchD3bEIchgekEBmZYRmyPAM3j4DJ8fhgfmeIjtD4HTwPAiPgNGB+BAAjtCABG8AwMvgwAEo5cSIfzt69YYDMdo9RxSsKtgIcom1PMylIK9rWkMkKzctAIIkqXCTqLYAoUrBCJrAlHzJipaMuaPvWraLnsMj6ExUtGUZ0ZRnJ7Q6PrnS7VrsC55kSlRyTYjonPkkybMT2AyVMrbMrYly661bq13Fz0K2JlbEdH1zk9ocnsB09CcutLYmj71p7Q6PWDI+hMXWjJ06Mozk9odH0BkfQmLrRlGdE6M5JrhKJzZKPoSSephKVHJlGcmLhkZXJJ9CYnrRkqSmMZybKpMQU1FMy4xMDCqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+5Jk7QT0dTc4kxw0ogAADSAAAAEZOaLm5+WQSAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqglFJEIRoPjA2MDYyViqViCJxDHghjyPQ4ioUiYKw4EMzYZXAooDEE1y2zRpTu00acWUWWcacaUWYeWcacJAhYgWJFCRQGIFiBZZRZRZlw7s7PG////s7M7Ozs7M5xpRZR5RRpxZRZh5RRZRbRC1NP///9PKqqq4NNNNRKqJXTTTTVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//uSZIIP9BFGHYksMlIAAA0gAAABAAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ=="}displayUpdate=(e,t=!1)=>{if(document.getElementById(this.targetElement)){const n=document.getElementById(this.targetElement);if(t){const t=n.innerText;n.innerText=e+"\n"+t}else n.innerText=e}else console.log("MESSAGE: ",e)};onPeerDisconnected=()=>{this.displayUpdate(this.onErrorReconnectMessage);try{this.peer.id=this.lastPeerId,this.peer._lastServerId=this.lastPeerId,this.peer.reconnect()}catch(e){console.log(e)}};onPeerClose=()=>{this.displayUpdate("Connection closed"),this.conn=null};onPeerError=e=>{this.displayUpdate(e),alert(""+e)};parseParams=e=>{const t=e.get("font");return{alphabet:this.checkAlphabet(decodeURIComponent(e.get("alphabet")).split(",")),font:t,peerId:e.get("peerID")}};queryStringFromObject=e=>Object.keys(e).map((t=>t+"="+encodeURIComponent(e[t]))).join("&");checkAlphabet=e=>{let t;Array.isArray(e)?t=e:"string"==typeof e?t="SPACE"===e.toUpperCase()||"RETURN"==e.toUpperCase()?[e]:e.split(""):(console.error("Error! Alphabet must be specified as an array of symbols, including 'RETURN', 'SPACE'"),t=[]);const n=[...new Set(t)];return"SPACE"in n&&(n=mt(n,"SPACE")),"RETURN"in n&&(n=mt(n,"RETURN")),n};_setupHeartBeatIntervals=()=>{this.heartBeatInterval=setInterval((()=>this.conn?.send({message:"Heartbeat"})),this.heartbeatIntervalMs),this.heartCheckInterval=setInterval((()=>{performance.now()-this.lastHeartbeat>this.ttd&&(console.log("Closing connection due to lack of heartbeat."),this.conn?.close(),this.conn=void 0,clearInterval(this.heartBeatInterval),clearInterval(this.heartCheckInterval),this.heartBeatInterval=void 0,this.heartCheckInterval=void 0)}),this.ttd)}}const mt=(e,t)=>[...e.slice(0,e.indexOf(t)),...e.slice(e.indexOf(t)+1),t];class gt extends ft{constructor(e={keypadUrl:pt,targetElementId:null,visualResponseFeedback:!1}){super({keypadUrl:e.keypadUrl,targetElementId:e.targetElementId}),this.startTime=Date.now(),this.receiverPeerId=null,this.controlButtons=e.controlButtons??["SPACE","RETURN"];const t=this.parseParams(new URLSearchParams(window.location.search));this.receiverPeerId=t.peerId,this.pressFeedback=new Audio(this.keypressFeedbackSound),this.peer.on("open",this.#n),this.peer.on("connection",this.#r),this.peer.on("disconnected",this.onPeerDisconnected),this.peer.on("close",this.onPeerClose),this.peer.on("error",this.onPeerError),this.#o()}#n=e=>{null===this.peer.id?(console.log("Received null id from peer open"),this.peer.id=this.lastPeerId):this.lastPeerId=this.peer.id,this.#i()};#r=e=>{e.on("open",(function(){e.send({message:"Rejected",info:"Sender does not accept incoming connections"}),setTimeout((function(){e.close()}),500)}))};#s=e=>{switch(console.log("Data received: ",e),e.message){case"KeypadParameters":this.alphabet=e.alphabet,this.font=e.font,this.controlButtons=e.controlButtons,this.onErrorReconnectMessage=e.onErrorReconnectMessage,this.#a();break;case"UpdateHeader":document.getElementById("keypad-header").innerText=e.headerContent,document.getElementById("keypad-header").style.display=""===e.headerContent?"none":"block",this.headerMessage=e.headerContent,this.#a();break;case"UpdateFooter":document.getElementById("keypad-footer").innerText=e.headerContent,this.footerMessage=e.headerContent,this.#a();break;case"Update":e.hasOwnProperty("alphabet")||e.hasOwnProperty("font")||e.hasOwnProperty("controlButtons")?(this.alphabet=e.alphabet??this.alphabet,this.font=e.font??this.font,this.controlButtons=e.controlButtons??this.controlButtons):console.error('Error in parsing data received! Must set "alphabet" or "font" properties'),this.#a();break;case"Disable":e.hasOwnProperty("keys")?this.disableKeys(e.keys):this.disableKeys();break;case"Enable":e.hasOwnProperty("keys")?this.enableKeys(e.keys):this.enableKeys();break;case"Heartbeat":this.lastHeartbeat=performance.now();break;default:console.log("Message type: ",e.message)}};#i=()=>{this.conn&&this.conn.close(),this.conn=this.peer.connect(this.receiverPeerId,{reliable:!0}),console.log("Connection: ",this.conn),this.conn.on("open",this.#c),this.conn.on("data",this.#s),this.conn.on("close",(()=>console.log("Connection closed")))};#c=()=>{this.conn.send({message:"Handshake"}),this._setupHeartBeatIntervals()};#o=()=>{const e=document.createElement("div");e.setAttribute("id","keypad");const t=document.createElement("h1");t.setAttribute("id","keypad-header"),t.classList.add("noselect");const n=document.createElement("div");n.setAttribute("id","keypad-keys"),n.classList.add("keys");const r=document.createElement("div");r.setAttribute("id","keypad-control-keys"),r.classList.add("keys");const o=document.createElement("div");o.setAttribute("id","keypad-footer"),e.appendChild(t),n.appendChild(r),e.appendChild(n),e.appendChild(o),document.getElementById(this.targetElement)?(console.log("Specified target element successfully used."),document.getElementById(this.targetElement).appendChild(e)):(console.log("No target element used."),document.getElementsByTagName("main")[0].appendChild(e)),window.onbeforeunload=()=>{this.conn?.close(),console.log("closing connection on page unload.")},window.onvisibilitychange=()=>{this.conn?.close(),console.log("closing connection on page unload.")},window.onresize=()=>{console.count("Window resized."),s(this.alphabet?.length)},window.visualViewport&&(window.visualViewport.onresize=()=>{console.count("VisualViewport resized."),s(this.alphabet?.length)})};#a=()=>{const e=e=>{const t={message:"Keypress",sendId:this.peer.id,recvId:this.conn.peer,response:e.id,timeSent:Date.now(),elapsedStartToSend:Date.now()-window.startTime};this.conn&&this.conn.open?(this.conn.send(t),console.log("Keypress sent: ",t)):console.log("Connection is closed"),this.visualResponseFeedback&&this.visualFeedbackThenReset(alphabet,font)},t=t=>{let n=document.createElement("button");n.id=t,n.className="response-button",n.style.fontFamily=this.font,n.style.visibility="hidden";const r=document.getElementById("feedbackAudio");n.addEventListener("touchstart",(e=>{e.preventDefault(),console.log("touchstart event: ",e),r.play()})),n.addEventListener("mousedown",(e=>{e.preventDefault(),r.play()})),n.addEventListener("mouseup",(t=>{switch(t.preventDefault(),console.log("mouseup event: ",t),t.target.className){case"response-button-label noselect":e(t.target.parentElement);break;case"response-button":e(t.target)}})),n.addEventListener("touchmove",(e=>{e.preventDefault()})),n.addEventListener("touchend",(t=>{t.preventDefault();const n=document.elementFromPoint(t.changedTouches[0].clientX,t.changedTouches[0].clientY);switch(n?.className){case"response-button-label noselect":e(n?.parentElement);break;case"response-button":e(n)}}));let o=document.createElement("span");o.classList.add("response-button-label","noselect"),o.innerText=t,o.style.fontFamily=this.font,n.appendChild(o),this.controlButtons.map((e=>e.toLowerCase())).includes(t.toLowerCase())?document.querySelector("#keypad-control-keys").appendChild(n):document.querySelector("#keypad-keys").appendChild(n)},n=document.getElementById("keypad-header");n.innerText=this.headerMessage||"",n.style.display=""===n.innerText?"none":"block";const r=document.getElementById("keypad"),o=document.createElement("audio");o.id="feedbackAudio",o.src="onems.mp3",n.appendChild(o),r.style.fontFamily=this.font,this.clearKeys(),this.alphabet.forEach((e=>t(e))),setTimeout((()=>s(this.alphabet.length)),5)};visualFeedbackThenReset=(e=800)=>{this.interResponseKeypadMessaging(),setTimeout(defaultKeypadMessaging,e)};defaultKeypadMessaging=(e="")=>{const t=document.getElementById("keypad-header");""===e?t.style.display="none":(t.innerText=e,t.style.display="block"),[...document.getElementsByClassName("response-button")].forEach((e=>{e.classList.remove("unpressable","noselect")}))};interResponseKeypadMessaging=(e="Please fix your gaze on the + mark on your computer screen.")=>{document.getElementById("keypad-header").innerText=e,[...document.getElementsByClassName("response-button")].forEach((e=>{e.classList.add("unpressable","noselect")}))};clearKeys=()=>{document.querySelector("#keypad-keys").innerHTML="<div id='keypad-control-keys'></div>"};_getKeysElements=(e=[])=>{let t=[...document.querySelector("#keypad").getElementsByClassName("response-button")];return 0!==e.length&&(t=t.filter((t=>e.includes(t.id)))),t};disableKeys=(e=[])=>{this._getKeysElements(e).forEach((e=>{e.classList.add("unpressable"),e.classList.add("noselect"),e.setAttribute("inert","")}))};enableKeys=(e=[])=>{this._getKeysElements(e).forEach((e=>{e.classList.remove("unpressable"),e.classList.remove("noselect"),e.removeAttribute("inert")}))}}var yt=n(592);const At=()=>{};class bt extends ft{constructor(e,t=At,n=At,r=At,o=At,i=At){super({targetElementId:e.targetElementId,onErrorReconnectMessage:e.onErrorReconnectMessage}),e=this.#l(e),this.alphabet=this.checkAlphabet(e.alphabet),this.font=e.font,this.controlButtons=e.controlButtons,this.onErrorReconnectMessage=e.onErrorReconnectMessage??"Connection lost. Please reconnect...",this.onData=t,this.onHandshake=()=>{n(),this._setupHeartBeatIntervals()},this.onConnection=e=>{this.#d(e),r(e)},this.onClose=()=>{this.onPeerClose(),o()},this.onError=e=>{this.onPeerError(e),i(e)},this.peer.on("open",this.#n),this.peer.on("connection",this.onConnection),this.peer.on("disconnected",this.onPeerDisconnected),this.peer.on("close",this.onClose),this.peer.on("error",this.onError)}update=(e=undefined,t=undefined,n=undefined)=>{if(void 0!==e){const t=this.checkAlphabet(e);String(this.alphabet)!==String(t)&&this.displayUpdate("New alphabet: "+String(t),!0),this.alphabet=t}this.font=t??this.font,this.controlButtons=n??this.controlButtons;try{this.conn.send({message:"Update",alphabet:this.alphabet,font:this.font,peerID:this.peer.id,controlButtons:this.controlButtons})}catch(e){this.displayUpdate(`Error updating! Alphabet: ${String(this.alphabet)}, font: ${this.font}`,e),console.error(e)}};disableKeys=(e=undefined)=>{const t={message:"Disable"};e&&(t.keys=e);try{this.conn.send(t)}catch(t){this.displayUpdate(`Error disabling keys. Keys: ${e}`),console.error(t)}};enableKeys=(e=undefined)=>{const t={message:"Enable"};e&&(t.keys=e);try{this.conn.send(t)}catch(t){this.displayUpdate(`Error enabling keys. Keys: ${e}`),console.error(t)}};updateDisplayMessage=e=>{try{this.conn.send({message:"UpdateHeader",headerContent:e})}catch(e){this.displayUpdate("Error in updating message!"),console.error(e)}};updateFooterMessage=e=>{try{this.conn.send({message:"UpdateFooter",headerContent:e})}catch(e){this.displayUpdate("Error in updating footer message."),console.error(e)}};#l=e=>(e.hasOwnProperty("alphabet")?e.alphabet=this.checkAlphabet(e.alphabet):(console.error("Must provide 'alphabet' parameter to Receiver object. Defaulting to 'CDHKNORSVZ'"),e.alphabet="CDHKNORSVZ".split("")),e.hasOwnProperty("font")||(console.error("Must provide 'font' parameter to Receiver object. Defaulting to 'Arial'"),e.alphabet="Arial"),e);#n=e=>{null===this.id?(this.displayUpdate("Received null id from peer open"),this.peer.id=this.lastPeerId):this.lastPeerId=this.peer.id;const t={peerID:this.peer.id};let n=this.queryStringFromObject(t);const r=this.keypadUrl+n;this.qrURL=r,console.log(this.qrURL);const o=document.createElement("canvas");yt.toCanvas(o,r,(function(e){e&&console.error(e)})),this.qrURI=o.toDataURL(),document.getElementById(this.targetElement)?document.getElementById(this.targetElement).appendChild(o):console.log("Peer reachable at: ",r)};#d=e=>{this.conn&&this.conn.open?e.on("open",(function(){e.send({message:"Rejected",info:"Already connected to another client"}),setTimeout((function(){e.close()}),500)})):(this.conn=e,console.log("Connection: ",e),this.displayUpdate("[Connection established]",!0),this.#h())};#h=()=>{this.conn.on("data",(e=>{switch(console.log("Received data: ",e),e.message){case"Handshake":this.conn.send({message:"KeypadParameters",alphabet:this.alphabet,controlButtons:this.controlButtons,font:this.font,onErrorReconnectMessage:this.onErrorReconnectMessage}),this.onHandshake();break;case"Keypress":this.onData(e);break;case"Heartbeat":this.lastHeartbeat=performance.now();break;default:console.log("Message type: ",e.message)}})),this.conn.on("close",(()=>{this.onClose(),this.displayUpdate("Connection reset. Awaiting connection..."),this.conn=null}))}}})(),r})()));
|
|
2
2
|
//# sourceMappingURL=main.js.map
|