@cling-se/widget 0.17.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddClientCallout-e8d19R3f.js +101 -0
- package/dist/AnswerModal-BGvB8IVV.js +3291 -0
- package/dist/AttachmentItem-CkHbAm4l.js +171 -0
- package/dist/BaseUpload-BiJBcWRu.js +2472 -0
- package/dist/BlockMedia-CW5wgipC.js +103 -0
- package/dist/CCallout-Cy2eeIYd.js +104 -0
- package/dist/{CCurrencyDropdown-C2rXt2cJ.js → CCurrencyDropdown-DE_3CTjm.js} +91 -53
- package/dist/CDropdownItem-Dmq5gYzA.js +751 -0
- package/dist/CFormField.vue_vue_type_script_setup_true_lang-D_U9coAY.js +292 -0
- package/dist/{CPhoneFormat-C8VPsiK6.js → CPhoneFormat-BS2nP9kc.js} +13 -21
- package/dist/CPhoneInput-Bf6329PO.js +207 -0
- package/dist/CPriceInput-d1yjuMQr.js +140 -0
- package/dist/CSelect-DgnT07Hk.js +98 -0
- package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-Ckl--dyv.js +51 -0
- package/dist/ClientAutocomplete-9JzGcO9O.js +532 -0
- package/dist/ClientModal-BzWQtWSZ.js +1181 -0
- package/dist/ColorPicker-BvoFN8nu.js +1408 -0
- package/dist/CompanyModal-Bp4V_az9.js +250 -0
- package/dist/ContentWrapper-CuH6xKmo.js +265 -0
- package/dist/CoverBlockSettings-BA5L0Zee.js +861 -0
- package/dist/DocAnswer-BcNA_KEg.js +33 -0
- package/dist/DocDetails-CStEwWnU.js +448 -0
- package/dist/DocForm-BOoILf5E.js +6748 -0
- package/dist/DocFormSend-CQIf-HJY.js +171 -0
- package/dist/DocLinks-BRX5QzNe.js +36 -0
- package/dist/DocModalBase-D72yWj-x.js +29 -0
- package/dist/DocPrint-BI1LXUPE.js +399 -0
- package/dist/DocReceipt-DaZ4V76p.js +341 -0
- package/dist/DocSendReminder-DKGZlo7s.js +181 -0
- package/dist/DocTextEditor-Dm-cTZpA.js +19413 -0
- package/dist/DocTimeline-DCwofzuk.js +537 -0
- package/dist/DocumentClient-vJdxCB53.js +90 -0
- package/dist/DocumentLayout-CKSi42ev.js +1368 -0
- package/dist/DocumentLogotype-DbQlvQ-y.js +162 -0
- package/dist/DocumentVoided-CRX2WxWO.js +33 -0
- package/dist/EmbedInput-B-oeC4Wy.js +157 -0
- package/dist/EmbedSettings-B9Yka2yB.js +103 -0
- package/dist/ErrorCallout-B_ygH33E.js +34 -0
- package/dist/FilePreviewModal-Bf3ELTow.js +202 -0
- package/dist/Flag-BwTgCNHO.js +41 -0
- package/dist/HeaderSettings-DvC7nlyY.js +720 -0
- package/dist/ImageSelectModal-D3sP3lhR.js +119 -0
- package/dist/ImageUploadWrapper-RWNa-yIq.js +1585 -0
- package/dist/Index-0_3ULrWX.js +126 -0
- package/dist/Index-4NPe0sfX.js +629 -0
- package/dist/Index-B1uA0FF6.js +4 -0
- package/dist/Index-BBkCYm2q.js +201 -0
- package/dist/{Index-LzN6dktq.js → Index-BBwvo7S9.js} +10 -18
- package/dist/Index-BEMlsYwJ.js +68 -0
- package/dist/Index-BRBhJ6kz.js +21 -0
- package/dist/{Index-BPUYpfLJ.js → Index-BTFmHjUt.js} +47 -60
- package/dist/Index-BcUNnxLC.js +1098 -0
- package/dist/Index-Bo6ExBUL.js +93 -0
- package/dist/Index-BvMPCgdH.js +102 -0
- package/dist/Index-Bx5TOI9k.js +74 -0
- package/dist/Index-C7GZS8EI.js +16 -0
- package/dist/Index-CNWhm07R.js +25 -0
- package/dist/{Index-BUK-1yVR.js → Index-CQpznMKV.js} +9 -17
- package/dist/Index-CRzsnIij.js +159 -0
- package/dist/Index-CeSG1C41.js +140 -0
- package/dist/Index-CjfjdZj5.js +52 -0
- package/dist/Index-CskKmZpd.js +363 -0
- package/dist/Index-D5qwbCo1.js +28 -0
- package/dist/Index-D8Ae1Txt.js +228 -0
- package/dist/Index-DE8aenDB.js +3452 -0
- package/dist/Index-DI5EB5Rt.js +39 -0
- package/dist/Index-DaV57YPP.js +163 -0
- package/dist/Index-DbwkmoyM.js +38 -0
- package/dist/Index-Df9skok6.js +70 -0
- package/dist/{Index-BHJGfHm9.js → Index-DfLLA0ij.js} +313 -206
- package/dist/Index-Dw1CO5F9.js +76 -0
- package/dist/Index-PZXyOoVb.js +87 -0
- package/dist/{Index-BioOegOO.js → Index-ZUnH-BHj.js} +10 -18
- package/dist/Index-cjKGSiDi.js +136 -0
- package/dist/Index-m-goRuKD.js +49 -0
- package/dist/Index-rGeWbLcB.js +47 -0
- package/dist/Index-vrljNp6G.js +28 -0
- package/dist/Index.vue_vue_type_script_lang-aeVuChGF.js +671 -0
- package/dist/InputToggleRow-v6qAWPg6.js +99 -0
- package/dist/ManualPopover-BONBJIUA.js +57 -0
- package/dist/MediaWrapper-CXb2UGd9.js +18 -0
- package/dist/{NotBindingText-CM3FN0A6.js → NotBindingText-BqESO13N.js} +13 -17
- package/dist/PackageGroup-AIysVmyh.js +1058 -0
- package/dist/PdfTerms-BlhHdTu3.js +34 -0
- package/dist/PdfViewer-DwZ1rwlN.js +392 -0
- package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D6NNUTz0.js +17 -0
- package/dist/PriceHeader-C4XhnoA3.js +488 -0
- package/dist/SearchApi-B7lXgUY6.js +137 -0
- package/dist/SendForm-BcD0xSvB.js +7031 -0
- package/dist/Setup-C2qaYDei.js +47 -0
- package/dist/{SmartList-DhhjSWLO.js → SmartList-DqG7Q5t7.js} +16 -24
- package/dist/Sortable.vue_vue_type_script_setup_true_lang-CzMbr8AX.js +1303 -0
- package/dist/{TermsSettings-BEQwmkFH.js → TermsSettings-BOCONyM4.js} +169 -56
- package/dist/ThemeColorRow-sjGdMzGN.js +108 -0
- package/dist/ToggleBinding-7oq_oXPt.js +44 -0
- package/dist/UploadModal-C_X2NjVY.js +134 -0
- package/dist/VideoPlayerInput-BsUcmpl4.js +135 -0
- package/dist/VideoPlayerSettings-BXMmxaZQ.js +78 -0
- package/dist/VideoSelectModal-CW0OweCw.js +217 -0
- package/dist/{anime.es-BrPTThYb.js → anime.es-gdcpA-eY.js} +1 -2
- package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
- package/dist/{debounce-D0hKNU85.js → debounce-DNl99Gyo.js} +10 -10
- package/dist/dom-CkTGWrfu.js +69 -0
- package/dist/{focusDrawerMixin-C_aTLmK0.js → focusDrawerMixin-BwcErMDY.js} +1 -1
- package/dist/{formDrawerState-Da4mcbab.js → formDrawerState-DaurePnd.js} +2 -2
- package/dist/helpers-CPW--XIz.js +44 -0
- package/dist/index-BjiGCJPI.js +149 -0
- package/dist/index-CFNv6OvX.js +188 -0
- package/dist/index-Cx71On5Z.js +508 -0
- package/dist/index-DKMxIBz_.js +270 -0
- package/dist/index-DKf5SGLD.js +125 -0
- package/dist/index-E32WgUp9.js +3525 -0
- package/dist/index-kp-GC5I0.js +513 -0
- package/dist/index.es.js +2 -5
- package/dist/index.umd.js +285 -1485
- package/dist/{main-BgzLHIoo.js → main-Cb-nyil1.js} +41414 -42507
- package/dist/mapFormMixin-D3BihYWW.js +1544 -0
- package/dist/omit--YYr41Xp.js +31 -0
- package/dist/{publicSenderState-DB4BHByV.js → publicSenderState-CdRW_Wwp.js} +4 -4
- package/dist/splitpanes-D-ThFkeR.js +342 -0
- package/dist/style.css +1 -4
- package/dist/template-BvaNnq-g.js +1493 -0
- package/dist/{throttle-DT2UVOqm.js → throttle-D-bUGaVh.js} +2 -2
- package/dist/tippy.esm-BmKNqohP.js +1994 -0
- package/dist/useTermsModal-Dhf6_eYb.js +87 -0
- package/dist/{utils-nos8CB1L.js → utils-CBPcYdLv.js} +8 -11
- package/dist/validation-DOcUOoMe.js +40 -0
- package/package.json +18 -21
- package/dist/AddClientCallout-BJzBdba1.js +0 -48
- package/dist/AnswerModal-frHq1g4s.js +0 -3874
- package/dist/AttachmentItem-BaN0OrEV.js +0 -85
- package/dist/BaseDatePicker-B-AfdrSb.js +0 -3187
- package/dist/BaseUpload-CY3lTcte.js +0 -1977
- package/dist/BlockMedia-Bb5wQIDg.js +0 -76
- package/dist/CCallout-5quI6yyk.js +0 -58
- package/dist/CDropdownItem-CaoSQX6X.js +0 -640
- package/dist/CFormField-Dd2Y71JG.js +0 -240
- package/dist/CPhoneInput-BU1t6eo_.js +0 -138
- package/dist/CPriceInput-pv2aIVkH.js +0 -116
- package/dist/CSelect-CrM45B7V.js +0 -91
- package/dist/CSkeleton-BkvONMqL.js +0 -55
- package/dist/ClientAutocomplete-BRXIKQSk.js +0 -438
- package/dist/ClientModal-CvHAptV2.js +0 -666
- package/dist/ColorPicker-RgoXRrud.js +0 -2879
- package/dist/CompanyModal-OL4bD9Gk.js +0 -147
- package/dist/ContentWrapper-8HduCnR4.js +0 -190
- package/dist/CoverBlockSettings-DUv8AcdX.js +0 -659
- package/dist/DocAnswer-DiyFfpT2.js +0 -36
- package/dist/DocDetails-BxNRfBnK.js +0 -263
- package/dist/DocForm-MGp-o0pu.js +0 -5017
- package/dist/DocFormSend-q_QuVCqh.js +0 -146
- package/dist/DocLinks-DGDdp30U.js +0 -38
- package/dist/DocModalBase-qG4RqwBn.js +0 -28
- package/dist/DocPrint-Cln3kt0g.js +0 -240
- package/dist/DocReceipt-nbsJ-ukZ.js +0 -217
- package/dist/DocSendReminder-B3qdqduf.js +0 -140
- package/dist/DocTextEditor-CQDnjnRY.js +0 -17193
- package/dist/DocTimeline-CgKHoDcG.js +0 -485
- package/dist/DocumentClient-UZlnIlz5.js +0 -136
- package/dist/DocumentLayout-Dvr4zgyF.js +0 -4880
- package/dist/DocumentLogotype-mAVgMRHr.js +0 -92
- package/dist/DocumentVoided-BXYNrf_6.js +0 -25
- package/dist/EmbedInput-YRUrw3c6.js +0 -117
- package/dist/EmbedSettings-DvRreF7H.js +0 -74
- package/dist/ErrorCallout-DVknpLVY.js +0 -27
- package/dist/FilePreviewModal-DC56FaGy.js +0 -81
- package/dist/Flag-D5iZLESg.js +0 -46
- package/dist/HeaderSettings-DXZnZL7A.js +0 -440
- package/dist/ImageSelectModal-Bu4_xZga.js +0 -86
- package/dist/ImageUploadWrapper-CtZhkAm1.js +0 -1604
- package/dist/Index-B1dJO6Bk.js +0 -54
- package/dist/Index-B3pz1coY.js +0 -150
- package/dist/Index-BHgW8EHW.js +0 -2446
- package/dist/Index-BNucs2O-.js +0 -154
- package/dist/Index-BW-EtZ1z.js +0 -55
- package/dist/Index-BjKACpun.js +0 -66
- package/dist/Index-C94BL4uU.js +0 -294
- package/dist/Index-CB57haU8.js +0 -58
- package/dist/Index-CP17iXT6.js +0 -25
- package/dist/Index-CUSbvjoD.js +0 -62
- package/dist/Index-CVnD6jo5.js +0 -25
- package/dist/Index-Ci5zdPeT.js +0 -28
- package/dist/Index-CikqSMjb.js +0 -41
- package/dist/Index-CxO4tJ3U.js +0 -26
- package/dist/Index-D4J4BpHd.js +0 -230
- package/dist/Index-DAQQQlut.js +0 -754
- package/dist/Index-DNxSR72J.js +0 -73
- package/dist/Index-DPuKRwmu.js +0 -41
- package/dist/Index-DSy8QG8T.js +0 -32
- package/dist/Index-DX6_D-J-.js +0 -77
- package/dist/Index-Dk0KaIKg.js +0 -643
- package/dist/Index-Hkzoh9QR.js +0 -24
- package/dist/Index-KsHJxWAa.js +0 -94
- package/dist/Index-TtItTuv6.js +0 -33
- package/dist/Index-YAD39Qvg.js +0 -146
- package/dist/Index-eh909lAz.js +0 -107
- package/dist/Index-otowKI_C.js +0 -56
- package/dist/Index-t_oVV8Rc.js +0 -84
- package/dist/Index-vG96oEXZ.js +0 -144
- package/dist/InputToggleRow-CcqJDguN.js +0 -57
- package/dist/ManualPopover-BE2IN-XU.js +0 -60
- package/dist/MediaWrapper-lnGUFiyc.js +0 -23
- package/dist/PackageGroup-BsmxOMLW.js +0 -704
- package/dist/PdfTerms-BgYwZoAZ.js +0 -31
- package/dist/PdfViewer-C0lDpjte.js +0 -383
- package/dist/PlainHtml-5YwYVj1v.js +0 -27
- package/dist/PriceHeader-CxqhpGS-.js +0 -338
- package/dist/SearchApi-BndaIbri.js +0 -161
- package/dist/SendForm-D7U9fG-5.js +0 -1023
- package/dist/Setup-CmAK2_ZT.js +0 -50
- package/dist/ThemeColorRow-BlnhzebY.js +0 -69
- package/dist/ToggleBinding-t_58JFya.js +0 -42
- package/dist/UploadModal-T-WpYNsN.js +0 -95
- package/dist/VideoPlayerInput-DKHKjMgX.js +0 -97
- package/dist/VideoPlayerSettings-DDMlUvSt.js +0 -61
- package/dist/VideoSelectModal-B9bbP0dd.js +0 -104
- package/dist/answerDocumentMixin-DXI_E5Kx.js +0 -51
- package/dist/dom-CWsqMElk.js +0 -71
- package/dist/formValidationMixin-WZ2lGndu.js +0 -49
- package/dist/index-B2l57ilt.js +0 -102
- package/dist/index-COKDjmM2.js +0 -167
- package/dist/index-HtKGcIng.js +0 -2700
- package/dist/index-LQ7NztTt.js +0 -81
- package/dist/index-fx5gR8fM.js +0 -351
- package/dist/index-zXXJrTvv.js +0 -492
- package/dist/mapFormMixin-CQgSN7dv.js +0 -3028
- package/dist/omit-ScS7B6c5.js +0 -31
- package/dist/simplebar.min-B0cB_p8g.js +0 -71
- package/dist/splitpanes-BHUVsCZF.js +0 -382
- package/dist/tippy.esm-CR89mtdY.js +0 -1805
- package/dist/vuedraggable.umd-CkXXkt1b.js +0 -3161
- package/dist/vuex.esm-DKGl8mcw.js +0 -467
|
@@ -0,0 +1,3291 @@
|
|
|
1
|
+
import { m as J } from "./mapFormMixin-D3BihYWW.js";
|
|
2
|
+
import { h as se, ai as wt, eb as ie, aA as At, y as bt, ec as oe, T as Ot, _ as X, ed as re, ee as ae, b as M, o as P, d as S, s as g, e as b, f as $, F as ct, c as G, w as A, v as C, B as z, aj as Pt, n as Bt, E as le, G as ce, ef as de, a as ue, g as dt, q as $t, ay as Dt, aq as he, bp as fe } from "./main-Cb-nyil1.js";
|
|
3
|
+
import { a as L } from "./anime.es-gdcpA-eY.js";
|
|
4
|
+
import { _ as ge } from "./CFormField.vue_vue_type_script_setup_true_lang-D_U9coAY.js";
|
|
5
|
+
var me = function() {
|
|
6
|
+
return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
|
|
7
|
+
}, zt = {}, I = {};
|
|
8
|
+
let Et;
|
|
9
|
+
const pe = [
|
|
10
|
+
0,
|
|
11
|
+
// Not used
|
|
12
|
+
26,
|
|
13
|
+
44,
|
|
14
|
+
70,
|
|
15
|
+
100,
|
|
16
|
+
134,
|
|
17
|
+
172,
|
|
18
|
+
196,
|
|
19
|
+
242,
|
|
20
|
+
292,
|
|
21
|
+
346,
|
|
22
|
+
404,
|
|
23
|
+
466,
|
|
24
|
+
532,
|
|
25
|
+
581,
|
|
26
|
+
655,
|
|
27
|
+
733,
|
|
28
|
+
815,
|
|
29
|
+
901,
|
|
30
|
+
991,
|
|
31
|
+
1085,
|
|
32
|
+
1156,
|
|
33
|
+
1258,
|
|
34
|
+
1364,
|
|
35
|
+
1474,
|
|
36
|
+
1588,
|
|
37
|
+
1706,
|
|
38
|
+
1828,
|
|
39
|
+
1921,
|
|
40
|
+
2051,
|
|
41
|
+
2185,
|
|
42
|
+
2323,
|
|
43
|
+
2465,
|
|
44
|
+
2611,
|
|
45
|
+
2761,
|
|
46
|
+
2876,
|
|
47
|
+
3034,
|
|
48
|
+
3196,
|
|
49
|
+
3362,
|
|
50
|
+
3532,
|
|
51
|
+
3706
|
|
52
|
+
];
|
|
53
|
+
I.getSymbolSize = function(t) {
|
|
54
|
+
if (!t) throw new Error('"version" cannot be null or undefined');
|
|
55
|
+
if (t < 1 || t > 40) throw new Error('"version" should be in range from 1 to 40');
|
|
56
|
+
return t * 4 + 17;
|
|
57
|
+
};
|
|
58
|
+
I.getSymbolTotalCodewords = function(t) {
|
|
59
|
+
return pe[t];
|
|
60
|
+
};
|
|
61
|
+
I.getBCHDigit = function(e) {
|
|
62
|
+
let t = 0;
|
|
63
|
+
for (; e !== 0; )
|
|
64
|
+
t++, e >>>= 1;
|
|
65
|
+
return t;
|
|
66
|
+
};
|
|
67
|
+
I.setToSJISFunction = function(t) {
|
|
68
|
+
if (typeof t != "function")
|
|
69
|
+
throw new Error('"toSJISFunc" is not a valid function.');
|
|
70
|
+
Et = t;
|
|
71
|
+
};
|
|
72
|
+
I.isKanjiModeEnabled = function() {
|
|
73
|
+
return typeof Et < "u";
|
|
74
|
+
};
|
|
75
|
+
I.toSJIS = function(t) {
|
|
76
|
+
return Et(t);
|
|
77
|
+
};
|
|
78
|
+
var it = {};
|
|
79
|
+
(function(e) {
|
|
80
|
+
e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
|
|
81
|
+
function t(i) {
|
|
82
|
+
if (typeof i != "string")
|
|
83
|
+
throw new Error("Param is not a string");
|
|
84
|
+
switch (i.toLowerCase()) {
|
|
85
|
+
case "l":
|
|
86
|
+
case "low":
|
|
87
|
+
return e.L;
|
|
88
|
+
case "m":
|
|
89
|
+
case "medium":
|
|
90
|
+
return e.M;
|
|
91
|
+
case "q":
|
|
92
|
+
case "quartile":
|
|
93
|
+
return e.Q;
|
|
94
|
+
case "h":
|
|
95
|
+
case "high":
|
|
96
|
+
return e.H;
|
|
97
|
+
default:
|
|
98
|
+
throw new Error("Unknown EC Level: " + i);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
e.isValid = function(s) {
|
|
102
|
+
return s && typeof s.bit < "u" && s.bit >= 0 && s.bit < 4;
|
|
103
|
+
}, e.from = function(s, n) {
|
|
104
|
+
if (e.isValid(s))
|
|
105
|
+
return s;
|
|
106
|
+
try {
|
|
107
|
+
return t(s);
|
|
108
|
+
} catch {
|
|
109
|
+
return n;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
})(it);
|
|
113
|
+
function jt() {
|
|
114
|
+
this.buffer = [], this.length = 0;
|
|
115
|
+
}
|
|
116
|
+
jt.prototype = {
|
|
117
|
+
get: function(e) {
|
|
118
|
+
const t = Math.floor(e / 8);
|
|
119
|
+
return (this.buffer[t] >>> 7 - e % 8 & 1) === 1;
|
|
120
|
+
},
|
|
121
|
+
put: function(e, t) {
|
|
122
|
+
for (let i = 0; i < t; i++)
|
|
123
|
+
this.putBit((e >>> t - i - 1 & 1) === 1);
|
|
124
|
+
},
|
|
125
|
+
getLengthInBits: function() {
|
|
126
|
+
return this.length;
|
|
127
|
+
},
|
|
128
|
+
putBit: function(e) {
|
|
129
|
+
const t = Math.floor(this.length / 8);
|
|
130
|
+
this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var we = jt;
|
|
134
|
+
function Q(e) {
|
|
135
|
+
if (!e || e < 1)
|
|
136
|
+
throw new Error("BitMatrix size must be defined and greater than 0");
|
|
137
|
+
this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
|
|
138
|
+
}
|
|
139
|
+
Q.prototype.set = function(e, t, i, s) {
|
|
140
|
+
const n = e * this.size + t;
|
|
141
|
+
this.data[n] = i, s && (this.reservedBit[n] = !0);
|
|
142
|
+
};
|
|
143
|
+
Q.prototype.get = function(e, t) {
|
|
144
|
+
return this.data[e * this.size + t];
|
|
145
|
+
};
|
|
146
|
+
Q.prototype.xor = function(e, t, i) {
|
|
147
|
+
this.data[e * this.size + t] ^= i;
|
|
148
|
+
};
|
|
149
|
+
Q.prototype.isReserved = function(e, t) {
|
|
150
|
+
return this.reservedBit[e * this.size + t];
|
|
151
|
+
};
|
|
152
|
+
var ye = Q, Wt = {};
|
|
153
|
+
(function(e) {
|
|
154
|
+
const t = I.getSymbolSize;
|
|
155
|
+
e.getRowColCoords = function(s) {
|
|
156
|
+
if (s === 1) return [];
|
|
157
|
+
const n = Math.floor(s / 7) + 2, o = t(s), r = o === 145 ? 26 : Math.ceil((o - 13) / (2 * n - 2)) * 2, a = [o - 7];
|
|
158
|
+
for (let l = 1; l < n - 1; l++)
|
|
159
|
+
a[l] = a[l - 1] - r;
|
|
160
|
+
return a.push(6), a.reverse();
|
|
161
|
+
}, e.getPositions = function(s) {
|
|
162
|
+
const n = [], o = e.getRowColCoords(s), r = o.length;
|
|
163
|
+
for (let a = 0; a < r; a++)
|
|
164
|
+
for (let l = 0; l < r; l++)
|
|
165
|
+
a === 0 && l === 0 || // top-left
|
|
166
|
+
a === 0 && l === r - 1 || // bottom-left
|
|
167
|
+
a === r - 1 && l === 0 || n.push([o[a], o[l]]);
|
|
168
|
+
return n;
|
|
169
|
+
};
|
|
170
|
+
})(Wt);
|
|
171
|
+
var Vt = {};
|
|
172
|
+
const ve = I.getSymbolSize, Ft = 7;
|
|
173
|
+
Vt.getPositions = function(t) {
|
|
174
|
+
const i = ve(t);
|
|
175
|
+
return [
|
|
176
|
+
// top-left
|
|
177
|
+
[0, 0],
|
|
178
|
+
// top-right
|
|
179
|
+
[i - Ft, 0],
|
|
180
|
+
// bottom-left
|
|
181
|
+
[0, i - Ft]
|
|
182
|
+
];
|
|
183
|
+
};
|
|
184
|
+
var Ht = {};
|
|
185
|
+
(function(e) {
|
|
186
|
+
e.Patterns = {
|
|
187
|
+
PATTERN000: 0,
|
|
188
|
+
PATTERN001: 1,
|
|
189
|
+
PATTERN010: 2,
|
|
190
|
+
PATTERN011: 3,
|
|
191
|
+
PATTERN100: 4,
|
|
192
|
+
PATTERN101: 5,
|
|
193
|
+
PATTERN110: 6,
|
|
194
|
+
PATTERN111: 7
|
|
195
|
+
};
|
|
196
|
+
const t = {
|
|
197
|
+
N1: 3,
|
|
198
|
+
N2: 3,
|
|
199
|
+
N3: 40,
|
|
200
|
+
N4: 10
|
|
201
|
+
};
|
|
202
|
+
e.isValid = function(n) {
|
|
203
|
+
return n != null && n !== "" && !isNaN(n) && n >= 0 && n <= 7;
|
|
204
|
+
}, e.from = function(n) {
|
|
205
|
+
return e.isValid(n) ? parseInt(n, 10) : void 0;
|
|
206
|
+
}, e.getPenaltyN1 = function(n) {
|
|
207
|
+
const o = n.size;
|
|
208
|
+
let r = 0, a = 0, l = 0, d = null, c = null;
|
|
209
|
+
for (let m = 0; m < o; m++) {
|
|
210
|
+
a = l = 0, d = c = null;
|
|
211
|
+
for (let p = 0; p < o; p++) {
|
|
212
|
+
let u = n.get(m, p);
|
|
213
|
+
u === d ? a++ : (a >= 5 && (r += t.N1 + (a - 5)), d = u, a = 1), u = n.get(p, m), u === c ? l++ : (l >= 5 && (r += t.N1 + (l - 5)), c = u, l = 1);
|
|
214
|
+
}
|
|
215
|
+
a >= 5 && (r += t.N1 + (a - 5)), l >= 5 && (r += t.N1 + (l - 5));
|
|
216
|
+
}
|
|
217
|
+
return r;
|
|
218
|
+
}, e.getPenaltyN2 = function(n) {
|
|
219
|
+
const o = n.size;
|
|
220
|
+
let r = 0;
|
|
221
|
+
for (let a = 0; a < o - 1; a++)
|
|
222
|
+
for (let l = 0; l < o - 1; l++) {
|
|
223
|
+
const d = n.get(a, l) + n.get(a, l + 1) + n.get(a + 1, l) + n.get(a + 1, l + 1);
|
|
224
|
+
(d === 4 || d === 0) && r++;
|
|
225
|
+
}
|
|
226
|
+
return r * t.N2;
|
|
227
|
+
}, e.getPenaltyN3 = function(n) {
|
|
228
|
+
const o = n.size;
|
|
229
|
+
let r = 0, a = 0, l = 0;
|
|
230
|
+
for (let d = 0; d < o; d++) {
|
|
231
|
+
a = l = 0;
|
|
232
|
+
for (let c = 0; c < o; c++)
|
|
233
|
+
a = a << 1 & 2047 | n.get(d, c), c >= 10 && (a === 1488 || a === 93) && r++, l = l << 1 & 2047 | n.get(c, d), c >= 10 && (l === 1488 || l === 93) && r++;
|
|
234
|
+
}
|
|
235
|
+
return r * t.N3;
|
|
236
|
+
}, e.getPenaltyN4 = function(n) {
|
|
237
|
+
let o = 0;
|
|
238
|
+
const r = n.data.length;
|
|
239
|
+
for (let l = 0; l < r; l++) o += n.data[l];
|
|
240
|
+
return Math.abs(Math.ceil(o * 100 / r / 5) - 10) * t.N4;
|
|
241
|
+
};
|
|
242
|
+
function i(s, n, o) {
|
|
243
|
+
switch (s) {
|
|
244
|
+
case e.Patterns.PATTERN000:
|
|
245
|
+
return (n + o) % 2 === 0;
|
|
246
|
+
case e.Patterns.PATTERN001:
|
|
247
|
+
return n % 2 === 0;
|
|
248
|
+
case e.Patterns.PATTERN010:
|
|
249
|
+
return o % 3 === 0;
|
|
250
|
+
case e.Patterns.PATTERN011:
|
|
251
|
+
return (n + o) % 3 === 0;
|
|
252
|
+
case e.Patterns.PATTERN100:
|
|
253
|
+
return (Math.floor(n / 2) + Math.floor(o / 3)) % 2 === 0;
|
|
254
|
+
case e.Patterns.PATTERN101:
|
|
255
|
+
return n * o % 2 + n * o % 3 === 0;
|
|
256
|
+
case e.Patterns.PATTERN110:
|
|
257
|
+
return (n * o % 2 + n * o % 3) % 2 === 0;
|
|
258
|
+
case e.Patterns.PATTERN111:
|
|
259
|
+
return (n * o % 3 + (n + o) % 2) % 2 === 0;
|
|
260
|
+
default:
|
|
261
|
+
throw new Error("bad maskPattern:" + s);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
e.applyMask = function(n, o) {
|
|
265
|
+
const r = o.size;
|
|
266
|
+
for (let a = 0; a < r; a++)
|
|
267
|
+
for (let l = 0; l < r; l++)
|
|
268
|
+
o.isReserved(l, a) || o.xor(l, a, i(n, l, a));
|
|
269
|
+
}, e.getBestMask = function(n, o) {
|
|
270
|
+
const r = Object.keys(e.Patterns).length;
|
|
271
|
+
let a = 0, l = 1 / 0;
|
|
272
|
+
for (let d = 0; d < r; d++) {
|
|
273
|
+
o(d), e.applyMask(d, n);
|
|
274
|
+
const c = e.getPenaltyN1(n) + e.getPenaltyN2(n) + e.getPenaltyN3(n) + e.getPenaltyN4(n);
|
|
275
|
+
e.applyMask(d, n), c < l && (l = c, a = d);
|
|
276
|
+
}
|
|
277
|
+
return a;
|
|
278
|
+
};
|
|
279
|
+
})(Ht);
|
|
280
|
+
var ot = {};
|
|
281
|
+
const U = it, Z = [
|
|
282
|
+
// L M Q H
|
|
283
|
+
1,
|
|
284
|
+
1,
|
|
285
|
+
1,
|
|
286
|
+
1,
|
|
287
|
+
1,
|
|
288
|
+
1,
|
|
289
|
+
1,
|
|
290
|
+
1,
|
|
291
|
+
1,
|
|
292
|
+
1,
|
|
293
|
+
2,
|
|
294
|
+
2,
|
|
295
|
+
1,
|
|
296
|
+
2,
|
|
297
|
+
2,
|
|
298
|
+
4,
|
|
299
|
+
1,
|
|
300
|
+
2,
|
|
301
|
+
4,
|
|
302
|
+
4,
|
|
303
|
+
2,
|
|
304
|
+
4,
|
|
305
|
+
4,
|
|
306
|
+
4,
|
|
307
|
+
2,
|
|
308
|
+
4,
|
|
309
|
+
6,
|
|
310
|
+
5,
|
|
311
|
+
2,
|
|
312
|
+
4,
|
|
313
|
+
6,
|
|
314
|
+
6,
|
|
315
|
+
2,
|
|
316
|
+
5,
|
|
317
|
+
8,
|
|
318
|
+
8,
|
|
319
|
+
4,
|
|
320
|
+
5,
|
|
321
|
+
8,
|
|
322
|
+
8,
|
|
323
|
+
4,
|
|
324
|
+
5,
|
|
325
|
+
8,
|
|
326
|
+
11,
|
|
327
|
+
4,
|
|
328
|
+
8,
|
|
329
|
+
10,
|
|
330
|
+
11,
|
|
331
|
+
4,
|
|
332
|
+
9,
|
|
333
|
+
12,
|
|
334
|
+
16,
|
|
335
|
+
4,
|
|
336
|
+
9,
|
|
337
|
+
16,
|
|
338
|
+
16,
|
|
339
|
+
6,
|
|
340
|
+
10,
|
|
341
|
+
12,
|
|
342
|
+
18,
|
|
343
|
+
6,
|
|
344
|
+
10,
|
|
345
|
+
17,
|
|
346
|
+
16,
|
|
347
|
+
6,
|
|
348
|
+
11,
|
|
349
|
+
16,
|
|
350
|
+
19,
|
|
351
|
+
6,
|
|
352
|
+
13,
|
|
353
|
+
18,
|
|
354
|
+
21,
|
|
355
|
+
7,
|
|
356
|
+
14,
|
|
357
|
+
21,
|
|
358
|
+
25,
|
|
359
|
+
8,
|
|
360
|
+
16,
|
|
361
|
+
20,
|
|
362
|
+
25,
|
|
363
|
+
8,
|
|
364
|
+
17,
|
|
365
|
+
23,
|
|
366
|
+
25,
|
|
367
|
+
9,
|
|
368
|
+
17,
|
|
369
|
+
23,
|
|
370
|
+
34,
|
|
371
|
+
9,
|
|
372
|
+
18,
|
|
373
|
+
25,
|
|
374
|
+
30,
|
|
375
|
+
10,
|
|
376
|
+
20,
|
|
377
|
+
27,
|
|
378
|
+
32,
|
|
379
|
+
12,
|
|
380
|
+
21,
|
|
381
|
+
29,
|
|
382
|
+
35,
|
|
383
|
+
12,
|
|
384
|
+
23,
|
|
385
|
+
34,
|
|
386
|
+
37,
|
|
387
|
+
12,
|
|
388
|
+
25,
|
|
389
|
+
34,
|
|
390
|
+
40,
|
|
391
|
+
13,
|
|
392
|
+
26,
|
|
393
|
+
35,
|
|
394
|
+
42,
|
|
395
|
+
14,
|
|
396
|
+
28,
|
|
397
|
+
38,
|
|
398
|
+
45,
|
|
399
|
+
15,
|
|
400
|
+
29,
|
|
401
|
+
40,
|
|
402
|
+
48,
|
|
403
|
+
16,
|
|
404
|
+
31,
|
|
405
|
+
43,
|
|
406
|
+
51,
|
|
407
|
+
17,
|
|
408
|
+
33,
|
|
409
|
+
45,
|
|
410
|
+
54,
|
|
411
|
+
18,
|
|
412
|
+
35,
|
|
413
|
+
48,
|
|
414
|
+
57,
|
|
415
|
+
19,
|
|
416
|
+
37,
|
|
417
|
+
51,
|
|
418
|
+
60,
|
|
419
|
+
19,
|
|
420
|
+
38,
|
|
421
|
+
53,
|
|
422
|
+
63,
|
|
423
|
+
20,
|
|
424
|
+
40,
|
|
425
|
+
56,
|
|
426
|
+
66,
|
|
427
|
+
21,
|
|
428
|
+
43,
|
|
429
|
+
59,
|
|
430
|
+
70,
|
|
431
|
+
22,
|
|
432
|
+
45,
|
|
433
|
+
62,
|
|
434
|
+
74,
|
|
435
|
+
24,
|
|
436
|
+
47,
|
|
437
|
+
65,
|
|
438
|
+
77,
|
|
439
|
+
25,
|
|
440
|
+
49,
|
|
441
|
+
68,
|
|
442
|
+
81
|
|
443
|
+
], tt = [
|
|
444
|
+
// L M Q H
|
|
445
|
+
7,
|
|
446
|
+
10,
|
|
447
|
+
13,
|
|
448
|
+
17,
|
|
449
|
+
10,
|
|
450
|
+
16,
|
|
451
|
+
22,
|
|
452
|
+
28,
|
|
453
|
+
15,
|
|
454
|
+
26,
|
|
455
|
+
36,
|
|
456
|
+
44,
|
|
457
|
+
20,
|
|
458
|
+
36,
|
|
459
|
+
52,
|
|
460
|
+
64,
|
|
461
|
+
26,
|
|
462
|
+
48,
|
|
463
|
+
72,
|
|
464
|
+
88,
|
|
465
|
+
36,
|
|
466
|
+
64,
|
|
467
|
+
96,
|
|
468
|
+
112,
|
|
469
|
+
40,
|
|
470
|
+
72,
|
|
471
|
+
108,
|
|
472
|
+
130,
|
|
473
|
+
48,
|
|
474
|
+
88,
|
|
475
|
+
132,
|
|
476
|
+
156,
|
|
477
|
+
60,
|
|
478
|
+
110,
|
|
479
|
+
160,
|
|
480
|
+
192,
|
|
481
|
+
72,
|
|
482
|
+
130,
|
|
483
|
+
192,
|
|
484
|
+
224,
|
|
485
|
+
80,
|
|
486
|
+
150,
|
|
487
|
+
224,
|
|
488
|
+
264,
|
|
489
|
+
96,
|
|
490
|
+
176,
|
|
491
|
+
260,
|
|
492
|
+
308,
|
|
493
|
+
104,
|
|
494
|
+
198,
|
|
495
|
+
288,
|
|
496
|
+
352,
|
|
497
|
+
120,
|
|
498
|
+
216,
|
|
499
|
+
320,
|
|
500
|
+
384,
|
|
501
|
+
132,
|
|
502
|
+
240,
|
|
503
|
+
360,
|
|
504
|
+
432,
|
|
505
|
+
144,
|
|
506
|
+
280,
|
|
507
|
+
408,
|
|
508
|
+
480,
|
|
509
|
+
168,
|
|
510
|
+
308,
|
|
511
|
+
448,
|
|
512
|
+
532,
|
|
513
|
+
180,
|
|
514
|
+
338,
|
|
515
|
+
504,
|
|
516
|
+
588,
|
|
517
|
+
196,
|
|
518
|
+
364,
|
|
519
|
+
546,
|
|
520
|
+
650,
|
|
521
|
+
224,
|
|
522
|
+
416,
|
|
523
|
+
600,
|
|
524
|
+
700,
|
|
525
|
+
224,
|
|
526
|
+
442,
|
|
527
|
+
644,
|
|
528
|
+
750,
|
|
529
|
+
252,
|
|
530
|
+
476,
|
|
531
|
+
690,
|
|
532
|
+
816,
|
|
533
|
+
270,
|
|
534
|
+
504,
|
|
535
|
+
750,
|
|
536
|
+
900,
|
|
537
|
+
300,
|
|
538
|
+
560,
|
|
539
|
+
810,
|
|
540
|
+
960,
|
|
541
|
+
312,
|
|
542
|
+
588,
|
|
543
|
+
870,
|
|
544
|
+
1050,
|
|
545
|
+
336,
|
|
546
|
+
644,
|
|
547
|
+
952,
|
|
548
|
+
1110,
|
|
549
|
+
360,
|
|
550
|
+
700,
|
|
551
|
+
1020,
|
|
552
|
+
1200,
|
|
553
|
+
390,
|
|
554
|
+
728,
|
|
555
|
+
1050,
|
|
556
|
+
1260,
|
|
557
|
+
420,
|
|
558
|
+
784,
|
|
559
|
+
1140,
|
|
560
|
+
1350,
|
|
561
|
+
450,
|
|
562
|
+
812,
|
|
563
|
+
1200,
|
|
564
|
+
1440,
|
|
565
|
+
480,
|
|
566
|
+
868,
|
|
567
|
+
1290,
|
|
568
|
+
1530,
|
|
569
|
+
510,
|
|
570
|
+
924,
|
|
571
|
+
1350,
|
|
572
|
+
1620,
|
|
573
|
+
540,
|
|
574
|
+
980,
|
|
575
|
+
1440,
|
|
576
|
+
1710,
|
|
577
|
+
570,
|
|
578
|
+
1036,
|
|
579
|
+
1530,
|
|
580
|
+
1800,
|
|
581
|
+
570,
|
|
582
|
+
1064,
|
|
583
|
+
1590,
|
|
584
|
+
1890,
|
|
585
|
+
600,
|
|
586
|
+
1120,
|
|
587
|
+
1680,
|
|
588
|
+
1980,
|
|
589
|
+
630,
|
|
590
|
+
1204,
|
|
591
|
+
1770,
|
|
592
|
+
2100,
|
|
593
|
+
660,
|
|
594
|
+
1260,
|
|
595
|
+
1860,
|
|
596
|
+
2220,
|
|
597
|
+
720,
|
|
598
|
+
1316,
|
|
599
|
+
1950,
|
|
600
|
+
2310,
|
|
601
|
+
750,
|
|
602
|
+
1372,
|
|
603
|
+
2040,
|
|
604
|
+
2430
|
|
605
|
+
];
|
|
606
|
+
ot.getBlocksCount = function(t, i) {
|
|
607
|
+
switch (i) {
|
|
608
|
+
case U.L:
|
|
609
|
+
return Z[(t - 1) * 4 + 0];
|
|
610
|
+
case U.M:
|
|
611
|
+
return Z[(t - 1) * 4 + 1];
|
|
612
|
+
case U.Q:
|
|
613
|
+
return Z[(t - 1) * 4 + 2];
|
|
614
|
+
case U.H:
|
|
615
|
+
return Z[(t - 1) * 4 + 3];
|
|
616
|
+
default:
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
ot.getTotalCodewordsCount = function(t, i) {
|
|
621
|
+
switch (i) {
|
|
622
|
+
case U.L:
|
|
623
|
+
return tt[(t - 1) * 4 + 0];
|
|
624
|
+
case U.M:
|
|
625
|
+
return tt[(t - 1) * 4 + 1];
|
|
626
|
+
case U.Q:
|
|
627
|
+
return tt[(t - 1) * 4 + 2];
|
|
628
|
+
case U.H:
|
|
629
|
+
return tt[(t - 1) * 4 + 3];
|
|
630
|
+
default:
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
var Yt = {}, rt = {};
|
|
635
|
+
const q = new Uint8Array(512), et = new Uint8Array(256);
|
|
636
|
+
(function() {
|
|
637
|
+
let t = 1;
|
|
638
|
+
for (let i = 0; i < 255; i++)
|
|
639
|
+
q[i] = t, et[t] = i, t <<= 1, t & 256 && (t ^= 285);
|
|
640
|
+
for (let i = 255; i < 512; i++)
|
|
641
|
+
q[i] = q[i - 255];
|
|
642
|
+
})();
|
|
643
|
+
rt.log = function(t) {
|
|
644
|
+
if (t < 1) throw new Error("log(" + t + ")");
|
|
645
|
+
return et[t];
|
|
646
|
+
};
|
|
647
|
+
rt.exp = function(t) {
|
|
648
|
+
return q[t];
|
|
649
|
+
};
|
|
650
|
+
rt.mul = function(t, i) {
|
|
651
|
+
return t === 0 || i === 0 ? 0 : q[et[t] + et[i]];
|
|
652
|
+
};
|
|
653
|
+
(function(e) {
|
|
654
|
+
const t = rt;
|
|
655
|
+
e.mul = function(s, n) {
|
|
656
|
+
const o = new Uint8Array(s.length + n.length - 1);
|
|
657
|
+
for (let r = 0; r < s.length; r++)
|
|
658
|
+
for (let a = 0; a < n.length; a++)
|
|
659
|
+
o[r + a] ^= t.mul(s[r], n[a]);
|
|
660
|
+
return o;
|
|
661
|
+
}, e.mod = function(s, n) {
|
|
662
|
+
let o = new Uint8Array(s);
|
|
663
|
+
for (; o.length - n.length >= 0; ) {
|
|
664
|
+
const r = o[0];
|
|
665
|
+
for (let l = 0; l < n.length; l++)
|
|
666
|
+
o[l] ^= t.mul(n[l], r);
|
|
667
|
+
let a = 0;
|
|
668
|
+
for (; a < o.length && o[a] === 0; ) a++;
|
|
669
|
+
o = o.slice(a);
|
|
670
|
+
}
|
|
671
|
+
return o;
|
|
672
|
+
}, e.generateECPolynomial = function(s) {
|
|
673
|
+
let n = new Uint8Array([1]);
|
|
674
|
+
for (let o = 0; o < s; o++)
|
|
675
|
+
n = e.mul(n, new Uint8Array([1, t.exp(o)]));
|
|
676
|
+
return n;
|
|
677
|
+
};
|
|
678
|
+
})(Yt);
|
|
679
|
+
const qt = Yt;
|
|
680
|
+
function kt(e) {
|
|
681
|
+
this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
|
|
682
|
+
}
|
|
683
|
+
kt.prototype.initialize = function(t) {
|
|
684
|
+
this.degree = t, this.genPoly = qt.generateECPolynomial(this.degree);
|
|
685
|
+
};
|
|
686
|
+
kt.prototype.encode = function(t) {
|
|
687
|
+
if (!this.genPoly)
|
|
688
|
+
throw new Error("Encoder not initialized");
|
|
689
|
+
const i = new Uint8Array(t.length + this.degree);
|
|
690
|
+
i.set(t);
|
|
691
|
+
const s = qt.mod(i, this.genPoly), n = this.degree - s.length;
|
|
692
|
+
if (n > 0) {
|
|
693
|
+
const o = new Uint8Array(this.degree);
|
|
694
|
+
return o.set(s, n), o;
|
|
695
|
+
}
|
|
696
|
+
return s;
|
|
697
|
+
};
|
|
698
|
+
var _e = kt, Gt = {}, O = {}, St = {};
|
|
699
|
+
St.isValid = function(t) {
|
|
700
|
+
return !isNaN(t) && t >= 1 && t <= 40;
|
|
701
|
+
};
|
|
702
|
+
var F = {};
|
|
703
|
+
const Kt = "[0-9]+", Ce = "[A-Z $%*+\\-./:]+";
|
|
704
|
+
let K = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
705
|
+
K = K.replace(/u/g, "\\u");
|
|
706
|
+
const xe = "(?:(?![A-Z0-9 $%*+\\-./:]|" + K + `)(?:.|[\r
|
|
707
|
+
]))+`;
|
|
708
|
+
F.KANJI = new RegExp(K, "g");
|
|
709
|
+
F.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
|
|
710
|
+
F.BYTE = new RegExp(xe, "g");
|
|
711
|
+
F.NUMERIC = new RegExp(Kt, "g");
|
|
712
|
+
F.ALPHANUMERIC = new RegExp(Ce, "g");
|
|
713
|
+
const be = new RegExp("^" + K + "$"), Pe = new RegExp("^" + Kt + "$"), Ee = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
714
|
+
F.testKanji = function(t) {
|
|
715
|
+
return be.test(t);
|
|
716
|
+
};
|
|
717
|
+
F.testNumeric = function(t) {
|
|
718
|
+
return Pe.test(t);
|
|
719
|
+
};
|
|
720
|
+
F.testAlphanumeric = function(t) {
|
|
721
|
+
return Ee.test(t);
|
|
722
|
+
};
|
|
723
|
+
(function(e) {
|
|
724
|
+
const t = St, i = F;
|
|
725
|
+
e.NUMERIC = {
|
|
726
|
+
id: "Numeric",
|
|
727
|
+
bit: 1,
|
|
728
|
+
ccBits: [10, 12, 14]
|
|
729
|
+
}, e.ALPHANUMERIC = {
|
|
730
|
+
id: "Alphanumeric",
|
|
731
|
+
bit: 2,
|
|
732
|
+
ccBits: [9, 11, 13]
|
|
733
|
+
}, e.BYTE = {
|
|
734
|
+
id: "Byte",
|
|
735
|
+
bit: 4,
|
|
736
|
+
ccBits: [8, 16, 16]
|
|
737
|
+
}, e.KANJI = {
|
|
738
|
+
id: "Kanji",
|
|
739
|
+
bit: 8,
|
|
740
|
+
ccBits: [8, 10, 12]
|
|
741
|
+
}, e.MIXED = {
|
|
742
|
+
bit: -1
|
|
743
|
+
}, e.getCharCountIndicator = function(o, r) {
|
|
744
|
+
if (!o.ccBits) throw new Error("Invalid mode: " + o);
|
|
745
|
+
if (!t.isValid(r))
|
|
746
|
+
throw new Error("Invalid version: " + r);
|
|
747
|
+
return r >= 1 && r < 10 ? o.ccBits[0] : r < 27 ? o.ccBits[1] : o.ccBits[2];
|
|
748
|
+
}, e.getBestModeForData = function(o) {
|
|
749
|
+
return i.testNumeric(o) ? e.NUMERIC : i.testAlphanumeric(o) ? e.ALPHANUMERIC : i.testKanji(o) ? e.KANJI : e.BYTE;
|
|
750
|
+
}, e.toString = function(o) {
|
|
751
|
+
if (o && o.id) return o.id;
|
|
752
|
+
throw new Error("Invalid mode");
|
|
753
|
+
}, e.isValid = function(o) {
|
|
754
|
+
return o && o.bit && o.ccBits;
|
|
755
|
+
};
|
|
756
|
+
function s(n) {
|
|
757
|
+
if (typeof n != "string")
|
|
758
|
+
throw new Error("Param is not a string");
|
|
759
|
+
switch (n.toLowerCase()) {
|
|
760
|
+
case "numeric":
|
|
761
|
+
return e.NUMERIC;
|
|
762
|
+
case "alphanumeric":
|
|
763
|
+
return e.ALPHANUMERIC;
|
|
764
|
+
case "kanji":
|
|
765
|
+
return e.KANJI;
|
|
766
|
+
case "byte":
|
|
767
|
+
return e.BYTE;
|
|
768
|
+
default:
|
|
769
|
+
throw new Error("Unknown mode: " + n);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
e.from = function(o, r) {
|
|
773
|
+
if (e.isValid(o))
|
|
774
|
+
return o;
|
|
775
|
+
try {
|
|
776
|
+
return s(o);
|
|
777
|
+
} catch {
|
|
778
|
+
return r;
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
})(O);
|
|
782
|
+
(function(e) {
|
|
783
|
+
const t = I, i = ot, s = it, n = O, o = St, r = 7973, a = t.getBCHDigit(r);
|
|
784
|
+
function l(p, u, f) {
|
|
785
|
+
for (let h = 1; h <= 40; h++)
|
|
786
|
+
if (u <= e.getCapacity(h, f, p))
|
|
787
|
+
return h;
|
|
788
|
+
}
|
|
789
|
+
function d(p, u) {
|
|
790
|
+
return n.getCharCountIndicator(p, u) + 4;
|
|
791
|
+
}
|
|
792
|
+
function c(p, u) {
|
|
793
|
+
let f = 0;
|
|
794
|
+
return p.forEach(function(h) {
|
|
795
|
+
const E = d(h.mode, u);
|
|
796
|
+
f += E + h.getBitsLength();
|
|
797
|
+
}), f;
|
|
798
|
+
}
|
|
799
|
+
function m(p, u) {
|
|
800
|
+
for (let f = 1; f <= 40; f++)
|
|
801
|
+
if (c(p, f) <= e.getCapacity(f, u, n.MIXED))
|
|
802
|
+
return f;
|
|
803
|
+
}
|
|
804
|
+
e.from = function(u, f) {
|
|
805
|
+
return o.isValid(u) ? parseInt(u, 10) : f;
|
|
806
|
+
}, e.getCapacity = function(u, f, h) {
|
|
807
|
+
if (!o.isValid(u))
|
|
808
|
+
throw new Error("Invalid QR Code version");
|
|
809
|
+
typeof h > "u" && (h = n.BYTE);
|
|
810
|
+
const E = t.getSymbolTotalCodewords(u), w = i.getTotalCodewordsCount(u, f), _ = (E - w) * 8;
|
|
811
|
+
if (h === n.MIXED) return _;
|
|
812
|
+
const y = _ - d(h, u);
|
|
813
|
+
switch (h) {
|
|
814
|
+
case n.NUMERIC:
|
|
815
|
+
return Math.floor(y / 10 * 3);
|
|
816
|
+
case n.ALPHANUMERIC:
|
|
817
|
+
return Math.floor(y / 11 * 2);
|
|
818
|
+
case n.KANJI:
|
|
819
|
+
return Math.floor(y / 13);
|
|
820
|
+
case n.BYTE:
|
|
821
|
+
default:
|
|
822
|
+
return Math.floor(y / 8);
|
|
823
|
+
}
|
|
824
|
+
}, e.getBestVersionForData = function(u, f) {
|
|
825
|
+
let h;
|
|
826
|
+
const E = s.from(f, s.M);
|
|
827
|
+
if (Array.isArray(u)) {
|
|
828
|
+
if (u.length > 1)
|
|
829
|
+
return m(u, E);
|
|
830
|
+
if (u.length === 0)
|
|
831
|
+
return 1;
|
|
832
|
+
h = u[0];
|
|
833
|
+
} else
|
|
834
|
+
h = u;
|
|
835
|
+
return l(h.mode, h.getLength(), E);
|
|
836
|
+
}, e.getEncodedBits = function(u) {
|
|
837
|
+
if (!o.isValid(u) || u < 7)
|
|
838
|
+
throw new Error("Invalid QR Code version");
|
|
839
|
+
let f = u << 12;
|
|
840
|
+
for (; t.getBCHDigit(f) - a >= 0; )
|
|
841
|
+
f ^= r << t.getBCHDigit(f) - a;
|
|
842
|
+
return u << 12 | f;
|
|
843
|
+
};
|
|
844
|
+
})(Gt);
|
|
845
|
+
var Jt = {};
|
|
846
|
+
const yt = I, Xt = 1335, ke = 21522, Nt = yt.getBCHDigit(Xt);
|
|
847
|
+
Jt.getEncodedBits = function(t, i) {
|
|
848
|
+
const s = t.bit << 3 | i;
|
|
849
|
+
let n = s << 10;
|
|
850
|
+
for (; yt.getBCHDigit(n) - Nt >= 0; )
|
|
851
|
+
n ^= Xt << yt.getBCHDigit(n) - Nt;
|
|
852
|
+
return (s << 10 | n) ^ ke;
|
|
853
|
+
};
|
|
854
|
+
var Qt = {};
|
|
855
|
+
const Se = O;
|
|
856
|
+
function j(e) {
|
|
857
|
+
this.mode = Se.NUMERIC, this.data = e.toString();
|
|
858
|
+
}
|
|
859
|
+
j.getBitsLength = function(t) {
|
|
860
|
+
return 10 * Math.floor(t / 3) + (t % 3 ? t % 3 * 3 + 1 : 0);
|
|
861
|
+
};
|
|
862
|
+
j.prototype.getLength = function() {
|
|
863
|
+
return this.data.length;
|
|
864
|
+
};
|
|
865
|
+
j.prototype.getBitsLength = function() {
|
|
866
|
+
return j.getBitsLength(this.data.length);
|
|
867
|
+
};
|
|
868
|
+
j.prototype.write = function(t) {
|
|
869
|
+
let i, s, n;
|
|
870
|
+
for (i = 0; i + 3 <= this.data.length; i += 3)
|
|
871
|
+
s = this.data.substr(i, 3), n = parseInt(s, 10), t.put(n, 10);
|
|
872
|
+
const o = this.data.length - i;
|
|
873
|
+
o > 0 && (s = this.data.substr(i), n = parseInt(s, 10), t.put(n, o * 3 + 1));
|
|
874
|
+
};
|
|
875
|
+
var Te = j;
|
|
876
|
+
const Me = O, ut = [
|
|
877
|
+
"0",
|
|
878
|
+
"1",
|
|
879
|
+
"2",
|
|
880
|
+
"3",
|
|
881
|
+
"4",
|
|
882
|
+
"5",
|
|
883
|
+
"6",
|
|
884
|
+
"7",
|
|
885
|
+
"8",
|
|
886
|
+
"9",
|
|
887
|
+
"A",
|
|
888
|
+
"B",
|
|
889
|
+
"C",
|
|
890
|
+
"D",
|
|
891
|
+
"E",
|
|
892
|
+
"F",
|
|
893
|
+
"G",
|
|
894
|
+
"H",
|
|
895
|
+
"I",
|
|
896
|
+
"J",
|
|
897
|
+
"K",
|
|
898
|
+
"L",
|
|
899
|
+
"M",
|
|
900
|
+
"N",
|
|
901
|
+
"O",
|
|
902
|
+
"P",
|
|
903
|
+
"Q",
|
|
904
|
+
"R",
|
|
905
|
+
"S",
|
|
906
|
+
"T",
|
|
907
|
+
"U",
|
|
908
|
+
"V",
|
|
909
|
+
"W",
|
|
910
|
+
"X",
|
|
911
|
+
"Y",
|
|
912
|
+
"Z",
|
|
913
|
+
" ",
|
|
914
|
+
"$",
|
|
915
|
+
"%",
|
|
916
|
+
"*",
|
|
917
|
+
"+",
|
|
918
|
+
"-",
|
|
919
|
+
".",
|
|
920
|
+
"/",
|
|
921
|
+
":"
|
|
922
|
+
];
|
|
923
|
+
function W(e) {
|
|
924
|
+
this.mode = Me.ALPHANUMERIC, this.data = e;
|
|
925
|
+
}
|
|
926
|
+
W.getBitsLength = function(t) {
|
|
927
|
+
return 11 * Math.floor(t / 2) + 6 * (t % 2);
|
|
928
|
+
};
|
|
929
|
+
W.prototype.getLength = function() {
|
|
930
|
+
return this.data.length;
|
|
931
|
+
};
|
|
932
|
+
W.prototype.getBitsLength = function() {
|
|
933
|
+
return W.getBitsLength(this.data.length);
|
|
934
|
+
};
|
|
935
|
+
W.prototype.write = function(t) {
|
|
936
|
+
let i;
|
|
937
|
+
for (i = 0; i + 2 <= this.data.length; i += 2) {
|
|
938
|
+
let s = ut.indexOf(this.data[i]) * 45;
|
|
939
|
+
s += ut.indexOf(this.data[i + 1]), t.put(s, 11);
|
|
940
|
+
}
|
|
941
|
+
this.data.length % 2 && t.put(ut.indexOf(this.data[i]), 6);
|
|
942
|
+
};
|
|
943
|
+
var Ie = W, Ae = function(t) {
|
|
944
|
+
for (var i = [], s = t.length, n = 0; n < s; n++) {
|
|
945
|
+
var o = t.charCodeAt(n);
|
|
946
|
+
if (o >= 55296 && o <= 56319 && s > n + 1) {
|
|
947
|
+
var r = t.charCodeAt(n + 1);
|
|
948
|
+
r >= 56320 && r <= 57343 && (o = (o - 55296) * 1024 + r - 56320 + 65536, n += 1);
|
|
949
|
+
}
|
|
950
|
+
if (o < 128) {
|
|
951
|
+
i.push(o);
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
if (o < 2048) {
|
|
955
|
+
i.push(o >> 6 | 192), i.push(o & 63 | 128);
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
if (o < 55296 || o >= 57344 && o < 65536) {
|
|
959
|
+
i.push(o >> 12 | 224), i.push(o >> 6 & 63 | 128), i.push(o & 63 | 128);
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
if (o >= 65536 && o <= 1114111) {
|
|
963
|
+
i.push(o >> 18 | 240), i.push(o >> 12 & 63 | 128), i.push(o >> 6 & 63 | 128), i.push(o & 63 | 128);
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
i.push(239, 191, 189);
|
|
967
|
+
}
|
|
968
|
+
return new Uint8Array(i).buffer;
|
|
969
|
+
};
|
|
970
|
+
const Be = Ae, $e = O;
|
|
971
|
+
function V(e) {
|
|
972
|
+
this.mode = $e.BYTE, typeof e == "string" && (e = Be(e)), this.data = new Uint8Array(e);
|
|
973
|
+
}
|
|
974
|
+
V.getBitsLength = function(t) {
|
|
975
|
+
return t * 8;
|
|
976
|
+
};
|
|
977
|
+
V.prototype.getLength = function() {
|
|
978
|
+
return this.data.length;
|
|
979
|
+
};
|
|
980
|
+
V.prototype.getBitsLength = function() {
|
|
981
|
+
return V.getBitsLength(this.data.length);
|
|
982
|
+
};
|
|
983
|
+
V.prototype.write = function(e) {
|
|
984
|
+
for (let t = 0, i = this.data.length; t < i; t++)
|
|
985
|
+
e.put(this.data[t], 8);
|
|
986
|
+
};
|
|
987
|
+
var De = V;
|
|
988
|
+
const Fe = O, Ne = I;
|
|
989
|
+
function H(e) {
|
|
990
|
+
this.mode = Fe.KANJI, this.data = e;
|
|
991
|
+
}
|
|
992
|
+
H.getBitsLength = function(t) {
|
|
993
|
+
return t * 13;
|
|
994
|
+
};
|
|
995
|
+
H.prototype.getLength = function() {
|
|
996
|
+
return this.data.length;
|
|
997
|
+
};
|
|
998
|
+
H.prototype.getBitsLength = function() {
|
|
999
|
+
return H.getBitsLength(this.data.length);
|
|
1000
|
+
};
|
|
1001
|
+
H.prototype.write = function(e) {
|
|
1002
|
+
let t;
|
|
1003
|
+
for (t = 0; t < this.data.length; t++) {
|
|
1004
|
+
let i = Ne.toSJIS(this.data[t]);
|
|
1005
|
+
if (i >= 33088 && i <= 40956)
|
|
1006
|
+
i -= 33088;
|
|
1007
|
+
else if (i >= 57408 && i <= 60351)
|
|
1008
|
+
i -= 49472;
|
|
1009
|
+
else
|
|
1010
|
+
throw new Error(
|
|
1011
|
+
"Invalid SJIS character: " + this.data[t] + `
|
|
1012
|
+
Make sure your charset is UTF-8`
|
|
1013
|
+
);
|
|
1014
|
+
i = (i >>> 8 & 255) * 192 + (i & 255), e.put(i, 13);
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
var Le = H, Zt = { exports: {} };
|
|
1018
|
+
(function(e) {
|
|
1019
|
+
var t = {
|
|
1020
|
+
single_source_shortest_paths: function(i, s, n) {
|
|
1021
|
+
var o = {}, r = {};
|
|
1022
|
+
r[s] = 0;
|
|
1023
|
+
var a = t.PriorityQueue.make();
|
|
1024
|
+
a.push(s, 0);
|
|
1025
|
+
for (var l, d, c, m, p, u, f, h, E; !a.empty(); ) {
|
|
1026
|
+
l = a.pop(), d = l.value, m = l.cost, p = i[d] || {};
|
|
1027
|
+
for (c in p)
|
|
1028
|
+
p.hasOwnProperty(c) && (u = p[c], f = m + u, h = r[c], E = typeof r[c] > "u", (E || h > f) && (r[c] = f, a.push(c, f), o[c] = d));
|
|
1029
|
+
}
|
|
1030
|
+
if (typeof n < "u" && typeof r[n] > "u") {
|
|
1031
|
+
var w = ["Could not find a path from ", s, " to ", n, "."].join("");
|
|
1032
|
+
throw new Error(w);
|
|
1033
|
+
}
|
|
1034
|
+
return o;
|
|
1035
|
+
},
|
|
1036
|
+
extract_shortest_path_from_predecessor_list: function(i, s) {
|
|
1037
|
+
for (var n = [], o = s; o; )
|
|
1038
|
+
n.push(o), i[o], o = i[o];
|
|
1039
|
+
return n.reverse(), n;
|
|
1040
|
+
},
|
|
1041
|
+
find_path: function(i, s, n) {
|
|
1042
|
+
var o = t.single_source_shortest_paths(i, s, n);
|
|
1043
|
+
return t.extract_shortest_path_from_predecessor_list(
|
|
1044
|
+
o,
|
|
1045
|
+
n
|
|
1046
|
+
);
|
|
1047
|
+
},
|
|
1048
|
+
/**
|
|
1049
|
+
* A very naive priority queue implementation.
|
|
1050
|
+
*/
|
|
1051
|
+
PriorityQueue: {
|
|
1052
|
+
make: function(i) {
|
|
1053
|
+
var s = t.PriorityQueue, n = {}, o;
|
|
1054
|
+
i = i || {};
|
|
1055
|
+
for (o in s)
|
|
1056
|
+
s.hasOwnProperty(o) && (n[o] = s[o]);
|
|
1057
|
+
return n.queue = [], n.sorter = i.sorter || s.default_sorter, n;
|
|
1058
|
+
},
|
|
1059
|
+
default_sorter: function(i, s) {
|
|
1060
|
+
return i.cost - s.cost;
|
|
1061
|
+
},
|
|
1062
|
+
/**
|
|
1063
|
+
* Add a new item to the queue and ensure the highest priority element
|
|
1064
|
+
* is at the front of the queue.
|
|
1065
|
+
*/
|
|
1066
|
+
push: function(i, s) {
|
|
1067
|
+
var n = { value: i, cost: s };
|
|
1068
|
+
this.queue.push(n), this.queue.sort(this.sorter);
|
|
1069
|
+
},
|
|
1070
|
+
/**
|
|
1071
|
+
* Return the highest priority element in the queue.
|
|
1072
|
+
*/
|
|
1073
|
+
pop: function() {
|
|
1074
|
+
return this.queue.shift();
|
|
1075
|
+
},
|
|
1076
|
+
empty: function() {
|
|
1077
|
+
return this.queue.length === 0;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
e.exports = t;
|
|
1082
|
+
})(Zt);
|
|
1083
|
+
var Re = Zt.exports;
|
|
1084
|
+
(function(e) {
|
|
1085
|
+
const t = O, i = Te, s = Ie, n = De, o = Le, r = F, a = I, l = Re;
|
|
1086
|
+
function d(w) {
|
|
1087
|
+
return unescape(encodeURIComponent(w)).length;
|
|
1088
|
+
}
|
|
1089
|
+
function c(w, _, y) {
|
|
1090
|
+
const v = [];
|
|
1091
|
+
let x;
|
|
1092
|
+
for (; (x = w.exec(y)) !== null; )
|
|
1093
|
+
v.push({
|
|
1094
|
+
data: x[0],
|
|
1095
|
+
index: x.index,
|
|
1096
|
+
mode: _,
|
|
1097
|
+
length: x[0].length
|
|
1098
|
+
});
|
|
1099
|
+
return v;
|
|
1100
|
+
}
|
|
1101
|
+
function m(w) {
|
|
1102
|
+
const _ = c(r.NUMERIC, t.NUMERIC, w), y = c(r.ALPHANUMERIC, t.ALPHANUMERIC, w);
|
|
1103
|
+
let v, x;
|
|
1104
|
+
return a.isKanjiModeEnabled() ? (v = c(r.BYTE, t.BYTE, w), x = c(r.KANJI, t.KANJI, w)) : (v = c(r.BYTE_KANJI, t.BYTE, w), x = []), _.concat(y, v, x).sort(function(T, B) {
|
|
1105
|
+
return T.index - B.index;
|
|
1106
|
+
}).map(function(T) {
|
|
1107
|
+
return {
|
|
1108
|
+
data: T.data,
|
|
1109
|
+
mode: T.mode,
|
|
1110
|
+
length: T.length
|
|
1111
|
+
};
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
function p(w, _) {
|
|
1115
|
+
switch (_) {
|
|
1116
|
+
case t.NUMERIC:
|
|
1117
|
+
return i.getBitsLength(w);
|
|
1118
|
+
case t.ALPHANUMERIC:
|
|
1119
|
+
return s.getBitsLength(w);
|
|
1120
|
+
case t.KANJI:
|
|
1121
|
+
return o.getBitsLength(w);
|
|
1122
|
+
case t.BYTE:
|
|
1123
|
+
return n.getBitsLength(w);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
function u(w) {
|
|
1127
|
+
return w.reduce(function(_, y) {
|
|
1128
|
+
const v = _.length - 1 >= 0 ? _[_.length - 1] : null;
|
|
1129
|
+
return v && v.mode === y.mode ? (_[_.length - 1].data += y.data, _) : (_.push(y), _);
|
|
1130
|
+
}, []);
|
|
1131
|
+
}
|
|
1132
|
+
function f(w) {
|
|
1133
|
+
const _ = [];
|
|
1134
|
+
for (let y = 0; y < w.length; y++) {
|
|
1135
|
+
const v = w[y];
|
|
1136
|
+
switch (v.mode) {
|
|
1137
|
+
case t.NUMERIC:
|
|
1138
|
+
_.push([
|
|
1139
|
+
v,
|
|
1140
|
+
{ data: v.data, mode: t.ALPHANUMERIC, length: v.length },
|
|
1141
|
+
{ data: v.data, mode: t.BYTE, length: v.length }
|
|
1142
|
+
]);
|
|
1143
|
+
break;
|
|
1144
|
+
case t.ALPHANUMERIC:
|
|
1145
|
+
_.push([
|
|
1146
|
+
v,
|
|
1147
|
+
{ data: v.data, mode: t.BYTE, length: v.length }
|
|
1148
|
+
]);
|
|
1149
|
+
break;
|
|
1150
|
+
case t.KANJI:
|
|
1151
|
+
_.push([
|
|
1152
|
+
v,
|
|
1153
|
+
{ data: v.data, mode: t.BYTE, length: d(v.data) }
|
|
1154
|
+
]);
|
|
1155
|
+
break;
|
|
1156
|
+
case t.BYTE:
|
|
1157
|
+
_.push([
|
|
1158
|
+
{ data: v.data, mode: t.BYTE, length: d(v.data) }
|
|
1159
|
+
]);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return _;
|
|
1163
|
+
}
|
|
1164
|
+
function h(w, _) {
|
|
1165
|
+
const y = {}, v = { start: {} };
|
|
1166
|
+
let x = ["start"];
|
|
1167
|
+
for (let k = 0; k < w.length; k++) {
|
|
1168
|
+
const T = w[k], B = [];
|
|
1169
|
+
for (let R = 0; R < T.length; R++) {
|
|
1170
|
+
const D = T[R], Y = "" + k + R;
|
|
1171
|
+
B.push(Y), y[Y] = { node: D, lastCount: 0 }, v[Y] = {};
|
|
1172
|
+
for (let lt = 0; lt < x.length; lt++) {
|
|
1173
|
+
const N = x[lt];
|
|
1174
|
+
y[N] && y[N].node.mode === D.mode ? (v[N][Y] = p(y[N].lastCount + D.length, D.mode) - p(y[N].lastCount, D.mode), y[N].lastCount += D.length) : (y[N] && (y[N].lastCount = D.length), v[N][Y] = p(D.length, D.mode) + 4 + t.getCharCountIndicator(D.mode, _));
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
x = B;
|
|
1178
|
+
}
|
|
1179
|
+
for (let k = 0; k < x.length; k++)
|
|
1180
|
+
v[x[k]].end = 0;
|
|
1181
|
+
return { map: v, table: y };
|
|
1182
|
+
}
|
|
1183
|
+
function E(w, _) {
|
|
1184
|
+
let y;
|
|
1185
|
+
const v = t.getBestModeForData(w);
|
|
1186
|
+
if (y = t.from(_, v), y !== t.BYTE && y.bit < v.bit)
|
|
1187
|
+
throw new Error('"' + w + '" cannot be encoded with mode ' + t.toString(y) + `.
|
|
1188
|
+
Suggested mode is: ` + t.toString(v));
|
|
1189
|
+
switch (y === t.KANJI && !a.isKanjiModeEnabled() && (y = t.BYTE), y) {
|
|
1190
|
+
case t.NUMERIC:
|
|
1191
|
+
return new i(w);
|
|
1192
|
+
case t.ALPHANUMERIC:
|
|
1193
|
+
return new s(w);
|
|
1194
|
+
case t.KANJI:
|
|
1195
|
+
return new o(w);
|
|
1196
|
+
case t.BYTE:
|
|
1197
|
+
return new n(w);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
e.fromArray = function(_) {
|
|
1201
|
+
return _.reduce(function(y, v) {
|
|
1202
|
+
return typeof v == "string" ? y.push(E(v, null)) : v.data && y.push(E(v.data, v.mode)), y;
|
|
1203
|
+
}, []);
|
|
1204
|
+
}, e.fromString = function(_, y) {
|
|
1205
|
+
const v = m(_, a.isKanjiModeEnabled()), x = f(v), k = h(x, y), T = l.find_path(k.map, "start", "end"), B = [];
|
|
1206
|
+
for (let R = 1; R < T.length - 1; R++)
|
|
1207
|
+
B.push(k.table[T[R]].node);
|
|
1208
|
+
return e.fromArray(u(B));
|
|
1209
|
+
}, e.rawSplit = function(_) {
|
|
1210
|
+
return e.fromArray(
|
|
1211
|
+
m(_, a.isKanjiModeEnabled())
|
|
1212
|
+
);
|
|
1213
|
+
};
|
|
1214
|
+
})(Qt);
|
|
1215
|
+
const at = I, ht = it, Ue = we, Oe = ye, ze = Wt, je = Vt, vt = Ht, _t = ot, We = _e, nt = Gt, Ve = Jt, He = O, ft = Qt;
|
|
1216
|
+
function Ye(e, t) {
|
|
1217
|
+
const i = e.size, s = je.getPositions(t);
|
|
1218
|
+
for (let n = 0; n < s.length; n++) {
|
|
1219
|
+
const o = s[n][0], r = s[n][1];
|
|
1220
|
+
for (let a = -1; a <= 7; a++)
|
|
1221
|
+
if (!(o + a <= -1 || i <= o + a))
|
|
1222
|
+
for (let l = -1; l <= 7; l++)
|
|
1223
|
+
r + l <= -1 || i <= r + l || (a >= 0 && a <= 6 && (l === 0 || l === 6) || l >= 0 && l <= 6 && (a === 0 || a === 6) || a >= 2 && a <= 4 && l >= 2 && l <= 4 ? e.set(o + a, r + l, !0, !0) : e.set(o + a, r + l, !1, !0));
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
function qe(e) {
|
|
1227
|
+
const t = e.size;
|
|
1228
|
+
for (let i = 8; i < t - 8; i++) {
|
|
1229
|
+
const s = i % 2 === 0;
|
|
1230
|
+
e.set(i, 6, s, !0), e.set(6, i, s, !0);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
function Ge(e, t) {
|
|
1234
|
+
const i = ze.getPositions(t);
|
|
1235
|
+
for (let s = 0; s < i.length; s++) {
|
|
1236
|
+
const n = i[s][0], o = i[s][1];
|
|
1237
|
+
for (let r = -2; r <= 2; r++)
|
|
1238
|
+
for (let a = -2; a <= 2; a++)
|
|
1239
|
+
r === -2 || r === 2 || a === -2 || a === 2 || r === 0 && a === 0 ? e.set(n + r, o + a, !0, !0) : e.set(n + r, o + a, !1, !0);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
function Ke(e, t) {
|
|
1243
|
+
const i = e.size, s = nt.getEncodedBits(t);
|
|
1244
|
+
let n, o, r;
|
|
1245
|
+
for (let a = 0; a < 18; a++)
|
|
1246
|
+
n = Math.floor(a / 3), o = a % 3 + i - 8 - 3, r = (s >> a & 1) === 1, e.set(n, o, r, !0), e.set(o, n, r, !0);
|
|
1247
|
+
}
|
|
1248
|
+
function gt(e, t, i) {
|
|
1249
|
+
const s = e.size, n = Ve.getEncodedBits(t, i);
|
|
1250
|
+
let o, r;
|
|
1251
|
+
for (o = 0; o < 15; o++)
|
|
1252
|
+
r = (n >> o & 1) === 1, o < 6 ? e.set(o, 8, r, !0) : o < 8 ? e.set(o + 1, 8, r, !0) : e.set(s - 15 + o, 8, r, !0), o < 8 ? e.set(8, s - o - 1, r, !0) : o < 9 ? e.set(8, 15 - o - 1 + 1, r, !0) : e.set(8, 15 - o - 1, r, !0);
|
|
1253
|
+
e.set(s - 8, 8, 1, !0);
|
|
1254
|
+
}
|
|
1255
|
+
function Je(e, t) {
|
|
1256
|
+
const i = e.size;
|
|
1257
|
+
let s = -1, n = i - 1, o = 7, r = 0;
|
|
1258
|
+
for (let a = i - 1; a > 0; a -= 2)
|
|
1259
|
+
for (a === 6 && a--; ; ) {
|
|
1260
|
+
for (let l = 0; l < 2; l++)
|
|
1261
|
+
if (!e.isReserved(n, a - l)) {
|
|
1262
|
+
let d = !1;
|
|
1263
|
+
r < t.length && (d = (t[r] >>> o & 1) === 1), e.set(n, a - l, d), o--, o === -1 && (r++, o = 7);
|
|
1264
|
+
}
|
|
1265
|
+
if (n += s, n < 0 || i <= n) {
|
|
1266
|
+
n -= s, s = -s;
|
|
1267
|
+
break;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
function Xe(e, t, i) {
|
|
1272
|
+
const s = new Ue();
|
|
1273
|
+
i.forEach(function(l) {
|
|
1274
|
+
s.put(l.mode.bit, 4), s.put(l.getLength(), He.getCharCountIndicator(l.mode, e)), l.write(s);
|
|
1275
|
+
});
|
|
1276
|
+
const n = at.getSymbolTotalCodewords(e), o = _t.getTotalCodewordsCount(e, t), r = (n - o) * 8;
|
|
1277
|
+
for (s.getLengthInBits() + 4 <= r && s.put(0, 4); s.getLengthInBits() % 8 !== 0; )
|
|
1278
|
+
s.putBit(0);
|
|
1279
|
+
const a = (r - s.getLengthInBits()) / 8;
|
|
1280
|
+
for (let l = 0; l < a; l++)
|
|
1281
|
+
s.put(l % 2 ? 17 : 236, 8);
|
|
1282
|
+
return Qe(s, e, t);
|
|
1283
|
+
}
|
|
1284
|
+
function Qe(e, t, i) {
|
|
1285
|
+
const s = at.getSymbolTotalCodewords(t), n = _t.getTotalCodewordsCount(t, i), o = s - n, r = _t.getBlocksCount(t, i), a = s % r, l = r - a, d = Math.floor(s / r), c = Math.floor(o / r), m = c + 1, p = d - c, u = new We(p);
|
|
1286
|
+
let f = 0;
|
|
1287
|
+
const h = new Array(r), E = new Array(r);
|
|
1288
|
+
let w = 0;
|
|
1289
|
+
const _ = new Uint8Array(e.buffer);
|
|
1290
|
+
for (let T = 0; T < r; T++) {
|
|
1291
|
+
const B = T < l ? c : m;
|
|
1292
|
+
h[T] = _.slice(f, f + B), E[T] = u.encode(h[T]), f += B, w = Math.max(w, B);
|
|
1293
|
+
}
|
|
1294
|
+
const y = new Uint8Array(s);
|
|
1295
|
+
let v = 0, x, k;
|
|
1296
|
+
for (x = 0; x < w; x++)
|
|
1297
|
+
for (k = 0; k < r; k++)
|
|
1298
|
+
x < h[k].length && (y[v++] = h[k][x]);
|
|
1299
|
+
for (x = 0; x < p; x++)
|
|
1300
|
+
for (k = 0; k < r; k++)
|
|
1301
|
+
y[v++] = E[k][x];
|
|
1302
|
+
return y;
|
|
1303
|
+
}
|
|
1304
|
+
function Ze(e, t, i, s) {
|
|
1305
|
+
let n;
|
|
1306
|
+
if (Array.isArray(e))
|
|
1307
|
+
n = ft.fromArray(e);
|
|
1308
|
+
else if (typeof e == "string") {
|
|
1309
|
+
let d = t;
|
|
1310
|
+
if (!d) {
|
|
1311
|
+
const c = ft.rawSplit(e);
|
|
1312
|
+
d = nt.getBestVersionForData(c, i);
|
|
1313
|
+
}
|
|
1314
|
+
n = ft.fromString(e, d || 40);
|
|
1315
|
+
} else
|
|
1316
|
+
throw new Error("Invalid data");
|
|
1317
|
+
const o = nt.getBestVersionForData(n, i);
|
|
1318
|
+
if (!o)
|
|
1319
|
+
throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
1320
|
+
if (!t)
|
|
1321
|
+
t = o;
|
|
1322
|
+
else if (t < o)
|
|
1323
|
+
throw new Error(
|
|
1324
|
+
`
|
|
1325
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
1326
|
+
Minimum version required to store current data is: ` + o + `.
|
|
1327
|
+
`
|
|
1328
|
+
);
|
|
1329
|
+
const r = Xe(t, i, n), a = at.getSymbolSize(t), l = new Oe(a);
|
|
1330
|
+
return Ye(l, t), qe(l), Ge(l, t), gt(l, i, 0), t >= 7 && Ke(l, t), Je(l, r), isNaN(s) && (s = vt.getBestMask(
|
|
1331
|
+
l,
|
|
1332
|
+
gt.bind(null, l, i)
|
|
1333
|
+
)), vt.applyMask(s, l), gt(l, i, s), {
|
|
1334
|
+
modules: l,
|
|
1335
|
+
version: t,
|
|
1336
|
+
errorCorrectionLevel: i,
|
|
1337
|
+
maskPattern: s,
|
|
1338
|
+
segments: n
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
zt.create = function(t, i) {
|
|
1342
|
+
if (typeof t > "u" || t === "")
|
|
1343
|
+
throw new Error("No input text");
|
|
1344
|
+
let s = ht.M, n, o;
|
|
1345
|
+
return typeof i < "u" && (s = ht.from(i.errorCorrectionLevel, ht.M), n = nt.from(i.version), o = vt.from(i.maskPattern), i.toSJISFunc && at.setToSJISFunction(i.toSJISFunc)), Ze(t, n, s, o);
|
|
1346
|
+
};
|
|
1347
|
+
var te = {}, Tt = {};
|
|
1348
|
+
(function(e) {
|
|
1349
|
+
function t(i) {
|
|
1350
|
+
if (typeof i == "number" && (i = i.toString()), typeof i != "string")
|
|
1351
|
+
throw new Error("Color should be defined as hex string");
|
|
1352
|
+
let s = i.slice().replace("#", "").split("");
|
|
1353
|
+
if (s.length < 3 || s.length === 5 || s.length > 8)
|
|
1354
|
+
throw new Error("Invalid hex color: " + i);
|
|
1355
|
+
(s.length === 3 || s.length === 4) && (s = Array.prototype.concat.apply([], s.map(function(o) {
|
|
1356
|
+
return [o, o];
|
|
1357
|
+
}))), s.length === 6 && s.push("F", "F");
|
|
1358
|
+
const n = parseInt(s.join(""), 16);
|
|
1359
|
+
return {
|
|
1360
|
+
r: n >> 24 & 255,
|
|
1361
|
+
g: n >> 16 & 255,
|
|
1362
|
+
b: n >> 8 & 255,
|
|
1363
|
+
a: n & 255,
|
|
1364
|
+
hex: "#" + s.slice(0, 6).join("")
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
e.getOptions = function(s) {
|
|
1368
|
+
s || (s = {}), s.color || (s.color = {});
|
|
1369
|
+
const n = typeof s.margin > "u" || s.margin === null || s.margin < 0 ? 4 : s.margin, o = s.width && s.width >= 21 ? s.width : void 0, r = s.scale || 4;
|
|
1370
|
+
return {
|
|
1371
|
+
width: o,
|
|
1372
|
+
scale: o ? 4 : r,
|
|
1373
|
+
margin: n,
|
|
1374
|
+
color: {
|
|
1375
|
+
dark: t(s.color.dark || "#000000ff"),
|
|
1376
|
+
light: t(s.color.light || "#ffffffff")
|
|
1377
|
+
},
|
|
1378
|
+
type: s.type,
|
|
1379
|
+
rendererOpts: s.rendererOpts || {}
|
|
1380
|
+
};
|
|
1381
|
+
}, e.getScale = function(s, n) {
|
|
1382
|
+
return n.width && n.width >= s + n.margin * 2 ? n.width / (s + n.margin * 2) : n.scale;
|
|
1383
|
+
}, e.getImageWidth = function(s, n) {
|
|
1384
|
+
const o = e.getScale(s, n);
|
|
1385
|
+
return Math.floor((s + n.margin * 2) * o);
|
|
1386
|
+
}, e.qrToImageData = function(s, n, o) {
|
|
1387
|
+
const r = n.modules.size, a = n.modules.data, l = e.getScale(r, o), d = Math.floor((r + o.margin * 2) * l), c = o.margin * l, m = [o.color.light, o.color.dark];
|
|
1388
|
+
for (let p = 0; p < d; p++)
|
|
1389
|
+
for (let u = 0; u < d; u++) {
|
|
1390
|
+
let f = (p * d + u) * 4, h = o.color.light;
|
|
1391
|
+
if (p >= c && u >= c && p < d - c && u < d - c) {
|
|
1392
|
+
const E = Math.floor((p - c) / l), w = Math.floor((u - c) / l);
|
|
1393
|
+
h = m[a[E * r + w] ? 1 : 0];
|
|
1394
|
+
}
|
|
1395
|
+
s[f++] = h.r, s[f++] = h.g, s[f++] = h.b, s[f] = h.a;
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
})(Tt);
|
|
1399
|
+
(function(e) {
|
|
1400
|
+
const t = Tt;
|
|
1401
|
+
function i(n, o, r) {
|
|
1402
|
+
n.clearRect(0, 0, o.width, o.height), o.style || (o.style = {}), o.height = r, o.width = r, o.style.height = r + "px", o.style.width = r + "px";
|
|
1403
|
+
}
|
|
1404
|
+
function s() {
|
|
1405
|
+
try {
|
|
1406
|
+
return document.createElement("canvas");
|
|
1407
|
+
} catch {
|
|
1408
|
+
throw new Error("You need to specify a canvas element");
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
e.render = function(o, r, a) {
|
|
1412
|
+
let l = a, d = r;
|
|
1413
|
+
typeof l > "u" && (!r || !r.getContext) && (l = r, r = void 0), r || (d = s()), l = t.getOptions(l);
|
|
1414
|
+
const c = t.getImageWidth(o.modules.size, l), m = d.getContext("2d"), p = m.createImageData(c, c);
|
|
1415
|
+
return t.qrToImageData(p.data, o, l), i(m, d, c), m.putImageData(p, 0, 0), d;
|
|
1416
|
+
}, e.renderToDataURL = function(o, r, a) {
|
|
1417
|
+
let l = a;
|
|
1418
|
+
typeof l > "u" && (!r || !r.getContext) && (l = r, r = void 0), l || (l = {});
|
|
1419
|
+
const d = e.render(o, r, l), c = l.type || "image/png", m = l.rendererOpts || {};
|
|
1420
|
+
return d.toDataURL(c, m.quality);
|
|
1421
|
+
};
|
|
1422
|
+
})(te);
|
|
1423
|
+
var ee = {};
|
|
1424
|
+
const tn = Tt;
|
|
1425
|
+
function Lt(e, t) {
|
|
1426
|
+
const i = e.a / 255, s = t + '="' + e.hex + '"';
|
|
1427
|
+
return i < 1 ? s + " " + t + '-opacity="' + i.toFixed(2).slice(1) + '"' : s;
|
|
1428
|
+
}
|
|
1429
|
+
function mt(e, t, i) {
|
|
1430
|
+
let s = e + t;
|
|
1431
|
+
return typeof i < "u" && (s += " " + i), s;
|
|
1432
|
+
}
|
|
1433
|
+
function en(e, t, i) {
|
|
1434
|
+
let s = "", n = 0, o = !1, r = 0;
|
|
1435
|
+
for (let a = 0; a < e.length; a++) {
|
|
1436
|
+
const l = Math.floor(a % t), d = Math.floor(a / t);
|
|
1437
|
+
!l && !o && (o = !0), e[a] ? (r++, a > 0 && l > 0 && e[a - 1] || (s += o ? mt("M", l + i, 0.5 + d + i) : mt("m", n, 0), n = 0, o = !1), l + 1 < t && e[a + 1] || (s += mt("h", r), r = 0)) : n++;
|
|
1438
|
+
}
|
|
1439
|
+
return s;
|
|
1440
|
+
}
|
|
1441
|
+
ee.render = function(t, i, s) {
|
|
1442
|
+
const n = tn.getOptions(i), o = t.modules.size, r = t.modules.data, a = o + n.margin * 2, l = n.color.light.a ? "<path " + Lt(n.color.light, "fill") + ' d="M0 0h' + a + "v" + a + 'H0z"/>' : "", d = "<path " + Lt(n.color.dark, "stroke") + ' d="' + en(r, o, n.margin) + '"/>', c = 'viewBox="0 0 ' + a + " " + a + '"', p = '<svg xmlns="http://www.w3.org/2000/svg" ' + (n.width ? 'width="' + n.width + '" height="' + n.width + '" ' : "") + c + ' shape-rendering="crispEdges">' + l + d + `</svg>
|
|
1443
|
+
`;
|
|
1444
|
+
return typeof s == "function" && s(null, p), p;
|
|
1445
|
+
};
|
|
1446
|
+
const nn = me, Ct = zt, ne = te, sn = ee;
|
|
1447
|
+
function Mt(e, t, i, s, n) {
|
|
1448
|
+
const o = [].slice.call(arguments, 1), r = o.length, a = typeof o[r - 1] == "function";
|
|
1449
|
+
if (!a && !nn())
|
|
1450
|
+
throw new Error("Callback required as last argument");
|
|
1451
|
+
if (a) {
|
|
1452
|
+
if (r < 2)
|
|
1453
|
+
throw new Error("Too few arguments provided");
|
|
1454
|
+
r === 2 ? (n = i, i = t, t = s = void 0) : r === 3 && (t.getContext && typeof n > "u" ? (n = s, s = void 0) : (n = s, s = i, i = t, t = void 0));
|
|
1455
|
+
} else {
|
|
1456
|
+
if (r < 1)
|
|
1457
|
+
throw new Error("Too few arguments provided");
|
|
1458
|
+
return r === 1 ? (i = t, t = s = void 0) : r === 2 && !t.getContext && (s = i, i = t, t = void 0), new Promise(function(l, d) {
|
|
1459
|
+
try {
|
|
1460
|
+
const c = Ct.create(i, s);
|
|
1461
|
+
l(e(c, t, s));
|
|
1462
|
+
} catch (c) {
|
|
1463
|
+
d(c);
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
try {
|
|
1468
|
+
const l = Ct.create(i, s);
|
|
1469
|
+
n(null, e(l, t, s));
|
|
1470
|
+
} catch (l) {
|
|
1471
|
+
n(l);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
Ct.create;
|
|
1475
|
+
var on = Mt.bind(null, ne.render), rn = Mt.bind(null, ne.renderToDataURL), an = Mt.bind(null, function(e, t, i) {
|
|
1476
|
+
return sn.render(e, i);
|
|
1477
|
+
});
|
|
1478
|
+
/*! vue-qrcode v2.0.0 | (c) 2018-present Chen Fengyuan | MIT */
|
|
1479
|
+
const Rt = "ready";
|
|
1480
|
+
var ln = se({
|
|
1481
|
+
name: "VueQrcode",
|
|
1482
|
+
props: {
|
|
1483
|
+
/**
|
|
1484
|
+
* The value of the QR code.
|
|
1485
|
+
*/
|
|
1486
|
+
value: {
|
|
1487
|
+
type: String,
|
|
1488
|
+
default: void 0
|
|
1489
|
+
},
|
|
1490
|
+
/**
|
|
1491
|
+
* The options for the QR code generator.
|
|
1492
|
+
* {@link https://github.com/soldair/node-qrcode#qr-code-options}
|
|
1493
|
+
*/
|
|
1494
|
+
options: {
|
|
1495
|
+
type: Object,
|
|
1496
|
+
default: void 0
|
|
1497
|
+
},
|
|
1498
|
+
/**
|
|
1499
|
+
* The tag name of the component's root element.
|
|
1500
|
+
*/
|
|
1501
|
+
tag: {
|
|
1502
|
+
type: String,
|
|
1503
|
+
default: "canvas"
|
|
1504
|
+
}
|
|
1505
|
+
},
|
|
1506
|
+
emits: [Rt],
|
|
1507
|
+
watch: {
|
|
1508
|
+
$props: {
|
|
1509
|
+
deep: !0,
|
|
1510
|
+
immediate: !0,
|
|
1511
|
+
/**
|
|
1512
|
+
* Update the QR code when props changed.
|
|
1513
|
+
*/
|
|
1514
|
+
handler() {
|
|
1515
|
+
this.$el && this.generate();
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
mounted() {
|
|
1520
|
+
this.generate();
|
|
1521
|
+
},
|
|
1522
|
+
methods: {
|
|
1523
|
+
/**
|
|
1524
|
+
* Generate QR code.
|
|
1525
|
+
*/
|
|
1526
|
+
generate() {
|
|
1527
|
+
const e = this.options || {}, t = String(this.value), i = () => {
|
|
1528
|
+
this.$emit(Rt, this.$el);
|
|
1529
|
+
};
|
|
1530
|
+
switch (this.tag) {
|
|
1531
|
+
case "canvas":
|
|
1532
|
+
on(this.$el, t, e, (s) => {
|
|
1533
|
+
if (s)
|
|
1534
|
+
throw s;
|
|
1535
|
+
i();
|
|
1536
|
+
});
|
|
1537
|
+
break;
|
|
1538
|
+
case "img":
|
|
1539
|
+
rn(t, e, (s, n) => {
|
|
1540
|
+
if (s)
|
|
1541
|
+
throw s;
|
|
1542
|
+
this.$el.src = n, this.$el.onload = i;
|
|
1543
|
+
});
|
|
1544
|
+
break;
|
|
1545
|
+
case "svg":
|
|
1546
|
+
an(t, e, (s, n) => {
|
|
1547
|
+
if (s)
|
|
1548
|
+
throw s;
|
|
1549
|
+
const o = document.createElement("div");
|
|
1550
|
+
o.innerHTML = n;
|
|
1551
|
+
const r = o.querySelector("svg");
|
|
1552
|
+
if (r) {
|
|
1553
|
+
const { attributes: a, childNodes: l } = r;
|
|
1554
|
+
Object.keys(a).forEach((d) => {
|
|
1555
|
+
const c = a[Number(d)];
|
|
1556
|
+
this.$el.setAttribute(c.name, c.value);
|
|
1557
|
+
}), Object.keys(l).forEach((d) => {
|
|
1558
|
+
const c = l[Number(d)];
|
|
1559
|
+
this.$el.appendChild(c.cloneNode(!0));
|
|
1560
|
+
}), i();
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
break;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
},
|
|
1567
|
+
render() {
|
|
1568
|
+
return wt(this.tag, this.$slots.default);
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1571
|
+
class cn {
|
|
1572
|
+
constructor() {
|
|
1573
|
+
this._activePolls = {}, this._pollingInterval = 1e3;
|
|
1574
|
+
}
|
|
1575
|
+
_startPolling(t) {
|
|
1576
|
+
const { handler: i, interval: s } = this._activePolls[t], n = async () => {
|
|
1577
|
+
var o;
|
|
1578
|
+
await i(), (o = this._activePolls[t]) != null && o.pollActive && setTimeout(n, s || this._pollingInterval);
|
|
1579
|
+
};
|
|
1580
|
+
n();
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Add a new poll to the active polls list.
|
|
1584
|
+
* @param {string} options.id - Unique identifier for the poll.
|
|
1585
|
+
* @param {function} options.handler - Function to be executed when the poll is activated.
|
|
1586
|
+
* @param {number} options.interval - Time interval in milliseconds at which the poll should run.
|
|
1587
|
+
* @param {number} [options.removeAfterMs=0] - Optional. Time in milliseconds after which the poll should be automatically removed.
|
|
1588
|
+
* @param {boolean} [options.startImmediately=true] - Optional. If true, the poll will start immediately after being added.
|
|
1589
|
+
* @param {*} [options.data] - Optional. Additional data associated with the poll.
|
|
1590
|
+
* @returns {function} - A function that can be used to manually remove the poll from the active polls list.
|
|
1591
|
+
*/
|
|
1592
|
+
addPoll({
|
|
1593
|
+
id: t,
|
|
1594
|
+
handler: i,
|
|
1595
|
+
interval: s,
|
|
1596
|
+
removeAfterMs: n = 0,
|
|
1597
|
+
startImmediately: o = !0,
|
|
1598
|
+
data: r
|
|
1599
|
+
}) {
|
|
1600
|
+
if (!t || typeof i != "function")
|
|
1601
|
+
throw new Error("Invalid poll definition");
|
|
1602
|
+
if (this._activePolls[t])
|
|
1603
|
+
throw new Error("Poll with the same ID already exists");
|
|
1604
|
+
return this._activePolls[t] = { handler: i, interval: s, pollActive: !1, data: r }, o && setTimeout(() => {
|
|
1605
|
+
this.activatePoll(t);
|
|
1606
|
+
}, 0), n && setTimeout(() => {
|
|
1607
|
+
this._activePolls[t] && this.removePoll(t);
|
|
1608
|
+
}, n), () => this.removePoll(t);
|
|
1609
|
+
}
|
|
1610
|
+
activatePoll(t) {
|
|
1611
|
+
if (!this._activePolls[t])
|
|
1612
|
+
throw new Error("Poll not found");
|
|
1613
|
+
this._activePolls[t].pollActive || (this._activePolls[t].pollActive = !0, this._startPolling(t));
|
|
1614
|
+
}
|
|
1615
|
+
deactivatePoll(t) {
|
|
1616
|
+
if (!this._activePolls[t]) {
|
|
1617
|
+
console.warn("[deactivatePoll] Poll not found");
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
this._activePolls[t].pollActive = !1;
|
|
1621
|
+
}
|
|
1622
|
+
removePoll(t) {
|
|
1623
|
+
if (!this._activePolls[t]) {
|
|
1624
|
+
console.warn("[removePoll] Poll not found");
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
delete this._activePolls[t];
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
let pt = null;
|
|
1631
|
+
function Ut() {
|
|
1632
|
+
return pt || (pt = new cn()), pt;
|
|
1633
|
+
}
|
|
1634
|
+
function dn(e) {
|
|
1635
|
+
window.history.replaceState(window.history.state, "", window.location.href);
|
|
1636
|
+
let t = "";
|
|
1637
|
+
const i = (navigator == null ? void 0 : navigator.userAgent) || "";
|
|
1638
|
+
return i.match("CriOS") ? t = "googlechromes://" : i.match("FxiOS") ? t = "firefox://" : i.match("GSA") && (t = "googleapp://open-url?url="), t + encodeURIComponent(`${window.location.href}#${e}`);
|
|
1639
|
+
}
|
|
1640
|
+
const un = {
|
|
1641
|
+
name: "BankIdAnswer",
|
|
1642
|
+
components: {
|
|
1643
|
+
QrCode: ln
|
|
1644
|
+
},
|
|
1645
|
+
emits: ["loading", "error", "complete"],
|
|
1646
|
+
mixins: [J([])],
|
|
1647
|
+
props: {
|
|
1648
|
+
onCompleteFunc: {
|
|
1649
|
+
type: Function,
|
|
1650
|
+
default: null
|
|
1651
|
+
}
|
|
1652
|
+
},
|
|
1653
|
+
data() {
|
|
1654
|
+
return {
|
|
1655
|
+
signAnswerId: null,
|
|
1656
|
+
view: "form",
|
|
1657
|
+
errorMessage: "",
|
|
1658
|
+
isLoading: !1,
|
|
1659
|
+
qrCode: null,
|
|
1660
|
+
autoStartToken: null,
|
|
1661
|
+
isMobile: !1
|
|
1662
|
+
};
|
|
1663
|
+
},
|
|
1664
|
+
computed: {
|
|
1665
|
+
viewText() {
|
|
1666
|
+
const e = (t) => this._document.$t(`answerModal.bankId.component.viewText.${t}`);
|
|
1667
|
+
return {
|
|
1668
|
+
new: {
|
|
1669
|
+
title: e("new.title"),
|
|
1670
|
+
text: e("new.text"),
|
|
1671
|
+
spinnerText: e("new.spinnerText")
|
|
1672
|
+
},
|
|
1673
|
+
waiting: {
|
|
1674
|
+
title: e("waiting.title"),
|
|
1675
|
+
text: e("waiting.text"),
|
|
1676
|
+
spinnerText: e("waiting.spinnerText")
|
|
1677
|
+
},
|
|
1678
|
+
started: {
|
|
1679
|
+
title: e("waiting.title"),
|
|
1680
|
+
text: e("waiting.text"),
|
|
1681
|
+
spinnerText: e("waiting.spinnerText")
|
|
1682
|
+
},
|
|
1683
|
+
signing: {
|
|
1684
|
+
title: e("signing.title"),
|
|
1685
|
+
text: e("signing.text"),
|
|
1686
|
+
spinnerText: e("signing.spinnerText")
|
|
1687
|
+
},
|
|
1688
|
+
error: {
|
|
1689
|
+
title: e("error.title"),
|
|
1690
|
+
text: e("error.text")
|
|
1691
|
+
},
|
|
1692
|
+
canceled: {
|
|
1693
|
+
title: e("canceled.title"),
|
|
1694
|
+
text: e("canceled.text")
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
},
|
|
1699
|
+
watch: {
|
|
1700
|
+
isLoading(e) {
|
|
1701
|
+
this.$emit("loading", e);
|
|
1702
|
+
}
|
|
1703
|
+
},
|
|
1704
|
+
created() {
|
|
1705
|
+
this.isMobile = ie(), this.tryResumeSigningSession();
|
|
1706
|
+
},
|
|
1707
|
+
methods: {
|
|
1708
|
+
tryResumeSigningSession() {
|
|
1709
|
+
var i, s;
|
|
1710
|
+
const e = Ut(), t = Object.keys(e._activePolls).find(
|
|
1711
|
+
(n) => n.includes("bankId-")
|
|
1712
|
+
);
|
|
1713
|
+
try {
|
|
1714
|
+
if (t) {
|
|
1715
|
+
const { signAnswerId: n, autoStartToken: o, qrCode: r } = ((i = e._activePolls[t]) == null ? void 0 : i.data) || {};
|
|
1716
|
+
this.signAnswerId = n, this.autoStartToken = o, this.qrCode = r, e.removePoll(t), (s = window.location) != null && s.hash && window.history.replaceState(
|
|
1717
|
+
window.history.state,
|
|
1718
|
+
"",
|
|
1719
|
+
window.location.pathname
|
|
1720
|
+
// clears search + hash
|
|
1721
|
+
), this.isLoading = !0, this.startPolling();
|
|
1722
|
+
}
|
|
1723
|
+
} catch {
|
|
1724
|
+
const o = this._document.$t(
|
|
1725
|
+
"answerModal.bankId.component.viewText.error.text"
|
|
1726
|
+
);
|
|
1727
|
+
At("error", o);
|
|
1728
|
+
}
|
|
1729
|
+
},
|
|
1730
|
+
async submit({ answer: e }) {
|
|
1731
|
+
try {
|
|
1732
|
+
this.isLoading = !0;
|
|
1733
|
+
const { id: t, autoStartToken: i, qrCodeData: s } = await e({
|
|
1734
|
+
body: { isAccepted: !0 }
|
|
1735
|
+
});
|
|
1736
|
+
i && (this.autoStartToken = i), s && (this.qrCode = s), this.signAnswerId = t, this.startPolling(), this.isMobile && this.triggerAutoStart();
|
|
1737
|
+
return;
|
|
1738
|
+
} catch (t) {
|
|
1739
|
+
this.onError(t);
|
|
1740
|
+
}
|
|
1741
|
+
},
|
|
1742
|
+
async startPolling() {
|
|
1743
|
+
if (!this.signAnswerId) throw Error("Missing signAnswerId");
|
|
1744
|
+
const e = Ut(), t = `bankId-${this.signAnswerId}`, i = async () => {
|
|
1745
|
+
if (!this.signAnswerId) throw Error("Missing signAnswerId");
|
|
1746
|
+
const s = () => {
|
|
1747
|
+
this.clearSignState(), e.removePoll(t);
|
|
1748
|
+
};
|
|
1749
|
+
try {
|
|
1750
|
+
const { data: n } = await re.get(this.signAnswerId);
|
|
1751
|
+
n.qrCodeData && (this.qrCode = n.qrCodeData), ["completed", "canceled"].includes(n.status) && s(), n.status === "completed" ? this.onComplete() : n.status === "canceled" ? this.onCanceled() : this.view = n.status;
|
|
1752
|
+
} catch (n) {
|
|
1753
|
+
this.onError(n), s();
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
try {
|
|
1757
|
+
e.addPoll({
|
|
1758
|
+
id: t,
|
|
1759
|
+
handler: i,
|
|
1760
|
+
interval: 1e3,
|
|
1761
|
+
data: {
|
|
1762
|
+
signAnswerId: this.signAnswerId,
|
|
1763
|
+
autoStartToken: this.autoStartToken,
|
|
1764
|
+
qrCode: this.qrCode
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
} catch {
|
|
1768
|
+
this.clearSignState();
|
|
1769
|
+
const n = this._document.$t(
|
|
1770
|
+
"answerModal.bankId.component.viewText.error.text"
|
|
1771
|
+
);
|
|
1772
|
+
At("error", n);
|
|
1773
|
+
}
|
|
1774
|
+
},
|
|
1775
|
+
clearSignState() {
|
|
1776
|
+
this.autoStartToken = null, this.qrCode = null, this.isLoading = !1;
|
|
1777
|
+
},
|
|
1778
|
+
onComplete() {
|
|
1779
|
+
typeof this.onCompleteFunc == "function" && this.onCompleteFunc();
|
|
1780
|
+
},
|
|
1781
|
+
onCanceled() {
|
|
1782
|
+
this.view = "canceled", this.errorMessage = this._document.$t(
|
|
1783
|
+
"answerModal.bankId.component.signingInterrupted"
|
|
1784
|
+
);
|
|
1785
|
+
},
|
|
1786
|
+
onError(e) {
|
|
1787
|
+
var i, s;
|
|
1788
|
+
if (e.httpStatusCode === 409) throw e;
|
|
1789
|
+
this.$emit("error"), this.view = "error";
|
|
1790
|
+
const t = (s = (i = e.response) == null ? void 0 : i.data) == null ? void 0 : s.errorCode;
|
|
1791
|
+
switch (t) {
|
|
1792
|
+
case 9001:
|
|
1793
|
+
case 9002:
|
|
1794
|
+
case 9003:
|
|
1795
|
+
case 9004:
|
|
1796
|
+
case 9005:
|
|
1797
|
+
case 9006:
|
|
1798
|
+
case 9007:
|
|
1799
|
+
oe.warn(e);
|
|
1800
|
+
break;
|
|
1801
|
+
case 9009:
|
|
1802
|
+
this.$emit("complete");
|
|
1803
|
+
break;
|
|
1804
|
+
default:
|
|
1805
|
+
bt(e, { showMessage: !1 });
|
|
1806
|
+
}
|
|
1807
|
+
this.errorMessage = this.$i18n.te(`errors:${t}`) && this._document.$t(`answerModal.bankId.component.errors.${t}`) || this._document.$t("answerModal.bankId.component.defaultError");
|
|
1808
|
+
},
|
|
1809
|
+
triggerAutoStart() {
|
|
1810
|
+
if (!this.autoStartToken) return;
|
|
1811
|
+
let e = "bankid://", t = "null";
|
|
1812
|
+
if (this.isMobile) {
|
|
1813
|
+
const s = ae(), n = (navigator == null ? void 0 : navigator.userAgent) || (navigator == null ? void 0 : navigator.vendor) || (window == null ? void 0 : window.opera), o = s === "iOS" && (/Version\/[\d.]+.*Safari/.test(n) || /GSA/.test(n)), r = s === "Android" && /Version\/[\d.]+.*Chrome/.test(n);
|
|
1814
|
+
(o || r) && (e = "https://app.bankid.com"), s === "iOS" && Ot.value !== "widget" && (t = dn(this.signAnswerId));
|
|
1815
|
+
}
|
|
1816
|
+
const i = `${e}/?autostarttoken=${this.autoStartToken}&redirect=${t}`;
|
|
1817
|
+
this.isMobile ? document.location = i : this.$refs.autoStartFrame.src = i;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
}, hn = { class: "-my-4 flex flex-col items-center" }, fn = {
|
|
1821
|
+
ref: "autoStartFrame",
|
|
1822
|
+
height: "0",
|
|
1823
|
+
width: "0",
|
|
1824
|
+
class: "hidden"
|
|
1825
|
+
}, gn = {
|
|
1826
|
+
key: 0,
|
|
1827
|
+
class: "flex h-[250px] w-[250px] items-center justify-center rounded-xl bg-gray-100"
|
|
1828
|
+
}, mn = ["textContent"], pn = { key: 2 }, wn = {
|
|
1829
|
+
class: "flex flex-col items-center justify-center",
|
|
1830
|
+
style: { "background-color": "#183e4f", padding: `calc(2.5 * var(--rem)) calc(3 * var(--rem))
|
|
1831
|
+
calc(2 * var(--rem))` }
|
|
1832
|
+
}, yn = ["textContent"], vn = {
|
|
1833
|
+
class: "flex w-full flex-col items-center justify-center text-center",
|
|
1834
|
+
style: { padding: `calc(3 * var(--rem)) calc(2 * var(--rem))
|
|
1835
|
+
calc(2 * var(--rem))` }
|
|
1836
|
+
}, _n = ["textContent"], Cn = ["textContent"];
|
|
1837
|
+
function xn(e, t, i, s, n, o) {
|
|
1838
|
+
const r = M("CIcon"), a = M("QrCode"), l = M("CButton"), d = M("Animation");
|
|
1839
|
+
return P(), S("div", hn, [
|
|
1840
|
+
g("iframe", fn, null, 512),
|
|
1841
|
+
["form", "signing", "error", "canceled"].includes(n.view) ? (P(), S("div", gn, [
|
|
1842
|
+
b(r, {
|
|
1843
|
+
type: "bankId",
|
|
1844
|
+
size: "50",
|
|
1845
|
+
class: "text-gray-500"
|
|
1846
|
+
})
|
|
1847
|
+
])) : $("", !0),
|
|
1848
|
+
["new", "waiting", "started"].includes(n.view) ? (P(), S(ct, { key: 1 }, [
|
|
1849
|
+
n.qrCode ? (P(), G(a, {
|
|
1850
|
+
key: 0,
|
|
1851
|
+
value: n.qrCode,
|
|
1852
|
+
options: {
|
|
1853
|
+
width: 250,
|
|
1854
|
+
errorCorrectionLevel: "L",
|
|
1855
|
+
color: { dark: "#000000" }
|
|
1856
|
+
}
|
|
1857
|
+
}, null, 8, ["value"])) : $("", !0)
|
|
1858
|
+
], 64)) : $("", !0),
|
|
1859
|
+
b(d, { class: "w-full" }, {
|
|
1860
|
+
default: A(() => {
|
|
1861
|
+
var c;
|
|
1862
|
+
return [
|
|
1863
|
+
g("div", {
|
|
1864
|
+
key: "a",
|
|
1865
|
+
class: "min-h-[20px] pt-4 text-sm text-gray-500",
|
|
1866
|
+
textContent: C((c = o.viewText[n.view]) == null ? void 0 : c.spinnerText)
|
|
1867
|
+
}, null, 8, mn),
|
|
1868
|
+
!n.isMobile && ["new", "waiting", "started"].includes(n.view) ? (P(), G(l, {
|
|
1869
|
+
key: "b",
|
|
1870
|
+
type: "none",
|
|
1871
|
+
pattern: "secondary",
|
|
1872
|
+
size: "small",
|
|
1873
|
+
class: "mt-4",
|
|
1874
|
+
onClick: o.triggerAutoStart
|
|
1875
|
+
}, {
|
|
1876
|
+
default: A(() => [
|
|
1877
|
+
z(C(e._document.$t("answerModal.bankId.component.startOnThisDevice")), 1)
|
|
1878
|
+
]),
|
|
1879
|
+
_: 1
|
|
1880
|
+
}, 8, ["onClick"])) : $("", !0)
|
|
1881
|
+
];
|
|
1882
|
+
}),
|
|
1883
|
+
_: 1
|
|
1884
|
+
}),
|
|
1885
|
+
["form", "new", "waiting", "started"].includes(n.view) ? $("", !0) : (P(), S("div", pn, [
|
|
1886
|
+
b(Pt, { name: "pop-in" }, {
|
|
1887
|
+
default: A(() => [
|
|
1888
|
+
["signing", "error", "canceled"].includes(n.view) ? (P(), S("div", {
|
|
1889
|
+
key: 0,
|
|
1890
|
+
class: "bankid-popup",
|
|
1891
|
+
onClick: t[1] || (t[1] = () => {
|
|
1892
|
+
n.view = "form", n.isLoading = !1;
|
|
1893
|
+
})
|
|
1894
|
+
}, [
|
|
1895
|
+
g("div", wn, [
|
|
1896
|
+
b(r, {
|
|
1897
|
+
type: "bankId",
|
|
1898
|
+
size: "34",
|
|
1899
|
+
class: "text-white"
|
|
1900
|
+
}),
|
|
1901
|
+
g("div", {
|
|
1902
|
+
class: "pt-4 text-sm font-medium text-white opacity-75",
|
|
1903
|
+
textContent: C(o.viewText[n.view].text)
|
|
1904
|
+
}, null, 8, yn)
|
|
1905
|
+
]),
|
|
1906
|
+
g("div", vn, [
|
|
1907
|
+
n.view === "signing" ? (P(), S(ct, { key: 0 }, [
|
|
1908
|
+
t[2] || (t[2] = g("div", { class: "spinner" }, null, -1)),
|
|
1909
|
+
g("div", {
|
|
1910
|
+
class: "pt-8 text-gray-500",
|
|
1911
|
+
textContent: C(o.viewText[n.view].spinnerText)
|
|
1912
|
+
}, null, 8, _n)
|
|
1913
|
+
], 64)) : ["error", "canceled"].includes(n.view) ? (P(), S(ct, { key: 1 }, [
|
|
1914
|
+
b(r, {
|
|
1915
|
+
type: "error",
|
|
1916
|
+
size: "22",
|
|
1917
|
+
class: "mb-2.5 text-gray-400"
|
|
1918
|
+
}),
|
|
1919
|
+
g("div", {
|
|
1920
|
+
style: { "font-size": "14px" },
|
|
1921
|
+
textContent: C(n.errorMessage)
|
|
1922
|
+
}, null, 8, Cn),
|
|
1923
|
+
b(l, {
|
|
1924
|
+
loading: n.isLoading,
|
|
1925
|
+
type: "none",
|
|
1926
|
+
pattern: "secondary",
|
|
1927
|
+
size: "small",
|
|
1928
|
+
style: { "margin-top": "calc(2.5 * var(--rem))", padding: "1em", height: "initial" },
|
|
1929
|
+
onClick: t[0] || (t[0] = (c) => n.view = "form")
|
|
1930
|
+
}, {
|
|
1931
|
+
default: A(() => [
|
|
1932
|
+
z(C(e._document.$t("tryAgain")), 1)
|
|
1933
|
+
]),
|
|
1934
|
+
_: 1
|
|
1935
|
+
}, 8, ["loading"])
|
|
1936
|
+
], 64)) : $("", !0)
|
|
1937
|
+
])
|
|
1938
|
+
])) : $("", !0)
|
|
1939
|
+
]),
|
|
1940
|
+
_: 1
|
|
1941
|
+
})
|
|
1942
|
+
]))
|
|
1943
|
+
]);
|
|
1944
|
+
}
|
|
1945
|
+
const bn = /* @__PURE__ */ X(un, [["render", xn], ["__scopeId", "data-v-722c137f"]]), Pn = {
|
|
1946
|
+
name: "DenyAnswer",
|
|
1947
|
+
mixins: [J([])],
|
|
1948
|
+
props: {
|
|
1949
|
+
onCompleteFunc: {
|
|
1950
|
+
type: Function,
|
|
1951
|
+
default: null
|
|
1952
|
+
}
|
|
1953
|
+
},
|
|
1954
|
+
data() {
|
|
1955
|
+
return {
|
|
1956
|
+
rejectReason: ""
|
|
1957
|
+
};
|
|
1958
|
+
},
|
|
1959
|
+
methods: {
|
|
1960
|
+
async submit({ update: e, answer: t }) {
|
|
1961
|
+
const i = [];
|
|
1962
|
+
this.rejectReason && i.push({
|
|
1963
|
+
key: "unclear-other",
|
|
1964
|
+
category: "misc",
|
|
1965
|
+
description: this.rejectReason,
|
|
1966
|
+
sentAt: this._document.lastSentAt
|
|
1967
|
+
}), await e({ body: { "data.rejectReasons": i } }), await t({ body: { isAccepted: !1 } }), typeof this.onCompleteFunc == "function" && this.onCompleteFunc();
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}, En = { class: "text-left" };
|
|
1971
|
+
function kn(e, t, i, s, n, o) {
|
|
1972
|
+
const r = M("CInput");
|
|
1973
|
+
return P(), S("div", En, [
|
|
1974
|
+
g("label", null, C(e._document.$t("answerModal.decline.component.label")), 1),
|
|
1975
|
+
b(r, {
|
|
1976
|
+
modelValue: n.rejectReason,
|
|
1977
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => n.rejectReason = a),
|
|
1978
|
+
type: "textarea",
|
|
1979
|
+
filled: "",
|
|
1980
|
+
"custom-class": "decline-input",
|
|
1981
|
+
style: { "margin-bottom": "calc(1.5 * var(--rem))" }
|
|
1982
|
+
}, null, 8, ["modelValue"])
|
|
1983
|
+
]);
|
|
1984
|
+
}
|
|
1985
|
+
const Sn = /* @__PURE__ */ X(Pn, [["render", kn]]);
|
|
1986
|
+
/*!
|
|
1987
|
+
* Signature Pad v4.0.10 | https://github.com/szimek/signature_pad
|
|
1988
|
+
* (c) 2022 Szymon Nowak | Released under the MIT license
|
|
1989
|
+
*/
|
|
1990
|
+
class st {
|
|
1991
|
+
constructor(t, i, s, n) {
|
|
1992
|
+
if (isNaN(t) || isNaN(i))
|
|
1993
|
+
throw new Error(`Point is invalid: (${t}, ${i})`);
|
|
1994
|
+
this.x = +t, this.y = +i, this.pressure = s || 0, this.time = n || Date.now();
|
|
1995
|
+
}
|
|
1996
|
+
distanceTo(t) {
|
|
1997
|
+
return Math.sqrt(Math.pow(this.x - t.x, 2) + Math.pow(this.y - t.y, 2));
|
|
1998
|
+
}
|
|
1999
|
+
equals(t) {
|
|
2000
|
+
return this.x === t.x && this.y === t.y && this.pressure === t.pressure && this.time === t.time;
|
|
2001
|
+
}
|
|
2002
|
+
velocityFrom(t) {
|
|
2003
|
+
return this.time !== t.time ? this.distanceTo(t) / (this.time - t.time) : 0;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
class It {
|
|
2007
|
+
constructor(t, i, s, n, o, r) {
|
|
2008
|
+
this.startPoint = t, this.control2 = i, this.control1 = s, this.endPoint = n, this.startWidth = o, this.endWidth = r;
|
|
2009
|
+
}
|
|
2010
|
+
static fromPoints(t, i) {
|
|
2011
|
+
const s = this.calculateControlPoints(t[0], t[1], t[2]).c2, n = this.calculateControlPoints(t[1], t[2], t[3]).c1;
|
|
2012
|
+
return new It(t[1], s, n, t[2], i.start, i.end);
|
|
2013
|
+
}
|
|
2014
|
+
static calculateControlPoints(t, i, s) {
|
|
2015
|
+
const n = t.x - i.x, o = t.y - i.y, r = i.x - s.x, a = i.y - s.y, l = { x: (t.x + i.x) / 2, y: (t.y + i.y) / 2 }, d = { x: (i.x + s.x) / 2, y: (i.y + s.y) / 2 }, c = Math.sqrt(n * n + o * o), m = Math.sqrt(r * r + a * a), p = l.x - d.x, u = l.y - d.y, f = m / (c + m), h = { x: d.x + p * f, y: d.y + u * f }, E = i.x - h.x, w = i.y - h.y;
|
|
2016
|
+
return {
|
|
2017
|
+
c1: new st(l.x + E, l.y + w),
|
|
2018
|
+
c2: new st(d.x + E, d.y + w)
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
length() {
|
|
2022
|
+
let i = 0, s, n;
|
|
2023
|
+
for (let o = 0; o <= 10; o += 1) {
|
|
2024
|
+
const r = o / 10, a = this.point(r, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x), l = this.point(r, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);
|
|
2025
|
+
if (o > 0) {
|
|
2026
|
+
const d = a - s, c = l - n;
|
|
2027
|
+
i += Math.sqrt(d * d + c * c);
|
|
2028
|
+
}
|
|
2029
|
+
s = a, n = l;
|
|
2030
|
+
}
|
|
2031
|
+
return i;
|
|
2032
|
+
}
|
|
2033
|
+
point(t, i, s, n, o) {
|
|
2034
|
+
return i * (1 - t) * (1 - t) * (1 - t) + 3 * s * (1 - t) * (1 - t) * t + 3 * n * (1 - t) * t * t + o * t * t * t;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
class Tn {
|
|
2038
|
+
constructor() {
|
|
2039
|
+
try {
|
|
2040
|
+
this._et = new EventTarget();
|
|
2041
|
+
} catch {
|
|
2042
|
+
this._et = document;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
addEventListener(t, i, s) {
|
|
2046
|
+
this._et.addEventListener(t, i, s);
|
|
2047
|
+
}
|
|
2048
|
+
dispatchEvent(t) {
|
|
2049
|
+
return this._et.dispatchEvent(t);
|
|
2050
|
+
}
|
|
2051
|
+
removeEventListener(t, i, s) {
|
|
2052
|
+
this._et.removeEventListener(t, i, s);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
function Mn(e, t = 250) {
|
|
2056
|
+
let i = 0, s = null, n, o, r;
|
|
2057
|
+
const a = () => {
|
|
2058
|
+
i = Date.now(), s = null, n = e.apply(o, r), s || (o = null, r = []);
|
|
2059
|
+
};
|
|
2060
|
+
return function(...d) {
|
|
2061
|
+
const c = Date.now(), m = t - (c - i);
|
|
2062
|
+
return o = this, r = d, m <= 0 || m > t ? (s && (clearTimeout(s), s = null), i = c, n = e.apply(o, r), s || (o = null, r = [])) : s || (s = window.setTimeout(a, m)), n;
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
let In = class xt extends Tn {
|
|
2066
|
+
constructor(t, i = {}) {
|
|
2067
|
+
super(), this.canvas = t, this._handleMouseDown = (s) => {
|
|
2068
|
+
s.buttons === 1 && (this._drawningStroke = !0, this._strokeBegin(s));
|
|
2069
|
+
}, this._handleMouseMove = (s) => {
|
|
2070
|
+
this._drawningStroke && this._strokeMoveUpdate(s);
|
|
2071
|
+
}, this._handleMouseUp = (s) => {
|
|
2072
|
+
s.buttons === 1 && this._drawningStroke && (this._drawningStroke = !1, this._strokeEnd(s));
|
|
2073
|
+
}, this._handleTouchStart = (s) => {
|
|
2074
|
+
if (s.cancelable && s.preventDefault(), s.targetTouches.length === 1) {
|
|
2075
|
+
const n = s.changedTouches[0];
|
|
2076
|
+
this._strokeBegin(n);
|
|
2077
|
+
}
|
|
2078
|
+
}, this._handleTouchMove = (s) => {
|
|
2079
|
+
s.cancelable && s.preventDefault();
|
|
2080
|
+
const n = s.targetTouches[0];
|
|
2081
|
+
this._strokeMoveUpdate(n);
|
|
2082
|
+
}, this._handleTouchEnd = (s) => {
|
|
2083
|
+
if (s.target === this.canvas) {
|
|
2084
|
+
s.cancelable && s.preventDefault();
|
|
2085
|
+
const o = s.changedTouches[0];
|
|
2086
|
+
this._strokeEnd(o);
|
|
2087
|
+
}
|
|
2088
|
+
}, this._handlePointerStart = (s) => {
|
|
2089
|
+
this._drawningStroke = !0, s.preventDefault(), this._strokeBegin(s);
|
|
2090
|
+
}, this._handlePointerMove = (s) => {
|
|
2091
|
+
this._drawningStroke && (s.preventDefault(), this._strokeMoveUpdate(s));
|
|
2092
|
+
}, this._handlePointerEnd = (s) => {
|
|
2093
|
+
this._drawningStroke && (s.preventDefault(), this._drawningStroke = !1, this._strokeEnd(s));
|
|
2094
|
+
}, this.velocityFilterWeight = i.velocityFilterWeight || 0.7, this.minWidth = i.minWidth || 0.5, this.maxWidth = i.maxWidth || 2.5, this.throttle = "throttle" in i ? i.throttle : 16, this.minDistance = "minDistance" in i ? i.minDistance : 5, this.dotSize = i.dotSize || 0, this.penColor = i.penColor || "black", this.backgroundColor = i.backgroundColor || "rgba(0,0,0,0)", this._strokeMoveUpdate = this.throttle ? Mn(xt.prototype._strokeUpdate, this.throttle) : xt.prototype._strokeUpdate, this._ctx = t.getContext("2d"), this.clear(), this.on();
|
|
2095
|
+
}
|
|
2096
|
+
clear() {
|
|
2097
|
+
const { _ctx: t, canvas: i } = this;
|
|
2098
|
+
t.fillStyle = this.backgroundColor, t.clearRect(0, 0, i.width, i.height), t.fillRect(0, 0, i.width, i.height), this._data = [], this._reset(this._getPointGroupOptions()), this._isEmpty = !0;
|
|
2099
|
+
}
|
|
2100
|
+
fromDataURL(t, i = {}) {
|
|
2101
|
+
return new Promise((s, n) => {
|
|
2102
|
+
const o = new Image(), r = i.ratio || window.devicePixelRatio || 1, a = i.width || this.canvas.width / r, l = i.height || this.canvas.height / r, d = i.xOffset || 0, c = i.yOffset || 0;
|
|
2103
|
+
this._reset(this._getPointGroupOptions()), o.onload = () => {
|
|
2104
|
+
this._ctx.drawImage(o, d, c, a, l), s();
|
|
2105
|
+
}, o.onerror = (m) => {
|
|
2106
|
+
n(m);
|
|
2107
|
+
}, o.crossOrigin = "anonymous", o.src = t, this._isEmpty = !1;
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
toDataURL(t = "image/png", i) {
|
|
2111
|
+
switch (t) {
|
|
2112
|
+
case "image/svg+xml":
|
|
2113
|
+
return this._toSVG();
|
|
2114
|
+
default:
|
|
2115
|
+
return this.canvas.toDataURL(t, i);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
on() {
|
|
2119
|
+
this.canvas.style.touchAction = "none", this.canvas.style.msTouchAction = "none", this.canvas.style.userSelect = "none";
|
|
2120
|
+
const t = /Macintosh/.test(navigator.userAgent) && "ontouchstart" in document;
|
|
2121
|
+
window.PointerEvent && !t ? this._handlePointerEvents() : (this._handleMouseEvents(), "ontouchstart" in window && this._handleTouchEvents());
|
|
2122
|
+
}
|
|
2123
|
+
off() {
|
|
2124
|
+
this.canvas.style.touchAction = "auto", this.canvas.style.msTouchAction = "auto", this.canvas.style.userSelect = "auto", this.canvas.removeEventListener("pointerdown", this._handlePointerStart), this.canvas.removeEventListener("pointermove", this._handlePointerMove), this.canvas.ownerDocument.removeEventListener("pointerup", this._handlePointerEnd), this.canvas.removeEventListener("mousedown", this._handleMouseDown), this.canvas.removeEventListener("mousemove", this._handleMouseMove), this.canvas.ownerDocument.removeEventListener("mouseup", this._handleMouseUp), this.canvas.removeEventListener("touchstart", this._handleTouchStart), this.canvas.removeEventListener("touchmove", this._handleTouchMove), this.canvas.removeEventListener("touchend", this._handleTouchEnd);
|
|
2125
|
+
}
|
|
2126
|
+
isEmpty() {
|
|
2127
|
+
return this._isEmpty;
|
|
2128
|
+
}
|
|
2129
|
+
fromData(t, { clear: i = !0 } = {}) {
|
|
2130
|
+
i && this.clear(), this._fromData(t, this._drawCurve.bind(this), this._drawDot.bind(this)), this._data = this._data.concat(t);
|
|
2131
|
+
}
|
|
2132
|
+
toData() {
|
|
2133
|
+
return this._data;
|
|
2134
|
+
}
|
|
2135
|
+
_getPointGroupOptions(t) {
|
|
2136
|
+
return {
|
|
2137
|
+
penColor: t && "penColor" in t ? t.penColor : this.penColor,
|
|
2138
|
+
dotSize: t && "dotSize" in t ? t.dotSize : this.dotSize,
|
|
2139
|
+
minWidth: t && "minWidth" in t ? t.minWidth : this.minWidth,
|
|
2140
|
+
maxWidth: t && "maxWidth" in t ? t.maxWidth : this.maxWidth,
|
|
2141
|
+
velocityFilterWeight: t && "velocityFilterWeight" in t ? t.velocityFilterWeight : this.velocityFilterWeight
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
_strokeBegin(t) {
|
|
2145
|
+
this.dispatchEvent(new CustomEvent("beginStroke", { detail: t }));
|
|
2146
|
+
const i = this._getPointGroupOptions(), s = Object.assign(Object.assign({}, i), { points: [] });
|
|
2147
|
+
this._data.push(s), this._reset(i), this._strokeUpdate(t);
|
|
2148
|
+
}
|
|
2149
|
+
_strokeUpdate(t) {
|
|
2150
|
+
if (this._data.length === 0) {
|
|
2151
|
+
this._strokeBegin(t);
|
|
2152
|
+
return;
|
|
2153
|
+
}
|
|
2154
|
+
this.dispatchEvent(new CustomEvent("beforeUpdateStroke", { detail: t }));
|
|
2155
|
+
const i = t.clientX, s = t.clientY, n = t.pressure !== void 0 ? t.pressure : t.force !== void 0 ? t.force : 0, o = this._createPoint(i, s, n), r = this._data[this._data.length - 1], a = r.points, l = a.length > 0 && a[a.length - 1], d = l ? o.distanceTo(l) <= this.minDistance : !1, c = this._getPointGroupOptions(r);
|
|
2156
|
+
if (!l || !(l && d)) {
|
|
2157
|
+
const m = this._addPoint(o, c);
|
|
2158
|
+
l ? m && this._drawCurve(m, c) : this._drawDot(o, c), a.push({
|
|
2159
|
+
time: o.time,
|
|
2160
|
+
x: o.x,
|
|
2161
|
+
y: o.y,
|
|
2162
|
+
pressure: o.pressure
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
this.dispatchEvent(new CustomEvent("afterUpdateStroke", { detail: t }));
|
|
2166
|
+
}
|
|
2167
|
+
_strokeEnd(t) {
|
|
2168
|
+
this._strokeUpdate(t), this.dispatchEvent(new CustomEvent("endStroke", { detail: t }));
|
|
2169
|
+
}
|
|
2170
|
+
_handlePointerEvents() {
|
|
2171
|
+
this._drawningStroke = !1, this.canvas.addEventListener("pointerdown", this._handlePointerStart), this.canvas.addEventListener("pointermove", this._handlePointerMove), this.canvas.ownerDocument.addEventListener("pointerup", this._handlePointerEnd);
|
|
2172
|
+
}
|
|
2173
|
+
_handleMouseEvents() {
|
|
2174
|
+
this._drawningStroke = !1, this.canvas.addEventListener("mousedown", this._handleMouseDown), this.canvas.addEventListener("mousemove", this._handleMouseMove), this.canvas.ownerDocument.addEventListener("mouseup", this._handleMouseUp);
|
|
2175
|
+
}
|
|
2176
|
+
_handleTouchEvents() {
|
|
2177
|
+
this.canvas.addEventListener("touchstart", this._handleTouchStart), this.canvas.addEventListener("touchmove", this._handleTouchMove), this.canvas.addEventListener("touchend", this._handleTouchEnd);
|
|
2178
|
+
}
|
|
2179
|
+
_reset(t) {
|
|
2180
|
+
this._lastPoints = [], this._lastVelocity = 0, this._lastWidth = (t.minWidth + t.maxWidth) / 2, this._ctx.fillStyle = t.penColor;
|
|
2181
|
+
}
|
|
2182
|
+
_createPoint(t, i, s) {
|
|
2183
|
+
const n = this.canvas.getBoundingClientRect();
|
|
2184
|
+
return new st(t - n.left, i - n.top, s, (/* @__PURE__ */ new Date()).getTime());
|
|
2185
|
+
}
|
|
2186
|
+
_addPoint(t, i) {
|
|
2187
|
+
const { _lastPoints: s } = this;
|
|
2188
|
+
if (s.push(t), s.length > 2) {
|
|
2189
|
+
s.length === 3 && s.unshift(s[0]);
|
|
2190
|
+
const n = this._calculateCurveWidths(s[1], s[2], i), o = It.fromPoints(s, n);
|
|
2191
|
+
return s.shift(), o;
|
|
2192
|
+
}
|
|
2193
|
+
return null;
|
|
2194
|
+
}
|
|
2195
|
+
_calculateCurveWidths(t, i, s) {
|
|
2196
|
+
const n = s.velocityFilterWeight * i.velocityFrom(t) + (1 - s.velocityFilterWeight) * this._lastVelocity, o = this._strokeWidth(n, s), r = {
|
|
2197
|
+
end: o,
|
|
2198
|
+
start: this._lastWidth
|
|
2199
|
+
};
|
|
2200
|
+
return this._lastVelocity = n, this._lastWidth = o, r;
|
|
2201
|
+
}
|
|
2202
|
+
_strokeWidth(t, i) {
|
|
2203
|
+
return Math.max(i.maxWidth / (t + 1), i.minWidth);
|
|
2204
|
+
}
|
|
2205
|
+
_drawCurveSegment(t, i, s) {
|
|
2206
|
+
const n = this._ctx;
|
|
2207
|
+
n.moveTo(t, i), n.arc(t, i, s, 0, 2 * Math.PI, !1), this._isEmpty = !1;
|
|
2208
|
+
}
|
|
2209
|
+
_drawCurve(t, i) {
|
|
2210
|
+
const s = this._ctx, n = t.endWidth - t.startWidth, o = Math.ceil(t.length()) * 2;
|
|
2211
|
+
s.beginPath(), s.fillStyle = i.penColor;
|
|
2212
|
+
for (let r = 0; r < o; r += 1) {
|
|
2213
|
+
const a = r / o, l = a * a, d = l * a, c = 1 - a, m = c * c, p = m * c;
|
|
2214
|
+
let u = p * t.startPoint.x;
|
|
2215
|
+
u += 3 * m * a * t.control1.x, u += 3 * c * l * t.control2.x, u += d * t.endPoint.x;
|
|
2216
|
+
let f = p * t.startPoint.y;
|
|
2217
|
+
f += 3 * m * a * t.control1.y, f += 3 * c * l * t.control2.y, f += d * t.endPoint.y;
|
|
2218
|
+
const h = Math.min(t.startWidth + d * n, i.maxWidth);
|
|
2219
|
+
this._drawCurveSegment(u, f, h);
|
|
2220
|
+
}
|
|
2221
|
+
s.closePath(), s.fill();
|
|
2222
|
+
}
|
|
2223
|
+
_drawDot(t, i) {
|
|
2224
|
+
const s = this._ctx, n = i.dotSize > 0 ? i.dotSize : (i.minWidth + i.maxWidth) / 2;
|
|
2225
|
+
s.beginPath(), this._drawCurveSegment(t.x, t.y, n), s.closePath(), s.fillStyle = i.penColor, s.fill();
|
|
2226
|
+
}
|
|
2227
|
+
_fromData(t, i, s) {
|
|
2228
|
+
for (const n of t) {
|
|
2229
|
+
const { points: o } = n, r = this._getPointGroupOptions(n);
|
|
2230
|
+
if (o.length > 1)
|
|
2231
|
+
for (let a = 0; a < o.length; a += 1) {
|
|
2232
|
+
const l = o[a], d = new st(l.x, l.y, l.pressure, l.time);
|
|
2233
|
+
a === 0 && this._reset(r);
|
|
2234
|
+
const c = this._addPoint(d, r);
|
|
2235
|
+
c && i(c, r);
|
|
2236
|
+
}
|
|
2237
|
+
else
|
|
2238
|
+
this._reset(r), s(o[0], r);
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
_toSVG() {
|
|
2242
|
+
const t = this._data, i = Math.max(window.devicePixelRatio || 1, 1), s = 0, n = 0, o = this.canvas.width / i, r = this.canvas.height / i, a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2243
|
+
a.setAttribute("width", this.canvas.width.toString()), a.setAttribute("height", this.canvas.height.toString()), this._fromData(t, (u, { penColor: f }) => {
|
|
2244
|
+
const h = document.createElement("path");
|
|
2245
|
+
if (!isNaN(u.control1.x) && !isNaN(u.control1.y) && !isNaN(u.control2.x) && !isNaN(u.control2.y)) {
|
|
2246
|
+
const E = `M ${u.startPoint.x.toFixed(3)},${u.startPoint.y.toFixed(3)} C ${u.control1.x.toFixed(3)},${u.control1.y.toFixed(3)} ${u.control2.x.toFixed(3)},${u.control2.y.toFixed(3)} ${u.endPoint.x.toFixed(3)},${u.endPoint.y.toFixed(3)}`;
|
|
2247
|
+
h.setAttribute("d", E), h.setAttribute("stroke-width", (u.endWidth * 2.25).toFixed(3)), h.setAttribute("stroke", f), h.setAttribute("fill", "none"), h.setAttribute("stroke-linecap", "round"), a.appendChild(h);
|
|
2248
|
+
}
|
|
2249
|
+
}, (u, { penColor: f, dotSize: h, minWidth: E, maxWidth: w }) => {
|
|
2250
|
+
const _ = document.createElement("circle"), y = h > 0 ? h : (E + w) / 2;
|
|
2251
|
+
_.setAttribute("r", y.toString()), _.setAttribute("cx", u.x.toString()), _.setAttribute("cy", u.y.toString()), _.setAttribute("fill", f), a.appendChild(_);
|
|
2252
|
+
});
|
|
2253
|
+
const l = "data:image/svg+xml;base64,", d = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="${s} ${n} ${o} ${r}" width="${o}" height="${r}">`;
|
|
2254
|
+
let c = a.innerHTML;
|
|
2255
|
+
if (c === void 0) {
|
|
2256
|
+
const u = document.createElement("dummy"), f = a.childNodes;
|
|
2257
|
+
u.innerHTML = "";
|
|
2258
|
+
for (let h = 0; h < f.length; h += 1)
|
|
2259
|
+
u.appendChild(f[h].cloneNode(!0));
|
|
2260
|
+
c = u.innerHTML;
|
|
2261
|
+
}
|
|
2262
|
+
const p = d + c + "</svg>";
|
|
2263
|
+
return l + btoa(p);
|
|
2264
|
+
}
|
|
2265
|
+
};
|
|
2266
|
+
class An extends In {
|
|
2267
|
+
fromText(t, i = {}) {
|
|
2268
|
+
if (this.clear(), !t) return;
|
|
2269
|
+
const { font: s, x: n = 10, y: o = 50 } = i;
|
|
2270
|
+
let { maxWidth: r } = i;
|
|
2271
|
+
if (!r) {
|
|
2272
|
+
const { clientWidth: a = 300 } = this.canvas;
|
|
2273
|
+
r = Math.floor(a - 2 * n);
|
|
2274
|
+
}
|
|
2275
|
+
this._ctx.font = s, this._ctx.fillText(t, n, o, r), this._isEmpty = !1;
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
const Bn = {
|
|
2279
|
+
name: "SignaturePad",
|
|
2280
|
+
props: {
|
|
2281
|
+
type: {
|
|
2282
|
+
type: String,
|
|
2283
|
+
default: "text",
|
|
2284
|
+
validator: (e) => ["text", "draw"].includes(e)
|
|
2285
|
+
},
|
|
2286
|
+
text: {
|
|
2287
|
+
type: String,
|
|
2288
|
+
default: ""
|
|
2289
|
+
},
|
|
2290
|
+
width: {
|
|
2291
|
+
type: String,
|
|
2292
|
+
default: "100%"
|
|
2293
|
+
},
|
|
2294
|
+
height: {
|
|
2295
|
+
type: String,
|
|
2296
|
+
default: "100%"
|
|
2297
|
+
},
|
|
2298
|
+
customStyle: {
|
|
2299
|
+
type: Object,
|
|
2300
|
+
default: () => ({})
|
|
2301
|
+
},
|
|
2302
|
+
options: {
|
|
2303
|
+
type: Object,
|
|
2304
|
+
default: () => ({})
|
|
2305
|
+
},
|
|
2306
|
+
/**
|
|
2307
|
+
* Obj on format like {
|
|
2308
|
+
beginStroke: () => {},
|
|
2309
|
+
endStroke: () => {},
|
|
2310
|
+
},
|
|
2311
|
+
*/
|
|
2312
|
+
signEvents: {
|
|
2313
|
+
type: Object,
|
|
2314
|
+
default: () => ({})
|
|
2315
|
+
},
|
|
2316
|
+
images: {
|
|
2317
|
+
type: Array,
|
|
2318
|
+
default: () => []
|
|
2319
|
+
}
|
|
2320
|
+
},
|
|
2321
|
+
data() {
|
|
2322
|
+
return {
|
|
2323
|
+
signaturePad: {},
|
|
2324
|
+
onResizeHandler: null,
|
|
2325
|
+
signatureData: "",
|
|
2326
|
+
defaultOptions: {
|
|
2327
|
+
dotSize: 1.5,
|
|
2328
|
+
minWidth: 0.5,
|
|
2329
|
+
maxWidth: 2.5,
|
|
2330
|
+
throttle: 16,
|
|
2331
|
+
minDistance: 3,
|
|
2332
|
+
backgroundColor: "rgba(0,0,0,0)",
|
|
2333
|
+
penColor: "black",
|
|
2334
|
+
velocityFilterWeight: 0.5
|
|
2335
|
+
},
|
|
2336
|
+
validTypes: ["image/png", "image/jpeg", "image/svg+xml"]
|
|
2337
|
+
};
|
|
2338
|
+
},
|
|
2339
|
+
watch: {
|
|
2340
|
+
type() {
|
|
2341
|
+
this.initType();
|
|
2342
|
+
},
|
|
2343
|
+
text(e) {
|
|
2344
|
+
this.drawText(e);
|
|
2345
|
+
}
|
|
2346
|
+
},
|
|
2347
|
+
mounted() {
|
|
2348
|
+
const { options: e, defaultOptions: t } = this, i = this.$refs.signaturePadCanvas;
|
|
2349
|
+
this.signaturePad = new An(i, {
|
|
2350
|
+
...t,
|
|
2351
|
+
...e
|
|
2352
|
+
}), this.onResizeHandler = this.resizeCanvas.bind(this), window.addEventListener("resize", this.onResizeHandler, !1), Object.keys(this.signEvents).forEach((s) => {
|
|
2353
|
+
this.signaturePad.addEventListener(s, () => {
|
|
2354
|
+
this.signEvents[s]();
|
|
2355
|
+
});
|
|
2356
|
+
}), this.initType(), this.resizeCanvas();
|
|
2357
|
+
},
|
|
2358
|
+
beforeUnmount() {
|
|
2359
|
+
this.onResizeHandler && window.removeEventListener("resize", this.onResizeHandler, !1);
|
|
2360
|
+
},
|
|
2361
|
+
methods: {
|
|
2362
|
+
initType() {
|
|
2363
|
+
this.type === "draw" ? this.openSignaturePad() : this.lockSignaturePad();
|
|
2364
|
+
},
|
|
2365
|
+
resizeCanvas() {
|
|
2366
|
+
const e = this.$refs.signaturePadCanvas, t = Math.max(window.devicePixelRatio || 1, 1);
|
|
2367
|
+
if (e.width = e.offsetWidth * t, e.height = e.offsetHeight * t, e.getContext("2d").scale(t, t), this.signaturePad.clear(), this.signatureData = "", this.type === "draw") {
|
|
2368
|
+
const i = this.signaturePad.toData();
|
|
2369
|
+
i != null && i.length && this.signaturePad.fromData(i);
|
|
2370
|
+
} else this.type === "text" && this.drawText(this.text);
|
|
2371
|
+
},
|
|
2372
|
+
saveSignature(e = {}) {
|
|
2373
|
+
const { type: t = "image/png", trim: i = !0, encoderOptions: s } = e || {}, n = { isEmpty: !1, data: void 0 };
|
|
2374
|
+
if (!this.validTypes.includes(t)) {
|
|
2375
|
+
const o = this.validTypes.join(", ");
|
|
2376
|
+
throw new Error(
|
|
2377
|
+
`The Image type is incorrect! We only support ${o} types.`
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
if (this.signaturePad.isEmpty()) return { ...n, isEmpty: !0 };
|
|
2381
|
+
if (i) {
|
|
2382
|
+
const o = this.$refs.signaturePadCanvas, r = o ? this.trimCanvas(o) : null;
|
|
2383
|
+
this.signatureData = r ? r.toDataURL(t, s) : "";
|
|
2384
|
+
} else
|
|
2385
|
+
this.signatureData = this.signaturePad.toDataURL(t, s);
|
|
2386
|
+
return {
|
|
2387
|
+
...n,
|
|
2388
|
+
data: this.signatureData
|
|
2389
|
+
};
|
|
2390
|
+
},
|
|
2391
|
+
undoSignature() {
|
|
2392
|
+
const { signaturePad: e } = this, t = e.toData();
|
|
2393
|
+
t && e.fromData(t.slice(0, -1));
|
|
2394
|
+
},
|
|
2395
|
+
drawText(e) {
|
|
2396
|
+
this.signaturePad.fromText(e, {
|
|
2397
|
+
font: '40px "Nothing You Could Do"',
|
|
2398
|
+
x: 10,
|
|
2399
|
+
y: 100
|
|
2400
|
+
});
|
|
2401
|
+
},
|
|
2402
|
+
// Extend of module methods
|
|
2403
|
+
fromText(...e) {
|
|
2404
|
+
return this.signaturePad.fromText(...e);
|
|
2405
|
+
},
|
|
2406
|
+
fromDataURL(...e) {
|
|
2407
|
+
return this.signaturePad.fromDataURL(...e);
|
|
2408
|
+
},
|
|
2409
|
+
fromData(...e) {
|
|
2410
|
+
return this.signaturePad.fromData(...e);
|
|
2411
|
+
},
|
|
2412
|
+
toData(...e) {
|
|
2413
|
+
return this.signaturePad.toData(...e);
|
|
2414
|
+
},
|
|
2415
|
+
lockSignaturePad() {
|
|
2416
|
+
return this.signaturePad.off();
|
|
2417
|
+
},
|
|
2418
|
+
openSignaturePad() {
|
|
2419
|
+
return this.signaturePad.on();
|
|
2420
|
+
},
|
|
2421
|
+
isEmpty() {
|
|
2422
|
+
return this.signaturePad.isEmpty();
|
|
2423
|
+
},
|
|
2424
|
+
clearSignature() {
|
|
2425
|
+
return this.signaturePad.clear();
|
|
2426
|
+
},
|
|
2427
|
+
trimCanvas(e) {
|
|
2428
|
+
const t = document.createElement("canvas"), i = t.getContext("2d");
|
|
2429
|
+
t.width = e.width, t.height = e.height, i.drawImage(e, 0, 0);
|
|
2430
|
+
let s = t.width, n = t.height;
|
|
2431
|
+
const o = { x: [], y: [] }, r = i.getImageData(
|
|
2432
|
+
0,
|
|
2433
|
+
0,
|
|
2434
|
+
t.width,
|
|
2435
|
+
t.height
|
|
2436
|
+
);
|
|
2437
|
+
let a = 0;
|
|
2438
|
+
for (let c = 0; c < n; c++)
|
|
2439
|
+
for (let m = 0; m < s; m++)
|
|
2440
|
+
a = (c * s + m) * 4, r.data[a + 3] > 0 && (o.x.push(m), o.y.push(c));
|
|
2441
|
+
o.x.sort((c, m) => c - m), o.y.sort((c, m) => c - m);
|
|
2442
|
+
const l = o.x.length - 1;
|
|
2443
|
+
s = o.x[l] - o.x[0], n = o.y[l] - o.y[0];
|
|
2444
|
+
const d = i.getImageData(o.x[0], o.y[0], s, n);
|
|
2445
|
+
return t.height = n, i.putImageData(d, 0, 0), t;
|
|
2446
|
+
}
|
|
2447
|
+
},
|
|
2448
|
+
render() {
|
|
2449
|
+
const { width: e, height: t, customStyle: i } = this;
|
|
2450
|
+
return wt(
|
|
2451
|
+
"div",
|
|
2452
|
+
{
|
|
2453
|
+
style: {
|
|
2454
|
+
width: e,
|
|
2455
|
+
height: t,
|
|
2456
|
+
...i
|
|
2457
|
+
}
|
|
2458
|
+
},
|
|
2459
|
+
[
|
|
2460
|
+
wt("canvas", {
|
|
2461
|
+
style: {
|
|
2462
|
+
width: "100%",
|
|
2463
|
+
height: "100%"
|
|
2464
|
+
},
|
|
2465
|
+
ref: "signaturePadCanvas"
|
|
2466
|
+
})
|
|
2467
|
+
]
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
function $n({ rel: e, href: t, crossorigin: i = !1 }) {
|
|
2472
|
+
const s = document.createElement("link");
|
|
2473
|
+
s.rel = e, s.href = t, s.crossorigin = i, document.head.appendChild(s);
|
|
2474
|
+
}
|
|
2475
|
+
const Dn = [
|
|
2476
|
+
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
|
|
2477
|
+
{ rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: !0 },
|
|
2478
|
+
{
|
|
2479
|
+
rel: "stylesheet",
|
|
2480
|
+
href: "https://fonts.googleapis.com/css2?family=Nothing+You+Could+Do&display=swap"
|
|
2481
|
+
}
|
|
2482
|
+
], Fn = {
|
|
2483
|
+
name: "SignatureAnswer",
|
|
2484
|
+
components: {
|
|
2485
|
+
CField: ge,
|
|
2486
|
+
SignaturePad: Bn
|
|
2487
|
+
},
|
|
2488
|
+
emits: ["invalid"],
|
|
2489
|
+
mixins: [J([])],
|
|
2490
|
+
props: {
|
|
2491
|
+
onCompleteFunc: {
|
|
2492
|
+
type: Function,
|
|
2493
|
+
default: null
|
|
2494
|
+
}
|
|
2495
|
+
},
|
|
2496
|
+
data() {
|
|
2497
|
+
return {
|
|
2498
|
+
mode: "text",
|
|
2499
|
+
text: "",
|
|
2500
|
+
isEmpty: !0,
|
|
2501
|
+
penColor: "hsl(220, 100%, 50%)"
|
|
2502
|
+
};
|
|
2503
|
+
},
|
|
2504
|
+
watch: {
|
|
2505
|
+
mode(e) {
|
|
2506
|
+
this.reset(), this.$refs.signaturePad && e === "text" && this.focusName();
|
|
2507
|
+
},
|
|
2508
|
+
text() {
|
|
2509
|
+
this.$refs.signaturePad && this.$nextTick(() => {
|
|
2510
|
+
this.isEmpty = this.$refs.signaturePad.isEmpty();
|
|
2511
|
+
});
|
|
2512
|
+
},
|
|
2513
|
+
isEmpty: {
|
|
2514
|
+
immediate: !0,
|
|
2515
|
+
handler(e) {
|
|
2516
|
+
this.$emit("invalid", e);
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
},
|
|
2520
|
+
created() {
|
|
2521
|
+
Dn.forEach($n);
|
|
2522
|
+
},
|
|
2523
|
+
mounted() {
|
|
2524
|
+
this.focusName();
|
|
2525
|
+
},
|
|
2526
|
+
methods: {
|
|
2527
|
+
reset() {
|
|
2528
|
+
this.$refs.signaturePad && (this.$refs.signaturePad.clearSignature(), this.text && (this.text = ""), this.isEmpty = this.$refs.signaturePad.isEmpty());
|
|
2529
|
+
},
|
|
2530
|
+
undo() {
|
|
2531
|
+
this.$refs.signaturePad && (this.mode === "text" && this.text ? this.text = this.text.slice(0, this.text.length - 1) : this.$refs.signaturePad.undoSignature(), this.isEmpty = this.$refs.signaturePad.isEmpty());
|
|
2532
|
+
},
|
|
2533
|
+
getSignatureData() {
|
|
2534
|
+
let e = { type: "image/png", trim: !0 };
|
|
2535
|
+
this.mode === "draw" && (e = { type: "image/svg+xml", trim: !1 });
|
|
2536
|
+
const { isEmpty: t, data: i } = this.$refs.signaturePad ? this.$refs.signaturePad.saveSignature(e) : {};
|
|
2537
|
+
if (t || !i) throw Error("Missing signatureData");
|
|
2538
|
+
return i;
|
|
2539
|
+
},
|
|
2540
|
+
async submit({ answer: e }) {
|
|
2541
|
+
const t = this.getSignatureData();
|
|
2542
|
+
await e({ body: { isAccepted: !0, signatureDataURL: t } }), typeof this.onCompleteFunc == "function" && this.onCompleteFunc();
|
|
2543
|
+
},
|
|
2544
|
+
focusName() {
|
|
2545
|
+
this.$nextTick(
|
|
2546
|
+
() => this.$refs.nameInput ? this.$refs.nameInput.focus() : null
|
|
2547
|
+
);
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
}, Nn = { style: { "text-align": "left" } }, Ln = {
|
|
2551
|
+
class: "flex w-full items-center justify-between",
|
|
2552
|
+
style: { "font-size": "16px", "padding-bottom": "1em", "font-weight": "500", color: "hsl(0, 0%, 11%)" }
|
|
2553
|
+
}, Rn = { class: "sign-toggle" }, Un = {
|
|
2554
|
+
class: "wrapper",
|
|
2555
|
+
style: { "padding-bottom": "5px" }
|
|
2556
|
+
}, On = { style: { position: "absolute", left: "1em", top: "0.75em", "font-size": "12px", color: "hsl(0, 0%, 50%)" } }, zn = { class: "flex w-full justify-end" }, jn = {
|
|
2557
|
+
class: "text-center",
|
|
2558
|
+
style: { "font-size": "12px", color: "hsl(0, 0%, 45%)", "padding-top": "10px" }
|
|
2559
|
+
};
|
|
2560
|
+
function Wn(e, t, i, s, n, o) {
|
|
2561
|
+
const r = M("CInput"), a = M("CField"), l = M("SignaturePad"), d = M("CButton");
|
|
2562
|
+
return P(), S("div", Nn, [
|
|
2563
|
+
g("div", Ln, [
|
|
2564
|
+
g("div", null, C(e._document.$t("answerModal.signature.component.subTitle")), 1),
|
|
2565
|
+
g("div", Rn, [
|
|
2566
|
+
g("div", {
|
|
2567
|
+
class: Bt([{ active: n.mode === "text" }, "sign-toggle-button"]),
|
|
2568
|
+
onClick: t[0] || (t[0] = (c) => n.mode = "text")
|
|
2569
|
+
}, C(e._document.$t("answerModal.signature.component.text.tab")), 3),
|
|
2570
|
+
g("div", {
|
|
2571
|
+
class: Bt([{ active: n.mode === "draw" }, "sign-toggle-button"]),
|
|
2572
|
+
onClick: t[1] || (t[1] = (c) => n.mode = "draw")
|
|
2573
|
+
}, C(e._document.$t("answerModal.signature.component.draw.tab")), 3)
|
|
2574
|
+
])
|
|
2575
|
+
]),
|
|
2576
|
+
n.mode === "text" ? (P(), G(a, {
|
|
2577
|
+
key: 0,
|
|
2578
|
+
label: e._document.$t("answerModal.signature.component.text.nameLabel")
|
|
2579
|
+
}, {
|
|
2580
|
+
default: A(() => [
|
|
2581
|
+
b(r, {
|
|
2582
|
+
ref: "nameInput",
|
|
2583
|
+
modelValue: n.text,
|
|
2584
|
+
"onUpdate:modelValue": t[2] || (t[2] = (c) => n.text = c),
|
|
2585
|
+
placeholder: e._document.$t("answerModal.signature.component.text.namePlaceholder")
|
|
2586
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
2587
|
+
]),
|
|
2588
|
+
_: 1
|
|
2589
|
+
}, 8, ["label"])) : $("", !0),
|
|
2590
|
+
g("div", Un, [
|
|
2591
|
+
t[3] || (t[3] = g("div", { class: "background-image" }, [
|
|
2592
|
+
g("svg", {
|
|
2593
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2594
|
+
width: "100%",
|
|
2595
|
+
height: "100%"
|
|
2596
|
+
}, [
|
|
2597
|
+
g("line", {
|
|
2598
|
+
x1: "0",
|
|
2599
|
+
y1: "75%",
|
|
2600
|
+
x2: "100%",
|
|
2601
|
+
y2: "75%",
|
|
2602
|
+
stroke: "hsl(0,0%, 70%)",
|
|
2603
|
+
"stroke-width": "1",
|
|
2604
|
+
"stroke-linecap": "round",
|
|
2605
|
+
"stroke-dasharray": "3",
|
|
2606
|
+
"shape-rendering": "crispEdges",
|
|
2607
|
+
"pointer-events": "none"
|
|
2608
|
+
})
|
|
2609
|
+
])
|
|
2610
|
+
], -1)),
|
|
2611
|
+
g("div", On, C(e._document.$t(`answerModal.signature.component.${n.mode}.canvasLabel`)), 1),
|
|
2612
|
+
t[4] || (t[4] = g("span", { style: { "font-family": "'Nothing You Could Do', cursive" } }, null, -1)),
|
|
2613
|
+
b(l, {
|
|
2614
|
+
ref: "signaturePad",
|
|
2615
|
+
type: n.mode,
|
|
2616
|
+
text: n.text,
|
|
2617
|
+
options: {
|
|
2618
|
+
penColor: n.penColor
|
|
2619
|
+
},
|
|
2620
|
+
"sign-events": {
|
|
2621
|
+
endStroke: () => {
|
|
2622
|
+
n.isEmpty = e.$refs.signaturePad ? e.$refs.signaturePad.isEmpty() : !0;
|
|
2623
|
+
}
|
|
2624
|
+
},
|
|
2625
|
+
class: "signature-pad"
|
|
2626
|
+
}, null, 8, ["type", "text", "options", "sign-events"])
|
|
2627
|
+
]),
|
|
2628
|
+
le(g("div", zn, [
|
|
2629
|
+
b(d, {
|
|
2630
|
+
disabled: n.isEmpty,
|
|
2631
|
+
type: "text",
|
|
2632
|
+
size: "small",
|
|
2633
|
+
pattern: "tertiary",
|
|
2634
|
+
circle: "",
|
|
2635
|
+
icon: "trash",
|
|
2636
|
+
onClick: o.reset
|
|
2637
|
+
}, null, 8, ["disabled", "onClick"]),
|
|
2638
|
+
b(d, {
|
|
2639
|
+
disabled: n.isEmpty,
|
|
2640
|
+
type: "text",
|
|
2641
|
+
size: "small",
|
|
2642
|
+
pattern: "tertiary",
|
|
2643
|
+
circle: "",
|
|
2644
|
+
icon: "rotate-left",
|
|
2645
|
+
onClick: o.undo
|
|
2646
|
+
}, null, 8, ["disabled", "onClick"])
|
|
2647
|
+
], 512), [
|
|
2648
|
+
[ce, n.mode === "draw"]
|
|
2649
|
+
]),
|
|
2650
|
+
g("div", jn, C(e._document.$t("answerModal.signature.component.terms")), 1)
|
|
2651
|
+
]);
|
|
2652
|
+
}
|
|
2653
|
+
const Vn = /* @__PURE__ */ X(Fn, [["render", Wn], ["__scopeId", "data-v-6857111d"]]), Hn = () => {
|
|
2654
|
+
const e = window.location.host.split(".");
|
|
2655
|
+
return e && e[0];
|
|
2656
|
+
}, Yn = Hn() === "fortnox", qn = [
|
|
2657
|
+
"enjoyedExperience",
|
|
2658
|
+
// boolean value
|
|
2659
|
+
"whatToImprove"
|
|
2660
|
+
// string value
|
|
2661
|
+
], Gn = {
|
|
2662
|
+
emits: ["page", "close"],
|
|
2663
|
+
mixins: [J([])],
|
|
2664
|
+
props: {
|
|
2665
|
+
publicId: {
|
|
2666
|
+
type: String,
|
|
2667
|
+
default: ""
|
|
2668
|
+
}
|
|
2669
|
+
},
|
|
2670
|
+
data() {
|
|
2671
|
+
return {
|
|
2672
|
+
page: "start",
|
|
2673
|
+
whatToImprove: ""
|
|
2674
|
+
};
|
|
2675
|
+
},
|
|
2676
|
+
computed: {
|
|
2677
|
+
showPostFeedbackActions() {
|
|
2678
|
+
return Ot.value !== "widget" && !Yn;
|
|
2679
|
+
}
|
|
2680
|
+
},
|
|
2681
|
+
created() {
|
|
2682
|
+
this.$nextTick(() => {
|
|
2683
|
+
this.startAnimation();
|
|
2684
|
+
});
|
|
2685
|
+
},
|
|
2686
|
+
methods: {
|
|
2687
|
+
async submitFeedback({ type: e, data: t }) {
|
|
2688
|
+
if (!this.publicId) throw Error("Missing param publicId");
|
|
2689
|
+
if (!e) throw Error("Missing param type");
|
|
2690
|
+
if (!qn.includes(e)) throw Error("Invalid feedback type");
|
|
2691
|
+
if (!t) throw Error("Missing param data");
|
|
2692
|
+
let i = "positive";
|
|
2693
|
+
try {
|
|
2694
|
+
de.feedback(this.publicId, { type: e, data: t }), e === "enjoyedExperience" && !t.value && (i = "negative"), e === "whatToImprove" && (i = "negative.success");
|
|
2695
|
+
} catch (s) {
|
|
2696
|
+
bt(s, { showMessage: !1 });
|
|
2697
|
+
} finally {
|
|
2698
|
+
this.goTo(i);
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
async goTo(e) {
|
|
2702
|
+
if (e === "positive" && !this.showPostFeedbackActions && setTimeout(() => {
|
|
2703
|
+
this.close();
|
|
2704
|
+
}, 2e3), this.$emit("page", e), e === "positive" || e === "negative") {
|
|
2705
|
+
this.$refs.start.style.opacity = 0, this.page = "intermediate", setTimeout(() => {
|
|
2706
|
+
this.page = e;
|
|
2707
|
+
}, 2e3);
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
this.page = e;
|
|
2711
|
+
},
|
|
2712
|
+
startAnimation() {
|
|
2713
|
+
const e = this.$refs.feedbackBg;
|
|
2714
|
+
e.gradOneXPos = 0, e.gradOneYPos = 0, e.gradTwoXPos = 80, e.gradTwoYPos = 20, e.gradThreeXPos = 20, e.gradThreeYPos = 80, e.gradFourXPos = 80, e.gradFourYPos = 80, L({
|
|
2715
|
+
targets: e,
|
|
2716
|
+
duration: 12e3,
|
|
2717
|
+
direction: "alternate",
|
|
2718
|
+
easing: "linear",
|
|
2719
|
+
loop: !0,
|
|
2720
|
+
gradOneXPos: [10, 5, 0, -10],
|
|
2721
|
+
gradOneYPos: [10, 20, 25, 30],
|
|
2722
|
+
gradTwoXPos: [25, 20, 15, 10, 25],
|
|
2723
|
+
gradTwoYPos: [65, 55, 40, 65, 80],
|
|
2724
|
+
gradThreeXPos: [25, 20, 10, 15, 25],
|
|
2725
|
+
gradThreeYPos: [65, 50, 45, 60, 80],
|
|
2726
|
+
gradFourXPos: [85, 80, 75, 70, 95],
|
|
2727
|
+
gradFourYPos: [90, 100, 120, 100, 85],
|
|
2728
|
+
update() {
|
|
2729
|
+
e.style.setProperty(
|
|
2730
|
+
"--gradOneXPos",
|
|
2731
|
+
`${e.gradOneXPos}%`
|
|
2732
|
+
), e.style.setProperty(
|
|
2733
|
+
"--gradOneYPos",
|
|
2734
|
+
`${e.gradOneYPos}%`
|
|
2735
|
+
), e.style.setProperty(
|
|
2736
|
+
"--gradTwoXPos",
|
|
2737
|
+
`${e.gradTwoXPos}%`
|
|
2738
|
+
), e.style.setProperty(
|
|
2739
|
+
"--gradTwoYPos",
|
|
2740
|
+
`${e.gradTwoYPos}%`
|
|
2741
|
+
), e.style.setProperty(
|
|
2742
|
+
"--gradThreeXPos",
|
|
2743
|
+
`${e.gradThreeXPos}%`
|
|
2744
|
+
), e.style.setProperty(
|
|
2745
|
+
"--gradThreeYPos",
|
|
2746
|
+
`${e.gradThreeYPos}%`
|
|
2747
|
+
), e.style.setProperty(
|
|
2748
|
+
"--gradFourXPos",
|
|
2749
|
+
`${e.gradFourXPos}%`
|
|
2750
|
+
), e.style.setProperty(
|
|
2751
|
+
"--gradFourYPos",
|
|
2752
|
+
`${e.gradFourYPos}%`
|
|
2753
|
+
);
|
|
2754
|
+
}
|
|
2755
|
+
});
|
|
2756
|
+
},
|
|
2757
|
+
// animations
|
|
2758
|
+
leave(e, t) {
|
|
2759
|
+
L({
|
|
2760
|
+
targets: e,
|
|
2761
|
+
// height: 0,
|
|
2762
|
+
// opacity: [1, 0],
|
|
2763
|
+
opacity: 0,
|
|
2764
|
+
duration: 500,
|
|
2765
|
+
easing: "easeInOutCubic",
|
|
2766
|
+
complete: t
|
|
2767
|
+
});
|
|
2768
|
+
},
|
|
2769
|
+
enter(e, t) {
|
|
2770
|
+
L({
|
|
2771
|
+
targets: e,
|
|
2772
|
+
delay: this.page === "intermediate" ? 250 : 0,
|
|
2773
|
+
duration: 500,
|
|
2774
|
+
opacity: [0, 1],
|
|
2775
|
+
easing: "easeInOutCubic",
|
|
2776
|
+
complete: t
|
|
2777
|
+
});
|
|
2778
|
+
},
|
|
2779
|
+
close() {
|
|
2780
|
+
this.$emit("close");
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
}, Kn = { class: "f-feedback" }, Jn = {
|
|
2784
|
+
ref: "feedbackBg",
|
|
2785
|
+
class: "f-bg"
|
|
2786
|
+
}, Xn = { class: "f-container" }, Qn = {
|
|
2787
|
+
ref: "start",
|
|
2788
|
+
key: "start",
|
|
2789
|
+
class: "flex w-full flex-col items-center justify-center",
|
|
2790
|
+
style: { transition: "opacity 250ms" }
|
|
2791
|
+
}, Zn = ["textContent"], ts = {
|
|
2792
|
+
key: "intermediate",
|
|
2793
|
+
style: { height: "100%", display: "flex", "flex-direction": "column" }
|
|
2794
|
+
}, es = { style: { flex: "1 1 auto", display: "flex", "flex-direction": "column", "justify-content": "center", "align-items": "center" } }, ns = ["textContent"], ss = {
|
|
2795
|
+
key: "positive",
|
|
2796
|
+
style: { height: "100%", display: "flex", "flex-direction": "column" }
|
|
2797
|
+
}, is = { style: { flex: "1 1 auto", display: "flex", "flex-direction": "column", "justify-content": "center", "align-items": "center" } }, os = ["textContent"], rs = ["textContent"], as = {
|
|
2798
|
+
key: "negative",
|
|
2799
|
+
style: { height: "100%", display: "flex", "flex-direction": "column" }
|
|
2800
|
+
}, ls = { style: { flex: "1 1 auto", display: "flex", "flex-direction": "column", "justify-content": "center", "align-items": "center" } }, cs = ["textContent"], ds = ["textContent"], us = {
|
|
2801
|
+
key: "success",
|
|
2802
|
+
style: { height: "100%", display: "flex", "flex-direction": "column" }
|
|
2803
|
+
}, hs = { style: { flex: "1 1 auto", display: "flex", "flex-direction": "column", "justify-content": "center", "align-items": "center" } }, fs = ["textContent"], gs = ["textContent"];
|
|
2804
|
+
function ms(e, t, i, s, n, o) {
|
|
2805
|
+
const r = M("CButton"), a = M("CInput");
|
|
2806
|
+
return P(), S("div", Kn, [
|
|
2807
|
+
g("div", Jn, null, 512),
|
|
2808
|
+
g("div", Xn, [
|
|
2809
|
+
b(Pt, {
|
|
2810
|
+
css: !1,
|
|
2811
|
+
mode: "out-in",
|
|
2812
|
+
onEnter: o.enter,
|
|
2813
|
+
onLeave: o.leave
|
|
2814
|
+
}, {
|
|
2815
|
+
default: A(() => [
|
|
2816
|
+
n.page === "start" ? (P(), S("div", Qn, [
|
|
2817
|
+
g("div", {
|
|
2818
|
+
style: { "padding-bottom": "calc(1.5 * var(--rem))", "font-size": "14px", "font-weight": "500" },
|
|
2819
|
+
textContent: C(e._document.$t("answerFeedback.start.title"))
|
|
2820
|
+
}, null, 8, Zn),
|
|
2821
|
+
g("div", null, [
|
|
2822
|
+
b(r, {
|
|
2823
|
+
"icon-left": "thumbsdown",
|
|
2824
|
+
size: "small",
|
|
2825
|
+
pattern: "secondary",
|
|
2826
|
+
class: "feedback-btn",
|
|
2827
|
+
onClick: t[0] || (t[0] = (l) => o.submitFeedback({
|
|
2828
|
+
type: "enjoyedExperience",
|
|
2829
|
+
data: { value: !1 }
|
|
2830
|
+
}))
|
|
2831
|
+
}, {
|
|
2832
|
+
default: A(() => [
|
|
2833
|
+
z(C(e._document.$t("answerFeedback.start.no")), 1)
|
|
2834
|
+
]),
|
|
2835
|
+
_: 1
|
|
2836
|
+
}),
|
|
2837
|
+
b(r, {
|
|
2838
|
+
"icon-left": "thumbsup",
|
|
2839
|
+
size: "small",
|
|
2840
|
+
pattern: "secondary",
|
|
2841
|
+
class: "feedback-btn",
|
|
2842
|
+
style: { "margin-left": "calc(0.75 * var(--rem))" },
|
|
2843
|
+
onClick: t[1] || (t[1] = (l) => o.submitFeedback({
|
|
2844
|
+
type: "enjoyedExperience",
|
|
2845
|
+
data: { value: !0 }
|
|
2846
|
+
}))
|
|
2847
|
+
}, {
|
|
2848
|
+
default: A(() => [
|
|
2849
|
+
z(C(e._document.$t("answerFeedback.start.yes")), 1)
|
|
2850
|
+
]),
|
|
2851
|
+
_: 1
|
|
2852
|
+
})
|
|
2853
|
+
])
|
|
2854
|
+
], 512)) : n.page === "intermediate" ? (P(), S("div", ts, [
|
|
2855
|
+
g("div", es, [
|
|
2856
|
+
g("div", {
|
|
2857
|
+
class: "f-title",
|
|
2858
|
+
textContent: C(e._document.$t("answerFeedback.intermediate.title"))
|
|
2859
|
+
}, null, 8, ns)
|
|
2860
|
+
])
|
|
2861
|
+
])) : n.page === "positive" ? (P(), S("div", ss, [
|
|
2862
|
+
g("div", is, [
|
|
2863
|
+
g("div", {
|
|
2864
|
+
class: "f-title",
|
|
2865
|
+
textContent: C(e._document.$t("answerFeedback.yes.title"))
|
|
2866
|
+
}, null, 8, os),
|
|
2867
|
+
g("div", {
|
|
2868
|
+
textContent: C(e._document.$t("answerFeedback.yes.text"))
|
|
2869
|
+
}, null, 8, rs)
|
|
2870
|
+
]),
|
|
2871
|
+
b(r, {
|
|
2872
|
+
class: "a-btn",
|
|
2873
|
+
type: "secondary",
|
|
2874
|
+
wide: "",
|
|
2875
|
+
tag: "a",
|
|
2876
|
+
href: "/register?utm_source=document&utm_medium=feedback-modal&utm_campaign=signup&utm_content=positive-exp",
|
|
2877
|
+
target: "_blank",
|
|
2878
|
+
style: { "margin-bottom": "0.5em" },
|
|
2879
|
+
textContent: C(e._document.$t("answerFeedback.yes.action"))
|
|
2880
|
+
}, null, 8, ["textContent"]),
|
|
2881
|
+
b(r, {
|
|
2882
|
+
class: "a-btn",
|
|
2883
|
+
wide: "",
|
|
2884
|
+
tag: "a",
|
|
2885
|
+
href: `https://${e.$t(
|
|
2886
|
+
"_common:brand.domain"
|
|
2887
|
+
)}?utm_source=document&utm_medium=feedback-modal&utm_campaign=learn-more&utm_content=positive-exp`,
|
|
2888
|
+
target: "_blank",
|
|
2889
|
+
textContent: C(e._document.$t("answerFeedback.yes.secondary"))
|
|
2890
|
+
}, null, 8, ["href", "textContent"])
|
|
2891
|
+
])) : n.page === "negative" ? (P(), S("div", as, [
|
|
2892
|
+
g("div", ls, [
|
|
2893
|
+
g("div", {
|
|
2894
|
+
class: "f-title",
|
|
2895
|
+
textContent: C(e._document.$t("answerFeedback.no.start.title"))
|
|
2896
|
+
}, null, 8, cs),
|
|
2897
|
+
g("div", {
|
|
2898
|
+
textContent: C(e._document.$t("answerFeedback.no.start.text"))
|
|
2899
|
+
}, null, 8, ds),
|
|
2900
|
+
b(a, {
|
|
2901
|
+
modelValue: n.whatToImprove,
|
|
2902
|
+
"onUpdate:modelValue": t[2] || (t[2] = (l) => n.whatToImprove = l),
|
|
2903
|
+
placeholder: e._document.$t("answerFeedback.no.start.placeholder"),
|
|
2904
|
+
type: "textarea",
|
|
2905
|
+
class: "input-style",
|
|
2906
|
+
style: { margin: "2em 0" }
|
|
2907
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
2908
|
+
]),
|
|
2909
|
+
b(r, {
|
|
2910
|
+
wide: "",
|
|
2911
|
+
class: "a-btn",
|
|
2912
|
+
onClick: t[3] || (t[3] = (l) => o.submitFeedback({
|
|
2913
|
+
type: "whatToImprove",
|
|
2914
|
+
data: { value: n.whatToImprove }
|
|
2915
|
+
})),
|
|
2916
|
+
textContent: C(e._document.$t("answerFeedback.no.start.action"))
|
|
2917
|
+
}, null, 8, ["textContent"])
|
|
2918
|
+
])) : n.page === "negative.success" ? (P(), S("div", us, [
|
|
2919
|
+
g("div", hs, [
|
|
2920
|
+
g("div", {
|
|
2921
|
+
class: "f-title",
|
|
2922
|
+
textContent: C(e._document.$t("answerFeedback.no.success.title"))
|
|
2923
|
+
}, null, 8, fs),
|
|
2924
|
+
g("div", {
|
|
2925
|
+
textContent: C(e._document.$t("answerFeedback.no.success.text"))
|
|
2926
|
+
}, null, 8, gs)
|
|
2927
|
+
]),
|
|
2928
|
+
b(r, {
|
|
2929
|
+
class: "a-btn",
|
|
2930
|
+
tag: "a",
|
|
2931
|
+
href: `https://${e.$t(
|
|
2932
|
+
"_common:brand.domain"
|
|
2933
|
+
)}?utm_source=document&utm_medium=feedback-modal&utm_campaign=learn-more&utm_content=negative-exp`,
|
|
2934
|
+
target: "_blank",
|
|
2935
|
+
wide: "",
|
|
2936
|
+
type: "secondary",
|
|
2937
|
+
style: { "margin-bottom": "0.5em" },
|
|
2938
|
+
textContent: C(e._document.$t("answerFeedback.no.success.action"))
|
|
2939
|
+
}, null, 8, ["href", "textContent"]),
|
|
2940
|
+
b(r, {
|
|
2941
|
+
class: "a-btn",
|
|
2942
|
+
wide: "",
|
|
2943
|
+
onClick: o.close,
|
|
2944
|
+
textContent: C(e._document.$t("answerFeedback.no.success.secondary"))
|
|
2945
|
+
}, null, 8, ["onClick", "textContent"])
|
|
2946
|
+
])) : $("", !0)
|
|
2947
|
+
]),
|
|
2948
|
+
_: 1
|
|
2949
|
+
}, 8, ["onEnter", "onLeave"])
|
|
2950
|
+
])
|
|
2951
|
+
]);
|
|
2952
|
+
}
|
|
2953
|
+
const ps = /* @__PURE__ */ X(Gn, [["render", ms], ["__scopeId", "data-v-a0039046"]]), ws = {
|
|
2954
|
+
components: {
|
|
2955
|
+
Feedback: ps,
|
|
2956
|
+
Signature: Vn,
|
|
2957
|
+
BankId: bn,
|
|
2958
|
+
Deny: Sn
|
|
2959
|
+
},
|
|
2960
|
+
mixins: [J([])],
|
|
2961
|
+
i18nOptions: {
|
|
2962
|
+
namespaces: "temporary",
|
|
2963
|
+
messages: {
|
|
2964
|
+
en: {
|
|
2965
|
+
previewMode: "Preview answer mode"
|
|
2966
|
+
},
|
|
2967
|
+
sv: {
|
|
2968
|
+
previewMode: "Demo - Förhandsgranska"
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
},
|
|
2972
|
+
emits: ["cancel", "close"],
|
|
2973
|
+
props: {
|
|
2974
|
+
mode: { type: String, default: "accept" },
|
|
2975
|
+
// 'accept', 'decline'
|
|
2976
|
+
isSender: { type: Boolean, default: !1 },
|
|
2977
|
+
fullScreen: { type: Boolean, default: !1 },
|
|
2978
|
+
senderActions: { type: Object, default: () => ({}) },
|
|
2979
|
+
calcHeight: { type: Boolean, default: !1 }
|
|
2980
|
+
},
|
|
2981
|
+
data() {
|
|
2982
|
+
return {
|
|
2983
|
+
page: "start",
|
|
2984
|
+
// start | intermediate | success | versionError
|
|
2985
|
+
isFeedbackInitiated: !1,
|
|
2986
|
+
isPosting: !1,
|
|
2987
|
+
actionInvalid: !1
|
|
2988
|
+
};
|
|
2989
|
+
},
|
|
2990
|
+
computed: {
|
|
2991
|
+
answerComponentName() {
|
|
2992
|
+
return this.mode === "decline" ? "Deny" : this.answerMethod === "bankId" ? "BankId" : "Signature";
|
|
2993
|
+
},
|
|
2994
|
+
answerType() {
|
|
2995
|
+
return this.mode === "decline" ? "decline" : this.answerMethod === "bankId" ? "bankId" : "signature";
|
|
2996
|
+
},
|
|
2997
|
+
signee() {
|
|
2998
|
+
return this.isSender ? this._document.senderClient : this._document.viewer;
|
|
2999
|
+
},
|
|
3000
|
+
answerMethod() {
|
|
3001
|
+
var e;
|
|
3002
|
+
return (e = this.signee.answerMethod) == null ? void 0 : e.accept;
|
|
3003
|
+
},
|
|
3004
|
+
successStrings() {
|
|
3005
|
+
const e = this.signee.email ? this._document.$t(`answerModal.${this.answerType}.success.text`, {
|
|
3006
|
+
email: this.signee.email
|
|
3007
|
+
}) : this._document.$t(
|
|
3008
|
+
`answerModal.${this.answerType}.success.textFallback`
|
|
3009
|
+
), t = this.signee.email ? this._document.$t("answerModal.successTextSingle", {
|
|
3010
|
+
email: this.signee.email
|
|
3011
|
+
}) : this._document.$t("answerModal.successTextFallbackSingle"), i = this._document.remainingSignatures === 0 ? t : e;
|
|
3012
|
+
return {
|
|
3013
|
+
title: this._document.$t(
|
|
3014
|
+
`answerModal.${this.answerType}.success.title`
|
|
3015
|
+
),
|
|
3016
|
+
text: i
|
|
3017
|
+
};
|
|
3018
|
+
}
|
|
3019
|
+
},
|
|
3020
|
+
created() {
|
|
3021
|
+
this.calcHeight && this.$nextTick(() => this.setFixedHeight());
|
|
3022
|
+
},
|
|
3023
|
+
methods: {
|
|
3024
|
+
...ue({
|
|
3025
|
+
answerCurrentDoc: dt.ANSWER_CURRENT_PUBLIC_DOCUMENT,
|
|
3026
|
+
putCurrentDoc: dt.PUT_CURRENT_PUBLIC_DOCUMENT,
|
|
3027
|
+
reloadCurrentDocument: dt.RELOAD_CURRENT_DOCUMENT
|
|
3028
|
+
}),
|
|
3029
|
+
async onSubmit() {
|
|
3030
|
+
this.setFixedHeight(), await this.submit();
|
|
3031
|
+
},
|
|
3032
|
+
async submit() {
|
|
3033
|
+
if (!this.isPosting) {
|
|
3034
|
+
this.isPosting = !0;
|
|
3035
|
+
try {
|
|
3036
|
+
const { submit: e } = this.$refs.answerComponent;
|
|
3037
|
+
if (typeof e != "function")
|
|
3038
|
+
throw Error("Missing answer type submit method");
|
|
3039
|
+
await e({
|
|
3040
|
+
update: (t) => this.putCurrentDoc({ includeChanges: !0, ...t }),
|
|
3041
|
+
answer: this.answerCurrentDoc,
|
|
3042
|
+
...this.isSender ? this.senderActions : null
|
|
3043
|
+
});
|
|
3044
|
+
} catch (e) {
|
|
3045
|
+
this.isPosting = !1, e.httpStatusCode === 409 ? this.page = "versionError" : bt(e);
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
},
|
|
3049
|
+
onComplete() {
|
|
3050
|
+
return (async () => {
|
|
3051
|
+
var i;
|
|
3052
|
+
if (this.isSender && this.senderActions.send) {
|
|
3053
|
+
this.$emit("close"), await this.senderActions.send();
|
|
3054
|
+
return;
|
|
3055
|
+
}
|
|
3056
|
+
const t = this.mode === "accept";
|
|
3057
|
+
this.mode === "accept" && this.answerMethod === "bankId" ? setTimeout(
|
|
3058
|
+
() => this.reloadCurrentDocument().then(
|
|
3059
|
+
() => {
|
|
3060
|
+
var s;
|
|
3061
|
+
return $t.trigger("document:answer", {
|
|
3062
|
+
id: (s = this._document) == null ? void 0 : s.id,
|
|
3063
|
+
didAccept: t
|
|
3064
|
+
});
|
|
3065
|
+
}
|
|
3066
|
+
),
|
|
3067
|
+
1e3
|
|
3068
|
+
) : $t.trigger("document:answer", {
|
|
3069
|
+
id: (i = this._document) == null ? void 0 : i.id,
|
|
3070
|
+
didAccept: t
|
|
3071
|
+
}), await Dt(800), this.page = "intermediate", await Dt(2e3), this.page = "success", this.isPosting = !1;
|
|
3072
|
+
})();
|
|
3073
|
+
},
|
|
3074
|
+
reload() {
|
|
3075
|
+
window.location.reload();
|
|
3076
|
+
},
|
|
3077
|
+
setFixedHeight() {
|
|
3078
|
+
this.$el.style.minHeight = `${this.$el.offsetHeight}px`;
|
|
3079
|
+
},
|
|
3080
|
+
minimizeHeight(e, t) {
|
|
3081
|
+
L({
|
|
3082
|
+
targets: e,
|
|
3083
|
+
height: 0,
|
|
3084
|
+
flexGrow: [1, 0],
|
|
3085
|
+
opacity: [1, 0],
|
|
3086
|
+
duration: 900,
|
|
3087
|
+
easing: "easeOutQuint",
|
|
3088
|
+
complete: t
|
|
3089
|
+
}), L({
|
|
3090
|
+
targets: this.$refs.feedback.$el,
|
|
3091
|
+
height: 0,
|
|
3092
|
+
flexGrow: 1,
|
|
3093
|
+
duration: 900,
|
|
3094
|
+
easing: "easeOutQuint"
|
|
3095
|
+
});
|
|
3096
|
+
},
|
|
3097
|
+
enterAnim(e, t) {
|
|
3098
|
+
L({
|
|
3099
|
+
targets: e.querySelectorAll(".stagger-anim"),
|
|
3100
|
+
opacity: [0, 1],
|
|
3101
|
+
delay: L.stagger(180, { start: 800 }),
|
|
3102
|
+
duration: 340,
|
|
3103
|
+
easing: "linear",
|
|
3104
|
+
complete: t
|
|
3105
|
+
});
|
|
3106
|
+
},
|
|
3107
|
+
leaveAnim(e, t) {
|
|
3108
|
+
e.style.position = "absolute", L({
|
|
3109
|
+
targets: e.querySelectorAll(".stagger-anim"),
|
|
3110
|
+
opacity: 0,
|
|
3111
|
+
delay: L.stagger(200),
|
|
3112
|
+
duration: 200,
|
|
3113
|
+
easing: "linear",
|
|
3114
|
+
complete: t
|
|
3115
|
+
});
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
}, ys = {
|
|
3119
|
+
key: "start",
|
|
3120
|
+
class: "root-padding flex-grow"
|
|
3121
|
+
}, vs = {
|
|
3122
|
+
class: "stagger-anim",
|
|
3123
|
+
style: { "padding-bottom": "40px" }
|
|
3124
|
+
}, _s = ["textContent"], Cs = ["textContent"], xs = {
|
|
3125
|
+
class: "stagger-anim",
|
|
3126
|
+
style: { "padding-top": "3em" }
|
|
3127
|
+
}, bs = {
|
|
3128
|
+
key: "intermediate",
|
|
3129
|
+
class: "flex w-full flex-grow flex-col items-center justify-center text-center",
|
|
3130
|
+
style: { height: "100%" }
|
|
3131
|
+
}, Ps = ["textContent"], Es = {
|
|
3132
|
+
key: "success",
|
|
3133
|
+
class: "flex w-full flex-grow flex-col",
|
|
3134
|
+
style: { height: "100%" }
|
|
3135
|
+
}, ks = {
|
|
3136
|
+
key: 0,
|
|
3137
|
+
class: "flex w-full flex-grow flex-col items-center justify-center",
|
|
3138
|
+
style: { overflow: "hidden" }
|
|
3139
|
+
}, Ss = {
|
|
3140
|
+
style: { height: "100%" },
|
|
3141
|
+
class: "root-padding flex w-full flex-col items-center justify-center"
|
|
3142
|
+
}, Ts = {
|
|
3143
|
+
class: "a-title stagger-anim",
|
|
3144
|
+
style: { padding: "calc(2.5 * var(--rem)) 0 calc(2 * var(--rem))" }
|
|
3145
|
+
}, Ms = ["textContent"], Is = ["textContent"], As = {
|
|
3146
|
+
key: "versionError",
|
|
3147
|
+
class: "root-padding flex flex-grow flex-col items-center justify-center text-center"
|
|
3148
|
+
}, Bs = { class: "stagger-anim" }, $s = {
|
|
3149
|
+
class: "flex items-center justify-center",
|
|
3150
|
+
style: { padding: "20px 0" }
|
|
3151
|
+
}, Ds = {
|
|
3152
|
+
class: "flex items-center justify-center",
|
|
3153
|
+
style: { width: "52px", height: "52px", "border-radius": "50%" }
|
|
3154
|
+
}, Fs = ["textContent"], Ns = ["textContent"], Ls = {
|
|
3155
|
+
class: "stagger-anim",
|
|
3156
|
+
style: { "padding-top": "3em" }
|
|
3157
|
+
};
|
|
3158
|
+
function Rs(e, t, i, s, n, o) {
|
|
3159
|
+
const r = M("CButton"), a = M("Feedback"), l = M("CIcon");
|
|
3160
|
+
return P(), G(fe, {
|
|
3161
|
+
class: "a-root font-inter",
|
|
3162
|
+
tag: "div",
|
|
3163
|
+
css: !1,
|
|
3164
|
+
mode: "out-in",
|
|
3165
|
+
onEnter: o.enterAnim,
|
|
3166
|
+
onLeave: o.leaveAnim
|
|
3167
|
+
}, {
|
|
3168
|
+
default: A(() => {
|
|
3169
|
+
var d;
|
|
3170
|
+
return [
|
|
3171
|
+
b(r, {
|
|
3172
|
+
key: "btn",
|
|
3173
|
+
icon: "x",
|
|
3174
|
+
circle: "",
|
|
3175
|
+
class: "text-[hsl(0, 0%, 45%)] absolute right-5 top-5 z-[9]",
|
|
3176
|
+
onClick: t[0] || (t[0] = () => {
|
|
3177
|
+
e.$emit("cancel"), e.$emit("close");
|
|
3178
|
+
})
|
|
3179
|
+
}),
|
|
3180
|
+
n.page === "start" ? (P(), S("div", ys, [
|
|
3181
|
+
g("div", vs, [
|
|
3182
|
+
g("div", {
|
|
3183
|
+
class: "a-title",
|
|
3184
|
+
textContent: C(e._document.$t(`answerModal.${o.answerType}.start.title`))
|
|
3185
|
+
}, null, 8, _s),
|
|
3186
|
+
g("div", {
|
|
3187
|
+
style: { color: "hsl(0, 0%, 40%)" },
|
|
3188
|
+
textContent: C(e._document.$t(`answerModal.${o.answerType}.start.text`))
|
|
3189
|
+
}, null, 8, Cs)
|
|
3190
|
+
]),
|
|
3191
|
+
(P(), G(he(o.answerComponentName), {
|
|
3192
|
+
ref: "answerComponent",
|
|
3193
|
+
_document: e._document,
|
|
3194
|
+
signee: o.signee,
|
|
3195
|
+
"on-complete-func": o.onComplete,
|
|
3196
|
+
class: "stagger-anim",
|
|
3197
|
+
onInvalid: t[1] || (t[1] = (c) => n.actionInvalid = c),
|
|
3198
|
+
onLoading: t[2] || (t[2] = (c) => n.isPosting = c)
|
|
3199
|
+
}, null, 40, ["_document", "signee", "on-complete-func"])),
|
|
3200
|
+
g("div", xs, [
|
|
3201
|
+
b(r, {
|
|
3202
|
+
loading: n.isPosting,
|
|
3203
|
+
disabled: n.actionInvalid,
|
|
3204
|
+
type: i.mode === "decline" ? "text" : "secondary",
|
|
3205
|
+
class: "a-btn",
|
|
3206
|
+
icon: o.answerType === "bankId" ? "bankId" : "",
|
|
3207
|
+
onClick: o.onSubmit
|
|
3208
|
+
}, {
|
|
3209
|
+
default: A(() => [
|
|
3210
|
+
z(C(e._document.$t(`answerModal.${o.answerType}.start.action`)), 1)
|
|
3211
|
+
]),
|
|
3212
|
+
_: 1
|
|
3213
|
+
}, 8, ["loading", "disabled", "type", "icon", "onClick"])
|
|
3214
|
+
])
|
|
3215
|
+
])) : n.page === "intermediate" ? (P(), S("div", bs, [
|
|
3216
|
+
g("div", {
|
|
3217
|
+
class: "a-title stagger-anim",
|
|
3218
|
+
textContent: C(e._document.$t("answerModal.answerSuccess"))
|
|
3219
|
+
}, null, 8, Ps)
|
|
3220
|
+
])) : n.page === "success" ? (P(), S("div", Es, [
|
|
3221
|
+
b(Pt, {
|
|
3222
|
+
css: !1,
|
|
3223
|
+
onLeave: o.minimizeHeight
|
|
3224
|
+
}, {
|
|
3225
|
+
default: A(() => [
|
|
3226
|
+
n.isFeedbackInitiated ? $("", !0) : (P(), S("div", ks, [
|
|
3227
|
+
g("div", Ss, [
|
|
3228
|
+
g("div", Ts, [
|
|
3229
|
+
g("div", {
|
|
3230
|
+
textContent: C(o.successStrings.title)
|
|
3231
|
+
}, null, 8, Ms)
|
|
3232
|
+
]),
|
|
3233
|
+
g("div", {
|
|
3234
|
+
class: "stagger-anim",
|
|
3235
|
+
textContent: C(o.successStrings.text)
|
|
3236
|
+
}, null, 8, Is)
|
|
3237
|
+
])
|
|
3238
|
+
]))
|
|
3239
|
+
]),
|
|
3240
|
+
_: 1
|
|
3241
|
+
}, 8, ["onLeave"]),
|
|
3242
|
+
b(a, {
|
|
3243
|
+
ref: "feedback",
|
|
3244
|
+
"public-id": (d = e._document.viewer) == null ? void 0 : d.publicDocumentId,
|
|
3245
|
+
_document: e._document,
|
|
3246
|
+
style: { flex: "0 0", overflow: "hidden", "min-height": "200px" },
|
|
3247
|
+
class: "stagger-anim",
|
|
3248
|
+
onPage: t[3] || (t[3] = () => n.isFeedbackInitiated = !0),
|
|
3249
|
+
onClose: t[4] || (t[4] = (c) => e.$emit("close"))
|
|
3250
|
+
}, null, 8, ["public-id", "_document"])
|
|
3251
|
+
])) : n.page === "versionError" ? (P(), S("div", As, [
|
|
3252
|
+
g("div", Bs, [
|
|
3253
|
+
g("div", $s, [
|
|
3254
|
+
g("div", Ds, [
|
|
3255
|
+
b(l, {
|
|
3256
|
+
size: 30,
|
|
3257
|
+
type: "error"
|
|
3258
|
+
})
|
|
3259
|
+
])
|
|
3260
|
+
]),
|
|
3261
|
+
g("div", {
|
|
3262
|
+
class: "a-title",
|
|
3263
|
+
textContent: C(e._document.$t(`answerModal.versionError.${i.mode}.title`))
|
|
3264
|
+
}, null, 8, Fs),
|
|
3265
|
+
g("div", {
|
|
3266
|
+
textContent: C(e._document.$t("answerModal.versionError.text"))
|
|
3267
|
+
}, null, 8, Ns)
|
|
3268
|
+
]),
|
|
3269
|
+
g("div", Ls, [
|
|
3270
|
+
b(r, {
|
|
3271
|
+
loading: n.isPosting,
|
|
3272
|
+
type: "none",
|
|
3273
|
+
class: "a-btn",
|
|
3274
|
+
onClick: o.reload
|
|
3275
|
+
}, {
|
|
3276
|
+
default: A(() => [
|
|
3277
|
+
z(C(e._document.$t("answerModal.versionError.btn")), 1)
|
|
3278
|
+
]),
|
|
3279
|
+
_: 1
|
|
3280
|
+
}, 8, ["loading", "onClick"])
|
|
3281
|
+
])
|
|
3282
|
+
])) : $("", !0)
|
|
3283
|
+
];
|
|
3284
|
+
}),
|
|
3285
|
+
_: 1
|
|
3286
|
+
}, 8, ["onEnter", "onLeave"]);
|
|
3287
|
+
}
|
|
3288
|
+
const Ws = /* @__PURE__ */ X(ws, [["render", Rs], ["__scopeId", "data-v-56fc17d8"]]);
|
|
3289
|
+
export {
|
|
3290
|
+
Ws as default
|
|
3291
|
+
};
|