@plattar/plattar-ar-adapter 1.150.1 → 1.150.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.
@@ -2825,7 +2825,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2825
2825
  Object.defineProperty(exports, "__esModule", {
2826
2826
  value: true
2827
2827
  });
2828
- exports["default"] = "1.150.1";
2828
+ exports["default"] = "1.150.2";
2829
2829
  }, {}],
2830
2830
  17: [function (require, module, exports) {
2831
2831
  "use strict";
@@ -5354,7 +5354,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5354
5354
  module.exports = PlattarQuery;
5355
5355
  }, {
5356
5356
  "../util/plattar-util.js": 105,
5357
- "node-fetch": 135
5357
+ "node-fetch": 132
5358
5358
  }],
5359
5359
  45: [function (require, module, exports) {
5360
5360
  (function (process) {
@@ -5554,8 +5554,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5554
5554
  }).call(this);
5555
5555
  }).call(this, require('_process'));
5556
5556
  }, {
5557
- "_process": 137,
5558
- "node-fetch": 135
5557
+ "_process": 134,
5558
+ "node-fetch": 132
5559
5559
  }],
5560
5560
  46: [function (require, module, exports) {
5561
5561
  var PlattarBase = require("./interfaces/plattar-base.js");
@@ -7518,278 +7518,273 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7518
7518
  module.exports = "1.148.1";
7519
7519
  }, {}],
