@falcon-ui/falcon-ui 1.0.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/LICENSE +21 -0
- package/README.md +182 -0
- package/cjs/JsBarcode-BlUjuVmB.cjs +3519 -0
- package/cjs/JsBarcode-BlUjuVmB.cjs.map +1 -0
- package/cjs/chunk-D4y6LrGi.cjs +40 -0
- package/cjs/components/JsBarcode-BOXEZn4Q.cjs +3519 -0
- package/cjs/components/JsBarcode-BOXEZn4Q.cjs.map +1 -0
- package/cjs/components/barcode/JsBarcode-BOXEZn4Q.cjs +3519 -0
- package/cjs/components/barcode/JsBarcode-BOXEZn4Q.cjs.map +1 -0
- package/cjs/components/barcode/chunk-D4y6LrGi.cjs +40 -0
- package/cjs/components/barcode/index.cjs +211 -0
- package/cjs/components/barcode/index.cjs.map +1 -0
- package/cjs/components/barcode/src/JsBarcode-BOXEZn4Q.cjs +3519 -0
- package/cjs/components/barcode/src/JsBarcode-BOXEZn4Q.cjs.map +1 -0
- package/cjs/components/barcode/src/barcode.cjs +102 -0
- package/cjs/components/barcode/src/barcode.cjs.map +1 -0
- package/cjs/components/barcode/src/barcode.vue.cjs +200 -0
- package/cjs/components/barcode/src/barcode.vue.cjs.map +1 -0
- package/cjs/components/barcode/src/chunk-D4y6LrGi.cjs +40 -0
- package/cjs/components/button/index.cjs +135 -0
- package/cjs/components/button/index.cjs.map +1 -0
- package/cjs/components/button/src/button.cjs +16 -0
- package/cjs/components/button/src/button.cjs.map +1 -0
- package/cjs/components/button/src/button.vue.cjs +124 -0
- package/cjs/components/button/src/button.vue.cjs.map +1 -0
- package/cjs/components/chunk-D4y6LrGi.cjs +40 -0
- package/cjs/components/date-picker/index.cjs +164 -0
- package/cjs/components/date-picker/index.cjs.map +1 -0
- package/cjs/components/date-picker/src/date-picker.cjs +25 -0
- package/cjs/components/date-picker/src/date-picker.cjs.map +1 -0
- package/cjs/components/date-picker/src/date-picker.vue.cjs +153 -0
- package/cjs/components/date-picker/src/date-picker.vue.cjs.map +1 -0
- package/cjs/components/dialog/index.cjs +346 -0
- package/cjs/components/dialog/index.cjs.map +1 -0
- package/cjs/components/dialog/src/dialog.cjs +40 -0
- package/cjs/components/dialog/src/dialog.cjs.map +1 -0
- package/cjs/components/dialog/src/dialog.vue.cjs +343 -0
- package/cjs/components/dialog/src/dialog.vue.cjs.map +1 -0
- package/cjs/components/index.cjs +9450 -0
- package/cjs/components/index.cjs.map +1 -0
- package/cjs/components/input/index.cjs +175 -0
- package/cjs/components/input/index.cjs.map +1 -0
- package/cjs/components/input/src/input.cjs +27 -0
- package/cjs/components/input/src/input.cjs.map +1 -0
- package/cjs/components/input/src/input.vue.cjs +164 -0
- package/cjs/components/input/src/input.vue.cjs.map +1 -0
- package/cjs/components/input-number/index.cjs +374 -0
- package/cjs/components/input-number/index.cjs.map +1 -0
- package/cjs/components/input-number/src/input-number.cjs +48 -0
- package/cjs/components/input-number/src/input-number.cjs.map +1 -0
- package/cjs/components/input-number/src/input-number.vue.cjs +363 -0
- package/cjs/components/input-number/src/input-number.vue.cjs.map +1 -0
- package/cjs/components/input-search/index.cjs +286 -0
- package/cjs/components/input-search/index.cjs.map +1 -0
- package/cjs/components/input-search/src/input-search.cjs +55 -0
- package/cjs/components/input-search/src/input-search.cjs.map +1 -0
- package/cjs/components/input-search/src/input-search.vue.cjs +275 -0
- package/cjs/components/input-search/src/input-search.vue.cjs.map +1 -0
- package/cjs/components/qr-code/index.cjs +1975 -0
- package/cjs/components/qr-code/index.cjs.map +1 -0
- package/cjs/components/qr-code/src/qr-code.cjs +63 -0
- package/cjs/components/qr-code/src/qr-code.cjs.map +1 -0
- package/cjs/components/qr-code/src/qr-code.vue.cjs +1964 -0
- package/cjs/components/qr-code/src/qr-code.vue.cjs.map +1 -0
- package/cjs/components/radial-menu/index.cjs +983 -0
- package/cjs/components/radial-menu/index.cjs.map +1 -0
- package/cjs/components/radial-menu/src/radial-menu.cjs +96 -0
- package/cjs/components/radial-menu/src/radial-menu.cjs.map +1 -0
- package/cjs/components/radial-menu/src/radial-menu.vue.cjs +921 -0
- package/cjs/components/radial-menu/src/radial-menu.vue.cjs.map +1 -0
- package/cjs/components/select/index.cjs +163 -0
- package/cjs/components/select/index.cjs.map +1 -0
- package/cjs/components/select/src/select.cjs +16 -0
- package/cjs/components/select/src/select.cjs.map +1 -0
- package/cjs/components/select/src/select.vue.cjs +152 -0
- package/cjs/components/select/src/select.vue.cjs.map +1 -0
- package/cjs/components/table/index.cjs +3351 -0
- package/cjs/components/table/index.cjs.map +1 -0
- package/cjs/components/table/src/table.cjs +62 -0
- package/cjs/components/table/src/table.cjs.map +1 -0
- package/cjs/components/table/src/table.vue.cjs +3085 -0
- package/cjs/components/table/src/table.vue.cjs.map +1 -0
- package/cjs/dialog-CJU00aEV.cjs +614 -0
- package/cjs/dialog-CJU00aEV.cjs.map +1 -0
- package/cjs/dialog-DcH26KbE.cjs +2 -0
- package/cjs/hooks/dialog-DpYPBcKV.cjs +266 -0
- package/cjs/hooks/dialog-DpYPBcKV.cjs.map +1 -0
- package/cjs/hooks/hooks-D2Jaq5kO.cjs +328 -0
- package/cjs/hooks/hooks-D2Jaq5kO.cjs.map +1 -0
- package/cjs/hooks/index.cjs +8 -0
- package/cjs/icons/index.cjs +86 -0
- package/cjs/icons/index.cjs.map +1 -0
- package/cjs/index.cjs +9141 -0
- package/cjs/index.cjs.map +1 -0
- package/cjs/utils/index.cjs +69 -0
- package/cjs/utils/index.cjs.map +1 -0
- package/esm/JsBarcode-kVJER62m.js +3514 -0
- package/esm/JsBarcode-kVJER62m.js.map +1 -0
- package/esm/chunk-BuRq7rDw.js +23 -0
- package/esm/components/JsBarcode-CzzxrEd_.js +3514 -0
- package/esm/components/JsBarcode-CzzxrEd_.js.map +1 -0
- package/esm/components/barcode/JsBarcode-C5ux6wsb.js +3514 -0
- package/esm/components/barcode/JsBarcode-C5ux6wsb.js.map +1 -0
- package/esm/components/barcode/chunk--em_ddB3.js +23 -0
- package/esm/components/barcode/index.mjs +204 -0
- package/esm/components/barcode/index.mjs.map +1 -0
- package/esm/components/barcode/src/JsBarcode-C5ux6wsb.js +3514 -0
- package/esm/components/barcode/src/JsBarcode-C5ux6wsb.js.map +1 -0
- package/esm/components/barcode/src/barcode.mjs +98 -0
- package/esm/components/barcode/src/barcode.mjs.map +1 -0
- package/esm/components/barcode/src/barcode.vue.mjs +194 -0
- package/esm/components/barcode/src/barcode.vue.mjs.map +1 -0
- package/esm/components/barcode/src/chunk--em_ddB3.js +23 -0
- package/esm/components/button/index.mjs +126 -0
- package/esm/components/button/index.mjs.map +1 -0
- package/esm/components/button/src/button.mjs +14 -0
- package/esm/components/button/src/button.mjs.map +1 -0
- package/esm/components/button/src/button.vue.mjs +117 -0
- package/esm/components/button/src/button.vue.mjs.map +1 -0
- package/esm/components/chunk-BuRq7rDw.js +23 -0
- package/esm/components/date-picker/index.mjs +155 -0
- package/esm/components/date-picker/index.mjs.map +1 -0
- package/esm/components/date-picker/src/date-picker.mjs +23 -0
- package/esm/components/date-picker/src/date-picker.mjs.map +1 -0
- package/esm/components/date-picker/src/date-picker.vue.mjs +146 -0
- package/esm/components/date-picker/src/date-picker.vue.mjs.map +1 -0
- package/esm/components/dialog/index.mjs +335 -0
- package/esm/components/dialog/index.mjs.map +1 -0
- package/esm/components/dialog/src/dialog.mjs +38 -0
- package/esm/components/dialog/src/dialog.mjs.map +1 -0
- package/esm/components/dialog/src/dialog.vue.mjs +334 -0
- package/esm/components/dialog/src/dialog.vue.mjs.map +1 -0
- package/esm/components/index.mjs +9386 -0
- package/esm/components/index.mjs.map +1 -0
- package/esm/components/input/index.mjs +166 -0
- package/esm/components/input/index.mjs.map +1 -0
- package/esm/components/input/src/input.mjs +25 -0
- package/esm/components/input/src/input.mjs.map +1 -0
- package/esm/components/input/src/input.vue.mjs +157 -0
- package/esm/components/input/src/input.vue.mjs.map +1 -0
- package/esm/components/input-number/index.mjs +365 -0
- package/esm/components/input-number/index.mjs.map +1 -0
- package/esm/components/input-number/src/input-number.mjs +45 -0
- package/esm/components/input-number/src/input-number.mjs.map +1 -0
- package/esm/components/input-number/src/input-number.vue.mjs +356 -0
- package/esm/components/input-number/src/input-number.vue.mjs.map +1 -0
- package/esm/components/input-search/index.mjs +277 -0
- package/esm/components/input-search/index.mjs.map +1 -0
- package/esm/components/input-search/src/input-search.mjs +53 -0
- package/esm/components/input-search/src/input-search.mjs.map +1 -0
- package/esm/components/input-search/src/input-search.vue.mjs +268 -0
- package/esm/components/input-search/src/input-search.vue.mjs.map +1 -0
- package/esm/components/qr-code/index.mjs +1967 -0
- package/esm/components/qr-code/index.mjs.map +1 -0
- package/esm/components/qr-code/src/qr-code.mjs +59 -0
- package/esm/components/qr-code/src/qr-code.mjs.map +1 -0
- package/esm/components/qr-code/src/qr-code.vue.mjs +1958 -0
- package/esm/components/qr-code/src/qr-code.vue.mjs.map +1 -0
- package/esm/components/radial-menu/index.mjs +974 -0
- package/esm/components/radial-menu/index.mjs.map +1 -0
- package/esm/components/radial-menu/src/radial-menu.mjs +94 -0
- package/esm/components/radial-menu/src/radial-menu.mjs.map +1 -0
- package/esm/components/radial-menu/src/radial-menu.vue.mjs +916 -0
- package/esm/components/radial-menu/src/radial-menu.vue.mjs.map +1 -0
- package/esm/components/select/index.mjs +154 -0
- package/esm/components/select/index.mjs.map +1 -0
- package/esm/components/select/src/select.mjs +14 -0
- package/esm/components/select/src/select.mjs.map +1 -0
- package/esm/components/select/src/select.vue.mjs +145 -0
- package/esm/components/select/src/select.vue.mjs.map +1 -0
- package/esm/components/table/index.mjs +3342 -0
- package/esm/components/table/index.mjs.map +1 -0
- package/esm/components/table/src/table.mjs +60 -0
- package/esm/components/table/src/table.mjs.map +1 -0
- package/esm/components/table/src/table.vue.mjs +3080 -0
- package/esm/components/table/src/table.vue.mjs.map +1 -0
- package/esm/dialog-Cm3Px-Bu.js +537 -0
- package/esm/dialog-Cm3Px-Bu.js.map +1 -0
- package/esm/dialog-CzZm50XM.js +2 -0
- package/esm/hooks/dialog-d4SMZWbw.js +261 -0
- package/esm/hooks/dialog-d4SMZWbw.js.map +1 -0
- package/esm/hooks/hooks-DdjieG2I.js +281 -0
- package/esm/hooks/hooks-DdjieG2I.js.map +1 -0
- package/esm/hooks/index.mjs +2 -0
- package/esm/icons/index.mjs +79 -0
- package/esm/icons/index.mjs.map +1 -0
- package/esm/index.mjs +9065 -0
- package/esm/index.mjs.map +1 -0
- package/esm/utils/index.mjs +65 -0
- package/esm/utils/index.mjs.map +1 -0
- package/global.d.ts +39 -0
- package/package.json +131 -0
- package/theme/index.css +1 -0
- package/theme/index.scss +16 -0
- package/theme/src/barcode.scss +14 -0
- package/theme/src/button.scss +65 -0
- package/theme/src/date-picker.scss +87 -0
- package/theme/src/dialog.scss +146 -0
- package/theme/src/ep-vars.scss +11 -0
- package/theme/src/input-number.scss +66 -0
- package/theme/src/input-search.scss +78 -0
- package/theme/src/input.scss +66 -0
- package/theme/src/mixins/bem.scss +35 -0
- package/theme/src/mixins/color.scss +8 -0
- package/theme/src/qr-code.scss +23 -0
- package/theme/src/radial-menu.scss +346 -0
- package/theme/src/select.scss +44 -0
- package/theme/src/table.scss +143 -0
- package/theme/src/tokens.scss +26 -0
- package/theme/src/tree-select.scss +45 -0
- package/theme/src/tree.scss +369 -0
- package/types/components/barcode/index.d.ts +183 -0
- package/types/components/barcode/src/barcode.d.ts +147 -0
- package/types/components/barcode/src/barcode.vue.d.ts +184 -0
- package/types/components/button/index.d.ts +135 -0
- package/types/components/button/src/button.d.ts +33 -0
- package/types/components/button/src/button.vue.d.ts +138 -0
- package/types/components/date-picker/index.d.ts +508 -0
- package/types/components/date-picker/src/date-picker.d.ts +35 -0
- package/types/components/date-picker/src/date-picker.vue.d.ts +509 -0
- package/types/components/dialog/index.d.ts +630 -0
- package/types/components/dialog/src/dialog.d.ts +70 -0
- package/types/components/dialog/src/dialog.vue.d.ts +257 -0
- package/types/components/index.d.ts +27 -0
- package/types/components/input/index.d.ts +233 -0
- package/types/components/input/src/input.d.ts +65 -0
- package/types/components/input/src/input.vue.d.ts +239 -0
- package/types/components/input-number/index.d.ts +713 -0
- package/types/components/input-number/src/input-number.d.ts +101 -0
- package/types/components/input-number/src/input-number.vue.d.ts +283 -0
- package/types/components/input-search/index.d.ts +113 -0
- package/types/components/input-search/src/input-search.d.ts +128 -0
- package/types/components/input-search/src/input-search.vue.d.ts +114 -0
- package/types/components/qr-code/index.d.ts +109 -0
- package/types/components/qr-code/src/qr-code.d.ts +93 -0
- package/types/components/qr-code/src/qr-code.vue.d.ts +109 -0
- package/types/components/radial-menu/index.d.ts +499 -0
- package/types/components/radial-menu/src/radial-menu-item.d.ts +40 -0
- package/types/components/radial-menu/src/radial-menu-item.vue.d.ts +95 -0
- package/types/components/radial-menu/src/radial-menu.d.ts +92 -0
- package/types/components/radial-menu/src/radial-menu.vue.d.ts +200 -0
- package/types/components/radial-menu/src/types.d.ts +48 -0
- package/types/components/radial-menu/src/use-radial-menu-items.d.ts +19 -0
- package/types/components/radial-menu/src/use-radial-menu-keyboard.d.ts +17 -0
- package/types/components/radial-menu/src/use-radial-menu-position.d.ts +45 -0
- package/types/components/radial-menu/src/use-radial-menu-shortcut.d.ts +8 -0
- package/types/components/radial-menu/src/use-radial-menu-state.d.ts +15 -0
- package/types/components/select/index.d.ts +5 -0
- package/types/components/select/src/select.d.ts +30 -0
- package/types/components/select/src/select.vue.d.ts +25 -0
- package/types/components/table/index.d.ts +8 -0
- package/types/components/table/src/editor-registry.d.ts +24 -0
- package/types/components/table/src/proxy-data.d.ts +10 -0
- package/types/components/table/src/table-editor.d.ts +18 -0
- package/types/components/table/src/table-editor.vue.d.ts +43 -0
- package/types/components/table/src/table.d.ts +179 -0
- package/types/components/table/src/table.vue.d.ts +121 -0
- package/types/components/tree/index.d.ts +5 -0
- package/types/components/tree/src/tree-node.vue.d.ts +88 -0
- package/types/components/tree/src/tree-types.d.ts +90 -0
- package/types/components/tree/src/tree.d.ts +448 -0
- package/types/components/tree/src/tree.vue.d.ts +301 -0
- package/types/components/tree/src/use-tree-check-conduct.d.ts +43 -0
- package/types/components/tree/src/use-tree-checked-state.d.ts +34 -0
- package/types/components/tree/src/use-tree-drag.d.ts +45 -0
- package/types/components/tree/src/use-tree-expanded-state.d.ts +41 -0
- package/types/components/tree/src/use-tree-keyboard.d.ts +21 -0
- package/types/components/tree/src/use-tree-load.d.ts +25 -0
- package/types/components/tree/src/use-tree-scroll.d.ts +17 -0
- package/types/components/tree/src/use-tree-selected-state.d.ts +29 -0
- package/types/components/tree-select/index.d.ts +5 -0
- package/types/components/tree-select/src/tree-select.d.ts +26 -0
- package/types/components/tree-select/src/tree-select.vue.d.ts +25 -0
- package/types/falcon-ui/index.d.ts +8 -0
- package/types/hooks/index.d.ts +3 -0
- package/types/hooks/src/use-clearable-state.d.ts +10 -0
- package/types/hooks/src/use-component.d.ts +15 -0
- package/types/hooks/src/use-dialog.d.ts +49 -0
- package/types/icons/index.d.ts +1 -0
- package/types/icons/src/components/holder-outlined.vue.d.ts +3 -0
- package/types/icons/src/components/index.d.ts +3 -0
- package/types/icons/src/components/minus-square-outlined.vue.d.ts +3 -0
- package/types/icons/src/components/plus-square-outlined.vue.d.ts +3 -0
- package/types/utils/index.d.ts +3 -0
- package/types/utils/src/bem.d.ts +11 -0
- package/types/utils/src/component.d.ts +6 -0
- package/types/utils/src/install.d.ts +5 -0
- package/umd/falcon-ui.umd.js +13297 -0
- package/umd/falcon-ui.umd.js.map +1 -0
|
@@ -0,0 +1,3514 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "./chunk--em_ddB3.js";
|
|
2
|
+
var require_Barcode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
function _classCallCheck$30(instance, Constructor) {
|
|
5
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
6
|
+
}
|
|
7
|
+
exports.default = function Barcode$1(data, options) {
|
|
8
|
+
_classCallCheck$30(this, Barcode$1);
|
|
9
|
+
this.data = data;
|
|
10
|
+
this.text = options.text || data;
|
|
11
|
+
this.options = options;
|
|
12
|
+
};
|
|
13
|
+
}));
|
|
14
|
+
var require_CODE39 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.CODE39 = void 0;
|
|
17
|
+
var _createClass$23 = function() {
|
|
18
|
+
function defineProperties(target, props) {
|
|
19
|
+
for (var i = 0; i < props.length; i++) {
|
|
20
|
+
var descriptor = props[i];
|
|
21
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
22
|
+
descriptor.configurable = true;
|
|
23
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
24
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return function(Constructor, protoProps, staticProps) {
|
|
28
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
29
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
30
|
+
return Constructor;
|
|
31
|
+
};
|
|
32
|
+
}();
|
|
33
|
+
var _Barcode3$12 = _interopRequireDefault$36(require_Barcode());
|
|
34
|
+
function _interopRequireDefault$36(obj) {
|
|
35
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
36
|
+
}
|
|
37
|
+
function _classCallCheck$29(instance, Constructor) {
|
|
38
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
39
|
+
}
|
|
40
|
+
function _possibleConstructorReturn$25(self, call) {
|
|
41
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
42
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
43
|
+
}
|
|
44
|
+
function _inherits$25(subClass, superClass) {
|
|
45
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
46
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
47
|
+
value: subClass,
|
|
48
|
+
enumerable: false,
|
|
49
|
+
writable: true,
|
|
50
|
+
configurable: true
|
|
51
|
+
} });
|
|
52
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
53
|
+
}
|
|
54
|
+
var CODE39 = function(_Barcode) {
|
|
55
|
+
_inherits$25(CODE39$1, _Barcode);
|
|
56
|
+
function CODE39$1(data, options) {
|
|
57
|
+
_classCallCheck$29(this, CODE39$1);
|
|
58
|
+
data = data.toUpperCase();
|
|
59
|
+
if (options.mod43) data += getCharacter(mod43checksum(data));
|
|
60
|
+
return _possibleConstructorReturn$25(this, (CODE39$1.__proto__ || Object.getPrototypeOf(CODE39$1)).call(this, data, options));
|
|
61
|
+
}
|
|
62
|
+
_createClass$23(CODE39$1, [{
|
|
63
|
+
key: "encode",
|
|
64
|
+
value: function encode$2() {
|
|
65
|
+
var result = getEncoding("*");
|
|
66
|
+
for (var i = 0; i < this.data.length; i++) result += getEncoding(this.data[i]) + "0";
|
|
67
|
+
result += getEncoding("*");
|
|
68
|
+
return {
|
|
69
|
+
data: result,
|
|
70
|
+
text: this.text
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "valid",
|
|
75
|
+
value: function valid() {
|
|
76
|
+
return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1;
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
return CODE39$1;
|
|
80
|
+
}(_Barcode3$12.default);
|
|
81
|
+
var characters = [
|
|
82
|
+
"0",
|
|
83
|
+
"1",
|
|
84
|
+
"2",
|
|
85
|
+
"3",
|
|
86
|
+
"4",
|
|
87
|
+
"5",
|
|
88
|
+
"6",
|
|
89
|
+
"7",
|
|
90
|
+
"8",
|
|
91
|
+
"9",
|
|
92
|
+
"A",
|
|
93
|
+
"B",
|
|
94
|
+
"C",
|
|
95
|
+
"D",
|
|
96
|
+
"E",
|
|
97
|
+
"F",
|
|
98
|
+
"G",
|
|
99
|
+
"H",
|
|
100
|
+
"I",
|
|
101
|
+
"J",
|
|
102
|
+
"K",
|
|
103
|
+
"L",
|
|
104
|
+
"M",
|
|
105
|
+
"N",
|
|
106
|
+
"O",
|
|
107
|
+
"P",
|
|
108
|
+
"Q",
|
|
109
|
+
"R",
|
|
110
|
+
"S",
|
|
111
|
+
"T",
|
|
112
|
+
"U",
|
|
113
|
+
"V",
|
|
114
|
+
"W",
|
|
115
|
+
"X",
|
|
116
|
+
"Y",
|
|
117
|
+
"Z",
|
|
118
|
+
"-",
|
|
119
|
+
".",
|
|
120
|
+
" ",
|
|
121
|
+
"$",
|
|
122
|
+
"/",
|
|
123
|
+
"+",
|
|
124
|
+
"%",
|
|
125
|
+
"*"
|
|
126
|
+
];
|
|
127
|
+
var encodings = [
|
|
128
|
+
20957,
|
|
129
|
+
29783,
|
|
130
|
+
23639,
|
|
131
|
+
30485,
|
|
132
|
+
20951,
|
|
133
|
+
29813,
|
|
134
|
+
23669,
|
|
135
|
+
20855,
|
|
136
|
+
29789,
|
|
137
|
+
23645,
|
|
138
|
+
29975,
|
|
139
|
+
23831,
|
|
140
|
+
30533,
|
|
141
|
+
22295,
|
|
142
|
+
30149,
|
|
143
|
+
24005,
|
|
144
|
+
21623,
|
|
145
|
+
29981,
|
|
146
|
+
23837,
|
|
147
|
+
22301,
|
|
148
|
+
30023,
|
|
149
|
+
23879,
|
|
150
|
+
30545,
|
|
151
|
+
22343,
|
|
152
|
+
30161,
|
|
153
|
+
24017,
|
|
154
|
+
21959,
|
|
155
|
+
30065,
|
|
156
|
+
23921,
|
|
157
|
+
22385,
|
|
158
|
+
29015,
|
|
159
|
+
18263,
|
|
160
|
+
29141,
|
|
161
|
+
17879,
|
|
162
|
+
29045,
|
|
163
|
+
18293,
|
|
164
|
+
17783,
|
|
165
|
+
29021,
|
|
166
|
+
18269,
|
|
167
|
+
17477,
|
|
168
|
+
17489,
|
|
169
|
+
17681,
|
|
170
|
+
20753,
|
|
171
|
+
35770
|
|
172
|
+
];
|
|
173
|
+
function getEncoding(character) {
|
|
174
|
+
return getBinary(characterValue(character));
|
|
175
|
+
}
|
|
176
|
+
function getBinary(characterValue$1) {
|
|
177
|
+
return encodings[characterValue$1].toString(2);
|
|
178
|
+
}
|
|
179
|
+
function getCharacter(characterValue$1) {
|
|
180
|
+
return characters[characterValue$1];
|
|
181
|
+
}
|
|
182
|
+
function characterValue(character) {
|
|
183
|
+
return characters.indexOf(character);
|
|
184
|
+
}
|
|
185
|
+
function mod43checksum(data) {
|
|
186
|
+
var checksum$5 = 0;
|
|
187
|
+
for (var i = 0; i < data.length; i++) checksum$5 += characterValue(data[i]);
|
|
188
|
+
checksum$5 = checksum$5 % 43;
|
|
189
|
+
return checksum$5;
|
|
190
|
+
}
|
|
191
|
+
exports.CODE39 = CODE39;
|
|
192
|
+
}));
|
|
193
|
+
var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
194
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
195
|
+
var _SET_BY_CODE;
|
|
196
|
+
function _defineProperty(obj, key, value) {
|
|
197
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
198
|
+
value,
|
|
199
|
+
enumerable: true,
|
|
200
|
+
configurable: true,
|
|
201
|
+
writable: true
|
|
202
|
+
});
|
|
203
|
+
else obj[key] = value;
|
|
204
|
+
return obj;
|
|
205
|
+
}
|
|
206
|
+
var SET_A = exports.SET_A = 0;
|
|
207
|
+
var SET_B = exports.SET_B = 1;
|
|
208
|
+
var SET_C = exports.SET_C = 2;
|
|
209
|
+
exports.SHIFT = 98;
|
|
210
|
+
var START_A = exports.START_A = 103;
|
|
211
|
+
var START_B = exports.START_B = 104;
|
|
212
|
+
var START_C = exports.START_C = 105;
|
|
213
|
+
exports.MODULO = 103;
|
|
214
|
+
exports.STOP = 106;
|
|
215
|
+
exports.FNC1 = 207;
|
|
216
|
+
exports.SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE);
|
|
217
|
+
exports.SWAP = {
|
|
218
|
+
101: SET_A,
|
|
219
|
+
100: SET_B,
|
|
220
|
+
99: SET_C
|
|
221
|
+
};
|
|
222
|
+
exports.A_START_CHAR = String.fromCharCode(208);
|
|
223
|
+
exports.B_START_CHAR = String.fromCharCode(209);
|
|
224
|
+
exports.C_START_CHAR = String.fromCharCode(210);
|
|
225
|
+
exports.A_CHARS = "[\0-_È-Ï]";
|
|
226
|
+
exports.B_CHARS = "[ -È-Ï]";
|
|
227
|
+
exports.C_CHARS = "(Ï*[0-9]{2}Ï*)";
|
|
228
|
+
exports.BARS = [
|
|
229
|
+
11011001100,
|
|
230
|
+
11001101100,
|
|
231
|
+
11001100110,
|
|
232
|
+
10010011e3,
|
|
233
|
+
10010001100,
|
|
234
|
+
10001001100,
|
|
235
|
+
10011001e3,
|
|
236
|
+
10011000100,
|
|
237
|
+
10001100100,
|
|
238
|
+
11001001e3,
|
|
239
|
+
11001000100,
|
|
240
|
+
11000100100,
|
|
241
|
+
10110011100,
|
|
242
|
+
10011011100,
|
|
243
|
+
10011001110,
|
|
244
|
+
10111001100,
|
|
245
|
+
10011101100,
|
|
246
|
+
10011100110,
|
|
247
|
+
11001110010,
|
|
248
|
+
11001011100,
|
|
249
|
+
11001001110,
|
|
250
|
+
11011100100,
|
|
251
|
+
11001110100,
|
|
252
|
+
11101101110,
|
|
253
|
+
11101001100,
|
|
254
|
+
11100101100,
|
|
255
|
+
11100100110,
|
|
256
|
+
11101100100,
|
|
257
|
+
11100110100,
|
|
258
|
+
11100110010,
|
|
259
|
+
11011011e3,
|
|
260
|
+
11011000110,
|
|
261
|
+
11000110110,
|
|
262
|
+
10100011e3,
|
|
263
|
+
10001011e3,
|
|
264
|
+
10001000110,
|
|
265
|
+
10110001e3,
|
|
266
|
+
10001101e3,
|
|
267
|
+
10001100010,
|
|
268
|
+
11010001e3,
|
|
269
|
+
11000101e3,
|
|
270
|
+
11000100010,
|
|
271
|
+
10110111e3,
|
|
272
|
+
10110001110,
|
|
273
|
+
10001101110,
|
|
274
|
+
10111011e3,
|
|
275
|
+
10111000110,
|
|
276
|
+
10001110110,
|
|
277
|
+
11101110110,
|
|
278
|
+
11010001110,
|
|
279
|
+
11000101110,
|
|
280
|
+
11011101e3,
|
|
281
|
+
11011100010,
|
|
282
|
+
11011101110,
|
|
283
|
+
11101011e3,
|
|
284
|
+
11101000110,
|
|
285
|
+
11100010110,
|
|
286
|
+
11101101e3,
|
|
287
|
+
11101100010,
|
|
288
|
+
11100011010,
|
|
289
|
+
11101111010,
|
|
290
|
+
11001000010,
|
|
291
|
+
11110001010,
|
|
292
|
+
1010011e4,
|
|
293
|
+
10100001100,
|
|
294
|
+
1001011e4,
|
|
295
|
+
10010000110,
|
|
296
|
+
10000101100,
|
|
297
|
+
10000100110,
|
|
298
|
+
1011001e4,
|
|
299
|
+
10110000100,
|
|
300
|
+
1001101e4,
|
|
301
|
+
10011000010,
|
|
302
|
+
10000110100,
|
|
303
|
+
10000110010,
|
|
304
|
+
11000010010,
|
|
305
|
+
1100101e4,
|
|
306
|
+
11110111010,
|
|
307
|
+
11000010100,
|
|
308
|
+
10001111010,
|
|
309
|
+
10100111100,
|
|
310
|
+
10010111100,
|
|
311
|
+
10010011110,
|
|
312
|
+
10111100100,
|
|
313
|
+
10011110100,
|
|
314
|
+
10011110010,
|
|
315
|
+
11110100100,
|
|
316
|
+
11110010100,
|
|
317
|
+
11110010010,
|
|
318
|
+
11011011110,
|
|
319
|
+
11011110110,
|
|
320
|
+
11110110110,
|
|
321
|
+
10101111e3,
|
|
322
|
+
10100011110,
|
|
323
|
+
10001011110,
|
|
324
|
+
10111101e3,
|
|
325
|
+
10111100010,
|
|
326
|
+
11110101e3,
|
|
327
|
+
11110100010,
|
|
328
|
+
10111011110,
|
|
329
|
+
10111101110,
|
|
330
|
+
11101011110,
|
|
331
|
+
11110101110,
|
|
332
|
+
11010000100,
|
|
333
|
+
1101001e4,
|
|
334
|
+
11010011100,
|
|
335
|
+
1100011101011
|
|
336
|
+
];
|
|
337
|
+
}));
|
|
338
|
+
var require_CODE128$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
339
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
340
|
+
var _createClass$22 = function() {
|
|
341
|
+
function defineProperties(target, props) {
|
|
342
|
+
for (var i = 0; i < props.length; i++) {
|
|
343
|
+
var descriptor = props[i];
|
|
344
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
345
|
+
descriptor.configurable = true;
|
|
346
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
347
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return function(Constructor, protoProps, staticProps) {
|
|
351
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
352
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
353
|
+
return Constructor;
|
|
354
|
+
};
|
|
355
|
+
}();
|
|
356
|
+
var _Barcode3$11 = _interopRequireDefault$35(require_Barcode());
|
|
357
|
+
var _constants$11 = require_constants$3();
|
|
358
|
+
function _interopRequireDefault$35(obj) {
|
|
359
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
360
|
+
}
|
|
361
|
+
function _classCallCheck$28(instance, Constructor) {
|
|
362
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
363
|
+
}
|
|
364
|
+
function _possibleConstructorReturn$24(self, call) {
|
|
365
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
366
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
367
|
+
}
|
|
368
|
+
function _inherits$24(subClass, superClass) {
|
|
369
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
370
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
371
|
+
value: subClass,
|
|
372
|
+
enumerable: false,
|
|
373
|
+
writable: true,
|
|
374
|
+
configurable: true
|
|
375
|
+
} });
|
|
376
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
377
|
+
}
|
|
378
|
+
exports.default = function(_Barcode) {
|
|
379
|
+
_inherits$24(CODE128$1, _Barcode);
|
|
380
|
+
function CODE128$1(data, options) {
|
|
381
|
+
_classCallCheck$28(this, CODE128$1);
|
|
382
|
+
var _this = _possibleConstructorReturn$24(this, (CODE128$1.__proto__ || Object.getPrototypeOf(CODE128$1)).call(this, data.substring(1), options));
|
|
383
|
+
_this.bytes = data.split("").map(function(char) {
|
|
384
|
+
return char.charCodeAt(0);
|
|
385
|
+
});
|
|
386
|
+
return _this;
|
|
387
|
+
}
|
|
388
|
+
_createClass$22(CODE128$1, [
|
|
389
|
+
{
|
|
390
|
+
key: "valid",
|
|
391
|
+
value: function valid() {
|
|
392
|
+
return /^[\x00-\x7F\xC8-\xD3]+$/.test(this.data);
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
key: "encode",
|
|
397
|
+
value: function encode$2() {
|
|
398
|
+
var bytes = this.bytes;
|
|
399
|
+
var startIndex = bytes.shift() - 105;
|
|
400
|
+
var startSet = _constants$11.SET_BY_CODE[startIndex];
|
|
401
|
+
if (startSet === void 0) throw new RangeError("The encoding does not start with a start character.");
|
|
402
|
+
if (this.shouldEncodeAsEan128() === true) bytes.unshift(_constants$11.FNC1);
|
|
403
|
+
var encodingResult = CODE128$1.next(bytes, 1, startSet);
|
|
404
|
+
return {
|
|
405
|
+
text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, "") : this.text,
|
|
406
|
+
data: CODE128$1.getBar(startIndex) + encodingResult.result + CODE128$1.getBar((encodingResult.checksum + startIndex) % _constants$11.MODULO) + CODE128$1.getBar(_constants$11.STOP)
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
key: "shouldEncodeAsEan128",
|
|
412
|
+
value: function shouldEncodeAsEan128() {
|
|
413
|
+
var isEAN128 = this.options.ean128 || false;
|
|
414
|
+
if (typeof isEAN128 === "string") isEAN128 = isEAN128.toLowerCase() === "true";
|
|
415
|
+
return isEAN128;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
], [
|
|
419
|
+
{
|
|
420
|
+
key: "getBar",
|
|
421
|
+
value: function getBar(index) {
|
|
422
|
+
return _constants$11.BARS[index] ? _constants$11.BARS[index].toString() : "";
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
key: "correctIndex",
|
|
427
|
+
value: function correctIndex(bytes, set) {
|
|
428
|
+
if (set === _constants$11.SET_A) {
|
|
429
|
+
var charCode = bytes.shift();
|
|
430
|
+
return charCode < 32 ? charCode + 64 : charCode - 32;
|
|
431
|
+
} else if (set === _constants$11.SET_B) return bytes.shift() - 32;
|
|
432
|
+
else return (bytes.shift() - 48) * 10 + bytes.shift() - 48;
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
key: "next",
|
|
437
|
+
value: function next(bytes, pos, set) {
|
|
438
|
+
if (!bytes.length) return {
|
|
439
|
+
result: "",
|
|
440
|
+
checksum: 0
|
|
441
|
+
};
|
|
442
|
+
var nextCode = void 0, index = void 0;
|
|
443
|
+
if (bytes[0] >= 200) {
|
|
444
|
+
index = bytes.shift() - 105;
|
|
445
|
+
var nextSet = _constants$11.SWAP[index];
|
|
446
|
+
if (nextSet !== void 0) nextCode = CODE128$1.next(bytes, pos + 1, nextSet);
|
|
447
|
+
else {
|
|
448
|
+
if ((set === _constants$11.SET_A || set === _constants$11.SET_B) && index === _constants$11.SHIFT) bytes[0] = set === _constants$11.SET_A ? bytes[0] > 95 ? bytes[0] - 96 : bytes[0] : bytes[0] < 32 ? bytes[0] + 96 : bytes[0];
|
|
449
|
+
nextCode = CODE128$1.next(bytes, pos + 1, set);
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
index = CODE128$1.correctIndex(bytes, set);
|
|
453
|
+
nextCode = CODE128$1.next(bytes, pos + 1, set);
|
|
454
|
+
}
|
|
455
|
+
var enc = CODE128$1.getBar(index);
|
|
456
|
+
var weight = index * pos;
|
|
457
|
+
return {
|
|
458
|
+
result: enc + nextCode.result,
|
|
459
|
+
checksum: weight + nextCode.checksum
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
]);
|
|
464
|
+
return CODE128$1;
|
|
465
|
+
}(_Barcode3$11.default);
|
|
466
|
+
}));
|
|
467
|
+
var require_auto = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
468
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
469
|
+
var _constants$10 = require_constants$3();
|
|
470
|
+
var matchSetALength = function matchSetALength$1(string) {
|
|
471
|
+
return string.match(/* @__PURE__ */ new RegExp("^" + _constants$10.A_CHARS + "*"))[0].length;
|
|
472
|
+
};
|
|
473
|
+
var matchSetBLength = function matchSetBLength$1(string) {
|
|
474
|
+
return string.match(/* @__PURE__ */ new RegExp("^" + _constants$10.B_CHARS + "*"))[0].length;
|
|
475
|
+
};
|
|
476
|
+
var matchSetC = function matchSetC$1(string) {
|
|
477
|
+
return string.match(/* @__PURE__ */ new RegExp("^" + _constants$10.C_CHARS + "*"))[0];
|
|
478
|
+
};
|
|
479
|
+
function autoSelectFromAB(string, isA) {
|
|
480
|
+
var ranges = isA ? _constants$10.A_CHARS : _constants$10.B_CHARS;
|
|
481
|
+
var untilC = string.match(/* @__PURE__ */ new RegExp("^(" + ranges + "+?)(([0-9]{2}){2,})([^0-9]|$)"));
|
|
482
|
+
if (untilC) return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length));
|
|
483
|
+
var chars = string.match(/* @__PURE__ */ new RegExp("^" + ranges + "+"))[0];
|
|
484
|
+
if (chars.length === string.length) return string;
|
|
485
|
+
return chars + String.fromCharCode(isA ? 205 : 206) + autoSelectFromAB(string.substring(chars.length), !isA);
|
|
486
|
+
}
|
|
487
|
+
function autoSelectFromC(string) {
|
|
488
|
+
var cMatch = matchSetC(string);
|
|
489
|
+
var length = cMatch.length;
|
|
490
|
+
if (length === string.length) return string;
|
|
491
|
+
string = string.substring(length);
|
|
492
|
+
var isA = matchSetALength(string) >= matchSetBLength(string);
|
|
493
|
+
return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA);
|
|
494
|
+
}
|
|
495
|
+
exports.default = function(string) {
|
|
496
|
+
var newString = void 0;
|
|
497
|
+
if (matchSetC(string).length >= 2) newString = _constants$10.C_START_CHAR + autoSelectFromC(string);
|
|
498
|
+
else {
|
|
499
|
+
var isA = matchSetALength(string) > matchSetBLength(string);
|
|
500
|
+
newString = (isA ? _constants$10.A_START_CHAR : _constants$10.B_START_CHAR) + autoSelectFromAB(string, isA);
|
|
501
|
+
}
|
|
502
|
+
return newString.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, function(match, char) {
|
|
503
|
+
return String.fromCharCode(203) + char;
|
|
504
|
+
});
|
|
505
|
+
};
|
|
506
|
+
}));
|
|
507
|
+
var require_CODE128_AUTO = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
508
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
509
|
+
var _CODE3$5 = _interopRequireDefault$34(require_CODE128$1());
|
|
510
|
+
var _auto2 = _interopRequireDefault$34(require_auto());
|
|
511
|
+
function _interopRequireDefault$34(obj) {
|
|
512
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
513
|
+
}
|
|
514
|
+
function _classCallCheck$27(instance, Constructor) {
|
|
515
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
516
|
+
}
|
|
517
|
+
function _possibleConstructorReturn$23(self, call) {
|
|
518
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
519
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
520
|
+
}
|
|
521
|
+
function _inherits$23(subClass, superClass) {
|
|
522
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
523
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
524
|
+
value: subClass,
|
|
525
|
+
enumerable: false,
|
|
526
|
+
writable: true,
|
|
527
|
+
configurable: true
|
|
528
|
+
} });
|
|
529
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
530
|
+
}
|
|
531
|
+
exports.default = function(_CODE$1) {
|
|
532
|
+
_inherits$23(CODE128AUTO$1, _CODE$1);
|
|
533
|
+
function CODE128AUTO$1(data, options) {
|
|
534
|
+
_classCallCheck$27(this, CODE128AUTO$1);
|
|
535
|
+
if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) var _this = _possibleConstructorReturn$23(this, (CODE128AUTO$1.__proto__ || Object.getPrototypeOf(CODE128AUTO$1)).call(this, (0, _auto2.default)(data), options));
|
|
536
|
+
else var _this = _possibleConstructorReturn$23(this, (CODE128AUTO$1.__proto__ || Object.getPrototypeOf(CODE128AUTO$1)).call(this, data, options));
|
|
537
|
+
return _possibleConstructorReturn$23(_this);
|
|
538
|
+
}
|
|
539
|
+
return CODE128AUTO$1;
|
|
540
|
+
}(_CODE3$5.default);
|
|
541
|
+
}));
|
|
542
|
+
var require_CODE128A = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
543
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
544
|
+
var _createClass$21 = function() {
|
|
545
|
+
function defineProperties(target, props) {
|
|
546
|
+
for (var i = 0; i < props.length; i++) {
|
|
547
|
+
var descriptor = props[i];
|
|
548
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
549
|
+
descriptor.configurable = true;
|
|
550
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
551
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return function(Constructor, protoProps, staticProps) {
|
|
555
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
556
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
557
|
+
return Constructor;
|
|
558
|
+
};
|
|
559
|
+
}();
|
|
560
|
+
var _CODE3$4 = _interopRequireDefault$33(require_CODE128$1());
|
|
561
|
+
var _constants$9 = require_constants$3();
|
|
562
|
+
function _interopRequireDefault$33(obj) {
|
|
563
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
564
|
+
}
|
|
565
|
+
function _classCallCheck$26(instance, Constructor) {
|
|
566
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
567
|
+
}
|
|
568
|
+
function _possibleConstructorReturn$22(self, call) {
|
|
569
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
570
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
571
|
+
}
|
|
572
|
+
function _inherits$22(subClass, superClass) {
|
|
573
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
574
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
575
|
+
value: subClass,
|
|
576
|
+
enumerable: false,
|
|
577
|
+
writable: true,
|
|
578
|
+
configurable: true
|
|
579
|
+
} });
|
|
580
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
581
|
+
}
|
|
582
|
+
exports.default = function(_CODE$1) {
|
|
583
|
+
_inherits$22(CODE128A$1, _CODE$1);
|
|
584
|
+
function CODE128A$1(string, options) {
|
|
585
|
+
_classCallCheck$26(this, CODE128A$1);
|
|
586
|
+
return _possibleConstructorReturn$22(this, (CODE128A$1.__proto__ || Object.getPrototypeOf(CODE128A$1)).call(this, _constants$9.A_START_CHAR + string, options));
|
|
587
|
+
}
|
|
588
|
+
_createClass$21(CODE128A$1, [{
|
|
589
|
+
key: "valid",
|
|
590
|
+
value: function valid() {
|
|
591
|
+
return (/* @__PURE__ */ new RegExp("^" + _constants$9.A_CHARS + "+$")).test(this.data);
|
|
592
|
+
}
|
|
593
|
+
}]);
|
|
594
|
+
return CODE128A$1;
|
|
595
|
+
}(_CODE3$4.default);
|
|
596
|
+
}));
|
|
597
|
+
var require_CODE128B = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
598
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
599
|
+
var _createClass$20 = function() {
|
|
600
|
+
function defineProperties(target, props) {
|
|
601
|
+
for (var i = 0; i < props.length; i++) {
|
|
602
|
+
var descriptor = props[i];
|
|
603
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
604
|
+
descriptor.configurable = true;
|
|
605
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
606
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return function(Constructor, protoProps, staticProps) {
|
|
610
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
611
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
612
|
+
return Constructor;
|
|
613
|
+
};
|
|
614
|
+
}();
|
|
615
|
+
var _CODE3$3 = _interopRequireDefault$32(require_CODE128$1());
|
|
616
|
+
var _constants$8 = require_constants$3();
|
|
617
|
+
function _interopRequireDefault$32(obj) {
|
|
618
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
619
|
+
}
|
|
620
|
+
function _classCallCheck$25(instance, Constructor) {
|
|
621
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
622
|
+
}
|
|
623
|
+
function _possibleConstructorReturn$21(self, call) {
|
|
624
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
625
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
626
|
+
}
|
|
627
|
+
function _inherits$21(subClass, superClass) {
|
|
628
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
629
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
630
|
+
value: subClass,
|
|
631
|
+
enumerable: false,
|
|
632
|
+
writable: true,
|
|
633
|
+
configurable: true
|
|
634
|
+
} });
|
|
635
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
636
|
+
}
|
|
637
|
+
exports.default = function(_CODE$1) {
|
|
638
|
+
_inherits$21(CODE128B$1, _CODE$1);
|
|
639
|
+
function CODE128B$1(string, options) {
|
|
640
|
+
_classCallCheck$25(this, CODE128B$1);
|
|
641
|
+
return _possibleConstructorReturn$21(this, (CODE128B$1.__proto__ || Object.getPrototypeOf(CODE128B$1)).call(this, _constants$8.B_START_CHAR + string, options));
|
|
642
|
+
}
|
|
643
|
+
_createClass$20(CODE128B$1, [{
|
|
644
|
+
key: "valid",
|
|
645
|
+
value: function valid() {
|
|
646
|
+
return (/* @__PURE__ */ new RegExp("^" + _constants$8.B_CHARS + "+$")).test(this.data);
|
|
647
|
+
}
|
|
648
|
+
}]);
|
|
649
|
+
return CODE128B$1;
|
|
650
|
+
}(_CODE3$3.default);
|
|
651
|
+
}));
|
|
652
|
+
var require_CODE128C = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
653
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
654
|
+
var _createClass$19 = function() {
|
|
655
|
+
function defineProperties(target, props) {
|
|
656
|
+
for (var i = 0; i < props.length; i++) {
|
|
657
|
+
var descriptor = props[i];
|
|
658
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
659
|
+
descriptor.configurable = true;
|
|
660
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
661
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return function(Constructor, protoProps, staticProps) {
|
|
665
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
666
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
667
|
+
return Constructor;
|
|
668
|
+
};
|
|
669
|
+
}();
|
|
670
|
+
var _CODE3$2 = _interopRequireDefault$31(require_CODE128$1());
|
|
671
|
+
var _constants$7 = require_constants$3();
|
|
672
|
+
function _interopRequireDefault$31(obj) {
|
|
673
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
674
|
+
}
|
|
675
|
+
function _classCallCheck$24(instance, Constructor) {
|
|
676
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
677
|
+
}
|
|
678
|
+
function _possibleConstructorReturn$20(self, call) {
|
|
679
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
680
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
681
|
+
}
|
|
682
|
+
function _inherits$20(subClass, superClass) {
|
|
683
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
684
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
685
|
+
value: subClass,
|
|
686
|
+
enumerable: false,
|
|
687
|
+
writable: true,
|
|
688
|
+
configurable: true
|
|
689
|
+
} });
|
|
690
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
691
|
+
}
|
|
692
|
+
exports.default = function(_CODE$1) {
|
|
693
|
+
_inherits$20(CODE128C$1, _CODE$1);
|
|
694
|
+
function CODE128C$1(string, options) {
|
|
695
|
+
_classCallCheck$24(this, CODE128C$1);
|
|
696
|
+
return _possibleConstructorReturn$20(this, (CODE128C$1.__proto__ || Object.getPrototypeOf(CODE128C$1)).call(this, _constants$7.C_START_CHAR + string, options));
|
|
697
|
+
}
|
|
698
|
+
_createClass$19(CODE128C$1, [{
|
|
699
|
+
key: "valid",
|
|
700
|
+
value: function valid() {
|
|
701
|
+
return (/* @__PURE__ */ new RegExp("^" + _constants$7.C_CHARS + "+$")).test(this.data);
|
|
702
|
+
}
|
|
703
|
+
}]);
|
|
704
|
+
return CODE128C$1;
|
|
705
|
+
}(_CODE3$2.default);
|
|
706
|
+
}));
|
|
707
|
+
var require_CODE128 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
708
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
709
|
+
exports.CODE128C = exports.CODE128B = exports.CODE128A = exports.CODE128 = void 0;
|
|
710
|
+
var _CODE128_AUTO2 = _interopRequireDefault$30(require_CODE128_AUTO());
|
|
711
|
+
var _CODE128A2 = _interopRequireDefault$30(require_CODE128A());
|
|
712
|
+
var _CODE128B2 = _interopRequireDefault$30(require_CODE128B());
|
|
713
|
+
var _CODE128C2 = _interopRequireDefault$30(require_CODE128C());
|
|
714
|
+
function _interopRequireDefault$30(obj) {
|
|
715
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
716
|
+
}
|
|
717
|
+
exports.CODE128 = _CODE128_AUTO2.default;
|
|
718
|
+
exports.CODE128A = _CODE128A2.default;
|
|
719
|
+
exports.CODE128B = _CODE128B2.default;
|
|
720
|
+
exports.CODE128C = _CODE128C2.default;
|
|
721
|
+
}));
|
|
722
|
+
var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
723
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
724
|
+
exports.SIDE_BIN = "101";
|
|
725
|
+
exports.MIDDLE_BIN = "01010";
|
|
726
|
+
exports.BINARIES = {
|
|
727
|
+
"L": [
|
|
728
|
+
"0001101",
|
|
729
|
+
"0011001",
|
|
730
|
+
"0010011",
|
|
731
|
+
"0111101",
|
|
732
|
+
"0100011",
|
|
733
|
+
"0110001",
|
|
734
|
+
"0101111",
|
|
735
|
+
"0111011",
|
|
736
|
+
"0110111",
|
|
737
|
+
"0001011"
|
|
738
|
+
],
|
|
739
|
+
"G": [
|
|
740
|
+
"0100111",
|
|
741
|
+
"0110011",
|
|
742
|
+
"0011011",
|
|
743
|
+
"0100001",
|
|
744
|
+
"0011101",
|
|
745
|
+
"0111001",
|
|
746
|
+
"0000101",
|
|
747
|
+
"0010001",
|
|
748
|
+
"0001001",
|
|
749
|
+
"0010111"
|
|
750
|
+
],
|
|
751
|
+
"R": [
|
|
752
|
+
"1110010",
|
|
753
|
+
"1100110",
|
|
754
|
+
"1101100",
|
|
755
|
+
"1000010",
|
|
756
|
+
"1011100",
|
|
757
|
+
"1001110",
|
|
758
|
+
"1010000",
|
|
759
|
+
"1000100",
|
|
760
|
+
"1001000",
|
|
761
|
+
"1110100"
|
|
762
|
+
],
|
|
763
|
+
"O": [
|
|
764
|
+
"0001101",
|
|
765
|
+
"0011001",
|
|
766
|
+
"0010011",
|
|
767
|
+
"0111101",
|
|
768
|
+
"0100011",
|
|
769
|
+
"0110001",
|
|
770
|
+
"0101111",
|
|
771
|
+
"0111011",
|
|
772
|
+
"0110111",
|
|
773
|
+
"0001011"
|
|
774
|
+
],
|
|
775
|
+
"E": [
|
|
776
|
+
"0100111",
|
|
777
|
+
"0110011",
|
|
778
|
+
"0011011",
|
|
779
|
+
"0100001",
|
|
780
|
+
"0011101",
|
|
781
|
+
"0111001",
|
|
782
|
+
"0000101",
|
|
783
|
+
"0010001",
|
|
784
|
+
"0001001",
|
|
785
|
+
"0010111"
|
|
786
|
+
]
|
|
787
|
+
};
|
|
788
|
+
exports.EAN2_STRUCTURE = [
|
|
789
|
+
"LL",
|
|
790
|
+
"LG",
|
|
791
|
+
"GL",
|
|
792
|
+
"GG"
|
|
793
|
+
];
|
|
794
|
+
exports.EAN5_STRUCTURE = [
|
|
795
|
+
"GGLLL",
|
|
796
|
+
"GLGLL",
|
|
797
|
+
"GLLGL",
|
|
798
|
+
"GLLLG",
|
|
799
|
+
"LGGLL",
|
|
800
|
+
"LLGGL",
|
|
801
|
+
"LLLGG",
|
|
802
|
+
"LGLGL",
|
|
803
|
+
"LGLLG",
|
|
804
|
+
"LLGLG"
|
|
805
|
+
];
|
|
806
|
+
exports.EAN13_STRUCTURE = [
|
|
807
|
+
"LLLLLL",
|
|
808
|
+
"LLGLGG",
|
|
809
|
+
"LLGGLG",
|
|
810
|
+
"LLGGGL",
|
|
811
|
+
"LGLLGG",
|
|
812
|
+
"LGGLLG",
|
|
813
|
+
"LGGGLL",
|
|
814
|
+
"LGLGLG",
|
|
815
|
+
"LGLGGL",
|
|
816
|
+
"LGGLGL"
|
|
817
|
+
];
|
|
818
|
+
}));
|
|
819
|
+
var require_encoder = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
820
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
821
|
+
var _constants$6 = require_constants$2();
|
|
822
|
+
exports.default = function encode$2(data, structure, separator) {
|
|
823
|
+
var encoded = data.split("").map(function(val, idx) {
|
|
824
|
+
return _constants$6.BINARIES[structure[idx]];
|
|
825
|
+
}).map(function(val, idx) {
|
|
826
|
+
return val ? val[data[idx]] : "";
|
|
827
|
+
});
|
|
828
|
+
if (separator) {
|
|
829
|
+
var last = data.length - 1;
|
|
830
|
+
encoded = encoded.map(function(val, idx) {
|
|
831
|
+
return idx < last ? val + separator : val;
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
return encoded.join("");
|
|
835
|
+
};
|
|
836
|
+
}));
|
|
837
|
+
var require_EAN = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
838
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
839
|
+
var _createClass$18 = function() {
|
|
840
|
+
function defineProperties(target, props) {
|
|
841
|
+
for (var i = 0; i < props.length; i++) {
|
|
842
|
+
var descriptor = props[i];
|
|
843
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
844
|
+
descriptor.configurable = true;
|
|
845
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
846
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return function(Constructor, protoProps, staticProps) {
|
|
850
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
851
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
852
|
+
return Constructor;
|
|
853
|
+
};
|
|
854
|
+
}();
|
|
855
|
+
var _constants$5 = require_constants$2();
|
|
856
|
+
var _encoder2$4 = _interopRequireDefault$29(require_encoder());
|
|
857
|
+
var _Barcode3$10 = _interopRequireDefault$29(require_Barcode());
|
|
858
|
+
function _interopRequireDefault$29(obj) {
|
|
859
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
860
|
+
}
|
|
861
|
+
function _classCallCheck$23(instance, Constructor) {
|
|
862
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
863
|
+
}
|
|
864
|
+
function _possibleConstructorReturn$19(self, call) {
|
|
865
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
866
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
867
|
+
}
|
|
868
|
+
function _inherits$19(subClass, superClass) {
|
|
869
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
870
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
871
|
+
value: subClass,
|
|
872
|
+
enumerable: false,
|
|
873
|
+
writable: true,
|
|
874
|
+
configurable: true
|
|
875
|
+
} });
|
|
876
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
877
|
+
}
|
|
878
|
+
exports.default = function(_Barcode) {
|
|
879
|
+
_inherits$19(EAN$1, _Barcode);
|
|
880
|
+
function EAN$1(data, options) {
|
|
881
|
+
_classCallCheck$23(this, EAN$1);
|
|
882
|
+
var _this = _possibleConstructorReturn$19(this, (EAN$1.__proto__ || Object.getPrototypeOf(EAN$1)).call(this, data, options));
|
|
883
|
+
_this.fontSize = !options.flat && options.fontSize > options.width * 10 ? options.width * 10 : options.fontSize;
|
|
884
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
885
|
+
return _this;
|
|
886
|
+
}
|
|
887
|
+
_createClass$18(EAN$1, [
|
|
888
|
+
{
|
|
889
|
+
key: "encode",
|
|
890
|
+
value: function encode$2() {
|
|
891
|
+
return this.options.flat ? this.encodeFlat() : this.encodeGuarded();
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
key: "leftText",
|
|
896
|
+
value: function leftText(from, to) {
|
|
897
|
+
return this.text.substr(from, to);
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
key: "leftEncode",
|
|
902
|
+
value: function leftEncode(data, structure) {
|
|
903
|
+
return (0, _encoder2$4.default)(data, structure);
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
key: "rightText",
|
|
908
|
+
value: function rightText(from, to) {
|
|
909
|
+
return this.text.substr(from, to);
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
key: "rightEncode",
|
|
914
|
+
value: function rightEncode(data, structure) {
|
|
915
|
+
return (0, _encoder2$4.default)(data, structure);
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
key: "encodeGuarded",
|
|
920
|
+
value: function encodeGuarded() {
|
|
921
|
+
var textOptions = { fontSize: this.fontSize };
|
|
922
|
+
var guardOptions = { height: this.guardHeight };
|
|
923
|
+
return [
|
|
924
|
+
{
|
|
925
|
+
data: _constants$5.SIDE_BIN,
|
|
926
|
+
options: guardOptions
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
data: this.leftEncode(),
|
|
930
|
+
text: this.leftText(),
|
|
931
|
+
options: textOptions
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
data: _constants$5.MIDDLE_BIN,
|
|
935
|
+
options: guardOptions
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
data: this.rightEncode(),
|
|
939
|
+
text: this.rightText(),
|
|
940
|
+
options: textOptions
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
data: _constants$5.SIDE_BIN,
|
|
944
|
+
options: guardOptions
|
|
945
|
+
}
|
|
946
|
+
];
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
key: "encodeFlat",
|
|
951
|
+
value: function encodeFlat() {
|
|
952
|
+
return {
|
|
953
|
+
data: [
|
|
954
|
+
_constants$5.SIDE_BIN,
|
|
955
|
+
this.leftEncode(),
|
|
956
|
+
_constants$5.MIDDLE_BIN,
|
|
957
|
+
this.rightEncode(),
|
|
958
|
+
_constants$5.SIDE_BIN
|
|
959
|
+
].join(""),
|
|
960
|
+
text: this.text
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
]);
|
|
965
|
+
return EAN$1;
|
|
966
|
+
}(_Barcode3$10.default);
|
|
967
|
+
}));
|
|
968
|
+
var require_EAN13 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
969
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
970
|
+
var _createClass$17 = function() {
|
|
971
|
+
function defineProperties(target, props) {
|
|
972
|
+
for (var i = 0; i < props.length; i++) {
|
|
973
|
+
var descriptor = props[i];
|
|
974
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
975
|
+
descriptor.configurable = true;
|
|
976
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
977
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return function(Constructor, protoProps, staticProps) {
|
|
981
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
982
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
983
|
+
return Constructor;
|
|
984
|
+
};
|
|
985
|
+
}();
|
|
986
|
+
var _get$1 = function get(object, property, receiver) {
|
|
987
|
+
if (object === null) object = Function.prototype;
|
|
988
|
+
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
989
|
+
if (desc === void 0) {
|
|
990
|
+
var parent = Object.getPrototypeOf(object);
|
|
991
|
+
if (parent === null) return;
|
|
992
|
+
else return get(parent, property, receiver);
|
|
993
|
+
} else if ("value" in desc) return desc.value;
|
|
994
|
+
else {
|
|
995
|
+
var getter = desc.get;
|
|
996
|
+
if (getter === void 0) return;
|
|
997
|
+
return getter.call(receiver);
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
var _constants$4 = require_constants$2();
|
|
1001
|
+
var _EAN3$1 = _interopRequireDefault$28(require_EAN());
|
|
1002
|
+
function _interopRequireDefault$28(obj) {
|
|
1003
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1004
|
+
}
|
|
1005
|
+
function _classCallCheck$22(instance, Constructor) {
|
|
1006
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1007
|
+
}
|
|
1008
|
+
function _possibleConstructorReturn$18(self, call) {
|
|
1009
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1010
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1011
|
+
}
|
|
1012
|
+
function _inherits$18(subClass, superClass) {
|
|
1013
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1014
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1015
|
+
value: subClass,
|
|
1016
|
+
enumerable: false,
|
|
1017
|
+
writable: true,
|
|
1018
|
+
configurable: true
|
|
1019
|
+
} });
|
|
1020
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1021
|
+
}
|
|
1022
|
+
var checksum$4 = function checksum$5(number) {
|
|
1023
|
+
return (10 - number.substr(0, 12).split("").map(function(n) {
|
|
1024
|
+
return +n;
|
|
1025
|
+
}).reduce(function(sum, a, idx) {
|
|
1026
|
+
return idx % 2 ? sum + a * 3 : sum + a;
|
|
1027
|
+
}, 0) % 10) % 10;
|
|
1028
|
+
};
|
|
1029
|
+
exports.default = function(_EAN) {
|
|
1030
|
+
_inherits$18(EAN13$1, _EAN);
|
|
1031
|
+
function EAN13$1(data, options) {
|
|
1032
|
+
_classCallCheck$22(this, EAN13$1);
|
|
1033
|
+
if (data.search(/^[0-9]{12}$/) !== -1) data += checksum$4(data);
|
|
1034
|
+
var _this = _possibleConstructorReturn$18(this, (EAN13$1.__proto__ || Object.getPrototypeOf(EAN13$1)).call(this, data, options));
|
|
1035
|
+
_this.lastChar = options.lastChar;
|
|
1036
|
+
return _this;
|
|
1037
|
+
}
|
|
1038
|
+
_createClass$17(EAN13$1, [
|
|
1039
|
+
{
|
|
1040
|
+
key: "valid",
|
|
1041
|
+
value: function valid() {
|
|
1042
|
+
return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum$4(this.data);
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
key: "leftText",
|
|
1047
|
+
value: function leftText() {
|
|
1048
|
+
return _get$1(EAN13$1.prototype.__proto__ || Object.getPrototypeOf(EAN13$1.prototype), "leftText", this).call(this, 1, 6);
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
key: "leftEncode",
|
|
1053
|
+
value: function leftEncode() {
|
|
1054
|
+
var data = this.data.substr(1, 6);
|
|
1055
|
+
var structure = _constants$4.EAN13_STRUCTURE[this.data[0]];
|
|
1056
|
+
return _get$1(EAN13$1.prototype.__proto__ || Object.getPrototypeOf(EAN13$1.prototype), "leftEncode", this).call(this, data, structure);
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
key: "rightText",
|
|
1061
|
+
value: function rightText() {
|
|
1062
|
+
return _get$1(EAN13$1.prototype.__proto__ || Object.getPrototypeOf(EAN13$1.prototype), "rightText", this).call(this, 7, 6);
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
key: "rightEncode",
|
|
1067
|
+
value: function rightEncode() {
|
|
1068
|
+
var data = this.data.substr(7, 6);
|
|
1069
|
+
return _get$1(EAN13$1.prototype.__proto__ || Object.getPrototypeOf(EAN13$1.prototype), "rightEncode", this).call(this, data, "RRRRRR");
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
key: "encodeGuarded",
|
|
1074
|
+
value: function encodeGuarded() {
|
|
1075
|
+
var data = _get$1(EAN13$1.prototype.__proto__ || Object.getPrototypeOf(EAN13$1.prototype), "encodeGuarded", this).call(this);
|
|
1076
|
+
if (this.options.displayValue) {
|
|
1077
|
+
data.unshift({
|
|
1078
|
+
data: "000000000000",
|
|
1079
|
+
text: this.text.substr(0, 1),
|
|
1080
|
+
options: {
|
|
1081
|
+
textAlign: "left",
|
|
1082
|
+
fontSize: this.fontSize
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
if (this.options.lastChar) {
|
|
1086
|
+
data.push({ data: "00" });
|
|
1087
|
+
data.push({
|
|
1088
|
+
data: "00000",
|
|
1089
|
+
text: this.options.lastChar,
|
|
1090
|
+
options: { fontSize: this.fontSize }
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return data;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
]);
|
|
1098
|
+
return EAN13$1;
|
|
1099
|
+
}(_EAN3$1.default);
|
|
1100
|
+
}));
|
|
1101
|
+
var require_EAN8 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1102
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1103
|
+
var _createClass$16 = function() {
|
|
1104
|
+
function defineProperties(target, props) {
|
|
1105
|
+
for (var i = 0; i < props.length; i++) {
|
|
1106
|
+
var descriptor = props[i];
|
|
1107
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1108
|
+
descriptor.configurable = true;
|
|
1109
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1110
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1114
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1115
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1116
|
+
return Constructor;
|
|
1117
|
+
};
|
|
1118
|
+
}();
|
|
1119
|
+
var _get = function get(object, property, receiver) {
|
|
1120
|
+
if (object === null) object = Function.prototype;
|
|
1121
|
+
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
1122
|
+
if (desc === void 0) {
|
|
1123
|
+
var parent = Object.getPrototypeOf(object);
|
|
1124
|
+
if (parent === null) return;
|
|
1125
|
+
else return get(parent, property, receiver);
|
|
1126
|
+
} else if ("value" in desc) return desc.value;
|
|
1127
|
+
else {
|
|
1128
|
+
var getter = desc.get;
|
|
1129
|
+
if (getter === void 0) return;
|
|
1130
|
+
return getter.call(receiver);
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
var _EAN3 = _interopRequireDefault$27(require_EAN());
|
|
1134
|
+
function _interopRequireDefault$27(obj) {
|
|
1135
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1136
|
+
}
|
|
1137
|
+
function _classCallCheck$21(instance, Constructor) {
|
|
1138
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1139
|
+
}
|
|
1140
|
+
function _possibleConstructorReturn$17(self, call) {
|
|
1141
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1142
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1143
|
+
}
|
|
1144
|
+
function _inherits$17(subClass, superClass) {
|
|
1145
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1146
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1147
|
+
value: subClass,
|
|
1148
|
+
enumerable: false,
|
|
1149
|
+
writable: true,
|
|
1150
|
+
configurable: true
|
|
1151
|
+
} });
|
|
1152
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1153
|
+
}
|
|
1154
|
+
var checksum$3 = function checksum$5(number) {
|
|
1155
|
+
return (10 - number.substr(0, 7).split("").map(function(n) {
|
|
1156
|
+
return +n;
|
|
1157
|
+
}).reduce(function(sum, a, idx) {
|
|
1158
|
+
return idx % 2 ? sum + a : sum + a * 3;
|
|
1159
|
+
}, 0) % 10) % 10;
|
|
1160
|
+
};
|
|
1161
|
+
exports.default = function(_EAN) {
|
|
1162
|
+
_inherits$17(EAN8$1, _EAN);
|
|
1163
|
+
function EAN8$1(data, options) {
|
|
1164
|
+
_classCallCheck$21(this, EAN8$1);
|
|
1165
|
+
if (data.search(/^[0-9]{7}$/) !== -1) data += checksum$3(data);
|
|
1166
|
+
return _possibleConstructorReturn$17(this, (EAN8$1.__proto__ || Object.getPrototypeOf(EAN8$1)).call(this, data, options));
|
|
1167
|
+
}
|
|
1168
|
+
_createClass$16(EAN8$1, [
|
|
1169
|
+
{
|
|
1170
|
+
key: "valid",
|
|
1171
|
+
value: function valid() {
|
|
1172
|
+
return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum$3(this.data);
|
|
1173
|
+
}
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
key: "leftText",
|
|
1177
|
+
value: function leftText() {
|
|
1178
|
+
return _get(EAN8$1.prototype.__proto__ || Object.getPrototypeOf(EAN8$1.prototype), "leftText", this).call(this, 0, 4);
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
key: "leftEncode",
|
|
1183
|
+
value: function leftEncode() {
|
|
1184
|
+
var data = this.data.substr(0, 4);
|
|
1185
|
+
return _get(EAN8$1.prototype.__proto__ || Object.getPrototypeOf(EAN8$1.prototype), "leftEncode", this).call(this, data, "LLLL");
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
key: "rightText",
|
|
1190
|
+
value: function rightText() {
|
|
1191
|
+
return _get(EAN8$1.prototype.__proto__ || Object.getPrototypeOf(EAN8$1.prototype), "rightText", this).call(this, 4, 4);
|
|
1192
|
+
}
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
key: "rightEncode",
|
|
1196
|
+
value: function rightEncode() {
|
|
1197
|
+
var data = this.data.substr(4, 4);
|
|
1198
|
+
return _get(EAN8$1.prototype.__proto__ || Object.getPrototypeOf(EAN8$1.prototype), "rightEncode", this).call(this, data, "RRRR");
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
]);
|
|
1202
|
+
return EAN8$1;
|
|
1203
|
+
}(_EAN3.default);
|
|
1204
|
+
}));
|
|
1205
|
+
var require_EAN5 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1206
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1207
|
+
var _createClass$15 = function() {
|
|
1208
|
+
function defineProperties(target, props) {
|
|
1209
|
+
for (var i = 0; i < props.length; i++) {
|
|
1210
|
+
var descriptor = props[i];
|
|
1211
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1212
|
+
descriptor.configurable = true;
|
|
1213
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1214
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1218
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1219
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1220
|
+
return Constructor;
|
|
1221
|
+
};
|
|
1222
|
+
}();
|
|
1223
|
+
var _constants$3 = require_constants$2();
|
|
1224
|
+
var _encoder2$3 = _interopRequireDefault$26(require_encoder());
|
|
1225
|
+
var _Barcode3$9 = _interopRequireDefault$26(require_Barcode());
|
|
1226
|
+
function _interopRequireDefault$26(obj) {
|
|
1227
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1228
|
+
}
|
|
1229
|
+
function _classCallCheck$20(instance, Constructor) {
|
|
1230
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1231
|
+
}
|
|
1232
|
+
function _possibleConstructorReturn$16(self, call) {
|
|
1233
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1234
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1235
|
+
}
|
|
1236
|
+
function _inherits$16(subClass, superClass) {
|
|
1237
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1238
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1239
|
+
value: subClass,
|
|
1240
|
+
enumerable: false,
|
|
1241
|
+
writable: true,
|
|
1242
|
+
configurable: true
|
|
1243
|
+
} });
|
|
1244
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1245
|
+
}
|
|
1246
|
+
var checksum$2 = function checksum$5(data) {
|
|
1247
|
+
return data.split("").map(function(n) {
|
|
1248
|
+
return +n;
|
|
1249
|
+
}).reduce(function(sum, a, idx) {
|
|
1250
|
+
return idx % 2 ? sum + a * 9 : sum + a * 3;
|
|
1251
|
+
}, 0) % 10;
|
|
1252
|
+
};
|
|
1253
|
+
exports.default = function(_Barcode) {
|
|
1254
|
+
_inherits$16(EAN5$1, _Barcode);
|
|
1255
|
+
function EAN5$1(data, options) {
|
|
1256
|
+
_classCallCheck$20(this, EAN5$1);
|
|
1257
|
+
return _possibleConstructorReturn$16(this, (EAN5$1.__proto__ || Object.getPrototypeOf(EAN5$1)).call(this, data, options));
|
|
1258
|
+
}
|
|
1259
|
+
_createClass$15(EAN5$1, [{
|
|
1260
|
+
key: "valid",
|
|
1261
|
+
value: function valid() {
|
|
1262
|
+
return this.data.search(/^[0-9]{5}$/) !== -1;
|
|
1263
|
+
}
|
|
1264
|
+
}, {
|
|
1265
|
+
key: "encode",
|
|
1266
|
+
value: function encode$2() {
|
|
1267
|
+
var structure = _constants$3.EAN5_STRUCTURE[checksum$2(this.data)];
|
|
1268
|
+
return {
|
|
1269
|
+
data: "1011" + (0, _encoder2$3.default)(this.data, structure, "01"),
|
|
1270
|
+
text: this.text
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
}]);
|
|
1274
|
+
return EAN5$1;
|
|
1275
|
+
}(_Barcode3$9.default);
|
|
1276
|
+
}));
|
|
1277
|
+
var require_EAN2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1278
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1279
|
+
var _createClass$14 = function() {
|
|
1280
|
+
function defineProperties(target, props) {
|
|
1281
|
+
for (var i = 0; i < props.length; i++) {
|
|
1282
|
+
var descriptor = props[i];
|
|
1283
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1284
|
+
descriptor.configurable = true;
|
|
1285
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1286
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1290
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1291
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1292
|
+
return Constructor;
|
|
1293
|
+
};
|
|
1294
|
+
}();
|
|
1295
|
+
var _constants$2 = require_constants$2();
|
|
1296
|
+
var _encoder2$2 = _interopRequireDefault$25(require_encoder());
|
|
1297
|
+
var _Barcode3$8 = _interopRequireDefault$25(require_Barcode());
|
|
1298
|
+
function _interopRequireDefault$25(obj) {
|
|
1299
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1300
|
+
}
|
|
1301
|
+
function _classCallCheck$19(instance, Constructor) {
|
|
1302
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1303
|
+
}
|
|
1304
|
+
function _possibleConstructorReturn$15(self, call) {
|
|
1305
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1306
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1307
|
+
}
|
|
1308
|
+
function _inherits$15(subClass, superClass) {
|
|
1309
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1310
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1311
|
+
value: subClass,
|
|
1312
|
+
enumerable: false,
|
|
1313
|
+
writable: true,
|
|
1314
|
+
configurable: true
|
|
1315
|
+
} });
|
|
1316
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1317
|
+
}
|
|
1318
|
+
exports.default = function(_Barcode) {
|
|
1319
|
+
_inherits$15(EAN2$1, _Barcode);
|
|
1320
|
+
function EAN2$1(data, options) {
|
|
1321
|
+
_classCallCheck$19(this, EAN2$1);
|
|
1322
|
+
return _possibleConstructorReturn$15(this, (EAN2$1.__proto__ || Object.getPrototypeOf(EAN2$1)).call(this, data, options));
|
|
1323
|
+
}
|
|
1324
|
+
_createClass$14(EAN2$1, [{
|
|
1325
|
+
key: "valid",
|
|
1326
|
+
value: function valid() {
|
|
1327
|
+
return this.data.search(/^[0-9]{2}$/) !== -1;
|
|
1328
|
+
}
|
|
1329
|
+
}, {
|
|
1330
|
+
key: "encode",
|
|
1331
|
+
value: function encode$2() {
|
|
1332
|
+
var structure = _constants$2.EAN2_STRUCTURE[parseInt(this.data) % 4];
|
|
1333
|
+
return {
|
|
1334
|
+
data: "1011" + (0, _encoder2$2.default)(this.data, structure, "01"),
|
|
1335
|
+
text: this.text
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
}]);
|
|
1339
|
+
return EAN2$1;
|
|
1340
|
+
}(_Barcode3$8.default);
|
|
1341
|
+
}));
|
|
1342
|
+
var require_UPC = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1343
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1344
|
+
var _createClass$13 = function() {
|
|
1345
|
+
function defineProperties(target, props) {
|
|
1346
|
+
for (var i = 0; i < props.length; i++) {
|
|
1347
|
+
var descriptor = props[i];
|
|
1348
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1349
|
+
descriptor.configurable = true;
|
|
1350
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1351
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1355
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1356
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1357
|
+
return Constructor;
|
|
1358
|
+
};
|
|
1359
|
+
}();
|
|
1360
|
+
exports.checksum = checksum$1;
|
|
1361
|
+
var _encoder2$1 = _interopRequireDefault$24(require_encoder());
|
|
1362
|
+
var _Barcode3$7 = _interopRequireDefault$24(require_Barcode());
|
|
1363
|
+
function _interopRequireDefault$24(obj) {
|
|
1364
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1365
|
+
}
|
|
1366
|
+
function _classCallCheck$18(instance, Constructor) {
|
|
1367
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1368
|
+
}
|
|
1369
|
+
function _possibleConstructorReturn$14(self, call) {
|
|
1370
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1371
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1372
|
+
}
|
|
1373
|
+
function _inherits$14(subClass, superClass) {
|
|
1374
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1375
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1376
|
+
value: subClass,
|
|
1377
|
+
enumerable: false,
|
|
1378
|
+
writable: true,
|
|
1379
|
+
configurable: true
|
|
1380
|
+
} });
|
|
1381
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1382
|
+
}
|
|
1383
|
+
var UPC = function(_Barcode) {
|
|
1384
|
+
_inherits$14(UPC$1, _Barcode);
|
|
1385
|
+
function UPC$1(data, options) {
|
|
1386
|
+
_classCallCheck$18(this, UPC$1);
|
|
1387
|
+
if (data.search(/^[0-9]{11}$/) !== -1) data += checksum$1(data);
|
|
1388
|
+
var _this = _possibleConstructorReturn$14(this, (UPC$1.__proto__ || Object.getPrototypeOf(UPC$1)).call(this, data, options));
|
|
1389
|
+
_this.displayValue = options.displayValue;
|
|
1390
|
+
if (options.fontSize > options.width * 10) _this.fontSize = options.width * 10;
|
|
1391
|
+
else _this.fontSize = options.fontSize;
|
|
1392
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
1393
|
+
return _this;
|
|
1394
|
+
}
|
|
1395
|
+
_createClass$13(UPC$1, [
|
|
1396
|
+
{
|
|
1397
|
+
key: "valid",
|
|
1398
|
+
value: function valid() {
|
|
1399
|
+
return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum$1(this.data);
|
|
1400
|
+
}
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
key: "encode",
|
|
1404
|
+
value: function encode$2() {
|
|
1405
|
+
if (this.options.flat) return this.flatEncoding();
|
|
1406
|
+
else return this.guardedEncoding();
|
|
1407
|
+
}
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
key: "flatEncoding",
|
|
1411
|
+
value: function flatEncoding() {
|
|
1412
|
+
var result = "";
|
|
1413
|
+
result += "101";
|
|
1414
|
+
result += (0, _encoder2$1.default)(this.data.substr(0, 6), "LLLLLL");
|
|
1415
|
+
result += "01010";
|
|
1416
|
+
result += (0, _encoder2$1.default)(this.data.substr(6, 6), "RRRRRR");
|
|
1417
|
+
result += "101";
|
|
1418
|
+
return {
|
|
1419
|
+
data: result,
|
|
1420
|
+
text: this.text
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
key: "guardedEncoding",
|
|
1426
|
+
value: function guardedEncoding() {
|
|
1427
|
+
var result = [];
|
|
1428
|
+
if (this.displayValue) result.push({
|
|
1429
|
+
data: "00000000",
|
|
1430
|
+
text: this.text.substr(0, 1),
|
|
1431
|
+
options: {
|
|
1432
|
+
textAlign: "left",
|
|
1433
|
+
fontSize: this.fontSize
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
result.push({
|
|
1437
|
+
data: "101" + (0, _encoder2$1.default)(this.data[0], "L"),
|
|
1438
|
+
options: { height: this.guardHeight }
|
|
1439
|
+
});
|
|
1440
|
+
result.push({
|
|
1441
|
+
data: (0, _encoder2$1.default)(this.data.substr(1, 5), "LLLLL"),
|
|
1442
|
+
text: this.text.substr(1, 5),
|
|
1443
|
+
options: { fontSize: this.fontSize }
|
|
1444
|
+
});
|
|
1445
|
+
result.push({
|
|
1446
|
+
data: "01010",
|
|
1447
|
+
options: { height: this.guardHeight }
|
|
1448
|
+
});
|
|
1449
|
+
result.push({
|
|
1450
|
+
data: (0, _encoder2$1.default)(this.data.substr(6, 5), "RRRRR"),
|
|
1451
|
+
text: this.text.substr(6, 5),
|
|
1452
|
+
options: { fontSize: this.fontSize }
|
|
1453
|
+
});
|
|
1454
|
+
result.push({
|
|
1455
|
+
data: (0, _encoder2$1.default)(this.data[11], "R") + "101",
|
|
1456
|
+
options: { height: this.guardHeight }
|
|
1457
|
+
});
|
|
1458
|
+
if (this.displayValue) result.push({
|
|
1459
|
+
data: "00000000",
|
|
1460
|
+
text: this.text.substr(11, 1),
|
|
1461
|
+
options: {
|
|
1462
|
+
textAlign: "right",
|
|
1463
|
+
fontSize: this.fontSize
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
return result;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
]);
|
|
1470
|
+
return UPC$1;
|
|
1471
|
+
}(_Barcode3$7.default);
|
|
1472
|
+
function checksum$1(number) {
|
|
1473
|
+
var result = 0;
|
|
1474
|
+
var i;
|
|
1475
|
+
for (i = 1; i < 11; i += 2) result += parseInt(number[i]);
|
|
1476
|
+
for (i = 0; i < 11; i += 2) result += parseInt(number[i]) * 3;
|
|
1477
|
+
return (10 - result % 10) % 10;
|
|
1478
|
+
}
|
|
1479
|
+
exports.default = UPC;
|
|
1480
|
+
}));
|
|
1481
|
+
var require_UPCE = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1482
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1483
|
+
var _createClass$12 = function() {
|
|
1484
|
+
function defineProperties(target, props) {
|
|
1485
|
+
for (var i = 0; i < props.length; i++) {
|
|
1486
|
+
var descriptor = props[i];
|
|
1487
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1488
|
+
descriptor.configurable = true;
|
|
1489
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1490
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1494
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1495
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1496
|
+
return Constructor;
|
|
1497
|
+
};
|
|
1498
|
+
}();
|
|
1499
|
+
var _encoder2 = _interopRequireDefault$23(require_encoder());
|
|
1500
|
+
var _Barcode3$6 = _interopRequireDefault$23(require_Barcode());
|
|
1501
|
+
var _UPC = require_UPC();
|
|
1502
|
+
function _interopRequireDefault$23(obj) {
|
|
1503
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1504
|
+
}
|
|
1505
|
+
function _classCallCheck$17(instance, Constructor) {
|
|
1506
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1507
|
+
}
|
|
1508
|
+
function _possibleConstructorReturn$13(self, call) {
|
|
1509
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1510
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1511
|
+
}
|
|
1512
|
+
function _inherits$13(subClass, superClass) {
|
|
1513
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1514
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1515
|
+
value: subClass,
|
|
1516
|
+
enumerable: false,
|
|
1517
|
+
writable: true,
|
|
1518
|
+
configurable: true
|
|
1519
|
+
} });
|
|
1520
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1521
|
+
}
|
|
1522
|
+
var EXPANSIONS = [
|
|
1523
|
+
"XX00000XXX",
|
|
1524
|
+
"XX10000XXX",
|
|
1525
|
+
"XX20000XXX",
|
|
1526
|
+
"XXX00000XX",
|
|
1527
|
+
"XXXX00000X",
|
|
1528
|
+
"XXXXX00005",
|
|
1529
|
+
"XXXXX00006",
|
|
1530
|
+
"XXXXX00007",
|
|
1531
|
+
"XXXXX00008",
|
|
1532
|
+
"XXXXX00009"
|
|
1533
|
+
];
|
|
1534
|
+
var PARITIES = [
|
|
1535
|
+
["EEEOOO", "OOOEEE"],
|
|
1536
|
+
["EEOEOO", "OOEOEE"],
|
|
1537
|
+
["EEOOEO", "OOEEOE"],
|
|
1538
|
+
["EEOOOE", "OOEEEO"],
|
|
1539
|
+
["EOEEOO", "OEOOEE"],
|
|
1540
|
+
["EOOEEO", "OEEOOE"],
|
|
1541
|
+
["EOOOEE", "OEEEOO"],
|
|
1542
|
+
["EOEOEO", "OEOEOE"],
|
|
1543
|
+
["EOEOOE", "OEOEEO"],
|
|
1544
|
+
["EOOEOE", "OEEOEO"]
|
|
1545
|
+
];
|
|
1546
|
+
var UPCE = function(_Barcode) {
|
|
1547
|
+
_inherits$13(UPCE$1, _Barcode);
|
|
1548
|
+
function UPCE$1(data, options) {
|
|
1549
|
+
_classCallCheck$17(this, UPCE$1);
|
|
1550
|
+
var _this = _possibleConstructorReturn$13(this, (UPCE$1.__proto__ || Object.getPrototypeOf(UPCE$1)).call(this, data, options));
|
|
1551
|
+
_this.isValid = false;
|
|
1552
|
+
if (data.search(/^[0-9]{6}$/) !== -1) {
|
|
1553
|
+
_this.middleDigits = data;
|
|
1554
|
+
_this.upcA = expandToUPCA(data, "0");
|
|
1555
|
+
_this.text = options.text || "" + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1];
|
|
1556
|
+
_this.isValid = true;
|
|
1557
|
+
} else if (data.search(/^[01][0-9]{7}$/) !== -1) {
|
|
1558
|
+
_this.middleDigits = data.substring(1, data.length - 1);
|
|
1559
|
+
_this.upcA = expandToUPCA(_this.middleDigits, data[0]);
|
|
1560
|
+
if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) _this.isValid = true;
|
|
1561
|
+
else return _possibleConstructorReturn$13(_this);
|
|
1562
|
+
} else return _possibleConstructorReturn$13(_this);
|
|
1563
|
+
_this.displayValue = options.displayValue;
|
|
1564
|
+
if (options.fontSize > options.width * 10) _this.fontSize = options.width * 10;
|
|
1565
|
+
else _this.fontSize = options.fontSize;
|
|
1566
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
1567
|
+
return _this;
|
|
1568
|
+
}
|
|
1569
|
+
_createClass$12(UPCE$1, [
|
|
1570
|
+
{
|
|
1571
|
+
key: "valid",
|
|
1572
|
+
value: function valid() {
|
|
1573
|
+
return this.isValid;
|
|
1574
|
+
}
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
key: "encode",
|
|
1578
|
+
value: function encode$2() {
|
|
1579
|
+
if (this.options.flat) return this.flatEncoding();
|
|
1580
|
+
else return this.guardedEncoding();
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
key: "flatEncoding",
|
|
1585
|
+
value: function flatEncoding() {
|
|
1586
|
+
var result = "";
|
|
1587
|
+
result += "101";
|
|
1588
|
+
result += this.encodeMiddleDigits();
|
|
1589
|
+
result += "010101";
|
|
1590
|
+
return {
|
|
1591
|
+
data: result,
|
|
1592
|
+
text: this.text
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
key: "guardedEncoding",
|
|
1598
|
+
value: function guardedEncoding() {
|
|
1599
|
+
var result = [];
|
|
1600
|
+
if (this.displayValue) result.push({
|
|
1601
|
+
data: "00000000",
|
|
1602
|
+
text: this.text[0],
|
|
1603
|
+
options: {
|
|
1604
|
+
textAlign: "left",
|
|
1605
|
+
fontSize: this.fontSize
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
result.push({
|
|
1609
|
+
data: "101",
|
|
1610
|
+
options: { height: this.guardHeight }
|
|
1611
|
+
});
|
|
1612
|
+
result.push({
|
|
1613
|
+
data: this.encodeMiddleDigits(),
|
|
1614
|
+
text: this.text.substring(1, 7),
|
|
1615
|
+
options: { fontSize: this.fontSize }
|
|
1616
|
+
});
|
|
1617
|
+
result.push({
|
|
1618
|
+
data: "010101",
|
|
1619
|
+
options: { height: this.guardHeight }
|
|
1620
|
+
});
|
|
1621
|
+
if (this.displayValue) result.push({
|
|
1622
|
+
data: "00000000",
|
|
1623
|
+
text: this.text[7],
|
|
1624
|
+
options: {
|
|
1625
|
+
textAlign: "right",
|
|
1626
|
+
fontSize: this.fontSize
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
return result;
|
|
1630
|
+
}
|
|
1631
|
+
},
|
|
1632
|
+
{
|
|
1633
|
+
key: "encodeMiddleDigits",
|
|
1634
|
+
value: function encodeMiddleDigits() {
|
|
1635
|
+
var numberSystem = this.upcA[0];
|
|
1636
|
+
var checkDigit = this.upcA[this.upcA.length - 1];
|
|
1637
|
+
var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)];
|
|
1638
|
+
return (0, _encoder2.default)(this.middleDigits, parity);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
]);
|
|
1642
|
+
return UPCE$1;
|
|
1643
|
+
}(_Barcode3$6.default);
|
|
1644
|
+
function expandToUPCA(middleDigits, numberSystem) {
|
|
1645
|
+
var expansion = EXPANSIONS[parseInt(middleDigits[middleDigits.length - 1])];
|
|
1646
|
+
var result = "";
|
|
1647
|
+
var digitIndex = 0;
|
|
1648
|
+
for (var i = 0; i < expansion.length; i++) {
|
|
1649
|
+
var c = expansion[i];
|
|
1650
|
+
if (c === "X") result += middleDigits[digitIndex++];
|
|
1651
|
+
else result += c;
|
|
1652
|
+
}
|
|
1653
|
+
result = "" + numberSystem + result;
|
|
1654
|
+
return "" + result + (0, _UPC.checksum)(result);
|
|
1655
|
+
}
|
|
1656
|
+
exports.default = UPCE;
|
|
1657
|
+
}));
|
|
1658
|
+
var require_EAN_UPC = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1659
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1660
|
+
exports.UPCE = exports.UPC = exports.EAN2 = exports.EAN5 = exports.EAN8 = exports.EAN13 = void 0;
|
|
1661
|
+
var _EAN2 = _interopRequireDefault$22(require_EAN13());
|
|
1662
|
+
var _EAN4 = _interopRequireDefault$22(require_EAN8());
|
|
1663
|
+
var _EAN6 = _interopRequireDefault$22(require_EAN5());
|
|
1664
|
+
var _EAN8 = _interopRequireDefault$22(require_EAN2());
|
|
1665
|
+
var _UPC2 = _interopRequireDefault$22(require_UPC());
|
|
1666
|
+
var _UPCE2 = _interopRequireDefault$22(require_UPCE());
|
|
1667
|
+
function _interopRequireDefault$22(obj) {
|
|
1668
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1669
|
+
}
|
|
1670
|
+
exports.EAN13 = _EAN2.default;
|
|
1671
|
+
exports.EAN8 = _EAN4.default;
|
|
1672
|
+
exports.EAN5 = _EAN6.default;
|
|
1673
|
+
exports.EAN2 = _EAN8.default;
|
|
1674
|
+
exports.UPC = _UPC2.default;
|
|
1675
|
+
exports.UPCE = _UPCE2.default;
|
|
1676
|
+
}));
|
|
1677
|
+
var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1678
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1679
|
+
exports.START_BIN = "1010";
|
|
1680
|
+
exports.END_BIN = "11101";
|
|
1681
|
+
exports.BINARIES = [
|
|
1682
|
+
"00110",
|
|
1683
|
+
"10001",
|
|
1684
|
+
"01001",
|
|
1685
|
+
"11000",
|
|
1686
|
+
"00101",
|
|
1687
|
+
"10100",
|
|
1688
|
+
"01100",
|
|
1689
|
+
"00011",
|
|
1690
|
+
"10010",
|
|
1691
|
+
"01010"
|
|
1692
|
+
];
|
|
1693
|
+
}));
|
|
1694
|
+
var require_ITF$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1695
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1696
|
+
var _createClass$11 = function() {
|
|
1697
|
+
function defineProperties(target, props) {
|
|
1698
|
+
for (var i = 0; i < props.length; i++) {
|
|
1699
|
+
var descriptor = props[i];
|
|
1700
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1701
|
+
descriptor.configurable = true;
|
|
1702
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1703
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1707
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1708
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1709
|
+
return Constructor;
|
|
1710
|
+
};
|
|
1711
|
+
}();
|
|
1712
|
+
var _constants$1 = require_constants$1();
|
|
1713
|
+
var _Barcode3$5 = _interopRequireDefault$21(require_Barcode());
|
|
1714
|
+
function _interopRequireDefault$21(obj) {
|
|
1715
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1716
|
+
}
|
|
1717
|
+
function _classCallCheck$16(instance, Constructor) {
|
|
1718
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1719
|
+
}
|
|
1720
|
+
function _possibleConstructorReturn$12(self, call) {
|
|
1721
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1722
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1723
|
+
}
|
|
1724
|
+
function _inherits$12(subClass, superClass) {
|
|
1725
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1726
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1727
|
+
value: subClass,
|
|
1728
|
+
enumerable: false,
|
|
1729
|
+
writable: true,
|
|
1730
|
+
configurable: true
|
|
1731
|
+
} });
|
|
1732
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1733
|
+
}
|
|
1734
|
+
exports.default = function(_Barcode) {
|
|
1735
|
+
_inherits$12(ITF$1, _Barcode);
|
|
1736
|
+
function ITF$1() {
|
|
1737
|
+
_classCallCheck$16(this, ITF$1);
|
|
1738
|
+
return _possibleConstructorReturn$12(this, (ITF$1.__proto__ || Object.getPrototypeOf(ITF$1)).apply(this, arguments));
|
|
1739
|
+
}
|
|
1740
|
+
_createClass$11(ITF$1, [
|
|
1741
|
+
{
|
|
1742
|
+
key: "valid",
|
|
1743
|
+
value: function valid() {
|
|
1744
|
+
return this.data.search(/^([0-9]{2})+$/) !== -1;
|
|
1745
|
+
}
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
key: "encode",
|
|
1749
|
+
value: function encode$2() {
|
|
1750
|
+
var _this2 = this;
|
|
1751
|
+
var encoded = this.data.match(/.{2}/g).map(function(pair) {
|
|
1752
|
+
return _this2.encodePair(pair);
|
|
1753
|
+
}).join("");
|
|
1754
|
+
return {
|
|
1755
|
+
data: _constants$1.START_BIN + encoded + _constants$1.END_BIN,
|
|
1756
|
+
text: this.text
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
key: "encodePair",
|
|
1762
|
+
value: function encodePair(pair) {
|
|
1763
|
+
var second = _constants$1.BINARIES[pair[1]];
|
|
1764
|
+
return _constants$1.BINARIES[pair[0]].split("").map(function(first, idx) {
|
|
1765
|
+
return (first === "1" ? "111" : "1") + (second[idx] === "1" ? "000" : "0");
|
|
1766
|
+
}).join("");
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
]);
|
|
1770
|
+
return ITF$1;
|
|
1771
|
+
}(_Barcode3$5.default);
|
|
1772
|
+
}));
|
|
1773
|
+
var require_ITF14 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1774
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1775
|
+
var _createClass$10 = function() {
|
|
1776
|
+
function defineProperties(target, props) {
|
|
1777
|
+
for (var i = 0; i < props.length; i++) {
|
|
1778
|
+
var descriptor = props[i];
|
|
1779
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1780
|
+
descriptor.configurable = true;
|
|
1781
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1782
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1786
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1787
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1788
|
+
return Constructor;
|
|
1789
|
+
};
|
|
1790
|
+
}();
|
|
1791
|
+
var _ITF3 = _interopRequireDefault$20(require_ITF$1());
|
|
1792
|
+
function _interopRequireDefault$20(obj) {
|
|
1793
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1794
|
+
}
|
|
1795
|
+
function _classCallCheck$15(instance, Constructor) {
|
|
1796
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1797
|
+
}
|
|
1798
|
+
function _possibleConstructorReturn$11(self, call) {
|
|
1799
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1800
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1801
|
+
}
|
|
1802
|
+
function _inherits$11(subClass, superClass) {
|
|
1803
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1804
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1805
|
+
value: subClass,
|
|
1806
|
+
enumerable: false,
|
|
1807
|
+
writable: true,
|
|
1808
|
+
configurable: true
|
|
1809
|
+
} });
|
|
1810
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1811
|
+
}
|
|
1812
|
+
var checksum = function checksum$5(data) {
|
|
1813
|
+
var res = data.substr(0, 13).split("").map(function(num) {
|
|
1814
|
+
return parseInt(num, 10);
|
|
1815
|
+
}).reduce(function(sum, n, idx) {
|
|
1816
|
+
return sum + n * (3 - idx % 2 * 2);
|
|
1817
|
+
}, 0);
|
|
1818
|
+
return Math.ceil(res / 10) * 10 - res;
|
|
1819
|
+
};
|
|
1820
|
+
exports.default = function(_ITF$1) {
|
|
1821
|
+
_inherits$11(ITF14$1, _ITF$1);
|
|
1822
|
+
function ITF14$1(data, options) {
|
|
1823
|
+
_classCallCheck$15(this, ITF14$1);
|
|
1824
|
+
if (data.search(/^[0-9]{13}$/) !== -1) data += checksum(data);
|
|
1825
|
+
return _possibleConstructorReturn$11(this, (ITF14$1.__proto__ || Object.getPrototypeOf(ITF14$1)).call(this, data, options));
|
|
1826
|
+
}
|
|
1827
|
+
_createClass$10(ITF14$1, [{
|
|
1828
|
+
key: "valid",
|
|
1829
|
+
value: function valid() {
|
|
1830
|
+
return this.data.search(/^[0-9]{14}$/) !== -1 && +this.data[13] === checksum(this.data);
|
|
1831
|
+
}
|
|
1832
|
+
}]);
|
|
1833
|
+
return ITF14$1;
|
|
1834
|
+
}(_ITF3.default);
|
|
1835
|
+
}));
|
|
1836
|
+
var require_ITF = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1837
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1838
|
+
exports.ITF14 = exports.ITF = void 0;
|
|
1839
|
+
var _ITF2 = _interopRequireDefault$19(require_ITF$1());
|
|
1840
|
+
var _ITF4 = _interopRequireDefault$19(require_ITF14());
|
|
1841
|
+
function _interopRequireDefault$19(obj) {
|
|
1842
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1843
|
+
}
|
|
1844
|
+
exports.ITF = _ITF2.default;
|
|
1845
|
+
exports.ITF14 = _ITF4.default;
|
|
1846
|
+
}));
|
|
1847
|
+
var require_MSI$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1848
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1849
|
+
var _createClass$9 = function() {
|
|
1850
|
+
function defineProperties(target, props) {
|
|
1851
|
+
for (var i = 0; i < props.length; i++) {
|
|
1852
|
+
var descriptor = props[i];
|
|
1853
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1854
|
+
descriptor.configurable = true;
|
|
1855
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1856
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
return function(Constructor, protoProps, staticProps) {
|
|
1860
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1861
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1862
|
+
return Constructor;
|
|
1863
|
+
};
|
|
1864
|
+
}();
|
|
1865
|
+
var _Barcode3$4 = _interopRequireDefault$18(require_Barcode());
|
|
1866
|
+
function _interopRequireDefault$18(obj) {
|
|
1867
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1868
|
+
}
|
|
1869
|
+
function _classCallCheck$14(instance, Constructor) {
|
|
1870
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1871
|
+
}
|
|
1872
|
+
function _possibleConstructorReturn$10(self, call) {
|
|
1873
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1874
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1875
|
+
}
|
|
1876
|
+
function _inherits$10(subClass, superClass) {
|
|
1877
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1878
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1879
|
+
value: subClass,
|
|
1880
|
+
enumerable: false,
|
|
1881
|
+
writable: true,
|
|
1882
|
+
configurable: true
|
|
1883
|
+
} });
|
|
1884
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1885
|
+
}
|
|
1886
|
+
var MSI = function(_Barcode) {
|
|
1887
|
+
_inherits$10(MSI$1, _Barcode);
|
|
1888
|
+
function MSI$1(data, options) {
|
|
1889
|
+
_classCallCheck$14(this, MSI$1);
|
|
1890
|
+
return _possibleConstructorReturn$10(this, (MSI$1.__proto__ || Object.getPrototypeOf(MSI$1)).call(this, data, options));
|
|
1891
|
+
}
|
|
1892
|
+
_createClass$9(MSI$1, [{
|
|
1893
|
+
key: "encode",
|
|
1894
|
+
value: function encode$2() {
|
|
1895
|
+
var ret = "110";
|
|
1896
|
+
for (var i = 0; i < this.data.length; i++) {
|
|
1897
|
+
var bin = parseInt(this.data[i]).toString(2);
|
|
1898
|
+
bin = addZeroes(bin, 4 - bin.length);
|
|
1899
|
+
for (var b = 0; b < bin.length; b++) ret += bin[b] == "0" ? "100" : "110";
|
|
1900
|
+
}
|
|
1901
|
+
ret += "1001";
|
|
1902
|
+
return {
|
|
1903
|
+
data: ret,
|
|
1904
|
+
text: this.text
|
|
1905
|
+
};
|
|
1906
|
+
}
|
|
1907
|
+
}, {
|
|
1908
|
+
key: "valid",
|
|
1909
|
+
value: function valid() {
|
|
1910
|
+
return this.data.search(/^[0-9]+$/) !== -1;
|
|
1911
|
+
}
|
|
1912
|
+
}]);
|
|
1913
|
+
return MSI$1;
|
|
1914
|
+
}(_Barcode3$4.default);
|
|
1915
|
+
function addZeroes(number, n) {
|
|
1916
|
+
for (var i = 0; i < n; i++) number = "0" + number;
|
|
1917
|
+
return number;
|
|
1918
|
+
}
|
|
1919
|
+
exports.default = MSI;
|
|
1920
|
+
}));
|
|
1921
|
+
var require_checksums = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1922
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1923
|
+
exports.mod10 = mod10;
|
|
1924
|
+
exports.mod11 = mod11;
|
|
1925
|
+
function mod10(number) {
|
|
1926
|
+
var sum = 0;
|
|
1927
|
+
for (var i = 0; i < number.length; i++) {
|
|
1928
|
+
var n = parseInt(number[i]);
|
|
1929
|
+
if ((i + number.length) % 2 === 0) sum += n;
|
|
1930
|
+
else sum += n * 2 % 10 + Math.floor(n * 2 / 10);
|
|
1931
|
+
}
|
|
1932
|
+
return (10 - sum % 10) % 10;
|
|
1933
|
+
}
|
|
1934
|
+
function mod11(number) {
|
|
1935
|
+
var sum = 0;
|
|
1936
|
+
var weights = [
|
|
1937
|
+
2,
|
|
1938
|
+
3,
|
|
1939
|
+
4,
|
|
1940
|
+
5,
|
|
1941
|
+
6,
|
|
1942
|
+
7
|
|
1943
|
+
];
|
|
1944
|
+
for (var i = 0; i < number.length; i++) {
|
|
1945
|
+
var n = parseInt(number[number.length - 1 - i]);
|
|
1946
|
+
sum += weights[i % weights.length] * n;
|
|
1947
|
+
}
|
|
1948
|
+
return (11 - sum % 11) % 11;
|
|
1949
|
+
}
|
|
1950
|
+
}));
|
|
1951
|
+
var require_MSI10 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1952
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1953
|
+
var _MSI3$3 = _interopRequireDefault$17(require_MSI$1());
|
|
1954
|
+
var _checksums$3 = require_checksums();
|
|
1955
|
+
function _interopRequireDefault$17(obj) {
|
|
1956
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1957
|
+
}
|
|
1958
|
+
function _classCallCheck$13(instance, Constructor) {
|
|
1959
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1960
|
+
}
|
|
1961
|
+
function _possibleConstructorReturn$9(self, call) {
|
|
1962
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1963
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1964
|
+
}
|
|
1965
|
+
function _inherits$9(subClass, superClass) {
|
|
1966
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1967
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
1968
|
+
value: subClass,
|
|
1969
|
+
enumerable: false,
|
|
1970
|
+
writable: true,
|
|
1971
|
+
configurable: true
|
|
1972
|
+
} });
|
|
1973
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1974
|
+
}
|
|
1975
|
+
exports.default = function(_MSI$1) {
|
|
1976
|
+
_inherits$9(MSI10$1, _MSI$1);
|
|
1977
|
+
function MSI10$1(data, options) {
|
|
1978
|
+
_classCallCheck$13(this, MSI10$1);
|
|
1979
|
+
return _possibleConstructorReturn$9(this, (MSI10$1.__proto__ || Object.getPrototypeOf(MSI10$1)).call(this, data + (0, _checksums$3.mod10)(data), options));
|
|
1980
|
+
}
|
|
1981
|
+
return MSI10$1;
|
|
1982
|
+
}(_MSI3$3.default);
|
|
1983
|
+
}));
|
|
1984
|
+
var require_MSI11 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1985
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1986
|
+
var _MSI3$2 = _interopRequireDefault$16(require_MSI$1());
|
|
1987
|
+
var _checksums$2 = require_checksums();
|
|
1988
|
+
function _interopRequireDefault$16(obj) {
|
|
1989
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1990
|
+
}
|
|
1991
|
+
function _classCallCheck$12(instance, Constructor) {
|
|
1992
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
1993
|
+
}
|
|
1994
|
+
function _possibleConstructorReturn$8(self, call) {
|
|
1995
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1996
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1997
|
+
}
|
|
1998
|
+
function _inherits$8(subClass, superClass) {
|
|
1999
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2000
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2001
|
+
value: subClass,
|
|
2002
|
+
enumerable: false,
|
|
2003
|
+
writable: true,
|
|
2004
|
+
configurable: true
|
|
2005
|
+
} });
|
|
2006
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2007
|
+
}
|
|
2008
|
+
exports.default = function(_MSI$1) {
|
|
2009
|
+
_inherits$8(MSI11$1, _MSI$1);
|
|
2010
|
+
function MSI11$1(data, options) {
|
|
2011
|
+
_classCallCheck$12(this, MSI11$1);
|
|
2012
|
+
return _possibleConstructorReturn$8(this, (MSI11$1.__proto__ || Object.getPrototypeOf(MSI11$1)).call(this, data + (0, _checksums$2.mod11)(data), options));
|
|
2013
|
+
}
|
|
2014
|
+
return MSI11$1;
|
|
2015
|
+
}(_MSI3$2.default);
|
|
2016
|
+
}));
|
|
2017
|
+
var require_MSI1010 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2018
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2019
|
+
var _MSI3$1 = _interopRequireDefault$15(require_MSI$1());
|
|
2020
|
+
var _checksums$1 = require_checksums();
|
|
2021
|
+
function _interopRequireDefault$15(obj) {
|
|
2022
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2023
|
+
}
|
|
2024
|
+
function _classCallCheck$11(instance, Constructor) {
|
|
2025
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2026
|
+
}
|
|
2027
|
+
function _possibleConstructorReturn$7(self, call) {
|
|
2028
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2029
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2030
|
+
}
|
|
2031
|
+
function _inherits$7(subClass, superClass) {
|
|
2032
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2033
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2034
|
+
value: subClass,
|
|
2035
|
+
enumerable: false,
|
|
2036
|
+
writable: true,
|
|
2037
|
+
configurable: true
|
|
2038
|
+
} });
|
|
2039
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2040
|
+
}
|
|
2041
|
+
exports.default = function(_MSI$1) {
|
|
2042
|
+
_inherits$7(MSI1010$1, _MSI$1);
|
|
2043
|
+
function MSI1010$1(data, options) {
|
|
2044
|
+
_classCallCheck$11(this, MSI1010$1);
|
|
2045
|
+
data += (0, _checksums$1.mod10)(data);
|
|
2046
|
+
data += (0, _checksums$1.mod10)(data);
|
|
2047
|
+
return _possibleConstructorReturn$7(this, (MSI1010$1.__proto__ || Object.getPrototypeOf(MSI1010$1)).call(this, data, options));
|
|
2048
|
+
}
|
|
2049
|
+
return MSI1010$1;
|
|
2050
|
+
}(_MSI3$1.default);
|
|
2051
|
+
}));
|
|
2052
|
+
var require_MSI1110 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2053
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2054
|
+
var _MSI3 = _interopRequireDefault$14(require_MSI$1());
|
|
2055
|
+
var _checksums = require_checksums();
|
|
2056
|
+
function _interopRequireDefault$14(obj) {
|
|
2057
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2058
|
+
}
|
|
2059
|
+
function _classCallCheck$10(instance, Constructor) {
|
|
2060
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2061
|
+
}
|
|
2062
|
+
function _possibleConstructorReturn$6(self, call) {
|
|
2063
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2064
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2065
|
+
}
|
|
2066
|
+
function _inherits$6(subClass, superClass) {
|
|
2067
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2068
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2069
|
+
value: subClass,
|
|
2070
|
+
enumerable: false,
|
|
2071
|
+
writable: true,
|
|
2072
|
+
configurable: true
|
|
2073
|
+
} });
|
|
2074
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2075
|
+
}
|
|
2076
|
+
exports.default = function(_MSI$1) {
|
|
2077
|
+
_inherits$6(MSI1110$1, _MSI$1);
|
|
2078
|
+
function MSI1110$1(data, options) {
|
|
2079
|
+
_classCallCheck$10(this, MSI1110$1);
|
|
2080
|
+
data += (0, _checksums.mod11)(data);
|
|
2081
|
+
data += (0, _checksums.mod10)(data);
|
|
2082
|
+
return _possibleConstructorReturn$6(this, (MSI1110$1.__proto__ || Object.getPrototypeOf(MSI1110$1)).call(this, data, options));
|
|
2083
|
+
}
|
|
2084
|
+
return MSI1110$1;
|
|
2085
|
+
}(_MSI3.default);
|
|
2086
|
+
}));
|
|
2087
|
+
var require_MSI = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2088
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2089
|
+
exports.MSI1110 = exports.MSI1010 = exports.MSI11 = exports.MSI10 = exports.MSI = void 0;
|
|
2090
|
+
var _MSI2 = _interopRequireDefault$13(require_MSI$1());
|
|
2091
|
+
var _MSI4 = _interopRequireDefault$13(require_MSI10());
|
|
2092
|
+
var _MSI6 = _interopRequireDefault$13(require_MSI11());
|
|
2093
|
+
var _MSI8 = _interopRequireDefault$13(require_MSI1010());
|
|
2094
|
+
var _MSI10 = _interopRequireDefault$13(require_MSI1110());
|
|
2095
|
+
function _interopRequireDefault$13(obj) {
|
|
2096
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2097
|
+
}
|
|
2098
|
+
exports.MSI = _MSI2.default;
|
|
2099
|
+
exports.MSI10 = _MSI4.default;
|
|
2100
|
+
exports.MSI11 = _MSI6.default;
|
|
2101
|
+
exports.MSI1010 = _MSI8.default;
|
|
2102
|
+
exports.MSI1110 = _MSI10.default;
|
|
2103
|
+
}));
|
|
2104
|
+
var require_pharmacode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2105
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2106
|
+
exports.pharmacode = void 0;
|
|
2107
|
+
var _createClass$8 = function() {
|
|
2108
|
+
function defineProperties(target, props) {
|
|
2109
|
+
for (var i = 0; i < props.length; i++) {
|
|
2110
|
+
var descriptor = props[i];
|
|
2111
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2112
|
+
descriptor.configurable = true;
|
|
2113
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2114
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
return function(Constructor, protoProps, staticProps) {
|
|
2118
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
2119
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
2120
|
+
return Constructor;
|
|
2121
|
+
};
|
|
2122
|
+
}();
|
|
2123
|
+
var _Barcode3$3 = _interopRequireDefault$12(require_Barcode());
|
|
2124
|
+
function _interopRequireDefault$12(obj) {
|
|
2125
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2126
|
+
}
|
|
2127
|
+
function _classCallCheck$9(instance, Constructor) {
|
|
2128
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2129
|
+
}
|
|
2130
|
+
function _possibleConstructorReturn$5(self, call) {
|
|
2131
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2132
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2133
|
+
}
|
|
2134
|
+
function _inherits$5(subClass, superClass) {
|
|
2135
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2136
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2137
|
+
value: subClass,
|
|
2138
|
+
enumerable: false,
|
|
2139
|
+
writable: true,
|
|
2140
|
+
configurable: true
|
|
2141
|
+
} });
|
|
2142
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2143
|
+
}
|
|
2144
|
+
exports.pharmacode = function(_Barcode) {
|
|
2145
|
+
_inherits$5(pharmacode$1, _Barcode);
|
|
2146
|
+
function pharmacode$1(data, options) {
|
|
2147
|
+
_classCallCheck$9(this, pharmacode$1);
|
|
2148
|
+
var _this = _possibleConstructorReturn$5(this, (pharmacode$1.__proto__ || Object.getPrototypeOf(pharmacode$1)).call(this, data, options));
|
|
2149
|
+
_this.number = parseInt(data, 10);
|
|
2150
|
+
return _this;
|
|
2151
|
+
}
|
|
2152
|
+
_createClass$8(pharmacode$1, [{
|
|
2153
|
+
key: "encode",
|
|
2154
|
+
value: function encode$2() {
|
|
2155
|
+
var z = this.number;
|
|
2156
|
+
var result = "";
|
|
2157
|
+
while (!isNaN(z) && z != 0) if (z % 2 === 0) {
|
|
2158
|
+
result = "11100" + result;
|
|
2159
|
+
z = (z - 2) / 2;
|
|
2160
|
+
} else {
|
|
2161
|
+
result = "100" + result;
|
|
2162
|
+
z = (z - 1) / 2;
|
|
2163
|
+
}
|
|
2164
|
+
result = result.slice(0, -2);
|
|
2165
|
+
return {
|
|
2166
|
+
data: result,
|
|
2167
|
+
text: this.text
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
}, {
|
|
2171
|
+
key: "valid",
|
|
2172
|
+
value: function valid() {
|
|
2173
|
+
return this.number >= 3 && this.number <= 131070;
|
|
2174
|
+
}
|
|
2175
|
+
}]);
|
|
2176
|
+
return pharmacode$1;
|
|
2177
|
+
}(_Barcode3$3.default);
|
|
2178
|
+
}));
|
|
2179
|
+
var require_codabar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2180
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2181
|
+
exports.codabar = void 0;
|
|
2182
|
+
var _createClass$7 = function() {
|
|
2183
|
+
function defineProperties(target, props) {
|
|
2184
|
+
for (var i = 0; i < props.length; i++) {
|
|
2185
|
+
var descriptor = props[i];
|
|
2186
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2187
|
+
descriptor.configurable = true;
|
|
2188
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2189
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
return function(Constructor, protoProps, staticProps) {
|
|
2193
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
2194
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
2195
|
+
return Constructor;
|
|
2196
|
+
};
|
|
2197
|
+
}();
|
|
2198
|
+
var _Barcode3$2 = _interopRequireDefault$11(require_Barcode());
|
|
2199
|
+
function _interopRequireDefault$11(obj) {
|
|
2200
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2201
|
+
}
|
|
2202
|
+
function _classCallCheck$8(instance, Constructor) {
|
|
2203
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2204
|
+
}
|
|
2205
|
+
function _possibleConstructorReturn$4(self, call) {
|
|
2206
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2207
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2208
|
+
}
|
|
2209
|
+
function _inherits$4(subClass, superClass) {
|
|
2210
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2211
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2212
|
+
value: subClass,
|
|
2213
|
+
enumerable: false,
|
|
2214
|
+
writable: true,
|
|
2215
|
+
configurable: true
|
|
2216
|
+
} });
|
|
2217
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2218
|
+
}
|
|
2219
|
+
exports.codabar = function(_Barcode) {
|
|
2220
|
+
_inherits$4(codabar$1, _Barcode);
|
|
2221
|
+
function codabar$1(data, options) {
|
|
2222
|
+
_classCallCheck$8(this, codabar$1);
|
|
2223
|
+
if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) data = "A" + data + "A";
|
|
2224
|
+
var _this = _possibleConstructorReturn$4(this, (codabar$1.__proto__ || Object.getPrototypeOf(codabar$1)).call(this, data.toUpperCase(), options));
|
|
2225
|
+
_this.text = _this.options.text || _this.text.replace(/[A-D]/g, "");
|
|
2226
|
+
return _this;
|
|
2227
|
+
}
|
|
2228
|
+
_createClass$7(codabar$1, [
|
|
2229
|
+
{
|
|
2230
|
+
key: "valid",
|
|
2231
|
+
value: function valid() {
|
|
2232
|
+
return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1;
|
|
2233
|
+
}
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
key: "encode",
|
|
2237
|
+
value: function encode$2() {
|
|
2238
|
+
var result = [];
|
|
2239
|
+
var encodings$1 = this.getEncodings();
|
|
2240
|
+
for (var i = 0; i < this.data.length; i++) {
|
|
2241
|
+
result.push(encodings$1[this.data.charAt(i)]);
|
|
2242
|
+
if (i !== this.data.length - 1) result.push("0");
|
|
2243
|
+
}
|
|
2244
|
+
return {
|
|
2245
|
+
text: this.text,
|
|
2246
|
+
data: result.join("")
|
|
2247
|
+
};
|
|
2248
|
+
}
|
|
2249
|
+
},
|
|
2250
|
+
{
|
|
2251
|
+
key: "getEncodings",
|
|
2252
|
+
value: function getEncodings() {
|
|
2253
|
+
return {
|
|
2254
|
+
"0": "101010011",
|
|
2255
|
+
"1": "101011001",
|
|
2256
|
+
"2": "101001011",
|
|
2257
|
+
"3": "110010101",
|
|
2258
|
+
"4": "101101001",
|
|
2259
|
+
"5": "110101001",
|
|
2260
|
+
"6": "100101011",
|
|
2261
|
+
"7": "100101101",
|
|
2262
|
+
"8": "100110101",
|
|
2263
|
+
"9": "110100101",
|
|
2264
|
+
"-": "101001101",
|
|
2265
|
+
"$": "101100101",
|
|
2266
|
+
":": "1101011011",
|
|
2267
|
+
"/": "1101101011",
|
|
2268
|
+
".": "1101101101",
|
|
2269
|
+
"+": "1011011011",
|
|
2270
|
+
"A": "1011001001",
|
|
2271
|
+
"B": "1001001011",
|
|
2272
|
+
"C": "1010010011",
|
|
2273
|
+
"D": "1010011001"
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
]);
|
|
2278
|
+
return codabar$1;
|
|
2279
|
+
}(_Barcode3$2.default);
|
|
2280
|
+
}));
|
|
2281
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2282
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2283
|
+
exports.SYMBOLS = [
|
|
2284
|
+
"0",
|
|
2285
|
+
"1",
|
|
2286
|
+
"2",
|
|
2287
|
+
"3",
|
|
2288
|
+
"4",
|
|
2289
|
+
"5",
|
|
2290
|
+
"6",
|
|
2291
|
+
"7",
|
|
2292
|
+
"8",
|
|
2293
|
+
"9",
|
|
2294
|
+
"A",
|
|
2295
|
+
"B",
|
|
2296
|
+
"C",
|
|
2297
|
+
"D",
|
|
2298
|
+
"E",
|
|
2299
|
+
"F",
|
|
2300
|
+
"G",
|
|
2301
|
+
"H",
|
|
2302
|
+
"I",
|
|
2303
|
+
"J",
|
|
2304
|
+
"K",
|
|
2305
|
+
"L",
|
|
2306
|
+
"M",
|
|
2307
|
+
"N",
|
|
2308
|
+
"O",
|
|
2309
|
+
"P",
|
|
2310
|
+
"Q",
|
|
2311
|
+
"R",
|
|
2312
|
+
"S",
|
|
2313
|
+
"T",
|
|
2314
|
+
"U",
|
|
2315
|
+
"V",
|
|
2316
|
+
"W",
|
|
2317
|
+
"X",
|
|
2318
|
+
"Y",
|
|
2319
|
+
"Z",
|
|
2320
|
+
"-",
|
|
2321
|
+
".",
|
|
2322
|
+
" ",
|
|
2323
|
+
"$",
|
|
2324
|
+
"/",
|
|
2325
|
+
"+",
|
|
2326
|
+
"%",
|
|
2327
|
+
"($)",
|
|
2328
|
+
"(%)",
|
|
2329
|
+
"(/)",
|
|
2330
|
+
"(+)",
|
|
2331
|
+
"ÿ"
|
|
2332
|
+
];
|
|
2333
|
+
exports.BINARIES = [
|
|
2334
|
+
"100010100",
|
|
2335
|
+
"101001000",
|
|
2336
|
+
"101000100",
|
|
2337
|
+
"101000010",
|
|
2338
|
+
"100101000",
|
|
2339
|
+
"100100100",
|
|
2340
|
+
"100100010",
|
|
2341
|
+
"101010000",
|
|
2342
|
+
"100010010",
|
|
2343
|
+
"100001010",
|
|
2344
|
+
"110101000",
|
|
2345
|
+
"110100100",
|
|
2346
|
+
"110100010",
|
|
2347
|
+
"110010100",
|
|
2348
|
+
"110010010",
|
|
2349
|
+
"110001010",
|
|
2350
|
+
"101101000",
|
|
2351
|
+
"101100100",
|
|
2352
|
+
"101100010",
|
|
2353
|
+
"100110100",
|
|
2354
|
+
"100011010",
|
|
2355
|
+
"101011000",
|
|
2356
|
+
"101001100",
|
|
2357
|
+
"101000110",
|
|
2358
|
+
"100101100",
|
|
2359
|
+
"100010110",
|
|
2360
|
+
"110110100",
|
|
2361
|
+
"110110010",
|
|
2362
|
+
"110101100",
|
|
2363
|
+
"110100110",
|
|
2364
|
+
"110010110",
|
|
2365
|
+
"110011010",
|
|
2366
|
+
"101101100",
|
|
2367
|
+
"101100110",
|
|
2368
|
+
"100110110",
|
|
2369
|
+
"100111010",
|
|
2370
|
+
"100101110",
|
|
2371
|
+
"111010100",
|
|
2372
|
+
"111010010",
|
|
2373
|
+
"111001010",
|
|
2374
|
+
"101101110",
|
|
2375
|
+
"101110110",
|
|
2376
|
+
"110101110",
|
|
2377
|
+
"100100110",
|
|
2378
|
+
"111011010",
|
|
2379
|
+
"111010110",
|
|
2380
|
+
"100110010",
|
|
2381
|
+
"101011110"
|
|
2382
|
+
];
|
|
2383
|
+
exports.MULTI_SYMBOLS = {
|
|
2384
|
+
"\0": ["(%)", "U"],
|
|
2385
|
+
"": ["($)", "A"],
|
|
2386
|
+
"": ["($)", "B"],
|
|
2387
|
+
"": ["($)", "C"],
|
|
2388
|
+
"": ["($)", "D"],
|
|
2389
|
+
"": ["($)", "E"],
|
|
2390
|
+
"": ["($)", "F"],
|
|
2391
|
+
"\x07": ["($)", "G"],
|
|
2392
|
+
"\b": ["($)", "H"],
|
|
2393
|
+
" ": ["($)", "I"],
|
|
2394
|
+
"\n": ["($)", "J"],
|
|
2395
|
+
"\v": ["($)", "K"],
|
|
2396
|
+
"\f": ["($)", "L"],
|
|
2397
|
+
"\r": ["($)", "M"],
|
|
2398
|
+
"": ["($)", "N"],
|
|
2399
|
+
"": ["($)", "O"],
|
|
2400
|
+
"": ["($)", "P"],
|
|
2401
|
+
"": ["($)", "Q"],
|
|
2402
|
+
"": ["($)", "R"],
|
|
2403
|
+
"": ["($)", "S"],
|
|
2404
|
+
"": ["($)", "T"],
|
|
2405
|
+
"": ["($)", "U"],
|
|
2406
|
+
"": ["($)", "V"],
|
|
2407
|
+
"": ["($)", "W"],
|
|
2408
|
+
"": ["($)", "X"],
|
|
2409
|
+
"": ["($)", "Y"],
|
|
2410
|
+
"": ["($)", "Z"],
|
|
2411
|
+
"\x1B": ["(%)", "A"],
|
|
2412
|
+
"": ["(%)", "B"],
|
|
2413
|
+
"": ["(%)", "C"],
|
|
2414
|
+
"": ["(%)", "D"],
|
|
2415
|
+
"": ["(%)", "E"],
|
|
2416
|
+
"!": ["(/)", "A"],
|
|
2417
|
+
"\"": ["(/)", "B"],
|
|
2418
|
+
"#": ["(/)", "C"],
|
|
2419
|
+
"&": ["(/)", "F"],
|
|
2420
|
+
"'": ["(/)", "G"],
|
|
2421
|
+
"(": ["(/)", "H"],
|
|
2422
|
+
")": ["(/)", "I"],
|
|
2423
|
+
"*": ["(/)", "J"],
|
|
2424
|
+
",": ["(/)", "L"],
|
|
2425
|
+
":": ["(/)", "Z"],
|
|
2426
|
+
";": ["(%)", "F"],
|
|
2427
|
+
"<": ["(%)", "G"],
|
|
2428
|
+
"=": ["(%)", "H"],
|
|
2429
|
+
">": ["(%)", "I"],
|
|
2430
|
+
"?": ["(%)", "J"],
|
|
2431
|
+
"@": ["(%)", "V"],
|
|
2432
|
+
"[": ["(%)", "K"],
|
|
2433
|
+
"\\": ["(%)", "L"],
|
|
2434
|
+
"]": ["(%)", "M"],
|
|
2435
|
+
"^": ["(%)", "N"],
|
|
2436
|
+
"_": ["(%)", "O"],
|
|
2437
|
+
"`": ["(%)", "W"],
|
|
2438
|
+
"a": ["(+)", "A"],
|
|
2439
|
+
"b": ["(+)", "B"],
|
|
2440
|
+
"c": ["(+)", "C"],
|
|
2441
|
+
"d": ["(+)", "D"],
|
|
2442
|
+
"e": ["(+)", "E"],
|
|
2443
|
+
"f": ["(+)", "F"],
|
|
2444
|
+
"g": ["(+)", "G"],
|
|
2445
|
+
"h": ["(+)", "H"],
|
|
2446
|
+
"i": ["(+)", "I"],
|
|
2447
|
+
"j": ["(+)", "J"],
|
|
2448
|
+
"k": ["(+)", "K"],
|
|
2449
|
+
"l": ["(+)", "L"],
|
|
2450
|
+
"m": ["(+)", "M"],
|
|
2451
|
+
"n": ["(+)", "N"],
|
|
2452
|
+
"o": ["(+)", "O"],
|
|
2453
|
+
"p": ["(+)", "P"],
|
|
2454
|
+
"q": ["(+)", "Q"],
|
|
2455
|
+
"r": ["(+)", "R"],
|
|
2456
|
+
"s": ["(+)", "S"],
|
|
2457
|
+
"t": ["(+)", "T"],
|
|
2458
|
+
"u": ["(+)", "U"],
|
|
2459
|
+
"v": ["(+)", "V"],
|
|
2460
|
+
"w": ["(+)", "W"],
|
|
2461
|
+
"x": ["(+)", "X"],
|
|
2462
|
+
"y": ["(+)", "Y"],
|
|
2463
|
+
"z": ["(+)", "Z"],
|
|
2464
|
+
"{": ["(%)", "P"],
|
|
2465
|
+
"|": ["(%)", "Q"],
|
|
2466
|
+
"}": ["(%)", "R"],
|
|
2467
|
+
"~": ["(%)", "S"],
|
|
2468
|
+
"": ["(%)", "T"]
|
|
2469
|
+
};
|
|
2470
|
+
}));
|
|
2471
|
+
var require_CODE93$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2472
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2473
|
+
var _createClass$6 = function() {
|
|
2474
|
+
function defineProperties(target, props) {
|
|
2475
|
+
for (var i = 0; i < props.length; i++) {
|
|
2476
|
+
var descriptor = props[i];
|
|
2477
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2478
|
+
descriptor.configurable = true;
|
|
2479
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2480
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
return function(Constructor, protoProps, staticProps) {
|
|
2484
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
2485
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
2486
|
+
return Constructor;
|
|
2487
|
+
};
|
|
2488
|
+
}();
|
|
2489
|
+
var _constants = require_constants();
|
|
2490
|
+
var _Barcode3$1 = _interopRequireDefault$10(require_Barcode());
|
|
2491
|
+
function _interopRequireDefault$10(obj) {
|
|
2492
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2493
|
+
}
|
|
2494
|
+
function _classCallCheck$7(instance, Constructor) {
|
|
2495
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2496
|
+
}
|
|
2497
|
+
function _possibleConstructorReturn$3(self, call) {
|
|
2498
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2499
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2500
|
+
}
|
|
2501
|
+
function _inherits$3(subClass, superClass) {
|
|
2502
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2503
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2504
|
+
value: subClass,
|
|
2505
|
+
enumerable: false,
|
|
2506
|
+
writable: true,
|
|
2507
|
+
configurable: true
|
|
2508
|
+
} });
|
|
2509
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2510
|
+
}
|
|
2511
|
+
exports.default = function(_Barcode) {
|
|
2512
|
+
_inherits$3(CODE93$1, _Barcode);
|
|
2513
|
+
function CODE93$1(data, options) {
|
|
2514
|
+
_classCallCheck$7(this, CODE93$1);
|
|
2515
|
+
return _possibleConstructorReturn$3(this, (CODE93$1.__proto__ || Object.getPrototypeOf(CODE93$1)).call(this, data, options));
|
|
2516
|
+
}
|
|
2517
|
+
_createClass$6(CODE93$1, [{
|
|
2518
|
+
key: "valid",
|
|
2519
|
+
value: function valid() {
|
|
2520
|
+
return /^[0-9A-Z\-. $/+%]+$/.test(this.data);
|
|
2521
|
+
}
|
|
2522
|
+
}, {
|
|
2523
|
+
key: "encode",
|
|
2524
|
+
value: function encode$2() {
|
|
2525
|
+
var symbols = this.data.split("").flatMap(function(c) {
|
|
2526
|
+
return _constants.MULTI_SYMBOLS[c] || c;
|
|
2527
|
+
});
|
|
2528
|
+
var encoded = symbols.map(function(s) {
|
|
2529
|
+
return CODE93$1.getEncoding(s);
|
|
2530
|
+
}).join("");
|
|
2531
|
+
var csumC = CODE93$1.checksum(symbols, 20);
|
|
2532
|
+
var csumK = CODE93$1.checksum(symbols.concat(csumC), 15);
|
|
2533
|
+
return {
|
|
2534
|
+
text: this.text,
|
|
2535
|
+
data: CODE93$1.getEncoding("ÿ") + encoded + CODE93$1.getEncoding(csumC) + CODE93$1.getEncoding(csumK) + CODE93$1.getEncoding("ÿ") + "1"
|
|
2536
|
+
};
|
|
2537
|
+
}
|
|
2538
|
+
}], [
|
|
2539
|
+
{
|
|
2540
|
+
key: "getEncoding",
|
|
2541
|
+
value: function getEncoding$1(symbol) {
|
|
2542
|
+
return _constants.BINARIES[CODE93$1.symbolValue(symbol)];
|
|
2543
|
+
}
|
|
2544
|
+
},
|
|
2545
|
+
{
|
|
2546
|
+
key: "getSymbol",
|
|
2547
|
+
value: function getSymbol(symbolValue) {
|
|
2548
|
+
return _constants.SYMBOLS[symbolValue];
|
|
2549
|
+
}
|
|
2550
|
+
},
|
|
2551
|
+
{
|
|
2552
|
+
key: "symbolValue",
|
|
2553
|
+
value: function symbolValue(symbol) {
|
|
2554
|
+
return _constants.SYMBOLS.indexOf(symbol);
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2557
|
+
{
|
|
2558
|
+
key: "checksum",
|
|
2559
|
+
value: function checksum$5(symbols, maxWeight) {
|
|
2560
|
+
var csum = symbols.slice().reverse().reduce(function(sum, symbol, idx) {
|
|
2561
|
+
var weight = idx % maxWeight + 1;
|
|
2562
|
+
return sum + CODE93$1.symbolValue(symbol) * weight;
|
|
2563
|
+
}, 0);
|
|
2564
|
+
return CODE93$1.getSymbol(csum % 47);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
]);
|
|
2568
|
+
return CODE93$1;
|
|
2569
|
+
}(_Barcode3$1.default);
|
|
2570
|
+
}));
|
|
2571
|
+
var require_CODE93FullASCII = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2572
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2573
|
+
var _createClass$5 = function() {
|
|
2574
|
+
function defineProperties(target, props) {
|
|
2575
|
+
for (var i = 0; i < props.length; i++) {
|
|
2576
|
+
var descriptor = props[i];
|
|
2577
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2578
|
+
descriptor.configurable = true;
|
|
2579
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2580
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
return function(Constructor, protoProps, staticProps) {
|
|
2584
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
2585
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
2586
|
+
return Constructor;
|
|
2587
|
+
};
|
|
2588
|
+
}();
|
|
2589
|
+
var _CODE3$1 = _interopRequireDefault$9(require_CODE93$1());
|
|
2590
|
+
function _interopRequireDefault$9(obj) {
|
|
2591
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2592
|
+
}
|
|
2593
|
+
function _classCallCheck$6(instance, Constructor) {
|
|
2594
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2595
|
+
}
|
|
2596
|
+
function _possibleConstructorReturn$2(self, call) {
|
|
2597
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2598
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2599
|
+
}
|
|
2600
|
+
function _inherits$2(subClass, superClass) {
|
|
2601
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2602
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2603
|
+
value: subClass,
|
|
2604
|
+
enumerable: false,
|
|
2605
|
+
writable: true,
|
|
2606
|
+
configurable: true
|
|
2607
|
+
} });
|
|
2608
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2609
|
+
}
|
|
2610
|
+
exports.default = function(_CODE$1) {
|
|
2611
|
+
_inherits$2(CODE93FullASCII$1, _CODE$1);
|
|
2612
|
+
function CODE93FullASCII$1(data, options) {
|
|
2613
|
+
_classCallCheck$6(this, CODE93FullASCII$1);
|
|
2614
|
+
return _possibleConstructorReturn$2(this, (CODE93FullASCII$1.__proto__ || Object.getPrototypeOf(CODE93FullASCII$1)).call(this, data, options));
|
|
2615
|
+
}
|
|
2616
|
+
_createClass$5(CODE93FullASCII$1, [{
|
|
2617
|
+
key: "valid",
|
|
2618
|
+
value: function valid() {
|
|
2619
|
+
return /^[\x00-\x7f]+$/.test(this.data);
|
|
2620
|
+
}
|
|
2621
|
+
}]);
|
|
2622
|
+
return CODE93FullASCII$1;
|
|
2623
|
+
}(_CODE3$1.default);
|
|
2624
|
+
}));
|
|
2625
|
+
var require_CODE93 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2626
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2627
|
+
exports.CODE93FullASCII = exports.CODE93 = void 0;
|
|
2628
|
+
var _CODE2$1 = _interopRequireDefault$8(require_CODE93$1());
|
|
2629
|
+
var _CODE93FullASCII2 = _interopRequireDefault$8(require_CODE93FullASCII());
|
|
2630
|
+
function _interopRequireDefault$8(obj) {
|
|
2631
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2632
|
+
}
|
|
2633
|
+
exports.CODE93 = _CODE2$1.default;
|
|
2634
|
+
exports.CODE93FullASCII = _CODE93FullASCII2.default;
|
|
2635
|
+
}));
|
|
2636
|
+
var require_GenericBarcode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2637
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2638
|
+
exports.GenericBarcode = void 0;
|
|
2639
|
+
var _createClass$4 = function() {
|
|
2640
|
+
function defineProperties(target, props) {
|
|
2641
|
+
for (var i = 0; i < props.length; i++) {
|
|
2642
|
+
var descriptor = props[i];
|
|
2643
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2644
|
+
descriptor.configurable = true;
|
|
2645
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2646
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
return function(Constructor, protoProps, staticProps) {
|
|
2650
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
2651
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
2652
|
+
return Constructor;
|
|
2653
|
+
};
|
|
2654
|
+
}();
|
|
2655
|
+
var _Barcode3 = _interopRequireDefault$7(require_Barcode());
|
|
2656
|
+
function _interopRequireDefault$7(obj) {
|
|
2657
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2658
|
+
}
|
|
2659
|
+
function _classCallCheck$5(instance, Constructor) {
|
|
2660
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2661
|
+
}
|
|
2662
|
+
function _possibleConstructorReturn$1(self, call) {
|
|
2663
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2664
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2665
|
+
}
|
|
2666
|
+
function _inherits$1(subClass, superClass) {
|
|
2667
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
2668
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
2669
|
+
value: subClass,
|
|
2670
|
+
enumerable: false,
|
|
2671
|
+
writable: true,
|
|
2672
|
+
configurable: true
|
|
2673
|
+
} });
|
|
2674
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2675
|
+
}
|
|
2676
|
+
exports.GenericBarcode = function(_Barcode) {
|
|
2677
|
+
_inherits$1(GenericBarcode$1, _Barcode);
|
|
2678
|
+
function GenericBarcode$1(data, options) {
|
|
2679
|
+
_classCallCheck$5(this, GenericBarcode$1);
|
|
2680
|
+
return _possibleConstructorReturn$1(this, (GenericBarcode$1.__proto__ || Object.getPrototypeOf(GenericBarcode$1)).call(this, data, options));
|
|
2681
|
+
}
|
|
2682
|
+
_createClass$4(GenericBarcode$1, [{
|
|
2683
|
+
key: "encode",
|
|
2684
|
+
value: function encode$2() {
|
|
2685
|
+
return {
|
|
2686
|
+
data: "10101010101010101010101010101010101010101",
|
|
2687
|
+
text: this.text
|
|
2688
|
+
};
|
|
2689
|
+
}
|
|
2690
|
+
}, {
|
|
2691
|
+
key: "valid",
|
|
2692
|
+
value: function valid() {
|
|
2693
|
+
return true;
|
|
2694
|
+
}
|
|
2695
|
+
}]);
|
|
2696
|
+
return GenericBarcode$1;
|
|
2697
|
+
}(_Barcode3.default);
|
|
2698
|
+
}));
|
|
2699
|
+
var require_barcodes = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2700
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2701
|
+
var _CODE = require_CODE39();
|
|
2702
|
+
var _CODE2 = require_CODE128();
|
|
2703
|
+
var _EAN_UPC = require_EAN_UPC();
|
|
2704
|
+
var _ITF = require_ITF();
|
|
2705
|
+
var _MSI = require_MSI();
|
|
2706
|
+
var _pharmacode = require_pharmacode();
|
|
2707
|
+
var _codabar = require_codabar();
|
|
2708
|
+
var _CODE3 = require_CODE93();
|
|
2709
|
+
var _GenericBarcode = require_GenericBarcode();
|
|
2710
|
+
exports.default = {
|
|
2711
|
+
CODE39: _CODE.CODE39,
|
|
2712
|
+
CODE128: _CODE2.CODE128,
|
|
2713
|
+
CODE128A: _CODE2.CODE128A,
|
|
2714
|
+
CODE128B: _CODE2.CODE128B,
|
|
2715
|
+
CODE128C: _CODE2.CODE128C,
|
|
2716
|
+
EAN13: _EAN_UPC.EAN13,
|
|
2717
|
+
EAN8: _EAN_UPC.EAN8,
|
|
2718
|
+
EAN5: _EAN_UPC.EAN5,
|
|
2719
|
+
EAN2: _EAN_UPC.EAN2,
|
|
2720
|
+
UPC: _EAN_UPC.UPC,
|
|
2721
|
+
UPCE: _EAN_UPC.UPCE,
|
|
2722
|
+
ITF14: _ITF.ITF14,
|
|
2723
|
+
ITF: _ITF.ITF,
|
|
2724
|
+
MSI: _MSI.MSI,
|
|
2725
|
+
MSI10: _MSI.MSI10,
|
|
2726
|
+
MSI11: _MSI.MSI11,
|
|
2727
|
+
MSI1010: _MSI.MSI1010,
|
|
2728
|
+
MSI1110: _MSI.MSI1110,
|
|
2729
|
+
pharmacode: _pharmacode.pharmacode,
|
|
2730
|
+
codabar: _codabar.codabar,
|
|
2731
|
+
CODE93: _CODE3.CODE93,
|
|
2732
|
+
CODE93FullASCII: _CODE3.CODE93FullASCII,
|
|
2733
|
+
GenericBarcode: _GenericBarcode.GenericBarcode
|
|
2734
|
+
};
|
|
2735
|
+
}));
|
|
2736
|
+
var require_merge = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2737
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2738
|
+
var _extends = Object.assign || function(target) {
|
|
2739
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2740
|
+
var source = arguments[i];
|
|
2741
|
+
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
2742
|
+
}
|
|
2743
|
+
return target;
|
|
2744
|
+
};
|
|
2745
|
+
exports.default = function(old, replaceObj) {
|
|
2746
|
+
return _extends({}, old, replaceObj);
|
|
2747
|
+
};
|
|
2748
|
+
}));
|
|
2749
|
+
var require_linearizeEncodings = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2750
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2751
|
+
exports.default = linearizeEncodings;
|
|
2752
|
+
function linearizeEncodings(encodings$1) {
|
|
2753
|
+
var linearEncodings = [];
|
|
2754
|
+
function nextLevel(encoded) {
|
|
2755
|
+
if (Array.isArray(encoded)) for (var i = 0; i < encoded.length; i++) nextLevel(encoded[i]);
|
|
2756
|
+
else {
|
|
2757
|
+
encoded.text = encoded.text || "";
|
|
2758
|
+
encoded.data = encoded.data || "";
|
|
2759
|
+
linearEncodings.push(encoded);
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
nextLevel(encodings$1);
|
|
2763
|
+
return linearEncodings;
|
|
2764
|
+
}
|
|
2765
|
+
}));
|
|
2766
|
+
var require_fixOptions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2767
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2768
|
+
exports.default = fixOptions;
|
|
2769
|
+
function fixOptions(options) {
|
|
2770
|
+
options.marginTop = options.marginTop || options.margin;
|
|
2771
|
+
options.marginBottom = options.marginBottom || options.margin;
|
|
2772
|
+
options.marginRight = options.marginRight || options.margin;
|
|
2773
|
+
options.marginLeft = options.marginLeft || options.margin;
|
|
2774
|
+
return options;
|
|
2775
|
+
}
|
|
2776
|
+
}));
|
|
2777
|
+
var require_optionsFromStrings = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2778
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2779
|
+
exports.default = optionsFromStrings;
|
|
2780
|
+
function optionsFromStrings(options) {
|
|
2781
|
+
var intOptions = [
|
|
2782
|
+
"width",
|
|
2783
|
+
"height",
|
|
2784
|
+
"textMargin",
|
|
2785
|
+
"fontSize",
|
|
2786
|
+
"margin",
|
|
2787
|
+
"marginTop",
|
|
2788
|
+
"marginBottom",
|
|
2789
|
+
"marginLeft",
|
|
2790
|
+
"marginRight"
|
|
2791
|
+
];
|
|
2792
|
+
for (var intOption in intOptions) if (intOptions.hasOwnProperty(intOption)) {
|
|
2793
|
+
intOption = intOptions[intOption];
|
|
2794
|
+
if (typeof options[intOption] === "string") options[intOption] = parseInt(options[intOption], 10);
|
|
2795
|
+
}
|
|
2796
|
+
if (typeof options["displayValue"] === "string") options["displayValue"] = options["displayValue"] != "false";
|
|
2797
|
+
return options;
|
|
2798
|
+
}
|
|
2799
|
+
}));
|
|
2800
|
+
var require_defaults = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2801
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2802
|
+
exports.default = {
|
|
2803
|
+
width: 2,
|
|
2804
|
+
height: 100,
|
|
2805
|
+
format: "auto",
|
|
2806
|
+
displayValue: true,
|
|
2807
|
+
fontOptions: "",
|
|
2808
|
+
font: "monospace",
|
|
2809
|
+
text: void 0,
|
|
2810
|
+
textAlign: "center",
|
|
2811
|
+
textPosition: "bottom",
|
|
2812
|
+
textMargin: 2,
|
|
2813
|
+
fontSize: 20,
|
|
2814
|
+
background: "#ffffff",
|
|
2815
|
+
lineColor: "#000000",
|
|
2816
|
+
margin: 10,
|
|
2817
|
+
marginTop: void 0,
|
|
2818
|
+
marginBottom: void 0,
|
|
2819
|
+
marginLeft: void 0,
|
|
2820
|
+
marginRight: void 0,
|
|
2821
|
+
valid: function valid() {}
|
|
2822
|
+
};
|
|
2823
|
+
}));
|
|
2824
|
+
var require_getOptionsFromElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2825
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2826
|
+
var _optionsFromStrings2$1 = _interopRequireDefault$6(require_optionsFromStrings());
|
|
2827
|
+
var _defaults2$1 = _interopRequireDefault$6(require_defaults());
|
|
2828
|
+
function _interopRequireDefault$6(obj) {
|
|
2829
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2830
|
+
}
|
|
2831
|
+
function getOptionsFromElement(element) {
|
|
2832
|
+
var options = {};
|
|
2833
|
+
for (var property in _defaults2$1.default) if (_defaults2$1.default.hasOwnProperty(property)) {
|
|
2834
|
+
if (element.hasAttribute("jsbarcode-" + property.toLowerCase())) options[property] = element.getAttribute("jsbarcode-" + property.toLowerCase());
|
|
2835
|
+
if (element.hasAttribute("data-" + property.toLowerCase())) options[property] = element.getAttribute("data-" + property.toLowerCase());
|
|
2836
|
+
}
|
|
2837
|
+
options["value"] = element.getAttribute("jsbarcode-value") || element.getAttribute("data-value");
|
|
2838
|
+
options = (0, _optionsFromStrings2$1.default)(options);
|
|
2839
|
+
return options;
|
|
2840
|
+
}
|
|
2841
|
+
exports.default = getOptionsFromElement;
|
|
2842
|
+
}));
|
|
2843
|
+
var require_shared = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2844
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2845
|
+
exports.getTotalWidthOfEncodings = exports.calculateEncodingAttributes = exports.getBarcodePadding = exports.getEncodingHeight = exports.getMaximumHeightOfEncodings = void 0;
|
|
2846
|
+
var _merge2$3 = _interopRequireDefault$5(require_merge());
|
|
2847
|
+
function _interopRequireDefault$5(obj) {
|
|
2848
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2849
|
+
}
|
|
2850
|
+
function getEncodingHeight(encoding, options) {
|
|
2851
|
+
return options.height + (options.displayValue && encoding.text.length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom;
|
|
2852
|
+
}
|
|
2853
|
+
function getBarcodePadding(textWidth, barcodeWidth, options) {
|
|
2854
|
+
if (options.displayValue && barcodeWidth < textWidth) {
|
|
2855
|
+
if (options.textAlign == "center") return Math.floor((textWidth - barcodeWidth) / 2);
|
|
2856
|
+
else if (options.textAlign == "left") return 0;
|
|
2857
|
+
else if (options.textAlign == "right") return Math.floor(textWidth - barcodeWidth);
|
|
2858
|
+
}
|
|
2859
|
+
return 0;
|
|
2860
|
+
}
|
|
2861
|
+
function calculateEncodingAttributes(encodings$1, barcodeOptions, context) {
|
|
2862
|
+
for (var i = 0; i < encodings$1.length; i++) {
|
|
2863
|
+
var encoding = encodings$1[i];
|
|
2864
|
+
var options = (0, _merge2$3.default)(barcodeOptions, encoding.options);
|
|
2865
|
+
var textWidth;
|
|
2866
|
+
if (options.displayValue) textWidth = messureText(encoding.text, options, context);
|
|
2867
|
+
else textWidth = 0;
|
|
2868
|
+
var barcodeWidth = encoding.data.length * options.width;
|
|
2869
|
+
encoding.width = Math.ceil(Math.max(textWidth, barcodeWidth));
|
|
2870
|
+
encoding.height = getEncodingHeight(encoding, options);
|
|
2871
|
+
encoding.barcodePadding = getBarcodePadding(textWidth, barcodeWidth, options);
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
function getTotalWidthOfEncodings(encodings$1) {
|
|
2875
|
+
var totalWidth = 0;
|
|
2876
|
+
for (var i = 0; i < encodings$1.length; i++) totalWidth += encodings$1[i].width;
|
|
2877
|
+
return totalWidth;
|
|
2878
|
+
}
|
|
2879
|
+
function getMaximumHeightOfEncodings(encodings$1) {
|
|
2880
|
+
var maxHeight = 0;
|
|
2881
|
+
for (var i = 0; i < encodings$1.length; i++) if (encodings$1[i].height > maxHeight) maxHeight = encodings$1[i].height;
|
|
2882
|
+
return maxHeight;
|
|
2883
|
+
}
|
|
2884
|
+
function messureText(string, options, context) {
|
|
2885
|
+
var ctx;
|
|
2886
|
+
if (context) ctx = context;
|
|
2887
|
+
else if (typeof document !== "undefined") ctx = document.createElement("canvas").getContext("2d");
|
|
2888
|
+
else return 0;
|
|
2889
|
+
ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font;
|
|
2890
|
+
var measureTextResult = ctx.measureText(string);
|
|
2891
|
+
if (!measureTextResult) return 0;
|
|
2892
|
+
return measureTextResult.width;
|
|
2893
|
+
}
|
|
2894
|
+
exports.getMaximumHeightOfEncodings = getMaximumHeightOfEncodings;
|
|
2895
|
+
exports.getEncodingHeight = getEncodingHeight;
|
|
2896
|
+
exports.getBarcodePadding = getBarcodePadding;
|
|
2897
|
+
exports.calculateEncodingAttributes = calculateEncodingAttributes;
|
|
2898
|
+
exports.getTotalWidthOfEncodings = getTotalWidthOfEncodings;
|
|
2899
|
+
}));
|
|
2900
|
+
var require_canvas = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2901
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2902
|
+
var _createClass$3 = function() {
|
|
2903
|
+
function defineProperties(target, props) {
|
|
2904
|
+
for (var i = 0; i < props.length; i++) {
|
|
2905
|
+
var descriptor = props[i];
|
|
2906
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
2907
|
+
descriptor.configurable = true;
|
|
2908
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2909
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
return function(Constructor, protoProps, staticProps) {
|
|
2913
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
2914
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
2915
|
+
return Constructor;
|
|
2916
|
+
};
|
|
2917
|
+
}();
|
|
2918
|
+
var _merge2$2 = _interopRequireDefault$4(require_merge());
|
|
2919
|
+
var _shared$1 = require_shared();
|
|
2920
|
+
function _interopRequireDefault$4(obj) {
|
|
2921
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2922
|
+
}
|
|
2923
|
+
function _classCallCheck$4(instance, Constructor) {
|
|
2924
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
2925
|
+
}
|
|
2926
|
+
exports.default = function() {
|
|
2927
|
+
function CanvasRenderer$1(canvas, encodings$1, options) {
|
|
2928
|
+
_classCallCheck$4(this, CanvasRenderer$1);
|
|
2929
|
+
this.canvas = canvas;
|
|
2930
|
+
this.encodings = encodings$1;
|
|
2931
|
+
this.options = options;
|
|
2932
|
+
}
|
|
2933
|
+
_createClass$3(CanvasRenderer$1, [
|
|
2934
|
+
{
|
|
2935
|
+
key: "render",
|
|
2936
|
+
value: function render$1() {
|
|
2937
|
+
if (!this.canvas.getContext) throw new Error("The browser does not support canvas.");
|
|
2938
|
+
this.prepareCanvas();
|
|
2939
|
+
for (var i = 0; i < this.encodings.length; i++) {
|
|
2940
|
+
var encodingOptions = (0, _merge2$2.default)(this.options, this.encodings[i].options);
|
|
2941
|
+
this.drawCanvasBarcode(encodingOptions, this.encodings[i]);
|
|
2942
|
+
this.drawCanvasText(encodingOptions, this.encodings[i]);
|
|
2943
|
+
this.moveCanvasDrawing(this.encodings[i]);
|
|
2944
|
+
}
|
|
2945
|
+
this.restoreCanvas();
|
|
2946
|
+
}
|
|
2947
|
+
},
|
|
2948
|
+
{
|
|
2949
|
+
key: "prepareCanvas",
|
|
2950
|
+
value: function prepareCanvas() {
|
|
2951
|
+
var ctx = this.canvas.getContext("2d");
|
|
2952
|
+
ctx.save();
|
|
2953
|
+
(0, _shared$1.calculateEncodingAttributes)(this.encodings, this.options, ctx);
|
|
2954
|
+
var totalWidth = (0, _shared$1.getTotalWidthOfEncodings)(this.encodings);
|
|
2955
|
+
var maxHeight = (0, _shared$1.getMaximumHeightOfEncodings)(this.encodings);
|
|
2956
|
+
this.canvas.width = totalWidth + this.options.marginLeft + this.options.marginRight;
|
|
2957
|
+
this.canvas.height = maxHeight;
|
|
2958
|
+
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2959
|
+
if (this.options.background) {
|
|
2960
|
+
ctx.fillStyle = this.options.background;
|
|
2961
|
+
ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2962
|
+
}
|
|
2963
|
+
ctx.translate(this.options.marginLeft, 0);
|
|
2964
|
+
}
|
|
2965
|
+
},
|
|
2966
|
+
{
|
|
2967
|
+
key: "drawCanvasBarcode",
|
|
2968
|
+
value: function drawCanvasBarcode(options, encoding) {
|
|
2969
|
+
var ctx = this.canvas.getContext("2d");
|
|
2970
|
+
var binary = encoding.data;
|
|
2971
|
+
var yFrom;
|
|
2972
|
+
if (options.textPosition == "top") yFrom = options.marginTop + options.fontSize + options.textMargin;
|
|
2973
|
+
else yFrom = options.marginTop;
|
|
2974
|
+
ctx.fillStyle = options.lineColor;
|
|
2975
|
+
for (var b = 0; b < binary.length; b++) {
|
|
2976
|
+
var x = b * options.width + encoding.barcodePadding;
|
|
2977
|
+
if (binary[b] === "1") ctx.fillRect(x, yFrom, options.width, options.height);
|
|
2978
|
+
else if (binary[b]) ctx.fillRect(x, yFrom, options.width, options.height * binary[b]);
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
},
|
|
2982
|
+
{
|
|
2983
|
+
key: "drawCanvasText",
|
|
2984
|
+
value: function drawCanvasText(options, encoding) {
|
|
2985
|
+
var ctx = this.canvas.getContext("2d");
|
|
2986
|
+
var font = options.fontOptions + " " + options.fontSize + "px " + options.font;
|
|
2987
|
+
if (options.displayValue) {
|
|
2988
|
+
var x, y;
|
|
2989
|
+
if (options.textPosition == "top") y = options.marginTop + options.fontSize - options.textMargin;
|
|
2990
|
+
else y = options.height + options.textMargin + options.marginTop + options.fontSize;
|
|
2991
|
+
ctx.font = font;
|
|
2992
|
+
if (options.textAlign == "left" || encoding.barcodePadding > 0) {
|
|
2993
|
+
x = 0;
|
|
2994
|
+
ctx.textAlign = "left";
|
|
2995
|
+
} else if (options.textAlign == "right") {
|
|
2996
|
+
x = encoding.width - 1;
|
|
2997
|
+
ctx.textAlign = "right";
|
|
2998
|
+
} else {
|
|
2999
|
+
x = encoding.width / 2;
|
|
3000
|
+
ctx.textAlign = "center";
|
|
3001
|
+
}
|
|
3002
|
+
ctx.fillText(encoding.text, x, y);
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
},
|
|
3006
|
+
{
|
|
3007
|
+
key: "moveCanvasDrawing",
|
|
3008
|
+
value: function moveCanvasDrawing(encoding) {
|
|
3009
|
+
this.canvas.getContext("2d").translate(encoding.width, 0);
|
|
3010
|
+
}
|
|
3011
|
+
},
|
|
3012
|
+
{
|
|
3013
|
+
key: "restoreCanvas",
|
|
3014
|
+
value: function restoreCanvas() {
|
|
3015
|
+
this.canvas.getContext("2d").restore();
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
]);
|
|
3019
|
+
return CanvasRenderer$1;
|
|
3020
|
+
}();
|
|
3021
|
+
}));
|
|
3022
|
+
var require_svg = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3023
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3024
|
+
var _createClass$2 = function() {
|
|
3025
|
+
function defineProperties(target, props) {
|
|
3026
|
+
for (var i = 0; i < props.length; i++) {
|
|
3027
|
+
var descriptor = props[i];
|
|
3028
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
3029
|
+
descriptor.configurable = true;
|
|
3030
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
3031
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
return function(Constructor, protoProps, staticProps) {
|
|
3035
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
3036
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
3037
|
+
return Constructor;
|
|
3038
|
+
};
|
|
3039
|
+
}();
|
|
3040
|
+
var _merge2$1 = _interopRequireDefault$3(require_merge());
|
|
3041
|
+
var _shared = require_shared();
|
|
3042
|
+
function _interopRequireDefault$3(obj) {
|
|
3043
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3044
|
+
}
|
|
3045
|
+
function _classCallCheck$3(instance, Constructor) {
|
|
3046
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
3047
|
+
}
|
|
3048
|
+
var svgns = "http://www.w3.org/2000/svg";
|
|
3049
|
+
exports.default = function() {
|
|
3050
|
+
function SVGRenderer$1(svg, encodings$1, options) {
|
|
3051
|
+
_classCallCheck$3(this, SVGRenderer$1);
|
|
3052
|
+
this.svg = svg;
|
|
3053
|
+
this.encodings = encodings$1;
|
|
3054
|
+
this.options = options;
|
|
3055
|
+
this.document = options.xmlDocument || document;
|
|
3056
|
+
}
|
|
3057
|
+
_createClass$2(SVGRenderer$1, [
|
|
3058
|
+
{
|
|
3059
|
+
key: "render",
|
|
3060
|
+
value: function render$1() {
|
|
3061
|
+
var currentX = this.options.marginLeft;
|
|
3062
|
+
this.prepareSVG();
|
|
3063
|
+
for (var i = 0; i < this.encodings.length; i++) {
|
|
3064
|
+
var encoding = this.encodings[i];
|
|
3065
|
+
var encodingOptions = (0, _merge2$1.default)(this.options, encoding.options);
|
|
3066
|
+
var group = this.createGroup(currentX, encodingOptions.marginTop, this.svg);
|
|
3067
|
+
this.setGroupOptions(group, encodingOptions);
|
|
3068
|
+
this.drawSvgBarcode(group, encodingOptions, encoding);
|
|
3069
|
+
this.drawSVGText(group, encodingOptions, encoding);
|
|
3070
|
+
currentX += encoding.width;
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
},
|
|
3074
|
+
{
|
|
3075
|
+
key: "prepareSVG",
|
|
3076
|
+
value: function prepareSVG() {
|
|
3077
|
+
while (this.svg.firstChild) this.svg.removeChild(this.svg.firstChild);
|
|
3078
|
+
(0, _shared.calculateEncodingAttributes)(this.encodings, this.options);
|
|
3079
|
+
var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings);
|
|
3080
|
+
var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings);
|
|
3081
|
+
var width = totalWidth + this.options.marginLeft + this.options.marginRight;
|
|
3082
|
+
this.setSvgAttributes(width, maxHeight);
|
|
3083
|
+
if (this.options.background) this.drawRect(0, 0, width, maxHeight, this.svg).setAttribute("fill", this.options.background);
|
|
3084
|
+
}
|
|
3085
|
+
},
|
|
3086
|
+
{
|
|
3087
|
+
key: "drawSvgBarcode",
|
|
3088
|
+
value: function drawSvgBarcode(parent, options, encoding) {
|
|
3089
|
+
var binary = encoding.data;
|
|
3090
|
+
var yFrom;
|
|
3091
|
+
if (options.textPosition == "top") yFrom = options.fontSize + options.textMargin;
|
|
3092
|
+
else yFrom = 0;
|
|
3093
|
+
var barWidth = 0;
|
|
3094
|
+
var x = 0;
|
|
3095
|
+
for (var b = 0; b < binary.length; b++) {
|
|
3096
|
+
x = b * options.width + encoding.barcodePadding;
|
|
3097
|
+
if (binary[b] === "1") barWidth++;
|
|
3098
|
+
else if (barWidth > 0) {
|
|
3099
|
+
this.drawRect(x - options.width * barWidth, yFrom, options.width * barWidth, options.height, parent);
|
|
3100
|
+
barWidth = 0;
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
if (barWidth > 0) this.drawRect(x - options.width * (barWidth - 1), yFrom, options.width * barWidth, options.height, parent);
|
|
3104
|
+
}
|
|
3105
|
+
},
|
|
3106
|
+
{
|
|
3107
|
+
key: "drawSVGText",
|
|
3108
|
+
value: function drawSVGText(parent, options, encoding) {
|
|
3109
|
+
var textElem = this.document.createElementNS(svgns, "text");
|
|
3110
|
+
if (options.displayValue) {
|
|
3111
|
+
var x, y;
|
|
3112
|
+
textElem.setAttribute("font-family", options.font);
|
|
3113
|
+
textElem.setAttribute("font-size", options.fontSize);
|
|
3114
|
+
if (options.fontOptions.includes("bold")) textElem.setAttribute("font-weight", "bold");
|
|
3115
|
+
if (options.fontOptions.includes("italic")) textElem.setAttribute("font-style", "italic");
|
|
3116
|
+
if (options.textPosition == "top") y = options.fontSize - options.textMargin;
|
|
3117
|
+
else y = options.height + options.textMargin + options.fontSize;
|
|
3118
|
+
if (options.textAlign == "left" || encoding.barcodePadding > 0) {
|
|
3119
|
+
x = 0;
|
|
3120
|
+
textElem.setAttribute("text-anchor", "start");
|
|
3121
|
+
} else if (options.textAlign == "right") {
|
|
3122
|
+
x = encoding.width - 1;
|
|
3123
|
+
textElem.setAttribute("text-anchor", "end");
|
|
3124
|
+
} else {
|
|
3125
|
+
x = encoding.width / 2;
|
|
3126
|
+
textElem.setAttribute("text-anchor", "middle");
|
|
3127
|
+
}
|
|
3128
|
+
textElem.setAttribute("x", x);
|
|
3129
|
+
textElem.setAttribute("y", y);
|
|
3130
|
+
textElem.appendChild(this.document.createTextNode(encoding.text));
|
|
3131
|
+
parent.appendChild(textElem);
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
},
|
|
3135
|
+
{
|
|
3136
|
+
key: "setSvgAttributes",
|
|
3137
|
+
value: function setSvgAttributes(width, height) {
|
|
3138
|
+
var svg = this.svg;
|
|
3139
|
+
svg.setAttribute("width", width + "px");
|
|
3140
|
+
svg.setAttribute("height", height + "px");
|
|
3141
|
+
svg.setAttribute("x", "0px");
|
|
3142
|
+
svg.setAttribute("y", "0px");
|
|
3143
|
+
svg.setAttribute("viewBox", "0 0 " + width + " " + height);
|
|
3144
|
+
svg.setAttribute("xmlns", svgns);
|
|
3145
|
+
svg.setAttribute("version", "1.1");
|
|
3146
|
+
}
|
|
3147
|
+
},
|
|
3148
|
+
{
|
|
3149
|
+
key: "createGroup",
|
|
3150
|
+
value: function createGroup(x, y, parent) {
|
|
3151
|
+
var group = this.document.createElementNS(svgns, "g");
|
|
3152
|
+
group.setAttribute("transform", "translate(" + x + ", " + y + ")");
|
|
3153
|
+
parent.appendChild(group);
|
|
3154
|
+
return group;
|
|
3155
|
+
}
|
|
3156
|
+
},
|
|
3157
|
+
{
|
|
3158
|
+
key: "setGroupOptions",
|
|
3159
|
+
value: function setGroupOptions(group, options) {
|
|
3160
|
+
group.setAttribute("fill", options.lineColor);
|
|
3161
|
+
}
|
|
3162
|
+
},
|
|
3163
|
+
{
|
|
3164
|
+
key: "drawRect",
|
|
3165
|
+
value: function drawRect(x, y, width, height, parent) {
|
|
3166
|
+
var rect = this.document.createElementNS(svgns, "rect");
|
|
3167
|
+
rect.setAttribute("x", x);
|
|
3168
|
+
rect.setAttribute("y", y);
|
|
3169
|
+
rect.setAttribute("width", width);
|
|
3170
|
+
rect.setAttribute("height", height);
|
|
3171
|
+
parent.appendChild(rect);
|
|
3172
|
+
return rect;
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
]);
|
|
3176
|
+
return SVGRenderer$1;
|
|
3177
|
+
}();
|
|
3178
|
+
}));
|
|
3179
|
+
var require_object = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3180
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3181
|
+
var _createClass$1 = function() {
|
|
3182
|
+
function defineProperties(target, props) {
|
|
3183
|
+
for (var i = 0; i < props.length; i++) {
|
|
3184
|
+
var descriptor = props[i];
|
|
3185
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
3186
|
+
descriptor.configurable = true;
|
|
3187
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
3188
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
return function(Constructor, protoProps, staticProps) {
|
|
3192
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
3193
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
3194
|
+
return Constructor;
|
|
3195
|
+
};
|
|
3196
|
+
}();
|
|
3197
|
+
function _classCallCheck$2(instance, Constructor) {
|
|
3198
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
3199
|
+
}
|
|
3200
|
+
exports.default = function() {
|
|
3201
|
+
function ObjectRenderer$1(object, encodings$1, options) {
|
|
3202
|
+
_classCallCheck$2(this, ObjectRenderer$1);
|
|
3203
|
+
this.object = object;
|
|
3204
|
+
this.encodings = encodings$1;
|
|
3205
|
+
this.options = options;
|
|
3206
|
+
}
|
|
3207
|
+
_createClass$1(ObjectRenderer$1, [{
|
|
3208
|
+
key: "render",
|
|
3209
|
+
value: function render$1() {
|
|
3210
|
+
this.object.encodings = this.encodings;
|
|
3211
|
+
}
|
|
3212
|
+
}]);
|
|
3213
|
+
return ObjectRenderer$1;
|
|
3214
|
+
}();
|
|
3215
|
+
}));
|
|
3216
|
+
var require_renderers = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3217
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3218
|
+
var _canvas2 = _interopRequireDefault$2(require_canvas());
|
|
3219
|
+
var _svg2 = _interopRequireDefault$2(require_svg());
|
|
3220
|
+
var _object2 = _interopRequireDefault$2(require_object());
|
|
3221
|
+
function _interopRequireDefault$2(obj) {
|
|
3222
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3223
|
+
}
|
|
3224
|
+
exports.default = {
|
|
3225
|
+
CanvasRenderer: _canvas2.default,
|
|
3226
|
+
SVGRenderer: _svg2.default,
|
|
3227
|
+
ObjectRenderer: _object2.default
|
|
3228
|
+
};
|
|
3229
|
+
}));
|
|
3230
|
+
var require_exceptions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3231
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3232
|
+
function _classCallCheck$1(instance, Constructor) {
|
|
3233
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
3234
|
+
}
|
|
3235
|
+
function _possibleConstructorReturn(self, call) {
|
|
3236
|
+
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
3237
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
3238
|
+
}
|
|
3239
|
+
function _inherits(subClass, superClass) {
|
|
3240
|
+
if (typeof superClass !== "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
3241
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
|
|
3242
|
+
value: subClass,
|
|
3243
|
+
enumerable: false,
|
|
3244
|
+
writable: true,
|
|
3245
|
+
configurable: true
|
|
3246
|
+
} });
|
|
3247
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
3248
|
+
}
|
|
3249
|
+
var InvalidInputException = function(_Error) {
|
|
3250
|
+
_inherits(InvalidInputException$1, _Error);
|
|
3251
|
+
function InvalidInputException$1(symbology, input) {
|
|
3252
|
+
_classCallCheck$1(this, InvalidInputException$1);
|
|
3253
|
+
var _this = _possibleConstructorReturn(this, (InvalidInputException$1.__proto__ || Object.getPrototypeOf(InvalidInputException$1)).call(this));
|
|
3254
|
+
_this.name = "InvalidInputException";
|
|
3255
|
+
_this.symbology = symbology;
|
|
3256
|
+
_this.input = input;
|
|
3257
|
+
_this.message = "\"" + _this.input + "\" is not a valid input for " + _this.symbology;
|
|
3258
|
+
return _this;
|
|
3259
|
+
}
|
|
3260
|
+
return InvalidInputException$1;
|
|
3261
|
+
}(Error);
|
|
3262
|
+
var InvalidElementException = function(_Error2) {
|
|
3263
|
+
_inherits(InvalidElementException$1, _Error2);
|
|
3264
|
+
function InvalidElementException$1() {
|
|
3265
|
+
_classCallCheck$1(this, InvalidElementException$1);
|
|
3266
|
+
var _this2 = _possibleConstructorReturn(this, (InvalidElementException$1.__proto__ || Object.getPrototypeOf(InvalidElementException$1)).call(this));
|
|
3267
|
+
_this2.name = "InvalidElementException";
|
|
3268
|
+
_this2.message = "Not supported type to render on";
|
|
3269
|
+
return _this2;
|
|
3270
|
+
}
|
|
3271
|
+
return InvalidElementException$1;
|
|
3272
|
+
}(Error);
|
|
3273
|
+
var NoElementException = function(_Error3) {
|
|
3274
|
+
_inherits(NoElementException$1, _Error3);
|
|
3275
|
+
function NoElementException$1() {
|
|
3276
|
+
_classCallCheck$1(this, NoElementException$1);
|
|
3277
|
+
var _this3 = _possibleConstructorReturn(this, (NoElementException$1.__proto__ || Object.getPrototypeOf(NoElementException$1)).call(this));
|
|
3278
|
+
_this3.name = "NoElementException";
|
|
3279
|
+
_this3.message = "No element to render on.";
|
|
3280
|
+
return _this3;
|
|
3281
|
+
}
|
|
3282
|
+
return NoElementException$1;
|
|
3283
|
+
}(Error);
|
|
3284
|
+
exports.InvalidInputException = InvalidInputException;
|
|
3285
|
+
exports.InvalidElementException = InvalidElementException;
|
|
3286
|
+
exports.NoElementException = NoElementException;
|
|
3287
|
+
}));
|
|
3288
|
+
var require_getRenderProperties = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3289
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3290
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
|
|
3291
|
+
return typeof obj;
|
|
3292
|
+
} : function(obj) {
|
|
3293
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
3294
|
+
};
|
|
3295
|
+
var _getOptionsFromElement2 = _interopRequireDefault$1(require_getOptionsFromElement());
|
|
3296
|
+
var _renderers2 = _interopRequireDefault$1(require_renderers());
|
|
3297
|
+
var _exceptions$1 = require_exceptions();
|
|
3298
|
+
function _interopRequireDefault$1(obj) {
|
|
3299
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3300
|
+
}
|
|
3301
|
+
function getRenderProperties(element) {
|
|
3302
|
+
if (typeof element === "string") return querySelectedRenderProperties(element);
|
|
3303
|
+
else if (Array.isArray(element)) {
|
|
3304
|
+
var returnArray = [];
|
|
3305
|
+
for (var i = 0; i < element.length; i++) returnArray.push(getRenderProperties(element[i]));
|
|
3306
|
+
return returnArray;
|
|
3307
|
+
} else if (typeof HTMLCanvasElement !== "undefined" && element instanceof HTMLImageElement) return newCanvasRenderProperties(element);
|
|
3308
|
+
else if (element && element.nodeName && element.nodeName.toLowerCase() === "svg" || typeof SVGElement !== "undefined" && element instanceof SVGElement) return {
|
|
3309
|
+
element,
|
|
3310
|
+
options: (0, _getOptionsFromElement2.default)(element),
|
|
3311
|
+
renderer: _renderers2.default.SVGRenderer
|
|
3312
|
+
};
|
|
3313
|
+
else if (typeof HTMLCanvasElement !== "undefined" && element instanceof HTMLCanvasElement) return {
|
|
3314
|
+
element,
|
|
3315
|
+
options: (0, _getOptionsFromElement2.default)(element),
|
|
3316
|
+
renderer: _renderers2.default.CanvasRenderer
|
|
3317
|
+
};
|
|
3318
|
+
else if (element && element.getContext) return {
|
|
3319
|
+
element,
|
|
3320
|
+
renderer: _renderers2.default.CanvasRenderer
|
|
3321
|
+
};
|
|
3322
|
+
else if (element && (typeof element === "undefined" ? "undefined" : _typeof(element)) === "object" && !element.nodeName) return {
|
|
3323
|
+
element,
|
|
3324
|
+
renderer: _renderers2.default.ObjectRenderer
|
|
3325
|
+
};
|
|
3326
|
+
else throw new _exceptions$1.InvalidElementException();
|
|
3327
|
+
}
|
|
3328
|
+
function querySelectedRenderProperties(string) {
|
|
3329
|
+
var selector = document.querySelectorAll(string);
|
|
3330
|
+
if (selector.length === 0) return;
|
|
3331
|
+
else {
|
|
3332
|
+
var returnArray = [];
|
|
3333
|
+
for (var i = 0; i < selector.length; i++) returnArray.push(getRenderProperties(selector[i]));
|
|
3334
|
+
return returnArray;
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
function newCanvasRenderProperties(imgElement) {
|
|
3338
|
+
var canvas = document.createElement("canvas");
|
|
3339
|
+
return {
|
|
3340
|
+
element: canvas,
|
|
3341
|
+
options: (0, _getOptionsFromElement2.default)(imgElement),
|
|
3342
|
+
renderer: _renderers2.default.CanvasRenderer,
|
|
3343
|
+
afterRender: function afterRender() {
|
|
3344
|
+
imgElement.setAttribute("src", canvas.toDataURL());
|
|
3345
|
+
}
|
|
3346
|
+
};
|
|
3347
|
+
}
|
|
3348
|
+
exports.default = getRenderProperties;
|
|
3349
|
+
}));
|
|
3350
|
+
var require_ErrorHandler = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3351
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3352
|
+
var _createClass = function() {
|
|
3353
|
+
function defineProperties(target, props) {
|
|
3354
|
+
for (var i = 0; i < props.length; i++) {
|
|
3355
|
+
var descriptor = props[i];
|
|
3356
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
3357
|
+
descriptor.configurable = true;
|
|
3358
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
3359
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
return function(Constructor, protoProps, staticProps) {
|
|
3363
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
3364
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
3365
|
+
return Constructor;
|
|
3366
|
+
};
|
|
3367
|
+
}();
|
|
3368
|
+
function _classCallCheck(instance, Constructor) {
|
|
3369
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
3370
|
+
}
|
|
3371
|
+
exports.default = function() {
|
|
3372
|
+
function ErrorHandler$1(api) {
|
|
3373
|
+
_classCallCheck(this, ErrorHandler$1);
|
|
3374
|
+
this.api = api;
|
|
3375
|
+
}
|
|
3376
|
+
_createClass(ErrorHandler$1, [{
|
|
3377
|
+
key: "handleCatch",
|
|
3378
|
+
value: function handleCatch(e) {
|
|
3379
|
+
if (e.name === "InvalidInputException") if (this.api._options.valid !== this.api._defaults.valid) this.api._options.valid(false);
|
|
3380
|
+
else throw e.message;
|
|
3381
|
+
else throw e;
|
|
3382
|
+
this.api.render = function() {};
|
|
3383
|
+
}
|
|
3384
|
+
}, {
|
|
3385
|
+
key: "wrapBarcodeCall",
|
|
3386
|
+
value: function wrapBarcodeCall(func) {
|
|
3387
|
+
try {
|
|
3388
|
+
var result = func.apply(void 0, arguments);
|
|
3389
|
+
this.api._options.valid(true);
|
|
3390
|
+
return result;
|
|
3391
|
+
} catch (e) {
|
|
3392
|
+
this.handleCatch(e);
|
|
3393
|
+
return this.api;
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
}]);
|
|
3397
|
+
return ErrorHandler$1;
|
|
3398
|
+
}();
|
|
3399
|
+
}));
|
|
3400
|
+
var require_JsBarcode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3401
|
+
var _barcodes2 = _interopRequireDefault(require_barcodes());
|
|
3402
|
+
var _merge2 = _interopRequireDefault(require_merge());
|
|
3403
|
+
var _linearizeEncodings2 = _interopRequireDefault(require_linearizeEncodings());
|
|
3404
|
+
var _fixOptions2 = _interopRequireDefault(require_fixOptions());
|
|
3405
|
+
var _getRenderProperties2 = _interopRequireDefault(require_getRenderProperties());
|
|
3406
|
+
var _optionsFromStrings2 = _interopRequireDefault(require_optionsFromStrings());
|
|
3407
|
+
var _ErrorHandler2 = _interopRequireDefault(require_ErrorHandler());
|
|
3408
|
+
var _exceptions = require_exceptions();
|
|
3409
|
+
var _defaults2 = _interopRequireDefault(require_defaults());
|
|
3410
|
+
function _interopRequireDefault(obj) {
|
|
3411
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3412
|
+
}
|
|
3413
|
+
var API = function API$1() {};
|
|
3414
|
+
var JsBarcode = function JsBarcode$1(element, text, options) {
|
|
3415
|
+
var api = new API();
|
|
3416
|
+
if (typeof element === "undefined") throw Error("No element to render on was provided.");
|
|
3417
|
+
api._renderProperties = (0, _getRenderProperties2.default)(element);
|
|
3418
|
+
api._encodings = [];
|
|
3419
|
+
api._options = _defaults2.default;
|
|
3420
|
+
api._errorHandler = new _ErrorHandler2.default(api);
|
|
3421
|
+
if (typeof text !== "undefined") {
|
|
3422
|
+
options = options || {};
|
|
3423
|
+
if (!options.format) options.format = autoSelectBarcode();
|
|
3424
|
+
api.options(options)[options.format](text, options).render();
|
|
3425
|
+
}
|
|
3426
|
+
return api;
|
|
3427
|
+
};
|
|
3428
|
+
JsBarcode.getModule = function(name$1) {
|
|
3429
|
+
return _barcodes2.default[name$1];
|
|
3430
|
+
};
|
|
3431
|
+
for (var name in _barcodes2.default) if (_barcodes2.default.hasOwnProperty(name)) registerBarcode(_barcodes2.default, name);
|
|
3432
|
+
function registerBarcode(barcodes, name$1) {
|
|
3433
|
+
API.prototype[name$1] = API.prototype[name$1.toUpperCase()] = API.prototype[name$1.toLowerCase()] = function(text, options) {
|
|
3434
|
+
var api = this;
|
|
3435
|
+
return api._errorHandler.wrapBarcodeCall(function() {
|
|
3436
|
+
options.text = typeof options.text === "undefined" ? void 0 : "" + options.text;
|
|
3437
|
+
var newOptions = (0, _merge2.default)(api._options, options);
|
|
3438
|
+
newOptions = (0, _optionsFromStrings2.default)(newOptions);
|
|
3439
|
+
var Encoder = barcodes[name$1];
|
|
3440
|
+
var encoded = encode(text, Encoder, newOptions);
|
|
3441
|
+
api._encodings.push(encoded);
|
|
3442
|
+
return api;
|
|
3443
|
+
});
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
function encode(text, Encoder, options) {
|
|
3447
|
+
text = "" + text;
|
|
3448
|
+
var encoder = new Encoder(text, options);
|
|
3449
|
+
if (!encoder.valid()) throw new _exceptions.InvalidInputException(encoder.constructor.name, text);
|
|
3450
|
+
var encoded = encoder.encode();
|
|
3451
|
+
encoded = (0, _linearizeEncodings2.default)(encoded);
|
|
3452
|
+
for (var i = 0; i < encoded.length; i++) encoded[i].options = (0, _merge2.default)(options, encoded[i].options);
|
|
3453
|
+
return encoded;
|
|
3454
|
+
}
|
|
3455
|
+
function autoSelectBarcode() {
|
|
3456
|
+
if (_barcodes2.default["CODE128"]) return "CODE128";
|
|
3457
|
+
return Object.keys(_barcodes2.default)[0];
|
|
3458
|
+
}
|
|
3459
|
+
API.prototype.options = function(options) {
|
|
3460
|
+
this._options = (0, _merge2.default)(this._options, options);
|
|
3461
|
+
return this;
|
|
3462
|
+
};
|
|
3463
|
+
API.prototype.blank = function(size) {
|
|
3464
|
+
var zeroes = new Array(size + 1).join("0");
|
|
3465
|
+
this._encodings.push({ data: zeroes });
|
|
3466
|
+
return this;
|
|
3467
|
+
};
|
|
3468
|
+
API.prototype.init = function() {
|
|
3469
|
+
if (!this._renderProperties) return;
|
|
3470
|
+
if (!Array.isArray(this._renderProperties)) this._renderProperties = [this._renderProperties];
|
|
3471
|
+
var renderProperty;
|
|
3472
|
+
for (var i in this._renderProperties) {
|
|
3473
|
+
renderProperty = this._renderProperties[i];
|
|
3474
|
+
var options = (0, _merge2.default)(this._options, renderProperty.options);
|
|
3475
|
+
if (options.format == "auto") options.format = autoSelectBarcode();
|
|
3476
|
+
this._errorHandler.wrapBarcodeCall(function() {
|
|
3477
|
+
var text = options.value;
|
|
3478
|
+
var Encoder = _barcodes2.default[options.format.toUpperCase()];
|
|
3479
|
+
var encoded = encode(text, Encoder, options);
|
|
3480
|
+
render(renderProperty, encoded, options);
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
};
|
|
3484
|
+
API.prototype.render = function() {
|
|
3485
|
+
if (!this._renderProperties) throw new _exceptions.NoElementException();
|
|
3486
|
+
if (Array.isArray(this._renderProperties)) for (var i = 0; i < this._renderProperties.length; i++) render(this._renderProperties[i], this._encodings, this._options);
|
|
3487
|
+
else render(this._renderProperties, this._encodings, this._options);
|
|
3488
|
+
return this;
|
|
3489
|
+
};
|
|
3490
|
+
API.prototype._defaults = _defaults2.default;
|
|
3491
|
+
function render(renderProperties, encodings$1, options) {
|
|
3492
|
+
encodings$1 = (0, _linearizeEncodings2.default)(encodings$1);
|
|
3493
|
+
for (var i = 0; i < encodings$1.length; i++) {
|
|
3494
|
+
encodings$1[i].options = (0, _merge2.default)(options, encodings$1[i].options);
|
|
3495
|
+
(0, _fixOptions2.default)(encodings$1[i].options);
|
|
3496
|
+
}
|
|
3497
|
+
(0, _fixOptions2.default)(options);
|
|
3498
|
+
var Renderer = renderProperties.renderer;
|
|
3499
|
+
new Renderer(renderProperties.element, encodings$1, options).render();
|
|
3500
|
+
if (renderProperties.afterRender) renderProperties.afterRender();
|
|
3501
|
+
}
|
|
3502
|
+
if (typeof window !== "undefined") window.JsBarcode = JsBarcode;
|
|
3503
|
+
if (typeof jQuery !== "undefined") jQuery.fn.JsBarcode = function(content, options) {
|
|
3504
|
+
var elementArray = [];
|
|
3505
|
+
jQuery(this).each(function() {
|
|
3506
|
+
elementArray.push(this);
|
|
3507
|
+
});
|
|
3508
|
+
return JsBarcode(elementArray, content, options);
|
|
3509
|
+
};
|
|
3510
|
+
module.exports = JsBarcode;
|
|
3511
|
+
}));
|
|
3512
|
+
export default require_JsBarcode();
|
|
3513
|
+
|
|
3514
|
+
//# sourceMappingURL=JsBarcode-C5ux6wsb.js.map
|