@teselagen/bio-parsers 0.4.23 → 0.4.25

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.
Files changed (5) hide show
  1. package/index.cjs +1281 -2464
  2. package/index.js +1281 -2464
  3. package/index.umd.cjs +1589 -2772
  4. package/package.json +5 -5
  5. package/src/ab1ToJson.js +4 -0
package/index.cjs CHANGED
@@ -5,7 +5,6 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
5
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __pow = Math.pow;
9
8
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
9
  var __spreadValues = (a, b) => {
11
10
  for (var prop in b || (b = {}))
@@ -7929,7 +7928,7 @@ const calcTmMethods = {
7929
7928
  * monovalentCationConc - THe monovalent salt concentration. Defaults to 50e-3M.
7930
7929
  * return - Temperature for the given sequence, in Celsius.
7931
7930
  */
7932
- calculateTemperature: function(_sequence, { type, A, R, primerConc, monovalentCationConc } = {}) {
7931
+ calculateTemperature: function(_sequence, { type, A, R: R2, primerConc, monovalentCationConc } = {}) {
7933
7932
  const sequence = (_sequence || "").toLowerCase();
7934
7933
  if (typeof type === "undefined") {
7935
7934
  type = this.TABLE_BRESLAUER;
@@ -7939,8 +7938,8 @@ const calcTmMethods = {
7939
7938
  if (!A) {
7940
7939
  A = this.A;
7941
7940
  }
7942
- if (!R) {
7943
- R = this.R;
7941
+ if (!R2) {
7942
+ R2 = this.R;
7944
7943
  }
7945
7944
  if (!primerConc) {
7946
7945
  primerConc = this.primerConc;
@@ -7977,7 +7976,7 @@ const calcTmMethods = {
7977
7976
  sumDeltaH = sumDeltaH + neighbors[i] * deltaHTable[i];
7978
7977
  sumDeltaS = sumDeltaS + neighbors[i] * deltaSTable[i];
7979
7978
  }
7980
- const temperature = -1e3 * sumDeltaH / (A + -sumDeltaS + R * Math.log(primerConc / 4)) - 273.15 + 16.6 * Math.LOG10E * Math.log(monovalentCationConc);
7979
+ const temperature = -1e3 * sumDeltaH / (A + -sumDeltaS + R2 * Math.log(primerConc / 4)) - 273.15 + 16.6 * Math.LOG10E * Math.log(monovalentCationConc);
7981
7980
  return temperature;
7982
7981
  },
7983
7982
  /**
@@ -18802,7 +18801,7 @@ var bufferpack = new BufferPack();
18802
18801
  const bufferpack$1 = /* @__PURE__ */ getDefaultExportFromCjs(bufferpack);
18803
18802
  var string_decoder = {};
18804
18803
  var safeBuffer = { exports: {} };
18805
- var buffer$2 = {};
18804
+ var buffer$1 = {};
18806
18805
  var base64Js = {};
18807
18806
  base64Js.byteLength = byteLength;
18808
18807
  base64Js.toByteArray = toByteArray;
@@ -20501,10 +20500,11 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
20501
20500
  }
20502
20501
  return table;
20503
20502
  }();
20504
- })(buffer$2);
20503
+ })(buffer$1);
20504
+ const buffer = /* @__PURE__ */ getDefaultExportFromCjs(buffer$1);
20505
20505
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
20506
20506
  (function(module2, exports2) {
20507
- var buffer2 = buffer$2;
20507
+ var buffer2 = buffer$1;
20508
20508
  var Buffer2 = buffer2.Buffer;
20509
20509
  function copyProps(src, dst) {
20510
20510
  for (var key in src) {
@@ -20828,1949 +20828,197 @@ function simpleEnd(buf) {
20828
20828
  return buf && buf.length ? this.write(buf) : "";
20829
20829
  }
20830
20830
  __name(simpleEnd, "simpleEnd");
20831
- var buffer$1 = {};
20832
- /*!
20833
- * The buffer module from node.js, for the browser.
20834
- *
20835
- * @author Feross Aboukhadijeh <https://feross.org>
20836
- * @license MIT
20837
- */
20838
- (function(exports2) {
20839
- const base64 = base64Js;
20840
- const ieee754$1 = ieee754;
20841
- const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
20842
- exports2.Buffer = Buffer2;
20843
- exports2.SlowBuffer = SlowBuffer;
20844
- exports2.INSPECT_MAX_BYTES = 50;
20845
- const K_MAX_LENGTH = 2147483647;
20846
- exports2.kMaxLength = K_MAX_LENGTH;
20847
- Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();
20848
- if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
20849
- console.error(
20850
- "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
20831
+ const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
20832
+ function getArrayBufferFromFile(file) {
20833
+ if (!isBrowser) {
20834
+ return toArrayBuffer(buffer$1.Buffer.isBuffer(file) ? file : file.buffer || file);
20835
+ }
20836
+ const reader = new window.FileReader();
20837
+ return new Promise((resolve, reject) => {
20838
+ reader.onload = (e) => {
20839
+ resolve(e.target.result);
20840
+ };
20841
+ reader.onerror = (err2) => {
20842
+ console.error("err:", err2);
20843
+ reject(err2);
20844
+ };
20845
+ reader.readAsArrayBuffer(
20846
+ buffer$1.Buffer.isBuffer(file) ? file : file.buffer || file
20851
20847
  );
20848
+ });
20849
+ }
20850
+ __name(getArrayBufferFromFile, "getArrayBufferFromFile");
20851
+ function toArrayBuffer(buffer2) {
20852
+ const ab = new ArrayBuffer(buffer2.length);
20853
+ const view = new Uint8Array(ab);
20854
+ for (let i = 0; i < buffer2.length; ++i) {
20855
+ view[i] = buffer2[i];
20852
20856
  }
20853
- function typedArraySupport() {
20857
+ return ab;
20858
+ }
20859
+ __name(toArrayBuffer, "toArrayBuffer");
20860
+ const Buffer$1 = buffer.Buffer;
20861
+ function snapgeneToJson(_0) {
20862
+ return __async(this, arguments, function* (fileObj, options = {}) {
20854
20863
  try {
20855
- const arr = new Uint8Array(1);
20856
- const proto = { foo: function() {
20857
- return 42;
20858
- } };
20859
- Object.setPrototypeOf(proto, Uint8Array.prototype);
20860
- Object.setPrototypeOf(arr, proto);
20861
- return arr.foo() === 42;
20864
+ let read = function(size, fmt) {
20865
+ const buffer2 = Buffer$1.from(arrayBuffer.slice(offset, size + offset));
20866
+ offset += size;
20867
+ if (fmt) {
20868
+ const decoder = new StringDecoder_1(fmt);
20869
+ const toRet = decoder.write(buffer2);
20870
+ return toRet;
20871
+ } else {
20872
+ return buffer2;
20873
+ }
20874
+ };
20875
+ __name(read, "read");
20876
+ const returnVal = createInitialSequence(options);
20877
+ const arrayBuffer = yield getArrayBufferFromFile(fileObj);
20878
+ const ext = extractFileExtension(options.fileName);
20879
+ let isProtein = options.isProtein;
20880
+ if (ext && /^(prot)$/.test(ext)) {
20881
+ isProtein = true;
20882
+ options.isProtein = true;
20883
+ }
20884
+ let offset = 0;
20885
+ function unpack(size, mode) {
20886
+ return __async(this, null, function* () {
20887
+ const buffer2 = yield read(size);
20888
+ const unpacked = yield bufferpack$1.unpack(">" + mode, buffer2);
20889
+ if (unpacked === void 0)
20890
+ return void 0;
20891
+ return yield unpacked[0];
20892
+ });
20893
+ }
20894
+ __name(unpack, "unpack");
20895
+ yield read(1);
20896
+ const length = yield unpack(4, "I");
20897
+ const title = yield read(8, "ascii");
20898
+ if (length !== 14 || title !== "SnapGene") {
20899
+ throw new Error("Wrong format for a SnapGene file !");
20900
+ }
20901
+ const data = yield __spreadProps(__spreadValues({}, returnVal.parsedSequence), {
20902
+ isProtein,
20903
+ isDNA: !!(yield unpack(2, "H")) && !isProtein,
20904
+ exportVersion: yield unpack(2, "H"),
20905
+ importVersion: yield unpack(2, "H"),
20906
+ features: []
20907
+ });
20908
+ while (offset <= arrayBuffer.byteLength) {
20909
+ const next_byte = yield read(1);
20910
+ const block_size = yield unpack(4, "I");
20911
+ if (ord(next_byte) === 21 || ord(next_byte) === 0) {
20912
+ const props = yield unpack(1, "b");
20913
+ const binaryRep = dec2bin(props);
20914
+ data.circular = isFirstBitA1(binaryRep);
20915
+ const size = block_size - 1;
20916
+ if (size < 0)
20917
+ return;
20918
+ data.size = isProtein ? size * 3 : size;
20919
+ data.sequence = yield read(size, "utf8");
20920
+ } else if (ord(next_byte) === 10) {
20921
+ const strand_dict = {
20922
+ // [strand, arrowheadType]
20923
+ 0: [1, "NONE"],
20924
+ // non-directional feature (in that case, the attribute is generally absent altogether)
20925
+ 1: [1, "TOP"],
20926
+ // forward strand
20927
+ 2: [-1, "BOTTOM"],
20928
+ // reverse strand
20929
+ 3: [1, "BOTH"]
20930
+ // bi-directional feature
20931
+ };
20932
+ const xml = yield read(block_size, "utf8");
20933
+ const b = new fxp.XMLParser({
20934
+ ignoreAttributes: false,
20935
+ attributeNamePrefix: "",
20936
+ isArray: (name) => name === "Feature" || name === "Segment"
20937
+ }).parse(xml);
20938
+ const { Features: { Feature = [] } = {} } = b;
20939
+ data.features = [];
20940
+ Feature.forEach((feat) => {
20941
+ const { directionality, Segment = [], name, type } = feat;
20942
+ let maxStart = 0;
20943
+ let maxEnd = 0;
20944
+ const locations = Segment && Segment.map((seg) => {
20945
+ if (!seg)
20946
+ throw new Error("invalid feature definition");
20947
+ const { range } = seg;
20948
+ let { start, end } = getStartAndEndFromRangeString(range);
20949
+ start = isProtein ? start * 3 : start;
20950
+ end = isProtein ? end * 3 + 2 : end;
20951
+ maxStart = Math.max(maxStart, start);
20952
+ maxEnd = Math.max(maxEnd, end);
20953
+ return {
20954
+ start,
20955
+ end
20956
+ };
20957
+ });
20958
+ data.features.push(__spreadProps(__spreadValues({
20959
+ name,
20960
+ type
20961
+ }, (locations == null ? void 0 : locations.length) > 1 && { locations }), {
20962
+ strand: directionality ? strand_dict[directionality][0] : 1,
20963
+ arrowheadType: directionality ? strand_dict[directionality][1] : "NONE",
20964
+ start: maxStart,
20965
+ end: maxEnd
20966
+ // color,
20967
+ }));
20968
+ });
20969
+ } else if (ord(next_byte) === 6) {
20970
+ const xml = yield read(block_size, "utf8");
20971
+ const b = new fxp.XMLParser({}).parse(xml);
20972
+ const name = get$1(b, "Notes.CustomMapLabel");
20973
+ if (name) {
20974
+ data.name = name;
20975
+ }
20976
+ const description = get$1(b, "Notes.Description");
20977
+ if (description && typeof description === "string") {
20978
+ data.description = description.replace("<html><body>", "").replace("</body></html>", "");
20979
+ }
20980
+ } else {
20981
+ yield read(block_size);
20982
+ }
20983
+ }
20984
+ returnVal.parsedSequence = data;
20985
+ return validateSequenceArray(
20986
+ flattenSequenceArray([returnVal], options),
20987
+ options
20988
+ );
20862
20989
  } catch (e) {
20863
- return false;
20864
- }
20865
- }
20866
- __name(typedArraySupport, "typedArraySupport");
20867
- Object.defineProperty(Buffer2.prototype, "parent", {
20868
- enumerable: true,
20869
- get: function() {
20870
- if (!Buffer2.isBuffer(this))
20871
- return void 0;
20872
- return this.buffer;
20873
- }
20874
- });
20875
- Object.defineProperty(Buffer2.prototype, "offset", {
20876
- enumerable: true,
20877
- get: function() {
20878
- if (!Buffer2.isBuffer(this))
20879
- return void 0;
20880
- return this.byteOffset;
20990
+ console.error("Error trying to parse file as snapgene:", e);
20991
+ return [
20992
+ {
20993
+ success: false,
20994
+ messages: ["Import Error: Invalid File"]
20995
+ }
20996
+ ];
20881
20997
  }
20882
20998
  });
20883
- function createBuffer(length) {
20884
- if (length > K_MAX_LENGTH) {
20885
- throw new RangeError('The value "' + length + '" is invalid for option "size"');
20999
+ }
21000
+ __name(snapgeneToJson, "snapgeneToJson");
21001
+ function getStartAndEndFromRangeString(rangestring) {
21002
+ const [start, end] = rangestring.split("-");
21003
+ return {
21004
+ start: start - 1,
21005
+ end: end - 1
21006
+ };
21007
+ }
21008
+ __name(getStartAndEndFromRangeString, "getStartAndEndFromRangeString");
21009
+ function ord(string) {
21010
+ const str = string + "";
21011
+ const code2 = str.charCodeAt(0);
21012
+ if (code2 >= 55296 && code2 <= 56319) {
21013
+ const hi = code2;
21014
+ if (str.length === 1) {
21015
+ return code2;
20886
21016
  }
20887
- const buf = new Uint8Array(length);
20888
- Object.setPrototypeOf(buf, Buffer2.prototype);
20889
- return buf;
21017
+ const low = str.charCodeAt(1);
21018
+ return (hi - 55296) * 1024 + (low - 56320) + 65536;
20890
21019
  }
20891
- __name(createBuffer, "createBuffer");
20892
- function Buffer2(arg, encodingOrOffset, length) {
20893
- if (typeof arg === "number") {
20894
- if (typeof encodingOrOffset === "string") {
20895
- throw new TypeError(
20896
- 'The "string" argument must be of type string. Received type number'
20897
- );
20898
- }
20899
- return allocUnsafe2(arg);
20900
- }
20901
- return from(arg, encodingOrOffset, length);
20902
- }
20903
- __name(Buffer2, "Buffer");
20904
- Buffer2.poolSize = 8192;
20905
- function from(value, encodingOrOffset, length) {
20906
- if (typeof value === "string") {
20907
- return fromString(value, encodingOrOffset);
20908
- }
20909
- if (ArrayBuffer.isView(value)) {
20910
- return fromArrayView(value);
20911
- }
20912
- if (value == null) {
20913
- throw new TypeError(
20914
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
20915
- );
20916
- }
20917
- if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
20918
- return fromArrayBuffer(value, encodingOrOffset, length);
20919
- }
20920
- if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
20921
- return fromArrayBuffer(value, encodingOrOffset, length);
20922
- }
20923
- if (typeof value === "number") {
20924
- throw new TypeError(
20925
- 'The "value" argument must not be of type number. Received type number'
20926
- );
20927
- }
20928
- const valueOf = value.valueOf && value.valueOf();
20929
- if (valueOf != null && valueOf !== value) {
20930
- return Buffer2.from(valueOf, encodingOrOffset, length);
20931
- }
20932
- const b = fromObject(value);
20933
- if (b)
20934
- return b;
20935
- if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
20936
- return Buffer2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
20937
- }
20938
- throw new TypeError(
20939
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
20940
- );
20941
- }
20942
- __name(from, "from");
20943
- Buffer2.from = function(value, encodingOrOffset, length) {
20944
- return from(value, encodingOrOffset, length);
20945
- };
20946
- Object.setPrototypeOf(Buffer2.prototype, Uint8Array.prototype);
20947
- Object.setPrototypeOf(Buffer2, Uint8Array);
20948
- function assertSize(size) {
20949
- if (typeof size !== "number") {
20950
- throw new TypeError('"size" argument must be of type number');
20951
- } else if (size < 0) {
20952
- throw new RangeError('The value "' + size + '" is invalid for option "size"');
20953
- }
20954
- }
20955
- __name(assertSize, "assertSize");
20956
- function alloc(size, fill, encoding) {
20957
- assertSize(size);
20958
- if (size <= 0) {
20959
- return createBuffer(size);
20960
- }
20961
- if (fill !== void 0) {
20962
- return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
20963
- }
20964
- return createBuffer(size);
20965
- }
20966
- __name(alloc, "alloc");
20967
- Buffer2.alloc = function(size, fill, encoding) {
20968
- return alloc(size, fill, encoding);
20969
- };
20970
- function allocUnsafe2(size) {
20971
- assertSize(size);
20972
- return createBuffer(size < 0 ? 0 : checked(size) | 0);
20973
- }
20974
- __name(allocUnsafe2, "allocUnsafe");
20975
- Buffer2.allocUnsafe = function(size) {
20976
- return allocUnsafe2(size);
20977
- };
20978
- Buffer2.allocUnsafeSlow = function(size) {
20979
- return allocUnsafe2(size);
20980
- };
20981
- function fromString(string, encoding) {
20982
- if (typeof encoding !== "string" || encoding === "") {
20983
- encoding = "utf8";
20984
- }
20985
- if (!Buffer2.isEncoding(encoding)) {
20986
- throw new TypeError("Unknown encoding: " + encoding);
20987
- }
20988
- const length = byteLength2(string, encoding) | 0;
20989
- let buf = createBuffer(length);
20990
- const actual = buf.write(string, encoding);
20991
- if (actual !== length) {
20992
- buf = buf.slice(0, actual);
20993
- }
20994
- return buf;
20995
- }
20996
- __name(fromString, "fromString");
20997
- function fromArrayLike(array) {
20998
- const length = array.length < 0 ? 0 : checked(array.length) | 0;
20999
- const buf = createBuffer(length);
21000
- for (let i = 0; i < length; i += 1) {
21001
- buf[i] = array[i] & 255;
21002
- }
21003
- return buf;
21004
- }
21005
- __name(fromArrayLike, "fromArrayLike");
21006
- function fromArrayView(arrayView) {
21007
- if (isInstance(arrayView, Uint8Array)) {
21008
- const copy = new Uint8Array(arrayView);
21009
- return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
21010
- }
21011
- return fromArrayLike(arrayView);
21012
- }
21013
- __name(fromArrayView, "fromArrayView");
21014
- function fromArrayBuffer(array, byteOffset, length) {
21015
- if (byteOffset < 0 || array.byteLength < byteOffset) {
21016
- throw new RangeError('"offset" is outside of buffer bounds');
21017
- }
21018
- if (array.byteLength < byteOffset + (length || 0)) {
21019
- throw new RangeError('"length" is outside of buffer bounds');
21020
- }
21021
- let buf;
21022
- if (byteOffset === void 0 && length === void 0) {
21023
- buf = new Uint8Array(array);
21024
- } else if (length === void 0) {
21025
- buf = new Uint8Array(array, byteOffset);
21026
- } else {
21027
- buf = new Uint8Array(array, byteOffset, length);
21028
- }
21029
- Object.setPrototypeOf(buf, Buffer2.prototype);
21030
- return buf;
21031
- }
21032
- __name(fromArrayBuffer, "fromArrayBuffer");
21033
- function fromObject(obj) {
21034
- if (Buffer2.isBuffer(obj)) {
21035
- const len = checked(obj.length) | 0;
21036
- const buf = createBuffer(len);
21037
- if (buf.length === 0) {
21038
- return buf;
21039
- }
21040
- obj.copy(buf, 0, 0, len);
21041
- return buf;
21042
- }
21043
- if (obj.length !== void 0) {
21044
- if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
21045
- return createBuffer(0);
21046
- }
21047
- return fromArrayLike(obj);
21048
- }
21049
- if (obj.type === "Buffer" && Array.isArray(obj.data)) {
21050
- return fromArrayLike(obj.data);
21051
- }
21052
- }
21053
- __name(fromObject, "fromObject");
21054
- function checked(length) {
21055
- if (length >= K_MAX_LENGTH) {
21056
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
21057
- }
21058
- return length | 0;
21059
- }
21060
- __name(checked, "checked");
21061
- function SlowBuffer(length) {
21062
- if (+length != length) {
21063
- length = 0;
21064
- }
21065
- return Buffer2.alloc(+length);
21066
- }
21067
- __name(SlowBuffer, "SlowBuffer");
21068
- Buffer2.isBuffer = /* @__PURE__ */ __name(function isBuffer2(b) {
21069
- return b != null && b._isBuffer === true && b !== Buffer2.prototype;
21070
- }, "isBuffer");
21071
- Buffer2.compare = /* @__PURE__ */ __name(function compare(a, b) {
21072
- if (isInstance(a, Uint8Array))
21073
- a = Buffer2.from(a, a.offset, a.byteLength);
21074
- if (isInstance(b, Uint8Array))
21075
- b = Buffer2.from(b, b.offset, b.byteLength);
21076
- if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
21077
- throw new TypeError(
21078
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
21079
- );
21080
- }
21081
- if (a === b)
21082
- return 0;
21083
- let x = a.length;
21084
- let y = b.length;
21085
- for (let i = 0, len = Math.min(x, y); i < len; ++i) {
21086
- if (a[i] !== b[i]) {
21087
- x = a[i];
21088
- y = b[i];
21089
- break;
21090
- }
21091
- }
21092
- if (x < y)
21093
- return -1;
21094
- if (y < x)
21095
- return 1;
21096
- return 0;
21097
- }, "compare");
21098
- Buffer2.isEncoding = /* @__PURE__ */ __name(function isEncoding2(encoding) {
21099
- switch (String(encoding).toLowerCase()) {
21100
- case "hex":
21101
- case "utf8":
21102
- case "utf-8":
21103
- case "ascii":
21104
- case "latin1":
21105
- case "binary":
21106
- case "base64":
21107
- case "ucs2":
21108
- case "ucs-2":
21109
- case "utf16le":
21110
- case "utf-16le":
21111
- return true;
21112
- default:
21113
- return false;
21114
- }
21115
- }, "isEncoding");
21116
- Buffer2.concat = /* @__PURE__ */ __name(function concat2(list, length) {
21117
- if (!Array.isArray(list)) {
21118
- throw new TypeError('"list" argument must be an Array of Buffers');
21119
- }
21120
- if (list.length === 0) {
21121
- return Buffer2.alloc(0);
21122
- }
21123
- let i;
21124
- if (length === void 0) {
21125
- length = 0;
21126
- for (i = 0; i < list.length; ++i) {
21127
- length += list[i].length;
21128
- }
21129
- }
21130
- const buffer2 = Buffer2.allocUnsafe(length);
21131
- let pos = 0;
21132
- for (i = 0; i < list.length; ++i) {
21133
- let buf = list[i];
21134
- if (isInstance(buf, Uint8Array)) {
21135
- if (pos + buf.length > buffer2.length) {
21136
- if (!Buffer2.isBuffer(buf))
21137
- buf = Buffer2.from(buf);
21138
- buf.copy(buffer2, pos);
21139
- } else {
21140
- Uint8Array.prototype.set.call(
21141
- buffer2,
21142
- buf,
21143
- pos
21144
- );
21145
- }
21146
- } else if (!Buffer2.isBuffer(buf)) {
21147
- throw new TypeError('"list" argument must be an Array of Buffers');
21148
- } else {
21149
- buf.copy(buffer2, pos);
21150
- }
21151
- pos += buf.length;
21152
- }
21153
- return buffer2;
21154
- }, "concat");
21155
- function byteLength2(string, encoding) {
21156
- if (Buffer2.isBuffer(string)) {
21157
- return string.length;
21158
- }
21159
- if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
21160
- return string.byteLength;
21161
- }
21162
- if (typeof string !== "string") {
21163
- throw new TypeError(
21164
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
21165
- );
21166
- }
21167
- const len = string.length;
21168
- const mustMatch = arguments.length > 2 && arguments[2] === true;
21169
- if (!mustMatch && len === 0)
21170
- return 0;
21171
- let loweredCase = false;
21172
- for (; ; ) {
21173
- switch (encoding) {
21174
- case "ascii":
21175
- case "latin1":
21176
- case "binary":
21177
- return len;
21178
- case "utf8":
21179
- case "utf-8":
21180
- return utf8ToBytes(string).length;
21181
- case "ucs2":
21182
- case "ucs-2":
21183
- case "utf16le":
21184
- case "utf-16le":
21185
- return len * 2;
21186
- case "hex":
21187
- return len >>> 1;
21188
- case "base64":
21189
- return base64ToBytes(string).length;
21190
- default:
21191
- if (loweredCase) {
21192
- return mustMatch ? -1 : utf8ToBytes(string).length;
21193
- }
21194
- encoding = ("" + encoding).toLowerCase();
21195
- loweredCase = true;
21196
- }
21197
- }
21198
- }
21199
- __name(byteLength2, "byteLength");
21200
- Buffer2.byteLength = byteLength2;
21201
- function slowToString(encoding, start, end) {
21202
- let loweredCase = false;
21203
- if (start === void 0 || start < 0) {
21204
- start = 0;
21205
- }
21206
- if (start > this.length) {
21207
- return "";
21208
- }
21209
- if (end === void 0 || end > this.length) {
21210
- end = this.length;
21211
- }
21212
- if (end <= 0) {
21213
- return "";
21214
- }
21215
- end >>>= 0;
21216
- start >>>= 0;
21217
- if (end <= start) {
21218
- return "";
21219
- }
21220
- if (!encoding)
21221
- encoding = "utf8";
21222
- while (true) {
21223
- switch (encoding) {
21224
- case "hex":
21225
- return hexSlice(this, start, end);
21226
- case "utf8":
21227
- case "utf-8":
21228
- return utf8Slice(this, start, end);
21229
- case "ascii":
21230
- return asciiSlice(this, start, end);
21231
- case "latin1":
21232
- case "binary":
21233
- return latin1Slice(this, start, end);
21234
- case "base64":
21235
- return base64Slice(this, start, end);
21236
- case "ucs2":
21237
- case "ucs-2":
21238
- case "utf16le":
21239
- case "utf-16le":
21240
- return utf16leSlice(this, start, end);
21241
- default:
21242
- if (loweredCase)
21243
- throw new TypeError("Unknown encoding: " + encoding);
21244
- encoding = (encoding + "").toLowerCase();
21245
- loweredCase = true;
21246
- }
21247
- }
21248
- }
21249
- __name(slowToString, "slowToString");
21250
- Buffer2.prototype._isBuffer = true;
21251
- function swap(b, n, m) {
21252
- const i = b[n];
21253
- b[n] = b[m];
21254
- b[m] = i;
21255
- }
21256
- __name(swap, "swap");
21257
- Buffer2.prototype.swap16 = /* @__PURE__ */ __name(function swap16() {
21258
- const len = this.length;
21259
- if (len % 2 !== 0) {
21260
- throw new RangeError("Buffer size must be a multiple of 16-bits");
21261
- }
21262
- for (let i = 0; i < len; i += 2) {
21263
- swap(this, i, i + 1);
21264
- }
21265
- return this;
21266
- }, "swap16");
21267
- Buffer2.prototype.swap32 = /* @__PURE__ */ __name(function swap32() {
21268
- const len = this.length;
21269
- if (len % 4 !== 0) {
21270
- throw new RangeError("Buffer size must be a multiple of 32-bits");
21271
- }
21272
- for (let i = 0; i < len; i += 4) {
21273
- swap(this, i, i + 3);
21274
- swap(this, i + 1, i + 2);
21275
- }
21276
- return this;
21277
- }, "swap32");
21278
- Buffer2.prototype.swap64 = /* @__PURE__ */ __name(function swap64() {
21279
- const len = this.length;
21280
- if (len % 8 !== 0) {
21281
- throw new RangeError("Buffer size must be a multiple of 64-bits");
21282
- }
21283
- for (let i = 0; i < len; i += 8) {
21284
- swap(this, i, i + 7);
21285
- swap(this, i + 1, i + 6);
21286
- swap(this, i + 2, i + 5);
21287
- swap(this, i + 3, i + 4);
21288
- }
21289
- return this;
21290
- }, "swap64");
21291
- Buffer2.prototype.toString = /* @__PURE__ */ __name(function toString2() {
21292
- const length = this.length;
21293
- if (length === 0)
21294
- return "";
21295
- if (arguments.length === 0)
21296
- return utf8Slice(this, 0, length);
21297
- return slowToString.apply(this, arguments);
21298
- }, "toString");
21299
- Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;
21300
- Buffer2.prototype.equals = /* @__PURE__ */ __name(function equals(b) {
21301
- if (!Buffer2.isBuffer(b))
21302
- throw new TypeError("Argument must be a Buffer");
21303
- if (this === b)
21304
- return true;
21305
- return Buffer2.compare(this, b) === 0;
21306
- }, "equals");
21307
- Buffer2.prototype.inspect = /* @__PURE__ */ __name(function inspect() {
21308
- let str = "";
21309
- const max2 = exports2.INSPECT_MAX_BYTES;
21310
- str = this.toString("hex", 0, max2).replace(/(.{2})/g, "$1 ").trim();
21311
- if (this.length > max2)
21312
- str += " ... ";
21313
- return "<Buffer " + str + ">";
21314
- }, "inspect");
21315
- if (customInspectSymbol) {
21316
- Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect;
21317
- }
21318
- Buffer2.prototype.compare = /* @__PURE__ */ __name(function compare(target, start, end, thisStart, thisEnd) {
21319
- if (isInstance(target, Uint8Array)) {
21320
- target = Buffer2.from(target, target.offset, target.byteLength);
21321
- }
21322
- if (!Buffer2.isBuffer(target)) {
21323
- throw new TypeError(
21324
- 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
21325
- );
21326
- }
21327
- if (start === void 0) {
21328
- start = 0;
21329
- }
21330
- if (end === void 0) {
21331
- end = target ? target.length : 0;
21332
- }
21333
- if (thisStart === void 0) {
21334
- thisStart = 0;
21335
- }
21336
- if (thisEnd === void 0) {
21337
- thisEnd = this.length;
21338
- }
21339
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
21340
- throw new RangeError("out of range index");
21341
- }
21342
- if (thisStart >= thisEnd && start >= end) {
21343
- return 0;
21344
- }
21345
- if (thisStart >= thisEnd) {
21346
- return -1;
21347
- }
21348
- if (start >= end) {
21349
- return 1;
21350
- }
21351
- start >>>= 0;
21352
- end >>>= 0;
21353
- thisStart >>>= 0;
21354
- thisEnd >>>= 0;
21355
- if (this === target)
21356
- return 0;
21357
- let x = thisEnd - thisStart;
21358
- let y = end - start;
21359
- const len = Math.min(x, y);
21360
- const thisCopy = this.slice(thisStart, thisEnd);
21361
- const targetCopy = target.slice(start, end);
21362
- for (let i = 0; i < len; ++i) {
21363
- if (thisCopy[i] !== targetCopy[i]) {
21364
- x = thisCopy[i];
21365
- y = targetCopy[i];
21366
- break;
21367
- }
21368
- }
21369
- if (x < y)
21370
- return -1;
21371
- if (y < x)
21372
- return 1;
21373
- return 0;
21374
- }, "compare");
21375
- function bidirectionalIndexOf(buffer2, val2, byteOffset, encoding, dir) {
21376
- if (buffer2.length === 0)
21377
- return -1;
21378
- if (typeof byteOffset === "string") {
21379
- encoding = byteOffset;
21380
- byteOffset = 0;
21381
- } else if (byteOffset > 2147483647) {
21382
- byteOffset = 2147483647;
21383
- } else if (byteOffset < -2147483648) {
21384
- byteOffset = -2147483648;
21385
- }
21386
- byteOffset = +byteOffset;
21387
- if (numberIsNaN(byteOffset)) {
21388
- byteOffset = dir ? 0 : buffer2.length - 1;
21389
- }
21390
- if (byteOffset < 0)
21391
- byteOffset = buffer2.length + byteOffset;
21392
- if (byteOffset >= buffer2.length) {
21393
- if (dir)
21394
- return -1;
21395
- else
21396
- byteOffset = buffer2.length - 1;
21397
- } else if (byteOffset < 0) {
21398
- if (dir)
21399
- byteOffset = 0;
21400
- else
21401
- return -1;
21402
- }
21403
- if (typeof val2 === "string") {
21404
- val2 = Buffer2.from(val2, encoding);
21405
- }
21406
- if (Buffer2.isBuffer(val2)) {
21407
- if (val2.length === 0) {
21408
- return -1;
21409
- }
21410
- return arrayIndexOf(buffer2, val2, byteOffset, encoding, dir);
21411
- } else if (typeof val2 === "number") {
21412
- val2 = val2 & 255;
21413
- if (typeof Uint8Array.prototype.indexOf === "function") {
21414
- if (dir) {
21415
- return Uint8Array.prototype.indexOf.call(buffer2, val2, byteOffset);
21416
- } else {
21417
- return Uint8Array.prototype.lastIndexOf.call(buffer2, val2, byteOffset);
21418
- }
21419
- }
21420
- return arrayIndexOf(buffer2, [val2], byteOffset, encoding, dir);
21421
- }
21422
- throw new TypeError("val must be string, number or Buffer");
21423
- }
21424
- __name(bidirectionalIndexOf, "bidirectionalIndexOf");
21425
- function arrayIndexOf(arr, val2, byteOffset, encoding, dir) {
21426
- let indexSize = 1;
21427
- let arrLength = arr.length;
21428
- let valLength = val2.length;
21429
- if (encoding !== void 0) {
21430
- encoding = String(encoding).toLowerCase();
21431
- if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
21432
- if (arr.length < 2 || val2.length < 2) {
21433
- return -1;
21434
- }
21435
- indexSize = 2;
21436
- arrLength /= 2;
21437
- valLength /= 2;
21438
- byteOffset /= 2;
21439
- }
21440
- }
21441
- function read(buf, i2) {
21442
- if (indexSize === 1) {
21443
- return buf[i2];
21444
- } else {
21445
- return buf.readUInt16BE(i2 * indexSize);
21446
- }
21447
- }
21448
- __name(read, "read");
21449
- let i;
21450
- if (dir) {
21451
- let foundIndex = -1;
21452
- for (i = byteOffset; i < arrLength; i++) {
21453
- if (read(arr, i) === read(val2, foundIndex === -1 ? 0 : i - foundIndex)) {
21454
- if (foundIndex === -1)
21455
- foundIndex = i;
21456
- if (i - foundIndex + 1 === valLength)
21457
- return foundIndex * indexSize;
21458
- } else {
21459
- if (foundIndex !== -1)
21460
- i -= i - foundIndex;
21461
- foundIndex = -1;
21462
- }
21463
- }
21464
- } else {
21465
- if (byteOffset + valLength > arrLength)
21466
- byteOffset = arrLength - valLength;
21467
- for (i = byteOffset; i >= 0; i--) {
21468
- let found = true;
21469
- for (let j = 0; j < valLength; j++) {
21470
- if (read(arr, i + j) !== read(val2, j)) {
21471
- found = false;
21472
- break;
21473
- }
21474
- }
21475
- if (found)
21476
- return i;
21477
- }
21478
- }
21479
- return -1;
21480
- }
21481
- __name(arrayIndexOf, "arrayIndexOf");
21482
- Buffer2.prototype.includes = /* @__PURE__ */ __name(function includes(val2, byteOffset, encoding) {
21483
- return this.indexOf(val2, byteOffset, encoding) !== -1;
21484
- }, "includes");
21485
- Buffer2.prototype.indexOf = /* @__PURE__ */ __name(function indexOf(val2, byteOffset, encoding) {
21486
- return bidirectionalIndexOf(this, val2, byteOffset, encoding, true);
21487
- }, "indexOf");
21488
- Buffer2.prototype.lastIndexOf = /* @__PURE__ */ __name(function lastIndexOf(val2, byteOffset, encoding) {
21489
- return bidirectionalIndexOf(this, val2, byteOffset, encoding, false);
21490
- }, "lastIndexOf");
21491
- function hexWrite(buf, string, offset, length) {
21492
- offset = Number(offset) || 0;
21493
- const remaining = buf.length - offset;
21494
- if (!length) {
21495
- length = remaining;
21496
- } else {
21497
- length = Number(length);
21498
- if (length > remaining) {
21499
- length = remaining;
21500
- }
21501
- }
21502
- const strLen = string.length;
21503
- if (length > strLen / 2) {
21504
- length = strLen / 2;
21505
- }
21506
- let i;
21507
- for (i = 0; i < length; ++i) {
21508
- const parsed = parseInt(string.substr(i * 2, 2), 16);
21509
- if (numberIsNaN(parsed))
21510
- return i;
21511
- buf[offset + i] = parsed;
21512
- }
21513
- return i;
21514
- }
21515
- __name(hexWrite, "hexWrite");
21516
- function utf8Write(buf, string, offset, length) {
21517
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
21518
- }
21519
- __name(utf8Write, "utf8Write");
21520
- function asciiWrite(buf, string, offset, length) {
21521
- return blitBuffer(asciiToBytes(string), buf, offset, length);
21522
- }
21523
- __name(asciiWrite, "asciiWrite");
21524
- function base64Write(buf, string, offset, length) {
21525
- return blitBuffer(base64ToBytes(string), buf, offset, length);
21526
- }
21527
- __name(base64Write, "base64Write");
21528
- function ucs2Write(buf, string, offset, length) {
21529
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
21530
- }
21531
- __name(ucs2Write, "ucs2Write");
21532
- Buffer2.prototype.write = /* @__PURE__ */ __name(function write(string, offset, length, encoding) {
21533
- if (offset === void 0) {
21534
- encoding = "utf8";
21535
- length = this.length;
21536
- offset = 0;
21537
- } else if (length === void 0 && typeof offset === "string") {
21538
- encoding = offset;
21539
- length = this.length;
21540
- offset = 0;
21541
- } else if (isFinite(offset)) {
21542
- offset = offset >>> 0;
21543
- if (isFinite(length)) {
21544
- length = length >>> 0;
21545
- if (encoding === void 0)
21546
- encoding = "utf8";
21547
- } else {
21548
- encoding = length;
21549
- length = void 0;
21550
- }
21551
- } else {
21552
- throw new Error(
21553
- "Buffer.write(string, encoding, offset[, length]) is no longer supported"
21554
- );
21555
- }
21556
- const remaining = this.length - offset;
21557
- if (length === void 0 || length > remaining)
21558
- length = remaining;
21559
- if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
21560
- throw new RangeError("Attempt to write outside buffer bounds");
21561
- }
21562
- if (!encoding)
21563
- encoding = "utf8";
21564
- let loweredCase = false;
21565
- for (; ; ) {
21566
- switch (encoding) {
21567
- case "hex":
21568
- return hexWrite(this, string, offset, length);
21569
- case "utf8":
21570
- case "utf-8":
21571
- return utf8Write(this, string, offset, length);
21572
- case "ascii":
21573
- case "latin1":
21574
- case "binary":
21575
- return asciiWrite(this, string, offset, length);
21576
- case "base64":
21577
- return base64Write(this, string, offset, length);
21578
- case "ucs2":
21579
- case "ucs-2":
21580
- case "utf16le":
21581
- case "utf-16le":
21582
- return ucs2Write(this, string, offset, length);
21583
- default:
21584
- if (loweredCase)
21585
- throw new TypeError("Unknown encoding: " + encoding);
21586
- encoding = ("" + encoding).toLowerCase();
21587
- loweredCase = true;
21588
- }
21589
- }
21590
- }, "write");
21591
- Buffer2.prototype.toJSON = /* @__PURE__ */ __name(function toJSON() {
21592
- return {
21593
- type: "Buffer",
21594
- data: Array.prototype.slice.call(this._arr || this, 0)
21595
- };
21596
- }, "toJSON");
21597
- function base64Slice(buf, start, end) {
21598
- if (start === 0 && end === buf.length) {
21599
- return base64.fromByteArray(buf);
21600
- } else {
21601
- return base64.fromByteArray(buf.slice(start, end));
21602
- }
21603
- }
21604
- __name(base64Slice, "base64Slice");
21605
- function utf8Slice(buf, start, end) {
21606
- end = Math.min(buf.length, end);
21607
- const res = [];
21608
- let i = start;
21609
- while (i < end) {
21610
- const firstByte = buf[i];
21611
- let codePoint = null;
21612
- let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
21613
- if (i + bytesPerSequence <= end) {
21614
- let secondByte, thirdByte, fourthByte, tempCodePoint;
21615
- switch (bytesPerSequence) {
21616
- case 1:
21617
- if (firstByte < 128) {
21618
- codePoint = firstByte;
21619
- }
21620
- break;
21621
- case 2:
21622
- secondByte = buf[i + 1];
21623
- if ((secondByte & 192) === 128) {
21624
- tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
21625
- if (tempCodePoint > 127) {
21626
- codePoint = tempCodePoint;
21627
- }
21628
- }
21629
- break;
21630
- case 3:
21631
- secondByte = buf[i + 1];
21632
- thirdByte = buf[i + 2];
21633
- if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
21634
- tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
21635
- if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
21636
- codePoint = tempCodePoint;
21637
- }
21638
- }
21639
- break;
21640
- case 4:
21641
- secondByte = buf[i + 1];
21642
- thirdByte = buf[i + 2];
21643
- fourthByte = buf[i + 3];
21644
- if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
21645
- tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
21646
- if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
21647
- codePoint = tempCodePoint;
21648
- }
21649
- }
21650
- }
21651
- }
21652
- if (codePoint === null) {
21653
- codePoint = 65533;
21654
- bytesPerSequence = 1;
21655
- } else if (codePoint > 65535) {
21656
- codePoint -= 65536;
21657
- res.push(codePoint >>> 10 & 1023 | 55296);
21658
- codePoint = 56320 | codePoint & 1023;
21659
- }
21660
- res.push(codePoint);
21661
- i += bytesPerSequence;
21662
- }
21663
- return decodeCodePointsArray(res);
21664
- }
21665
- __name(utf8Slice, "utf8Slice");
21666
- const MAX_ARGUMENTS_LENGTH = 4096;
21667
- function decodeCodePointsArray(codePoints) {
21668
- const len = codePoints.length;
21669
- if (len <= MAX_ARGUMENTS_LENGTH) {
21670
- return String.fromCharCode.apply(String, codePoints);
21671
- }
21672
- let res = "";
21673
- let i = 0;
21674
- while (i < len) {
21675
- res += String.fromCharCode.apply(
21676
- String,
21677
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
21678
- );
21679
- }
21680
- return res;
21681
- }
21682
- __name(decodeCodePointsArray, "decodeCodePointsArray");
21683
- function asciiSlice(buf, start, end) {
21684
- let ret = "";
21685
- end = Math.min(buf.length, end);
21686
- for (let i = start; i < end; ++i) {
21687
- ret += String.fromCharCode(buf[i] & 127);
21688
- }
21689
- return ret;
21690
- }
21691
- __name(asciiSlice, "asciiSlice");
21692
- function latin1Slice(buf, start, end) {
21693
- let ret = "";
21694
- end = Math.min(buf.length, end);
21695
- for (let i = start; i < end; ++i) {
21696
- ret += String.fromCharCode(buf[i]);
21697
- }
21698
- return ret;
21699
- }
21700
- __name(latin1Slice, "latin1Slice");
21701
- function hexSlice(buf, start, end) {
21702
- const len = buf.length;
21703
- if (!start || start < 0)
21704
- start = 0;
21705
- if (!end || end < 0 || end > len)
21706
- end = len;
21707
- let out = "";
21708
- for (let i = start; i < end; ++i) {
21709
- out += hexSliceLookupTable[buf[i]];
21710
- }
21711
- return out;
21712
- }
21713
- __name(hexSlice, "hexSlice");
21714
- function utf16leSlice(buf, start, end) {
21715
- const bytes = buf.slice(start, end);
21716
- let res = "";
21717
- for (let i = 0; i < bytes.length - 1; i += 2) {
21718
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
21719
- }
21720
- return res;
21721
- }
21722
- __name(utf16leSlice, "utf16leSlice");
21723
- Buffer2.prototype.slice = /* @__PURE__ */ __name(function slice2(start, end) {
21724
- const len = this.length;
21725
- start = ~~start;
21726
- end = end === void 0 ? len : ~~end;
21727
- if (start < 0) {
21728
- start += len;
21729
- if (start < 0)
21730
- start = 0;
21731
- } else if (start > len) {
21732
- start = len;
21733
- }
21734
- if (end < 0) {
21735
- end += len;
21736
- if (end < 0)
21737
- end = 0;
21738
- } else if (end > len) {
21739
- end = len;
21740
- }
21741
- if (end < start)
21742
- end = start;
21743
- const newBuf = this.subarray(start, end);
21744
- Object.setPrototypeOf(newBuf, Buffer2.prototype);
21745
- return newBuf;
21746
- }, "slice");
21747
- function checkOffset(offset, ext, length) {
21748
- if (offset % 1 !== 0 || offset < 0)
21749
- throw new RangeError("offset is not uint");
21750
- if (offset + ext > length)
21751
- throw new RangeError("Trying to access beyond buffer length");
21752
- }
21753
- __name(checkOffset, "checkOffset");
21754
- Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = /* @__PURE__ */ __name(function readUIntLE(offset, byteLength3, noAssert) {
21755
- offset = offset >>> 0;
21756
- byteLength3 = byteLength3 >>> 0;
21757
- if (!noAssert)
21758
- checkOffset(offset, byteLength3, this.length);
21759
- let val2 = this[offset];
21760
- let mul = 1;
21761
- let i = 0;
21762
- while (++i < byteLength3 && (mul *= 256)) {
21763
- val2 += this[offset + i] * mul;
21764
- }
21765
- return val2;
21766
- }, "readUIntLE");
21767
- Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = /* @__PURE__ */ __name(function readUIntBE(offset, byteLength3, noAssert) {
21768
- offset = offset >>> 0;
21769
- byteLength3 = byteLength3 >>> 0;
21770
- if (!noAssert) {
21771
- checkOffset(offset, byteLength3, this.length);
21772
- }
21773
- let val2 = this[offset + --byteLength3];
21774
- let mul = 1;
21775
- while (byteLength3 > 0 && (mul *= 256)) {
21776
- val2 += this[offset + --byteLength3] * mul;
21777
- }
21778
- return val2;
21779
- }, "readUIntBE");
21780
- Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = /* @__PURE__ */ __name(function readUInt8(offset, noAssert) {
21781
- offset = offset >>> 0;
21782
- if (!noAssert)
21783
- checkOffset(offset, 1, this.length);
21784
- return this[offset];
21785
- }, "readUInt8");
21786
- Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = /* @__PURE__ */ __name(function readUInt16LE(offset, noAssert) {
21787
- offset = offset >>> 0;
21788
- if (!noAssert)
21789
- checkOffset(offset, 2, this.length);
21790
- return this[offset] | this[offset + 1] << 8;
21791
- }, "readUInt16LE");
21792
- Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = /* @__PURE__ */ __name(function readUInt16BE(offset, noAssert) {
21793
- offset = offset >>> 0;
21794
- if (!noAssert)
21795
- checkOffset(offset, 2, this.length);
21796
- return this[offset] << 8 | this[offset + 1];
21797
- }, "readUInt16BE");
21798
- Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = /* @__PURE__ */ __name(function readUInt32LE(offset, noAssert) {
21799
- offset = offset >>> 0;
21800
- if (!noAssert)
21801
- checkOffset(offset, 4, this.length);
21802
- return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
21803
- }, "readUInt32LE");
21804
- Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = /* @__PURE__ */ __name(function readUInt32BE(offset, noAssert) {
21805
- offset = offset >>> 0;
21806
- if (!noAssert)
21807
- checkOffset(offset, 4, this.length);
21808
- return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
21809
- }, "readUInt32BE");
21810
- Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigUInt64LE(offset) {
21811
- offset = offset >>> 0;
21812
- validateNumber(offset, "offset");
21813
- const first = this[offset];
21814
- const last2 = this[offset + 7];
21815
- if (first === void 0 || last2 === void 0) {
21816
- boundsError(offset, this.length - 8);
21817
- }
21818
- const lo = first + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 24);
21819
- const hi = this[++offset] + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + last2 * __pow(2, 24);
21820
- return BigInt(lo) + (BigInt(hi) << BigInt(32));
21821
- }, "readBigUInt64LE"));
21822
- Buffer2.prototype.readBigUInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigUInt64BE(offset) {
21823
- offset = offset >>> 0;
21824
- validateNumber(offset, "offset");
21825
- const first = this[offset];
21826
- const last2 = this[offset + 7];
21827
- if (first === void 0 || last2 === void 0) {
21828
- boundsError(offset, this.length - 8);
21829
- }
21830
- const hi = first * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + this[++offset];
21831
- const lo = this[++offset] * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + last2;
21832
- return (BigInt(hi) << BigInt(32)) + BigInt(lo);
21833
- }, "readBigUInt64BE"));
21834
- Buffer2.prototype.readIntLE = /* @__PURE__ */ __name(function readIntLE(offset, byteLength3, noAssert) {
21835
- offset = offset >>> 0;
21836
- byteLength3 = byteLength3 >>> 0;
21837
- if (!noAssert)
21838
- checkOffset(offset, byteLength3, this.length);
21839
- let val2 = this[offset];
21840
- let mul = 1;
21841
- let i = 0;
21842
- while (++i < byteLength3 && (mul *= 256)) {
21843
- val2 += this[offset + i] * mul;
21844
- }
21845
- mul *= 128;
21846
- if (val2 >= mul)
21847
- val2 -= Math.pow(2, 8 * byteLength3);
21848
- return val2;
21849
- }, "readIntLE");
21850
- Buffer2.prototype.readIntBE = /* @__PURE__ */ __name(function readIntBE(offset, byteLength3, noAssert) {
21851
- offset = offset >>> 0;
21852
- byteLength3 = byteLength3 >>> 0;
21853
- if (!noAssert)
21854
- checkOffset(offset, byteLength3, this.length);
21855
- let i = byteLength3;
21856
- let mul = 1;
21857
- let val2 = this[offset + --i];
21858
- while (i > 0 && (mul *= 256)) {
21859
- val2 += this[offset + --i] * mul;
21860
- }
21861
- mul *= 128;
21862
- if (val2 >= mul)
21863
- val2 -= Math.pow(2, 8 * byteLength3);
21864
- return val2;
21865
- }, "readIntBE");
21866
- Buffer2.prototype.readInt8 = /* @__PURE__ */ __name(function readInt8(offset, noAssert) {
21867
- offset = offset >>> 0;
21868
- if (!noAssert)
21869
- checkOffset(offset, 1, this.length);
21870
- if (!(this[offset] & 128))
21871
- return this[offset];
21872
- return (255 - this[offset] + 1) * -1;
21873
- }, "readInt8");
21874
- Buffer2.prototype.readInt16LE = /* @__PURE__ */ __name(function readInt16LE(offset, noAssert) {
21875
- offset = offset >>> 0;
21876
- if (!noAssert)
21877
- checkOffset(offset, 2, this.length);
21878
- const val2 = this[offset] | this[offset + 1] << 8;
21879
- return val2 & 32768 ? val2 | 4294901760 : val2;
21880
- }, "readInt16LE");
21881
- Buffer2.prototype.readInt16BE = /* @__PURE__ */ __name(function readInt16BE(offset, noAssert) {
21882
- offset = offset >>> 0;
21883
- if (!noAssert)
21884
- checkOffset(offset, 2, this.length);
21885
- const val2 = this[offset + 1] | this[offset] << 8;
21886
- return val2 & 32768 ? val2 | 4294901760 : val2;
21887
- }, "readInt16BE");
21888
- Buffer2.prototype.readInt32LE = /* @__PURE__ */ __name(function readInt32LE(offset, noAssert) {
21889
- offset = offset >>> 0;
21890
- if (!noAssert)
21891
- checkOffset(offset, 4, this.length);
21892
- return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
21893
- }, "readInt32LE");
21894
- Buffer2.prototype.readInt32BE = /* @__PURE__ */ __name(function readInt32BE(offset, noAssert) {
21895
- offset = offset >>> 0;
21896
- if (!noAssert)
21897
- checkOffset(offset, 4, this.length);
21898
- return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
21899
- }, "readInt32BE");
21900
- Buffer2.prototype.readBigInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigInt64LE(offset) {
21901
- offset = offset >>> 0;
21902
- validateNumber(offset, "offset");
21903
- const first = this[offset];
21904
- const last2 = this[offset + 7];
21905
- if (first === void 0 || last2 === void 0) {
21906
- boundsError(offset, this.length - 8);
21907
- }
21908
- const val2 = this[offset + 4] + this[offset + 5] * __pow(2, 8) + this[offset + 6] * __pow(2, 16) + (last2 << 24);
21909
- return (BigInt(val2) << BigInt(32)) + BigInt(first + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 24));
21910
- }, "readBigInt64LE"));
21911
- Buffer2.prototype.readBigInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigInt64BE(offset) {
21912
- offset = offset >>> 0;
21913
- validateNumber(offset, "offset");
21914
- const first = this[offset];
21915
- const last2 = this[offset + 7];
21916
- if (first === void 0 || last2 === void 0) {
21917
- boundsError(offset, this.length - 8);
21918
- }
21919
- const val2 = (first << 24) + // Overflow
21920
- this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + this[++offset];
21921
- return (BigInt(val2) << BigInt(32)) + BigInt(this[++offset] * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + last2);
21922
- }, "readBigInt64BE"));
21923
- Buffer2.prototype.readFloatLE = /* @__PURE__ */ __name(function readFloatLE(offset, noAssert) {
21924
- offset = offset >>> 0;
21925
- if (!noAssert)
21926
- checkOffset(offset, 4, this.length);
21927
- return ieee754$1.read(this, offset, true, 23, 4);
21928
- }, "readFloatLE");
21929
- Buffer2.prototype.readFloatBE = /* @__PURE__ */ __name(function readFloatBE(offset, noAssert) {
21930
- offset = offset >>> 0;
21931
- if (!noAssert)
21932
- checkOffset(offset, 4, this.length);
21933
- return ieee754$1.read(this, offset, false, 23, 4);
21934
- }, "readFloatBE");
21935
- Buffer2.prototype.readDoubleLE = /* @__PURE__ */ __name(function readDoubleLE(offset, noAssert) {
21936
- offset = offset >>> 0;
21937
- if (!noAssert)
21938
- checkOffset(offset, 8, this.length);
21939
- return ieee754$1.read(this, offset, true, 52, 8);
21940
- }, "readDoubleLE");
21941
- Buffer2.prototype.readDoubleBE = /* @__PURE__ */ __name(function readDoubleBE(offset, noAssert) {
21942
- offset = offset >>> 0;
21943
- if (!noAssert)
21944
- checkOffset(offset, 8, this.length);
21945
- return ieee754$1.read(this, offset, false, 52, 8);
21946
- }, "readDoubleBE");
21947
- function checkInt(buf, value, offset, ext, max2, min) {
21948
- if (!Buffer2.isBuffer(buf))
21949
- throw new TypeError('"buffer" argument must be a Buffer instance');
21950
- if (value > max2 || value < min)
21951
- throw new RangeError('"value" argument is out of bounds');
21952
- if (offset + ext > buf.length)
21953
- throw new RangeError("Index out of range");
21954
- }
21955
- __name(checkInt, "checkInt");
21956
- Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = /* @__PURE__ */ __name(function writeUIntLE(value, offset, byteLength3, noAssert) {
21957
- value = +value;
21958
- offset = offset >>> 0;
21959
- byteLength3 = byteLength3 >>> 0;
21960
- if (!noAssert) {
21961
- const maxBytes = Math.pow(2, 8 * byteLength3) - 1;
21962
- checkInt(this, value, offset, byteLength3, maxBytes, 0);
21963
- }
21964
- let mul = 1;
21965
- let i = 0;
21966
- this[offset] = value & 255;
21967
- while (++i < byteLength3 && (mul *= 256)) {
21968
- this[offset + i] = value / mul & 255;
21969
- }
21970
- return offset + byteLength3;
21971
- }, "writeUIntLE");
21972
- Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = /* @__PURE__ */ __name(function writeUIntBE(value, offset, byteLength3, noAssert) {
21973
- value = +value;
21974
- offset = offset >>> 0;
21975
- byteLength3 = byteLength3 >>> 0;
21976
- if (!noAssert) {
21977
- const maxBytes = Math.pow(2, 8 * byteLength3) - 1;
21978
- checkInt(this, value, offset, byteLength3, maxBytes, 0);
21979
- }
21980
- let i = byteLength3 - 1;
21981
- let mul = 1;
21982
- this[offset + i] = value & 255;
21983
- while (--i >= 0 && (mul *= 256)) {
21984
- this[offset + i] = value / mul & 255;
21985
- }
21986
- return offset + byteLength3;
21987
- }, "writeUIntBE");
21988
- Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = /* @__PURE__ */ __name(function writeUInt8(value, offset, noAssert) {
21989
- value = +value;
21990
- offset = offset >>> 0;
21991
- if (!noAssert)
21992
- checkInt(this, value, offset, 1, 255, 0);
21993
- this[offset] = value & 255;
21994
- return offset + 1;
21995
- }, "writeUInt8");
21996
- Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = /* @__PURE__ */ __name(function writeUInt16LE(value, offset, noAssert) {
21997
- value = +value;
21998
- offset = offset >>> 0;
21999
- if (!noAssert)
22000
- checkInt(this, value, offset, 2, 65535, 0);
22001
- this[offset] = value & 255;
22002
- this[offset + 1] = value >>> 8;
22003
- return offset + 2;
22004
- }, "writeUInt16LE");
22005
- Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = /* @__PURE__ */ __name(function writeUInt16BE(value, offset, noAssert) {
22006
- value = +value;
22007
- offset = offset >>> 0;
22008
- if (!noAssert)
22009
- checkInt(this, value, offset, 2, 65535, 0);
22010
- this[offset] = value >>> 8;
22011
- this[offset + 1] = value & 255;
22012
- return offset + 2;
22013
- }, "writeUInt16BE");
22014
- Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = /* @__PURE__ */ __name(function writeUInt32LE(value, offset, noAssert) {
22015
- value = +value;
22016
- offset = offset >>> 0;
22017
- if (!noAssert)
22018
- checkInt(this, value, offset, 4, 4294967295, 0);
22019
- this[offset + 3] = value >>> 24;
22020
- this[offset + 2] = value >>> 16;
22021
- this[offset + 1] = value >>> 8;
22022
- this[offset] = value & 255;
22023
- return offset + 4;
22024
- }, "writeUInt32LE");
22025
- Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = /* @__PURE__ */ __name(function writeUInt32BE(value, offset, noAssert) {
22026
- value = +value;
22027
- offset = offset >>> 0;
22028
- if (!noAssert)
22029
- checkInt(this, value, offset, 4, 4294967295, 0);
22030
- this[offset] = value >>> 24;
22031
- this[offset + 1] = value >>> 16;
22032
- this[offset + 2] = value >>> 8;
22033
- this[offset + 3] = value & 255;
22034
- return offset + 4;
22035
- }, "writeUInt32BE");
22036
- function wrtBigUInt64LE(buf, value, offset, min, max2) {
22037
- checkIntBI(value, min, max2, buf, offset, 7);
22038
- let lo = Number(value & BigInt(4294967295));
22039
- buf[offset++] = lo;
22040
- lo = lo >> 8;
22041
- buf[offset++] = lo;
22042
- lo = lo >> 8;
22043
- buf[offset++] = lo;
22044
- lo = lo >> 8;
22045
- buf[offset++] = lo;
22046
- let hi = Number(value >> BigInt(32) & BigInt(4294967295));
22047
- buf[offset++] = hi;
22048
- hi = hi >> 8;
22049
- buf[offset++] = hi;
22050
- hi = hi >> 8;
22051
- buf[offset++] = hi;
22052
- hi = hi >> 8;
22053
- buf[offset++] = hi;
22054
- return offset;
22055
- }
22056
- __name(wrtBigUInt64LE, "wrtBigUInt64LE");
22057
- function wrtBigUInt64BE(buf, value, offset, min, max2) {
22058
- checkIntBI(value, min, max2, buf, offset, 7);
22059
- let lo = Number(value & BigInt(4294967295));
22060
- buf[offset + 7] = lo;
22061
- lo = lo >> 8;
22062
- buf[offset + 6] = lo;
22063
- lo = lo >> 8;
22064
- buf[offset + 5] = lo;
22065
- lo = lo >> 8;
22066
- buf[offset + 4] = lo;
22067
- let hi = Number(value >> BigInt(32) & BigInt(4294967295));
22068
- buf[offset + 3] = hi;
22069
- hi = hi >> 8;
22070
- buf[offset + 2] = hi;
22071
- hi = hi >> 8;
22072
- buf[offset + 1] = hi;
22073
- hi = hi >> 8;
22074
- buf[offset] = hi;
22075
- return offset + 8;
22076
- }
22077
- __name(wrtBigUInt64BE, "wrtBigUInt64BE");
22078
- Buffer2.prototype.writeBigUInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigUInt64LE(value, offset = 0) {
22079
- return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
22080
- }, "writeBigUInt64LE"));
22081
- Buffer2.prototype.writeBigUInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigUInt64BE(value, offset = 0) {
22082
- return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
22083
- }, "writeBigUInt64BE"));
22084
- Buffer2.prototype.writeIntLE = /* @__PURE__ */ __name(function writeIntLE(value, offset, byteLength3, noAssert) {
22085
- value = +value;
22086
- offset = offset >>> 0;
22087
- if (!noAssert) {
22088
- const limit = Math.pow(2, 8 * byteLength3 - 1);
22089
- checkInt(this, value, offset, byteLength3, limit - 1, -limit);
22090
- }
22091
- let i = 0;
22092
- let mul = 1;
22093
- let sub = 0;
22094
- this[offset] = value & 255;
22095
- while (++i < byteLength3 && (mul *= 256)) {
22096
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
22097
- sub = 1;
22098
- }
22099
- this[offset + i] = (value / mul >> 0) - sub & 255;
22100
- }
22101
- return offset + byteLength3;
22102
- }, "writeIntLE");
22103
- Buffer2.prototype.writeIntBE = /* @__PURE__ */ __name(function writeIntBE(value, offset, byteLength3, noAssert) {
22104
- value = +value;
22105
- offset = offset >>> 0;
22106
- if (!noAssert) {
22107
- const limit = Math.pow(2, 8 * byteLength3 - 1);
22108
- checkInt(this, value, offset, byteLength3, limit - 1, -limit);
22109
- }
22110
- let i = byteLength3 - 1;
22111
- let mul = 1;
22112
- let sub = 0;
22113
- this[offset + i] = value & 255;
22114
- while (--i >= 0 && (mul *= 256)) {
22115
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
22116
- sub = 1;
22117
- }
22118
- this[offset + i] = (value / mul >> 0) - sub & 255;
22119
- }
22120
- return offset + byteLength3;
22121
- }, "writeIntBE");
22122
- Buffer2.prototype.writeInt8 = /* @__PURE__ */ __name(function writeInt8(value, offset, noAssert) {
22123
- value = +value;
22124
- offset = offset >>> 0;
22125
- if (!noAssert)
22126
- checkInt(this, value, offset, 1, 127, -128);
22127
- if (value < 0)
22128
- value = 255 + value + 1;
22129
- this[offset] = value & 255;
22130
- return offset + 1;
22131
- }, "writeInt8");
22132
- Buffer2.prototype.writeInt16LE = /* @__PURE__ */ __name(function writeInt16LE(value, offset, noAssert) {
22133
- value = +value;
22134
- offset = offset >>> 0;
22135
- if (!noAssert)
22136
- checkInt(this, value, offset, 2, 32767, -32768);
22137
- this[offset] = value & 255;
22138
- this[offset + 1] = value >>> 8;
22139
- return offset + 2;
22140
- }, "writeInt16LE");
22141
- Buffer2.prototype.writeInt16BE = /* @__PURE__ */ __name(function writeInt16BE(value, offset, noAssert) {
22142
- value = +value;
22143
- offset = offset >>> 0;
22144
- if (!noAssert)
22145
- checkInt(this, value, offset, 2, 32767, -32768);
22146
- this[offset] = value >>> 8;
22147
- this[offset + 1] = value & 255;
22148
- return offset + 2;
22149
- }, "writeInt16BE");
22150
- Buffer2.prototype.writeInt32LE = /* @__PURE__ */ __name(function writeInt32LE(value, offset, noAssert) {
22151
- value = +value;
22152
- offset = offset >>> 0;
22153
- if (!noAssert)
22154
- checkInt(this, value, offset, 4, 2147483647, -2147483648);
22155
- this[offset] = value & 255;
22156
- this[offset + 1] = value >>> 8;
22157
- this[offset + 2] = value >>> 16;
22158
- this[offset + 3] = value >>> 24;
22159
- return offset + 4;
22160
- }, "writeInt32LE");
22161
- Buffer2.prototype.writeInt32BE = /* @__PURE__ */ __name(function writeInt32BE(value, offset, noAssert) {
22162
- value = +value;
22163
- offset = offset >>> 0;
22164
- if (!noAssert)
22165
- checkInt(this, value, offset, 4, 2147483647, -2147483648);
22166
- if (value < 0)
22167
- value = 4294967295 + value + 1;
22168
- this[offset] = value >>> 24;
22169
- this[offset + 1] = value >>> 16;
22170
- this[offset + 2] = value >>> 8;
22171
- this[offset + 3] = value & 255;
22172
- return offset + 4;
22173
- }, "writeInt32BE");
22174
- Buffer2.prototype.writeBigInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigInt64LE(value, offset = 0) {
22175
- return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
22176
- }, "writeBigInt64LE"));
22177
- Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigInt64BE(value, offset = 0) {
22178
- return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
22179
- }, "writeBigInt64BE"));
22180
- function checkIEEE754(buf, value, offset, ext, max2, min) {
22181
- if (offset + ext > buf.length)
22182
- throw new RangeError("Index out of range");
22183
- if (offset < 0)
22184
- throw new RangeError("Index out of range");
22185
- }
22186
- __name(checkIEEE754, "checkIEEE754");
22187
- function writeFloat(buf, value, offset, littleEndian, noAssert) {
22188
- value = +value;
22189
- offset = offset >>> 0;
22190
- if (!noAssert) {
22191
- checkIEEE754(buf, value, offset, 4);
22192
- }
22193
- ieee754$1.write(buf, value, offset, littleEndian, 23, 4);
22194
- return offset + 4;
22195
- }
22196
- __name(writeFloat, "writeFloat");
22197
- Buffer2.prototype.writeFloatLE = /* @__PURE__ */ __name(function writeFloatLE(value, offset, noAssert) {
22198
- return writeFloat(this, value, offset, true, noAssert);
22199
- }, "writeFloatLE");
22200
- Buffer2.prototype.writeFloatBE = /* @__PURE__ */ __name(function writeFloatBE(value, offset, noAssert) {
22201
- return writeFloat(this, value, offset, false, noAssert);
22202
- }, "writeFloatBE");
22203
- function writeDouble(buf, value, offset, littleEndian, noAssert) {
22204
- value = +value;
22205
- offset = offset >>> 0;
22206
- if (!noAssert) {
22207
- checkIEEE754(buf, value, offset, 8);
22208
- }
22209
- ieee754$1.write(buf, value, offset, littleEndian, 52, 8);
22210
- return offset + 8;
22211
- }
22212
- __name(writeDouble, "writeDouble");
22213
- Buffer2.prototype.writeDoubleLE = /* @__PURE__ */ __name(function writeDoubleLE(value, offset, noAssert) {
22214
- return writeDouble(this, value, offset, true, noAssert);
22215
- }, "writeDoubleLE");
22216
- Buffer2.prototype.writeDoubleBE = /* @__PURE__ */ __name(function writeDoubleBE(value, offset, noAssert) {
22217
- return writeDouble(this, value, offset, false, noAssert);
22218
- }, "writeDoubleBE");
22219
- Buffer2.prototype.copy = /* @__PURE__ */ __name(function copy(target, targetStart, start, end) {
22220
- if (!Buffer2.isBuffer(target))
22221
- throw new TypeError("argument should be a Buffer");
22222
- if (!start)
22223
- start = 0;
22224
- if (!end && end !== 0)
22225
- end = this.length;
22226
- if (targetStart >= target.length)
22227
- targetStart = target.length;
22228
- if (!targetStart)
22229
- targetStart = 0;
22230
- if (end > 0 && end < start)
22231
- end = start;
22232
- if (end === start)
22233
- return 0;
22234
- if (target.length === 0 || this.length === 0)
22235
- return 0;
22236
- if (targetStart < 0) {
22237
- throw new RangeError("targetStart out of bounds");
22238
- }
22239
- if (start < 0 || start >= this.length)
22240
- throw new RangeError("Index out of range");
22241
- if (end < 0)
22242
- throw new RangeError("sourceEnd out of bounds");
22243
- if (end > this.length)
22244
- end = this.length;
22245
- if (target.length - targetStart < end - start) {
22246
- end = target.length - targetStart + start;
22247
- }
22248
- const len = end - start;
22249
- if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
22250
- this.copyWithin(targetStart, start, end);
22251
- } else {
22252
- Uint8Array.prototype.set.call(
22253
- target,
22254
- this.subarray(start, end),
22255
- targetStart
22256
- );
22257
- }
22258
- return len;
22259
- }, "copy");
22260
- Buffer2.prototype.fill = /* @__PURE__ */ __name(function fill(val2, start, end, encoding) {
22261
- if (typeof val2 === "string") {
22262
- if (typeof start === "string") {
22263
- encoding = start;
22264
- start = 0;
22265
- end = this.length;
22266
- } else if (typeof end === "string") {
22267
- encoding = end;
22268
- end = this.length;
22269
- }
22270
- if (encoding !== void 0 && typeof encoding !== "string") {
22271
- throw new TypeError("encoding must be a string");
22272
- }
22273
- if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) {
22274
- throw new TypeError("Unknown encoding: " + encoding);
22275
- }
22276
- if (val2.length === 1) {
22277
- const code2 = val2.charCodeAt(0);
22278
- if (encoding === "utf8" && code2 < 128 || encoding === "latin1") {
22279
- val2 = code2;
22280
- }
22281
- }
22282
- } else if (typeof val2 === "number") {
22283
- val2 = val2 & 255;
22284
- } else if (typeof val2 === "boolean") {
22285
- val2 = Number(val2);
22286
- }
22287
- if (start < 0 || this.length < start || this.length < end) {
22288
- throw new RangeError("Out of range index");
22289
- }
22290
- if (end <= start) {
22291
- return this;
22292
- }
22293
- start = start >>> 0;
22294
- end = end === void 0 ? this.length : end >>> 0;
22295
- if (!val2)
22296
- val2 = 0;
22297
- let i;
22298
- if (typeof val2 === "number") {
22299
- for (i = start; i < end; ++i) {
22300
- this[i] = val2;
22301
- }
22302
- } else {
22303
- const bytes = Buffer2.isBuffer(val2) ? val2 : Buffer2.from(val2, encoding);
22304
- const len = bytes.length;
22305
- if (len === 0) {
22306
- throw new TypeError('The value "' + val2 + '" is invalid for argument "value"');
22307
- }
22308
- for (i = 0; i < end - start; ++i) {
22309
- this[i + start] = bytes[i % len];
22310
- }
22311
- }
22312
- return this;
22313
- }, "fill");
22314
- const errors = {};
22315
- function E(sym, getMessage, Base) {
22316
- var _a3;
22317
- errors[sym] = (_a3 = class extends Base {
22318
- constructor() {
22319
- super();
22320
- Object.defineProperty(this, "message", {
22321
- value: getMessage.apply(this, arguments),
22322
- writable: true,
22323
- configurable: true
22324
- });
22325
- this.name = `${this.name} [${sym}]`;
22326
- this.stack;
22327
- delete this.name;
22328
- }
22329
- get code() {
22330
- return sym;
22331
- }
22332
- set code(value) {
22333
- Object.defineProperty(this, "code", {
22334
- configurable: true,
22335
- enumerable: true,
22336
- value,
22337
- writable: true
22338
- });
22339
- }
22340
- toString() {
22341
- return `${this.name} [${sym}]: ${this.message}`;
22342
- }
22343
- }, __name(_a3, "NodeError"), _a3);
22344
- }
22345
- __name(E, "E");
22346
- E(
22347
- "ERR_BUFFER_OUT_OF_BOUNDS",
22348
- function(name) {
22349
- if (name) {
22350
- return `${name} is outside of buffer bounds`;
22351
- }
22352
- return "Attempt to access memory outside buffer bounds";
22353
- },
22354
- RangeError
22355
- );
22356
- E(
22357
- "ERR_INVALID_ARG_TYPE",
22358
- function(name, actual) {
22359
- return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
22360
- },
22361
- TypeError
22362
- );
22363
- E(
22364
- "ERR_OUT_OF_RANGE",
22365
- function(str, range, input) {
22366
- let msg = `The value of "${str}" is out of range.`;
22367
- let received = input;
22368
- if (Number.isInteger(input) && Math.abs(input) > __pow(2, 32)) {
22369
- received = addNumericalSeparator(String(input));
22370
- } else if (typeof input === "bigint") {
22371
- received = String(input);
22372
- if (input > __pow(BigInt(2), BigInt(32)) || input < -__pow(BigInt(2), BigInt(32))) {
22373
- received = addNumericalSeparator(received);
22374
- }
22375
- received += "n";
22376
- }
22377
- msg += ` It must be ${range}. Received ${received}`;
22378
- return msg;
22379
- },
22380
- RangeError
22381
- );
22382
- function addNumericalSeparator(val2) {
22383
- let res = "";
22384
- let i = val2.length;
22385
- const start = val2[0] === "-" ? 1 : 0;
22386
- for (; i >= start + 4; i -= 3) {
22387
- res = `_${val2.slice(i - 3, i)}${res}`;
22388
- }
22389
- return `${val2.slice(0, i)}${res}`;
22390
- }
22391
- __name(addNumericalSeparator, "addNumericalSeparator");
22392
- function checkBounds(buf, offset, byteLength3) {
22393
- validateNumber(offset, "offset");
22394
- if (buf[offset] === void 0 || buf[offset + byteLength3] === void 0) {
22395
- boundsError(offset, buf.length - (byteLength3 + 1));
22396
- }
22397
- }
22398
- __name(checkBounds, "checkBounds");
22399
- function checkIntBI(value, min, max2, buf, offset, byteLength3) {
22400
- if (value > max2 || value < min) {
22401
- const n = typeof min === "bigint" ? "n" : "";
22402
- let range;
22403
- {
22404
- if (min === 0 || min === BigInt(0)) {
22405
- range = `>= 0${n} and < 2${n} ** ${(byteLength3 + 1) * 8}${n}`;
22406
- } else {
22407
- range = `>= -(2${n} ** ${(byteLength3 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength3 + 1) * 8 - 1}${n}`;
22408
- }
22409
- }
22410
- throw new errors.ERR_OUT_OF_RANGE("value", range, value);
22411
- }
22412
- checkBounds(buf, offset, byteLength3);
22413
- }
22414
- __name(checkIntBI, "checkIntBI");
22415
- function validateNumber(value, name) {
22416
- if (typeof value !== "number") {
22417
- throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
22418
- }
22419
- }
22420
- __name(validateNumber, "validateNumber");
22421
- function boundsError(value, length, type) {
22422
- if (Math.floor(value) !== value) {
22423
- validateNumber(value, type);
22424
- throw new errors.ERR_OUT_OF_RANGE("offset", "an integer", value);
22425
- }
22426
- if (length < 0) {
22427
- throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
22428
- }
22429
- throw new errors.ERR_OUT_OF_RANGE(
22430
- "offset",
22431
- `>= ${0} and <= ${length}`,
22432
- value
22433
- );
22434
- }
22435
- __name(boundsError, "boundsError");
22436
- const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
22437
- function base64clean(str) {
22438
- str = str.split("=")[0];
22439
- str = str.trim().replace(INVALID_BASE64_RE, "");
22440
- if (str.length < 2)
22441
- return "";
22442
- while (str.length % 4 !== 0) {
22443
- str = str + "=";
22444
- }
22445
- return str;
22446
- }
22447
- __name(base64clean, "base64clean");
22448
- function utf8ToBytes(string, units) {
22449
- units = units || Infinity;
22450
- let codePoint;
22451
- const length = string.length;
22452
- let leadSurrogate = null;
22453
- const bytes = [];
22454
- for (let i = 0; i < length; ++i) {
22455
- codePoint = string.charCodeAt(i);
22456
- if (codePoint > 55295 && codePoint < 57344) {
22457
- if (!leadSurrogate) {
22458
- if (codePoint > 56319) {
22459
- if ((units -= 3) > -1)
22460
- bytes.push(239, 191, 189);
22461
- continue;
22462
- } else if (i + 1 === length) {
22463
- if ((units -= 3) > -1)
22464
- bytes.push(239, 191, 189);
22465
- continue;
22466
- }
22467
- leadSurrogate = codePoint;
22468
- continue;
22469
- }
22470
- if (codePoint < 56320) {
22471
- if ((units -= 3) > -1)
22472
- bytes.push(239, 191, 189);
22473
- leadSurrogate = codePoint;
22474
- continue;
22475
- }
22476
- codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
22477
- } else if (leadSurrogate) {
22478
- if ((units -= 3) > -1)
22479
- bytes.push(239, 191, 189);
22480
- }
22481
- leadSurrogate = null;
22482
- if (codePoint < 128) {
22483
- if ((units -= 1) < 0)
22484
- break;
22485
- bytes.push(codePoint);
22486
- } else if (codePoint < 2048) {
22487
- if ((units -= 2) < 0)
22488
- break;
22489
- bytes.push(
22490
- codePoint >> 6 | 192,
22491
- codePoint & 63 | 128
22492
- );
22493
- } else if (codePoint < 65536) {
22494
- if ((units -= 3) < 0)
22495
- break;
22496
- bytes.push(
22497
- codePoint >> 12 | 224,
22498
- codePoint >> 6 & 63 | 128,
22499
- codePoint & 63 | 128
22500
- );
22501
- } else if (codePoint < 1114112) {
22502
- if ((units -= 4) < 0)
22503
- break;
22504
- bytes.push(
22505
- codePoint >> 18 | 240,
22506
- codePoint >> 12 & 63 | 128,
22507
- codePoint >> 6 & 63 | 128,
22508
- codePoint & 63 | 128
22509
- );
22510
- } else {
22511
- throw new Error("Invalid code point");
22512
- }
22513
- }
22514
- return bytes;
22515
- }
22516
- __name(utf8ToBytes, "utf8ToBytes");
22517
- function asciiToBytes(str) {
22518
- const byteArray = [];
22519
- for (let i = 0; i < str.length; ++i) {
22520
- byteArray.push(str.charCodeAt(i) & 255);
22521
- }
22522
- return byteArray;
22523
- }
22524
- __name(asciiToBytes, "asciiToBytes");
22525
- function utf16leToBytes(str, units) {
22526
- let c, hi, lo;
22527
- const byteArray = [];
22528
- for (let i = 0; i < str.length; ++i) {
22529
- if ((units -= 2) < 0)
22530
- break;
22531
- c = str.charCodeAt(i);
22532
- hi = c >> 8;
22533
- lo = c % 256;
22534
- byteArray.push(lo);
22535
- byteArray.push(hi);
22536
- }
22537
- return byteArray;
22538
- }
22539
- __name(utf16leToBytes, "utf16leToBytes");
22540
- function base64ToBytes(str) {
22541
- return base64.toByteArray(base64clean(str));
22542
- }
22543
- __name(base64ToBytes, "base64ToBytes");
22544
- function blitBuffer(src, dst, offset, length) {
22545
- let i;
22546
- for (i = 0; i < length; ++i) {
22547
- if (i + offset >= dst.length || i >= src.length)
22548
- break;
22549
- dst[i + offset] = src[i];
22550
- }
22551
- return i;
22552
- }
22553
- __name(blitBuffer, "blitBuffer");
22554
- function isInstance(obj, type) {
22555
- return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
22556
- }
22557
- __name(isInstance, "isInstance");
22558
- function numberIsNaN(obj) {
22559
- return obj !== obj;
22560
- }
22561
- __name(numberIsNaN, "numberIsNaN");
22562
- const hexSliceLookupTable = function() {
22563
- const alphabet2 = "0123456789abcdef";
22564
- const table = new Array(256);
22565
- for (let i = 0; i < 16; ++i) {
22566
- const i16 = i * 16;
22567
- for (let j = 0; j < 16; ++j) {
22568
- table[i16 + j] = alphabet2[i] + alphabet2[j];
22569
- }
22570
- }
22571
- return table;
22572
- }();
22573
- function defineBigIntMethod(fn) {
22574
- return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
22575
- }
22576
- __name(defineBigIntMethod, "defineBigIntMethod");
22577
- function BufferBigIntNotDefined() {
22578
- throw new Error("BigInt not supported");
22579
- }
22580
- __name(BufferBigIntNotDefined, "BufferBigIntNotDefined");
22581
- })(buffer$1);
22582
- const buffer = /* @__PURE__ */ getDefaultExportFromCjs(buffer$1);
22583
- const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
22584
- function getArrayBufferFromFile(file) {
22585
- if (!isBrowser) {
22586
- return toArrayBuffer(buffer$1.Buffer.isBuffer(file) ? file : file.buffer || file);
22587
- }
22588
- const reader = new window.FileReader();
22589
- return new Promise((resolve, reject) => {
22590
- reader.onload = (e) => {
22591
- resolve(e.target.result);
22592
- };
22593
- reader.onerror = (err2) => {
22594
- console.error("err:", err2);
22595
- reject(err2);
22596
- };
22597
- reader.readAsArrayBuffer(
22598
- buffer$1.Buffer.isBuffer(file) ? file : file.buffer || file
22599
- );
22600
- });
22601
- }
22602
- __name(getArrayBufferFromFile, "getArrayBufferFromFile");
22603
- function toArrayBuffer(buffer2) {
22604
- const ab = new ArrayBuffer(buffer2.length);
22605
- const view = new Uint8Array(ab);
22606
- for (let i = 0; i < buffer2.length; ++i) {
22607
- view[i] = buffer2[i];
22608
- }
22609
- return ab;
22610
- }
22611
- __name(toArrayBuffer, "toArrayBuffer");
22612
- const Buffer$1 = buffer.Buffer;
22613
- function snapgeneToJson(_0) {
22614
- return __async(this, arguments, function* (fileObj, options = {}) {
22615
- try {
22616
- let read = function(size, fmt) {
22617
- const buffer2 = Buffer$1.from(arrayBuffer.slice(offset, size + offset));
22618
- offset += size;
22619
- if (fmt) {
22620
- const decoder = new StringDecoder_1(fmt);
22621
- const toRet = decoder.write(buffer2);
22622
- return toRet;
22623
- } else {
22624
- return buffer2;
22625
- }
22626
- };
22627
- __name(read, "read");
22628
- const returnVal = createInitialSequence(options);
22629
- const arrayBuffer = yield getArrayBufferFromFile(fileObj);
22630
- const ext = extractFileExtension(options.fileName);
22631
- let isProtein = options.isProtein;
22632
- if (ext && /^(prot)$/.test(ext)) {
22633
- isProtein = true;
22634
- options.isProtein = true;
22635
- }
22636
- let offset = 0;
22637
- function unpack(size, mode) {
22638
- return __async(this, null, function* () {
22639
- const buffer2 = yield read(size);
22640
- const unpacked = yield bufferpack$1.unpack(">" + mode, buffer2);
22641
- if (unpacked === void 0)
22642
- return void 0;
22643
- return yield unpacked[0];
22644
- });
22645
- }
22646
- __name(unpack, "unpack");
22647
- yield read(1);
22648
- const length = yield unpack(4, "I");
22649
- const title = yield read(8, "ascii");
22650
- if (length !== 14 || title !== "SnapGene") {
22651
- throw new Error("Wrong format for a SnapGene file !");
22652
- }
22653
- const data = yield __spreadProps(__spreadValues({}, returnVal.parsedSequence), {
22654
- isProtein,
22655
- isDNA: !!(yield unpack(2, "H")) && !isProtein,
22656
- exportVersion: yield unpack(2, "H"),
22657
- importVersion: yield unpack(2, "H"),
22658
- features: []
22659
- });
22660
- while (offset <= arrayBuffer.byteLength) {
22661
- const next_byte = yield read(1);
22662
- const block_size = yield unpack(4, "I");
22663
- if (ord(next_byte) === 21 || ord(next_byte) === 0) {
22664
- const props = yield unpack(1, "b");
22665
- const binaryRep = dec2bin(props);
22666
- data.circular = isFirstBitA1(binaryRep);
22667
- const size = block_size - 1;
22668
- if (size < 0)
22669
- return;
22670
- data.size = isProtein ? size * 3 : size;
22671
- data.sequence = yield read(size, "utf8");
22672
- } else if (ord(next_byte) === 10) {
22673
- const strand_dict = {
22674
- // [strand, arrowheadType]
22675
- 0: [1, "NONE"],
22676
- // non-directional feature (in that case, the attribute is generally absent altogether)
22677
- 1: [1, "TOP"],
22678
- // forward strand
22679
- 2: [-1, "BOTTOM"],
22680
- // reverse strand
22681
- 3: [1, "BOTH"]
22682
- // bi-directional feature
22683
- };
22684
- const xml = yield read(block_size, "utf8");
22685
- const b = new fxp.XMLParser({
22686
- ignoreAttributes: false,
22687
- attributeNamePrefix: "",
22688
- isArray: (name) => name === "Feature" || name === "Segment"
22689
- }).parse(xml);
22690
- const { Features: { Feature = [] } = {} } = b;
22691
- data.features = [];
22692
- Feature.forEach((feat) => {
22693
- const { directionality, Segment = [], name, type } = feat;
22694
- let maxStart = 0;
22695
- let maxEnd = 0;
22696
- const locations = Segment && Segment.map((seg) => {
22697
- if (!seg)
22698
- throw new Error("invalid feature definition");
22699
- const { range } = seg;
22700
- let { start, end } = getStartAndEndFromRangeString(range);
22701
- start = isProtein ? start * 3 : start;
22702
- end = isProtein ? end * 3 + 2 : end;
22703
- maxStart = Math.max(maxStart, start);
22704
- maxEnd = Math.max(maxEnd, end);
22705
- return {
22706
- start,
22707
- end
22708
- };
22709
- });
22710
- data.features.push(__spreadProps(__spreadValues({
22711
- name,
22712
- type
22713
- }, (locations == null ? void 0 : locations.length) > 1 && { locations }), {
22714
- strand: directionality ? strand_dict[directionality][0] : 1,
22715
- arrowheadType: directionality ? strand_dict[directionality][1] : "NONE",
22716
- start: maxStart,
22717
- end: maxEnd
22718
- // color,
22719
- }));
22720
- });
22721
- } else if (ord(next_byte) === 6) {
22722
- const xml = yield read(block_size, "utf8");
22723
- const b = new fxp.XMLParser({}).parse(xml);
22724
- const name = get$1(b, "Notes.CustomMapLabel");
22725
- if (name) {
22726
- data.name = name;
22727
- }
22728
- const description = get$1(b, "Notes.Description");
22729
- if (description && typeof description === "string") {
22730
- data.description = description.replace("<html><body>", "").replace("</body></html>", "");
22731
- }
22732
- } else {
22733
- yield read(block_size);
22734
- }
22735
- }
22736
- returnVal.parsedSequence = data;
22737
- return validateSequenceArray(
22738
- flattenSequenceArray([returnVal], options),
22739
- options
22740
- );
22741
- } catch (e) {
22742
- console.error("Error trying to parse file as snapgene:", e);
22743
- return [
22744
- {
22745
- success: false,
22746
- messages: ["Import Error: Invalid File"]
22747
- }
22748
- ];
22749
- }
22750
- });
22751
- }
22752
- __name(snapgeneToJson, "snapgeneToJson");
22753
- function getStartAndEndFromRangeString(rangestring) {
22754
- const [start, end] = rangestring.split("-");
22755
- return {
22756
- start: start - 1,
22757
- end: end - 1
22758
- };
22759
- }
22760
- __name(getStartAndEndFromRangeString, "getStartAndEndFromRangeString");
22761
- function ord(string) {
22762
- const str = string + "";
22763
- const code2 = str.charCodeAt(0);
22764
- if (code2 >= 55296 && code2 <= 56319) {
22765
- const hi = code2;
22766
- if (str.length === 1) {
22767
- return code2;
22768
- }
22769
- const low = str.charCodeAt(1);
22770
- return (hi - 55296) * 1024 + (low - 56320) + 65536;
22771
- }
22772
- if (code2 >= 56320 && code2 <= 57343) {
22773
- return code2;
21020
+ if (code2 >= 56320 && code2 <= 57343) {
21021
+ return code2;
22774
21022
  }
22775
21023
  return code2;
22776
21024
  }
@@ -22854,6 +21102,9 @@ function abConverter(inputArrayBuffer) {
22854
21102
  traceData.gTrace = this.getDataTag(tagDict.colorDataG);
22855
21103
  traceData.cTrace = this.getDataTag(tagDict.colorDataC);
22856
21104
  traceData.basePos = this.getDataTag(tagDict.peakLocations);
21105
+ if (traceData.basePos === void 0) {
21106
+ traceData.basePos = this.getDataTag(tagDict.peakLocationsUser);
21107
+ }
22857
21108
  traceData.baseCalls = this.getDataTag(tagDict.baseCalls2);
22858
21109
  traceData.qualNums = this.getDataTag(tagDict.qualNums);
22859
21110
  if (traceData.qualNums) {
@@ -22881,6 +21132,7 @@ const tagDict = {
22881
21132
  baseCalls2: { tagName: "PBAS", tagNum: 2, typeToReturn: "getChar" },
22882
21133
  qualNums: { tagName: "PCON", tagNum: 2, typeToReturn: "getNumber" },
22883
21134
  peakLocations: { tagName: "PLOC", tagNum: 2, typeToReturn: "getShort" },
21135
+ peakLocationsUser: { tagName: "PLOC", tagNum: 1, typeToReturn: "getShort" },
22884
21136
  peakDev: { tagName: "P1RL", tagNum: 1, typeToReturn: "getShort" },
22885
21137
  peakOneAmp: { tagName: "P1AM", tagNum: 1, typeToReturn: "getShort" },
22886
21138
  colorDataA: { tagName: "DATA", tagNum: 10, typeToReturn: "getShort" },
@@ -22888,61 +21140,438 @@ const tagDict = {
22888
21140
  colorDataG: { tagName: "DATA", tagNum: 9, typeToReturn: "getShort" },
22889
21141
  colorDataC: { tagName: "DATA", tagNum: 12, typeToReturn: "getShort" }
22890
21142
  };
22891
- const correctionAmount = 3;
22892
- function convertBasePosTraceToPerBpTrace(chromData) {
22893
- const { basePos, aTrace } = chromData;
22894
- const traceLength = aTrace.length;
22895
- let startPos = 0;
22896
- let nextBasePos = basePos[1];
22897
- let endPos;
22898
- function setEndPos() {
22899
- if (nextBasePos) {
22900
- endPos = startPos + Math.ceil((nextBasePos - startPos) / 2);
22901
- } else {
22902
- endPos = traceLength;
21143
+ const correctionAmount = 3;
21144
+ function convertBasePosTraceToPerBpTrace(chromData) {
21145
+ const { basePos, aTrace } = chromData;
21146
+ const traceLength = aTrace.length;
21147
+ let startPos = 0;
21148
+ let nextBasePos = basePos[1];
21149
+ let endPos;
21150
+ function setEndPos() {
21151
+ if (nextBasePos) {
21152
+ endPos = startPos + Math.ceil((nextBasePos - startPos) / 2);
21153
+ } else {
21154
+ endPos = traceLength;
21155
+ }
21156
+ }
21157
+ __name(setEndPos, "setEndPos");
21158
+ setEndPos();
21159
+ const baseTraces = [];
21160
+ for (let i = 0; i < basePos.length; i++) {
21161
+ const tracesForType = {
21162
+ aTrace: [],
21163
+ tTrace: [],
21164
+ gTrace: [],
21165
+ cTrace: []
21166
+ };
21167
+ baseTraces[i] = tracesForType;
21168
+ [
21169
+ "aTrace",
21170
+ "tTrace",
21171
+ "gTrace",
21172
+ "cTrace"
21173
+ // eslint-disable-next-line no-loop-func
21174
+ ].forEach((type) => {
21175
+ const traceForType = tracesForType[type];
21176
+ const traceData = chromData[type];
21177
+ for (let j = startPos; j < endPos + correctionAmount; j++) {
21178
+ traceForType.push(traceData[j] || 0);
21179
+ }
21180
+ });
21181
+ if (i !== basePos.length - 1) {
21182
+ startPos = endPos + correctionAmount;
21183
+ nextBasePos = basePos[i + 2];
21184
+ setEndPos();
21185
+ }
21186
+ }
21187
+ return __spreadValues({
21188
+ baseTraces
21189
+ }, chromData);
21190
+ }
21191
+ __name(convertBasePosTraceToPerBpTrace, "convertBasePosTraceToPerBpTrace");
21192
+ var events = { exports: {} };
21193
+ var R = typeof Reflect === "object" ? Reflect : null;
21194
+ var ReflectApply = R && typeof R.apply === "function" ? R.apply : /* @__PURE__ */ __name(function ReflectApply2(target, receiver, args) {
21195
+ return Function.prototype.apply.call(target, receiver, args);
21196
+ }, "ReflectApply");
21197
+ var ReflectOwnKeys;
21198
+ if (R && typeof R.ownKeys === "function") {
21199
+ ReflectOwnKeys = R.ownKeys;
21200
+ } else if (Object.getOwnPropertySymbols) {
21201
+ ReflectOwnKeys = /* @__PURE__ */ __name(function ReflectOwnKeys2(target) {
21202
+ return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
21203
+ }, "ReflectOwnKeys");
21204
+ } else {
21205
+ ReflectOwnKeys = /* @__PURE__ */ __name(function ReflectOwnKeys2(target) {
21206
+ return Object.getOwnPropertyNames(target);
21207
+ }, "ReflectOwnKeys");
21208
+ }
21209
+ function ProcessEmitWarning(warning) {
21210
+ if (console && console.warn)
21211
+ console.warn(warning);
21212
+ }
21213
+ __name(ProcessEmitWarning, "ProcessEmitWarning");
21214
+ var NumberIsNaN = Number.isNaN || /* @__PURE__ */ __name(function NumberIsNaN2(value) {
21215
+ return value !== value;
21216
+ }, "NumberIsNaN");
21217
+ function EventEmitter() {
21218
+ EventEmitter.init.call(this);
21219
+ }
21220
+ __name(EventEmitter, "EventEmitter");
21221
+ events.exports = EventEmitter;
21222
+ events.exports.once = once2;
21223
+ EventEmitter.EventEmitter = EventEmitter;
21224
+ EventEmitter.prototype._events = void 0;
21225
+ EventEmitter.prototype._eventsCount = 0;
21226
+ EventEmitter.prototype._maxListeners = void 0;
21227
+ var defaultMaxListeners = 10;
21228
+ function checkListener(listener) {
21229
+ if (typeof listener !== "function") {
21230
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
21231
+ }
21232
+ }
21233
+ __name(checkListener, "checkListener");
21234
+ Object.defineProperty(EventEmitter, "defaultMaxListeners", {
21235
+ enumerable: true,
21236
+ get: function() {
21237
+ return defaultMaxListeners;
21238
+ },
21239
+ set: function(arg) {
21240
+ if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
21241
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
21242
+ }
21243
+ defaultMaxListeners = arg;
21244
+ }
21245
+ });
21246
+ EventEmitter.init = function() {
21247
+ if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
21248
+ this._events = /* @__PURE__ */ Object.create(null);
21249
+ this._eventsCount = 0;
21250
+ }
21251
+ this._maxListeners = this._maxListeners || void 0;
21252
+ };
21253
+ EventEmitter.prototype.setMaxListeners = /* @__PURE__ */ __name(function setMaxListeners(n) {
21254
+ if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
21255
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
21256
+ }
21257
+ this._maxListeners = n;
21258
+ return this;
21259
+ }, "setMaxListeners");
21260
+ function _getMaxListeners(that) {
21261
+ if (that._maxListeners === void 0)
21262
+ return EventEmitter.defaultMaxListeners;
21263
+ return that._maxListeners;
21264
+ }
21265
+ __name(_getMaxListeners, "_getMaxListeners");
21266
+ EventEmitter.prototype.getMaxListeners = /* @__PURE__ */ __name(function getMaxListeners() {
21267
+ return _getMaxListeners(this);
21268
+ }, "getMaxListeners");
21269
+ EventEmitter.prototype.emit = /* @__PURE__ */ __name(function emit(type) {
21270
+ var args = [];
21271
+ for (var i = 1; i < arguments.length; i++)
21272
+ args.push(arguments[i]);
21273
+ var doError = type === "error";
21274
+ var events2 = this._events;
21275
+ if (events2 !== void 0)
21276
+ doError = doError && events2.error === void 0;
21277
+ else if (!doError)
21278
+ return false;
21279
+ if (doError) {
21280
+ var er;
21281
+ if (args.length > 0)
21282
+ er = args[0];
21283
+ if (er instanceof Error) {
21284
+ throw er;
21285
+ }
21286
+ var err2 = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
21287
+ err2.context = er;
21288
+ throw err2;
21289
+ }
21290
+ var handler = events2[type];
21291
+ if (handler === void 0)
21292
+ return false;
21293
+ if (typeof handler === "function") {
21294
+ ReflectApply(handler, this, args);
21295
+ } else {
21296
+ var len = handler.length;
21297
+ var listeners2 = arrayClone(handler, len);
21298
+ for (var i = 0; i < len; ++i)
21299
+ ReflectApply(listeners2[i], this, args);
21300
+ }
21301
+ return true;
21302
+ }, "emit");
21303
+ function _addListener(target, type, listener, prepend) {
21304
+ var m;
21305
+ var events2;
21306
+ var existing;
21307
+ checkListener(listener);
21308
+ events2 = target._events;
21309
+ if (events2 === void 0) {
21310
+ events2 = target._events = /* @__PURE__ */ Object.create(null);
21311
+ target._eventsCount = 0;
21312
+ } else {
21313
+ if (events2.newListener !== void 0) {
21314
+ target.emit(
21315
+ "newListener",
21316
+ type,
21317
+ listener.listener ? listener.listener : listener
21318
+ );
21319
+ events2 = target._events;
21320
+ }
21321
+ existing = events2[type];
21322
+ }
21323
+ if (existing === void 0) {
21324
+ existing = events2[type] = listener;
21325
+ ++target._eventsCount;
21326
+ } else {
21327
+ if (typeof existing === "function") {
21328
+ existing = events2[type] = prepend ? [listener, existing] : [existing, listener];
21329
+ } else if (prepend) {
21330
+ existing.unshift(listener);
21331
+ } else {
21332
+ existing.push(listener);
21333
+ }
21334
+ m = _getMaxListeners(target);
21335
+ if (m > 0 && existing.length > m && !existing.warned) {
21336
+ existing.warned = true;
21337
+ var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");
21338
+ w.name = "MaxListenersExceededWarning";
21339
+ w.emitter = target;
21340
+ w.type = type;
21341
+ w.count = existing.length;
21342
+ ProcessEmitWarning(w);
21343
+ }
21344
+ }
21345
+ return target;
21346
+ }
21347
+ __name(_addListener, "_addListener");
21348
+ EventEmitter.prototype.addListener = /* @__PURE__ */ __name(function addListener(type, listener) {
21349
+ return _addListener(this, type, listener, false);
21350
+ }, "addListener");
21351
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
21352
+ EventEmitter.prototype.prependListener = /* @__PURE__ */ __name(function prependListener(type, listener) {
21353
+ return _addListener(this, type, listener, true);
21354
+ }, "prependListener");
21355
+ function onceWrapper() {
21356
+ if (!this.fired) {
21357
+ this.target.removeListener(this.type, this.wrapFn);
21358
+ this.fired = true;
21359
+ if (arguments.length === 0)
21360
+ return this.listener.call(this.target);
21361
+ return this.listener.apply(this.target, arguments);
21362
+ }
21363
+ }
21364
+ __name(onceWrapper, "onceWrapper");
21365
+ function _onceWrap(target, type, listener) {
21366
+ var state2 = { fired: false, wrapFn: void 0, target, type, listener };
21367
+ var wrapped = onceWrapper.bind(state2);
21368
+ wrapped.listener = listener;
21369
+ state2.wrapFn = wrapped;
21370
+ return wrapped;
21371
+ }
21372
+ __name(_onceWrap, "_onceWrap");
21373
+ EventEmitter.prototype.once = /* @__PURE__ */ __name(function once(type, listener) {
21374
+ checkListener(listener);
21375
+ this.on(type, _onceWrap(this, type, listener));
21376
+ return this;
21377
+ }, "once");
21378
+ EventEmitter.prototype.prependOnceListener = /* @__PURE__ */ __name(function prependOnceListener(type, listener) {
21379
+ checkListener(listener);
21380
+ this.prependListener(type, _onceWrap(this, type, listener));
21381
+ return this;
21382
+ }, "prependOnceListener");
21383
+ EventEmitter.prototype.removeListener = /* @__PURE__ */ __name(function removeListener(type, listener) {
21384
+ var list, events2, position, i, originalListener;
21385
+ checkListener(listener);
21386
+ events2 = this._events;
21387
+ if (events2 === void 0)
21388
+ return this;
21389
+ list = events2[type];
21390
+ if (list === void 0)
21391
+ return this;
21392
+ if (list === listener || list.listener === listener) {
21393
+ if (--this._eventsCount === 0)
21394
+ this._events = /* @__PURE__ */ Object.create(null);
21395
+ else {
21396
+ delete events2[type];
21397
+ if (events2.removeListener)
21398
+ this.emit("removeListener", type, list.listener || listener);
21399
+ }
21400
+ } else if (typeof list !== "function") {
21401
+ position = -1;
21402
+ for (i = list.length - 1; i >= 0; i--) {
21403
+ if (list[i] === listener || list[i].listener === listener) {
21404
+ originalListener = list[i].listener;
21405
+ position = i;
21406
+ break;
21407
+ }
21408
+ }
21409
+ if (position < 0)
21410
+ return this;
21411
+ if (position === 0)
21412
+ list.shift();
21413
+ else {
21414
+ spliceOne(list, position);
21415
+ }
21416
+ if (list.length === 1)
21417
+ events2[type] = list[0];
21418
+ if (events2.removeListener !== void 0)
21419
+ this.emit("removeListener", type, originalListener || listener);
21420
+ }
21421
+ return this;
21422
+ }, "removeListener");
21423
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
21424
+ EventEmitter.prototype.removeAllListeners = /* @__PURE__ */ __name(function removeAllListeners(type) {
21425
+ var listeners2, events2, i;
21426
+ events2 = this._events;
21427
+ if (events2 === void 0)
21428
+ return this;
21429
+ if (events2.removeListener === void 0) {
21430
+ if (arguments.length === 0) {
21431
+ this._events = /* @__PURE__ */ Object.create(null);
21432
+ this._eventsCount = 0;
21433
+ } else if (events2[type] !== void 0) {
21434
+ if (--this._eventsCount === 0)
21435
+ this._events = /* @__PURE__ */ Object.create(null);
21436
+ else
21437
+ delete events2[type];
21438
+ }
21439
+ return this;
21440
+ }
21441
+ if (arguments.length === 0) {
21442
+ var keys2 = Object.keys(events2);
21443
+ var key;
21444
+ for (i = 0; i < keys2.length; ++i) {
21445
+ key = keys2[i];
21446
+ if (key === "removeListener")
21447
+ continue;
21448
+ this.removeAllListeners(key);
21449
+ }
21450
+ this.removeAllListeners("removeListener");
21451
+ this._events = /* @__PURE__ */ Object.create(null);
21452
+ this._eventsCount = 0;
21453
+ return this;
21454
+ }
21455
+ listeners2 = events2[type];
21456
+ if (typeof listeners2 === "function") {
21457
+ this.removeListener(type, listeners2);
21458
+ } else if (listeners2 !== void 0) {
21459
+ for (i = listeners2.length - 1; i >= 0; i--) {
21460
+ this.removeListener(type, listeners2[i]);
21461
+ }
21462
+ }
21463
+ return this;
21464
+ }, "removeAllListeners");
21465
+ function _listeners(target, type, unwrap) {
21466
+ var events2 = target._events;
21467
+ if (events2 === void 0)
21468
+ return [];
21469
+ var evlistener = events2[type];
21470
+ if (evlistener === void 0)
21471
+ return [];
21472
+ if (typeof evlistener === "function")
21473
+ return unwrap ? [evlistener.listener || evlistener] : [evlistener];
21474
+ return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
21475
+ }
21476
+ __name(_listeners, "_listeners");
21477
+ EventEmitter.prototype.listeners = /* @__PURE__ */ __name(function listeners(type) {
21478
+ return _listeners(this, type, true);
21479
+ }, "listeners");
21480
+ EventEmitter.prototype.rawListeners = /* @__PURE__ */ __name(function rawListeners(type) {
21481
+ return _listeners(this, type, false);
21482
+ }, "rawListeners");
21483
+ EventEmitter.listenerCount = function(emitter, type) {
21484
+ if (typeof emitter.listenerCount === "function") {
21485
+ return emitter.listenerCount(type);
21486
+ } else {
21487
+ return listenerCount.call(emitter, type);
21488
+ }
21489
+ };
21490
+ EventEmitter.prototype.listenerCount = listenerCount;
21491
+ function listenerCount(type) {
21492
+ var events2 = this._events;
21493
+ if (events2 !== void 0) {
21494
+ var evlistener = events2[type];
21495
+ if (typeof evlistener === "function") {
21496
+ return 1;
21497
+ } else if (evlistener !== void 0) {
21498
+ return evlistener.length;
22903
21499
  }
22904
21500
  }
22905
- __name(setEndPos, "setEndPos");
22906
- setEndPos();
22907
- const baseTraces = [];
22908
- for (let i = 0; i < basePos.length; i++) {
22909
- const tracesForType = {
22910
- aTrace: [],
22911
- tTrace: [],
22912
- gTrace: [],
22913
- cTrace: []
22914
- };
22915
- baseTraces[i] = tracesForType;
22916
- [
22917
- "aTrace",
22918
- "tTrace",
22919
- "gTrace",
22920
- "cTrace"
22921
- // eslint-disable-next-line no-loop-func
22922
- ].forEach((type) => {
22923
- const traceForType = tracesForType[type];
22924
- const traceData = chromData[type];
22925
- for (let j = startPos; j < endPos + correctionAmount; j++) {
22926
- traceForType.push(traceData[j] || 0);
21501
+ return 0;
21502
+ }
21503
+ __name(listenerCount, "listenerCount");
21504
+ EventEmitter.prototype.eventNames = /* @__PURE__ */ __name(function eventNames() {
21505
+ return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
21506
+ }, "eventNames");
21507
+ function arrayClone(arr, n) {
21508
+ var copy = new Array(n);
21509
+ for (var i = 0; i < n; ++i)
21510
+ copy[i] = arr[i];
21511
+ return copy;
21512
+ }
21513
+ __name(arrayClone, "arrayClone");
21514
+ function spliceOne(list, index) {
21515
+ for (; index + 1 < list.length; index++)
21516
+ list[index] = list[index + 1];
21517
+ list.pop();
21518
+ }
21519
+ __name(spliceOne, "spliceOne");
21520
+ function unwrapListeners(arr) {
21521
+ var ret = new Array(arr.length);
21522
+ for (var i = 0; i < ret.length; ++i) {
21523
+ ret[i] = arr[i].listener || arr[i];
21524
+ }
21525
+ return ret;
21526
+ }
21527
+ __name(unwrapListeners, "unwrapListeners");
21528
+ function once2(emitter, name) {
21529
+ return new Promise(function(resolve, reject) {
21530
+ function errorListener(err2) {
21531
+ emitter.removeListener(name, resolver);
21532
+ reject(err2);
21533
+ }
21534
+ __name(errorListener, "errorListener");
21535
+ function resolver() {
21536
+ if (typeof emitter.removeListener === "function") {
21537
+ emitter.removeListener("error", errorListener);
22927
21538
  }
22928
- });
22929
- if (i !== basePos.length - 1) {
22930
- startPos = endPos + correctionAmount;
22931
- nextBasePos = basePos[i + 2];
22932
- setEndPos();
21539
+ resolve([].slice.call(arguments));
22933
21540
  }
21541
+ __name(resolver, "resolver");
21542
+ eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
21543
+ if (name !== "error") {
21544
+ addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
21545
+ }
21546
+ });
21547
+ }
21548
+ __name(once2, "once");
21549
+ function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
21550
+ if (typeof emitter.on === "function") {
21551
+ eventTargetAgnosticAddListener(emitter, "error", handler, flags);
22934
21552
  }
22935
- return __spreadValues({
22936
- baseTraces
22937
- }, chromData);
22938
21553
  }
22939
- __name(convertBasePosTraceToPerBpTrace, "convertBasePosTraceToPerBpTrace");
22940
- const __viteBrowserExternal = {};
22941
- const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22942
- __proto__: null,
22943
- default: __viteBrowserExternal
22944
- }, Symbol.toStringTag, { value: "Module" }));
22945
- const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
21554
+ __name(addErrorHandlerIfEventEmitter, "addErrorHandlerIfEventEmitter");
21555
+ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
21556
+ if (typeof emitter.on === "function") {
21557
+ if (flags.once) {
21558
+ emitter.once(name, listener);
21559
+ } else {
21560
+ emitter.on(name, listener);
21561
+ }
21562
+ } else if (typeof emitter.addEventListener === "function") {
21563
+ emitter.addEventListener(name, /* @__PURE__ */ __name(function wrapListener(arg) {
21564
+ if (flags.once) {
21565
+ emitter.removeEventListener(name, wrapListener);
21566
+ }
21567
+ listener(arg);
21568
+ }, "wrapListener"));
21569
+ } else {
21570
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
21571
+ }
21572
+ }
21573
+ __name(eventTargetAgnosticAddListener, "eventTargetAgnosticAddListener");
21574
+ var eventsExports = events.exports;
22946
21575
  var inherits_browser = { exports: {} };
22947
21576
  if (typeof Object.create === "function") {
22948
21577
  inherits_browser.exports = /* @__PURE__ */ __name(function inherits2(ctor, superCtor) {
@@ -22977,10 +21606,16 @@ function requireStreamBrowser() {
22977
21606
  if (hasRequiredStreamBrowser)
22978
21607
  return streamBrowser;
22979
21608
  hasRequiredStreamBrowser = 1;
22980
- streamBrowser = require$$0.EventEmitter;
21609
+ streamBrowser = eventsExports.EventEmitter;
22981
21610
  return streamBrowser;
22982
21611
  }
22983
21612
  __name(requireStreamBrowser, "requireStreamBrowser");
21613
+ const __viteBrowserExternal = {};
21614
+ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21615
+ __proto__: null,
21616
+ default: __viteBrowserExternal
21617
+ }, Symbol.toStringTag, { value: "Module" }));
21618
+ const require$$3 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
22984
21619
  var buffer_list;
22985
21620
  var hasRequiredBuffer_list;
22986
21621
  function requireBuffer_list() {
@@ -23062,8 +21697,8 @@ function requireBuffer_list() {
23062
21697
  return (hint === "string" ? String : Number)(input);
23063
21698
  }
23064
21699
  __name(_toPrimitive, "_toPrimitive");
23065
- var _require = buffer$2, Buffer2 = _require.Buffer;
23066
- var _require2 = require$$0, inspect = _require2.inspect;
21700
+ var _require = buffer$1, Buffer2 = _require.Buffer;
21701
+ var _require2 = require$$3, inspect = _require2.inspect;
23067
21702
  var custom = inspect && inspect.custom || "inspect";
23068
21703
  function copyBuffer(src, target, offset) {
23069
21704
  Buffer2.prototype.copy.call(src, target, offset);
@@ -23567,7 +22202,7 @@ function require_stream_writable() {
23567
22202
  deprecate: requireBrowser()
23568
22203
  };
23569
22204
  var Stream2 = requireStreamBrowser();
23570
- var Buffer2 = buffer$2.Buffer;
22205
+ var Buffer2 = buffer$1.Buffer;
23571
22206
  var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
23572
22207
  };
23573
22208
  function _uint8ArrayToBuffer(chunk) {
@@ -24169,7 +22804,7 @@ function requireEndOfStream() {
24169
22804
  return endOfStream;
24170
22805
  hasRequiredEndOfStream = 1;
24171
22806
  var ERR_STREAM_PREMATURE_CLOSE = requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;
24172
- function once(callback) {
22807
+ function once3(callback) {
24173
22808
  var called = false;
24174
22809
  return function() {
24175
22810
  if (called)
@@ -24181,7 +22816,7 @@ function requireEndOfStream() {
24181
22816
  callback.apply(this, args);
24182
22817
  };
24183
22818
  }
24184
- __name(once, "once");
22819
+ __name(once3, "once");
24185
22820
  function noop2() {
24186
22821
  }
24187
22822
  __name(noop2, "noop");
@@ -24194,7 +22829,7 @@ function requireEndOfStream() {
24194
22829
  return eos(stream, null, opts);
24195
22830
  if (!opts)
24196
22831
  opts = {};
24197
- callback = once(callback || noop2);
22832
+ callback = once3(callback || noop2);
24198
22833
  var readable = opts.readable || opts.readable !== false && stream.readable;
24199
22834
  var writable = opts.writable || opts.writable !== false && stream.writable;
24200
22835
  var onlegacyfinish = /* @__PURE__ */ __name(function onlegacyfinish2() {
@@ -24484,12 +23119,12 @@ function require_stream_readable() {
24484
23119
  _stream_readable = Readable;
24485
23120
  var Duplex;
24486
23121
  Readable.ReadableState = ReadableState;
24487
- require$$0.EventEmitter;
23122
+ eventsExports.EventEmitter;
24488
23123
  var EElistenerCount = /* @__PURE__ */ __name(function EElistenerCount2(emitter, type) {
24489
23124
  return emitter.listeners(type).length;
24490
23125
  }, "EElistenerCount");
24491
23126
  var Stream2 = requireStreamBrowser();
24492
- var Buffer2 = buffer$2.Buffer;
23127
+ var Buffer2 = buffer$1.Buffer;
24493
23128
  var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
24494
23129
  };
24495
23130
  function _uint8ArrayToBuffer(chunk) {
@@ -24500,7 +23135,7 @@ function require_stream_readable() {
24500
23135
  return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
24501
23136
  }
24502
23137
  __name(_isUint8Array, "_isUint8Array");
24503
- var debugUtil = require$$0;
23138
+ var debugUtil = require$$3;
24504
23139
  var debug;
24505
23140
  if (debugUtil && debugUtil.debuglog) {
24506
23141
  debug = debugUtil.debuglog("stream");
@@ -24518,7 +23153,7 @@ function require_stream_readable() {
24518
23153
  inherits_browserExports(Readable, Stream2);
24519
23154
  var errorOrDestroy = destroyImpl.errorOrDestroy;
24520
23155
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
24521
- function prependListener(emitter, event, fn) {
23156
+ function prependListener2(emitter, event, fn) {
24522
23157
  if (typeof emitter.prependListener === "function")
24523
23158
  return emitter.prependListener(event, fn);
24524
23159
  if (!emitter._events || !emitter._events[event])
@@ -24528,7 +23163,7 @@ function require_stream_readable() {
24528
23163
  else
24529
23164
  emitter._events[event] = [fn, emitter._events[event]];
24530
23165
  }
24531
- __name(prependListener, "prependListener");
23166
+ __name(prependListener2, "prependListener");
24532
23167
  function ReadableState(options, stream, isDuplex) {
24533
23168
  Duplex = Duplex || require_stream_duplex();
24534
23169
  options = options || {};
@@ -24962,7 +23597,7 @@ function require_stream_readable() {
24962
23597
  errorOrDestroy(dest, er);
24963
23598
  }
24964
23599
  __name(onerror, "onerror");
24965
- prependListener(dest, "error", onerror);
23600
+ prependListener2(dest, "error", onerror);
24966
23601
  function onclose() {
24967
23602
  dest.removeListener("finish", onfinish);
24968
23603
  unpipe();
@@ -25439,7 +24074,7 @@ function requirePipeline() {
25439
24074
  return pipeline_1;
25440
24075
  hasRequiredPipeline = 1;
25441
24076
  var eos;
25442
- function once(callback) {
24077
+ function once3(callback) {
25443
24078
  var called = false;
25444
24079
  return function() {
25445
24080
  if (called)
@@ -25448,7 +24083,7 @@ function requirePipeline() {
25448
24083
  callback.apply(void 0, arguments);
25449
24084
  };
25450
24085
  }
25451
- __name(once, "once");
24086
+ __name(once3, "once");
25452
24087
  var _require$codes = requireErrorsBrowser().codes, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
25453
24088
  function noop2(err2) {
25454
24089
  if (err2)
@@ -25460,7 +24095,7 @@ function requirePipeline() {
25460
24095
  }
25461
24096
  __name(isRequest, "isRequest");
25462
24097
  function destroyer(stream, reading, writing, callback) {
25463
- callback = once(callback);
24098
+ callback = once3(callback);
25464
24099
  var closed = false;
25465
24100
  stream.on("close", function() {
25466
24101
  closed = true;
@@ -25540,7 +24175,7 @@ function requirePipeline() {
25540
24175
  }
25541
24176
  __name(requirePipeline, "requirePipeline");
25542
24177
  var streamBrowserify = Stream;
25543
- var EE = require$$0.EventEmitter;
24178
+ var EE = eventsExports.EventEmitter;
25544
24179
  var inherits = inherits_browserExports;
25545
24180
  inherits(Stream, EE);
25546
24181
  Stream.Readable = require_stream_readable();
@@ -27100,7 +25735,7 @@ function getUint8ArrayFromFile(file, { emulateBrowser } = {}) {
27100
25735
  }
27101
25736
  __name(getUint8ArrayFromFile, "getUint8ArrayFromFile");
27102
25737
  var colorString$1 = { exports: {} };
27103
- var colorName = {
25738
+ var colorName$1 = {
27104
25739
  "aliceblue": [240, 248, 255],
27105
25740
  "antiquewhite": [250, 235, 215],
27106
25741
  "aqua": [0, 255, 255],
@@ -27278,7 +25913,7 @@ swizzle$1.wrap = function(fn) {
27278
25913
  };
27279
25914
  };
27280
25915
  var simpleSwizzleExports = simpleSwizzle.exports;
27281
- var colorNames = colorName;
25916
+ var colorNames = colorName$1;
27282
25917
  var swizzle2 = simpleSwizzleExports;
27283
25918
  var hasOwnProperty = Object.hasOwnProperty;
27284
25919
  var reverseNames = /* @__PURE__ */ Object.create(null);
@@ -27459,12 +26094,165 @@ function hexDouble(num) {
27459
26094
  }
27460
26095
  __name(hexDouble, "hexDouble");
27461
26096
  var colorStringExports = colorString$1.exports;
27462
- const cssKeywords = colorName;
27463
- const reverseKeywords = {};
27464
- for (const key of Object.keys(cssKeywords)) {
27465
- reverseKeywords[cssKeywords[key]] = key;
26097
+ var conversions$2 = { exports: {} };
26098
+ var colorName = {
26099
+ "aliceblue": [240, 248, 255],
26100
+ "antiquewhite": [250, 235, 215],
26101
+ "aqua": [0, 255, 255],
26102
+ "aquamarine": [127, 255, 212],
26103
+ "azure": [240, 255, 255],
26104
+ "beige": [245, 245, 220],
26105
+ "bisque": [255, 228, 196],
26106
+ "black": [0, 0, 0],
26107
+ "blanchedalmond": [255, 235, 205],
26108
+ "blue": [0, 0, 255],
26109
+ "blueviolet": [138, 43, 226],
26110
+ "brown": [165, 42, 42],
26111
+ "burlywood": [222, 184, 135],
26112
+ "cadetblue": [95, 158, 160],
26113
+ "chartreuse": [127, 255, 0],
26114
+ "chocolate": [210, 105, 30],
26115
+ "coral": [255, 127, 80],
26116
+ "cornflowerblue": [100, 149, 237],
26117
+ "cornsilk": [255, 248, 220],
26118
+ "crimson": [220, 20, 60],
26119
+ "cyan": [0, 255, 255],
26120
+ "darkblue": [0, 0, 139],
26121
+ "darkcyan": [0, 139, 139],
26122
+ "darkgoldenrod": [184, 134, 11],
26123
+ "darkgray": [169, 169, 169],
26124
+ "darkgreen": [0, 100, 0],
26125
+ "darkgrey": [169, 169, 169],
26126
+ "darkkhaki": [189, 183, 107],
26127
+ "darkmagenta": [139, 0, 139],
26128
+ "darkolivegreen": [85, 107, 47],
26129
+ "darkorange": [255, 140, 0],
26130
+ "darkorchid": [153, 50, 204],
26131
+ "darkred": [139, 0, 0],
26132
+ "darksalmon": [233, 150, 122],
26133
+ "darkseagreen": [143, 188, 143],
26134
+ "darkslateblue": [72, 61, 139],
26135
+ "darkslategray": [47, 79, 79],
26136
+ "darkslategrey": [47, 79, 79],
26137
+ "darkturquoise": [0, 206, 209],
26138
+ "darkviolet": [148, 0, 211],
26139
+ "deeppink": [255, 20, 147],
26140
+ "deepskyblue": [0, 191, 255],
26141
+ "dimgray": [105, 105, 105],
26142
+ "dimgrey": [105, 105, 105],
26143
+ "dodgerblue": [30, 144, 255],
26144
+ "firebrick": [178, 34, 34],
26145
+ "floralwhite": [255, 250, 240],
26146
+ "forestgreen": [34, 139, 34],
26147
+ "fuchsia": [255, 0, 255],
26148
+ "gainsboro": [220, 220, 220],
26149
+ "ghostwhite": [248, 248, 255],
26150
+ "gold": [255, 215, 0],
26151
+ "goldenrod": [218, 165, 32],
26152
+ "gray": [128, 128, 128],
26153
+ "green": [0, 128, 0],
26154
+ "greenyellow": [173, 255, 47],
26155
+ "grey": [128, 128, 128],
26156
+ "honeydew": [240, 255, 240],
26157
+ "hotpink": [255, 105, 180],
26158
+ "indianred": [205, 92, 92],
26159
+ "indigo": [75, 0, 130],
26160
+ "ivory": [255, 255, 240],
26161
+ "khaki": [240, 230, 140],
26162
+ "lavender": [230, 230, 250],
26163
+ "lavenderblush": [255, 240, 245],
26164
+ "lawngreen": [124, 252, 0],
26165
+ "lemonchiffon": [255, 250, 205],
26166
+ "lightblue": [173, 216, 230],
26167
+ "lightcoral": [240, 128, 128],
26168
+ "lightcyan": [224, 255, 255],
26169
+ "lightgoldenrodyellow": [250, 250, 210],
26170
+ "lightgray": [211, 211, 211],
26171
+ "lightgreen": [144, 238, 144],
26172
+ "lightgrey": [211, 211, 211],
26173
+ "lightpink": [255, 182, 193],
26174
+ "lightsalmon": [255, 160, 122],
26175
+ "lightseagreen": [32, 178, 170],
26176
+ "lightskyblue": [135, 206, 250],
26177
+ "lightslategray": [119, 136, 153],
26178
+ "lightslategrey": [119, 136, 153],
26179
+ "lightsteelblue": [176, 196, 222],
26180
+ "lightyellow": [255, 255, 224],
26181
+ "lime": [0, 255, 0],
26182
+ "limegreen": [50, 205, 50],
26183
+ "linen": [250, 240, 230],
26184
+ "magenta": [255, 0, 255],
26185
+ "maroon": [128, 0, 0],
26186
+ "mediumaquamarine": [102, 205, 170],
26187
+ "mediumblue": [0, 0, 205],
26188
+ "mediumorchid": [186, 85, 211],
26189
+ "mediumpurple": [147, 112, 219],
26190
+ "mediumseagreen": [60, 179, 113],
26191
+ "mediumslateblue": [123, 104, 238],
26192
+ "mediumspringgreen": [0, 250, 154],
26193
+ "mediumturquoise": [72, 209, 204],
26194
+ "mediumvioletred": [199, 21, 133],
26195
+ "midnightblue": [25, 25, 112],
26196
+ "mintcream": [245, 255, 250],
26197
+ "mistyrose": [255, 228, 225],
26198
+ "moccasin": [255, 228, 181],
26199
+ "navajowhite": [255, 222, 173],
26200
+ "navy": [0, 0, 128],
26201
+ "oldlace": [253, 245, 230],
26202
+ "olive": [128, 128, 0],
26203
+ "olivedrab": [107, 142, 35],
26204
+ "orange": [255, 165, 0],
26205
+ "orangered": [255, 69, 0],
26206
+ "orchid": [218, 112, 214],
26207
+ "palegoldenrod": [238, 232, 170],
26208
+ "palegreen": [152, 251, 152],
26209
+ "paleturquoise": [175, 238, 238],
26210
+ "palevioletred": [219, 112, 147],
26211
+ "papayawhip": [255, 239, 213],
26212
+ "peachpuff": [255, 218, 185],
26213
+ "peru": [205, 133, 63],
26214
+ "pink": [255, 192, 203],
26215
+ "plum": [221, 160, 221],
26216
+ "powderblue": [176, 224, 230],
26217
+ "purple": [128, 0, 128],
26218
+ "rebeccapurple": [102, 51, 153],
26219
+ "red": [255, 0, 0],
26220
+ "rosybrown": [188, 143, 143],
26221
+ "royalblue": [65, 105, 225],
26222
+ "saddlebrown": [139, 69, 19],
26223
+ "salmon": [250, 128, 114],
26224
+ "sandybrown": [244, 164, 96],
26225
+ "seagreen": [46, 139, 87],
26226
+ "seashell": [255, 245, 238],
26227
+ "sienna": [160, 82, 45],
26228
+ "silver": [192, 192, 192],
26229
+ "skyblue": [135, 206, 235],
26230
+ "slateblue": [106, 90, 205],
26231
+ "slategray": [112, 128, 144],
26232
+ "slategrey": [112, 128, 144],
26233
+ "snow": [255, 250, 250],
26234
+ "springgreen": [0, 255, 127],
26235
+ "steelblue": [70, 130, 180],
26236
+ "tan": [210, 180, 140],
26237
+ "teal": [0, 128, 128],
26238
+ "thistle": [216, 191, 216],
26239
+ "tomato": [255, 99, 71],
26240
+ "turquoise": [64, 224, 208],
26241
+ "violet": [238, 130, 238],
26242
+ "wheat": [245, 222, 179],
26243
+ "white": [255, 255, 255],
26244
+ "whitesmoke": [245, 245, 245],
26245
+ "yellow": [255, 255, 0],
26246
+ "yellowgreen": [154, 205, 50]
26247
+ };
26248
+ var cssKeywords = colorName;
26249
+ var reverseKeywords = {};
26250
+ for (var key in cssKeywords) {
26251
+ if (cssKeywords.hasOwnProperty(key)) {
26252
+ reverseKeywords[cssKeywords[key]] = key;
26253
+ }
27466
26254
  }
27467
- const convert$2 = {
26255
+ var convert$2 = conversions$2.exports = {
27468
26256
  rgb: { channels: 3, labels: "rgb" },
27469
26257
  hsl: { channels: 3, labels: "hsl" },
27470
26258
  hsv: { channels: 3, labels: "hsv" },
@@ -27481,32 +26269,35 @@ const convert$2 = {
27481
26269
  apple: { channels: 3, labels: ["r16", "g16", "b16"] },
27482
26270
  gray: { channels: 1, labels: ["gray"] }
27483
26271
  };
27484
- var conversions$2 = convert$2;
27485
- for (const model of Object.keys(convert$2)) {
27486
- if (!("channels" in convert$2[model])) {
27487
- throw new Error("missing channels property: " + model);
27488
- }
27489
- if (!("labels" in convert$2[model])) {
27490
- throw new Error("missing channel labels property: " + model);
27491
- }
27492
- if (convert$2[model].labels.length !== convert$2[model].channels) {
27493
- throw new Error("channel and label counts mismatch: " + model);
26272
+ for (var model in convert$2) {
26273
+ if (convert$2.hasOwnProperty(model)) {
26274
+ if (!("channels" in convert$2[model])) {
26275
+ throw new Error("missing channels property: " + model);
26276
+ }
26277
+ if (!("labels" in convert$2[model])) {
26278
+ throw new Error("missing channel labels property: " + model);
26279
+ }
26280
+ if (convert$2[model].labels.length !== convert$2[model].channels) {
26281
+ throw new Error("channel and label counts mismatch: " + model);
26282
+ }
26283
+ var channels = convert$2[model].channels;
26284
+ var labels = convert$2[model].labels;
26285
+ delete convert$2[model].channels;
26286
+ delete convert$2[model].labels;
26287
+ Object.defineProperty(convert$2[model], "channels", { value: channels });
26288
+ Object.defineProperty(convert$2[model], "labels", { value: labels });
27494
26289
  }
27495
- const { channels, labels } = convert$2[model];
27496
- delete convert$2[model].channels;
27497
- delete convert$2[model].labels;
27498
- Object.defineProperty(convert$2[model], "channels", { value: channels });
27499
- Object.defineProperty(convert$2[model], "labels", { value: labels });
27500
26290
  }
27501
26291
  convert$2.rgb.hsl = function(rgb) {
27502
- const r = rgb[0] / 255;
27503
- const g = rgb[1] / 255;
27504
- const b = rgb[2] / 255;
27505
- const min = Math.min(r, g, b);
27506
- const max2 = Math.max(r, g, b);
27507
- const delta = max2 - min;
27508
- let h;
27509
- let s;
26292
+ var r = rgb[0] / 255;
26293
+ var g = rgb[1] / 255;
26294
+ var b = rgb[2] / 255;
26295
+ var min = Math.min(r, g, b);
26296
+ var max2 = Math.max(r, g, b);
26297
+ var delta = max2 - min;
26298
+ var h;
26299
+ var s;
26300
+ var l;
27510
26301
  if (max2 === min) {
27511
26302
  h = 0;
27512
26303
  } else if (r === max2) {
@@ -27520,7 +26311,7 @@ convert$2.rgb.hsl = function(rgb) {
27520
26311
  if (h < 0) {
27521
26312
  h += 360;
27522
26313
  }
27523
- const l = (min + max2) / 2;
26314
+ l = (min + max2) / 2;
27524
26315
  if (max2 === min) {
27525
26316
  s = 0;
27526
26317
  } else if (l <= 0.5) {
@@ -27531,22 +26322,21 @@ convert$2.rgb.hsl = function(rgb) {
27531
26322
  return [h, s * 100, l * 100];
27532
26323
  };
27533
26324
  convert$2.rgb.hsv = function(rgb) {
27534
- let rdif;
27535
- let gdif;
27536
- let bdif;
27537
- let h;
27538
- let s;
27539
- const r = rgb[0] / 255;
27540
- const g = rgb[1] / 255;
27541
- const b = rgb[2] / 255;
27542
- const v = Math.max(r, g, b);
27543
- const diff = v - Math.min(r, g, b);
27544
- const diffc = /* @__PURE__ */ __name(function(c) {
26325
+ var rdif;
26326
+ var gdif;
26327
+ var bdif;
26328
+ var h;
26329
+ var s;
26330
+ var r = rgb[0] / 255;
26331
+ var g = rgb[1] / 255;
26332
+ var b = rgb[2] / 255;
26333
+ var v = Math.max(r, g, b);
26334
+ var diff = v - Math.min(r, g, b);
26335
+ var diffc = /* @__PURE__ */ __name(function(c) {
27545
26336
  return (v - c) / 6 / diff + 1 / 2;
27546
26337
  }, "diffc");
27547
26338
  if (diff === 0) {
27548
- h = 0;
27549
- s = 0;
26339
+ h = s = 0;
27550
26340
  } else {
27551
26341
  s = diff / v;
27552
26342
  rdif = diffc(r);
@@ -27572,41 +26362,47 @@ convert$2.rgb.hsv = function(rgb) {
27572
26362
  ];
27573
26363
  };
27574
26364
  convert$2.rgb.hwb = function(rgb) {
27575
- const r = rgb[0];
27576
- const g = rgb[1];
27577
- let b = rgb[2];
27578
- const h = convert$2.rgb.hsl(rgb)[0];
27579
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
26365
+ var r = rgb[0];
26366
+ var g = rgb[1];
26367
+ var b = rgb[2];
26368
+ var h = convert$2.rgb.hsl(rgb)[0];
26369
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
27580
26370
  b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
27581
26371
  return [h, w * 100, b * 100];
27582
26372
  };
27583
26373
  convert$2.rgb.cmyk = function(rgb) {
27584
- const r = rgb[0] / 255;
27585
- const g = rgb[1] / 255;
27586
- const b = rgb[2] / 255;
27587
- const k = Math.min(1 - r, 1 - g, 1 - b);
27588
- const c = (1 - r - k) / (1 - k) || 0;
27589
- const m = (1 - g - k) / (1 - k) || 0;
27590
- const y = (1 - b - k) / (1 - k) || 0;
26374
+ var r = rgb[0] / 255;
26375
+ var g = rgb[1] / 255;
26376
+ var b = rgb[2] / 255;
26377
+ var c;
26378
+ var m;
26379
+ var y;
26380
+ var k;
26381
+ k = Math.min(1 - r, 1 - g, 1 - b);
26382
+ c = (1 - r - k) / (1 - k) || 0;
26383
+ m = (1 - g - k) / (1 - k) || 0;
26384
+ y = (1 - b - k) / (1 - k) || 0;
27591
26385
  return [c * 100, m * 100, y * 100, k * 100];
27592
26386
  };
27593
26387
  function comparativeDistance(x, y) {
27594
- return __pow(x[0] - y[0], 2) + __pow(x[1] - y[1], 2) + __pow(x[2] - y[2], 2);
26388
+ return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
27595
26389
  }
27596
26390
  __name(comparativeDistance, "comparativeDistance");
27597
26391
  convert$2.rgb.keyword = function(rgb) {
27598
- const reversed = reverseKeywords[rgb];
26392
+ var reversed = reverseKeywords[rgb];
27599
26393
  if (reversed) {
27600
26394
  return reversed;
27601
26395
  }
27602
- let currentClosestDistance = Infinity;
27603
- let currentClosestKeyword;
27604
- for (const keyword of Object.keys(cssKeywords)) {
27605
- const value = cssKeywords[keyword];
27606
- const distance = comparativeDistance(rgb, value);
27607
- if (distance < currentClosestDistance) {
27608
- currentClosestDistance = distance;
27609
- currentClosestKeyword = keyword;
26396
+ var currentClosestDistance = Infinity;
26397
+ var currentClosestKeyword;
26398
+ for (var keyword in cssKeywords) {
26399
+ if (cssKeywords.hasOwnProperty(keyword)) {
26400
+ var value = cssKeywords[keyword];
26401
+ var distance = comparativeDistance(rgb, value);
26402
+ if (distance < currentClosestDistance) {
26403
+ currentClosestDistance = distance;
26404
+ currentClosestKeyword = keyword;
26405
+ }
27610
26406
  }
27611
26407
  }
27612
26408
  return currentClosestKeyword;
@@ -27615,40 +26411,45 @@ convert$2.keyword.rgb = function(keyword) {
27615
26411
  return cssKeywords[keyword];
27616
26412
  };
27617
26413
  convert$2.rgb.xyz = function(rgb) {
27618
- let r = rgb[0] / 255;
27619
- let g = rgb[1] / 255;
27620
- let b = rgb[2] / 255;
27621
- r = r > 0.04045 ? __pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
27622
- g = g > 0.04045 ? __pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
27623
- b = b > 0.04045 ? __pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
27624
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
27625
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
27626
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
26414
+ var r = rgb[0] / 255;
26415
+ var g = rgb[1] / 255;
26416
+ var b = rgb[2] / 255;
26417
+ r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
26418
+ g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
26419
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
26420
+ var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
26421
+ var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
26422
+ var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
27627
26423
  return [x * 100, y * 100, z * 100];
27628
26424
  };
27629
26425
  convert$2.rgb.lab = function(rgb) {
27630
- const xyz = convert$2.rgb.xyz(rgb);
27631
- let x = xyz[0];
27632
- let y = xyz[1];
27633
- let z = xyz[2];
26426
+ var xyz = convert$2.rgb.xyz(rgb);
26427
+ var x = xyz[0];
26428
+ var y = xyz[1];
26429
+ var z = xyz[2];
26430
+ var l;
26431
+ var a;
26432
+ var b;
27634
26433
  x /= 95.047;
27635
26434
  y /= 100;
27636
26435
  z /= 108.883;
27637
- x = x > 8856e-6 ? __pow(x, 1 / 3) : 7.787 * x + 16 / 116;
27638
- y = y > 8856e-6 ? __pow(y, 1 / 3) : 7.787 * y + 16 / 116;
27639
- z = z > 8856e-6 ? __pow(z, 1 / 3) : 7.787 * z + 16 / 116;
27640
- const l = 116 * y - 16;
27641
- const a = 500 * (x - y);
27642
- const b = 200 * (y - z);
26436
+ x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
26437
+ y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
26438
+ z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
26439
+ l = 116 * y - 16;
26440
+ a = 500 * (x - y);
26441
+ b = 200 * (y - z);
27643
26442
  return [l, a, b];
27644
26443
  };
27645
26444
  convert$2.hsl.rgb = function(hsl) {
27646
- const h = hsl[0] / 360;
27647
- const s = hsl[1] / 100;
27648
- const l = hsl[2] / 100;
27649
- let t2;
27650
- let t3;
27651
- let val2;
26445
+ var h = hsl[0] / 360;
26446
+ var s = hsl[1] / 100;
26447
+ var l = hsl[2] / 100;
26448
+ var t1;
26449
+ var t2;
26450
+ var t3;
26451
+ var rgb;
26452
+ var val2;
27652
26453
  if (s === 0) {
27653
26454
  val2 = l * 255;
27654
26455
  return [val2, val2, val2];
@@ -27658,9 +26459,9 @@ convert$2.hsl.rgb = function(hsl) {
27658
26459
  } else {
27659
26460
  t2 = l + s - l * s;
27660
26461
  }
27661
- const t1 = 2 * l - t2;
27662
- const rgb = [0, 0, 0];
27663
- for (let i = 0; i < 3; i++) {
26462
+ t1 = 2 * l - t2;
26463
+ rgb = [0, 0, 0];
26464
+ for (var i = 0; i < 3; i++) {
27664
26465
  t3 = h + 1 / 3 * -(i - 1);
27665
26466
  if (t3 < 0) {
27666
26467
  t3++;
@@ -27682,27 +26483,29 @@ convert$2.hsl.rgb = function(hsl) {
27682
26483
  return rgb;
27683
26484
  };
27684
26485
  convert$2.hsl.hsv = function(hsl) {
27685
- const h = hsl[0];
27686
- let s = hsl[1] / 100;
27687
- let l = hsl[2] / 100;
27688
- let smin = s;
27689
- const lmin = Math.max(l, 0.01);
26486
+ var h = hsl[0];
26487
+ var s = hsl[1] / 100;
26488
+ var l = hsl[2] / 100;
26489
+ var smin = s;
26490
+ var lmin = Math.max(l, 0.01);
26491
+ var sv;
26492
+ var v;
27690
26493
  l *= 2;
27691
26494
  s *= l <= 1 ? l : 2 - l;
27692
26495
  smin *= lmin <= 1 ? lmin : 2 - lmin;
27693
- const v = (l + s) / 2;
27694
- const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
26496
+ v = (l + s) / 2;
26497
+ sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
27695
26498
  return [h, sv * 100, v * 100];
27696
26499
  };
27697
26500
  convert$2.hsv.rgb = function(hsv) {
27698
- const h = hsv[0] / 60;
27699
- const s = hsv[1] / 100;
27700
- let v = hsv[2] / 100;
27701
- const hi = Math.floor(h) % 6;
27702
- const f = h - Math.floor(h);
27703
- const p = 255 * v * (1 - s);
27704
- const q = 255 * v * (1 - s * f);
27705
- const t = 255 * v * (1 - s * (1 - f));
26501
+ var h = hsv[0] / 60;
26502
+ var s = hsv[1] / 100;
26503
+ var v = hsv[2] / 100;
26504
+ var hi = Math.floor(h) % 6;
26505
+ var f = h - Math.floor(h);
26506
+ var p = 255 * v * (1 - s);
26507
+ var q = 255 * v * (1 - s * f);
26508
+ var t = 255 * v * (1 - s * (1 - f));
27706
26509
  v *= 255;
27707
26510
  switch (hi) {
27708
26511
  case 0:
@@ -27720,14 +26523,15 @@ convert$2.hsv.rgb = function(hsv) {
27720
26523
  }
27721
26524
  };
27722
26525
  convert$2.hsv.hsl = function(hsv) {
27723
- const h = hsv[0];
27724
- const s = hsv[1] / 100;
27725
- const v = hsv[2] / 100;
27726
- const vmin = Math.max(v, 0.01);
27727
- let sl;
27728
- let l;
26526
+ var h = hsv[0];
26527
+ var s = hsv[1] / 100;
26528
+ var v = hsv[2] / 100;
26529
+ var vmin = Math.max(v, 0.01);
26530
+ var lmin;
26531
+ var sl;
26532
+ var l;
27729
26533
  l = (2 - s) * v;
27730
- const lmin = (2 - s) * vmin;
26534
+ lmin = (2 - s) * vmin;
27731
26535
  sl = s * vmin;
27732
26536
  sl /= lmin <= 1 ? lmin : 2 - lmin;
27733
26537
  sl = sl || 0;
@@ -27735,25 +26539,28 @@ convert$2.hsv.hsl = function(hsv) {
27735
26539
  return [h, sl * 100, l * 100];
27736
26540
  };
27737
26541
  convert$2.hwb.rgb = function(hwb) {
27738
- const h = hwb[0] / 360;
27739
- let wh = hwb[1] / 100;
27740
- let bl = hwb[2] / 100;
27741
- const ratio = wh + bl;
27742
- let f;
26542
+ var h = hwb[0] / 360;
26543
+ var wh = hwb[1] / 100;
26544
+ var bl = hwb[2] / 100;
26545
+ var ratio = wh + bl;
26546
+ var i;
26547
+ var v;
26548
+ var f;
26549
+ var n;
27743
26550
  if (ratio > 1) {
27744
26551
  wh /= ratio;
27745
26552
  bl /= ratio;
27746
26553
  }
27747
- const i = Math.floor(6 * h);
27748
- const v = 1 - bl;
26554
+ i = Math.floor(6 * h);
26555
+ v = 1 - bl;
27749
26556
  f = 6 * h - i;
27750
26557
  if ((i & 1) !== 0) {
27751
26558
  f = 1 - f;
27752
26559
  }
27753
- const n = wh + f * (v - wh);
27754
- let r;
27755
- let g;
27756
- let b;
26560
+ n = wh + f * (v - wh);
26561
+ var r;
26562
+ var g;
26563
+ var b;
27757
26564
  switch (i) {
27758
26565
  default:
27759
26566
  case 6:
@@ -27791,61 +26598,67 @@ convert$2.hwb.rgb = function(hwb) {
27791
26598
  return [r * 255, g * 255, b * 255];
27792
26599
  };
27793
26600
  convert$2.cmyk.rgb = function(cmyk) {
27794
- const c = cmyk[0] / 100;
27795
- const m = cmyk[1] / 100;
27796
- const y = cmyk[2] / 100;
27797
- const k = cmyk[3] / 100;
27798
- const r = 1 - Math.min(1, c * (1 - k) + k);
27799
- const g = 1 - Math.min(1, m * (1 - k) + k);
27800
- const b = 1 - Math.min(1, y * (1 - k) + k);
26601
+ var c = cmyk[0] / 100;
26602
+ var m = cmyk[1] / 100;
26603
+ var y = cmyk[2] / 100;
26604
+ var k = cmyk[3] / 100;
26605
+ var r;
26606
+ var g;
26607
+ var b;
26608
+ r = 1 - Math.min(1, c * (1 - k) + k);
26609
+ g = 1 - Math.min(1, m * (1 - k) + k);
26610
+ b = 1 - Math.min(1, y * (1 - k) + k);
27801
26611
  return [r * 255, g * 255, b * 255];
27802
26612
  };
27803
26613
  convert$2.xyz.rgb = function(xyz) {
27804
- const x = xyz[0] / 100;
27805
- const y = xyz[1] / 100;
27806
- const z = xyz[2] / 100;
27807
- let r;
27808
- let g;
27809
- let b;
26614
+ var x = xyz[0] / 100;
26615
+ var y = xyz[1] / 100;
26616
+ var z = xyz[2] / 100;
26617
+ var r;
26618
+ var g;
26619
+ var b;
27810
26620
  r = x * 3.2406 + y * -1.5372 + z * -0.4986;
27811
26621
  g = x * -0.9689 + y * 1.8758 + z * 0.0415;
27812
26622
  b = x * 0.0557 + y * -0.204 + z * 1.057;
27813
- r = r > 31308e-7 ? 1.055 * __pow(r, 1 / 2.4) - 0.055 : r * 12.92;
27814
- g = g > 31308e-7 ? 1.055 * __pow(g, 1 / 2.4) - 0.055 : g * 12.92;
27815
- b = b > 31308e-7 ? 1.055 * __pow(b, 1 / 2.4) - 0.055 : b * 12.92;
26623
+ r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
26624
+ g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
26625
+ b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
27816
26626
  r = Math.min(Math.max(0, r), 1);
27817
26627
  g = Math.min(Math.max(0, g), 1);
27818
26628
  b = Math.min(Math.max(0, b), 1);
27819
26629
  return [r * 255, g * 255, b * 255];
27820
26630
  };
27821
26631
  convert$2.xyz.lab = function(xyz) {
27822
- let x = xyz[0];
27823
- let y = xyz[1];
27824
- let z = xyz[2];
26632
+ var x = xyz[0];
26633
+ var y = xyz[1];
26634
+ var z = xyz[2];
26635
+ var l;
26636
+ var a;
26637
+ var b;
27825
26638
  x /= 95.047;
27826
26639
  y /= 100;
27827
26640
  z /= 108.883;
27828
- x = x > 8856e-6 ? __pow(x, 1 / 3) : 7.787 * x + 16 / 116;
27829
- y = y > 8856e-6 ? __pow(y, 1 / 3) : 7.787 * y + 16 / 116;
27830
- z = z > 8856e-6 ? __pow(z, 1 / 3) : 7.787 * z + 16 / 116;
27831
- const l = 116 * y - 16;
27832
- const a = 500 * (x - y);
27833
- const b = 200 * (y - z);
26641
+ x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
26642
+ y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
26643
+ z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
26644
+ l = 116 * y - 16;
26645
+ a = 500 * (x - y);
26646
+ b = 200 * (y - z);
27834
26647
  return [l, a, b];
27835
26648
  };
27836
26649
  convert$2.lab.xyz = function(lab) {
27837
- const l = lab[0];
27838
- const a = lab[1];
27839
- const b = lab[2];
27840
- let x;
27841
- let y;
27842
- let z;
26650
+ var l = lab[0];
26651
+ var a = lab[1];
26652
+ var b = lab[2];
26653
+ var x;
26654
+ var y;
26655
+ var z;
27843
26656
  y = (l + 16) / 116;
27844
26657
  x = a / 500 + y;
27845
26658
  z = y - b / 200;
27846
- const y2 = __pow(y, 3);
27847
- const x2 = __pow(x, 3);
27848
- const z2 = __pow(z, 3);
26659
+ var y2 = Math.pow(y, 3);
26660
+ var x2 = Math.pow(x, 3);
26661
+ var z2 = Math.pow(z, 3);
27849
26662
  y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
27850
26663
  x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
27851
26664
  z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
@@ -27855,35 +26668,42 @@ convert$2.lab.xyz = function(lab) {
27855
26668
  return [x, y, z];
27856
26669
  };
27857
26670
  convert$2.lab.lch = function(lab) {
27858
- const l = lab[0];
27859
- const a = lab[1];
27860
- const b = lab[2];
27861
- let h;
27862
- const hr = Math.atan2(b, a);
26671
+ var l = lab[0];
26672
+ var a = lab[1];
26673
+ var b = lab[2];
26674
+ var hr;
26675
+ var h;
26676
+ var c;
26677
+ hr = Math.atan2(b, a);
27863
26678
  h = hr * 360 / 2 / Math.PI;
27864
26679
  if (h < 0) {
27865
26680
  h += 360;
27866
26681
  }
27867
- const c = Math.sqrt(a * a + b * b);
26682
+ c = Math.sqrt(a * a + b * b);
27868
26683
  return [l, c, h];
27869
26684
  };
27870
26685
  convert$2.lch.lab = function(lch) {
27871
- const l = lch[0];
27872
- const c = lch[1];
27873
- const h = lch[2];
27874
- const hr = h / 360 * 2 * Math.PI;
27875
- const a = c * Math.cos(hr);
27876
- const b = c * Math.sin(hr);
26686
+ var l = lch[0];
26687
+ var c = lch[1];
26688
+ var h = lch[2];
26689
+ var a;
26690
+ var b;
26691
+ var hr;
26692
+ hr = h / 360 * 2 * Math.PI;
26693
+ a = c * Math.cos(hr);
26694
+ b = c * Math.sin(hr);
27877
26695
  return [l, a, b];
27878
26696
  };
27879
- convert$2.rgb.ansi16 = function(args, saturation = null) {
27880
- const [r, g, b] = args;
27881
- let value = saturation === null ? convert$2.rgb.hsv(args)[2] : saturation;
26697
+ convert$2.rgb.ansi16 = function(args) {
26698
+ var r = args[0];
26699
+ var g = args[1];
26700
+ var b = args[2];
26701
+ var value = 1 in arguments ? arguments[1] : convert$2.rgb.hsv(args)[2];
27882
26702
  value = Math.round(value / 50);
27883
26703
  if (value === 0) {
27884
26704
  return 30;
27885
26705
  }
27886
- let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
26706
+ var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
27887
26707
  if (value === 2) {
27888
26708
  ansi += 60;
27889
26709
  }
@@ -27893,9 +26713,9 @@ convert$2.hsv.ansi16 = function(args) {
27893
26713
  return convert$2.rgb.ansi16(convert$2.hsv.rgb(args), args[2]);
27894
26714
  };
27895
26715
  convert$2.rgb.ansi256 = function(args) {
27896
- const r = args[0];
27897
- const g = args[1];
27898
- const b = args[2];
26716
+ var r = args[0];
26717
+ var g = args[1];
26718
+ var b = args[2];
27899
26719
  if (r === g && g === b) {
27900
26720
  if (r < 8) {
27901
26721
  return 16;
@@ -27905,11 +26725,11 @@ convert$2.rgb.ansi256 = function(args) {
27905
26725
  }
27906
26726
  return Math.round((r - 8) / 247 * 24) + 232;
27907
26727
  }
27908
- const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
26728
+ var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
27909
26729
  return ansi;
27910
26730
  };
27911
26731
  convert$2.ansi16.rgb = function(args) {
27912
- let color2 = args % 10;
26732
+ var color2 = args % 10;
27913
26733
  if (color2 === 0 || color2 === 7) {
27914
26734
  if (args > 50) {
27915
26735
  color2 += 3.5;
@@ -27917,55 +26737,55 @@ convert$2.ansi16.rgb = function(args) {
27917
26737
  color2 = color2 / 10.5 * 255;
27918
26738
  return [color2, color2, color2];
27919
26739
  }
27920
- const mult = (~~(args > 50) + 1) * 0.5;
27921
- const r = (color2 & 1) * mult * 255;
27922
- const g = (color2 >> 1 & 1) * mult * 255;
27923
- const b = (color2 >> 2 & 1) * mult * 255;
26740
+ var mult = (~~(args > 50) + 1) * 0.5;
26741
+ var r = (color2 & 1) * mult * 255;
26742
+ var g = (color2 >> 1 & 1) * mult * 255;
26743
+ var b = (color2 >> 2 & 1) * mult * 255;
27924
26744
  return [r, g, b];
27925
26745
  };
27926
26746
  convert$2.ansi256.rgb = function(args) {
27927
26747
  if (args >= 232) {
27928
- const c = (args - 232) * 10 + 8;
26748
+ var c = (args - 232) * 10 + 8;
27929
26749
  return [c, c, c];
27930
26750
  }
27931
26751
  args -= 16;
27932
- let rem;
27933
- const r = Math.floor(args / 36) / 5 * 255;
27934
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
27935
- const b = rem % 6 / 5 * 255;
26752
+ var rem;
26753
+ var r = Math.floor(args / 36) / 5 * 255;
26754
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
26755
+ var b = rem % 6 / 5 * 255;
27936
26756
  return [r, g, b];
27937
26757
  };
27938
26758
  convert$2.rgb.hex = function(args) {
27939
- const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
27940
- const string = integer.toString(16).toUpperCase();
26759
+ var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
26760
+ var string = integer.toString(16).toUpperCase();
27941
26761
  return "000000".substring(string.length) + string;
27942
26762
  };
27943
26763
  convert$2.hex.rgb = function(args) {
27944
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
26764
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
27945
26765
  if (!match) {
27946
26766
  return [0, 0, 0];
27947
26767
  }
27948
- let colorString2 = match[0];
26768
+ var colorString2 = match[0];
27949
26769
  if (match[0].length === 3) {
27950
- colorString2 = colorString2.split("").map((char) => {
26770
+ colorString2 = colorString2.split("").map(function(char) {
27951
26771
  return char + char;
27952
26772
  }).join("");
27953
26773
  }
27954
- const integer = parseInt(colorString2, 16);
27955
- const r = integer >> 16 & 255;
27956
- const g = integer >> 8 & 255;
27957
- const b = integer & 255;
26774
+ var integer = parseInt(colorString2, 16);
26775
+ var r = integer >> 16 & 255;
26776
+ var g = integer >> 8 & 255;
26777
+ var b = integer & 255;
27958
26778
  return [r, g, b];
27959
26779
  };
27960
26780
  convert$2.rgb.hcg = function(rgb) {
27961
- const r = rgb[0] / 255;
27962
- const g = rgb[1] / 255;
27963
- const b = rgb[2] / 255;
27964
- const max2 = Math.max(Math.max(r, g), b);
27965
- const min = Math.min(Math.min(r, g), b);
27966
- const chroma = max2 - min;
27967
- let grayscale;
27968
- let hue;
26781
+ var r = rgb[0] / 255;
26782
+ var g = rgb[1] / 255;
26783
+ var b = rgb[2] / 255;
26784
+ var max2 = Math.max(Math.max(r, g), b);
26785
+ var min = Math.min(Math.min(r, g), b);
26786
+ var chroma = max2 - min;
26787
+ var grayscale;
26788
+ var hue;
27969
26789
  if (chroma < 1) {
27970
26790
  grayscale = min / (1 - chroma);
27971
26791
  } else {
@@ -27978,44 +26798,49 @@ convert$2.rgb.hcg = function(rgb) {
27978
26798
  } else if (max2 === g) {
27979
26799
  hue = 2 + (b - r) / chroma;
27980
26800
  } else {
27981
- hue = 4 + (r - g) / chroma;
26801
+ hue = 4 + (r - g) / chroma + 4;
27982
26802
  }
27983
26803
  hue /= 6;
27984
26804
  hue %= 1;
27985
26805
  return [hue * 360, chroma * 100, grayscale * 100];
27986
26806
  };
27987
26807
  convert$2.hsl.hcg = function(hsl) {
27988
- const s = hsl[1] / 100;
27989
- const l = hsl[2] / 100;
27990
- const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
27991
- let f = 0;
26808
+ var s = hsl[1] / 100;
26809
+ var l = hsl[2] / 100;
26810
+ var c = 1;
26811
+ var f = 0;
26812
+ if (l < 0.5) {
26813
+ c = 2 * s * l;
26814
+ } else {
26815
+ c = 2 * s * (1 - l);
26816
+ }
27992
26817
  if (c < 1) {
27993
26818
  f = (l - 0.5 * c) / (1 - c);
27994
26819
  }
27995
26820
  return [hsl[0], c * 100, f * 100];
27996
26821
  };
27997
26822
  convert$2.hsv.hcg = function(hsv) {
27998
- const s = hsv[1] / 100;
27999
- const v = hsv[2] / 100;
28000
- const c = s * v;
28001
- let f = 0;
26823
+ var s = hsv[1] / 100;
26824
+ var v = hsv[2] / 100;
26825
+ var c = s * v;
26826
+ var f = 0;
28002
26827
  if (c < 1) {
28003
26828
  f = (v - c) / (1 - c);
28004
26829
  }
28005
26830
  return [hsv[0], c * 100, f * 100];
28006
26831
  };
28007
26832
  convert$2.hcg.rgb = function(hcg) {
28008
- const h = hcg[0] / 360;
28009
- const c = hcg[1] / 100;
28010
- const g = hcg[2] / 100;
26833
+ var h = hcg[0] / 360;
26834
+ var c = hcg[1] / 100;
26835
+ var g = hcg[2] / 100;
28011
26836
  if (c === 0) {
28012
26837
  return [g * 255, g * 255, g * 255];
28013
26838
  }
28014
- const pure = [0, 0, 0];
28015
- const hi = h % 1 * 6;
28016
- const v = hi % 1;
28017
- const w = 1 - v;
28018
- let mg = 0;
26839
+ var pure = [0, 0, 0];
26840
+ var hi = h % 1 * 6;
26841
+ var v = hi % 1;
26842
+ var w = 1 - v;
26843
+ var mg = 0;
28019
26844
  switch (Math.floor(hi)) {
28020
26845
  case 0:
28021
26846
  pure[0] = 1;
@@ -28055,20 +26880,20 @@ convert$2.hcg.rgb = function(hcg) {
28055
26880
  ];
28056
26881
  };
28057
26882
  convert$2.hcg.hsv = function(hcg) {
28058
- const c = hcg[1] / 100;
28059
- const g = hcg[2] / 100;
28060
- const v = c + g * (1 - c);
28061
- let f = 0;
26883
+ var c = hcg[1] / 100;
26884
+ var g = hcg[2] / 100;
26885
+ var v = c + g * (1 - c);
26886
+ var f = 0;
28062
26887
  if (v > 0) {
28063
26888
  f = c / v;
28064
26889
  }
28065
26890
  return [hcg[0], f * 100, v * 100];
28066
26891
  };
28067
26892
  convert$2.hcg.hsl = function(hcg) {
28068
- const c = hcg[1] / 100;
28069
- const g = hcg[2] / 100;
28070
- const l = g * (1 - c) + 0.5 * c;
28071
- let s = 0;
26893
+ var c = hcg[1] / 100;
26894
+ var g = hcg[2] / 100;
26895
+ var l = g * (1 - c) + 0.5 * c;
26896
+ var s = 0;
28072
26897
  if (l > 0 && l < 0.5) {
28073
26898
  s = c / (2 * l);
28074
26899
  } else if (l >= 0.5 && l < 1) {
@@ -28077,17 +26902,17 @@ convert$2.hcg.hsl = function(hcg) {
28077
26902
  return [hcg[0], s * 100, l * 100];
28078
26903
  };
28079
26904
  convert$2.hcg.hwb = function(hcg) {
28080
- const c = hcg[1] / 100;
28081
- const g = hcg[2] / 100;
28082
- const v = c + g * (1 - c);
26905
+ var c = hcg[1] / 100;
26906
+ var g = hcg[2] / 100;
26907
+ var v = c + g * (1 - c);
28083
26908
  return [hcg[0], (v - c) * 100, (1 - v) * 100];
28084
26909
  };
28085
26910
  convert$2.hwb.hcg = function(hwb) {
28086
- const w = hwb[1] / 100;
28087
- const b = hwb[2] / 100;
28088
- const v = 1 - b;
28089
- const c = v - w;
28090
- let g = 0;
26911
+ var w = hwb[1] / 100;
26912
+ var b = hwb[2] / 100;
26913
+ var v = 1 - b;
26914
+ var c = v - w;
26915
+ var g = 0;
28091
26916
  if (c < 1) {
28092
26917
  g = (v - c) / (1 - c);
28093
26918
  }
@@ -28102,10 +26927,9 @@ convert$2.rgb.apple = function(rgb) {
28102
26927
  convert$2.gray.rgb = function(args) {
28103
26928
  return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
28104
26929
  };
28105
- convert$2.gray.hsl = function(args) {
26930
+ convert$2.gray.hsl = convert$2.gray.hsv = function(args) {
28106
26931
  return [0, 0, args[0]];
28107
26932
  };
28108
- convert$2.gray.hsv = convert$2.gray.hsl;
28109
26933
  convert$2.gray.hwb = function(gray) {
28110
26934
  return [0, 100, gray[0]];
28111
26935
  };
@@ -28116,20 +26940,21 @@ convert$2.gray.lab = function(gray) {
28116
26940
  return [gray[0], 0, 0];
28117
26941
  };
28118
26942
  convert$2.gray.hex = function(gray) {
28119
- const val2 = Math.round(gray[0] / 100 * 255) & 255;
28120
- const integer = (val2 << 16) + (val2 << 8) + val2;
28121
- const string = integer.toString(16).toUpperCase();
26943
+ var val2 = Math.round(gray[0] / 100 * 255) & 255;
26944
+ var integer = (val2 << 16) + (val2 << 8) + val2;
26945
+ var string = integer.toString(16).toUpperCase();
28122
26946
  return "000000".substring(string.length) + string;
28123
26947
  };
28124
26948
  convert$2.rgb.gray = function(rgb) {
28125
- const val2 = (rgb[0] + rgb[1] + rgb[2]) / 3;
26949
+ var val2 = (rgb[0] + rgb[1] + rgb[2]) / 3;
28126
26950
  return [val2 / 255 * 100];
28127
26951
  };
28128
- const conversions$1 = conversions$2;
26952
+ var conversionsExports = conversions$2.exports;
26953
+ var conversions$1 = conversionsExports;
28129
26954
  function buildGraph() {
28130
- const graph = {};
28131
- const models2 = Object.keys(conversions$1);
28132
- for (let len = models2.length, i = 0; i < len; i++) {
26955
+ var graph = {};
26956
+ var models2 = Object.keys(conversions$1);
26957
+ for (var len = models2.length, i = 0; i < len; i++) {
28133
26958
  graph[models2[i]] = {
28134
26959
  // http://jsperf.com/1-vs-infinity
28135
26960
  // micro-opt, but this is simple.
@@ -28141,15 +26966,15 @@ function buildGraph() {
28141
26966
  }
28142
26967
  __name(buildGraph, "buildGraph");
28143
26968
  function deriveBFS(fromModel) {
28144
- const graph = buildGraph();
28145
- const queue = [fromModel];
26969
+ var graph = buildGraph();
26970
+ var queue = [fromModel];
28146
26971
  graph[fromModel].distance = 0;
28147
26972
  while (queue.length) {
28148
- const current = queue.pop();
28149
- const adjacents = Object.keys(conversions$1[current]);
28150
- for (let len = adjacents.length, i = 0; i < len; i++) {
28151
- const adjacent = adjacents[i];
28152
- const node = graph[adjacent];
26973
+ var current = queue.pop();
26974
+ var adjacents = Object.keys(conversions$1[current]);
26975
+ for (var len = adjacents.length, i = 0; i < len; i++) {
26976
+ var adjacent = adjacents[i];
26977
+ var node = graph[adjacent];
28153
26978
  if (node.distance === -1) {
28154
26979
  node.distance = graph[current].distance + 1;
28155
26980
  node.parent = current;
@@ -28167,9 +26992,9 @@ function link(from, to) {
28167
26992
  }
28168
26993
  __name(link, "link");
28169
26994
  function wrapConversion(toModel, graph) {
28170
- const path = [graph[toModel].parent, toModel];
28171
- let fn = conversions$1[graph[toModel].parent][toModel];
28172
- let cur = graph[toModel].parent;
26995
+ var path = [graph[toModel].parent, toModel];
26996
+ var fn = conversions$1[graph[toModel].parent][toModel];
26997
+ var cur = graph[toModel].parent;
28173
26998
  while (graph[cur].parent) {
28174
26999
  path.unshift(graph[cur].parent);
28175
27000
  fn = link(conversions$1[graph[cur].parent][cur], fn);
@@ -28180,12 +27005,12 @@ function wrapConversion(toModel, graph) {
28180
27005
  }
28181
27006
  __name(wrapConversion, "wrapConversion");
28182
27007
  var route$1 = /* @__PURE__ */ __name(function(fromModel) {
28183
- const graph = deriveBFS(fromModel);
28184
- const conversion = {};
28185
- const models2 = Object.keys(graph);
28186
- for (let len = models2.length, i = 0; i < len; i++) {
28187
- const toModel = models2[i];
28188
- const node = graph[toModel];
27008
+ var graph = deriveBFS(fromModel);
27009
+ var conversion = {};
27010
+ var models2 = Object.keys(graph);
27011
+ for (var len = models2.length, i = 0; i < len; i++) {
27012
+ var toModel = models2[i];
27013
+ var node = graph[toModel];
28189
27014
  if (node.parent === null) {
28190
27015
  continue;
28191
27016
  }
@@ -28193,18 +27018,17 @@ var route$1 = /* @__PURE__ */ __name(function(fromModel) {
28193
27018
  }
28194
27019
  return conversion;
28195
27020
  }, "route$1");
28196
- const conversions = conversions$2;
28197
- const route = route$1;
28198
- const convert$1 = {};
28199
- const models = Object.keys(conversions);
27021
+ var conversions = conversionsExports;
27022
+ var route = route$1;
27023
+ var convert$1 = {};
27024
+ var models = Object.keys(conversions);
28200
27025
  function wrapRaw(fn) {
28201
- const wrappedFn = /* @__PURE__ */ __name(function(...args) {
28202
- const arg0 = args[0];
28203
- if (arg0 === void 0 || arg0 === null) {
28204
- return arg0;
27026
+ var wrappedFn = /* @__PURE__ */ __name(function(args) {
27027
+ if (args === void 0 || args === null) {
27028
+ return args;
28205
27029
  }
28206
- if (arg0.length > 1) {
28207
- args = arg0;
27030
+ if (arguments.length > 1) {
27031
+ args = Array.prototype.slice.call(arguments);
28208
27032
  }
28209
27033
  return fn(args);
28210
27034
  }, "wrappedFn");
@@ -28215,17 +27039,16 @@ function wrapRaw(fn) {
28215
27039
  }
28216
27040
  __name(wrapRaw, "wrapRaw");
28217
27041
  function wrapRounded(fn) {
28218
- const wrappedFn = /* @__PURE__ */ __name(function(...args) {
28219
- const arg0 = args[0];
28220
- if (arg0 === void 0 || arg0 === null) {
28221
- return arg0;
27042
+ var wrappedFn = /* @__PURE__ */ __name(function(args) {
27043
+ if (args === void 0 || args === null) {
27044
+ return args;
28222
27045
  }
28223
- if (arg0.length > 1) {
28224
- args = arg0;
27046
+ if (arguments.length > 1) {
27047
+ args = Array.prototype.slice.call(arguments);
28225
27048
  }
28226
- const result = fn(args);
27049
+ var result = fn(args);
28227
27050
  if (typeof result === "object") {
28228
- for (let len = result.length, i = 0; i < len; i++) {
27051
+ for (var len = result.length, i = 0; i < len; i++) {
28229
27052
  result[i] = Math.round(result[i]);
28230
27053
  }
28231
27054
  }
@@ -28237,37 +27060,38 @@ function wrapRounded(fn) {
28237
27060
  return wrappedFn;
28238
27061
  }
28239
27062
  __name(wrapRounded, "wrapRounded");
28240
- models.forEach((fromModel) => {
27063
+ models.forEach(function(fromModel) {
28241
27064
  convert$1[fromModel] = {};
28242
27065
  Object.defineProperty(convert$1[fromModel], "channels", { value: conversions[fromModel].channels });
28243
27066
  Object.defineProperty(convert$1[fromModel], "labels", { value: conversions[fromModel].labels });
28244
- const routes = route(fromModel);
28245
- const routeModels = Object.keys(routes);
28246
- routeModels.forEach((toModel) => {
28247
- const fn = routes[toModel];
27067
+ var routes = route(fromModel);
27068
+ var routeModels = Object.keys(routes);
27069
+ routeModels.forEach(function(toModel) {
27070
+ var fn = routes[toModel];
28248
27071
  convert$1[fromModel][toModel] = wrapRounded(fn);
28249
27072
  convert$1[fromModel][toModel].raw = wrapRaw(fn);
28250
27073
  });
28251
27074
  });
28252
27075
  var colorConvert = convert$1;
28253
- const colorString = colorStringExports;
28254
- const convert = colorConvert;
28255
- const skippedModels = [
28256
- // To be honest, I don't really feel like keyword belongs in color convert, but eh.
27076
+ var colorString = colorStringExports;
27077
+ var convert = colorConvert;
27078
+ var _slice = [].slice;
27079
+ var skippedModels = [
27080
+ // to be honest, I don't really feel like keyword belongs in color convert, but eh.
28257
27081
  "keyword",
28258
- // Gray conflicts with some method names, and has its own method defined.
27082
+ // gray conflicts with some method names, and has its own method defined.
28259
27083
  "gray",
28260
- // Shouldn't really be in color-convert either...
27084
+ // shouldn't really be in color-convert either...
28261
27085
  "hex"
28262
27086
  ];
28263
- const hashedModelKeys = {};
28264
- for (const model of Object.keys(convert)) {
28265
- hashedModelKeys[[...convert[model].labels].sort().join("")] = model;
28266
- }
28267
- const limiters = {};
28268
- function Color(object, model) {
27087
+ var hashedModelKeys = {};
27088
+ Object.keys(convert).forEach(function(model) {
27089
+ hashedModelKeys[_slice.call(convert[model].labels).sort().join("")] = model;
27090
+ });
27091
+ var limiters = {};
27092
+ function Color(obj, model) {
28269
27093
  if (!(this instanceof Color)) {
28270
- return new Color(object, model);
27094
+ return new Color(obj, model);
28271
27095
  }
28272
27096
  if (model && model in skippedModels) {
28273
27097
  model = null;
@@ -28275,62 +27099,63 @@ function Color(object, model) {
28275
27099
  if (model && !(model in convert)) {
28276
27100
  throw new Error("Unknown model: " + model);
28277
27101
  }
28278
- let i;
28279
- let channels;
28280
- if (object == null) {
27102
+ var i;
27103
+ var channels;
27104
+ if (obj == null) {
28281
27105
  this.model = "rgb";
28282
27106
  this.color = [0, 0, 0];
28283
27107
  this.valpha = 1;
28284
- } else if (object instanceof Color) {
28285
- this.model = object.model;
28286
- this.color = [...object.color];
28287
- this.valpha = object.valpha;
28288
- } else if (typeof object === "string") {
28289
- const result = colorString.get(object);
27108
+ } else if (obj instanceof Color) {
27109
+ this.model = obj.model;
27110
+ this.color = obj.color.slice();
27111
+ this.valpha = obj.valpha;
27112
+ } else if (typeof obj === "string") {
27113
+ var result = colorString.get(obj);
28290
27114
  if (result === null) {
28291
- throw new Error("Unable to parse color from string: " + object);
27115
+ throw new Error("Unable to parse color from string: " + obj);
28292
27116
  }
28293
27117
  this.model = result.model;
28294
27118
  channels = convert[this.model].channels;
28295
27119
  this.color = result.value.slice(0, channels);
28296
27120
  this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
28297
- } else if (object.length > 0) {
27121
+ } else if (obj.length) {
28298
27122
  this.model = model || "rgb";
28299
27123
  channels = convert[this.model].channels;
28300
- const newArray = Array.prototype.slice.call(object, 0, channels);
28301
- this.color = zeroArray(newArray, channels);
28302
- this.valpha = typeof object[channels] === "number" ? object[channels] : 1;
28303
- } else if (typeof object === "number") {
27124
+ var newArr = _slice.call(obj, 0, channels);
27125
+ this.color = zeroArray(newArr, channels);
27126
+ this.valpha = typeof obj[channels] === "number" ? obj[channels] : 1;
27127
+ } else if (typeof obj === "number") {
27128
+ obj &= 16777215;
28304
27129
  this.model = "rgb";
28305
27130
  this.color = [
28306
- object >> 16 & 255,
28307
- object >> 8 & 255,
28308
- object & 255
27131
+ obj >> 16 & 255,
27132
+ obj >> 8 & 255,
27133
+ obj & 255
28309
27134
  ];
28310
27135
  this.valpha = 1;
28311
27136
  } else {
28312
27137
  this.valpha = 1;
28313
- const keys2 = Object.keys(object);
28314
- if ("alpha" in object) {
27138
+ var keys2 = Object.keys(obj);
27139
+ if ("alpha" in obj) {
28315
27140
  keys2.splice(keys2.indexOf("alpha"), 1);
28316
- this.valpha = typeof object.alpha === "number" ? object.alpha : 0;
27141
+ this.valpha = typeof obj.alpha === "number" ? obj.alpha : 0;
28317
27142
  }
28318
- const hashedKeys = keys2.sort().join("");
27143
+ var hashedKeys = keys2.sort().join("");
28319
27144
  if (!(hashedKeys in hashedModelKeys)) {
28320
- throw new Error("Unable to parse color from object: " + JSON.stringify(object));
27145
+ throw new Error("Unable to parse color from object: " + JSON.stringify(obj));
28321
27146
  }
28322
27147
  this.model = hashedModelKeys[hashedKeys];
28323
- const { labels } = convert[this.model];
28324
- const color2 = [];
27148
+ var labels = convert[this.model].labels;
27149
+ var color2 = [];
28325
27150
  for (i = 0; i < labels.length; i++) {
28326
- color2.push(object[labels[i]]);
27151
+ color2.push(obj[labels[i]]);
28327
27152
  }
28328
27153
  this.color = zeroArray(color2);
28329
27154
  }
28330
27155
  if (limiters[this.model]) {
28331
27156
  channels = convert[this.model].channels;
28332
27157
  for (i = 0; i < channels; i++) {
28333
- const limit = limiters[this.model][i];
27158
+ var limit = limiters[this.model][i];
28334
27159
  if (limit) {
28335
27160
  this.color[i] = limit(this.color[i]);
28336
27161
  }
@@ -28343,31 +27168,31 @@ function Color(object, model) {
28343
27168
  }
28344
27169
  __name(Color, "Color");
28345
27170
  Color.prototype = {
28346
- toString() {
27171
+ toString: function() {
28347
27172
  return this.string();
28348
27173
  },
28349
- toJSON() {
27174
+ toJSON: function() {
28350
27175
  return this[this.model]();
28351
27176
  },
28352
- string(places) {
28353
- let self2 = this.model in colorString.to ? this : this.rgb();
27177
+ string: function(places) {
27178
+ var self2 = this.model in colorString.to ? this : this.rgb();
28354
27179
  self2 = self2.round(typeof places === "number" ? places : 1);
28355
- const args = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
27180
+ var args = self2.valpha === 1 ? self2.color : self2.color.concat(this.valpha);
28356
27181
  return colorString.to[self2.model](args);
28357
27182
  },
28358
- percentString(places) {
28359
- const self2 = this.rgb().round(typeof places === "number" ? places : 1);
28360
- const args = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
27183
+ percentString: function(places) {
27184
+ var self2 = this.rgb().round(typeof places === "number" ? places : 1);
27185
+ var args = self2.valpha === 1 ? self2.color : self2.color.concat(this.valpha);
28361
27186
  return colorString.to.rgb.percent(args);
28362
27187
  },
28363
- array() {
28364
- return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
27188
+ array: function() {
27189
+ return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
28365
27190
  },
28366
- object() {
28367
- const result = {};
28368
- const { channels } = convert[this.model];
28369
- const { labels } = convert[this.model];
28370
- for (let i = 0; i < channels; i++) {
27191
+ object: function() {
27192
+ var result = {};
27193
+ var channels = convert[this.model].channels;
27194
+ var labels = convert[this.model].labels;
27195
+ for (var i = 0; i < channels; i++) {
28371
27196
  result[labels[i]] = this.color[i];
28372
27197
  }
28373
27198
  if (this.valpha !== 1) {
@@ -28375,8 +27200,8 @@ Color.prototype = {
28375
27200
  }
28376
27201
  return result;
28377
27202
  },
28378
- unitArray() {
28379
- const rgb = this.rgb().color;
27203
+ unitArray: function() {
27204
+ var rgb = this.rgb().color;
28380
27205
  rgb[0] /= 255;
28381
27206
  rgb[1] /= 255;
28382
27207
  rgb[2] /= 255;
@@ -28385,8 +27210,8 @@ Color.prototype = {
28385
27210
  }
28386
27211
  return rgb;
28387
27212
  },
28388
- unitObject() {
28389
- const rgb = this.rgb().object();
27213
+ unitObject: function() {
27214
+ var rgb = this.rgb().object();
28390
27215
  rgb.r /= 255;
28391
27216
  rgb.g /= 255;
28392
27217
  rgb.b /= 255;
@@ -28395,21 +27220,24 @@ Color.prototype = {
28395
27220
  }
28396
27221
  return rgb;
28397
27222
  },
28398
- round(places) {
27223
+ round: function(places) {
28399
27224
  places = Math.max(places || 0, 0);
28400
- return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
27225
+ return new Color(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);
28401
27226
  },
28402
- alpha(value) {
28403
- if (value !== void 0) {
28404
- return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
27227
+ alpha: function(val2) {
27228
+ if (arguments.length) {
27229
+ return new Color(this.color.concat(Math.max(0, Math.min(1, val2))), this.model);
28405
27230
  }
28406
27231
  return this.valpha;
28407
27232
  },
28408
- // Rgb
27233
+ // rgb
28409
27234
  red: getset("rgb", 0, maxfn(255)),
28410
27235
  green: getset("rgb", 1, maxfn(255)),
28411
27236
  blue: getset("rgb", 2, maxfn(255)),
28412
- hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (value) => (value % 360 + 360) % 360),
27237
+ hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, function(val2) {
27238
+ return (val2 % 360 + 360) % 360;
27239
+ }),
27240
+ // eslint-disable-line brace-style
28413
27241
  saturationl: getset("hsl", 1, maxfn(100)),
28414
27242
  lightness: getset("hsl", 2, maxfn(100)),
28415
27243
  saturationv: getset("hsv", 1, maxfn(100)),
@@ -28422,138 +27250,127 @@ Color.prototype = {
28422
27250
  magenta: getset("cmyk", 1, maxfn(100)),
28423
27251
  yellow: getset("cmyk", 2, maxfn(100)),
28424
27252
  black: getset("cmyk", 3, maxfn(100)),
28425
- x: getset("xyz", 0, maxfn(95.047)),
27253
+ x: getset("xyz", 0, maxfn(100)),
28426
27254
  y: getset("xyz", 1, maxfn(100)),
28427
- z: getset("xyz", 2, maxfn(108.833)),
27255
+ z: getset("xyz", 2, maxfn(100)),
28428
27256
  l: getset("lab", 0, maxfn(100)),
28429
27257
  a: getset("lab", 1),
28430
27258
  b: getset("lab", 2),
28431
- keyword(value) {
28432
- if (value !== void 0) {
28433
- return new Color(value);
27259
+ keyword: function(val2) {
27260
+ if (arguments.length) {
27261
+ return new Color(val2);
28434
27262
  }
28435
27263
  return convert[this.model].keyword(this.color);
28436
27264
  },
28437
- hex(value) {
28438
- if (value !== void 0) {
28439
- return new Color(value);
27265
+ hex: function(val2) {
27266
+ if (arguments.length) {
27267
+ return new Color(val2);
28440
27268
  }
28441
27269
  return colorString.to.hex(this.rgb().round().color);
28442
27270
  },
28443
- hexa(value) {
28444
- if (value !== void 0) {
28445
- return new Color(value);
28446
- }
28447
- const rgbArray = this.rgb().round().color;
28448
- let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
28449
- if (alphaHex.length === 1) {
28450
- alphaHex = "0" + alphaHex;
28451
- }
28452
- return colorString.to.hex(rgbArray) + alphaHex;
28453
- },
28454
- rgbNumber() {
28455
- const rgb = this.rgb().color;
27271
+ rgbNumber: function() {
27272
+ var rgb = this.rgb().color;
28456
27273
  return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255;
28457
27274
  },
28458
- luminosity() {
28459
- const rgb = this.rgb().color;
28460
- const lum = [];
28461
- for (const [i, element] of rgb.entries()) {
28462
- const chan = element / 255;
28463
- lum[i] = chan <= 0.04045 ? chan / 12.92 : __pow((chan + 0.055) / 1.055, 2.4);
27275
+ luminosity: function() {
27276
+ var rgb = this.rgb().color;
27277
+ var lum = [];
27278
+ for (var i = 0; i < rgb.length; i++) {
27279
+ var chan = rgb[i] / 255;
27280
+ lum[i] = chan <= 0.03928 ? chan / 12.92 : Math.pow((chan + 0.055) / 1.055, 2.4);
28464
27281
  }
28465
27282
  return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
28466
27283
  },
28467
- contrast(color2) {
28468
- const lum1 = this.luminosity();
28469
- const lum2 = color2.luminosity();
27284
+ contrast: function(color2) {
27285
+ var lum1 = this.luminosity();
27286
+ var lum2 = color2.luminosity();
28470
27287
  if (lum1 > lum2) {
28471
27288
  return (lum1 + 0.05) / (lum2 + 0.05);
28472
27289
  }
28473
27290
  return (lum2 + 0.05) / (lum1 + 0.05);
28474
27291
  },
28475
- level(color2) {
28476
- const contrastRatio = this.contrast(color2);
28477
- if (contrastRatio >= 7) {
27292
+ level: function(color2) {
27293
+ var contrastRatio = this.contrast(color2);
27294
+ if (contrastRatio >= 7.1) {
28478
27295
  return "AAA";
28479
27296
  }
28480
27297
  return contrastRatio >= 4.5 ? "AA" : "";
28481
27298
  },
28482
- isDark() {
28483
- const rgb = this.rgb().color;
28484
- const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 1e4;
27299
+ isDark: function() {
27300
+ var rgb = this.rgb().color;
27301
+ var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1e3;
28485
27302
  return yiq < 128;
28486
27303
  },
28487
- isLight() {
27304
+ isLight: function() {
28488
27305
  return !this.isDark();
28489
27306
  },
28490
- negate() {
28491
- const rgb = this.rgb();
28492
- for (let i = 0; i < 3; i++) {
27307
+ negate: function() {
27308
+ var rgb = this.rgb();
27309
+ for (var i = 0; i < 3; i++) {
28493
27310
  rgb.color[i] = 255 - rgb.color[i];
28494
27311
  }
28495
27312
  return rgb;
28496
27313
  },
28497
- lighten(ratio) {
28498
- const hsl = this.hsl();
27314
+ lighten: function(ratio) {
27315
+ var hsl = this.hsl();
28499
27316
  hsl.color[2] += hsl.color[2] * ratio;
28500
27317
  return hsl;
28501
27318
  },
28502
- darken(ratio) {
28503
- const hsl = this.hsl();
27319
+ darken: function(ratio) {
27320
+ var hsl = this.hsl();
28504
27321
  hsl.color[2] -= hsl.color[2] * ratio;
28505
27322
  return hsl;
28506
27323
  },
28507
- saturate(ratio) {
28508
- const hsl = this.hsl();
27324
+ saturate: function(ratio) {
27325
+ var hsl = this.hsl();
28509
27326
  hsl.color[1] += hsl.color[1] * ratio;
28510
27327
  return hsl;
28511
27328
  },
28512
- desaturate(ratio) {
28513
- const hsl = this.hsl();
27329
+ desaturate: function(ratio) {
27330
+ var hsl = this.hsl();
28514
27331
  hsl.color[1] -= hsl.color[1] * ratio;
28515
27332
  return hsl;
28516
27333
  },
28517
- whiten(ratio) {
28518
- const hwb = this.hwb();
27334
+ whiten: function(ratio) {
27335
+ var hwb = this.hwb();
28519
27336
  hwb.color[1] += hwb.color[1] * ratio;
28520
27337
  return hwb;
28521
27338
  },
28522
- blacken(ratio) {
28523
- const hwb = this.hwb();
27339
+ blacken: function(ratio) {
27340
+ var hwb = this.hwb();
28524
27341
  hwb.color[2] += hwb.color[2] * ratio;
28525
27342
  return hwb;
28526
27343
  },
28527
- grayscale() {
28528
- const rgb = this.rgb().color;
28529
- const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
28530
- return Color.rgb(value, value, value);
27344
+ grayscale: function() {
27345
+ var rgb = this.rgb().color;
27346
+ var val2 = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
27347
+ return Color.rgb(val2, val2, val2);
28531
27348
  },
28532
- fade(ratio) {
27349
+ fade: function(ratio) {
28533
27350
  return this.alpha(this.valpha - this.valpha * ratio);
28534
27351
  },
28535
- opaquer(ratio) {
27352
+ opaquer: function(ratio) {
28536
27353
  return this.alpha(this.valpha + this.valpha * ratio);
28537
27354
  },
28538
- rotate(degrees) {
28539
- const hsl = this.hsl();
28540
- let hue = hsl.color[0];
27355
+ rotate: function(degrees) {
27356
+ var hsl = this.hsl();
27357
+ var hue = hsl.color[0];
28541
27358
  hue = (hue + degrees) % 360;
28542
27359
  hue = hue < 0 ? 360 + hue : hue;
28543
27360
  hsl.color[0] = hue;
28544
27361
  return hsl;
28545
27362
  },
28546
- mix(mixinColor, weight) {
27363
+ mix: function(mixinColor, weight) {
28547
27364
  if (!mixinColor || !mixinColor.rgb) {
28548
27365
  throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
28549
27366
  }
28550
- const color1 = mixinColor.rgb();
28551
- const color2 = this.rgb();
28552
- const p = weight === void 0 ? 0.5 : weight;
28553
- const w = 2 * p - 1;
28554
- const a = color1.alpha() - color2.alpha();
28555
- const w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
28556
- const w2 = 1 - w1;
27367
+ var color1 = mixinColor.rgb();
27368
+ var color2 = this.rgb();
27369
+ var p = weight === void 0 ? 0.5 : weight;
27370
+ var w = 2 * p - 1;
27371
+ var a = color1.alpha() - color2.alpha();
27372
+ var w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
27373
+ var w2 = 1 - w1;
28557
27374
  return Color.rgb(
28558
27375
  w1 * color1.red() + w2 * color2.red(),
28559
27376
  w1 * color1.green() + w2 * color2.green(),
@@ -28562,52 +27379,52 @@ Color.prototype = {
28562
27379
  );
28563
27380
  }
28564
27381
  };
28565
- for (const model of Object.keys(convert)) {
28566
- if (skippedModels.includes(model)) {
28567
- continue;
27382
+ Object.keys(convert).forEach(function(model) {
27383
+ if (skippedModels.indexOf(model) !== -1) {
27384
+ return;
28568
27385
  }
28569
- const { channels } = convert[model];
28570
- Color.prototype[model] = function(...args) {
27386
+ var channels = convert[model].channels;
27387
+ Color.prototype[model] = function() {
28571
27388
  if (this.model === model) {
28572
27389
  return new Color(this);
28573
27390
  }
28574
- if (args.length > 0) {
28575
- return new Color(args, model);
27391
+ if (arguments.length) {
27392
+ return new Color(arguments, model);
28576
27393
  }
28577
- return new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);
27394
+ var newAlpha = typeof arguments[channels] === "number" ? channels : this.valpha;
27395
+ return new Color(assertArray(convert[this.model][model].raw(this.color)).concat(newAlpha), model);
28578
27396
  };
28579
- Color[model] = function(...args) {
28580
- let color2 = args[0];
27397
+ Color[model] = function(color2) {
28581
27398
  if (typeof color2 === "number") {
28582
- color2 = zeroArray(args, channels);
27399
+ color2 = zeroArray(_slice.call(arguments), channels);
28583
27400
  }
28584
27401
  return new Color(color2, model);
28585
27402
  };
28586
- }
28587
- function roundTo(number, places) {
28588
- return Number(number.toFixed(places));
27403
+ });
27404
+ function roundTo(num, places) {
27405
+ return Number(num.toFixed(places));
28589
27406
  }
28590
27407
  __name(roundTo, "roundTo");
28591
27408
  function roundToPlace(places) {
28592
- return function(number) {
28593
- return roundTo(number, places);
27409
+ return function(num) {
27410
+ return roundTo(num, places);
28594
27411
  };
28595
27412
  }
28596
27413
  __name(roundToPlace, "roundToPlace");
28597
27414
  function getset(model, channel, modifier) {
28598
27415
  model = Array.isArray(model) ? model : [model];
28599
- for (const m of model) {
27416
+ model.forEach(function(m) {
28600
27417
  (limiters[m] || (limiters[m] = []))[channel] = modifier;
28601
- }
27418
+ });
28602
27419
  model = model[0];
28603
- return function(value) {
28604
- let result;
28605
- if (value !== void 0) {
27420
+ return function(val2) {
27421
+ var result;
27422
+ if (arguments.length) {
28606
27423
  if (modifier) {
28607
- value = modifier(value);
27424
+ val2 = modifier(val2);
28608
27425
  }
28609
27426
  result = this[model]();
28610
- result.color[channel] = value;
27427
+ result.color[channel] = val2;
28611
27428
  return result;
28612
27429
  }
28613
27430
  result = this[model]().color[channel];
@@ -28624,17 +27441,17 @@ function maxfn(max2) {
28624
27441
  };
28625
27442
  }
28626
27443
  __name(maxfn, "maxfn");
28627
- function assertArray(value) {
28628
- return Array.isArray(value) ? value : [value];
27444
+ function assertArray(val2) {
27445
+ return Array.isArray(val2) ? val2 : [val2];
28629
27446
  }
28630
27447
  __name(assertArray, "assertArray");
28631
- function zeroArray(array, length) {
28632
- for (let i = 0; i < length; i++) {
28633
- if (typeof array[i] !== "number") {
28634
- array[i] = 0;
27448
+ function zeroArray(arr, length) {
27449
+ for (var i = 0; i < length; i++) {
27450
+ if (typeof arr[i] !== "number") {
27451
+ arr[i] = 0;
28635
27452
  }
28636
27453
  }
28637
- return array;
27454
+ return arr;
28638
27455
  }
28639
27456
  __name(zeroArray, "zeroArray");
28640
27457
  var color = Color;