7520
7520
  107: [function (require, module, exports) {
7521
- (function (Buffer) {
7522
- (function () {
7523
- var QRCodeStyling = require("qr-code-styling");
7524
- var hash = require("object-hash");
7525
- var BaseElement = /*#__PURE__*/function (_HTMLElement2) {
7526
- _inherits(BaseElement, _HTMLElement2);
7527
- var _super71 = _createSuper(BaseElement);
7528
- function BaseElement() {
7529
- _classCallCheck(this, BaseElement);
7530
- return _super71.call(this);
7531
- }
7532
- _createClass(BaseElement, [{
7533
- key: "connectedCallback",
7534
- value: function connectedCallback() {
7535
- var _this60 = this;
7536
- if (this.hasAttribute("url")) {
7537
- this.renderQRCode();
7521
+ var QRCodeStyling = require("qr-code-styling");
7522
+ var hash = require("object-hash");
7523
+ var BaseElement = /*#__PURE__*/function (_HTMLElement2) {
7524
+ _inherits(BaseElement, _HTMLElement2);
7525
+ var _super71 = _createSuper(BaseElement);
7526
+ function BaseElement() {
7527
+ _classCallCheck(this, BaseElement);
7528
+ return _super71.call(this);
7529
+ }
7530
+ _createClass(BaseElement, [{
7531
+ key: "connectedCallback",
7532
+ value: function connectedCallback() {
7533
+ var _this60 = this;
7534
+ if (this.hasAttribute("url")) {
7535
+ this.renderQRCode();
7536
+ }
7537
+ var observer = new MutationObserver(function (mutations) {
7538
+ mutations.forEach(function (mutation) {
7539
+ if (mutation.type === "attributes") {
7540
+ if (_this60.hasAttribute("url")) {
7541
+ _this60.renderQRCode();
7542
+ }
7538
7543
  }
7539
- var observer = new MutationObserver(function (mutations) {
7540
- mutations.forEach(function (mutation) {
7541
- if (mutation.type === "attributes") {
7542
- if (_this60.hasAttribute("url")) {
7543
- _this60.renderQRCode();
7544
- }
7545
- }
7546
- });
7547
- });
7548
- observer.observe(this, {
7549
- attributes: true
7550
- });
7551
- }
7552
- }, {
7553
- key: "download",
7554
- value: function download(options) {
7555
- var opt = options || {
7556
- name: "plattar-qrcode",
7557
- extension: "png"
7558
- };
7559
- if (this._qrCode) {
7560
- this._qrCode.download(opt);
7544
+ });
7545
+ });
7546
+ observer.observe(this, {
7547
+ attributes: true
7548
+ });
7549
+ }
7550
+ }, {
7551
+ key: "download",
7552
+ value: function download(options) {
7553
+ var opt = options || {
7554
+ name: "plattar-qrcode",
7555
+ extension: "png"
7556
+ };
7557
+ if (this._qrCode) {
7558
+ this._qrCode.download(opt);
7559
+ }
7560
+ }
7561
+ }, {
7562
+ key: "renderQRCode",
7563
+ value: function renderQRCode() {
7564
+ var _this61 = this;
7565
+ var url = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
7566
+ if (!url) {
7567
+ console.warn("PlattarQR.renderQRCode() - required attribute \"url\" is missing or invalid, QR Code will not render");
7568
+ return;
7569
+ }
7570
+ var width = this.hasAttribute("width") ? this.getAttribute("width") : "100%";
7571
+ var height = this.hasAttribute("height") ? this.getAttribute("height") : "100%";
7572
+ var margin = this.hasAttribute("margin") ? this.getAttribute("margin") : 0;
7573
+ var image = this.hasAttribute("image") ? this.getAttribute("image") : undefined;
7574
+ var color = this.hasAttribute("color") ? this.getAttribute("color") : "#000000";
7575
+ var style = this.hasAttribute("qr-type") ? this.getAttribute("qr-type") : "default";
7576
+
7577
+ // used to check if anything has changed in the options
7578
+ // to avoid re-rendering
7579
+ this._optionsHash = '0';
7580
+ this._options = this._options || {
7581
+ imageOptions: {
7582
+ hideBackgroundDots: true,
7583
+ imageSize: 0.4,
7584
+ margin: 0
7585
+ },
7586
+ dotsOptions: {
7587
+ type: "rounded"
7588
+ },
7589
+ backgroundOptions: {
7590
+ color: "#ffffff"
7591
+ },
7592
+ dotsOptionsHelper: {
7593
+ colorType: {
7594
+ single: true,
7595
+ gradient: false
7596
+ },
7597
+ gradient: {
7598
+ linear: true,
7599
+ radial: false,
7600
+ color1: "#6a1a4c",
7601
+ color2: "#6a1a4c",
7602
+ rotation: "0"
7561
7603
  }
7562
- }
7563
- }, {
7564
- key: "renderQRCode",
7565
- value: function renderQRCode() {
7566
- var _this61 = this;
7567
- var url = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
7568
- if (!url) {
7569
- console.warn("PlattarQR.renderQRCode() - required attribute \"url\" is missing or invalid, QR Code will not render");
7570
- return;
7604
+ },
7605
+ cornersSquareOptions: {
7606
+ type: "extra-rounded"
7607
+ },
7608
+ cornersSquareOptionsHelper: {
7609
+ colorType: {
7610
+ single: true,
7611
+ gradient: false
7612
+ },
7613
+ gradient: {
7614
+ linear: true,
7615
+ radial: false,
7616
+ color1: "#000000",
7617
+ color2: "#000000",
7618
+ rotation: "0"
7571
7619
  }
7572
- var width = this.hasAttribute("width") ? this.getAttribute("width") : "100%";
7573
- var height = this.hasAttribute("height") ? this.getAttribute("height") : "100%";
7574
- var margin = this.hasAttribute("margin") ? this.getAttribute("margin") : 0;
7575
- var image = this.hasAttribute("image") ? this.getAttribute("image") : undefined;
7576
- var color = this.hasAttribute("color") ? this.getAttribute("color") : "#000000";
7577
- var style = this.hasAttribute("qr-type") ? this.getAttribute("qr-type") : "default";
7578
-
7579
- // used to check if anything has changed in the options
7580
- // to avoid re-rendering
7581
- this._optionsHash = '0';
7582
- this._options = this._options || {
7583
- imageOptions: {
7584
- hideBackgroundDots: true,
7585
- imageSize: 0.4,
7586
- margin: 0
7587
- },
7588
- dotsOptions: {
7589
- type: "rounded"
7590
- },
7591
- backgroundOptions: {
7592
- color: "#ffffff"
7593
- },
7594
- dotsOptionsHelper: {
7595
- colorType: {
7596
- single: true,
7597
- gradient: false
7598
- },
7599
- gradient: {
7600
- linear: true,
7601
- radial: false,
7602
- color1: "#6a1a4c",
7603
- color2: "#6a1a4c",
7604
- rotation: "0"
7605
- }
7606
- },
7607
- cornersSquareOptions: {
7608
- type: "extra-rounded"
7609
- },
7610
- cornersSquareOptionsHelper: {
7611
- colorType: {
7612
- single: true,
7613
- gradient: false
7614
- },
7615
- gradient: {
7616
- linear: true,
7617
- radial: false,
7618
- color1: "#000000",
7619
- color2: "#000000",
7620
- rotation: "0"
7621
- }
7622
- },
7623
- cornersDotOptions: {
7624
- type: "dot"
7625
- },
7626
- cornersDotOptionsHelper: {
7627
- colorType: {
7628
- single: true,
7629
- gradient: false
7630
- },
7631
- gradient: {
7632
- linear: true,
7633
- radial: false,
7634
- color1: "#000000",
7635
- color2: "#000000",
7636
- rotation: "0"
7637
- }
7638
- },
7639
- backgroundOptionsHelper: {
7640
- colorType: {
7641
- single: true,
7642
- gradient: false
7643
- },
7644
- gradient: {
7645
- linear: true,
7646
- radial: false,
7647
- color1: "#ffffff",
7648
- color2: "#ffffff",
7649
- rotation: "0"
7650
- }
7651
- },
7652
- width: 1024,
7653
- height: 1024,
7654
- type: "canvas"
7655
- };
7656
- this._options.margin = margin;
7657
- this._options.image = image;
7658
-
7659
- // set the colors
7660
- this._options.dotsOptions.color = color;
7661
- this._options.cornersDotOptions.color = color;
7662
- this._options.cornersSquareOptions.color = color;
7663
- switch (style) {
7664
- case "dots":
7665
- this._options.dotsOptions.type = "dots";
7666
- break;
7667
- case "default":
7668
- default:
7669
- this._options.dotsOptions.type = "rounded";
7620
+ },
7621
+ cornersDotOptions: {
7622
+ type: "dot"
7623
+ },
7624
+ cornersDotOptionsHelper: {
7625
+ colorType: {
7626
+ single: true,
7627
+ gradient: false
7628
+ },
7629
+ gradient: {
7630
+ linear: true,
7631
+ radial: false,
7632
+ color1: "#000000",
7633
+ color2: "#000000",
7634
+ rotation: "0"
7670
7635
  }
7671
- var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
7672
- if (shortenURL && shortenURL.toLowerCase() === "true") {
7673
- this._ShortenURL(url).then(function (newURL) {
7674
- _this61._GenerateQRCode(newURL, width, height);
7675
- })["catch"](function (_err) {
7676
- console.warn(_err);
7677
- // ignore error and just generate normal QR Code
7678
- _this61._GenerateQRCode(url, width, height);
7679
- });
7680
- } else {
7681
- this._GenerateQRCode(url, width, height);
7636
+ },
7637
+ backgroundOptionsHelper: {
7638
+ colorType: {
7639
+ single: true,
7640
+ gradient: false
7641
+ },
7642
+ gradient: {
7643
+ linear: true,
7644
+ radial: false,
7645
+ color1: "#ffffff",
7646
+ color2: "#ffffff",
7647
+ rotation: "0"
7682
7648
  }
7649
+ },
7650
+ width: 1024,
7651
+ height: 1024,
7652
+ type: "canvas"
7653
+ };
7654
+ this._options.margin = margin;
7655
+ this._options.image = image;
7656
+
7657
+ // set the colors
7658
+ this._options.dotsOptions.color = color;
7659
+ this._options.cornersDotOptions.color = color;
7660
+ this._options.cornersSquareOptions.color = color;
7661
+ switch (style) {
7662
+ case "dots":
7663
+ this._options.dotsOptions.type = "dots";
7664
+ break;
7665
+ case "default":
7666
+ default:
7667
+ this._options.dotsOptions.type = "rounded";
7668
+ }
7669
+ var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
7670
+ if (shortenURL && shortenURL.toLowerCase() === "true") {
7671
+ this._ShortenURL(url).then(function (newURL) {
7672
+ _this61._GenerateQRCode(newURL, width, height);
7673
+ })["catch"](function (_err) {
7674
+ console.warn(_err);
7675
+ // ignore error and just generate normal QR Code
7676
+ _this61._GenerateQRCode(url, width, height);
7677
+ });
7678
+ } else {
7679
+ this._GenerateQRCode(url, width, height);
7680
+ }
7681
+ }
7682
+ }, {
7683
+ key: "_UpdateCanvas",
7684
+ value: function _UpdateCanvas(width, height) {
7685
+ if (!this._qrCode) {
7686
+ return;
7687
+ }
7688
+ var canvas = this._qrCode._canvas;
7689
+ if (canvas) {
7690
+ if (canvas.style.width !== "100%") {
7691
+ canvas.style.width = "100%";
7683
7692
  }
7684
- }, {
7685
- key: "_UpdateCanvas",
7686
- value: function _UpdateCanvas(width, height) {
7687
- if (!this._qrCode) {
7688
- return;
7689
- }
7690
- var canvas = this._qrCode._canvas;
7691
- if (canvas) {
7692
- if (canvas.style.width !== "100%") {
7693
- canvas.style.width = "100%";
7694
- }
7695
- if (canvas.style.height !== "100%") {
7696
- canvas.style.height = "100%";
7697
- }
7698
- }
7699
- if (this._divContainer) {
7700
- var div = this._divContainer;
7701
- if (div.style.width !== width) {
7702
- div.style.width = width;
7703
- }
7704
- if (div.style.height !== height) {
7705
- div.style.height = height;
7706
- }
7707
- }
7693
+ if (canvas.style.height !== "100%") {
7694
+ canvas.style.height = "100%";
7708
7695
  }
7709
- }, {
7710
- key: "_GenerateQRCode",
7711
- value: function _GenerateQRCode(url, width, height) {
7712
- this._options.data = url;
7713
- var shadow = this.shadowRoot || this.attachShadow({
7714
- mode: 'open'
7715
- });
7716
- var qrCode = this._qrCode;
7717
- if (!qrCode) {
7718
- var div = document.createElement("div");
7719
- div.style.display = "none";
7720
- shadow.appendChild(div);
7721
- this._divContainer = div;
7722
- this._qrCode = new QRCodeStyling(this._options);
7723
- this._qrCode.append(div);
7724
- this._UpdateCanvas(width, height);
7725
- div.style.display = "block";
7726
- return;
7727
- }
7728
- var newHash = hash({
7729
- options: this._options,
7730
- width: width,
7731
- height: height
7732
- });
7733
- if (this._optionsHash !== newHash) {
7734
- this._optionsHash = newHash;
7735
- this._qrCode.update(this._options);
7736
- this._UpdateCanvas(width, height);
7737
- }
7696
+ }
7697
+ if (this._divContainer) {
7698
+ var div = this._divContainer;
7699
+ if (div.style.width !== width) {
7700
+ div.style.width = width;
7738
7701
  }
7739
- }, {
7740
- key: "_IsFetchAPISupported",
7741
- value: function _IsFetchAPISupported() {
7742
- return "fetch" in window;
7702
+ if (div.style.height !== height) {
7703
+ div.style.height = height;
7743
7704
  }
7744
- }, {
7745
- key: "_ShortenURL",
7746
- value: function _ShortenURL(url) {
7747
- var _this62 = this;
7748
- return new Promise(function (accept, reject) {
7749
- if (!_this62._IsFetchAPISupported()) {
7750
- return reject(new Error("PlattarQR._ShortenURL() - fetch api not supported, cannot proceed"));
7751
- }
7752
- try {
7753
- var b64Link = new Buffer(url).toString("base64");
7754
- fetch("https://c.plattar.com/shorten", {
7755
- cache: "no-store",
7756
- method: "POST",
7757
- headers: {
7758
- "Content-Type": "application/json"
7759
- },
7760
- body: JSON.stringify({
7761
- data: {
7762
- attributes: {
7763
- url: b64Link,
7764
- isBase64: true
7765
- }
7766
- }
7767
- })
7768
- }).then(function (response) {
7769
- if (!response.ok) {
7770
- throw new Error("PlattarQR._ShortenURL() - response was invalid");
7705
+ }
7706
+ }
7707
+ }, {
7708
+ key: "_GenerateQRCode",
7709
+ value: function _GenerateQRCode(url, width, height) {
7710
+ this._options.data = url;
7711
+ var shadow = this.shadowRoot || this.attachShadow({
7712
+ mode: 'open'
7713
+ });
7714
+ var qrCode = this._qrCode;
7715
+ if (!qrCode) {
7716
+ var div = document.createElement("div");
7717
+ div.style.display = "none";
7718
+ shadow.appendChild(div);
7719
+ this._divContainer = div;
7720
+ this._qrCode = new QRCodeStyling(this._options);
7721
+ this._qrCode.append(div);
7722
+ this._UpdateCanvas(width, height);
7723
+ div.style.display = "block";
7724
+ return;
7725
+ }
7726
+ var newHash = hash({
7727
+ options: this._options,
7728
+ width: width,
7729
+ height: height
7730
+ });
7731
+ if (this._optionsHash !== newHash) {
7732
+ this._optionsHash = newHash;
7733
+ this._qrCode.update(this._options);
7734
+ this._UpdateCanvas(width, height);
7735
+ }
7736
+ }
7737
+ }, {
7738
+ key: "_IsFetchAPISupported",
7739
+ value: function _IsFetchAPISupported() {
7740
+ return "fetch" in window;
7741
+ }
7742
+ }, {
7743
+ key: "_ShortenURL",
7744
+ value: function _ShortenURL(url) {
7745
+ var _this62 = this;
7746
+ return new Promise(function (accept, reject) {
7747
+ if (!_this62._IsFetchAPISupported()) {
7748
+ return reject(new Error("PlattarQR._ShortenURL() - fetch api not supported, cannot proceed"));
7749
+ }
7750
+ try {
7751
+ var b64Link = btoa(url);
7752
+ fetch("https://c.plattar.com/shorten", {
7753
+ cache: "no-store",
7754
+ method: "POST",
7755
+ headers: {
7756
+ "Content-Type": "application/json"
7757
+ },
7758
+ body: JSON.stringify({
7759
+ data: {
7760
+ attributes: {
7761
+ url: b64Link,
7762
+ isBase64: true
7771
7763
  }
7772
- return response.json();
7773
- }).then(function (json) {
7774
- return accept(json.data.attributes.url);
7775
- })["catch"](function () {
7776
- return reject(new Error("PlattarQR._ShortenURL() - there was an unexpected issue generating short url"));
7777
- });
7778
- } catch (err) {
7779
- return reject(err);
7780
- }
7764
+ }
7765
+ })
7766
+ }).then(function (response) {
7767
+ if (!response.ok) {
7768
+ throw new Error("PlattarQR._ShortenURL() - response was invalid");
7769
+ }
7770
+ return response.json();
7771
+ }).then(function (json) {
7772
+ return accept(json.data.attributes.url);
7773
+ })["catch"](function () {
7774
+ return reject(new Error("PlattarQR._ShortenURL() - there was an unexpected issue generating short url"));
7781
7775
  });
7776
+ } catch (err) {
7777
+ return reject(err);
7782
7778
  }
7783
- }]);
7784
- return BaseElement;
7785
- }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
7786
- module.exports = BaseElement;
7787
- }).call(this);
7788
- }).call(this, require("buffer").Buffer);
7779
+ });
7780
+ }
7781
+ }]);
7782
+ return BaseElement;
7783
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
7784
+ module.exports = BaseElement;
7789
7785
  }, {
7790
- "buffer": 133,
7791
- "object-hash": 136,
7792
- "qr-code-styling": 138
7786
+ "object-hash": 133,
7787
+ "qr-code-styling": 135
7793
7788
  }],
7794
7789
  108: [function (require, module, exports) {
7795
7790
  var BaseElement = require("./base/base-element.js");
@@ -7825,7 +7820,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7825
7820
  "./version": 110
7826
7821
  }],
7827
7822
  110: [function (require, module, exports) {
7828
- module.exports = "1.150.1";
7823
+ module.exports = "1.150.2";
7829
7824
  }, {}],
7830
7825
  111: [function (require, module, exports) {
7831
7826
  "use strict";
@@ -8178,7 +8173,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
8178
8173
  }();
8179
8174
  exports.RemoteRequest = RemoteRequest;
8180
8175
  }, {
8181
- "node-fetch": 135
8176
+ "node-fetch": 132
8182
8177
  }],
8183
8178
  114: [function (require, module, exports) {
8184
8179
  "use strict";
@@ -10151,1692 +10146,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
10151
10146
  module.exports = "1.135.2";
10152
10147
  }, {}],
10153
10148
  132: [function (require, module, exports) {
10154
- 'use strict';
10155
-
10156
- exports.byteLength = byteLength;
10157
- exports.toByteArray = toByteArray;
10158
- exports.fromByteArray = fromByteArray;
10159
- var lookup = [];
10160
- var revLookup = [];
10161
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
10162
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
10163
- for (var i = 0, len = code.length; i < len; ++i) {
10164
- lookup[i] = code[i];
10165
- revLookup[code.charCodeAt(i)] = i;
10166
- }
10167
-
10168
- // Support decoding URL-safe base64 strings, as Node.js does.
10169
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
10170
- revLookup['-'.charCodeAt(0)] = 62;
10171
- revLookup['_'.charCodeAt(0)] = 63;
10172
- function getLens(b64) {
10173
- var len = b64.length;
10174
- if (len % 4 > 0) {
10175
- throw new Error('Invalid string. Length must be a multiple of 4');
10176
- }
10177
-
10178
- // Trim off extra bytes after placeholder bytes are found
10179
- // See: https://github.com/beatgammit/base64-js/issues/42
10180
- var validLen = b64.indexOf('=');
10181
- if (validLen === -1) validLen = len;
10182
- var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
10183
- return [validLen, placeHoldersLen];
10184
- }
10185
-
10186
- // base64 is 4/3 + up to two characters of the original data
10187
- function byteLength(b64) {
10188
- var lens = getLens(b64);
10189
- var validLen = lens[0];
10190
- var placeHoldersLen = lens[1];
10191
- return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
10192
- }
10193
- function _byteLength(b64, validLen, placeHoldersLen) {
10194
- return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
10195
- }
10196
- function toByteArray(b64) {
10197
- var tmp;
10198
- var lens = getLens(b64);
10199
- var validLen = lens[0];
10200
- var placeHoldersLen = lens[1];
10201
- var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
10202
- var curByte = 0;
10203
-
10204
- // if there are placeholders, only get up to the last complete 4 chars
10205
- var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
10206
- var i;
10207
- for (i = 0; i < len; i += 4) {
10208
- tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
10209
- arr[curByte++] = tmp >> 16 & 0xFF;
10210
- arr[curByte++] = tmp >> 8 & 0xFF;
10211
- arr[curByte++] = tmp & 0xFF;
10212
- }
10213
- if (placeHoldersLen === 2) {
10214
- tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
10215
- arr[curByte++] = tmp & 0xFF;
10216
- }
10217
- if (placeHoldersLen === 1) {
10218
- tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
10219
- arr[curByte++] = tmp >> 8 & 0xFF;
10220
- arr[curByte++] = tmp & 0xFF;
10221
- }
10222
- return arr;
10223
- }
10224
- function tripletToBase64(num) {
10225
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
10226
- }
10227
- function encodeChunk(uint8, start, end) {
10228
- var tmp;
10229
- var output = [];
10230
- for (var i = start; i < end; i += 3) {
10231
- tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF);
10232
- output.push(tripletToBase64(tmp));
10233
- }
10234
- return output.join('');
10235
- }
10236
- function fromByteArray(uint8) {
10237
- var tmp;
10238
- var len = uint8.length;
10239
- var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
10240
- var parts = [];
10241
- var maxChunkLength = 16383; // must be multiple of 3
10242
-
10243
- // go through the array every three bytes, we'll deal with trailing stuff later
10244
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
10245
- parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
10246
- }
10247
-
10248
- // pad the end with zeros, but make sure to not forget the extra bytes
10249
- if (extraBytes === 1) {
10250
- tmp = uint8[len - 1];
10251
- parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '==');
10252
- } else if (extraBytes === 2) {
10253
- tmp = (uint8[len - 2] << 8) + uint8[len - 1];
10254
- parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '=');
10255
- }
10256
- return parts.join('');
10257
- }
10258
- }, {}],
10259
- 133: [function (require, module, exports) {
10260
- (function (Buffer) {
10261
- (function () {
10262
- /*!
10263
- * The buffer module from node.js, for the browser.
10264
- *
10265
- * @author Feross Aboukhadijeh <https://feross.org>
10266
- * @license MIT
10267
- */
10268
- /* eslint-disable no-proto */
10269
-
10270
- 'use strict';
10271
-
10272
- var base64 = require('base64-js');
10273
- var ieee754 = require('ieee754');
10274
- exports.Buffer = Buffer;
10275
- exports.SlowBuffer = SlowBuffer;
10276
- exports.INSPECT_MAX_BYTES = 50;
10277
- var K_MAX_LENGTH = 0x7fffffff;
10278
- exports.kMaxLength = K_MAX_LENGTH;
10279
-
10280
- /**
10281
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
10282
- * === true Use Uint8Array implementation (fastest)
10283
- * === false Print warning and recommend using `buffer` v4.x which has an Object
10284
- * implementation (most compatible, even IE6)
10285
- *
10286
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
10287
- * Opera 11.6+, iOS 4.2+.
10288
- *
10289
- * We report that the browser does not support typed arrays if the are not subclassable
10290
- * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
10291
- * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
10292
- * for __proto__ and has a buggy typed array implementation.
10293
- */
10294
- Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
10295
- if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') {
10296
- console.error('This browser lacks typed array (Uint8Array) support which is required by ' + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.');
10297
- }
10298
- function typedArraySupport() {
10299
- // Can typed array instances can be augmented?
10300
- try {
10301
- var arr = new Uint8Array(1);
10302
- arr.__proto__ = {
10303
- __proto__: Uint8Array.prototype,
10304
- foo: function foo() {
10305
- return 42;
10306
- }
10307
- };
10308
- return arr.foo() === 42;
10309
- } catch (e) {
10310
- return false;
10311
- }
10312
- }
10313
- Object.defineProperty(Buffer.prototype, 'parent', {
10314
- enumerable: true,
10315
- get: function get() {
10316
- if (!Buffer.isBuffer(this)) return undefined;
10317
- return this.buffer;
10318
- }
10319
- });
10320
- Object.defineProperty(Buffer.prototype, 'offset', {
10321
- enumerable: true,
10322
- get: function get() {
10323
- if (!Buffer.isBuffer(this)) return undefined;
10324
- return this.byteOffset;
10325
- }
10326
- });
10327
- function createBuffer(length) {
10328
- if (length > K_MAX_LENGTH) {
10329
- throw new RangeError('The value "' + length + '" is invalid for option "size"');
10330
- }
10331
- // Return an augmented `Uint8Array` instance
10332
- var buf = new Uint8Array(length);
10333
- buf.__proto__ = Buffer.prototype;
10334
- return buf;
10335
- }
10336
-
10337
- /**
10338
- * The Buffer constructor returns instances of `Uint8Array` that have their
10339
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
10340
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
10341
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
10342
- * returns a single octet.
10343
- *
10344
- * The `Uint8Array` prototype remains unmodified.
10345
- */
10346
-
10347
- function Buffer(arg, encodingOrOffset, length) {
10348
- // Common case.
10349
- if (typeof arg === 'number') {
10350
- if (typeof encodingOrOffset === 'string') {
10351
- throw new TypeError('The "string" argument must be of type string. Received type number');
10352
- }
10353
- return allocUnsafe(arg);
10354
- }
10355
- return from(arg, encodingOrOffset, length);
10356
- }
10357
-
10358
- // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
10359
- if (typeof Symbol !== 'undefined' && Symbol.species != null && Buffer[Symbol.species] === Buffer) {
10360
- Object.defineProperty(Buffer, Symbol.species, {
10361
- value: null,
10362
- configurable: true,
10363
- enumerable: false,
10364
- writable: false
10365
- });
10366
- }
10367
- Buffer.poolSize = 8192; // not used by this implementation
10368
-
10369
- function from(value, encodingOrOffset, length) {
10370
- if (typeof value === 'string') {
10371
- return fromString(value, encodingOrOffset);
10372
- }
10373
- if (ArrayBuffer.isView(value)) {
10374
- return fromArrayLike(value);
10375
- }
10376
- if (value == null) {
10377
- throw TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + _typeof(value));
10378
- }
10379
- if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
10380
- return fromArrayBuffer(value, encodingOrOffset, length);
10381
- }
10382
- if (typeof value === 'number') {
10383
- throw new TypeError('The "value" argument must not be of type number. Received type number');
10384
- }
10385
- var valueOf = value.valueOf && value.valueOf();
10386
- if (valueOf != null && valueOf !== value) {
10387
- return Buffer.from(valueOf, encodingOrOffset, length);
10388
- }
10389
- var b = fromObject(value);
10390
- if (b) return b;
10391
- if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') {
10392
- return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length);
10393
- }
10394
- throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + _typeof(value));
10395
- }
10396
-
10397
- /**
10398
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
10399
- * if value is a number.
10400
- * Buffer.from(str[, encoding])
10401
- * Buffer.from(array)
10402
- * Buffer.from(buffer)
10403
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
10404
- **/
10405
- Buffer.from = function (value, encodingOrOffset, length) {
10406
- return from(value, encodingOrOffset, length);
10407
- };
10408
-
10409
- // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
10410
- // https://github.com/feross/buffer/pull/148
10411
- Buffer.prototype.__proto__ = Uint8Array.prototype;
10412
- Buffer.__proto__ = Uint8Array;
10413
- function assertSize(size) {
10414
- if (typeof size !== 'number') {
10415
- throw new TypeError('"size" argument must be of type number');
10416
- } else if (size < 0) {
10417
- throw new RangeError('The value "' + size + '" is invalid for option "size"');
10418
- }
10419
- }
10420
- function alloc(size, fill, encoding) {
10421
- assertSize(size);
10422
- if (size <= 0) {
10423
- return createBuffer(size);
10424
- }
10425
- if (fill !== undefined) {
10426
- // Only pay attention to encoding if it's a string. This
10427
- // prevents accidentally sending in a number that would
10428
- // be interpretted as a start offset.
10429
- return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
10430
- }
10431
- return createBuffer(size);
10432
- }
10433
-
10434
- /**
10435
- * Creates a new filled Buffer instance.
10436
- * alloc(size[, fill[, encoding]])
10437
- **/
10438
- Buffer.alloc = function (size, fill, encoding) {
10439
- return alloc(size, fill, encoding);
10440
- };
10441
- function allocUnsafe(size) {
10442
- assertSize(size);
10443
- return createBuffer(size < 0 ? 0 : checked(size) | 0);
10444
- }
10445
-
10446
- /**
10447
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
10448
- * */
10449
- Buffer.allocUnsafe = function (size) {
10450
- return allocUnsafe(size);
10451
- };
10452
- /**
10453
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
10454
- */
10455
- Buffer.allocUnsafeSlow = function (size) {
10456
- return allocUnsafe(size);
10457
- };
10458
- function fromString(string, encoding) {
10459
- if (typeof encoding !== 'string' || encoding === '') {
10460
- encoding = 'utf8';
10461
- }
10462
- if (!Buffer.isEncoding(encoding)) {
10463
- throw new TypeError('Unknown encoding: ' + encoding);
10464
- }
10465
- var length = byteLength(string, encoding) | 0;
10466
- var buf = createBuffer(length);
10467
- var actual = buf.write(string, encoding);
10468
- if (actual !== length) {
10469
- // Writing a hex string, for example, that contains invalid characters will
10470
- // cause everything after the first invalid character to be ignored. (e.g.
10471
- // 'abxxcd' will be treated as 'ab')
10472
- buf = buf.slice(0, actual);
10473
- }
10474
- return buf;
10475
- }
10476
- function fromArrayLike(array) {
10477
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
10478
- var buf = createBuffer(length);
10479
- for (var i = 0; i < length; i += 1) {
10480
- buf[i] = array[i] & 255;
10481
- }
10482
- return buf;
10483
- }
10484
- function fromArrayBuffer(array, byteOffset, length) {
10485
- if (byteOffset < 0 || array.byteLength < byteOffset) {
10486
- throw new RangeError('"offset" is outside of buffer bounds');
10487
- }
10488
- if (array.byteLength < byteOffset + (length || 0)) {
10489
- throw new RangeError('"length" is outside of buffer bounds');
10490
- }
10491
- var buf;
10492
- if (byteOffset === undefined && length === undefined) {
10493
- buf = new Uint8Array(array);
10494
- } else if (length === undefined) {
10495
- buf = new Uint8Array(array, byteOffset);
10496
- } else {
10497
- buf = new Uint8Array(array, byteOffset, length);
10498
- }
10499
-
10500
- // Return an augmented `Uint8Array` instance
10501
- buf.__proto__ = Buffer.prototype;
10502
- return buf;
10503
- }
10504
- function fromObject(obj) {
10505
- if (Buffer.isBuffer(obj)) {
10506
- var len = checked(obj.length) | 0;
10507
- var buf = createBuffer(len);
10508
- if (buf.length === 0) {
10509
- return buf;
10510
- }
10511
- obj.copy(buf, 0, 0, len);
10512
- return buf;
10513
- }
10514
- if (obj.length !== undefined) {
10515
- if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
10516
- return createBuffer(0);
10517
- }
10518
- return fromArrayLike(obj);
10519
- }
10520
- if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
10521
- return fromArrayLike(obj.data);
10522
- }
10523
- }
10524
- function checked(length) {
10525
- // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
10526
- // length is NaN (which is otherwise coerced to zero.)
10527
- if (length >= K_MAX_LENGTH) {
10528
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes');
10529
- }
10530
- return length | 0;
10531
- }
10532
- function SlowBuffer(length) {
10533
- if (+length != length) {
10534
- // eslint-disable-line eqeqeq
10535
- length = 0;
10536
- }
10537
- return Buffer.alloc(+length);
10538
- }
10539
- Buffer.isBuffer = function isBuffer(b) {
10540
- return b != null && b._isBuffer === true && b !== Buffer.prototype; // so Buffer.isBuffer(Buffer.prototype) will be false
10541
- };
10542
-
10543
- Buffer.compare = function compare(a, b) {
10544
- if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
10545
- if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
10546
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
10547
- throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
10548
- }
10549
- if (a === b) return 0;
10550
- var x = a.length;
10551
- var y = b.length;
10552
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
10553
- if (a[i] !== b[i]) {
10554
- x = a[i];
10555
- y = b[i];
10556
- break;
10557
- }
10558
- }
10559
- if (x < y) return -1;
10560
- if (y < x) return 1;
10561
- return 0;
10562
- };
10563
- Buffer.isEncoding = function isEncoding(encoding) {
10564
- switch (String(encoding).toLowerCase()) {
10565
- case 'hex':
10566
- case 'utf8':
10567
- case 'utf-8':
10568
- case 'ascii':
10569
- case 'latin1':
10570
- case 'binary':
10571
- case 'base64':
10572
- case 'ucs2':
10573
- case 'ucs-2':
10574
- case 'utf16le':
10575
- case 'utf-16le':
10576
- return true;
10577
- default:
10578
- return false;
10579
- }
10580
- };
10581
- Buffer.concat = function concat(list, length) {
10582
- if (!Array.isArray(list)) {
10583
- throw new TypeError('"list" argument must be an Array of Buffers');
10584
- }
10585
- if (list.length === 0) {
10586
- return Buffer.alloc(0);
10587
- }
10588
- var i;
10589
- if (length === undefined) {
10590
- length = 0;
10591
- for (i = 0; i < list.length; ++i) {
10592
- length += list[i].length;
10593
- }
10594
- }
10595
- var buffer = Buffer.allocUnsafe(length);
10596
- var pos = 0;
10597
- for (i = 0; i < list.length; ++i) {
10598
- var buf = list[i];
10599
- if (isInstance(buf, Uint8Array)) {
10600
- buf = Buffer.from(buf);
10601
- }
10602
- if (!Buffer.isBuffer(buf)) {
10603
- throw new TypeError('"list" argument must be an Array of Buffers');
10604
- }
10605
- buf.copy(buffer, pos);
10606
- pos += buf.length;
10607
- }
10608
- return buffer;
10609
- };
10610
- function byteLength(string, encoding) {
10611
- if (Buffer.isBuffer(string)) {
10612
- return string.length;
10613
- }
10614
- if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
10615
- return string.byteLength;
10616
- }
10617
- if (typeof string !== 'string') {
10618
- throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + _typeof(string));
10619
- }
10620
- var len = string.length;
10621
- var mustMatch = arguments.length > 2 && arguments[2] === true;
10622
- if (!mustMatch && len === 0) return 0;
10623
-
10624
- // Use a for loop to avoid recursion
10625
- var loweredCase = false;
10626
- for (;;) {
10627
- switch (encoding) {
10628
- case 'ascii':
10629
- case 'latin1':
10630
- case 'binary':
10631
- return len;
10632
- case 'utf8':
10633
- case 'utf-8':
10634
- return utf8ToBytes(string).length;
10635
- case 'ucs2':
10636
- case 'ucs-2':
10637
- case 'utf16le':
10638
- case 'utf-16le':
10639
- return len * 2;
10640
- case 'hex':
10641
- return len >>> 1;
10642
- case 'base64':
10643
- return base64ToBytes(string).length;
10644
- default:
10645
- if (loweredCase) {
10646
- return mustMatch ? -1 : utf8ToBytes(string).length; // assume utf8
10647
- }
10648
-
10649
- encoding = ('' + encoding).toLowerCase();
10650
- loweredCase = true;
10651
- }
10652
- }
10653
- }
10654
- Buffer.byteLength = byteLength;
10655
- function slowToString(encoding, start, end) {
10656
- var loweredCase = false;
10657
-
10658
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
10659
- // property of a typed array.
10660
-
10661
- // This behaves neither like String nor Uint8Array in that we set start/end
10662
- // to their upper/lower bounds if the value passed is out of range.
10663
- // undefined is handled specially as per ECMA-262 6th Edition,
10664
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
10665
- if (start === undefined || start < 0) {
10666
- start = 0;
10667
- }
10668
- // Return early if start > this.length. Done here to prevent potential uint32
10669
- // coercion fail below.
10670
- if (start > this.length) {
10671
- return '';
10672
- }
10673
- if (end === undefined || end > this.length) {
10674
- end = this.length;
10675
- }
10676
- if (end <= 0) {
10677
- return '';
10678
- }
10679
-
10680
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
10681
- end >>>= 0;
10682
- start >>>= 0;
10683
- if (end <= start) {
10684
- return '';
10685
- }
10686
- if (!encoding) encoding = 'utf8';
10687
- while (true) {
10688
- switch (encoding) {
10689
- case 'hex':
10690
- return hexSlice(this, start, end);
10691
- case 'utf8':
10692
- case 'utf-8':
10693
- return utf8Slice(this, start, end);
10694
- case 'ascii':
10695
- return asciiSlice(this, start, end);
10696
- case 'latin1':
10697
- case 'binary':
10698
- return latin1Slice(this, start, end);
10699
- case 'base64':
10700
- return base64Slice(this, start, end);
10701
- case 'ucs2':
10702
- case 'ucs-2':
10703
- case 'utf16le':
10704
- case 'utf-16le':
10705
- return utf16leSlice(this, start, end);
10706
- default:
10707
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
10708
- encoding = (encoding + '').toLowerCase();
10709
- loweredCase = true;
10710
- }
10711
- }
10712
- }
10713
-
10714
- // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
10715
- // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
10716
- // reliably in a browserify context because there could be multiple different
10717
- // copies of the 'buffer' package in use. This method works even for Buffer
10718
- // instances that were created from another copy of the `buffer` package.
10719
- // See: https://github.com/feross/buffer/issues/154
10720
- Buffer.prototype._isBuffer = true;
10721
- function swap(b, n, m) {
10722
- var i = b[n];
10723
- b[n] = b[m];
10724
- b[m] = i;
10725
- }
10726
- Buffer.prototype.swap16 = function swap16() {
10727
- var len = this.length;
10728
- if (len % 2 !== 0) {
10729
- throw new RangeError('Buffer size must be a multiple of 16-bits');
10730
- }
10731
- for (var i = 0; i < len; i += 2) {
10732
- swap(this, i, i + 1);
10733
- }
10734
- return this;
10735
- };
10736
- Buffer.prototype.swap32 = function swap32() {
10737
- var len = this.length;
10738
- if (len % 4 !== 0) {
10739
- throw new RangeError('Buffer size must be a multiple of 32-bits');
10740
- }
10741
- for (var i = 0; i < len; i += 4) {
10742
- swap(this, i, i + 3);
10743
- swap(this, i + 1, i + 2);
10744
- }
10745
- return this;
10746
- };
10747
- Buffer.prototype.swap64 = function swap64() {
10748
- var len = this.length;
10749
- if (len % 8 !== 0) {
10750
- throw new RangeError('Buffer size must be a multiple of 64-bits');
10751
- }
10752
- for (var i = 0; i < len; i += 8) {
10753
- swap(this, i, i + 7);
10754
- swap(this, i + 1, i + 6);
10755
- swap(this, i + 2, i + 5);
10756
- swap(this, i + 3, i + 4);
10757
- }
10758
- return this;
10759
- };
10760
- Buffer.prototype.toString = function toString() {
10761
- var length = this.length;
10762
- if (length === 0) return '';
10763
- if (arguments.length === 0) return utf8Slice(this, 0, length);
10764
- return slowToString.apply(this, arguments);
10765
- };
10766
- Buffer.prototype.toLocaleString = Buffer.prototype.toString;
10767
- Buffer.prototype.equals = function equals(b) {
10768
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer');
10769
- if (this === b) return true;
10770
- return Buffer.compare(this, b) === 0;
10771
- };
10772
- Buffer.prototype.inspect = function inspect() {
10773
- var str = '';
10774
- var max = exports.INSPECT_MAX_BYTES;
10775
- str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
10776
- if (this.length > max) str += ' ... ';
10777
- return '<Buffer ' + str + '>';
10778
- };
10779
- Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
10780
- if (isInstance(target, Uint8Array)) {
10781
- target = Buffer.from(target, target.offset, target.byteLength);
10782
- }
10783
- if (!Buffer.isBuffer(target)) {
10784
- throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. ' + 'Received type ' + _typeof(target));
10785
- }
10786
- if (start === undefined) {
10787
- start = 0;
10788
- }
10789
- if (end === undefined) {
10790
- end = target ? target.length : 0;
10791
- }
10792
- if (thisStart === undefined) {
10793
- thisStart = 0;
10794
- }
10795
- if (thisEnd === undefined) {
10796
- thisEnd = this.length;
10797
- }
10798
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
10799
- throw new RangeError('out of range index');
10800
- }
10801
- if (thisStart >= thisEnd && start >= end) {
10802
- return 0;
10803
- }
10804
- if (thisStart >= thisEnd) {
10805
- return -1;
10806
- }
10807
- if (start >= end) {
10808
- return 1;
10809
- }
10810
- start >>>= 0;
10811
- end >>>= 0;
10812
- thisStart >>>= 0;
10813
- thisEnd >>>= 0;
10814
- if (this === target) return 0;
10815
- var x = thisEnd - thisStart;
10816
- var y = end - start;
10817
- var len = Math.min(x, y);
10818
- var thisCopy = this.slice(thisStart, thisEnd);
10819
- var targetCopy = target.slice(start, end);
10820
- for (var i = 0; i < len; ++i) {
10821
- if (thisCopy[i] !== targetCopy[i]) {
10822
- x = thisCopy[i];
10823
- y = targetCopy[i];
10824
- break;
10825
- }
10826
- }
10827
- if (x < y) return -1;
10828
- if (y < x) return 1;
10829
- return 0;
10830
- };
10831
-
10832
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
10833
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
10834
- //
10835
- // Arguments:
10836
- // - buffer - a Buffer to search
10837
- // - val - a string, Buffer, or number
10838
- // - byteOffset - an index into `buffer`; will be clamped to an int32
10839
- // - encoding - an optional encoding, relevant is val is a string
10840
- // - dir - true for indexOf, false for lastIndexOf
10841
- function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
10842
- // Empty buffer means no match
10843
- if (buffer.length === 0) return -1;
10844
-
10845
- // Normalize byteOffset
10846
- if (typeof byteOffset === 'string') {
10847
- encoding = byteOffset;
10848
- byteOffset = 0;
10849
- } else if (byteOffset > 0x7fffffff) {
10850
- byteOffset = 0x7fffffff;
10851
- } else if (byteOffset < -0x80000000) {
10852
- byteOffset = -0x80000000;
10853
- }
10854
- byteOffset = +byteOffset; // Coerce to Number.
10855
- if (numberIsNaN(byteOffset)) {
10856
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
10857
- byteOffset = dir ? 0 : buffer.length - 1;
10858
- }
10859
-
10860
- // Normalize byteOffset: negative offsets start from the end of the buffer
10861
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
10862
- if (byteOffset >= buffer.length) {
10863
- if (dir) return -1;else byteOffset = buffer.length - 1;
10864
- } else if (byteOffset < 0) {
10865
- if (dir) byteOffset = 0;else return -1;
10866
- }
10867
-
10868
- // Normalize val
10869
- if (typeof val === 'string') {
10870
- val = Buffer.from(val, encoding);
10871
- }
10872
-
10873
- // Finally, search either indexOf (if dir is true) or lastIndexOf
10874
- if (Buffer.isBuffer(val)) {
10875
- // Special case: looking for empty string/buffer always fails
10876
- if (val.length === 0) {
10877
- return -1;
10878
- }
10879
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
10880
- } else if (typeof val === 'number') {
10881
- val = val & 0xFF; // Search for a byte value [0-255]
10882
- if (typeof Uint8Array.prototype.indexOf === 'function') {
10883
- if (dir) {
10884
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
10885
- } else {
10886
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
10887
- }
10888
- }
10889
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
10890
- }
10891
- throw new TypeError('val must be string, number or Buffer');
10892
- }
10893
- function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
10894
- var indexSize = 1;
10895
- var arrLength = arr.length;
10896
- var valLength = val.length;
10897
- if (encoding !== undefined) {
10898
- encoding = String(encoding).toLowerCase();
10899
- if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
10900
- if (arr.length < 2 || val.length < 2) {
10901
- return -1;
10902
- }
10903
- indexSize = 2;
10904
- arrLength /= 2;
10905
- valLength /= 2;
10906
- byteOffset /= 2;
10907
- }
10908
- }
10909
- function read(buf, i) {
10910
- if (indexSize === 1) {
10911
- return buf[i];
10912
- } else {
10913
- return buf.readUInt16BE(i * indexSize);
10914
- }
10915
- }
10916
- var i;
10917
- if (dir) {
10918
- var foundIndex = -1;
10919
- for (i = byteOffset; i < arrLength; i++) {
10920
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
10921
- if (foundIndex === -1) foundIndex = i;
10922
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
10923
- } else {
10924
- if (foundIndex !== -1) i -= i - foundIndex;
10925
- foundIndex = -1;
10926
- }
10927
- }
10928
- } else {
10929
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
10930
- for (i = byteOffset; i >= 0; i--) {
10931
- var found = true;
10932
- for (var j = 0; j < valLength; j++) {
10933
- if (read(arr, i + j) !== read(val, j)) {
10934
- found = false;
10935
- break;
10936
- }
10937
- }
10938
- if (found) return i;
10939
- }
10940
- }
10941
- return -1;
10942
- }
10943
- Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
10944
- return this.indexOf(val, byteOffset, encoding) !== -1;
10945
- };
10946
- Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
10947
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
10948
- };
10949
- Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
10950
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
10951
- };
10952
- function hexWrite(buf, string, offset, length) {
10953
- offset = Number(offset) || 0;
10954
- var remaining = buf.length - offset;
10955
- if (!length) {
10956
- length = remaining;
10957
- } else {
10958
- length = Number(length);
10959
- if (length > remaining) {
10960
- length = remaining;
10961
- }
10962
- }
10963
- var strLen = string.length;
10964
- if (length > strLen / 2) {
10965
- length = strLen / 2;
10966
- }
10967
- for (var i = 0; i < length; ++i) {
10968
- var parsed = parseInt(string.substr(i * 2, 2), 16);
10969
- if (numberIsNaN(parsed)) return i;
10970
- buf[offset + i] = parsed;
10971
- }
10972
- return i;
10973
- }
10974
- function utf8Write(buf, string, offset, length) {
10975
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
10976
- }
10977
- function asciiWrite(buf, string, offset, length) {
10978
- return blitBuffer(asciiToBytes(string), buf, offset, length);
10979
- }
10980
- function latin1Write(buf, string, offset, length) {
10981
- return asciiWrite(buf, string, offset, length);
10982
- }
10983
- function base64Write(buf, string, offset, length) {
10984
- return blitBuffer(base64ToBytes(string), buf, offset, length);
10985
- }
10986
- function ucs2Write(buf, string, offset, length) {
10987
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
10988
- }
10989
- Buffer.prototype.write = function write(string, offset, length, encoding) {
10990
- // Buffer#write(string)
10991
- if (offset === undefined) {
10992
- encoding = 'utf8';
10993
- length = this.length;
10994
- offset = 0;
10995
- // Buffer#write(string, encoding)
10996
- } else if (length === undefined && typeof offset === 'string') {
10997
- encoding = offset;
10998
- length = this.length;
10999
- offset = 0;
11000
- // Buffer#write(string, offset[, length][, encoding])
11001
- } else if (isFinite(offset)) {
11002
- offset = offset >>> 0;
11003
- if (isFinite(length)) {
11004
- length = length >>> 0;
11005
- if (encoding === undefined) encoding = 'utf8';
11006
- } else {
11007
- encoding = length;
11008
- length = undefined;
11009
- }
11010
- } else {
11011
- throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
11012
- }
11013
- var remaining = this.length - offset;
11014
- if (length === undefined || length > remaining) length = remaining;
11015
- if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
11016
- throw new RangeError('Attempt to write outside buffer bounds');
11017
- }
11018
- if (!encoding) encoding = 'utf8';
11019
- var loweredCase = false;
11020
- for (;;) {
11021
- switch (encoding) {
11022
- case 'hex':
11023
- return hexWrite(this, string, offset, length);
11024
- case 'utf8':
11025
- case 'utf-8':
11026
- return utf8Write(this, string, offset, length);
11027
- case 'ascii':
11028
- return asciiWrite(this, string, offset, length);
11029
- case 'latin1':
11030
- case 'binary':
11031
- return latin1Write(this, string, offset, length);
11032
- case 'base64':
11033
- // Warning: maxLength not taken into account in base64Write
11034
- return base64Write(this, string, offset, length);
11035
- case 'ucs2':
11036
- case 'ucs-2':
11037
- case 'utf16le':
11038
- case 'utf-16le':
11039
- return ucs2Write(this, string, offset, length);
11040
- default:
11041
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
11042
- encoding = ('' + encoding).toLowerCase();
11043
- loweredCase = true;
11044
- }
11045
- }
11046
- };
11047
- Buffer.prototype.toJSON = function toJSON() {
11048
- return {
11049
- type: 'Buffer',
11050
- data: Array.prototype.slice.call(this._arr || this, 0)
11051
- };
11052
- };
11053
- function base64Slice(buf, start, end) {
11054
- if (start === 0 && end === buf.length) {
11055
- return base64.fromByteArray(buf);
11056
- } else {
11057
- return base64.fromByteArray(buf.slice(start, end));
11058
- }
11059
- }
11060
- function utf8Slice(buf, start, end) {
11061
- end = Math.min(buf.length, end);
11062
- var res = [];
11063
- var i = start;
11064
- while (i < end) {
11065
- var firstByte = buf[i];
11066
- var codePoint = null;
11067
- var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
11068
- if (i + bytesPerSequence <= end) {
11069
- var secondByte, thirdByte, fourthByte, tempCodePoint;
11070
- switch (bytesPerSequence) {
11071
- case 1:
11072
- if (firstByte < 0x80) {
11073
- codePoint = firstByte;
11074
- }
11075
- break;
11076
- case 2:
11077
- secondByte = buf[i + 1];
11078
- if ((secondByte & 0xC0) === 0x80) {
11079
- tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
11080
- if (tempCodePoint > 0x7F) {
11081
- codePoint = tempCodePoint;
11082
- }
11083
- }
11084
- break;
11085
- case 3:
11086
- secondByte = buf[i + 1];
11087
- thirdByte = buf[i + 2];
11088
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
11089
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
11090
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
11091
- codePoint = tempCodePoint;
11092
- }
11093
- }
11094
- break;
11095
- case 4:
11096
- secondByte = buf[i + 1];
11097
- thirdByte = buf[i + 2];
11098
- fourthByte = buf[i + 3];
11099
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
11100
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
11101
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
11102
- codePoint = tempCodePoint;
11103
- }
11104
- }
11105
- }
11106
- }
11107
- if (codePoint === null) {
11108
- // we did not generate a valid codePoint so insert a
11109
- // replacement char (U+FFFD) and advance only 1 byte
11110
- codePoint = 0xFFFD;
11111
- bytesPerSequence = 1;
11112
- } else if (codePoint > 0xFFFF) {
11113
- // encode to utf16 (surrogate pair dance)
11114
- codePoint -= 0x10000;
11115
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
11116
- codePoint = 0xDC00 | codePoint & 0x3FF;
11117
- }
11118
- res.push(codePoint);
11119
- i += bytesPerSequence;
11120
- }
11121
- return decodeCodePointsArray(res);
11122
- }
11123
-
11124
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
11125
- // the lowest limit is Chrome, with 0x10000 args.
11126
- // We go 1 magnitude less, for safety
11127
- var MAX_ARGUMENTS_LENGTH = 0x1000;
11128
- function decodeCodePointsArray(codePoints) {
11129
- var len = codePoints.length;
11130
- if (len <= MAX_ARGUMENTS_LENGTH) {
11131
- return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
11132
- }
11133
-
11134
- // Decode in chunks to avoid "call stack size exceeded".
11135
- var res = '';
11136
- var i = 0;
11137
- while (i < len) {
11138
- res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
11139
- }
11140
- return res;
11141
- }
11142
- function asciiSlice(buf, start, end) {
11143
- var ret = '';
11144
- end = Math.min(buf.length, end);
11145
- for (var i = start; i < end; ++i) {
11146
- ret += String.fromCharCode(buf[i] & 0x7F);
11147
- }
11148
- return ret;
11149
- }
11150
- function latin1Slice(buf, start, end) {
11151
- var ret = '';
11152
- end = Math.min(buf.length, end);
11153
- for (var i = start; i < end; ++i) {
11154
- ret += String.fromCharCode(buf[i]);
11155
- }
11156
- return ret;
11157
- }
11158
- function hexSlice(buf, start, end) {
11159
- var len = buf.length;
11160
- if (!start || start < 0) start = 0;
11161
- if (!end || end < 0 || end > len) end = len;
11162
- var out = '';
11163
- for (var i = start; i < end; ++i) {
11164
- out += toHex(buf[i]);
11165
- }
11166
- return out;
11167
- }
11168
- function utf16leSlice(buf, start, end) {
11169
- var bytes = buf.slice(start, end);
11170
- var res = '';
11171
- for (var i = 0; i < bytes.length; i += 2) {
11172
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
11173
- }
11174
- return res;
11175
- }
11176
- Buffer.prototype.slice = function slice(start, end) {
11177
- var len = this.length;
11178
- start = ~~start;
11179
- end = end === undefined ? len : ~~end;
11180
- if (start < 0) {
11181
- start += len;
11182
- if (start < 0) start = 0;
11183
- } else if (start > len) {
11184
- start = len;
11185
- }
11186
- if (end < 0) {
11187
- end += len;
11188
- if (end < 0) end = 0;
11189
- } else if (end > len) {
11190
- end = len;
11191
- }
11192
- if (end < start) end = start;
11193
- var newBuf = this.subarray(start, end);
11194
- // Return an augmented `Uint8Array` instance
11195
- newBuf.__proto__ = Buffer.prototype;
11196
- return newBuf;
11197
- };
11198
-
11199
- /*
11200
- * Need to make sure that buffer isn't trying to write out of bounds.
11201
- */
11202
- function checkOffset(offset, ext, length) {
11203
- if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
11204
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
11205
- }
11206
- Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
11207
- offset = offset >>> 0;
11208
- byteLength = byteLength >>> 0;
11209
- if (!noAssert) checkOffset(offset, byteLength, this.length);
11210
- var val = this[offset];
11211
- var mul = 1;
11212
- var i = 0;
11213
- while (++i < byteLength && (mul *= 0x100)) {
11214
- val += this[offset + i] * mul;
11215
- }
11216
- return val;
11217
- };
11218
- Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
11219
- offset = offset >>> 0;
11220
- byteLength = byteLength >>> 0;
11221
- if (!noAssert) {
11222
- checkOffset(offset, byteLength, this.length);
11223
- }
11224
- var val = this[offset + --byteLength];
11225
- var mul = 1;
11226
- while (byteLength > 0 && (mul *= 0x100)) {
11227
- val += this[offset + --byteLength] * mul;
11228
- }
11229
- return val;
11230
- };
11231
- Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
11232
- offset = offset >>> 0;
11233
- if (!noAssert) checkOffset(offset, 1, this.length);
11234
- return this[offset];
11235
- };
11236
- Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
11237
- offset = offset >>> 0;
11238
- if (!noAssert) checkOffset(offset, 2, this.length);
11239
- return this[offset] | this[offset + 1] << 8;
11240
- };
11241
- Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
11242
- offset = offset >>> 0;
11243
- if (!noAssert) checkOffset(offset, 2, this.length);
11244
- return this[offset] << 8 | this[offset + 1];
11245
- };
11246
- Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
11247
- offset = offset >>> 0;
11248
- if (!noAssert) checkOffset(offset, 4, this.length);
11249
- return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
11250
- };
11251
- Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
11252
- offset = offset >>> 0;
11253
- if (!noAssert) checkOffset(offset, 4, this.length);
11254
- return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
11255
- };
11256
- Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
11257
- offset = offset >>> 0;
11258
- byteLength = byteLength >>> 0;
11259
- if (!noAssert) checkOffset(offset, byteLength, this.length);
11260
- var val = this[offset];
11261
- var mul = 1;
11262
- var i = 0;
11263
- while (++i < byteLength && (mul *= 0x100)) {
11264
- val += this[offset + i] * mul;
11265
- }
11266
- mul *= 0x80;
11267
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
11268
- return val;
11269
- };
11270
- Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
11271
- offset = offset >>> 0;
11272
- byteLength = byteLength >>> 0;
11273
- if (!noAssert) checkOffset(offset, byteLength, this.length);
11274
- var i = byteLength;
11275
- var mul = 1;
11276
- var val = this[offset + --i];
11277
- while (i > 0 && (mul *= 0x100)) {
11278
- val += this[offset + --i] * mul;
11279
- }
11280
- mul *= 0x80;
11281
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
11282
- return val;
11283
- };
11284
- Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
11285
- offset = offset >>> 0;
11286
- if (!noAssert) checkOffset(offset, 1, this.length);
11287
- if (!(this[offset] & 0x80)) return this[offset];
11288
- return (0xff - this[offset] + 1) * -1;
11289
- };
11290
- Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
11291
- offset = offset >>> 0;
11292
- if (!noAssert) checkOffset(offset, 2, this.length);
11293
- var val = this[offset] | this[offset + 1] << 8;
11294
- return val & 0x8000 ? val | 0xFFFF0000 : val;
11295
- };
11296
- Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
11297
- offset = offset >>> 0;
11298
- if (!noAssert) checkOffset(offset, 2, this.length);
11299
- var val = this[offset + 1] | this[offset] << 8;
11300
- return val & 0x8000 ? val | 0xFFFF0000 : val;
11301
- };
11302
- Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
11303
- offset = offset >>> 0;
11304
- if (!noAssert) checkOffset(offset, 4, this.length);
11305
- return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
11306
- };
11307
- Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
11308
- offset = offset >>> 0;
11309
- if (!noAssert) checkOffset(offset, 4, this.length);
11310
- return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
11311
- };
11312
- Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
11313
- offset = offset >>> 0;
11314
- if (!noAssert) checkOffset(offset, 4, this.length);
11315
- return ieee754.read(this, offset, true, 23, 4);
11316
- };
11317
- Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
11318
- offset = offset >>> 0;
11319
- if (!noAssert) checkOffset(offset, 4, this.length);
11320
- return ieee754.read(this, offset, false, 23, 4);
11321
- };
11322
- Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
11323
- offset = offset >>> 0;
11324
- if (!noAssert) checkOffset(offset, 8, this.length);
11325
- return ieee754.read(this, offset, true, 52, 8);
11326
- };
11327
- Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
11328
- offset = offset >>> 0;
11329
- if (!noAssert) checkOffset(offset, 8, this.length);
11330
- return ieee754.read(this, offset, false, 52, 8);
11331
- };
11332
- function checkInt(buf, value, offset, ext, max, min) {
11333
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
11334
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
11335
- if (offset + ext > buf.length) throw new RangeError('Index out of range');
11336
- }
11337
- Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
11338
- value = +value;
11339
- offset = offset >>> 0;
11340
- byteLength = byteLength >>> 0;
11341
- if (!noAssert) {
11342
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
11343
- checkInt(this, value, offset, byteLength, maxBytes, 0);
11344
- }
11345
- var mul = 1;
11346
- var i = 0;
11347
- this[offset] = value & 0xFF;
11348
- while (++i < byteLength && (mul *= 0x100)) {
11349
- this[offset + i] = value / mul & 0xFF;
11350
- }
11351
- return offset + byteLength;
11352
- };
11353
- Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
11354
- value = +value;
11355
- offset = offset >>> 0;
11356
- byteLength = byteLength >>> 0;
11357
- if (!noAssert) {
11358
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
11359
- checkInt(this, value, offset, byteLength, maxBytes, 0);
11360
- }
11361
- var i = byteLength - 1;
11362
- var mul = 1;
11363
- this[offset + i] = value & 0xFF;
11364
- while (--i >= 0 && (mul *= 0x100)) {
11365
- this[offset + i] = value / mul & 0xFF;
11366
- }
11367
- return offset + byteLength;
11368
- };
11369
- Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
11370
- value = +value;
11371
- offset = offset >>> 0;
11372
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
11373
- this[offset] = value & 0xff;
11374
- return offset + 1;
11375
- };
11376
- Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
11377
- value = +value;
11378
- offset = offset >>> 0;
11379
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
11380
- this[offset] = value & 0xff;
11381
- this[offset + 1] = value >>> 8;
11382
- return offset + 2;
11383
- };
11384
- Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
11385
- value = +value;
11386
- offset = offset >>> 0;
11387
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
11388
- this[offset] = value >>> 8;
11389
- this[offset + 1] = value & 0xff;
11390
- return offset + 2;
11391
- };
11392
- Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
11393
- value = +value;
11394
- offset = offset >>> 0;
11395
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
11396
- this[offset + 3] = value >>> 24;
11397
- this[offset + 2] = value >>> 16;
11398
- this[offset + 1] = value >>> 8;
11399
- this[offset] = value & 0xff;
11400
- return offset + 4;
11401
- };
11402
- Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
11403
- value = +value;
11404
- offset = offset >>> 0;
11405
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
11406
- this[offset] = value >>> 24;
11407
- this[offset + 1] = value >>> 16;
11408
- this[offset + 2] = value >>> 8;
11409
- this[offset + 3] = value & 0xff;
11410
- return offset + 4;
11411
- };
11412
- Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
11413
- value = +value;
11414
- offset = offset >>> 0;
11415
- if (!noAssert) {
11416
- var limit = Math.pow(2, 8 * byteLength - 1);
11417
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
11418
- }
11419
- var i = 0;
11420
- var mul = 1;
11421
- var sub = 0;
11422
- this[offset] = value & 0xFF;
11423
- while (++i < byteLength && (mul *= 0x100)) {
11424
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
11425
- sub = 1;
11426
- }
11427
- this[offset + i] = (value / mul >> 0) - sub & 0xFF;
11428
- }
11429
- return offset + byteLength;
11430
- };
11431
- Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
11432
- value = +value;
11433
- offset = offset >>> 0;
11434
- if (!noAssert) {
11435
- var limit = Math.pow(2, 8 * byteLength - 1);
11436
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
11437
- }
11438
- var i = byteLength - 1;
11439
- var mul = 1;
11440
- var sub = 0;
11441
- this[offset + i] = value & 0xFF;
11442
- while (--i >= 0 && (mul *= 0x100)) {
11443
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
11444
- sub = 1;
11445
- }
11446
- this[offset + i] = (value / mul >> 0) - sub & 0xFF;
11447
- }
11448
- return offset + byteLength;
11449
- };
11450
- Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
11451
- value = +value;
11452
- offset = offset >>> 0;
11453
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
11454
- if (value < 0) value = 0xff + value + 1;
11455
- this[offset] = value & 0xff;
11456
- return offset + 1;
11457
- };
11458
- Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
11459
- value = +value;
11460
- offset = offset >>> 0;
11461
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
11462
- this[offset] = value & 0xff;
11463
- this[offset + 1] = value >>> 8;
11464
- return offset + 2;
11465
- };
11466
- Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
11467
- value = +value;
11468
- offset = offset >>> 0;
11469
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
11470
- this[offset] = value >>> 8;
11471
- this[offset + 1] = value & 0xff;
11472
- return offset + 2;
11473
- };
11474
- Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
11475
- value = +value;
11476
- offset = offset >>> 0;
11477
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
11478
- this[offset] = value & 0xff;
11479
- this[offset + 1] = value >>> 8;
11480
- this[offset + 2] = value >>> 16;
11481
- this[offset + 3] = value >>> 24;
11482
- return offset + 4;
11483
- };
11484
- Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
11485
- value = +value;
11486
- offset = offset >>> 0;
11487
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
11488
- if (value < 0) value = 0xffffffff + value + 1;
11489
- this[offset] = value >>> 24;
11490
- this[offset + 1] = value >>> 16;
11491
- this[offset + 2] = value >>> 8;
11492
- this[offset + 3] = value & 0xff;
11493
- return offset + 4;
11494
- };
11495
- function checkIEEE754(buf, value, offset, ext, max, min) {
11496
- if (offset + ext > buf.length) throw new RangeError('Index out of range');
11497
- if (offset < 0) throw new RangeError('Index out of range');
11498
- }
11499
- function writeFloat(buf, value, offset, littleEndian, noAssert) {
11500
- value = +value;
11501
- offset = offset >>> 0;
11502
- if (!noAssert) {
11503
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);
11504
- }
11505
- ieee754.write(buf, value, offset, littleEndian, 23, 4);
11506
- return offset + 4;
11507
- }
11508
- Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
11509
- return writeFloat(this, value, offset, true, noAssert);
11510
- };
11511
- Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
11512
- return writeFloat(this, value, offset, false, noAssert);
11513
- };
11514
- function writeDouble(buf, value, offset, littleEndian, noAssert) {
11515
- value = +value;
11516
- offset = offset >>> 0;
11517
- if (!noAssert) {
11518
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);
11519
- }
11520
- ieee754.write(buf, value, offset, littleEndian, 52, 8);
11521
- return offset + 8;
11522
- }
11523
- Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
11524
- return writeDouble(this, value, offset, true, noAssert);
11525
- };
11526
- Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
11527
- return writeDouble(this, value, offset, false, noAssert);
11528
- };
11529
-
11530
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
11531
- Buffer.prototype.copy = function copy(target, targetStart, start, end) {
11532
- if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer');
11533
- if (!start) start = 0;
11534
- if (!end && end !== 0) end = this.length;
11535
- if (targetStart >= target.length) targetStart = target.length;
11536
- if (!targetStart) targetStart = 0;
11537
- if (end > 0 && end < start) end = start;
11538
-
11539
- // Copy 0 bytes; we're done
11540
- if (end === start) return 0;
11541
- if (target.length === 0 || this.length === 0) return 0;
11542
-
11543
- // Fatal error conditions
11544
- if (targetStart < 0) {
11545
- throw new RangeError('targetStart out of bounds');
11546
- }
11547
- if (start < 0 || start >= this.length) throw new RangeError('Index out of range');
11548
- if (end < 0) throw new RangeError('sourceEnd out of bounds');
11549
-
11550
- // Are we oob?
11551
- if (end > this.length) end = this.length;
11552
- if (target.length - targetStart < end - start) {
11553
- end = target.length - targetStart + start;
11554
- }
11555
- var len = end - start;
11556
- if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
11557
- // Use built-in when available, missing from IE11
11558
- this.copyWithin(targetStart, start, end);
11559
- } else if (this === target && start < targetStart && targetStart < end) {
11560
- // descending copy from end
11561
- for (var i = len - 1; i >= 0; --i) {
11562
- target[i + targetStart] = this[i + start];
11563
- }
11564
- } else {
11565
- Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
11566
- }
11567
- return len;
11568
- };
11569
-
11570
- // Usage:
11571
- // buffer.fill(number[, offset[, end]])
11572
- // buffer.fill(buffer[, offset[, end]])
11573
- // buffer.fill(string[, offset[, end]][, encoding])
11574
- Buffer.prototype.fill = function fill(val, start, end, encoding) {
11575
- // Handle string cases:
11576
- if (typeof val === 'string') {
11577
- if (typeof start === 'string') {
11578
- encoding = start;
11579
- start = 0;
11580
- end = this.length;
11581
- } else if (typeof end === 'string') {
11582
- encoding = end;
11583
- end = this.length;
11584
- }
11585
- if (encoding !== undefined && typeof encoding !== 'string') {
11586
- throw new TypeError('encoding must be a string');
11587
- }
11588
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
11589
- throw new TypeError('Unknown encoding: ' + encoding);
11590
- }
11591
- if (val.length === 1) {
11592
- var code = val.charCodeAt(0);
11593
- if (encoding === 'utf8' && code < 128 || encoding === 'latin1') {
11594
- // Fast path: If `val` fits into a single byte, use that numeric value.
11595
- val = code;
11596
- }
11597
- }
11598
- } else if (typeof val === 'number') {
11599
- val = val & 255;
11600
- }
11601
-
11602
- // Invalid ranges are not set to a default, so can range check early.
11603
- if (start < 0 || this.length < start || this.length < end) {
11604
- throw new RangeError('Out of range index');
11605
- }
11606
- if (end <= start) {
11607
- return this;
11608
- }
11609
- start = start >>> 0;
11610
- end = end === undefined ? this.length : end >>> 0;
11611
- if (!val) val = 0;
11612
- var i;
11613
- if (typeof val === 'number') {
11614
- for (i = start; i < end; ++i) {
11615
- this[i] = val;
11616
- }
11617
- } else {
11618
- var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding);
11619
- var len = bytes.length;
11620
- if (len === 0) {
11621
- throw new TypeError('The value "' + val + '" is invalid for argument "value"');
11622
- }
11623
- for (i = 0; i < end - start; ++i) {
11624
- this[i + start] = bytes[i % len];
11625
- }
11626
- }
11627
- return this;
11628
- };
11629
-
11630
- // HELPER FUNCTIONS
11631
- // ================
11632
-
11633
- var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
11634
- function base64clean(str) {
11635
- // Node takes equal signs as end of the Base64 encoding
11636
- str = str.split('=')[0];
11637
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
11638
- str = str.trim().replace(INVALID_BASE64_RE, '');
11639
- // Node converts strings with length < 2 to ''
11640
- if (str.length < 2) return '';
11641
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
11642
- while (str.length % 4 !== 0) {
11643
- str = str + '=';
11644
- }
11645
- return str;
11646
- }
11647
- function toHex(n) {
11648
- if (n < 16) return '0' + n.toString(16);
11649
- return n.toString(16);
11650
- }
11651
- function utf8ToBytes(string, units) {
11652
- units = units || Infinity;
11653
- var codePoint;
11654
- var length = string.length;
11655
- var leadSurrogate = null;
11656
- var bytes = [];
11657
- for (var i = 0; i < length; ++i) {
11658
- codePoint = string.charCodeAt(i);
11659
-
11660
- // is surrogate component
11661
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
11662
- // last char was a lead
11663
- if (!leadSurrogate) {
11664
- // no lead yet
11665
- if (codePoint > 0xDBFF) {
11666
- // unexpected trail
11667
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
11668
- continue;
11669
- } else if (i + 1 === length) {
11670
- // unpaired lead
11671
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
11672
- continue;
11673
- }
11674
-
11675
- // valid lead
11676
- leadSurrogate = codePoint;
11677
- continue;
11678
- }
11679
-
11680
- // 2 leads in a row
11681
- if (codePoint < 0xDC00) {
11682
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
11683
- leadSurrogate = codePoint;
11684
- continue;
11685
- }
11686
-
11687
- // valid surrogate pair
11688
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
11689
- } else if (leadSurrogate) {
11690
- // valid bmp char, but last char was a lead
11691
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
11692
- }
11693
- leadSurrogate = null;
11694
-
11695
- // encode utf8
11696
- if (codePoint < 0x80) {
11697
- if ((units -= 1) < 0) break;
11698
- bytes.push(codePoint);
11699
- } else if (codePoint < 0x800) {
11700
- if ((units -= 2) < 0) break;
11701
- bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
11702
- } else if (codePoint < 0x10000) {
11703
- if ((units -= 3) < 0) break;
11704
- bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
11705
- } else if (codePoint < 0x110000) {
11706
- if ((units -= 4) < 0) break;
11707
- bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
11708
- } else {
11709
- throw new Error('Invalid code point');
11710
- }
11711
- }
11712
- return bytes;
11713
- }
11714
- function asciiToBytes(str) {
11715
- var byteArray = [];
11716
- for (var i = 0; i < str.length; ++i) {
11717
- // Node's code seems to be doing this and not & 0x7F..
11718
- byteArray.push(str.charCodeAt(i) & 0xFF);
11719
- }
11720
- return byteArray;
11721
- }
11722
- function utf16leToBytes(str, units) {
11723
- var c, hi, lo;
11724
- var byteArray = [];
11725
- for (var i = 0; i < str.length; ++i) {
11726
- if ((units -= 2) < 0) break;
11727
- c = str.charCodeAt(i);
11728
- hi = c >> 8;
11729
- lo = c % 256;
11730
- byteArray.push(lo);
11731
- byteArray.push(hi);
11732
- }
11733
- return byteArray;
11734
- }
11735
- function base64ToBytes(str) {
11736
- return base64.toByteArray(base64clean(str));
11737
- }
11738
- function blitBuffer(src, dst, offset, length) {
11739
- for (var i = 0; i < length; ++i) {
11740
- if (i + offset >= dst.length || i >= src.length) break;
11741
- dst[i + offset] = src[i];
11742
- }
11743
- return i;
11744
- }
11745
-
11746
- // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
11747
- // the `instanceof` check but they should be treated as of that type.
11748
- // See: https://github.com/feross/buffer/issues/166
11749
- function isInstance(obj, type) {
11750
- return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
11751
- }
11752
- function numberIsNaN(obj) {
11753
- // For IE11 support
11754
- return obj !== obj; // eslint-disable-line no-self-compare
11755
- }
11756
- }).call(this);
11757
- }).call(this, require("buffer").Buffer);
11758
- }, {
11759
- "base64-js": 132,
11760
- "buffer": 133,
11761
- "ieee754": 134
11762
- }],
11763
- 134: [function (require, module, exports) {
11764
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
11765
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
11766
- var e, m;
11767
- var eLen = nBytes * 8 - mLen - 1;
11768
- var eMax = (1 << eLen) - 1;
11769
- var eBias = eMax >> 1;
11770
- var nBits = -7;
11771
- var i = isLE ? nBytes - 1 : 0;
11772
- var d = isLE ? -1 : 1;
11773
- var s = buffer[offset + i];
11774
- i += d;
11775
- e = s & (1 << -nBits) - 1;
11776
- s >>= -nBits;
11777
- nBits += eLen;
11778
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
11779
- m = e & (1 << -nBits) - 1;
11780
- e >>= -nBits;
11781
- nBits += mLen;
11782
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
11783
- if (e === 0) {
11784
- e = 1 - eBias;
11785
- } else if (e === eMax) {
11786
- return m ? NaN : (s ? -1 : 1) * Infinity;
11787
- } else {
11788
- m = m + Math.pow(2, mLen);
11789
- e = e - eBias;
11790
- }
11791
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
11792
- };
11793
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
11794
- var e, m, c;
11795
- var eLen = nBytes * 8 - mLen - 1;
11796
- var eMax = (1 << eLen) - 1;
11797
- var eBias = eMax >> 1;
11798
- var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
11799
- var i = isLE ? 0 : nBytes - 1;
11800
- var d = isLE ? 1 : -1;
11801
- var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
11802
- value = Math.abs(value);
11803
- if (isNaN(value) || value === Infinity) {
11804
- m = isNaN(value) ? 1 : 0;
11805
- e = eMax;
11806
- } else {
11807
- e = Math.floor(Math.log(value) / Math.LN2);
11808
- if (value * (c = Math.pow(2, -e)) < 1) {
11809
- e--;
11810
- c *= 2;
11811
- }
11812
- if (e + eBias >= 1) {
11813
- value += rt / c;
11814
- } else {
11815
- value += rt * Math.pow(2, 1 - eBias);
11816
- }
11817
- if (value * c >= 2) {
11818
- e++;
11819
- c /= 2;
11820
- }
11821
- if (e + eBias >= eMax) {
11822
- m = 0;
11823
- e = eMax;
11824
- } else if (e + eBias >= 1) {
11825
- m = (value * c - 1) * Math.pow(2, mLen);
11826
- e = e + eBias;
11827
- } else {
11828
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
11829
- e = 0;
11830
- }
11831
- }
11832
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
11833
- e = e << mLen | m;
11834
- eLen += mLen;
11835
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
11836
- buffer[offset + i - d] |= s * 128;
11837
- };
11838
- }, {}],
11839
- 135: [function (require, module, exports) {
11840
10149
  (function (global) {
11841
10150
  (function () {
11842
10151
  "use strict";
@@ -11870,7 +10179,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
11870
10179
  }).call(this);
11871
10180
  }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
11872
10181
  }, {}],
11873
- 136: [function (require, module, exports) {
10182
+ 133: [function (require, module, exports) {
11874
10183
  (function (global) {
11875
10184
  (function () {
11876
10185
  !function (e) {
@@ -12870,7 +11179,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
12870
11179
  }).call(this);
12871
11180
  }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
12872
11181
  }, {}],
12873
- 137: [function (require, module, exports) {
11182
+ 134: [function (require, module, exports) {
12874
11183
  // shim for using process in browser
12875
11184
  var process = module.exports = {};
12876
11185
 
@@ -13047,7 +11356,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
13047
11356
  return 0;
13048
11357
  };
13049
11358
  }, {}],
13050
- 138: [function (require, module, exports) {
11359
+ 135: [function (require, module, exports) {
13051
11360
  !function (t, e) {
13052
11361
  "object" == _typeof(exports) && "object" == _typeof(module) ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == _typeof(exports) ? exports.QRCodeStyling = e() : t.QRCodeStyling = e();
13053
11362
  }(self, function () {