PromoCursed/node_modules/.cache/babel-loader/facc2401de17ec428781b83b71b09e536bc182da1cfa06f7b9f0d68f80a68214.json

1 line
128 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _createForOfIteratorHelper from \"@babel/runtime/helpers/esm/createForOfIteratorHelper\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _class, _class2;\n// Copyright (c) Project Nayuki. (MIT License)\n// https://www.nayuki.io/page/qr-code-generator-library\n\n// Modification with code reorder and prettier\n\n// --------------------------------------------\n\n// Appends the given number of low-order bits of the given value\n// to the given buffer. Requires 0 <= len <= 31 and 0 <= val < 2^len.\nfunction appendBits(val, len, bb) {\n if (len < 0 || len > 31 || val >>> len != 0) throw new RangeError('Value out of range');\n for (var i = len - 1; i >= 0; i-- // Append bit by bit\n ) bb.push(val >>> i & 1);\n}\n\n// Returns true iff the i'th bit of x is set to 1.\nfunction getBit(x, i) {\n return (x >>> i & 1) != 0;\n}\n\n// Throws an exception if the given condition is false.\nfunction assert(cond) {\n if (!cond) throw new Error('Assertion error');\n}\n\n/*---- Public helper enumeration ----*/\n/*\n * Describes how a segment's data bits are numbererpreted. Immutable.\n */\nexport var Mode = /*#__PURE__*/function () {\n function Mode(modeBits, numBitsCharCount) {\n _classCallCheck(this, Mode);\n /*-- Constructor and fields --*/\n // The mode indicator bits, which is a unumber4 value (range 0 to 15).\n _defineProperty(this, \"modeBits\", void 0);\n // Number of character count bits for three different version ranges.\n _defineProperty(this, \"numBitsCharCount\", void 0);\n this.modeBits = modeBits;\n this.numBitsCharCount = numBitsCharCount;\n }\n\n /*-- Method --*/\n\n // (Package-private) Returns the bit width of the character count field for a segment in\n // this mode in a QR Code at the given version number. The result is in the range [0, 16].\n _createClass(Mode, [{\n key: \"numCharCountBits\",\n value: function numCharCountBits(ver) {\n return this.numBitsCharCount[Math.floor((ver + 7) / 17)];\n }\n }]);\n return Mode;\n}();\n\n/*---- Public helper enumeration ----*/\n\n/*\n * The error correction level in a QR Code symbol. Immutable.\n */\n_class = Mode;\n/*-- Constants --*/\n_defineProperty(Mode, \"NUMERIC\", new _class(0x1, [10, 12, 14]));\n_defineProperty(Mode, \"ALPHANUMERIC\", new _class(0x2, [9, 11, 13]));\n_defineProperty(Mode, \"BYTE\", new _class(0x4, [8, 16, 16]));\n_defineProperty(Mode, \"KANJI\", new _class(0x8, [8, 10, 12]));\n_defineProperty(Mode, \"ECI\", new _class(0x7, [0, 0, 0]));\nexport var Ecc = /*#__PURE__*/_createClass(function Ecc(ordinal, formatBits) {\n _classCallCheck(this, Ecc);\n // The QR Code can tolerate about 30% erroneous codewords\n /*-- Constructor and fields --*/\n // In the range 0 to 3 (unsigned 2-bit numbereger).\n _defineProperty(this, \"ordinal\", void 0);\n // (Package-private) In the range 0 to 3 (unsigned 2-bit numbereger).\n _defineProperty(this, \"formatBits\", void 0);\n this.ordinal = ordinal;\n this.formatBits = formatBits;\n});\n\n/*\n * A segment of character/binary/control data in a QR Code symbol.\n * Instances of this class are immutable.\n * The mid-level way to create a segment is to take the payload data\n * and call a static factory function such as QrSegment.makeNumeric().\n * The low-level way to create a segment is to custom-make the bit buffer\n * and call the QrSegment() constructor with appropriate values.\n * This segment class imposes no length restrictions, but QR Codes have restrictions.\n * Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.\n * Any segment longer than this is meaningless for the purpose of generating QR Codes.\n */\n_class2 = Ecc;\n/*-- Constants --*/\n_defineProperty(Ecc, \"LOW\", new _class2(0, 1));\n// The QR Code can tolerate about 7% erroneous codewords\n_defineProperty(Ecc, \"MEDIUM\", new _class2(1, 0));\n// The QR Code can to