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