@krizaka/ui 3.78.1 → 3.80.0

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 (240) hide show
  1. package/README.md +1 -0
  2. package/dist/app-frame.d.ts +4 -1
  3. package/dist/chunk-BCD2CRFG.js +349 -0
  4. package/dist/chunk-BCD2CRFG.js.map +1 -0
  5. package/dist/{chunk-PGPNYYE2.js → chunk-BHAWCN4I.js} +128 -110
  6. package/dist/chunk-BHAWCN4I.js.map +1 -0
  7. package/dist/{chunk-SG3QJJXE.js → chunk-ENFXJUDN.js} +3 -16
  8. package/dist/chunk-ENFXJUDN.js.map +1 -0
  9. package/dist/identity-card.d.ts +39 -0
  10. package/dist/identity-card.js +34 -0
  11. package/dist/identity-card.js.map +1 -0
  12. package/dist/index.d.ts +47 -15
  13. package/dist/index.js +87 -23
  14. package/dist/index.js.map +1 -1
  15. package/dist/native.d.ts +4 -1
  16. package/dist/nav-bar.d.ts +1 -1
  17. package/dist/nav-bar.js +63 -53
  18. package/dist/nav-bar.js.map +1 -1
  19. package/dist/qr-code.d.ts +25 -2
  20. package/dist/qr-code.js +29 -339
  21. package/dist/qr-code.js.map +1 -1
  22. package/dist/rail-nav.d.ts +4 -1
  23. package/dist/{schema-CL7t7xqb.d.ts → schema-DgjBz7-8.d.ts} +1 -1
  24. package/dist/shop.d.ts +2 -2
  25. package/dist/site-cahier.d.ts +32 -19
  26. package/dist/site-cahier.js +164 -138
  27. package/dist/site-cahier.js.map +1 -1
  28. package/dist/site-footer.d.ts +59 -39
  29. package/dist/site-footer.js +94 -68
  30. package/dist/site-footer.js.map +1 -1
  31. package/dist/{sites-CVNSirrg.d.ts → sites-BLqbwmng.d.ts} +14 -0
  32. package/dist/sites.d.ts +28 -2
  33. package/dist/sites.js +10 -0
  34. package/dist/sites.js.map +1 -1
  35. package/package.json +17 -3
  36. package/registry/account-menu.json +1 -1
  37. package/registry/account-settings.json +1 -1
  38. package/registry/achievement.json +1 -1
  39. package/registry/action-bar.json +1 -1
  40. package/registry/activity-feed.json +1 -1
  41. package/registry/agenda.json +1 -1
  42. package/registry/alert.json +1 -1
  43. package/registry/analysis-report.json +1 -1
  44. package/registry/anatomy-plate.json +1 -1
  45. package/registry/app-frame.json +8 -4
  46. package/registry/app-header.json +1 -1
  47. package/registry/app-shell.json +1 -1
  48. package/registry/argument-card.json +1 -1
  49. package/registry/auth-layout.json +1 -1
  50. package/registry/avatar.json +1 -1
  51. package/registry/badge.json +1 -1
  52. package/registry/bird-plate.json +1 -1
  53. package/registry/button.json +1 -1
  54. package/registry/captcha.json +1 -1
  55. package/registry/card-grid.json +1 -1
  56. package/registry/card.json +1 -1
  57. package/registry/catalogue-page.json +1 -1
  58. package/registry/changelog-page.json +1 -1
  59. package/registry/chapter.json +1 -1
  60. package/registry/chat.json +1 -1
  61. package/registry/checkbox.json +1 -1
  62. package/registry/chip-link.json +1 -1
  63. package/registry/chip-row.json +1 -1
  64. package/registry/chip.json +1 -1
  65. package/registry/choice-grid.json +1 -1
  66. package/registry/code-block.json +1 -1
  67. package/registry/collection-switcher.json +1 -1
  68. package/registry/combobox.json +1 -1
  69. package/registry/command.json +1 -1
  70. package/registry/comparison-table.json +1 -1
  71. package/registry/component-page.json +1 -1
  72. package/registry/confirm-button.json +1 -1
  73. package/registry/contact-page.json +1 -1
  74. package/registry/continue-prompt.json +1 -1
  75. package/registry/copy-button.json +1 -1
  76. package/registry/countdown.json +1 -1
  77. package/registry/cover-hero.json +1 -1
  78. package/registry/cta-panel.json +1 -1
  79. package/registry/dashboard-layout.json +1 -1
  80. package/registry/data-table.json +1 -1
  81. package/registry/date-picker.json +1 -1
  82. package/registry/decision-list.json +1 -1
  83. package/registry/description-list.json +1 -1
  84. package/registry/desktop-window.json +1 -1
  85. package/registry/detail-layout.json +1 -1
  86. package/registry/dialog.json +1 -1
  87. package/registry/docs-article-page.json +1 -1
  88. package/registry/docs-hub-page.json +1 -1
  89. package/registry/docs-layout.json +1 -1
  90. package/registry/docs-nav.json +1 -1
  91. package/registry/document-viewer.json +1 -1
  92. package/registry/doodle.json +1 -1
  93. package/registry/drop-overlay.json +1 -1
  94. package/registry/dropdown-menu.json +1 -1
  95. package/registry/elephant.json +1 -1
  96. package/registry/embed-facade.json +1 -1
  97. package/registry/empty-state.json +1 -1
  98. package/registry/engine-flow.json +1 -1
  99. package/registry/entity-header.json +1 -1
  100. package/registry/environment-notice.json +1 -1
  101. package/registry/error-page.json +1 -1
  102. package/registry/examples/identity-card/basic.d.ts +4 -0
  103. package/registry/examples/identity-card/basic.js +33 -0
  104. package/registry/examples/identity-card/basic.tsx +29 -0
  105. package/registry/examples/site-footer/company.js +1 -0
  106. package/registry/examples/site-footer/company.tsx +3 -2
  107. package/registry/examples/site-footer/docs.tsx +1 -1
  108. package/registry/examples/site-footer/open-source-fr.js +1 -1
  109. package/registry/examples/site-footer/open-source-fr.tsx +1 -1
  110. package/registry/examples/site-footer/product.js +9 -14
  111. package/registry/examples/site-footer/product.tsx +14 -12
  112. package/registry/field.json +1 -1
  113. package/registry/file-upload.json +1 -1
  114. package/registry/filter-bar.json +1 -1
  115. package/registry/flock.json +1 -1
  116. package/registry/footnote.json +1 -1
  117. package/registry/force-update-screen.json +1 -1
  118. package/registry/form.json +1 -1
  119. package/registry/gallery-page.json +1 -1
  120. package/registry/genui.json +1 -1
  121. package/registry/glossary-term.json +1 -1
  122. package/registry/glossary.json +1 -1
  123. package/registry/glow-card.json +1 -1
  124. package/registry/goal-gauge.json +1 -1
  125. package/registry/grade-stamp.json +1 -1
  126. package/registry/identity-card.json +218 -0
  127. package/registry/image-cropper.json +1 -1
  128. package/registry/index.json +40 -9
  129. package/registry/kanban.json +1 -1
  130. package/registry/kbd.json +1 -1
  131. package/registry/kind-config-editor.json +1 -1
  132. package/registry/kpi-explained.json +1 -1
  133. package/registry/landing-page.json +1 -1
  134. package/registry/landscape.json +1 -1
  135. package/registry/language-switch.json +1 -1
  136. package/registry/legal-page.json +1 -1
  137. package/registry/link-card.json +1 -1
  138. package/registry/list.json +1 -1
  139. package/registry/loader.json +1 -1
  140. package/registry/longform-page.json +1 -1
  141. package/registry/maintenance-screen.json +1 -1
  142. package/registry/map.json +2 -2
  143. package/registry/margin-layout.json +1 -1
  144. package/registry/markdown.json +1 -1
  145. package/registry/marketing-layout.json +1 -1
  146. package/registry/mascot-quote.json +1 -1
  147. package/registry/mascot-state.json +1 -1
  148. package/registry/mascots.json +1 -1
  149. package/registry/match-dialog.json +1 -1
  150. package/registry/media-capture.json +1 -1
  151. package/registry/media-gallery.json +1 -1
  152. package/registry/meter.json +1 -1
  153. package/registry/money-input.json +1 -1
  154. package/registry/nav-bar.json +8 -4
  155. package/registry/next-actions.json +1 -1
  156. package/registry/notification-preferences.json +1 -1
  157. package/registry/number-ticker.json +1 -1
  158. package/registry/opening-hours.json +1 -1
  159. package/registry/page-header.json +1 -1
  160. package/registry/page-hero.json +1 -1
  161. package/registry/page-index.json +1 -1
  162. package/registry/page.json +1 -1
  163. package/registry/pagination.json +1 -1
  164. package/registry/pointer-light.json +1 -1
  165. package/registry/popover.json +1 -1
  166. package/registry/price-catalogue-editor.json +1 -1
  167. package/registry/pricing-page.json +1 -1
  168. package/registry/product-page.json +1 -1
  169. package/registry/profile-card.json +1 -1
  170. package/registry/progress.json +1 -1
  171. package/registry/promise-card.json +1 -1
  172. package/registry/promo-code-field.json +1 -1
  173. package/registry/proposal.json +1 -1
  174. package/registry/qr-code.json +6 -2
  175. package/registry/quota-meter.json +1 -1
  176. package/registry/radio-group.json +1 -1
  177. package/registry/rail-nav.json +8 -4
  178. package/registry/recipes.json +1 -1
  179. package/registry/retro-tv.json +1 -1
  180. package/registry/reviews.json +1 -1
  181. package/registry/router.json +1 -1
  182. package/registry/schema-form.json +1 -1
  183. package/registry/scroll-stage.json +1 -1
  184. package/registry/search-field.json +1 -1
  185. package/registry/section-backdrop.json +1 -1
  186. package/registry/separator.json +1 -1
  187. package/registry/service-card.json +1 -1
  188. package/registry/settings-layout.json +1 -1
  189. package/registry/shop-composer.json +1 -1
  190. package/registry/shop-gallery.json +1 -1
  191. package/registry/shop.json +2 -2
  192. package/registry/showcase.json +1 -1
  193. package/registry/signature.json +1 -1
  194. package/registry/site-cahier.json +1 -1
  195. package/registry/site-footer.json +87 -60
  196. package/registry/sites.json +7 -3
  197. package/registry/skeleton.json +1 -1
  198. package/registry/skip-link.json +1 -1
  199. package/registry/slider.json +1 -1
  200. package/registry/slot-picker.json +1 -1
  201. package/registry/slot.json +1 -1
  202. package/registry/specimen-tag.json +1 -1
  203. package/registry/speed-lines.json +1 -1
  204. package/registry/spinner.json +1 -1
  205. package/registry/split-view.json +1 -1
  206. package/registry/stage-banner.json +1 -1
  207. package/registry/stat.json +1 -1
  208. package/registry/status-chip.json +1 -1
  209. package/registry/status-page.json +1 -1
  210. package/registry/step-progress.json +1 -1
  211. package/registry/step-showcase.json +1 -1
  212. package/registry/stepper.json +1 -1
  213. package/registry/sticky-action.json +1 -1
  214. package/registry/stuck.json +1 -1
  215. package/registry/swipe-deck.json +1 -1
  216. package/registry/switch.json +1 -1
  217. package/registry/tabs.json +1 -1
  218. package/registry/tag-input.json +1 -1
  219. package/registry/tag-selector.json +1 -1
  220. package/registry/taped-photo.json +1 -1
  221. package/registry/terminal-replay.json +1 -1
  222. package/registry/text-style.json +1 -1
  223. package/registry/theme.json +1 -1
  224. package/registry/toast.json +1 -1
  225. package/registry/toc.json +1 -1
  226. package/registry/tooltip.json +1 -1
  227. package/registry/tree-view.json +1 -1
  228. package/registry/update-prompt.json +1 -1
  229. package/registry/upload-queue.json +1 -1
  230. package/registry/usage.json +1 -1
  231. package/registry/verified-badge.json +1 -1
  232. package/registry/versus-card.json +1 -1
  233. package/registry/vertical-video.json +1 -1
  234. package/registry/video-player.json +1 -1
  235. package/registry/video-trimmer.json +1 -1
  236. package/registry/virtual.json +1 -1
  237. package/registry/wall.json +1 -1
  238. package/registry/waveform.json +1 -1
  239. package/dist/chunk-PGPNYYE2.js.map +0 -1
  240. package/dist/chunk-SG3QJJXE.js.map +0 -1
