@cling-se/widget 0.22.3 → 0.23.0

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