{"version":3,"file":"index.mjs","sources":["../src/encode/QrCodeMatrix.ts","../src/encode/QrCodedText.ts","../src/utils/SvgUtils.ts","../src/style/QrColor.ts","../src/style/shapes/QrBackground.ts","../src/style/shapes/QrPixelShape.ts","../src/style/shapes/QrEyeShape.ts","../src/utils/Neighbors.ts","../src/style/shapes/QrEyeFrameShape.ts","../src/style/shapes/QrLogoShape.ts","../src/style/shapes/QrMatrixPixelShape.ts","../src/style/shapes/QrShape.ts","../src/style/shapes/QrTimingLineShape.ts","../src/options/QrShapes.ts","../src/style/shapes/QrAlignmentPatternShape.ts","../src/mapper/QrShapesMapper.ts","../src/options/QrOptions.ts","../src/style/QrShapesDesigner.ts","../src/encode/QrData.ts","../src/mapper/QrDataMapper.ts","../src/core/QrCodeGenerator.ts"],"sourcesContent":["import type { QrCodedText } from \"./QrCodedText\";\n\nexport enum PixelType {\n  DarkPixel = \"DarkPixel\",\n  Background = \"Background\",\n}\n\n/**\n * Represents a matrix with pixel types for QrCode.\n * The matrix is now a 2D array.\n */\nexport class QrCodeMatrix {\n  private matrix: PixelType[][];\n  public size: number;\n  public origin = 0;\n\n  constructor(size: number) {\n    this.size = size;\n    this.matrix = Array.from({ length: size }, () =>\n      Array(size).fill(PixelType.Background),\n    );\n  }\n\n  /**\n   * Retrieves the pixel type at a given position (i, j).\n   * Throws an error if the indices are out of bounds.\n   */\n  get(i: number, j: number): PixelType {\n    if (this.isOutOfBounds(i, j)) {\n      throw new RangeError(\n        `Index (${i}, ${j}) is out of bounds for a matrix of size ${this.size}.`,\n      );\n    }\n    return this.matrix[i]![j]!;\n  }\n\n  /**\n   * Sets the pixel type at a given position (i, j).\n   * Throws an error if the indices are out of bounds.\n   */\n  set(i: number, j: number, type: PixelType): void {\n    if (this.isOutOfBounds(i, j)) {\n      throw new RangeError(\n        `Index (${i}, ${j}) is out of bounds for a matrix of size ${this.size}.`,\n      );\n    }\n    this.matrix[i]![j] = type;\n  }\n\n  /**\n   * Checks if the given indices are out of bounds.\n   */\n  isOutOfBounds(i: number, j: number): boolean {\n    return i < 0 || i >= this.size || j < 0 || j >= this.size;\n  }\n\n  /**\n   * Converts a byte matrix (base QrCode) into a QrCodeMatrix with pixel types.\n   * Ensures that the input matrix is square.\n   */\n  static fromQrMatrix(byteMatrix: QrCodedText): QrCodeMatrix {\n    const { size } = byteMatrix;\n    const qrMatrix = new QrCodeMatrix(size);\n\n    for (let i = 0; i < size; i++) {\n      for (let j = 0; j < size; j++) {\n        const value = byteMatrix.getModule(i, j);\n        qrMatrix.set(i, j, value ? PixelType.DarkPixel : PixelType.Background);\n      }\n    }\n    return qrMatrix;\n  }\n}\n","type bit = number;\ntype byte = number;\ntype int = number;\n\n/*---- QR Code symbol class ----*/\n\n/*\n * A QR Code symbol, which is a type of two-dimension barcode.\n * Invented by Denso Wave and described in the ISO/IEC 18004 standard.\n * Instances of this class represent an immutable square grid of dark and light cells.\n * The class provides static factory functions to create a QR Code from text or binary data.\n * The class covers the QR Code Model 2 specification, supporting all versions (sizes)\n * from 1 to 40, all 4 error correction levels, and 4 character encoding modes.\n *\n * Ways to create a QR Code object:\n * - High level: Take the payload data and call QrCode.encodeText() or QrCode.encodeBinary().\n * - Mid level: Custom-make the list of segments and call QrCode.encodeSegments().\n * - Low level: Custom-make the array of data codeword bytes (including\n *   segment headers and final padding, excluding error correction codewords),\n *   supply the appropriate version number, and call the QrCode() constructor.\n * (Note that all ways require supplying the desired error correction level.)\n */\nexport class QrCodedText {\n  /*-- Static factory functions (high level) --*/\n\n  // Returns a QR Code representing the given Unicode text string at the given error correction level.\n  // As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer\n  // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible\n  // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the\n  // ecl argument if it can be done without increasing the version.\n  public static encodeText(\n    text: string,\n    ecl: QrErrorCorrectionLevel,\n  ): QrCodedText {\n    const segs: Array<QrSegment> = QrSegment.makeSegments(text);\n    return QrCodedText.encodeSegments(segs, ecl);\n  }\n\n  /*-- Static factory functions (mid level) --*/\n\n  // Returns a QR Code representing the given segments with the given encoding parameters.\n  // The smallest possible QR Code version within the given range is automatically\n  // chosen for the output. Iff boostEcl is true, then the ECC level of the result\n  // may be higher than the ecl argument if it can be done without increasing the\n  // version. The mask number is either between 0 to 7 (inclusive) to force that\n  // mask, or -1 to automatically choose an appropriate mask (which may be slow).\n  // This function allows the user to create a custom sequence of segments that switches\n  // between modes (such as alphanumeric and byte) to encode text in less space.\n  // This is a mid-level API; the high-level API is encodeText() and encodeBinary().\n  public static encodeSegments(\n    segs: Readonly<Array<QrSegment>>,\n    ecl: QrErrorCorrectionLevel,\n    minVersion: int = 1,\n    maxVersion: int = 40,\n    mask: int = -1,\n    boostEcl: boolean = true,\n  ): QrCodedText {\n    if (\n      !(\n        QrCodedText.MIN_VERSION <= minVersion &&\n        minVersion <= maxVersion &&\n        maxVersion <= QrCodedText.MAX_VERSION\n      ) ||\n      mask < -1 ||\n      mask > 7\n    )\n      throw new RangeError(\"Invalid value\");\n\n    // Find the minimal version number to use\n    let version: int;\n    let dataUsedBits: int;\n    for (version = minVersion; ; version++) {\n      const dataCapacityBits: int =\n        QrCodedText.getNumDataCodewords(version, ecl) * 8; // Number of data bits available\n      const usedBits: number = QrSegment.getTotalBits(segs, version);\n      if (usedBits <= dataCapacityBits) {\n        dataUsedBits = usedBits;\n        break; // This version number is found to be suitable\n      }\n      if (version >= maxVersion)\n        // All versions in the range could not fit the given data\n        throw new RangeError(\"Data too long\");\n    }\n\n    // Increase the error correction level while the data still fits in the current version number\n    for (const newEcl of [\n      QrErrorCorrectionLevel.MEDIUM,\n      QrErrorCorrectionLevel.QUARTILE,\n      QrErrorCorrectionLevel.HIGH,\n    ]) {\n      // From low to high\n      if (\n        boostEcl &&\n        dataUsedBits <= QrCodedText.getNumDataCodewords(version, newEcl) * 8\n      )\n        ecl = newEcl;\n    }\n\n    // Concatenate all segments to create the data bit string\n    const bb: Array<bit> = [];\n    for (const seg of segs) {\n      appendBits(seg.mode.modeBits, 4, bb);\n      appendBits(seg.numChars, seg.mode.numCharCountBits(version), bb);\n      for (const b of seg.getData()) bb.push(b);\n    }\n    assert(bb.length == dataUsedBits);\n\n    // Add terminator and pad up to a byte if applicable\n    const dataCapacityBits: int =\n      QrCodedText.getNumDataCodewords(version, ecl) * 8;\n    assert(bb.length <= dataCapacityBits);\n    appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);\n    appendBits(0, (8 - (bb.length % 8)) % 8, bb);\n    assert(bb.length % 8 == 0);\n\n    // Pad with alternating bytes until data capacity is reached\n    for (\n      let padByte = 0xec;\n      bb.length < dataCapacityBits;\n      padByte ^= 0xec ^ 0x11\n    )\n      appendBits(padByte, 8, bb);\n\n    // Pack bits into bytes in big endian\n    const dataCodewords: Array<byte> = [];\n    while (dataCodewords.length * 8 < bb.length) dataCodewords.push(0);\n    bb.forEach(\n      (b: bit, i: int) =>\n        (dataCodewords[i >>> 3] =\n          (dataCodewords[i >>> 3] ?? 0) | (b << (7 - (i & 7)))),\n    );\n\n    // Create the QR Code object\n    return new QrCodedText(version, ecl, dataCodewords, mask);\n  }\n\n  /*-- Fields --*/\n\n  // The width and height of this QR Code, measured in modules, between\n  // 21 and 177 (inclusive). This is equal to version * 4 + 17.\n  public readonly size: int;\n\n  // The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).\n  // Even if a QR Code is created with automatic masking requested (mask = -1),\n  // the resulting object still has a mask value between 0 and 7.\n  public readonly mask: int;\n\n  // The modules of this QR Code (false = light, true = dark).\n  // Immutable after constructor finishes. Accessed through getModule().\n  public readonly modules: Array<Array<boolean>> = [];\n\n  // Indicates function modules that are not subjected to masking. Discarded when constructor finishes.\n  private readonly isFunction: Array<Array<boolean>> = [];\n\n  /*-- Constructor (low level) and fields --*/\n\n  // Creates a new QR Code with the given version number,\n  // error correction level, data codeword bytes, and mask number.\n  // This is a low-level API that most users should not use directly.\n  // A mid-level API is the encodeSegments() function.\n  public constructor(\n    // The version number of this QR Code, which is between 1 and 40 (inclusive).\n    // This determines the size of this barcode.\n    public readonly version: int,\n\n    // The error correction level used in this QR Code.\n    public readonly errorCorrectionLevel: QrErrorCorrectionLevel,\n\n    dataCodewords: Readonly<Array<byte>>,\n\n    msk: int,\n  ) {\n    // Check scalar arguments\n    if (version < QrCodedText.MIN_VERSION || version > QrCodedText.MAX_VERSION)\n      throw new RangeError(\"Version value out of range\");\n    if (msk < -1 || msk > 7) throw new RangeError(\"Mask value out of range\");\n    this.size = version * 4 + 17;\n\n    // Initialize both grids to be size*size arrays of Boolean false\n    const row: Array<boolean> = [];\n    for (let i = 0; i < this.size; i++) row.push(false);\n    for (let i = 0; i < this.size; i++) {\n      this.modules.push(row.slice()); // Initially all light\n      this.isFunction.push(row.slice());\n    }\n\n    // Compute ECC, draw modules\n    this.drawFunctionPatterns();\n    const allCodewords: Array<byte> = this.addEccAndInterleave(dataCodewords);\n    this.drawCodewords(allCodewords);\n\n    // Do masking\n    if (msk == -1) {\n      // Automatically choose best mask\n      let minPenalty: int = 1000000000;\n      for (let i = 0; i < 8; i++) {\n        this.applyMask(i);\n        this.drawFormatBits(i);\n        const penalty: int = this.getPenaltyScore();\n        if (penalty < minPenalty) {\n          msk = i;\n          minPenalty = penalty;\n        }\n        this.applyMask(i); // Undoes the mask due to XOR\n      }\n    }\n    assert(0 <= msk && msk <= 7);\n    this.mask = msk;\n    this.applyMask(msk); // Apply the final choice of mask\n    this.drawFormatBits(msk); // Overwrite old format bits\n\n    this.isFunction = [];\n  }\n\n  /*-- Accessor methods --*/\n\n  // Returns the color of the module (pixel) at the given coordinates, which is false\n  // for light or true for dark. The top left corner has the coordinates (x=0, y=0).\n  // If the given coordinates are out of bounds, then false (light) is returned.\n  public getModule(x: int, y: int): boolean {\n    return (\n      (0 <= x &&\n        x < this.size &&\n        0 <= y &&\n        y < this.size &&\n        this.modules?.[y]?.[x]) ||\n      false\n    );\n  }\n\n  /*-- Private helper methods for constructor: Drawing function modules --*/\n\n  // Reads this object's version field, and draws and marks all function modules.\n  private drawFunctionPatterns(): void {\n    // Draw horizontal and vertical timing patterns\n    for (let i = 0; i < this.size; i++) {\n      this.setFunctionModule(6, i, i % 2 == 0);\n      this.setFunctionModule(i, 6, i % 2 == 0);\n    }\n\n    // Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)\n    this.drawFinderPattern(3, 3);\n    this.drawFinderPattern(this.size - 4, 3);\n    this.drawFinderPattern(3, this.size - 4);\n\n    // Draw numerous alignment patterns\n    const alignPatPos: Array<int> = this.getAlignmentPatternPositions();\n    const numAlign: int = alignPatPos.length;\n    for (let i = 0; i < numAlign; i++) {\n      for (let j = 0; j < numAlign; j++) {\n        // Don't draw on the three finder corners\n        if (\n          !(\n            (i == 0 && j == 0) ||\n            (i == 0 && j == numAlign - 1) ||\n            (i == numAlign - 1 && j == 0)\n          )\n        )\n          this.drawAlignmentPattern(alignPatPos[i]!, alignPatPos[j]!);\n      }\n    }\n\n    // Draw configuration data\n    this.drawFormatBits(0); // Dummy mask value; overwritten later in the constructor\n    this.drawVersion();\n  }\n\n  // Draws two copies of the format bits (with its own error correction code)\n  // based on the given mask and this object's error correction level field.\n  private drawFormatBits(mask: int): void {\n    // Calculate error correction code and pack bits\n    const data: int = (this.errorCorrectionLevel.formatBits << 3) | mask; // errCorrLvl is uint2, mask is uint3\n    let rem: int = data;\n    for (let i = 0; i < 10; i++) rem = (rem << 1) ^ ((rem >>> 9) * 0x537);\n    const bits = ((data << 10) | rem) ^ 0x5412; // uint15\n    assert(bits >>> 15 == 0);\n\n    // Draw first copy\n    for (let i = 0; i <= 5; i++) this.setFunctionModule(8, i, getBit(bits, i));\n    this.setFunctionModule(8, 7, getBit(bits, 6));\n    this.setFunctionModule(8, 8, getBit(bits, 7));\n    this.setFunctionModule(7, 8, getBit(bits, 8));\n    for (let i = 9; i < 15; i++)\n      this.setFunctionModule(14 - i, 8, getBit(bits, i));\n\n    // Draw second copy\n    for (let i = 0; i < 8; i++)\n      this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));\n    for (let i = 8; i < 15; i++)\n      this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));\n    this.setFunctionModule(8, this.size - 8, true); // Always dark\n  }\n\n  // Draws two copies of the version bits (with its own error correction code),\n  // based on this object's version field, iff 7 <= version <= 40.\n  private drawVersion(): void {\n    if (this.version < 7) return;\n\n    // Calculate error correction code and pack bits\n    let rem: int = this.version; // version is uint6, in the range [7, 40]\n    for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n    const bits: int = (this.version << 12) | rem; // uint18\n    assert(bits >>> 18 == 0);\n\n    // Draw two copies\n    for (let i = 0; i < 18; i++) {\n      const color: boolean = getBit(bits, i);\n      const a: int = this.size - 11 + (i % 3);\n      const b: int = Math.floor(i / 3);\n      this.setFunctionModule(a, b, color);\n      this.setFunctionModule(b, a, color);\n    }\n  }\n\n  // Draws a 9*9 finder pattern including the border separator,\n  // with the center module at (x, y). Modules can be out of bounds.\n  private drawFinderPattern(x: int, y: int): void {\n    for (let dy = -4; dy <= 4; dy++) {\n      for (let dx = -4; dx <= 4; dx++) {\n        const dist: int = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm\n        const xx: int = x + dx;\n        const yy: int = y + dy;\n        if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)\n          this.setFunctionModule(xx, yy, dist != 2 && dist != 4);\n      }\n    }\n  }\n\n  // Draws a 5*5 alignment pattern, with the center module\n  // at (x, y). All modules must be in bounds.\n  private drawAlignmentPattern(x: int, y: int): void {\n    for (let dy = -2; dy <= 2; dy++) {\n      for (let dx = -2; dx <= 2; dx++)\n        this.setFunctionModule(\n          x + dx,\n          y + dy,\n          Math.max(Math.abs(dx), Math.abs(dy)) != 1,\n        );\n    }\n  }\n\n  // Sets the color of a module and marks it as a function module.\n  // Only used by the constructor. Coordinates must be in bounds.\n  private setFunctionModule(x: int, y: int, isDark: boolean): void {\n    this.modules[y]![x] = isDark;\n    this.isFunction[y]![x] = true;\n  }\n\n  /*-- Private helper methods for constructor: Codewords and masking --*/\n\n  // Returns a new byte string representing the given data with the appropriate error correction\n  // codewords appended to it, based on this object's version and error correction level.\n  private addEccAndInterleave(data: Readonly<Array<byte>>): Array<byte> {\n    const ver: int = this.version;\n    const ecl: QrErrorCorrectionLevel = this.errorCorrectionLevel;\n    if (data.length != QrCodedText.getNumDataCodewords(ver, ecl))\n      throw new RangeError(\"Invalid argument\");\n\n    // Calculate parameter numbers\n    const numBlocks: int =\n      QrCodedText.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal]![ver]!;\n    const blockEccLen: int =\n      QrCodedText.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal]![ver]!;\n    const rawCodewords: int = Math.floor(\n      QrCodedText.getNumRawDataModules(ver) / 8,\n    );\n    const numShortBlocks: int = numBlocks - (rawCodewords % numBlocks);\n    const shortBlockLen: int = Math.floor(rawCodewords / numBlocks);\n\n    // Split data into blocks and append ECC to each block\n    const blocks: Array<Array<byte>> = [];\n    const rsDiv: Array<byte> =\n      QrCodedText.reedSolomonComputeDivisor(blockEccLen);\n    for (let i = 0, k = 0; i < numBlocks; i++) {\n      const dat: Array<byte> = data.slice(\n        k,\n        k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1),\n      );\n      k += dat.length;\n      const ecc: Array<byte> = QrCodedText.reedSolomonComputeRemainder(\n        dat,\n        rsDiv,\n      );\n      if (i < numShortBlocks) dat.push(0);\n      blocks.push(dat.concat(ecc));\n    }\n\n    // Interleave (not concatenate) the bytes from every block into a single sequence\n    const result: Array<byte> = [];\n    for (let i = 0; i < blocks[0]!.length; i++) {\n      blocks.forEach((block, j) => {\n        // Skip the padding byte in short blocks\n        if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)\n          result.push(block[i]!);\n      });\n    }\n    assert(result.length == rawCodewords);\n    return result;\n  }\n\n  // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire\n  // data area of this QR Code. Function modules need to be marked off before this is called.\n  private drawCodewords(data: Readonly<Array<byte>>): void {\n    if (\n      data.length !=\n      Math.floor(QrCodedText.getNumRawDataModules(this.version) / 8)\n    )\n      throw new RangeError(\"Invalid argument\");\n    let i: int = 0; // Bit index into the data\n    // Do the funny zigzag scan\n    for (let right = this.size - 1; right >= 1; right -= 2) {\n      // Index of right column in each column pair\n      if (right == 6) right = 5;\n      for (let vert = 0; vert < this.size; vert++) {\n        // Vertical counter\n        for (let j = 0; j < 2; j++) {\n          const x: int = right - j; // Actual x coordinate\n          const upward: boolean = ((right + 1) & 2) == 0;\n          const y: int = upward ? this.size - 1 - vert : vert; // Actual y coordinate\n          if (!this.isFunction[y]![x] && i < data.length * 8) {\n            this.modules[y]![x] = getBit(data[i >>> 3]!, 7 - (i & 7));\n            i++;\n          }\n          // If this QR Code has any remainder bits (0 to 7), they were assigned as\n          // 0/false/light by the constructor and are left unchanged by this method\n        }\n      }\n    }\n    assert(i == data.length * 8);\n  }\n\n  // XORs the codeword modules in this QR Code with the given mask pattern.\n  // The function modules must be marked and the codeword bits must be drawn\n  // before masking. Due to the arithmetic of XOR, calling applyMask() with\n  // the same mask value a second time will undo the mask. A final well-formed\n  // QR Code needs exactly one (not zero, two, etc.) mask applied.\n  private applyMask(mask: int): void {\n    if (mask < 0 || mask > 7) throw new RangeError(\"Mask value out of range\");\n    for (let y = 0; y < this.size; y++) {\n      for (let x = 0; x < this.size; x++) {\n        let invert: boolean;\n        switch (mask) {\n          case 0:\n            invert = (x + y) % 2 == 0;\n            break;\n          case 1:\n            invert = y % 2 == 0;\n            break;\n          case 2:\n            invert = x % 3 == 0;\n            break;\n          case 3:\n            invert = (x + y) % 3 == 0;\n            break;\n          case 4:\n            invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;\n            break;\n          case 5:\n            invert = ((x * y) % 2) + ((x * y) % 3) == 0;\n            break;\n          case 6:\n            invert = (((x * y) % 2) + ((x * y) % 3)) % 2 == 0;\n            break;\n          case 7:\n            invert = (((x + y) % 2) + ((x * y) % 3)) % 2 == 0;\n            break;\n          default:\n            throw new Error(\"Unreachable\");\n        }\n        if (!this.isFunction[y]![x] && invert)\n          this.modules[y]![x] = !this.modules[y]![x];\n      }\n    }\n  }\n\n  // Calculates and returns the penalty score based on state of this QR Code's current modules.\n  // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.\n  private getPenaltyScore(): int {\n    let result: int = 0;\n\n    // Adjacent modules in row having same color, and finder-like patterns\n    for (let y = 0; y < this.size; y++) {\n      let runColor = false;\n      let runX = 0;\n      const runHistory = [0, 0, 0, 0, 0, 0, 0];\n      for (let x = 0; x < this.size; x++) {\n        if (this.modules[y]![x] == runColor) {\n          runX++;\n          if (runX == 5) result += QrCodedText.PENALTY_N1;\n          else if (runX > 5) result++;\n        } else {\n          this.finderPenaltyAddHistory(runX, runHistory);\n          if (!runColor)\n            result +=\n              this.finderPenaltyCountPatterns(runHistory) *\n              QrCodedText.PENALTY_N3;\n          runColor = this.modules[y]![x]!;\n          runX = 1;\n        }\n      }\n      result +=\n        this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) *\n        QrCodedText.PENALTY_N3;\n    }\n    // Adjacent modules in column having same color, and finder-like patterns\n    for (let x = 0; x < this.size; x++) {\n      let runColor = false;\n      let runY = 0;\n      const runHistory = [0, 0, 0, 0, 0, 0, 0];\n      for (let y = 0; y < this.size; y++) {\n        if (this.modules[y]![x] == runColor) {\n          runY++;\n          if (runY == 5) result += QrCodedText.PENALTY_N1;\n          else if (runY > 5) result++;\n        } else {\n          this.finderPenaltyAddHistory(runY, runHistory);\n          if (!runColor)\n            result +=\n              this.finderPenaltyCountPatterns(runHistory) *\n              QrCodedText.PENALTY_N3;\n          runColor = this.modules[y]![x]!;\n          runY = 1;\n        }\n      }\n      result +=\n        this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) *\n        QrCodedText.PENALTY_N3;\n    }\n\n    // 2*2 blocks of modules having same color\n    for (let y = 0; y < this.size - 1; y++) {\n      for (let x = 0; x < this.size - 1; x++) {\n        const color: boolean = this.modules[y]![x]!;\n        if (\n          color == this.modules[y]![x + 1] &&\n          color == this.modules[y + 1]![x] &&\n          color == this.modules[y + 1]![x + 1]\n        )\n          result += QrCodedText.PENALTY_N2;\n      }\n    }\n\n    // Balance of dark and light modules\n    let dark: int = 0;\n    for (const row of this.modules)\n      dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);\n    const total: int = this.size * this.size; // Note that size is odd, so dark/total != 1/2\n    // Compute the smallest integer k >= 0 such that (45-5k)% <= dark/total <= (55+5k)%\n    const k: int = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;\n    assert(0 <= k && k <= 9);\n    result += k * QrCodedText.PENALTY_N4;\n    assert(0 <= result && result <= 2568888); // Non-tight upper bound based on default values of PENALTY_N1, ..., N4\n    return result;\n  }\n\n  /*-- Private helper functions --*/\n\n  // Returns an ascending list of positions of alignment patterns for this version number.\n  // Each position is in the range [0,177), and are used on both the x and y axes.\n  // This could be implemented as lookup table of 40 variable-length lists of integers.\n  private getAlignmentPatternPositions(): Array<int> {\n    if (this.version == 1) return [];\n    else {\n      const numAlign: int = Math.floor(this.version / 7) + 2;\n      const step: int =\n        Math.floor((this.version * 8 + numAlign * 3 + 5) / (numAlign * 4 - 4)) *\n        2;\n      const result: Array<int> = [6];\n      for (let pos = this.size - 7; result.length < numAlign; pos -= step)\n        result.splice(1, 0, pos);\n      return result;\n    }\n  }\n\n  // Returns the number of data bits that can be stored in a QR Code of the given version number, after\n  // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.\n  // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.\n  private static getNumRawDataModules(ver: int): int {\n    if (ver < QrCodedText.MIN_VERSION || ver > QrCodedText.MAX_VERSION)\n      throw new RangeError(\"Version number out of range\");\n    let result: int = (16 * ver + 128) * ver + 64;\n    if (ver >= 2) {\n      const numAlign: int = Math.floor(ver / 7) + 2;\n      result -= (25 * numAlign - 10) * numAlign - 55;\n      if (ver >= 7) result -= 36;\n    }\n    assert(208 <= result && result <= 29648);\n    return result;\n  }\n\n  // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any\n  // QR Code of the given version number and error correction level, with remainder bits discarded.\n  // This stateless pure function could be implemented as a (40*4)-cell lookup table.\n  private static getNumDataCodewords(\n    ver: int,\n    ecl: QrErrorCorrectionLevel,\n  ): int {\n    return (\n      Math.floor(QrCodedText.getNumRawDataModules(ver) / 8) -\n      QrCodedText.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal]![ver]! *\n        QrCodedText.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal]![ver]!\n    );\n  }\n\n  // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be\n  // implemented as a lookup table over all possible parameter values, instead of as an algorithm.\n  private static reedSolomonComputeDivisor(degree: int): Array<byte> {\n    if (degree < 1 || degree > 255) throw new RangeError(\"Degree out of range\");\n    // Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1.\n    // For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array [255, 8, 93].\n    const result: Array<byte> = [];\n    for (let i = 0; i < degree - 1; i++) result.push(0);\n    result.push(1); // Start off with the monomial x^0\n\n    // Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),\n    // and drop the highest monomial term which is always 1x^degree.\n    // Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).\n    let root = 1;\n    for (let i = 0; i < degree; i++) {\n      // Multiply the current product by (x - r^i)\n      for (let j = 0; j < result.length; j++) {\n        result[j] = QrCodedText.reedSolomonMultiply(result[j]!, root);\n        if (j + 1 < result.length) result[j]! ^= result[j + 1]!;\n      }\n      root = QrCodedText.reedSolomonMultiply(root, 0x02);\n    }\n    return result;\n  }\n\n  // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.\n  private static reedSolomonComputeRemainder(\n    data: Readonly<Array<byte>>,\n    divisor: Readonly<Array<byte>>,\n  ): Array<byte> {\n    const result: Array<byte> = divisor.map((_) => 0);\n    for (const b of data) {\n      // Polynomial division\n      const factor: byte = b ^ (result.shift() as byte);\n      result.push(0);\n      divisor.forEach(\n        (coef, i) =>\n          (result[i]! ^= QrCodedText.reedSolomonMultiply(coef, factor)),\n      );\n    }\n    return result;\n  }\n\n  // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result\n  // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.\n  private static reedSolomonMultiply(x: byte, y: byte): byte {\n    if (x >>> 8 != 0 || y >>> 8 != 0) throw new RangeError(\"Byte out of range\");\n    // Russian peasant multiplication\n    let z: int = 0;\n    for (let i = 7; i >= 0; i--) {\n      z = (z << 1) ^ ((z >>> 7) * 0x11d);\n      z ^= ((y >>> i) & 1) * x;\n    }\n    assert(z >>> 8 == 0);\n    return z;\n  }\n\n  // Can only be called immediately after a light run is added, and\n  // returns either 0, 1, or 2. A helper function for getPenaltyScore().\n  private finderPenaltyCountPatterns(runHistory: Readonly<Array<int>>): int {\n    const n: int = runHistory[1]!;\n    assert(n <= this.size * 3);\n    const core: boolean =\n      n > 0 &&\n      runHistory[2] == n &&\n      runHistory[3] == n * 3 &&\n      runHistory[4] == n &&\n      runHistory[5] == n;\n    return (\n      (core && runHistory[0]! >= n * 4 && runHistory[6]! >= n ? 1 : 0) +\n      (core && runHistory[6]! >= n * 4 && runHistory[0]! >= n ? 1 : 0)\n    );\n  }\n\n  // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().\n  private finderPenaltyTerminateAndCount(\n    currentRunColor: boolean,\n    currentRunLength: int,\n    runHistory: Array<int>,\n  ): int {\n    if (currentRunColor) {\n      // Terminate dark run\n      this.finderPenaltyAddHistory(currentRunLength, runHistory);\n      currentRunLength = 0;\n    }\n    currentRunLength += this.size; // Add light border to final run\n    this.finderPenaltyAddHistory(currentRunLength, runHistory);\n    return this.finderPenaltyCountPatterns(runHistory);\n  }\n\n  // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().\n  private finderPenaltyAddHistory(\n    currentRunLength: int,\n    runHistory: Array<int>,\n  ): void {\n    if (runHistory[0] == 0) currentRunLength += this.size; // Add light border to initial run\n    runHistory.pop();\n    runHistory.unshift(currentRunLength);\n  }\n\n  /*-- Constants and tables --*/\n\n  // The minimum version number supported in the QR Code Model 2 standard.\n  public static readonly MIN_VERSION: int = 1;\n  // The maximum version number supported in the QR Code Model 2 standard.\n  public static readonly MAX_VERSION: int = 40;\n\n  // For use in getPenaltyScore(), when evaluating which mask is best.\n  private static readonly PENALTY_N1: int = 3;\n  private static readonly PENALTY_N2: int = 3;\n  private static readonly PENALTY_N3: int = 40;\n  private static readonly PENALTY_N4: int = 10;\n\n  private static readonly ECC_CODEWORDS_PER_BLOCK: Array<Array<int>> = [\n    // Version: (note that index 0 is for padding, and is set to an illegal value)\n    //0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40    Error correction level\n    [\n      -1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30,\n      28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,\n      30, 30, 30, 30,\n    ], // Low\n    [\n      -1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28,\n      26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,\n      28, 28, 28, 28, 28,\n    ], // Medium\n    [\n      -1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28,\n      28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30,\n      30, 30, 30, 30, 30,\n    ], // Quartile\n    [\n      -1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28,\n      28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,\n      30, 30, 30, 30, 30,\n    ], // High\n  ];\n\n  private static readonly NUM_ERROR_CORRECTION_BLOCKS: Array<Array<int>> = [\n    // Version: (note that index 0 is for padding, and is set to an illegal value)\n    //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40    Error correction level\n    [\n      -1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9,\n      10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25,\n    ], // Low\n    [\n      -1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17,\n      17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47,\n      49,\n    ], // Medium\n    [\n      -1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20,\n      23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62,\n      65, 68,\n    ], // Quartile\n    [\n      -1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25,\n      25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74,\n      77, 81,\n    ], // High\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: int, len: int, bb: Array<bit>): void {\n  if (len < 0 || len > 31 || val >>> len != 0)\n    throw new RangeError(\"Value out of range\");\n  for (\n    let i = len - 1;\n    i >= 0;\n    i-- // Append bit by bit\n  )\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: int, i: int): boolean {\n  return ((x >>> i) & 1) != 0;\n}\n\n// Throws an exception if the given condition is false.\nfunction assert(cond: boolean): void {\n  if (!cond) throw new Error(\"Assertion error\");\n}\n\n/*---- Data segment class ----*/\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 */\nexport class QrSegment {\n  /*-- Static factory functions (mid level) --*/\n\n  // Returns a segment representing the given binary data encoded in\n  // byte mode. All input byte arrays are acceptable. Any text string\n  // can be converted to UTF-8 bytes and encoded as a byte mode segment.\n  public static makeBytes(data: Readonly<Array<byte>>): QrSegment {\n    const bb: Array<bit> = [];\n    for (const b of data) appendBits(b, 8, bb);\n    return new QrSegment(Mode.BYTE, data.length, bb);\n  }\n\n  // Returns a segment representing the given string of decimal digits encoded in numeric mode.\n  public static makeNumeric(digits: string): QrSegment {\n    if (!QrSegment.isNumeric(digits))\n      throw new RangeError(\"String contains non-numeric characters\");\n    const bb: Array<bit> = [];\n    for (let i = 0; i < digits.length; ) {\n      // Consume up to 3 digits per iteration\n      const n: int = Math.min(digits.length - i, 3);\n      appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);\n      i += n;\n    }\n    return new QrSegment(Mode.NUMERIC, digits.length, bb);\n  }\n\n  // Returns a segment representing the given text string encoded in alphanumeric mode.\n  // The characters allowed are: 0 to 9, A to Z (uppercase only), space,\n  // dollar, percent, asterisk, plus, hyphen, period, slash, colon.\n  public static makeAlphanumeric(text: string): QrSegment {\n    if (!QrSegment.isAlphanumeric(text))\n      throw new RangeError(\n        \"String contains unencodable characters in alphanumeric mode\",\n      );\n    const bb: Array<bit> = [];\n    let i: int;\n    for (i = 0; i + 2 <= text.length; i += 2) {\n      // Process groups of 2\n      let temp: int =\n        QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;\n      temp += QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));\n      appendBits(temp, 11, bb);\n    }\n    if (i < text.length)\n      // 1 character remaining\n      appendBits(QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);\n    return new QrSegment(Mode.ALPHANUMERIC, text.length, bb);\n  }\n\n  // Returns a new mutable list of zero or more segments to represent the given Unicode text string.\n  // The result may use various segment modes and switch modes to optimize the length of the bit stream.\n  public static makeSegments(text: string): Array<QrSegment> {\n    // Select the most efficient segment encoding automatically\n    if (text == \"\") return [];\n    else if (QrSegment.isNumeric(text)) return [QrSegment.makeNumeric(text)];\n    else if (QrSegment.isAlphanumeric(text))\n      return [QrSegment.makeAlphanumeric(text)];\n    else return [QrSegment.makeBytes(QrSegment.toUtf8ByteArray(text))];\n  }\n\n  // Returns a segment representing an Extended Channel Interpretation\n  // (ECI) designator with the given assignment value.\n  public static makeEci(assignVal: int): QrSegment {\n    const bb: Array<bit> = [];\n    if (assignVal < 0)\n      throw new RangeError(\"ECI assignment value out of range\");\n    else if (assignVal < 1 << 7) appendBits(assignVal, 8, bb);\n    else if (assignVal < 1 << 14) {\n      appendBits(0b10, 2, bb);\n      appendBits(assignVal, 14, bb);\n    } else if (assignVal < 1000000) {\n      appendBits(0b110, 3, bb);\n      appendBits(assignVal, 21, bb);\n    } else throw new RangeError(\"ECI assignment value out of range\");\n    return new QrSegment(Mode.ECI, 0, bb);\n  }\n\n  // Tests whether the given string can be encoded as a segment in numeric mode.\n  // A string is encodable iff each character is in the range 0 to 9.\n  public static isNumeric(text: string): boolean {\n    return QrSegment.NUMERIC_REGEX.test(text);\n  }\n\n  // Tests whether the given string can be encoded as a segment in alphanumeric mode.\n  // A string is encodable iff each character is in the following set: 0 to 9, A to Z\n  // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.\n  public static isAlphanumeric(text: string): boolean {\n    return QrSegment.ALPHANUMERIC_REGEX.test(text);\n  }\n\n  /*-- Constructor (low level) and fields --*/\n\n  // Creates a new QR Code segment with the given attributes and data.\n  // The character count (numChars) must agree with the mode and the bit buffer length,\n  // but the constraint isn't checked. The given bit buffer is cloned and stored.\n  public constructor(\n    // The mode indicator of this segment.\n    public readonly mode: Mode,\n\n    // The length of this segment's unencoded data. Measured in characters for\n    // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.\n    // Always zero or positive. Not the same as the data's bit length.\n    public readonly numChars: int,\n\n    // The data bits of this segment. Accessed through getData().\n    private readonly bitData: Array<bit>,\n  ) {\n    if (numChars < 0) throw new RangeError(\"Invalid argument\");\n    this.bitData = bitData.slice(); // Make defensive copy\n  }\n\n  /*-- Methods --*/\n\n  // Returns a new copy of the data bits of this segment.\n  public getData(): Array<bit> {\n    return this.bitData.slice(); // Make defensive copy\n  }\n\n  // (Package-private) Calculates and returns the number of bits needed to encode the given segments at\n  // the given version. The result is infinity if a segment has too many characters to fit its length field.\n  public static getTotalBits(\n    segs: Readonly<Array<QrSegment>>,\n    version: int,\n  ): number {\n    let result: number = 0;\n    for (const seg of segs) {\n      const ccbits: int = seg.mode.numCharCountBits(version);\n      if (seg.numChars >= 1 << ccbits) return Infinity; // The segment's length doesn't fit the field's bit width\n      result += 4 + ccbits + seg.bitData.length;\n    }\n    return result;\n  }\n\n  // Returns a new array of bytes representing the given string encoded in UTF-8.\n  private static toUtf8ByteArray(str: string): Array<byte> {\n    str = encodeURI(str);\n    const result: Array<byte> = [];\n    for (let i = 0; i < str.length; i++) {\n      if (str.charAt(i) != \"%\") result.push(str.charCodeAt(i));\n      else {\n        result.push(parseInt(str.substring(i + 1, i + 3), 16));\n        i += 2;\n      }\n    }\n    return result;\n  }\n\n  /*-- Constants --*/\n\n  // Describes precisely all strings that are encodable in numeric mode.\n  private static readonly NUMERIC_REGEX: RegExp = /^[0-9]*$/;\n\n  // Describes precisely all strings that are encodable in alphanumeric mode.\n  private static readonly ALPHANUMERIC_REGEX: RegExp = /^[A-Z0-9 $%*+./:-]*$/;\n\n  // The set of all legal characters in alphanumeric mode,\n  // where each character value maps to the index in the string.\n  private static readonly ALPHANUMERIC_CHARSET: string =\n    \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:\";\n}\n\n/*\n * The error correction level in a QR Code symbol. Immutable.\n */\n\nexport type QrErrorCorrectionLevelConfig =\n  | \"LOW\"\n  | \"MEDIUM\"\n  | \"QUARTILE\"\n  | \"HIGH\";\nexport class QrErrorCorrectionLevel {\n  /*-- Constants --*/\n\n  public static readonly LOW = new QrErrorCorrectionLevel(0, 1); // The QR Code can tolerate about  7% erroneous codewords\n  public static readonly MEDIUM = new QrErrorCorrectionLevel(1, 0); // The QR Code can tolerate about 15% erroneous codewords\n  public static readonly QUARTILE = new QrErrorCorrectionLevel(2, 3); // The QR Code can tolerate about 25% erroneous codewords\n  public static readonly HIGH = new QrErrorCorrectionLevel(3, 2); // The QR Code can tolerate about 30% erroneous codewords\n\n  /*-- Constructor and fields --*/\n\n  private constructor(\n    // In the range 0 to 3 (unsigned 2-bit integer).\n    public readonly ordinal: int,\n    // (Package-private) In the range 0 to 3 (unsigned 2-bit integer).\n    public readonly formatBits: int,\n  ) {}\n\n  public static fromString(\n    level: QrErrorCorrectionLevelConfig,\n  ): QrErrorCorrectionLevel {\n    switch (level) {\n      case \"LOW\":\n        return QrErrorCorrectionLevel.LOW;\n      case \"MEDIUM\":\n        return QrErrorCorrectionLevel.MEDIUM;\n      case \"QUARTILE\":\n        return QrErrorCorrectionLevel.QUARTILE;\n      case \"HIGH\":\n        return QrErrorCorrectionLevel.HIGH;\n    }\n  }\n}\n\n/*\n * Describes how a segment's data bits are interpreted. Immutable.\n */\nexport class Mode {\n  /*-- Constants --*/\n\n  public static readonly NUMERIC = new Mode(0x1, [10, 12, 14]);\n  public static readonly ALPHANUMERIC = new Mode(0x2, [9, 11, 13]);\n  public static readonly BYTE = new Mode(0x4, [8, 16, 16]);\n  public static readonly KANJI = new Mode(0x8, [8, 10, 12]);\n  public static readonly ECI = new Mode(0x7, [0, 0, 0]);\n\n  /*-- Constructor and fields --*/\n\n  private constructor(\n    // The mode indicator bits, which is a uint4 value (range 0 to 15).\n    public readonly modeBits: int,\n    // Number of character count bits for three different version ranges.\n    private readonly numBitsCharCount: [int, int, int],\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  public numCharCountBits(ver: int): int {\n    return this.numBitsCharCount[Math.floor((ver + 7) / 17)]!;\n  }\n}\n","export const SVG_NS = \"http://www.w3.org/2000/svg\";\n\n/**\n * Takes a string representing the SVG path data\n * and creates an SVG `<path>` element with the provided data.\n */\nexport function createSvgPathFromString(pathData: string): SVGPathElement {\n  const pathElement = document.createElementNS(SVG_NS, \"path\");\n  pathElement.setAttribute(\"d\", pathData);\n  return pathElement;\n}\n\n/**\n * Takes an array of SVG elements and creates an SVG `<g>` (group) element.\n * All provided elements are appended as children of the group element.\n */\nexport function createSvgGroupFromElements(\n  elements: SVGElement[],\n): SVGGElement {\n  const groupElement = document.createElementNS(SVG_NS, \"g\");\n  for (const element of elements) {\n    groupElement.appendChild(element);\n  }\n  return groupElement;\n}\n\n/**\n * Retrieves the `<defs>` element from the provided SVG element.\n * If no `<defs>` element exists, it creates one and inserts it as the first child of the SVG.\n */\nexport function getDefsElement(mainSvg: SVGElement): SVGDefsElement {\n  let defs = mainSvg.querySelector(\"defs\");\n  if (defs === null) {\n    defs = document.createElementNS(SVG_NS, \"defs\");\n    mainSvg.insertBefore(defs, mainSvg.firstChild);\n  }\n  return defs;\n}\n\n// Increase the viewbox size to reduce the QR code size\nexport function computeViewBoxIncrease(\n  codeMatrixSize: number,\n  sizeRatio: number,\n): number {\n  return codeMatrixSize * ((1 - sizeRatio) / sizeRatio);\n}\n","import { getDefsElement } from \"../utils/SvgUtils\";\n\n/**\n * Interface representing a QR vector color for SVG.\n */\ninterface IQrColor {\n  applyToElement(element: SVGElement, mainSvg: SVGElement): void;\n}\n\n/**\n * Solid color class.\n */\nclass Solid implements IQrColor {\n  constructor(private color: string) {}\n\n  applyToElement(element: SVGElement): void {\n    element.setAttribute(\"fill\", this.color);\n  }\n}\n\n/**\n * Linear gradient class for SVG.\n */\nclass LinearGradient implements IQrColor {\n  private gradientId = `gradient-linear-${Math.random().toString(36).slice(2, 11)}`;\n\n  constructor(\n    private colors: Array<[number, string]>,\n    private orientation: LinearGradientOrientation,\n  ) {}\n\n  applyToElement(element: SVGElement, mainSvg: SVGElement): void {\n    const defs = getDefsElement(mainSvg);\n    if (!defs.querySelector(`#${this.gradientId}`)) {\n      const gradientElement = this.createGradientElement();\n      this.colors.forEach(([offset, color]) =>\n        this.appendStopElement(gradientElement, offset, color),\n      );\n      defs.appendChild(gradientElement);\n    }\n    element.setAttribute(\"fill\", `url(#${this.gradientId})`);\n  }\n\n  private createGradientElement() {\n    const { start, end } = this.orientation;\n    const gradientElement = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"linearGradient\",\n    );\n    gradientElement.setAttribute(\"id\", this.gradientId);\n    gradientElement.setAttribute(\"gradientUnits\", \"userSpaceOnUse\");\n    gradientElement.setAttribute(\"x1\", start[0].toString());\n    gradientElement.setAttribute(\"y1\", start[1].toString());\n    gradientElement.setAttribute(\"x2\", end[0].toString());\n    gradientElement.setAttribute(\"y2\", end[1].toString());\n    return gradientElement;\n  }\n\n  private appendStopElement(\n    gradientElement: SVGElement,\n    offset: number,\n    color: string,\n  ) {\n    const stopElement = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"stop\",\n    );\n    stopElement.setAttribute(\"offset\", `${offset * 100}%`);\n    stopElement.setAttribute(\"stop-color\", color);\n    gradientElement.appendChild(stopElement);\n  }\n}\n\n/**\n * Radial gradient class for SVG.\n */\nclass RadialGradient implements IQrColor {\n  private gradientId = `gradient-radial-${Math.random().toString(36).slice(2, 11)}`;\n\n  constructor(\n    private colors: Array<[number, string]>,\n    private radius: number = Math.sqrt(2),\n  ) {}\n\n  applyToElement(element: SVGElement, mainSvg: SVGElement): void {\n    const defs = getDefsElement(mainSvg);\n    const gradientElement = this.createGradientElement();\n    this.colors.forEach(([offset, color]) =>\n      this.appendStopElement(gradientElement, offset, color),\n    );\n    defs.appendChild(gradientElement);\n    element.setAttribute(\"fill\", `url(#${this.gradientId})`);\n  }\n\n  private createGradientElement() {\n    const gradientElement = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"radialGradient\",\n    );\n    gradientElement.setAttribute(\"id\", this.gradientId);\n    gradientElement.setAttribute(\"cx\", \"0.5\");\n    gradientElement.setAttribute(\"cy\", \"0.5\");\n    gradientElement.setAttribute(\"r\", `${this.radius * 50}%`);\n    return gradientElement;\n  }\n\n  private appendStopElement(\n    gradientElement: SVGElement,\n    offset: number,\n    color: string,\n  ) {\n    const stopElement = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"stop\",\n    );\n    stopElement.setAttribute(\"offset\", `${offset * 100}%`);\n    stopElement.setAttribute(\"stop-color\", color);\n    gradientElement.appendChild(stopElement);\n  }\n}\n\n/**\n * Sweep (circular) gradient class for SVG.\n */\nclass SweepGradient implements IQrColor {\n  private gradientId = `gradient-sweep-${Math.random().toString(36).slice(2, 11)}`;\n\n  constructor(private colors: Array<[number, string]>) {}\n\n  applyToElement(element: SVGElement, mainSvg: SVGElement): void {\n    const defs = getDefsElement(mainSvg);\n    const gradientElement = this.createGradientElement();\n    this.colors.forEach(([offset, color]) =>\n      this.appendStopElement(gradientElement, offset, color),\n    );\n    defs.appendChild(gradientElement);\n    element.setAttribute(\"fill\", `url(#${this.gradientId})`);\n  }\n\n  private createGradientElement() {\n    const gradientElement = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"radialGradient\",\n    );\n    gradientElement.setAttribute(\"id\", this.gradientId);\n    gradientElement.setAttribute(\"cx\", \"0.5\");\n    gradientElement.setAttribute(\"cy\", \"0.5\");\n    gradientElement.setAttribute(\"r\", \"0.5\");\n    return gradientElement;\n  }\n\n  private appendStopElement(\n    gradientElement: SVGElement,\n    offset: number,\n    color: string,\n  ) {\n    const stopElement = document.createElementNS(\n      \"http://www.w3.org/2000/svg\",\n      \"stop\",\n    );\n    stopElement.setAttribute(\"offset\", `${offset * 100}%`);\n    stopElement.setAttribute(\"stop-color\", color);\n    gradientElement.appendChild(stopElement);\n  }\n}\n\nexport type LinearGradientOrientationConfig =\n  | \"Vertical\"\n  | \"Horizontal\"\n  | \"LeftDiagonal\"\n  | \"RightDiagonal\";\nclass LinearGradientOrientation {\n  constructor(\n    public start: [string, string],\n    public end: [string, string],\n  ) {}\n\n  static Vertical = new LinearGradientOrientation(\n    [\"50%\", \"0%\"],\n    [\"50%\", \"100%\"],\n  );\n  static Horizontal = new LinearGradientOrientation(\n    [\"0%\", \"50%\"],\n    [\"100%\", \"50%\"],\n  );\n  static LeftDiagonal = new LinearGradientOrientation(\n    [\"0%\", \"0%\"],\n    [\"100%\", \"100%\"],\n  );\n  static RightDiagonal = new LinearGradientOrientation(\n    [\"100%\", \"0%\"],\n    [\"0%\", \"100%\"],\n  );\n\n  static fromString(\n    orientation: LinearGradientOrientationConfig,\n  ): LinearGradientOrientation {\n    switch (orientation) {\n      case \"Vertical\":\n        return LinearGradientOrientation.Vertical;\n      case \"Horizontal\":\n        return LinearGradientOrientation.Horizontal;\n      case \"LeftDiagonal\":\n        return LinearGradientOrientation.LeftDiagonal;\n      case \"RightDiagonal\":\n        return LinearGradientOrientation.RightDiagonal;\n    }\n  }\n}\n\nconst QrColor = {\n  Solid,\n  LinearGradient,\n  RadialGradient,\n  SweepGradient,\n};\n\n// Exports\nexport type { IQrColor };\nexport { QrColor, LinearGradientOrientation };\n","import { getDefsElement, SVG_NS } from \"../../utils/SvgUtils\";\nimport { QrColor, type IQrColor } from \"../QrColor\";\nimport type { IQrSVGWithImage } from \"../SVGInterfaces\";\n\n// Class representing a vector background for a QR code\nexport class QrBackground implements IQrSVGWithImage {\n  constructor(\n    public imageData: string | null = null,\n    public sizeRatio: number = 1,\n    public padding: number = 0,\n    public color: IQrColor = new QrColor.Solid(\"black\"),\n  ) {}\n\n  createSvgElement(mainSvg: SVGElement): SVGElement {\n    const rect = this.createBaseRect();\n    const defs = getDefsElement(mainSvg);\n\n    if (this.imageData) {\n      this.createPattern(this.imageData, defs, mainSvg); // No need to assign 'pattern' to a variable\n      rect.setAttribute(\"fill\", `url(#${this.imageData})`);\n    } else {\n      this.color.applyToElement(rect, mainSvg);\n    }\n\n    return rect;\n  }\n\n  // Create the base rectangle that covers the full QR code area\n  private createBaseRect(): SVGElement {\n    const rect = document.createElementNS(SVG_NS, \"rect\");\n    rect.setAttribute(\"x\", \"0\");\n    rect.setAttribute(\"y\", \"0\");\n    rect.setAttribute(\"width\", \"100%\");\n    rect.setAttribute(\"height\", \"100%\");\n    return rect;\n  }\n\n  // Create the pattern element if image data is provided\n  private createPattern(\n    imageData: string,\n    defs: SVGElement,\n    mainSvg: SVGElement,\n  ): void {\n    const pattern = document.createElementNS(SVG_NS, \"pattern\");\n    pattern.setAttribute(\"id\", imageData);\n    pattern.setAttribute(\"patternUnits\", \"userSpaceOnUse\");\n    pattern.setAttribute(\"width\", \"100%\");\n    pattern.setAttribute(\"height\", \"100%\");\n\n    const bgRect = this.createBaseRect();\n    this.color.applyToElement(bgRect, mainSvg);\n\n    const image = this.createImageElement(imageData);\n    pattern.appendChild(bgRect);\n    pattern.appendChild(image);\n    defs.appendChild(pattern); // Pattern is directly appended, no need for a variable\n  }\n\n  // Create the image element for the background pattern\n  private createImageElement(imageData: string): SVGElement {\n    const image = document.createElementNS(SVG_NS, \"image\");\n    image.setAttribute(\"href\", imageData);\n    image.setAttribute(\"x\", \"0\");\n    image.setAttribute(\"y\", \"0\");\n    image.setAttribute(\"width\", \"100%\");\n    image.setAttribute(\"height\", \"100%\");\n    image.setAttribute(\"preserveAspectRatio\", \"xMidYMid slice\");\n    return image;\n  }\n}\n","import type { Neighbors } from \"../../utils/Neighbors\";\n\n/**\n * Interface to define the shape of the vector QR pixels.\n */\ninterface IQrPixelShape {\n  createSvgElement(\n    x: number,\n    y: number,\n    size: number,\n    neighbors: Neighbors,\n  ): string;\n}\n\nabstract class BaseShape implements IQrPixelShape {\n  constructor(public sizeRatio: number = 1) {}\n\n  abstract createSvgElement(\n    x: number,\n    y: number,\n    size: number,\n    neighbors: Neighbors,\n  ): string;\n}\n\n/**\n * Default square pixel shape.\n */\nclass SquareShape extends BaseShape {\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    return `M${x + offset},${y + offset} H${x + offset + fitSize} V${y + offset + fitSize} H${x + offset} Z`;\n  }\n}\n\n/**\n * Circular pixel shape.\n */\nclass CircleShape extends BaseShape {\n  createSvgElement(x: number, y: number, size: number): string {\n    const radius = (size / 2) * this.sizeRatio;\n    const centerX = x + size / 2;\n    const centerY = y + size / 2;\n    return `M${centerX},${centerY} m-${radius},0 a${radius},${radius} 0 1,0 ${2 * radius},0 a${radius},${radius} 0 1,0 -${2 * radius},0`;\n  }\n}\n\n/**\n * Pixel shape with rounded corners.\n */\nclass RoundCornersShape extends BaseShape {\n  constructor(\n    sizeRatio: number = 1,\n    public cornerRadius: number = 0,\n  ) {\n    super(sizeRatio);\n  }\n\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    const cornerRadius = fitSize * this.cornerRadius;\n    return `M${x + offset + cornerRadius},${y + offset}\n            H${x + offset + fitSize - cornerRadius}\n            A${cornerRadius},${cornerRadius} 0 0 1 ${x + offset + fitSize},${y + offset + cornerRadius}\n            V${y + offset + fitSize - cornerRadius}\n            A${cornerRadius},${cornerRadius} 0 0 1 ${x + offset + fitSize - cornerRadius},${y + offset + fitSize}\n            H${x + offset + cornerRadius}\n            A${cornerRadius},${cornerRadius} 0 0 1 ${x + offset},${y + offset + fitSize - cornerRadius}\n            V${y + offset + cornerRadius}\n            A${cornerRadius},${cornerRadius} 0 0 1 ${x + offset + cornerRadius},${y + offset} Z`;\n  }\n}\n\n/**\n * Rhombus-shaped pixel.\n */\nclass RhombusShape extends BaseShape {\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    const halfSize = fitSize / 2;\n    return `M ${x + offset + halfSize},${y + offset}\n            L ${x + offset + fitSize},${y + offset + halfSize}\n            L ${x + offset + halfSize},${y + offset + fitSize}\n            L ${x + offset},${y + offset + halfSize} Z`;\n  }\n}\n\n/**\n * Star-shaped pixel.\n */\nclass StarShape extends BaseShape {\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    const centerX = x + offset + fitSize / 2;\n    const centerY = y + offset + fitSize / 2;\n    const path = Array.from({ length: 5 }, (_, i) => {\n      const angle = ((i * 72 - 90) * Math.PI) / 180;\n      const pointX = centerX + (fitSize / 2) * Math.cos(angle);\n      const pointY = centerY + (fitSize / 2) * Math.sin(angle);\n      return `${pointX},${pointY}`;\n    });\n    return `M ${path.join(\" L \")} Z`;\n  }\n}\n\n/**\n * Pixel shape with vertical rounded corners.\n */\nclass RoundCornersVerticalShape extends BaseShape {\n  constructor(\n    sizeRatio: number = 1,\n    public cornerRadius: number = 0,\n  ) {\n    super(sizeRatio);\n  }\n\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    const padding = fitSize * this.cornerRadius;\n    return `M ${x + offset + padding},${y + offset}\n            H ${x + offset + fitSize - padding}\n            V ${y + offset + fitSize}\n            H ${x + offset + padding} Z`;\n  }\n}\n\n/**\n * Pixel shape with horizontal rounded corners.\n */\nclass RoundCornersHorizontalShape extends BaseShape {\n  constructor(\n    sizeRatio: number = 1,\n    public cornerRadius: number = 0,\n  ) {\n    super(sizeRatio);\n  }\n\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    const padding = fitSize * this.cornerRadius;\n    return `M ${x + offset},${y + offset + padding}\n            H ${x + offset + fitSize}\n            V ${y + offset + fitSize - padding}\n            H ${x + offset} Z`;\n  }\n}\n\n/**\n * Hexagonal pixel shape.\n */\nclass HexagonShape extends BaseShape {\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    const halfSize = fitSize / 2;\n    const quarterSize = fitSize / 4;\n    return `M ${x + offset + quarterSize},${y + offset}\n            L ${x + offset + fitSize - quarterSize},${y + offset}\n            L ${x + offset + fitSize},${y + offset + halfSize}\n            L ${x + offset + fitSize - quarterSize},${y + offset + fitSize}\n            L ${x + offset + quarterSize},${y + offset + fitSize}\n            L ${x + offset},${y + offset + halfSize} Z`;\n  }\n}\n\n/**\n * Octagonal pixel shape.\n */\nclass OctagonShape extends BaseShape {\n  createSvgElement(x: number, y: number, size: number): string {\n    const fitSize = size * this.sizeRatio;\n    const offsetXY = (size - fitSize) / 2;\n    const offset = fitSize / 3;\n    return `M ${x + offsetXY + offset},${y + offsetXY}\n            L ${x + offsetXY + fitSize - offset},${y + offsetXY}\n            L ${x + offsetXY + fitSize},${y + offsetXY + offset}\n            L ${x + offsetXY + fitSize},${y + offsetXY + fitSize - offset}\n            L ${x + offsetXY + fitSize - offset},${y + offsetXY + fitSize}\n            L ${x + offsetXY + offset},${y + offsetXY + fitSize}\n            L ${x + offsetXY},${y + offsetXY + fitSize - offset}\n            L ${x + offsetXY},${y + offsetXY + offset} Z`;\n  }\n}\n\n/**\n * StickyCorners pixel shape adjusts corners based on neighbors and rounds them if isolated.\n */\nclass StickyCornersShape extends BaseShape {\n  constructor(\n    sizeRatio: number = 1,\n    public cornerRadius: number = 0,\n  ) {\n    super(sizeRatio);\n  }\n\n  createSvgElement(\n    x: number,\n    y: number,\n    size: number,\n    neighbors: Neighbors,\n  ): string {\n    const fitSize = size * this.sizeRatio;\n    const offset = (size - fitSize) / 2;\n    const radius = fitSize * this.cornerRadius;\n\n    let path = `M${x + offset + fitSize / 2},${y + offset}`;\n\n    // Top-right corner\n    if (!neighbors.top && !neighbors.right) {\n      path += ` H${x + offset + fitSize - radius}\n                A${radius},${radius} 0 0 1 ${x + offset + fitSize},${y + offset + radius}`;\n    } else {\n      path += ` H${x + offset + fitSize}`;\n    }\n\n    // Bottom-right corner\n    if (!neighbors.right && !neighbors.bottom) {\n      path += ` V${y + offset + fitSize - radius}\n                A${radius},${radius} 0 0 1 ${x + offset + fitSize - radius},${y + offset + fitSize}`;\n    } else {\n      path += ` V${y + offset + fitSize}`;\n    }\n\n    // Bottom-left corner\n    if (!neighbors.bottom && !neighbors.left) {\n      path += ` H${x + offset + radius}\n                A${radius},${radius} 0 0 1 ${x + offset},${y + offset + fitSize - radius}`;\n    } else {\n      path += ` H${x + offset}`;\n    }\n\n    // Top-left corner\n    if (!neighbors.left && !neighbors.top) {\n      path += ` V${y + offset + radius}\n                A${radius},${radius} 0 0 1 ${x + offset + radius},${y + offset}`;\n    } else {\n      path += ` V${y + offset}`;\n    }\n\n    return path + \" Z\";\n  }\n}\n\n/**\n * Available implementations for QrPixelShape.\n */\nexport const QrPixelShape = {\n  Square: SquareShape,\n  Circle: CircleShape,\n  RoundCorners: RoundCornersShape,\n  Rhombus: RhombusShape,\n  Star: StarShape,\n  RoundCornersVertical: RoundCornersVerticalShape,\n  RoundCornersHorizontal: RoundCornersHorizontalShape,\n  StickyCorners: StickyCornersShape, // Renamed from StickyCorners\n  Hexagon: HexagonShape,\n  Octagon: OctagonShape,\n};\n\n// Exports\nexport type { IQrPixelShape };\n","import { SVG_NS } from \"../../utils/SvgUtils\";\nimport { QrColor, type IQrColor } from \"../QrColor\";\nimport type { QrShapesDesigner } from \"../QrShapesDesigner\";\nimport type { IQrSVGShape } from \"../SVGInterfaces\";\n\nconst eyeSize = 3;\nconst centerOffset = eyeSize / 2;\n\n/**\n * Interface for defining the shape of the QR code eye.\n */\nexport interface IQrEyeShape extends IQrSVGShape {}\n\nabstract class BaseEyeShape implements IQrEyeShape {\n  constructor(\n    public size: number = eyeSize,\n    public color: IQrColor = new QrColor.Solid(\"black\"),\n  ) {}\n\n  /**\n   * Add the coordinates of the eye to the designer.\n   */\n  protected addEyeCoordinates(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ) {\n    for (let i = x; i < x + this.size; i++) {\n      for (let j = y; j < y + this.size; j++) {\n        designer.addUsedCoordinate(i, j);\n      }\n    }\n  }\n\n  /**\n   * Helper method to set common SVG attributes for positioning and size.\n   */\n  protected setAttributes(\n    element: SVGElement,\n    attributes: Record<string, string>,\n  ) {\n    Object.entries(attributes).forEach(([key, value]) =>\n      element.setAttribute(key, value),\n    );\n  }\n\n  abstract createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement;\n}\n\n/**\n * Square-shaped eye for the QR code.\n */\nexport class SquareEyeShape extends BaseEyeShape {\n  constructor(\n    public cornerRadius: number = 0,\n    size: number = eyeSize,\n    color?: IQrColor,\n  ) {\n    super(size, color);\n  }\n\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    this.addEyeCoordinates(x, y, designer);\n    const rect = document.createElementNS(SVG_NS, \"rect\");\n    const fitSize = this.size;\n    const corner = Math.min(Math.max(this.cornerRadius, 0), 0.5) * fitSize;\n\n    this.setAttributes(rect, {\n      x: x.toString(),\n      y: y.toString(),\n      width: fitSize.toString(),\n      height: fitSize.toString(),\n      rx: corner.toString(),\n      ry: corner.toString(),\n    });\n\n    this.color.applyToElement(rect, designer.mainSvg);\n    return rect;\n  }\n}\n\n/**\n * Circle-shaped eye for the QR code.\n */\nexport class CircleEyeShape extends BaseEyeShape {\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    this.addEyeCoordinates(x, y, designer);\n    const circle = document.createElementNS(SVG_NS, \"circle\");\n    const radius = this.size / 2;\n\n    this.setAttributes(circle, {\n      cx: (x + centerOffset).toString(),\n      cy: (y + centerOffset).toString(),\n      r: radius.toString(),\n    });\n\n    this.color.applyToElement(circle, designer.mainSvg);\n    return circle;\n  }\n}\n\n/**\n * Rhombus-shaped eye for the QR code.\n */\nexport class RhombusEyeShape extends BaseEyeShape {\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    this.addEyeCoordinates(x, y, designer);\n    const polygon = document.createElementNS(SVG_NS, \"polygon\");\n    const halfSize = this.size / 2;\n\n    // Define points for a rhombus\n    const points = [\n      `${halfSize},0`, // Top\n      `${this.size},${halfSize}`, // Right\n      `${halfSize},${this.size}`, // Bottom\n      `0,${halfSize}`, // Left\n    ].map((point) => {\n      const [px, py] = point.split(\",\").map(Number);\n      return `${px! + x},${py! + y}`;\n    });\n\n    polygon.setAttribute(\"points\", points.join(\" \"));\n\n    this.color.applyToElement(polygon, designer.mainSvg);\n    return polygon;\n  }\n}\n\n/**\n * Export QR code eye shapes.\n */\nexport const QrEyeShape = {\n  Square: SquareEyeShape,\n  Circle: CircleEyeShape,\n  Rhombus: RhombusEyeShape,\n};\n","import type { QrCodeMatrix } from \"../encode/QrCodeMatrix\";\n\n/**\n * Neighbors of a pixel in the QR code matrix.\n */\nexport class Neighbors {\n  topLeft: boolean;\n  topRight: boolean;\n  left: boolean;\n  top: boolean;\n  right: boolean;\n  bottomLeft: boolean;\n  bottom: boolean;\n  bottomRight: boolean;\n\n  constructor(\n    top: boolean = false,\n    right: boolean = false,\n    bottom: boolean = false,\n    left: boolean = false,\n    topRight: boolean = false,\n    bottomRight: boolean = false,\n    bottomLeft: boolean = false,\n    topLeft: boolean = false,\n  ) {\n    this.topLeft = topLeft;\n    this.topRight = topRight;\n    this.left = left;\n    this.top = top;\n    this.right = right;\n    this.bottomLeft = bottomLeft;\n    this.bottom = bottom;\n    this.bottomRight = bottomRight;\n  }\n\n  // Singleton empty\n  private static emptyInstance: Neighbors | null = null;\n  static get empty(): Neighbors {\n    if (this.emptyInstance === null) {\n      this.emptyInstance = new Neighbors();\n    }\n    return this.emptyInstance;\n  }\n}\n\n/**\n * Retrieves the neighbors of a pixel in the QR code matrix based on the pixel type.\n */\nexport function getNeighbors(\n  matrix: QrCodeMatrix,\n  i: number,\n  j: number,\n): Neighbors {\n  const cmp = (i2: number, j2: number): boolean => {\n    return (\n      !matrix.isOutOfBounds(i2, j2) && matrix.get(i2, j2) === matrix.get(i, j)\n    );\n  };\n\n  return new Neighbors(\n    cmp(i, j - 1), // top\n    cmp(i + 1, j), // right\n    cmp(i, j + 1), // bottom\n    cmp(i - 1, j), // left\n    cmp(i + 1, j - 1), // topRight\n    cmp(i + 1, j + 1), // bottomRight\n    cmp(i - 1, j + 1), // bottomLeft\n    cmp(i - 1, j - 1), // topLeft\n  );\n}\n","import { QrPixelShape, type IQrPixelShape } from \"./QrPixelShape\";\nimport type { IQrSVGShape } from \"../SVGInterfaces\";\nimport {\n  createSvgGroupFromElements,\n  createSvgPathFromString,\n} from \"../../utils/SvgUtils\";\nimport type { QrShapesDesigner } from \"../QrShapesDesigner\";\nimport { QrColor, type IQrColor } from \"../QrColor\";\nimport { QrEyeShape } from \"./QrEyeShape\";\nimport { getNeighbors } from \"../../utils/Neighbors\";\n\nexport const eyeFrameSize = 7;\n\n/**\n * Interface représentant la forme du cadre du QR code.\n */\ninterface IQrEyeFrameShape extends IQrSVGShape {}\n\nabstract class BaseEyeFrameShape implements IQrEyeFrameShape {\n  constructor(\n    public pixelShape: IQrPixelShape,\n    public color: IQrColor = new QrColor.Solid(\"black\"),\n  ) {}\n\n  abstract createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement;\n\n  protected addEyeFrameCoordinates(\n    designer: QrShapesDesigner,\n    x: number,\n    y: number,\n  ) {\n    for (let i = x; i < x + eyeFrameSize; i++) {\n      for (let j = y; j < y + eyeFrameSize; j++) {\n        if (\n          i === x ||\n          j === y ||\n          i === x + eyeFrameSize - 1 ||\n          j === y + eyeFrameSize - 1\n        ) {\n          designer.addUsedCoordinate(i, j);\n        }\n      }\n    }\n  }\n}\n\n/**\n * Forme par défaut pour le cadre du QR code (7x7 avec cadre de 1px d'épaisseur).\n */\nclass Square extends BaseEyeFrameShape {\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    this.addEyeFrameCoordinates(designer, x, y);\n\n    if (this.pixelShape instanceof QrPixelShape.StickyCorners) {\n      const outerPath = new QrEyeShape.Square(\n        this.pixelShape.cornerRadius,\n        eyeFrameSize,\n        this.color,\n      ).createSvgElement(x, y, designer);\n      const innerPath = new QrEyeShape.Square(\n        this.pixelShape.cornerRadius - 0.05 * this.pixelShape.sizeRatio, // Fix inner corner radius\n        eyeFrameSize - this.pixelShape.sizeRatio * 2,\n        designer.options.shapes.background?.color ?? new QrColor.Solid(\"white\"),\n      ).createSvgElement(\n        x + this.pixelShape.sizeRatio,\n        y + this.pixelShape.sizeRatio,\n        designer,\n      );\n      return createSvgGroupFromElements([outerPath, innerPath]);\n    } else {\n      let pathData = \"\";\n      for (let i = x; i < x + eyeFrameSize; i++) {\n        for (let j = y; j < y + eyeFrameSize; j++) {\n          if (\n            i === x ||\n            j === y ||\n            i === x + eyeFrameSize - 1 ||\n            j === y + eyeFrameSize - 1\n          ) {\n            pathData += this.pixelShape.createSvgElement(\n              i,\n              j,\n              1,\n              getNeighbors(designer.qrMatrix, i, j),\n            );\n          }\n        }\n      }\n      const svg = createSvgPathFromString(pathData);\n      this.color.applyToElement(svg, designer.mainSvg);\n      return svg;\n    }\n  }\n}\n\n/**\n * Forme de cadre circulaire.\n */\nclass Circle extends BaseEyeFrameShape {\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    this.addEyeFrameCoordinates(designer, x, y);\n    const cx = x + eyeFrameSize / 2;\n    const cy = y + eyeFrameSize / 2;\n    const r = eyeFrameSize / 2; // Rayon du cercle ajusté\n    let pathData = \"\";\n\n    if (this.pixelShape instanceof QrPixelShape.StickyCorners) {\n      const rInner = r - 1;\n\n      // Création d'un anneau circulaire (cercle vide à l'intérieur)\n      pathData = `\n        M ${cx + r}, ${cy}\n        A ${r},${r} 0 1,0 ${cx - r},${cy}\n        A ${r},${r} 0 1,0 ${cx + r},${cy}\n        M ${cx + rInner}, ${cy}\n        A ${rInner},${rInner} 0 1,1 ${cx - rInner},${cy}\n        A ${rInner},${rInner} 0 1,1 ${cx + rInner},${cy}\n      `;\n\n      const pathElement = createSvgPathFromString(pathData);\n      pathElement.setAttribute(\"fill-rule\", \"evenodd\");\n      this.color.applyToElement(pathElement, designer.mainSvg);\n      return pathElement;\n    } else {\n      // Si les points ne sont pas liés, dessiner le cercle avec des pixels\n      const thickness = 0.5; // Épaisseur du contour du cercle\n\n      for (let i = x; i < x + eyeFrameSize; i++) {\n        for (let j = y; j < y + eyeFrameSize; j++) {\n          const dx = i - cx + 0.5;\n          const dy = j - cy + 0.5;\n          const distance = Math.sqrt(dx * dx + dy * dy);\n\n          if (distance >= r - thickness && distance <= r + thickness) {\n            pathData += this.pixelShape.createSvgElement(\n              i,\n              j,\n              1,\n              getNeighbors(designer.qrMatrix, i, j),\n            );\n          }\n        }\n      }\n      const svg = createSvgPathFromString(pathData);\n      this.color.applyToElement(svg, designer.mainSvg);\n      return svg;\n    }\n  }\n}\n\n// Export des classes et objets\nexport const QrEyeFrameShape = {\n  Square,\n  Circle,\n};\n\nexport type { IQrEyeFrameShape };\n","import {\n  createSvgGroupFromElements,\n  getDefsElement,\n} from \"../../utils/SvgUtils\";\nimport { QrColor, type IQrColor } from \"../QrColor\";\nimport type { QrShapesDesigner } from \"../QrShapesDesigner\";\nimport type { IQrSVGWithImage } from \"../SVGInterfaces\";\n\ninterface IQrLogoShape extends IQrSVGWithImage {}\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nabstract class BaseLogoShape implements IQrLogoShape {\n  constructor(\n    public imageData: string | null = null, // Can be an URL or an SVG string\n    public sizeRatio: number = 0.2,\n    public padding: number = 1,\n    public color: IQrColor = new QrColor.Solid(\"black\"),\n  ) {}\n\n  // Adds the logo's coordinates to the designer grid\n  protected addLogoCoordinates(\n    x: number,\n    y: number,\n    width: number,\n    height: number,\n    designer: QrShapesDesigner,\n  ) {\n    for (let i = x; i < x + width; i++) {\n      for (let j = y; j < y + height; j++) {\n        designer.addUsedCoordinate(i, j);\n      }\n    }\n  }\n\n  // Creates the image element (either SVG or regular image)\n  protected createImageElement(\n    x: number,\n    y: number,\n    width: number,\n    height: number,\n    clipPathId?: string,\n  ): SVGElement {\n    if (!this.imageData) throw new Error(\"Image data is not provided.\");\n\n    const isSvg = this.imageData.includes(\"<svg\");\n    if (isSvg) {\n      const parser = new DOMParser();\n      const svgDoc = parser.parseFromString(this.imageData, \"image/svg+xml\");\n      const importedSvg = document.importNode(svgDoc.documentElement, true);\n\n      importedSvg.setAttribute(\"width\", width.toString());\n      importedSvg.setAttribute(\"height\", height.toString());\n      importedSvg.setAttribute(\"x\", x.toString());\n      importedSvg.setAttribute(\"y\", y.toString());\n\n      const group = document.createElementNS(SVG_NS, \"g\");\n      if (clipPathId) group.setAttribute(\"clip-path\", `url(#${clipPathId})`);\n      group.appendChild(importedSvg);\n      return group;\n    } else {\n      const img = document.createElementNS(SVG_NS, \"image\");\n      img.setAttributeNS(\n        \"http://www.w3.org/1999/xlink\",\n        \"href\",\n        this.imageData || \"\",\n      );\n      img.setAttribute(\"x\", x.toString());\n      img.setAttribute(\"y\", y.toString());\n      img.setAttribute(\"width\", width.toString());\n      img.setAttribute(\"height\", height.toString());\n      if (clipPathId) img.setAttribute(\"clip-path\", `url(#${clipPathId})`);\n      return img;\n    }\n  }\n\n  abstract createSvgElement(\n    mainSvg: SVGElement,\n    designer: QrShapesDesigner,\n  ): SVGElement;\n}\n\n/**\n * Square or rounded corner logo shape, depending on the cornerRadius.\n */\nclass SquareShape extends BaseLogoShape {\n  constructor(\n    imageData?: string | null,\n    sizeRatio?: number,\n    padding?: number,\n    color?: IQrColor,\n    public cornerRadius: number = 0,\n  ) {\n    super(imageData, sizeRatio, padding, color);\n  }\n\n  createSvgElement(\n    mainSvg: SVGElement,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    const logoSize = designer.qrMatrix.size * this.sizeRatio;\n    const x = (designer.qrMatrix.size - logoSize) / 2;\n    const y = (designer.qrMatrix.size - logoSize) / 2;\n    const svgElements: SVGElement[] = [];\n\n    this.addLogoCoordinates(\n      Math.round(x),\n      Math.round(y),\n      logoSize,\n      logoSize,\n      designer,\n    );\n\n    // Create the background with optional rounded corners\n    const bgRect = document.createElementNS(SVG_NS, \"rect\");\n    bgRect.setAttribute(\"x\", x.toString());\n    bgRect.setAttribute(\"y\", y.toString());\n    bgRect.setAttribute(\"width\", logoSize.toString());\n    bgRect.setAttribute(\"height\", logoSize.toString());\n    if (this.cornerRadius > 0) {\n      bgRect.setAttribute(\"rx\", this.cornerRadius.toString());\n      bgRect.setAttribute(\"ry\", this.cornerRadius.toString());\n    }\n    this.color.applyToElement(bgRect, mainSvg);\n    svgElements.push(bgRect);\n\n    // Handle image data inside the shape\n    if (this.imageData) {\n      const clipPathId = `clipSquare${Math.random().toString(36).substr(2, 9)}`;\n      this.createClipPath(mainSvg, x, y, logoSize, clipPathId);\n\n      const imgSize = logoSize - 2 * this.padding;\n      const img = this.createImageElement(\n        x + this.padding,\n        y + this.padding,\n        imgSize,\n        imgSize,\n        clipPathId,\n      );\n      svgElements.push(img);\n    }\n\n    return createSvgGroupFromElements(svgElements);\n  }\n\n  private createClipPath(\n    mainSvg: SVGElement,\n    x: number,\n    y: number,\n    size: number,\n    clipPathId: string,\n  ) {\n    const defs = getDefsElement(mainSvg);\n    const clipPath = document.createElementNS(SVG_NS, \"clipPath\");\n    clipPath.setAttribute(\"id\", clipPathId);\n\n    const clipRect = document.createElementNS(SVG_NS, \"rect\");\n    clipRect.setAttribute(\"x\", (x + this.padding).toString());\n    clipRect.setAttribute(\"y\", (y + this.padding).toString());\n    clipRect.setAttribute(\"width\", (size - 2 * this.padding).toString());\n    clipRect.setAttribute(\"height\", (size - 2 * this.padding).toString());\n    if (this.cornerRadius > 0) {\n      clipRect.setAttribute(\"rx\", this.cornerRadius.toString());\n      clipRect.setAttribute(\"ry\", this.cornerRadius.toString());\n    }\n\n    clipPath.appendChild(clipRect);\n    defs.appendChild(clipPath);\n  }\n}\n\n/**\n * Circular logo shape.\n */\nclass CircleShape extends BaseLogoShape {\n  createSvgElement(\n    mainSvg: SVGElement,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    const width = designer.qrMatrix.size;\n    const height = designer.qrMatrix.size;\n    const logoSize = Math.min(width, height) * this.sizeRatio;\n    const cx = width / 2;\n    const cy = height / 2;\n    const radius = logoSize / 2;\n    const svgElements: SVGElement[] = [];\n\n    this.addCircleCoordinates(cx - 0.5, cy - 0.5, radius, designer);\n\n    // Create the circular background\n    const bgCircle = document.createElementNS(SVG_NS, \"circle\");\n    bgCircle.setAttribute(\"cx\", cx.toString());\n    bgCircle.setAttribute(\"cy\", cy.toString());\n    bgCircle.setAttribute(\"r\", radius.toString());\n    this.color.applyToElement(bgCircle, mainSvg);\n    svgElements.push(bgCircle);\n\n    // Handle image data inside the circle\n    if (this.imageData) {\n      const clipPathId = `clipCircle${Math.random().toString(36).substr(2, 9)}`;\n      this.createClipPath(mainSvg, cx, cy, radius, clipPathId);\n\n      const imgSize = 2 * (radius - this.padding);\n      const img = this.createImageElement(\n        cx - (radius - this.padding),\n        cy - (radius - this.padding),\n        imgSize,\n        imgSize,\n        clipPathId,\n      );\n      svgElements.push(img);\n    }\n\n    return createSvgGroupFromElements(svgElements);\n  }\n\n  private createClipPath(\n    mainSvg: SVGElement,\n    cx: number,\n    cy: number,\n    radius: number,\n    clipPathId: string,\n  ) {\n    const defs = getDefsElement(mainSvg);\n    const clipPath = document.createElementNS(SVG_NS, \"clipPath\");\n    clipPath.setAttribute(\"id\", clipPathId);\n\n    const clipCircle = document.createElementNS(SVG_NS, \"circle\");\n    clipCircle.setAttribute(\"cx\", cx.toString());\n    clipCircle.setAttribute(\"cy\", cy.toString());\n    clipCircle.setAttribute(\"r\", (radius - this.padding).toString());\n\n    clipPath.appendChild(clipCircle);\n    defs.appendChild(clipPath);\n  }\n\n  private addCircleCoordinates(\n    cx: number,\n    cy: number,\n    radius: number,\n    designer: QrShapesDesigner,\n  ) {\n    const minX = Math.floor(cx - radius);\n    const maxX = Math.ceil(cx + radius);\n    const minY = Math.floor(cy - radius);\n    const maxY = Math.ceil(cy + radius);\n\n    for (let x = minX; x < maxX; x++) {\n      for (let y = minY; y < maxY; y++) {\n        const distance = Math.sqrt((x - cx) ** 2 + (y - cy) ** 2);\n        if (distance <= radius) designer.addUsedCoordinate(x, y);\n      }\n    }\n  }\n}\n\n/**\n * Rhombus-shaped logo.\n */\nclass RhombusShape extends BaseLogoShape {\n  createSvgElement(\n    mainSvg: SVGElement,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    const logoSize = designer.qrMatrix.size * this.sizeRatio;\n    const cx = designer.qrMatrix.size / 2;\n    const cy = designer.qrMatrix.size / 2;\n    const halfSize = logoSize / 2;\n    const svgElements: SVGElement[] = [];\n\n    this.addRhombusLogoCoordinates(cx - 0.5, cy - 0.5, halfSize, designer);\n\n    const points = [\n      `${cx},${cy - halfSize}`,\n      `${cx + halfSize},${cy}`,\n      `${cx},${cy + halfSize}`,\n      `${cx - halfSize},${cy}`,\n    ].join(\" \");\n\n    const bgPolygon = document.createElementNS(SVG_NS, \"polygon\");\n    bgPolygon.setAttribute(\"points\", points);\n    this.color.applyToElement(bgPolygon, mainSvg);\n    svgElements.push(bgPolygon);\n\n    if (this.imageData) {\n      const clipPathId = `clipRhombus${Math.random().toString(36).substr(2, 9)}`;\n      this.createClipPath(mainSvg, cx, cy, halfSize, clipPathId);\n\n      const imgSize = 2 * (halfSize - this.padding);\n      const img = this.createImageElement(\n        cx - (halfSize - this.padding),\n        cy - (halfSize - this.padding),\n        imgSize,\n        imgSize,\n        clipPathId,\n      );\n      svgElements.push(img);\n    }\n\n    return createSvgGroupFromElements(svgElements);\n  }\n\n  private createClipPath(\n    mainSvg: SVGElement,\n    cx: number,\n    cy: number,\n    halfSize: number,\n    clipPathId: string,\n  ) {\n    const defs = getDefsElement(mainSvg);\n    const clipPath = document.createElementNS(SVG_NS, \"clipPath\");\n    clipPath.setAttribute(\"id\", clipPathId);\n\n    const paddingHalfSize = halfSize - this.padding;\n    const clipPoints = [\n      `${cx},${cy - paddingHalfSize}`,\n      `${cx + paddingHalfSize},${cy}`,\n      `${cx},${cy + paddingHalfSize}`,\n      `${cx - paddingHalfSize},${cy}`,\n    ].join(\" \");\n\n    const clipPolygon = document.createElementNS(SVG_NS, \"polygon\");\n    clipPolygon.setAttribute(\"points\", clipPoints);\n\n    clipPath.appendChild(clipPolygon);\n    defs.appendChild(clipPath);\n  }\n\n  private addRhombusLogoCoordinates(\n    cx: number,\n    cy: number,\n    halfSize: number,\n    designer: QrShapesDesigner,\n  ) {\n    const minX = Math.floor(cx - halfSize);\n    const maxX = Math.ceil(cx + halfSize);\n    const minY = Math.floor(cy - halfSize);\n    const maxY = Math.ceil(cy + halfSize);\n\n    for (let x = minX; x <= maxX; x++) {\n      for (let y = minY; y <= maxY; y++) {\n        const dx = Math.abs(x - cx) / halfSize;\n        const dy = Math.abs(y - cy) / halfSize;\n        if (dx + dy <= 1) designer.addUsedCoordinate(x, y);\n      }\n    }\n  }\n}\n\nexport const QrLogoShape = {\n  Square: SquareShape,\n  Circle: CircleShape,\n  Rhombus: RhombusShape,\n};\n\nexport type { IQrLogoShape };\n","import { PixelType } from \"../../encode/QrCodeMatrix\";\nimport { getNeighbors } from \"../../utils/Neighbors\";\nimport { createSvgPathFromString } from \"../../utils/SvgUtils\";\nimport { QrPixelShape, type IQrPixelShape } from \"./QrPixelShape\";\nimport type { IQrSVGShape } from \"../SVGInterfaces\";\nimport type { QrShapesDesigner } from \"../QrShapesDesigner\";\nimport { QrColor, type IQrColor } from \"../QrColor\";\n\n/**\n * Interface to define the shape of the QR code matrix pixel.\n */\nexport interface IQrMatrixPixelShape extends IQrSVGShape {}\n\nexport class QrMatrixPixelShape implements IQrMatrixPixelShape {\n  constructor(\n    public pixelShape: IQrPixelShape = new QrPixelShape.Square(),\n    public color: IQrColor = new QrColor.Solid(\"black\"),\n  ) {}\n\n  /**\n   * Create an SVG path for the dark pixels of the QR code, except those already used.\n   */\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    let pathData = \"\";\n    const matrixSize = designer.qrMatrix.size;\n\n    // Loop through the QR matrix and generate SVG path data for dark pixels\n    for (let i = x; i < matrixSize; i++) {\n      for (let j = y; j < matrixSize; j++) {\n        if (this.isDarkPixel(i, j, designer)) {\n          designer.addUsedCoordinate(i, j); // Mark the coordinate as used\n\n          const neighbors = getNeighbors(designer.qrMatrix, i, j); // Get neighboring pixels\n          pathData += this.pixelShape.createSvgElement(i, j, 1, neighbors); // Create path for the pixel\n        }\n      }\n    }\n\n    const svg = createSvgPathFromString(pathData);\n    this.color.applyToElement(svg, designer.mainSvg);\n    return svg;\n  }\n\n  /**\n   * Helper method to check if a pixel is dark and not already used.\n   */\n  private isDarkPixel(\n    i: number,\n    j: number,\n    designer: QrShapesDesigner,\n  ): boolean {\n    return (\n      designer.qrMatrix.get(i, j) === PixelType.DarkPixel &&\n      !designer.isUsedCoordinate(i, j)\n    );\n  }\n}\n","import { QrCodeMatrix, PixelType } from \"../../encode/QrCodeMatrix\";\nimport { eyeFrameSize } from \"./QrEyeFrameShape\";\n\n/**\n * Interface representing the QR code shape.\n */\nexport interface IQrShape {\n  qrOriginStart: [number, number];\n\n  /**\n   * Transforms or expands the pixel matrix of the QR code.\n   * Throws an error if the matrix is reduced.\n   */\n  apply(matrix: QrCodeMatrix): QrCodeMatrix;\n\n  /**\n   * Checks if a pixel is within the shape of the QR code.\n   */\n  pixelInShape(i: number, j: number, modifiedByteMatrix: QrCodeMatrix): boolean;\n}\n\n/**\n * Square QR code shape\n */\nexport class Square implements IQrShape {\n  qrOriginStart: [number, number] = [0, 0];\n\n  apply(matrix: QrCodeMatrix): QrCodeMatrix {\n    return matrix;\n  }\n\n  pixelInShape(): boolean {\n    return true;\n  }\n}\n\n/**\n * Circular QR code shape with random dark/light pixels around the circle.\n */\nexport class Circle implements IQrShape {\n  private random: Random;\n  private addedPoints: Set<string>;\n  public qrOriginStart: [number, number];\n\n  constructor(seed: number = 233) {\n    this.random = new Random(seed);\n    this.addedPoints = new Set();\n    this.qrOriginStart = [0, 0];\n  }\n\n  apply(matrix: QrCodeMatrix): QrCodeMatrix {\n    const added = Math.round((matrix.size * Math.sqrt(2) - matrix.size) / 2);\n    const newSize = matrix.size + 2 * added;\n    const newMatrix = new QrCodeMatrix(newSize);\n    const center = newSize / 2;\n    this.qrOriginStart = [center - matrix.size / 2, center - matrix.size / 2];\n\n    // Fill surrounding area with random pixels forming a circular shape\n    this.fillCircularPixels(newMatrix, matrix, added, center, newSize);\n\n    // Copy the original matrix into the new one\n    this.copyOriginalMatrix(matrix, newMatrix, added);\n\n    return newMatrix;\n  }\n\n  pixelInShape(i: number, j: number): boolean {\n    return this.addedPoints.has(`${i},${j}`);\n  }\n\n  private fillCircularPixels(\n    newMatrix: QrCodeMatrix,\n    matrix: QrCodeMatrix,\n    added: number,\n    center: number,\n    newSize: number,\n  ) {\n    for (let i = 0; i < newSize; i++) {\n      for (let j = 0; j < newSize; j++) {\n        if (\n          this.isInCircularArea(i, j, center, matrix.size, added) &&\n          !this.isAdjacentToEyeFrame(\n            i,\n            j,\n            eyeFrameSize,\n            newSize,\n            this.qrOriginStart,\n          )\n        ) {\n          const isDarkPixel = this.random.nextBoolean();\n          newMatrix.set(\n            i,\n            j,\n            isDarkPixel ? PixelType.DarkPixel : PixelType.Background,\n          );\n\n          if (isDarkPixel) {\n            this.addedPoints.add(`${i},${j}`);\n          }\n        }\n      }\n    }\n  }\n\n  private copyOriginalMatrix(\n    matrix: QrCodeMatrix,\n    newMatrix: QrCodeMatrix,\n    added: number,\n  ) {\n    for (let i = 0; i < matrix.size; i++) {\n      for (let j = 0; j < matrix.size; j++) {\n        newMatrix.set(added + i, added + j, matrix.get(i, j));\n      }\n    }\n  }\n\n  private isInCircularArea(\n    i: number,\n    j: number,\n    center: number,\n    matrixSize: number,\n    added: number,\n  ): boolean {\n    return (\n      (i <= added - 1 ||\n        j <= added - 1 ||\n        i >= added + matrixSize ||\n        j >= added + matrixSize) &&\n      Math.sqrt(\n        (center - i) * (center - i - 0.5) + (center - j) * (center - j - 0.5),\n      ) <= center\n    );\n  }\n\n  private isAdjacentToEyeFrame(\n    i: number,\n    j: number,\n    eyeFrameSize: number,\n    newSize: number,\n    qrOriginStart: [number, number],\n  ): boolean {\n    const eyeFrames = [\n      { x: qrOriginStart[0], y: qrOriginStart[1], sides: [\"top\", \"left\"] },\n      {\n        x: qrOriginStart[0],\n        y: newSize - qrOriginStart[1] - eyeFrameSize,\n        sides: [\"bottom\", \"left\"],\n      },\n      {\n        x: newSize - qrOriginStart[0] - eyeFrameSize,\n        y: qrOriginStart[1],\n        sides: [\"top\", \"right\"],\n      },\n    ];\n\n    return eyeFrames.some(({ x, y, sides }) =>\n      this.isPixelAdjacentToEyeFrame(i, j, x, y, sides, eyeFrameSize),\n    );\n  }\n\n  private isPixelAdjacentToEyeFrame(\n    i: number,\n    j: number,\n    x: number,\n    y: number,\n    sides: string[],\n    eyeFrameSize: number,\n  ): boolean {\n    return (\n      (sides.includes(\"left\") &&\n        i === x - 1 &&\n        j >= y &&\n        j < y + eyeFrameSize) ||\n      (sides.includes(\"right\") &&\n        i === x + eyeFrameSize &&\n        j >= y &&\n        j < y + eyeFrameSize) ||\n      (sides.includes(\"top\") &&\n        j === y - 1 &&\n        i >= x &&\n        i < x + eyeFrameSize) ||\n      (sides.includes(\"bottom\") &&\n        j === y + eyeFrameSize &&\n        i >= x &&\n        i < x + eyeFrameSize)\n    );\n  }\n}\n\n/**\n * Simple random generator based on seed.\n */\nclass Random {\n  constructor(private seed: number) {}\n\n  nextBoolean(): boolean {\n    const x = Math.sin(this.seed++) * 10000;\n    return x - Math.floor(x) > 0.5;\n  }\n}\n\n/**\n * Available QR shapes.\n */\nexport const QrShape = {\n  Square,\n  Circle,\n};\n","import { PixelType } from \"../../encode/QrCodeMatrix\";\nimport { getNeighbors } from \"../../utils/Neighbors\";\nimport { createSvgPathFromString } from \"../../utils/SvgUtils\";\nimport type { IQrPixelShape } from \"./QrPixelShape\";\nimport type { IQrSVGShape } from \"../SVGInterfaces\";\nimport type { QrShapesDesigner } from \"../QrShapesDesigner\";\nimport { QrColor, type IQrColor } from \"../QrColor\";\n\nexport class QrTimingLineShape implements IQrSVGShape {\n  constructor(\n    public pixelShape: IQrPixelShape,\n    public color: IQrColor = new QrColor.Solid(\"black\"),\n  ) {}\n\n  /**\n   * Creates an SVG element representing the timing line in a QR code.\n   * The timing line alternates between dark and light pixels.\n   */\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    let pathData = \"\";\n    const timingLineEnd = designer.qrXEnd - 7;\n\n    // Process pixels for the timing line in both directions\n    for (let i = x + 1; i < timingLineEnd; i++) {\n      pathData += this.processPixel(x, i, designer); // Process horizontal timing line\n      pathData += this.processPixel(i, y, designer); // Process vertical timing line\n    }\n\n    const svg = createSvgPathFromString(pathData);\n    this.color.applyToElement(svg, designer.mainSvg);\n    return svg;\n  }\n\n  /**\n   * Helper method to process a single pixel and add it to the path if it's dark or light.\n   */\n  private processPixel(\n    i: number,\n    j: number,\n    designer: QrShapesDesigner,\n  ): string {\n    const pixelType = designer.qrMatrix.get(i, j);\n\n    // Only process if the pixel is of type DarkPixel\n    if (pixelType === PixelType.DarkPixel) {\n      designer.addUsedCoordinate(i, j);\n      return this.pixelShape.createSvgElement(\n        i,\n        j,\n        1,\n        getNeighbors(designer.qrMatrix, i, j),\n      );\n    }\n    return \"\"; // Return an empty string if no valid pixel\n  }\n}\n","import type { IQrAlignmentPatternShape } from \"../style/shapes/QrAlignmentPatternShape\";\nimport { QrBackground } from \"../style/shapes/QrBackground\";\nimport { type IQrEyeFrameShape } from \"../style/shapes/QrEyeFrameShape\";\nimport { type IQrEyeShape } from \"../style/shapes/QrEyeShape\";\nimport { type IQrLogoShape } from \"../style/shapes/QrLogoShape\";\nimport {\n  QrMatrixPixelShape,\n  type IQrMatrixPixelShape,\n} from \"../style/shapes/QrMatrixPixelShape\";\nimport { QrPixelShape } from \"../style/shapes/QrPixelShape\";\nimport { QrShape, type IQrShape } from \"../style/shapes/QrShape\";\nimport { QrTimingLineShape } from \"../style/shapes/QrTimingLineShape\";\n\n// Represents the shapes of various elements in the QR code\nexport interface IQrShapes {\n  alignmentPattern: IQrAlignmentPatternShape | null;\n  background: QrBackground | null;\n  eyeFrame: IQrEyeFrameShape | null;\n  eye: IQrEyeShape | null;\n  logo: IQrLogoShape | null;\n  matrixPixel: IQrMatrixPixelShape;\n  qrCode: IQrShape;\n  timingLine: QrTimingLineShape | null;\n}\n\n// Class representing the shapes of QR code elements with default symmetrical shapes\nexport class QrShapes implements IQrShapes {\n  matrixPixel: IQrMatrixPixelShape;\n  qrCode: IQrShape;\n  constructor(\n    public alignmentPattern: IQrAlignmentPatternShape | null = null,\n    public background: QrBackground | null = null,\n    public eyeFrame: IQrEyeFrameShape | null = null,\n    public eye: IQrEyeShape | null = null,\n    public logo: IQrLogoShape | null = null,\n    matrixPixel: IQrMatrixPixelShape | null,\n    qrCode: IQrShape | null,\n    public timingLine: QrTimingLineShape | null = null,\n  ) {\n    this.matrixPixel =\n      matrixPixel ?? new QrMatrixPixelShape(new QrPixelShape.Square());\n    this.qrCode = qrCode ?? new QrShape.Square();\n  }\n}\n","import { QrPixelShape, type IQrPixelShape } from \"./QrPixelShape\";\nimport type { IQrSVGShape } from \"../SVGInterfaces\";\nimport {\n  createSvgGroupFromElements,\n  createSvgPathFromString,\n} from \"../../utils/SvgUtils\";\nimport type { QrShapesDesigner } from \"../QrShapesDesigner\";\nimport { QrColor, type IQrColor } from \"../QrColor\";\nimport { QrEyeShape } from \"./QrEyeShape\";\nimport { getNeighbors } from \"../../utils/Neighbors\";\n\nexport const alignmentPatternSize = 5;\n\n/**\n * Interface representing the alignment pattern shape for the QR code.\n */\ninterface IQrAlignmentPatternShape extends IQrSVGShape {}\n\nabstract class BaseAlignmentPatternShape implements IQrAlignmentPatternShape {\n  constructor(\n    public pixelShape: IQrPixelShape,\n    public color: IQrColor = new QrColor.Solid(\"black\"),\n  ) {}\n\n  abstract createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement;\n\n  protected addAlignmentPatternCoordinates(\n    designer: QrShapesDesigner,\n    x: number,\n    y: number,\n  ) {\n    for (let i = x; i < x + alignmentPatternSize; i++) {\n      for (let j = y; j < y + alignmentPatternSize; j++) {\n        designer.addUsedCoordinate(i, j);\n      }\n    }\n  }\n}\n\n/**\n * Square shape for alignment pattern\n */\nclass Square extends BaseAlignmentPatternShape {\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    this.addAlignmentPatternCoordinates(designer, x, y);\n\n    if (this.pixelShape instanceof QrPixelShape.StickyCorners) {\n      const outerPath = new QrEyeShape.Square(\n        this.pixelShape.cornerRadius,\n        alignmentPatternSize,\n        this.color,\n      ).createSvgElement(x, y, designer);\n      const innerPath = new QrEyeShape.Square(\n        this.pixelShape.cornerRadius - 0.05 * this.pixelShape.sizeRatio,\n        alignmentPatternSize - this.pixelShape.sizeRatio * 2,\n        designer.options.shapes.background?.color ?? new QrColor.Solid(\"white\"),\n      ).createSvgElement(\n        x + this.pixelShape.sizeRatio,\n        y + this.pixelShape.sizeRatio,\n        designer,\n      );\n      const pixelPath = this.createPixelPath(x, y, designer);\n      return createSvgGroupFromElements([outerPath, innerPath, pixelPath]);\n    } else {\n      return this.createSimpleSquarePath(x, y, designer);\n    }\n  }\n\n  private createPixelPath(x: number, y: number, designer: QrShapesDesigner) {\n    const pathData = this.pixelShape.createSvgElement(\n      x + 2,\n      y + 2,\n      1,\n      getNeighbors(designer.qrMatrix, x + 2, y + 2),\n    );\n    const path = createSvgPathFromString(pathData);\n    this.color.applyToElement(path, designer.mainSvg);\n    return path;\n  }\n\n  private createSimpleSquarePath(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ) {\n    let pathData = \"\";\n    for (let i = x; i < x + alignmentPatternSize; i++) {\n      for (let j = y; j < y + alignmentPatternSize; j++) {\n        if (\n          i === x ||\n          j === y ||\n          i === x + alignmentPatternSize - 1 ||\n          j === y + alignmentPatternSize - 1\n        ) {\n          pathData += this.pixelShape.createSvgElement(\n            i,\n            j,\n            1,\n            getNeighbors(designer.qrMatrix, i, j),\n          );\n        }\n      }\n    }\n\n    pathData += this.pixelShape.createSvgElement(\n      x + 2,\n      y + 2,\n      1,\n      getNeighbors(designer.qrMatrix, x + 2, y + 2),\n    );\n\n    const svg = createSvgPathFromString(pathData);\n    this.color.applyToElement(svg, designer.mainSvg);\n    return svg;\n  }\n}\n\n/**\n * Circular alignment pattern shape.\n */\nclass Circle extends BaseAlignmentPatternShape {\n  createSvgElement(\n    x: number,\n    y: number,\n    designer: QrShapesDesigner,\n  ): SVGElement {\n    this.addAlignmentPatternCoordinates(designer, x, y);\n\n    const cx = x + alignmentPatternSize / 2;\n    const cy = y + alignmentPatternSize / 2;\n    const r = alignmentPatternSize / 2;\n    const pathData = this.createCirclePathData(cx, cy, r);\n\n    const pixelPath = this.pixelShape.createSvgElement(\n      x + 2,\n      y + 2,\n      1,\n      getNeighbors(designer.qrMatrix, x + 2, y + 2),\n    );\n    const pathElement = createSvgPathFromString(`${pathData}${pixelPath}`);\n    pathElement.setAttribute(\"fill-rule\", \"evenodd\");\n\n    this.color.applyToElement(pathElement, designer.mainSvg);\n    return pathElement;\n  }\n\n  private createCirclePathData(cx: number, cy: number, r: number): string {\n    const rInner = r - 1;\n    return `\n      M ${cx + r}, ${cy}\n      A ${r},${r} 0 1,0 ${cx - r},${cy}\n      A ${r},${r} 0 1,0 ${cx + r},${cy}\n      M ${cx + rInner}, ${cy}\n      A ${rInner},${rInner} 0 1,1 ${cx - rInner},${cy}\n      A ${rInner},${rInner} 0 1,1 ${cx + rInner},${cy}\n    `;\n  }\n}\n\nexport const QrAlignmentPatternShape = {\n  Square,\n  Circle,\n};\n\nexport type { IQrAlignmentPatternShape };\n","import {\n  LinearGradientOrientation,\n  type IQrColor,\n  QrColor,\n  type LinearGradientOrientationConfig,\n} from \"../style/QrColor\";\nimport {\n  type IQrAlignmentPatternShape,\n  QrAlignmentPatternShape,\n} from \"../style/shapes/QrAlignmentPatternShape\";\nimport { QrBackground } from \"../style/shapes/QrBackground\";\nimport {\n  QrEyeFrameShape,\n  type IQrEyeFrameShape,\n} from \"../style/shapes/QrEyeFrameShape\";\nimport { QrEyeShape, type IQrEyeShape } from \"../style/shapes/QrEyeShape\";\nimport { type IQrLogoShape, QrLogoShape } from \"../style/shapes/QrLogoShape\";\nimport { QrMatrixPixelShape } from \"../style/shapes/QrMatrixPixelShape\";\nimport { type IQrPixelShape, QrPixelShape } from \"../style/shapes/QrPixelShape\";\nimport { QrShape, type IQrShape } from \"../style/shapes/QrShape\";\nimport { QrTimingLineShape } from \"../style/shapes/QrTimingLineShape\";\nimport { QrShapes } from \"../options/QrShapes\";\n\n/** --------------------------------------------------------------------------\n * Factory shapes configuration.\n */\n\nexport interface QrShapesConfig {\n  qrCode?: QrShapeConfig;\n  matrixPixel?: QrMatrixPixelShapeConfig;\n  eye?: QrEyeShapeConfig;\n  eyeFrame?: QrEyeFrameShapeConfig;\n  logo?: QrLogoShapeConfig;\n  timingLine?: QrTimingLineShapeConfig;\n  background?: QrBackgroundConfig;\n  alignmentPattern?: QrAlignmentPatternShapeConfig;\n}\n\nexport function createQrShapesFromConfig(config: QrShapesConfig): QrShapes {\n  return new QrShapes(\n    config.alignmentPattern\n      ? createQrAlignmentPatternShape(config.alignmentPattern)\n      : null,\n    config.background ? createQrBackground(config.background) : null,\n    config.eyeFrame ? createQrEyeFrameShape(config.eyeFrame) : null,\n    config.eye ? createQrEyeShape(config.eye) : null,\n    config.logo ? createQrLogoShape(config.logo) : null,\n    config.matrixPixel ? createQrMatrixPixelShape(config.matrixPixel) : null,\n    config.qrCode ? createQrShape(config.qrCode) : null,\n    config.timingLine ? createQrTimingLineShape(config.timingLine) : null,\n  );\n}\n\n/** --------------------------------------------------------------------------\n * QR AlignmentPatternShape configuration.\n */\nexport interface QrAlignmentPatternShapeConfig {\n  type: \"Square\" | \"Circle\";\n  pixelShape: QrPixelShapeConfig;\n  color?: QrColorConfig;\n}\n\nfunction createQrAlignmentPatternShape(\n  config: QrAlignmentPatternShapeConfig,\n): IQrAlignmentPatternShape {\n  return new QrAlignmentPatternShape.Square(\n    createQrPixelShape(config.pixelShape),\n    config.color ? createQrColor(config.color) : undefined,\n  );\n}\n\n/** --------------------------------------------------------------------------\n * QR Background configuration.\n */\nexport interface QrBackgroundConfig {\n  image?: string;\n  color?: QrColorConfig;\n}\n\nfunction createQrBackground(config: QrBackgroundConfig): QrBackground {\n  const color = config.color ? createQrColor(config.color) : undefined;\n  return new QrBackground(config.image, 1, 0, color);\n}\n\n/** --------------------------------------------------------------------------\n * QR EyeFrameShape configuration.\n */\nexport interface QrEyeFrameShapeConfig {\n  type: \"Square\" | \"Circle\";\n  pixelShape: QrPixelShapeConfig;\n  color?: QrColorConfig;\n}\n\nfunction createQrEyeFrameShape(\n  config: QrEyeFrameShapeConfig,\n): IQrEyeFrameShape {\n  return config.type === \"Circle\"\n    ? new QrEyeFrameShape.Circle(\n        createQrPixelShape(config.pixelShape),\n        config.color ? createQrColor(config.color) : undefined,\n      )\n    : new QrEyeFrameShape.Square(\n        createQrPixelShape(config.pixelShape),\n        config.color ? createQrColor(config.color) : undefined,\n      );\n}\n\n/** --------------------------------------------------------------------------\n * QR EyeShape configuration.\n */\ntype QrEyeShapeType = \"Square\" | \"Circle\" | \"Rhombus\";\n\ninterface QrEyeShapeBaseConfig {\n  type: QrEyeShapeType;\n  color?: QrColorConfig;\n}\n\ninterface QrEyeShapeClassicConfig extends QrEyeShapeBaseConfig {\n  type: \"Circle\" | \"Rhombus\";\n}\n\ninterface QrEyeShapeRoundedConfig extends QrEyeShapeBaseConfig {\n  type: \"Square\";\n  cornerRadius?: number;\n}\n\nexport type QrEyeShapeConfig =\n  | QrEyeShapeClassicConfig\n  | QrEyeShapeRoundedConfig;\n\nfunction createQrEyeShape(config: QrEyeShapeConfig): IQrEyeShape {\n  const color = config.color ? createQrColor(config.color) : undefined;\n  switch (config.type) {\n    case \"Circle\":\n      return new QrEyeShape.Circle(3, color);\n    case \"Rhombus\":\n      return new QrEyeShape.Rhombus(3, color);\n    case \"Square\":\n    default:\n      return new QrEyeShape.Square(config.cornerRadius ?? 0, 3, color);\n  }\n}\n\n/** --------------------------------------------------------------------------\n * QR LogoShape configuration.\n */\n\nexport interface QrLogoShapeConfig {\n  type: \"Circle\" | \"Square\" | \"Rhombus\";\n  image?: string | null;\n  sizeRatio?: number;\n  padding?: number;\n  color?: QrColorConfig;\n}\n\nfunction createQrLogoShape(config: QrLogoShapeConfig): IQrLogoShape {\n  const color = config.color ? createQrColor(config.color) : undefined;\n  switch (config.type) {\n    case \"Circle\":\n      return new QrLogoShape.Circle(\n        config.image,\n        config.sizeRatio,\n        config.padding,\n        color,\n      );\n    case \"Rhombus\":\n      return new QrLogoShape.Rhombus(\n        config.image,\n        config.sizeRatio,\n        config.padding,\n        color,\n      );\n    case \"Square\":\n    default:\n      return new QrLogoShape.Square(\n        config.image,\n        config.sizeRatio,\n        config.padding,\n        color,\n      );\n  }\n}\n\n/** --------------------------------------------------------------------------\n * QR MatrixPixelShape configuration.\n */\nexport interface QrMatrixPixelShapeConfig {\n  pixelShape?: QrPixelShapeConfig;\n  color?: QrColorConfig;\n}\n\nfunction createQrMatrixPixelShape(\n  config: QrMatrixPixelShapeConfig,\n): QrMatrixPixelShape {\n  return new QrMatrixPixelShape(\n    config.pixelShape ? createQrPixelShape(config.pixelShape) : undefined,\n    config.color ? createQrColor(config.color) : undefined,\n  );\n}\n\n/** --------------------------------------------------------------------------\n * QR PixelShape configuration.\n */\ntype QrPixelShapeType =\n  | \"Square\"\n  | \"Circle\"\n  | \"RoundCorners\"\n  | \"StickyCorners\"\n  | \"Rhombus\"\n  | \"Star\"\n  | \"RoundCornersVertical\"\n  | \"RoundCornersHorizontal\"\n  | \"Hexagon\"\n  | \"Octagon\";\n\n// Discriminated union for pixel shapes\ninterface QrPixelShapeBase {\n  type: QrPixelShapeType;\n  sizeRatio?: number;\n}\n\ninterface QrPixelShapeBasic extends QrPixelShapeBase {\n  type: \"Circle\" | \"Square\" | \"Rhombus\" | \"Star\" | \"Hexagon\" | \"Octagon\";\n}\n\ninterface QrPixelShapeWithRadius extends QrPixelShapeBase {\n  type:\n    | \"RoundCorners\"\n    | \"StickyCorners\"\n    | \"RoundCornersVertical\"\n    | \"RoundCornersHorizontal\";\n  cornerRadius?: number;\n}\n\n// Union of all pixel shape types\nexport type QrPixelShapeConfig = QrPixelShapeBasic | QrPixelShapeWithRadius;\n\nfunction createQrPixelShape(config: QrPixelShapeConfig): IQrPixelShape {\n  switch (config.type) {\n    case \"Circle\":\n      return new QrPixelShape.Circle(config.sizeRatio);\n    case \"RoundCorners\":\n      return new QrPixelShape.RoundCorners(\n        config.sizeRatio,\n        config.cornerRadius,\n      );\n    case \"StickyCorners\":\n      return new QrPixelShape.StickyCorners(\n        config.sizeRatio,\n        config.cornerRadius,\n      );\n    case \"Square\":\n      return new QrPixelShape.Square(config.sizeRatio);\n    case \"Rhombus\":\n      return new QrPixelShape.Rhombus(config.sizeRatio);\n    case \"Star\":\n      return new QrPixelShape.Star(config.sizeRatio);\n    case \"RoundCornersVertical\":\n      return new QrPixelShape.RoundCornersVertical(\n        config.sizeRatio,\n        config.cornerRadius,\n      );\n    case \"RoundCornersHorizontal\":\n      return new QrPixelShape.RoundCornersHorizontal(\n        config.sizeRatio,\n        config.cornerRadius,\n      );\n    case \"Hexagon\":\n      return new QrPixelShape.Hexagon(config.sizeRatio);\n    case \"Octagon\":\n      return new QrPixelShape.Octagon(config.sizeRatio);\n  }\n}\n\n/** --------------------------------------------------------------------------\n * QR Shape configuration.\n */\nexport type QrShapeType = \"Circle\" | \"Square\";\n\nexport interface QrShapeConfig {\n  type: QrShapeType;\n  seed?: number;\n}\n\nexport function createQrShape(config: QrShapeConfig): IQrShape {\n  return config.type === \"Circle\"\n    ? new QrShape.Circle(config.seed)\n    : new QrShape.Square();\n}\n\n/** --------------------------------------------------------------------------\n * QR TimingLineShape configuration.\n */\nexport interface QrTimingLineShapeConfig {\n  pixelShape: QrPixelShapeConfig;\n  color?: QrColorConfig;\n}\n\nexport function createQrTimingLineShape(\n  config: QrTimingLineShapeConfig,\n): QrTimingLineShape {\n  return new QrTimingLineShape(\n    createQrPixelShape(config.pixelShape),\n    config.color ? createQrColor(config.color) : undefined,\n  );\n}\n\n/** --------------------------------------------------------------------------\n * QR Color configuration.\n */\n\nexport type QrColorConfig =\n  | { type: \"Solid\"; value: string }\n  | {\n      type: \"LinearGradient\";\n      colors: Array<[number, string]>;\n      orientation: LinearGradientOrientationConfig;\n    }\n  | { type: \"RadialGradient\"; colors: Array<[number, string]>; radius?: number }\n  | { type: \"SweepGradient\"; colors: Array<[number, string]> };\n\nfunction createQrColor(config: QrColorConfig): IQrColor {\n  switch (config.type) {\n    case \"LinearGradient\":\n      return new QrColor.LinearGradient(\n        config.colors,\n        LinearGradientOrientation.fromString(config.orientation),\n      );\n    case \"RadialGradient\":\n      return new QrColor.RadialGradient(config.colors, config.radius);\n    case \"SweepGradient\":\n      return new QrColor.SweepGradient(config.colors);\n    case \"Solid\":\n    default:\n      return new QrColor.Solid(config.value);\n  }\n}\n","import {\n  QrErrorCorrectionLevel,\n  type QrErrorCorrectionLevelConfig,\n} from \"../encode/QrCodedText\";\nimport { QrShapes } from \"./QrShapes\";\nimport {\n  createQrShapesFromConfig,\n  type QrShapesConfig,\n} from \"../mapper/QrShapesMapper\";\n\nexport interface QrOptionsConfig {\n  sizeRatio?: number;\n  shapes?: QrShapesConfig;\n  errorCorrectionLevel?: QrErrorCorrectionLevelConfig;\n}\n\n// Represents the options of the QR code\nexport class QrOptions {\n  sizeRatio: number;\n  shapes: QrShapes;\n  errorCorrectionLevel: QrErrorCorrectionLevel;\n\n  constructor(config: QrOptionsConfig) {\n    this.sizeRatio = config.sizeRatio ?? 1;\n    this.shapes = config.shapes\n      ? createQrShapesFromConfig(config.shapes)\n      : new QrShapes(null, null, null, null, null, null, null, null);\n    this.errorCorrectionLevel = config.errorCorrectionLevel\n      ? QrErrorCorrectionLevel.fromString(config.errorCorrectionLevel)\n      : QrErrorCorrectionLevel.HIGH;\n  }\n}\n","import type { QrCodeMatrix } from \"../encode/QrCodeMatrix\";\nimport { type QrOptions } from \"../options/QrOptions\";\nimport {\n  computeViewBoxIncrease,\n  createSvgGroupFromElements,\n} from \"../utils/SvgUtils\";\nimport { eyeFrameSize } from \"./shapes/QrEyeFrameShape\";\n\nexport class QrShapesDesigner {\n  usedCoordinates = new Set<string>();\n\n  constructor(\n    public qrMatrix: QrCodeMatrix,\n    public options: QrOptions,\n    public mainSvg: SVGElement,\n  ) {}\n\n  get qrXOrigin() {\n    return this.shapes.qrCode.qrOriginStart[0];\n  }\n\n  get qrYOrigin() {\n    return this.shapes.qrCode.qrOriginStart[1];\n  }\n\n  get qrXEnd() {\n    return this.qrMatrix.size - this.qrXOrigin;\n  }\n\n  get qrYEnd() {\n    return this.qrMatrix.size - this.qrYOrigin;\n  }\n\n  get shapes() {\n    return this.options.shapes;\n  }\n\n  addUsedCoordinate(x: number, y: number) {\n    this.usedCoordinates.add(`${x},${y}`);\n  }\n\n  isUsedCoordinate(x: number, y: number) {\n    return this.usedCoordinates.has(`${x},${y}`);\n  }\n\n  // Get the start coordinates for different QR code elements\n  private get qrCodeElementStartCoordinate() {\n    const { qrXOrigin, qrYOrigin, qrXEnd, qrYEnd } = this;\n    const eyePositions = [\n      { x: qrXOrigin, y: qrYOrigin }, // Top-left corner\n      { x: qrXEnd - eyeFrameSize, y: qrYOrigin }, // Top-right corner\n      { x: qrXOrigin, y: qrYEnd - eyeFrameSize }, // Bottom-left corner\n    ];\n\n    return {\n      timingLinePosition: {\n        x: qrXOrigin + eyeFrameSize - 1,\n        y: qrYOrigin + eyeFrameSize - 1,\n      },\n      eyesFramesPositions: eyePositions,\n      eyesPositions: eyePositions.map(({ x, y }) => ({ x: x + 2, y: y + 2 })), // Slight offset for inner eye\n      alignmentPatternPosition: { x: qrXEnd - 9, y: qrYEnd - 9 },\n    };\n  }\n\n  drawSvg() {\n    if (!this.qrMatrix) throw new Error(\"No QR matrix set\");\n\n    const { shapes, mainSvg, qrCodeElementStartCoordinate } = this;\n    const qrGroupedElements = [];\n\n    // Create background if defined\n    if (shapes.background)\n      mainSvg.appendChild(shapes.background.createSvgElement(mainSvg));\n\n    // Create timing line if defined\n    if (shapes.timingLine) {\n      qrGroupedElements.push(\n        shapes.timingLine.createSvgElement(\n          qrCodeElementStartCoordinate.timingLinePosition.x,\n          qrCodeElementStartCoordinate.timingLinePosition.y,\n          this,\n        ),\n      );\n    }\n\n    // Create eye frames if defined\n    if (shapes.eyeFrame) {\n      qrCodeElementStartCoordinate.eyesFramesPositions.forEach(({ x, y }) => {\n        qrGroupedElements.push(shapes.eyeFrame!.createSvgElement(x, y, this));\n      });\n    }\n\n    // Create eye inner parts if defined\n    if (shapes.eye) {\n      qrCodeElementStartCoordinate.eyesPositions.forEach(({ x, y }) => {\n        qrGroupedElements.push(shapes.eye!.createSvgElement(x, y, this));\n      });\n    }\n\n    // Add logo if defined\n    if (shapes.logo)\n      qrGroupedElements.push(shapes.logo.createSvgElement(mainSvg, this));\n\n    // Create alignment pattern if defined\n    if (shapes.alignmentPattern) {\n      qrGroupedElements.push(\n        shapes.alignmentPattern.createSvgElement(\n          qrCodeElementStartCoordinate.alignmentPatternPosition.x,\n          qrCodeElementStartCoordinate.alignmentPatternPosition.y,\n          this,\n        ),\n      );\n    }\n\n    // Create QR code matrix\n    qrGroupedElements.push(shapes.matrixPixel.createSvgElement(0, 0, this));\n\n    // Group all elements, apply padding, and append to the main SVG\n    const g = createSvgGroupFromElements(qrGroupedElements);\n    const padding =\n      computeViewBoxIncrease(this.qrMatrix.size, this.options.sizeRatio) / 2;\n    g.setAttribute(\"transform\", `translate(${padding}, ${padding})`); // To center the QR code if sizeRatio is set\n    mainSvg.appendChild(g);\n  }\n}\n","// Base interface for all QR Data types\nexport interface IQrData {\n  encode(): string;\n}\n\n// Class representing simple text for QR\nclass Text implements IQrData {\n  constructor(public value: string) {}\n\n  encode(): string {\n    return this.value;\n  }\n}\n\n// Class representing URLs for QR\nclass Url implements IQrData {\n  constructor(public url: string) {}\n\n  encode(): string {\n    return this.url;\n  }\n}\n\n// Class representing email data for QR\nclass Email implements IQrData {\n  constructor(\n    public email: string,\n    public copyTo?: string,\n    public subject?: string,\n    public body?: string,\n  ) {}\n\n  encode(): string {\n    const queries: string[] = [];\n\n    if (this.copyTo) queries.push(`cc=${this.copyTo}`);\n    if (this.subject) queries.push(`subject=${this.escape(this.subject)}`);\n    if (this.body) queries.push(`body=${this.escape(this.body)}`);\n\n    const queryString = queries.length > 0 ? `?${queries.join(\"&\")}` : \"\";\n    return `mailto:${this.email}${queryString}`;\n  }\n\n  private escape(text: string): string {\n    return encodeURIComponent(text).replace(/\\+/g, \" \");\n  }\n}\n\n// Class representing geographic coordinates for QR\nclass GeoPos implements IQrData {\n  constructor(\n    public lat: number,\n    public lon: number,\n  ) {}\n\n  encode(): string {\n    return `GEO:${this.lat},${this.lon}`;\n  }\n}\n\n// Class representing bookmark data for QR\nclass Bookmark implements IQrData {\n  constructor(\n    public url: string,\n    public title: string,\n  ) {}\n\n  encode(): string {\n    return `MEBKM:URL:${this.url};TITLE:${this.title};`;\n  }\n}\n\n// Enum representing Wi-Fi authentication types\nexport enum Authentication {\n  WEP = \"WEP\",\n  WPA = \"WPA\",\n  OPEN = \"nopass\",\n}\n\n// Class representing Wi-Fi credentials for QR\nclass Wifi implements IQrData {\n  constructor(\n    public authentication?: Authentication,\n    public ssid?: string,\n    public psk?: string,\n    public hidden: boolean = false,\n  ) {}\n\n  encode(): string {\n    return (\n      `WIFI:${this.ssid ? `S:${Wifi.escape(this.ssid)};` : \"\"}` +\n      `${this.authentication ? `T:${this.authentication};` : \"\"}` +\n      `${this.psk ? `P:${Wifi.escape(this.psk)};` : \"\"}` +\n      `H:${this.hidden};`\n    );\n  }\n\n  static escape(text: string): string {\n    return text.replace(/[\\\\,;.\"']/g, (match) => `\\\\${match}`);\n  }\n}\n\n// Class representing enterprise Wi-Fi credentials for QR\nclass EnterpriseWifi implements IQrData {\n  constructor(\n    public ssid?: string,\n    public psk?: string,\n    public hidden: boolean = false,\n    public user?: string,\n    public eap?: string,\n    public phase?: string,\n  ) {}\n\n  encode(): string {\n    return (\n      `WIFI:${this.ssid ? `S:${Wifi.escape(this.ssid)};` : \"\"}` +\n      `${this.user ? `U:${Wifi.escape(this.user)};` : \"\"}` +\n      `${this.psk ? `P:${Wifi.escape(this.psk)};` : \"\"}` +\n      `${this.eap ? `E:${Wifi.escape(this.eap)};` : \"\"}` +\n      `${this.phase ? `PH:${Wifi.escape(this.phase)};` : \"\"}` +\n      `H:${this.hidden};`\n    );\n  }\n}\n\n// Class representing phone numbers for QR\nclass Phone implements IQrData {\n  constructor(public phoneNumber: string) {}\n\n  encode(): string {\n    return `TEL:${this.phoneNumber}`;\n  }\n}\n\n// Class representing SMS or MMS data for QR\nclass SMS implements IQrData {\n  constructor(\n    public phoneNumber: string,\n    public subject: string,\n    public isMMS: boolean = false,\n  ) {}\n\n  encode(): string {\n    return `${this.isMMS ? \"MMS\" : \"SMS\"}:${this.phoneNumber}${this.subject ? `:${this.subject}` : \"\"}`;\n  }\n}\n\n// Class representing business cards for QR (BizCard format)\nclass BizCard implements IQrData {\n  constructor(\n    public firstName?: string,\n    public secondName?: string,\n    public job?: string,\n    public company?: string,\n    public address?: string,\n    public phone?: string,\n    public email?: string,\n  ) {}\n\n  encode(): string {\n    return (\n      `BIZCARD:` +\n      `${this.firstName ? `N:${this.firstName};` : \"\"}` +\n      `${this.secondName ? `X:${this.secondName};` : \"\"}` +\n      `${this.job ? `T:${this.job};` : \"\"}` +\n      `${this.company ? `C:${this.company};` : \"\"}` +\n      `${this.address ? `A:${this.address};` : \"\"}` +\n      `${this.phone ? `B:${this.phone};` : \"\"}` +\n      `${this.email ? `E:${this.email};` : \"\"}` +\n      `;`\n    );\n  }\n}\n\n// Class representing VCards for QR\nclass VCard implements IQrData {\n  constructor(\n    public name?: string,\n    public company?: string,\n    public title?: string,\n    public phoneNumber?: string,\n    public email?: string,\n    public address?: string,\n    public website?: string,\n    public note?: string,\n  ) {}\n\n  encode(): string {\n    return (\n      `BEGIN:VCARD\\nVERSION:3.0\\n` +\n      `${this.name ? `N:${this.name}\\n` : \"\"}` +\n      `${this.company ? `ORG:${this.company}\\n` : \"\"}` +\n      `${this.title ? `TITLE:${this.title}\\n` : \"\"}` +\n      `${this.phoneNumber ? `TEL:${this.phoneNumber}\\n` : \"\"}` +\n      `${this.website ? `URL:${this.website}\\n` : \"\"}` +\n      `${this.email ? `EMAIL:${this.email}\\n` : \"\"}` +\n      `${this.address ? `ADR:${this.address}\\n` : \"\"}` +\n      `${this.note ? `NOTE:${this.note}\\n` : \"\"}` +\n      `END:VCARD`\n    );\n  }\n}\n\n// Class representing MeCards for QR\nclass MeCard implements IQrData {\n  constructor(\n    public name?: string,\n    public address?: string,\n    public phoneNumber?: string,\n    public email?: string,\n  ) {}\n\n  encode(): string {\n    return (\n      `MECARD:` +\n      `${this.name ? `N:${this.name};` : \"\"}` +\n      `${this.address ? `ADR:${this.address};` : \"\"}` +\n      `${this.phoneNumber ? `TEL:${this.phoneNumber};` : \"\"}` +\n      `${this.email ? `EMAIL:${this.email};` : \"\"}` +\n      `;`\n    );\n  }\n}\n\n// Class representing YouTube videos for QR\nclass YouTube implements IQrData {\n  constructor(public videoId: string) {}\n\n  encode(): string {\n    return `YOUTUBE:${this.videoId}`;\n  }\n}\n\n// Class representing events for QR (iCalendar format)\nclass Event implements IQrData {\n  constructor(\n    public uid?: string,\n    public stamp?: string,\n    public organizer?: string,\n    public start?: string,\n    public end?: string,\n    public summary?: string,\n  ) {}\n\n  encode(): string {\n    return (\n      `BEGIN:VEVENT\\n` +\n      `${this.uid ? `UID:${this.uid}\\n` : \"\"}` +\n      `${this.stamp ? `DTSTAMP:${this.stamp}\\n` : \"\"}` +\n      `${this.organizer ? `ORGANIZER:${this.organizer}\\n` : \"\"}` +\n      `${this.start ? `DTSTART:${this.start}\\n` : \"\"}` +\n      `${this.end ? `DTEND:${this.end}\\n` : \"\"}` +\n      `${this.summary ? `SUMMARY:${this.summary}\\n` : \"\"}` +\n      `END:VEVENT`\n    );\n  }\n}\n\n// Class representing Google Play apps for QR\nclass GooglePlay implements IQrData {\n  constructor(public appPackage: string) {}\n\n  encode(): string {\n    return `market://details?id=${this.appPackage}`;\n  }\n}\n\nexport {\n  Text,\n  Url,\n  Email,\n  GeoPos,\n  Bookmark,\n  Wifi,\n  EnterpriseWifi,\n  Phone,\n  SMS,\n  BizCard,\n  VCard,\n  MeCard,\n  YouTube,\n  Event,\n  GooglePlay,\n};\n","import {\n  Text,\n  Authentication,\n  BizCard,\n  Bookmark,\n  Email,\n  Event,\n  EnterpriseWifi,\n  GeoPos,\n  GooglePlay,\n  MeCard,\n  Phone,\n  SMS,\n  Url,\n  VCard,\n  Wifi,\n  YouTube,\n  type IQrData,\n} from \"../encode/QrData\";\n\n/** --------------------------------------------------------------------------\n * Factory data configuration.\n */\n\nexport type QrDataConfig =\n  | TextConfig\n  | UrlConfig\n  | EmailConfig\n  | GeoPosConfig\n  | BookmarkConfig\n  | WifiConfig\n  | EnterpriseWifiConfig\n  | PhoneConfig\n  | SMSConfig\n  | BizCardConfig\n  | VCardConfig\n  | MeCardConfig\n  | YouTubeConfig\n  | EventConfig\n  | GooglePlayConfig;\n\nexport function createQrDataFromConfig(config: QrDataConfig): IQrData {\n  switch (config.type) {\n    case \"Text\":\n      return new Text(config.data.value);\n    case \"Url\":\n      return new Url(config.data.url);\n    case \"Email\":\n      return new Email(\n        config.data.email,\n        config.data.copyTo,\n        config.data.subject,\n        config.data.body,\n      );\n    case \"GeoPos\":\n      return new GeoPos(config.data.lat, config.data.lon);\n    case \"Bookmark\":\n      return new Bookmark(config.data.url, config.data.title);\n    case \"Wifi\":\n      return new Wifi(\n        config.data.authentication,\n        config.data.ssid,\n        config.data.psk,\n        config.data.hidden ?? false,\n      );\n    case \"EnterpriseWifi\":\n      return new EnterpriseWifi(\n        config.data.ssid,\n        config.data.psk,\n        config.data.hidden ?? false,\n        config.data.user,\n        config.data.eap,\n        config.data.phase,\n      );\n    case \"Phone\":\n      return new Phone(config.data.phoneNumber);\n    case \"SMS\":\n      return new SMS(\n        config.data.phoneNumber,\n        config.data.subject,\n        config.data.isMMS,\n      );\n    case \"BizCard\":\n      return new BizCard(\n        config.data.firstName,\n        config.data.secondName,\n        config.data.job,\n        config.data.company,\n        config.data.address,\n        config.data.phone,\n        config.data.email,\n      );\n    case \"VCard\":\n      return new VCard(\n        config.data.name,\n        config.data.company,\n        config.data.title,\n        config.data.phoneNumber,\n        config.data.email,\n        config.data.address,\n        config.data.website,\n        config.data.note,\n      );\n    case \"MeCard\":\n      return new MeCard(\n        config.data.name,\n        config.data.address,\n        config.data.phoneNumber,\n        config.data.email,\n      );\n    case \"YouTube\":\n      return new YouTube(config.data.videoId);\n    case \"Event\":\n      return new Event(\n        config.data.uid,\n        config.data.stamp,\n        config.data.organizer,\n        config.data.start,\n        config.data.end,\n        config.data.summary,\n      );\n    case \"GooglePlay\":\n      return new GooglePlay(config.data.appPackage);\n  }\n}\n\n/** --------------------------------------------------------------------------\n * QrData types configuration.\n */\n\ninterface TextConfig {\n  type: \"Text\";\n  data: { value: string };\n}\n\ninterface UrlConfig {\n  type: \"Url\";\n  data: { url: string };\n}\n\ninterface EmailConfig {\n  type: \"Email\";\n  data: {\n    email: string;\n    copyTo?: string;\n    subject?: string;\n    body?: string;\n  };\n}\n\ninterface GeoPosConfig {\n  type: \"GeoPos\";\n  data: { lat: number; lon: number };\n}\n\ninterface BookmarkConfig {\n  type: \"Bookmark\";\n  data: { url: string; title: string };\n}\n\ninterface WifiConfig {\n  type: \"Wifi\";\n  data: {\n    authentication?: Authentication;\n    ssid?: string;\n    psk?: string;\n    hidden?: boolean;\n  };\n}\n\ninterface EnterpriseWifiConfig {\n  type: \"EnterpriseWifi\";\n  data: {\n    ssid?: string;\n    psk?: string;\n    hidden?: boolean;\n    user?: string;\n    eap?: string;\n    phase?: string;\n  };\n}\n\ninterface PhoneConfig {\n  type: \"Phone\";\n  data: { phoneNumber: string };\n}\n\ninterface SMSConfig {\n  type: \"SMS\";\n  data: { phoneNumber: string; subject: string; isMMS: boolean };\n}\n\ninterface BizCardConfig {\n  type: \"BizCard\";\n  data: {\n    firstName?: string;\n    secondName?: string;\n    job?: string;\n    company?: string;\n    address?: string;\n    phone?: string;\n    email?: string;\n  };\n}\n\ninterface VCardConfig {\n  type: \"VCard\";\n  data: {\n    name?: string;\n    company?: string;\n    title?: string;\n    phoneNumber?: string;\n    email?: string;\n    address?: string;\n    website?: string;\n    note?: string;\n  };\n}\n\ninterface MeCardConfig {\n  type: \"MeCard\";\n  data: {\n    name?: string;\n    address?: string;\n    phoneNumber?: string;\n    email?: string;\n  };\n}\n\ninterface YouTubeConfig {\n  type: \"YouTube\";\n  data: { videoId: string };\n}\n\ninterface EventConfig {\n  type: \"Event\";\n  data: {\n    uid?: string;\n    stamp?: string;\n    organizer?: string;\n    start?: string;\n    end?: string;\n    summary?: string;\n  };\n}\n\ninterface GooglePlayConfig {\n  type: \"GooglePlay\";\n  data: { appPackage: string };\n}\n","import { QrCodeMatrix } from \"../encode/QrCodeMatrix\";\nimport { QrOptions, type QrOptionsConfig } from \"../options/QrOptions\";\nimport { QrShapesDesigner } from \"../style/QrShapesDesigner\";\nimport { QrCodedText } from \"../encode/QrCodedText\";\nimport type { IQrData } from \"../encode/QrData\";\nimport { computeViewBoxIncrease } from \"../utils/SvgUtils\";\nimport {\n  createQrDataFromConfig,\n  type QrDataConfig,\n} from \"../mapper/QrDataMapper\";\n\nexport interface QrCodeConfig {\n  data: QrDataConfig;\n  options?: QrOptionsConfig;\n}\n\n// Client function to init a custom QR code instance without draw it\nexport function QrCodeGenerator(\n  svgElement: SVGSVGElement,\n  config: QrCodeConfig,\n): QrCodeGeneratorImpl {\n  return new QrCodeGeneratorImpl(\n    svgElement,\n    createQrDataFromConfig(config.data),\n    new QrOptions(config.options ?? {}),\n  );\n}\n\n// Class that handles the QR code generation process in SVG format\nclass QrCodeGeneratorImpl {\n  private codeMatrix: QrCodeMatrix;\n\n  constructor(\n    private svg: SVGSVGElement,\n    data: IQrData,\n    private options: QrOptions,\n  ) {\n    // Generate the base QR code matrix\n    const code = QrCodedText.encodeText(\n      data.encode(),\n      options.errorCorrectionLevel,\n    );\n    this.codeMatrix = options.shapes.qrCode.apply(\n      QrCodeMatrix.fromQrMatrix(code),\n    );\n  }\n\n  // Generate the SVG for the QR code and append it to the SVG element given to the constructor\n  public generateSvg(): void {\n    this.svg.innerHTML = \"\"; // Clear previous content\n\n    // Increase the viewbox size to fit the QR code\n    let fitSize;\n    if (this.options.sizeRatio !== 0) {\n      fitSize =\n        this.codeMatrix.size +\n        computeViewBoxIncrease(this.codeMatrix.size, this.options.sizeRatio);\n    } else {\n      fitSize = 0;\n    }\n\n    this.svg.setAttribute(\"viewBox\", `0 0 ${fitSize} ${fitSize}`);\n    this.svg.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n\n    new QrShapesDesigner(this.codeMatrix, this.options, this.svg).drawSvg();\n  }\n}\n"],"names":["PixelType","QrCodeMatrix","constructor","size","this","origin","matrix","Array","from","length","fill","Background","get","i","j","isOutOfBounds","RangeError","set","type","fromQrMatrix","byteMatrix","qrMatrix","value","getModule","DarkPixel","QrCodedText","encodeText","text","ecl","segs","QrSegment","makeSegments","encodeSegments","minVersion","maxVersion","mask","boostEcl","MIN_VERSION","MAX_VERSION","version","dataUsedBits","dataCapacityBits","getNumDataCodewords","usedBits","getTotalBits","newEcl","QrErrorCorrectionLevel","MEDIUM","QUARTILE","HIGH","bb","seg","appendBits","mode","modeBits","numChars","numCharCountBits","b","getData","push","assert","Math","min","padByte","dataCodewords","forEach","errorCorrectionLevel","msk","modules","isFunction","row","slice","drawFunctionPatterns","allCodewords","addEccAndInterleave","drawCodewords","minPenalty","applyMask","drawFormatBits","penalty","getPenaltyScore","x","y","setFunctionModule","drawFinderPattern","alignPatPos","getAlignmentPatternPositions","numAlign","drawAlignmentPattern","drawVersion","data","formatBits","rem","bits","getBit","color","a","floor","dy","dx","dist","max","abs","xx","yy","isDark","ver","numBlocks","NUM_ERROR_CORRECTION_BLOCKS","ordinal","blockEccLen","ECC_CODEWORDS_PER_BLOCK","rawCodewords","getNumRawDataModules","numShortBlocks","shortBlockLen","blocks","rsDiv","reedSolomonComputeDivisor","k","dat","ecc","reedSolomonComputeRemainder","concat","result","block","right","vert","invert","Error","runColor","runX","runHistory","PENALTY_N1","finderPenaltyAddHistory","finderPenaltyCountPatterns","PENALTY_N3","finderPenaltyTerminateAndCount","runY","PENALTY_N2","dark","reduce","sum","total","ceil","PENALTY_N4","step","pos","splice","degree","root","reedSolomonMultiply","divisor","map","_","factor","shift","coef","z","n","core","currentRunColor","currentRunLength","pop","unshift","val","len","cond","makeBytes","Mode","BYTE","makeNumeric","digits","isNumeric","parseInt","substring","NUMERIC","makeAlphanumeric","isAlphanumeric","temp","ALPHANUMERIC_CHARSET","indexOf","charAt","ALPHANUMERIC","toUtf8ByteArray","makeEci","assignVal","ECI","NUMERIC_REGEX","test","ALPHANUMERIC_REGEX","bitData","ccbits","Infinity","str","encodeURI","charCodeAt","fromString","level","LOW","numBitsCharCount","KANJI","SVG_NS","createSvgPathFromString","pathData","pathElement","document","createElementNS","setAttribute","createSvgGroupFromElements","elements","groupElement","element","appendChild","getDefsElement","mainSvg","defs","querySelector","insertBefore","firstChild","computeViewBoxIncrease","codeMatrixSize","sizeRatio","LinearGradientOrientation","start","end","orientation","Vertical","Horizontal","LeftDiagonal","RightDiagonal","QrColor","applyToElement","colors","gradientId","random","toString","gradientElement","createGradientElement","offset","appendStopElement","stopElement","radius","sqrt","QrBackground","imageData","padding","createSvgElement","rect","createBaseRect","createPattern","pattern","bgRect","image","createImageElement","BaseShape","QrPixelShape","Square","fitSize","Circle","RoundCorners","cornerRadius","super","Rhombus","halfSize","Star","centerX","centerY","angle","PI","cos","sin","join","RoundCornersVertical","RoundCornersHorizontal","StickyCorners","neighbors","path","top","bottom","left","Hexagon","quarterSize","Octagon","offsetXY","BaseEyeShape","addEyeCoordinates","designer","addUsedCoordinate","setAttributes","attributes","Object","entries","key","QrEyeShape","corner","width","height","rx","ry","circle","cx","eyeSize","cy","r","polygon","points","point","px","py","split","Number","Neighbors","topRight","bottomRight","bottomLeft","topLeft","empty","emptyInstance","getNeighbors","cmp","i2","j2","BaseEyeFrameShape","pixelShape","addEyeFrameCoordinates","QrEyeFrameShape","options","shapes","background","svg","eyeFrameSize","rInner","thickness","distance","BaseLogoShape","addLogoCoordinates","clipPathId","includes","svgDoc","DOMParser","parseFromString","importedSvg","importNode","documentElement","group","img","setAttributeNS","QrLogoShape","logoSize","svgElements","round","substr","createClipPath","imgSize","clipPath","clipRect","addCircleCoordinates","bgCircle","clipCircle","minX","maxX","minY","maxY","addRhombusLogoCoordinates","bgPolygon","paddingHalfSize","clipPoints","clipPolygon","QrMatrixPixelShape","matrixSize","isDarkPixel","isUsedCoordinate","Random","seed","nextBoolean","QrShape","qrOriginStart","apply","pixelInShape","addedPoints","Set","added","newSize","newMatrix","center","fillCircularPixels","copyOriginalMatrix","has","isInCircularArea","isAdjacentToEyeFrame","add","sides","some","isPixelAdjacentToEyeFrame","QrTimingLineShape","timingLineEnd","qrXEnd","processPixel","QrShapes","alignmentPattern","eyeFrame","eye","logo","matrixPixel","qrCode","timingLine","BaseAlignmentPatternShape","addAlignmentPatternCoordinates","QrAlignmentPatternShape","createPixelPath","createSimpleSquarePath","alignmentPatternSize","createCirclePathData","createQrShapesFromConfig","config","createQrPixelShape","createQrColor","undefined","createQrAlignmentPatternShape","createQrBackground","createQrEyeFrameShape","createQrEyeShape","createQrLogoShape","createQrMatrixPixelShape","createQrShape","createQrTimingLineShape","QrOptions","QrShapesDesigner","usedCoordinates","qrXOrigin","qrYOrigin","qrYEnd","qrCodeElementStartCoordinate","eyePositions","timingLinePosition","eyesFramesPositions","eyesPositions","alignmentPatternPosition","drawSvg","qrGroupedElements","g","Text","encode","Url","url","Email","email","copyTo","subject","body","queries","escape","queryString","encodeURIComponent","replace","GeoPos","lat","lon","Bookmark","title","Authentication","Wifi","authentication","ssid","psk","hidden","match","EnterpriseWifi","user","eap","phase","Phone","phoneNumber","SMS","isMMS","BizCard","firstName","secondName","job","company","address","phone","VCard","name","website","note","MeCard","YouTube","videoId","Event","uid","stamp","organizer","summary","GooglePlay","appPackage","createQrDataFromConfig","QrCodeGenerator","svgElement","QrCodeGeneratorImpl","code","codeMatrix","generateSvg","innerHTML"],"mappings":";;;;;AAEA,IAAYA,GAAZ,SAAYA,GACVA,EAAA,UAAA,YACAA,EAAA,WAAA,YACD,CAHD,CAAYA,IAAAA,EAGX,CAAA,UAMYC,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