package/README.md CHANGED
@@ -195,6 +195,7 @@ light or a product's — is a set of tokens.
195
195
  | `@krizaka/ui/video-trimmer` | `VideoTrimmer` (`duration`, `value` [start, end], `minLength`, `step`/`largeStep`, `frames` or children, `time` + `onSeek`, `classNames` per part, `renderHandle`) | client |
196
196
  | `@krizaka/ui/waveform` | `Waveform` (`peaks`, `bars`, `size` sm·md·lg, `tone` accent·neutral, `playing`, `label`): the bars of a sound, decorative by default (`aria-hidden`), breathing gently while it plays, still under reduced motion and off screen; `/native` has the same | client |
197
197
  | `@krizaka/ui/qr-code` | `QrCode` (`value`, `label`, `size`, `quietZone`, `level` L·M·Q·H, `copyLabel` / `copiedLabel` / `onCopy`) and the pure `encodeQr` / `qrPath`: a QR code drawn offline, dark modules on a light tile in both themes, an image named by `label`; `/native` has the same (`onCopy` receives the text) | client |
198
+ | `@krizaka/ui/identity-card` | `IdentityCard` (`mark`, `name`, `subtitle`, `chips`, `qr`): the identity of a business or a person at the top of a sheet, with a contact QR code (`vCard(fields)` of `qr-code` writes the text) | client |
198
199
  | `@krizaka/ui/entity-header` | `EntityHeader` (`name` / `onNameChange`, `description` / `onDescriptionChange`, `avatar`, `avatarPicker`, `tags`, `refusal` + `refusals` by `OrganizeCode`, `actions`): the head of a collection, shop or studio, edited in place; `/native` has the same (`onAvatarPress`) | client |
