kui-vue 5.2.3 → 5.3.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/index.js +2 -2
- package/es/index.js +3373 -360
- package/es/locale/de.js +7 -1
- package/es/locale/el.js +7 -1
- package/es/locale/en.js +7 -1
- package/es/locale/fr.js +7 -1
- package/es/locale/it.js +7 -1
- package/es/locale/ja.js +7 -1
- package/es/locale/ko.js +7 -1
- package/es/locale/ru.js +7 -1
- package/es/locale/th.js +7 -1
- package/es/locale/uk.js +7 -1
- package/es/locale/vi.js +7 -1
- package/es/locale/zh-CN.js +7 -1
- package/es/locale/zh-TW.js +7 -1
- package/lib/index.js +2 -2
- package/lib/locale/de.js +2 -2
- package/lib/locale/el.js +2 -2
- package/lib/locale/en.js +2 -2
- package/lib/locale/fr.js +2 -2
- package/lib/locale/it.js +2 -2
- package/lib/locale/ja.js +2 -2
- package/lib/locale/ko.js +2 -2
- package/lib/locale/ru.js +2 -2
- package/lib/locale/th.js +2 -2
- package/lib/locale/uk.js +2 -2
- package/lib/locale/vi.js +2 -2
- package/lib/locale/zh-CN.js +2 -2
- package/lib/locale/zh-TW.js +2 -2
- package/package.json +17 -15
- package/style/index.css +2 -2
- package/types/avatar/avatar-group.d.ts +1 -1
- package/types/color-picker/index.d.ts +1 -1
- package/types/components.d.ts +6 -2
- package/types/date-picker/index.d.ts +1 -1
- package/types/descriptions/descriptions-item.d.ts +1 -1
- package/types/descriptions/{Descriptions.d.ts → descriptions.d.ts} +1 -1
- package/types/divider/index.d.ts +1 -1
- package/types/drawer/index.d.ts +1 -1
- package/types/dropdown/dropdown-button.d.ts +1 -1
- package/types/dropdown/{Dropdown.d.ts → dropdown.d.ts} +1 -1
- package/types/empty/index.d.ts +1 -1
- package/types/flex/index.d.ts +1 -1
- package/types/global.d.ts +8 -4
- package/types/input/input-box.d.ts +1 -1
- package/types/input/input-group.d.ts +1 -1
- package/types/input/{Input.d.ts → input.d.ts} +3 -1
- package/types/input/{TextArea.d.ts → textarea.d.ts} +2 -1
- package/types/input-number/index.d.ts +1 -1
- package/types/layout/index.d.ts +2 -2
- package/types/loading/index.d.ts +1 -1
- package/types/locale/de.d.ts +6 -0
- package/types/locale/el.d.ts +6 -0
- package/types/locale/en.d.ts +6 -0
- package/types/locale/fr.d.ts +6 -0
- package/types/locale/it.d.ts +6 -0
- package/types/locale/ja.d.ts +6 -0
- package/types/locale/ko.d.ts +6 -0
- package/types/locale/ru.d.ts +6 -0
- package/types/locale/th.d.ts +6 -0
- package/types/locale/uk.d.ts +6 -0
- package/types/locale/vi.d.ts +6 -0
- package/types/locale/zh-CN.d.ts +6 -0
- package/types/locale/zh-TW.d.ts +6 -0
- package/types/menu/menu-group.d.ts +1 -1
- package/types/menu/menu-item.d.ts +1 -1
- package/types/menu/{Menu.d.ts → menu.d.ts} +1 -1
- package/types/menu/sub-menu.d.ts +1 -1
- package/types/modal/{Modal.d.ts → modal.d.ts} +1 -1
- package/types/page/index.d.ts +1 -1
- package/types/popconfirm/index.d.ts +1 -1
- package/types/poptip/index.d.ts +1 -1
- package/types/progress/index.d.ts +1 -1
- package/types/qrcode/index.d.ts +165 -0
- package/types/radio/radio-button.d.ts +1 -1
- package/types/radio/radio-group.d.ts +1 -1
- package/types/radio/{Radio.d.ts → radio.d.ts} +1 -1
- package/types/rate/index.d.ts +1 -1
- package/types/rate/star.d.ts +1 -1
- package/types/row-col/{Col.d.ts → col.d.ts} +1 -1
- package/types/row-col/{Row.d.ts → row.d.ts} +1 -1
- package/types/select/{Option.d.ts → option.d.ts} +1 -1
- package/types/select/{Select.d.ts → select.d.ts} +1 -1
- package/types/slider/index.d.ts +1 -1
- package/types/space/index.d.ts +1 -1
- package/types/spin/index.d.ts +1 -1
- package/types/stat-card/stat-card.d.ts +1 -1
- package/types/stat-card/stat-number.d.ts +1 -1
- package/types/switch/index.d.ts +1 -1
- package/types/table/index.d.ts +1 -1
- package/types/tabs/tab-panel.d.ts +1 -1
- package/types/tabs/{Tabs.d.ts → tabs.d.ts} +1 -1
- package/types/tag/index.d.ts +1 -1
- package/types/time-line/timeline-item.d.ts +1 -1
- package/types/time-line/timeline.d.ts +1 -1
- package/types/tooltip/index.d.ts +1 -1
- package/types/tree/index.d.ts +1 -1
- package/types/tree-select/index.d.ts +1 -1
- package/types/upload/file-list.d.ts +1 -1
- package/types/upload/index.d.ts +1 -1
- package/types/upload/selector.d.ts +1 -1
- package/types/watermark/index.d.ts +197 -0
- package/vetur/attributes.json +149 -37
- package/vetur/tags.json +52 -18
- package/vetur/web-types.json +282 -68
- package/types/affix/Affix.d.ts +0 -15
- package/types/alert/Alert.d.ts +0 -19
- package/types/anchor/AnchorLink.d.ts +0 -12
- package/types/avatar/AvatarGroup.d.ts +0 -13
- package/types/backtop/BackTop.d.ts +0 -16
- package/types/badge/Badge.d.ts +0 -18
- package/types/breadcrumb/BreadcrumbItem.d.ts +0 -12
- package/types/button/ButtonGroup.d.ts +0 -12
- package/types/card/Card.d.ts +0 -14
- package/types/carousel/CarouselItem.d.ts +0 -9
- package/types/checkbox/CheckboxGroup.d.ts +0 -19
- package/types/collapse/CollapsePanel.d.ts +0 -12
- package/types/color-picker/ColorPicker.d.ts +0 -28
- package/types/date-picker/DatePicker.d.ts +0 -46
- package/types/descriptions/DescriptionsItem.d.ts +0 -16
- package/types/divider/Divider.d.ts +0 -16
- package/types/drawer/Drawer.d.ts +0 -35
- package/types/dropdown/DropdownButton.d.ts +0 -19
- package/types/empty/Empty.d.ts +0 -13
- package/types/flex/Flex.d.ts +0 -15
- package/types/form/FormItem.d.ts +0 -15
- package/types/grid/GridItem.d.ts +0 -18
- package/types/icon/Icon.d.ts +0 -15
- package/types/image/ImageGroup.d.ts +0 -11
- package/types/image/KImage.d.ts +0 -20
- package/types/input/InputGroup.d.ts +0 -16
- package/types/input-number/InputNumber.d.ts +0 -32
- package/types/layout/sider.d.ts +0 -11
- package/types/loading/loading.d.ts +0 -9
- package/types/menu/MenuDivider.d.ts +0 -9
- package/types/menu/MenuGroup.d.ts +0 -11
- package/types/menu/MenuItem.d.ts +0 -15
- package/types/menu/SubMenu.d.ts +0 -14
- package/types/page/Page.d.ts +0 -27
- package/types/popconfirm/Popconfirm.d.ts +0 -19
- package/types/poptip/Poptip.d.ts +0 -19
- package/types/progress/Progress.d.ts +0 -31
- package/types/radio/RadioButton.d.ts +0 -19
- package/types/radio/RadioGroup.d.ts +0 -20
- package/types/rate/Rate.d.ts +0 -24
- package/types/skeleton/SkeletonAvatar.d.ts +0 -17
- package/types/skeleton/SkeletonButton.d.ts +0 -18
- package/types/skeleton/SkeletonImage.d.ts +0 -16
- package/types/skeleton/SkeletonText.d.ts +0 -16
- package/types/slider/Slider.d.ts +0 -29
- package/types/space/Space.d.ts +0 -17
- package/types/spin/Spin.d.ts +0 -18
- package/types/stat-card/StatCard.d.ts +0 -20
- package/types/stat-card/StatNumber.d.ts +0 -20
- package/types/switch/Switch.d.ts +0 -19
- package/types/table/Table.d.ts +0 -29
- package/types/tabs/TabPanel.d.ts +0 -15
- package/types/tag/Tag.d.ts +0 -18
- package/types/timeline/TimeLine.d.ts +0 -12
- package/types/timeline/TimeLineItem.d.ts +0 -14
- package/types/tooltip/Tooltip.d.ts +0 -20
- package/types/tree/Tree.d.ts +0 -28
- package/types/tree-select/TreeSelect.d.ts +0 -46
- package/types/upload/Upload.d.ts +0 -37
- /package/types/anchor/{Anchor.d.ts → anchor.d.ts} +0 -0
- /package/types/avatar/{Avatar.d.ts → avatar.d.ts} +0 -0
- /package/types/breadcrumb/{Breadcrumb.d.ts → breadcrumb.d.ts} +0 -0
- /package/types/button/{Button.d.ts → button.d.ts} +0 -0
- /package/types/carousel/{Carousel.d.ts → carousel.d.ts} +0 -0
- /package/types/checkbox/{Checkbox.d.ts → checkbox.d.ts} +0 -0
- /package/types/collapse/{Collapse.d.ts → collapse.d.ts} +0 -0
- /package/types/form/{Form.d.ts → form.d.ts} +0 -0
- /package/types/grid/{Grid.d.ts → grid.d.ts} +0 -0
- /package/types/skeleton/{Skeleton.d.ts → skeleton.d.ts} +0 -0
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* kui-vue v5.
|
|
2
|
+
* kui-vue v5.3.0
|
|
3
3
|
* Copyright 2017-present, kui-vue.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://k-ui.cn
|
|
@@ -663,8 +663,10 @@ var Avatar = /* @__PURE__ */ defineComponent({
|
|
|
663
663
|
if (innerRef.value && rootRef.value) {
|
|
664
664
|
const max = rootRef.value.offsetWidth - 8;
|
|
665
665
|
const innerWidth = innerRef.value.offsetWidth || innerRef.value.scrollWidth;
|
|
666
|
-
if (innerWidth > 0 && innerWidth > max)
|
|
667
|
-
|
|
666
|
+
if (innerWidth > 0 && innerWidth > max) {
|
|
667
|
+
const scale = Math.min(max / innerWidth, 1);
|
|
668
|
+
textStyles.value = { transform: `scale(${scale}) translateX(-50%)` };
|
|
669
|
+
} else textStyles.value = { transform: "scale(1) translateX(-50%)" };
|
|
668
670
|
}
|
|
669
671
|
};
|
|
670
672
|
onMounted(() => {
|
|
@@ -771,6 +773,8 @@ var toggleContainerScroll = (target, lock) => {
|
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
775
|
};
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region components/avatar/avatar-group.tsx
|
|
774
778
|
var AvatarGroup = /* @__PURE__ */ defineComponent({
|
|
775
779
|
name: "AvatarGroup",
|
|
776
780
|
props: {
|
|
@@ -876,7 +880,8 @@ var BackTop = /* @__PURE__ */ defineComponent({
|
|
|
876
880
|
setup(props, { emit, slots }) {
|
|
877
881
|
const visible = ref(false);
|
|
878
882
|
const onScroll = () => {
|
|
879
|
-
|
|
883
|
+
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop || window.scrollY;
|
|
884
|
+
visible.value = scrollTop >= props.height;
|
|
880
885
|
};
|
|
881
886
|
const handleClick = (e) => {
|
|
882
887
|
emit("click", e);
|
|
@@ -1181,7 +1186,8 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
1181
1186
|
return result;
|
|
1182
1187
|
};
|
|
1183
1188
|
const children = computed(() => {
|
|
1184
|
-
|
|
1189
|
+
const raw = slots.default?.() || [];
|
|
1190
|
+
return flatten(raw);
|
|
1185
1191
|
});
|
|
1186
1192
|
watch(() => props.modelValue, (val) => {
|
|
1187
1193
|
currentIndex.value = val;
|
|
@@ -3885,6 +3891,10 @@ function setPlacement({ refSelection, refPopper, currentPlacement, position = nu
|
|
|
3885
3891
|
calcLeft = rect.left + (rect.width - pickerW) / 2;
|
|
3886
3892
|
originX = "center";
|
|
3887
3893
|
}
|
|
3894
|
+
if (calcLeft < 0) calcLeft = 0;
|
|
3895
|
+
else if (calcLeft + pickerW > clientWidth) calcLeft = clientWidth - pickerW;
|
|
3896
|
+
if (calcTop < 0) calcTop = 0;
|
|
3897
|
+
else if (calcTop + pickerH > clientHeight) calcTop = clientHeight - pickerH;
|
|
3888
3898
|
top.value = calcTop + scrollTop;
|
|
3889
3899
|
left.value = calcLeft + scrollLeft;
|
|
3890
3900
|
transOrigin.value = `${originX} ${originY}`;
|
|
@@ -3923,7 +3933,8 @@ var alpha_default = /* @__PURE__ */ defineComponent({
|
|
|
3923
3933
|
ctx.fillRect(0, 0, width, height);
|
|
3924
3934
|
};
|
|
3925
3935
|
const updatePos = () => {
|
|
3926
|
-
|
|
3936
|
+
const a = Color(props.modelValue).alpha();
|
|
3937
|
+
dotPos.value = a * 190 - 7;
|
|
3927
3938
|
};
|
|
3928
3939
|
const handleMove = (e) => {
|
|
3929
3940
|
const canvas = refPaint.value;
|
|
@@ -4036,7 +4047,21 @@ var hue_default = /* @__PURE__ */ defineComponent({
|
|
|
4036
4047
|
//#endregion
|
|
4037
4048
|
//#region node_modules/.pnpm/big.js@7.0.1/node_modules/big.js/big.mjs
|
|
4038
4049
|
/************************************** EDITABLE DEFAULTS *****************************************/
|
|
4039
|
-
var DP = 20
|
|
4050
|
+
var DP = 20;
|
|
4051
|
+
var RM = 1;
|
|
4052
|
+
var MAX_DP = 1e6;
|
|
4053
|
+
var MAX_POWER = 1e6;
|
|
4054
|
+
var NE = -7;
|
|
4055
|
+
var PE = 21;
|
|
4056
|
+
var STRICT = false;
|
|
4057
|
+
var NAME = "[big.js] ";
|
|
4058
|
+
var INVALID = NAME + "Invalid ";
|
|
4059
|
+
var INVALID_DP = INVALID + "decimal places";
|
|
4060
|
+
var INVALID_RM = INVALID + "rounding mode";
|
|
4061
|
+
var DIV_BY_ZERO = NAME + "Division by zero";
|
|
4062
|
+
var P = {};
|
|
4063
|
+
var UNDEFINED = void 0;
|
|
4064
|
+
var NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
4040
4065
|
function _Big_() {
|
|
4041
4066
|
function Big(n) {
|
|
4042
4067
|
var x = this;
|
|
@@ -4325,7 +4350,7 @@ P.plus = P.add = function(y) {
|
|
|
4325
4350
|
};
|
|
4326
4351
|
P.pow = function(n) {
|
|
4327
4352
|
var x = this, one = new x.constructor("1"), y = one, isneg = n < 0;
|
|
4328
|
-
if (n !== ~~n || n < -
|
|
4353
|
+
if (n !== ~~n || n < -1e6 || n > MAX_POWER) throw Error(INVALID + "exponent");
|
|
4329
4354
|
if (isneg) n = -n;
|
|
4330
4355
|
for (;;) {
|
|
4331
4356
|
if (n & 1) y = y.times(x);
|
|
@@ -4341,7 +4366,7 @@ P.prec = function(sd, rm) {
|
|
|
4341
4366
|
};
|
|
4342
4367
|
P.round = function(dp, rm) {
|
|
4343
4368
|
if (dp === UNDEFINED) dp = 0;
|
|
4344
|
-
else if (dp !== ~~dp || dp < -
|
|
4369
|
+
else if (dp !== ~~dp || dp < -1e6 || dp > MAX_DP) throw Error(INVALID_DP);
|
|
4345
4370
|
return round(new this.constructor(this), dp + this.e + 1, rm);
|
|
4346
4371
|
};
|
|
4347
4372
|
P.sqrt = function() {
|
|
@@ -4554,6 +4579,8 @@ var input_box_default = /* @__PURE__ */ defineComponent({
|
|
|
4554
4579
|
};
|
|
4555
4580
|
}
|
|
4556
4581
|
});
|
|
4582
|
+
//#endregion
|
|
4583
|
+
//#region components/input/input-group.tsx
|
|
4557
4584
|
var InputGroup = /* @__PURE__ */ defineComponent({
|
|
4558
4585
|
name: "InputGroup",
|
|
4559
4586
|
props: {
|
|
@@ -4621,6 +4648,12 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4621
4648
|
default: true
|
|
4622
4649
|
},
|
|
4623
4650
|
size: { type: String },
|
|
4651
|
+
value: { type: [
|
|
4652
|
+
String,
|
|
4653
|
+
Number,
|
|
4654
|
+
Array,
|
|
4655
|
+
Object
|
|
4656
|
+
] },
|
|
4624
4657
|
modelValue: { type: [
|
|
4625
4658
|
String,
|
|
4626
4659
|
Number,
|
|
@@ -4653,13 +4686,12 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4653
4686
|
default: "input"
|
|
4654
4687
|
},
|
|
4655
4688
|
onSearch: { type: Function },
|
|
4656
|
-
maxlength: Number,
|
|
4657
4689
|
onIconClick: { type: Function },
|
|
4658
4690
|
onClear: { type: Function },
|
|
4659
4691
|
onChange: { type: Function }
|
|
4660
4692
|
},
|
|
4661
4693
|
setup(props, { slots, emit, attrs, expose }) {
|
|
4662
|
-
const currentValue = ref(props.modelValue);
|
|
4694
|
+
const currentValue = ref(props.modelValue ?? props.value);
|
|
4663
4695
|
const focused = ref(false);
|
|
4664
4696
|
const showPassword = ref(false);
|
|
4665
4697
|
const inputRef = ref();
|
|
@@ -4797,9 +4829,17 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4797
4829
|
};
|
|
4798
4830
|
}
|
|
4799
4831
|
});
|
|
4832
|
+
//#endregion
|
|
4833
|
+
//#region components/input/textarea.tsx
|
|
4800
4834
|
var TextArea = /* @__PURE__ */ defineComponent({
|
|
4801
4835
|
name: "TextArea",
|
|
4802
4836
|
props: {
|
|
4837
|
+
value: [
|
|
4838
|
+
String,
|
|
4839
|
+
Number,
|
|
4840
|
+
Object,
|
|
4841
|
+
Array
|
|
4842
|
+
],
|
|
4803
4843
|
modelValue: [
|
|
4804
4844
|
String,
|
|
4805
4845
|
Number,
|
|
@@ -4821,7 +4861,7 @@ var TextArea = /* @__PURE__ */ defineComponent({
|
|
|
4821
4861
|
onChange: { type: Function }
|
|
4822
4862
|
},
|
|
4823
4863
|
setup(props, { attrs, emit }) {
|
|
4824
|
-
const currentValue = ref(props.modelValue);
|
|
4864
|
+
const currentValue = ref(props.modelValue ?? props.value);
|
|
4825
4865
|
watch(() => props.modelValue, (v) => {
|
|
4826
4866
|
currentValue.value = v;
|
|
4827
4867
|
});
|
|
@@ -4850,6 +4890,8 @@ var TextArea = /* @__PURE__ */ defineComponent({
|
|
|
4850
4890
|
};
|
|
4851
4891
|
}
|
|
4852
4892
|
});
|
|
4893
|
+
//#endregion
|
|
4894
|
+
//#region components/input-number/index.tsx
|
|
4853
4895
|
var InputNumber = /* @__PURE__ */ defineComponent({
|
|
4854
4896
|
inheritAttrs: false,
|
|
4855
4897
|
name: "InputNumber",
|
|
@@ -4921,7 +4963,8 @@ var InputNumber = /* @__PURE__ */ defineComponent({
|
|
|
4921
4963
|
const clampedStr = clamp(String(parsed));
|
|
4922
4964
|
innerValue.value = clampedStr;
|
|
4923
4965
|
userInput.value = null;
|
|
4924
|
-
|
|
4966
|
+
const output = clampedStr === "" ? void 0 : Number(clampedStr);
|
|
4967
|
+
emitValue(output);
|
|
4925
4968
|
};
|
|
4926
4969
|
const handleInput = (val) => {
|
|
4927
4970
|
userInput.value = val;
|
|
@@ -4948,7 +4991,8 @@ var InputNumber = /* @__PURE__ */ defineComponent({
|
|
|
4948
4991
|
const stepAction = (type) => {
|
|
4949
4992
|
if (props.disabled || props.readonly) return;
|
|
4950
4993
|
const current = isValidBig(innerValue.value) ? innerValue.value : 0;
|
|
4951
|
-
|
|
4994
|
+
const next = type === "up" ? new Big(current).plus(props.step) : new Big(current).minus(props.step);
|
|
4995
|
+
triggerUpdate(next.toFixed());
|
|
4952
4996
|
};
|
|
4953
4997
|
return () => {
|
|
4954
4998
|
const inputProps = {
|
|
@@ -4993,6 +5037,8 @@ var InputNumber = /* @__PURE__ */ defineComponent({
|
|
|
4993
5037
|
};
|
|
4994
5038
|
}
|
|
4995
5039
|
});
|
|
5040
|
+
//#endregion
|
|
5041
|
+
//#region components/select/option.tsx
|
|
4996
5042
|
var Option = /* @__PURE__ */ defineComponent({
|
|
4997
5043
|
name: "Option",
|
|
4998
5044
|
props: {
|
|
@@ -5035,6 +5081,8 @@ var Option = /* @__PURE__ */ defineComponent({
|
|
|
5035
5081
|
};
|
|
5036
5082
|
}
|
|
5037
5083
|
});
|
|
5084
|
+
//#endregion
|
|
5085
|
+
//#region components/empty/index.tsx
|
|
5038
5086
|
var Empty = /* @__PURE__ */ defineComponent({
|
|
5039
5087
|
name: "Empty",
|
|
5040
5088
|
props: {
|
|
@@ -5073,6 +5121,8 @@ var Empty = /* @__PURE__ */ defineComponent({
|
|
|
5073
5121
|
};
|
|
5074
5122
|
}
|
|
5075
5123
|
});
|
|
5124
|
+
//#endregion
|
|
5125
|
+
//#region components/select/select.tsx
|
|
5076
5126
|
var Select = /* @__PURE__ */ defineComponent({
|
|
5077
5127
|
name: "Select",
|
|
5078
5128
|
directives: {
|
|
@@ -5310,12 +5360,16 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5310
5360
|
nextTick(() => {
|
|
5311
5361
|
visible.value = true;
|
|
5312
5362
|
emit("openChange", true);
|
|
5313
|
-
|
|
5363
|
+
nextTick(() => {
|
|
5364
|
+
updatePosition();
|
|
5365
|
+
});
|
|
5314
5366
|
});
|
|
5315
5367
|
} else {
|
|
5316
5368
|
visible.value = true;
|
|
5317
5369
|
emit("openChange", true);
|
|
5318
|
-
|
|
5370
|
+
nextTick(() => {
|
|
5371
|
+
updatePosition();
|
|
5372
|
+
});
|
|
5319
5373
|
}
|
|
5320
5374
|
emit("search", e);
|
|
5321
5375
|
}, 500);
|
|
@@ -5844,6 +5898,8 @@ var presets_default = /* @__PURE__ */ defineComponent({
|
|
|
5844
5898
|
};
|
|
5845
5899
|
}
|
|
5846
5900
|
});
|
|
5901
|
+
//#endregion
|
|
5902
|
+
//#region components/color-picker/index.tsx
|
|
5847
5903
|
var ColorPicker = /* @__PURE__ */ defineComponent({
|
|
5848
5904
|
name: "ColorPicker",
|
|
5849
5905
|
directives: {
|
|
@@ -5929,11 +5985,15 @@ var ColorPicker = /* @__PURE__ */ defineComponent({
|
|
|
5929
5985
|
document.addEventListener("click", outsideClick);
|
|
5930
5986
|
nextTick(() => {
|
|
5931
5987
|
openChange(true);
|
|
5932
|
-
|
|
5988
|
+
nextTick(() => {
|
|
5989
|
+
updatePopPosition();
|
|
5990
|
+
});
|
|
5933
5991
|
});
|
|
5934
5992
|
} else {
|
|
5935
5993
|
openChange(true);
|
|
5936
|
-
|
|
5994
|
+
nextTick(() => {
|
|
5995
|
+
updatePopPosition();
|
|
5996
|
+
});
|
|
5937
5997
|
}
|
|
5938
5998
|
else openChange(false);
|
|
5939
5999
|
};
|
|
@@ -5956,20 +6016,23 @@ var ColorPicker = /* @__PURE__ */ defineComponent({
|
|
|
5956
6016
|
emit("change", value);
|
|
5957
6017
|
};
|
|
5958
6018
|
const onUpdateRGB = ({ r, g, b }) => {
|
|
5959
|
-
|
|
6019
|
+
const color = Color({
|
|
5960
6020
|
r,
|
|
5961
6021
|
g,
|
|
5962
6022
|
b,
|
|
5963
6023
|
alpha: currentAlpha.value
|
|
5964
|
-
})
|
|
6024
|
+
});
|
|
6025
|
+
onUpdate(color.rgb());
|
|
5965
6026
|
};
|
|
5966
6027
|
const onUpdateHue = (hue) => {
|
|
5967
6028
|
currentHue.value = hue;
|
|
5968
|
-
|
|
6029
|
+
const value = Color(currentColor.value).hue(hue).rgb();
|
|
6030
|
+
onUpdate(value);
|
|
5969
6031
|
};
|
|
5970
6032
|
const onUpdateAlpha = (a) => {
|
|
5971
6033
|
currentAlpha.value = a;
|
|
5972
|
-
|
|
6034
|
+
const value = Color(currentColor.value).alpha(a).rgb();
|
|
6035
|
+
onUpdate(value);
|
|
5973
6036
|
};
|
|
5974
6037
|
const onUpdateMode = (mode) => {
|
|
5975
6038
|
currentMode.value = mode;
|
|
@@ -6669,11 +6732,15 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6669
6732
|
document.addEventListener("click", handleClickOutside);
|
|
6670
6733
|
nextTick(() => {
|
|
6671
6734
|
updatePanelState();
|
|
6672
|
-
|
|
6735
|
+
nextTick(() => {
|
|
6736
|
+
updatePosition();
|
|
6737
|
+
});
|
|
6673
6738
|
});
|
|
6674
6739
|
} else {
|
|
6675
6740
|
updatePanelState();
|
|
6676
|
-
|
|
6741
|
+
nextTick(() => {
|
|
6742
|
+
updatePosition();
|
|
6743
|
+
});
|
|
6677
6744
|
}
|
|
6678
6745
|
};
|
|
6679
6746
|
const handleClickOutside = (e) => {
|
|
@@ -6915,7 +6982,8 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6915
6982
|
"class": "k-picker-time-col",
|
|
6916
6983
|
"ref": (el) => timeColRefs.value[type] = el
|
|
6917
6984
|
}, [Array.from({ length: max }).map((_, i) => {
|
|
6918
|
-
const
|
|
6985
|
+
const tempDate = activeDate.set(type, i);
|
|
6986
|
+
const isDisabled = checkTimeDisabled(tempDate);
|
|
6919
6987
|
return createVNode("li", {
|
|
6920
6988
|
"key": i,
|
|
6921
6989
|
"class": [
|
|
@@ -7136,6 +7204,8 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
7136
7204
|
};
|
|
7137
7205
|
}
|
|
7138
7206
|
});
|
|
7207
|
+
//#endregion
|
|
7208
|
+
//#region components/descriptions/descriptions-item.tsx
|
|
7139
7209
|
var DescriptionsItem = /* @__PURE__ */ defineComponent({
|
|
7140
7210
|
name: "DescriptionsItem",
|
|
7141
7211
|
props: {
|
|
@@ -7290,6 +7360,8 @@ var Descriptions = /* @__PURE__ */ defineComponent({
|
|
|
7290
7360
|
};
|
|
7291
7361
|
}
|
|
7292
7362
|
});
|
|
7363
|
+
//#endregion
|
|
7364
|
+
//#region components/drawer/index.tsx
|
|
7293
7365
|
var Drawer = /* @__PURE__ */ defineComponent({
|
|
7294
7366
|
name: "Drawer",
|
|
7295
7367
|
directives: { transfer },
|
|
@@ -7449,6 +7521,8 @@ var Drawer = /* @__PURE__ */ defineComponent({
|
|
|
7449
7521
|
};
|
|
7450
7522
|
}
|
|
7451
7523
|
});
|
|
7524
|
+
//#endregion
|
|
7525
|
+
//#region components/dropdown/dropdown.tsx
|
|
7452
7526
|
var Dropdown = /* @__PURE__ */ defineComponent({
|
|
7453
7527
|
name: "Dropdown",
|
|
7454
7528
|
directives: {
|
|
@@ -7533,12 +7607,16 @@ var Dropdown = /* @__PURE__ */ defineComponent({
|
|
|
7533
7607
|
nextTick(() => {
|
|
7534
7608
|
openChange(true);
|
|
7535
7609
|
emit("update:show", true);
|
|
7536
|
-
|
|
7610
|
+
nextTick(() => {
|
|
7611
|
+
updatePosition(e);
|
|
7612
|
+
});
|
|
7537
7613
|
});
|
|
7538
7614
|
} else {
|
|
7539
7615
|
emit("update:show", true);
|
|
7540
|
-
updatePosition(e);
|
|
7541
7616
|
openChange(true);
|
|
7617
|
+
nextTick(() => {
|
|
7618
|
+
updatePosition(e);
|
|
7619
|
+
});
|
|
7542
7620
|
}
|
|
7543
7621
|
else {
|
|
7544
7622
|
openChange(false);
|
|
@@ -7649,6 +7727,8 @@ var trigger_default = /* @__PURE__ */ defineComponent({
|
|
|
7649
7727
|
};
|
|
7650
7728
|
}
|
|
7651
7729
|
});
|
|
7730
|
+
//#endregion
|
|
7731
|
+
//#region components/dropdown/dropdown-button.tsx
|
|
7652
7732
|
var DropdownButton = /* @__PURE__ */ defineComponent({
|
|
7653
7733
|
name: "DropdownButton",
|
|
7654
7734
|
props: {
|
|
@@ -7693,6 +7773,8 @@ var DropdownButton = /* @__PURE__ */ defineComponent({
|
|
|
7693
7773
|
};
|
|
7694
7774
|
}
|
|
7695
7775
|
});
|
|
7776
|
+
//#endregion
|
|
7777
|
+
//#region components/divider/index.tsx
|
|
7696
7778
|
var Divider = /* @__PURE__ */ defineComponent({
|
|
7697
7779
|
name: "Divider",
|
|
7698
7780
|
props: {
|
|
@@ -7847,13 +7929,14 @@ var Form = /* @__PURE__ */ defineComponent({
|
|
|
7847
7929
|
provide("Form", form);
|
|
7848
7930
|
return () => {
|
|
7849
7931
|
const { layout, size, name } = props;
|
|
7932
|
+
const classes = ["k-form", {
|
|
7933
|
+
[`k-form-${layout}`]: layout,
|
|
7934
|
+
"k-form-lg": size === "large",
|
|
7935
|
+
"k-form-sm": size === "small"
|
|
7936
|
+
}];
|
|
7850
7937
|
return createVNode("form", {
|
|
7851
7938
|
"ref": formRef,
|
|
7852
|
-
"class":
|
|
7853
|
-
[`k-form-${layout}`]: layout,
|
|
7854
|
-
"k-form-lg": size === "large",
|
|
7855
|
-
"k-form-sm": size === "small"
|
|
7856
|
-
}],
|
|
7939
|
+
"class": classes,
|
|
7857
7940
|
"id": name,
|
|
7858
7941
|
"onSubmit": onSubmit,
|
|
7859
7942
|
"onReset": reset,
|
|
@@ -7862,6 +7945,8 @@ var Form = /* @__PURE__ */ defineComponent({
|
|
|
7862
7945
|
};
|
|
7863
7946
|
}
|
|
7864
7947
|
});
|
|
7948
|
+
//#endregion
|
|
7949
|
+
//#region components/row-col/col.tsx
|
|
7865
7950
|
var Col = /* @__PURE__ */ defineComponent({
|
|
7866
7951
|
name: "Col",
|
|
7867
7952
|
props: {
|
|
@@ -7906,6 +7991,8 @@ var Col = /* @__PURE__ */ defineComponent({
|
|
|
7906
7991
|
};
|
|
7907
7992
|
}
|
|
7908
7993
|
});
|
|
7994
|
+
//#endregion
|
|
7995
|
+
//#region components/row-col/row.tsx
|
|
7909
7996
|
var Row = /* @__PURE__ */ defineComponent({
|
|
7910
7997
|
name: "Row",
|
|
7911
7998
|
props: {
|
|
@@ -8106,6 +8193,8 @@ var FormItem = /* @__PURE__ */ defineComponent({
|
|
|
8106
8193
|
};
|
|
8107
8194
|
}
|
|
8108
8195
|
});
|
|
8196
|
+
//#endregion
|
|
8197
|
+
//#region components/flex/index.tsx
|
|
8109
8198
|
var Flex = /* @__PURE__ */ defineComponent({
|
|
8110
8199
|
name: "Flex",
|
|
8111
8200
|
props: {
|
|
@@ -8358,6 +8447,8 @@ var getMousePoint = () => {
|
|
|
8358
8447
|
y: 0
|
|
8359
8448
|
};
|
|
8360
8449
|
};
|
|
8450
|
+
//#endregion
|
|
8451
|
+
//#region components/tooltip/index.tsx
|
|
8361
8452
|
var Tooltip = /* @__PURE__ */ defineComponent({
|
|
8362
8453
|
name: "Tooltip",
|
|
8363
8454
|
directives: { transfer },
|
|
@@ -8425,12 +8516,16 @@ var Tooltip = /* @__PURE__ */ defineComponent({
|
|
|
8425
8516
|
rendered.value = true;
|
|
8426
8517
|
nextTick(() => {
|
|
8427
8518
|
updateShow(true);
|
|
8428
|
-
|
|
8519
|
+
nextTick(() => {
|
|
8520
|
+
updatePosition();
|
|
8521
|
+
});
|
|
8429
8522
|
});
|
|
8430
8523
|
} else {
|
|
8431
8524
|
clearTimeout(showTimer.value);
|
|
8432
8525
|
updateShow(true);
|
|
8433
|
-
|
|
8526
|
+
nextTick(() => {
|
|
8527
|
+
updatePosition();
|
|
8528
|
+
});
|
|
8434
8529
|
}
|
|
8435
8530
|
};
|
|
8436
8531
|
const hide = () => {
|
|
@@ -8595,6 +8690,8 @@ var getPosition = (e) => {
|
|
|
8595
8690
|
}
|
|
8596
8691
|
return [clientX, clientY];
|
|
8597
8692
|
};
|
|
8693
|
+
//#endregion
|
|
8694
|
+
//#region components/slider/index.tsx
|
|
8598
8695
|
var Slider = /* @__PURE__ */ defineComponent({
|
|
8599
8696
|
name: "Slider",
|
|
8600
8697
|
props: {
|
|
@@ -8646,7 +8743,10 @@ var Slider = /* @__PURE__ */ defineComponent({
|
|
|
8646
8743
|
return val;
|
|
8647
8744
|
};
|
|
8648
8745
|
const formatValue = (val) => {
|
|
8649
|
-
if (props.range)
|
|
8746
|
+
if (props.range) {
|
|
8747
|
+
const arr = Array.isArray(val) ? [...val] : [props.min, props.min];
|
|
8748
|
+
return sortValue(arr.map((v) => getClosestStep(v, props)));
|
|
8749
|
+
}
|
|
8650
8750
|
return getClosestStep(val, props);
|
|
8651
8751
|
};
|
|
8652
8752
|
const updateSize = () => {
|
|
@@ -9125,7 +9225,7 @@ var ImagePreview = /* @__PURE__ */ defineComponent({
|
|
|
9125
9225
|
});
|
|
9126
9226
|
onMounted(() => {
|
|
9127
9227
|
if (typeof window !== "undefined") {
|
|
9128
|
-
const touch = "ontouchstart" in window || navigator.maxTouchPoints > 0 || window.
|
|
9228
|
+
const touch = "ontouchstart" in window || navigator.maxTouchPoints > 0 || window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
|
|
9129
9229
|
state.touch = touch;
|
|
9130
9230
|
const event = touch ? "touchstart" : "mousedown";
|
|
9131
9231
|
document.addEventListener(event, mousedown, { passive: false });
|
|
@@ -9371,7 +9471,7 @@ var KImage = /* @__PURE__ */ defineComponent({
|
|
|
9371
9471
|
const showPreview = (e) => {
|
|
9372
9472
|
const { origin, src } = props;
|
|
9373
9473
|
if (!src && !origin || showPlaceholder.value || loading.value) return;
|
|
9374
|
-
|
|
9474
|
+
const options = {
|
|
9375
9475
|
onClose: () => {
|
|
9376
9476
|
emit("close");
|
|
9377
9477
|
setTimeout(() => {
|
|
@@ -9384,7 +9484,8 @@ var KImage = /* @__PURE__ */ defineComponent({
|
|
|
9384
9484
|
src: origin || src,
|
|
9385
9485
|
showPanel: props.showPanel,
|
|
9386
9486
|
type: props.type
|
|
9387
|
-
}
|
|
9487
|
+
};
|
|
9488
|
+
show(options, slots);
|
|
9388
9489
|
e.preventDefault();
|
|
9389
9490
|
};
|
|
9390
9491
|
const reload = () => {
|
|
@@ -9526,6 +9627,8 @@ Layout.Header = Header;
|
|
|
9526
9627
|
Layout.Footer = Footer;
|
|
9527
9628
|
Layout.Content = Content;
|
|
9528
9629
|
Layout.Sider = Sider;
|
|
9630
|
+
//#endregion
|
|
9631
|
+
//#region components/loading/index.tsx
|
|
9529
9632
|
var LoadingComponent = /* @__PURE__ */ defineComponent({
|
|
9530
9633
|
name: "LoadingBar",
|
|
9531
9634
|
props: { height: {
|
|
@@ -9638,6 +9741,8 @@ var loading = {
|
|
|
9638
9741
|
loadInstance?.destroy?.();
|
|
9639
9742
|
}
|
|
9640
9743
|
};
|
|
9744
|
+
//#endregion
|
|
9745
|
+
//#region components/menu/menu-item.tsx
|
|
9641
9746
|
var MenuItem = /* @__PURE__ */ defineComponent({
|
|
9642
9747
|
name: "MenuItem",
|
|
9643
9748
|
props: {
|
|
@@ -9690,6 +9795,8 @@ var MenuItem = /* @__PURE__ */ defineComponent({
|
|
|
9690
9795
|
};
|
|
9691
9796
|
}
|
|
9692
9797
|
});
|
|
9798
|
+
//#endregion
|
|
9799
|
+
//#region components/menu/sub-menu.tsx
|
|
9693
9800
|
var SubMenu = /* @__PURE__ */ defineComponent({
|
|
9694
9801
|
name: "SubMenu",
|
|
9695
9802
|
directives: { transfer },
|
|
@@ -9721,7 +9828,8 @@ var SubMenu = /* @__PURE__ */ defineComponent({
|
|
|
9721
9828
|
const rendered = ref(false);
|
|
9722
9829
|
onMounted(() => {
|
|
9723
9830
|
nextTick(() => {
|
|
9724
|
-
|
|
9831
|
+
const width = refSelection.value?.offsetWidth;
|
|
9832
|
+
minWidth.value = `${width}px`;
|
|
9725
9833
|
if (openKeys.value.indexOf(key) >= 0) updatePosition();
|
|
9726
9834
|
});
|
|
9727
9835
|
});
|
|
@@ -9879,6 +9987,8 @@ var RecursiveMenu = /* @__PURE__ */ defineComponent({
|
|
|
9879
9987
|
};
|
|
9880
9988
|
}
|
|
9881
9989
|
});
|
|
9990
|
+
//#endregion
|
|
9991
|
+
//#region components/menu/menu.tsx
|
|
9882
9992
|
var Menu = /* @__PURE__ */ defineComponent({
|
|
9883
9993
|
name: "Menu",
|
|
9884
9994
|
props: {
|
|
@@ -9988,6 +10098,8 @@ var MenuDivider = /* @__PURE__ */ defineComponent({
|
|
|
9988
10098
|
};
|
|
9989
10099
|
}
|
|
9990
10100
|
});
|
|
10101
|
+
//#endregion
|
|
10102
|
+
//#region components/menu/menu-group.tsx
|
|
9991
10103
|
var MenuGroup = /* @__PURE__ */ defineComponent({
|
|
9992
10104
|
name: "MenuGroup",
|
|
9993
10105
|
props: { title: {
|
|
@@ -10404,7 +10516,7 @@ var Modal = /* @__PURE__ */ defineComponent({
|
|
|
10404
10516
|
"tabindex": "0"
|
|
10405
10517
|
}, [contents]);
|
|
10406
10518
|
}
|
|
10407
|
-
const style = {
|
|
10519
|
+
const style = props.maximized ? null : {
|
|
10408
10520
|
width: typeof width === "number" ? `${width}px` : width,
|
|
10409
10521
|
top: `${currentTop.value}px`,
|
|
10410
10522
|
left: `${left.value}px`
|
|
@@ -10626,6 +10738,8 @@ var notice = {
|
|
|
10626
10738
|
});
|
|
10627
10739
|
}
|
|
10628
10740
|
};
|
|
10741
|
+
//#endregion
|
|
10742
|
+
//#region components/page/index.tsx
|
|
10629
10743
|
var Page = /* @__PURE__ */ defineComponent({
|
|
10630
10744
|
name: "Page",
|
|
10631
10745
|
props: {
|
|
@@ -10792,7 +10906,7 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
10792
10906
|
};
|
|
10793
10907
|
const renderSize = () => {
|
|
10794
10908
|
let prop = {
|
|
10795
|
-
|
|
10909
|
+
modelValue: defaultPageSize.value,
|
|
10796
10910
|
size: props.size,
|
|
10797
10911
|
clearable: false,
|
|
10798
10912
|
theme: props.theme,
|
|
@@ -10865,6 +10979,8 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
10865
10979
|
};
|
|
10866
10980
|
}
|
|
10867
10981
|
});
|
|
10982
|
+
//#endregion
|
|
10983
|
+
//#region components/poptip/index.tsx
|
|
10868
10984
|
var Poptip = /* @__PURE__ */ defineComponent({
|
|
10869
10985
|
name: "Poptip",
|
|
10870
10986
|
directives: { transfer },
|
|
@@ -10941,12 +11057,16 @@ var Poptip = /* @__PURE__ */ defineComponent({
|
|
|
10941
11057
|
document.addEventListener("click", outsideClick);
|
|
10942
11058
|
nextTick(() => {
|
|
10943
11059
|
updateShow(true);
|
|
10944
|
-
|
|
11060
|
+
nextTick(() => {
|
|
11061
|
+
updatePosition();
|
|
11062
|
+
});
|
|
10945
11063
|
});
|
|
10946
11064
|
} else {
|
|
10947
11065
|
clearTimeout(showTimer.value);
|
|
10948
11066
|
updateShow(true);
|
|
10949
|
-
|
|
11067
|
+
nextTick(() => {
|
|
11068
|
+
updatePosition();
|
|
11069
|
+
});
|
|
10950
11070
|
}
|
|
10951
11071
|
};
|
|
10952
11072
|
const hide = () => {
|
|
@@ -11021,6 +11141,8 @@ var Poptip = /* @__PURE__ */ defineComponent({
|
|
|
11021
11141
|
};
|
|
11022
11142
|
}
|
|
11023
11143
|
});
|
|
11144
|
+
//#endregion
|
|
11145
|
+
//#region components/popconfirm/index.tsx
|
|
11024
11146
|
var Popconfirm = /* @__PURE__ */ defineComponent({
|
|
11025
11147
|
name: "Popconfirm",
|
|
11026
11148
|
directives: { transfer },
|
|
@@ -11098,12 +11220,16 @@ var Popconfirm = /* @__PURE__ */ defineComponent({
|
|
|
11098
11220
|
document.addEventListener("click", outsideClick);
|
|
11099
11221
|
nextTick(() => {
|
|
11100
11222
|
updateShow(true);
|
|
11101
|
-
|
|
11223
|
+
nextTick(() => {
|
|
11224
|
+
updatePosition();
|
|
11225
|
+
});
|
|
11102
11226
|
});
|
|
11103
11227
|
} else {
|
|
11104
11228
|
clearTimeout(showTimer.value);
|
|
11105
11229
|
updateShow(true);
|
|
11106
|
-
|
|
11230
|
+
nextTick(() => {
|
|
11231
|
+
updatePosition();
|
|
11232
|
+
});
|
|
11107
11233
|
}
|
|
11108
11234
|
};
|
|
11109
11235
|
const ok = () => {
|
|
@@ -11181,6 +11307,8 @@ var Popconfirm = /* @__PURE__ */ defineComponent({
|
|
|
11181
11307
|
};
|
|
11182
11308
|
}
|
|
11183
11309
|
});
|
|
11310
|
+
//#endregion
|
|
11311
|
+
//#region components/progress/index.tsx
|
|
11184
11312
|
var Progress = /* @__PURE__ */ defineComponent({
|
|
11185
11313
|
name: "Progress",
|
|
11186
11314
|
props: {
|
|
@@ -11318,115 +11446,2762 @@ var Progress = /* @__PURE__ */ defineComponent({
|
|
|
11318
11446
|
};
|
|
11319
11447
|
}
|
|
11320
11448
|
});
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11449
|
+
//#endregion
|
|
11450
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
|
|
11451
|
+
var require_can_promise = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11452
|
+
module.exports = function() {
|
|
11453
|
+
return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
|
|
11454
|
+
};
|
|
11455
|
+
}));
|
|
11456
|
+
//#endregion
|
|
11457
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js
|
|
11458
|
+
var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11459
|
+
var toSJISFunction;
|
|
11460
|
+
var CODEWORDS_COUNT = [
|
|
11461
|
+
0,
|
|
11462
|
+
26,
|
|
11463
|
+
44,
|
|
11464
|
+
70,
|
|
11465
|
+
100,
|
|
11466
|
+
134,
|
|
11467
|
+
172,
|
|
11468
|
+
196,
|
|
11469
|
+
242,
|
|
11470
|
+
292,
|
|
11471
|
+
346,
|
|
11472
|
+
404,
|
|
11473
|
+
466,
|
|
11474
|
+
532,
|
|
11475
|
+
581,
|
|
11476
|
+
655,
|
|
11477
|
+
733,
|
|
11478
|
+
815,
|
|
11479
|
+
901,
|
|
11480
|
+
991,
|
|
11481
|
+
1085,
|
|
11482
|
+
1156,
|
|
11483
|
+
1258,
|
|
11484
|
+
1364,
|
|
11485
|
+
1474,
|
|
11486
|
+
1588,
|
|
11487
|
+
1706,
|
|
11488
|
+
1828,
|
|
11489
|
+
1921,
|
|
11490
|
+
2051,
|
|
11491
|
+
2185,
|
|
11492
|
+
2323,
|
|
11493
|
+
2465,
|
|
11494
|
+
2611,
|
|
11495
|
+
2761,
|
|
11496
|
+
2876,
|
|
11497
|
+
3034,
|
|
11498
|
+
3196,
|
|
11499
|
+
3362,
|
|
11500
|
+
3532,
|
|
11501
|
+
3706
|
|
11502
|
+
];
|
|
11503
|
+
/**
|
|
11504
|
+
* Returns the QR Code size for the specified version
|
|
11505
|
+
*
|
|
11506
|
+
* @param {Number} version QR Code version
|
|
11507
|
+
* @return {Number} size of QR code
|
|
11508
|
+
*/
|
|
11509
|
+
exports.getSymbolSize = function getSymbolSize(version) {
|
|
11510
|
+
if (!version) throw new Error("\"version\" cannot be null or undefined");
|
|
11511
|
+
if (version < 1 || version > 40) throw new Error("\"version\" should be in range from 1 to 40");
|
|
11512
|
+
return version * 4 + 17;
|
|
11513
|
+
};
|
|
11514
|
+
/**
|
|
11515
|
+
* Returns the total number of codewords used to store data and EC information.
|
|
11516
|
+
*
|
|
11517
|
+
* @param {Number} version QR Code version
|
|
11518
|
+
* @return {Number} Data length in bits
|
|
11519
|
+
*/
|
|
11520
|
+
exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
|
|
11521
|
+
return CODEWORDS_COUNT[version];
|
|
11522
|
+
};
|
|
11523
|
+
/**
|
|
11524
|
+
* Encode data with Bose-Chaudhuri-Hocquenghem
|
|
11525
|
+
*
|
|
11526
|
+
* @param {Number} data Value to encode
|
|
11527
|
+
* @return {Number} Encoded value
|
|
11528
|
+
*/
|
|
11529
|
+
exports.getBCHDigit = function(data) {
|
|
11530
|
+
let digit = 0;
|
|
11531
|
+
while (data !== 0) {
|
|
11532
|
+
digit++;
|
|
11533
|
+
data >>>= 1;
|
|
11534
|
+
}
|
|
11535
|
+
return digit;
|
|
11536
|
+
};
|
|
11537
|
+
exports.setToSJISFunction = function setToSJISFunction(f) {
|
|
11538
|
+
if (typeof f !== "function") throw new Error("\"toSJISFunc\" is not a valid function.");
|
|
11539
|
+
toSJISFunction = f;
|
|
11540
|
+
};
|
|
11541
|
+
exports.isKanjiModeEnabled = function() {
|
|
11542
|
+
return typeof toSJISFunction !== "undefined";
|
|
11543
|
+
};
|
|
11544
|
+
exports.toSJIS = function toSJIS(kanji) {
|
|
11545
|
+
return toSJISFunction(kanji);
|
|
11546
|
+
};
|
|
11547
|
+
}));
|
|
11548
|
+
//#endregion
|
|
11549
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js
|
|
11550
|
+
var require_error_correction_level = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11551
|
+
exports.L = { bit: 1 };
|
|
11552
|
+
exports.M = { bit: 0 };
|
|
11553
|
+
exports.Q = { bit: 3 };
|
|
11554
|
+
exports.H = { bit: 2 };
|
|
11555
|
+
function fromString(string) {
|
|
11556
|
+
if (typeof string !== "string") throw new Error("Param is not a string");
|
|
11557
|
+
switch (string.toLowerCase()) {
|
|
11558
|
+
case "l":
|
|
11559
|
+
case "low": return exports.L;
|
|
11560
|
+
case "m":
|
|
11561
|
+
case "medium": return exports.M;
|
|
11562
|
+
case "q":
|
|
11563
|
+
case "quartile": return exports.Q;
|
|
11564
|
+
case "h":
|
|
11565
|
+
case "high": return exports.H;
|
|
11566
|
+
default: throw new Error("Unknown EC Level: " + string);
|
|
11567
|
+
}
|
|
11568
|
+
}
|
|
11569
|
+
exports.isValid = function isValid(level) {
|
|
11570
|
+
return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;
|
|
11571
|
+
};
|
|
11572
|
+
exports.from = function from(value, defaultValue) {
|
|
11573
|
+
if (exports.isValid(value)) return value;
|
|
11574
|
+
try {
|
|
11575
|
+
return fromString(value);
|
|
11576
|
+
} catch (e) {
|
|
11577
|
+
return defaultValue;
|
|
11578
|
+
}
|
|
11579
|
+
};
|
|
11580
|
+
}));
|
|
11581
|
+
//#endregion
|
|
11582
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js
|
|
11583
|
+
var require_bit_buffer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11584
|
+
function BitBuffer() {
|
|
11585
|
+
this.buffer = [];
|
|
11586
|
+
this.length = 0;
|
|
11587
|
+
}
|
|
11588
|
+
BitBuffer.prototype = {
|
|
11589
|
+
get: function(index) {
|
|
11590
|
+
const bufIndex = Math.floor(index / 8);
|
|
11591
|
+
return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
|
|
11331
11592
|
},
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
Number,
|
|
11335
|
-
Boolean
|
|
11336
|
-
] },
|
|
11337
|
-
label: { type: String },
|
|
11338
|
-
checked: Boolean,
|
|
11339
|
-
disabled: Boolean,
|
|
11340
|
-
theme: {
|
|
11341
|
-
type: String,
|
|
11342
|
-
default: "fill"
|
|
11593
|
+
put: function(num, length) {
|
|
11594
|
+
for (let i = 0; i < length; i++) this.putBit((num >>> length - i - 1 & 1) === 1);
|
|
11343
11595
|
},
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
const checked = e.target.checked;
|
|
11370
|
-
emitValue(checked);
|
|
11371
|
-
};
|
|
11372
|
-
const triggerCheck = (e) => {
|
|
11373
|
-
if (e.code == "Space") {
|
|
11374
|
-
e.preventDefault();
|
|
11375
|
-
e.stopPropagation();
|
|
11376
|
-
if (props.disabled || isChecked.value) return;
|
|
11377
|
-
emitValue(!isChecked.value);
|
|
11378
|
-
}
|
|
11379
|
-
};
|
|
11380
|
-
return () => {
|
|
11381
|
-
const classes = ["k-radio", {
|
|
11382
|
-
["k-radio-fill"]: props.theme == "fill",
|
|
11383
|
-
["k-radio-disabled"]: props.disabled,
|
|
11384
|
-
["k-radio-checked"]: isChecked.value,
|
|
11385
|
-
["k-radio-lg"]: props.size === "large",
|
|
11386
|
-
["k-radio-sm"]: props.size === "small"
|
|
11387
|
-
}];
|
|
11388
|
-
const labelNode = props.label || slots.default?.();
|
|
11389
|
-
return createVNode("label", {
|
|
11390
|
-
"class": classes,
|
|
11391
|
-
"tabindex": props.disabled ? void 0 : 0,
|
|
11392
|
-
"onKeydown": triggerCheck
|
|
11393
|
-
}, [createVNode("span", { "class": "k-radio-symbol" }, [createVNode("input", {
|
|
11394
|
-
"type": "radio",
|
|
11395
|
-
"tabindex": "-1",
|
|
11396
|
-
"class": "k-radio-input",
|
|
11397
|
-
"disabled": props.disabled,
|
|
11398
|
-
"onChange": onChange,
|
|
11399
|
-
"checked": isChecked.value
|
|
11400
|
-
}, null)]), labelNode ? createVNode("span", { "class": "k-radio-label" }, [labelNode]) : null]);
|
|
11401
|
-
};
|
|
11596
|
+
getLengthInBits: function() {
|
|
11597
|
+
return this.length;
|
|
11598
|
+
},
|
|
11599
|
+
putBit: function(bit) {
|
|
11600
|
+
const bufIndex = Math.floor(this.length / 8);
|
|
11601
|
+
if (this.buffer.length <= bufIndex) this.buffer.push(0);
|
|
11602
|
+
if (bit) this.buffer[bufIndex] |= 128 >>> this.length % 8;
|
|
11603
|
+
this.length++;
|
|
11604
|
+
}
|
|
11605
|
+
};
|
|
11606
|
+
module.exports = BitBuffer;
|
|
11607
|
+
}));
|
|
11608
|
+
//#endregion
|
|
11609
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js
|
|
11610
|
+
var require_bit_matrix = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11611
|
+
/**
|
|
11612
|
+
* Helper class to handle QR Code symbol modules
|
|
11613
|
+
*
|
|
11614
|
+
* @param {Number} size Symbol size
|
|
11615
|
+
*/
|
|
11616
|
+
function BitMatrix(size) {
|
|
11617
|
+
if (!size || size < 1) throw new Error("BitMatrix size must be defined and greater than 0");
|
|
11618
|
+
this.size = size;
|
|
11619
|
+
this.data = new Uint8Array(size * size);
|
|
11620
|
+
this.reservedBit = new Uint8Array(size * size);
|
|
11402
11621
|
}
|
|
11403
|
-
|
|
11622
|
+
/**
|
|
11623
|
+
* Set bit value at specified location
|
|
11624
|
+
* If reserved flag is set, this bit will be ignored during masking process
|
|
11625
|
+
*
|
|
11626
|
+
* @param {Number} row
|
|
11627
|
+
* @param {Number} col
|
|
11628
|
+
* @param {Boolean} value
|
|
11629
|
+
* @param {Boolean} reserved
|
|
11630
|
+
*/
|
|
11631
|
+
BitMatrix.prototype.set = function(row, col, value, reserved) {
|
|
11632
|
+
const index = row * this.size + col;
|
|
11633
|
+
this.data[index] = value;
|
|
11634
|
+
if (reserved) this.reservedBit[index] = true;
|
|
11635
|
+
};
|
|
11636
|
+
/**
|
|
11637
|
+
* Returns bit value at specified location
|
|
11638
|
+
*
|
|
11639
|
+
* @param {Number} row
|
|
11640
|
+
* @param {Number} col
|
|
11641
|
+
* @return {Boolean}
|
|
11642
|
+
*/
|
|
11643
|
+
BitMatrix.prototype.get = function(row, col) {
|
|
11644
|
+
return this.data[row * this.size + col];
|
|
11645
|
+
};
|
|
11646
|
+
/**
|
|
11647
|
+
* Applies xor operator at specified location
|
|
11648
|
+
* (used during masking process)
|
|
11649
|
+
*
|
|
11650
|
+
* @param {Number} row
|
|
11651
|
+
* @param {Number} col
|
|
11652
|
+
* @param {Boolean} value
|
|
11653
|
+
*/
|
|
11654
|
+
BitMatrix.prototype.xor = function(row, col, value) {
|
|
11655
|
+
this.data[row * this.size + col] ^= value;
|
|
11656
|
+
};
|
|
11657
|
+
/**
|
|
11658
|
+
* Check if bit at specified location is reserved
|
|
11659
|
+
*
|
|
11660
|
+
* @param {Number} row
|
|
11661
|
+
* @param {Number} col
|
|
11662
|
+
* @return {Boolean}
|
|
11663
|
+
*/
|
|
11664
|
+
BitMatrix.prototype.isReserved = function(row, col) {
|
|
11665
|
+
return this.reservedBit[row * this.size + col];
|
|
11666
|
+
};
|
|
11667
|
+
module.exports = BitMatrix;
|
|
11668
|
+
}));
|
|
11404
11669
|
//#endregion
|
|
11405
|
-
//#region
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11670
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js
|
|
11671
|
+
var require_alignment_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11672
|
+
/**
|
|
11673
|
+
* Alignment pattern are fixed reference pattern in defined positions
|
|
11674
|
+
* in a matrix symbology, which enables the decode software to re-synchronise
|
|
11675
|
+
* the coordinate mapping of the image modules in the event of moderate amounts
|
|
11676
|
+
* of distortion of the image.
|
|
11677
|
+
*
|
|
11678
|
+
* Alignment patterns are present only in QR Code symbols of version 2 or larger
|
|
11679
|
+
* and their number depends on the symbol version.
|
|
11680
|
+
*/
|
|
11681
|
+
var getSymbolSize = require_utils$1().getSymbolSize;
|
|
11682
|
+
/**
|
|
11683
|
+
* Calculate the row/column coordinates of the center module of each alignment pattern
|
|
11684
|
+
* for the specified QR Code version.
|
|
11685
|
+
*
|
|
11686
|
+
* The alignment patterns are positioned symmetrically on either side of the diagonal
|
|
11687
|
+
* running from the top left corner of the symbol to the bottom right corner.
|
|
11688
|
+
*
|
|
11689
|
+
* Since positions are simmetrical only half of the coordinates are returned.
|
|
11690
|
+
* Each item of the array will represent in turn the x and y coordinate.
|
|
11691
|
+
* @see {@link getPositions}
|
|
11692
|
+
*
|
|
11693
|
+
* @param {Number} version QR Code version
|
|
11694
|
+
* @return {Array} Array of coordinate
|
|
11695
|
+
*/
|
|
11696
|
+
exports.getRowColCoords = function getRowColCoords(version) {
|
|
11697
|
+
if (version === 1) return [];
|
|
11698
|
+
const posCount = Math.floor(version / 7) + 2;
|
|
11699
|
+
const size = getSymbolSize(version);
|
|
11700
|
+
const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
|
|
11701
|
+
const positions = [size - 7];
|
|
11702
|
+
for (let i = 1; i < posCount - 1; i++) positions[i] = positions[i - 1] - intervals;
|
|
11703
|
+
positions.push(6);
|
|
11704
|
+
return positions.reverse();
|
|
11705
|
+
};
|
|
11706
|
+
/**
|
|
11707
|
+
* Returns an array containing the positions of each alignment pattern.
|
|
11708
|
+
* Each array's element represent the center point of the pattern as (x, y) coordinates
|
|
11709
|
+
*
|
|
11710
|
+
* Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
|
|
11711
|
+
* and filtering out the items that overlaps with finder pattern
|
|
11712
|
+
*
|
|
11713
|
+
* @example
|
|
11714
|
+
* For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
|
|
11715
|
+
* The alignment patterns, therefore, are to be centered on (row, column)
|
|
11716
|
+
* positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
|
|
11717
|
+
* Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
|
|
11718
|
+
* and are not therefore used for alignment patterns.
|
|
11719
|
+
*
|
|
11720
|
+
* let pos = getPositions(7)
|
|
11721
|
+
* // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
|
|
11722
|
+
*
|
|
11723
|
+
* @param {Number} version QR Code version
|
|
11724
|
+
* @return {Array} Array of coordinates
|
|
11725
|
+
*/
|
|
11726
|
+
exports.getPositions = function getPositions(version) {
|
|
11727
|
+
const coords = [];
|
|
11728
|
+
const pos = exports.getRowColCoords(version);
|
|
11729
|
+
const posLength = pos.length;
|
|
11730
|
+
for (let i = 0; i < posLength; i++) for (let j = 0; j < posLength; j++) {
|
|
11731
|
+
if (i === 0 && j === 0 || i === 0 && j === posLength - 1 || i === posLength - 1 && j === 0) continue;
|
|
11732
|
+
coords.push([pos[i], pos[j]]);
|
|
11733
|
+
}
|
|
11734
|
+
return coords;
|
|
11735
|
+
};
|
|
11736
|
+
}));
|
|
11737
|
+
//#endregion
|
|
11738
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js
|
|
11739
|
+
var require_finder_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11740
|
+
var getSymbolSize = require_utils$1().getSymbolSize;
|
|
11741
|
+
var FINDER_PATTERN_SIZE = 7;
|
|
11742
|
+
/**
|
|
11743
|
+
* Returns an array containing the positions of each finder pattern.
|
|
11744
|
+
* Each array's element represent the top-left point of the pattern as (x, y) coordinates
|
|
11745
|
+
*
|
|
11746
|
+
* @param {Number} version QR Code version
|
|
11747
|
+
* @return {Array} Array of coordinates
|
|
11748
|
+
*/
|
|
11749
|
+
exports.getPositions = function getPositions(version) {
|
|
11750
|
+
const size = getSymbolSize(version);
|
|
11751
|
+
return [
|
|
11752
|
+
[0, 0],
|
|
11753
|
+
[size - FINDER_PATTERN_SIZE, 0],
|
|
11754
|
+
[0, size - FINDER_PATTERN_SIZE]
|
|
11755
|
+
];
|
|
11756
|
+
};
|
|
11757
|
+
}));
|
|
11758
|
+
//#endregion
|
|
11759
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js
|
|
11760
|
+
var require_mask_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11761
|
+
/**
|
|
11762
|
+
* Data mask pattern reference
|
|
11763
|
+
* @type {Object}
|
|
11764
|
+
*/
|
|
11765
|
+
exports.Patterns = {
|
|
11766
|
+
PATTERN000: 0,
|
|
11767
|
+
PATTERN001: 1,
|
|
11768
|
+
PATTERN010: 2,
|
|
11769
|
+
PATTERN011: 3,
|
|
11770
|
+
PATTERN100: 4,
|
|
11771
|
+
PATTERN101: 5,
|
|
11772
|
+
PATTERN110: 6,
|
|
11773
|
+
PATTERN111: 7
|
|
11774
|
+
};
|
|
11775
|
+
/**
|
|
11776
|
+
* Weighted penalty scores for the undesirable features
|
|
11777
|
+
* @type {Object}
|
|
11778
|
+
*/
|
|
11779
|
+
var PenaltyScores = {
|
|
11780
|
+
N1: 3,
|
|
11781
|
+
N2: 3,
|
|
11782
|
+
N3: 40,
|
|
11783
|
+
N4: 10
|
|
11784
|
+
};
|
|
11785
|
+
/**
|
|
11786
|
+
* Check if mask pattern value is valid
|
|
11787
|
+
*
|
|
11788
|
+
* @param {Number} mask Mask pattern
|
|
11789
|
+
* @return {Boolean} true if valid, false otherwise
|
|
11790
|
+
*/
|
|
11791
|
+
exports.isValid = function isValid(mask) {
|
|
11792
|
+
return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
|
|
11793
|
+
};
|
|
11794
|
+
/**
|
|
11795
|
+
* Returns mask pattern from a value.
|
|
11796
|
+
* If value is not valid, returns undefined
|
|
11797
|
+
*
|
|
11798
|
+
* @param {Number|String} value Mask pattern value
|
|
11799
|
+
* @return {Number} Valid mask pattern or undefined
|
|
11800
|
+
*/
|
|
11801
|
+
exports.from = function from(value) {
|
|
11802
|
+
return exports.isValid(value) ? parseInt(value, 10) : void 0;
|
|
11803
|
+
};
|
|
11804
|
+
/**
|
|
11805
|
+
* Find adjacent modules in row/column with the same color
|
|
11806
|
+
* and assign a penalty value.
|
|
11807
|
+
*
|
|
11808
|
+
* Points: N1 + i
|
|
11809
|
+
* i is the amount by which the number of adjacent modules of the same color exceeds 5
|
|
11810
|
+
*/
|
|
11811
|
+
exports.getPenaltyN1 = function getPenaltyN1(data) {
|
|
11812
|
+
const size = data.size;
|
|
11813
|
+
let points = 0;
|
|
11814
|
+
let sameCountCol = 0;
|
|
11815
|
+
let sameCountRow = 0;
|
|
11816
|
+
let lastCol = null;
|
|
11817
|
+
let lastRow = null;
|
|
11818
|
+
for (let row = 0; row < size; row++) {
|
|
11819
|
+
sameCountCol = sameCountRow = 0;
|
|
11820
|
+
lastCol = lastRow = null;
|
|
11821
|
+
for (let col = 0; col < size; col++) {
|
|
11822
|
+
let module$1 = data.get(row, col);
|
|
11823
|
+
if (module$1 === lastCol) sameCountCol++;
|
|
11824
|
+
else {
|
|
11825
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
|
|
11826
|
+
lastCol = module$1;
|
|
11827
|
+
sameCountCol = 1;
|
|
11828
|
+
}
|
|
11829
|
+
module$1 = data.get(col, row);
|
|
11830
|
+
if (module$1 === lastRow) sameCountRow++;
|
|
11831
|
+
else {
|
|
11832
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
|
|
11833
|
+
lastRow = module$1;
|
|
11834
|
+
sameCountRow = 1;
|
|
11835
|
+
}
|
|
11836
|
+
}
|
|
11837
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
|
|
11838
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
|
|
11839
|
+
}
|
|
11840
|
+
return points;
|
|
11841
|
+
};
|
|
11842
|
+
/**
|
|
11843
|
+
* Find 2x2 blocks with the same color and assign a penalty value
|
|
11844
|
+
*
|
|
11845
|
+
* Points: N2 * (m - 1) * (n - 1)
|
|
11846
|
+
*/
|
|
11847
|
+
exports.getPenaltyN2 = function getPenaltyN2(data) {
|
|
11848
|
+
const size = data.size;
|
|
11849
|
+
let points = 0;
|
|
11850
|
+
for (let row = 0; row < size - 1; row++) for (let col = 0; col < size - 1; col++) {
|
|
11851
|
+
const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
|
|
11852
|
+
if (last === 4 || last === 0) points++;
|
|
11853
|
+
}
|
|
11854
|
+
return points * PenaltyScores.N2;
|
|
11855
|
+
};
|
|
11856
|
+
/**
|
|
11857
|
+
* Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
|
|
11858
|
+
* preceded or followed by light area 4 modules wide
|
|
11859
|
+
*
|
|
11860
|
+
* Points: N3 * number of pattern found
|
|
11861
|
+
*/
|
|
11862
|
+
exports.getPenaltyN3 = function getPenaltyN3(data) {
|
|
11863
|
+
const size = data.size;
|
|
11864
|
+
let points = 0;
|
|
11865
|
+
let bitsCol = 0;
|
|
11866
|
+
let bitsRow = 0;
|
|
11867
|
+
for (let row = 0; row < size; row++) {
|
|
11868
|
+
bitsCol = bitsRow = 0;
|
|
11869
|
+
for (let col = 0; col < size; col++) {
|
|
11870
|
+
bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
|
|
11871
|
+
if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;
|
|
11872
|
+
bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
|
|
11873
|
+
if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;
|
|
11874
|
+
}
|
|
11875
|
+
}
|
|
11876
|
+
return points * PenaltyScores.N3;
|
|
11877
|
+
};
|
|
11878
|
+
/**
|
|
11879
|
+
* Calculate proportion of dark modules in entire symbol
|
|
11880
|
+
*
|
|
11881
|
+
* Points: N4 * k
|
|
11882
|
+
*
|
|
11883
|
+
* k is the rating of the deviation of the proportion of dark modules
|
|
11884
|
+
* in the symbol from 50% in steps of 5%
|
|
11885
|
+
*/
|
|
11886
|
+
exports.getPenaltyN4 = function getPenaltyN4(data) {
|
|
11887
|
+
let darkCount = 0;
|
|
11888
|
+
const modulesCount = data.data.length;
|
|
11889
|
+
for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];
|
|
11890
|
+
return Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10) * PenaltyScores.N4;
|
|
11891
|
+
};
|
|
11892
|
+
/**
|
|
11893
|
+
* Return mask value at given position
|
|
11894
|
+
*
|
|
11895
|
+
* @param {Number} maskPattern Pattern reference value
|
|
11896
|
+
* @param {Number} i Row
|
|
11897
|
+
* @param {Number} j Column
|
|
11898
|
+
* @return {Boolean} Mask value
|
|
11899
|
+
*/
|
|
11900
|
+
function getMaskAt(maskPattern, i, j) {
|
|
11901
|
+
switch (maskPattern) {
|
|
11902
|
+
case exports.Patterns.PATTERN000: return (i + j) % 2 === 0;
|
|
11903
|
+
case exports.Patterns.PATTERN001: return i % 2 === 0;
|
|
11904
|
+
case exports.Patterns.PATTERN010: return j % 3 === 0;
|
|
11905
|
+
case exports.Patterns.PATTERN011: return (i + j) % 3 === 0;
|
|
11906
|
+
case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
|
|
11907
|
+
case exports.Patterns.PATTERN101: return i * j % 2 + i * j % 3 === 0;
|
|
11908
|
+
case exports.Patterns.PATTERN110: return (i * j % 2 + i * j % 3) % 2 === 0;
|
|
11909
|
+
case exports.Patterns.PATTERN111: return (i * j % 3 + (i + j) % 2) % 2 === 0;
|
|
11910
|
+
default: throw new Error("bad maskPattern:" + maskPattern);
|
|
11911
|
+
}
|
|
11912
|
+
}
|
|
11913
|
+
/**
|
|
11914
|
+
* Apply a mask pattern to a BitMatrix
|
|
11915
|
+
*
|
|
11916
|
+
* @param {Number} pattern Pattern reference number
|
|
11917
|
+
* @param {BitMatrix} data BitMatrix data
|
|
11918
|
+
*/
|
|
11919
|
+
exports.applyMask = function applyMask(pattern, data) {
|
|
11920
|
+
const size = data.size;
|
|
11921
|
+
for (let col = 0; col < size; col++) for (let row = 0; row < size; row++) {
|
|
11922
|
+
if (data.isReserved(row, col)) continue;
|
|
11923
|
+
data.xor(row, col, getMaskAt(pattern, row, col));
|
|
11924
|
+
}
|
|
11925
|
+
};
|
|
11926
|
+
/**
|
|
11927
|
+
* Returns the best mask pattern for data
|
|
11928
|
+
*
|
|
11929
|
+
* @param {BitMatrix} data
|
|
11930
|
+
* @return {Number} Mask pattern reference number
|
|
11931
|
+
*/
|
|
11932
|
+
exports.getBestMask = function getBestMask(data, setupFormatFunc) {
|
|
11933
|
+
const numPatterns = Object.keys(exports.Patterns).length;
|
|
11934
|
+
let bestPattern = 0;
|
|
11935
|
+
let lowerPenalty = Infinity;
|
|
11936
|
+
for (let p = 0; p < numPatterns; p++) {
|
|
11937
|
+
setupFormatFunc(p);
|
|
11938
|
+
exports.applyMask(p, data);
|
|
11939
|
+
const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);
|
|
11940
|
+
exports.applyMask(p, data);
|
|
11941
|
+
if (penalty < lowerPenalty) {
|
|
11942
|
+
lowerPenalty = penalty;
|
|
11943
|
+
bestPattern = p;
|
|
11944
|
+
}
|
|
11945
|
+
}
|
|
11946
|
+
return bestPattern;
|
|
11947
|
+
};
|
|
11948
|
+
}));
|
|
11949
|
+
//#endregion
|
|
11950
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js
|
|
11951
|
+
var require_error_correction_code = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11952
|
+
var ECLevel = require_error_correction_level();
|
|
11953
|
+
var EC_BLOCKS_TABLE = [
|
|
11954
|
+
1,
|
|
11955
|
+
1,
|
|
11956
|
+
1,
|
|
11957
|
+
1,
|
|
11958
|
+
1,
|
|
11959
|
+
1,
|
|
11960
|
+
1,
|
|
11961
|
+
1,
|
|
11962
|
+
1,
|
|
11963
|
+
1,
|
|
11964
|
+
2,
|
|
11965
|
+
2,
|
|
11966
|
+
1,
|
|
11967
|
+
2,
|
|
11968
|
+
2,
|
|
11969
|
+
4,
|
|
11970
|
+
1,
|
|
11971
|
+
2,
|
|
11972
|
+
4,
|
|
11973
|
+
4,
|
|
11974
|
+
2,
|
|
11975
|
+
4,
|
|
11976
|
+
4,
|
|
11977
|
+
4,
|
|
11978
|
+
2,
|
|
11979
|
+
4,
|
|
11980
|
+
6,
|
|
11981
|
+
5,
|
|
11982
|
+
2,
|
|
11983
|
+
4,
|
|
11984
|
+
6,
|
|
11985
|
+
6,
|
|
11986
|
+
2,
|
|
11987
|
+
5,
|
|
11988
|
+
8,
|
|
11989
|
+
8,
|
|
11990
|
+
4,
|
|
11991
|
+
5,
|
|
11992
|
+
8,
|
|
11993
|
+
8,
|
|
11994
|
+
4,
|
|
11995
|
+
5,
|
|
11996
|
+
8,
|
|
11997
|
+
11,
|
|
11998
|
+
4,
|
|
11999
|
+
8,
|
|
12000
|
+
10,
|
|
12001
|
+
11,
|
|
12002
|
+
4,
|
|
12003
|
+
9,
|
|
12004
|
+
12,
|
|
12005
|
+
16,
|
|
12006
|
+
4,
|
|
12007
|
+
9,
|
|
12008
|
+
16,
|
|
12009
|
+
16,
|
|
12010
|
+
6,
|
|
12011
|
+
10,
|
|
12012
|
+
12,
|
|
12013
|
+
18,
|
|
12014
|
+
6,
|
|
12015
|
+
10,
|
|
12016
|
+
17,
|
|
12017
|
+
16,
|
|
12018
|
+
6,
|
|
12019
|
+
11,
|
|
12020
|
+
16,
|
|
12021
|
+
19,
|
|
12022
|
+
6,
|
|
12023
|
+
13,
|
|
12024
|
+
18,
|
|
12025
|
+
21,
|
|
12026
|
+
7,
|
|
12027
|
+
14,
|
|
12028
|
+
21,
|
|
12029
|
+
25,
|
|
12030
|
+
8,
|
|
12031
|
+
16,
|
|
12032
|
+
20,
|
|
12033
|
+
25,
|
|
12034
|
+
8,
|
|
12035
|
+
17,
|
|
12036
|
+
23,
|
|
12037
|
+
25,
|
|
12038
|
+
9,
|
|
12039
|
+
17,
|
|
12040
|
+
23,
|
|
12041
|
+
34,
|
|
12042
|
+
9,
|
|
12043
|
+
18,
|
|
12044
|
+
25,
|
|
12045
|
+
30,
|
|
12046
|
+
10,
|
|
12047
|
+
20,
|
|
12048
|
+
27,
|
|
12049
|
+
32,
|
|
12050
|
+
12,
|
|
12051
|
+
21,
|
|
12052
|
+
29,
|
|
12053
|
+
35,
|
|
12054
|
+
12,
|
|
12055
|
+
23,
|
|
12056
|
+
34,
|
|
12057
|
+
37,
|
|
12058
|
+
12,
|
|
12059
|
+
25,
|
|
12060
|
+
34,
|
|
12061
|
+
40,
|
|
12062
|
+
13,
|
|
12063
|
+
26,
|
|
12064
|
+
35,
|
|
12065
|
+
42,
|
|
12066
|
+
14,
|
|
12067
|
+
28,
|
|
12068
|
+
38,
|
|
12069
|
+
45,
|
|
12070
|
+
15,
|
|
12071
|
+
29,
|
|
12072
|
+
40,
|
|
12073
|
+
48,
|
|
12074
|
+
16,
|
|
12075
|
+
31,
|
|
12076
|
+
43,
|
|
12077
|
+
51,
|
|
12078
|
+
17,
|
|
12079
|
+
33,
|
|
12080
|
+
45,
|
|
12081
|
+
54,
|
|
12082
|
+
18,
|
|
12083
|
+
35,
|
|
12084
|
+
48,
|
|
12085
|
+
57,
|
|
12086
|
+
19,
|
|
12087
|
+
37,
|
|
12088
|
+
51,
|
|
12089
|
+
60,
|
|
12090
|
+
19,
|
|
12091
|
+
38,
|
|
12092
|
+
53,
|
|
12093
|
+
63,
|
|
12094
|
+
20,
|
|
12095
|
+
40,
|
|
12096
|
+
56,
|
|
12097
|
+
66,
|
|
12098
|
+
21,
|
|
12099
|
+
43,
|
|
12100
|
+
59,
|
|
12101
|
+
70,
|
|
12102
|
+
22,
|
|
12103
|
+
45,
|
|
12104
|
+
62,
|
|
12105
|
+
74,
|
|
12106
|
+
24,
|
|
12107
|
+
47,
|
|
12108
|
+
65,
|
|
12109
|
+
77,
|
|
12110
|
+
25,
|
|
12111
|
+
49,
|
|
12112
|
+
68,
|
|
12113
|
+
81
|
|
12114
|
+
];
|
|
12115
|
+
var EC_CODEWORDS_TABLE = [
|
|
12116
|
+
7,
|
|
12117
|
+
10,
|
|
12118
|
+
13,
|
|
12119
|
+
17,
|
|
12120
|
+
10,
|
|
12121
|
+
16,
|
|
12122
|
+
22,
|
|
12123
|
+
28,
|
|
12124
|
+
15,
|
|
12125
|
+
26,
|
|
12126
|
+
36,
|
|
12127
|
+
44,
|
|
12128
|
+
20,
|
|
12129
|
+
36,
|
|
12130
|
+
52,
|
|
12131
|
+
64,
|
|
12132
|
+
26,
|
|
12133
|
+
48,
|
|
12134
|
+
72,
|
|
12135
|
+
88,
|
|
12136
|
+
36,
|
|
12137
|
+
64,
|
|
12138
|
+
96,
|
|
12139
|
+
112,
|
|
12140
|
+
40,
|
|
12141
|
+
72,
|
|
12142
|
+
108,
|
|
12143
|
+
130,
|
|
12144
|
+
48,
|
|
12145
|
+
88,
|
|
12146
|
+
132,
|
|
12147
|
+
156,
|
|
12148
|
+
60,
|
|
12149
|
+
110,
|
|
12150
|
+
160,
|
|
12151
|
+
192,
|
|
12152
|
+
72,
|
|
12153
|
+
130,
|
|
12154
|
+
192,
|
|
12155
|
+
224,
|
|
12156
|
+
80,
|
|
12157
|
+
150,
|
|
12158
|
+
224,
|
|
12159
|
+
264,
|
|
12160
|
+
96,
|
|
12161
|
+
176,
|
|
12162
|
+
260,
|
|
12163
|
+
308,
|
|
12164
|
+
104,
|
|
12165
|
+
198,
|
|
12166
|
+
288,
|
|
12167
|
+
352,
|
|
12168
|
+
120,
|
|
12169
|
+
216,
|
|
12170
|
+
320,
|
|
12171
|
+
384,
|
|
12172
|
+
132,
|
|
12173
|
+
240,
|
|
12174
|
+
360,
|
|
12175
|
+
432,
|
|
12176
|
+
144,
|
|
12177
|
+
280,
|
|
12178
|
+
408,
|
|
12179
|
+
480,
|
|
12180
|
+
168,
|
|
12181
|
+
308,
|
|
12182
|
+
448,
|
|
12183
|
+
532,
|
|
12184
|
+
180,
|
|
12185
|
+
338,
|
|
12186
|
+
504,
|
|
12187
|
+
588,
|
|
12188
|
+
196,
|
|
12189
|
+
364,
|
|
12190
|
+
546,
|
|
12191
|
+
650,
|
|
12192
|
+
224,
|
|
12193
|
+
416,
|
|
12194
|
+
600,
|
|
12195
|
+
700,
|
|
12196
|
+
224,
|
|
12197
|
+
442,
|
|
12198
|
+
644,
|
|
12199
|
+
750,
|
|
12200
|
+
252,
|
|
12201
|
+
476,
|
|
12202
|
+
690,
|
|
12203
|
+
816,
|
|
12204
|
+
270,
|
|
12205
|
+
504,
|
|
12206
|
+
750,
|
|
12207
|
+
900,
|
|
12208
|
+
300,
|
|
12209
|
+
560,
|
|
12210
|
+
810,
|
|
12211
|
+
960,
|
|
12212
|
+
312,
|
|
12213
|
+
588,
|
|
12214
|
+
870,
|
|
12215
|
+
1050,
|
|
12216
|
+
336,
|
|
12217
|
+
644,
|
|
12218
|
+
952,
|
|
12219
|
+
1110,
|
|
12220
|
+
360,
|
|
12221
|
+
700,
|
|
12222
|
+
1020,
|
|
12223
|
+
1200,
|
|
12224
|
+
390,
|
|
12225
|
+
728,
|
|
12226
|
+
1050,
|
|
12227
|
+
1260,
|
|
12228
|
+
420,
|
|
12229
|
+
784,
|
|
12230
|
+
1140,
|
|
12231
|
+
1350,
|
|
12232
|
+
450,
|
|
12233
|
+
812,
|
|
12234
|
+
1200,
|
|
12235
|
+
1440,
|
|
12236
|
+
480,
|
|
12237
|
+
868,
|
|
12238
|
+
1290,
|
|
12239
|
+
1530,
|
|
12240
|
+
510,
|
|
12241
|
+
924,
|
|
12242
|
+
1350,
|
|
12243
|
+
1620,
|
|
12244
|
+
540,
|
|
12245
|
+
980,
|
|
12246
|
+
1440,
|
|
12247
|
+
1710,
|
|
12248
|
+
570,
|
|
12249
|
+
1036,
|
|
12250
|
+
1530,
|
|
12251
|
+
1800,
|
|
12252
|
+
570,
|
|
12253
|
+
1064,
|
|
12254
|
+
1590,
|
|
12255
|
+
1890,
|
|
12256
|
+
600,
|
|
12257
|
+
1120,
|
|
12258
|
+
1680,
|
|
12259
|
+
1980,
|
|
12260
|
+
630,
|
|
12261
|
+
1204,
|
|
12262
|
+
1770,
|
|
12263
|
+
2100,
|
|
12264
|
+
660,
|
|
12265
|
+
1260,
|
|
12266
|
+
1860,
|
|
12267
|
+
2220,
|
|
12268
|
+
720,
|
|
12269
|
+
1316,
|
|
12270
|
+
1950,
|
|
12271
|
+
2310,
|
|
12272
|
+
750,
|
|
12273
|
+
1372,
|
|
12274
|
+
2040,
|
|
12275
|
+
2430
|
|
12276
|
+
];
|
|
12277
|
+
/**
|
|
12278
|
+
* Returns the number of error correction block that the QR Code should contain
|
|
12279
|
+
* for the specified version and error correction level.
|
|
12280
|
+
*
|
|
12281
|
+
* @param {Number} version QR Code version
|
|
12282
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
12283
|
+
* @return {Number} Number of error correction blocks
|
|
12284
|
+
*/
|
|
12285
|
+
exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
|
|
12286
|
+
switch (errorCorrectionLevel) {
|
|
12287
|
+
case ECLevel.L: return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
|
|
12288
|
+
case ECLevel.M: return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
|
|
12289
|
+
case ECLevel.Q: return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
|
|
12290
|
+
case ECLevel.H: return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
|
|
12291
|
+
default: return;
|
|
12292
|
+
}
|
|
12293
|
+
};
|
|
12294
|
+
/**
|
|
12295
|
+
* Returns the number of error correction codewords to use for the specified
|
|
12296
|
+
* version and error correction level.
|
|
12297
|
+
*
|
|
12298
|
+
* @param {Number} version QR Code version
|
|
12299
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
12300
|
+
* @return {Number} Number of error correction codewords
|
|
12301
|
+
*/
|
|
12302
|
+
exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
|
|
12303
|
+
switch (errorCorrectionLevel) {
|
|
12304
|
+
case ECLevel.L: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
|
|
12305
|
+
case ECLevel.M: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
|
|
12306
|
+
case ECLevel.Q: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
|
|
12307
|
+
case ECLevel.H: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
|
|
12308
|
+
default: return;
|
|
12309
|
+
}
|
|
12310
|
+
};
|
|
12311
|
+
}));
|
|
12312
|
+
//#endregion
|
|
12313
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js
|
|
12314
|
+
var require_galois_field = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12315
|
+
var EXP_TABLE = /* @__PURE__ */ new Uint8Array(512);
|
|
12316
|
+
var LOG_TABLE = /* @__PURE__ */ new Uint8Array(256);
|
|
12317
|
+
(function initTables() {
|
|
12318
|
+
let x = 1;
|
|
12319
|
+
for (let i = 0; i < 255; i++) {
|
|
12320
|
+
EXP_TABLE[i] = x;
|
|
12321
|
+
LOG_TABLE[x] = i;
|
|
12322
|
+
x <<= 1;
|
|
12323
|
+
if (x & 256) x ^= 285;
|
|
12324
|
+
}
|
|
12325
|
+
for (let i = 255; i < 512; i++) EXP_TABLE[i] = EXP_TABLE[i - 255];
|
|
12326
|
+
})();
|
|
12327
|
+
/**
|
|
12328
|
+
* Returns log value of n inside Galois Field
|
|
12329
|
+
*
|
|
12330
|
+
* @param {Number} n
|
|
12331
|
+
* @return {Number}
|
|
12332
|
+
*/
|
|
12333
|
+
exports.log = function log(n) {
|
|
12334
|
+
if (n < 1) throw new Error("log(" + n + ")");
|
|
12335
|
+
return LOG_TABLE[n];
|
|
12336
|
+
};
|
|
12337
|
+
/**
|
|
12338
|
+
* Returns anti-log value of n inside Galois Field
|
|
12339
|
+
*
|
|
12340
|
+
* @param {Number} n
|
|
12341
|
+
* @return {Number}
|
|
12342
|
+
*/
|
|
12343
|
+
exports.exp = function exp(n) {
|
|
12344
|
+
return EXP_TABLE[n];
|
|
12345
|
+
};
|
|
12346
|
+
/**
|
|
12347
|
+
* Multiplies two number inside Galois Field
|
|
12348
|
+
*
|
|
12349
|
+
* @param {Number} x
|
|
12350
|
+
* @param {Number} y
|
|
12351
|
+
* @return {Number}
|
|
12352
|
+
*/
|
|
12353
|
+
exports.mul = function mul(x, y) {
|
|
12354
|
+
if (x === 0 || y === 0) return 0;
|
|
12355
|
+
return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];
|
|
12356
|
+
};
|
|
12357
|
+
}));
|
|
12358
|
+
//#endregion
|
|
12359
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js
|
|
12360
|
+
var require_polynomial = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12361
|
+
var GF = require_galois_field();
|
|
12362
|
+
/**
|
|
12363
|
+
* Multiplies two polynomials inside Galois Field
|
|
12364
|
+
*
|
|
12365
|
+
* @param {Uint8Array} p1 Polynomial
|
|
12366
|
+
* @param {Uint8Array} p2 Polynomial
|
|
12367
|
+
* @return {Uint8Array} Product of p1 and p2
|
|
12368
|
+
*/
|
|
12369
|
+
exports.mul = function mul(p1, p2) {
|
|
12370
|
+
const coeff = new Uint8Array(p1.length + p2.length - 1);
|
|
12371
|
+
for (let i = 0; i < p1.length; i++) for (let j = 0; j < p2.length; j++) coeff[i + j] ^= GF.mul(p1[i], p2[j]);
|
|
12372
|
+
return coeff;
|
|
12373
|
+
};
|
|
12374
|
+
/**
|
|
12375
|
+
* Calculate the remainder of polynomials division
|
|
12376
|
+
*
|
|
12377
|
+
* @param {Uint8Array} divident Polynomial
|
|
12378
|
+
* @param {Uint8Array} divisor Polynomial
|
|
12379
|
+
* @return {Uint8Array} Remainder
|
|
12380
|
+
*/
|
|
12381
|
+
exports.mod = function mod(divident, divisor) {
|
|
12382
|
+
let result = new Uint8Array(divident);
|
|
12383
|
+
while (result.length - divisor.length >= 0) {
|
|
12384
|
+
const coeff = result[0];
|
|
12385
|
+
for (let i = 0; i < divisor.length; i++) result[i] ^= GF.mul(divisor[i], coeff);
|
|
12386
|
+
let offset = 0;
|
|
12387
|
+
while (offset < result.length && result[offset] === 0) offset++;
|
|
12388
|
+
result = result.slice(offset);
|
|
12389
|
+
}
|
|
12390
|
+
return result;
|
|
12391
|
+
};
|
|
12392
|
+
/**
|
|
12393
|
+
* Generate an irreducible generator polynomial of specified degree
|
|
12394
|
+
* (used by Reed-Solomon encoder)
|
|
12395
|
+
*
|
|
12396
|
+
* @param {Number} degree Degree of the generator polynomial
|
|
12397
|
+
* @return {Uint8Array} Buffer containing polynomial coefficients
|
|
12398
|
+
*/
|
|
12399
|
+
exports.generateECPolynomial = function generateECPolynomial(degree) {
|
|
12400
|
+
let poly = new Uint8Array([1]);
|
|
12401
|
+
for (let i = 0; i < degree; i++) poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));
|
|
12402
|
+
return poly;
|
|
12403
|
+
};
|
|
12404
|
+
}));
|
|
12405
|
+
//#endregion
|
|
12406
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js
|
|
12407
|
+
var require_reed_solomon_encoder = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12408
|
+
var Polynomial = require_polynomial();
|
|
12409
|
+
function ReedSolomonEncoder(degree) {
|
|
12410
|
+
this.genPoly = void 0;
|
|
12411
|
+
this.degree = degree;
|
|
12412
|
+
if (this.degree) this.initialize(this.degree);
|
|
12413
|
+
}
|
|
12414
|
+
/**
|
|
12415
|
+
* Initialize the encoder.
|
|
12416
|
+
* The input param should correspond to the number of error correction codewords.
|
|
12417
|
+
*
|
|
12418
|
+
* @param {Number} degree
|
|
12419
|
+
*/
|
|
12420
|
+
ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
|
|
12421
|
+
this.degree = degree;
|
|
12422
|
+
this.genPoly = Polynomial.generateECPolynomial(this.degree);
|
|
12423
|
+
};
|
|
12424
|
+
/**
|
|
12425
|
+
* Encodes a chunk of data
|
|
12426
|
+
*
|
|
12427
|
+
* @param {Uint8Array} data Buffer containing input data
|
|
12428
|
+
* @return {Uint8Array} Buffer containing encoded data
|
|
12429
|
+
*/
|
|
12430
|
+
ReedSolomonEncoder.prototype.encode = function encode(data) {
|
|
12431
|
+
if (!this.genPoly) throw new Error("Encoder not initialized");
|
|
12432
|
+
const paddedData = new Uint8Array(data.length + this.degree);
|
|
12433
|
+
paddedData.set(data);
|
|
12434
|
+
const remainder = Polynomial.mod(paddedData, this.genPoly);
|
|
12435
|
+
const start = this.degree - remainder.length;
|
|
12436
|
+
if (start > 0) {
|
|
12437
|
+
const buff = new Uint8Array(this.degree);
|
|
12438
|
+
buff.set(remainder, start);
|
|
12439
|
+
return buff;
|
|
12440
|
+
}
|
|
12441
|
+
return remainder;
|
|
12442
|
+
};
|
|
12443
|
+
module.exports = ReedSolomonEncoder;
|
|
12444
|
+
}));
|
|
12445
|
+
//#endregion
|
|
12446
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js
|
|
12447
|
+
var require_version_check = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12448
|
+
/**
|
|
12449
|
+
* Check if QR Code version is valid
|
|
12450
|
+
*
|
|
12451
|
+
* @param {Number} version QR Code version
|
|
12452
|
+
* @return {Boolean} true if valid version, false otherwise
|
|
12453
|
+
*/
|
|
12454
|
+
exports.isValid = function isValid(version) {
|
|
12455
|
+
return !isNaN(version) && version >= 1 && version <= 40;
|
|
12456
|
+
};
|
|
12457
|
+
}));
|
|
12458
|
+
//#endregion
|
|
12459
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js
|
|
12460
|
+
var require_regex = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12461
|
+
var numeric = "[0-9]+";
|
|
12462
|
+
var alphanumeric = "[A-Z $%*+\\-./:]+";
|
|
12463
|
+
var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
12464
|
+
kanji = kanji.replace(/u/g, "\\u");
|
|
12465
|
+
var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
|
|
12466
|
+
exports.KANJI = new RegExp(kanji, "g");
|
|
12467
|
+
exports.BYTE_KANJI = /* @__PURE__ */ new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
|
|
12468
|
+
exports.BYTE = new RegExp(byte, "g");
|
|
12469
|
+
exports.NUMERIC = new RegExp(numeric, "g");
|
|
12470
|
+
exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");
|
|
12471
|
+
var TEST_KANJI = new RegExp("^" + kanji + "$");
|
|
12472
|
+
var TEST_NUMERIC = /* @__PURE__ */ new RegExp("^[0-9]+$");
|
|
12473
|
+
var TEST_ALPHANUMERIC = /* @__PURE__ */ new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
12474
|
+
exports.testKanji = function testKanji(str) {
|
|
12475
|
+
return TEST_KANJI.test(str);
|
|
12476
|
+
};
|
|
12477
|
+
exports.testNumeric = function testNumeric(str) {
|
|
12478
|
+
return TEST_NUMERIC.test(str);
|
|
12479
|
+
};
|
|
12480
|
+
exports.testAlphanumeric = function testAlphanumeric(str) {
|
|
12481
|
+
return TEST_ALPHANUMERIC.test(str);
|
|
12482
|
+
};
|
|
12483
|
+
}));
|
|
12484
|
+
//#endregion
|
|
12485
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
|
|
12486
|
+
var require_mode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12487
|
+
var VersionCheck = require_version_check();
|
|
12488
|
+
var Regex = require_regex();
|
|
12489
|
+
/**
|
|
12490
|
+
* Numeric mode encodes data from the decimal digit set (0 - 9)
|
|
12491
|
+
* (byte values 30HEX to 39HEX).
|
|
12492
|
+
* Normally, 3 data characters are represented by 10 bits.
|
|
12493
|
+
*
|
|
12494
|
+
* @type {Object}
|
|
12495
|
+
*/
|
|
12496
|
+
exports.NUMERIC = {
|
|
12497
|
+
id: "Numeric",
|
|
12498
|
+
bit: 1,
|
|
12499
|
+
ccBits: [
|
|
12500
|
+
10,
|
|
12501
|
+
12,
|
|
12502
|
+
14
|
|
12503
|
+
]
|
|
12504
|
+
};
|
|
12505
|
+
/**
|
|
12506
|
+
* Alphanumeric mode encodes data from a set of 45 characters,
|
|
12507
|
+
* i.e. 10 numeric digits (0 - 9),
|
|
12508
|
+
* 26 alphabetic characters (A - Z),
|
|
12509
|
+
* and 9 symbols (SP, $, %, *, +, -, ., /, :).
|
|
12510
|
+
* Normally, two input characters are represented by 11 bits.
|
|
12511
|
+
*
|
|
12512
|
+
* @type {Object}
|
|
12513
|
+
*/
|
|
12514
|
+
exports.ALPHANUMERIC = {
|
|
12515
|
+
id: "Alphanumeric",
|
|
12516
|
+
bit: 2,
|
|
12517
|
+
ccBits: [
|
|
12518
|
+
9,
|
|
12519
|
+
11,
|
|
12520
|
+
13
|
|
12521
|
+
]
|
|
12522
|
+
};
|
|
12523
|
+
/**
|
|
12524
|
+
* In byte mode, data is encoded at 8 bits per character.
|
|
12525
|
+
*
|
|
12526
|
+
* @type {Object}
|
|
12527
|
+
*/
|
|
12528
|
+
exports.BYTE = {
|
|
12529
|
+
id: "Byte",
|
|
12530
|
+
bit: 4,
|
|
12531
|
+
ccBits: [
|
|
12532
|
+
8,
|
|
12533
|
+
16,
|
|
12534
|
+
16
|
|
12535
|
+
]
|
|
12536
|
+
};
|
|
12537
|
+
/**
|
|
12538
|
+
* The Kanji mode efficiently encodes Kanji characters in accordance with
|
|
12539
|
+
* the Shift JIS system based on JIS X 0208.
|
|
12540
|
+
* The Shift JIS values are shifted from the JIS X 0208 values.
|
|
12541
|
+
* JIS X 0208 gives details of the shift coded representation.
|
|
12542
|
+
* Each two-byte character value is compacted to a 13-bit binary codeword.
|
|
12543
|
+
*
|
|
12544
|
+
* @type {Object}
|
|
12545
|
+
*/
|
|
12546
|
+
exports.KANJI = {
|
|
12547
|
+
id: "Kanji",
|
|
12548
|
+
bit: 8,
|
|
12549
|
+
ccBits: [
|
|
12550
|
+
8,
|
|
12551
|
+
10,
|
|
12552
|
+
12
|
|
12553
|
+
]
|
|
12554
|
+
};
|
|
12555
|
+
/**
|
|
12556
|
+
* Mixed mode will contain a sequences of data in a combination of any of
|
|
12557
|
+
* the modes described above
|
|
12558
|
+
*
|
|
12559
|
+
* @type {Object}
|
|
12560
|
+
*/
|
|
12561
|
+
exports.MIXED = { bit: -1 };
|
|
12562
|
+
/**
|
|
12563
|
+
* Returns the number of bits needed to store the data length
|
|
12564
|
+
* according to QR Code specifications.
|
|
12565
|
+
*
|
|
12566
|
+
* @param {Mode} mode Data mode
|
|
12567
|
+
* @param {Number} version QR Code version
|
|
12568
|
+
* @return {Number} Number of bits
|
|
12569
|
+
*/
|
|
12570
|
+
exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {
|
|
12571
|
+
if (!mode.ccBits) throw new Error("Invalid mode: " + mode);
|
|
12572
|
+
if (!VersionCheck.isValid(version)) throw new Error("Invalid version: " + version);
|
|
12573
|
+
if (version >= 1 && version < 10) return mode.ccBits[0];
|
|
12574
|
+
else if (version < 27) return mode.ccBits[1];
|
|
12575
|
+
return mode.ccBits[2];
|
|
12576
|
+
};
|
|
12577
|
+
/**
|
|
12578
|
+
* Returns the most efficient mode to store the specified data
|
|
12579
|
+
*
|
|
12580
|
+
* @param {String} dataStr Input data string
|
|
12581
|
+
* @return {Mode} Best mode
|
|
12582
|
+
*/
|
|
12583
|
+
exports.getBestModeForData = function getBestModeForData(dataStr) {
|
|
12584
|
+
if (Regex.testNumeric(dataStr)) return exports.NUMERIC;
|
|
12585
|
+
else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;
|
|
12586
|
+
else if (Regex.testKanji(dataStr)) return exports.KANJI;
|
|
12587
|
+
else return exports.BYTE;
|
|
12588
|
+
};
|
|
12589
|
+
/**
|
|
12590
|
+
* Return mode name as string
|
|
12591
|
+
*
|
|
12592
|
+
* @param {Mode} mode Mode object
|
|
12593
|
+
* @returns {String} Mode name
|
|
12594
|
+
*/
|
|
12595
|
+
exports.toString = function toString(mode) {
|
|
12596
|
+
if (mode && mode.id) return mode.id;
|
|
12597
|
+
throw new Error("Invalid mode");
|
|
12598
|
+
};
|
|
12599
|
+
/**
|
|
12600
|
+
* Check if input param is a valid mode object
|
|
12601
|
+
*
|
|
12602
|
+
* @param {Mode} mode Mode object
|
|
12603
|
+
* @returns {Boolean} True if valid mode, false otherwise
|
|
12604
|
+
*/
|
|
12605
|
+
exports.isValid = function isValid(mode) {
|
|
12606
|
+
return mode && mode.bit && mode.ccBits;
|
|
12607
|
+
};
|
|
12608
|
+
/**
|
|
12609
|
+
* Get mode object from its name
|
|
12610
|
+
*
|
|
12611
|
+
* @param {String} string Mode name
|
|
12612
|
+
* @returns {Mode} Mode object
|
|
12613
|
+
*/
|
|
12614
|
+
function fromString(string) {
|
|
12615
|
+
if (typeof string !== "string") throw new Error("Param is not a string");
|
|
12616
|
+
switch (string.toLowerCase()) {
|
|
12617
|
+
case "numeric": return exports.NUMERIC;
|
|
12618
|
+
case "alphanumeric": return exports.ALPHANUMERIC;
|
|
12619
|
+
case "kanji": return exports.KANJI;
|
|
12620
|
+
case "byte": return exports.BYTE;
|
|
12621
|
+
default: throw new Error("Unknown mode: " + string);
|
|
12622
|
+
}
|
|
12623
|
+
}
|
|
12624
|
+
/**
|
|
12625
|
+
* Returns mode from a value.
|
|
12626
|
+
* If value is not a valid mode, returns defaultValue
|
|
12627
|
+
*
|
|
12628
|
+
* @param {Mode|String} value Encoding mode
|
|
12629
|
+
* @param {Mode} defaultValue Fallback value
|
|
12630
|
+
* @return {Mode} Encoding mode
|
|
12631
|
+
*/
|
|
12632
|
+
exports.from = function from(value, defaultValue) {
|
|
12633
|
+
if (exports.isValid(value)) return value;
|
|
12634
|
+
try {
|
|
12635
|
+
return fromString(value);
|
|
12636
|
+
} catch (e) {
|
|
12637
|
+
return defaultValue;
|
|
12638
|
+
}
|
|
12639
|
+
};
|
|
12640
|
+
}));
|
|
12641
|
+
//#endregion
|
|
12642
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js
|
|
12643
|
+
var require_version = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12644
|
+
var Utils = require_utils$1();
|
|
12645
|
+
var ECCode = require_error_correction_code();
|
|
12646
|
+
var ECLevel = require_error_correction_level();
|
|
12647
|
+
var Mode = require_mode();
|
|
12648
|
+
var VersionCheck = require_version_check();
|
|
12649
|
+
var G18 = 7973;
|
|
12650
|
+
var G18_BCH = Utils.getBCHDigit(G18);
|
|
12651
|
+
function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {
|
|
12652
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) return currentVersion;
|
|
12653
|
+
}
|
|
12654
|
+
function getReservedBitsCount(mode, version) {
|
|
12655
|
+
return Mode.getCharCountIndicator(mode, version) + 4;
|
|
12656
|
+
}
|
|
12657
|
+
function getTotalBitsFromDataArray(segments, version) {
|
|
12658
|
+
let totalBits = 0;
|
|
12659
|
+
segments.forEach(function(data) {
|
|
12660
|
+
const reservedBits = getReservedBitsCount(data.mode, version);
|
|
12661
|
+
totalBits += reservedBits + data.getBitsLength();
|
|
12662
|
+
});
|
|
12663
|
+
return totalBits;
|
|
12664
|
+
}
|
|
12665
|
+
function getBestVersionForMixedData(segments, errorCorrectionLevel) {
|
|
12666
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) if (getTotalBitsFromDataArray(segments, currentVersion) <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) return currentVersion;
|
|
12667
|
+
}
|
|
12668
|
+
/**
|
|
12669
|
+
* Returns version number from a value.
|
|
12670
|
+
* If value is not a valid version, returns defaultValue
|
|
12671
|
+
*
|
|
12672
|
+
* @param {Number|String} value QR Code version
|
|
12673
|
+
* @param {Number} defaultValue Fallback value
|
|
12674
|
+
* @return {Number} QR Code version number
|
|
12675
|
+
*/
|
|
12676
|
+
exports.from = function from(value, defaultValue) {
|
|
12677
|
+
if (VersionCheck.isValid(value)) return parseInt(value, 10);
|
|
12678
|
+
return defaultValue;
|
|
12679
|
+
};
|
|
12680
|
+
/**
|
|
12681
|
+
* Returns how much data can be stored with the specified QR code version
|
|
12682
|
+
* and error correction level
|
|
12683
|
+
*
|
|
12684
|
+
* @param {Number} version QR Code version (1-40)
|
|
12685
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
12686
|
+
* @param {Mode} mode Data mode
|
|
12687
|
+
* @return {Number} Quantity of storable data
|
|
12688
|
+
*/
|
|
12689
|
+
exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
|
|
12690
|
+
if (!VersionCheck.isValid(version)) throw new Error("Invalid QR Code version");
|
|
12691
|
+
if (typeof mode === "undefined") mode = Mode.BYTE;
|
|
12692
|
+
const dataTotalCodewordsBits = (Utils.getSymbolTotalCodewords(version) - ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)) * 8;
|
|
12693
|
+
if (mode === Mode.MIXED) return dataTotalCodewordsBits;
|
|
12694
|
+
const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
|
|
12695
|
+
switch (mode) {
|
|
12696
|
+
case Mode.NUMERIC: return Math.floor(usableBits / 10 * 3);
|
|
12697
|
+
case Mode.ALPHANUMERIC: return Math.floor(usableBits / 11 * 2);
|
|
12698
|
+
case Mode.KANJI: return Math.floor(usableBits / 13);
|
|
12699
|
+
case Mode.BYTE:
|
|
12700
|
+
default: return Math.floor(usableBits / 8);
|
|
12701
|
+
}
|
|
12702
|
+
};
|
|
12703
|
+
/**
|
|
12704
|
+
* Returns the minimum version needed to contain the amount of data
|
|
12705
|
+
*
|
|
12706
|
+
* @param {Segment} data Segment of data
|
|
12707
|
+
* @param {Number} [errorCorrectionLevel=H] Error correction level
|
|
12708
|
+
* @param {Mode} mode Data mode
|
|
12709
|
+
* @return {Number} QR Code version
|
|
12710
|
+
*/
|
|
12711
|
+
exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {
|
|
12712
|
+
let seg;
|
|
12713
|
+
const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
|
|
12714
|
+
if (Array.isArray(data)) {
|
|
12715
|
+
if (data.length > 1) return getBestVersionForMixedData(data, ecl);
|
|
12716
|
+
if (data.length === 0) return 1;
|
|
12717
|
+
seg = data[0];
|
|
12718
|
+
} else seg = data;
|
|
12719
|
+
return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);
|
|
12720
|
+
};
|
|
12721
|
+
/**
|
|
12722
|
+
* Returns version information with relative error correction bits
|
|
12723
|
+
*
|
|
12724
|
+
* The version information is included in QR Code symbols of version 7 or larger.
|
|
12725
|
+
* It consists of an 18-bit sequence containing 6 data bits,
|
|
12726
|
+
* with 12 error correction bits calculated using the (18, 6) Golay code.
|
|
12727
|
+
*
|
|
12728
|
+
* @param {Number} version QR Code version
|
|
12729
|
+
* @return {Number} Encoded version info bits
|
|
12730
|
+
*/
|
|
12731
|
+
exports.getEncodedBits = function getEncodedBits(version) {
|
|
12732
|
+
if (!VersionCheck.isValid(version) || version < 7) throw new Error("Invalid QR Code version");
|
|
12733
|
+
let d = version << 12;
|
|
12734
|
+
while (Utils.getBCHDigit(d) - G18_BCH >= 0) d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;
|
|
12735
|
+
return version << 12 | d;
|
|
12736
|
+
};
|
|
12737
|
+
}));
|
|
12738
|
+
//#endregion
|
|
12739
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js
|
|
12740
|
+
var require_format_info = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12741
|
+
var Utils = require_utils$1();
|
|
12742
|
+
var G15 = 1335;
|
|
12743
|
+
var G15_MASK = 21522;
|
|
12744
|
+
var G15_BCH = Utils.getBCHDigit(G15);
|
|
12745
|
+
/**
|
|
12746
|
+
* Returns format information with relative error correction bits
|
|
12747
|
+
*
|
|
12748
|
+
* The format information is a 15-bit sequence containing 5 data bits,
|
|
12749
|
+
* with 10 error correction bits calculated using the (15, 5) BCH code.
|
|
12750
|
+
*
|
|
12751
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
12752
|
+
* @param {Number} mask Mask pattern
|
|
12753
|
+
* @return {Number} Encoded format information bits
|
|
12754
|
+
*/
|
|
12755
|
+
exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
|
|
12756
|
+
const data = errorCorrectionLevel.bit << 3 | mask;
|
|
12757
|
+
let d = data << 10;
|
|
12758
|
+
while (Utils.getBCHDigit(d) - G15_BCH >= 0) d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;
|
|
12759
|
+
return (data << 10 | d) ^ G15_MASK;
|
|
12760
|
+
};
|
|
12761
|
+
}));
|
|
12762
|
+
//#endregion
|
|
12763
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
|
|
12764
|
+
var require_numeric_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12765
|
+
var Mode = require_mode();
|
|
12766
|
+
function NumericData(data) {
|
|
12767
|
+
this.mode = Mode.NUMERIC;
|
|
12768
|
+
this.data = data.toString();
|
|
12769
|
+
}
|
|
12770
|
+
NumericData.getBitsLength = function getBitsLength(length) {
|
|
12771
|
+
return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);
|
|
12772
|
+
};
|
|
12773
|
+
NumericData.prototype.getLength = function getLength() {
|
|
12774
|
+
return this.data.length;
|
|
12775
|
+
};
|
|
12776
|
+
NumericData.prototype.getBitsLength = function getBitsLength() {
|
|
12777
|
+
return NumericData.getBitsLength(this.data.length);
|
|
12778
|
+
};
|
|
12779
|
+
NumericData.prototype.write = function write(bitBuffer) {
|
|
12780
|
+
let i, group, value;
|
|
12781
|
+
for (i = 0; i + 3 <= this.data.length; i += 3) {
|
|
12782
|
+
group = this.data.substr(i, 3);
|
|
12783
|
+
value = parseInt(group, 10);
|
|
12784
|
+
bitBuffer.put(value, 10);
|
|
12785
|
+
}
|
|
12786
|
+
const remainingNum = this.data.length - i;
|
|
12787
|
+
if (remainingNum > 0) {
|
|
12788
|
+
group = this.data.substr(i);
|
|
12789
|
+
value = parseInt(group, 10);
|
|
12790
|
+
bitBuffer.put(value, remainingNum * 3 + 1);
|
|
12791
|
+
}
|
|
12792
|
+
};
|
|
12793
|
+
module.exports = NumericData;
|
|
12794
|
+
}));
|
|
12795
|
+
//#endregion
|
|
12796
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
|
|
12797
|
+
var require_alphanumeric_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12798
|
+
var Mode = require_mode();
|
|
12799
|
+
/**
|
|
12800
|
+
* Array of characters available in alphanumeric mode
|
|
12801
|
+
*
|
|
12802
|
+
* As per QR Code specification, to each character
|
|
12803
|
+
* is assigned a value from 0 to 44 which in this case coincides
|
|
12804
|
+
* with the array index
|
|
12805
|
+
*
|
|
12806
|
+
* @type {Array}
|
|
12807
|
+
*/
|
|
12808
|
+
var ALPHA_NUM_CHARS = [
|
|
12809
|
+
"0",
|
|
12810
|
+
"1",
|
|
12811
|
+
"2",
|
|
12812
|
+
"3",
|
|
12813
|
+
"4",
|
|
12814
|
+
"5",
|
|
12815
|
+
"6",
|
|
12816
|
+
"7",
|
|
12817
|
+
"8",
|
|
12818
|
+
"9",
|
|
12819
|
+
"A",
|
|
12820
|
+
"B",
|
|
12821
|
+
"C",
|
|
12822
|
+
"D",
|
|
12823
|
+
"E",
|
|
12824
|
+
"F",
|
|
12825
|
+
"G",
|
|
12826
|
+
"H",
|
|
12827
|
+
"I",
|
|
12828
|
+
"J",
|
|
12829
|
+
"K",
|
|
12830
|
+
"L",
|
|
12831
|
+
"M",
|
|
12832
|
+
"N",
|
|
12833
|
+
"O",
|
|
12834
|
+
"P",
|
|
12835
|
+
"Q",
|
|
12836
|
+
"R",
|
|
12837
|
+
"S",
|
|
12838
|
+
"T",
|
|
12839
|
+
"U",
|
|
12840
|
+
"V",
|
|
12841
|
+
"W",
|
|
12842
|
+
"X",
|
|
12843
|
+
"Y",
|
|
12844
|
+
"Z",
|
|
12845
|
+
" ",
|
|
12846
|
+
"$",
|
|
12847
|
+
"%",
|
|
12848
|
+
"*",
|
|
12849
|
+
"+",
|
|
12850
|
+
"-",
|
|
12851
|
+
".",
|
|
12852
|
+
"/",
|
|
12853
|
+
":"
|
|
12854
|
+
];
|
|
12855
|
+
function AlphanumericData(data) {
|
|
12856
|
+
this.mode = Mode.ALPHANUMERIC;
|
|
12857
|
+
this.data = data;
|
|
12858
|
+
}
|
|
12859
|
+
AlphanumericData.getBitsLength = function getBitsLength(length) {
|
|
12860
|
+
return 11 * Math.floor(length / 2) + 6 * (length % 2);
|
|
12861
|
+
};
|
|
12862
|
+
AlphanumericData.prototype.getLength = function getLength() {
|
|
12863
|
+
return this.data.length;
|
|
12864
|
+
};
|
|
12865
|
+
AlphanumericData.prototype.getBitsLength = function getBitsLength() {
|
|
12866
|
+
return AlphanumericData.getBitsLength(this.data.length);
|
|
12867
|
+
};
|
|
12868
|
+
AlphanumericData.prototype.write = function write(bitBuffer) {
|
|
12869
|
+
let i;
|
|
12870
|
+
for (i = 0; i + 2 <= this.data.length; i += 2) {
|
|
12871
|
+
let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
|
|
12872
|
+
value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
|
|
12873
|
+
bitBuffer.put(value, 11);
|
|
12874
|
+
}
|
|
12875
|
+
if (this.data.length % 2) bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
|
|
12876
|
+
};
|
|
12877
|
+
module.exports = AlphanumericData;
|
|
12878
|
+
}));
|
|
12879
|
+
//#endregion
|
|
12880
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
|
|
12881
|
+
var require_byte_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12882
|
+
var Mode = require_mode();
|
|
12883
|
+
function ByteData(data) {
|
|
12884
|
+
this.mode = Mode.BYTE;
|
|
12885
|
+
if (typeof data === "string") this.data = new TextEncoder().encode(data);
|
|
12886
|
+
else this.data = new Uint8Array(data);
|
|
12887
|
+
}
|
|
12888
|
+
ByteData.getBitsLength = function getBitsLength(length) {
|
|
12889
|
+
return length * 8;
|
|
12890
|
+
};
|
|
12891
|
+
ByteData.prototype.getLength = function getLength() {
|
|
12892
|
+
return this.data.length;
|
|
12893
|
+
};
|
|
12894
|
+
ByteData.prototype.getBitsLength = function getBitsLength() {
|
|
12895
|
+
return ByteData.getBitsLength(this.data.length);
|
|
12896
|
+
};
|
|
12897
|
+
ByteData.prototype.write = function(bitBuffer) {
|
|
12898
|
+
for (let i = 0, l = this.data.length; i < l; i++) bitBuffer.put(this.data[i], 8);
|
|
12899
|
+
};
|
|
12900
|
+
module.exports = ByteData;
|
|
12901
|
+
}));
|
|
12902
|
+
//#endregion
|
|
12903
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
|
|
12904
|
+
var require_kanji_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12905
|
+
var Mode = require_mode();
|
|
12906
|
+
var Utils = require_utils$1();
|
|
12907
|
+
function KanjiData(data) {
|
|
12908
|
+
this.mode = Mode.KANJI;
|
|
12909
|
+
this.data = data;
|
|
12910
|
+
}
|
|
12911
|
+
KanjiData.getBitsLength = function getBitsLength(length) {
|
|
12912
|
+
return length * 13;
|
|
12913
|
+
};
|
|
12914
|
+
KanjiData.prototype.getLength = function getLength() {
|
|
12915
|
+
return this.data.length;
|
|
12916
|
+
};
|
|
12917
|
+
KanjiData.prototype.getBitsLength = function getBitsLength() {
|
|
12918
|
+
return KanjiData.getBitsLength(this.data.length);
|
|
12919
|
+
};
|
|
12920
|
+
KanjiData.prototype.write = function(bitBuffer) {
|
|
12921
|
+
let i;
|
|
12922
|
+
for (i = 0; i < this.data.length; i++) {
|
|
12923
|
+
let value = Utils.toSJIS(this.data[i]);
|
|
12924
|
+
if (value >= 33088 && value <= 40956) value -= 33088;
|
|
12925
|
+
else if (value >= 57408 && value <= 60351) value -= 49472;
|
|
12926
|
+
else throw new Error("Invalid SJIS character: " + this.data[i] + "\nMake sure your charset is UTF-8");
|
|
12927
|
+
value = (value >>> 8 & 255) * 192 + (value & 255);
|
|
12928
|
+
bitBuffer.put(value, 13);
|
|
12929
|
+
}
|
|
12930
|
+
};
|
|
12931
|
+
module.exports = KanjiData;
|
|
12932
|
+
}));
|
|
12933
|
+
//#endregion
|
|
12934
|
+
//#region node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js
|
|
12935
|
+
var require_dijkstra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12936
|
+
/******************************************************************************
|
|
12937
|
+
* Created 2008-08-19.
|
|
12938
|
+
*
|
|
12939
|
+
* Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
|
|
12940
|
+
*
|
|
12941
|
+
* Copyright (C) 2008
|
|
12942
|
+
* Wyatt Baldwin <self@wyattbaldwin.com>
|
|
12943
|
+
* All rights reserved
|
|
12944
|
+
*
|
|
12945
|
+
* Licensed under the MIT license.
|
|
12946
|
+
*
|
|
12947
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
12948
|
+
*
|
|
12949
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
12950
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12951
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
12952
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
12953
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
12954
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
12955
|
+
* THE SOFTWARE.
|
|
12956
|
+
*****************************************************************************/
|
|
12957
|
+
var dijkstra = {
|
|
12958
|
+
single_source_shortest_paths: function(graph, s, d) {
|
|
12959
|
+
var predecessors = {};
|
|
12960
|
+
var costs = {};
|
|
12961
|
+
costs[s] = 0;
|
|
12962
|
+
var open = dijkstra.PriorityQueue.make();
|
|
12963
|
+
open.push(s, 0);
|
|
12964
|
+
var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
|
|
12965
|
+
while (!open.empty()) {
|
|
12966
|
+
closest = open.pop();
|
|
12967
|
+
u = closest.value;
|
|
12968
|
+
cost_of_s_to_u = closest.cost;
|
|
12969
|
+
adjacent_nodes = graph[u] || {};
|
|
12970
|
+
for (v in adjacent_nodes) if (adjacent_nodes.hasOwnProperty(v)) {
|
|
12971
|
+
cost_of_e = adjacent_nodes[v];
|
|
12972
|
+
cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
|
|
12973
|
+
cost_of_s_to_v = costs[v];
|
|
12974
|
+
first_visit = typeof costs[v] === "undefined";
|
|
12975
|
+
if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
|
|
12976
|
+
costs[v] = cost_of_s_to_u_plus_cost_of_e;
|
|
12977
|
+
open.push(v, cost_of_s_to_u_plus_cost_of_e);
|
|
12978
|
+
predecessors[v] = u;
|
|
12979
|
+
}
|
|
12980
|
+
}
|
|
12981
|
+
}
|
|
12982
|
+
if (typeof d !== "undefined" && typeof costs[d] === "undefined") {
|
|
12983
|
+
var msg = [
|
|
12984
|
+
"Could not find a path from ",
|
|
12985
|
+
s,
|
|
12986
|
+
" to ",
|
|
12987
|
+
d,
|
|
12988
|
+
"."
|
|
12989
|
+
].join("");
|
|
12990
|
+
throw new Error(msg);
|
|
12991
|
+
}
|
|
12992
|
+
return predecessors;
|
|
12993
|
+
},
|
|
12994
|
+
extract_shortest_path_from_predecessor_list: function(predecessors, d) {
|
|
12995
|
+
var nodes = [];
|
|
12996
|
+
var u = d;
|
|
12997
|
+
while (u) {
|
|
12998
|
+
nodes.push(u);
|
|
12999
|
+
predecessors[u];
|
|
13000
|
+
u = predecessors[u];
|
|
13001
|
+
}
|
|
13002
|
+
nodes.reverse();
|
|
13003
|
+
return nodes;
|
|
13004
|
+
},
|
|
13005
|
+
find_path: function(graph, s, d) {
|
|
13006
|
+
var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
|
|
13007
|
+
return dijkstra.extract_shortest_path_from_predecessor_list(predecessors, d);
|
|
13008
|
+
},
|
|
13009
|
+
/**
|
|
13010
|
+
* A very naive priority queue implementation.
|
|
13011
|
+
*/
|
|
13012
|
+
PriorityQueue: {
|
|
13013
|
+
make: function(opts) {
|
|
13014
|
+
var T = dijkstra.PriorityQueue, t = {}, key;
|
|
13015
|
+
opts = opts || {};
|
|
13016
|
+
for (key in T) if (T.hasOwnProperty(key)) t[key] = T[key];
|
|
13017
|
+
t.queue = [];
|
|
13018
|
+
t.sorter = opts.sorter || T.default_sorter;
|
|
13019
|
+
return t;
|
|
13020
|
+
},
|
|
13021
|
+
default_sorter: function(a, b) {
|
|
13022
|
+
return a.cost - b.cost;
|
|
13023
|
+
},
|
|
13024
|
+
/**
|
|
13025
|
+
* Add a new item to the queue and ensure the highest priority element
|
|
13026
|
+
* is at the front of the queue.
|
|
13027
|
+
*/
|
|
13028
|
+
push: function(value, cost) {
|
|
13029
|
+
var item = {
|
|
13030
|
+
value,
|
|
13031
|
+
cost
|
|
13032
|
+
};
|
|
13033
|
+
this.queue.push(item);
|
|
13034
|
+
this.queue.sort(this.sorter);
|
|
13035
|
+
},
|
|
13036
|
+
/**
|
|
13037
|
+
* Return the highest priority element in the queue.
|
|
13038
|
+
*/
|
|
13039
|
+
pop: function() {
|
|
13040
|
+
return this.queue.shift();
|
|
13041
|
+
},
|
|
13042
|
+
empty: function() {
|
|
13043
|
+
return this.queue.length === 0;
|
|
13044
|
+
}
|
|
13045
|
+
}
|
|
13046
|
+
};
|
|
13047
|
+
if (typeof module !== "undefined") module.exports = dijkstra;
|
|
13048
|
+
}));
|
|
13049
|
+
//#endregion
|
|
13050
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
|
|
13051
|
+
var require_segments = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13052
|
+
var Mode = require_mode();
|
|
13053
|
+
var NumericData = require_numeric_data();
|
|
13054
|
+
var AlphanumericData = require_alphanumeric_data();
|
|
13055
|
+
var ByteData = require_byte_data();
|
|
13056
|
+
var KanjiData = require_kanji_data();
|
|
13057
|
+
var Regex = require_regex();
|
|
13058
|
+
var Utils = require_utils$1();
|
|
13059
|
+
var dijkstra = require_dijkstra();
|
|
13060
|
+
/**
|
|
13061
|
+
* Returns UTF8 byte length
|
|
13062
|
+
*
|
|
13063
|
+
* @param {String} str Input string
|
|
13064
|
+
* @return {Number} Number of byte
|
|
13065
|
+
*/
|
|
13066
|
+
function getStringByteLength(str) {
|
|
13067
|
+
return unescape(encodeURIComponent(str)).length;
|
|
13068
|
+
}
|
|
13069
|
+
/**
|
|
13070
|
+
* Get a list of segments of the specified mode
|
|
13071
|
+
* from a string
|
|
13072
|
+
*
|
|
13073
|
+
* @param {Mode} mode Segment mode
|
|
13074
|
+
* @param {String} str String to process
|
|
13075
|
+
* @return {Array} Array of object with segments data
|
|
13076
|
+
*/
|
|
13077
|
+
function getSegments(regex, mode, str) {
|
|
13078
|
+
const segments = [];
|
|
13079
|
+
let result;
|
|
13080
|
+
while ((result = regex.exec(str)) !== null) segments.push({
|
|
13081
|
+
data: result[0],
|
|
13082
|
+
index: result.index,
|
|
13083
|
+
mode,
|
|
13084
|
+
length: result[0].length
|
|
13085
|
+
});
|
|
13086
|
+
return segments;
|
|
13087
|
+
}
|
|
13088
|
+
/**
|
|
13089
|
+
* Extracts a series of segments with the appropriate
|
|
13090
|
+
* modes from a string
|
|
13091
|
+
*
|
|
13092
|
+
* @param {String} dataStr Input string
|
|
13093
|
+
* @return {Array} Array of object with segments data
|
|
13094
|
+
*/
|
|
13095
|
+
function getSegmentsFromString(dataStr) {
|
|
13096
|
+
const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
|
|
13097
|
+
const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
|
|
13098
|
+
let byteSegs;
|
|
13099
|
+
let kanjiSegs;
|
|
13100
|
+
if (Utils.isKanjiModeEnabled()) {
|
|
13101
|
+
byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
|
|
13102
|
+
kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
|
|
13103
|
+
} else {
|
|
13104
|
+
byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
|
|
13105
|
+
kanjiSegs = [];
|
|
13106
|
+
}
|
|
13107
|
+
return numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs).sort(function(s1, s2) {
|
|
13108
|
+
return s1.index - s2.index;
|
|
13109
|
+
}).map(function(obj) {
|
|
13110
|
+
return {
|
|
13111
|
+
data: obj.data,
|
|
13112
|
+
mode: obj.mode,
|
|
13113
|
+
length: obj.length
|
|
13114
|
+
};
|
|
13115
|
+
});
|
|
13116
|
+
}
|
|
13117
|
+
/**
|
|
13118
|
+
* Returns how many bits are needed to encode a string of
|
|
13119
|
+
* specified length with the specified mode
|
|
13120
|
+
*
|
|
13121
|
+
* @param {Number} length String length
|
|
13122
|
+
* @param {Mode} mode Segment mode
|
|
13123
|
+
* @return {Number} Bit length
|
|
13124
|
+
*/
|
|
13125
|
+
function getSegmentBitsLength(length, mode) {
|
|
13126
|
+
switch (mode) {
|
|
13127
|
+
case Mode.NUMERIC: return NumericData.getBitsLength(length);
|
|
13128
|
+
case Mode.ALPHANUMERIC: return AlphanumericData.getBitsLength(length);
|
|
13129
|
+
case Mode.KANJI: return KanjiData.getBitsLength(length);
|
|
13130
|
+
case Mode.BYTE: return ByteData.getBitsLength(length);
|
|
13131
|
+
}
|
|
13132
|
+
}
|
|
13133
|
+
/**
|
|
13134
|
+
* Merges adjacent segments which have the same mode
|
|
13135
|
+
*
|
|
13136
|
+
* @param {Array} segs Array of object with segments data
|
|
13137
|
+
* @return {Array} Array of object with segments data
|
|
13138
|
+
*/
|
|
13139
|
+
function mergeSegments(segs) {
|
|
13140
|
+
return segs.reduce(function(acc, curr) {
|
|
13141
|
+
const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
|
|
13142
|
+
if (prevSeg && prevSeg.mode === curr.mode) {
|
|
13143
|
+
acc[acc.length - 1].data += curr.data;
|
|
13144
|
+
return acc;
|
|
13145
|
+
}
|
|
13146
|
+
acc.push(curr);
|
|
13147
|
+
return acc;
|
|
13148
|
+
}, []);
|
|
13149
|
+
}
|
|
13150
|
+
/**
|
|
13151
|
+
* Generates a list of all possible nodes combination which
|
|
13152
|
+
* will be used to build a segments graph.
|
|
13153
|
+
*
|
|
13154
|
+
* Nodes are divided by groups. Each group will contain a list of all the modes
|
|
13155
|
+
* in which is possible to encode the given text.
|
|
13156
|
+
*
|
|
13157
|
+
* For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
|
|
13158
|
+
* The group for '12345' will contain then 3 objects, one for each
|
|
13159
|
+
* possible encoding mode.
|
|
13160
|
+
*
|
|
13161
|
+
* Each node represents a possible segment.
|
|
13162
|
+
*
|
|
13163
|
+
* @param {Array} segs Array of object with segments data
|
|
13164
|
+
* @return {Array} Array of object with segments data
|
|
13165
|
+
*/
|
|
13166
|
+
function buildNodes(segs) {
|
|
13167
|
+
const nodes = [];
|
|
13168
|
+
for (let i = 0; i < segs.length; i++) {
|
|
13169
|
+
const seg = segs[i];
|
|
13170
|
+
switch (seg.mode) {
|
|
13171
|
+
case Mode.NUMERIC:
|
|
13172
|
+
nodes.push([
|
|
13173
|
+
seg,
|
|
13174
|
+
{
|
|
13175
|
+
data: seg.data,
|
|
13176
|
+
mode: Mode.ALPHANUMERIC,
|
|
13177
|
+
length: seg.length
|
|
13178
|
+
},
|
|
13179
|
+
{
|
|
13180
|
+
data: seg.data,
|
|
13181
|
+
mode: Mode.BYTE,
|
|
13182
|
+
length: seg.length
|
|
13183
|
+
}
|
|
13184
|
+
]);
|
|
13185
|
+
break;
|
|
13186
|
+
case Mode.ALPHANUMERIC:
|
|
13187
|
+
nodes.push([seg, {
|
|
13188
|
+
data: seg.data,
|
|
13189
|
+
mode: Mode.BYTE,
|
|
13190
|
+
length: seg.length
|
|
13191
|
+
}]);
|
|
13192
|
+
break;
|
|
13193
|
+
case Mode.KANJI:
|
|
13194
|
+
nodes.push([seg, {
|
|
13195
|
+
data: seg.data,
|
|
13196
|
+
mode: Mode.BYTE,
|
|
13197
|
+
length: getStringByteLength(seg.data)
|
|
13198
|
+
}]);
|
|
13199
|
+
break;
|
|
13200
|
+
case Mode.BYTE: nodes.push([{
|
|
13201
|
+
data: seg.data,
|
|
13202
|
+
mode: Mode.BYTE,
|
|
13203
|
+
length: getStringByteLength(seg.data)
|
|
13204
|
+
}]);
|
|
13205
|
+
}
|
|
13206
|
+
}
|
|
13207
|
+
return nodes;
|
|
13208
|
+
}
|
|
13209
|
+
/**
|
|
13210
|
+
* Builds a graph from a list of nodes.
|
|
13211
|
+
* All segments in each node group will be connected with all the segments of
|
|
13212
|
+
* the next group and so on.
|
|
13213
|
+
*
|
|
13214
|
+
* At each connection will be assigned a weight depending on the
|
|
13215
|
+
* segment's byte length.
|
|
13216
|
+
*
|
|
13217
|
+
* @param {Array} nodes Array of object with segments data
|
|
13218
|
+
* @param {Number} version QR Code version
|
|
13219
|
+
* @return {Object} Graph of all possible segments
|
|
13220
|
+
*/
|
|
13221
|
+
function buildGraph(nodes, version) {
|
|
13222
|
+
const table = {};
|
|
13223
|
+
const graph = { start: {} };
|
|
13224
|
+
let prevNodeIds = ["start"];
|
|
13225
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
13226
|
+
const nodeGroup = nodes[i];
|
|
13227
|
+
const currentNodeIds = [];
|
|
13228
|
+
for (let j = 0; j < nodeGroup.length; j++) {
|
|
13229
|
+
const node = nodeGroup[j];
|
|
13230
|
+
const key = "" + i + j;
|
|
13231
|
+
currentNodeIds.push(key);
|
|
13232
|
+
table[key] = {
|
|
13233
|
+
node,
|
|
13234
|
+
lastCount: 0
|
|
13235
|
+
};
|
|
13236
|
+
graph[key] = {};
|
|
13237
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
13238
|
+
const prevNodeId = prevNodeIds[n];
|
|
13239
|
+
if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
|
|
13240
|
+
graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
|
|
13241
|
+
table[prevNodeId].lastCount += node.length;
|
|
13242
|
+
} else {
|
|
13243
|
+
if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
|
|
13244
|
+
graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
|
|
13245
|
+
}
|
|
13246
|
+
}
|
|
13247
|
+
}
|
|
13248
|
+
prevNodeIds = currentNodeIds;
|
|
13249
|
+
}
|
|
13250
|
+
for (let n = 0; n < prevNodeIds.length; n++) graph[prevNodeIds[n]].end = 0;
|
|
13251
|
+
return {
|
|
13252
|
+
map: graph,
|
|
13253
|
+
table
|
|
13254
|
+
};
|
|
13255
|
+
}
|
|
13256
|
+
/**
|
|
13257
|
+
* Builds a segment from a specified data and mode.
|
|
13258
|
+
* If a mode is not specified, the more suitable will be used.
|
|
13259
|
+
*
|
|
13260
|
+
* @param {String} data Input data
|
|
13261
|
+
* @param {Mode | String} modesHint Data mode
|
|
13262
|
+
* @return {Segment} Segment
|
|
13263
|
+
*/
|
|
13264
|
+
function buildSingleSegment(data, modesHint) {
|
|
13265
|
+
let mode;
|
|
13266
|
+
const bestMode = Mode.getBestModeForData(data);
|
|
13267
|
+
mode = Mode.from(modesHint, bestMode);
|
|
13268
|
+
if (mode !== Mode.BYTE && mode.bit < bestMode.bit) throw new Error("\"" + data + "\" cannot be encoded with mode " + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
|
|
13269
|
+
if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) mode = Mode.BYTE;
|
|
13270
|
+
switch (mode) {
|
|
13271
|
+
case Mode.NUMERIC: return new NumericData(data);
|
|
13272
|
+
case Mode.ALPHANUMERIC: return new AlphanumericData(data);
|
|
13273
|
+
case Mode.KANJI: return new KanjiData(data);
|
|
13274
|
+
case Mode.BYTE: return new ByteData(data);
|
|
13275
|
+
}
|
|
13276
|
+
}
|
|
13277
|
+
/**
|
|
13278
|
+
* Builds a list of segments from an array.
|
|
13279
|
+
* Array can contain Strings or Objects with segment's info.
|
|
13280
|
+
*
|
|
13281
|
+
* For each item which is a string, will be generated a segment with the given
|
|
13282
|
+
* string and the more appropriate encoding mode.
|
|
13283
|
+
*
|
|
13284
|
+
* For each item which is an object, will be generated a segment with the given
|
|
13285
|
+
* data and mode.
|
|
13286
|
+
* Objects must contain at least the property "data".
|
|
13287
|
+
* If property "mode" is not present, the more suitable mode will be used.
|
|
13288
|
+
*
|
|
13289
|
+
* @param {Array} array Array of objects with segments data
|
|
13290
|
+
* @return {Array} Array of Segments
|
|
13291
|
+
*/
|
|
13292
|
+
exports.fromArray = function fromArray(array) {
|
|
13293
|
+
return array.reduce(function(acc, seg) {
|
|
13294
|
+
if (typeof seg === "string") acc.push(buildSingleSegment(seg, null));
|
|
13295
|
+
else if (seg.data) acc.push(buildSingleSegment(seg.data, seg.mode));
|
|
13296
|
+
return acc;
|
|
13297
|
+
}, []);
|
|
13298
|
+
};
|
|
13299
|
+
/**
|
|
13300
|
+
* Builds an optimized sequence of segments from a string,
|
|
13301
|
+
* which will produce the shortest possible bitstream.
|
|
13302
|
+
*
|
|
13303
|
+
* @param {String} data Input string
|
|
13304
|
+
* @param {Number} version QR Code version
|
|
13305
|
+
* @return {Array} Array of segments
|
|
13306
|
+
*/
|
|
13307
|
+
exports.fromString = function fromString(data, version) {
|
|
13308
|
+
const graph = buildGraph(buildNodes(getSegmentsFromString(data, Utils.isKanjiModeEnabled())), version);
|
|
13309
|
+
const path = dijkstra.find_path(graph.map, "start", "end");
|
|
13310
|
+
const optimizedSegs = [];
|
|
13311
|
+
for (let i = 1; i < path.length - 1; i++) optimizedSegs.push(graph.table[path[i]].node);
|
|
13312
|
+
return exports.fromArray(mergeSegments(optimizedSegs));
|
|
13313
|
+
};
|
|
13314
|
+
/**
|
|
13315
|
+
* Splits a string in various segments with the modes which
|
|
13316
|
+
* best represent their content.
|
|
13317
|
+
* The produced segments are far from being optimized.
|
|
13318
|
+
* The output of this function is only used to estimate a QR Code version
|
|
13319
|
+
* which may contain the data.
|
|
13320
|
+
*
|
|
13321
|
+
* @param {string} data Input string
|
|
13322
|
+
* @return {Array} Array of segments
|
|
13323
|
+
*/
|
|
13324
|
+
exports.rawSplit = function rawSplit(data) {
|
|
13325
|
+
return exports.fromArray(getSegmentsFromString(data, Utils.isKanjiModeEnabled()));
|
|
13326
|
+
};
|
|
13327
|
+
}));
|
|
13328
|
+
//#endregion
|
|
13329
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js
|
|
13330
|
+
var require_qrcode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13331
|
+
var Utils = require_utils$1();
|
|
13332
|
+
var ECLevel = require_error_correction_level();
|
|
13333
|
+
var BitBuffer = require_bit_buffer();
|
|
13334
|
+
var BitMatrix = require_bit_matrix();
|
|
13335
|
+
var AlignmentPattern = require_alignment_pattern();
|
|
13336
|
+
var FinderPattern = require_finder_pattern();
|
|
13337
|
+
var MaskPattern = require_mask_pattern();
|
|
13338
|
+
var ECCode = require_error_correction_code();
|
|
13339
|
+
var ReedSolomonEncoder = require_reed_solomon_encoder();
|
|
13340
|
+
var Version = require_version();
|
|
13341
|
+
var FormatInfo = require_format_info();
|
|
13342
|
+
var Mode = require_mode();
|
|
13343
|
+
var Segments = require_segments();
|
|
13344
|
+
/**
|
|
13345
|
+
* QRCode for JavaScript
|
|
13346
|
+
*
|
|
13347
|
+
* modified by Ryan Day for nodejs support
|
|
13348
|
+
* Copyright (c) 2011 Ryan Day
|
|
13349
|
+
*
|
|
13350
|
+
* Licensed under the MIT license:
|
|
13351
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
13352
|
+
*
|
|
13353
|
+
//---------------------------------------------------------------------
|
|
13354
|
+
// QRCode for JavaScript
|
|
13355
|
+
//
|
|
13356
|
+
// Copyright (c) 2009 Kazuhiko Arase
|
|
13357
|
+
//
|
|
13358
|
+
// URL: http://www.d-project.com/
|
|
13359
|
+
//
|
|
13360
|
+
// Licensed under the MIT license:
|
|
13361
|
+
// http://www.opensource.org/licenses/mit-license.php
|
|
13362
|
+
//
|
|
13363
|
+
// The word "QR Code" is registered trademark of
|
|
13364
|
+
// DENSO WAVE INCORPORATED
|
|
13365
|
+
// http://www.denso-wave.com/qrcode/faqpatent-e.html
|
|
13366
|
+
//
|
|
13367
|
+
//---------------------------------------------------------------------
|
|
13368
|
+
*/
|
|
13369
|
+
/**
|
|
13370
|
+
* Add finder patterns bits to matrix
|
|
13371
|
+
*
|
|
13372
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
13373
|
+
* @param {Number} version QR Code version
|
|
13374
|
+
*/
|
|
13375
|
+
function setupFinderPattern(matrix, version) {
|
|
13376
|
+
const size = matrix.size;
|
|
13377
|
+
const pos = FinderPattern.getPositions(version);
|
|
13378
|
+
for (let i = 0; i < pos.length; i++) {
|
|
13379
|
+
const row = pos[i][0];
|
|
13380
|
+
const col = pos[i][1];
|
|
13381
|
+
for (let r = -1; r <= 7; r++) {
|
|
13382
|
+
if (row + r <= -1 || size <= row + r) continue;
|
|
13383
|
+
for (let c = -1; c <= 7; c++) {
|
|
13384
|
+
if (col + c <= -1 || size <= col + c) continue;
|
|
13385
|
+
if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) matrix.set(row + r, col + c, true, true);
|
|
13386
|
+
else matrix.set(row + r, col + c, false, true);
|
|
13387
|
+
}
|
|
13388
|
+
}
|
|
13389
|
+
}
|
|
13390
|
+
}
|
|
13391
|
+
/**
|
|
13392
|
+
* Add timing pattern bits to matrix
|
|
13393
|
+
*
|
|
13394
|
+
* Note: this function must be called before {@link setupAlignmentPattern}
|
|
13395
|
+
*
|
|
13396
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
13397
|
+
*/
|
|
13398
|
+
function setupTimingPattern(matrix) {
|
|
13399
|
+
const size = matrix.size;
|
|
13400
|
+
for (let r = 8; r < size - 8; r++) {
|
|
13401
|
+
const value = r % 2 === 0;
|
|
13402
|
+
matrix.set(r, 6, value, true);
|
|
13403
|
+
matrix.set(6, r, value, true);
|
|
13404
|
+
}
|
|
13405
|
+
}
|
|
13406
|
+
/**
|
|
13407
|
+
* Add alignment patterns bits to matrix
|
|
13408
|
+
*
|
|
13409
|
+
* Note: this function must be called after {@link setupTimingPattern}
|
|
13410
|
+
*
|
|
13411
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
13412
|
+
* @param {Number} version QR Code version
|
|
13413
|
+
*/
|
|
13414
|
+
function setupAlignmentPattern(matrix, version) {
|
|
13415
|
+
const pos = AlignmentPattern.getPositions(version);
|
|
13416
|
+
for (let i = 0; i < pos.length; i++) {
|
|
13417
|
+
const row = pos[i][0];
|
|
13418
|
+
const col = pos[i][1];
|
|
13419
|
+
for (let r = -2; r <= 2; r++) for (let c = -2; c <= 2; c++) if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) matrix.set(row + r, col + c, true, true);
|
|
13420
|
+
else matrix.set(row + r, col + c, false, true);
|
|
13421
|
+
}
|
|
13422
|
+
}
|
|
13423
|
+
/**
|
|
13424
|
+
* Add version info bits to matrix
|
|
13425
|
+
*
|
|
13426
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
13427
|
+
* @param {Number} version QR Code version
|
|
13428
|
+
*/
|
|
13429
|
+
function setupVersionInfo(matrix, version) {
|
|
13430
|
+
const size = matrix.size;
|
|
13431
|
+
const bits = Version.getEncodedBits(version);
|
|
13432
|
+
let row, col, mod;
|
|
13433
|
+
for (let i = 0; i < 18; i++) {
|
|
13434
|
+
row = Math.floor(i / 3);
|
|
13435
|
+
col = i % 3 + size - 8 - 3;
|
|
13436
|
+
mod = (bits >> i & 1) === 1;
|
|
13437
|
+
matrix.set(row, col, mod, true);
|
|
13438
|
+
matrix.set(col, row, mod, true);
|
|
13439
|
+
}
|
|
13440
|
+
}
|
|
13441
|
+
/**
|
|
13442
|
+
* Add format info bits to matrix
|
|
13443
|
+
*
|
|
13444
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
13445
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
13446
|
+
* @param {Number} maskPattern Mask pattern reference value
|
|
13447
|
+
*/
|
|
13448
|
+
function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
|
|
13449
|
+
const size = matrix.size;
|
|
13450
|
+
const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
|
|
13451
|
+
let i, mod;
|
|
13452
|
+
for (i = 0; i < 15; i++) {
|
|
13453
|
+
mod = (bits >> i & 1) === 1;
|
|
13454
|
+
if (i < 6) matrix.set(i, 8, mod, true);
|
|
13455
|
+
else if (i < 8) matrix.set(i + 1, 8, mod, true);
|
|
13456
|
+
else matrix.set(size - 15 + i, 8, mod, true);
|
|
13457
|
+
if (i < 8) matrix.set(8, size - i - 1, mod, true);
|
|
13458
|
+
else if (i < 9) matrix.set(8, 15 - i - 1 + 1, mod, true);
|
|
13459
|
+
else matrix.set(8, 15 - i - 1, mod, true);
|
|
13460
|
+
}
|
|
13461
|
+
matrix.set(size - 8, 8, 1, true);
|
|
13462
|
+
}
|
|
13463
|
+
/**
|
|
13464
|
+
* Add encoded data bits to matrix
|
|
13465
|
+
*
|
|
13466
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
13467
|
+
* @param {Uint8Array} data Data codewords
|
|
13468
|
+
*/
|
|
13469
|
+
function setupData(matrix, data) {
|
|
13470
|
+
const size = matrix.size;
|
|
13471
|
+
let inc = -1;
|
|
13472
|
+
let row = size - 1;
|
|
13473
|
+
let bitIndex = 7;
|
|
13474
|
+
let byteIndex = 0;
|
|
13475
|
+
for (let col = size - 1; col > 0; col -= 2) {
|
|
13476
|
+
if (col === 6) col--;
|
|
13477
|
+
while (true) {
|
|
13478
|
+
for (let c = 0; c < 2; c++) if (!matrix.isReserved(row, col - c)) {
|
|
13479
|
+
let dark = false;
|
|
13480
|
+
if (byteIndex < data.length) dark = (data[byteIndex] >>> bitIndex & 1) === 1;
|
|
13481
|
+
matrix.set(row, col - c, dark);
|
|
13482
|
+
bitIndex--;
|
|
13483
|
+
if (bitIndex === -1) {
|
|
13484
|
+
byteIndex++;
|
|
13485
|
+
bitIndex = 7;
|
|
13486
|
+
}
|
|
13487
|
+
}
|
|
13488
|
+
row += inc;
|
|
13489
|
+
if (row < 0 || size <= row) {
|
|
13490
|
+
row -= inc;
|
|
13491
|
+
inc = -inc;
|
|
13492
|
+
break;
|
|
13493
|
+
}
|
|
13494
|
+
}
|
|
13495
|
+
}
|
|
13496
|
+
}
|
|
13497
|
+
/**
|
|
13498
|
+
* Create encoded codewords from data input
|
|
13499
|
+
*
|
|
13500
|
+
* @param {Number} version QR Code version
|
|
13501
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
13502
|
+
* @param {ByteData} data Data input
|
|
13503
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
13504
|
+
*/
|
|
13505
|
+
function createData(version, errorCorrectionLevel, segments) {
|
|
13506
|
+
const buffer = new BitBuffer();
|
|
13507
|
+
segments.forEach(function(data) {
|
|
13508
|
+
buffer.put(data.mode.bit, 4);
|
|
13509
|
+
buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
|
|
13510
|
+
data.write(buffer);
|
|
13511
|
+
});
|
|
13512
|
+
const dataTotalCodewordsBits = (Utils.getSymbolTotalCodewords(version) - ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)) * 8;
|
|
13513
|
+
if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) buffer.put(0, 4);
|
|
13514
|
+
while (buffer.getLengthInBits() % 8 !== 0) buffer.putBit(0);
|
|
13515
|
+
const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
|
|
13516
|
+
for (let i = 0; i < remainingByte; i++) buffer.put(i % 2 ? 17 : 236, 8);
|
|
13517
|
+
return createCodewords(buffer, version, errorCorrectionLevel);
|
|
13518
|
+
}
|
|
13519
|
+
/**
|
|
13520
|
+
* Encode input data with Reed-Solomon and return codewords with
|
|
13521
|
+
* relative error correction bits
|
|
13522
|
+
*
|
|
13523
|
+
* @param {BitBuffer} bitBuffer Data to encode
|
|
13524
|
+
* @param {Number} version QR Code version
|
|
13525
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
13526
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
13527
|
+
*/
|
|
13528
|
+
function createCodewords(bitBuffer, version, errorCorrectionLevel) {
|
|
13529
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version);
|
|
13530
|
+
const dataTotalCodewords = totalCodewords - ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
|
|
13531
|
+
const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
|
|
13532
|
+
const blocksInGroup1 = ecTotalBlocks - totalCodewords % ecTotalBlocks;
|
|
13533
|
+
const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
|
|
13534
|
+
const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
|
|
13535
|
+
const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
|
|
13536
|
+
const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
|
|
13537
|
+
const rs = new ReedSolomonEncoder(ecCount);
|
|
13538
|
+
let offset = 0;
|
|
13539
|
+
const dcData = new Array(ecTotalBlocks);
|
|
13540
|
+
const ecData = new Array(ecTotalBlocks);
|
|
13541
|
+
let maxDataSize = 0;
|
|
13542
|
+
const buffer = new Uint8Array(bitBuffer.buffer);
|
|
13543
|
+
for (let b = 0; b < ecTotalBlocks; b++) {
|
|
13544
|
+
const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
|
|
13545
|
+
dcData[b] = buffer.slice(offset, offset + dataSize);
|
|
13546
|
+
ecData[b] = rs.encode(dcData[b]);
|
|
13547
|
+
offset += dataSize;
|
|
13548
|
+
maxDataSize = Math.max(maxDataSize, dataSize);
|
|
13549
|
+
}
|
|
13550
|
+
const data = new Uint8Array(totalCodewords);
|
|
13551
|
+
let index = 0;
|
|
13552
|
+
let i, r;
|
|
13553
|
+
for (i = 0; i < maxDataSize; i++) for (r = 0; r < ecTotalBlocks; r++) if (i < dcData[r].length) data[index++] = dcData[r][i];
|
|
13554
|
+
for (i = 0; i < ecCount; i++) for (r = 0; r < ecTotalBlocks; r++) data[index++] = ecData[r][i];
|
|
13555
|
+
return data;
|
|
13556
|
+
}
|
|
13557
|
+
/**
|
|
13558
|
+
* Build QR Code symbol
|
|
13559
|
+
*
|
|
13560
|
+
* @param {String} data Input string
|
|
13561
|
+
* @param {Number} version QR Code version
|
|
13562
|
+
* @param {ErrorCorretionLevel} errorCorrectionLevel Error level
|
|
13563
|
+
* @param {MaskPattern} maskPattern Mask pattern
|
|
13564
|
+
* @return {Object} Object containing symbol data
|
|
13565
|
+
*/
|
|
13566
|
+
function createSymbol(data, version, errorCorrectionLevel, maskPattern) {
|
|
13567
|
+
let segments;
|
|
13568
|
+
if (Array.isArray(data)) segments = Segments.fromArray(data);
|
|
13569
|
+
else if (typeof data === "string") {
|
|
13570
|
+
let estimatedVersion = version;
|
|
13571
|
+
if (!estimatedVersion) {
|
|
13572
|
+
const rawSegments = Segments.rawSplit(data);
|
|
13573
|
+
estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
|
|
13574
|
+
}
|
|
13575
|
+
segments = Segments.fromString(data, estimatedVersion || 40);
|
|
13576
|
+
} else throw new Error("Invalid data");
|
|
13577
|
+
const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
|
|
13578
|
+
if (!bestVersion) throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
13579
|
+
if (!version) version = bestVersion;
|
|
13580
|
+
else if (version < bestVersion) throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n");
|
|
13581
|
+
const dataBits = createData(version, errorCorrectionLevel, segments);
|
|
13582
|
+
const modules = new BitMatrix(Utils.getSymbolSize(version));
|
|
13583
|
+
setupFinderPattern(modules, version);
|
|
13584
|
+
setupTimingPattern(modules);
|
|
13585
|
+
setupAlignmentPattern(modules, version);
|
|
13586
|
+
setupFormatInfo(modules, errorCorrectionLevel, 0);
|
|
13587
|
+
if (version >= 7) setupVersionInfo(modules, version);
|
|
13588
|
+
setupData(modules, dataBits);
|
|
13589
|
+
if (isNaN(maskPattern)) maskPattern = MaskPattern.getBestMask(modules, setupFormatInfo.bind(null, modules, errorCorrectionLevel));
|
|
13590
|
+
MaskPattern.applyMask(maskPattern, modules);
|
|
13591
|
+
setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
|
|
13592
|
+
return {
|
|
13593
|
+
modules,
|
|
13594
|
+
version,
|
|
13595
|
+
errorCorrectionLevel,
|
|
13596
|
+
maskPattern,
|
|
13597
|
+
segments
|
|
13598
|
+
};
|
|
13599
|
+
}
|
|
13600
|
+
/**
|
|
13601
|
+
* QR Code
|
|
13602
|
+
*
|
|
13603
|
+
* @param {String | Array} data Input data
|
|
13604
|
+
* @param {Object} options Optional configurations
|
|
13605
|
+
* @param {Number} options.version QR Code version
|
|
13606
|
+
* @param {String} options.errorCorrectionLevel Error correction level
|
|
13607
|
+
* @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
|
|
13608
|
+
*/
|
|
13609
|
+
exports.create = function create(data, options) {
|
|
13610
|
+
if (typeof data === "undefined" || data === "") throw new Error("No input text");
|
|
13611
|
+
let errorCorrectionLevel = ECLevel.M;
|
|
13612
|
+
let version;
|
|
13613
|
+
let mask;
|
|
13614
|
+
if (typeof options !== "undefined") {
|
|
13615
|
+
errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
|
|
13616
|
+
version = Version.from(options.version);
|
|
13617
|
+
mask = MaskPattern.from(options.maskPattern);
|
|
13618
|
+
if (options.toSJISFunc) Utils.setToSJISFunction(options.toSJISFunc);
|
|
13619
|
+
}
|
|
13620
|
+
return createSymbol(data, version, errorCorrectionLevel, mask);
|
|
13621
|
+
};
|
|
13622
|
+
}));
|
|
13623
|
+
//#endregion
|
|
13624
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js
|
|
13625
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13626
|
+
function hex2rgba(hex) {
|
|
13627
|
+
if (typeof hex === "number") hex = hex.toString();
|
|
13628
|
+
if (typeof hex !== "string") throw new Error("Color should be defined as hex string");
|
|
13629
|
+
let hexCode = hex.slice().replace("#", "").split("");
|
|
13630
|
+
if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) throw new Error("Invalid hex color: " + hex);
|
|
13631
|
+
if (hexCode.length === 3 || hexCode.length === 4) hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {
|
|
13632
|
+
return [c, c];
|
|
13633
|
+
}));
|
|
13634
|
+
if (hexCode.length === 6) hexCode.push("F", "F");
|
|
13635
|
+
const hexValue = parseInt(hexCode.join(""), 16);
|
|
13636
|
+
return {
|
|
13637
|
+
r: hexValue >> 24 & 255,
|
|
13638
|
+
g: hexValue >> 16 & 255,
|
|
13639
|
+
b: hexValue >> 8 & 255,
|
|
13640
|
+
a: hexValue & 255,
|
|
13641
|
+
hex: "#" + hexCode.slice(0, 6).join("")
|
|
13642
|
+
};
|
|
13643
|
+
}
|
|
13644
|
+
exports.getOptions = function getOptions(options) {
|
|
13645
|
+
if (!options) options = {};
|
|
13646
|
+
if (!options.color) options.color = {};
|
|
13647
|
+
const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;
|
|
13648
|
+
const width = options.width && options.width >= 21 ? options.width : void 0;
|
|
13649
|
+
const scale = options.scale || 4;
|
|
13650
|
+
return {
|
|
13651
|
+
width,
|
|
13652
|
+
scale: width ? 4 : scale,
|
|
13653
|
+
margin,
|
|
13654
|
+
color: {
|
|
13655
|
+
dark: hex2rgba(options.color.dark || "#000000ff"),
|
|
13656
|
+
light: hex2rgba(options.color.light || "#ffffffff")
|
|
13657
|
+
},
|
|
13658
|
+
type: options.type,
|
|
13659
|
+
rendererOpts: options.rendererOpts || {}
|
|
13660
|
+
};
|
|
13661
|
+
};
|
|
13662
|
+
exports.getScale = function getScale(qrSize, opts) {
|
|
13663
|
+
return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;
|
|
13664
|
+
};
|
|
13665
|
+
exports.getImageWidth = function getImageWidth(qrSize, opts) {
|
|
13666
|
+
const scale = exports.getScale(qrSize, opts);
|
|
13667
|
+
return Math.floor((qrSize + opts.margin * 2) * scale);
|
|
13668
|
+
};
|
|
13669
|
+
exports.qrToImageData = function qrToImageData(imgData, qr, opts) {
|
|
13670
|
+
const size = qr.modules.size;
|
|
13671
|
+
const data = qr.modules.data;
|
|
13672
|
+
const scale = exports.getScale(size, opts);
|
|
13673
|
+
const symbolSize = Math.floor((size + opts.margin * 2) * scale);
|
|
13674
|
+
const scaledMargin = opts.margin * scale;
|
|
13675
|
+
const palette = [opts.color.light, opts.color.dark];
|
|
13676
|
+
for (let i = 0; i < symbolSize; i++) for (let j = 0; j < symbolSize; j++) {
|
|
13677
|
+
let posDst = (i * symbolSize + j) * 4;
|
|
13678
|
+
let pxColor = opts.color.light;
|
|
13679
|
+
if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
|
|
13680
|
+
const iSrc = Math.floor((i - scaledMargin) / scale);
|
|
13681
|
+
const jSrc = Math.floor((j - scaledMargin) / scale);
|
|
13682
|
+
pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
|
|
13683
|
+
}
|
|
13684
|
+
imgData[posDst++] = pxColor.r;
|
|
13685
|
+
imgData[posDst++] = pxColor.g;
|
|
13686
|
+
imgData[posDst++] = pxColor.b;
|
|
13687
|
+
imgData[posDst] = pxColor.a;
|
|
13688
|
+
}
|
|
13689
|
+
};
|
|
13690
|
+
}));
|
|
13691
|
+
//#endregion
|
|
13692
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js
|
|
13693
|
+
var require_canvas = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13694
|
+
var Utils = require_utils();
|
|
13695
|
+
function clearCanvas(ctx, canvas, size) {
|
|
13696
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
13697
|
+
if (!canvas.style) canvas.style = {};
|
|
13698
|
+
canvas.height = size;
|
|
13699
|
+
canvas.width = size;
|
|
13700
|
+
canvas.style.height = size + "px";
|
|
13701
|
+
canvas.style.width = size + "px";
|
|
13702
|
+
}
|
|
13703
|
+
function getCanvasElement() {
|
|
13704
|
+
try {
|
|
13705
|
+
return document.createElement("canvas");
|
|
13706
|
+
} catch (e) {
|
|
13707
|
+
throw new Error("You need to specify a canvas element");
|
|
13708
|
+
}
|
|
13709
|
+
}
|
|
13710
|
+
exports.render = function render(qrData, canvas, options) {
|
|
13711
|
+
let opts = options;
|
|
13712
|
+
let canvasEl = canvas;
|
|
13713
|
+
if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
|
|
13714
|
+
opts = canvas;
|
|
13715
|
+
canvas = void 0;
|
|
13716
|
+
}
|
|
13717
|
+
if (!canvas) canvasEl = getCanvasElement();
|
|
13718
|
+
opts = Utils.getOptions(opts);
|
|
13719
|
+
const size = Utils.getImageWidth(qrData.modules.size, opts);
|
|
13720
|
+
const ctx = canvasEl.getContext("2d");
|
|
13721
|
+
const image = ctx.createImageData(size, size);
|
|
13722
|
+
Utils.qrToImageData(image.data, qrData, opts);
|
|
13723
|
+
clearCanvas(ctx, canvasEl, size);
|
|
13724
|
+
ctx.putImageData(image, 0, 0);
|
|
13725
|
+
return canvasEl;
|
|
13726
|
+
};
|
|
13727
|
+
exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {
|
|
13728
|
+
let opts = options;
|
|
13729
|
+
if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
|
|
13730
|
+
opts = canvas;
|
|
13731
|
+
canvas = void 0;
|
|
13732
|
+
}
|
|
13733
|
+
if (!opts) opts = {};
|
|
13734
|
+
const canvasEl = exports.render(qrData, canvas, opts);
|
|
13735
|
+
const type = opts.type || "image/png";
|
|
13736
|
+
const rendererOpts = opts.rendererOpts || {};
|
|
13737
|
+
return canvasEl.toDataURL(type, rendererOpts.quality);
|
|
13738
|
+
};
|
|
13739
|
+
}));
|
|
13740
|
+
//#endregion
|
|
13741
|
+
//#region node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js
|
|
13742
|
+
var require_svg_tag = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13743
|
+
var Utils = require_utils();
|
|
13744
|
+
function getColorAttrib(color, attrib) {
|
|
13745
|
+
const alpha = color.a / 255;
|
|
13746
|
+
const str = attrib + "=\"" + color.hex + "\"";
|
|
13747
|
+
return alpha < 1 ? str + " " + attrib + "-opacity=\"" + alpha.toFixed(2).slice(1) + "\"" : str;
|
|
13748
|
+
}
|
|
13749
|
+
function svgCmd(cmd, x, y) {
|
|
13750
|
+
let str = cmd + x;
|
|
13751
|
+
if (typeof y !== "undefined") str += " " + y;
|
|
13752
|
+
return str;
|
|
13753
|
+
}
|
|
13754
|
+
function qrToPath(data, size, margin) {
|
|
13755
|
+
let path = "";
|
|
13756
|
+
let moveBy = 0;
|
|
13757
|
+
let newRow = false;
|
|
13758
|
+
let lineLength = 0;
|
|
13759
|
+
for (let i = 0; i < data.length; i++) {
|
|
13760
|
+
const col = Math.floor(i % size);
|
|
13761
|
+
const row = Math.floor(i / size);
|
|
13762
|
+
if (!col && !newRow) newRow = true;
|
|
13763
|
+
if (data[i]) {
|
|
13764
|
+
lineLength++;
|
|
13765
|
+
if (!(i > 0 && col > 0 && data[i - 1])) {
|
|
13766
|
+
path += newRow ? svgCmd("M", col + margin, .5 + row + margin) : svgCmd("m", moveBy, 0);
|
|
13767
|
+
moveBy = 0;
|
|
13768
|
+
newRow = false;
|
|
13769
|
+
}
|
|
13770
|
+
if (!(col + 1 < size && data[i + 1])) {
|
|
13771
|
+
path += svgCmd("h", lineLength);
|
|
13772
|
+
lineLength = 0;
|
|
13773
|
+
}
|
|
13774
|
+
} else moveBy++;
|
|
13775
|
+
}
|
|
13776
|
+
return path;
|
|
13777
|
+
}
|
|
13778
|
+
exports.render = function render(qrData, options, cb) {
|
|
13779
|
+
const opts = Utils.getOptions(options);
|
|
13780
|
+
const size = qrData.modules.size;
|
|
13781
|
+
const data = qrData.modules.data;
|
|
13782
|
+
const qrcodesize = size + opts.margin * 2;
|
|
13783
|
+
const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + " d=\"M0 0h" + qrcodesize + "v" + qrcodesize + "H0z\"/>";
|
|
13784
|
+
const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + " d=\"" + qrToPath(data, size, opts.margin) + "\"/>";
|
|
13785
|
+
const viewBox = "viewBox=\"0 0 " + qrcodesize + " " + qrcodesize + "\"";
|
|
13786
|
+
const svgTag = "<svg xmlns=\"http://www.w3.org/2000/svg\" " + (!opts.width ? "" : "width=\"" + opts.width + "\" height=\"" + opts.width + "\" ") + viewBox + " shape-rendering=\"crispEdges\">" + bg + path + "</svg>\n";
|
|
13787
|
+
if (typeof cb === "function") cb(null, svgTag);
|
|
13788
|
+
return svgTag;
|
|
13789
|
+
};
|
|
13790
|
+
}));
|
|
13791
|
+
//#endregion
|
|
13792
|
+
//#region components/spin/index.tsx
|
|
13793
|
+
var import_browser = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13794
|
+
var canPromise = require_can_promise();
|
|
13795
|
+
var QRCode = require_qrcode();
|
|
13796
|
+
var CanvasRenderer = require_canvas();
|
|
13797
|
+
var SvgRenderer = require_svg_tag();
|
|
13798
|
+
function renderCanvas(renderFunc, canvas, text, opts, cb) {
|
|
13799
|
+
const args = [].slice.call(arguments, 1);
|
|
13800
|
+
const argsNum = args.length;
|
|
13801
|
+
const isLastArgCb = typeof args[argsNum - 1] === "function";
|
|
13802
|
+
if (!isLastArgCb && !canPromise()) throw new Error("Callback required as last argument");
|
|
13803
|
+
if (isLastArgCb) {
|
|
13804
|
+
if (argsNum < 2) throw new Error("Too few arguments provided");
|
|
13805
|
+
if (argsNum === 2) {
|
|
13806
|
+
cb = text;
|
|
13807
|
+
text = canvas;
|
|
13808
|
+
canvas = opts = void 0;
|
|
13809
|
+
} else if (argsNum === 3) if (canvas.getContext && typeof cb === "undefined") {
|
|
13810
|
+
cb = opts;
|
|
13811
|
+
opts = void 0;
|
|
13812
|
+
} else {
|
|
13813
|
+
cb = opts;
|
|
13814
|
+
opts = text;
|
|
13815
|
+
text = canvas;
|
|
13816
|
+
canvas = void 0;
|
|
13817
|
+
}
|
|
13818
|
+
} else {
|
|
13819
|
+
if (argsNum < 1) throw new Error("Too few arguments provided");
|
|
13820
|
+
if (argsNum === 1) {
|
|
13821
|
+
text = canvas;
|
|
13822
|
+
canvas = opts = void 0;
|
|
13823
|
+
} else if (argsNum === 2 && !canvas.getContext) {
|
|
13824
|
+
opts = text;
|
|
13825
|
+
text = canvas;
|
|
13826
|
+
canvas = void 0;
|
|
13827
|
+
}
|
|
13828
|
+
return new Promise(function(resolve, reject) {
|
|
13829
|
+
try {
|
|
13830
|
+
resolve(renderFunc(QRCode.create(text, opts), canvas, opts));
|
|
13831
|
+
} catch (e) {
|
|
13832
|
+
reject(e);
|
|
13833
|
+
}
|
|
13834
|
+
});
|
|
13835
|
+
}
|
|
13836
|
+
try {
|
|
13837
|
+
const data = QRCode.create(text, opts);
|
|
13838
|
+
cb(null, renderFunc(data, canvas, opts));
|
|
13839
|
+
} catch (e) {
|
|
13840
|
+
cb(e);
|
|
13841
|
+
}
|
|
13842
|
+
}
|
|
13843
|
+
exports.create = QRCode.create;
|
|
13844
|
+
exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
|
|
13845
|
+
exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
|
|
13846
|
+
exports.toString = renderCanvas.bind(null, function(data, _, opts) {
|
|
13847
|
+
return SvgRenderer.render(data, opts);
|
|
13848
|
+
});
|
|
13849
|
+
})))();
|
|
13850
|
+
var Spin = /* @__PURE__ */ defineComponent({
|
|
13851
|
+
name: "Spin",
|
|
13852
|
+
props: {
|
|
13853
|
+
modelValue: {
|
|
13854
|
+
type: Boolean,
|
|
13855
|
+
default: true
|
|
13856
|
+
},
|
|
13857
|
+
delay: {
|
|
13858
|
+
type: Number,
|
|
13859
|
+
default: 500
|
|
13860
|
+
},
|
|
13861
|
+
size: { type: String },
|
|
13862
|
+
mode: {
|
|
13863
|
+
type: String,
|
|
13864
|
+
default: "rotate"
|
|
13865
|
+
}
|
|
13866
|
+
},
|
|
13867
|
+
setup(props, { slots }) {
|
|
13868
|
+
const spinning = ref(props.modelValue);
|
|
13869
|
+
let timer;
|
|
13870
|
+
watch(() => props.modelValue, (nv) => {
|
|
13871
|
+
if (nv) spinning.value = nv;
|
|
13872
|
+
else {
|
|
13873
|
+
clearTimeout(timer);
|
|
13874
|
+
timer = setTimeout(() => {
|
|
13875
|
+
spinning.value = nv;
|
|
13876
|
+
}, props.delay);
|
|
13877
|
+
}
|
|
13878
|
+
});
|
|
13879
|
+
return () => {
|
|
13880
|
+
let { mode, size } = props;
|
|
13881
|
+
const classes = [{
|
|
13882
|
+
[`k-spin-loading`]: spinning.value,
|
|
13883
|
+
[`k-spin-${mode}`]: mode && spinning.value
|
|
13884
|
+
}];
|
|
13885
|
+
const children = slots.default?.();
|
|
13886
|
+
const root = ["k-spin", {
|
|
13887
|
+
[`k-spin-lg`]: size == "large",
|
|
13888
|
+
[`k-spin-sm`]: size == "small",
|
|
13889
|
+
[`k-spin-only`]: children == null
|
|
13890
|
+
}];
|
|
13891
|
+
const spin = createVNode("div", { "class": classes }, null);
|
|
13892
|
+
return createVNode("div", { "class": root }, [[spin, children]]);
|
|
13893
|
+
};
|
|
13894
|
+
}
|
|
13895
|
+
});
|
|
13896
|
+
//#endregion
|
|
13897
|
+
//#region components/qrcode/index.tsx
|
|
13898
|
+
var QRCode = /* @__PURE__ */ defineComponent({
|
|
13899
|
+
name: "QRCode",
|
|
13900
|
+
props: {
|
|
13901
|
+
value: {
|
|
13902
|
+
type: String,
|
|
13903
|
+
required: true
|
|
13904
|
+
},
|
|
13905
|
+
size: {
|
|
13906
|
+
type: Number,
|
|
13907
|
+
default: 160
|
|
13908
|
+
},
|
|
13909
|
+
colorDark: {
|
|
13910
|
+
type: String,
|
|
13911
|
+
default: "var(--kui-color-reverse)"
|
|
13912
|
+
},
|
|
13913
|
+
colorLight: {
|
|
13914
|
+
type: String,
|
|
13915
|
+
default: "var(--kui-color-bg)"
|
|
13916
|
+
},
|
|
13917
|
+
bordered: {
|
|
13918
|
+
type: Boolean,
|
|
13919
|
+
default: true
|
|
13920
|
+
},
|
|
13921
|
+
status: {
|
|
13922
|
+
type: String,
|
|
13923
|
+
default: "active"
|
|
13924
|
+
},
|
|
13925
|
+
logo: {
|
|
13926
|
+
type: String,
|
|
13927
|
+
default: ""
|
|
13928
|
+
},
|
|
13929
|
+
logoSize: { type: Number },
|
|
13930
|
+
margin: {
|
|
13931
|
+
type: Number,
|
|
13932
|
+
default: 0
|
|
13933
|
+
},
|
|
13934
|
+
logoRadius: {
|
|
13935
|
+
type: Number,
|
|
13936
|
+
default: 4
|
|
13937
|
+
},
|
|
13938
|
+
logoBorder: {
|
|
13939
|
+
type: Boolean,
|
|
13940
|
+
default: true
|
|
13941
|
+
},
|
|
13942
|
+
errorLevel: {
|
|
13943
|
+
type: String,
|
|
13944
|
+
default: "M"
|
|
13945
|
+
}
|
|
13946
|
+
},
|
|
13947
|
+
emits: ["refresh"],
|
|
13948
|
+
setup(props, { emit, slots, expose }) {
|
|
13949
|
+
const canvasRef = ref(null);
|
|
13950
|
+
let rootObserver = null;
|
|
13951
|
+
const injectedLocale = inject("locale", zh_CN_default);
|
|
13952
|
+
const locale = computed(() => {
|
|
13953
|
+
return injectedLocale instanceof Object && "value" in injectedLocale ? injectedLocale.value : injectedLocale;
|
|
13954
|
+
});
|
|
13955
|
+
const initThemeObserver = () => {
|
|
13956
|
+
const rootEl = document.documentElement;
|
|
13957
|
+
rootObserver = new MutationObserver((mutations) => {
|
|
13958
|
+
for (const mutation of mutations) if (mutation.type === "attributes" && mutation.attributeName === "theme-mode") {
|
|
13959
|
+
drawQRCode();
|
|
13960
|
+
break;
|
|
13961
|
+
}
|
|
13962
|
+
});
|
|
13963
|
+
rootObserver.observe(rootEl, {
|
|
13964
|
+
attributes: true,
|
|
13965
|
+
attributeFilter: ["theme-mode"]
|
|
13966
|
+
});
|
|
13967
|
+
};
|
|
13968
|
+
const parseCssVariable = (colorStr) => {
|
|
13969
|
+
if (colorStr.trim().startsWith("var(")) {
|
|
13970
|
+
const tempDiv = document.createElement("div");
|
|
13971
|
+
tempDiv.style.color = colorStr;
|
|
13972
|
+
document.body.appendChild(tempDiv);
|
|
13973
|
+
let computedColor = window.getComputedStyle(tempDiv).color;
|
|
13974
|
+
computedColor = Color(computedColor).hex();
|
|
13975
|
+
document.body.removeChild(tempDiv);
|
|
13976
|
+
return computedColor || "#000000";
|
|
13977
|
+
}
|
|
13978
|
+
return colorStr;
|
|
13979
|
+
};
|
|
13980
|
+
const drawQRCode = async () => {
|
|
13981
|
+
if (!canvasRef.value) return;
|
|
13982
|
+
const canvas = canvasRef.value;
|
|
13983
|
+
const ctx = canvas.getContext("2d");
|
|
13984
|
+
if (!ctx) return;
|
|
13985
|
+
const { size, value, logo, logoRadius, logoBorder, errorLevel } = props;
|
|
13986
|
+
const ratio = window.devicePixelRatio || 1;
|
|
13987
|
+
canvas.width = size * ratio;
|
|
13988
|
+
canvas.height = size * ratio;
|
|
13989
|
+
ctx.scale(ratio, ratio);
|
|
13990
|
+
try {
|
|
13991
|
+
const realDark = parseCssVariable(props.colorDark);
|
|
13992
|
+
const realLight = parseCssVariable(props.colorLight);
|
|
13993
|
+
const options = {
|
|
13994
|
+
width: size,
|
|
13995
|
+
margin: props.margin,
|
|
13996
|
+
color: {
|
|
13997
|
+
dark: realDark,
|
|
13998
|
+
light: realLight
|
|
13999
|
+
},
|
|
14000
|
+
errorCorrectionLevel: errorLevel
|
|
14001
|
+
};
|
|
14002
|
+
const memCanvas = document.createElement("canvas");
|
|
14003
|
+
await (0, import_browser.toCanvas)(memCanvas, value || " ", options);
|
|
14004
|
+
ctx.drawImage(memCanvas, 0, 0, size, size);
|
|
14005
|
+
if (logo) {
|
|
14006
|
+
const img = new Image();
|
|
14007
|
+
img.crossOrigin = "anonymous";
|
|
14008
|
+
img.src = logo;
|
|
14009
|
+
img.onload = () => {
|
|
14010
|
+
const computedLogoSize = props.logoSize || size * .22;
|
|
14011
|
+
const x = (size - computedLogoSize) / 2;
|
|
14012
|
+
const y = (size - computedLogoSize) / 2;
|
|
14013
|
+
ctx.save();
|
|
14014
|
+
if (logoBorder) {
|
|
14015
|
+
ctx.fillStyle = realLight;
|
|
14016
|
+
const borderSize = computedLogoSize + 6;
|
|
14017
|
+
const bx = (size - borderSize) / 2;
|
|
14018
|
+
const by = (size - borderSize) / 2;
|
|
14019
|
+
ctx.beginPath();
|
|
14020
|
+
ctx.roundRect(bx, by, borderSize, borderSize, logoRadius + 2);
|
|
14021
|
+
ctx.fill();
|
|
14022
|
+
}
|
|
14023
|
+
ctx.beginPath();
|
|
14024
|
+
ctx.roundRect(x, y, computedLogoSize, computedLogoSize, logoRadius);
|
|
14025
|
+
ctx.clip();
|
|
14026
|
+
ctx.drawImage(img, x, y, computedLogoSize, computedLogoSize);
|
|
14027
|
+
ctx.restore();
|
|
14028
|
+
};
|
|
14029
|
+
}
|
|
14030
|
+
} catch (err) {
|
|
14031
|
+
console.error("二维码生成失败: ", err);
|
|
14032
|
+
}
|
|
14033
|
+
};
|
|
14034
|
+
const download = (fileName = "qrcode.png") => {
|
|
14035
|
+
if (!canvasRef.value) return;
|
|
14036
|
+
const url = canvasRef.value.toDataURL("image/png");
|
|
14037
|
+
const a = document.createElement("a");
|
|
14038
|
+
a.download = fileName;
|
|
14039
|
+
a.href = url;
|
|
14040
|
+
a.click();
|
|
14041
|
+
};
|
|
14042
|
+
watch(() => [
|
|
14043
|
+
props.value,
|
|
14044
|
+
props.size,
|
|
14045
|
+
props.colorDark,
|
|
14046
|
+
props.colorLight,
|
|
14047
|
+
props.logo,
|
|
14048
|
+
props.status,
|
|
14049
|
+
props.margin,
|
|
14050
|
+
props.errorLevel
|
|
14051
|
+
], () => {
|
|
14052
|
+
if (props.status === "active") drawQRCode();
|
|
14053
|
+
}, { deep: true });
|
|
14054
|
+
expose({ download });
|
|
14055
|
+
onMounted(() => {
|
|
14056
|
+
drawQRCode();
|
|
14057
|
+
initThemeObserver();
|
|
14058
|
+
});
|
|
14059
|
+
onBeforeUnmount(() => {
|
|
14060
|
+
if (rootObserver) rootObserver.disconnect();
|
|
14061
|
+
});
|
|
14062
|
+
const renderMask = () => {
|
|
14063
|
+
if (props.status === "active") return null;
|
|
14064
|
+
return createVNode("div", { "class": "k-qrcode-mask" }, [
|
|
14065
|
+
props.status === "loading" && createVNode("div", { "class": "k-qrcode-loading-wrapper" }, [slots.loading ? slots.loading() : [createVNode(Spin, { "size": "small" }, null), createVNode("span", null, [locale.value?.k.qrcode.loading])]]),
|
|
14066
|
+
props.status === "expired" && createVNode("div", {
|
|
14067
|
+
"class": "k-qrcode-expired-wrapper",
|
|
14068
|
+
"onClick": () => emit("refresh")
|
|
14069
|
+
}, [slots.expired ? slots.expired() : createVNode(Fragment, null, [createVNode("div", { "class": "k-qrcode-expired" }, [locale.value?.k.qrcode.expired]), createVNode(Button, {
|
|
14070
|
+
"size": "small",
|
|
14071
|
+
"type": "text"
|
|
14072
|
+
}, { default: () => [locale.value?.k.qrcode.refresh] })])]),
|
|
14073
|
+
props.status === "scanned" && createVNode("div", { "class": "k-qrcode-scanned-wrapper" }, [slots.scanned ? slots.scanned() : createVNode(Fragment, null, [locale.value?.k.qrcode.scanned])])
|
|
14074
|
+
]);
|
|
14075
|
+
};
|
|
14076
|
+
return () => {
|
|
14077
|
+
return createVNode("div", {
|
|
14078
|
+
"style": {
|
|
14079
|
+
width: `${props.size}px`,
|
|
14080
|
+
height: `${props.size}px`
|
|
14081
|
+
},
|
|
14082
|
+
"class": ["k-qrcode", { "k-qrcode-borderless": props.bordered === false }]
|
|
14083
|
+
}, [createVNode("canvas", {
|
|
14084
|
+
"ref": canvasRef,
|
|
14085
|
+
"style": {
|
|
14086
|
+
width: `${props.size}px`,
|
|
14087
|
+
height: `${props.size}px`,
|
|
14088
|
+
display: "block"
|
|
14089
|
+
}
|
|
14090
|
+
}, null), renderMask()]);
|
|
14091
|
+
};
|
|
14092
|
+
}
|
|
14093
|
+
});
|
|
14094
|
+
//#endregion
|
|
14095
|
+
//#region components/radio/radio.tsx
|
|
14096
|
+
var Radio = /* @__PURE__ */ defineComponent({
|
|
14097
|
+
name: "Radio",
|
|
14098
|
+
props: {
|
|
14099
|
+
modelValue: {
|
|
14100
|
+
type: [
|
|
14101
|
+
Boolean,
|
|
14102
|
+
String,
|
|
14103
|
+
Number
|
|
14104
|
+
],
|
|
14105
|
+
default: false
|
|
14106
|
+
},
|
|
14107
|
+
value: { type: [
|
|
14108
|
+
String,
|
|
14109
|
+
Number,
|
|
14110
|
+
Boolean
|
|
14111
|
+
] },
|
|
14112
|
+
label: { type: String },
|
|
14113
|
+
checked: Boolean,
|
|
14114
|
+
disabled: Boolean,
|
|
14115
|
+
theme: {
|
|
14116
|
+
type: String,
|
|
14117
|
+
default: "fill"
|
|
14118
|
+
},
|
|
14119
|
+
size: { type: String },
|
|
14120
|
+
onChange: Function
|
|
14121
|
+
},
|
|
14122
|
+
setup(props, { slots, emit }) {
|
|
14123
|
+
const isChecked = ref(props.modelValue || props.checked);
|
|
14124
|
+
watch(() => props.modelValue, (v) => {
|
|
14125
|
+
isChecked.value = v;
|
|
14126
|
+
});
|
|
14127
|
+
watch(() => props.checked, (v) => {
|
|
14128
|
+
isChecked.value = v;
|
|
14129
|
+
});
|
|
14130
|
+
const emitValue = (checked) => {
|
|
14131
|
+
isChecked.value = checked;
|
|
14132
|
+
emit("change", {
|
|
14133
|
+
checked,
|
|
14134
|
+
value: props.value,
|
|
14135
|
+
label: props.label || slots.default?.()
|
|
14136
|
+
});
|
|
14137
|
+
emit("update:modelValue", checked);
|
|
14138
|
+
emit("update:checked", checked);
|
|
14139
|
+
};
|
|
14140
|
+
const onChange = (e) => {
|
|
14141
|
+
if (props.disabled || isChecked.value) return;
|
|
14142
|
+
e.stopPropagation();
|
|
14143
|
+
e.preventDefault();
|
|
14144
|
+
const checked = e.target.checked;
|
|
14145
|
+
emitValue(checked);
|
|
14146
|
+
};
|
|
14147
|
+
const triggerCheck = (e) => {
|
|
14148
|
+
if (e.code == "Space") {
|
|
14149
|
+
e.preventDefault();
|
|
14150
|
+
e.stopPropagation();
|
|
14151
|
+
if (props.disabled || isChecked.value) return;
|
|
14152
|
+
emitValue(!isChecked.value);
|
|
14153
|
+
}
|
|
14154
|
+
};
|
|
14155
|
+
return () => {
|
|
14156
|
+
const classes = ["k-radio", {
|
|
14157
|
+
["k-radio-fill"]: props.theme == "fill",
|
|
14158
|
+
["k-radio-disabled"]: props.disabled,
|
|
14159
|
+
["k-radio-checked"]: isChecked.value,
|
|
14160
|
+
["k-radio-lg"]: props.size === "large",
|
|
14161
|
+
["k-radio-sm"]: props.size === "small"
|
|
14162
|
+
}];
|
|
14163
|
+
const labelNode = props.label || slots.default?.();
|
|
14164
|
+
return createVNode("label", {
|
|
14165
|
+
"class": classes,
|
|
14166
|
+
"tabindex": props.disabled ? void 0 : 0,
|
|
14167
|
+
"onKeydown": triggerCheck
|
|
14168
|
+
}, [createVNode("span", { "class": "k-radio-symbol" }, [createVNode("input", {
|
|
14169
|
+
"type": "radio",
|
|
14170
|
+
"tabindex": "-1",
|
|
14171
|
+
"class": "k-radio-input",
|
|
14172
|
+
"disabled": props.disabled,
|
|
14173
|
+
"onChange": onChange,
|
|
14174
|
+
"checked": isChecked.value
|
|
14175
|
+
}, null)]), labelNode ? createVNode("span", { "class": "k-radio-label" }, [labelNode]) : null]);
|
|
14176
|
+
};
|
|
14177
|
+
}
|
|
14178
|
+
});
|
|
14179
|
+
//#endregion
|
|
14180
|
+
//#region components/radio/radio-button.tsx
|
|
14181
|
+
function _isSlot$2(s) {
|
|
14182
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
14183
|
+
}
|
|
14184
|
+
var RadioButton = /* @__PURE__ */ defineComponent({
|
|
14185
|
+
name: "RadioButton",
|
|
14186
|
+
props: {
|
|
14187
|
+
modelValue: {
|
|
14188
|
+
type: [Boolean],
|
|
14189
|
+
default: false
|
|
14190
|
+
},
|
|
14191
|
+
label: { type: String },
|
|
14192
|
+
value: { type: [String, Number] },
|
|
14193
|
+
theme: String,
|
|
14194
|
+
disabled: Boolean,
|
|
14195
|
+
checked: Boolean,
|
|
14196
|
+
icon: Array,
|
|
14197
|
+
size: { type: String },
|
|
14198
|
+
shape: { type: String },
|
|
14199
|
+
onChange: Function
|
|
14200
|
+
},
|
|
14201
|
+
setup(props, { slots, emit, attrs }) {
|
|
14202
|
+
const isChecked = ref(props.modelValue || props.checked);
|
|
14203
|
+
watch(() => props.modelValue, (v) => {
|
|
14204
|
+
isChecked.value = v;
|
|
11430
14205
|
});
|
|
11431
14206
|
watch(() => props.checked, (v) => {
|
|
11432
14207
|
isChecked.value = v;
|
|
@@ -11458,6 +14233,8 @@ var RadioButton = /* @__PURE__ */ defineComponent({
|
|
|
11458
14233
|
};
|
|
11459
14234
|
}
|
|
11460
14235
|
});
|
|
14236
|
+
//#endregion
|
|
14237
|
+
//#region components/radio/radio-group.tsx
|
|
11461
14238
|
var RadioGroup = /* @__PURE__ */ defineComponent({
|
|
11462
14239
|
name: "RadioGroup",
|
|
11463
14240
|
props: {
|
|
@@ -11654,6 +14431,8 @@ var star_default = /* @__PURE__ */ defineComponent({
|
|
|
11654
14431
|
};
|
|
11655
14432
|
}
|
|
11656
14433
|
});
|
|
14434
|
+
//#endregion
|
|
14435
|
+
//#region components/rate/index.tsx
|
|
11657
14436
|
var Rate = /* @__PURE__ */ defineComponent({
|
|
11658
14437
|
name: "Rate",
|
|
11659
14438
|
props: {
|
|
@@ -11694,8 +14473,10 @@ var Rate = /* @__PURE__ */ defineComponent({
|
|
|
11694
14473
|
const update = (t, index, percent) => {
|
|
11695
14474
|
if (t === "M") {
|
|
11696
14475
|
if (cleared.value) return;
|
|
11697
|
-
if (props.allowHalf)
|
|
11698
|
-
|
|
14476
|
+
if (props.allowHalf) {
|
|
14477
|
+
const value = index - (percent < .5 ? .5 : 0);
|
|
14478
|
+
tempValue.value = value;
|
|
14479
|
+
} else tempValue.value = index;
|
|
11699
14480
|
} else {
|
|
11700
14481
|
let value = index - (props.allowHalf ? percent < .5 ? .5 : 0 : 0);
|
|
11701
14482
|
value = parseFloat(value.toFixed(2));
|
|
@@ -12447,6 +15228,8 @@ var CountUpNumber = /* @__PURE__ */ defineComponent({
|
|
|
12447
15228
|
}, null);
|
|
12448
15229
|
}
|
|
12449
15230
|
});
|
|
15231
|
+
//#endregion
|
|
15232
|
+
//#region components/stat-card/stat-number.tsx
|
|
12450
15233
|
var StatNumber = /* @__PURE__ */ defineComponent({
|
|
12451
15234
|
name: "StatNumber",
|
|
12452
15235
|
props: {
|
|
@@ -12500,6 +15283,8 @@ var StatNumber = /* @__PURE__ */ defineComponent({
|
|
|
12500
15283
|
};
|
|
12501
15284
|
}
|
|
12502
15285
|
});
|
|
15286
|
+
//#endregion
|
|
15287
|
+
//#region components/stat-card/stat-card.tsx
|
|
12503
15288
|
var StatCard = /* @__PURE__ */ defineComponent({
|
|
12504
15289
|
name: "StatCard",
|
|
12505
15290
|
props: {
|
|
@@ -12541,6 +15326,8 @@ var StatCard = /* @__PURE__ */ defineComponent({
|
|
|
12541
15326
|
};
|
|
12542
15327
|
}
|
|
12543
15328
|
});
|
|
15329
|
+
//#endregion
|
|
15330
|
+
//#region components/space/index.tsx
|
|
12544
15331
|
var Space = /* @__PURE__ */ defineComponent({
|
|
12545
15332
|
name: "Space",
|
|
12546
15333
|
props: {
|
|
@@ -12606,117 +15393,197 @@ var Space = /* @__PURE__ */ defineComponent({
|
|
|
12606
15393
|
};
|
|
12607
15394
|
}
|
|
12608
15395
|
});
|
|
12609
|
-
|
|
12610
|
-
|
|
15396
|
+
//#endregion
|
|
15397
|
+
//#region components/switch/index.tsx
|
|
15398
|
+
var Switch = /* @__PURE__ */ defineComponent({
|
|
15399
|
+
name: "KSwitch",
|
|
12611
15400
|
props: {
|
|
12612
|
-
|
|
15401
|
+
checked: {
|
|
12613
15402
|
type: Boolean,
|
|
12614
|
-
default:
|
|
15403
|
+
default: false
|
|
12615
15404
|
},
|
|
12616
|
-
|
|
12617
|
-
type:
|
|
12618
|
-
default:
|
|
15405
|
+
valueType: {
|
|
15406
|
+
type: String,
|
|
15407
|
+
default: "boolean"
|
|
12619
15408
|
},
|
|
15409
|
+
modelValue: { type: [
|
|
15410
|
+
String,
|
|
15411
|
+
Number,
|
|
15412
|
+
Boolean
|
|
15413
|
+
] },
|
|
15414
|
+
type: String,
|
|
15415
|
+
disabled: Boolean,
|
|
15416
|
+
loading: Boolean,
|
|
12620
15417
|
size: { type: String },
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
}
|
|
15418
|
+
trueText: String,
|
|
15419
|
+
falseText: String,
|
|
15420
|
+
onChange: Function
|
|
12625
15421
|
},
|
|
12626
|
-
setup(props, { slots }) {
|
|
12627
|
-
const
|
|
12628
|
-
let timer;
|
|
15422
|
+
setup(props, { slots, emit }) {
|
|
15423
|
+
const isChecked = ref(props.modelValue || props.checked);
|
|
12629
15424
|
watch(() => props.modelValue, (nv) => {
|
|
12630
|
-
|
|
12631
|
-
|
|
12632
|
-
|
|
12633
|
-
|
|
12634
|
-
spinning.value = nv;
|
|
12635
|
-
}, props.delay);
|
|
12636
|
-
}
|
|
15425
|
+
isChecked.value = nv == 1;
|
|
15426
|
+
});
|
|
15427
|
+
watch(() => props.checked, (nv) => {
|
|
15428
|
+
isChecked.value = nv;
|
|
12637
15429
|
});
|
|
15430
|
+
const change = () => {
|
|
15431
|
+
if (props.disabled) return false;
|
|
15432
|
+
const checked = !isChecked.value;
|
|
15433
|
+
isChecked.value = checked;
|
|
15434
|
+
const value = getValueWithType(checked, props.valueType);
|
|
15435
|
+
emit("update:modelValue", value);
|
|
15436
|
+
emit("update:checked", checked);
|
|
15437
|
+
emit("change", value);
|
|
15438
|
+
};
|
|
12638
15439
|
return () => {
|
|
12639
|
-
|
|
12640
|
-
const classes = [{
|
|
12641
|
-
[
|
|
12642
|
-
[
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
const root = ["k-spin", {
|
|
12646
|
-
[`k-spin-lg`]: size == "large",
|
|
12647
|
-
[`k-spin-sm`]: size == "small",
|
|
12648
|
-
[`k-spin-only`]: children == null
|
|
15440
|
+
const { type, trueText, falseText, disabled, loading, size } = props;
|
|
15441
|
+
const classes = ["k-switch", {
|
|
15442
|
+
["k-switch-checked"]: isChecked.value,
|
|
15443
|
+
["k-switch-disabled"]: disabled || loading,
|
|
15444
|
+
[`k-switch-${type}`]: !!type,
|
|
15445
|
+
["k-switch-sm"]: props.size == "small"
|
|
12649
15446
|
}];
|
|
12650
|
-
const
|
|
12651
|
-
|
|
15447
|
+
const children = slots.checked?.() || trueText || slots.unchecked?.() || falseText;
|
|
15448
|
+
const loadNode = loading ? createVNode(Icon, {
|
|
15449
|
+
"spin": true,
|
|
15450
|
+
"type": Loading,
|
|
15451
|
+
"class": "k-switch-loading"
|
|
15452
|
+
}, null) : null;
|
|
15453
|
+
const textNode = size != "small" && children ? createVNode("span", { "class": "k-switch-inner" }, [isChecked.value ? slots.checked?.() || trueText : slots.unchecked?.() || falseText]) : null;
|
|
15454
|
+
return createVNode("button", {
|
|
15455
|
+
"class": classes,
|
|
15456
|
+
"onClick": change,
|
|
15457
|
+
"disabled": disabled || loading,
|
|
15458
|
+
"type": "button"
|
|
15459
|
+
}, [textNode, loadNode]);
|
|
15460
|
+
};
|
|
15461
|
+
}
|
|
15462
|
+
});
|
|
15463
|
+
var Splitter = /* @__PURE__ */ defineComponent({
|
|
15464
|
+
name: "Splitter",
|
|
15465
|
+
props: {
|
|
15466
|
+
direction: {
|
|
15467
|
+
type: String,
|
|
15468
|
+
default: "horizontal"
|
|
15469
|
+
},
|
|
15470
|
+
onResize: Function,
|
|
15471
|
+
onResizeEnd: Function,
|
|
15472
|
+
onResizeStart: Function
|
|
15473
|
+
},
|
|
15474
|
+
setup(props, { slots, emit }) {
|
|
15475
|
+
const containerRef = ref(null);
|
|
15476
|
+
const isDragging = ref(false);
|
|
15477
|
+
const activeResizerIndex = ref(null);
|
|
15478
|
+
const panelSizes = ref([]);
|
|
15479
|
+
const minSizes = ref([]);
|
|
15480
|
+
const maxSizes = ref([]);
|
|
15481
|
+
const parseToPx = (val, total) => {
|
|
15482
|
+
if (val === void 0 || val === null || val === "") return null;
|
|
15483
|
+
const s = String(val).trim();
|
|
15484
|
+
if (s.endsWith("%")) return parseFloat(s) / 100 * total;
|
|
15485
|
+
if (s.endsWith("px")) return parseFloat(s);
|
|
15486
|
+
if (!isNaN(Number(s))) return parseFloat(s) / 100 * total;
|
|
15487
|
+
return null;
|
|
15488
|
+
};
|
|
15489
|
+
const initSizes = () => {
|
|
15490
|
+
if (!containerRef.value) return;
|
|
15491
|
+
const rect = containerRef.value.getBoundingClientRect();
|
|
15492
|
+
const children = slots.default?.() || [];
|
|
15493
|
+
const totalSize = (props.direction === "horizontal" ? rect.width : rect.height) - (children.length - 1) * 4;
|
|
15494
|
+
minSizes.value = children.map((c) => parseToPx(c.props?.min, totalSize) ?? 0);
|
|
15495
|
+
maxSizes.value = children.map((c) => parseToPx(c.props?.max, totalSize) ?? totalSize);
|
|
15496
|
+
const rawSizes = children.map((c) => parseToPx(c.props?.size, totalSize));
|
|
15497
|
+
const definedSum = rawSizes.reduce((acc, s) => (acc ?? 0) + (s ?? 0), 0) || 0;
|
|
15498
|
+
const undefinedCount = rawSizes.filter((s) => s === null).length;
|
|
15499
|
+
const spare = Math.max(0, totalSize - definedSum);
|
|
15500
|
+
const autoSize = undefinedCount > 0 ? spare / undefinedCount : 0;
|
|
15501
|
+
panelSizes.value = rawSizes.map((s) => s ?? autoSize);
|
|
15502
|
+
};
|
|
15503
|
+
const onMouseDown = (index) => {
|
|
15504
|
+
isDragging.value = true;
|
|
15505
|
+
activeResizerIndex.value = index;
|
|
15506
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
15507
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
15508
|
+
document.body.style.cursor = props.direction === "horizontal" ? "col-resize" : "row-resize";
|
|
15509
|
+
document.body.classList.add("k-splitter-dragging");
|
|
15510
|
+
emitSize("resizeStart");
|
|
15511
|
+
};
|
|
15512
|
+
const emitSize = (type) => {
|
|
15513
|
+
emit(type, panelSizes.value.map((x) => parseFloat(x.toFixed(3))));
|
|
15514
|
+
};
|
|
15515
|
+
const onMouseMove = (e) => {
|
|
15516
|
+
if (!isDragging.value || activeResizerIndex.value === null || !containerRef.value) return;
|
|
15517
|
+
const rect = containerRef.value.getBoundingClientRect();
|
|
15518
|
+
const idx = activeResizerIndex.value;
|
|
15519
|
+
const children = slots.default?.() || [];
|
|
15520
|
+
const resizerWidth = 4;
|
|
15521
|
+
const totalResizersWidth = (children.length - 1) * resizerWidth;
|
|
15522
|
+
const totalAvailableSize = (props.direction === "horizontal" ? rect.width : rect.height) - totalResizersWidth;
|
|
15523
|
+
const resizersBefore = idx * resizerWidth;
|
|
15524
|
+
let currentPos = (props.direction === "horizontal" ? e.clientX - rect.left : e.clientY - rect.top) - resizersBefore;
|
|
15525
|
+
currentPos = Math.max(0, Math.min(totalAvailableSize, currentPos));
|
|
15526
|
+
const pairTotal = panelSizes.value[idx] + panelSizes.value[idx + 1];
|
|
15527
|
+
const offset = panelSizes.value.slice(0, idx).reduce((a, b) => a + b, 0);
|
|
15528
|
+
let newSizeIdx = currentPos - offset;
|
|
15529
|
+
newSizeIdx = Math.max(minSizes.value[idx], Math.min(maxSizes.value[idx], newSizeIdx));
|
|
15530
|
+
const maxAllowed = pairTotal - minSizes.value[idx + 1];
|
|
15531
|
+
newSizeIdx = Math.min(newSizeIdx, maxAllowed);
|
|
15532
|
+
panelSizes.value[idx] = newSizeIdx;
|
|
15533
|
+
panelSizes.value[idx + 1] = pairTotal - newSizeIdx;
|
|
15534
|
+
emitSize("resize");
|
|
15535
|
+
};
|
|
15536
|
+
const onMouseUp = () => {
|
|
15537
|
+
isDragging.value = false;
|
|
15538
|
+
activeResizerIndex.value = null;
|
|
15539
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
15540
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
15541
|
+
document.body.style.cursor = "";
|
|
15542
|
+
document.body.classList.remove("k-splitter-dragging");
|
|
15543
|
+
emitSize("resizeEnd");
|
|
15544
|
+
};
|
|
15545
|
+
let ob = null;
|
|
15546
|
+
onMounted(() => {
|
|
15547
|
+
initSizes();
|
|
15548
|
+
ob = new ResizeObserver(() => initSizes());
|
|
15549
|
+
if (containerRef.value) ob.observe(containerRef.value);
|
|
15550
|
+
});
|
|
15551
|
+
onUnmounted(() => ob?.disconnect());
|
|
15552
|
+
return () => {
|
|
15553
|
+
const children = slots.default?.() || [];
|
|
15554
|
+
return createVNode("div", {
|
|
15555
|
+
"ref": containerRef,
|
|
15556
|
+
"class": ["k-splitter", `is-${props.direction}`]
|
|
15557
|
+
}, [children.map((child, index) => {
|
|
15558
|
+
const isLast = index === children.length - 1;
|
|
15559
|
+
return createVNode(Fragment, null, [createVNode("div", {
|
|
15560
|
+
"class": "k-splitter-item",
|
|
15561
|
+
"style": {
|
|
15562
|
+
flexBasis: `${panelSizes.value[index]}px`,
|
|
15563
|
+
flexGrow: 0,
|
|
15564
|
+
flexShrink: 0
|
|
15565
|
+
}
|
|
15566
|
+
}, [child]), !isLast && createVNode("div", {
|
|
15567
|
+
"class": "k-splitter-resizer",
|
|
15568
|
+
"onMousedown": () => onMouseDown(index)
|
|
15569
|
+
}, null)]);
|
|
15570
|
+
})]);
|
|
12652
15571
|
};
|
|
12653
15572
|
}
|
|
12654
15573
|
});
|
|
12655
|
-
var
|
|
12656
|
-
name: "
|
|
15574
|
+
var SplitterPanel = /* @__PURE__ */ defineComponent({
|
|
15575
|
+
name: "SplitterPanel",
|
|
12657
15576
|
props: {
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
},
|
|
12662
|
-
valueType: {
|
|
12663
|
-
type: String,
|
|
12664
|
-
default: "boolean"
|
|
12665
|
-
},
|
|
12666
|
-
modelValue: { type: [
|
|
12667
|
-
String,
|
|
12668
|
-
Number,
|
|
12669
|
-
Boolean
|
|
12670
|
-
] },
|
|
12671
|
-
type: String,
|
|
12672
|
-
disabled: Boolean,
|
|
12673
|
-
loading: Boolean,
|
|
12674
|
-
size: { type: String },
|
|
12675
|
-
trueText: String,
|
|
12676
|
-
falseText: String,
|
|
12677
|
-
onChange: Function
|
|
15577
|
+
size: { type: [Number, String] },
|
|
15578
|
+
min: { type: [Number, String] },
|
|
15579
|
+
max: { type: [Number, String] }
|
|
12678
15580
|
},
|
|
12679
|
-
setup(
|
|
12680
|
-
|
|
12681
|
-
watch(() => props.modelValue, (nv) => {
|
|
12682
|
-
isChecked.value = nv == 1;
|
|
12683
|
-
});
|
|
12684
|
-
watch(() => props.checked, (nv) => {
|
|
12685
|
-
isChecked.value = nv;
|
|
12686
|
-
});
|
|
12687
|
-
const change = () => {
|
|
12688
|
-
if (props.disabled) return false;
|
|
12689
|
-
const checked = !isChecked.value;
|
|
12690
|
-
isChecked.value = checked;
|
|
12691
|
-
const value = getValueWithType(checked, props.valueType);
|
|
12692
|
-
emit("update:modelValue", value);
|
|
12693
|
-
emit("update:checked", checked);
|
|
12694
|
-
emit("change", value);
|
|
12695
|
-
};
|
|
12696
|
-
return () => {
|
|
12697
|
-
const { type, trueText, falseText, disabled, loading, size } = props;
|
|
12698
|
-
const classes = ["k-switch", {
|
|
12699
|
-
["k-switch-checked"]: isChecked.value,
|
|
12700
|
-
["k-switch-disabled"]: disabled || loading,
|
|
12701
|
-
[`k-switch-${type}`]: !!type,
|
|
12702
|
-
["k-switch-sm"]: props.size == "small"
|
|
12703
|
-
}];
|
|
12704
|
-
const children = slots.checked?.() || trueText || slots.unchecked?.() || falseText;
|
|
12705
|
-
const loadNode = loading ? createVNode(Icon, {
|
|
12706
|
-
"spin": true,
|
|
12707
|
-
"type": Loading,
|
|
12708
|
-
"class": "k-switch-loading"
|
|
12709
|
-
}, null) : null;
|
|
12710
|
-
const textNode = size != "small" && children ? createVNode("span", { "class": "k-switch-inner" }, [isChecked.value ? slots.checked?.() || trueText : slots.unchecked?.() || falseText]) : null;
|
|
12711
|
-
return createVNode("button", {
|
|
12712
|
-
"class": classes,
|
|
12713
|
-
"onClick": change,
|
|
12714
|
-
"disabled": disabled || loading,
|
|
12715
|
-
"type": "button"
|
|
12716
|
-
}, [textNode, loadNode]);
|
|
12717
|
-
};
|
|
15581
|
+
setup(_, { slots }) {
|
|
15582
|
+
return () => createVNode("div", { "class": "k-splitter-panel" }, [slots.default?.()]);
|
|
12718
15583
|
}
|
|
12719
15584
|
});
|
|
15585
|
+
//#endregion
|
|
15586
|
+
//#region components/table/index.tsx
|
|
12720
15587
|
var Table = /* @__PURE__ */ defineComponent({
|
|
12721
15588
|
name: "Table",
|
|
12722
15589
|
props: {
|
|
@@ -13123,6 +15990,8 @@ var Table = /* @__PURE__ */ defineComponent({
|
|
|
13123
15990
|
};
|
|
13124
15991
|
}
|
|
13125
15992
|
});
|
|
15993
|
+
//#endregion
|
|
15994
|
+
//#region components/tabs/tab-panel.tsx
|
|
13126
15995
|
var TabPanel = /* @__PURE__ */ defineComponent({
|
|
13127
15996
|
name: "TabPanel",
|
|
13128
15997
|
props: {
|
|
@@ -13142,6 +16011,8 @@ var TabPanel = /* @__PURE__ */ defineComponent({
|
|
|
13142
16011
|
};
|
|
13143
16012
|
}
|
|
13144
16013
|
});
|
|
16014
|
+
//#endregion
|
|
16015
|
+
//#region components/tabs/tabs.tsx
|
|
13145
16016
|
var Tabs = /* @__PURE__ */ defineComponent({
|
|
13146
16017
|
name: "Tabs",
|
|
13147
16018
|
props: {
|
|
@@ -13247,7 +16118,8 @@ var Tabs = /* @__PURE__ */ defineComponent({
|
|
|
13247
16118
|
};
|
|
13248
16119
|
const updateIndex = () => {
|
|
13249
16120
|
nextTick(() => {
|
|
13250
|
-
|
|
16121
|
+
const nodes = getChildren(slots.default?.());
|
|
16122
|
+
currentIndex.value = nodes?.map((p) => p.key).indexOf(defaultActiveKey.value);
|
|
13251
16123
|
resetActivePosition();
|
|
13252
16124
|
updateInkBarPosition();
|
|
13253
16125
|
});
|
|
@@ -13338,6 +16210,8 @@ var Tabs = /* @__PURE__ */ defineComponent({
|
|
|
13338
16210
|
};
|
|
13339
16211
|
}
|
|
13340
16212
|
});
|
|
16213
|
+
//#endregion
|
|
16214
|
+
//#region components/time-line/timeline.tsx
|
|
13341
16215
|
var TimeLine = /* @__PURE__ */ defineComponent({
|
|
13342
16216
|
name: "TimeLine",
|
|
13343
16217
|
props: { mode: {
|
|
@@ -13358,6 +16232,8 @@ var TimeLine = /* @__PURE__ */ defineComponent({
|
|
|
13358
16232
|
};
|
|
13359
16233
|
}
|
|
13360
16234
|
});
|
|
16235
|
+
//#endregion
|
|
16236
|
+
//#region components/time-line/timeline-item.tsx
|
|
13361
16237
|
var TimeLineItem = /* @__PURE__ */ defineComponent({
|
|
13362
16238
|
name: "TimeLineItem",
|
|
13363
16239
|
props: {
|
|
@@ -13925,6 +16801,8 @@ var Tree = /* @__PURE__ */ defineComponent({
|
|
|
13925
16801
|
};
|
|
13926
16802
|
}
|
|
13927
16803
|
});
|
|
16804
|
+
//#endregion
|
|
16805
|
+
//#region components/tree-select/index.tsx
|
|
13928
16806
|
var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
13929
16807
|
name: "TreeSelect",
|
|
13930
16808
|
directives: {
|
|
@@ -14137,13 +17015,17 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
14137
17015
|
document.addEventListener("click", outsideClick);
|
|
14138
17016
|
nextTick(() => {
|
|
14139
17017
|
openChange(true);
|
|
14140
|
-
|
|
14141
|
-
|
|
17018
|
+
nextTick(() => {
|
|
17019
|
+
updatePosition();
|
|
17020
|
+
showQuery();
|
|
17021
|
+
});
|
|
14142
17022
|
});
|
|
14143
17023
|
} else {
|
|
14144
17024
|
openChange(show || !visible.value);
|
|
14145
17025
|
if (visible.value) {
|
|
14146
|
-
|
|
17026
|
+
nextTick(() => {
|
|
17027
|
+
updatePosition();
|
|
17028
|
+
});
|
|
14147
17029
|
showQuery();
|
|
14148
17030
|
} else clearQuery();
|
|
14149
17031
|
}
|
|
@@ -14365,6 +17247,8 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
14365
17247
|
};
|
|
14366
17248
|
}
|
|
14367
17249
|
});
|
|
17250
|
+
//#endregion
|
|
17251
|
+
//#region components/tag/index.tsx
|
|
14368
17252
|
var Tag = /* @__PURE__ */ defineComponent({
|
|
14369
17253
|
name: "Tag",
|
|
14370
17254
|
props: {
|
|
@@ -14430,20 +17314,20 @@ var Tag = /* @__PURE__ */ defineComponent({
|
|
|
14430
17314
|
}
|
|
14431
17315
|
});
|
|
14432
17316
|
//#endregion
|
|
14433
|
-
//#region node_modules/.pnpm/uuid@14.0.
|
|
17317
|
+
//#region node_modules/.pnpm/uuid@14.0.1/node_modules/uuid/dist/stringify.js
|
|
14434
17318
|
var byteToHex = [];
|
|
14435
17319
|
for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
|
|
14436
17320
|
function unsafeStringify(arr, offset = 0) {
|
|
14437
17321
|
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
14438
17322
|
}
|
|
14439
17323
|
//#endregion
|
|
14440
|
-
//#region node_modules/.pnpm/uuid@14.0.
|
|
14441
|
-
var rnds8 = new Uint8Array(16);
|
|
17324
|
+
//#region node_modules/.pnpm/uuid@14.0.1/node_modules/uuid/dist/rng.js
|
|
17325
|
+
var rnds8 = /* @__PURE__ */ new Uint8Array(16);
|
|
14442
17326
|
function rng() {
|
|
14443
17327
|
return crypto.getRandomValues(rnds8);
|
|
14444
17328
|
}
|
|
14445
17329
|
//#endregion
|
|
14446
|
-
//#region node_modules/.pnpm/uuid@14.0.
|
|
17330
|
+
//#region node_modules/.pnpm/uuid@14.0.1/node_modules/uuid/dist/v4.js
|
|
14447
17331
|
function v4(options, buf, offset) {
|
|
14448
17332
|
if (!buf && !options && crypto.randomUUID) return crypto.randomUUID();
|
|
14449
17333
|
return _v4(options, buf, offset);
|
|
@@ -14628,6 +17512,8 @@ var selector_default = /* @__PURE__ */ defineComponent({
|
|
|
14628
17512
|
};
|
|
14629
17513
|
}
|
|
14630
17514
|
});
|
|
17515
|
+
//#endregion
|
|
17516
|
+
//#region components/upload/index.tsx
|
|
14631
17517
|
var Upload = /* @__PURE__ */ defineComponent({
|
|
14632
17518
|
name: "Upload",
|
|
14633
17519
|
props: {
|
|
@@ -14855,128 +17741,253 @@ var Upload = /* @__PURE__ */ defineComponent({
|
|
|
14855
17741
|
};
|
|
14856
17742
|
}
|
|
14857
17743
|
});
|
|
14858
|
-
|
|
14859
|
-
|
|
17744
|
+
//#endregion
|
|
17745
|
+
//#region components/watermark/index.tsx
|
|
17746
|
+
var Watermark = /* @__PURE__ */ defineComponent({
|
|
17747
|
+
name: "Watermark",
|
|
14860
17748
|
props: {
|
|
14861
|
-
|
|
17749
|
+
content: {
|
|
17750
|
+
type: [String, Array],
|
|
17751
|
+
default: ""
|
|
17752
|
+
},
|
|
17753
|
+
image: {
|
|
14862
17754
|
type: String,
|
|
14863
|
-
default: "
|
|
17755
|
+
default: ""
|
|
14864
17756
|
},
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
17757
|
+
width: {
|
|
17758
|
+
type: Number,
|
|
17759
|
+
default: 240
|
|
17760
|
+
},
|
|
17761
|
+
height: {
|
|
17762
|
+
type: Number,
|
|
17763
|
+
default: 189
|
|
17764
|
+
},
|
|
17765
|
+
rotate: {
|
|
17766
|
+
type: Number,
|
|
17767
|
+
default: -22
|
|
17768
|
+
},
|
|
17769
|
+
zIndex: {
|
|
17770
|
+
type: Number,
|
|
17771
|
+
default: 999
|
|
17772
|
+
},
|
|
17773
|
+
fullscreen: {
|
|
17774
|
+
type: Boolean,
|
|
17775
|
+
default: false
|
|
17776
|
+
},
|
|
17777
|
+
antiTamper: {
|
|
17778
|
+
type: Boolean,
|
|
17779
|
+
default: true
|
|
17780
|
+
},
|
|
17781
|
+
font: {
|
|
17782
|
+
type: Object,
|
|
17783
|
+
default: () => ({
|
|
17784
|
+
color: "rgba(128, 128, 128, 0.15)",
|
|
17785
|
+
fontSize: 15,
|
|
17786
|
+
fontWeight: "normal",
|
|
17787
|
+
fontFamily: "sans-serif",
|
|
17788
|
+
fontStyle: "normal"
|
|
17789
|
+
})
|
|
17790
|
+
},
|
|
17791
|
+
gap: {
|
|
17792
|
+
type: Array,
|
|
17793
|
+
default: () => [40, 40]
|
|
17794
|
+
},
|
|
17795
|
+
offset: {
|
|
17796
|
+
type: Array,
|
|
17797
|
+
default: () => [20, 20]
|
|
17798
|
+
},
|
|
17799
|
+
layout: {
|
|
17800
|
+
type: String,
|
|
17801
|
+
default: "stagger"
|
|
17802
|
+
}
|
|
14868
17803
|
},
|
|
14869
|
-
setup(props, { slots
|
|
17804
|
+
setup(props, { slots }) {
|
|
14870
17805
|
const containerRef = ref(null);
|
|
14871
|
-
const
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
const
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
17806
|
+
const watermarkRef = ref(null);
|
|
17807
|
+
let parentObserver = null;
|
|
17808
|
+
let selfObserver = null;
|
|
17809
|
+
let base64Url = ref("");
|
|
17810
|
+
const createWatermarkBase64 = () => {
|
|
17811
|
+
return new Promise((resolve) => {
|
|
17812
|
+
const canvas = document.createElement("canvas");
|
|
17813
|
+
const ratio = window.devicePixelRatio || 1;
|
|
17814
|
+
const cellW = props.width + props.gap[0];
|
|
17815
|
+
const cellH = props.height + props.gap[1];
|
|
17816
|
+
const offsetX = props.offset?.[0] ?? 0;
|
|
17817
|
+
const offsetY = props.offset?.[1] ?? 0;
|
|
17818
|
+
const isStagger = props.layout === "stagger";
|
|
17819
|
+
const canvasWidth = isStagger ? cellW * 2 : cellW;
|
|
17820
|
+
const canvasHeight = isStagger ? cellH * 2 : cellH;
|
|
17821
|
+
canvas.width = canvasWidth * ratio;
|
|
17822
|
+
canvas.height = canvasHeight * ratio;
|
|
17823
|
+
const ctx = canvas.getContext("2d");
|
|
17824
|
+
if (!ctx) return resolve("");
|
|
17825
|
+
ctx.scale(ratio, ratio);
|
|
17826
|
+
const drawSingleCell = (ctx, centerX, centerY, imgObj) => {
|
|
17827
|
+
ctx.save();
|
|
17828
|
+
ctx.translate(centerX, centerY);
|
|
17829
|
+
ctx.rotate(props.rotate * Math.PI / 180);
|
|
17830
|
+
if (imgObj) ctx.drawImage(imgObj, -props.width / 2, -props.height / 2, props.width, props.height);
|
|
17831
|
+
else drawTextWatermark(ctx);
|
|
17832
|
+
ctx.restore();
|
|
17833
|
+
};
|
|
17834
|
+
const renderAllCells = (imgObj) => {
|
|
17835
|
+
if (isStagger) {
|
|
17836
|
+
drawSingleCell(ctx, cellW / 2 + offsetX, cellH / 2 + offsetY, imgObj);
|
|
17837
|
+
drawSingleCell(ctx, cellW + cellW / 2 + offsetX, cellH / 2 + offsetY, imgObj);
|
|
17838
|
+
drawSingleCell(ctx, 0 + offsetX, cellH + cellH / 2 + offsetY, imgObj);
|
|
17839
|
+
drawSingleCell(ctx, cellW + offsetX, cellH + cellH / 2 + offsetY, imgObj);
|
|
17840
|
+
drawSingleCell(ctx, cellW * 2 + offsetX, cellH + cellH / 2 + offsetY, imgObj);
|
|
17841
|
+
} else drawSingleCell(ctx, cellW / 2 + offsetX, cellH / 2 + offsetY, imgObj);
|
|
17842
|
+
resolve(canvas.toDataURL());
|
|
17843
|
+
};
|
|
17844
|
+
if (props.image) {
|
|
17845
|
+
const img = new Image();
|
|
17846
|
+
img.crossOrigin = "anonymous";
|
|
17847
|
+
img.src = props.image;
|
|
17848
|
+
img.onload = () => {
|
|
17849
|
+
renderAllCells(img);
|
|
17850
|
+
};
|
|
17851
|
+
img.onerror = () => {
|
|
17852
|
+
renderAllCells();
|
|
17853
|
+
};
|
|
17854
|
+
} else renderAllCells();
|
|
17855
|
+
});
|
|
14897
17856
|
};
|
|
14898
|
-
const
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
17857
|
+
const drawTextWatermark = (ctx) => {
|
|
17858
|
+
const globalFont = {
|
|
17859
|
+
color: "rgba(128, 128, 128, 0.15)",
|
|
17860
|
+
fontSize: 15,
|
|
17861
|
+
fontWeight: "normal",
|
|
17862
|
+
fontStyle: "normal",
|
|
17863
|
+
fontFamily: "sans-serif",
|
|
17864
|
+
...props.font
|
|
17865
|
+
};
|
|
17866
|
+
const contents = (Array.isArray(props.content) ? props.content : [props.content || ""]).map((item) => {
|
|
17867
|
+
if (typeof item === "string") return { text: item };
|
|
17868
|
+
return item;
|
|
17869
|
+
});
|
|
17870
|
+
ctx.textAlign = "center";
|
|
17871
|
+
ctx.textBaseline = "middle";
|
|
17872
|
+
let totalHeight = 0;
|
|
17873
|
+
const lineHeights = contents.map((item) => {
|
|
17874
|
+
return (item.fontSize || globalFont.fontSize) + 8;
|
|
17875
|
+
});
|
|
17876
|
+
totalHeight = lineHeights.reduce((a, b) => a + b, 0);
|
|
17877
|
+
let currentY = -totalHeight / 2;
|
|
17878
|
+
contents.forEach((item, index) => {
|
|
17879
|
+
const fSize = item.fontSize || globalFont.fontSize;
|
|
17880
|
+
const fWeight = item.fontWeight || globalFont.fontWeight;
|
|
17881
|
+
const fStyle = item.fontStyle || globalFont.fontStyle;
|
|
17882
|
+
const fColor = item.color || globalFont.color;
|
|
17883
|
+
ctx.font = `${fStyle} ${fWeight} ${fSize}px ${globalFont.fontFamily}`;
|
|
17884
|
+
ctx.fillStyle = fColor;
|
|
17885
|
+
const yOffset = currentY + lineHeights[index] / 2;
|
|
17886
|
+
ctx.fillText(item.text, 0, yOffset);
|
|
17887
|
+
currentY += lineHeights[index];
|
|
17888
|
+
});
|
|
14906
17889
|
};
|
|
14907
|
-
const
|
|
14908
|
-
|
|
17890
|
+
const renderWatermark = async () => {
|
|
17891
|
+
base64Url.value = await createWatermarkBase64();
|
|
17892
|
+
const targetContainer = props.fullscreen ? document.body : containerRef.value;
|
|
17893
|
+
if (!targetContainer) return;
|
|
17894
|
+
disconnectObservers();
|
|
17895
|
+
if (watermarkRef.value && watermarkRef.value.parentNode) watermarkRef.value.parentNode.removeChild(watermarkRef.value);
|
|
17896
|
+
const wmWrapper = document.createElement("div");
|
|
17897
|
+
const wmStyle = {
|
|
17898
|
+
position: props.fullscreen ? "fixed" : "absolute",
|
|
17899
|
+
left: "0",
|
|
17900
|
+
top: "0",
|
|
17901
|
+
width: "100%",
|
|
17902
|
+
height: "100%",
|
|
17903
|
+
pointerEvents: "none",
|
|
17904
|
+
zIndex: props.zIndex.toString(),
|
|
17905
|
+
margin: "0",
|
|
17906
|
+
padding: "0"
|
|
17907
|
+
};
|
|
17908
|
+
Object.assign(wmWrapper.style, wmStyle);
|
|
17909
|
+
wmWrapper.setAttribute("data-wm-root", "true");
|
|
17910
|
+
const shadowRoot = wmWrapper.attachShadow({ mode: "closed" });
|
|
17911
|
+
const wmInner = document.createElement("div");
|
|
17912
|
+
const cellW = props.width + props.gap[0];
|
|
17913
|
+
const cellH = props.height + props.gap[1];
|
|
17914
|
+
const isStagger = props.layout === "stagger";
|
|
17915
|
+
const innerStyle = {
|
|
17916
|
+
width: "100%",
|
|
17917
|
+
height: "100%",
|
|
17918
|
+
backgroundSize: `${isStagger ? cellW * 2 : cellW}px ${isStagger ? cellH * 2 : cellH}px`,
|
|
17919
|
+
backgroundImage: `url(${base64Url.value})`,
|
|
17920
|
+
backgroundRepeat: "repeat",
|
|
17921
|
+
pointerEvents: "none"
|
|
17922
|
+
};
|
|
17923
|
+
Object.assign(wmInner.style, innerStyle);
|
|
17924
|
+
shadowRoot.appendChild(wmInner);
|
|
17925
|
+
targetContainer.appendChild(wmWrapper);
|
|
17926
|
+
watermarkRef.value = wmWrapper;
|
|
17927
|
+
if (props.antiTamper) nextTick(() => {
|
|
17928
|
+
initAntiTamper(targetContainer, wmWrapper);
|
|
17929
|
+
});
|
|
14909
17930
|
};
|
|
14910
|
-
const
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
17931
|
+
const initAntiTamper = (parent, self) => {
|
|
17932
|
+
parentObserver = new MutationObserver((mutations) => {
|
|
17933
|
+
for (const mutation of mutations) if (Array.from(mutation.removedNodes).includes(self)) {
|
|
17934
|
+
renderWatermark();
|
|
17935
|
+
break;
|
|
17936
|
+
}
|
|
17937
|
+
});
|
|
17938
|
+
parentObserver.observe(parent, { childList: true });
|
|
17939
|
+
selfObserver = new MutationObserver((mutations) => {
|
|
17940
|
+
for (const mutation of mutations) if (mutation.type === "attributes") {
|
|
17941
|
+
renderWatermark();
|
|
17942
|
+
break;
|
|
17943
|
+
}
|
|
17944
|
+
});
|
|
17945
|
+
selfObserver.observe(self, {
|
|
17946
|
+
attributes: true,
|
|
17947
|
+
attributeFilter: [
|
|
17948
|
+
"style",
|
|
17949
|
+
"class",
|
|
17950
|
+
"id",
|
|
17951
|
+
"hidden"
|
|
17952
|
+
]
|
|
17953
|
+
});
|
|
14930
17954
|
};
|
|
14931
|
-
const
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
14935
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
14936
|
-
document.body.style.cursor = "";
|
|
14937
|
-
document.body.classList.remove("k-splitter-dragging");
|
|
14938
|
-
emitSize("resizeEnd");
|
|
17955
|
+
const disconnectObservers = () => {
|
|
17956
|
+
if (parentObserver) parentObserver.disconnect();
|
|
17957
|
+
if (selfObserver) selfObserver.disconnect();
|
|
14939
17958
|
};
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
17959
|
+
watch(() => [
|
|
17960
|
+
props.content,
|
|
17961
|
+
props.image,
|
|
17962
|
+
props.width,
|
|
17963
|
+
props.height,
|
|
17964
|
+
props.rotate,
|
|
17965
|
+
props.gap,
|
|
17966
|
+
props.offset,
|
|
17967
|
+
props.font,
|
|
17968
|
+
props.layout
|
|
17969
|
+
], () => {
|
|
17970
|
+
renderWatermark();
|
|
17971
|
+
}, { deep: true });
|
|
17972
|
+
onMounted(() => renderWatermark());
|
|
17973
|
+
onBeforeUnmount(() => {
|
|
17974
|
+
disconnectObservers();
|
|
17975
|
+
if (watermarkRef.value && watermarkRef.value.parentNode) watermarkRef.value.parentNode.removeChild(watermarkRef.value);
|
|
14945
17976
|
});
|
|
14946
|
-
onUnmounted(() => ob?.disconnect());
|
|
14947
17977
|
return () => {
|
|
14948
|
-
|
|
17978
|
+
if (props.fullscreen) return slots.default ? slots.default() : null;
|
|
14949
17979
|
return createVNode("div", {
|
|
14950
17980
|
"ref": containerRef,
|
|
14951
|
-
"
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
flexGrow: 0,
|
|
14959
|
-
flexShrink: 0
|
|
14960
|
-
}
|
|
14961
|
-
}, [child]), !isLast && createVNode("div", {
|
|
14962
|
-
"class": "k-splitter-resizer",
|
|
14963
|
-
"onMousedown": () => onMouseDown(index)
|
|
14964
|
-
}, null)]);
|
|
14965
|
-
})]);
|
|
17981
|
+
"style": {
|
|
17982
|
+
position: "relative",
|
|
17983
|
+
width: "100%",
|
|
17984
|
+
height: "100%"
|
|
17985
|
+
},
|
|
17986
|
+
"class": "k-watermark-container"
|
|
17987
|
+
}, [slots.default?.()]);
|
|
14966
17988
|
};
|
|
14967
17989
|
}
|
|
14968
17990
|
});
|
|
14969
|
-
var SplitterPanel = /* @__PURE__ */ defineComponent({
|
|
14970
|
-
name: "SplitterPanel",
|
|
14971
|
-
props: {
|
|
14972
|
-
size: { type: [Number, String] },
|
|
14973
|
-
min: { type: [Number, String] },
|
|
14974
|
-
max: { type: [Number, String] }
|
|
14975
|
-
},
|
|
14976
|
-
setup(_, { slots }) {
|
|
14977
|
-
return () => createVNode("div", { "class": "k-splitter-panel" }, [slots.default?.()]);
|
|
14978
|
-
}
|
|
14979
|
-
});
|
|
14980
17991
|
//#endregion
|
|
14981
17992
|
//#region components/utils/theme.ts
|
|
14982
17993
|
var THEME_KEY = "theme-mode";
|
|
@@ -15080,6 +18091,7 @@ var components_exports = /* @__PURE__ */ __exportAll({
|
|
|
15080
18091
|
Popconfirm: () => Popconfirm,
|
|
15081
18092
|
Poptip: () => Poptip,
|
|
15082
18093
|
Progress: () => Progress,
|
|
18094
|
+
QRCode: () => QRCode,
|
|
15083
18095
|
Radio: () => Radio,
|
|
15084
18096
|
RadioButton: () => RadioButton,
|
|
15085
18097
|
RadioGroup: () => RadioGroup,
|
|
@@ -15111,6 +18123,7 @@ var components_exports = /* @__PURE__ */ __exportAll({
|
|
|
15111
18123
|
Tree: () => Tree,
|
|
15112
18124
|
TreeSelect: () => TreeSelect,
|
|
15113
18125
|
Upload: () => Upload,
|
|
18126
|
+
Watermark: () => Watermark,
|
|
15114
18127
|
loading: () => loading,
|
|
15115
18128
|
message: () => message,
|
|
15116
18129
|
modal: () => modal,
|
|
@@ -15149,4 +18162,4 @@ var UI = {
|
|
|
15149
18162
|
var install = UI.install;
|
|
15150
18163
|
var version = UI.version;
|
|
15151
18164
|
//#endregion
|
|
15152
|
-
export { Affix, Alert, Anchor, AnchorLink, Avatar, AvatarGroup, BackTop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonGroup, Card, Carousel, CarouselItem, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, ConfigProvider, Content, DatePicker, Descriptions, DescriptionsItem, Divider, Drawer, Dropdown, DropdownButton, Empty, Flex, Footer, Form, FormItem, Grid, GridItem, Header, Icon, ImageGroup, Input, InputGroup, InputNumber, KImage, Switch as KSwitch, Layout, Menu, MenuDivider, MenuGroup, MenuItem, modal_default as Modal, Option, Page, Popconfirm, Poptip, Progress, Radio, RadioButton, RadioGroup, Rate, Row, Select, Sider, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonText, Slider, Space, Spin, Splitter, SplitterPanel, StatCard, StatNumber, SubMenu, TabPanel, Table, Tabs, Tag, TextArea, TimeLine, TimeLineItem, Tooltip, Tree, TreeSelect, Upload, UI as default, install, loading, message, modal, notice, Theme as theme, version };
|
|
18165
|
+
export { Affix, Alert, Anchor, AnchorLink, Avatar, AvatarGroup, BackTop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonGroup, Card, Carousel, CarouselItem, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, ConfigProvider, Content, DatePicker, Descriptions, DescriptionsItem, Divider, Drawer, Dropdown, DropdownButton, Empty, Flex, Footer, Form, FormItem, Grid, GridItem, Header, Icon, ImageGroup, Input, InputGroup, InputNumber, KImage, Switch as KSwitch, Layout, Menu, MenuDivider, MenuGroup, MenuItem, modal_default as Modal, Option, Page, Popconfirm, Poptip, Progress, QRCode, Radio, RadioButton, RadioGroup, Rate, Row, Select, Sider, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonText, Slider, Space, Spin, Splitter, SplitterPanel, StatCard, StatNumber, SubMenu, TabPanel, Table, Tabs, Tag, TextArea, TimeLine, TimeLineItem, Tooltip, Tree, TreeSelect, Upload, Watermark, UI as default, install, loading, message, modal, notice, Theme as theme, version };
|