@eifi1/ui-kit 0.11.0 → 0.13.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.
- package/README.md +59 -34
- package/dist/chart.d.ts +3 -1
- package/dist/chart.js +2 -0
- package/dist/chart.js.map +1 -1
- package/dist/components/account-settings-labels.d.ts +105 -0
- package/dist/components/account-settings-labels.js +81 -0
- package/dist/components/account-settings-labels.js.map +1 -0
- package/dist/components/account-settings.d.ts +36 -52
- package/dist/components/account-settings.js +44 -8
- package/dist/components/account-settings.js.map +1 -1
- package/dist/components/amount-input.d.ts +40 -4
- package/dist/components/amount-input.js +50 -12
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/authed-image.d.ts +68 -0
- package/dist/components/authed-image.js +117 -0
- package/dist/components/authed-image.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +2 -1
- package/dist/components/breadcrumbs.js +5 -2
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bulk-action-bar.d.ts +10 -2
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +51 -2
- package/dist/components/button-group.js +5 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/calculator.d.ts +15 -4
- package/dist/components/calendar-heatmap.d.ts +41 -3
- package/dist/components/calendar-heatmap.js +48 -7
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/chart.js +14 -8
- package/dist/components/chart.js.map +1 -1
- package/dist/components/chip.d.ts +2 -1
- package/dist/components/chip.js +26 -18
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +35 -3
- package/dist/components/choice-card.js +83 -25
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/combobox-core.d.ts +3 -1
- package/dist/components/combobox-core.js +18 -5
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +2 -2
- package/dist/components/combobox.js +31 -9
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/copy-button.d.ts +51 -70
- package/dist/components/copy-button.js +1 -1
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +63 -0
- package/dist/components/data-table-cells.js +64 -0
- package/dist/components/data-table-cells.js.map +1 -0
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filter-popover.js +8 -1
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-filters.js +31 -1
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-labels.d.ts +13 -0
- package/dist/components/data-table-labels.js +8 -1
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +125 -27
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +3 -1
- package/dist/components/date-picker.js +15 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/description-list.d.ts +23 -3
- package/dist/components/description-list.js +23 -3
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +1 -0
- package/dist/components/entity-combobox.d.ts +1 -1
- package/dist/components/entity-combobox.js +40 -20
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/error-boundary.d.ts +281 -0
- package/dist/components/error-boundary.js +302 -0
- package/dist/components/error-boundary.js.map +1 -0
- package/dist/components/field-sync.js +90 -83
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.d.ts +30 -4
- package/dist/components/field.js +40 -17
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +50 -208
- package/dist/components/file-dropzone.d.ts +49 -2
- package/dist/components/floating-panel.d.ts +13 -4
- package/dist/components/floating-panel.js +7 -3
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/form-actions.d.ts +53 -0
- package/dist/components/form-actions.js +98 -0
- package/dist/components/form-actions.js.map +1 -0
- package/dist/components/full-bleed-dialog.js +4 -0
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/hover-menu.js +64 -56
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/image-grid.d.ts +67 -0
- package/dist/components/image-grid.js +112 -0
- package/dist/components/image-grid.js.map +1 -0
- package/dist/components/lightbox.d.ts +104 -0
- package/dist/components/lightbox.js +229 -0
- package/dist/components/lightbox.js.map +1 -0
- package/dist/components/line-items.d.ts +114 -0
- package/dist/components/line-items.js +238 -0
- package/dist/components/line-items.js.map +1 -0
- package/dist/components/list.d.ts +37 -4
- package/dist/components/list.js +35 -14
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-state.d.ts +24 -0
- package/dist/components/loading-state.js +32 -0
- package/dist/components/loading-state.js.map +1 -0
- package/dist/components/menu-item.d.ts +2 -1
- package/dist/components/menu-item.js +5 -1
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar.d.ts +13 -1
- package/dist/components/mini-calendar.js +46 -2
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +20 -1
- package/dist/components/modal.js +26 -2
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-picker.d.ts +21 -1
- package/dist/components/month-picker.js +139 -26
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +1 -1
- package/dist/components/multi-entity-combobox.js +42 -20
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/nav-pills.d.ts +2 -1
- package/dist/components/nav-pills.js +5 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.d.ts +24 -5
- package/dist/components/number-field.js +5 -7
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +25 -5
- package/dist/components/number-input.js +7 -1
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +20 -5
- package/dist/components/numpad-sheet.js +3 -2
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/page-header.d.ts +35 -6
- package/dist/components/page-header.js +7 -1
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/passkeys-setting.d.ts +67 -0
- package/dist/components/passkeys-setting.js +214 -0
- package/dist/components/passkeys-setting.js.map +1 -0
- package/dist/components/picker-sheet.js +5 -1
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/pie-chart-labels.d.ts +20 -0
- package/dist/components/pie-chart-labels.js +12 -0
- package/dist/components/pie-chart-labels.js.map +1 -0
- package/dist/components/pie-chart.d.ts +101 -0
- package/dist/components/pie-chart.js +283 -0
- package/dist/components/pie-chart.js.map +1 -0
- package/dist/components/popover.js +3 -0
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar.d.ts +44 -3
- package/dist/components/progress-bar.js +58 -22
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/qr-code.d.ts +34 -0
- package/dist/components/qr-code.js +57 -0
- package/dist/components/qr-code.js.map +1 -0
- package/dist/components/search-field.d.ts +15 -3
- package/dist/components/search-field.js +5 -1
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/settings-fields.d.ts +49 -1
- package/dist/components/signed-amount.d.ts +122 -0
- package/dist/components/signed-amount.js +152 -0
- package/dist/components/signed-amount.js.map +1 -0
- package/dist/components/skeleton.d.ts +10 -3
- package/dist/components/skeleton.js +12 -2
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/stat-tile.d.ts +2 -1
- package/dist/components/stat-tile.js +6 -3
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/swipeable-row.js +4 -3
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/table.d.ts +39 -5
- package/dist/components/table.js +45 -11
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +238 -0
- package/dist/components/text-link.js +144 -0
- package/dist/components/text-link.js.map +1 -0
- package/dist/components/text.d.ts +26 -2
- package/dist/components/text.js +16 -2
- package/dist/components/text.js.map +1 -1
- package/dist/components/time-input.d.ts +49 -1
- package/dist/components/toggle-group.d.ts +35 -0
- package/dist/components/toggle-group.js +43 -14
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +53 -3
- package/dist/components/toggle-legend.js +54 -1
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/tooltip.d.ts +51 -1
- package/dist/components/tooltip.js +59 -35
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/ui.d.ts +51 -779
- package/dist/components/ui.js +364 -34
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +3 -52
- package/dist/components/use-table-state.js +128 -30
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/{data-table-filters-Dh9uF_S-.d.ts → data-table-Drun8Fk9.d.ts} +305 -61
- package/dist/data-table.d.ts +2 -1
- package/dist/data-table.js +5 -1
- package/dist/data-table.js.map +1 -1
- package/dist/feedback/feedback-attachment.js +4 -6
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-dialog.d.ts +26 -3
- package/dist/feedback/feedback-dialog.js +21 -5
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.js +86 -75
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +173 -0
- package/dist/feedback/feedback-thread.js +264 -0
- package/dist/feedback/feedback-thread.js.map +1 -0
- package/dist/feedback.d.ts +2 -1
- package/dist/feedback.js +1 -0
- package/dist/feedback.js.map +1 -1
- package/dist/hooks/use-authed-src.d.ts +71 -0
- package/dist/hooks/use-authed-src.js +63 -0
- package/dist/hooks/use-authed-src.js.map +1 -0
- package/dist/hooks/use-file-drop.d.ts +49 -2
- package/dist/hooks/use-hotkey.d.ts +59 -0
- package/dist/hooks/use-hotkey.js +105 -0
- package/dist/hooks/use-hotkey.js.map +1 -0
- package/dist/hooks/use-search-param-state.d.ts +83 -0
- package/dist/hooks/use-search-param-state.js +94 -0
- package/dist/hooks/use-search-param-state.js.map +1 -0
- package/dist/i18n/defaults.d.ts +15 -4
- package/dist/i18n/defaults.js +31 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +46 -312
- package/dist/i18n/kit-labels.js +20 -5
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/de-CH-informal.d.ts +15 -4
- package/dist/i18n/locales/de-CH.d.ts +15 -4
- package/dist/i18n/locales/de-informal.d.ts +15 -4
- package/dist/i18n/locales/de.d.ts +15 -4
- package/dist/i18n/locales/de.js +164 -3
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +15 -4
- package/dist/i18n/locales/es.js +161 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +15 -4
- package/dist/i18n/locales/fr.js +161 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +15 -4
- package/dist/i18n/locales/hu.js +161 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +15 -4
- package/dist/i18n/locales/it.js +161 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +15 -4
- package/dist/i18n/locales/zh.js +161 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.d.ts +39 -19
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/dist/kit-labels-Mz8zZHIF.d.ts +1744 -0
- package/dist/lib/format.d.ts +162 -0
- package/dist/lib/format.js +151 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/qr-encode.d.ts +44 -0
- package/dist/lib/qr-encode.js +338 -0
- package/dist/lib/qr-encode.js.map +1 -0
- package/dist/rhf/fields.d.ts +283 -0
- package/dist/rhf/fields.js +631 -0
- package/dist/rhf/fields.js.map +1 -0
- package/dist/rhf/form.d.ts +49 -1
- package/dist/rhf/line-items.d.ts +31 -0
- package/dist/rhf/line-items.js +59 -0
- package/dist/rhf/line-items.js.map +1 -0
- package/dist/rhf.d.ts +61 -1
- package/dist/rhf.js +2 -0
- package/dist/rhf.js.map +1 -1
- package/dist/search/command-palette.js +20 -14
- package/dist/search/command-palette.js.map +1 -1
- package/dist/shell/app-shell.d.ts +99 -2
- package/dist/shell/app-shell.js +120 -57
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.d.ts +74 -0
- package/dist/shell/auth-layout.js +97 -0
- package/dist/shell/auth-layout.js.map +1 -0
- package/dist/shell/top-bar-brand.d.ts +81 -0
- package/dist/shell/top-bar-brand.js +47 -0
- package/dist/shell/top-bar-brand.js.map +1 -0
- package/dist/shell/topbar-action-menu.d.ts +21 -4
- package/dist/shell/topbar-action-menu.js +18 -2
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell.d.ts +56 -1
- package/dist/shell.js +2 -0
- package/dist/shell.js.map +1 -1
- package/dist/tour/tour.js +10 -4
- package/dist/tour/tour.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +48 -1
- package/dist/wizard/use-wizard.js +4 -2
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/wizard-context.d.ts +24 -1
- package/dist/wizard/wizard-context.js +19 -2
- package/dist/wizard/wizard-context.js.map +1 -1
- package/dist/wizard/wizard-step.d.ts +30 -5
- package/dist/wizard/wizard-step.js +34 -3
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard.d.ts +50 -3
- package/package.json +6 -6
- package/src/chart.ts +4 -0
- package/src/components/account-settings-labels.ts +190 -0
- package/src/components/account-settings.tsx +110 -63
- package/src/components/amount-input.tsx +109 -10
- package/src/components/authed-image.tsx +190 -0
- package/src/components/breadcrumbs.tsx +8 -2
- package/src/components/bulk-action-bar.tsx +16 -3
- package/src/components/button-group.tsx +7 -2
- package/src/components/calendar-heatmap.tsx +105 -10
- package/src/components/chart.tsx +19 -8
- package/src/components/chip.tsx +14 -4
- package/src/components/choice-card.tsx +136 -25
- package/src/components/combobox-core.tsx +33 -9
- package/src/components/combobox.tsx +33 -9
- package/src/components/copy-button.tsx +3 -2
- package/src/components/data-table-cells.tsx +119 -0
- package/src/components/data-table-filter-popover.tsx +13 -5
- package/src/components/data-table-filters.ts +77 -0
- package/src/components/data-table-labels.ts +23 -0
- package/src/components/data-table.tsx +230 -13
- package/src/components/date-picker.tsx +19 -3
- package/src/components/description-list.tsx +52 -3
- package/src/components/entity-combobox.tsx +25 -7
- package/src/components/error-boundary.tsx +640 -0
- package/src/components/field-sync.tsx +48 -40
- package/src/components/field.tsx +56 -5
- package/src/components/floating-panel.tsx +20 -7
- package/src/components/form-actions.tsx +191 -0
- package/src/components/full-bleed-dialog.tsx +4 -0
- package/src/components/hover-menu.tsx +26 -17
- package/src/components/image-grid.tsx +181 -0
- package/src/components/lightbox.tsx +374 -0
- package/src/components/line-items.tsx +385 -0
- package/src/components/list.tsx +82 -19
- package/src/components/loading-state.tsx +47 -0
- package/src/components/menu-item.tsx +7 -2
- package/src/components/mini-calendar.tsx +72 -3
- package/src/components/modal.tsx +65 -3
- package/src/components/month-picker.tsx +181 -26
- package/src/components/multi-entity-combobox.tsx +27 -7
- package/src/components/nav-pills.tsx +8 -1
- package/src/components/number-field.tsx +15 -10
- package/src/components/number-input.tsx +17 -1
- package/src/components/numpad-sheet.tsx +6 -1
- package/src/components/page-header.tsx +42 -5
- package/src/components/passkeys-setting.tsx +331 -0
- package/src/components/picker-sheet.tsx +10 -1
- package/src/components/pie-chart-labels.ts +32 -0
- package/src/components/pie-chart.tsx +479 -0
- package/src/components/popover.tsx +3 -0
- package/src/components/progress-bar.tsx +129 -19
- package/src/components/qr-code.tsx +83 -0
- package/src/components/search-field.tsx +20 -4
- package/src/components/signed-amount.tsx +295 -0
- package/src/components/skeleton.tsx +21 -3
- package/src/components/stat-tile.tsx +11 -3
- package/src/components/swipeable-row.tsx +7 -7
- package/src/components/table.tsx +102 -13
- package/src/components/text-link.tsx +356 -0
- package/src/components/text.tsx +46 -2
- package/src/components/toggle-group.tsx +93 -20
- package/src/components/toggle-legend.tsx +108 -2
- package/src/components/tooltip.tsx +79 -8
- package/src/components/ui.tsx +707 -49
- package/src/components/use-table-state.ts +265 -33
- package/src/data-table.ts +10 -0
- package/src/feedback/feedback-attachment.tsx +10 -7
- package/src/feedback/feedback-dialog.tsx +49 -7
- package/src/feedback/feedback-inbox.tsx +7 -0
- package/src/feedback/feedback-thread.tsx +510 -0
- package/src/feedback.ts +1 -0
- package/src/hooks/use-authed-src.ts +161 -0
- package/src/hooks/use-hotkey.ts +172 -0
- package/src/hooks/use-search-param-state.ts +187 -0
- package/src/i18n/defaults.ts +30 -0
- package/src/i18n/kit-labels.tsx +118 -8
- package/src/i18n/locales/de.ts +161 -0
- package/src/i18n/locales/es.ts +158 -0
- package/src/i18n/locales/fr.ts +161 -0
- package/src/i18n/locales/hu.ts +159 -0
- package/src/i18n/locales/it.ts +159 -0
- package/src/i18n/locales/zh.ts +158 -0
- package/src/index.ts +59 -0
- package/src/lib/format.ts +348 -0
- package/src/lib/qr-encode.ts +420 -0
- package/src/rhf/fields.tsx +1135 -0
- package/src/rhf/line-items.tsx +130 -0
- package/src/rhf.ts +6 -0
- package/src/search/command-palette.tsx +29 -19
- package/src/shell/app-shell.tsx +153 -3
- package/src/shell/auth-layout.tsx +190 -0
- package/src/shell/top-bar-brand.tsx +76 -0
- package/src/shell/topbar-action-menu.tsx +32 -4
- package/src/shell.ts +2 -0
- package/src/tour/tour.tsx +16 -5
- package/src/wizard/use-wizard.ts +8 -4
- package/src/wizard/wizard-context.tsx +41 -1
- package/src/wizard/wizard-step.tsx +75 -6
- package/tokens.css +12 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const LEVELS = ["L", "M", "Q", "H"];
|
|
3
|
+
const FORMAT_BITS = { L: 1, M: 0, Q: 3, H: 2 };
|
|
4
|
+
const ECC_CODEWORDS_PER_BLOCK = [
|
|
5
|
+
[-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],
|
|
6
|
+
[-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],
|
|
7
|
+
[-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],
|
|
8
|
+
[-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]
|
|
9
|
+
];
|
|
10
|
+
const NUM_ERROR_CORRECTION_BLOCKS = [
|
|
11
|
+
[-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],
|
|
12
|
+
[-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],
|
|
13
|
+
[-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],
|
|
14
|
+
[-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]
|
|
15
|
+
];
|
|
16
|
+
function encodeQr(text, options = {}) {
|
|
17
|
+
const bytes = Array.from(new TextEncoder().encode(text));
|
|
18
|
+
let level = LEVELS.indexOf(options.errorCorrection ?? "M");
|
|
19
|
+
let version = 1;
|
|
20
|
+
let usedBits;
|
|
21
|
+
for (; ; version++) {
|
|
22
|
+
const countBits = version <= 9 ? 8 : 16;
|
|
23
|
+
usedBits = bytes.length < 1 << countBits ? 4 + countBits + bytes.length * 8 : Infinity;
|
|
24
|
+
if (usedBits <= dataCodewords(version, level) * 8) break;
|
|
25
|
+
if (version >= 40) throw new RangeError("QR data too long");
|
|
26
|
+
}
|
|
27
|
+
if (options.boostErrorCorrection ?? true) {
|
|
28
|
+
for (let higher = level + 1; higher < LEVELS.length; higher++) {
|
|
29
|
+
if (usedBits <= dataCodewords(version, higher) * 8) level = higher;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const bits = [];
|
|
33
|
+
const append = (value, length) => {
|
|
34
|
+
for (let i = length - 1; i >= 0; i--) bits.push(value >>> i & 1);
|
|
35
|
+
};
|
|
36
|
+
append(4, 4);
|
|
37
|
+
append(bytes.length, version <= 9 ? 8 : 16);
|
|
38
|
+
for (const b of bytes) append(b, 8);
|
|
39
|
+
const capacity = dataCodewords(version, level) * 8;
|
|
40
|
+
append(0, Math.min(4, capacity - bits.length));
|
|
41
|
+
append(0, (8 - bits.length % 8) % 8);
|
|
42
|
+
for (let pad = 236; bits.length < capacity; pad ^= 236 ^ 17) append(pad, 8);
|
|
43
|
+
const data = [];
|
|
44
|
+
for (let i = 0; i < bits.length; i += 8) {
|
|
45
|
+
let byte = 0;
|
|
46
|
+
for (let j = 0; j < 8; j++) byte = byte << 1 | bits[i + j];
|
|
47
|
+
data.push(byte);
|
|
48
|
+
}
|
|
49
|
+
const grid = new Grid(version, LEVELS[level]);
|
|
50
|
+
grid.drawFunctionPatterns();
|
|
51
|
+
grid.drawCodewords(interleaveWithEcc(data, version, level));
|
|
52
|
+
let bestMask = 0;
|
|
53
|
+
let bestPenalty = Infinity;
|
|
54
|
+
for (let mask = 0; mask < 8; mask++) {
|
|
55
|
+
grid.applyMask(mask);
|
|
56
|
+
grid.drawFormatBits(mask);
|
|
57
|
+
const penalty = grid.penalty();
|
|
58
|
+
if (penalty < bestPenalty) {
|
|
59
|
+
bestMask = mask;
|
|
60
|
+
bestPenalty = penalty;
|
|
61
|
+
}
|
|
62
|
+
grid.applyMask(mask);
|
|
63
|
+
}
|
|
64
|
+
grid.applyMask(bestMask);
|
|
65
|
+
grid.drawFormatBits(bestMask);
|
|
66
|
+
return {
|
|
67
|
+
version,
|
|
68
|
+
size: grid.size,
|
|
69
|
+
errorCorrection: LEVELS[level],
|
|
70
|
+
mask: bestMask,
|
|
71
|
+
modules: grid.modules
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function rawDataModules(version) {
|
|
75
|
+
let result = (16 * version + 128) * version + 64;
|
|
76
|
+
if (version >= 2) {
|
|
77
|
+
const numAlign = Math.floor(version / 7) + 2;
|
|
78
|
+
result -= (25 * numAlign - 10) * numAlign - 55;
|
|
79
|
+
if (version >= 7) result -= 36;
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
function dataCodewords(version, level) {
|
|
84
|
+
return Math.floor(rawDataModules(version) / 8) - ECC_CODEWORDS_PER_BLOCK[level][version] * NUM_ERROR_CORRECTION_BLOCKS[level][version];
|
|
85
|
+
}
|
|
86
|
+
function interleaveWithEcc(data, version, level) {
|
|
87
|
+
const numBlocks = NUM_ERROR_CORRECTION_BLOCKS[level][version];
|
|
88
|
+
const eccLen = ECC_CODEWORDS_PER_BLOCK[level][version];
|
|
89
|
+
const rawCodewords = Math.floor(rawDataModules(version) / 8);
|
|
90
|
+
const numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
|
91
|
+
const shortBlockLen = Math.floor(rawCodewords / numBlocks);
|
|
92
|
+
const divisor = reedSolomonDivisor(eccLen);
|
|
93
|
+
const blocks = [];
|
|
94
|
+
for (let i = 0, k = 0; i < numBlocks; i++) {
|
|
95
|
+
const block = data.slice(k, k + shortBlockLen - eccLen + (i < numShortBlocks ? 0 : 1));
|
|
96
|
+
k += block.length;
|
|
97
|
+
const ecc = reedSolomonRemainder(block, divisor);
|
|
98
|
+
if (i < numShortBlocks) block.push(0);
|
|
99
|
+
blocks.push(block.concat(ecc));
|
|
100
|
+
}
|
|
101
|
+
const result = [];
|
|
102
|
+
for (let i = 0; i < blocks[0].length; i++) {
|
|
103
|
+
blocks.forEach((block, j) => {
|
|
104
|
+
if (i !== shortBlockLen - eccLen || j >= numShortBlocks) result.push(block[i]);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
function gfMultiply(x, y) {
|
|
110
|
+
let z = 0;
|
|
111
|
+
for (let i = 7; i >= 0; i--) {
|
|
112
|
+
z = z << 1 ^ (z >>> 7) * 285;
|
|
113
|
+
z ^= (y >>> i & 1) * x;
|
|
114
|
+
}
|
|
115
|
+
return z;
|
|
116
|
+
}
|
|
117
|
+
function reedSolomonDivisor(degree) {
|
|
118
|
+
const result = new Array(degree).fill(0);
|
|
119
|
+
result[degree - 1] = 1;
|
|
120
|
+
let root = 1;
|
|
121
|
+
for (let i = 0; i < degree; i++) {
|
|
122
|
+
for (let j = 0; j < degree; j++) {
|
|
123
|
+
result[j] = gfMultiply(result[j], root);
|
|
124
|
+
if (j + 1 < degree) result[j] ^= result[j + 1];
|
|
125
|
+
}
|
|
126
|
+
root = gfMultiply(root, 2);
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
function reedSolomonRemainder(data, divisor) {
|
|
131
|
+
const result = new Array(divisor.length).fill(0);
|
|
132
|
+
for (const b of data) {
|
|
133
|
+
const factor = b ^ result.shift();
|
|
134
|
+
result.push(0);
|
|
135
|
+
divisor.forEach((coef, i) => {
|
|
136
|
+
result[i] ^= gfMultiply(coef, factor);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
const bit = (value, i) => (value >>> i & 1) !== 0;
|
|
142
|
+
class Grid {
|
|
143
|
+
size;
|
|
144
|
+
modules;
|
|
145
|
+
reserved;
|
|
146
|
+
version;
|
|
147
|
+
level;
|
|
148
|
+
constructor(version, level) {
|
|
149
|
+
this.version = version;
|
|
150
|
+
this.level = level;
|
|
151
|
+
this.size = version * 4 + 17;
|
|
152
|
+
this.modules = Array.from({ length: this.size }, () => new Array(this.size).fill(false));
|
|
153
|
+
this.reserved = Array.from({ length: this.size }, () => new Array(this.size).fill(false));
|
|
154
|
+
}
|
|
155
|
+
set(x, y, dark) {
|
|
156
|
+
this.modules[y][x] = dark;
|
|
157
|
+
this.reserved[y][x] = true;
|
|
158
|
+
}
|
|
159
|
+
drawFunctionPatterns() {
|
|
160
|
+
const { size } = this;
|
|
161
|
+
for (let i = 0; i < size; i++) {
|
|
162
|
+
this.set(6, i, i % 2 === 0);
|
|
163
|
+
this.set(i, 6, i % 2 === 0);
|
|
164
|
+
}
|
|
165
|
+
this.drawFinder(3, 3);
|
|
166
|
+
this.drawFinder(size - 4, 3);
|
|
167
|
+
this.drawFinder(3, size - 4);
|
|
168
|
+
const align = this.alignmentPositions();
|
|
169
|
+
const n = align.length;
|
|
170
|
+
for (let i = 0; i < n; i++) {
|
|
171
|
+
for (let j = 0; j < n; j++) {
|
|
172
|
+
const corner = i === 0 && j === 0 || i === 0 && j === n - 1 || i === n - 1 && j === 0;
|
|
173
|
+
if (!corner) this.drawAlignment(align[i], align[j]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
this.drawFormatBits(0);
|
|
177
|
+
this.drawVersion();
|
|
178
|
+
}
|
|
179
|
+
drawFinder(x, y) {
|
|
180
|
+
for (let dy = -4; dy <= 4; dy++) {
|
|
181
|
+
for (let dx = -4; dx <= 4; dx++) {
|
|
182
|
+
const dist = Math.max(Math.abs(dx), Math.abs(dy));
|
|
183
|
+
const xx = x + dx;
|
|
184
|
+
const yy = y + dy;
|
|
185
|
+
if (xx >= 0 && xx < this.size && yy >= 0 && yy < this.size) {
|
|
186
|
+
this.set(xx, yy, dist !== 2 && dist !== 4);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
drawAlignment(x, y) {
|
|
192
|
+
for (let dy = -2; dy <= 2; dy++) {
|
|
193
|
+
for (let dx = -2; dx <= 2; dx++) {
|
|
194
|
+
this.set(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
alignmentPositions() {
|
|
199
|
+
if (this.version === 1) return [];
|
|
200
|
+
const numAlign = Math.floor(this.version / 7) + 2;
|
|
201
|
+
const step = Math.floor((this.version * 8 + numAlign * 3 + 5) / (numAlign * 4 - 4)) * 2;
|
|
202
|
+
const result = [6];
|
|
203
|
+
for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
drawFormatBits(mask) {
|
|
207
|
+
const data = FORMAT_BITS[this.level] << 3 | mask;
|
|
208
|
+
let rem = data;
|
|
209
|
+
for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
|
|
210
|
+
const bits = (data << 10 | rem) ^ 21522;
|
|
211
|
+
const { size } = this;
|
|
212
|
+
for (let i = 0; i <= 5; i++) this.set(8, i, bit(bits, i));
|
|
213
|
+
this.set(8, 7, bit(bits, 6));
|
|
214
|
+
this.set(8, 8, bit(bits, 7));
|
|
215
|
+
this.set(7, 8, bit(bits, 8));
|
|
216
|
+
for (let i = 9; i < 15; i++) this.set(14 - i, 8, bit(bits, i));
|
|
217
|
+
for (let i = 0; i < 8; i++) this.set(size - 1 - i, 8, bit(bits, i));
|
|
218
|
+
for (let i = 8; i < 15; i++) this.set(8, size - 15 + i, bit(bits, i));
|
|
219
|
+
this.set(8, size - 8, true);
|
|
220
|
+
}
|
|
221
|
+
drawVersion() {
|
|
222
|
+
if (this.version < 7) return;
|
|
223
|
+
let rem = this.version;
|
|
224
|
+
for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
|
|
225
|
+
const bits = this.version << 12 | rem;
|
|
226
|
+
for (let i = 0; i < 18; i++) {
|
|
227
|
+
const dark = bit(bits, i);
|
|
228
|
+
const a = this.size - 11 + i % 3;
|
|
229
|
+
const b = Math.floor(i / 3);
|
|
230
|
+
this.set(a, b, dark);
|
|
231
|
+
this.set(b, a, dark);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/** The zig-zag placement: two-module columns, right to left, alternating up and down. */
|
|
235
|
+
drawCodewords(data) {
|
|
236
|
+
const { size } = this;
|
|
237
|
+
let i = 0;
|
|
238
|
+
for (let right = size - 1; right >= 1; right -= 2) {
|
|
239
|
+
if (right === 6) right = 5;
|
|
240
|
+
for (let vert = 0; vert < size; vert++) {
|
|
241
|
+
for (let j = 0; j < 2; j++) {
|
|
242
|
+
const x = right - j;
|
|
243
|
+
const upward = (right + 1 & 2) === 0;
|
|
244
|
+
const y = upward ? size - 1 - vert : vert;
|
|
245
|
+
if (!this.reserved[y][x] && i < data.length * 8) {
|
|
246
|
+
this.modules[y][x] = bit(data[i >>> 3], 7 - (i & 7));
|
|
247
|
+
i++;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
applyMask(mask) {
|
|
254
|
+
for (let y = 0; y < this.size; y++) {
|
|
255
|
+
for (let x = 0; x < this.size; x++) {
|
|
256
|
+
if (!this.reserved[y][x] && maskBit(mask, x, y)) this.modules[y][x] = !this.modules[y][x];
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
penalty() {
|
|
261
|
+
const { size, modules } = this;
|
|
262
|
+
let result = 0;
|
|
263
|
+
const line = (get) => {
|
|
264
|
+
for (let a = 0; a < size; a++) {
|
|
265
|
+
let runColor = false;
|
|
266
|
+
let run = 0;
|
|
267
|
+
const history = [0, 0, 0, 0, 0, 0, 0];
|
|
268
|
+
for (let b = 0; b < size; b++) {
|
|
269
|
+
if (get(a, b) === runColor) {
|
|
270
|
+
run++;
|
|
271
|
+
if (run === 5) result += 3;
|
|
272
|
+
else if (run > 5) result++;
|
|
273
|
+
} else {
|
|
274
|
+
this.addHistory(run, history);
|
|
275
|
+
if (!runColor) result += this.countFinderLike(history) * 40;
|
|
276
|
+
runColor = get(a, b);
|
|
277
|
+
run = 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (runColor) {
|
|
281
|
+
this.addHistory(run, history);
|
|
282
|
+
run = 0;
|
|
283
|
+
}
|
|
284
|
+
this.addHistory(run + size, history);
|
|
285
|
+
result += this.countFinderLike(history) * 40;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
line((y, x) => modules[y][x]);
|
|
289
|
+
line((x, y) => modules[y][x]);
|
|
290
|
+
for (let y = 0; y < size - 1; y++) {
|
|
291
|
+
for (let x = 0; x < size - 1; x++) {
|
|
292
|
+
const c = modules[y][x];
|
|
293
|
+
if (c === modules[y][x + 1] && c === modules[y + 1][x] && c === modules[y + 1][x + 1]) {
|
|
294
|
+
result += 3;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
let dark = 0;
|
|
299
|
+
for (const row of modules) for (const m of row) if (m) dark++;
|
|
300
|
+
const total = size * size;
|
|
301
|
+
result += (Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1) * 10;
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
304
|
+
addHistory(run, history) {
|
|
305
|
+
if (history[0] === 0) run += this.size;
|
|
306
|
+
history.pop();
|
|
307
|
+
history.unshift(run);
|
|
308
|
+
}
|
|
309
|
+
countFinderLike(h) {
|
|
310
|
+
const n = h[1];
|
|
311
|
+
const core = n > 0 && h[2] === n && h[3] === n * 3 && h[4] === n && h[5] === n;
|
|
312
|
+
return (core && h[0] >= n * 4 && h[6] >= n ? 1 : 0) + (core && h[6] >= n * 4 && h[0] >= n ? 1 : 0);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function maskBit(mask, x, y) {
|
|
316
|
+
switch (mask) {
|
|
317
|
+
case 0:
|
|
318
|
+
return (x + y) % 2 === 0;
|
|
319
|
+
case 1:
|
|
320
|
+
return y % 2 === 0;
|
|
321
|
+
case 2:
|
|
322
|
+
return x % 3 === 0;
|
|
323
|
+
case 3:
|
|
324
|
+
return (x + y) % 3 === 0;
|
|
325
|
+
case 4:
|
|
326
|
+
return (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;
|
|
327
|
+
case 5:
|
|
328
|
+
return x * y % 2 + x * y % 3 === 0;
|
|
329
|
+
case 6:
|
|
330
|
+
return (x * y % 2 + x * y % 3) % 2 === 0;
|
|
331
|
+
default:
|
|
332
|
+
return ((x + y) % 2 + x * y % 3) % 2 === 0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
export {
|
|
336
|
+
encodeQr
|
|
337
|
+
};
|
|
338
|
+
//# sourceMappingURL=qr-encode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qr-encode.ts"],"sourcesContent":["/**\n * A QR code encoder: text in, a square of dark / light modules out (ISO/IEC 18004).\n *\n * WHY IT IS IN THE KIT rather than a dependency. `TwoFactorSetting` needs one QR code —\n * an `otpauth://` URI, around 100–200 bytes — and every app that shows it was pulling\n * in `qrcode.react` plus `react-dom/server` to render that one code to a static SVG\n * string, then base64-encoding it so the kit could draw it back as an `<img>`.\n * A dependency here would land in all three apps whether they show 2FA or not; an\n * optional peer would mean a lazy import and a loading state for something that is\n * a few hundred lines of arithmetic. So it is those lines: pure, no imports, no module\n * state beyond two constant tables, safe under `sideEffects: false`, and\n * tree-shaken out of every app that never renders a {@link QrCode}.\n *\n * Scope, chosen for what the kit renders: BYTE mode only (UTF-8), all 40 versions,\n * all four error-correction levels, automatic version and mask selection. Numeric,\n * alphanumeric and Kanji modes are denser for their alphabets but would not shrink an\n * otpauth URI (lower-case letters are not in the alphanumeric set). The algorithm and\n * its penalty rules follow the reference implementation by Project Nayuki (MIT),\n * which is also what `qrcode.react` wraps — so for the same input, level and boost\n * the modules match that library's output exactly (the test suite pins a matrix).\n */\n\nexport type QrErrorCorrection = \"L\" | \"M\" | \"Q\" | \"H\";\n\nexport interface QrEncodeOptions {\n /** How much of the code may be damaged and still read. Default `\"M\"` (~15 %). */\n errorCorrection?: QrErrorCorrection;\n /** Raise the level as far as the chosen version still fits, for free. Default true. */\n boostErrorCorrection?: boolean;\n}\n\nexport interface QrMatrix {\n /** 1–40. */\n version: number;\n /** Modules per side: `version * 4 + 17`. */\n size: number;\n /** The level actually used — higher than asked when boosted. */\n errorCorrection: QrErrorCorrection;\n /** 0–7. */\n mask: number;\n /** `modules[y][x]`, true = dark. No quiet zone: the renderer adds its own. */\n modules: boolean[][];\n}\n\nconst LEVELS: QrErrorCorrection[] = [\"L\", \"M\", \"Q\", \"H\"];\n/** The two format-information bits per level (not in ordinal order: M is 00). */\nconst FORMAT_BITS: Record<QrErrorCorrection, number> = { L: 1, M: 0, Q: 3, H: 2 };\n\n// Index 0 is padding; rows are L, M, Q, H.\nconst ECC_CODEWORDS_PER_BLOCK: readonly (readonly number[])[] = [\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];\nconst NUM_ERROR_CORRECTION_BLOCKS: readonly (readonly number[])[] = [\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];\n\n/** Encode `text` (as UTF-8 bytes). Throws a `RangeError` past version 40's capacity. */\nexport function encodeQr(text: string, options: QrEncodeOptions = {}): QrMatrix {\n const bytes = Array.from(new TextEncoder().encode(text));\n let level = LEVELS.indexOf(options.errorCorrection ?? \"M\");\n\n // The smallest version that holds the data at the requested level.\n let version = 1;\n let usedBits: number;\n for (; ; version++) {\n const countBits = version <= 9 ? 8 : 16;\n usedBits = bytes.length < 1 << countBits ? 4 + countBits + bytes.length * 8 : Infinity;\n if (usedBits <= dataCodewords(version, level) * 8) break;\n if (version >= 40) throw new RangeError(\"QR data too long\");\n }\n if (options.boostErrorCorrection ?? true) {\n for (let higher = level + 1; higher < LEVELS.length; higher++) {\n if (usedBits <= dataCodewords(version, higher) * 8) level = higher;\n }\n }\n\n // Mode, count, data; then terminator, byte padding and the 0xEC/0x11 fill.\n const bits: number[] = [];\n const append = (value: number, length: number) => {\n for (let i = length - 1; i >= 0; i--) bits.push((value >>> i) & 1);\n };\n append(0b0100, 4);\n append(bytes.length, version <= 9 ? 8 : 16);\n for (const b of bytes) append(b, 8);\n const capacity = dataCodewords(version, level) * 8;\n append(0, Math.min(4, capacity - bits.length));\n append(0, (8 - (bits.length % 8)) % 8);\n for (let pad = 0xec; bits.length < capacity; pad ^= 0xec ^ 0x11) append(pad, 8);\n\n const data: number[] = [];\n for (let i = 0; i < bits.length; i += 8) {\n let byte = 0;\n for (let j = 0; j < 8; j++) byte = (byte << 1) | bits[i + j];\n data.push(byte);\n }\n\n const grid = new Grid(version, LEVELS[level]);\n grid.drawFunctionPatterns();\n grid.drawCodewords(interleaveWithEcc(data, version, level));\n\n let bestMask = 0;\n let bestPenalty = Infinity;\n for (let mask = 0; mask < 8; mask++) {\n grid.applyMask(mask);\n grid.drawFormatBits(mask);\n const penalty = grid.penalty();\n if (penalty < bestPenalty) {\n bestMask = mask;\n bestPenalty = penalty;\n }\n grid.applyMask(mask); // XOR again undoes it\n }\n grid.applyMask(bestMask);\n grid.drawFormatBits(bestMask);\n\n return {\n version,\n size: grid.size,\n errorCorrection: LEVELS[level],\n mask: bestMask,\n modules: grid.modules,\n };\n}\n\nfunction rawDataModules(version: number): number {\n let result = (16 * version + 128) * version + 64;\n if (version >= 2) {\n const numAlign = Math.floor(version / 7) + 2;\n result -= (25 * numAlign - 10) * numAlign - 55;\n if (version >= 7) result -= 36;\n }\n return result;\n}\n\nfunction dataCodewords(version: number, level: number): number {\n return (\n Math.floor(rawDataModules(version) / 8) -\n ECC_CODEWORDS_PER_BLOCK[level][version] * NUM_ERROR_CORRECTION_BLOCKS[level][version]\n );\n}\n\n/** Split into blocks, append each block's Reed–Solomon codewords, interleave. */\nfunction interleaveWithEcc(data: number[], version: number, level: number): number[] {\n const numBlocks = NUM_ERROR_CORRECTION_BLOCKS[level][version];\n const eccLen = ECC_CODEWORDS_PER_BLOCK[level][version];\n const rawCodewords = Math.floor(rawDataModules(version) / 8);\n const numShortBlocks = numBlocks - (rawCodewords % numBlocks);\n const shortBlockLen = Math.floor(rawCodewords / numBlocks);\n const divisor = reedSolomonDivisor(eccLen);\n\n const blocks: number[][] = [];\n for (let i = 0, k = 0; i < numBlocks; i++) {\n const block = data.slice(k, k + shortBlockLen - eccLen + (i < numShortBlocks ? 0 : 1));\n k += block.length;\n const ecc = reedSolomonRemainder(block, divisor);\n if (i < numShortBlocks) block.push(0); // placeholder, skipped below\n blocks.push(block.concat(ecc));\n }\n\n const result: number[] = [];\n for (let i = 0; i < blocks[0].length; i++) {\n blocks.forEach((block, j) => {\n if (i !== shortBlockLen - eccLen || j >= numShortBlocks) result.push(block[i]);\n });\n }\n return result;\n}\n\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 reedSolomonDivisor(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 + 1];\n }\n root = gfMultiply(root, 0x02);\n }\n return result;\n}\n\nfunction reedSolomonRemainder(data: number[], divisor: number[]): number[] {\n const result = new Array<number>(divisor.length).fill(0);\n for (const b of data) {\n const factor = b ^ (result.shift() as number);\n result.push(0);\n divisor.forEach((coef, i) => {\n result[i] ^= gfMultiply(coef, factor);\n });\n }\n return result;\n}\n\nconst bit = (value: number, i: number) => ((value >>> i) & 1) !== 0;\n\nclass Grid {\n readonly size: number;\n readonly modules: boolean[][];\n private readonly reserved: boolean[][];\n private readonly version: number;\n private readonly level: QrErrorCorrection;\n\n constructor(version: number, level: QrErrorCorrection) {\n this.version = version;\n this.level = level;\n this.size = version * 4 + 17;\n this.modules = Array.from({ length: this.size }, () => new Array<boolean>(this.size).fill(false));\n this.reserved = Array.from({ length: this.size }, () => new Array<boolean>(this.size).fill(false));\n }\n\n private set(x: number, y: number, dark: boolean) {\n this.modules[y][x] = dark;\n this.reserved[y][x] = true;\n }\n\n drawFunctionPatterns() {\n const { size } = this;\n for (let i = 0; i < size; i++) {\n this.set(6, i, i % 2 === 0);\n this.set(i, 6, i % 2 === 0);\n }\n this.drawFinder(3, 3);\n this.drawFinder(size - 4, 3);\n this.drawFinder(3, size - 4);\n const align = this.alignmentPositions();\n const n = align.length;\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < n; j++) {\n const corner = (i === 0 && j === 0) || (i === 0 && j === n - 1) || (i === n - 1 && j === 0);\n if (!corner) this.drawAlignment(align[i], align[j]);\n }\n }\n this.drawFormatBits(0); // reserves the area; redrawn once the mask is chosen\n this.drawVersion();\n }\n\n private drawFinder(x: number, y: number) {\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 (xx >= 0 && xx < this.size && yy >= 0 && yy < this.size) {\n this.set(xx, yy, dist !== 2 && dist !== 4);\n }\n }\n }\n }\n\n private drawAlignment(x: number, y: number) {\n for (let dy = -2; dy <= 2; dy++) {\n for (let dx = -2; dx <= 2; dx++) {\n this.set(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);\n }\n }\n }\n\n private alignmentPositions(): number[] {\n if (this.version === 1) return [];\n const numAlign = Math.floor(this.version / 7) + 2;\n const step = Math.floor((this.version * 8 + numAlign * 3 + 5) / (numAlign * 4 - 4)) * 2;\n const result = [6];\n for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);\n return result;\n }\n\n drawFormatBits(mask: number) {\n const data = (FORMAT_BITS[this.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 { size } = this;\n for (let i = 0; i <= 5; i++) this.set(8, i, bit(bits, i));\n this.set(8, 7, bit(bits, 6));\n this.set(8, 8, bit(bits, 7));\n this.set(7, 8, bit(bits, 8));\n for (let i = 9; i < 15; i++) this.set(14 - i, 8, bit(bits, i));\n for (let i = 0; i < 8; i++) this.set(size - 1 - i, 8, bit(bits, i));\n for (let i = 8; i < 15; i++) this.set(8, size - 15 + i, bit(bits, i));\n this.set(8, size - 8, true); // the always-dark module\n }\n\n private drawVersion() {\n if (this.version < 7) return;\n let rem = this.version;\n for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n const bits = (this.version << 12) | rem;\n for (let i = 0; i < 18; i++) {\n const dark = bit(bits, i);\n const a = this.size - 11 + (i % 3);\n const b = Math.floor(i / 3);\n this.set(a, b, dark);\n this.set(b, a, dark);\n }\n }\n\n /** The zig-zag placement: two-module columns, right to left, alternating up and down. */\n drawCodewords(data: number[]) {\n const { size } = this;\n let i = 0;\n for (let right = size - 1; right >= 1; right -= 2) {\n if (right === 6) right = 5; // skip the vertical timing column\n for (let vert = 0; vert < 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 ? size - 1 - vert : vert;\n if (!this.reserved[y][x] && i < data.length * 8) {\n this.modules[y][x] = bit(data[i >>> 3], 7 - (i & 7));\n i++;\n }\n }\n }\n }\n }\n\n applyMask(mask: number) {\n for (let y = 0; y < this.size; y++) {\n for (let x = 0; x < this.size; x++) {\n if (!this.reserved[y][x] && maskBit(mask, x, y)) this.modules[y][x] = !this.modules[y][x];\n }\n }\n }\n\n penalty(): number {\n const { size, modules } = this;\n let result = 0;\n const line = (get: (a: number, b: number) => boolean) => {\n for (let a = 0; a < size; a++) {\n let runColor = false;\n let run = 0;\n const history = [0, 0, 0, 0, 0, 0, 0];\n for (let b = 0; b < size; b++) {\n if (get(a, b) === runColor) {\n run++;\n if (run === 5) result += 3;\n else if (run > 5) result++;\n } else {\n this.addHistory(run, history);\n if (!runColor) result += this.countFinderLike(history) * 40;\n runColor = get(a, b);\n run = 1;\n }\n }\n if (runColor) {\n this.addHistory(run, history);\n run = 0;\n }\n this.addHistory(run + size, history);\n result += this.countFinderLike(history) * 40;\n }\n };\n line((y, x) => modules[y][x]);\n line((x, y) => modules[y][x]);\n\n for (let y = 0; y < size - 1; y++) {\n for (let x = 0; x < size - 1; x++) {\n const c = modules[y][x];\n if (c === modules[y][x + 1] && c === modules[y + 1][x] && c === modules[y + 1][x + 1]) {\n result += 3;\n }\n }\n }\n\n let dark = 0;\n for (const row of modules) for (const m of row) if (m) dark++;\n const total = size * size;\n result += (Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1) * 10;\n return result;\n }\n\n private addHistory(run: number, history: number[]) {\n if (history[0] === 0) run += this.size; // the light border before the first run\n history.pop();\n history.unshift(run);\n }\n\n private countFinderLike(h: number[]): number {\n const n = h[1];\n const core = n > 0 && h[2] === n && h[3] === n * 3 && h[4] === n && h[5] === n;\n return (core && h[0] >= n * 4 && h[6] >= n ? 1 : 0) + (core && h[6] >= n * 4 && h[0] >= n ? 1 : 0);\n }\n}\n\nfunction maskBit(mask: number, x: number, y: number): boolean {\n switch (mask) {\n case 0:\n return (x + y) % 2 === 0;\n case 1:\n return y % 2 === 0;\n case 2:\n return x % 3 === 0;\n case 3:\n return (x + y) % 3 === 0;\n case 4:\n return (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;\n case 5:\n return ((x * y) % 2) + ((x * y) % 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