199
200
  | `@krizaka/ui/collection-switcher` | `CollectionSwitcher` (`collections` with `parentId` / `isDefault` / `count`, `value` from the URL, `onValueChange` or `href`, `layout` list·tree, `mode` collection·entity, `onRemove` never on the default one, `onCreate`), `collectionTree`; `/native` has the same | client |
200
201
  | `@krizaka/ui/image-cropper` | `ImageCropper` (`aspect`, `round`, an image or a `<video>`, a focus point + zoom out, keyboard and zoom slider), `cropRect` | client |
@@ -2,7 +2,10 @@ import { AccountMenu } from '@krizaka/ui/account-menu';
2
2
  import { Mode } from '@krizaka/ui/theme';
3
3
  import * as React from 'react';
4
4
 
5
- /** A Krizaka brand: the company and its three products. */
5
+ /**
6
+ * A Krizaka brand by its code name: the company and its three products — sold as Verikora (`yomizaka`), Folioviv
7
+ * (`akinaza`) and Sovkora (`orazaka`). It also keys the brand palettes (maps, forms, loaders).
8
+ */
6
9
  type BrandId = "krizaka" | "orazaka" | "yomizaka" | "akinaza";
7
10
 
8
11
  /** The places the account menu can hold, in the order the frame draws them. */
