@memobit/libs 3.0.0 → 3.1.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/dist/components/Accordion/Accordion.css +1 -0
- package/dist/components/Accordion/Accordion2.js +79 -0
- package/dist/components/AlertDialog/AlertDialog.css +1 -0
- package/dist/components/AlertDialog/AlertDialog2.js +26 -0
- package/dist/components/AnalogClock/AnalogClock.css +1 -0
- package/dist/components/AnalogClock/AnalogClock2.js +293 -0
- package/dist/components/AngleSlider/AngleSlider.css +1 -0
- package/dist/components/AngleSlider/AngleSlider2.js +135 -0
- package/dist/components/AppHeader/AppHeader.css +1 -0
- package/dist/components/AppHeader/AppHeader2.js +44 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal.css +1 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +138 -0
- package/dist/components/Auth/Login/Login.css +1 -0
- package/dist/components/Auth/Login/Login2.js +155 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal.css +1 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +327 -0
- package/dist/components/AvatarInitials/AvatarInitials.css +1 -0
- package/dist/components/AvatarInitials/AvatarInitials2.js +73 -0
- package/dist/components/BMI/BMI.css +1 -0
- package/dist/components/BMI/BMI2.js +53 -0
- package/dist/components/BMI/bmiUtils.js +265 -0
- package/dist/components/Badge/Badge.css +1 -0
- package/dist/components/Badge/Badge2.js +30 -0
- package/dist/components/Banner/Banner.css +1 -0
- package/dist/components/Banner/Banner2.js +57 -0
- package/dist/components/Blockquote/Blockquote.css +1 -0
- package/dist/components/Blockquote/Blockquote2.js +55 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +1 -0
- package/dist/components/Breadcrumb/Breadcrumb2.js +36 -0
- package/dist/components/BulkActionBar/BulkActionBar.css +1 -0
- package/dist/components/BulkActionBar/BulkActionBar2.js +39 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button2.js +32 -0
- package/dist/components/Calendar/Calendar.css +1 -0
- package/dist/components/Calendar/Calendar2.js +279 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap.css +1 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap2.js +91 -0
- package/dist/components/Card/Card.css +1 -0
- package/dist/components/Card/Card2.js +47 -0
- package/dist/components/Checkbox/Checkbox.css +1 -0
- package/dist/components/Checkbox/Checkbox2.js +35 -0
- package/dist/components/Chip/Chip.css +1 -0
- package/dist/components/Chip/Chip2.js +31 -0
- package/dist/components/CollapsibleSection/CollapsibleSection.css +1 -0
- package/dist/components/CollapsibleSection/CollapsibleSection2.js +68 -0
- package/dist/components/ColorPicker/ColorPicker.css +1 -0
- package/dist/components/ColorPicker/ColorPicker2.js +257 -0
- package/dist/components/CommandPalette/CommandPalette.css +1 -0
- package/dist/components/CommandPalette/CommandPalette2.js +97 -0
- package/dist/components/Confetti/Confetti.css +1 -0
- package/dist/components/Confetti/Confetti2.js +175 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.css +1 -0
- package/dist/components/ConfirmDialog/ConfirmDialog2.js +37 -0
- package/dist/components/ConfirmPopover/ConfirmPopover.css +1 -0
- package/dist/components/ConfirmPopover/ConfirmPopover2.js +55 -0
- package/dist/components/ContextMenu/ContextMenu.css +1 -0
- package/dist/components/ContextMenu/ContextMenu2.js +53 -0
- package/dist/components/ContextToast/ContextToast.css +1 -0
- package/dist/components/ContextToast/ContextToast2.js +96 -0
- package/dist/components/ControlPanel/ControlPanel.css +1 -0
- package/dist/components/ControlPanel/ControlPanel.types.js +21 -0
- package/dist/components/ControlPanel/ControlPanel2.js +137 -0
- package/dist/components/ControlPanel/ControlPanelContext.js +31 -0
- package/dist/components/ControlPanel/ControlPanelFilter.js +386 -0
- package/dist/components/ControlPanel/ControlPanelNav.js +74 -0
- package/dist/components/ControlPanel/ControlPanelOptions.js +197 -0
- package/dist/components/CopyButton/CopyButton.css +1 -0
- package/dist/components/CopyButton/CopyButton2.js +48 -0
- package/dist/components/CountryWithFlag/CountryWithFlag.css +1 -0
- package/dist/components/CountryWithFlag/CountryWithFlag2.js +21 -0
- package/dist/components/DataView/DataView.CardView.js +189 -0
- package/dist/components/DataView/DataView.ColumnSelector.js +51 -0
- package/dist/components/DataView/DataView.MiniSort.js +25 -0
- package/dist/components/DataView/DataView.css +1 -0
- package/dist/components/DataView/DataView2.js +433 -0
- package/dist/components/DatePicker/DatePicker.css +1 -0
- package/dist/components/DatePicker/DatePicker2.js +151 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +1 -0
- package/dist/components/DateRangePicker/DateRangePicker2.js +223 -0
- package/dist/components/DayAgenda/DayAgenda.css +1 -0
- package/dist/components/DayAgenda/DayAgenda2.js +120 -0
- package/dist/components/DiffViewer/DiffViewer.css +1 -0
- package/dist/components/DiffViewer/DiffViewer2.js +270 -0
- package/dist/components/Drawer/Drawer.css +1 -0
- package/dist/components/Drawer/Drawer2.js +119 -0
- package/dist/components/Dropdown/Dropdown.css +1 -0
- package/dist/components/Dropdown/Dropdown2.js +413 -0
- package/dist/components/EmojiPicker/EmojiPicker.css +1 -0
- package/dist/components/EmojiPicker/EmojiPicker2.js +789 -0
- package/dist/components/EmojiPicker/emojiKeywords/activities.js +508 -0
- package/dist/components/EmojiPicker/emojiKeywords/animals.js +501 -0
- package/dist/components/EmojiPicker/emojiKeywords/food.js +540 -0
- package/dist/components/EmojiPicker/emojiKeywords/index.js +21 -0
- package/dist/components/EmojiPicker/emojiKeywords/objects.js +652 -0
- package/dist/components/EmojiPicker/emojiKeywords/people.js +488 -0
- package/dist/components/EmojiPicker/emojiKeywords/smileys.js +538 -0
- package/dist/components/EmojiPicker/emojiKeywords/symbols.js +597 -0
- package/dist/components/EmojiPicker/emojiKeywords/travel.js +507 -0
- package/dist/components/EmptyState/EmptyState.css +1 -0
- package/dist/components/EmptyState/EmptyState2.js +47 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.css +1 -0
- package/dist/components/ErrorBoundary/ErrorBoundary2.js +37 -0
- package/dist/components/EventCalendar/EventCalendar.Chip.js +45 -0
- package/dist/components/EventCalendar/EventCalendar.Month.js +118 -0
- package/dist/components/EventCalendar/EventCalendar.Week.js +131 -0
- package/dist/components/EventCalendar/EventCalendar.css +1 -0
- package/dist/components/EventCalendar/EventCalendar.helpers.js +72 -0
- package/dist/components/EventCalendar/EventCalendar2.js +157 -0
- package/dist/components/FileDropzone/FileDropzone.css +1 -0
- package/dist/components/FileDropzone/FileDropzone2.js +71 -0
- package/dist/components/Flag/Flag.css +1 -0
- package/dist/components/Flag/Flag2.js +36 -0
- package/dist/components/FloatButton/FloatButton.css +1 -0
- package/dist/components/FloatButton/FloatButton2.js +68 -0
- package/dist/components/FloatingWindow/FloatingWindow.css +1 -0
- package/dist/components/FloatingWindow/FloatingWindow2.js +203 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal.css +1 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal2.js +144 -0
- package/dist/components/Grid/Col.js +17 -0
- package/dist/components/Grid/Grid.css +1 -0
- package/dist/components/Grid/Grid2.js +28 -0
- package/dist/components/Icon/Icon.css +1 -0
- package/dist/components/Icon/Icon2.js +23 -0
- package/dist/components/IconPicker/IconPicker.css +1 -0
- package/dist/components/IconPicker/IconPicker2.js +51 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.css +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll2.js +66 -0
- package/dist/components/InputDate/InputDate.css +1 -0
- package/dist/components/InputDate/InputDate2.js +87 -0
- package/dist/components/InputEmail/InputEmail.css +1 -0
- package/dist/components/InputEmail/InputEmail2.js +73 -0
- package/dist/components/InputFile/InputFile.css +1 -0
- package/dist/components/InputFile/InputFile2.js +41 -0
- package/dist/components/InputMask/InputMask.css +1 -0
- package/dist/components/InputMask/InputMask2.js +163 -0
- package/dist/components/InputNumber/InputNumber.css +1 -0
- package/dist/components/InputNumber/InputNumber2.js +60 -0
- package/dist/components/InputPIN/InputPIN.css +1 -0
- package/dist/components/InputPIN/InputPIN2.js +121 -0
- package/dist/components/InputPassword/InputPassword.css +1 -0
- package/dist/components/InputPassword/InputPassword2.js +47 -0
- package/dist/components/InputPhone/InputPhone.css +1 -0
- package/dist/components/InputPhone/InputPhone2.js +82 -0
- package/dist/components/InputSearch/InputSearch.css +1 -0
- package/dist/components/InputSearch/InputSearch2.js +53 -0
- package/dist/components/InputText/InputText.css +1 -0
- package/dist/components/InputText/InputText2.js +47 -0
- package/dist/components/InputTextarea/InputTextarea.css +1 -0
- package/dist/components/InputTextarea/InputTextarea2.js +46 -0
- package/dist/components/InputTime/InputTime.css +1 -0
- package/dist/components/InputTime/InputTime2.js +85 -0
- package/dist/components/InputUrl/InputUrl.css +1 -0
- package/dist/components/InputUrl/InputUrl2.js +65 -0
- package/dist/components/JourneyWizard/JourneyWizard.css +1 -0
- package/dist/components/JourneyWizard/JourneyWizard2.js +147 -0
- package/dist/components/List/List.css +1 -0
- package/dist/components/List/List2.js +28 -0
- package/dist/components/Loading/Loading.css +1 -0
- package/dist/components/Loading/Loading2.js +11 -0
- package/dist/components/MenuHamburger/MenuHamburger.css +1 -0
- package/dist/components/MenuHamburger/MenuHamburger2.js +65 -0
- package/dist/components/MiniSort/MiniSort.css +1 -0
- package/dist/components/MiniSort/MiniSort2.js +52 -0
- package/dist/components/MiniStatsCard/MiniStatsCard.css +1 -0
- package/dist/components/MiniStatsCard/MiniStatsCard2.js +67 -0
- package/dist/components/Minimap/Minimap.css +1 -0
- package/dist/components/Minimap/Minimap2.js +62 -0
- package/dist/components/Modal/Modal.css +1 -0
- package/dist/components/Modal/Modal2.js +87 -0
- package/dist/components/NavBar/NavBar.css +1 -0
- package/dist/components/NavBar/NavBar2.js +64 -0
- package/dist/components/NotificationPanel/NotificationPanel.css +1 -0
- package/dist/components/NotificationPanel/NotificationPanel2.js +66 -0
- package/dist/components/Pagination/Pagination.css +1 -0
- package/dist/components/Pagination/Pagination2.js +92 -0
- package/dist/components/PieChart/PieChart.css +1 -0
- package/dist/components/PieChart/PieChart2.js +142 -0
- package/dist/components/Popover/Popover.css +1 -0
- package/dist/components/Popover/Popover2.js +109 -0
- package/dist/components/Popover/hooks/Popover.hook.js +33 -0
- package/dist/components/ProgressBar/ProgressBar.css +1 -0
- package/dist/components/ProgressBar/ProgressBar2.js +48 -0
- package/dist/components/ProgressRing/ProgressRing.css +1 -0
- package/dist/components/ProgressRing/ProgressRing2.js +54 -0
- package/dist/components/QuantitySelector/QuantitySelector.css +1 -0
- package/dist/components/QuantitySelector/QuantitySelector2.js +94 -0
- package/dist/components/QuickAdd/QuickAdd.css +1 -0
- package/dist/components/QuickAdd/QuickAdd2.js +56 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate.css +1 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate2.js +52 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate.css +1 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate2.js +67 -0
- package/dist/components/Radio/Radio.css +1 -0
- package/dist/components/Radio/Radio2.js +36 -0
- package/dist/components/RangeSlider/RangeSlider.css +1 -0
- package/dist/components/RangeSlider/RangeSlider2.js +157 -0
- package/dist/components/Rating/Rating.css +1 -0
- package/dist/components/Rating/Rating2.js +148 -0
- package/dist/components/Rating/RatingIcon.js +102 -0
- package/dist/components/RichTextEditor/RichTextEditor.css +1 -0
- package/dist/components/RichTextEditor/RichTextEditor2.js +212 -0
- package/dist/components/RichTextEditor/RteLinkPrompt.js +42 -0
- package/dist/components/RichTextEditor/RteTableToolbar.js +95 -0
- package/dist/components/RichTextEditor/RteToolbar.js +106 -0
- package/dist/components/RichTextEditor/helpers.js +73 -0
- package/dist/components/RichTextEditor/hooks/useEditorHistory.js +39 -0
- package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +61 -0
- package/dist/components/RichTextEditor/hooks/useTableOps.js +134 -0
- package/dist/components/RollingNumber/RollingNumber.css +1 -0
- package/dist/components/RollingNumber/RollingNumber2.js +71 -0
- package/dist/components/ScrollToTop/ScrollToTop.css +1 -0
- package/dist/components/ScrollToTop/ScrollToTop2.js +40 -0
- package/dist/components/Separator/Separator.css +1 -0
- package/dist/components/Separator/Separator2.js +39 -0
- package/dist/components/Sidebar/Sidebar.css +1 -0
- package/dist/components/Sidebar/Sidebar2.js +115 -0
- package/dist/components/Sidebar/SidebarContext.js +31 -0
- package/dist/components/SignalStrength/SignalStrength.css +1 -0
- package/dist/components/SignalStrength/SignalStrength2.js +56 -0
- package/dist/components/Skeleton/Skeleton.css +1 -0
- package/dist/components/Skeleton/Skeleton2.js +50 -0
- package/dist/components/Slider/Slider.css +1 -0
- package/dist/components/Slider/Slider2.js +39 -0
- package/dist/components/SplitPanel/SplitPanel.css +1 -0
- package/dist/components/SplitPanel/SplitPanel2.js +69 -0
- package/dist/components/Splitter/Splitter.css +1 -0
- package/dist/components/Splitter/Splitter2.js +89 -0
- package/dist/components/StackedBar/StackedBar.css +1 -0
- package/dist/components/StackedBar/StackedBar2.js +50 -0
- package/dist/components/Stats/Stats.css +1 -0
- package/dist/components/Stats/Stats2.js +26 -0
- package/dist/components/StickyBar/StickyBar.css +1 -0
- package/dist/components/StickyBar/StickyBar2.js +29 -0
- package/dist/components/SuggestionsList/SuggestionsList.css +1 -0
- package/dist/components/SuggestionsList/SuggestionsList2.js +121 -0
- package/dist/components/ThemeSettings/ThemeContext.js +138 -0
- package/dist/components/ThemeSettings/ThemeContextValue.js +5 -0
- package/dist/components/ThemeSettings/ThemeSettings.css +1 -0
- package/dist/components/ThemeSettings/ThemeSettings2.js +245 -0
- package/dist/components/ThemeSettings/themeConfig.js +7 -0
- package/dist/components/ThemeSettings/useTheme.js +10 -0
- package/dist/components/TimePicker/TimePicker.css +1 -0
- package/dist/components/TimePicker/TimePicker2.js +118 -0
- package/dist/components/TimePicker/TimeSpinner.js +59 -0
- package/dist/components/Timeline/Timeline.css +1 -0
- package/dist/components/Timeline/Timeline2.js +57 -0
- package/dist/components/TimelineMarkers/TimelineMarkers.css +1 -0
- package/dist/components/TimelineMarkers/TimelineMarkers2.js +73 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay.css +1 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +24 -0
- package/dist/components/Toast/Toast.css +1 -0
- package/dist/components/Toast/Toast2.js +39 -0
- package/dist/components/ToggleButtons/ToggleButtons.css +1 -0
- package/dist/components/ToggleButtons/ToggleButtons2.js +47 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.css +1 -0
- package/dist/components/ToggleSwitch/ToggleSwitch2.js +27 -0
- package/dist/components/Toolbar/Toolbar.css +1 -0
- package/dist/components/Toolbar/Toolbar2.js +129 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip2.js +93 -0
- package/dist/components/TourHud/TourHud.css +1 -0
- package/dist/components/TourHud/TourHud2.js +70 -0
- package/dist/components/Transition/Transition.css +1 -0
- package/dist/components/Transition/Transition2.js +68 -0
- package/dist/components/Tree/Tree.css +1 -0
- package/dist/components/Tree/Tree2.js +95 -0
- package/dist/components/VirtualList/VirtualList.css +1 -0
- package/dist/components/VirtualList/VirtualList2.js +64 -0
- package/dist/components/WHtR/WHtR.css +1 -0
- package/dist/components/WHtR/WHtR2.js +115 -0
- package/dist/contexts/AuthContext/AuthContext.js +113 -0
- package/dist/helpers/AppPersistenceStorage.js +50 -0
- package/dist/helpers/Datetime.js +114 -0
- package/dist/helpers/Format.js +21 -0
- package/dist/helpers/Highlight.js +36 -0
- package/dist/helpers/HtmlContent.js +118 -0
- package/dist/helpers/LogicalOperators.js +15 -0
- package/dist/helpers/Numbers.js +15 -0
- package/dist/helpers/Pagination.js +7 -0
- package/dist/helpers/Search.js +15 -0
- package/dist/helpers/Strings.js +10 -0
- package/dist/helpers/Urls.js +68 -0
- package/dist/helpers/VersionInfo.js +36 -0
- package/dist/hooks/useAppPersistence.js +51 -0
- package/dist/hooks/useAuth/useAuth.js +10 -0
- package/dist/hooks/useBodyScrollLock.js +31 -0
- package/dist/hooks/useBreakpoint.js +65 -0
- package/dist/hooks/useComponentEffect.js +8 -0
- package/dist/hooks/useSwipe.js +45 -0
- package/dist/index.css +1 -2
- package/dist/index.esm.js +1 -17211
- package/dist/index.js +348 -0
- package/dist/mfa.js +4 -0
- package/dist/node_modules/qrcode.react/lib/esm/index.js +979 -0
- package/dist/validators/Vin.js +69 -0
- package/dist/version.js +8 -0
- package/dist/version.json +4 -4
- package/package.json +8 -7
- package/dist/mfa.esm.js +0 -1293
- package/dist/useAuth-BBqdDG2z.js +0 -467
|
@@ -0,0 +1,979 @@
|
|
|
1
|
+
import w from "react";
|
|
2
|
+
var ie = Object.defineProperty, D = Object.getOwnPropertySymbols, Y = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable, G = (u, l, s) => l in u ? ie(u, l, {
|
|
3
|
+
enumerable: !0,
|
|
4
|
+
configurable: !0,
|
|
5
|
+
writable: !0,
|
|
6
|
+
value: s
|
|
7
|
+
}) : u[l] = s, z = (u, l) => {
|
|
8
|
+
for (var s in l || (l = {})) Y.call(l, s) && G(u, s, l[s]);
|
|
9
|
+
if (D)
|
|
10
|
+
for (var s of D(l)) V.call(l, s) && G(u, s, l[s]);
|
|
11
|
+
return u;
|
|
12
|
+
}, U = (u, l) => {
|
|
13
|
+
var s = {};
|
|
14
|
+
for (var c in u) Y.call(u, c) && l.indexOf(c) < 0 && (s[c] = u[c]);
|
|
15
|
+
if (u != null && D)
|
|
16
|
+
for (var c of D(u)) l.indexOf(c) < 0 && V.call(u, c) && (s[c] = u[c]);
|
|
17
|
+
return s;
|
|
18
|
+
}, S;
|
|
19
|
+
((u) => {
|
|
20
|
+
const l = class m {
|
|
21
|
+
constructor(e, n, t, r) {
|
|
22
|
+
if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < m.MIN_VERSION || e > m.MAX_VERSION) throw new RangeError("Version value out of range");
|
|
23
|
+
if (r < -1 || r > 7) throw new RangeError("Mask value out of range");
|
|
24
|
+
this.size = e * 4 + 17;
|
|
25
|
+
let o = [];
|
|
26
|
+
for (let i = 0; i < this.size; i++) o.push(!1);
|
|
27
|
+
for (let i = 0; i < this.size; i++)
|
|
28
|
+
this.modules.push(o.slice()), this.isFunction.push(o.slice());
|
|
29
|
+
this.drawFunctionPatterns();
|
|
30
|
+
const a = this.addEccAndInterleave(t);
|
|
31
|
+
if (this.drawCodewords(a), r == -1) {
|
|
32
|
+
let i = 1e9;
|
|
33
|
+
for (let E = 0; E < 8; E++) {
|
|
34
|
+
this.applyMask(E), this.drawFormatBits(E);
|
|
35
|
+
const f = this.getPenaltyScore();
|
|
36
|
+
f < i && (r = E, i = f), this.applyMask(E);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
g(0 <= r && r <= 7), this.mask = r, this.applyMask(r), this.drawFormatBits(r), this.isFunction = [];
|
|
40
|
+
}
|
|
41
|
+
static encodeText(e, n) {
|
|
42
|
+
const t = u.QrSegment.makeSegments(e);
|
|
43
|
+
return m.encodeSegments(t, n);
|
|
44
|
+
}
|
|
45
|
+
static encodeBinary(e, n) {
|
|
46
|
+
const t = u.QrSegment.makeBytes(e);
|
|
47
|
+
return m.encodeSegments([t], n);
|
|
48
|
+
}
|
|
49
|
+
static encodeSegments(e, n, t = 1, r = 40, o = -1, a = !0) {
|
|
50
|
+
if (!(m.MIN_VERSION <= t && t <= r && r <= m.MAX_VERSION) || o < -1 || o > 7) throw new RangeError("Invalid value");
|
|
51
|
+
let i, E;
|
|
52
|
+
for (i = t; ; i++) {
|
|
53
|
+
const d = m.getNumDataCodewords(i, n) * 8, R = p.getTotalBits(e, i);
|
|
54
|
+
if (R <= d) {
|
|
55
|
+
E = R;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
if (i >= r) throw new RangeError("Data too long");
|
|
59
|
+
}
|
|
60
|
+
for (const d of [
|
|
61
|
+
m.Ecc.MEDIUM,
|
|
62
|
+
m.Ecc.QUARTILE,
|
|
63
|
+
m.Ecc.HIGH
|
|
64
|
+
]) a && E <= m.getNumDataCodewords(i, d) * 8 && (n = d);
|
|
65
|
+
let f = [];
|
|
66
|
+
for (const d of e) {
|
|
67
|
+
s(d.mode.modeBits, 4, f), s(d.numChars, d.mode.numCharCountBits(i), f);
|
|
68
|
+
for (const R of d.getData()) f.push(R);
|
|
69
|
+
}
|
|
70
|
+
g(f.length == E);
|
|
71
|
+
const N = m.getNumDataCodewords(i, n) * 8;
|
|
72
|
+
g(f.length <= N), s(0, Math.min(4, N - f.length), f), s(0, (8 - f.length % 8) % 8, f), g(f.length % 8 == 0);
|
|
73
|
+
for (let d = 236; f.length < N; d ^= 253) s(d, 8, f);
|
|
74
|
+
let A = [];
|
|
75
|
+
for (; A.length * 8 < f.length; ) A.push(0);
|
|
76
|
+
return f.forEach((d, R) => A[R >>> 3] |= d << 7 - (R & 7)), new m(i, n, A, o);
|
|
77
|
+
}
|
|
78
|
+
getModule(e, n) {
|
|
79
|
+
return 0 <= e && e < this.size && 0 <= n && n < this.size && this.modules[n][e];
|
|
80
|
+
}
|
|
81
|
+
getModules() {
|
|
82
|
+
return this.modules;
|
|
83
|
+
}
|
|
84
|
+
drawFunctionPatterns() {
|
|
85
|
+
for (let t = 0; t < this.size; t++)
|
|
86
|
+
this.setFunctionModule(6, t, t % 2 == 0), this.setFunctionModule(t, 6, t % 2 == 0);
|
|
87
|
+
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
88
|
+
const e = this.getAlignmentPatternPositions(), n = e.length;
|
|
89
|
+
for (let t = 0; t < n; t++) for (let r = 0; r < n; r++) t == 0 && r == 0 || t == 0 && r == n - 1 || t == n - 1 && r == 0 || this.drawAlignmentPattern(e[t], e[r]);
|
|
90
|
+
this.drawFormatBits(0), this.drawVersion();
|
|
91
|
+
}
|
|
92
|
+
drawFormatBits(e) {
|
|
93
|
+
const n = this.errorCorrectionLevel.formatBits << 3 | e;
|
|
94
|
+
let t = n;
|
|
95
|
+
for (let o = 0; o < 10; o++) t = t << 1 ^ (t >>> 9) * 1335;
|
|
96
|
+
const r = (n << 10 | t) ^ 21522;
|
|
97
|
+
g(r >>> 15 == 0);
|
|
98
|
+
for (let o = 0; o <= 5; o++) this.setFunctionModule(8, o, c(r, o));
|
|
99
|
+
this.setFunctionModule(8, 7, c(r, 6)), this.setFunctionModule(8, 8, c(r, 7)), this.setFunctionModule(7, 8, c(r, 8));
|
|
100
|
+
for (let o = 9; o < 15; o++) this.setFunctionModule(14 - o, 8, c(r, o));
|
|
101
|
+
for (let o = 0; o < 8; o++) this.setFunctionModule(this.size - 1 - o, 8, c(r, o));
|
|
102
|
+
for (let o = 8; o < 15; o++) this.setFunctionModule(8, this.size - 15 + o, c(r, o));
|
|
103
|
+
this.setFunctionModule(8, this.size - 8, !0);
|
|
104
|
+
}
|
|
105
|
+
drawVersion() {
|
|
106
|
+
if (this.version < 7) return;
|
|
107
|
+
let e = this.version;
|
|
108
|
+
for (let t = 0; t < 12; t++) e = e << 1 ^ (e >>> 11) * 7973;
|
|
109
|
+
const n = this.version << 12 | e;
|
|
110
|
+
g(n >>> 18 == 0);
|
|
111
|
+
for (let t = 0; t < 18; t++) {
|
|
112
|
+
const r = c(n, t), o = this.size - 11 + t % 3, a = Math.floor(t / 3);
|
|
113
|
+
this.setFunctionModule(o, a, r), this.setFunctionModule(a, o, r);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
drawFinderPattern(e, n) {
|
|
117
|
+
for (let t = -4; t <= 4; t++) for (let r = -4; r <= 4; r++) {
|
|
118
|
+
const o = Math.max(Math.abs(r), Math.abs(t)), a = e + r, i = n + t;
|
|
119
|
+
0 <= a && a < this.size && 0 <= i && i < this.size && this.setFunctionModule(a, i, o != 2 && o != 4);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
drawAlignmentPattern(e, n) {
|
|
123
|
+
for (let t = -2; t <= 2; t++) for (let r = -2; r <= 2; r++) this.setFunctionModule(e + r, n + t, Math.max(Math.abs(r), Math.abs(t)) != 1);
|
|
124
|
+
}
|
|
125
|
+
setFunctionModule(e, n, t) {
|
|
126
|
+
this.modules[n][e] = t, this.isFunction[n][e] = !0;
|
|
127
|
+
}
|
|
128
|
+
addEccAndInterleave(e) {
|
|
129
|
+
const n = this.version, t = this.errorCorrectionLevel;
|
|
130
|
+
if (e.length != m.getNumDataCodewords(n, t)) throw new RangeError("Invalid argument");
|
|
131
|
+
const r = m.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][n], o = m.ECC_CODEWORDS_PER_BLOCK[t.ordinal][n], a = Math.floor(m.getNumRawDataModules(n) / 8), i = r - a % r, E = Math.floor(a / r);
|
|
132
|
+
let f = [];
|
|
133
|
+
const N = m.reedSolomonComputeDivisor(o);
|
|
134
|
+
for (let d = 0, R = 0; d < r; d++) {
|
|
135
|
+
let v = e.slice(R, R + E - o + (d < i ? 0 : 1));
|
|
136
|
+
R += v.length;
|
|
137
|
+
const O = m.reedSolomonComputeRemainder(v, N);
|
|
138
|
+
d < i && v.push(0), f.push(v.concat(O));
|
|
139
|
+
}
|
|
140
|
+
let A = [];
|
|
141
|
+
for (let d = 0; d < f[0].length; d++) f.forEach((R, v) => {
|
|
142
|
+
(d != E - o || v >= i) && A.push(R[d]);
|
|
143
|
+
});
|
|
144
|
+
return g(A.length == a), A;
|
|
145
|
+
}
|
|
146
|
+
drawCodewords(e) {
|
|
147
|
+
if (e.length != Math.floor(m.getNumRawDataModules(this.version) / 8)) throw new RangeError("Invalid argument");
|
|
148
|
+
let n = 0;
|
|
149
|
+
for (let t = this.size - 1; t >= 1; t -= 2) {
|
|
150
|
+
t == 6 && (t = 5);
|
|
151
|
+
for (let r = 0; r < this.size; r++) for (let o = 0; o < 2; o++) {
|
|
152
|
+
const a = t - o, i = (t + 1 & 2) == 0 ? this.size - 1 - r : r;
|
|
153
|
+
!this.isFunction[i][a] && n < e.length * 8 && (this.modules[i][a] = c(e[n >>> 3], 7 - (n & 7)), n++);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
g(n == e.length * 8);
|
|
157
|
+
}
|
|
158
|
+
applyMask(e) {
|
|
159
|
+
if (e < 0 || e > 7) throw new RangeError("Mask value out of range");
|
|
160
|
+
for (let n = 0; n < this.size; n++) for (let t = 0; t < this.size; t++) {
|
|
161
|
+
let r;
|
|
162
|
+
switch (e) {
|
|
163
|
+
case 0:
|
|
164
|
+
r = (t + n) % 2 == 0;
|
|
165
|
+
break;
|
|
166
|
+
case 1:
|
|
167
|
+
r = n % 2 == 0;
|
|
168
|
+
break;
|
|
169
|
+
case 2:
|
|
170
|
+
r = t % 3 == 0;
|
|
171
|
+
break;
|
|
172
|
+
case 3:
|
|
173
|
+
r = (t + n) % 3 == 0;
|
|
174
|
+
break;
|
|
175
|
+
case 4:
|
|
176
|
+
r = (Math.floor(t / 3) + Math.floor(n / 2)) % 2 == 0;
|
|
177
|
+
break;
|
|
178
|
+
case 5:
|
|
179
|
+
r = t * n % 2 + t * n % 3 == 0;
|
|
180
|
+
break;
|
|
181
|
+
case 6:
|
|
182
|
+
r = (t * n % 2 + t * n % 3) % 2 == 0;
|
|
183
|
+
break;
|
|
184
|
+
case 7:
|
|
185
|
+
r = ((t + n) % 2 + t * n % 3) % 2 == 0;
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
throw new Error("Unreachable");
|
|
189
|
+
}
|
|
190
|
+
!this.isFunction[n][t] && r && (this.modules[n][t] = !this.modules[n][t]);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
getPenaltyScore() {
|
|
194
|
+
let e = 0;
|
|
195
|
+
for (let o = 0; o < this.size; o++) {
|
|
196
|
+
let a = !1, i = 0, E = [
|
|
197
|
+
0,
|
|
198
|
+
0,
|
|
199
|
+
0,
|
|
200
|
+
0,
|
|
201
|
+
0,
|
|
202
|
+
0,
|
|
203
|
+
0
|
|
204
|
+
];
|
|
205
|
+
for (let f = 0; f < this.size; f++) this.modules[o][f] == a ? (i++, i == 5 ? e += m.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, E), a || (e += this.finderPenaltyCountPatterns(E) * m.PENALTY_N3), a = this.modules[o][f], i = 1);
|
|
206
|
+
e += this.finderPenaltyTerminateAndCount(a, i, E) * m.PENALTY_N3;
|
|
207
|
+
}
|
|
208
|
+
for (let o = 0; o < this.size; o++) {
|
|
209
|
+
let a = !1, i = 0, E = [
|
|
210
|
+
0,
|
|
211
|
+
0,
|
|
212
|
+
0,
|
|
213
|
+
0,
|
|
214
|
+
0,
|
|
215
|
+
0,
|
|
216
|
+
0
|
|
217
|
+
];
|
|
218
|
+
for (let f = 0; f < this.size; f++) this.modules[f][o] == a ? (i++, i == 5 ? e += m.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, E), a || (e += this.finderPenaltyCountPatterns(E) * m.PENALTY_N3), a = this.modules[f][o], i = 1);
|
|
219
|
+
e += this.finderPenaltyTerminateAndCount(a, i, E) * m.PENALTY_N3;
|
|
220
|
+
}
|
|
221
|
+
for (let o = 0; o < this.size - 1; o++) for (let a = 0; a < this.size - 1; a++) {
|
|
222
|
+
const i = this.modules[o][a];
|
|
223
|
+
i == this.modules[o][a + 1] && i == this.modules[o + 1][a] && i == this.modules[o + 1][a + 1] && (e += m.PENALTY_N2);
|
|
224
|
+
}
|
|
225
|
+
let n = 0;
|
|
226
|
+
for (const o of this.modules) n = o.reduce((a, i) => a + (i ? 1 : 0), n);
|
|
227
|
+
const t = this.size * this.size, r = Math.ceil(Math.abs(n * 20 - t * 10) / t) - 1;
|
|
228
|
+
return g(0 <= r && r <= 9), e += r * m.PENALTY_N4, g(0 <= e && e <= 2568888), e;
|
|
229
|
+
}
|
|
230
|
+
getAlignmentPatternPositions() {
|
|
231
|
+
if (this.version == 1) return [];
|
|
232
|
+
{
|
|
233
|
+
const e = Math.floor(this.version / 7) + 2, n = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2;
|
|
234
|
+
let t = [6];
|
|
235
|
+
for (let r = this.size - 7; t.length < e; r -= n) t.splice(1, 0, r);
|
|
236
|
+
return t;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
static getNumRawDataModules(e) {
|
|
240
|
+
if (e < m.MIN_VERSION || e > m.MAX_VERSION) throw new RangeError("Version number out of range");
|
|
241
|
+
let n = (16 * e + 128) * e + 64;
|
|
242
|
+
if (e >= 2) {
|
|
243
|
+
const t = Math.floor(e / 7) + 2;
|
|
244
|
+
n -= (25 * t - 10) * t - 55, e >= 7 && (n -= 36);
|
|
245
|
+
}
|
|
246
|
+
return g(208 <= n && n <= 29648), n;
|
|
247
|
+
}
|
|
248
|
+
static getNumDataCodewords(e, n) {
|
|
249
|
+
return Math.floor(m.getNumRawDataModules(e) / 8) - m.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * m.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
|
|
250
|
+
}
|
|
251
|
+
static reedSolomonComputeDivisor(e) {
|
|
252
|
+
if (e < 1 || e > 255) throw new RangeError("Degree out of range");
|
|
253
|
+
let n = [];
|
|
254
|
+
for (let r = 0; r < e - 1; r++) n.push(0);
|
|
255
|
+
n.push(1);
|
|
256
|
+
let t = 1;
|
|
257
|
+
for (let r = 0; r < e; r++) {
|
|
258
|
+
for (let o = 0; o < n.length; o++)
|
|
259
|
+
n[o] = m.reedSolomonMultiply(n[o], t), o + 1 < n.length && (n[o] ^= n[o + 1]);
|
|
260
|
+
t = m.reedSolomonMultiply(t, 2);
|
|
261
|
+
}
|
|
262
|
+
return n;
|
|
263
|
+
}
|
|
264
|
+
static reedSolomonComputeRemainder(e, n) {
|
|
265
|
+
let t = n.map((r) => 0);
|
|
266
|
+
for (const r of e) {
|
|
267
|
+
const o = r ^ t.shift();
|
|
268
|
+
t.push(0), n.forEach((a, i) => t[i] ^= m.reedSolomonMultiply(a, o));
|
|
269
|
+
}
|
|
270
|
+
return t;
|
|
271
|
+
}
|
|
272
|
+
static reedSolomonMultiply(e, n) {
|
|
273
|
+
if (e >>> 8 || n >>> 8) throw new RangeError("Byte out of range");
|
|
274
|
+
let t = 0;
|
|
275
|
+
for (let r = 7; r >= 0; r--)
|
|
276
|
+
t = t << 1 ^ (t >>> 7) * 285, t ^= (n >>> r & 1) * e;
|
|
277
|
+
return g(t >>> 8 == 0), t;
|
|
278
|
+
}
|
|
279
|
+
finderPenaltyCountPatterns(e) {
|
|
280
|
+
const n = e[1];
|
|
281
|
+
g(n <= this.size * 3);
|
|
282
|
+
const t = n > 0 && e[2] == n && e[3] == n * 3 && e[4] == n && e[5] == n;
|
|
283
|
+
return (t && e[0] >= n * 4 && e[6] >= n ? 1 : 0) + (t && e[6] >= n * 4 && e[0] >= n ? 1 : 0);
|
|
284
|
+
}
|
|
285
|
+
finderPenaltyTerminateAndCount(e, n, t) {
|
|
286
|
+
return e && (this.finderPenaltyAddHistory(n, t), n = 0), n += this.size, this.finderPenaltyAddHistory(n, t), this.finderPenaltyCountPatterns(t);
|
|
287
|
+
}
|
|
288
|
+
finderPenaltyAddHistory(e, n) {
|
|
289
|
+
n[0] == 0 && (e += this.size), n.pop(), n.unshift(e);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
l.MIN_VERSION = 1, l.MAX_VERSION = 40, l.PENALTY_N1 = 3, l.PENALTY_N2 = 3, l.PENALTY_N3 = 40, l.PENALTY_N4 = 10, l.ECC_CODEWORDS_PER_BLOCK = [
|
|
293
|
+
[
|
|
294
|
+
-1,
|
|
295
|
+
7,
|
|
296
|
+
10,
|
|
297
|
+
15,
|
|
298
|
+
20,
|
|
299
|
+
26,
|
|
300
|
+
18,
|
|
301
|
+
20,
|
|
302
|
+
24,
|
|
303
|
+
30,
|
|
304
|
+
18,
|
|
305
|
+
20,
|
|
306
|
+
24,
|
|
307
|
+
26,
|
|
308
|
+
30,
|
|
309
|
+
22,
|
|
310
|
+
24,
|
|
311
|
+
28,
|
|
312
|
+
30,
|
|
313
|
+
28,
|
|
314
|
+
28,
|
|
315
|
+
28,
|
|
316
|
+
28,
|
|
317
|
+
30,
|
|
318
|
+
30,
|
|
319
|
+
26,
|
|
320
|
+
28,
|
|
321
|
+
30,
|
|
322
|
+
30,
|
|
323
|
+
30,
|
|
324
|
+
30,
|
|
325
|
+
30,
|
|
326
|
+
30,
|
|
327
|
+
30,
|
|
328
|
+
30,
|
|
329
|
+
30,
|
|
330
|
+
30,
|
|
331
|
+
30,
|
|
332
|
+
30,
|
|
333
|
+
30,
|
|
334
|
+
30
|
|
335
|
+
],
|
|
336
|
+
[
|
|
337
|
+
-1,
|
|
338
|
+
10,
|
|
339
|
+
16,
|
|
340
|
+
26,
|
|
341
|
+
18,
|
|
342
|
+
24,
|
|
343
|
+
16,
|
|
344
|
+
18,
|
|
345
|
+
22,
|
|
346
|
+
22,
|
|
347
|
+
26,
|
|
348
|
+
30,
|
|
349
|
+
22,
|
|
350
|
+
22,
|
|
351
|
+
24,
|
|
352
|
+
24,
|
|
353
|
+
28,
|
|
354
|
+
28,
|
|
355
|
+
26,
|
|
356
|
+
26,
|
|
357
|
+
26,
|
|
358
|
+
26,
|
|
359
|
+
28,
|
|
360
|
+
28,
|
|
361
|
+
28,
|
|
362
|
+
28,
|
|
363
|
+
28,
|
|
364
|
+
28,
|
|
365
|
+
28,
|
|
366
|
+
28,
|
|
367
|
+
28,
|
|
368
|
+
28,
|
|
369
|
+
28,
|
|
370
|
+
28,
|
|
371
|
+
28,
|
|
372
|
+
28,
|
|
373
|
+
28,
|
|
374
|
+
28,
|
|
375
|
+
28,
|
|
376
|
+
28,
|
|
377
|
+
28
|
|
378
|
+
],
|
|
379
|
+
[
|
|
380
|
+
-1,
|
|
381
|
+
13,
|
|
382
|
+
22,
|
|
383
|
+
18,
|
|
384
|
+
26,
|
|
385
|
+
18,
|
|
386
|
+
24,
|
|
387
|
+
18,
|
|
388
|
+
22,
|
|
389
|
+
20,
|
|
390
|
+
24,
|
|
391
|
+
28,
|
|
392
|
+
26,
|
|
393
|
+
24,
|
|
394
|
+
20,
|
|
395
|
+
30,
|
|
396
|
+
24,
|
|
397
|
+
28,
|
|
398
|
+
28,
|
|
399
|
+
26,
|
|
400
|
+
30,
|
|
401
|
+
28,
|
|
402
|
+
30,
|
|
403
|
+
30,
|
|
404
|
+
30,
|
|
405
|
+
30,
|
|
406
|
+
28,
|
|
407
|
+
30,
|
|
408
|
+
30,
|
|
409
|
+
30,
|
|
410
|
+
30,
|
|
411
|
+
30,
|
|
412
|
+
30,
|
|
413
|
+
30,
|
|
414
|
+
30,
|
|
415
|
+
30,
|
|
416
|
+
30,
|
|
417
|
+
30,
|
|
418
|
+
30,
|
|
419
|
+
30,
|
|
420
|
+
30
|
|
421
|
+
],
|
|
422
|
+
[
|
|
423
|
+
-1,
|
|
424
|
+
17,
|
|
425
|
+
28,
|
|
426
|
+
22,
|
|
427
|
+
16,
|
|
428
|
+
22,
|
|
429
|
+
28,
|
|
430
|
+
26,
|
|
431
|
+
26,
|
|
432
|
+
24,
|
|
433
|
+
28,
|
|
434
|
+
24,
|
|
435
|
+
28,
|
|
436
|
+
22,
|
|
437
|
+
24,
|
|
438
|
+
24,
|
|
439
|
+
30,
|
|
440
|
+
28,
|
|
441
|
+
28,
|
|
442
|
+
26,
|
|
443
|
+
28,
|
|
444
|
+
30,
|
|
445
|
+
24,
|
|
446
|
+
30,
|
|
447
|
+
30,
|
|
448
|
+
30,
|
|
449
|
+
30,
|
|
450
|
+
30,
|
|
451
|
+
30,
|
|
452
|
+
30,
|
|
453
|
+
30,
|
|
454
|
+
30,
|
|
455
|
+
30,
|
|
456
|
+
30,
|
|
457
|
+
30,
|
|
458
|
+
30,
|
|
459
|
+
30,
|
|
460
|
+
30,
|
|
461
|
+
30,
|
|
462
|
+
30,
|
|
463
|
+
30
|
|
464
|
+
]
|
|
465
|
+
], l.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
466
|
+
[
|
|
467
|
+
-1,
|
|
468
|
+
1,
|
|
469
|
+
1,
|
|
470
|
+
1,
|
|
471
|
+
1,
|
|
472
|
+
1,
|
|
473
|
+
2,
|
|
474
|
+
2,
|
|
475
|
+
2,
|
|
476
|
+
2,
|
|
477
|
+
4,
|
|
478
|
+
4,
|
|
479
|
+
4,
|
|
480
|
+
4,
|
|
481
|
+
4,
|
|
482
|
+
6,
|
|
483
|
+
6,
|
|
484
|
+
6,
|
|
485
|
+
6,
|
|
486
|
+
7,
|
|
487
|
+
8,
|
|
488
|
+
8,
|
|
489
|
+
9,
|
|
490
|
+
9,
|
|
491
|
+
10,
|
|
492
|
+
12,
|
|
493
|
+
12,
|
|
494
|
+
12,
|
|
495
|
+
13,
|
|
496
|
+
14,
|
|
497
|
+
15,
|
|
498
|
+
16,
|
|
499
|
+
17,
|
|
500
|
+
18,
|
|
501
|
+
19,
|
|
502
|
+
19,
|
|
503
|
+
20,
|
|
504
|
+
21,
|
|
505
|
+
22,
|
|
506
|
+
24,
|
|
507
|
+
25
|
|
508
|
+
],
|
|
509
|
+
[
|
|
510
|
+
-1,
|
|
511
|
+
1,
|
|
512
|
+
1,
|
|
513
|
+
1,
|
|
514
|
+
2,
|
|
515
|
+
2,
|
|
516
|
+
4,
|
|
517
|
+
4,
|
|
518
|
+
4,
|
|
519
|
+
5,
|
|
520
|
+
5,
|
|
521
|
+
5,
|
|
522
|
+
8,
|
|
523
|
+
9,
|
|
524
|
+
9,
|
|
525
|
+
10,
|
|
526
|
+
10,
|
|
527
|
+
11,
|
|
528
|
+
13,
|
|
529
|
+
14,
|
|
530
|
+
16,
|
|
531
|
+
17,
|
|
532
|
+
17,
|
|
533
|
+
18,
|
|
534
|
+
20,
|
|
535
|
+
21,
|
|
536
|
+
23,
|
|
537
|
+
25,
|
|
538
|
+
26,
|
|
539
|
+
28,
|
|
540
|
+
29,
|
|
541
|
+
31,
|
|
542
|
+
33,
|
|
543
|
+
35,
|
|
544
|
+
37,
|
|
545
|
+
38,
|
|
546
|
+
40,
|
|
547
|
+
43,
|
|
548
|
+
45,
|
|
549
|
+
47,
|
|
550
|
+
49
|
|
551
|
+
],
|
|
552
|
+
[
|
|
553
|
+
-1,
|
|
554
|
+
1,
|
|
555
|
+
1,
|
|
556
|
+
2,
|
|
557
|
+
2,
|
|
558
|
+
4,
|
|
559
|
+
4,
|
|
560
|
+
6,
|
|
561
|
+
6,
|
|
562
|
+
8,
|
|
563
|
+
8,
|
|
564
|
+
8,
|
|
565
|
+
10,
|
|
566
|
+
12,
|
|
567
|
+
16,
|
|
568
|
+
12,
|
|
569
|
+
17,
|
|
570
|
+
16,
|
|
571
|
+
18,
|
|
572
|
+
21,
|
|
573
|
+
20,
|
|
574
|
+
23,
|
|
575
|
+
23,
|
|
576
|
+
25,
|
|
577
|
+
27,
|
|
578
|
+
29,
|
|
579
|
+
34,
|
|
580
|
+
34,
|
|
581
|
+
35,
|
|
582
|
+
38,
|
|
583
|
+
40,
|
|
584
|
+
43,
|
|
585
|
+
45,
|
|
586
|
+
48,
|
|
587
|
+
51,
|
|
588
|
+
53,
|
|
589
|
+
56,
|
|
590
|
+
59,
|
|
591
|
+
62,
|
|
592
|
+
65,
|
|
593
|
+
68
|
|
594
|
+
],
|
|
595
|
+
[
|
|
596
|
+
-1,
|
|
597
|
+
1,
|
|
598
|
+
1,
|
|
599
|
+
2,
|
|
600
|
+
4,
|
|
601
|
+
4,
|
|
602
|
+
4,
|
|
603
|
+
5,
|
|
604
|
+
6,
|
|
605
|
+
8,
|
|
606
|
+
8,
|
|
607
|
+
11,
|
|
608
|
+
11,
|
|
609
|
+
16,
|
|
610
|
+
16,
|
|
611
|
+
18,
|
|
612
|
+
16,
|
|
613
|
+
19,
|
|
614
|
+
21,
|
|
615
|
+
25,
|
|
616
|
+
25,
|
|
617
|
+
25,
|
|
618
|
+
34,
|
|
619
|
+
30,
|
|
620
|
+
32,
|
|
621
|
+
35,
|
|
622
|
+
37,
|
|
623
|
+
40,
|
|
624
|
+
42,
|
|
625
|
+
45,
|
|
626
|
+
48,
|
|
627
|
+
51,
|
|
628
|
+
54,
|
|
629
|
+
57,
|
|
630
|
+
60,
|
|
631
|
+
63,
|
|
632
|
+
66,
|
|
633
|
+
70,
|
|
634
|
+
74,
|
|
635
|
+
77,
|
|
636
|
+
81
|
|
637
|
+
]
|
|
638
|
+
], u.QrCode = l;
|
|
639
|
+
function s(C, e, n) {
|
|
640
|
+
if (e < 0 || e > 31 || C >>> e) throw new RangeError("Value out of range");
|
|
641
|
+
for (let t = e - 1; t >= 0; t--) n.push(C >>> t & 1);
|
|
642
|
+
}
|
|
643
|
+
function c(C, e) {
|
|
644
|
+
return (C >>> e & 1) != 0;
|
|
645
|
+
}
|
|
646
|
+
function g(C) {
|
|
647
|
+
if (!C) throw new Error("Assertion error");
|
|
648
|
+
}
|
|
649
|
+
const h = class M {
|
|
650
|
+
constructor(e, n, t) {
|
|
651
|
+
if (this.mode = e, this.numChars = n, this.bitData = t, n < 0) throw new RangeError("Invalid argument");
|
|
652
|
+
this.bitData = t.slice();
|
|
653
|
+
}
|
|
654
|
+
static makeBytes(e) {
|
|
655
|
+
let n = [];
|
|
656
|
+
for (const t of e) s(t, 8, n);
|
|
657
|
+
return new M(M.Mode.BYTE, e.length, n);
|
|
658
|
+
}
|
|
659
|
+
static makeNumeric(e) {
|
|
660
|
+
if (!M.isNumeric(e)) throw new RangeError("String contains non-numeric characters");
|
|
661
|
+
let n = [];
|
|
662
|
+
for (let t = 0; t < e.length; ) {
|
|
663
|
+
const r = Math.min(e.length - t, 3);
|
|
664
|
+
s(parseInt(e.substring(t, t + r), 10), r * 3 + 1, n), t += r;
|
|
665
|
+
}
|
|
666
|
+
return new M(M.Mode.NUMERIC, e.length, n);
|
|
667
|
+
}
|
|
668
|
+
static makeAlphanumeric(e) {
|
|
669
|
+
if (!M.isAlphanumeric(e)) throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
670
|
+
let n = [], t;
|
|
671
|
+
for (t = 0; t + 2 <= e.length; t += 2) {
|
|
672
|
+
let r = M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)) * 45;
|
|
673
|
+
r += M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t + 1)), s(r, 11, n);
|
|
674
|
+
}
|
|
675
|
+
return t < e.length && s(M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)), 6, n), new M(M.Mode.ALPHANUMERIC, e.length, n);
|
|
676
|
+
}
|
|
677
|
+
static makeSegments(e) {
|
|
678
|
+
return e == "" ? [] : M.isNumeric(e) ? [M.makeNumeric(e)] : M.isAlphanumeric(e) ? [M.makeAlphanumeric(e)] : [M.makeBytes(M.toUtf8ByteArray(e))];
|
|
679
|
+
}
|
|
680
|
+
static makeEci(e) {
|
|
681
|
+
let n = [];
|
|
682
|
+
if (e < 0) throw new RangeError("ECI assignment value out of range");
|
|
683
|
+
if (e < 128) s(e, 8, n);
|
|
684
|
+
else if (e < 16384)
|
|
685
|
+
s(2, 2, n), s(e, 14, n);
|
|
686
|
+
else if (e < 1e6)
|
|
687
|
+
s(6, 3, n), s(e, 21, n);
|
|
688
|
+
else throw new RangeError("ECI assignment value out of range");
|
|
689
|
+
return new M(M.Mode.ECI, 0, n);
|
|
690
|
+
}
|
|
691
|
+
static isNumeric(e) {
|
|
692
|
+
return M.NUMERIC_REGEX.test(e);
|
|
693
|
+
}
|
|
694
|
+
static isAlphanumeric(e) {
|
|
695
|
+
return M.ALPHANUMERIC_REGEX.test(e);
|
|
696
|
+
}
|
|
697
|
+
getData() {
|
|
698
|
+
return this.bitData.slice();
|
|
699
|
+
}
|
|
700
|
+
static getTotalBits(e, n) {
|
|
701
|
+
let t = 0;
|
|
702
|
+
for (const r of e) {
|
|
703
|
+
const o = r.mode.numCharCountBits(n);
|
|
704
|
+
if (r.numChars >= 1 << o) return 1 / 0;
|
|
705
|
+
t += 4 + o + r.bitData.length;
|
|
706
|
+
}
|
|
707
|
+
return t;
|
|
708
|
+
}
|
|
709
|
+
static toUtf8ByteArray(e) {
|
|
710
|
+
e = encodeURI(e);
|
|
711
|
+
let n = [];
|
|
712
|
+
for (let t = 0; t < e.length; t++) e.charAt(t) != "%" ? n.push(e.charCodeAt(t)) : (n.push(parseInt(e.substring(t + 1, t + 3), 16)), t += 2);
|
|
713
|
+
return n;
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
h.NUMERIC_REGEX = /^[0-9]*$/, h.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, h.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
717
|
+
let p = h;
|
|
718
|
+
u.QrSegment = h;
|
|
719
|
+
})(S || (S = {}));
|
|
720
|
+
((u) => {
|
|
721
|
+
((l) => {
|
|
722
|
+
const s = class {
|
|
723
|
+
constructor(g, h) {
|
|
724
|
+
this.ordinal = g, this.formatBits = h;
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
s.LOW = new s(0, 1), s.MEDIUM = new s(1, 0), s.QUARTILE = new s(2, 3), s.HIGH = new s(3, 2), l.Ecc = s;
|
|
728
|
+
})(u.QrCode || (u.QrCode = {}));
|
|
729
|
+
})(S || (S = {}));
|
|
730
|
+
((u) => {
|
|
731
|
+
((l) => {
|
|
732
|
+
const s = class {
|
|
733
|
+
constructor(g, h) {
|
|
734
|
+
this.modeBits = g, this.numBitsCharCount = h;
|
|
735
|
+
}
|
|
736
|
+
numCharCountBits(g) {
|
|
737
|
+
return this.numBitsCharCount[Math.floor((g + 7) / 17)];
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
s.NUMERIC = new s(1, [
|
|
741
|
+
10,
|
|
742
|
+
12,
|
|
743
|
+
14
|
|
744
|
+
]), s.ALPHANUMERIC = new s(2, [
|
|
745
|
+
9,
|
|
746
|
+
11,
|
|
747
|
+
13
|
|
748
|
+
]), s.BYTE = new s(4, [
|
|
749
|
+
8,
|
|
750
|
+
16,
|
|
751
|
+
16
|
|
752
|
+
]), s.KANJI = new s(8, [
|
|
753
|
+
8,
|
|
754
|
+
10,
|
|
755
|
+
12
|
|
756
|
+
]), s.ECI = new s(7, [
|
|
757
|
+
0,
|
|
758
|
+
0,
|
|
759
|
+
0
|
|
760
|
+
]), l.Mode = s;
|
|
761
|
+
})(u.QrSegment || (u.QrSegment = {}));
|
|
762
|
+
})(S || (S = {}));
|
|
763
|
+
var L = S, le = {
|
|
764
|
+
L: L.QrCode.Ecc.LOW,
|
|
765
|
+
M: L.QrCode.Ecc.MEDIUM,
|
|
766
|
+
Q: L.QrCode.Ecc.QUARTILE,
|
|
767
|
+
H: L.QrCode.Ecc.HIGH
|
|
768
|
+
}, x = 128, X = "L", K = "#FFFFFF", j = "#000000", W = !1, Z = 1, ae = 4, ce = 0, ue = 0.1;
|
|
769
|
+
function J(u, l = 0) {
|
|
770
|
+
const s = [];
|
|
771
|
+
return u.forEach(function(c, g) {
|
|
772
|
+
let h = null;
|
|
773
|
+
c.forEach(function(p, C) {
|
|
774
|
+
if (!p && h !== null) {
|
|
775
|
+
s.push(`M${h + l} ${g + l}h${C - h}v1H${h + l}z`), h = null;
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
if (C === c.length - 1) {
|
|
779
|
+
if (!p) return;
|
|
780
|
+
h === null ? s.push(`M${C + l},${g + l} h1v1H${C + l}z`) : s.push(`M${h + l},${g + l} h${C + 1 - h}v1H${h + l}z`);
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
p && h === null && (h = C);
|
|
784
|
+
});
|
|
785
|
+
}), s.join("");
|
|
786
|
+
}
|
|
787
|
+
function q(u, l) {
|
|
788
|
+
return u.slice().map((s, c) => c < l.y || c >= l.y + l.h ? s : s.map((g, h) => h < l.x || h >= l.x + l.w ? g : !1));
|
|
789
|
+
}
|
|
790
|
+
function he(u, l, s, c) {
|
|
791
|
+
if (c == null) return null;
|
|
792
|
+
const g = u.length + s * 2, h = Math.floor(l * ue), p = g / l, C = (c.width || h) * p, e = (c.height || h) * p, n = c.x == null ? u.length / 2 - C / 2 : c.x * p, t = c.y == null ? u.length / 2 - e / 2 : c.y * p, r = c.opacity == null ? 1 : c.opacity;
|
|
793
|
+
let o = null;
|
|
794
|
+
if (c.excavate) {
|
|
795
|
+
let i = Math.floor(n), E = Math.floor(t);
|
|
796
|
+
o = {
|
|
797
|
+
x: i,
|
|
798
|
+
y: E,
|
|
799
|
+
w: Math.ceil(C + n - i),
|
|
800
|
+
h: Math.ceil(e + t - E)
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
const a = c.crossOrigin;
|
|
804
|
+
return {
|
|
805
|
+
x: n,
|
|
806
|
+
y: t,
|
|
807
|
+
h: e,
|
|
808
|
+
w: C,
|
|
809
|
+
excavation: o,
|
|
810
|
+
opacity: r,
|
|
811
|
+
crossOrigin: a
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
function fe(u, l) {
|
|
815
|
+
return l != null ? Math.max(Math.floor(l), 0) : u ? ae : ce;
|
|
816
|
+
}
|
|
817
|
+
function ee({ value: u, level: l, minVersion: s, includeMargin: c, marginSize: g, imageSettings: h, size: p, boostLevel: C }) {
|
|
818
|
+
let e = w.useMemo(() => {
|
|
819
|
+
const a = (Array.isArray(u) ? u : [u]).reduce((i, E) => (i.push(...L.QrSegment.makeSegments(E)), i), []);
|
|
820
|
+
return L.QrCode.encodeSegments(a, le[l], s, void 0, void 0, C);
|
|
821
|
+
}, [
|
|
822
|
+
u,
|
|
823
|
+
l,
|
|
824
|
+
s,
|
|
825
|
+
C
|
|
826
|
+
]);
|
|
827
|
+
const { cells: n, margin: t, numCells: r, calculatedImageSettings: o } = w.useMemo(() => {
|
|
828
|
+
let a = e.getModules();
|
|
829
|
+
const i = fe(c, g);
|
|
830
|
+
return {
|
|
831
|
+
cells: a,
|
|
832
|
+
margin: i,
|
|
833
|
+
numCells: a.length + i * 2,
|
|
834
|
+
calculatedImageSettings: he(a, p, i, h)
|
|
835
|
+
};
|
|
836
|
+
}, [
|
|
837
|
+
e,
|
|
838
|
+
p,
|
|
839
|
+
h,
|
|
840
|
+
c,
|
|
841
|
+
g
|
|
842
|
+
]);
|
|
843
|
+
return {
|
|
844
|
+
qrcode: e,
|
|
845
|
+
margin: t,
|
|
846
|
+
cells: n,
|
|
847
|
+
numCells: r,
|
|
848
|
+
calculatedImageSettings: o
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
var de = (function() {
|
|
852
|
+
try {
|
|
853
|
+
new Path2D().addPath(new Path2D());
|
|
854
|
+
} catch {
|
|
855
|
+
return !1;
|
|
856
|
+
}
|
|
857
|
+
return !0;
|
|
858
|
+
})(), me = w.forwardRef(function(l, s) {
|
|
859
|
+
const c = l, { value: g, size: h = x, level: p = X, bgColor: C = K, fgColor: e = j, includeMargin: n = W, minVersion: t = Z, boostLevel: r, marginSize: o, imageSettings: a } = c, i = U(c, [
|
|
860
|
+
"value",
|
|
861
|
+
"size",
|
|
862
|
+
"level",
|
|
863
|
+
"bgColor",
|
|
864
|
+
"fgColor",
|
|
865
|
+
"includeMargin",
|
|
866
|
+
"minVersion",
|
|
867
|
+
"boostLevel",
|
|
868
|
+
"marginSize",
|
|
869
|
+
"imageSettings"
|
|
870
|
+
]), { style: E } = i, f = U(i, ["style"]), N = a?.src, A = w.useRef(null), d = w.useRef(null), R = w.useCallback((y) => {
|
|
871
|
+
A.current = y, typeof s == "function" ? s(y) : s && (s.current = y);
|
|
872
|
+
}, [s]), [v, O] = w.useState(!1), { margin: b, cells: T, numCells: B, calculatedImageSettings: P } = ee({
|
|
873
|
+
value: g,
|
|
874
|
+
level: p,
|
|
875
|
+
minVersion: t,
|
|
876
|
+
boostLevel: r,
|
|
877
|
+
includeMargin: n,
|
|
878
|
+
marginSize: o,
|
|
879
|
+
imageSettings: a,
|
|
880
|
+
size: h
|
|
881
|
+
});
|
|
882
|
+
w.useEffect(() => {
|
|
883
|
+
if (A.current != null) {
|
|
884
|
+
const y = A.current, I = y.getContext("2d");
|
|
885
|
+
if (!I) return;
|
|
886
|
+
let Q = T;
|
|
887
|
+
const F = d.current, k = P != null && F !== null && F.complete && F.naturalHeight !== 0 && F.naturalWidth !== 0;
|
|
888
|
+
k && P.excavation != null && (Q = q(T, P.excavation));
|
|
889
|
+
const H = window.devicePixelRatio || 1;
|
|
890
|
+
y.height = y.width = h * H;
|
|
891
|
+
const $ = h / B * H;
|
|
892
|
+
I.scale($, $), I.fillStyle = C, I.fillRect(0, 0, B, B), I.fillStyle = e, de ? I.fill(new Path2D(J(Q, b))) : T.forEach(function(ne, re) {
|
|
893
|
+
ne.forEach(function(oe, se) {
|
|
894
|
+
oe && I.fillRect(se + b, re + b, 1, 1);
|
|
895
|
+
});
|
|
896
|
+
}), P && (I.globalAlpha = P.opacity), k && I.drawImage(F, P.x + b, P.y + b, P.w, P.h);
|
|
897
|
+
}
|
|
898
|
+
}), w.useEffect(() => {
|
|
899
|
+
O(!1);
|
|
900
|
+
}, [N]);
|
|
901
|
+
const te = z({
|
|
902
|
+
height: h,
|
|
903
|
+
width: h
|
|
904
|
+
}, E);
|
|
905
|
+
let _ = null;
|
|
906
|
+
return N != null && (_ = /* @__PURE__ */ w.createElement("img", {
|
|
907
|
+
src: N,
|
|
908
|
+
key: N,
|
|
909
|
+
style: { display: "none" },
|
|
910
|
+
onLoad: () => {
|
|
911
|
+
O(!0);
|
|
912
|
+
},
|
|
913
|
+
ref: d,
|
|
914
|
+
crossOrigin: P?.crossOrigin
|
|
915
|
+
})), /* @__PURE__ */ w.createElement(w.Fragment, null, /* @__PURE__ */ w.createElement("canvas", z({
|
|
916
|
+
style: te,
|
|
917
|
+
height: h,
|
|
918
|
+
width: h,
|
|
919
|
+
ref: R,
|
|
920
|
+
role: "img"
|
|
921
|
+
}, f)), _);
|
|
922
|
+
});
|
|
923
|
+
me.displayName = "QRCodeCanvas";
|
|
924
|
+
var ge = w.forwardRef(function(l, s) {
|
|
925
|
+
const c = l, { value: g, size: h = x, level: p = X, bgColor: C = K, fgColor: e = j, includeMargin: n = W, minVersion: t = Z, boostLevel: r, title: o, marginSize: a, imageSettings: i } = c, E = U(c, [
|
|
926
|
+
"value",
|
|
927
|
+
"size",
|
|
928
|
+
"level",
|
|
929
|
+
"bgColor",
|
|
930
|
+
"fgColor",
|
|
931
|
+
"includeMargin",
|
|
932
|
+
"minVersion",
|
|
933
|
+
"boostLevel",
|
|
934
|
+
"title",
|
|
935
|
+
"marginSize",
|
|
936
|
+
"imageSettings"
|
|
937
|
+
]), { margin: f, cells: N, numCells: A, calculatedImageSettings: d } = ee({
|
|
938
|
+
value: g,
|
|
939
|
+
level: p,
|
|
940
|
+
minVersion: t,
|
|
941
|
+
boostLevel: r,
|
|
942
|
+
includeMargin: n,
|
|
943
|
+
marginSize: a,
|
|
944
|
+
imageSettings: i,
|
|
945
|
+
size: h
|
|
946
|
+
});
|
|
947
|
+
let R = N, v = null;
|
|
948
|
+
i != null && d != null && (d.excavation != null && (R = q(N, d.excavation)), v = /* @__PURE__ */ w.createElement("image", {
|
|
949
|
+
href: i.src,
|
|
950
|
+
height: d.h,
|
|
951
|
+
width: d.w,
|
|
952
|
+
x: d.x + f,
|
|
953
|
+
y: d.y + f,
|
|
954
|
+
preserveAspectRatio: "none",
|
|
955
|
+
opacity: d.opacity,
|
|
956
|
+
crossOrigin: d.crossOrigin
|
|
957
|
+
}));
|
|
958
|
+
const O = J(R, f);
|
|
959
|
+
return /* @__PURE__ */ w.createElement("svg", z({
|
|
960
|
+
height: h,
|
|
961
|
+
width: h,
|
|
962
|
+
viewBox: `0 0 ${A} ${A}`,
|
|
963
|
+
ref: s,
|
|
964
|
+
role: "img"
|
|
965
|
+
}, E), !!o && /* @__PURE__ */ w.createElement("title", null, o), /* @__PURE__ */ w.createElement("path", {
|
|
966
|
+
fill: C,
|
|
967
|
+
d: `M0,0 h${A}v${A}H0z`,
|
|
968
|
+
shapeRendering: "crispEdges"
|
|
969
|
+
}), /* @__PURE__ */ w.createElement("path", {
|
|
970
|
+
fill: e,
|
|
971
|
+
d: O,
|
|
972
|
+
shapeRendering: "crispEdges"
|
|
973
|
+
}), v);
|
|
974
|
+
});
|
|
975
|
+
ge.displayName = "QRCodeSVG";
|
|
976
|
+
export {
|
|
977
|
+
me as QRCodeCanvas,
|
|
978
|
+
ge as QRCodeSVG
|
|
979
|
+
};
|