@linxin666/dsh-remote-bridge 0.4.7 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +93 -26
  3. package/README.zh.md +91 -26
  4. package/icon.svg +3 -0
  5. package/lib/client.js +274 -253
  6. package/lib/client.js.map +1 -1
  7. package/lib/index.js +8891 -2433
  8. package/lib/types/client/PairEntry.d.ts +2 -2
  9. package/lib/types/client/PairPanel.d.ts +10 -2
  10. package/lib/types/client/icons.d.ts +5 -13
  11. package/lib/types/client/locales.d.ts +10 -14
  12. package/lib/types/client/semantic.d.ts +9 -5
  13. package/lib/types/core/approvals.d.ts +24 -0
  14. package/lib/types/core/commands.d.ts +59 -0
  15. package/lib/types/core/connection.d.ts +124 -5
  16. package/lib/types/core/delta.d.ts +101 -0
  17. package/lib/types/core/devices.d.ts +98 -2
  18. package/lib/types/core/dsh-frames.d.ts +155 -4
  19. package/lib/types/core/envelope.d.ts +34 -0
  20. package/lib/types/core/extension.d.ts +144 -0
  21. package/lib/types/core/hub.d.ts +96 -20
  22. package/lib/types/core/jobs.d.ts +204 -0
  23. package/lib/types/core/liveactivity.d.ts +324 -0
  24. package/lib/types/core/protocol.d.ts +491 -2
  25. package/lib/types/core/push.d.ts +178 -0
  26. package/lib/types/core/questions.d.ts +109 -9
  27. package/lib/types/core/session-meta.d.ts +55 -1
  28. package/lib/types/core/squads.d.ts +130 -0
  29. package/lib/types/core/usage-stats.d.ts +160 -0
  30. package/lib/types/core/usage.d.ts +294 -0
  31. package/lib/types/core/wire.d.ts +1 -1
  32. package/lib/types/core/ws-frames.d.ts +11 -0
  33. package/lib/types/host/apns.d.ts +151 -0
  34. package/lib/types/host/squads-ledger.d.ts +39 -0
  35. package/lib/types/host/squads.d.ts +77 -0
  36. package/lib/types/host/usage-stats.d.ts +75 -0
  37. package/lib/types/host/watchers.d.ts +88 -0
  38. package/lib/types/host/websocket.d.ts +8 -1
  39. package/lib/types/index.d.ts +34 -3
  40. package/lib/types/mount-once.d.ts +55 -0
  41. package/locale/en.json +6 -0
  42. package/locale/ru.json +6 -0
  43. package/locale/zh.json +6 -0
  44. package/package.json +20 -14
  45. package/src/client/PairEntry.tsx +58 -31
  46. package/src/client/PairPanel.tsx +181 -97
  47. package/src/client/icons.tsx +17 -60
  48. package/src/client/locales.ts +15 -23
  49. package/src/client/panel.module.css +239 -186
  50. package/src/client/semantic.ts +10 -6
  51. package/src/core/approvals.ts +32 -1
  52. package/src/core/commands.ts +95 -0
  53. package/src/core/connection.ts +1483 -31
  54. package/src/core/delta.ts +204 -0
  55. package/src/core/devices.ts +221 -3
  56. package/src/core/dsh-frames.ts +365 -8
  57. package/src/core/envelope.ts +46 -0
  58. package/src/core/extension.ts +197 -0
  59. package/src/core/hub.ts +441 -49
  60. package/src/core/jobs.ts +372 -0
  61. package/src/core/liveactivity.ts +833 -0
  62. package/src/core/protocol.ts +556 -2
  63. package/src/core/push.ts +354 -0
  64. package/src/core/questions.ts +264 -17
  65. package/src/core/session-meta.ts +73 -1
  66. package/src/core/squads.ts +345 -0
  67. package/src/core/usage-stats.ts +424 -0
  68. package/src/core/usage.ts +937 -0
  69. package/src/core/wire.ts +13 -1
  70. package/src/core/ws-frames.ts +14 -0
  71. package/src/host/apns.ts +320 -0
  72. package/src/host/squads-ledger.ts +105 -0
  73. package/src/host/squads.ts +206 -0
  74. package/src/host/usage-stats.ts +155 -0
  75. package/src/host/watchers.ts +272 -0
  76. package/src/host/websocket.ts +37 -3
  77. package/src/index.ts +310 -9
  78. package/src/mount-once.ts +142 -0
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["React","css","css","writeClipboard"],"sources":["../../../node_modules/.pnpm/qrcode.react@4.2.0_react@18.3.1/node_modules/qrcode.react/lib/esm/index.js","../../../packages/dsh-remote-bridge/src/client/icons.tsx","../../../packages/dsh-remote-bridge/src/client/semantic.ts","../../../packages/dsh-remote-bridge/src/client/PairPanel.tsx","../../../packages/dsh-remote-bridge/src/client/PairEntry.tsx","../../../packages/dsh-remote-bridge/src/core/protocol.ts","../../../packages/dsh-remote-bridge/src/client/pair-token.ts","../../../packages/dsh-remote-bridge/src/client/locales.ts","../../../packages/dsh-remote-bridge/src/client/index.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __objRest = (source, exclude) => {\n var target = {};\n for (var prop in source)\n if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)\n target[prop] = source[prop];\n if (source != null && __getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(source)) {\n if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))\n target[prop] = source[prop];\n }\n return target;\n};\n\n// src/index.tsx\nimport React from \"react\";\n\n// src/third-party/qrcodegen/index.ts\n/**\n * @license QR Code generator library (TypeScript)\n * Copyright (c) Project Nayuki.\n * SPDX-License-Identifier: MIT\n */\nvar qrcodegen;\n((qrcodegen2) => {\n const _QrCode = class _QrCode {\n /*-- Constructor (low level) and fields --*/\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 constructor(version, errorCorrectionLevel, dataCodewords, msk) {\n this.version = version;\n this.errorCorrectionLevel = errorCorrectionLevel;\n // The modules of this QR Code (false = light, true = dark).\n // Immutable after constructor finishes. Accessed through getModule().\n this.modules = [];\n // Indicates function modules that are not subjected to masking. Discarded when constructor finishes.\n this.isFunction = [];\n if (version < _QrCode.MIN_VERSION || version > _QrCode.MAX_VERSION)\n throw new RangeError(\"Version value out of range\");\n if (msk < -1 || msk > 7)\n throw new RangeError(\"Mask value out of range\");\n this.size = version * 4 + 17;\n let row = [];\n for (let i = 0; i < this.size; i++)\n row.push(false);\n for (let i = 0; i < this.size; i++) {\n this.modules.push(row.slice());\n this.isFunction.push(row.slice());\n }\n this.drawFunctionPatterns();\n const allCodewords = this.addEccAndInterleave(dataCodewords);\n this.drawCodewords(allCodewords);\n if (msk == -1) {\n let minPenalty = 1e9;\n for (let i = 0; i < 8; i++) {\n this.applyMask(i);\n this.drawFormatBits(i);\n const penalty = this.getPenaltyScore();\n if (penalty < minPenalty) {\n msk = i;\n minPenalty = penalty;\n }\n this.applyMask(i);\n }\n }\n assert(0 <= msk && msk <= 7);\n this.mask = msk;\n this.applyMask(msk);\n this.drawFormatBits(msk);\n this.isFunction = [];\n }\n /*-- Static factory functions (high level) --*/\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 static encodeText(text, ecl) {\n const segs = qrcodegen2.QrSegment.makeSegments(text);\n return _QrCode.encodeSegments(segs, ecl);\n }\n // Returns a QR Code representing the given binary data at the given error correction level.\n // This function always encodes using the binary segment mode, not any text mode. The maximum number of\n // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.\n // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.\n static encodeBinary(data, ecl) {\n const seg = qrcodegen2.QrSegment.makeBytes(data);\n return _QrCode.encodeSegments([seg], ecl);\n }\n /*-- Static factory functions (mid level) --*/\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 static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {\n if (!(_QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _QrCode.MAX_VERSION) || mask < -1 || mask > 7)\n throw new RangeError(\"Invalid value\");\n let version;\n let dataUsedBits;\n for (version = minVersion; ; version++) {\n const dataCapacityBits2 = _QrCode.getNumDataCodewords(version, ecl) * 8;\n const usedBits = QrSegment.getTotalBits(segs, version);\n if (usedBits <= dataCapacityBits2) {\n dataUsedBits = usedBits;\n break;\n }\n if (version >= maxVersion)\n throw new RangeError(\"Data too long\");\n }\n for (const newEcl of [_QrCode.Ecc.MEDIUM, _QrCode.Ecc.QUARTILE, _QrCode.Ecc.HIGH]) {\n if (boostEcl && dataUsedBits <= _QrCode.getNumDataCodewords(version, newEcl) * 8)\n ecl = newEcl;\n }\n let bb = [];\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())\n bb.push(b);\n }\n assert(bb.length == dataUsedBits);\n const dataCapacityBits = _QrCode.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 for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)\n appendBits(padByte, 8, bb);\n let dataCodewords = [];\n while (dataCodewords.length * 8 < bb.length)\n dataCodewords.push(0);\n bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));\n return new _QrCode(version, ecl, dataCodewords, mask);\n }\n /*-- Accessor methods --*/\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 getModule(x, y) {\n return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];\n }\n // Modified to expose modules for easy access\n getModules() {\n return this.modules;\n }\n /*-- Private helper methods for constructor: Drawing function modules --*/\n // Reads this object's version field, and draws and marks all function modules.\n drawFunctionPatterns() {\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 this.drawFinderPattern(3, 3);\n this.drawFinderPattern(this.size - 4, 3);\n this.drawFinderPattern(3, this.size - 4);\n const alignPatPos = this.getAlignmentPatternPositions();\n const numAlign = alignPatPos.length;\n for (let i = 0; i < numAlign; i++) {\n for (let j = 0; j < numAlign; j++) {\n if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))\n this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);\n }\n }\n this.drawFormatBits(0);\n this.drawVersion();\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 drawFormatBits(mask) {\n const data = this.errorCorrectionLevel.formatBits << 3 | mask;\n let rem = data;\n for (let i = 0; i < 10; i++)\n rem = rem << 1 ^ (rem >>> 9) * 1335;\n const bits = (data << 10 | rem) ^ 21522;\n assert(bits >>> 15 == 0);\n for (let i = 0; i <= 5; i++)\n 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 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);\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 drawVersion() {\n if (this.version < 7)\n return;\n let rem = this.version;\n for (let i = 0; i < 12; i++)\n rem = rem << 1 ^ (rem >>> 11) * 7973;\n const bits = this.version << 12 | rem;\n assert(bits >>> 18 == 0);\n for (let i = 0; i < 18; i++) {\n const color = getBit(bits, i);\n const a = this.size - 11 + i % 3;\n const b = Math.floor(i / 3);\n this.setFunctionModule(a, b, color);\n this.setFunctionModule(b, a, color);\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 drawFinderPattern(x, y) {\n for (let dy = -4; dy <= 4; dy++) {\n for (let dx = -4; dx <= 4; dx++) {\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n const xx = x + dx;\n const yy = 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 // Draws a 5*5 alignment pattern, with the center module\n // at (x, y). All modules must be in bounds.\n drawAlignmentPattern(x, y) {\n for (let dy = -2; dy <= 2; dy++) {\n for (let dx = -2; dx <= 2; dx++)\n this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);\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 setFunctionModule(x, y, isDark) {\n this.modules[y][x] = isDark;\n this.isFunction[y][x] = true;\n }\n /*-- Private helper methods for constructor: Codewords and masking --*/\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 addEccAndInterleave(data) {\n const ver = this.version;\n const ecl = this.errorCorrectionLevel;\n if (data.length != _QrCode.getNumDataCodewords(ver, ecl))\n throw new RangeError(\"Invalid argument\");\n const numBlocks = _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];\n const blockEccLen = _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];\n const rawCodewords = Math.floor(_QrCode.getNumRawDataModules(ver) / 8);\n const numShortBlocks = numBlocks - rawCodewords % numBlocks;\n const shortBlockLen = Math.floor(rawCodewords / numBlocks);\n let blocks = [];\n const rsDiv = _QrCode.reedSolomonComputeDivisor(blockEccLen);\n for (let i = 0, k = 0; i < numBlocks; i++) {\n let dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));\n k += dat.length;\n const ecc = _QrCode.reedSolomonComputeRemainder(dat, rsDiv);\n if (i < numShortBlocks)\n dat.push(0);\n blocks.push(dat.concat(ecc));\n }\n let result = [];\n for (let i = 0; i < blocks[0].length; i++) {\n blocks.forEach((block, j) => {\n if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)\n result.push(block[i]);\n });\n }\n assert(result.length == rawCodewords);\n return result;\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 drawCodewords(data) {\n if (data.length != Math.floor(_QrCode.getNumRawDataModules(this.version) / 8))\n throw new RangeError(\"Invalid argument\");\n let i = 0;\n for (let right = this.size - 1; right >= 1; right -= 2) {\n if (right == 6)\n right = 5;\n for (let vert = 0; vert < this.size; vert++) {\n for (let j = 0; j < 2; j++) {\n const x = right - j;\n const upward = (right + 1 & 2) == 0;\n const y = upward ? this.size - 1 - vert : vert;\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 }\n }\n }\n assert(i == data.length * 8);\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 applyMask(mask) {\n if (mask < 0 || mask > 7)\n 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;\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 // 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 getPenaltyScore() {\n let result = 0;\n for (let y = 0; y < this.size; y++) {\n let runColor = false;\n let runX = 0;\n let 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)\n result += _QrCode.PENALTY_N1;\n else if (runX > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runX, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;\n runColor = this.modules[y][x];\n runX = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _QrCode.PENALTY_N3;\n }\n for (let x = 0; x < this.size; x++) {\n let runColor = false;\n let runY = 0;\n let 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)\n result += _QrCode.PENALTY_N1;\n else if (runY > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runY, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;\n runColor = this.modules[y][x];\n runY = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode.PENALTY_N3;\n }\n for (let y = 0; y < this.size - 1; y++) {\n for (let x = 0; x < this.size - 1; x++) {\n const color = this.modules[y][x];\n if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1])\n result += _QrCode.PENALTY_N2;\n }\n }\n let dark = 0;\n for (const row of this.modules)\n dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);\n const total = this.size * this.size;\n const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;\n assert(0 <= k && k <= 9);\n result += k * _QrCode.PENALTY_N4;\n assert(0 <= result && result <= 2568888);\n return result;\n }\n /*-- Private helper functions --*/\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 getAlignmentPatternPositions() {\n if (this.version == 1)\n return [];\n else {\n const numAlign = Math.floor(this.version / 7) + 2;\n const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;\n let result = [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 // 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 static getNumRawDataModules(ver) {\n if (ver < _QrCode.MIN_VERSION || ver > _QrCode.MAX_VERSION)\n throw new RangeError(\"Version number out of range\");\n let result = (16 * ver + 128) * ver + 64;\n if (ver >= 2) {\n const numAlign = Math.floor(ver / 7) + 2;\n result -= (25 * numAlign - 10) * numAlign - 55;\n if (ver >= 7)\n result -= 36;\n }\n assert(208 <= result && result <= 29648);\n return result;\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 static getNumDataCodewords(ver, ecl) {\n return Math.floor(_QrCode.getNumRawDataModules(ver) / 8) - _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];\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 static reedSolomonComputeDivisor(degree) {\n if (degree < 1 || degree > 255)\n throw new RangeError(\"Degree out of range\");\n let result = [];\n for (let i = 0; i < degree - 1; i++)\n result.push(0);\n result.push(1);\n let root = 1;\n for (let i = 0; i < degree; i++) {\n for (let j = 0; j < result.length; j++) {\n result[j] = _QrCode.reedSolomonMultiply(result[j], root);\n if (j + 1 < result.length)\n result[j] ^= result[j + 1];\n }\n root = _QrCode.reedSolomonMultiply(root, 2);\n }\n return result;\n }\n // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.\n static reedSolomonComputeRemainder(data, divisor) {\n let result = divisor.map((_) => 0);\n for (const b of data) {\n const factor = b ^ result.shift();\n result.push(0);\n divisor.forEach((coef, i) => result[i] ^= _QrCode.reedSolomonMultiply(coef, factor));\n }\n return result;\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 static reedSolomonMultiply(x, y) {\n if (x >>> 8 != 0 || y >>> 8 != 0)\n throw new RangeError(\"Byte out of range\");\n let z = 0;\n for (let i = 7; i >= 0; i--) {\n z = z << 1 ^ (z >>> 7) * 285;\n z ^= (y >>> i & 1) * x;\n }\n assert(z >>> 8 == 0);\n return z;\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 finderPenaltyCountPatterns(runHistory) {\n const n = runHistory[1];\n assert(n <= this.size * 3);\n const core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;\n return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);\n }\n // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().\n finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {\n if (currentRunColor) {\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n currentRunLength = 0;\n }\n currentRunLength += this.size;\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n return this.finderPenaltyCountPatterns(runHistory);\n }\n // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().\n finderPenaltyAddHistory(currentRunLength, runHistory) {\n if (runHistory[0] == 0)\n currentRunLength += this.size;\n runHistory.pop();\n runHistory.unshift(currentRunLength);\n }\n };\n /*-- Constants and tables --*/\n // The minimum version number supported in the QR Code Model 2 standard.\n _QrCode.MIN_VERSION = 1;\n // The maximum version number supported in the QR Code Model 2 standard.\n _QrCode.MAX_VERSION = 40;\n // For use in getPenaltyScore(), when evaluating which mask is best.\n _QrCode.PENALTY_N1 = 3;\n _QrCode.PENALTY_N2 = 3;\n _QrCode.PENALTY_N3 = 40;\n _QrCode.PENALTY_N4 = 10;\n _QrCode.ECC_CODEWORDS_PER_BLOCK = [\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 [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Low\n [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],\n // Medium\n [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Quartile\n [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]\n // High\n ];\n _QrCode.NUM_ERROR_CORRECTION_BLOCKS = [\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 [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],\n // Low\n [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],\n // Medium\n [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],\n // Quartile\n [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]\n // High\n ];\n let QrCode = _QrCode;\n qrcodegen2.QrCode = _QrCode;\n function appendBits(val, len, bb) {\n if (len < 0 || len > 31 || val >>> len != 0)\n throw new RangeError(\"Value out of range\");\n for (let i = len - 1; i >= 0; i--)\n bb.push(val >>> i & 1);\n }\n function getBit(x, i) {\n return (x >>> i & 1) != 0;\n }\n function assert(cond) {\n if (!cond)\n throw new Error(\"Assertion error\");\n }\n const _QrSegment = class _QrSegment {\n /*-- Constructor (low level) and fields --*/\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 constructor(mode, numChars, bitData) {\n this.mode = mode;\n this.numChars = numChars;\n this.bitData = bitData;\n if (numChars < 0)\n throw new RangeError(\"Invalid argument\");\n this.bitData = bitData.slice();\n }\n /*-- Static factory functions (mid level) --*/\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 static makeBytes(data) {\n let bb = [];\n for (const b of data)\n appendBits(b, 8, bb);\n return new _QrSegment(_QrSegment.Mode.BYTE, data.length, bb);\n }\n // Returns a segment representing the given string of decimal digits encoded in numeric mode.\n static makeNumeric(digits) {\n if (!_QrSegment.isNumeric(digits))\n throw new RangeError(\"String contains non-numeric characters\");\n let bb = [];\n for (let i = 0; i < digits.length; ) {\n const n = 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(_QrSegment.Mode.NUMERIC, digits.length, bb);\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 static makeAlphanumeric(text) {\n if (!_QrSegment.isAlphanumeric(text))\n throw new RangeError(\"String contains unencodable characters in alphanumeric mode\");\n let bb = [];\n let i;\n for (i = 0; i + 2 <= text.length; i += 2) {\n let temp = _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 appendBits(_QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);\n return new _QrSegment(_QrSegment.Mode.ALPHANUMERIC, text.length, bb);\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 static makeSegments(text) {\n if (text == \"\")\n return [];\n else if (_QrSegment.isNumeric(text))\n return [_QrSegment.makeNumeric(text)];\n else if (_QrSegment.isAlphanumeric(text))\n return [_QrSegment.makeAlphanumeric(text)];\n else\n return [_QrSegment.makeBytes(_QrSegment.toUtf8ByteArray(text))];\n }\n // Returns a segment representing an Extended Channel Interpretation\n // (ECI) designator with the given assignment value.\n static makeEci(assignVal) {\n let bb = [];\n if (assignVal < 0)\n throw new RangeError(\"ECI assignment value out of range\");\n else if (assignVal < 1 << 7)\n appendBits(assignVal, 8, bb);\n else if (assignVal < 1 << 14) {\n appendBits(2, 2, bb);\n appendBits(assignVal, 14, bb);\n } else if (assignVal < 1e6) {\n appendBits(6, 3, bb);\n appendBits(assignVal, 21, bb);\n } else\n throw new RangeError(\"ECI assignment value out of range\");\n return new _QrSegment(_QrSegment.Mode.ECI, 0, bb);\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 static isNumeric(text) {\n return _QrSegment.NUMERIC_REGEX.test(text);\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 static isAlphanumeric(text) {\n return _QrSegment.ALPHANUMERIC_REGEX.test(text);\n }\n /*-- Methods --*/\n // Returns a new copy of the data bits of this segment.\n getData() {\n return this.bitData.slice();\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 static getTotalBits(segs, version) {\n let result = 0;\n for (const seg of segs) {\n const ccbits = seg.mode.numCharCountBits(version);\n if (seg.numChars >= 1 << ccbits)\n return Infinity;\n result += 4 + ccbits + seg.bitData.length;\n }\n return result;\n }\n // Returns a new array of bytes representing the given string encoded in UTF-8.\n static toUtf8ByteArray(str) {\n str = encodeURI(str);\n let result = [];\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) != \"%\")\n 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 // Describes precisely all strings that are encodable in numeric mode.\n _QrSegment.NUMERIC_REGEX = /^[0-9]*$/;\n // Describes precisely all strings that are encodable in alphanumeric mode.\n _QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\\/:-]*$/;\n // The set of all legal characters in alphanumeric mode,\n // where each character value maps to the index in the string.\n _QrSegment.ALPHANUMERIC_CHARSET = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:\";\n let QrSegment = _QrSegment;\n qrcodegen2.QrSegment = _QrSegment;\n})(qrcodegen || (qrcodegen = {}));\n((qrcodegen2) => {\n let QrCode;\n ((QrCode2) => {\n const _Ecc = class _Ecc {\n // The QR Code can tolerate about 30% erroneous codewords\n /*-- Constructor and fields --*/\n constructor(ordinal, formatBits) {\n this.ordinal = ordinal;\n this.formatBits = formatBits;\n }\n };\n /*-- Constants --*/\n _Ecc.LOW = new _Ecc(0, 1);\n // The QR Code can tolerate about 7% erroneous codewords\n _Ecc.MEDIUM = new _Ecc(1, 0);\n // The QR Code can tolerate about 15% erroneous codewords\n _Ecc.QUARTILE = new _Ecc(2, 3);\n // The QR Code can tolerate about 25% erroneous codewords\n _Ecc.HIGH = new _Ecc(3, 2);\n let Ecc = _Ecc;\n QrCode2.Ecc = _Ecc;\n })(QrCode = qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));\n})(qrcodegen || (qrcodegen = {}));\n((qrcodegen2) => {\n let QrSegment;\n ((QrSegment2) => {\n const _Mode = class _Mode {\n /*-- Constructor and fields --*/\n constructor(modeBits, numBitsCharCount) {\n this.modeBits = modeBits;\n this.numBitsCharCount = numBitsCharCount;\n }\n /*-- Method --*/\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 numCharCountBits(ver) {\n return this.numBitsCharCount[Math.floor((ver + 7) / 17)];\n }\n };\n /*-- Constants --*/\n _Mode.NUMERIC = new _Mode(1, [10, 12, 14]);\n _Mode.ALPHANUMERIC = new _Mode(2, [9, 11, 13]);\n _Mode.BYTE = new _Mode(4, [8, 16, 16]);\n _Mode.KANJI = new _Mode(8, [8, 10, 12]);\n _Mode.ECI = new _Mode(7, [0, 0, 0]);\n let Mode = _Mode;\n QrSegment2.Mode = _Mode;\n })(QrSegment = qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));\n})(qrcodegen || (qrcodegen = {}));\nvar qrcodegen_default = qrcodegen;\n\n// src/index.tsx\n/**\n * @license qrcode.react\n * Copyright (c) Paul O'Shannessy\n * SPDX-License-Identifier: ISC\n */\nvar ERROR_LEVEL_MAP = {\n L: qrcodegen_default.QrCode.Ecc.LOW,\n M: qrcodegen_default.QrCode.Ecc.MEDIUM,\n Q: qrcodegen_default.QrCode.Ecc.QUARTILE,\n H: qrcodegen_default.QrCode.Ecc.HIGH\n};\nvar DEFAULT_SIZE = 128;\nvar DEFAULT_LEVEL = \"L\";\nvar DEFAULT_BGCOLOR = \"#FFFFFF\";\nvar DEFAULT_FGCOLOR = \"#000000\";\nvar DEFAULT_INCLUDEMARGIN = false;\nvar DEFAULT_MINVERSION = 1;\nvar SPEC_MARGIN_SIZE = 4;\nvar DEFAULT_MARGIN_SIZE = 0;\nvar DEFAULT_IMG_SCALE = 0.1;\nfunction generatePath(modules, margin = 0) {\n const ops = [];\n modules.forEach(function(row, y) {\n let start = null;\n row.forEach(function(cell, x) {\n if (!cell && start !== null) {\n ops.push(\n `M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`\n );\n start = null;\n return;\n }\n if (x === row.length - 1) {\n if (!cell) {\n return;\n }\n if (start === null) {\n ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);\n } else {\n ops.push(\n `M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`\n );\n }\n return;\n }\n if (cell && start === null) {\n start = x;\n }\n });\n });\n return ops.join(\"\");\n}\nfunction excavateModules(modules, excavation) {\n return modules.slice().map((row, y) => {\n if (y < excavation.y || y >= excavation.y + excavation.h) {\n return row;\n }\n return row.map((cell, x) => {\n if (x < excavation.x || x >= excavation.x + excavation.w) {\n return cell;\n }\n return false;\n });\n });\n}\nfunction getImageSettings(cells, size, margin, imageSettings) {\n if (imageSettings == null) {\n return null;\n }\n const numCells = cells.length + margin * 2;\n const defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);\n const scale = numCells / size;\n const w = (imageSettings.width || defaultSize) * scale;\n const h = (imageSettings.height || defaultSize) * scale;\n const x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;\n const y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;\n const opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;\n let excavation = null;\n if (imageSettings.excavate) {\n let floorX = Math.floor(x);\n let floorY = Math.floor(y);\n let ceilW = Math.ceil(w + x - floorX);\n let ceilH = Math.ceil(h + y - floorY);\n excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };\n }\n const crossOrigin = imageSettings.crossOrigin;\n return { x, y, h, w, excavation, opacity, crossOrigin };\n}\nfunction getMarginSize(includeMargin, marginSize) {\n if (marginSize != null) {\n return Math.max(Math.floor(marginSize), 0);\n }\n return includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;\n}\nfunction useQRCode({\n value,\n level,\n minVersion,\n includeMargin,\n marginSize,\n imageSettings,\n size,\n boostLevel\n}) {\n let qrcode = React.useMemo(() => {\n const values = Array.isArray(value) ? value : [value];\n const segments = values.reduce((accum, v) => {\n accum.push(...qrcodegen_default.QrSegment.makeSegments(v));\n return accum;\n }, []);\n return qrcodegen_default.QrCode.encodeSegments(\n segments,\n ERROR_LEVEL_MAP[level],\n minVersion,\n void 0,\n void 0,\n boostLevel\n );\n }, [value, level, minVersion, boostLevel]);\n const { cells, margin, numCells, calculatedImageSettings } = React.useMemo(() => {\n let cells2 = qrcode.getModules();\n const margin2 = getMarginSize(includeMargin, marginSize);\n const numCells2 = cells2.length + margin2 * 2;\n const calculatedImageSettings2 = getImageSettings(\n cells2,\n size,\n margin2,\n imageSettings\n );\n return {\n cells: cells2,\n margin: margin2,\n numCells: numCells2,\n calculatedImageSettings: calculatedImageSettings2\n };\n }, [qrcode, size, imageSettings, includeMargin, marginSize]);\n return {\n qrcode,\n margin,\n cells,\n numCells,\n calculatedImageSettings\n };\n}\nvar SUPPORTS_PATH2D = function() {\n try {\n new Path2D().addPath(new Path2D());\n } catch (e) {\n return false;\n }\n return true;\n}();\nvar QRCodeCanvas = React.forwardRef(\n function QRCodeCanvas2(props, forwardedRef) {\n const _a = props, {\n value,\n size = DEFAULT_SIZE,\n level = DEFAULT_LEVEL,\n bgColor = DEFAULT_BGCOLOR,\n fgColor = DEFAULT_FGCOLOR,\n includeMargin = DEFAULT_INCLUDEMARGIN,\n minVersion = DEFAULT_MINVERSION,\n boostLevel,\n marginSize,\n imageSettings\n } = _a, extraProps = __objRest(_a, [\n \"value\",\n \"size\",\n \"level\",\n \"bgColor\",\n \"fgColor\",\n \"includeMargin\",\n \"minVersion\",\n \"boostLevel\",\n \"marginSize\",\n \"imageSettings\"\n ]);\n const _b = extraProps, { style } = _b, otherProps = __objRest(_b, [\"style\"]);\n const imgSrc = imageSettings == null ? void 0 : imageSettings.src;\n const _canvas = React.useRef(null);\n const _image = React.useRef(null);\n const setCanvasRef = React.useCallback(\n (node) => {\n _canvas.current = node;\n if (typeof forwardedRef === \"function\") {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef]\n );\n const [isImgLoaded, setIsImageLoaded] = React.useState(false);\n const { margin, cells, numCells, calculatedImageSettings } = useQRCode({\n value,\n level,\n minVersion,\n boostLevel,\n includeMargin,\n marginSize,\n imageSettings,\n size\n });\n React.useEffect(() => {\n if (_canvas.current != null) {\n const canvas = _canvas.current;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n return;\n }\n let cellsToDraw = cells;\n const image = _image.current;\n const haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;\n if (haveImageToRender) {\n if (calculatedImageSettings.excavation != null) {\n cellsToDraw = excavateModules(\n cells,\n calculatedImageSettings.excavation\n );\n }\n }\n const pixelRatio = window.devicePixelRatio || 1;\n canvas.height = canvas.width = size * pixelRatio;\n const scale = size / numCells * pixelRatio;\n ctx.scale(scale, scale);\n ctx.fillStyle = bgColor;\n ctx.fillRect(0, 0, numCells, numCells);\n ctx.fillStyle = fgColor;\n if (SUPPORTS_PATH2D) {\n ctx.fill(new Path2D(generatePath(cellsToDraw, margin)));\n } else {\n cells.forEach(function(row, rdx) {\n row.forEach(function(cell, cdx) {\n if (cell) {\n ctx.fillRect(cdx + margin, rdx + margin, 1, 1);\n }\n });\n });\n }\n if (calculatedImageSettings) {\n ctx.globalAlpha = calculatedImageSettings.opacity;\n }\n if (haveImageToRender) {\n ctx.drawImage(\n image,\n calculatedImageSettings.x + margin,\n calculatedImageSettings.y + margin,\n calculatedImageSettings.w,\n calculatedImageSettings.h\n );\n }\n }\n });\n React.useEffect(() => {\n setIsImageLoaded(false);\n }, [imgSrc]);\n const canvasStyle = __spreadValues({ height: size, width: size }, style);\n let img = null;\n if (imgSrc != null) {\n img = /* @__PURE__ */ React.createElement(\n \"img\",\n {\n src: imgSrc,\n key: imgSrc,\n style: { display: \"none\" },\n onLoad: () => {\n setIsImageLoaded(true);\n },\n ref: _image,\n crossOrigin: calculatedImageSettings == null ? void 0 : calculatedImageSettings.crossOrigin\n }\n );\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(\n \"canvas\",\n __spreadValues({\n style: canvasStyle,\n height: size,\n width: size,\n ref: setCanvasRef,\n role: \"img\"\n }, otherProps)\n ), img);\n }\n);\nQRCodeCanvas.displayName = \"QRCodeCanvas\";\nvar QRCodeSVG = React.forwardRef(\n function QRCodeSVG2(props, forwardedRef) {\n const _a = props, {\n value,\n size = DEFAULT_SIZE,\n level = DEFAULT_LEVEL,\n bgColor = DEFAULT_BGCOLOR,\n fgColor = DEFAULT_FGCOLOR,\n includeMargin = DEFAULT_INCLUDEMARGIN,\n minVersion = DEFAULT_MINVERSION,\n boostLevel,\n title,\n marginSize,\n imageSettings\n } = _a, otherProps = __objRest(_a, [\n \"value\",\n \"size\",\n \"level\",\n \"bgColor\",\n \"fgColor\",\n \"includeMargin\",\n \"minVersion\",\n \"boostLevel\",\n \"title\",\n \"marginSize\",\n \"imageSettings\"\n ]);\n const { margin, cells, numCells, calculatedImageSettings } = useQRCode({\n value,\n level,\n minVersion,\n boostLevel,\n includeMargin,\n marginSize,\n imageSettings,\n size\n });\n let cellsToDraw = cells;\n let image = null;\n if (imageSettings != null && calculatedImageSettings != null) {\n if (calculatedImageSettings.excavation != null) {\n cellsToDraw = excavateModules(\n cells,\n calculatedImageSettings.excavation\n );\n }\n image = /* @__PURE__ */ React.createElement(\n \"image\",\n {\n href: imageSettings.src,\n height: calculatedImageSettings.h,\n width: calculatedImageSettings.w,\n x: calculatedImageSettings.x + margin,\n y: calculatedImageSettings.y + margin,\n preserveAspectRatio: \"none\",\n opacity: calculatedImageSettings.opacity,\n crossOrigin: calculatedImageSettings.crossOrigin\n }\n );\n }\n const fgPath = generatePath(cellsToDraw, margin);\n return /* @__PURE__ */ React.createElement(\n \"svg\",\n __spreadValues({\n height: size,\n width: size,\n viewBox: `0 0 ${numCells} ${numCells}`,\n ref: forwardedRef,\n role: \"img\"\n }, otherProps),\n !!title && /* @__PURE__ */ React.createElement(\"title\", null, title),\n /* @__PURE__ */ React.createElement(\n \"path\",\n {\n fill: bgColor,\n d: `M0,0 h${numCells}v${numCells}H0z`,\n shapeRendering: \"crispEdges\"\n }\n ),\n /* @__PURE__ */ React.createElement(\"path\", { fill: fgColor, d: fgPath, shapeRendering: \"crispEdges\" }),\n image\n );\n }\n);\nQRCodeSVG.displayName = \"QRCodeSVG\";\nexport {\n QRCodeCanvas,\n QRCodeSVG\n};\n","/**\n * Inline SVG icons for the pairing panel (16px stroke style matching the\n * shell's nav icons). Held here rather than imported from\n * `@deepseek-ai/dsh-client-ui-primitives` so the panel's rendered tree carries\n * no closure-factory bundle import: the component stays renderable under the\n * package's own test runner.\n */\nimport type { SVGProps } from 'react'\n\n/** Shared svg attrs for the 16px stroke icon family. */\nfunction iconProps(props: SVGProps<SVGSVGElement>): SVGProps<SVGSVGElement> {\n return {\n width: 16,\n height: 16,\n viewBox: '0 0 16 16',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 1.3,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n 'aria-hidden': true,\n ...props,\n }\n}\n\n/** A QR-symbol glyph: three finder squares plus a payload dot. */\nexport function QrIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M2.5 2.5h4v4h-4zM9.5 2.5h4v4h-4zM2.5 9.5h4v4h-4z\" />\n <path d=\"M9.5 9.5h1.6v1.6H9.5zM12.4 9.5h1.1M9.5 12.4v1.1M12 13.5h1.5v-1.5h-1.5z\" />\n </svg>\n )\n}\n\n/** Copy glyph. */\nexport function CopyIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <rect x=\"5.5\" y=\"5.5\" width=\"9\" height=\"9\" rx=\"1.5\" />\n <path d=\"M2.5 10.5v-7A1.5 1.5 0 0 1 4 2h5.5\" />\n </svg>\n )\n}\n\n/** Check glyph for the transient copied state. */\nexport function CheckIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M3 8.5 6.5 12l6.5-8\" />\n </svg>\n )\n}\n\n/** Close glyph for the panel header. */\nexport function CloseIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M4 4l8 8M12 4l-8 8\" />\n </svg>\n )\n}\n\n/** Refresh glyph for the mint-again action. */\nexport function RefreshIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M13 8a5 5 0 1 1-1.8-3.85\" />\n <path d=\"M13.2 2.4V5.6H10\" />\n </svg>\n )\n}\n","/**\n * Semantic attribute values for the protocol v1 pairing panel (contract:\n * skins/skin-center/contracts/semantic-attrs-v1.md). Root containers carry\n * `data-dsh-plugin`; parts carry bare `data-dsh-part` values owned by that\n * plugin attribute.\n */\n\n/** Plugin short name stamped on the footer trigger and the modal root. */\nexport const PLUGIN_ATTR = 'remote-bridge'\n\n/** The sidebar footer seat trigger. */\nexport const PART_ENTRY = 'entry'\n\n/** The modal panel root. */\nexport const PART_PANEL = 'panel'\n\n/** The QR symbol's wrapper — it also mirrors the encoded string. */\nexport const PART_QR = 'qr'\n\n/** The plaintext pairing code row. */\nexport const PART_TOKEN = 'token'\n\n/** A state notice: the origin warning, or a refusal the host raised. */\nexport const PART_NOTICE = 'notice'\n\n/** The mint-again button. */\nexport const PART_REFRESH = 'refresh'\n\n/** The copy-the-code button. */\nexport const PART_COPY = 'copy'\n\n/**\n * Attribute carrying the exact string the QR symbol encodes, so the operator\n * (and a UI check) can compare it against the host route's answer without\n * decoding the symbol. The same string is already on screen in plaintext.\n */\nexport const QR_VALUE_ATTR = 'data-dsh-qr-value'\n","/**\n * The protocol v1 pairing panel body: the QR symbol, the same secret in\n * plaintext, the 30 s countdown with its expiry state, the refresh action, and\n * the two facts the reader must not miss — the phone's origin is the public\n * relay (never this machine's loopback address), and the code is one-shot.\n *\n * Pure presentation: every state and action arrives through props, and the\n * clock is a prop, so the expiry flip is deterministic instead of read from\n * `Date.now()` here.\n */\nimport { memo } from 'react'\nimport { QRCodeSVG } from 'qrcode.react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { CheckIcon, CloseIcon, CopyIcon, RefreshIcon } from './icons.tsx'\nimport { PART_COPY, PART_NOTICE, PART_PANEL, PART_QR, PART_REFRESH, PART_TOKEN, PLUGIN_ATTR, QR_VALUE_ATTR } from './semantic.ts'\nimport css from './panel.module.css'\n\n/** What the panel is currently showing. */\nexport type PairPanelState =\n /** A read is in flight. */\n | { kind: 'reading' }\n /**\n * A live one-shot secret. `pairingUrl`, when the host could name its own\n * public origin, is what the QR encodes: a `{token, url}` document the iOS\n * client parses into both halves of its configuration, so one scan sets the\n * address AND the token. With no origin the QR carries the bare token and the\n * panel says the address has to be set on the phone by hand.\n */\n | { kind: 'ready'; token: string; issuedAt: number; expiresAt: number; origin: string | null; pairingUrl: string | null }\n /** 403 from the loopback gate: this page is not open on the machine itself. */\n | { kind: 'forbidden' }\n /** The host route answered with an unexpected status or shape. */\n | { kind: 'failed'; status: number }\n /** The request never reached the host. */\n | { kind: 'unreachable' }\n\n/** How the last copy attempt went. */\nexport type PairCopyState = 'idle' | 'copied' | 'failed'\n\nexport interface PairPanelProps {\n t: PropsLocale<'remote-bridge'>['t']\n state: PairPanelState\n /** The current wall clock; the entry supplies it from a one-second ticker. */\n now: number\n /** This page's own `host:port`, named in the origin warning. */\n host: string\n copy: PairCopyState\n onClose(): void\n onRefresh(): void\n onCopy(token: string): void\n}\n\n/**\n * The QR symbol, memoized on the secret: the countdown re-renders the panel\n * every second, and qrcode.react rebuilds the whole module path on each render.\n * The encoded value is the host's own `pairingUrl` verbatim when there is one —\n * a `{token, url}` document whose `url` names THIS instance's public relay, so\n * the phone adopts an origin that actually reaches this host. The bare-token\n * fallback means the phone keeps whatever origin it already has.\n */\nconst PairQrCode = memo(function PairQrCode({ value, label }: { value: string; label: string }) {\n return <QRCodeSVG value={value} size={184} level=\"M\" marginSize={1} aria-label={label} />\n})\n\n/** One state notice: a title and, when there is one, the sentence explaining it. */\nfunction Notice({ tone, title, body }: { tone: 'plain' | 'warning' | 'alert'; title: string; body?: string }) {\n return (\n <div className={css.notice} data-dsh-part={PART_NOTICE} data-tone={tone} role={tone === 'plain' ? 'status' : 'alert'}>\n <p className={css.noticeTitle}>{title}</p>\n {body !== undefined && <p className={css.noticeBody}>{body}</p>}\n </div>\n )\n}\n\n/**\n * Render the pairing panel.\n * @param props - locale seat, view state, clock, page host and actions.\n * @returns the panel element tree.\n */\nexport function PairPanel({ t, state, now, host, copy, onClose, onRefresh, onCopy }: PairPanelProps) {\n const remainingMs = state.kind === 'ready' ? Math.max(0, state.expiresAt - now) : 0\n const expired = state.kind === 'ready' && remainingMs <= 0\n const seconds = Math.ceil(remainingMs / 1000)\n const windowMs = state.kind === 'ready' ? Math.max(1, state.expiresAt - state.issuedAt) : 1\n const percent = Math.min(100, Math.max(0, Math.round((remainingMs / windowMs) * 100)))\n // What the QR encodes and what the copy button hands over: the same string,\n // so a human can paste exactly what a camera would have read.\n const payload = state.kind === 'ready' ? (state.pairingUrl ?? state.token) : ''\n\n return (\n <div className={css.overlay} role=\"presentation\">\n <div className={css.mask} aria-hidden=\"true\" onClick={onClose} />\n <div\n className={css.panel}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={t('title')}\n data-dsh-plugin={PLUGIN_ATTR}\n data-dsh-part={PART_PANEL}\n >\n <div className={css.header}>\n <div className={css.heading}>\n <h2 className={css.title}>{t('title')}</h2>\n <p className={css.subtitle}>{t('subtitle')}</p>\n </div>\n <button type=\"button\" className={css.closeButton} aria-label={t('action.close')} onClick={onClose}>\n <CloseIcon />\n </button>\n </div>\n\n {state.kind === 'reading' && <Notice tone=\"plain\" title={t('state.reading')} />}\n\n {state.kind === 'forbidden' && (\n <Notice tone=\"alert\" title={t('forbidden.title')} body={t('forbidden.body')} />\n )}\n\n {state.kind === 'failed' && (\n <Notice tone=\"alert\" title={t('failed.title')} body={t('failed.body', { status: String(state.status) })} />\n )}\n\n {state.kind === 'unreachable' && (\n <Notice tone=\"alert\" title={t('unreachable.title')} body={t('unreachable.body')} />\n )}\n\n {state.kind === 'ready' && (\n <>\n <div className={css.qrCard}>\n <div className={css.qrWrap} data-dsh-part={PART_QR} {...{ [QR_VALUE_ATTR]: payload }}>\n <PairQrCode value={payload} label={t('pair.qrLabel')} />\n </div>\n {expired ? (\n <Notice tone=\"alert\" title={t('pair.expired')} body={t('pair.expiredHint')} />\n ) : (\n <div className={css.countdown}>\n <span className={css.countdownText}>{t('pair.countdown', { s: String(seconds) })}</span>\n <span className={css.bar}>\n <span className={css.barFill} style={{ width: `${String(percent)}%` }} />\n </span>\n </div>\n )}\n </div>\n\n <div className={css.tokenRow} data-dsh-part={PART_TOKEN}>\n <span className={css.tokenLabel}>{t('pair.payloadLabel')}</span>\n <code className={css.token}>{payload}</code>\n </div>\n\n <button\n type=\"button\"\n className={css.copyButton}\n data-dsh-part={PART_COPY}\n data-copied={copy === 'copied'}\n data-failed={copy === 'failed'}\n onClick={() => { onCopy(payload) }}\n >\n {copy === 'copied' ? <CheckIcon /> : <CopyIcon />}\n {copy === 'copied' ? t('action.copied') : copy === 'failed' ? t('action.copyFailed') : t('action.copy')}\n </button>\n\n {state.pairingUrl === null ? (\n <Notice tone=\"warning\" title={t('origin.title')} body={t('origin.body', { host })} />\n ) : (\n <Notice\n tone=\"plain\"\n title={t('origin.located.title')}\n body={t('origin.located.body', { origin: state.origin ?? '' })}\n />\n )}\n </>\n )}\n\n <div className={css.actions}>\n {state.kind !== 'reading' && state.kind !== 'forbidden' && (\n <button type=\"button\" className={css.refresh} data-dsh-part={PART_REFRESH} onClick={onRefresh}>\n <RefreshIcon />\n {t('pair.refresh')}\n </button>\n )}\n </div>\n </div>\n </div>\n )\n}\n","/**\n * Sidebar footer entry for the protocol v1 pairing panel: the icon-only trigger\n * beside the sidebar settings seat (wide row / rail circle) that opens the\n * panel. Registered into the official `sidebar.footer.action` list slot\n * (declared by ui-sidebar — the same seat dsh-remote-web-ui and dsh-update\n * share).\n *\n * This component owns the panel's behavior: one read per open, one clock tick\n * while a live code is on screen, the mint-again action, and the copy action.\n * The wire call and the clipboard are injected (see the plugin entry), so the\n * rendered tree carries no closure-factory bundle import and both can be driven\n * by a test without patching a module.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { PairPanel, type PairCopyState, type PairPanelState } from './PairPanel.tsx'\nimport type { PairTokenOutcome } from './pair-token.ts'\nimport { PART_ENTRY, PLUGIN_ATTR } from './semantic.ts'\nimport { QrIcon } from './icons.tsx'\nimport css from './panel.module.css'\n\n/** How long the transient \"copied\" / \"copy failed\" label stays up. */\nconst COPY_FEEDBACK_MS = 1_500\n/** The countdown's tick; one second is the resolution the panel shows. */\nconst TICK_MS = 1_000\n\nexport type PairEntryProps = PropsLocale<'remote-bridge'> & {\n /** Whether the sidebar renders wide content (false = 56px rail). */\n wide: boolean\n /** Reads a fresh one-shot token from this package's own Host route. */\n read: () => Promise<PairTokenOutcome>\n /** Puts the token on the OS clipboard; false means the write was refused. */\n copy: (text: string) => Promise<boolean>\n}\n\n/** Map a read outcome onto the panel's view state. */\nfunction panelStateOf(outcome: PairTokenOutcome, issuedAt: number): PairPanelState {\n switch (outcome.kind) {\n case 'ok':\n return {\n kind: 'ready',\n token: outcome.token,\n issuedAt,\n expiresAt: outcome.expiresAt,\n origin: outcome.origin,\n pairingUrl: outcome.pairingUrl,\n }\n case 'forbidden': return { kind: 'forbidden' }\n case 'unreachable': return { kind: 'unreachable' }\n case 'failed': return { kind: 'failed', status: outcome.status }\n }\n}\n\n/**\n * Render the pairing seat trigger and, when open, the panel.\n * @param props - the footer seat's column state, the injected actions and the locale seat.\n * @returns the trigger and the panel portal.\n */\nexport function PairEntry({ wide, read, copy, t }: PairEntryProps) {\n const [open, setOpen] = useState(false)\n const [state, setState] = useState<PairPanelState>({ kind: 'reading' })\n const [copyState, setCopyState] = useState<PairCopyState>('idle')\n const [now, setNow] = useState<number>(() => Date.now())\n // Generation counter: closing (or minting again) invalidates a read that is\n // still in flight, so an answer that lands after the panel closed cannot\n // resurrect a code nobody asked for.\n const generation = useRef(0)\n\n const mint = useCallback((): void => {\n const request = ++generation.current\n setState({ kind: 'reading' })\n void read().then((outcome) => {\n if (request !== generation.current) return\n const issuedAt = Date.now()\n setNow(issuedAt)\n setState(panelStateOf(outcome, issuedAt))\n })\n }, [read])\n\n const openPanel = useCallback((): void => {\n setOpen(true)\n setCopyState('idle')\n mint()\n }, [mint])\n\n const closePanel = useCallback((): void => {\n generation.current += 1\n setOpen(false)\n }, [])\n\n // One ticker per live code; it clears itself at the deadline, so a panel left\n // open on an expired code stops re-rendering instead of ticking forever.\n useEffect(() => {\n if (!open || state.kind !== 'ready') return\n const deadline = state.expiresAt\n const timer = window.setInterval(() => {\n const current = Date.now()\n setNow(current)\n if (current >= deadline) window.clearInterval(timer)\n }, TICK_MS)\n return () => { window.clearInterval(timer) }\n }, [open, state])\n\n useEffect(() => {\n if (!open) return\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') closePanel()\n }\n window.addEventListener('keydown', onKey)\n return () => { window.removeEventListener('keydown', onKey) }\n }, [open, closePanel])\n\n const handleCopy = useCallback((token: string): void => {\n void copy(token).then((ok) => {\n setCopyState(ok ? 'copied' : 'failed')\n window.setTimeout(() => { setCopyState('idle') }, COPY_FEEDBACK_MS)\n })\n }, [copy])\n\n return (\n <>\n <button\n type=\"button\"\n className={css.trigger}\n data-dsh-plugin={PLUGIN_ATTR}\n data-dsh-part={PART_ENTRY}\n data-wide={wide ? 'wide' : 'rail'}\n aria-label={t('entry.label')}\n aria-expanded={open}\n title={t('entry.label')}\n onClick={openPanel}\n >\n <QrIcon />\n </button>\n {open && createPortal(\n <PairPanel\n t={t}\n state={state}\n now={now}\n host={window.location.host}\n copy={copyState}\n onClose={closePanel}\n onRefresh={mint}\n onCopy={handleCopy}\n />,\n document.body,\n )}\n </>\n )\n}\n","/**\n * The frozen protocol surface: method names, topic names, refusal codes, and\n * the one authorization rule the dispatcher enforces before any method runs.\n * @module dsh-remote-bridge/core/protocol\n */\n\n/** Client-callable methods of protocol v1. */\nexport const METHOD_HELLO = 'hello'\nexport const METHOD_SESSION_LIST = 'session.list'\nexport const METHOD_SESSION_TITLES = 'session.titles'\nexport const METHOD_SESSION_SNAPSHOT = 'session.snapshot'\nexport const METHOD_SESSION_HISTORY = 'session.history'\nexport const METHOD_SESSION_PROMPT = 'session.prompt'\nexport const METHOD_SESSION_INTERRUPT = 'session.interrupt'\nexport const METHOD_SESSION_ATTACHMENT = 'session.attachment'\nexport const METHOD_SESSION_PERMISSIONS = 'session.permissions'\nexport const METHOD_SESSION_SET_PERMISSION = 'session.setPermission'\nexport const METHOD_SESSION_MODELS = 'session.models'\nexport const METHOD_SESSION_SET_MODEL = 'session.setModel'\nexport const METHOD_PAIR_BEGIN = 'pair.begin'\nexport const METHOD_PAIR_FINISH = 'pair.finish'\nexport const METHOD_APPROVAL_RESOLVE = 'approval.resolve'\nexport const METHOD_QUESTION_ANSWER = 'question.answer'\n\n/** Server-pushed topics of protocol v1. */\nexport const TOPIC_SESSION_DELTA = 'session.delta'\nexport const TOPIC_APPROVAL_REQUEST = 'approval.request'\nexport const TOPIC_QUESTION_REQUEST = 'question.request'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to ask for a trimmed\n * `session.snapshot` baseline. A client that does not declare it — including\n * every client written before this capability existed — is served exactly the\n * baseline protocol v1 always served.\n */\nexport const CAP_SESSION_SNAPSHOT_TRIM = 'session.snapshot.trim.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to have\n * `session.snapshot` answer with one bounded page instead of the whole opening\n * window. Declaring it is what makes an opening screen cost one page rather\n * than a whole session; a client that does not declare it — including every\n * client written before this capability existed — receives byte for byte the\n * snapshot protocol v1 always served.\n */\nexport const CAP_SESSION_SNAPSHOT_PAGE = 'session.snapshot.page.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be shown the\n * host's pending user questions and to answer them with `question.answer`.\n *\n * Declaring it is what makes `question.request` reachable and what makes the\n * method part of that client's protocol at all: a client that does not declare\n * it — including every client written before this channel existed — receives no\n * such event, and its `question.answer` is refused as an unknown method,\n * exactly as that frame was refused before.\n */\nexport const CAP_QUESTIONS = 'questions.v1'\n\n/**\n * Methods an unpaired connection may still call: the handshake itself and the\n * two pairing steps. Everything else answers `unpaired` — a caller can pair\n * without a device token, but cannot touch a session without one.\n */\nexport const UNPAIRED_METHODS: ReadonlySet<string> = new Set([\n METHOD_HELLO,\n METHOD_PAIR_BEGIN,\n METHOD_PAIR_FINISH,\n])\n\n/** Every method this protocol version serves. */\nexport const KNOWN_METHODS: ReadonlySet<string> = new Set([\n METHOD_HELLO,\n METHOD_SESSION_LIST,\n METHOD_SESSION_TITLES,\n METHOD_SESSION_SNAPSHOT,\n METHOD_SESSION_HISTORY,\n METHOD_SESSION_PROMPT,\n METHOD_SESSION_INTERRUPT,\n METHOD_SESSION_ATTACHMENT,\n METHOD_SESSION_PERMISSIONS,\n METHOD_SESSION_SET_PERMISSION,\n METHOD_SESSION_MODELS,\n METHOD_SESSION_SET_MODEL,\n METHOD_PAIR_BEGIN,\n METHOD_PAIR_FINISH,\n METHOD_APPROVAL_RESOLVE,\n METHOD_QUESTION_ANSWER,\n])\n\n/** Refusal codes the bridge itself raises (DSH failures cross as their own code). */\nexport const CODE_UNPAIRED = 'unpaired'\nexport const CODE_UNKNOWN_METHOD = 'unknown-method'\nexport const CODE_INVALID_ARGS = 'invalid-args'\nexport const CODE_PROTO_UNSUPPORTED = 'proto-unsupported'\nexport const CODE_TOKEN_INVALID = 'token-invalid'\nexport const CODE_NONCE_INVALID = 'nonce-invalid'\nexport const CODE_SIGNATURE_INVALID = 'signature-invalid'\nexport const CODE_APPROVAL_UNKNOWN = 'approval-unknown'\n/**\n * The bridge does not hold the named question: it never claimed that call id, it\n * already answered it, or the host no longer holds it as answerable. Host\n * failures crossing this method keep their own codes instead.\n */\nexport const CODE_QUESTION_UNKNOWN = 'question-unknown'\nexport const CODE_SNAPSHOT_UNAVAILABLE = 'snapshot-unavailable'\nexport const CODE_SNAPSHOT_TOO_LARGE = 'snapshot-too-large'\nexport const CODE_INTERNAL = 'internal'\n\n/** Protocol version this package speaks. */\nexport const PROTO = 1\n/** Minor version this package speaks. */\nexport const MINOR = 0\n/** `server` field of the hello response. */\nexport const SERVER_ID = 'dsh-remote-bridge'\n\n/** Exact route path of the bridge's WebSocket endpoint. */\nexport const WS_PATH = '/ios/v1'\n/** Exact route path of the loopback-only bootstrap token endpoint. */\nexport const PAIR_TOKEN_PATH = '/remote-bridge/pair/token'\n","/**\n * The panel's one wire call: read the one-shot bootstrap token from this\n * package's own Host route.\n *\n * The route is same-origin and document-relative (the GUI is served with\n * `<base href=\"./\">`, so a sub-path deployment resolves it against its entry\n * directory instead of escaping to the origin root — the same rule\n * `dsh-remote-web-ui`'s pair API follows). It is NOT consumed here: the panel\n * only displays the secret, and the phone spends it in `pair.begin`, so a\n * mis-click on \"new code\" voids a token without ever pairing a device.\n *\n * `403` is a fact, not an error: the loopback gate in `core/loopback.ts`\n * refuses any page whose socket or `Host` is not this machine, which is exactly\n * the case the panel must name out loud.\n * @module dsh-remote-bridge/client/pair-token\n */\n\nimport { PAIR_TOKEN_PATH } from '../core/protocol.ts'\n\n/** Document-relative form of the Host route, for a page served under any base. */\nexport const PAIR_TOKEN_URL = PAIR_TOKEN_PATH.replace(/^\\/+/, '')\n\n/** The outcome of one token read. */\nexport type PairTokenOutcome =\n /**\n * A live one-shot token and the instant it stops being accepted, plus the\n * address half when this machine can name its own public origin. `pairingUrl`\n * is the code a QR should carry: a `{token, url}` document the phone parses\n * into both halves of its configuration.\n */\n | { kind: 'ok'; token: string; expiresAt: number; origin: string | null; pairingUrl: string | null }\n /** 403: the page is not open on the machine itself, so the loopback gate refused it. */\n | { kind: 'forbidden' }\n /** The route answered with a status the panel does not know, or with a body that is not a token. */\n | { kind: 'failed'; status: number }\n /** The request never reached the host (offline, host stopped, connection reset). */\n | { kind: 'unreachable' }\n\n/** The minimal response surface the reader uses, so a test can inject its own. */\nexport interface PairTokenResponse {\n readonly ok: boolean\n readonly status: number\n json(): Promise<unknown>\n}\n\n/** The minimal fetch surface the reader uses, so a test can inject its own. */\nexport type PairTokenFetch = (url: string, init: { signal?: AbortSignal; cache: string }) => Promise<PairTokenResponse>\n\nexport interface ReadPairTokenOptions {\n /** Injected transport; defaults to the global fetch. */\n readonly fetchImpl?: PairTokenFetch\n /** Aborts an in-flight read (the panel closed, the entry unmounted). */\n readonly signal?: AbortSignal\n}\n\n/** Read a string field, treating a missing, mistyped or empty value as absent. */\nfunction stringOrNull(value: unknown): string | null {\n return typeof value === 'string' && value !== '' ? value : null\n}\n\n/**\n * Read one bootstrap token.\n *\n * Never throws: every failure is one of the outcome arms, because the panel has\n * to render each of them. A `200` whose body is not `{token, expiresAt}` is\n * reported as a failure rather than shown as an empty QR.\n * @param options - injected transport and abort signal.\n * @returns the read outcome.\n */\nexport async function readPairToken(options: ReadPairTokenOptions = {}): Promise<PairTokenOutcome> {\n const send = options.fetchImpl ?? (globalThis.fetch as unknown as PairTokenFetch | undefined)\n if (send === undefined) return { kind: 'unreachable' }\n let response: PairTokenResponse\n try {\n response = await send(PAIR_TOKEN_URL, {\n cache: 'no-store',\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n })\n } catch {\n // A network failure and an aborted read are indistinguishable here, and\n // both mean \"no token arrived\" — the panel says so instead of guessing.\n return { kind: 'unreachable' }\n }\n if (response.status === 403) return { kind: 'forbidden' }\n if (!response.ok) return { kind: 'failed', status: response.status }\n let body: unknown\n try {\n body = await response.json()\n } catch {\n return { kind: 'failed', status: response.status }\n }\n if (typeof body !== 'object' || body === null) return { kind: 'failed', status: response.status }\n const token = (body as { token?: unknown }).token\n const expiresAt = (body as { expiresAt?: unknown }).expiresAt\n if (typeof token !== 'string' || token === '') return { kind: 'failed', status: response.status }\n if (typeof expiresAt !== 'number' || !Number.isFinite(expiresAt)) return { kind: 'failed', status: response.status }\n // Additive fields: a host that predates origin discovery answers without\n // them, and the panel then falls back to the bare-token code instead of\n // refusing to show anything.\n const origin = stringOrNull((body as { origin?: unknown }).origin)\n const candidate = stringOrNull((body as { pairingUrl?: unknown }).pairingUrl)\n const pairingUrl = candidate !== null && /^wss?:\\/\\/\\S+$/.test(candidate) ? candidate : null\n return { kind: 'ok', token, expiresAt, origin, pairingUrl }\n}\n","/**\n * `remote-bridge` namespace dictionaries: the protocol v1 pairing panel copy.\n *\n * The panel has one job — show the operator the one-shot bootstrap token as a\n * QR symbol plus its plaintext — so the copy is dominated by the two facts a\n * reader has to get right: where the phone's origin points (the public relay,\n * never this machine's loopback address) and why the token vanished (30 s, one\n * use, or a fresh mint).\n */\n\n/** Simplified Chinese dictionary (the key-set source of truth). */\nexport const zh = {\n 'entry.label': '配对手机(协议 v1)',\n 'title': '协议 v1 配对',\n 'subtitle': '用手机 App 扫描下方二维码,即可以协议 v1 配对这台宿主。配对码由本机签发,仅在本机可读。',\n 'state.reading': '正在取配对码…',\n 'pair.qrLabel': '配对二维码',\n 'pair.payloadLabel': '二维码内容(可复制后粘贴到手机)',\n 'pair.countdown': '剩余 {s} 秒',\n 'pair.expired': '配对码已过期(30 秒)',\n 'pair.expiredHint': '过期的配对码不会被手机接受,请重新取码。',\n 'pair.usedHint': '配对码一次性:手机调用 pair.begin 的瞬间即作废,重新取码也会作废上一张。',\n 'pair.refresh': '重新取码',\n 'origin.title': '没能自动定位公网地址,二维码只装裸配对码',\n 'origin.body': '这台机器既没有 DSH_REMOTE_PUBLIC_BASE_URL,也没有中继注册表记录,因此无法把地址写进二维码。请先在手机 App 里把连接地址设成你的公网中继(形如 wss://<id>.dsh-market.com),再扫上面的码;本页所在的 {host} 只有本机能连,手机连不上。',\n 'origin.located.title': '手机将直接连到公网中继(地址已写进二维码)',\n 'origin.located.body': '二维码里已经带上 {origin}:手机扫一次就同时设好连接地址与配对码,不需要手填任何东西。',\n 'forbidden.title': '这个页面不是从本机打开的',\n 'forbidden.body': '配对码只能在本机 Web UI 上取。请在本机浏览器打开 http://127.0.0.1:<端口> 后重试。',\n 'failed.title': '取配对码失败',\n 'failed.body': '宿主返回了 HTTP {status},请刷新页面后重试。',\n 'unreachable.title': '无法连接本机宿主',\n 'unreachable.body': '请求没有到达宿主,请确认 dsh web 仍在运行后重试。',\n 'action.close': '关闭',\n 'action.copy': '复制配对码',\n 'action.copied': '已复制',\n 'action.copyFailed': '复制失败',\n 'action.retry': '重试',\n} as const\n\n/** English dictionary, key-for-key with the zh source. */\nexport const en: Record<RemoteBridgeKey, string> = {\n 'entry.label': 'Pair a phone (protocol v1)',\n 'title': 'Protocol v1 pairing',\n 'subtitle': 'Scan the QR code with the phone app to pair it with this host over protocol v1. The code is minted by this machine and only readable here.',\n 'state.reading': 'Requesting a pairing code…',\n 'pair.qrLabel': 'Pairing QR code',\n 'pair.payloadLabel': 'What the QR encodes (copy it to paste on the phone)',\n 'pair.countdown': '{s} s left',\n 'pair.expired': 'The pairing code expired (30 s)',\n 'pair.expiredHint': 'An expired code is never accepted; request a new one.',\n 'pair.usedHint': 'The code is single-use: the phone spends it the moment it calls pair.begin, and requesting a new one voids the previous code.',\n 'pair.refresh': 'New code',\n 'origin.title': 'No public address could be located, so the QR carries the bare code',\n 'origin.body': 'This machine has neither DSH_REMOTE_PUBLIC_BASE_URL nor a relay registry row, so the address cannot go into the QR. Set the phone app to your public relay first (such as wss://<id>.dsh-market.com), then scan the code above; {host} (this page) is reachable only from this machine and never from the phone.',\n 'origin.located.title': 'The phone dials the public relay directly (address is in the QR)',\n 'origin.located.body': 'The QR carries {origin}: one scan sets both the connection address and the pairing code, with nothing to type.',\n 'forbidden.title': 'This page is not open on this machine',\n 'forbidden.body': 'Pairing codes can only be read from the machine itself. Open http://127.0.0.1:<port> in a browser on this machine and retry.',\n 'failed.title': 'Could not read a pairing code',\n 'failed.body': 'The host answered HTTP {status}. Reload the page and retry.',\n 'unreachable.title': 'Cannot reach the local host',\n 'unreachable.body': 'The request never reached the host. Check that dsh web is still running and retry.',\n 'action.close': 'Close',\n 'action.copy': 'Copy pairing code',\n 'action.copied': 'Copied',\n 'action.copyFailed': 'Copy failed',\n 'action.retry': 'Retry',\n}\n\n/** Every key the `remote-bridge` namespace carries. */\nexport type RemoteBridgeKey = keyof typeof zh\n","/**\n * Protocol v1 pairing panel — browser half. Registers the `remote-bridge`\n * dictionary and the sidebar-foot trigger (into the ui-sidebar-declared\n * `sidebar.footer.action` list slot) that opens the panel showing this\n * package's own one-shot bootstrap token as a QR symbol plus its plaintext.\n *\n * The panel is display-only for the native path: it reads the same loopback-only\n * `GET /remote-bridge/pair/token` route an operator would curl, and never spends\n * the token (`pair.begin` stays the phone's call). The browser half therefore\n * adds no wire surface — the envelope, the method names, the topic names and\n * the events are untouched — and it does not touch `dsh-remote-web-ui`'s pairing\n * service, its roster, or its browser cookie path.\n *\n * Export discipline (packages/AGENTS.md): the /client surface carries only what\n * cordis loading needs plus types.\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its\n// LocaleNamespaceMap merge table.\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ctx.slots merge (the renderer owns the slot registry).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the ui-sidebar SlotMap merge (the 'sidebar.footer.action' hole).\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport { writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { PairEntry } from './PairEntry.tsx'\nimport { readPairToken } from './pair-token.ts'\nimport { en, zh, type RemoteBridgeKey } from './locales.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Protocol v1 pairing panel copy. */\n 'remote-bridge': RemoteBridgeKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'remote-bridge'\n\n/** Unique occupant id inside the shared footer.action list slot. */\nconst ENTRY_ID = 'remote-bridge'\n\n/** Services required by this plugin. */\nexport const inject = ['slots', 'locale']\n\n/**\n * Register the protocol v1 pairing surface.\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'remote-bridge: dictionaries')\n\n // Sidebar foot entry. The shell declares 'sidebar.footer.action' (list kind:\n // multiple occupants may share the seat) and registration is\n // declaration-aware via slots.inject. Read and clipboard arrive as an\n // injected face rather than a module import, which keeps the trigger's\n // rendered tree free of closure-factory bundles.\n ctx.slots.inject('sidebar.footer.action', () => {\n try {\n return ctx.slots.register({\n name: 'sidebar.footer.action',\n id: ENTRY_ID,\n locale: NS,\n inject: () => ({ read: readPairToken, copy: writeClipboard }),\n }, PairEntry)\n } catch {\n return () => {}\n }\n })\n}\n\nexport type { PairEntryProps } from './PairEntry.tsx'\nexport type { PairCopyState, PairPanelProps, PairPanelState } from './PairPanel.tsx'\nexport type { PairTokenFetch, PairTokenOutcome, PairTokenResponse, ReadPairTokenOptions } from './pair-token.ts'\nexport type { RemoteBridgeKey } from './locales.ts'\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,IAAI,YAAY,OAAO;EACvB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;KAC7D,GAAG,SAAS;IACd,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,CAAC;EACH"}
1
+ {"version":3,"file":"client.js","names":["React","Modal","css","Button","IconCloseOutlineRegular","IconWarningOutlineRegular","IconCheckOutlineRegular","IconCopyOutlineRegular","IconRefreshOutlineRegular","css","writeClipboard"],"sources":["../../../node_modules/.pnpm/qrcode.react@4.2.0_react@18.3.1/node_modules/qrcode.react/lib/esm/index.js","../../../packages/dsh-remote-bridge/src/client/semantic.ts","../../../packages/dsh-remote-bridge/src/client/PairPanel.tsx","../../../packages/dsh-remote-bridge/src/client/icons.tsx","../../../packages/dsh-remote-bridge/src/client/PairEntry.tsx","../../../packages/dsh-remote-bridge/src/core/protocol.ts","../../../packages/dsh-remote-bridge/src/client/pair-token.ts","../../../packages/dsh-remote-bridge/src/client/locales.ts","../../../packages/dsh-remote-bridge/src/client/index.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __objRest = (source, exclude) => {\n var target = {};\n for (var prop in source)\n if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)\n target[prop] = source[prop];\n if (source != null && __getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(source)) {\n if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))\n target[prop] = source[prop];\n }\n return target;\n};\n\n// src/index.tsx\nimport React from \"react\";\n\n// src/third-party/qrcodegen/index.ts\n/**\n * @license QR Code generator library (TypeScript)\n * Copyright (c) Project Nayuki.\n * SPDX-License-Identifier: MIT\n */\nvar qrcodegen;\n((qrcodegen2) => {\n const _QrCode = class _QrCode {\n /*-- Constructor (low level) and fields --*/\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 constructor(version, errorCorrectionLevel, dataCodewords, msk) {\n this.version = version;\n this.errorCorrectionLevel = errorCorrectionLevel;\n // The modules of this QR Code (false = light, true = dark).\n // Immutable after constructor finishes. Accessed through getModule().\n this.modules = [];\n // Indicates function modules that are not subjected to masking. Discarded when constructor finishes.\n this.isFunction = [];\n if (version < _QrCode.MIN_VERSION || version > _QrCode.MAX_VERSION)\n throw new RangeError(\"Version value out of range\");\n if (msk < -1 || msk > 7)\n throw new RangeError(\"Mask value out of range\");\n this.size = version * 4 + 17;\n let row = [];\n for (let i = 0; i < this.size; i++)\n row.push(false);\n for (let i = 0; i < this.size; i++) {\n this.modules.push(row.slice());\n this.isFunction.push(row.slice());\n }\n this.drawFunctionPatterns();\n const allCodewords = this.addEccAndInterleave(dataCodewords);\n this.drawCodewords(allCodewords);\n if (msk == -1) {\n let minPenalty = 1e9;\n for (let i = 0; i < 8; i++) {\n this.applyMask(i);\n this.drawFormatBits(i);\n const penalty = this.getPenaltyScore();\n if (penalty < minPenalty) {\n msk = i;\n minPenalty = penalty;\n }\n this.applyMask(i);\n }\n }\n assert(0 <= msk && msk <= 7);\n this.mask = msk;\n this.applyMask(msk);\n this.drawFormatBits(msk);\n this.isFunction = [];\n }\n /*-- Static factory functions (high level) --*/\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 static encodeText(text, ecl) {\n const segs = qrcodegen2.QrSegment.makeSegments(text);\n return _QrCode.encodeSegments(segs, ecl);\n }\n // Returns a QR Code representing the given binary data at the given error correction level.\n // This function always encodes using the binary segment mode, not any text mode. The maximum number of\n // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.\n // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.\n static encodeBinary(data, ecl) {\n const seg = qrcodegen2.QrSegment.makeBytes(data);\n return _QrCode.encodeSegments([seg], ecl);\n }\n /*-- Static factory functions (mid level) --*/\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 static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {\n if (!(_QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _QrCode.MAX_VERSION) || mask < -1 || mask > 7)\n throw new RangeError(\"Invalid value\");\n let version;\n let dataUsedBits;\n for (version = minVersion; ; version++) {\n const dataCapacityBits2 = _QrCode.getNumDataCodewords(version, ecl) * 8;\n const usedBits = QrSegment.getTotalBits(segs, version);\n if (usedBits <= dataCapacityBits2) {\n dataUsedBits = usedBits;\n break;\n }\n if (version >= maxVersion)\n throw new RangeError(\"Data too long\");\n }\n for (const newEcl of [_QrCode.Ecc.MEDIUM, _QrCode.Ecc.QUARTILE, _QrCode.Ecc.HIGH]) {\n if (boostEcl && dataUsedBits <= _QrCode.getNumDataCodewords(version, newEcl) * 8)\n ecl = newEcl;\n }\n let bb = [];\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())\n bb.push(b);\n }\n assert(bb.length == dataUsedBits);\n const dataCapacityBits = _QrCode.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 for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)\n appendBits(padByte, 8, bb);\n let dataCodewords = [];\n while (dataCodewords.length * 8 < bb.length)\n dataCodewords.push(0);\n bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));\n return new _QrCode(version, ecl, dataCodewords, mask);\n }\n /*-- Accessor methods --*/\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 getModule(x, y) {\n return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];\n }\n // Modified to expose modules for easy access\n getModules() {\n return this.modules;\n }\n /*-- Private helper methods for constructor: Drawing function modules --*/\n // Reads this object's version field, and draws and marks all function modules.\n drawFunctionPatterns() {\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 this.drawFinderPattern(3, 3);\n this.drawFinderPattern(this.size - 4, 3);\n this.drawFinderPattern(3, this.size - 4);\n const alignPatPos = this.getAlignmentPatternPositions();\n const numAlign = alignPatPos.length;\n for (let i = 0; i < numAlign; i++) {\n for (let j = 0; j < numAlign; j++) {\n if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))\n this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);\n }\n }\n this.drawFormatBits(0);\n this.drawVersion();\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 drawFormatBits(mask) {\n const data = this.errorCorrectionLevel.formatBits << 3 | mask;\n let rem = data;\n for (let i = 0; i < 10; i++)\n rem = rem << 1 ^ (rem >>> 9) * 1335;\n const bits = (data << 10 | rem) ^ 21522;\n assert(bits >>> 15 == 0);\n for (let i = 0; i <= 5; i++)\n 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 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);\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 drawVersion() {\n if (this.version < 7)\n return;\n let rem = this.version;\n for (let i = 0; i < 12; i++)\n rem = rem << 1 ^ (rem >>> 11) * 7973;\n const bits = this.version << 12 | rem;\n assert(bits >>> 18 == 0);\n for (let i = 0; i < 18; i++) {\n const color = getBit(bits, i);\n const a = this.size - 11 + i % 3;\n const b = Math.floor(i / 3);\n this.setFunctionModule(a, b, color);\n this.setFunctionModule(b, a, color);\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 drawFinderPattern(x, y) {\n for (let dy = -4; dy <= 4; dy++) {\n for (let dx = -4; dx <= 4; dx++) {\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n const xx = x + dx;\n const yy = 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 // Draws a 5*5 alignment pattern, with the center module\n // at (x, y). All modules must be in bounds.\n drawAlignmentPattern(x, y) {\n for (let dy = -2; dy <= 2; dy++) {\n for (let dx = -2; dx <= 2; dx++)\n this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);\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 setFunctionModule(x, y, isDark) {\n this.modules[y][x] = isDark;\n this.isFunction[y][x] = true;\n }\n /*-- Private helper methods for constructor: Codewords and masking --*/\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 addEccAndInterleave(data) {\n const ver = this.version;\n const ecl = this.errorCorrectionLevel;\n if (data.length != _QrCode.getNumDataCodewords(ver, ecl))\n throw new RangeError(\"Invalid argument\");\n const numBlocks = _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];\n const blockEccLen = _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];\n const rawCodewords = Math.floor(_QrCode.getNumRawDataModules(ver) / 8);\n const numShortBlocks = numBlocks - rawCodewords % numBlocks;\n const shortBlockLen = Math.floor(rawCodewords / numBlocks);\n let blocks = [];\n const rsDiv = _QrCode.reedSolomonComputeDivisor(blockEccLen);\n for (let i = 0, k = 0; i < numBlocks; i++) {\n let dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));\n k += dat.length;\n const ecc = _QrCode.reedSolomonComputeRemainder(dat, rsDiv);\n if (i < numShortBlocks)\n dat.push(0);\n blocks.push(dat.concat(ecc));\n }\n let result = [];\n for (let i = 0; i < blocks[0].length; i++) {\n blocks.forEach((block, j) => {\n if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)\n result.push(block[i]);\n });\n }\n assert(result.length == rawCodewords);\n return result;\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 drawCodewords(data) {\n if (data.length != Math.floor(_QrCode.getNumRawDataModules(this.version) / 8))\n throw new RangeError(\"Invalid argument\");\n let i = 0;\n for (let right = this.size - 1; right >= 1; right -= 2) {\n if (right == 6)\n right = 5;\n for (let vert = 0; vert < this.size; vert++) {\n for (let j = 0; j < 2; j++) {\n const x = right - j;\n const upward = (right + 1 & 2) == 0;\n const y = upward ? this.size - 1 - vert : vert;\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 }\n }\n }\n assert(i == data.length * 8);\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 applyMask(mask) {\n if (mask < 0 || mask > 7)\n 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;\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 // 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 getPenaltyScore() {\n let result = 0;\n for (let y = 0; y < this.size; y++) {\n let runColor = false;\n let runX = 0;\n let 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)\n result += _QrCode.PENALTY_N1;\n else if (runX > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runX, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;\n runColor = this.modules[y][x];\n runX = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _QrCode.PENALTY_N3;\n }\n for (let x = 0; x < this.size; x++) {\n let runColor = false;\n let runY = 0;\n let 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)\n result += _QrCode.PENALTY_N1;\n else if (runY > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runY, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;\n runColor = this.modules[y][x];\n runY = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode.PENALTY_N3;\n }\n for (let y = 0; y < this.size - 1; y++) {\n for (let x = 0; x < this.size - 1; x++) {\n const color = this.modules[y][x];\n if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1])\n result += _QrCode.PENALTY_N2;\n }\n }\n let dark = 0;\n for (const row of this.modules)\n dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);\n const total = this.size * this.size;\n const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;\n assert(0 <= k && k <= 9);\n result += k * _QrCode.PENALTY_N4;\n assert(0 <= result && result <= 2568888);\n return result;\n }\n /*-- Private helper functions --*/\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 getAlignmentPatternPositions() {\n if (this.version == 1)\n return [];\n else {\n const numAlign = Math.floor(this.version / 7) + 2;\n const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;\n let result = [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 // 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 static getNumRawDataModules(ver) {\n if (ver < _QrCode.MIN_VERSION || ver > _QrCode.MAX_VERSION)\n throw new RangeError(\"Version number out of range\");\n let result = (16 * ver + 128) * ver + 64;\n if (ver >= 2) {\n const numAlign = Math.floor(ver / 7) + 2;\n result -= (25 * numAlign - 10) * numAlign - 55;\n if (ver >= 7)\n result -= 36;\n }\n assert(208 <= result && result <= 29648);\n return result;\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 static getNumDataCodewords(ver, ecl) {\n return Math.floor(_QrCode.getNumRawDataModules(ver) / 8) - _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];\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 static reedSolomonComputeDivisor(degree) {\n if (degree < 1 || degree > 255)\n throw new RangeError(\"Degree out of range\");\n let result = [];\n for (let i = 0; i < degree - 1; i++)\n result.push(0);\n result.push(1);\n let root = 1;\n for (let i = 0; i < degree; i++) {\n for (let j = 0; j < result.length; j++) {\n result[j] = _QrCode.reedSolomonMultiply(result[j], root);\n if (j + 1 < result.length)\n result[j] ^= result[j + 1];\n }\n root = _QrCode.reedSolomonMultiply(root, 2);\n }\n return result;\n }\n // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.\n static reedSolomonComputeRemainder(data, divisor) {\n let result = divisor.map((_) => 0);\n for (const b of data) {\n const factor = b ^ result.shift();\n result.push(0);\n divisor.forEach((coef, i) => result[i] ^= _QrCode.reedSolomonMultiply(coef, factor));\n }\n return result;\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 static reedSolomonMultiply(x, y) {\n if (x >>> 8 != 0 || y >>> 8 != 0)\n throw new RangeError(\"Byte out of range\");\n let z = 0;\n for (let i = 7; i >= 0; i--) {\n z = z << 1 ^ (z >>> 7) * 285;\n z ^= (y >>> i & 1) * x;\n }\n assert(z >>> 8 == 0);\n return z;\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 finderPenaltyCountPatterns(runHistory) {\n const n = runHistory[1];\n assert(n <= this.size * 3);\n const core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;\n return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);\n }\n // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().\n finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {\n if (currentRunColor) {\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n currentRunLength = 0;\n }\n currentRunLength += this.size;\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n return this.finderPenaltyCountPatterns(runHistory);\n }\n // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().\n finderPenaltyAddHistory(currentRunLength, runHistory) {\n if (runHistory[0] == 0)\n currentRunLength += this.size;\n runHistory.pop();\n runHistory.unshift(currentRunLength);\n }\n };\n /*-- Constants and tables --*/\n // The minimum version number supported in the QR Code Model 2 standard.\n _QrCode.MIN_VERSION = 1;\n // The maximum version number supported in the QR Code Model 2 standard.\n _QrCode.MAX_VERSION = 40;\n // For use in getPenaltyScore(), when evaluating which mask is best.\n _QrCode.PENALTY_N1 = 3;\n _QrCode.PENALTY_N2 = 3;\n _QrCode.PENALTY_N3 = 40;\n _QrCode.PENALTY_N4 = 10;\n _QrCode.ECC_CODEWORDS_PER_BLOCK = [\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 [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Low\n [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],\n // Medium\n [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Quartile\n [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]\n // High\n ];\n _QrCode.NUM_ERROR_CORRECTION_BLOCKS = [\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 [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],\n // Low\n [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],\n // Medium\n [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],\n // Quartile\n [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]\n // High\n ];\n let QrCode = _QrCode;\n qrcodegen2.QrCode = _QrCode;\n function appendBits(val, len, bb) {\n if (len < 0 || len > 31 || val >>> len != 0)\n throw new RangeError(\"Value out of range\");\n for (let i = len - 1; i >= 0; i--)\n bb.push(val >>> i & 1);\n }\n function getBit(x, i) {\n return (x >>> i & 1) != 0;\n }\n function assert(cond) {\n if (!cond)\n throw new Error(\"Assertion error\");\n }\n const _QrSegment = class _QrSegment {\n /*-- Constructor (low level) and fields --*/\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 constructor(mode, numChars, bitData) {\n this.mode = mode;\n this.numChars = numChars;\n this.bitData = bitData;\n if (numChars < 0)\n throw new RangeError(\"Invalid argument\");\n this.bitData = bitData.slice();\n }\n /*-- Static factory functions (mid level) --*/\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 static makeBytes(data) {\n let bb = [];\n for (const b of data)\n appendBits(b, 8, bb);\n return new _QrSegment(_QrSegment.Mode.BYTE, data.length, bb);\n }\n // Returns a segment representing the given string of decimal digits encoded in numeric mode.\n static makeNumeric(digits) {\n if (!_QrSegment.isNumeric(digits))\n throw new RangeError(\"String contains non-numeric characters\");\n let bb = [];\n for (let i = 0; i < digits.length; ) {\n const n = 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(_QrSegment.Mode.NUMERIC, digits.length, bb);\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 static makeAlphanumeric(text) {\n if (!_QrSegment.isAlphanumeric(text))\n throw new RangeError(\"String contains unencodable characters in alphanumeric mode\");\n let bb = [];\n let i;\n for (i = 0; i + 2 <= text.length; i += 2) {\n let temp = _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 appendBits(_QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);\n return new _QrSegment(_QrSegment.Mode.ALPHANUMERIC, text.length, bb);\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 static makeSegments(text) {\n if (text == \"\")\n return [];\n else if (_QrSegment.isNumeric(text))\n return [_QrSegment.makeNumeric(text)];\n else if (_QrSegment.isAlphanumeric(text))\n return [_QrSegment.makeAlphanumeric(text)];\n else\n return [_QrSegment.makeBytes(_QrSegment.toUtf8ByteArray(text))];\n }\n // Returns a segment representing an Extended Channel Interpretation\n // (ECI) designator with the given assignment value.\n static makeEci(assignVal) {\n let bb = [];\n if (assignVal < 0)\n throw new RangeError(\"ECI assignment value out of range\");\n else if (assignVal < 1 << 7)\n appendBits(assignVal, 8, bb);\n else if (assignVal < 1 << 14) {\n appendBits(2, 2, bb);\n appendBits(assignVal, 14, bb);\n } else if (assignVal < 1e6) {\n appendBits(6, 3, bb);\n appendBits(assignVal, 21, bb);\n } else\n throw new RangeError(\"ECI assignment value out of range\");\n return new _QrSegment(_QrSegment.Mode.ECI, 0, bb);\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 static isNumeric(text) {\n return _QrSegment.NUMERIC_REGEX.test(text);\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 static isAlphanumeric(text) {\n return _QrSegment.ALPHANUMERIC_REGEX.test(text);\n }\n /*-- Methods --*/\n // Returns a new copy of the data bits of this segment.\n getData() {\n return this.bitData.slice();\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 static getTotalBits(segs, version) {\n let result = 0;\n for (const seg of segs) {\n const ccbits = seg.mode.numCharCountBits(version);\n if (seg.numChars >= 1 << ccbits)\n return Infinity;\n result += 4 + ccbits + seg.bitData.length;\n }\n return result;\n }\n // Returns a new array of bytes representing the given string encoded in UTF-8.\n static toUtf8ByteArray(str) {\n str = encodeURI(str);\n let result = [];\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) != \"%\")\n 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 // Describes precisely all strings that are encodable in numeric mode.\n _QrSegment.NUMERIC_REGEX = /^[0-9]*$/;\n // Describes precisely all strings that are encodable in alphanumeric mode.\n _QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\\/:-]*$/;\n // The set of all legal characters in alphanumeric mode,\n // where each character value maps to the index in the string.\n _QrSegment.ALPHANUMERIC_CHARSET = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:\";\n let QrSegment = _QrSegment;\n qrcodegen2.QrSegment = _QrSegment;\n})(qrcodegen || (qrcodegen = {}));\n((qrcodegen2) => {\n let QrCode;\n ((QrCode2) => {\n const _Ecc = class _Ecc {\n // The QR Code can tolerate about 30% erroneous codewords\n /*-- Constructor and fields --*/\n constructor(ordinal, formatBits) {\n this.ordinal = ordinal;\n this.formatBits = formatBits;\n }\n };\n /*-- Constants --*/\n _Ecc.LOW = new _Ecc(0, 1);\n // The QR Code can tolerate about 7% erroneous codewords\n _Ecc.MEDIUM = new _Ecc(1, 0);\n // The QR Code can tolerate about 15% erroneous codewords\n _Ecc.QUARTILE = new _Ecc(2, 3);\n // The QR Code can tolerate about 25% erroneous codewords\n _Ecc.HIGH = new _Ecc(3, 2);\n let Ecc = _Ecc;\n QrCode2.Ecc = _Ecc;\n })(QrCode = qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));\n})(qrcodegen || (qrcodegen = {}));\n((qrcodegen2) => {\n let QrSegment;\n ((QrSegment2) => {\n const _Mode = class _Mode {\n /*-- Constructor and fields --*/\n constructor(modeBits, numBitsCharCount) {\n this.modeBits = modeBits;\n this.numBitsCharCount = numBitsCharCount;\n }\n /*-- Method --*/\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 numCharCountBits(ver) {\n return this.numBitsCharCount[Math.floor((ver + 7) / 17)];\n }\n };\n /*-- Constants --*/\n _Mode.NUMERIC = new _Mode(1, [10, 12, 14]);\n _Mode.ALPHANUMERIC = new _Mode(2, [9, 11, 13]);\n _Mode.BYTE = new _Mode(4, [8, 16, 16]);\n _Mode.KANJI = new _Mode(8, [8, 10, 12]);\n _Mode.ECI = new _Mode(7, [0, 0, 0]);\n let Mode = _Mode;\n QrSegment2.Mode = _Mode;\n })(QrSegment = qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));\n})(qrcodegen || (qrcodegen = {}));\nvar qrcodegen_default = qrcodegen;\n\n// src/index.tsx\n/**\n * @license qrcode.react\n * Copyright (c) Paul O'Shannessy\n * SPDX-License-Identifier: ISC\n */\nvar ERROR_LEVEL_MAP = {\n L: qrcodegen_default.QrCode.Ecc.LOW,\n M: qrcodegen_default.QrCode.Ecc.MEDIUM,\n Q: qrcodegen_default.QrCode.Ecc.QUARTILE,\n H: qrcodegen_default.QrCode.Ecc.HIGH\n};\nvar DEFAULT_SIZE = 128;\nvar DEFAULT_LEVEL = \"L\";\nvar DEFAULT_BGCOLOR = \"#FFFFFF\";\nvar DEFAULT_FGCOLOR = \"#000000\";\nvar DEFAULT_INCLUDEMARGIN = false;\nvar DEFAULT_MINVERSION = 1;\nvar SPEC_MARGIN_SIZE = 4;\nvar DEFAULT_MARGIN_SIZE = 0;\nvar DEFAULT_IMG_SCALE = 0.1;\nfunction generatePath(modules, margin = 0) {\n const ops = [];\n modules.forEach(function(row, y) {\n let start = null;\n row.forEach(function(cell, x) {\n if (!cell && start !== null) {\n ops.push(\n `M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`\n );\n start = null;\n return;\n }\n if (x === row.length - 1) {\n if (!cell) {\n return;\n }\n if (start === null) {\n ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);\n } else {\n ops.push(\n `M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`\n );\n }\n return;\n }\n if (cell && start === null) {\n start = x;\n }\n });\n });\n return ops.join(\"\");\n}\nfunction excavateModules(modules, excavation) {\n return modules.slice().map((row, y) => {\n if (y < excavation.y || y >= excavation.y + excavation.h) {\n return row;\n }\n return row.map((cell, x) => {\n if (x < excavation.x || x >= excavation.x + excavation.w) {\n return cell;\n }\n return false;\n });\n });\n}\nfunction getImageSettings(cells, size, margin, imageSettings) {\n if (imageSettings == null) {\n return null;\n }\n const numCells = cells.length + margin * 2;\n const defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);\n const scale = numCells / size;\n const w = (imageSettings.width || defaultSize) * scale;\n const h = (imageSettings.height || defaultSize) * scale;\n const x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;\n const y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;\n const opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;\n let excavation = null;\n if (imageSettings.excavate) {\n let floorX = Math.floor(x);\n let floorY = Math.floor(y);\n let ceilW = Math.ceil(w + x - floorX);\n let ceilH = Math.ceil(h + y - floorY);\n excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };\n }\n const crossOrigin = imageSettings.crossOrigin;\n return { x, y, h, w, excavation, opacity, crossOrigin };\n}\nfunction getMarginSize(includeMargin, marginSize) {\n if (marginSize != null) {\n return Math.max(Math.floor(marginSize), 0);\n }\n return includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;\n}\nfunction useQRCode({\n value,\n level,\n minVersion,\n includeMargin,\n marginSize,\n imageSettings,\n size,\n boostLevel\n}) {\n let qrcode = React.useMemo(() => {\n const values = Array.isArray(value) ? value : [value];\n const segments = values.reduce((accum, v) => {\n accum.push(...qrcodegen_default.QrSegment.makeSegments(v));\n return accum;\n }, []);\n return qrcodegen_default.QrCode.encodeSegments(\n segments,\n ERROR_LEVEL_MAP[level],\n minVersion,\n void 0,\n void 0,\n boostLevel\n );\n }, [value, level, minVersion, boostLevel]);\n const { cells, margin, numCells, calculatedImageSettings } = React.useMemo(() => {\n let cells2 = qrcode.getModules();\n const margin2 = getMarginSize(includeMargin, marginSize);\n const numCells2 = cells2.length + margin2 * 2;\n const calculatedImageSettings2 = getImageSettings(\n cells2,\n size,\n margin2,\n imageSettings\n );\n return {\n cells: cells2,\n margin: margin2,\n numCells: numCells2,\n calculatedImageSettings: calculatedImageSettings2\n };\n }, [qrcode, size, imageSettings, includeMargin, marginSize]);\n return {\n qrcode,\n margin,\n cells,\n numCells,\n calculatedImageSettings\n };\n}\nvar SUPPORTS_PATH2D = function() {\n try {\n new Path2D().addPath(new Path2D());\n } catch (e) {\n return false;\n }\n return true;\n}();\nvar QRCodeCanvas = React.forwardRef(\n function QRCodeCanvas2(props, forwardedRef) {\n const _a = props, {\n value,\n size = DEFAULT_SIZE,\n level = DEFAULT_LEVEL,\n bgColor = DEFAULT_BGCOLOR,\n fgColor = DEFAULT_FGCOLOR,\n includeMargin = DEFAULT_INCLUDEMARGIN,\n minVersion = DEFAULT_MINVERSION,\n boostLevel,\n marginSize,\n imageSettings\n } = _a, extraProps = __objRest(_a, [\n \"value\",\n \"size\",\n \"level\",\n \"bgColor\",\n \"fgColor\",\n \"includeMargin\",\n \"minVersion\",\n \"boostLevel\",\n \"marginSize\",\n \"imageSettings\"\n ]);\n const _b = extraProps, { style } = _b, otherProps = __objRest(_b, [\"style\"]);\n const imgSrc = imageSettings == null ? void 0 : imageSettings.src;\n const _canvas = React.useRef(null);\n const _image = React.useRef(null);\n const setCanvasRef = React.useCallback(\n (node) => {\n _canvas.current = node;\n if (typeof forwardedRef === \"function\") {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef]\n );\n const [isImgLoaded, setIsImageLoaded] = React.useState(false);\n const { margin, cells, numCells, calculatedImageSettings } = useQRCode({\n value,\n level,\n minVersion,\n boostLevel,\n includeMargin,\n marginSize,\n imageSettings,\n size\n });\n React.useEffect(() => {\n if (_canvas.current != null) {\n const canvas = _canvas.current;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n return;\n }\n let cellsToDraw = cells;\n const image = _image.current;\n const haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;\n if (haveImageToRender) {\n if (calculatedImageSettings.excavation != null) {\n cellsToDraw = excavateModules(\n cells,\n calculatedImageSettings.excavation\n );\n }\n }\n const pixelRatio = window.devicePixelRatio || 1;\n canvas.height = canvas.width = size * pixelRatio;\n const scale = size / numCells * pixelRatio;\n ctx.scale(scale, scale);\n ctx.fillStyle = bgColor;\n ctx.fillRect(0, 0, numCells, numCells);\n ctx.fillStyle = fgColor;\n if (SUPPORTS_PATH2D) {\n ctx.fill(new Path2D(generatePath(cellsToDraw, margin)));\n } else {\n cells.forEach(function(row, rdx) {\n row.forEach(function(cell, cdx) {\n if (cell) {\n ctx.fillRect(cdx + margin, rdx + margin, 1, 1);\n }\n });\n });\n }\n if (calculatedImageSettings) {\n ctx.globalAlpha = calculatedImageSettings.opacity;\n }\n if (haveImageToRender) {\n ctx.drawImage(\n image,\n calculatedImageSettings.x + margin,\n calculatedImageSettings.y + margin,\n calculatedImageSettings.w,\n calculatedImageSettings.h\n );\n }\n }\n });\n React.useEffect(() => {\n setIsImageLoaded(false);\n }, [imgSrc]);\n const canvasStyle = __spreadValues({ height: size, width: size }, style);\n let img = null;\n if (imgSrc != null) {\n img = /* @__PURE__ */ React.createElement(\n \"img\",\n {\n src: imgSrc,\n key: imgSrc,\n style: { display: \"none\" },\n onLoad: () => {\n setIsImageLoaded(true);\n },\n ref: _image,\n crossOrigin: calculatedImageSettings == null ? void 0 : calculatedImageSettings.crossOrigin\n }\n );\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(\n \"canvas\",\n __spreadValues({\n style: canvasStyle,\n height: size,\n width: size,\n ref: setCanvasRef,\n role: \"img\"\n }, otherProps)\n ), img);\n }\n);\nQRCodeCanvas.displayName = \"QRCodeCanvas\";\nvar QRCodeSVG = React.forwardRef(\n function QRCodeSVG2(props, forwardedRef) {\n const _a = props, {\n value,\n size = DEFAULT_SIZE,\n level = DEFAULT_LEVEL,\n bgColor = DEFAULT_BGCOLOR,\n fgColor = DEFAULT_FGCOLOR,\n includeMargin = DEFAULT_INCLUDEMARGIN,\n minVersion = DEFAULT_MINVERSION,\n boostLevel,\n title,\n marginSize,\n imageSettings\n } = _a, otherProps = __objRest(_a, [\n \"value\",\n \"size\",\n \"level\",\n \"bgColor\",\n \"fgColor\",\n \"includeMargin\",\n \"minVersion\",\n \"boostLevel\",\n \"title\",\n \"marginSize\",\n \"imageSettings\"\n ]);\n const { margin, cells, numCells, calculatedImageSettings } = useQRCode({\n value,\n level,\n minVersion,\n boostLevel,\n includeMargin,\n marginSize,\n imageSettings,\n size\n });\n let cellsToDraw = cells;\n let image = null;\n if (imageSettings != null && calculatedImageSettings != null) {\n if (calculatedImageSettings.excavation != null) {\n cellsToDraw = excavateModules(\n cells,\n calculatedImageSettings.excavation\n );\n }\n image = /* @__PURE__ */ React.createElement(\n \"image\",\n {\n href: imageSettings.src,\n height: calculatedImageSettings.h,\n width: calculatedImageSettings.w,\n x: calculatedImageSettings.x + margin,\n y: calculatedImageSettings.y + margin,\n preserveAspectRatio: \"none\",\n opacity: calculatedImageSettings.opacity,\n crossOrigin: calculatedImageSettings.crossOrigin\n }\n );\n }\n const fgPath = generatePath(cellsToDraw, margin);\n return /* @__PURE__ */ React.createElement(\n \"svg\",\n __spreadValues({\n height: size,\n width: size,\n viewBox: `0 0 ${numCells} ${numCells}`,\n ref: forwardedRef,\n role: \"img\"\n }, otherProps),\n !!title && /* @__PURE__ */ React.createElement(\"title\", null, title),\n /* @__PURE__ */ React.createElement(\n \"path\",\n {\n fill: bgColor,\n d: `M0,0 h${numCells}v${numCells}H0z`,\n shapeRendering: \"crispEdges\"\n }\n ),\n /* @__PURE__ */ React.createElement(\"path\", { fill: fgColor, d: fgPath, shapeRendering: \"crispEdges\" }),\n image\n );\n }\n);\nQRCodeSVG.displayName = \"QRCodeSVG\";\nexport {\n QRCodeCanvas,\n QRCodeSVG\n};\n","/**\n * Semantic attribute values for the protocol v1 pairing panel (contract:\n * skins/skin-center/contracts/semantic-attrs-v1.md). Root containers carry\n * `data-dsh-plugin`; parts carry bare `data-dsh-part` values owned by that\n * plugin attribute.\n */\n\n/** Plugin short name stamped on the footer trigger and the modal root. */\nexport const PLUGIN_ATTR = 'remote-bridge'\n\n/** The sidebar footer seat trigger. */\nexport const PART_ENTRY = 'entry'\n\n/** The modal panel root. */\nexport const PART_PANEL = 'panel'\n\n/** The QR symbol's box — it also mirrors the encoded string. */\nexport const PART_QR = 'qr'\n\n/** A refusal the host raised. */\nexport const PART_NOTICE = 'notice'\n\n/** The mint-again button. */\nexport const PART_REFRESH = 'refresh'\n\n/** The copy-the-code button. */\nexport const PART_COPY = 'copy'\n\n/**\n * Attribute carrying the exact string the QR symbol encodes, so the operator\n * (and a UI check) can compare it against the host route's answer without\n * decoding the symbol. It is the only machine trace the panel renders.\n */\nexport const QR_VALUE_ATTR = 'data-dsh-qr-value'\n\n/**\n * Marks the QR part of a code that has run out of time. Expiry is state on the\n * existing part, not a new part value: the cross-repository part enum is frozen\n * and a plugin may not extend it for one visual state.\n */\nexport const EXPIRED_ATTR = 'data-expired'\n","/**\n * The protocol v1 pairing panel: the QR symbol, the countdown with its expiry\n * state, the one address fact the reader must not miss, and the two actions that\n * keep a fresh code on screen.\n *\n * The shell is the official headless `Modal` and every action is the official\n * `Button`, so the overlay, the mask, the card, the focus trap, the Escape\n * command and the interaction states belong to the library. This file owns the\n * information order and the state presentation only: every state and action\n * arrives through props, and the clock is a prop, so the expiry flip is\n * deterministic instead of read from `Date.now()` here.\n */\nimport { memo, useLayoutEffect, useRef } from 'react'\nimport { QRCodeSVG } from 'qrcode.react'\nimport {\n Button, IconCheckOutlineRegular, IconCloseOutlineRegular, IconCopyOutlineRegular,\n IconRefreshOutlineRegular, IconWarningOutlineRegular, Modal,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport {\n EXPIRED_ATTR, PART_COPY, PART_NOTICE, PART_PANEL, PART_QR, PART_REFRESH, PLUGIN_ATTR, QR_VALUE_ATTR,\n} from './semantic.ts'\nimport css from './panel.module.css'\n\n/** The custom property carrying the dialog's own enter keyframe name. */\nconst EXIT_NAME_VAR = '--pair-exit-name'\n\n/** What the panel is currently showing. */\nexport type PairPanelState =\n /** A read is in flight. */\n | { kind: 'reading' }\n /**\n * A live one-shot secret. `pairingUrl`, when the host could name its own\n * public origin, is what the QR encodes: a `{token, url}` document the iOS\n * client parses into both halves of its configuration, so one scan sets the\n * address AND the token. With no origin the QR carries the bare token and the\n * panel says the address has to be set on the phone by hand.\n */\n | { kind: 'ready'; token: string; issuedAt: number; expiresAt: number; origin: string | null; pairingUrl: string | null }\n /** 403 from the loopback gate: this page is not open on the machine itself. */\n | { kind: 'forbidden' }\n /** The host route answered with an unexpected status or shape. */\n | { kind: 'failed'; status: number }\n /** The request never reached the host. */\n | { kind: 'unreachable' }\n\n/** How the last copy attempt went. */\nexport type PairCopyState = 'idle' | 'copied' | 'failed'\n\nexport interface PairPanelProps {\n t: PropsLocale<'remote-bridge'>['t']\n state: PairPanelState\n /** The current wall clock; the entry supplies it from a one-second ticker. */\n now: number\n /** This page's own `host:port`, named in the origin warning. */\n host: string\n copy: PairCopyState\n /** Whether the modal is mounted at all (the entry keeps it for the leave leg). */\n showing: boolean\n /** Whether the leave leg is running; the card stays mounted until it ends. */\n closing: boolean\n /** The panel element's id, so the seat trigger can name what it expands. */\n id: string\n onClose(): void\n /** The leave leg reported completion: the entry may unmount the modal now. */\n onExited(): void\n onRefresh(): void\n onCopy(payload: string): void\n}\n\n/**\n * The QR symbol, memoized on the secret: the countdown re-renders the panel\n * every second, and qrcode.react rebuilds the whole module path on each render.\n * The encoded value is the host's own `pairingUrl` verbatim when there is one —\n * a `{token, url}` document whose `url` names THIS instance's public relay, so\n * the phone adopts an origin that actually reaches this host. The bare-token\n * fallback means the phone keeps whatever origin it already has.\n */\nconst PairQrCode = memo(function PairQrCode({ value, label }: { value: string; label: string }) {\n return <QRCodeSVG value={value} size={184} level=\"M\" marginSize={1} aria-label={label} />\n})\n\n/** The one string the panel hands out: what the symbol encodes, what copy copies. */\nfunction payloadOf(state: PairPanelState): string {\n return state.kind === 'ready' ? (state.pairingUrl ?? state.token) : ''\n}\n\n/**\n * Render the pairing panel.\n * @param props - locale seat, view state, clock, page host and actions.\n * @returns the panel element tree.\n */\nexport function PairPanel({\n t, state, now, host, copy, showing, closing, id, onClose, onExited, onRefresh, onCopy,\n}: PairPanelProps) {\n const panel = useRef<HTMLDivElement | null>(null)\n const ready = state.kind === 'ready'\n const remainingMs = ready ? Math.max(0, state.expiresAt - now) : 0\n const expired = ready && remainingMs <= 0\n const seconds = Math.ceil(remainingMs / 1000)\n const windowMs = ready ? Math.max(1, state.expiresAt - state.issuedAt) : 1\n const percent = Math.min(100, Math.max(0, Math.round((remainingMs / windowMs) * 100)))\n const payload = payloadOf(state)\n // Only a live code can be handed out. An expired one is still on screen, so\n // its button stays put and reports that it is switched off.\n const canCopy = !expired && payload !== ''\n // A refusal the host raised is retried; a live or expired code is minted again.\n const primaryLabel = state.kind === 'failed' || state.kind === 'unreachable' ? t('action.retry') : t('pair.refresh')\n const located = ready && state.pairingUrl !== null\n\n // The library owns the enter animation and the bundler scopes its keyframe\n // name, so the leave leg cannot name it in CSS. Read the mounted dialog's own\n // animation at the moment closing starts and hand it to the card: the exit\n // then plays that exact keyframe backwards (M2, same path reversed). Clearing\n // it on reopen is what lets the same card come back to full opacity.\n useLayoutEffect(() => {\n const element = panel.current\n if (element === null) return\n if (!closing) {\n element.style.removeProperty(EXIT_NAME_VAR)\n return\n }\n const dialog = element.parentElement\n const enter = dialog === null ? '' : window.getComputedStyle(dialog).animationName\n if (enter !== '' && enter !== 'none') element.style.setProperty(EXIT_NAME_VAR, enter)\n }, [closing])\n\n return (\n <Modal open={showing} onClose={onClose} title={t('title')} headless className={css.dialog}>\n <div\n ref={panel}\n id={id}\n className={css.panel}\n data-dsh-plugin={PLUGIN_ATTR}\n data-dsh-part={PART_PANEL}\n data-closing={closing || undefined}\n onAnimationEnd={(event) => {\n if (closing && event.target === event.currentTarget) onExited()\n }}\n onTransitionEnd={(event) => {\n if (closing && event.target === event.currentTarget && event.propertyName === 'opacity') onExited()\n }}\n >\n <header className={css.header}>\n <div className={css.heading}>\n <h2 className={css.title}>{t('title')}</h2>\n <p className={css.subtitle}>{t('subtitle')}</p>\n </div>\n <Button\n className={css.close}\n variant=\"ghost\"\n size=\"sm\"\n aria-label={t('action.close')}\n icon={<IconCloseOutlineRegular />}\n onClick={onClose}\n />\n </header>\n\n <div className={css.body}>\n {(state.kind === 'forbidden' || state.kind === 'failed' || state.kind === 'unreachable') && (\n <div className={css.notice} data-dsh-part={PART_NOTICE} data-tone=\"alert\" role=\"alert\">\n <span className={css.noticeIcon} aria-hidden=\"true\"><IconWarningOutlineRegular /></span>\n <div className={css.noticeCopy}>\n <p className={css.noticeTitle}>\n {state.kind === 'forbidden' && t('forbidden.title')}\n {state.kind === 'failed' && t('failed.title')}\n {state.kind === 'unreachable' && t('unreachable.title')}\n </p>\n <p className={css.noticeText}>\n {state.kind === 'forbidden' && t('forbidden.body')}\n {state.kind === 'failed' && t('failed.body', { status: String(state.status) })}\n {state.kind === 'unreachable' && t('unreachable.body')}\n </p>\n </div>\n </div>\n )}\n\n {(state.kind === 'reading' || ready) && (\n <>\n <div className={css.qrCard}>\n <div\n className={css.qrSlot}\n data-dsh-part={PART_QR}\n {...{ [QR_VALUE_ATTR]: payload }}\n {...{ [EXPIRED_ATTR]: expired || undefined }}\n >\n {ready ? (\n <PairQrCode value={payload} label={t('pair.qrLabel')} />\n ) : (\n <span className={css.skeleton} aria-hidden=\"true\" />\n )}\n </div>\n <div className={css.status}>\n {!ready && <p className={css.statusText}>{t('state.reading')}</p>}\n {ready && expired && <p className={css.statusText} role=\"status\">{t('pair.expired')}</p>}\n {ready && !expired && (\n <>\n <p className={css.statusText}>{t('pair.countdown', { s: String(seconds) })}</p>\n <span className={css.bar} aria-hidden=\"true\">\n <span className={css.barFill} style={{ width: `${String(percent)}%` }} />\n </span>\n </>\n )}\n </div>\n </div>\n\n <p className={css.address} data-tone={located ? 'plain' : 'warning'}>\n {ready && located && t('origin.located', { origin: state.origin ?? '' })}\n {ready && !located && t('origin.missing', { host })}\n </p>\n <p className={css.hint}>{t('pair.usedHint')}</p>\n </>\n )}\n </div>\n\n {/* The row exists only while it holds an action: a refusal offers\n nothing to press, and copy itself needs a code to hand out. An\n actionless row would still spend the panel's own gap. */}\n {state.kind !== 'forbidden' && (\n <footer className={css.actions}>\n {ready && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n data-dsh-part={PART_COPY}\n disabled={!canCopy}\n icon={copy === 'copied' ? <IconCheckOutlineRegular /> : <IconCopyOutlineRegular />}\n onClick={() => { onCopy(payload) }}\n >\n <span className={css.labels}>\n <span className={css.label} data-visible={copy === 'idle'} aria-hidden={copy !== 'idle'}>\n {t('action.copy')}\n </span>\n <span className={css.label} data-visible={copy === 'copied'} aria-hidden={copy !== 'copied'}>\n {t('action.copied')}\n </span>\n <span className={css.label} data-visible={copy === 'failed'} aria-hidden={copy !== 'failed'}>\n {t('action.copyFailed')}\n </span>\n </span>\n </Button>\n )}\n <Button\n variant=\"primary\"\n size=\"sm\"\n data-dsh-part={PART_REFRESH}\n disabled={state.kind === 'reading'}\n icon={<IconRefreshOutlineRegular />}\n onClick={onRefresh}\n >\n {primaryLabel}\n </Button>\n </footer>\n )}\n\n {/* Renaming the button under the pointer is not announced: a control's\n label is reported when focus lands on it, not when it changes. The\n outcome is said once from this region instead, and said as nothing\n while there is no outcome to report. */}\n <div className={css.announce} role=\"status\">\n {copy === 'copied' && t('action.copied')}\n {copy === 'failed' && t('action.copyFailed')}\n </div>\n </div>\n </Modal>\n )\n}\n","/**\n * The pairing seat's QR glyph. It is the one icon this package draws itself\n * (I4 exception, recorded here): the official icon set in\n * `@deepseek-ai/dsh-client-ui-primitives` ships no QR or scan metaphor, and a\n * text or emoji stand-in is not an icon (I1). Every other glyph this panel\n * needs — close, copy, check, refresh, warning — comes from that set.\n */\nimport type { SVGProps } from 'react'\n\n/** A QR-symbol glyph: three finder squares plus a payload dot. */\nexport function QrIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg\n width={16}\n height={16}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M2.5 2.5h4v4h-4zM9.5 2.5h4v4h-4zM2.5 9.5h4v4h-4z\" />\n <path d=\"M9.5 9.5h1.6v1.6H9.5zM12.4 9.5h1.1M9.5 12.4v1.1M12 13.5h1.5v-1.5h-1.5z\" />\n </svg>\n )\n}\n","/**\n * Sidebar footer entry for the protocol v1 pairing panel: the icon-only trigger\n * beside the sidebar settings seat (wide row / rail circle) that opens the\n * panel. Registered into the official `sidebar.footer.action` list slot\n * (declared by ui-sidebar — the same seat dsh-remote-web-ui and dsh-update\n * share).\n *\n * This component owns the panel's presence and behavior: one read per open, one\n * clock tick while a live code is on screen, the mint-again action, the copy\n * action, and the leave leg that keeps the modal mounted until its exit reports\n * completion. The wire call and the clipboard are injected (see the plugin\n * entry), so the rendered tree carries no closure-factory bundle import and both\n * can be driven by a test without patching a module.\n */\nimport { useCallback, useEffect, useId, useRef, useState } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { PairPanel, type PairCopyState, type PairPanelState } from './PairPanel.tsx'\nimport type { PairTokenOutcome } from './pair-token.ts'\nimport { PART_ENTRY, PLUGIN_ATTR } from './semantic.ts'\nimport { QrIcon } from './icons.tsx'\nimport css from './panel.module.css'\n\n/** How long the transient \"copied\" / \"copy failed\" label stays up. */\nconst COPY_FEEDBACK_MS = 1_500\n/** The countdown's tick; one second is the resolution the panel shows. */\nconst TICK_MS = 1_000\n/**\n * Upper bound on the leave leg. The card reports its own animation end, and the\n * reduced-motion fade reports a transition end; this only ends the presence of a\n * browser that reports neither, just past var(--ds-transition-duration).\n */\nconst EXIT_TIMEOUT_MS = 260\n\n/**\n * The modal's presence. `closing` is a state of its own: the card stays mounted\n * for its reverse exit and unmounts only when that exit reports completion,\n * instead of disappearing on the same tick as the click.\n */\ntype Presence = 'closed' | 'open' | 'closing'\n\nexport type PairEntryProps = PropsLocale<'remote-bridge'> & {\n /** Whether the sidebar renders wide content (false = 56px rail). */\n wide: boolean\n /** Reads a fresh one-shot token from this package's own Host route. */\n read: () => Promise<PairTokenOutcome>\n /** Puts the token on the OS clipboard; false means the write was refused. */\n copy: (text: string) => Promise<boolean>\n}\n\n/** Map a read outcome onto the panel's view state. */\nfunction panelStateOf(outcome: PairTokenOutcome, issuedAt: number): PairPanelState {\n switch (outcome.kind) {\n case 'ok':\n return {\n kind: 'ready',\n token: outcome.token,\n issuedAt,\n expiresAt: outcome.expiresAt,\n origin: outcome.origin,\n pairingUrl: outcome.pairingUrl,\n }\n case 'forbidden': return { kind: 'forbidden' }\n case 'unreachable': return { kind: 'unreachable' }\n case 'failed': return { kind: 'failed', status: outcome.status }\n }\n}\n\n/**\n * Render the pairing seat trigger and, while it is open or leaving, the panel.\n * @param props - the footer seat's column state, the injected actions and the locale seat.\n * @returns the trigger and, when present, the official Modal holding the panel.\n */\nexport function PairEntry({ wide, read, copy, t }: PairEntryProps) {\n const [presence, setPresence] = useState<Presence>('closed')\n const [state, setState] = useState<PairPanelState>({ kind: 'reading' })\n const [copyState, setCopyState] = useState<PairCopyState>('idle')\n const [now, setNow] = useState<number>(() => Date.now())\n const panelId = useId()\n // Generation counter: closing (or minting again) invalidates a read that is\n // still in flight, so an answer that lands after the panel closed cannot\n // resurrect a code nobody asked for.\n const generation = useRef(0)\n\n const mint = useCallback((): void => {\n const request = ++generation.current\n setState({ kind: 'reading' })\n void read().then((outcome) => {\n if (request !== generation.current) return\n const issuedAt = Date.now()\n setNow(issuedAt)\n setState(panelStateOf(outcome, issuedAt))\n })\n }, [read])\n\n const openPanel = useCallback((): void => {\n setPresence('open')\n setCopyState('idle')\n mint()\n }, [mint])\n\n // Escape, the mask click, the focus trap and focus restoration belong to the\n // official Modal; this only decides what closing means for the presence, and\n // it invalidates a read that is still in flight.\n const requestClose = useCallback((): void => {\n generation.current += 1\n setPresence((current) => (current === 'closed' ? 'closed' : 'closing'))\n }, [])\n\n const finishClose = useCallback((): void => {\n setPresence((current) => (current === 'closing' ? 'closed' : current))\n }, [])\n\n const closing = presence === 'closing'\n const showing = presence !== 'closed'\n\n // Safety net for the leave leg: the card normally reports its own animation or\n // transition end, and this bound covers the case where neither arrives.\n useEffect(() => {\n if (!closing) return\n const timer = window.setTimeout(() => { finishClose() }, EXIT_TIMEOUT_MS)\n return () => { window.clearTimeout(timer) }\n }, [closing, finishClose])\n\n // One ticker per live code; it clears itself at the deadline, so a panel left\n // open on an expired code stops re-rendering instead of ticking forever.\n useEffect(() => {\n if (presence !== 'open' || state.kind !== 'ready') return\n const deadline = state.expiresAt\n const timer = window.setInterval(() => {\n const current = Date.now()\n setNow(current)\n if (current >= deadline) window.clearInterval(timer)\n }, TICK_MS)\n return () => { window.clearInterval(timer) }\n }, [presence, state])\n\n const handleCopy = useCallback((payload: string): void => {\n void copy(payload).then((ok) => {\n setCopyState(ok ? 'copied' : 'failed')\n window.setTimeout(() => { setCopyState('idle') }, COPY_FEEDBACK_MS)\n })\n }, [copy])\n\n return (\n <>\n <button\n type=\"button\"\n className={css.trigger}\n data-dsh-plugin={PLUGIN_ATTR}\n data-dsh-part={PART_ENTRY}\n data-wide={wide ? 'wide' : 'rail'}\n aria-label={t('entry.label')}\n aria-expanded={showing}\n aria-controls={showing ? panelId : undefined}\n title={t('entry.label')}\n onClick={openPanel}\n >\n <QrIcon />\n </button>\n {showing && (\n <PairPanel\n id={panelId}\n t={t}\n state={state}\n now={now}\n host={window.location.host}\n copy={copyState}\n showing={showing}\n closing={closing}\n onClose={requestClose}\n onExited={finishClose}\n onRefresh={mint}\n onCopy={handleCopy}\n />\n )}\n </>\n )\n}\n","/**\n * The frozen protocol surface: method names, topic names, refusal codes, and\n * the one authorization rule the dispatcher enforces before any method runs.\n * @module dsh-remote-bridge/core/protocol\n */\n\n/** Client-callable methods of protocol v1. */\nexport const METHOD_HELLO = 'hello'\nexport const METHOD_SESSION_LIST = 'session.list'\nexport const METHOD_SESSION_TITLES = 'session.titles'\nexport const METHOD_SESSION_SNAPSHOT = 'session.snapshot'\nexport const METHOD_SESSION_HISTORY = 'session.history'\nexport const METHOD_SESSION_HISTORY_DEEP = 'session.history.deep'\nexport const METHOD_SESSION_PROMPT = 'session.prompt'\nexport const METHOD_SESSION_INTERRUPT = 'session.interrupt'\nexport const METHOD_SESSION_ATTACHMENT = 'session.attachment'\nexport const METHOD_SESSION_PERMISSIONS = 'session.permissions'\nexport const METHOD_SESSION_SET_PERMISSION = 'session.setPermission'\nexport const METHOD_SESSION_MODELS = 'session.models'\nexport const METHOD_SESSION_SET_MODEL = 'session.setModel'\nexport const METHOD_SESSION_CREATE = 'session.create'\nexport const METHOD_SESSION_FORK = 'session.fork'\nexport const METHOD_SESSION_COMMANDS = 'session.commands'\nexport const METHOD_SESSION_COMMAND = 'session.command'\nexport const METHOD_SESSION_RENAME = 'session.rename'\nexport const METHOD_SESSION_PIN = 'session.pin'\nexport const METHOD_SESSION_UNPIN = 'session.unpin'\nexport const METHOD_SESSION_ARCHIVE = 'session.archive'\nexport const METHOD_SESSION_UNARCHIVE = 'session.unarchive'\nexport const METHOD_WORKSPACE_LIST = 'workspace.list'\nexport const METHOD_PRESETS_LIST = 'presets.list'\nexport const METHOD_PAIR_BEGIN = 'pair.begin'\nexport const METHOD_PAIR_FINISH = 'pair.finish'\nexport const METHOD_APPROVAL_RESOLVE = 'approval.resolve'\nexport const METHOD_QUESTION_ANSWER = 'question.answer'\nexport const METHOD_QUESTION_LIST = 'question.list'\nexport const METHOD_JOBS_LIST = 'jobs.list'\nexport const METHOD_SQUADS_STATE = 'squads.state'\nexport const METHOD_SQUADS_LIST = 'squads.list'\nexport const METHOD_SQUADS_RUNS = 'squads.runs'\nexport const METHOD_SQUADS_RUN_MEMBER = 'squads.runMember'\nexport const METHOD_SQUADS_RUN_SQUAD = 'squads.runSquad'\nexport const METHOD_PUSH_REGISTER = 'push.register'\nexport const METHOD_USAGE_SESSION = 'usage.session'\nexport const METHOD_USAGE_BALANCE = 'usage.balance'\nexport const METHOD_USAGE_STATS = 'usage.stats'\n\n/** Server-pushed topics of protocol v1. */\nexport const TOPIC_SESSION_DELTA = 'session.delta'\nexport const TOPIC_APPROVAL_REQUEST = 'approval.request'\nexport const TOPIC_QUESTION_REQUEST = 'question.request'\nexport const TOPIC_JOBS_CHANGED = 'jobs.changed'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to ask for a trimmed\n * `session.snapshot` baseline. A client that does not declare it — including\n * every client written before this capability existed — is served exactly the\n * baseline protocol v1 always served.\n */\nexport const CAP_SESSION_SNAPSHOT_TRIM = 'session.snapshot.trim.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to have\n * `session.snapshot` answer with one bounded page instead of the whole opening\n * window. Declaring it is what makes an opening screen cost one page rather\n * than a whole session; a client that does not declare it — including every\n * client written before this capability existed — receives byte for byte the\n * snapshot protocol v1 always served.\n */\nexport const CAP_SESSION_SNAPSHOT_PAGE = 'session.snapshot.page.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to have\n * `session.snapshot` answer a reconnect with only what it missed.\n *\n * The declaration and the request's `sinceSeq` are what it takes together: a\n * snapshot that carries no `sinceSeq` is answered, byte for byte, the body\n * protocol v1 always served, whether or not the client declared this. Behind\n * both, the client names the durable `lastSeq` of a snapshot it already holds\n * and the answer is either that same reply in an incremental form —\n * `{turns, lastSeq, mode:\"since\", reset:false}` carrying only the entries above\n * that watermark — or a full baseline with `mode:\"full\"` and `reset:true`,\n * which is the one answer that tells a client to throw its copy away. The\n * estimate is only served when the bridge can PROVE nothing was lost: the\n * current follow window's oldest entry must sit at or below `sinceSeq + 1`, so a\n * window that has already scrolled past the watermark answers the baseline\n * instead of a delta with a hole in it. It exists because a reconnect on the\n * phone re-paid 0.86-1.06 s of baseline five times in one measured run.\n */\nexport const CAP_SESSION_SNAPSHOT_SINCE = 'session.snapshot.since.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be shown the\n * host's pending user questions and to answer them with `question.answer`.\n *\n * Declaring it is what makes `question.request` reachable and what makes the\n * method part of that client's protocol at all: a client that does not declare\n * it — including every client written before this channel existed — receives no\n * such event, and its `question.answer` is refused as an unknown method,\n * exactly as that frame was refused before.\n */\nexport const CAP_QUESTIONS = 'questions.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to learn that this\n * bridge can list the user questions it is still holding.\n *\n * An announcement rather than a switch, the same shape as\n * {@link CAP_SESSION_DEEP_HISTORY}: `question.list` is reachable from every\n * client that declared {@link CAP_QUESTIONS}, exactly as `question.answer` is,\n * so a client written before this name existed loses nothing by declaring it\n * and nothing by never calling the method. What the name buys is a way to tell\n * a bridge that serves the method from one that does not: a host built before\n * it answers `unknown-method`, so a client that does not find this name in\n * `hello`'s `capabilities` keeps the retirement rule it had — a card is over\n * when `question.request` says `settled` — instead of reaping cards on an\n * answer it cannot trust.\n */\nexport const CAP_QUESTION_LIST = 'questions.list.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be handed the\n * approval questions this bridge is already holding for it.\n *\n * Unlike every channel capability beside it, this one gates a second delivery\n * rather than the channel: `approval.request` still reaches every paired\n * connection the moment a tool asks, exactly as it did before this name\n * existed, because gating the first broadcast would take approvals away from\n * every client written before the capability. What the declaration buys is the\n * replay — after a reconnect, or on a session screen opened late, the client is\n * handed the questions that are still waiting instead of a card it never saw.\n * Only a live claim is replayed: a question that was answered, that the bridge\n * timed out, or that was withdrawn with the last phone is gone from the claim\n * registry before the replay reads it.\n *\n * It is deliberately absent from {@link SERVED_CAPABILITIES}: that list is what\n * `hello` advertises as served, advertising a capability is a minor-version\n * addition (see {@link MINOR}), and this channel changes nothing a client can\n * observe in the handshake — no answer, no field and no method behind it. The\n * declaration is the whole switch, and the name reaches a client through this\n * bridge's own protocol documentation.\n */\nexport const CAP_APPROVALS = 'approvals.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be told where a\n * message came from and that an agent spawned a child session.\n *\n * Declaring it is what makes the `subagent` delta part of that client's\n * protocol: a client that does not declare it — including every client written\n * before this channel existed — receives no such event, exactly as that frame\n * was dropped before. The `actor` of a `user-message` is not gated: it is an\n * additive field a client that does not read it ignores.\n */\nexport const CAP_SUBAGENT_THREAD = 'subagent.thread.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to see the host's\n * background jobs and to be told when the set changes.\n *\n * Declaring it is what makes `jobs.list` reachable, and `jobs.list` is the only\n * thing that opens a roster: a connection that declares this capability but\n * never asks for a scope receives no `jobs.changed` at all. A client that does\n * not declare it — including every client written before this channel existed —\n * receives no such event, and its `jobs.list` is refused as an unknown method,\n * exactly as that frame was refused before.\n */\nexport const CAP_JOBS = 'jobs.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to read the host's\n * Agent presets and to instantiate one as a session.\n *\n * Declaring it is what makes `presets.list` and `session.create` part of that\n * client's protocol at all: a client that does not declare it — including every\n * client written before this channel existed — is refused both as unknown\n * methods, exactly as those frames were refused before. Neither method is\n * called on a connection's behalf either, so a client that never asks sends the\n * host no request.\n */\nexport const CAP_AGENTS = 'agents.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to read the host's\n * agent squads and to drive them.\n *\n * Declaring it is what makes `squads.state`, `squads.list`, `squads.runs`,\n * `squads.runMember` and `squads.runSquad` part of that client's protocol at\n * all: a client that does not declare it — including every client written before\n * this channel existed — is refused each as an unknown method, exactly as those\n * frames were refused before. No command is called on a connection's behalf\n * either, so a client that never asks sends the host no request.\n *\n * The channel is additive beside {@link CAP_AGENTS} rather than a replacement:\n * a phone that predates the squad model keeps the preset roster and session\n * creation it was written against, and a phone that reads this name reads the\n * squad domain instead of deriving agents from anything else.\n */\nexport const CAP_SQUADS = 'squads.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to register the APNs\n * token this device wants to be notified on.\n *\n * Declaring it is what makes `push.register` part of that client's protocol at\n * all: a client that does not declare it — including every client written before\n * this channel existed — is refused that frame as an unknown method, and no\n * device row is written on its behalf.\n *\n * The name announces that this bridge can REMEMBER a token, not that it will\n * send anything. Whether a notification ever leaves the process is a deployment\n * fact (is an APNs signing key configured?) that the wire deliberately cannot\n * express: a bridge with no key answers `ok:true` exactly like one with a key,\n * because a client has no second code path to keep for the difference. Every\n * notification this channel produces is an outbound APNs request and nothing\n * else — no topic, no frame and no state is added to `/ios/v1` (see the\n * protocol's §28).\n */\nexport const CAP_PUSH = 'push.v1'\n\n/**\n * 客户端在 `hello` 的 `cap` 数组里宣告它要读本桥自己的用量读数。\n *\n * 宣告它是 `usage.session` 与 `usage.balance` 进入这个客户端协议的唯一前提:\n * 不宣告的客户端——包括这个通道出现之前写下的每一个客户端——收到的是与从前\n * 逐字一样的 `unknown-method`,本桥也不会替它读一条会话、更不会替它打一次\n * 上游余额端点。\n *\n * 一个能力名带两个方法,因为它们读的是同一件事的两面:一条会话下一次请求由\n * 什么组成(上下文窗口取宿主自己广播的值,组成由本桥按文本长度估算并恒标\n * `estimated: true`),以及某条 provider 路由背后账户的余额(DeepSeek 官方\n * 口径,只在路由确实指向 `api.deepseek.com` 且凭据拿得到时才查官方端点,宿主\n * 侧同一 provider + 凭据 60 秒最多一次上游请求)。\n */\nexport const CAP_USAGE = 'usage.v1'\n\n/**\n * 客户端在 `hello` 的 `cap` 数组里宣告它要读宿主自己的用量台账聚合。\n *\n * 与 {@link CAP_USAGE} 平级、独立声明:宣告它是 `usage.stats` 进入这个客户端\n * 协议的唯一前提,不宣告的客户端——包括 `usage.v1` 出现之后、这个能力出现之前\n * 写下的每一个客户端——收到的仍是 `unknown-method`,本桥也不会替它去读宿主\n * 上 `dsh-usage` 插件的任何一条路由。\n *\n * 拆成独立能力而不是塞进 `usage.v1`,是因为它读的是另一件事:那两半读的是本\n * 进程自己的事实(一个会话、一条路由的账户),这一半读的是另一个插件挂在这个\n * 宿主上的 HTTP 路由,而那个插件可能根本没装。老客户端忽略这个未知名字即可,\n * 它看到的能力表里多一项、别的什么都没有变。\n */\nexport const CAP_USAGE_STATS = 'usage.stats.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be answered with\n * byte-level increments instead of the whole roster or the whole board.\n *\n * Behind it, `session.list` and `board.snapshot` (the latter through the board\n * plugin, §15) accept an opaque `since` token and answer either the whole set\n * (`mode:\"reset\"`) or only what changed since the set that token names. A\n * client that does not declare it — including every client written before this\n * channel existed — is answered today's body plus the ignorable `mode` and\n * `token` keys, with `mode` always `\"reset\"`.\n */\nexport const CAP_DELTA = 'delta.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be told that an\n * archived session is not in the roster at all.\n *\n * Unlike every capability beside it this one negotiates nothing: the bridge\n * never transfers an archived session, whether or not a client declares it, so\n * an older client simply receives the shorter roster it would have hidden\n * anyway. The name is an announcement of that fact, so a client can stop\n * filtering for itself: behind it, no `session.list` row is a session the\n * host's archive set names, a row that does survive still carries\n * `archived: false` under the same schema, and a live child of an archived\n * parent still crosses with its `parentSessionId` — the parent id, not the\n * parent row.\n */\nexport const CAP_ROSTER_OMITS_ARCHIVED = 'session.list.omit-archived.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be answered a\n * compact roster it can page.\n *\n * The declaration alone changes nothing: a listing that carries none of the\n * compact parameters (`cwd`, `maxRows`, `after`) is answered exactly the body\n * protocol v1 always served, so a client can opt into the name before it\n * relies on any of it. Behind the parameters, a row drops its absolute `cwd`\n * unless the request asks for it, drops its `updatedAt` when this connection\n * already sent that id the same value, and a `maxRows`/`after` pair cuts the\n * roster into pages ordered most recent first. The roster is the most repeated\n * large reply on the link, so this is what lets a reconnect pay for the newest\n * screenful plus a cursor instead of the whole list again.\n */\nexport const CAP_ROSTER_COMPACT = 'session.list.compact.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be told that this\n * bridge can page a session's durable history down to its oldest entry.\n *\n * The capability is an announcement and nothing more. `session.history.deep` is\n * open to every paired connection, exactly as `session.history` is, because it\n * is a pure read of the session store that costs no other client anything;\n * declaring the capability is how a client learns the method exists, and a\n * client that does not declare it loses only that knowledge.\n */\nexport const CAP_SESSION_DEEP_HISTORY = 'session.deep-history.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to fork a session.\n *\n * Declaring it is what makes `session.fork` part of that client's protocol at\n * all: a client that does not declare it — including every client written\n * before this channel existed — is refused `unknown-method`, and no fork is\n * asked of the host on its behalf. Behind the name the bridge forwards one\n * `SessionForkRequest` to the host's `session/fork` and hands back the host's\n * own `SessionForkValue`, so what a fork point means stays the host's: an\n * `atSeq` is the source event seq the fork includes, an omitted one is the\n * newest finished turn, and a cut the host opens itself is closed by the host's\n * own synthetic finishing event. Nothing about a fork is modelled or\n * re-derived here.\n */\nexport const CAP_SESSION_FORK = 'session.fork.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to list a session's\n * slash commands and skills and to run one of them.\n *\n * Declaring it is what makes `session.commands` and `session.command` part of\n * that client's protocol at all: a client that does not declare it — including\n * every client written before this channel existed — is refused both as unknown\n * methods, exactly as those frames were refused before. Neither method is called\n * on a connection's behalf either, so a client that never asks costs the host no\n * registry read and no skill catalog read.\n *\n * The channel holds no events and no cache: a directory is read live on every\n * call, so a command a plugin registered a moment ago and a skill withdrawn from\n * one Agent preset are both reflected in the answer that follows.\n */\nexport const CAP_COMMANDS = 'commands.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to read the host's\n * workspaces and its two registry-global session sets.\n *\n * Declaring it is what makes `workspace.list` part of that client's protocol at\n * all: a client that does not declare it — including every client written before\n * this channel existed — is refused that frame as an unknown method, and no\n * registry is read on its behalf. Behind the name the answer is the host's own\n * synchronous projection: one row per registered workspace in registry order,\n * plus the complete archive and pin sets.\n *\n * The method is a read and nothing is cached, so a pin or an archive followed by\n * another list reads the set the write left behind. That pair of calls is the\n * whole refresh story of the session-admin channel: see {@link CAP_SESSION_ADMIN}.\n */\nexport const CAP_WORKSPACE = 'workspace.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to rename, pin,\n * unpin, archive and unarchive a session.\n *\n * Declaring it is what makes those five methods part of that client's protocol\n * at all: a client that does not declare it — including every client written\n * before this channel existed — is refused each as an unknown method, and no\n * write is asked of the host on its behalf.\n *\n * Every one of the five is forwarded one-to-one to the endpoint that already\n * owns the semantics, so nothing about a title, a pin or an archive is modelled\n * or re-derived here: a rename reaches `session/rename` — the endpoint that\n * restores a cold session before it writes, which is why a client needs no\n * resume path of its own — and the four set mutations reach\n * `workspace/pinSession`, `workspace/unpinSession`, `workspace/archiveSession`\n * and `workspace/unarchiveSession`. A host refusal crosses with its own code\n * and text, `workspace/session-active` included.\n *\n * The channel publishes no event, because the host announces none of these\n * writes as a cordis event a connection could fold into a delta: a rename\n * appends one `session/title` log record and nothing else. A client re-reads\n * after a write instead — the pin set through {@link CAP_WORKSPACE}, the roster\n * through `session.list` — which is why one branch serves both capabilities.\n */\nexport const CAP_SESSION_ADMIN = 'session.admin.v1'\n\n/**\n * Capability a client declares in `hello`'s `cap` array to be sent frames\n * compressed instead of as plain text.\n *\n * Declaring it is what allows the host to compress at all: a frame whose JSON\n * text is at least 1024 UTF-8 bytes crosses as one WebSocket binary frame\n * carrying raw DEFLATE (RFC 1951) of exactly that text, and a frame that does\n * not get smaller still crosses as the text frame it always was. A client that\n * does not declare it — including every client written before this capability\n * existed — receives byte for byte the text frames protocol v1 always wrote.\n *\n * The direction is one way: a client still sends text frames only, and the\n * 10 MiB frame cap stays measured on the text, before inflation.\n */\nexport const CAP_FRAME_DEFLATE = 'frame.deflate.v1'\n\n/**\n * Methods an unpaired connection may still call: the handshake itself and the\n * two pairing steps. Everything else answers `unpaired` — a caller can pair\n * without a device token, but cannot touch a session without one.\n */\nexport const UNPAIRED_METHODS: ReadonlySet<string> = new Set([\n METHOD_HELLO,\n METHOD_PAIR_BEGIN,\n METHOD_PAIR_FINISH,\n])\n\n/** Every method this protocol version serves. */\nexport const KNOWN_METHODS: ReadonlySet<string> = new Set([\n METHOD_HELLO,\n METHOD_SESSION_LIST,\n METHOD_SESSION_TITLES,\n METHOD_SESSION_SNAPSHOT,\n METHOD_SESSION_HISTORY,\n METHOD_SESSION_HISTORY_DEEP,\n METHOD_SESSION_PROMPT,\n METHOD_SESSION_INTERRUPT,\n METHOD_SESSION_ATTACHMENT,\n METHOD_SESSION_PERMISSIONS,\n METHOD_SESSION_SET_PERMISSION,\n METHOD_SESSION_MODELS,\n METHOD_SESSION_SET_MODEL,\n METHOD_PAIR_BEGIN,\n METHOD_PAIR_FINISH,\n METHOD_APPROVAL_RESOLVE,\n METHOD_QUESTION_ANSWER,\n METHOD_QUESTION_LIST,\n METHOD_JOBS_LIST,\n METHOD_PRESETS_LIST,\n METHOD_SESSION_CREATE,\n METHOD_SESSION_FORK,\n METHOD_SESSION_COMMANDS,\n METHOD_SESSION_COMMAND,\n METHOD_SESSION_RENAME,\n METHOD_SESSION_PIN,\n METHOD_SESSION_UNPIN,\n METHOD_SESSION_ARCHIVE,\n METHOD_SESSION_UNARCHIVE,\n METHOD_WORKSPACE_LIST,\n METHOD_SQUADS_STATE,\n METHOD_SQUADS_LIST,\n METHOD_SQUADS_RUNS,\n METHOD_SQUADS_RUN_MEMBER,\n METHOD_SQUADS_RUN_SQUAD,\n METHOD_PUSH_REGISTER,\n METHOD_USAGE_SESSION,\n METHOD_USAGE_BALANCE,\n METHOD_USAGE_STATS,\n])\n\n/** Refusal codes the bridge itself raises (DSH failures cross as their own code). */\nexport const CODE_UNPAIRED = 'unpaired'\nexport const CODE_UNKNOWN_METHOD = 'unknown-method'\nexport const CODE_INVALID_ARGS = 'invalid-args'\n/**\n * `usage.session` 点名的会话在这个宿主上不存在:宿主自己的会话名册里没有它,\n * 活会话存储里没有它,本进程也从未观察过它的任何事件。它与「会话存在但两项\n * 读数都取不到」是两个答案,后者回的是空对象——一条刚刚开始、还什么都没广播\n * 的会话,以及一条在桥重载前就存在的会话,都在那个状态里:存在而没读数,不是\n * 不存在。\n */\nexport const CODE_UNKNOWN_SESSION = 'unknown-session'\nexport const CODE_PROTO_UNSUPPORTED = 'proto-unsupported'\nexport const CODE_TOKEN_INVALID = 'token-invalid'\nexport const CODE_NONCE_INVALID = 'nonce-invalid'\nexport const CODE_SIGNATURE_INVALID = 'signature-invalid'\nexport const CODE_APPROVAL_UNKNOWN = 'approval-unknown'\n/**\n * The bridge does not hold the named question: it never claimed that call id, it\n * already answered it, or the host no longer holds it as answerable. Host\n * failures crossing this method keep their own codes instead.\n */\nexport const CODE_QUESTION_UNKNOWN = 'question-unknown'\n/**\n * The bridge could not read the questions it is holding, so it cannot say which\n * ones are still live. The answer is deliberately not an empty list: a client\n * retires every card a COMPLETE list does not carry, and a read that failed is\n * not a complete one — it is a bridge that cannot answer this question today.\n */\nexport const CODE_QUESTION_LIST_UNAVAILABLE = 'question-list-unavailable'\n/**\n * The named session is a delegated child whose durable parent is not a session\n * this connection may read. The bridge follows an addressable child and refuses\n * an unaddressable one, rather than reading it blind.\n */\nexport const CODE_SESSION_NOT_FOLLOWABLE = 'session-not-followable'\nexport const CODE_SNAPSHOT_UNAVAILABLE = 'snapshot-unavailable'\n/**\n * This host composes no job registry, so it has no background jobs to publish.\n * The capability stays advertised — it is a fact about this bridge, not about\n * what a particular host mounts — and only a call that needs the registry fails.\n */\nexport const CODE_JOBS_UNAVAILABLE = 'jobs-unavailable'\n/**\n * This host serves no endpoint behind the command channel: no `commands/list`,\n * no `commands/execute` or no `skills/list`, which the gateway itself reports\n * as an endpoint nothing exports. The capability stays advertised — it is a fact\n * about this bridge, not about what a particular host mounts — and only a call\n * that needs those endpoints fails.\n */\nexport const CODE_COMMANDS_UNAVAILABLE = 'commands-unavailable'\n/**\n * This host serves no squad domain this bridge can reach: no answer to the\n * plugin's state route over loopback, no readable ledger beside it, or a body\n * this build cannot read as one squad domain. The capability stays advertised —\n * it is a fact about this bridge, not about what a particular host mounts — and\n * only a call that needs the domain fails. A refusal the `dsh-agents` plugin\n * itself raised crosses with the plugin's own code instead (`team-not-found`,\n * `member-not-found`, `preset-unknown`, `workspace-required` and their\n * neighbours).\n */\nexport const CODE_SQUADS_UNAVAILABLE = 'squads-unavailable'\n/**\n * The definitions are readable but the two run commands cannot be served: this\n * host answered no run route over loopback, and the read-only ledger fallback\n * cannot launch anything. Failing closed is the point — a client is told the\n * capability is not served here rather than shown a run that never started.\n */\nexport const CODE_SQUADS_RUN_UNAVAILABLE = 'squads-run-unavailable'\nexport const CODE_SNAPSHOT_TOO_LARGE = 'snapshot-too-large'\nexport const CODE_INTERNAL = 'internal'\n\n/** Protocol version this package speaks. */\nexport const PROTO = 1\n/**\n * Minor version this package speaks.\n *\n * 20 when the usage stats channel shipped: behind {@link CAP_USAGE_STATS} a\n * client may call {@link METHOD_USAGE_STATS} and read the host's own usage\n * ledger — today, this month and one row per local day — and behind the same\n * {@link CAP_USAGE} this bridge now also answers `usage.session` with a\n * `modelContextWindow` when the model catalog of the session's route declares\n * one, so a client reads one new reply body and one new optional key off the\n * wire and has to read the name before it asks. The stats half is independent\n * of {@link CAP_USAGE} on purpose: it reads another plugin's HTTP routes, which\n * a host may not mount at all, so a client written before this name existed\n * keeps the two readings it had and the bridge reads no route on its behalf.\n * No frame, no topic, no existing method and no existing key changes shape.\n * 19 when the usage channel shipped: behind {@link CAP_USAGE} a client may call\n * {@link METHOD_USAGE_SESSION} and read one session's context window and its\n * request's estimated composition, and {@link METHOD_USAGE_BALANCE} and read the\n * account behind one provider route, so it reads two new reply bodies off the\n * wire and has to read the name before it asks — a bridge below this one answers\n * `unknown-method` for both. No frame, no topic and no existing method changes\n * shape.\n * 18 when one card learned to lay out several sessions (§30 of\n * `docs/protocol-v1.md` in the iphone_remote_use_dsh repository): `content-state`\n * gains the optional `rows` key, so a phone reads up to three sessions off one\n * lock-screen card instead of having to hold one card per session. It is a pure\n * addition — no new method, no new capability name, no existing key or topic\n * changes shape — so the minor counts the key alone, and a client that reads 18\n * knows the order of the rows it is handed is the bridge's rather than one it\n * has to derive.\n * 17 when the live-activity channel shipped (§29.2): this bridge now sends the\n * lock-screen card a suspended app cannot update itself, addressed to the\n * per-card APNs tokens {@link METHOD_PUSH_REGISTER} already carries and projected\n * per session rather than per bridge. It is a pure addition — no new method, no\n * new capability name, and no existing frame, field or topic changes shape — so\n * the minor counts it alone: a client that wants a card has to read 17 before it\n * registers one, because a bridge below this one has no sending path at all and\n * would answer `ok:true` to a registration it can never use.\n * 16 when the push channel shipped: behind {@link CAP_PUSH} a client may call\n * {@link METHOD_PUSH_REGISTER} and have the device table remember an APNs token,\n * so a phone learns a turn ended — or that a question is waiting — while its\n * socket is not open. No frame, no topic and no existing method changes shape;\n * the minor is raised because a new reply body and a new announcement appear on\n * the wire, and because a client has to read the name before it registers.\n * 15 when the squads channel shipped: behind {@link CAP_SQUADS} a client may\n * call {@link METHOD_SQUADS_STATE}, {@link METHOD_SQUADS_LIST},\n * {@link METHOD_SQUADS_RUNS}, {@link METHOD_SQUADS_RUN_MEMBER} and\n * {@link METHOD_SQUADS_RUN_SQUAD}, so it reads five new reply bodies off the wire\n * and drives the squad domain instead of deriving its agents from anything else.\n * 14 when the session-admin channel shipped: behind {@link CAP_WORKSPACE} a\n * client may call {@link METHOD_WORKSPACE_LIST} and read the host's workspaces\n * with both registry-global session sets, and behind {@link CAP_SESSION_ADMIN}\n * it may call {@link METHOD_SESSION_RENAME}, {@link METHOD_SESSION_PIN},\n * {@link METHOD_SESSION_UNPIN}, {@link METHOD_SESSION_ARCHIVE} and\n * {@link METHOD_SESSION_UNARCHIVE}, so a phone long-presses a roster row for the\n * same five actions the desktop offers it.\n * 13 when the question list shipped: behind {@link CAP_QUESTION_LIST} a client\n * may call {@link METHOD_QUESTION_LIST} and be answered the questions this\n * bridge is still holding, so it reads a new reply body off the wire and the\n * number rises with it. It is what lets a phone stop trusting a card it holds:\n * the one retirement signal before it was `question.request` with\n * `state: \"settled\"`, which a phone that was disconnected when the last client\n * left never receives.\n * 12 when the command channel shipped: behind {@link CAP_COMMANDS} a client may\n * call {@link METHOD_SESSION_COMMANDS} and {@link METHOD_SESSION_COMMAND}, so it\n * reads a new reply body off the wire and the number rises with it.\n * 11 when the fork channel shipped: behind {@link CAP_SESSION_FORK} a client may\n * call {@link METHOD_SESSION_FORK} and receive the host's own fork answer, so a\n * phone branches a session that inherits the context of the one it forked. This\n * is the second of two appends cut from 9 — the snapshot-`since` channel took\n * 10 on the integration branch first — so the number steps over the one already\n * on `dev`: the minor counts additions to this protocol, and a later landing\n * steps over the earlier one instead of reusing its number.\n * 10 when the snapshot became incremental on request: behind\n * {@link CAP_SESSION_SNAPSHOT_SINCE} a `session.snapshot` that names `sinceSeq`\n * is answered either the entries above that watermark or a full baseline\n * carrying `mode` and `reset`, so a client reads a new reply shape off the\n * wire and the number rises with it.\n * 9 when the compact roster shipped: behind {@link CAP_ROSTER_COMPACT} a\n * `session.list` that names one of the compact parameters is answered a\n * shorter row and may be cut into pages, so a client reads a new row schema\n * off the wire and the number rises with it.\n * 8 when the outbound frame form became a capability: behind\n * {@link CAP_FRAME_DEFLATE} a declaring client may be answered in binary\n * frames carrying raw DEFLATE of the text, so the minor is raised for a change\n * a client reads off the wire rather than for a name alone.\n * 7 when the two channels met: the agent channel and the durable history\n * channel each raised 5 to 6 on its own branch, so the protocol that carries\n * both is 7. 6 when the agent channel shipped: behind {@link CAP_AGENTS}\n * `presets.list` forwards the host's Agent-preset roster and `session.create`\n * hands the host one creation request, both verbatim. 6 was also the durable\n * history channel on its own: behind {@link CAP_SESSION_DEEP_HISTORY} a client\n * may call {@link METHOD_SESSION_HISTORY_DEEP} and walk a session's store back\n * to its oldest entry, below the follow window `session.history` slices. 5 when\n * the roster stopped carrying archived sessions: behind\n * {@link CAP_ROSTER_OMITS_ARCHIVED} `session.list` names no session the host's\n * archive set holds, so a session archived between two listings arrives as a\n * removal and one restored as a change. 4 when byte-level increments shipped:\n * behind {@link CAP_DELTA} `session.list` and `board.snapshot` answer a reset\n * or a delta against a `since` token. 3 was\n * the background-job channel — behind {@link CAP_JOBS} a client may call\n * `jobs.list` and receive `jobs.changed`. 2 was the subagent thread —\n * a `user-message` delta may carry an `actor` and a `subagent` delta exists\n * behind {@link CAP_SUBAGENT_THREAD}. 1 was the extension seam — a mounted\n * plugin may answer methods outside {@link KNOWN_METHODS} once the client\n * declares the capability that plugin requires. No addition changed the major\n * version, a frozen field, or an existing method or topic name.\n */\nexport const MINOR = 20\n\n/**\n * The capabilities this bridge itself serves, as `hello` advertises them.\n *\n * A capability a mounted plugin adds is not listed here: the bridge cannot know\n * what it is not the author of. A client learns such a capability from the\n * plugin's own documentation, exactly as it did before this list existed.\n */\nexport const SERVED_CAPABILITIES: readonly string[] = [\n CAP_SESSION_SNAPSHOT_TRIM,\n CAP_SESSION_SNAPSHOT_PAGE,\n CAP_QUESTIONS,\n CAP_QUESTION_LIST,\n CAP_SUBAGENT_THREAD,\n CAP_JOBS,\n CAP_AGENTS,\n CAP_DELTA,\n CAP_ROSTER_OMITS_ARCHIVED,\n CAP_SESSION_DEEP_HISTORY,\n CAP_FRAME_DEFLATE,\n CAP_ROSTER_COMPACT,\n CAP_SESSION_SNAPSHOT_SINCE,\n CAP_SESSION_FORK,\n CAP_COMMANDS,\n CAP_WORKSPACE,\n CAP_SESSION_ADMIN,\n CAP_SQUADS,\n CAP_PUSH,\n CAP_USAGE,\n CAP_USAGE_STATS,\n]\n/** `server` field of the hello response. */\nexport const SERVER_ID = 'dsh-remote-bridge'\n\n/** Exact route path of the bridge's WebSocket endpoint. */\nexport const WS_PATH = '/ios/v1'\n/** Exact route path of the loopback-only bootstrap token endpoint. */\nexport const PAIR_TOKEN_PATH = '/remote-bridge/pair/token'\n","/**\n * The panel's one wire call: read the one-shot bootstrap token from this\n * package's own Host route.\n *\n * The route is same-origin and document-relative (the GUI is served with\n * `<base href=\"./\">`, so a sub-path deployment resolves it against its entry\n * directory instead of escaping to the origin root — the same rule\n * `dsh-remote-web-ui`'s pair API follows). It is NOT consumed here: the panel\n * only displays the secret, and the phone spends it in `pair.begin`, so a\n * mis-click on \"new code\" voids a token without ever pairing a device.\n *\n * `403` is a fact, not an error: the loopback gate in `core/loopback.ts`\n * refuses any page whose socket or `Host` is not this machine, which is exactly\n * the case the panel must name out loud.\n * @module dsh-remote-bridge/client/pair-token\n */\n\nimport { PAIR_TOKEN_PATH } from '../core/protocol.ts'\n\n/** Document-relative form of the Host route, for a page served under any base. */\nexport const PAIR_TOKEN_URL = PAIR_TOKEN_PATH.replace(/^\\/+/, '')\n\n/** The outcome of one token read. */\nexport type PairTokenOutcome =\n /**\n * A live one-shot token and the instant it stops being accepted, plus the\n * address half when this machine can name its own public origin. `pairingUrl`\n * is the code a QR should carry: a `{token, url}` document the phone parses\n * into both halves of its configuration.\n */\n | { kind: 'ok'; token: string; expiresAt: number; origin: string | null; pairingUrl: string | null }\n /** 403: the page is not open on the machine itself, so the loopback gate refused it. */\n | { kind: 'forbidden' }\n /** The route answered with a status the panel does not know, or with a body that is not a token. */\n | { kind: 'failed'; status: number }\n /** The request never reached the host (offline, host stopped, connection reset). */\n | { kind: 'unreachable' }\n\n/** The minimal response surface the reader uses, so a test can inject its own. */\nexport interface PairTokenResponse {\n readonly ok: boolean\n readonly status: number\n json(): Promise<unknown>\n}\n\n/** The minimal fetch surface the reader uses, so a test can inject its own. */\nexport type PairTokenFetch = (url: string, init: { signal?: AbortSignal; cache: string }) => Promise<PairTokenResponse>\n\nexport interface ReadPairTokenOptions {\n /** Injected transport; defaults to the global fetch. */\n readonly fetchImpl?: PairTokenFetch\n /** Aborts an in-flight read (the panel closed, the entry unmounted). */\n readonly signal?: AbortSignal\n}\n\n/** Read a string field, treating a missing, mistyped or empty value as absent. */\nfunction stringOrNull(value: unknown): string | null {\n return typeof value === 'string' && value !== '' ? value : null\n}\n\n/**\n * Read one bootstrap token.\n *\n * Never throws: every failure is one of the outcome arms, because the panel has\n * to render each of them. A `200` whose body is not `{token, expiresAt}` is\n * reported as a failure rather than shown as an empty QR.\n * @param options - injected transport and abort signal.\n * @returns the read outcome.\n */\nexport async function readPairToken(options: ReadPairTokenOptions = {}): Promise<PairTokenOutcome> {\n const send = options.fetchImpl ?? (globalThis.fetch as unknown as PairTokenFetch | undefined)\n if (send === undefined) return { kind: 'unreachable' }\n let response: PairTokenResponse\n try {\n response = await send(PAIR_TOKEN_URL, {\n cache: 'no-store',\n ...(options.signal === undefined ? {} : { signal: options.signal }),\n })\n } catch {\n // A network failure and an aborted read are indistinguishable here, and\n // both mean \"no token arrived\" — the panel says so instead of guessing.\n return { kind: 'unreachable' }\n }\n if (response.status === 403) return { kind: 'forbidden' }\n if (!response.ok) return { kind: 'failed', status: response.status }\n let body: unknown\n try {\n body = await response.json()\n } catch {\n return { kind: 'failed', status: response.status }\n }\n if (typeof body !== 'object' || body === null) return { kind: 'failed', status: response.status }\n const token = (body as { token?: unknown }).token\n const expiresAt = (body as { expiresAt?: unknown }).expiresAt\n if (typeof token !== 'string' || token === '') return { kind: 'failed', status: response.status }\n if (typeof expiresAt !== 'number' || !Number.isFinite(expiresAt)) return { kind: 'failed', status: response.status }\n // Additive fields: a host that predates origin discovery answers without\n // them, and the panel then falls back to the bare-token code instead of\n // refusing to show anything.\n const origin = stringOrNull((body as { origin?: unknown }).origin)\n const candidate = stringOrNull((body as { pairingUrl?: unknown }).pairingUrl)\n const pairingUrl = candidate !== null && /^wss?:\\/\\/\\S+$/.test(candidate) ? candidate : null\n return { kind: 'ok', token, expiresAt, origin, pairingUrl }\n}\n","/**\n * `remote-bridge` namespace dictionaries: the protocol v1 pairing panel copy.\n *\n * The panel has one job — put the live one-shot code in front of the operator as\n * a QR symbol — so the copy carries exactly four things: what to do with the\n * symbol, how long it lives, which address the phone will actually dial, and why\n * the code is single-use. No key states how the host finds its public address:\n * that is an implementation fact the reader cannot act on.\n */\n\n/** Simplified Chinese dictionary (the key-set source of truth). */\nexport const zh = {\n 'entry.label': '配对手机(协议 v1)',\n 'title': '协议 v1 配对',\n 'subtitle': '用手机 App 扫描二维码,即可让手机以协议 v1 连上这台宿主。配对码由本机签发,只在本机显示。',\n 'state.reading': '正在取配对码…',\n 'pair.qrLabel': '配对二维码',\n 'pair.countdown': '剩余 {s} 秒',\n 'pair.expired': '配对码已过期',\n 'pair.refresh': '重新取码',\n 'pair.usedHint': '配对码一次性有效:手机一开始配对即作废,重新取码也会作废上一张。',\n 'origin.located': '手机将连到 {origin}',\n 'origin.missing': '没有找到公网地址:请先在手机里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。',\n 'forbidden.title': '这个页面不是从本机打开的',\n 'forbidden.body': '配对码只能在本机 Web UI 上取。请在本机浏览器打开 http://127.0.0.1:<端口> 后重试。',\n 'failed.title': '取配对码失败',\n 'failed.body': '宿主返回了 HTTP {status},请刷新页面后重试。',\n 'unreachable.title': '无法连接本机宿主',\n 'unreachable.body': '请求没有到达宿主,请确认 dsh web 仍在运行后重试。',\n 'action.close': '关闭',\n 'action.copy': '复制配对码',\n 'action.copied': '已复制',\n 'action.copyFailed': '复制失败',\n 'action.retry': '重试',\n} as const\n\n/** English dictionary, key-for-key with the zh source. */\nexport const en: Record<RemoteBridgeKey, string> = {\n 'entry.label': 'Pair a phone (protocol v1)',\n 'title': 'Protocol v1 pairing',\n 'subtitle': 'Scan the QR code with the phone app to let the phone reach this host over protocol v1. The code is minted by this machine and shown only here.',\n 'state.reading': 'Requesting a pairing code…',\n 'pair.qrLabel': 'Pairing QR code',\n 'pair.countdown': '{s} s left',\n 'pair.expired': 'The pairing code expired',\n 'pair.refresh': 'New code',\n 'pair.usedHint': 'The code is single-use: pairing spends it, and a new code voids the previous one.',\n 'origin.located': 'The phone will dial {origin}',\n 'origin.missing': 'No public address found: set the phone app to your public relay first, then scan. {host} (this page) is reachable only from this machine.',\n 'forbidden.title': 'This page is not open on this machine',\n 'forbidden.body': 'Pairing codes can only be read from the machine itself. Open http://127.0.0.1:<port> in a browser on this machine and retry.',\n 'failed.title': 'Could not read a pairing code',\n 'failed.body': 'The host answered HTTP {status}. Reload the page and retry.',\n 'unreachable.title': 'Cannot reach the local host',\n 'unreachable.body': 'The request never reached the host. Check that dsh web is still running and retry.',\n 'action.close': 'Close',\n 'action.copy': 'Copy pairing code',\n 'action.copied': 'Copied',\n 'action.copyFailed': 'Copy failed',\n 'action.retry': 'Retry',\n}\n\n/** Every key the `remote-bridge` namespace carries. */\nexport type RemoteBridgeKey = keyof typeof zh\n","/**\n * Protocol v1 pairing panel — browser half. Registers the `remote-bridge`\n * dictionary and the sidebar-foot trigger (into the ui-sidebar-declared\n * `sidebar.footer.action` list slot) that opens the panel showing this\n * package's own one-shot bootstrap token as a QR symbol plus its plaintext.\n *\n * The panel is display-only for the native path: it reads the same loopback-only\n * `GET /remote-bridge/pair/token` route an operator would curl, and never spends\n * the token (`pair.begin` stays the phone's call). The browser half therefore\n * adds no wire surface — the envelope, the method names, the topic names and\n * the events are untouched — and it does not touch `dsh-remote-web-ui`'s pairing\n * service, its roster, or its browser cookie path.\n *\n * Export discipline (packages/AGENTS.md): the /client surface carries only what\n * cordis loading needs plus types.\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its\n// LocaleNamespaceMap merge table.\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ctx.slots merge (the renderer owns the slot registry).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the ui-sidebar SlotMap merge (the 'sidebar.footer.action' hole).\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport { writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { PairEntry } from './PairEntry.tsx'\nimport { readPairToken } from './pair-token.ts'\nimport { en, zh, type RemoteBridgeKey } from './locales.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Protocol v1 pairing panel copy. */\n 'remote-bridge': RemoteBridgeKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'remote-bridge'\n\n/** Unique occupant id inside the shared footer.action list slot. */\nconst ENTRY_ID = 'remote-bridge'\n\n/** Services required by this plugin. */\nexport const inject = ['slots', 'locale']\n\n/**\n * Register the protocol v1 pairing surface.\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'remote-bridge: dictionaries')\n\n // Sidebar foot entry. The shell declares 'sidebar.footer.action' (list kind:\n // multiple occupants may share the seat) and registration is\n // declaration-aware via slots.inject. Read and clipboard arrive as an\n // injected face rather than a module import, which keeps the trigger's\n // rendered tree free of closure-factory bundles.\n ctx.slots.inject('sidebar.footer.action', () => {\n try {\n return ctx.slots.register({\n name: 'sidebar.footer.action',\n id: ENTRY_ID,\n locale: NS,\n inject: () => ({ read: readPairToken, copy: writeClipboard }),\n }, PairEntry)\n } catch {\n return () => {}\n }\n })\n}\n\nexport type { PairEntryProps } from './PairEntry.tsx'\nexport type { PairCopyState, PairPanelProps, PairPanelState } from './PairPanel.tsx'\nexport type { PairTokenFetch, PairTokenOutcome, PairTokenResponse, ReadPairTokenOptions } from './pair-token.ts'\nexport type { RemoteBridgeKey } from './locales.ts'\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,IAAI,YAAY,OAAO;EACvB,IAAI,sBAAsB,OAAO;EACjC,IAAI,eAAe,OAAO,UAAU;EACpC,IAAI,eAAe,OAAO,UAAU;EACpC,IAAI,mBAAmB,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK;GAAE,YAAY;GAAM,cAAc;GAAM,UAAU;GAAM;EAAM,CAAC,IAAI,IAAI,OAAO;EAC1J,IAAI,kBAAkB,GAAG,MAAM;GAC7B,KAAK,IAAI,QAAQ,MAAM,IAAI,CAAC,IAC1B,IAAI,aAAa,KAAK,GAAG,IAAI,GAC3B,gBAAgB,GAAG,MAAM,EAAE,KAAK;GACpC,IAAI;SACG,IAAI,QAAQ,oBAAoB,CAAC,GACpC,IAAI,aAAa,KAAK,GAAG,IAAI,GAC3B,gBAAgB,G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