@@ -0,0 +1,349 @@
1
+ import {
2
+ CheckGlyph,
3
+ CopyGlyph
4
+ } from "./chunk-C57KK5VB.js";
5
+ import {
6
+ Button
7
+ } from "./chunk-EB45EVPJ.js";
8
+ import {
9
+ cn
10
+ } from "./chunk-W675RFOA.js";
11
+
12
+ // src/qr-code/encode.ts
13
+ var LEVEL_INDEX = { L: 0, M: 1, Q: 2, H: 3 };
14
+ var LEVEL_BITS = { L: 1, M: 0, Q: 3, H: 2 };
15
+ var ECC_PER_BLOCK = [
16
+ [-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],
17
+ [-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],
18
+ [-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],
19
+ [-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]
20
+ ];
21
+ var BLOCKS = [
22
+ [-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],
23
+ [-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],
24
+ [-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],
25
+ [-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]
26
+ ];
27
+ function rawModules(version) {
28
+ let result = (16 * version + 128) * version + 64;
29
+ if (version >= 2) {
30
+ const align = Math.floor(version / 7) + 2;
31
+ result -= (25 * align - 10) * align - 55;
32
+ if (version >= 7) result -= 36;
33
+ }
34
+ return result;
35
+ }
36
+ function dataCodewords(version, level) {
37
+ const l = LEVEL_INDEX[level];
38
+ return Math.floor(rawModules(version) / 8) - ECC_PER_BLOCK[l][version] * BLOCKS[l][version];
39
+ }
40
+ function utf8(text) {
41
+ return [...new TextEncoder().encode(text)];
42
+ }
43
+ function gfMultiply(x, y) {
44
+ let z = 0;
45
+ for (let i = 7; i >= 0; i--) {
46
+ z = z << 1 ^ (z >>> 7) * 285;
47
+ z ^= (y >>> i & 1) * x;
48
+ }
49
+ return z;
50
+ }
51
+ function divisor(degree) {
52
+ const result = new Array(degree).fill(0);
53
+ result[degree - 1] = 1;
54
+ let root = 1;
55
+ for (let i = 0; i < degree; i++) {
56
+ for (let j = 0; j < degree; j++) {
57
+ result[j] = gfMultiply(result[j], root);
58
+ if (j + 1 < degree) result[j] = result[j] ^ result[j + 1];
59
+ }
60
+ root = gfMultiply(root, 2);
61
+ }
62
+ return result;
63
+ }
64
+ function remainder(data, div) {
65
+ const result = div.map(() => 0);
66
+ for (const b of data) {
67
+ const factor = b ^ result.shift();
68
+ result.push(0);
69
+ div.forEach((coef, i) => {
70
+ result[i] = result[i] ^ gfMultiply(coef, factor);
71
+ });
72
+ }
73
+ return result;
74
+ }
75
+ function pushBits(bits, value, count) {
76
+ for (let i = count - 1; i >= 0; i--) bits.push(value >>> i & 1);
77
+ }
78
+ function codewords(bytes, version, level) {
79
+ const bits = [];
80
+ pushBits(bits, 4, 4);
81
+ pushBits(bits, bytes.length, version <= 9 ? 8 : 16);
82
+ for (const b of bytes) pushBits(bits, b, 8);
83
+ const capacity = dataCodewords(version, level) * 8;
84
+ pushBits(bits, 0, Math.min(4, capacity - bits.length));
85
+ pushBits(bits, 0, (8 - bits.length % 8) % 8);
86
+ let pad = 236;
87
+ while (bits.length < capacity) {
88
+ pushBits(bits, pad, 8);
89
+ pad ^= 236 ^ 17;
90
+ }
91
+ const data = [];
92
+ for (let i = 0; i < bits.length; i += 8) data.push(parseInt(bits.slice(i, i + 8).join(""), 2));
93
+ const l = LEVEL_INDEX[level];
94
+ const blocks = BLOCKS[l][version];
95
+ const eccLen = ECC_PER_BLOCK[l][version];
96
+ const shortBlocks = blocks - Math.floor(rawModules(version) / 8) % blocks;
97
+ const shortLen = Math.floor(rawModules(version) / 8 / blocks) - eccLen;
98
+ const div = divisor(eccLen);
99
+ const parts = [];
100
+ for (let i = 0, k = 0; i < blocks; i++) {
101
+ const chunk = data.slice(k, k + shortLen + (i < shortBlocks ? 0 : 1));
102
+ k += chunk.length;
103
+ parts.push({ data: chunk, ecc: remainder(chunk, div) });
104
+ }
105
+ const out = [];
106
+ for (let i = 0; i <= shortLen; i++) parts.forEach((p) => i < p.data.length && out.push(p.data[i]));
107
+ for (let i = 0; i < eccLen; i++) parts.forEach((p) => out.push(p.ecc[i]));
108
+ return out;
109
+ }
110
+ function alignmentPositions(version) {
111
+ if (version === 1) return [];
112
+ const count = Math.floor(version / 7) + 2;
113
+ const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;
114
+ const result = [6];
115
+ let pos = version * 4 + 10;
116
+ while (result.length < count) {
117
+ result.splice(1, 0, pos);
118
+ pos -= step;
119
+ }
120
+ return result;
121
+ }
122
+ function drawFunctionPatterns(version, level) {
123
+ const size = version * 4 + 17;
124
+ const dark = Array.from({ length: size }, () => new Array(size).fill(false));
125
+ const fn = Array.from({ length: size }, () => new Array(size).fill(false));
126
+ const set = (x, y, on) => {
127
+ dark[y][x] = on;
128
+ fn[y][x] = true;
129
+ };
130
+ for (let i = 0; i < size; i++) {
131
+ set(6, i, i % 2 === 0);
132
+ set(i, 6, i % 2 === 0);
133
+ }
134
+ const finder = (cx, cy) => {
135
+ for (let dy = -4; dy <= 4; dy++)
136
+ for (let dx = -4; dx <= 4; dx++) {
137
+ const x = cx + dx;
138
+ const y = cy + dy;
139
+ if (x < 0 || x >= size || y < 0 || y >= size) continue;
140
+ const dist = Math.max(Math.abs(dx), Math.abs(dy));
141
+ set(x, y, dist !== 2 && dist !== 4);
142
+ }
143
+ };
144
+ finder(3, 3);
145
+ finder(size - 4, 3);
146
+ finder(3, size - 4);
147
+ const align = alignmentPositions(version);
148
+ align.forEach(
149
+ (cx, i) => align.forEach((cy, j) => {
150
+ if (i === 0 && j === 0 || i === 0 && j === align.length - 1 || i === align.length - 1 && j === 0) return;
151
+ for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) set(cx + dx, cy + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
152
+ })
153
+ );
154
+ drawFormat(dark, fn, size, level, 0);
155
+ if (version >= 7) {
156
+ let rem = version;
157
+ for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
158
+ const bits = version << 12 | rem;
159
+ for (let i = 0; i < 18; i++) {
160
+ const on = (bits >>> i & 1) !== 0;
161
+ const a = size - 11 + i % 3;
162
+ const b = Math.floor(i / 3);
163
+ set(a, b, on);
164
+ set(b, a, on);
165
+ }
166
+ }
167
+ return { size, dark, fn };
168
+ }
169
+ function drawFormat(dark, fn, size, level, mask) {
170
+ const data = LEVEL_BITS[level] << 3 | mask;
171
+ let rem = data;
172
+ for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
173
+ const bits = (data << 10 | rem) ^ 21522;
174
+ const bit = (i) => (bits >>> i & 1) !== 0;
175
+ const set = (x, y, on) => {
176
+ dark[y][x] = on;
177
+ fn[y][x] = true;
178
+ };
179
+ for (let i = 0; i <= 5; i++) set(8, i, bit(i));
180
+ set(8, 7, bit(6));
181
+ set(8, 8, bit(7));
182
+ set(7, 8, bit(8));
183
+ for (let i = 9; i < 15; i++) set(14 - i, 8, bit(i));
184
+ for (let i = 0; i < 8; i++) set(size - 1 - i, 8, bit(i));
185
+ for (let i = 8; i < 15; i++) set(8, size - 15 + i, bit(i));
186
+ set(8, size - 8, true);
187
+ }
188
+ function* dataPositions(size) {
189
+ for (let right = size - 1; right >= 1; right -= 2) {
190
+ if (right === 6) right = 5;
191
+ for (let vert = 0; vert < size; vert++) {
192
+ const y = (right + 1 & 2) === 0 ? size - 1 - vert : vert;
193
+ yield [right, y];
194
+ yield [right - 1, y];
195
+ }
196
+ }
197
+ }
198
+ function placeData(grid, data) {
199
+ const { size, dark, fn } = grid;
200
+ let i = 0;
201
+ for (const [x, y] of dataPositions(size)) {
202
+ if (fn[y][x] || i >= data.length * 8) continue;
203
+ dark[y][x] = (data[i >>> 3] >>> 7 - (i & 7) & 1) !== 0;
204
+ i++;
205
+ }
206
+ }
207
+ var MASKS = [
208
+ (x, y) => (x + y) % 2 === 0,
209
+ (_x, y) => y % 2 === 0,
210
+ (x) => x % 3 === 0,
211
+ (x, y) => (x + y) % 3 === 0,
212
+ (x, y) => (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0,
213
+ (x, y) => x * y % 2 + x * y % 3 === 0,
214
+ (x, y) => (x * y % 2 + x * y % 3) % 2 === 0,
215
+ (x, y) => ((x + y) % 2 + x * y % 3) % 2 === 0
216
+ ];
217
+ function runPenalty(line) {
218
+ let score = 0;
219
+ let run = 1;
220
+ for (let i = 1; i < line.length; i++) {
221
+ run = line[i] === line[i - 1] ? run + 1 : 1;
222
+ if (run === 5) score += 3;
223
+ else if (run > 5) score++;
224
+ }
225
+ return score;
226
+ }
227
+ function finderPenalty(line) {
228
+ const text = line.map((on) => on ? "1" : "0").join("");
229
+ let score = 0;
230
+ for (const pattern of ["00001011101", "10111010000"]) {
231
+ for (let at = text.indexOf(pattern); at >= 0; at = text.indexOf(pattern, at + 1)) score += 40;
232
+ }
233
+ return score;
234
+ }
235
+ function blockPenalty(dark) {
236
+ let score = 0;
237
+ for (let y = 0; y < dark.length - 1; y++)
238
+ for (let x = 0; x < dark.length - 1; x++) {
239
+ const c = dark[y][x];
240
+ if (c === dark[y][x + 1] && c === dark[y + 1][x] && c === dark[y + 1][x + 1]) score += 3;
241
+ }
242
+ return score;
243
+ }
244
+ function balancePenalty(dark) {
245
+ const size = dark.length;
246
+ const total = dark.reduce((n, row) => n + row.filter(Boolean).length, 0);
247
+ return (Math.ceil(Math.abs(total * 20 - size * size * 10) / (size * size)) - 1) * 10;
248
+ }
249
+ function penalty(dark) {
250
+ const columns = dark.map((_, x) => dark.map((row) => row[x]));
251
+ const lines = [...dark, ...columns];
252
+ return lines.reduce((n, line) => n + runPenalty(line) + finderPenalty(line), 0) + blockPenalty(dark) + balancePenalty(dark);
253
+ }
254
+ var QrTooLongError = class extends Error {
255
+ constructor(length, level) {
256
+ super(`The text (${length} bytes) is too long for a QR code at level ${level}.`);
257
+ this.name = "QrTooLongError";
258
+ }
259
+ };
260
+ function smallestVersion(bytes, level) {
261
+ for (let version = 1; version <= 40; version++) {
262
+ if (4 + (version <= 9 ? 8 : 16) + bytes.length * 8 <= dataCodewords(version, level) * 8) return version;
263
+ }
264
+ throw new QrTooLongError(bytes.length, level);
265
+ }
266
+ function masked(base, mask, level) {
267
+ const dark = base.dark.map((row) => [...row]);
268
+ const fn = base.fn.map((row) => [...row]);
269
+ for (let y = 0; y < base.size; y++) for (let x = 0; x < base.size; x++) if (!fn[y][x] && MASKS[mask](x, y)) dark[y][x] = !dark[y][x];
270
+ drawFormat(dark, fn, base.size, level, mask);
271
+ return dark;
272
+ }
273
+ function encodeQr(text, level = "M") {
274
+ const bytes = utf8(text);
275
+ const version = smallestVersion(bytes, level);
276
+ const base = drawFunctionPatterns(version, level);
277
+ placeData(base, codewords(bytes, version, level));
278
+ const candidates = MASKS.map((_, mask) => masked(base, mask, level));
279
+ const scores = candidates.map(penalty);
280
+ return candidates[scores.indexOf(Math.min(...scores))];
281
+ }
282
+ function qrPath(matrix, quiet) {
283
+ const parts = [];
284
+ matrix.forEach((row, y) => {
285
+ for (let x = 0; x < row.length; x++) {
286
+ if (!row[x]) continue;
287
+ let end = x;
288
+ while (end + 1 < row.length && row[end + 1]) end++;
289
+ parts.push(`M${x + quiet} ${y + quiet}h${end - x + 1}v1h${x - end - 1}z`);
290
+ x = end;
291
+ }
292
+ });
293
+ return parts.join("");
294
+ }
295
+
296
+ // src/qr-code/qr-code.tsx
297
+ import * as React from "react";
298
+ import { jsx, jsxs } from "react/jsx-runtime";
299
+ var QR_TILE = "#ffffff";
300
+ var QR_MODULE = "#0b0f19";
301
+ function QrCode({ value, label, size = 176, quietZone = 4, level = "M", copyLabel, copiedLabel, onCopy, className }) {
302
+ const quiet = Math.max(2, Math.round(quietZone));
303
+ const { matrix, path } = React.useMemo(() => {
304
+ const m = encodeQr(value, level);
305
+ return { matrix: m, path: qrPath(m, quiet) };
306
+ }, [value, level, quiet]);
307
+ const modules = matrix.length + quiet * 2;
308
+ const [copied, setCopied] = React.useState(false);
309
+ React.useEffect(() => {
310
+ if (!copied) return;
311
+ const t = setTimeout(() => setCopied(false), 1800);
312
+ return () => clearTimeout(t);
313
+ }, [copied]);
314
+ const copy = () => navigator.clipboard?.writeText(value).then(() => {
315
+ setCopied(true);
316
+ onCopy?.();
317
+ });
318
+ return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex flex-col items-start gap-3", className), "data-qr-code": true, children: [
319
+ /* @__PURE__ */ jsxs(
320
+ "svg",
321
+ {
322
+ role: "img",
323
+ "aria-label": label,
324
+ viewBox: `0 0 ${modules} ${modules}`,
325
+ width: size,
326
+ height: size,
327
+ shapeRendering: "crispEdges",
328
+ className: "block max-w-full rounded-lg border border-border-default",
329
+ style: { height: "auto", aspectRatio: "1 / 1" },
330
+ children: [
331
+ /* @__PURE__ */ jsx("rect", { width: modules, height: modules, fill: QR_TILE }),
332
+ /* @__PURE__ */ jsx("path", { d: path, fill: QR_MODULE })
333
+ ]
334
+ }
335
+ ),
336
+ copyLabel ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "secondary", size: "sm", onClick: copy, announce: copied ? copiedLabel ?? copyLabel : void 0, children: [
337
+ copied ? /* @__PURE__ */ jsx(CheckGlyph, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(CopyGlyph, { className: "h-3.5 w-3.5" }),
338
+ copied ? copiedLabel ?? copyLabel : copyLabel
339
+ ] }) : null
340
+ ] });
341
+ }
342
+
343
+ export {
344
+ QrTooLongError,
345
+ encodeQr,
346
+ qrPath,
347
+ QrCode
348
+ };
349
+ //# sourceMappingURL=chunk-BCD2CRFG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/qr-code/encode.ts","../src/qr-code/qr-code.tsx"],"sourcesContent":["// The QR encoder: a string in, a square of dark/light modules out. Pure, offline, no dependency, shared by the web\n// and the native drawing. Byte mode (UTF-8), versions 1-40, the four error-correction levels, the eight masks chosen\n// by the standard's penalty rules (ISO/IEC 18004). `qr-code.test.tsx` decodes what it draws, version by version.\n\nexport type QrLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/** The square of modules, row by row: `true` is dark. */\nexport type QrMatrix = readonly (readonly boolean[])[];\n\nconst LEVEL_INDEX: Record<QrLevel, number> = { L: 0, M: 1, Q: 2, H: 3 };\nconst LEVEL_BITS: Record<QrLevel, number> = { L: 1, M: 0, Q: 3, H: 2 };\n\n// Error-correction codewords per block, and number of blocks, by level (L, M, Q, H) then version (index 0 is unused).\nconst ECC_PER_BLOCK = [\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 [-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 [-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 [-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] as const;\nconst BLOCKS = [\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 [-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 [-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 [-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] as const;\n\n/** Data modules of a version (everything but the finder, timing, alignment, format and version patterns). */\nfunction rawModules(version: number): number {\n let result = (16 * version + 128) * version + 64;\n if (version >= 2) {\n const align = Math.floor(version / 7) + 2;\n result -= (25 * align - 10) * align - 55;\n if (version >= 7) result -= 36;\n }\n return result;\n}\n\nfunction dataCodewords(version: number, level: QrLevel): number {\n const l = LEVEL_INDEX[level];\n return Math.floor(rawModules(version) / 8) - ECC_PER_BLOCK[l]![version]! * BLOCKS[l]![version]!;\n}\n\nexport function utf8(text: string): number[] {\n return [...new TextEncoder().encode(text)];\n}\n\n// Reed-Solomon over GF(256), polynomial 0x11D.\nfunction gfMultiply(x: number, y: number): number {\n let z = 0;\n for (let i = 7; i >= 0; i--) {\n z = (z << 1) ^ ((z >>> 7) * 0x11d);\n z ^= ((y >>> i) & 1) * x;\n }\n return z;\n}\n\nfunction divisor(degree: number): number[] {\n const result = new Array<number>(degree).fill(0);\n result[degree - 1] = 1;\n let root = 1;\n for (let i = 0; i < degree; i++) {\n for (let j = 0; j < degree; j++) {\n result[j] = gfMultiply(result[j]!, root);\n if (j + 1 < degree) result[j] = result[j]! ^ result[j + 1]!;\n }\n root = gfMultiply(root, 0x02);\n }\n return result;\n}\n\nfunction remainder(data: readonly number[], div: readonly number[]): number[] {\n const result = div.map(() => 0);\n for (const b of data) {\n const factor = b ^ result.shift()!;\n result.push(0);\n div.forEach((coef, i) => {\n result[i] = result[i]! ^ gfMultiply(coef, factor);\n });\n }\n return result;\n}\n\nfunction pushBits(bits: number[], value: number, count: number) {\n for (let i = count - 1; i >= 0; i--) bits.push((value >>> i) & 1);\n}\n\n/** The codewords of the message: mode, length, bytes, terminator, padding, then blocks interleaved with their ECC. */\nfunction codewords(bytes: readonly number[], version: number, level: QrLevel): number[] {\n const bits: number[] = [];\n pushBits(bits, 0b0100, 4);\n pushBits(bits, bytes.length, version <= 9 ? 8 : 16);\n for (const b of bytes) pushBits(bits, b, 8);\n const capacity = dataCodewords(version, level) * 8;\n pushBits(bits, 0, Math.min(4, capacity - bits.length));\n pushBits(bits, 0, (8 - (bits.length % 8)) % 8);\n let pad = 0xec;\n while (bits.length < capacity) {\n pushBits(bits, pad, 8);\n pad ^= 0xec ^ 0x11;\n }\n const data: number[] = [];\n for (let i = 0; i < bits.length; i += 8) data.push(parseInt(bits.slice(i, i + 8).join(\"\"), 2));\n\n const l = LEVEL_INDEX[level];\n const blocks = BLOCKS[l]![version]!;\n const eccLen = ECC_PER_BLOCK[l]![version]!;\n const shortBlocks = blocks - (Math.floor(rawModules(version) / 8) % blocks);\n const shortLen = Math.floor(rawModules(version) / 8 / blocks) - eccLen;\n const div = divisor(eccLen);\n const parts: { data: number[]; ecc: number[] }[] = [];\n for (let i = 0, k = 0; i < blocks; i++) {\n const chunk = data.slice(k, k + shortLen + (i < shortBlocks ? 0 : 1));\n k += chunk.length;\n parts.push({ data: chunk, ecc: remainder(chunk, div) });\n }\n const out: number[] = [];\n for (let i = 0; i <= shortLen; i++) parts.forEach((p) => i < p.data.length && out.push(p.data[i]!));\n for (let i = 0; i < eccLen; i++) parts.forEach((p) => out.push(p.ecc[i]!));\n return out;\n}\n\nfunction alignmentPositions(version: number): number[] {\n if (version === 1) return [];\n const count = Math.floor(version / 7) + 2;\n const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;\n const result = [6];\n let pos = version * 4 + 10;\n while (result.length < count) {\n result.splice(1, 0, pos);\n pos -= step;\n }\n return result;\n}\n\ntype Grid = { size: number; dark: boolean[][]; fn: boolean[][] };\n\nfunction drawFunctionPatterns(version: number, level: QrLevel): Grid {\n const size = version * 4 + 17;\n const dark = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n const fn = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n const set = (x: number, y: number, on: boolean) => {\n dark[y]![x] = on;\n fn[y]![x] = true;\n };\n for (let i = 0; i < size; i++) {\n set(6, i, i % 2 === 0);\n set(i, 6, i % 2 === 0);\n }\n const finder = (cx: number, cy: number) => {\n for (let dy = -4; dy <= 4; dy++)\n for (let dx = -4; dx <= 4; dx++) {\n const x = cx + dx;\n const y = cy + dy;\n if (x < 0 || x >= size || y < 0 || y >= size) continue;\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n set(x, y, dist !== 2 && dist !== 4);\n }\n };\n finder(3, 3);\n finder(size - 4, 3);\n finder(3, size - 4);\n const align = alignmentPositions(version);\n align.forEach((cx, i) =>\n align.forEach((cy, j) => {\n if ((i === 0 && j === 0) || (i === 0 && j === align.length - 1) || (i === align.length - 1 && j === 0)) return;\n for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) set(cx + dx, cy + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);\n }),\n );\n drawFormat(dark, fn, size, level, 0);\n if (version >= 7) {\n let rem = version;\n for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n const bits = (version << 12) | rem;\n for (let i = 0; i < 18; i++) {\n const on = ((bits >>> i) & 1) !== 0;\n const a = size - 11 + (i % 3);\n const b = Math.floor(i / 3);\n set(a, b, on);\n set(b, a, on);\n }\n }\n return { size, dark, fn };\n}\n\nfunction drawFormat(dark: boolean[][], fn: boolean[][], size: number, level: QrLevel, mask: number) {\n const data = (LEVEL_BITS[level] << 3) | mask;\n let rem = data;\n for (let i = 0; i < 10; i++) rem = (rem << 1) ^ ((rem >>> 9) * 0x537);\n const bits = ((data << 10) | rem) ^ 0x5412;\n const bit = (i: number) => ((bits >>> i) & 1) !== 0;\n const set = (x: number, y: number, on: boolean) => {\n dark[y]![x] = on;\n fn[y]![x] = true;\n };\n for (let i = 0; i <= 5; i++) set(8, i, bit(i));\n set(8, 7, bit(6));\n set(8, 8, bit(7));\n set(7, 8, bit(8));\n for (let i = 9; i < 15; i++) set(14 - i, 8, bit(i));\n for (let i = 0; i < 8; i++) set(size - 1 - i, 8, bit(i));\n for (let i = 8; i < 15; i++) set(8, size - 15 + i, bit(i));\n set(8, size - 8, true);\n}\n\n/** The data modules in the standard's order: two-column strips from the right, up then down, skipping the timing column. */\nfunction* dataPositions(size: number): Generator<[number, number]> {\n for (let right = size - 1; right >= 1; right -= 2) {\n if (right === 6) right = 5;\n for (let vert = 0; vert < size; vert++) {\n const y = ((right + 1) & 2) === 0 ? size - 1 - vert : vert;\n yield [right, y];\n yield [right - 1, y];\n }\n }\n}\n\nfunction placeData(grid: Grid, data: readonly number[]) {\n const { size, dark, fn } = grid;\n let i = 0;\n for (const [x, y] of dataPositions(size)) {\n if (fn[y]![x] || i >= data.length * 8) continue;\n dark[y]![x] = ((data[i >>> 3]! >>> (7 - (i & 7))) & 1) !== 0;\n i++;\n }\n}\n\nconst MASKS: ((x: number, y: number) => boolean)[] = [\n (x, y) => (x + y) % 2 === 0,\n (_x, y) => y % 2 === 0,\n (x) => x % 3 === 0,\n (x, y) => (x + y) % 3 === 0,\n (x, y) => (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0,\n (x, y) => ((x * y) % 2) + ((x * y) % 3) === 0,\n (x, y) => (((x * y) % 2) + ((x * y) % 3)) % 2 === 0,\n (x, y) => (((x + y) % 2) + ((x * y) % 3)) % 2 === 0,\n];\n\ntype Dark = readonly (readonly boolean[])[];\n\n/** Rule 1: runs of five or more of one colour in a line (3, then 1 per module beyond). */\nfunction runPenalty(line: readonly boolean[]): number {\n let score = 0;\n let run = 1;\n for (let i = 1; i < line.length; i++) {\n run = line[i] === line[i - 1] ? run + 1 : 1;\n if (run === 5) score += 3;\n else if (run > 5) score++;\n }\n return score;\n}\n\n/** Rule 3: the finder-like pattern 1011101 with four light modules on one side, 40 each. */\nfunction finderPenalty(line: readonly boolean[]): number {\n const text = line.map((on) => (on ? \"1\" : \"0\")).join(\"\");\n let score = 0;\n for (const pattern of [\"00001011101\", \"10111010000\"]) {\n for (let at = text.indexOf(pattern); at >= 0; at = text.indexOf(pattern, at + 1)) score += 40;\n }\n return score;\n}\n\n/** Rule 2: 2x2 blocks of one colour, 3 each. */\nfunction blockPenalty(dark: Dark): number {\n let score = 0;\n for (let y = 0; y < dark.length - 1; y++)\n for (let x = 0; x < dark.length - 1; x++) {\n const c = dark[y]![x]!;\n if (c === dark[y]![x + 1] && c === dark[y + 1]![x] && c === dark[y + 1]![x + 1]) score += 3;\n }\n return score;\n}\n\n/** Rule 4: the share of dark modules away from 50 %, 10 per started 5 %. */\nfunction balancePenalty(dark: Dark): number {\n const size = dark.length;\n const total = dark.reduce((n, row) => n + row.filter(Boolean).length, 0);\n return (Math.ceil(Math.abs(total * 20 - size * size * 10) / (size * size)) - 1) * 10;\n}\n\nfunction penalty(dark: Dark): number {\n const columns = dark.map((_, x) => dark.map((row) => row[x]!));\n const lines = [...dark, ...columns];\n return lines.reduce((n, line) => n + runPenalty(line) + finderPenalty(line), 0) + blockPenalty(dark) + balancePenalty(dark);\n}\n\n/** Thrown when the text does not fit the biggest code (version 40) at the asked level. */\nexport class QrTooLongError extends Error {\n constructor(length: number, level: QrLevel) {\n super(`The text (${length} bytes) is too long for a QR code at level ${level}.`);\n this.name = \"QrTooLongError\";\n }\n}\n\n/** The smallest version whose data capacity holds the bytes (mode and length fields included). */\nfunction smallestVersion(bytes: readonly number[], level: QrLevel): number {\n for (let version = 1; version <= 40; version++) {\n if (4 + (version <= 9 ? 8 : 16) + bytes.length * 8 <= dataCodewords(version, level) * 8) return version;\n }\n throw new QrTooLongError(bytes.length, level);\n}\n\n/** The grid with one mask applied to its data modules and its format bits written. */\nfunction masked(base: Grid, mask: number, level: QrLevel): boolean[][] {\n const dark = base.dark.map((row) => [...row]);\n const fn = base.fn.map((row) => [...row]);\n for (let y = 0; y < base.size; y++) for (let x = 0; x < base.size; x++) if (!fn[y]![x] && MASKS[mask]!(x, y)) dark[y]![x] = !dark[y]![x];\n drawFormat(dark, fn, base.size, level, mask);\n return dark;\n}\n\n/** Encodes a text as a QR code: the smallest version that holds it at `level`, the best of the eight masks. */\nexport function encodeQr(text: string, level: QrLevel = \"M\"): QrMatrix {\n const bytes = utf8(text);\n const version = smallestVersion(bytes, level);\n const base = drawFunctionPatterns(version, level);\n placeData(base, codewords(bytes, version, level));\n const candidates = MASKS.map((_, mask) => masked(base, mask, level));\n const scores = candidates.map(penalty);\n return candidates[scores.indexOf(Math.min(...scores))]!;\n}\n\n/**\n * The drawing of a matrix as one SVG path: a rectangle per horizontal run of dark modules, in module units, offset by\n * the quiet zone. Shared by the web `<svg>` and the native `<Path>`.\n */\nexport function qrPath(matrix: QrMatrix, quiet: number): string {\n const parts: string[] = [];\n matrix.forEach((row, y) => {\n for (let x = 0; x < row.length; x++) {\n if (!row[x]) continue;\n let end = x;\n while (end + 1 < row.length && row[end + 1]) end++;\n parts.push(`M${x + quiet} ${y + quiet}h${end - x + 1}v1h${x - end - 1}z`);\n x = end;\n }\n });\n return parts.join(\"\");\n}\n","// Client (the copy action). A QR code drawn from a text, offline: an SVG of dark modules on a light tile, whatever the\n// theme (a phone reads dark on light), with its quiet zone. No call to any service; the text never leaves the page.\nimport * as React from \"react\";\n\nimport { Button } from \"../button/button\";\nimport { cn } from \"../cn\";\nimport { CheckGlyph, CopyGlyph } from \"../glyphs\";\nimport { encodeQr, type QrLevel, qrPath } from \"./encode\";\n\n// The tile and the modules are the same in dark and light on purpose: a scanner needs dark modules on a light ground.\nexport const QR_TILE = \"#ffffff\";\nexport const QR_MODULE = \"#0b0f19\";\n\nexport type QrCodeProps = {\n /** The text to encode — an address, a feed URL. Encoded here, in the browser (or on the server); never sent anywhere. */\n value: string;\n /** What the code is, for a screen reader (“Calendar feed — scan with your phone”), passed translated. The image is named by it. */\n label: string;\n /** The side of the tile, in px, quiet zone included. Default 176. */\n size?: number;\n /** The quiet zone, in modules, around the code (the standard asks for 4). Default 4, never less than 2. */\n quietZone?: number;\n /** The error-correction level: L · M (default) · Q · H (a logo or wear on the print). */\n level?: QrLevel;\n /** The words of the copy action, passed translated. Without them there is no « copy » button. */\n copyLabel?: string;\n /** Said once the text is on the clipboard. Default: the copy label. */\n copiedLabel?: string;\n /** Called after the text is copied. */\n onCopy?: () => void;\n /** Classes merged last, on the wrapper. */\n className?: string;\n};\n\n/** A QR code from a text: dark modules on a light tile in both themes, a quiet zone, an accessible name, an optional copy action. */\nexport function QrCode({ value, label, size = 176, quietZone = 4, level = \"M\", copyLabel, copiedLabel, onCopy, className }: QrCodeProps) {\n const quiet = Math.max(2, Math.round(quietZone));\n const { matrix, path } = React.useMemo(() => {\n const m = encodeQr(value, level);\n return { matrix: m, path: qrPath(m, quiet) };\n }, [value, level, quiet]);\n const modules = matrix.length + quiet * 2;\n const [copied, setCopied] = React.useState(false);\n React.useEffect(() => {\n if (!copied) return;\n const t = setTimeout(() => setCopied(false), 1800);\n return () => clearTimeout(t);\n }, [copied]);\n const copy = () =>\n navigator.clipboard?.writeText(value).then(() => {\n setCopied(true);\n onCopy?.();\n });\n\n return (\n <div className={cn(\"inline-flex flex-col items-start gap-3\", className)} data-qr-code>\n <svg\n role=\"img\"\n aria-label={label}\n viewBox={`0 0 ${modules} ${modules}`}\n width={size}\n height={size}\n shapeRendering=\"crispEdges\"\n className=\"block max-w-full rounded-lg border border-border-default\"\n style={{ height: \"auto\", aspectRatio: \"1 / 1\" }}\n >\n <rect width={modules} height={modules} fill={QR_TILE} />\n <path d={path} fill={QR_MODULE} />\n </svg>\n {copyLabel ? (\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onClick={copy} announce={copied ? (copiedLabel ?? copyLabel) : undefined}>\n {copied ? <CheckGlyph className=\"h-3.5 w-3.5\" /> : <CopyGlyph className=\"h-3.5 w-3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