@opengis/form 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/index.css +1 -0
- package/index.js +3286 -0
- package/index.umd.cjs +6 -0
- package/package.json +28 -0
- package/vite.svg +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,3286 @@
|
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createElementVNode, renderSlot, createCommentVNode, toDisplayString, normalizeProps, guardReactiveProps, createTextVNode, computed, mergeModels, useModel, withDirectives, normalizeClass, unref, vModelText, vModelRadio, Fragment, renderList, createBlock, resolveDynamicComponent, mergeProps, nextTick, ref, onMounted, onUnmounted, withModifiers, normalizeStyle, createVNode, Teleport, vShow, watch, Transition, withCtx, inject, vModelCheckbox, reactive, createStaticVNode, useAttrs, provide } from "vue";
|
|
2
|
+
const _hoisted_1$t = { class: "w-full relative" }, _hoisted_2$a = { class: "text-xs text-gray-500 block" }, _hoisted_3$4 = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "text-red-500 text-[14px]"
|
|
5
|
+
}, _hoisted_4$4 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "text-red-500 text-[10px] absolute bottom-[-14px]"
|
|
8
|
+
}, _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "vs-layout-default",
|
|
10
|
+
props: {
|
|
11
|
+
ua: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
item: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
},
|
|
19
|
+
error: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
setup(e) {
|
|
29
|
+
return (t, n) => (openBlock(), createElementBlock("div", _hoisted_1$t, [
|
|
30
|
+
createElementVNode("span", _hoisted_2$a, [
|
|
31
|
+
createElementVNode("span", null, toDisplayString(e.ua || e.label), 1),
|
|
32
|
+
e.item?.rules?.includes("required") ? (openBlock(), createElementBlock("span", _hoisted_3$4, "*")) : createCommentVNode("", !0)
|
|
33
|
+
]),
|
|
34
|
+
renderSlot(t.$slots, "default", normalizeProps(guardReactiveProps(t.$attrs))),
|
|
35
|
+
e.error ? (openBlock(), createElementBlock("span", _hoisted_4$4, toDisplayString(e.error), 1)) : createCommentVNode("", !0)
|
|
36
|
+
]));
|
|
37
|
+
}
|
|
38
|
+
}), _hoisted_1$s = { class: "w-full relative flex items-center gap-2" }, _hoisted_2$9 = { class: "text-xs text-gray-500 flex shrink-0 w-3/12" }, _hoisted_3$3 = {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: "text-red-500 text-[14px]"
|
|
41
|
+
}, _hoisted_4$3 = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "text-red-500 text-[10px] absolute bottom-[-14px]"
|
|
44
|
+
}, _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
45
|
+
__name: "vs-layout-horizontal",
|
|
46
|
+
props: {
|
|
47
|
+
ua: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ""
|
|
50
|
+
},
|
|
51
|
+
item: {
|
|
52
|
+
type: Object,
|
|
53
|
+
default: () => ({})
|
|
54
|
+
},
|
|
55
|
+
error: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: ""
|
|
58
|
+
},
|
|
59
|
+
label: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ""
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
setup(e) {
|
|
65
|
+
return (t, n) => (openBlock(), createElementBlock("div", _hoisted_1$s, [
|
|
66
|
+
createElementVNode("span", _hoisted_2$9, [
|
|
67
|
+
createTextVNode(toDisplayString(e.ua || e.label) + " ", 1),
|
|
68
|
+
e.item?.rules?.includes("required") ? (openBlock(), createElementBlock("span", _hoisted_3$3, "*")) : createCommentVNode("", !0)
|
|
69
|
+
]),
|
|
70
|
+
renderSlot(t.$slots, "default", normalizeProps(guardReactiveProps(t.$attrs))),
|
|
71
|
+
e.error ? (openBlock(), createElementBlock("span", _hoisted_4$3, toDisplayString(e.error), 1)) : createCommentVNode("", !0)
|
|
72
|
+
]));
|
|
73
|
+
}
|
|
74
|
+
}), _hoisted_1$r = { class: "w-full relative" }, _hoisted_2$8 = {
|
|
75
|
+
key: 0,
|
|
76
|
+
class: "text-red-500 text-[10px] absolute bottom-[-14px]"
|
|
77
|
+
}, _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
78
|
+
__name: "vs-layout-inline",
|
|
79
|
+
props: {
|
|
80
|
+
ua: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: ""
|
|
83
|
+
},
|
|
84
|
+
item: {
|
|
85
|
+
type: Object,
|
|
86
|
+
default: () => ({})
|
|
87
|
+
},
|
|
88
|
+
error: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: ""
|
|
91
|
+
},
|
|
92
|
+
label: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: ""
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
setup(e) {
|
|
98
|
+
return (t, n) => (openBlock(), createElementBlock("div", _hoisted_1$r, [
|
|
99
|
+
renderSlot(t.$slots, "default", normalizeProps(guardReactiveProps(t.$attrs))),
|
|
100
|
+
e.error ? (openBlock(), createElementBlock("span", _hoisted_2$8, toDisplayString(e.error), 1)) : createCommentVNode("", !0)
|
|
101
|
+
]));
|
|
102
|
+
}
|
|
103
|
+
}), layouts$1 = {
|
|
104
|
+
default: _sfc_main$y,
|
|
105
|
+
horizontal: _sfc_main$x,
|
|
106
|
+
inline: _sfc_main$w
|
|
107
|
+
};
|
|
108
|
+
function useStyle(e) {
|
|
109
|
+
return {
|
|
110
|
+
inputClass: computed(() => {
|
|
111
|
+
const n = `disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${e?.primaryColor || "blue"}-500 border border-solid border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 `;
|
|
112
|
+
return e?.size === "sm" ? n + "h-[32px]" : n + "h-[40px]";
|
|
113
|
+
})
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const _hoisted_1$q = ["placeholder", "disabled"], _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
117
|
+
__name: "vs-input-text",
|
|
118
|
+
props: /* @__PURE__ */ mergeModels({
|
|
119
|
+
style: {
|
|
120
|
+
type: Object,
|
|
121
|
+
default: () => ({})
|
|
122
|
+
},
|
|
123
|
+
customClass: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: ""
|
|
126
|
+
},
|
|
127
|
+
placeholder: {
|
|
128
|
+
type: String,
|
|
129
|
+
default: ""
|
|
130
|
+
},
|
|
131
|
+
disabled: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: !1
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
modelValue: { default: "" },
|
|
137
|
+
modelModifiers: {}
|
|
138
|
+
}),
|
|
139
|
+
emits: ["update:modelValue"],
|
|
140
|
+
setup(e) {
|
|
141
|
+
const t = e, { inputClass: n } = useStyle(t.style), r = useModel(e, "modelValue");
|
|
142
|
+
return (o, s) => withDirectives((openBlock(), createElementBlock("input", {
|
|
143
|
+
type: "text",
|
|
144
|
+
"onUpdate:modelValue": s[0] || (s[0] = (i) => r.value = i),
|
|
145
|
+
placeholder: e.placeholder,
|
|
146
|
+
disabled: e.disabled,
|
|
147
|
+
class: normalizeClass(["py-1.5 px-3 block w-full", [unref(n)]]),
|
|
148
|
+
style: {
|
|
149
|
+
border: "1px solid #e0e0e0"
|
|
150
|
+
}
|
|
151
|
+
}, null, 10, _hoisted_1$q)), [
|
|
152
|
+
[vModelText, r.value]
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
}), _hoisted_1$p = ["placeholder"], _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
156
|
+
__name: "vs-input-number",
|
|
157
|
+
props: /* @__PURE__ */ mergeModels({
|
|
158
|
+
style: {
|
|
159
|
+
type: Object,
|
|
160
|
+
default: () => ({})
|
|
161
|
+
},
|
|
162
|
+
placeholder: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: ""
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
modelValue: { default: null },
|
|
168
|
+
modelModifiers: {}
|
|
169
|
+
}),
|
|
170
|
+
emits: ["update:modelValue"],
|
|
171
|
+
setup(e) {
|
|
172
|
+
const t = e, { inputClass: n } = useStyle(t.style), r = useModel(e, "modelValue");
|
|
173
|
+
return (o, s) => withDirectives((openBlock(), createElementBlock("input", {
|
|
174
|
+
type: "number",
|
|
175
|
+
"onUpdate:modelValue": s[0] || (s[0] = (i) => r.value = i),
|
|
176
|
+
placeholder: e.placeholder,
|
|
177
|
+
class: normalizeClass(["py-1.5 px-3 block w-full", [unref(n)]]),
|
|
178
|
+
style: {
|
|
179
|
+
border: "1px solid #e0e0e0"
|
|
180
|
+
}
|
|
181
|
+
}, null, 10, _hoisted_1$p)), [
|
|
182
|
+
[vModelText, r.value]
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
}), _hoisted_1$o = ["value", "disabled"], _hoisted_2$7 = { class: "text-[13px]" }, _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
186
|
+
__name: "vs-input-radio-default",
|
|
187
|
+
props: /* @__PURE__ */ mergeModels({
|
|
188
|
+
text: {
|
|
189
|
+
type: String,
|
|
190
|
+
required: !0
|
|
191
|
+
},
|
|
192
|
+
value: {
|
|
193
|
+
type: String,
|
|
194
|
+
required: !0
|
|
195
|
+
},
|
|
196
|
+
style: {
|
|
197
|
+
type: Object,
|
|
198
|
+
default: () => ({})
|
|
199
|
+
},
|
|
200
|
+
disabled: {
|
|
201
|
+
type: Boolean,
|
|
202
|
+
default: !1
|
|
203
|
+
},
|
|
204
|
+
customClass: {
|
|
205
|
+
type: String,
|
|
206
|
+
default: ""
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
modelValue: { default: "" },
|
|
210
|
+
modelModifiers: {}
|
|
211
|
+
}),
|
|
212
|
+
emits: ["update:modelValue"],
|
|
213
|
+
setup(e) {
|
|
214
|
+
const t = useModel(e, "modelValue");
|
|
215
|
+
return (n, r) => (openBlock(), createElementBlock("label", {
|
|
216
|
+
class: normalizeClass(["flex items-center gap-0", [e.customClass]])
|
|
217
|
+
}, [
|
|
218
|
+
withDirectives(createElementVNode("input", {
|
|
219
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => t.value = o),
|
|
220
|
+
type: "radio",
|
|
221
|
+
value: e.value,
|
|
222
|
+
disabled: e.disabled,
|
|
223
|
+
class: "hidden"
|
|
224
|
+
}, null, 8, _hoisted_1$o), [
|
|
225
|
+
[vModelRadio, t.value]
|
|
226
|
+
]),
|
|
227
|
+
createElementVNode("span", {
|
|
228
|
+
class: normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]", [
|
|
229
|
+
`border-${e.style?.primaryColor || "blue"}-500`,
|
|
230
|
+
e.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
231
|
+
]])
|
|
232
|
+
}, [
|
|
233
|
+
t.value == e.value ? (openBlock(), createElementBlock("span", {
|
|
234
|
+
key: 0,
|
|
235
|
+
class: normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full", [`bg-${e.style?.primaryColor || "blue"}-500`]])
|
|
236
|
+
}, null, 2)) : createCommentVNode("", !0)
|
|
237
|
+
], 2),
|
|
238
|
+
createElementVNode("span", _hoisted_2$7, toDisplayString(e.text), 1)
|
|
239
|
+
], 2));
|
|
240
|
+
}
|
|
241
|
+
}), _hoisted_1$n = ["value", "disabled"], _hoisted_2$6 = { class: "text-[13px]" }, _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
242
|
+
__name: "vs-input-radio-buttons",
|
|
243
|
+
props: /* @__PURE__ */ mergeModels({
|
|
244
|
+
text: {
|
|
245
|
+
type: String,
|
|
246
|
+
required: !0
|
|
247
|
+
},
|
|
248
|
+
value: {
|
|
249
|
+
type: String,
|
|
250
|
+
required: !0
|
|
251
|
+
},
|
|
252
|
+
style: {
|
|
253
|
+
type: Object,
|
|
254
|
+
default: () => ({})
|
|
255
|
+
},
|
|
256
|
+
disabled: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: !1
|
|
259
|
+
},
|
|
260
|
+
customClass: {
|
|
261
|
+
type: String,
|
|
262
|
+
default: ""
|
|
263
|
+
}
|
|
264
|
+
}, {
|
|
265
|
+
modelValue: { default: "" },
|
|
266
|
+
modelModifiers: {}
|
|
267
|
+
}),
|
|
268
|
+
emits: ["update:modelValue"],
|
|
269
|
+
setup(e) {
|
|
270
|
+
const t = useModel(e, "modelValue");
|
|
271
|
+
return (n, r) => (openBlock(), createElementBlock("label", {
|
|
272
|
+
class: normalizeClass(["flex items-center border rounded-lg px-2 py-1", [
|
|
273
|
+
t.value == e.value ? `ring-2 ring-ring ring-${e.style?.primaryColor || "blue"}-500` : "",
|
|
274
|
+
e.customClass
|
|
275
|
+
]])
|
|
276
|
+
}, [
|
|
277
|
+
withDirectives(createElementVNode("input", {
|
|
278
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => t.value = o),
|
|
279
|
+
type: "radio",
|
|
280
|
+
value: e.value,
|
|
281
|
+
disabled: e.disabled,
|
|
282
|
+
class: "hidden"
|
|
283
|
+
}, null, 8, _hoisted_1$n), [
|
|
284
|
+
[vModelRadio, t.value]
|
|
285
|
+
]),
|
|
286
|
+
createElementVNode("span", _hoisted_2$6, toDisplayString(e.text), 1)
|
|
287
|
+
], 2));
|
|
288
|
+
}
|
|
289
|
+
}), layouts = {
|
|
290
|
+
"vs-input-radio-default": _sfc_main$t,
|
|
291
|
+
"vs-input-radio-buttons": _sfc_main$s
|
|
292
|
+
}, _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
293
|
+
__name: "vs-input-radio",
|
|
294
|
+
props: /* @__PURE__ */ mergeModels({
|
|
295
|
+
options: {
|
|
296
|
+
type: Array,
|
|
297
|
+
required: !0
|
|
298
|
+
},
|
|
299
|
+
position: {
|
|
300
|
+
type: String,
|
|
301
|
+
default: "vertical"
|
|
302
|
+
},
|
|
303
|
+
view: {
|
|
304
|
+
type: String,
|
|
305
|
+
default: "default"
|
|
306
|
+
}
|
|
307
|
+
}, {
|
|
308
|
+
modelValue: { default: "" },
|
|
309
|
+
modelModifiers: {}
|
|
310
|
+
}),
|
|
311
|
+
emits: ["update:modelValue"],
|
|
312
|
+
setup(e) {
|
|
313
|
+
const t = e, n = useModel(e, "modelValue"), r = computed(() => layouts[`vs-input-radio-${t.view}`]);
|
|
314
|
+
return (o, s) => (openBlock(), createElementBlock("div", {
|
|
315
|
+
class: normalizeClass([e.position === "horizontal" ? "flex items-center flex-wrap gap-2" : ""])
|
|
316
|
+
}, [
|
|
317
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(e.options, (i) => (openBlock(), createBlock(resolveDynamicComponent(r.value), mergeProps({
|
|
318
|
+
key: i?.id,
|
|
319
|
+
text: i.text,
|
|
320
|
+
value: i.id.toString(),
|
|
321
|
+
checked: n.value === i.id,
|
|
322
|
+
modelValue: n.value,
|
|
323
|
+
"onUpdate:modelValue": s[0] || (s[0] = (l) => n.value = l)
|
|
324
|
+
}, { ref_for: !0 }, o.$attrs), null, 16, ["text", "value", "checked", "modelValue"]))), 128))
|
|
325
|
+
], 2));
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
function bind(e, t) {
|
|
329
|
+
return function() {
|
|
330
|
+
return e.apply(t, arguments);
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
const { toString } = Object.prototype, { getPrototypeOf } = Object, { iterator, toStringTag } = Symbol, kindOf = /* @__PURE__ */ ((e) => (t) => {
|
|
334
|
+
const n = toString.call(t);
|
|
335
|
+
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
336
|
+
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (e) => (e = e.toLowerCase(), (t) => kindOf(t) === e), typeOfTest = (e) => (t) => typeof t === e, { isArray } = Array, isUndefined = typeOfTest("undefined");
|
|
337
|
+
function isBuffer(e) {
|
|
338
|
+
return e !== null && !isUndefined(e) && e.constructor !== null && !isUndefined(e.constructor) && isFunction(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
339
|
+
}
|
|
340
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
341
|
+
function isArrayBufferView(e) {
|
|
342
|
+
let t;
|
|
343
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && isArrayBuffer(e.buffer), t;
|
|
344
|
+
}
|
|
345
|
+
const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (e) => e !== null && typeof e == "object", isBoolean = (e) => e === !0 || e === !1, isPlainObject = (e) => {
|
|
346
|
+
if (kindOf(e) !== "object")
|
|
347
|
+
return !1;
|
|
348
|
+
const t = getPrototypeOf(e);
|
|
349
|
+
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(toStringTag in e) && !(iterator in e);
|
|
350
|
+
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (e) => isObject(e) && isFunction(e.pipe), isFormData = (e) => {
|
|
351
|
+
let t;
|
|
352
|
+
return e && (typeof FormData == "function" && e instanceof FormData || isFunction(e.append) && ((t = kindOf(e)) === "formdata" || // detect form-data instance
|
|
353
|
+
t === "object" && isFunction(e.toString) && e.toString() === "[object FormData]"));
|
|
354
|
+
}, isURLSearchParams = kindOfTest("URLSearchParams"), [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest), trim = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
355
|
+
function forEach(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
356
|
+
if (e === null || typeof e > "u")
|
|
357
|
+
return;
|
|
358
|
+
let r, o;
|
|
359
|
+
if (typeof e != "object" && (e = [e]), isArray(e))
|
|
360
|
+
for (r = 0, o = e.length; r < o; r++)
|
|
361
|
+
t.call(null, e[r], r, e);
|
|
362
|
+
else {
|
|
363
|
+
const s = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = s.length;
|
|
364
|
+
let l;
|
|
365
|
+
for (r = 0; r < i; r++)
|
|
366
|
+
l = s[r], t.call(null, e[l], l, e);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function findKey(e, t) {
|
|
370
|
+
t = t.toLowerCase();
|
|
371
|
+
const n = Object.keys(e);
|
|
372
|
+
let r = n.length, o;
|
|
373
|
+
for (; r-- > 0; )
|
|
374
|
+
if (o = n[r], t === o.toLowerCase())
|
|
375
|
+
return o;
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
const _global = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, isContextDefined = (e) => !isUndefined(e) && e !== _global;
|
|
379
|
+
function merge() {
|
|
380
|
+
const { caseless: e } = isContextDefined(this) && this || {}, t = {}, n = (r, o) => {
|
|
381
|
+
const s = e && findKey(t, o) || o;
|
|
382
|
+
isPlainObject(t[s]) && isPlainObject(r) ? t[s] = merge(t[s], r) : isPlainObject(r) ? t[s] = merge({}, r) : isArray(r) ? t[s] = r.slice() : t[s] = r;
|
|
383
|
+
};
|
|
384
|
+
for (let r = 0, o = arguments.length; r < o; r++)
|
|
385
|
+
arguments[r] && forEach(arguments[r], n);
|
|
386
|
+
return t;
|
|
387
|
+
}
|
|
388
|
+
const extend = (e, t, n, { allOwnKeys: r } = {}) => (forEach(t, (o, s) => {
|
|
389
|
+
n && isFunction(o) ? e[s] = bind(o, n) : e[s] = o;
|
|
390
|
+
}, { allOwnKeys: r }), e), stripBOM = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), inherits = (e, t, n, r) => {
|
|
391
|
+
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
392
|
+
value: t.prototype
|
|
393
|
+
}), n && Object.assign(e.prototype, n);
|
|
394
|
+
}, toFlatObject = (e, t, n, r) => {
|
|
395
|
+
let o, s, i;
|
|
396
|
+
const l = {};
|
|
397
|
+
if (t = t || {}, e == null) return t;
|
|
398
|
+
do {
|
|
399
|
+
for (o = Object.getOwnPropertyNames(e), s = o.length; s-- > 0; )
|
|
400
|
+
i = o[s], (!r || r(i, e, t)) && !l[i] && (t[i] = e[i], l[i] = !0);
|
|
401
|
+
e = n !== !1 && getPrototypeOf(e);
|
|
402
|
+
} while (e && (!n || n(e, t)) && e !== Object.prototype);
|
|
403
|
+
return t;
|
|
404
|
+
}, endsWith = (e, t, n) => {
|
|
405
|
+
e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
|
|
406
|
+
const r = e.indexOf(t, n);
|
|
407
|
+
return r !== -1 && r === n;
|
|
408
|
+
}, toArray = (e) => {
|
|
409
|
+
if (!e) return null;
|
|
410
|
+
if (isArray(e)) return e;
|
|
411
|
+
let t = e.length;
|
|
412
|
+
if (!isNumber(t)) return null;
|
|
413
|
+
const n = new Array(t);
|
|
414
|
+
for (; t-- > 0; )
|
|
415
|
+
n[t] = e[t];
|
|
416
|
+
return n;
|
|
417
|
+
}, isTypedArray = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (e, t) => {
|
|
418
|
+
const r = (e && e[iterator]).call(e);
|
|
419
|
+
let o;
|
|
420
|
+
for (; (o = r.next()) && !o.done; ) {
|
|
421
|
+
const s = o.value;
|
|
422
|
+
t.call(e, s[0], s[1]);
|
|
423
|
+
}
|
|
424
|
+
}, matchAll = (e, t) => {
|
|
425
|
+
let n;
|
|
426
|
+
const r = [];
|
|
427
|
+
for (; (n = e.exec(t)) !== null; )
|
|
428
|
+
r.push(n);
|
|
429
|
+
return r;
|
|
430
|
+
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (e) => e.toLowerCase().replace(
|
|
431
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
432
|
+
function(n, r, o) {
|
|
433
|
+
return r.toUpperCase() + o;
|
|
434
|
+
}
|
|
435
|
+
), hasOwnProperty = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (e, t) => {
|
|
436
|
+
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
437
|
+
forEach(n, (o, s) => {
|
|
438
|
+
let i;
|
|
439
|
+
(i = t(o, s, e)) !== !1 && (r[s] = i || o);
|
|
440
|
+
}), Object.defineProperties(e, r);
|
|
441
|
+
}, freezeMethods = (e) => {
|
|
442
|
+
reduceDescriptors(e, (t, n) => {
|
|
443
|
+
if (isFunction(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
444
|
+
return !1;
|
|
445
|
+
const r = e[n];
|
|
446
|
+
if (isFunction(r)) {
|
|
447
|
+
if (t.enumerable = !1, "writable" in t) {
|
|
448
|
+
t.writable = !1;
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
t.set || (t.set = () => {
|
|
452
|
+
throw Error("Can not rewrite read-only method '" + n + "'");
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
}, toObjectSet = (e, t) => {
|
|
457
|
+
const n = {}, r = (o) => {
|
|
458
|
+
o.forEach((s) => {
|
|
459
|
+
n[s] = !0;
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
return isArray(e) ? r(e) : r(String(e).split(t)), n;
|
|
463
|
+
}, noop = () => {
|
|
464
|
+
}, toFiniteNumber = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
465
|
+
function isSpecCompliantForm(e) {
|
|
466
|
+
return !!(e && isFunction(e.append) && e[toStringTag] === "FormData" && e[iterator]);
|
|
467
|
+
}
|
|
468
|
+
const toJSONObject = (e) => {
|
|
469
|
+
const t = new Array(10), n = (r, o) => {
|
|
470
|
+
if (isObject(r)) {
|
|
471
|
+
if (t.indexOf(r) >= 0)
|
|
472
|
+
return;
|
|
473
|
+
if (!("toJSON" in r)) {
|
|
474
|
+
t[o] = r;
|
|
475
|
+
const s = isArray(r) ? [] : {};
|
|
476
|
+
return forEach(r, (i, l) => {
|
|
477
|
+
const c = n(i, o + 1);
|
|
478
|
+
!isUndefined(c) && (s[l] = c);
|
|
479
|
+
}), t[o] = void 0, s;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return r;
|
|
483
|
+
};
|
|
484
|
+
return n(e, 0);
|
|
485
|
+
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (e) => e && (isObject(e) || isFunction(e)) && isFunction(e.then) && isFunction(e.catch), _setImmediate = ((e, t) => e ? setImmediate : t ? ((n, r) => (_global.addEventListener("message", ({ source: o, data: s }) => {
|
|
486
|
+
o === _global && s === n && r.length && r.shift()();
|
|
487
|
+
}, !1), (o) => {
|
|
488
|
+
r.push(o), _global.postMessage(n, "*");
|
|
489
|
+
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
490
|
+
typeof setImmediate == "function",
|
|
491
|
+
isFunction(_global.postMessage)
|
|
492
|
+
), asap = typeof queueMicrotask < "u" ? queueMicrotask.bind(_global) : typeof process < "u" && process.nextTick || _setImmediate, isIterable = (e) => e != null && isFunction(e[iterator]), utils$1 = {
|
|
493
|
+
isArray,
|
|
494
|
+
isArrayBuffer,
|
|
495
|
+
isBuffer,
|
|
496
|
+
isFormData,
|
|
497
|
+
isArrayBufferView,
|
|
498
|
+
isString,
|
|
499
|
+
isNumber,
|
|
500
|
+
isBoolean,
|
|
501
|
+
isObject,
|
|
502
|
+
isPlainObject,
|
|
503
|
+
isReadableStream,
|
|
504
|
+
isRequest,
|
|
505
|
+
isResponse,
|
|
506
|
+
isHeaders,
|
|
507
|
+
isUndefined,
|
|
508
|
+
isDate,
|
|
509
|
+
isFile,
|
|
510
|
+
isBlob,
|
|
511
|
+
isRegExp,
|
|
512
|
+
isFunction,
|
|
513
|
+
isStream,
|
|
514
|
+
isURLSearchParams,
|
|
515
|
+
isTypedArray,
|
|
516
|
+
isFileList,
|
|
517
|
+
forEach,
|
|
518
|
+
merge,
|
|
519
|
+
extend,
|
|
520
|
+
trim,
|
|
521
|
+
stripBOM,
|
|
522
|
+
inherits,
|
|
523
|
+
toFlatObject,
|
|
524
|
+
kindOf,
|
|
525
|
+
kindOfTest,
|
|
526
|
+
endsWith,
|
|
527
|
+
toArray,
|
|
528
|
+
forEachEntry,
|
|
529
|
+
matchAll,
|
|
530
|
+
isHTMLForm,
|
|
531
|
+
hasOwnProperty,
|
|
532
|
+
hasOwnProp: hasOwnProperty,
|
|
533
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
534
|
+
reduceDescriptors,
|
|
535
|
+
freezeMethods,
|
|
536
|
+
toObjectSet,
|
|
537
|
+
toCamelCase,
|
|
538
|
+
noop,
|
|
539
|
+
toFiniteNumber,
|
|
540
|
+
findKey,
|
|
541
|
+
global: _global,
|
|
542
|
+
isContextDefined,
|
|
543
|
+
isSpecCompliantForm,
|
|
544
|
+
toJSONObject,
|
|
545
|
+
isAsyncFn,
|
|
546
|
+
isThenable,
|
|
547
|
+
setImmediate: _setImmediate,
|
|
548
|
+
asap,
|
|
549
|
+
isIterable
|
|
550
|
+
};
|
|
551
|
+
function AxiosError$1(e, t, n, r, o) {
|
|
552
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
|
|
553
|
+
}
|
|
554
|
+
utils$1.inherits(AxiosError$1, Error, {
|
|
555
|
+
toJSON: function() {
|
|
556
|
+
return {
|
|
557
|
+
// Standard
|
|
558
|
+
message: this.message,
|
|
559
|
+
name: this.name,
|
|
560
|
+
// Microsoft
|
|
561
|
+
description: this.description,
|
|
562
|
+
number: this.number,
|
|
563
|
+
// Mozilla
|
|
564
|
+
fileName: this.fileName,
|
|
565
|
+
lineNumber: this.lineNumber,
|
|
566
|
+
columnNumber: this.columnNumber,
|
|
567
|
+
stack: this.stack,
|
|
568
|
+
// Axios
|
|
569
|
+
config: utils$1.toJSONObject(this.config),
|
|
570
|
+
code: this.code,
|
|
571
|
+
status: this.status
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
const prototype$1 = AxiosError$1.prototype, descriptors = {};
|
|
576
|
+
[
|
|
577
|
+
"ERR_BAD_OPTION_VALUE",
|
|
578
|
+
"ERR_BAD_OPTION",
|
|
579
|
+
"ECONNABORTED",
|
|
580
|
+
"ETIMEDOUT",
|
|
581
|
+
"ERR_NETWORK",
|
|
582
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
583
|
+
"ERR_DEPRECATED",
|
|
584
|
+
"ERR_BAD_RESPONSE",
|
|
585
|
+
"ERR_BAD_REQUEST",
|
|
586
|
+
"ERR_CANCELED",
|
|
587
|
+
"ERR_NOT_SUPPORT",
|
|
588
|
+
"ERR_INVALID_URL"
|
|
589
|
+
// eslint-disable-next-line func-names
|
|
590
|
+
].forEach((e) => {
|
|
591
|
+
descriptors[e] = { value: e };
|
|
592
|
+
});
|
|
593
|
+
Object.defineProperties(AxiosError$1, descriptors);
|
|
594
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
|
|
595
|
+
AxiosError$1.from = (e, t, n, r, o, s) => {
|
|
596
|
+
const i = Object.create(prototype$1);
|
|
597
|
+
return utils$1.toFlatObject(e, i, function(c) {
|
|
598
|
+
return c !== Error.prototype;
|
|
599
|
+
}, (l) => l !== "isAxiosError"), AxiosError$1.call(i, e.message, t, n, r, o), i.cause = e, i.name = e.name, s && Object.assign(i, s), i;
|
|
600
|
+
};
|
|
601
|
+
const httpAdapter = null;
|
|
602
|
+
function isVisitable(e) {
|
|
603
|
+
return utils$1.isPlainObject(e) || utils$1.isArray(e);
|
|
604
|
+
}
|
|
605
|
+
function removeBrackets(e) {
|
|
606
|
+
return utils$1.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
607
|
+
}
|
|
608
|
+
function renderKey(e, t, n) {
|
|
609
|
+
return e ? e.concat(t).map(function(o, s) {
|
|
610
|
+
return o = removeBrackets(o), !n && s ? "[" + o + "]" : o;
|
|
611
|
+
}).join(n ? "." : "") : t;
|
|
612
|
+
}
|
|
613
|
+
function isFlatArray(e) {
|
|
614
|
+
return utils$1.isArray(e) && !e.some(isVisitable);
|
|
615
|
+
}
|
|
616
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function(t) {
|
|
617
|
+
return /^is[A-Z]/.test(t);
|
|
618
|
+
});
|
|
619
|
+
function toFormData$1(e, t, n) {
|
|
620
|
+
if (!utils$1.isObject(e))
|
|
621
|
+
throw new TypeError("target must be an object");
|
|
622
|
+
t = t || new FormData(), n = utils$1.toFlatObject(n, {
|
|
623
|
+
metaTokens: !0,
|
|
624
|
+
dots: !1,
|
|
625
|
+
indexes: !1
|
|
626
|
+
}, !1, function(y, m) {
|
|
627
|
+
return !utils$1.isUndefined(m[y]);
|
|
628
|
+
});
|
|
629
|
+
const r = n.metaTokens, o = n.visitor || a, s = n.dots, i = n.indexes, c = (n.Blob || typeof Blob < "u" && Blob) && utils$1.isSpecCompliantForm(t);
|
|
630
|
+
if (!utils$1.isFunction(o))
|
|
631
|
+
throw new TypeError("visitor must be a function");
|
|
632
|
+
function u(p) {
|
|
633
|
+
if (p === null) return "";
|
|
634
|
+
if (utils$1.isDate(p))
|
|
635
|
+
return p.toISOString();
|
|
636
|
+
if (utils$1.isBoolean(p))
|
|
637
|
+
return p.toString();
|
|
638
|
+
if (!c && utils$1.isBlob(p))
|
|
639
|
+
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
640
|
+
return utils$1.isArrayBuffer(p) || utils$1.isTypedArray(p) ? c && typeof Blob == "function" ? new Blob([p]) : Buffer.from(p) : p;
|
|
641
|
+
}
|
|
642
|
+
function a(p, y, m) {
|
|
643
|
+
let $ = p;
|
|
644
|
+
if (p && !m && typeof p == "object") {
|
|
645
|
+
if (utils$1.endsWith(y, "{}"))
|
|
646
|
+
y = r ? y : y.slice(0, -2), p = JSON.stringify(p);
|
|
647
|
+
else if (utils$1.isArray(p) && isFlatArray(p) || (utils$1.isFileList(p) || utils$1.endsWith(y, "[]")) && ($ = utils$1.toArray(p)))
|
|
648
|
+
return y = removeBrackets(y), $.forEach(function(x, _) {
|
|
649
|
+
!(utils$1.isUndefined(x) || x === null) && t.append(
|
|
650
|
+
// eslint-disable-next-line no-nested-ternary
|
|
651
|
+
i === !0 ? renderKey([y], _, s) : i === null ? y : y + "[]",
|
|
652
|
+
u(x)
|
|
653
|
+
);
|
|
654
|
+
}), !1;
|
|
655
|
+
}
|
|
656
|
+
return isVisitable(p) ? !0 : (t.append(renderKey(m, y, s), u(p)), !1);
|
|
657
|
+
}
|
|
658
|
+
const d = [], f = Object.assign(predicates, {
|
|
659
|
+
defaultVisitor: a,
|
|
660
|
+
convertValue: u,
|
|
661
|
+
isVisitable
|
|
662
|
+
});
|
|
663
|
+
function h(p, y) {
|
|
664
|
+
if (!utils$1.isUndefined(p)) {
|
|
665
|
+
if (d.indexOf(p) !== -1)
|
|
666
|
+
throw Error("Circular reference detected in " + y.join("."));
|
|
667
|
+
d.push(p), utils$1.forEach(p, function($, w) {
|
|
668
|
+
(!(utils$1.isUndefined($) || $ === null) && o.call(
|
|
669
|
+
t,
|
|
670
|
+
$,
|
|
671
|
+
utils$1.isString(w) ? w.trim() : w,
|
|
672
|
+
y,
|
|
673
|
+
f
|
|
674
|
+
)) === !0 && h($, y ? y.concat(w) : [w]);
|
|
675
|
+
}), d.pop();
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
if (!utils$1.isObject(e))
|
|
679
|
+
throw new TypeError("data must be an object");
|
|
680
|
+
return h(e), t;
|
|
681
|
+
}
|
|
682
|
+
function encode$1(e) {
|
|
683
|
+
const t = {
|
|
684
|
+
"!": "%21",
|
|
685
|
+
"'": "%27",
|
|
686
|
+
"(": "%28",
|
|
687
|
+
")": "%29",
|
|
688
|
+
"~": "%7E",
|
|
689
|
+
"%20": "+",
|
|
690
|
+
"%00": "\0"
|
|
691
|
+
};
|
|
692
|
+
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
693
|
+
return t[r];
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
function AxiosURLSearchParams(e, t) {
|
|
697
|
+
this._pairs = [], e && toFormData$1(e, this, t);
|
|
698
|
+
}
|
|
699
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
700
|
+
prototype.append = function(t, n) {
|
|
701
|
+
this._pairs.push([t, n]);
|
|
702
|
+
};
|
|
703
|
+
prototype.toString = function(t) {
|
|
704
|
+
const n = t ? function(r) {
|
|
705
|
+
return t.call(this, r, encode$1);
|
|
706
|
+
} : encode$1;
|
|
707
|
+
return this._pairs.map(function(o) {
|
|
708
|
+
return n(o[0]) + "=" + n(o[1]);
|
|
709
|
+
}, "").join("&");
|
|
710
|
+
};
|
|
711
|
+
function encode(e) {
|
|
712
|
+
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
713
|
+
}
|
|
714
|
+
function buildURL(e, t, n) {
|
|
715
|
+
if (!t)
|
|
716
|
+
return e;
|
|
717
|
+
const r = n && n.encode || encode;
|
|
718
|
+
utils$1.isFunction(n) && (n = {
|
|
719
|
+
serialize: n
|
|
720
|
+
});
|
|
721
|
+
const o = n && n.serialize;
|
|
722
|
+
let s;
|
|
723
|
+
if (o ? s = o(t, n) : s = utils$1.isURLSearchParams(t) ? t.toString() : new AxiosURLSearchParams(t, n).toString(r), s) {
|
|
724
|
+
const i = e.indexOf("#");
|
|
725
|
+
i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + s;
|
|
726
|
+
}
|
|
727
|
+
return e;
|
|
728
|
+
}
|
|
729
|
+
class InterceptorManager {
|
|
730
|
+
constructor() {
|
|
731
|
+
this.handlers = [];
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Add a new interceptor to the stack
|
|
735
|
+
*
|
|
736
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
737
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
738
|
+
*
|
|
739
|
+
* @return {Number} An ID used to remove interceptor later
|
|
740
|
+
*/
|
|
741
|
+
use(t, n, r) {
|
|
742
|
+
return this.handlers.push({
|
|
743
|
+
fulfilled: t,
|
|
744
|
+
rejected: n,
|
|
745
|
+
synchronous: r ? r.synchronous : !1,
|
|
746
|
+
runWhen: r ? r.runWhen : null
|
|
747
|
+
}), this.handlers.length - 1;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Remove an interceptor from the stack
|
|
751
|
+
*
|
|
752
|
+
* @param {Number} id The ID that was returned by `use`
|
|
753
|
+
*
|
|
754
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
755
|
+
*/
|
|
756
|
+
eject(t) {
|
|
757
|
+
this.handlers[t] && (this.handlers[t] = null);
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Clear all interceptors from the stack
|
|
761
|
+
*
|
|
762
|
+
* @returns {void}
|
|
763
|
+
*/
|
|
764
|
+
clear() {
|
|
765
|
+
this.handlers && (this.handlers = []);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Iterate over all the registered interceptors
|
|
769
|
+
*
|
|
770
|
+
* This method is particularly useful for skipping over any
|
|
771
|
+
* interceptors that may have become `null` calling `eject`.
|
|
772
|
+
*
|
|
773
|
+
* @param {Function} fn The function to call for each interceptor
|
|
774
|
+
*
|
|
775
|
+
* @returns {void}
|
|
776
|
+
*/
|
|
777
|
+
forEach(t) {
|
|
778
|
+
utils$1.forEach(this.handlers, function(r) {
|
|
779
|
+
r !== null && t(r);
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
const transitionalDefaults = {
|
|
784
|
+
silentJSONParsing: !0,
|
|
785
|
+
forcedJSONParsing: !0,
|
|
786
|
+
clarifyTimeoutError: !1
|
|
787
|
+
}, URLSearchParams$1 = typeof URLSearchParams < "u" ? URLSearchParams : AxiosURLSearchParams, FormData$1 = typeof FormData < "u" ? FormData : null, Blob$1 = typeof Blob < "u" ? Blob : null, platform$1 = {
|
|
788
|
+
isBrowser: !0,
|
|
789
|
+
classes: {
|
|
790
|
+
URLSearchParams: URLSearchParams$1,
|
|
791
|
+
FormData: FormData$1,
|
|
792
|
+
Blob: Blob$1
|
|
793
|
+
},
|
|
794
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
795
|
+
}, hasBrowserEnv = typeof window < "u" && typeof document < "u", _navigator = typeof navigator == "object" && navigator || void 0, hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0), hasStandardBrowserWebWorkerEnv = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
796
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", origin = hasBrowserEnv && window.location.href || "http://localhost", utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
797
|
+
__proto__: null,
|
|
798
|
+
hasBrowserEnv,
|
|
799
|
+
hasStandardBrowserEnv,
|
|
800
|
+
hasStandardBrowserWebWorkerEnv,
|
|
801
|
+
navigator: _navigator,
|
|
802
|
+
origin
|
|
803
|
+
}, Symbol.toStringTag, { value: "Module" })), platform = {
|
|
804
|
+
...utils,
|
|
805
|
+
...platform$1
|
|
806
|
+
};
|
|
807
|
+
function toURLEncodedForm(e, t) {
|
|
808
|
+
return toFormData$1(e, new platform.classes.URLSearchParams(), Object.assign({
|
|
809
|
+
visitor: function(n, r, o, s) {
|
|
810
|
+
return platform.isNode && utils$1.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments);
|
|
811
|
+
}
|
|
812
|
+
}, t));
|
|
813
|
+
}
|
|
814
|
+
function parsePropPath(e) {
|
|
815
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
|
|
816
|
+
}
|
|
817
|
+
function arrayToObject(e) {
|
|
818
|
+
const t = {}, n = Object.keys(e);
|
|
819
|
+
let r;
|
|
820
|
+
const o = n.length;
|
|
821
|
+
let s;
|
|
822
|
+
for (r = 0; r < o; r++)
|
|
823
|
+
s = n[r], t[s] = e[s];
|
|
824
|
+
return t;
|
|
825
|
+
}
|
|
826
|
+
function formDataToJSON(e) {
|
|
827
|
+
function t(n, r, o, s) {
|
|
828
|
+
let i = n[s++];
|
|
829
|
+
if (i === "__proto__") return !0;
|
|
830
|
+
const l = Number.isFinite(+i), c = s >= n.length;
|
|
831
|
+
return i = !i && utils$1.isArray(o) ? o.length : i, c ? (utils$1.hasOwnProp(o, i) ? o[i] = [o[i], r] : o[i] = r, !l) : ((!o[i] || !utils$1.isObject(o[i])) && (o[i] = []), t(n, r, o[i], s) && utils$1.isArray(o[i]) && (o[i] = arrayToObject(o[i])), !l);
|
|
832
|
+
}
|
|
833
|
+
if (utils$1.isFormData(e) && utils$1.isFunction(e.entries)) {
|
|
834
|
+
const n = {};
|
|
835
|
+
return utils$1.forEachEntry(e, (r, o) => {
|
|
836
|
+
t(parsePropPath(r), o, n, 0);
|
|
837
|
+
}), n;
|
|
838
|
+
}
|
|
839
|
+
return null;
|
|
840
|
+
}
|
|
841
|
+
function stringifySafely(e, t, n) {
|
|
842
|
+
if (utils$1.isString(e))
|
|
843
|
+
try {
|
|
844
|
+
return (t || JSON.parse)(e), utils$1.trim(e);
|
|
845
|
+
} catch (r) {
|
|
846
|
+
if (r.name !== "SyntaxError")
|
|
847
|
+
throw r;
|
|
848
|
+
}
|
|
849
|
+
return (n || JSON.stringify)(e);
|
|
850
|
+
}
|
|
851
|
+
const defaults = {
|
|
852
|
+
transitional: transitionalDefaults,
|
|
853
|
+
adapter: ["xhr", "http", "fetch"],
|
|
854
|
+
transformRequest: [function(t, n) {
|
|
855
|
+
const r = n.getContentType() || "", o = r.indexOf("application/json") > -1, s = utils$1.isObject(t);
|
|
856
|
+
if (s && utils$1.isHTMLForm(t) && (t = new FormData(t)), utils$1.isFormData(t))
|
|
857
|
+
return o ? JSON.stringify(formDataToJSON(t)) : t;
|
|
858
|
+
if (utils$1.isArrayBuffer(t) || utils$1.isBuffer(t) || utils$1.isStream(t) || utils$1.isFile(t) || utils$1.isBlob(t) || utils$1.isReadableStream(t))
|
|
859
|
+
return t;
|
|
860
|
+
if (utils$1.isArrayBufferView(t))
|
|
861
|
+
return t.buffer;
|
|
862
|
+
if (utils$1.isURLSearchParams(t))
|
|
863
|
+
return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
|
|
864
|
+
let l;
|
|
865
|
+
if (s) {
|
|
866
|
+
if (r.indexOf("application/x-www-form-urlencoded") > -1)
|
|
867
|
+
return toURLEncodedForm(t, this.formSerializer).toString();
|
|
868
|
+
if ((l = utils$1.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
|
|
869
|
+
const c = this.env && this.env.FormData;
|
|
870
|
+
return toFormData$1(
|
|
871
|
+
l ? { "files[]": t } : t,
|
|
872
|
+
c && new c(),
|
|
873
|
+
this.formSerializer
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
return s || o ? (n.setContentType("application/json", !1), stringifySafely(t)) : t;
|
|
878
|
+
}],
|
|
879
|
+
transformResponse: [function(t) {
|
|
880
|
+
const n = this.transitional || defaults.transitional, r = n && n.forcedJSONParsing, o = this.responseType === "json";
|
|
881
|
+
if (utils$1.isResponse(t) || utils$1.isReadableStream(t))
|
|
882
|
+
return t;
|
|
883
|
+
if (t && utils$1.isString(t) && (r && !this.responseType || o)) {
|
|
884
|
+
const i = !(n && n.silentJSONParsing) && o;
|
|
885
|
+
try {
|
|
886
|
+
return JSON.parse(t);
|
|
887
|
+
} catch (l) {
|
|
888
|
+
if (i)
|
|
889
|
+
throw l.name === "SyntaxError" ? AxiosError$1.from(l, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response) : l;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
return t;
|
|
893
|
+
}],
|
|
894
|
+
/**
|
|
895
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
896
|
+
* timeout is not created.
|
|
897
|
+
*/
|
|
898
|
+
timeout: 0,
|
|
899
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
900
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
901
|
+
maxContentLength: -1,
|
|
902
|
+
maxBodyLength: -1,
|
|
903
|
+
env: {
|
|
904
|
+
FormData: platform.classes.FormData,
|
|
905
|
+
Blob: platform.classes.Blob
|
|
906
|
+
},
|
|
907
|
+
validateStatus: function(t) {
|
|
908
|
+
return t >= 200 && t < 300;
|
|
909
|
+
},
|
|
910
|
+
headers: {
|
|
911
|
+
common: {
|
|
912
|
+
Accept: "application/json, text/plain, */*",
|
|
913
|
+
"Content-Type": void 0
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
|
|
918
|
+
defaults.headers[e] = {};
|
|
919
|
+
});
|
|
920
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
921
|
+
"age",
|
|
922
|
+
"authorization",
|
|
923
|
+
"content-length",
|
|
924
|
+
"content-type",
|
|
925
|
+
"etag",
|
|
926
|
+
"expires",
|
|
927
|
+
"from",
|
|
928
|
+
"host",
|
|
929
|
+
"if-modified-since",
|
|
930
|
+
"if-unmodified-since",
|
|
931
|
+
"last-modified",
|
|
932
|
+
"location",
|
|
933
|
+
"max-forwards",
|
|
934
|
+
"proxy-authorization",
|
|
935
|
+
"referer",
|
|
936
|
+
"retry-after",
|
|
937
|
+
"user-agent"
|
|
938
|
+
]), parseHeaders = (e) => {
|
|
939
|
+
const t = {};
|
|
940
|
+
let n, r, o;
|
|
941
|
+
return e && e.split(`
|
|
942
|
+
`).forEach(function(i) {
|
|
943
|
+
o = i.indexOf(":"), n = i.substring(0, o).trim().toLowerCase(), r = i.substring(o + 1).trim(), !(!n || t[n] && ignoreDuplicateOf[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
|
|
944
|
+
}), t;
|
|
945
|
+
}, $internals = Symbol("internals");
|
|
946
|
+
function normalizeHeader(e) {
|
|
947
|
+
return e && String(e).trim().toLowerCase();
|
|
948
|
+
}
|
|
949
|
+
function normalizeValue(e) {
|
|
950
|
+
return e === !1 || e == null ? e : utils$1.isArray(e) ? e.map(normalizeValue) : String(e);
|
|
951
|
+
}
|
|
952
|
+
function parseTokens(e) {
|
|
953
|
+
const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
954
|
+
let r;
|
|
955
|
+
for (; r = n.exec(e); )
|
|
956
|
+
t[r[1]] = r[2];
|
|
957
|
+
return t;
|
|
958
|
+
}
|
|
959
|
+
const isValidHeaderName = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
960
|
+
function matchHeaderValue(e, t, n, r, o) {
|
|
961
|
+
if (utils$1.isFunction(r))
|
|
962
|
+
return r.call(this, t, n);
|
|
963
|
+
if (o && (t = n), !!utils$1.isString(t)) {
|
|
964
|
+
if (utils$1.isString(r))
|
|
965
|
+
return t.indexOf(r) !== -1;
|
|
966
|
+
if (utils$1.isRegExp(r))
|
|
967
|
+
return r.test(t);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
function formatHeader(e) {
|
|
971
|
+
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
|
|
972
|
+
}
|
|
973
|
+
function buildAccessors(e, t) {
|
|
974
|
+
const n = utils$1.toCamelCase(" " + t);
|
|
975
|
+
["get", "set", "has"].forEach((r) => {
|
|
976
|
+
Object.defineProperty(e, r + n, {
|
|
977
|
+
value: function(o, s, i) {
|
|
978
|
+
return this[r].call(this, t, o, s, i);
|
|
979
|
+
},
|
|
980
|
+
configurable: !0
|
|
981
|
+
});
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
let AxiosHeaders$1 = class {
|
|
985
|
+
constructor(t) {
|
|
986
|
+
t && this.set(t);
|
|
987
|
+
}
|
|
988
|
+
set(t, n, r) {
|
|
989
|
+
const o = this;
|
|
990
|
+
function s(l, c, u) {
|
|
991
|
+
const a = normalizeHeader(c);
|
|
992
|
+
if (!a)
|
|
993
|
+
throw new Error("header name must be a non-empty string");
|
|
994
|
+
const d = utils$1.findKey(o, a);
|
|
995
|
+
(!d || o[d] === void 0 || u === !0 || u === void 0 && o[d] !== !1) && (o[d || c] = normalizeValue(l));
|
|
996
|
+
}
|
|
997
|
+
const i = (l, c) => utils$1.forEach(l, (u, a) => s(u, a, c));
|
|
998
|
+
if (utils$1.isPlainObject(t) || t instanceof this.constructor)
|
|
999
|
+
i(t, n);
|
|
1000
|
+
else if (utils$1.isString(t) && (t = t.trim()) && !isValidHeaderName(t))
|
|
1001
|
+
i(parseHeaders(t), n);
|
|
1002
|
+
else if (utils$1.isObject(t) && utils$1.isIterable(t)) {
|
|
1003
|
+
let l = {}, c, u;
|
|
1004
|
+
for (const a of t) {
|
|
1005
|
+
if (!utils$1.isArray(a))
|
|
1006
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
1007
|
+
l[u = a[0]] = (c = l[u]) ? utils$1.isArray(c) ? [...c, a[1]] : [c, a[1]] : a[1];
|
|
1008
|
+
}
|
|
1009
|
+
i(l, n);
|
|
1010
|
+
} else
|
|
1011
|
+
t != null && s(n, t, r);
|
|
1012
|
+
return this;
|
|
1013
|
+
}
|
|
1014
|
+
get(t, n) {
|
|
1015
|
+
if (t = normalizeHeader(t), t) {
|
|
1016
|
+
const r = utils$1.findKey(this, t);
|
|
1017
|
+
if (r) {
|
|
1018
|
+
const o = this[r];
|
|
1019
|
+
if (!n)
|
|
1020
|
+
return o;
|
|
1021
|
+
if (n === !0)
|
|
1022
|
+
return parseTokens(o);
|
|
1023
|
+
if (utils$1.isFunction(n))
|
|
1024
|
+
return n.call(this, o, r);
|
|
1025
|
+
if (utils$1.isRegExp(n))
|
|
1026
|
+
return n.exec(o);
|
|
1027
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
has(t, n) {
|
|
1032
|
+
if (t = normalizeHeader(t), t) {
|
|
1033
|
+
const r = utils$1.findKey(this, t);
|
|
1034
|
+
return !!(r && this[r] !== void 0 && (!n || matchHeaderValue(this, this[r], r, n)));
|
|
1035
|
+
}
|
|
1036
|
+
return !1;
|
|
1037
|
+
}
|
|
1038
|
+
delete(t, n) {
|
|
1039
|
+
const r = this;
|
|
1040
|
+
let o = !1;
|
|
1041
|
+
function s(i) {
|
|
1042
|
+
if (i = normalizeHeader(i), i) {
|
|
1043
|
+
const l = utils$1.findKey(r, i);
|
|
1044
|
+
l && (!n || matchHeaderValue(r, r[l], l, n)) && (delete r[l], o = !0);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return utils$1.isArray(t) ? t.forEach(s) : s(t), o;
|
|
1048
|
+
}
|
|
1049
|
+
clear(t) {
|
|
1050
|
+
const n = Object.keys(this);
|
|
1051
|
+
let r = n.length, o = !1;
|
|
1052
|
+
for (; r--; ) {
|
|
1053
|
+
const s = n[r];
|
|
1054
|
+
(!t || matchHeaderValue(this, this[s], s, t, !0)) && (delete this[s], o = !0);
|
|
1055
|
+
}
|
|
1056
|
+
return o;
|
|
1057
|
+
}
|
|
1058
|
+
normalize(t) {
|
|
1059
|
+
const n = this, r = {};
|
|
1060
|
+
return utils$1.forEach(this, (o, s) => {
|
|
1061
|
+
const i = utils$1.findKey(r, s);
|
|
1062
|
+
if (i) {
|
|
1063
|
+
n[i] = normalizeValue(o), delete n[s];
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
const l = t ? formatHeader(s) : String(s).trim();
|
|
1067
|
+
l !== s && delete n[s], n[l] = normalizeValue(o), r[l] = !0;
|
|
1068
|
+
}), this;
|
|
1069
|
+
}
|
|
1070
|
+
concat(...t) {
|
|
1071
|
+
return this.constructor.concat(this, ...t);
|
|
1072
|
+
}
|
|
1073
|
+
toJSON(t) {
|
|
1074
|
+
const n = /* @__PURE__ */ Object.create(null);
|
|
1075
|
+
return utils$1.forEach(this, (r, o) => {
|
|
1076
|
+
r != null && r !== !1 && (n[o] = t && utils$1.isArray(r) ? r.join(", ") : r);
|
|
1077
|
+
}), n;
|
|
1078
|
+
}
|
|
1079
|
+
[Symbol.iterator]() {
|
|
1080
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1081
|
+
}
|
|
1082
|
+
toString() {
|
|
1083
|
+
return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
|
|
1084
|
+
`);
|
|
1085
|
+
}
|
|
1086
|
+
getSetCookie() {
|
|
1087
|
+
return this.get("set-cookie") || [];
|
|
1088
|
+
}
|
|
1089
|
+
get [Symbol.toStringTag]() {
|
|
1090
|
+
return "AxiosHeaders";
|
|
1091
|
+
}
|
|
1092
|
+
static from(t) {
|
|
1093
|
+
return t instanceof this ? t : new this(t);
|
|
1094
|
+
}
|
|
1095
|
+
static concat(t, ...n) {
|
|
1096
|
+
const r = new this(t);
|
|
1097
|
+
return n.forEach((o) => r.set(o)), r;
|
|
1098
|
+
}
|
|
1099
|
+
static accessor(t) {
|
|
1100
|
+
const r = (this[$internals] = this[$internals] = {
|
|
1101
|
+
accessors: {}
|
|
1102
|
+
}).accessors, o = this.prototype;
|
|
1103
|
+
function s(i) {
|
|
1104
|
+
const l = normalizeHeader(i);
|
|
1105
|
+
r[l] || (buildAccessors(o, i), r[l] = !0);
|
|
1106
|
+
}
|
|
1107
|
+
return utils$1.isArray(t) ? t.forEach(s) : s(t), this;
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1111
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value: e }, t) => {
|
|
1112
|
+
let n = t[0].toUpperCase() + t.slice(1);
|
|
1113
|
+
return {
|
|
1114
|
+
get: () => e,
|
|
1115
|
+
set(r) {
|
|
1116
|
+
this[n] = r;
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
});
|
|
1120
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
1121
|
+
function transformData(e, t) {
|
|
1122
|
+
const n = this || defaults, r = t || n, o = AxiosHeaders$1.from(r.headers);
|
|
1123
|
+
let s = r.data;
|
|
1124
|
+
return utils$1.forEach(e, function(l) {
|
|
1125
|
+
s = l.call(n, s, o.normalize(), t ? t.status : void 0);
|
|
1126
|
+
}), o.normalize(), s;
|
|
1127
|
+
}
|
|
1128
|
+
function isCancel$1(e) {
|
|
1129
|
+
return !!(e && e.__CANCEL__);
|
|
1130
|
+
}
|
|
1131
|
+
function CanceledError$1(e, t, n) {
|
|
1132
|
+
AxiosError$1.call(this, e ?? "canceled", AxiosError$1.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
1133
|
+
}
|
|
1134
|
+
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
1135
|
+
__CANCEL__: !0
|
|
1136
|
+
});
|
|
1137
|
+
function settle(e, t, n) {
|
|
1138
|
+
const r = n.config.validateStatus;
|
|
1139
|
+
!n.status || !r || r(n.status) ? e(n) : t(new AxiosError$1(
|
|
1140
|
+
"Request failed with status code " + n.status,
|
|
1141
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
|
|
1142
|
+
n.config,
|
|
1143
|
+
n.request,
|
|
1144
|
+
n
|
|
1145
|
+
));
|
|
1146
|
+
}
|
|
1147
|
+
function parseProtocol(e) {
|
|
1148
|
+
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
1149
|
+
return t && t[1] || "";
|
|
1150
|
+
}
|
|
1151
|
+
function speedometer(e, t) {
|
|
1152
|
+
e = e || 10;
|
|
1153
|
+
const n = new Array(e), r = new Array(e);
|
|
1154
|
+
let o = 0, s = 0, i;
|
|
1155
|
+
return t = t !== void 0 ? t : 1e3, function(c) {
|
|
1156
|
+
const u = Date.now(), a = r[s];
|
|
1157
|
+
i || (i = u), n[o] = c, r[o] = u;
|
|
1158
|
+
let d = s, f = 0;
|
|
1159
|
+
for (; d !== o; )
|
|
1160
|
+
f += n[d++], d = d % e;
|
|
1161
|
+
if (o = (o + 1) % e, o === s && (s = (s + 1) % e), u - i < t)
|
|
1162
|
+
return;
|
|
1163
|
+
const h = a && u - a;
|
|
1164
|
+
return h ? Math.round(f * 1e3 / h) : void 0;
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
function throttle(e, t) {
|
|
1168
|
+
let n = 0, r = 1e3 / t, o, s;
|
|
1169
|
+
const i = (u, a = Date.now()) => {
|
|
1170
|
+
n = a, o = null, s && (clearTimeout(s), s = null), e.apply(null, u);
|
|
1171
|
+
};
|
|
1172
|
+
return [(...u) => {
|
|
1173
|
+
const a = Date.now(), d = a - n;
|
|
1174
|
+
d >= r ? i(u, a) : (o = u, s || (s = setTimeout(() => {
|
|
1175
|
+
s = null, i(o);
|
|
1176
|
+
}, r - d)));
|
|
1177
|
+
}, () => o && i(o)];
|
|
1178
|
+
}
|
|
1179
|
+
const progressEventReducer = (e, t, n = 3) => {
|
|
1180
|
+
let r = 0;
|
|
1181
|
+
const o = speedometer(50, 250);
|
|
1182
|
+
return throttle((s) => {
|
|
1183
|
+
const i = s.loaded, l = s.lengthComputable ? s.total : void 0, c = i - r, u = o(c), a = i <= l;
|
|
1184
|
+
r = i;
|
|
1185
|
+
const d = {
|
|
1186
|
+
loaded: i,
|
|
1187
|
+
total: l,
|
|
1188
|
+
progress: l ? i / l : void 0,
|
|
1189
|
+
bytes: c,
|
|
1190
|
+
rate: u || void 0,
|
|
1191
|
+
estimated: u && l && a ? (l - i) / u : void 0,
|
|
1192
|
+
event: s,
|
|
1193
|
+
lengthComputable: l != null,
|
|
1194
|
+
[t ? "download" : "upload"]: !0
|
|
1195
|
+
};
|
|
1196
|
+
e(d);
|
|
1197
|
+
}, n);
|
|
1198
|
+
}, progressEventDecorator = (e, t) => {
|
|
1199
|
+
const n = e != null;
|
|
1200
|
+
return [(r) => t[0]({
|
|
1201
|
+
lengthComputable: n,
|
|
1202
|
+
total: e,
|
|
1203
|
+
loaded: r
|
|
1204
|
+
}), t[1]];
|
|
1205
|
+
}, asyncDecorator = (e) => (...t) => utils$1.asap(() => e(...t)), isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, platform.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
|
|
1206
|
+
new URL(platform.origin),
|
|
1207
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
1208
|
+
) : () => !0, cookies = platform.hasStandardBrowserEnv ? (
|
|
1209
|
+
// Standard browser envs support document.cookie
|
|
1210
|
+
{
|
|
1211
|
+
write(e, t, n, r, o, s) {
|
|
1212
|
+
const i = [e + "=" + encodeURIComponent(t)];
|
|
1213
|
+
utils$1.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), utils$1.isString(r) && i.push("path=" + r), utils$1.isString(o) && i.push("domain=" + o), s === !0 && i.push("secure"), document.cookie = i.join("; ");
|
|
1214
|
+
},
|
|
1215
|
+
read(e) {
|
|
1216
|
+
const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
|
|
1217
|
+
return t ? decodeURIComponent(t[3]) : null;
|
|
1218
|
+
},
|
|
1219
|
+
remove(e) {
|
|
1220
|
+
this.write(e, "", Date.now() - 864e5);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
) : (
|
|
1224
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1225
|
+
{
|
|
1226
|
+
write() {
|
|
1227
|
+
},
|
|
1228
|
+
read() {
|
|
1229
|
+
return null;
|
|
1230
|
+
},
|
|
1231
|
+
remove() {
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
);
|
|
1235
|
+
function isAbsoluteURL(e) {
|
|
1236
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
1237
|
+
}
|
|
1238
|
+
function combineURLs(e, t) {
|
|
1239
|
+
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
1240
|
+
}
|
|
1241
|
+
function buildFullPath(e, t, n) {
|
|
1242
|
+
let r = !isAbsoluteURL(t);
|
|
1243
|
+
return e && (r || n == !1) ? combineURLs(e, t) : t;
|
|
1244
|
+
}
|
|
1245
|
+
const headersToObject = (e) => e instanceof AxiosHeaders$1 ? { ...e } : e;
|
|
1246
|
+
function mergeConfig$1(e, t) {
|
|
1247
|
+
t = t || {};
|
|
1248
|
+
const n = {};
|
|
1249
|
+
function r(u, a, d, f) {
|
|
1250
|
+
return utils$1.isPlainObject(u) && utils$1.isPlainObject(a) ? utils$1.merge.call({ caseless: f }, u, a) : utils$1.isPlainObject(a) ? utils$1.merge({}, a) : utils$1.isArray(a) ? a.slice() : a;
|
|
1251
|
+
}
|
|
1252
|
+
function o(u, a, d, f) {
|
|
1253
|
+
if (utils$1.isUndefined(a)) {
|
|
1254
|
+
if (!utils$1.isUndefined(u))
|
|
1255
|
+
return r(void 0, u, d, f);
|
|
1256
|
+
} else return r(u, a, d, f);
|
|
1257
|
+
}
|
|
1258
|
+
function s(u, a) {
|
|
1259
|
+
if (!utils$1.isUndefined(a))
|
|
1260
|
+
return r(void 0, a);
|
|
1261
|
+
}
|
|
1262
|
+
function i(u, a) {
|
|
1263
|
+
if (utils$1.isUndefined(a)) {
|
|
1264
|
+
if (!utils$1.isUndefined(u))
|
|
1265
|
+
return r(void 0, u);
|
|
1266
|
+
} else return r(void 0, a);
|
|
1267
|
+
}
|
|
1268
|
+
function l(u, a, d) {
|
|
1269
|
+
if (d in t)
|
|
1270
|
+
return r(u, a);
|
|
1271
|
+
if (d in e)
|
|
1272
|
+
return r(void 0, u);
|
|
1273
|
+
}
|
|
1274
|
+
const c = {
|
|
1275
|
+
url: s,
|
|
1276
|
+
method: s,
|
|
1277
|
+
data: s,
|
|
1278
|
+
baseURL: i,
|
|
1279
|
+
transformRequest: i,
|
|
1280
|
+
transformResponse: i,
|
|
1281
|
+
paramsSerializer: i,
|
|
1282
|
+
timeout: i,
|
|
1283
|
+
timeoutMessage: i,
|
|
1284
|
+
withCredentials: i,
|
|
1285
|
+
withXSRFToken: i,
|
|
1286
|
+
adapter: i,
|
|
1287
|
+
responseType: i,
|
|
1288
|
+
xsrfCookieName: i,
|
|
1289
|
+
xsrfHeaderName: i,
|
|
1290
|
+
onUploadProgress: i,
|
|
1291
|
+
onDownloadProgress: i,
|
|
1292
|
+
decompress: i,
|
|
1293
|
+
maxContentLength: i,
|
|
1294
|
+
maxBodyLength: i,
|
|
1295
|
+
beforeRedirect: i,
|
|
1296
|
+
transport: i,
|
|
1297
|
+
httpAgent: i,
|
|
1298
|
+
httpsAgent: i,
|
|
1299
|
+
cancelToken: i,
|
|
1300
|
+
socketPath: i,
|
|
1301
|
+
responseEncoding: i,
|
|
1302
|
+
validateStatus: l,
|
|
1303
|
+
headers: (u, a, d) => o(headersToObject(u), headersToObject(a), d, !0)
|
|
1304
|
+
};
|
|
1305
|
+
return utils$1.forEach(Object.keys(Object.assign({}, e, t)), function(a) {
|
|
1306
|
+
const d = c[a] || o, f = d(e[a], t[a], a);
|
|
1307
|
+
utils$1.isUndefined(f) && d !== l || (n[a] = f);
|
|
1308
|
+
}), n;
|
|
1309
|
+
}
|
|
1310
|
+
const resolveConfig = (e) => {
|
|
1311
|
+
const t = mergeConfig$1({}, e);
|
|
1312
|
+
let { data: n, withXSRFToken: r, xsrfHeaderName: o, xsrfCookieName: s, headers: i, auth: l } = t;
|
|
1313
|
+
t.headers = i = AxiosHeaders$1.from(i), t.url = buildURL(buildFullPath(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), l && i.set(
|
|
1314
|
+
"Authorization",
|
|
1315
|
+
"Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : ""))
|
|
1316
|
+
);
|
|
1317
|
+
let c;
|
|
1318
|
+
if (utils$1.isFormData(n)) {
|
|
1319
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
|
|
1320
|
+
i.setContentType(void 0);
|
|
1321
|
+
else if ((c = i.getContentType()) !== !1) {
|
|
1322
|
+
const [u, ...a] = c ? c.split(";").map((d) => d.trim()).filter(Boolean) : [];
|
|
1323
|
+
i.setContentType([u || "multipart/form-data", ...a].join("; "));
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
if (platform.hasStandardBrowserEnv && (r && utils$1.isFunction(r) && (r = r(t)), r || r !== !1 && isURLSameOrigin(t.url))) {
|
|
1327
|
+
const u = o && s && cookies.read(s);
|
|
1328
|
+
u && i.set(o, u);
|
|
1329
|
+
}
|
|
1330
|
+
return t;
|
|
1331
|
+
}, isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(e) {
|
|
1332
|
+
return new Promise(function(n, r) {
|
|
1333
|
+
const o = resolveConfig(e);
|
|
1334
|
+
let s = o.data;
|
|
1335
|
+
const i = AxiosHeaders$1.from(o.headers).normalize();
|
|
1336
|
+
let { responseType: l, onUploadProgress: c, onDownloadProgress: u } = o, a, d, f, h, p;
|
|
1337
|
+
function y() {
|
|
1338
|
+
h && h(), p && p(), o.cancelToken && o.cancelToken.unsubscribe(a), o.signal && o.signal.removeEventListener("abort", a);
|
|
1339
|
+
}
|
|
1340
|
+
let m = new XMLHttpRequest();
|
|
1341
|
+
m.open(o.method.toUpperCase(), o.url, !0), m.timeout = o.timeout;
|
|
1342
|
+
function $() {
|
|
1343
|
+
if (!m)
|
|
1344
|
+
return;
|
|
1345
|
+
const x = AxiosHeaders$1.from(
|
|
1346
|
+
"getAllResponseHeaders" in m && m.getAllResponseHeaders()
|
|
1347
|
+
), k = {
|
|
1348
|
+
data: !l || l === "text" || l === "json" ? m.responseText : m.response,
|
|
1349
|
+
status: m.status,
|
|
1350
|
+
statusText: m.statusText,
|
|
1351
|
+
headers: x,
|
|
1352
|
+
config: e,
|
|
1353
|
+
request: m
|
|
1354
|
+
};
|
|
1355
|
+
settle(function(g) {
|
|
1356
|
+
n(g), y();
|
|
1357
|
+
}, function(g) {
|
|
1358
|
+
r(g), y();
|
|
1359
|
+
}, k), m = null;
|
|
1360
|
+
}
|
|
1361
|
+
"onloadend" in m ? m.onloadend = $ : m.onreadystatechange = function() {
|
|
1362
|
+
!m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout($);
|
|
1363
|
+
}, m.onabort = function() {
|
|
1364
|
+
m && (r(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, e, m)), m = null);
|
|
1365
|
+
}, m.onerror = function() {
|
|
1366
|
+
r(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, e, m)), m = null;
|
|
1367
|
+
}, m.ontimeout = function() {
|
|
1368
|
+
let _ = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
|
|
1369
|
+
const k = o.transitional || transitionalDefaults;
|
|
1370
|
+
o.timeoutErrorMessage && (_ = o.timeoutErrorMessage), r(new AxiosError$1(
|
|
1371
|
+
_,
|
|
1372
|
+
k.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
1373
|
+
e,
|
|
1374
|
+
m
|
|
1375
|
+
)), m = null;
|
|
1376
|
+
}, s === void 0 && i.setContentType(null), "setRequestHeader" in m && utils$1.forEach(i.toJSON(), function(_, k) {
|
|
1377
|
+
m.setRequestHeader(k, _);
|
|
1378
|
+
}), utils$1.isUndefined(o.withCredentials) || (m.withCredentials = !!o.withCredentials), l && l !== "json" && (m.responseType = o.responseType), u && ([f, p] = progressEventReducer(u, !0), m.addEventListener("progress", f)), c && m.upload && ([d, h] = progressEventReducer(c), m.upload.addEventListener("progress", d), m.upload.addEventListener("loadend", h)), (o.cancelToken || o.signal) && (a = (x) => {
|
|
1379
|
+
m && (r(!x || x.type ? new CanceledError$1(null, e, m) : x), m.abort(), m = null);
|
|
1380
|
+
}, o.cancelToken && o.cancelToken.subscribe(a), o.signal && (o.signal.aborted ? a() : o.signal.addEventListener("abort", a)));
|
|
1381
|
+
const w = parseProtocol(o.url);
|
|
1382
|
+
if (w && platform.protocols.indexOf(w) === -1) {
|
|
1383
|
+
r(new AxiosError$1("Unsupported protocol " + w + ":", AxiosError$1.ERR_BAD_REQUEST, e));
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
m.send(s || null);
|
|
1387
|
+
});
|
|
1388
|
+
}, composeSignals = (e, t) => {
|
|
1389
|
+
const { length: n } = e = e ? e.filter(Boolean) : [];
|
|
1390
|
+
if (t || n) {
|
|
1391
|
+
let r = new AbortController(), o;
|
|
1392
|
+
const s = function(u) {
|
|
1393
|
+
if (!o) {
|
|
1394
|
+
o = !0, l();
|
|
1395
|
+
const a = u instanceof Error ? u : this.reason;
|
|
1396
|
+
r.abort(a instanceof AxiosError$1 ? a : new CanceledError$1(a instanceof Error ? a.message : a));
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
let i = t && setTimeout(() => {
|
|
1400
|
+
i = null, s(new AxiosError$1(`timeout ${t} of ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
1401
|
+
}, t);
|
|
1402
|
+
const l = () => {
|
|
1403
|
+
e && (i && clearTimeout(i), i = null, e.forEach((u) => {
|
|
1404
|
+
u.unsubscribe ? u.unsubscribe(s) : u.removeEventListener("abort", s);
|
|
1405
|
+
}), e = null);
|
|
1406
|
+
};
|
|
1407
|
+
e.forEach((u) => u.addEventListener("abort", s));
|
|
1408
|
+
const { signal: c } = r;
|
|
1409
|
+
return c.unsubscribe = () => utils$1.asap(l), c;
|
|
1410
|
+
}
|
|
1411
|
+
}, streamChunk = function* (e, t) {
|
|
1412
|
+
let n = e.byteLength;
|
|
1413
|
+
if (n < t) {
|
|
1414
|
+
yield e;
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1417
|
+
let r = 0, o;
|
|
1418
|
+
for (; r < n; )
|
|
1419
|
+
o = r + t, yield e.slice(r, o), r = o;
|
|
1420
|
+
}, readBytes = async function* (e, t) {
|
|
1421
|
+
for await (const n of readStream(e))
|
|
1422
|
+
yield* streamChunk(n, t);
|
|
1423
|
+
}, readStream = async function* (e) {
|
|
1424
|
+
if (e[Symbol.asyncIterator]) {
|
|
1425
|
+
yield* e;
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
const t = e.getReader();
|
|
1429
|
+
try {
|
|
1430
|
+
for (; ; ) {
|
|
1431
|
+
const { done: n, value: r } = await t.read();
|
|
1432
|
+
if (n)
|
|
1433
|
+
break;
|
|
1434
|
+
yield r;
|
|
1435
|
+
}
|
|
1436
|
+
} finally {
|
|
1437
|
+
await t.cancel();
|
|
1438
|
+
}
|
|
1439
|
+
}, trackStream = (e, t, n, r) => {
|
|
1440
|
+
const o = readBytes(e, t);
|
|
1441
|
+
let s = 0, i, l = (c) => {
|
|
1442
|
+
i || (i = !0, r && r(c));
|
|
1443
|
+
};
|
|
1444
|
+
return new ReadableStream({
|
|
1445
|
+
async pull(c) {
|
|
1446
|
+
try {
|
|
1447
|
+
const { done: u, value: a } = await o.next();
|
|
1448
|
+
if (u) {
|
|
1449
|
+
l(), c.close();
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
let d = a.byteLength;
|
|
1453
|
+
if (n) {
|
|
1454
|
+
let f = s += d;
|
|
1455
|
+
n(f);
|
|
1456
|
+
}
|
|
1457
|
+
c.enqueue(new Uint8Array(a));
|
|
1458
|
+
} catch (u) {
|
|
1459
|
+
throw l(u), u;
|
|
1460
|
+
}
|
|
1461
|
+
},
|
|
1462
|
+
cancel(c) {
|
|
1463
|
+
return l(c), o.return();
|
|
1464
|
+
}
|
|
1465
|
+
}, {
|
|
1466
|
+
highWaterMark: 2
|
|
1467
|
+
});
|
|
1468
|
+
}, isFetchSupported = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", isReadableStreamSupported = isFetchSupported && typeof ReadableStream == "function", encodeText = isFetchSupported && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), test = (e, ...t) => {
|
|
1469
|
+
try {
|
|
1470
|
+
return !!e(...t);
|
|
1471
|
+
} catch {
|
|
1472
|
+
return !1;
|
|
1473
|
+
}
|
|
1474
|
+
}, supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
1475
|
+
let e = !1;
|
|
1476
|
+
const t = new Request(platform.origin, {
|
|
1477
|
+
body: new ReadableStream(),
|
|
1478
|
+
method: "POST",
|
|
1479
|
+
get duplex() {
|
|
1480
|
+
return e = !0, "half";
|
|
1481
|
+
}
|
|
1482
|
+
}).headers.has("Content-Type");
|
|
1483
|
+
return e && !t;
|
|
1484
|
+
}), DEFAULT_CHUNK_SIZE = 64 * 1024, supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body)), resolvers = {
|
|
1485
|
+
stream: supportsResponseStream && ((e) => e.body)
|
|
1486
|
+
};
|
|
1487
|
+
isFetchSupported && ((e) => {
|
|
1488
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
|
|
1489
|
+
!resolvers[t] && (resolvers[t] = utils$1.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
|
|
1490
|
+
throw new AxiosError$1(`Response type '${t}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, r);
|
|
1491
|
+
});
|
|
1492
|
+
});
|
|
1493
|
+
})(new Response());
|
|
1494
|
+
const getBodyLength = async (e) => {
|
|
1495
|
+
if (e == null)
|
|
1496
|
+
return 0;
|
|
1497
|
+
if (utils$1.isBlob(e))
|
|
1498
|
+
return e.size;
|
|
1499
|
+
if (utils$1.isSpecCompliantForm(e))
|
|
1500
|
+
return (await new Request(platform.origin, {
|
|
1501
|
+
method: "POST",
|
|
1502
|
+
body: e
|
|
1503
|
+
}).arrayBuffer()).byteLength;
|
|
1504
|
+
if (utils$1.isArrayBufferView(e) || utils$1.isArrayBuffer(e))
|
|
1505
|
+
return e.byteLength;
|
|
1506
|
+
if (utils$1.isURLSearchParams(e) && (e = e + ""), utils$1.isString(e))
|
|
1507
|
+
return (await encodeText(e)).byteLength;
|
|
1508
|
+
}, resolveBodyLength = async (e, t) => {
|
|
1509
|
+
const n = utils$1.toFiniteNumber(e.getContentLength());
|
|
1510
|
+
return n ?? getBodyLength(t);
|
|
1511
|
+
}, fetchAdapter = isFetchSupported && (async (e) => {
|
|
1512
|
+
let {
|
|
1513
|
+
url: t,
|
|
1514
|
+
method: n,
|
|
1515
|
+
data: r,
|
|
1516
|
+
signal: o,
|
|
1517
|
+
cancelToken: s,
|
|
1518
|
+
timeout: i,
|
|
1519
|
+
onDownloadProgress: l,
|
|
1520
|
+
onUploadProgress: c,
|
|
1521
|
+
responseType: u,
|
|
1522
|
+
headers: a,
|
|
1523
|
+
withCredentials: d = "same-origin",
|
|
1524
|
+
fetchOptions: f
|
|
1525
|
+
} = resolveConfig(e);
|
|
1526
|
+
u = u ? (u + "").toLowerCase() : "text";
|
|
1527
|
+
let h = composeSignals([o, s && s.toAbortSignal()], i), p;
|
|
1528
|
+
const y = h && h.unsubscribe && (() => {
|
|
1529
|
+
h.unsubscribe();
|
|
1530
|
+
});
|
|
1531
|
+
let m;
|
|
1532
|
+
try {
|
|
1533
|
+
if (c && supportsRequestStream && n !== "get" && n !== "head" && (m = await resolveBodyLength(a, r)) !== 0) {
|
|
1534
|
+
let k = new Request(t, {
|
|
1535
|
+
method: "POST",
|
|
1536
|
+
body: r,
|
|
1537
|
+
duplex: "half"
|
|
1538
|
+
}), b;
|
|
1539
|
+
if (utils$1.isFormData(r) && (b = k.headers.get("content-type")) && a.setContentType(b), k.body) {
|
|
1540
|
+
const [g, v] = progressEventDecorator(
|
|
1541
|
+
m,
|
|
1542
|
+
progressEventReducer(asyncDecorator(c))
|
|
1543
|
+
);
|
|
1544
|
+
r = trackStream(k.body, DEFAULT_CHUNK_SIZE, g, v);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
utils$1.isString(d) || (d = d ? "include" : "omit");
|
|
1548
|
+
const $ = "credentials" in Request.prototype;
|
|
1549
|
+
p = new Request(t, {
|
|
1550
|
+
...f,
|
|
1551
|
+
signal: h,
|
|
1552
|
+
method: n.toUpperCase(),
|
|
1553
|
+
headers: a.normalize().toJSON(),
|
|
1554
|
+
body: r,
|
|
1555
|
+
duplex: "half",
|
|
1556
|
+
credentials: $ ? d : void 0
|
|
1557
|
+
});
|
|
1558
|
+
let w = await fetch(p, f);
|
|
1559
|
+
const x = supportsResponseStream && (u === "stream" || u === "response");
|
|
1560
|
+
if (supportsResponseStream && (l || x && y)) {
|
|
1561
|
+
const k = {};
|
|
1562
|
+
["status", "statusText", "headers"].forEach((E) => {
|
|
1563
|
+
k[E] = w[E];
|
|
1564
|
+
});
|
|
1565
|
+
const b = utils$1.toFiniteNumber(w.headers.get("content-length")), [g, v] = l && progressEventDecorator(
|
|
1566
|
+
b,
|
|
1567
|
+
progressEventReducer(asyncDecorator(l), !0)
|
|
1568
|
+
) || [];
|
|
1569
|
+
w = new Response(
|
|
1570
|
+
trackStream(w.body, DEFAULT_CHUNK_SIZE, g, () => {
|
|
1571
|
+
v && v(), y && y();
|
|
1572
|
+
}),
|
|
1573
|
+
k
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
u = u || "text";
|
|
1577
|
+
let _ = await resolvers[utils$1.findKey(resolvers, u) || "text"](w, e);
|
|
1578
|
+
return !x && y && y(), await new Promise((k, b) => {
|
|
1579
|
+
settle(k, b, {
|
|
1580
|
+
data: _,
|
|
1581
|
+
headers: AxiosHeaders$1.from(w.headers),
|
|
1582
|
+
status: w.status,
|
|
1583
|
+
statusText: w.statusText,
|
|
1584
|
+
config: e,
|
|
1585
|
+
request: p
|
|
1586
|
+
});
|
|
1587
|
+
});
|
|
1588
|
+
} catch ($) {
|
|
1589
|
+
throw y && y(), $ && $.name === "TypeError" && /Load failed|fetch/i.test($.message) ? Object.assign(
|
|
1590
|
+
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, e, p),
|
|
1591
|
+
{
|
|
1592
|
+
cause: $.cause || $
|
|
1593
|
+
}
|
|
1594
|
+
) : AxiosError$1.from($, $ && $.code, e, p);
|
|
1595
|
+
}
|
|
1596
|
+
}), knownAdapters = {
|
|
1597
|
+
http: httpAdapter,
|
|
1598
|
+
xhr: xhrAdapter,
|
|
1599
|
+
fetch: fetchAdapter
|
|
1600
|
+
};
|
|
1601
|
+
utils$1.forEach(knownAdapters, (e, t) => {
|
|
1602
|
+
if (e) {
|
|
1603
|
+
try {
|
|
1604
|
+
Object.defineProperty(e, "name", { value: t });
|
|
1605
|
+
} catch {
|
|
1606
|
+
}
|
|
1607
|
+
Object.defineProperty(e, "adapterName", { value: t });
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
const renderReason = (e) => `- ${e}`, isResolvedHandle = (e) => utils$1.isFunction(e) || e === null || e === !1, adapters = {
|
|
1611
|
+
getAdapter: (e) => {
|
|
1612
|
+
e = utils$1.isArray(e) ? e : [e];
|
|
1613
|
+
const { length: t } = e;
|
|
1614
|
+
let n, r;
|
|
1615
|
+
const o = {};
|
|
1616
|
+
for (let s = 0; s < t; s++) {
|
|
1617
|
+
n = e[s];
|
|
1618
|
+
let i;
|
|
1619
|
+
if (r = n, !isResolvedHandle(n) && (r = knownAdapters[(i = String(n)).toLowerCase()], r === void 0))
|
|
1620
|
+
throw new AxiosError$1(`Unknown adapter '${i}'`);
|
|
1621
|
+
if (r)
|
|
1622
|
+
break;
|
|
1623
|
+
o[i || "#" + s] = r;
|
|
1624
|
+
}
|
|
1625
|
+
if (!r) {
|
|
1626
|
+
const s = Object.entries(o).map(
|
|
1627
|
+
([l, c]) => `adapter ${l} ` + (c === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1628
|
+
);
|
|
1629
|
+
let i = t ? s.length > 1 ? `since :
|
|
1630
|
+
` + s.map(renderReason).join(`
|
|
1631
|
+
`) : " " + renderReason(s[0]) : "as no adapter specified";
|
|
1632
|
+
throw new AxiosError$1(
|
|
1633
|
+
"There is no suitable adapter to dispatch the request " + i,
|
|
1634
|
+
"ERR_NOT_SUPPORT"
|
|
1635
|
+
);
|
|
1636
|
+
}
|
|
1637
|
+
return r;
|
|
1638
|
+
},
|
|
1639
|
+
adapters: knownAdapters
|
|
1640
|
+
};
|
|
1641
|
+
function throwIfCancellationRequested(e) {
|
|
1642
|
+
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1643
|
+
throw new CanceledError$1(null, e);
|
|
1644
|
+
}
|
|
1645
|
+
function dispatchRequest(e) {
|
|
1646
|
+
return throwIfCancellationRequested(e), e.headers = AxiosHeaders$1.from(e.headers), e.data = transformData.call(
|
|
1647
|
+
e,
|
|
1648
|
+
e.transformRequest
|
|
1649
|
+
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(e.adapter || defaults.adapter)(e).then(function(r) {
|
|
1650
|
+
return throwIfCancellationRequested(e), r.data = transformData.call(
|
|
1651
|
+
e,
|
|
1652
|
+
e.transformResponse,
|
|
1653
|
+
r
|
|
1654
|
+
), r.headers = AxiosHeaders$1.from(r.headers), r;
|
|
1655
|
+
}, function(r) {
|
|
1656
|
+
return isCancel$1(r) || (throwIfCancellationRequested(e), r && r.response && (r.response.data = transformData.call(
|
|
1657
|
+
e,
|
|
1658
|
+
e.transformResponse,
|
|
1659
|
+
r.response
|
|
1660
|
+
), r.response.headers = AxiosHeaders$1.from(r.response.headers))), Promise.reject(r);
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
const VERSION$1 = "1.10.0", validators$1 = {};
|
|
1664
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
|
|
1665
|
+
validators$1[e] = function(r) {
|
|
1666
|
+
return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
1667
|
+
};
|
|
1668
|
+
});
|
|
1669
|
+
const deprecatedWarnings = {};
|
|
1670
|
+
validators$1.transitional = function(t, n, r) {
|
|
1671
|
+
function o(s, i) {
|
|
1672
|
+
return "[Axios v" + VERSION$1 + "] Transitional option '" + s + "'" + i + (r ? ". " + r : "");
|
|
1673
|
+
}
|
|
1674
|
+
return (s, i, l) => {
|
|
1675
|
+
if (t === !1)
|
|
1676
|
+
throw new AxiosError$1(
|
|
1677
|
+
o(i, " has been removed" + (n ? " in " + n : "")),
|
|
1678
|
+
AxiosError$1.ERR_DEPRECATED
|
|
1679
|
+
);
|
|
1680
|
+
return n && !deprecatedWarnings[i] && (deprecatedWarnings[i] = !0, console.warn(
|
|
1681
|
+
o(
|
|
1682
|
+
i,
|
|
1683
|
+
" has been deprecated since v" + n + " and will be removed in the near future"
|
|
1684
|
+
)
|
|
1685
|
+
)), t ? t(s, i, l) : !0;
|
|
1686
|
+
};
|
|
1687
|
+
};
|
|
1688
|
+
validators$1.spelling = function(t) {
|
|
1689
|
+
return (n, r) => (console.warn(`${r} is likely a misspelling of ${t}`), !0);
|
|
1690
|
+
};
|
|
1691
|
+
function assertOptions(e, t, n) {
|
|
1692
|
+
if (typeof e != "object")
|
|
1693
|
+
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
1694
|
+
const r = Object.keys(e);
|
|
1695
|
+
let o = r.length;
|
|
1696
|
+
for (; o-- > 0; ) {
|
|
1697
|
+
const s = r[o], i = t[s];
|
|
1698
|
+
if (i) {
|
|
1699
|
+
const l = e[s], c = l === void 0 || i(l, s, e);
|
|
1700
|
+
if (c !== !0)
|
|
1701
|
+
throw new AxiosError$1("option " + s + " must be " + c, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
1702
|
+
continue;
|
|
1703
|
+
}
|
|
1704
|
+
if (n !== !0)
|
|
1705
|
+
throw new AxiosError$1("Unknown option " + s, AxiosError$1.ERR_BAD_OPTION);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
const validator = {
|
|
1709
|
+
assertOptions,
|
|
1710
|
+
validators: validators$1
|
|
1711
|
+
}, validators = validator.validators;
|
|
1712
|
+
let Axios$1 = class {
|
|
1713
|
+
constructor(t) {
|
|
1714
|
+
this.defaults = t || {}, this.interceptors = {
|
|
1715
|
+
request: new InterceptorManager(),
|
|
1716
|
+
response: new InterceptorManager()
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Dispatch a request
|
|
1721
|
+
*
|
|
1722
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
1723
|
+
* @param {?Object} config
|
|
1724
|
+
*
|
|
1725
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
1726
|
+
*/
|
|
1727
|
+
async request(t, n) {
|
|
1728
|
+
try {
|
|
1729
|
+
return await this._request(t, n);
|
|
1730
|
+
} catch (r) {
|
|
1731
|
+
if (r instanceof Error) {
|
|
1732
|
+
let o = {};
|
|
1733
|
+
Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
|
|
1734
|
+
const s = o.stack ? o.stack.replace(/^.+\n/, "") : "";
|
|
1735
|
+
try {
|
|
1736
|
+
r.stack ? s && !String(r.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (r.stack += `
|
|
1737
|
+
` + s) : r.stack = s;
|
|
1738
|
+
} catch {
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
throw r;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
_request(t, n) {
|
|
1745
|
+
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = mergeConfig$1(this.defaults, n);
|
|
1746
|
+
const { transitional: r, paramsSerializer: o, headers: s } = n;
|
|
1747
|
+
r !== void 0 && validator.assertOptions(r, {
|
|
1748
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
1749
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
1750
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
1751
|
+
}, !1), o != null && (utils$1.isFunction(o) ? n.paramsSerializer = {
|
|
1752
|
+
serialize: o
|
|
1753
|
+
} : validator.assertOptions(o, {
|
|
1754
|
+
encode: validators.function,
|
|
1755
|
+
serialize: validators.function
|
|
1756
|
+
}, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), validator.assertOptions(n, {
|
|
1757
|
+
baseUrl: validators.spelling("baseURL"),
|
|
1758
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
1759
|
+
}, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
1760
|
+
let i = s && utils$1.merge(
|
|
1761
|
+
s.common,
|
|
1762
|
+
s[n.method]
|
|
1763
|
+
);
|
|
1764
|
+
s && utils$1.forEach(
|
|
1765
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1766
|
+
(p) => {
|
|
1767
|
+
delete s[p];
|
|
1768
|
+
}
|
|
1769
|
+
), n.headers = AxiosHeaders$1.concat(i, s);
|
|
1770
|
+
const l = [];
|
|
1771
|
+
let c = !0;
|
|
1772
|
+
this.interceptors.request.forEach(function(y) {
|
|
1773
|
+
typeof y.runWhen == "function" && y.runWhen(n) === !1 || (c = c && y.synchronous, l.unshift(y.fulfilled, y.rejected));
|
|
1774
|
+
});
|
|
1775
|
+
const u = [];
|
|
1776
|
+
this.interceptors.response.forEach(function(y) {
|
|
1777
|
+
u.push(y.fulfilled, y.rejected);
|
|
1778
|
+
});
|
|
1779
|
+
let a, d = 0, f;
|
|
1780
|
+
if (!c) {
|
|
1781
|
+
const p = [dispatchRequest.bind(this), void 0];
|
|
1782
|
+
for (p.unshift.apply(p, l), p.push.apply(p, u), f = p.length, a = Promise.resolve(n); d < f; )
|
|
1783
|
+
a = a.then(p[d++], p[d++]);
|
|
1784
|
+
return a;
|
|
1785
|
+
}
|
|
1786
|
+
f = l.length;
|
|
1787
|
+
let h = n;
|
|
1788
|
+
for (d = 0; d < f; ) {
|
|
1789
|
+
const p = l[d++], y = l[d++];
|
|
1790
|
+
try {
|
|
1791
|
+
h = p(h);
|
|
1792
|
+
} catch (m) {
|
|
1793
|
+
y.call(this, m);
|
|
1794
|
+
break;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
try {
|
|
1798
|
+
a = dispatchRequest.call(this, h);
|
|
1799
|
+
} catch (p) {
|
|
1800
|
+
return Promise.reject(p);
|
|
1801
|
+
}
|
|
1802
|
+
for (d = 0, f = u.length; d < f; )
|
|
1803
|
+
a = a.then(u[d++], u[d++]);
|
|
1804
|
+
return a;
|
|
1805
|
+
}
|
|
1806
|
+
getUri(t) {
|
|
1807
|
+
t = mergeConfig$1(this.defaults, t);
|
|
1808
|
+
const n = buildFullPath(t.baseURL, t.url, t.allowAbsoluteUrls);
|
|
1809
|
+
return buildURL(n, t.params, t.paramsSerializer);
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
utils$1.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1813
|
+
Axios$1.prototype[t] = function(n, r) {
|
|
1814
|
+
return this.request(mergeConfig$1(r || {}, {
|
|
1815
|
+
method: t,
|
|
1816
|
+
url: n,
|
|
1817
|
+
data: (r || {}).data
|
|
1818
|
+
}));
|
|
1819
|
+
};
|
|
1820
|
+
});
|
|
1821
|
+
utils$1.forEach(["post", "put", "patch"], function(t) {
|
|
1822
|
+
function n(r) {
|
|
1823
|
+
return function(s, i, l) {
|
|
1824
|
+
return this.request(mergeConfig$1(l || {}, {
|
|
1825
|
+
method: t,
|
|
1826
|
+
headers: r ? {
|
|
1827
|
+
"Content-Type": "multipart/form-data"
|
|
1828
|
+
} : {},
|
|
1829
|
+
url: s,
|
|
1830
|
+
data: i
|
|
1831
|
+
}));
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
Axios$1.prototype[t] = n(), Axios$1.prototype[t + "Form"] = n(!0);
|
|
1835
|
+
});
|
|
1836
|
+
let CancelToken$1 = class C {
|
|
1837
|
+
constructor(t) {
|
|
1838
|
+
if (typeof t != "function")
|
|
1839
|
+
throw new TypeError("executor must be a function.");
|
|
1840
|
+
let n;
|
|
1841
|
+
this.promise = new Promise(function(s) {
|
|
1842
|
+
n = s;
|
|
1843
|
+
});
|
|
1844
|
+
const r = this;
|
|
1845
|
+
this.promise.then((o) => {
|
|
1846
|
+
if (!r._listeners) return;
|
|
1847
|
+
let s = r._listeners.length;
|
|
1848
|
+
for (; s-- > 0; )
|
|
1849
|
+
r._listeners[s](o);
|
|
1850
|
+
r._listeners = null;
|
|
1851
|
+
}), this.promise.then = (o) => {
|
|
1852
|
+
let s;
|
|
1853
|
+
const i = new Promise((l) => {
|
|
1854
|
+
r.subscribe(l), s = l;
|
|
1855
|
+
}).then(o);
|
|
1856
|
+
return i.cancel = function() {
|
|
1857
|
+
r.unsubscribe(s);
|
|
1858
|
+
}, i;
|
|
1859
|
+
}, t(function(s, i, l) {
|
|
1860
|
+
r.reason || (r.reason = new CanceledError$1(s, i, l), n(r.reason));
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
1865
|
+
*/
|
|
1866
|
+
throwIfRequested() {
|
|
1867
|
+
if (this.reason)
|
|
1868
|
+
throw this.reason;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Subscribe to the cancel signal
|
|
1872
|
+
*/
|
|
1873
|
+
subscribe(t) {
|
|
1874
|
+
if (this.reason) {
|
|
1875
|
+
t(this.reason);
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
this._listeners ? this._listeners.push(t) : this._listeners = [t];
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Unsubscribe from the cancel signal
|
|
1882
|
+
*/
|
|
1883
|
+
unsubscribe(t) {
|
|
1884
|
+
if (!this._listeners)
|
|
1885
|
+
return;
|
|
1886
|
+
const n = this._listeners.indexOf(t);
|
|
1887
|
+
n !== -1 && this._listeners.splice(n, 1);
|
|
1888
|
+
}
|
|
1889
|
+
toAbortSignal() {
|
|
1890
|
+
const t = new AbortController(), n = (r) => {
|
|
1891
|
+
t.abort(r);
|
|
1892
|
+
};
|
|
1893
|
+
return this.subscribe(n), t.signal.unsubscribe = () => this.unsubscribe(n), t.signal;
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1897
|
+
* cancels the `CancelToken`.
|
|
1898
|
+
*/
|
|
1899
|
+
static source() {
|
|
1900
|
+
let t;
|
|
1901
|
+
return {
|
|
1902
|
+
token: new C(function(o) {
|
|
1903
|
+
t = o;
|
|
1904
|
+
}),
|
|
1905
|
+
cancel: t
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
function spread$1(e) {
|
|
1910
|
+
return function(n) {
|
|
1911
|
+
return e.apply(null, n);
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
function isAxiosError$1(e) {
|
|
1915
|
+
return utils$1.isObject(e) && e.isAxiosError === !0;
|
|
1916
|
+
}
|
|
1917
|
+
const HttpStatusCode$1 = {
|
|
1918
|
+
Continue: 100,
|
|
1919
|
+
SwitchingProtocols: 101,
|
|
1920
|
+
Processing: 102,
|
|
1921
|
+
EarlyHints: 103,
|
|
1922
|
+
Ok: 200,
|
|
1923
|
+
Created: 201,
|
|
1924
|
+
Accepted: 202,
|
|
1925
|
+
NonAuthoritativeInformation: 203,
|
|
1926
|
+
NoContent: 204,
|
|
1927
|
+
ResetContent: 205,
|
|
1928
|
+
PartialContent: 206,
|
|
1929
|
+
MultiStatus: 207,
|
|
1930
|
+
AlreadyReported: 208,
|
|
1931
|
+
ImUsed: 226,
|
|
1932
|
+
MultipleChoices: 300,
|
|
1933
|
+
MovedPermanently: 301,
|
|
1934
|
+
Found: 302,
|
|
1935
|
+
SeeOther: 303,
|
|
1936
|
+
NotModified: 304,
|
|
1937
|
+
UseProxy: 305,
|
|
1938
|
+
Unused: 306,
|
|
1939
|
+
TemporaryRedirect: 307,
|
|
1940
|
+
PermanentRedirect: 308,
|
|
1941
|
+
BadRequest: 400,
|
|
1942
|
+
Unauthorized: 401,
|
|
1943
|
+
PaymentRequired: 402,
|
|
1944
|
+
Forbidden: 403,
|
|
1945
|
+
NotFound: 404,
|
|
1946
|
+
MethodNotAllowed: 405,
|
|
1947
|
+
NotAcceptable: 406,
|
|
1948
|
+
ProxyAuthenticationRequired: 407,
|
|
1949
|
+
RequestTimeout: 408,
|
|
1950
|
+
Conflict: 409,
|
|
1951
|
+
Gone: 410,
|
|
1952
|
+
LengthRequired: 411,
|
|
1953
|
+
PreconditionFailed: 412,
|
|
1954
|
+
PayloadTooLarge: 413,
|
|
1955
|
+
UriTooLong: 414,
|
|
1956
|
+
UnsupportedMediaType: 415,
|
|
1957
|
+
RangeNotSatisfiable: 416,
|
|
1958
|
+
ExpectationFailed: 417,
|
|
1959
|
+
ImATeapot: 418,
|
|
1960
|
+
MisdirectedRequest: 421,
|
|
1961
|
+
UnprocessableEntity: 422,
|
|
1962
|
+
Locked: 423,
|
|
1963
|
+
FailedDependency: 424,
|
|
1964
|
+
TooEarly: 425,
|
|
1965
|
+
UpgradeRequired: 426,
|
|
1966
|
+
PreconditionRequired: 428,
|
|
1967
|
+
TooManyRequests: 429,
|
|
1968
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
1969
|
+
UnavailableForLegalReasons: 451,
|
|
1970
|
+
InternalServerError: 500,
|
|
1971
|
+
NotImplemented: 501,
|
|
1972
|
+
BadGateway: 502,
|
|
1973
|
+
ServiceUnavailable: 503,
|
|
1974
|
+
GatewayTimeout: 504,
|
|
1975
|
+
HttpVersionNotSupported: 505,
|
|
1976
|
+
VariantAlsoNegotiates: 506,
|
|
1977
|
+
InsufficientStorage: 507,
|
|
1978
|
+
LoopDetected: 508,
|
|
1979
|
+
NotExtended: 510,
|
|
1980
|
+
NetworkAuthenticationRequired: 511
|
|
1981
|
+
};
|
|
1982
|
+
Object.entries(HttpStatusCode$1).forEach(([e, t]) => {
|
|
1983
|
+
HttpStatusCode$1[t] = e;
|
|
1984
|
+
});
|
|
1985
|
+
function createInstance(e) {
|
|
1986
|
+
const t = new Axios$1(e), n = bind(Axios$1.prototype.request, t);
|
|
1987
|
+
return utils$1.extend(n, Axios$1.prototype, t, { allOwnKeys: !0 }), utils$1.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(o) {
|
|
1988
|
+
return createInstance(mergeConfig$1(e, o));
|
|
1989
|
+
}, n;
|
|
1990
|
+
}
|
|
1991
|
+
const axios = createInstance(defaults);
|
|
1992
|
+
axios.Axios = Axios$1;
|
|
1993
|
+
axios.CanceledError = CanceledError$1;
|
|
1994
|
+
axios.CancelToken = CancelToken$1;
|
|
1995
|
+
axios.isCancel = isCancel$1;
|
|
1996
|
+
axios.VERSION = VERSION$1;
|
|
1997
|
+
axios.toFormData = toFormData$1;
|
|
1998
|
+
axios.AxiosError = AxiosError$1;
|
|
1999
|
+
axios.Cancel = axios.CanceledError;
|
|
2000
|
+
axios.all = function(t) {
|
|
2001
|
+
return Promise.all(t);
|
|
2002
|
+
};
|
|
2003
|
+
axios.spread = spread$1;
|
|
2004
|
+
axios.isAxiosError = isAxiosError$1;
|
|
2005
|
+
axios.mergeConfig = mergeConfig$1;
|
|
2006
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
2007
|
+
axios.formToJSON = (e) => formDataToJSON(utils$1.isHTMLForm(e) ? new FormData(e) : e);
|
|
2008
|
+
axios.getAdapter = adapters.getAdapter;
|
|
2009
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
2010
|
+
axios.default = axios;
|
|
2011
|
+
const {
|
|
2012
|
+
Axios,
|
|
2013
|
+
AxiosError,
|
|
2014
|
+
CanceledError,
|
|
2015
|
+
isCancel,
|
|
2016
|
+
CancelToken,
|
|
2017
|
+
VERSION,
|
|
2018
|
+
all,
|
|
2019
|
+
Cancel,
|
|
2020
|
+
isAxiosError,
|
|
2021
|
+
spread,
|
|
2022
|
+
toFormData,
|
|
2023
|
+
AxiosHeaders,
|
|
2024
|
+
HttpStatusCode,
|
|
2025
|
+
formToJSON,
|
|
2026
|
+
getAdapter,
|
|
2027
|
+
mergeConfig
|
|
2028
|
+
} = axios, _export_sfc = (e, t) => {
|
|
2029
|
+
const n = e.__vccOpts || e;
|
|
2030
|
+
for (const [r, o] of t)
|
|
2031
|
+
n[r] = o;
|
|
2032
|
+
return n;
|
|
2033
|
+
}, _sfc_main$q = {}, _hoisted_1$m = {
|
|
2034
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2035
|
+
viewBox: "0 0 24 24",
|
|
2036
|
+
fill: "none",
|
|
2037
|
+
stroke: "currentColor",
|
|
2038
|
+
"stroke-width": "4",
|
|
2039
|
+
"stroke-linecap": "round",
|
|
2040
|
+
"stroke-linejoin": "round",
|
|
2041
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-check"
|
|
2042
|
+
};
|
|
2043
|
+
function _sfc_render$b(e, t) {
|
|
2044
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$m, t[0] || (t[0] = [
|
|
2045
|
+
createElementVNode("path", {
|
|
2046
|
+
stroke: "none",
|
|
2047
|
+
d: "M0 0h24v24H0z",
|
|
2048
|
+
fill: "none"
|
|
2049
|
+
}, null, -1),
|
|
2050
|
+
createElementVNode("path", { d: "M5 12l5 5l10 -10" }, null, -1)
|
|
2051
|
+
]));
|
|
2052
|
+
}
|
|
2053
|
+
const IconCheck = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$b]]), _sfc_main$p = {}, _hoisted_1$l = {
|
|
2054
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2055
|
+
viewBox: "0 0 24 24",
|
|
2056
|
+
fill: "none",
|
|
2057
|
+
stroke: "currentColor",
|
|
2058
|
+
"stroke-width": "2",
|
|
2059
|
+
"stroke-linecap": "round",
|
|
2060
|
+
"stroke-linejoin": "round",
|
|
2061
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"
|
|
2062
|
+
};
|
|
2063
|
+
function _sfc_render$a(e, t) {
|
|
2064
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$l, t[0] || (t[0] = [
|
|
2065
|
+
createElementVNode("path", {
|
|
2066
|
+
stroke: "none",
|
|
2067
|
+
d: "M0 0h24v24H0z",
|
|
2068
|
+
fill: "none"
|
|
2069
|
+
}, null, -1),
|
|
2070
|
+
createElementVNode("path", { d: "M6 9l6 6l6 -6" }, null, -1)
|
|
2071
|
+
]));
|
|
2072
|
+
}
|
|
2073
|
+
const IconChevronDown = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$a]]), _sfc_main$o = {}, _hoisted_1$k = {
|
|
2074
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2075
|
+
viewBox: "0 0 24 24",
|
|
2076
|
+
fill: "none",
|
|
2077
|
+
stroke: "currentColor",
|
|
2078
|
+
"stroke-width": "2",
|
|
2079
|
+
"stroke-linecap": "round",
|
|
2080
|
+
"stroke-linejoin": "round"
|
|
2081
|
+
};
|
|
2082
|
+
function _sfc_render$9(e, t) {
|
|
2083
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$k, t[0] || (t[0] = [
|
|
2084
|
+
createElementVNode("path", { d: "m7 15 5 5 5-5" }, null, -1),
|
|
2085
|
+
createElementVNode("path", { d: "m7 9 5-5 5 5" }, null, -1)
|
|
2086
|
+
]));
|
|
2087
|
+
}
|
|
2088
|
+
const IconChevronTopBottom = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$9]]), _sfc_main$n = {}, _hoisted_1$j = {
|
|
2089
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2090
|
+
viewBox: "0 0 24 24",
|
|
2091
|
+
fill: "none",
|
|
2092
|
+
stroke: "currentColor",
|
|
2093
|
+
"stroke-width": "2",
|
|
2094
|
+
"stroke-linecap": "round",
|
|
2095
|
+
"stroke-linejoin": "round",
|
|
2096
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-x"
|
|
2097
|
+
};
|
|
2098
|
+
function _sfc_render$8(e, t) {
|
|
2099
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$j, t[0] || (t[0] = [
|
|
2100
|
+
createElementVNode("path", {
|
|
2101
|
+
stroke: "none",
|
|
2102
|
+
d: "M0 0h24v24H0z",
|
|
2103
|
+
fill: "none"
|
|
2104
|
+
}, null, -1),
|
|
2105
|
+
createElementVNode("path", { d: "M18 6l-12 12" }, null, -1),
|
|
2106
|
+
createElementVNode("path", { d: "M6 6l12 12" }, null, -1)
|
|
2107
|
+
]));
|
|
2108
|
+
}
|
|
2109
|
+
const IconClose = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$8]]), dynamicPosition = async (e, t, n, r = 10) => {
|
|
2110
|
+
if (!t || !n) return;
|
|
2111
|
+
await nextTick();
|
|
2112
|
+
const o = await n?.getBoundingClientRect(), s = await t?.getBoundingClientRect();
|
|
2113
|
+
if (!s || !o) return;
|
|
2114
|
+
const i = await parseInt(t?.getBoundingClientRect()?.height.toString()), l = await parseInt(t?.getBoundingClientRect()?.width.toString()), c = await parseInt(n?.getBoundingClientRect()?.height.toString()), u = await parseInt(n?.getBoundingClientRect()?.width.toString()), a = await window.innerHeight, d = await window.innerWidth;
|
|
2115
|
+
let f = 0, h = 0;
|
|
2116
|
+
const p = s.bottom + r + c;
|
|
2117
|
+
switch (e) {
|
|
2118
|
+
case "top":
|
|
2119
|
+
s.top - o.height - r < 0 ? f = s.top - o.height + r + c + i : f = s.top - o.height - r, d > u + s.right + 30 ? h = s.left - o.width / 2 + s.width / 2 : h = d - 30 - u;
|
|
2120
|
+
break;
|
|
2121
|
+
case "bottom":
|
|
2122
|
+
a > p ? f = s.bottom + r : f = s.bottom - r - c - i, h = s.left - o.width / 2 + s.width / 2;
|
|
2123
|
+
break;
|
|
2124
|
+
case "left":
|
|
2125
|
+
f = s.top - o.height / 2 + s.height / 2, s.left - o.width - r > 0 ? h = s.left - o.width - r : h = 10;
|
|
2126
|
+
break;
|
|
2127
|
+
case "right":
|
|
2128
|
+
f = s.top - o.height / 2 + s.height / 2, d - l > u ? h = s.right + r : h = d - 30 - u;
|
|
2129
|
+
break;
|
|
2130
|
+
case "top-right":
|
|
2131
|
+
s.top - o.height - r < 0 ? f = s.top - o.height + r + c + i : f = s.top - o.height - r, d - l > u ? h = s.right + r : h = d - 30 - u;
|
|
2132
|
+
break;
|
|
2133
|
+
case "top-left":
|
|
2134
|
+
s.top - o.height - r < 0 ? f = s.top - o.height + r + c + i : f = s.top - o.height - r, s.left - o.width - r > 0 ? h = s.left - o.width - r : h = 10;
|
|
2135
|
+
break;
|
|
2136
|
+
case "top-start":
|
|
2137
|
+
s.top - o.height - r < 0 ? f = s.top - o.height + r + c + i : f = s.top - o.height - r, s.left > 0 ? h = s.left : h = 10;
|
|
2138
|
+
break;
|
|
2139
|
+
case "bottom-right":
|
|
2140
|
+
a > p ? f = s.bottom + r : f = s.bottom - r - c - i, d - l > u ? h = s.left : h = d - 30 - u;
|
|
2141
|
+
break;
|
|
2142
|
+
case "bottom-left":
|
|
2143
|
+
a > p ? f = s.bottom + r : f = s.bottom - r - c - i, s.left > 0 ? h = s.right - u : h = 10;
|
|
2144
|
+
break;
|
|
2145
|
+
case "bottom-start":
|
|
2146
|
+
a > p ? f = s.bottom + r : f = s.bottom - r - c - i, s.left > 0 ? h = s.left : h = 10;
|
|
2147
|
+
break;
|
|
2148
|
+
}
|
|
2149
|
+
f + c > a ? f = a - c - r : f < 0 && (f = r), h + u > d ? h = d - u - r : h < 0 && (h = r), n instanceof HTMLElement && (n.style.top = `${f}px`, n.style.left = `${h}px`, n.style.position = "fixed");
|
|
2150
|
+
}, _hoisted_1$i = ["disabled"], _hoisted_2$5 = { key: 1 }, _hoisted_3$2 = {
|
|
2151
|
+
key: 2,
|
|
2152
|
+
class: "text-gray-400"
|
|
2153
|
+
}, _hoisted_4$2 = { class: "absolute top-[50%] text-gray-500 translate-y-[-50%] right-[10px] pointer-events-none" }, _hoisted_5 = ["onClick"], _hoisted_6 = { class: "flex items-center gap-[8px] w-full" }, _hoisted_7 = { key: 1 }, _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
2154
|
+
__name: "vs-input-select",
|
|
2155
|
+
props: /* @__PURE__ */ mergeModels({
|
|
2156
|
+
placeholder: { default: "Оберіть значення" },
|
|
2157
|
+
prefix: { default: "api" },
|
|
2158
|
+
host: { default: "" },
|
|
2159
|
+
data: { default: null },
|
|
2160
|
+
options: { default: () => [] },
|
|
2161
|
+
maxHeight: { default: 400 },
|
|
2162
|
+
slots: { default: null },
|
|
2163
|
+
customClass: { default: "" },
|
|
2164
|
+
style: { default: () => ({}) },
|
|
2165
|
+
disabled: { type: Boolean }
|
|
2166
|
+
}, {
|
|
2167
|
+
modelValue: {
|
|
2168
|
+
type: [Number, String],
|
|
2169
|
+
default: null
|
|
2170
|
+
},
|
|
2171
|
+
modelModifiers: {}
|
|
2172
|
+
}),
|
|
2173
|
+
emits: ["update:modelValue"],
|
|
2174
|
+
setup(e) {
|
|
2175
|
+
const t = e, { inputClass: n } = useStyle(t.style), r = useModel(e, "modelValue"), o = ref({}), s = ref(null), i = ref(null), l = ref(!1), c = ref(null), u = ref([]), a = ref(-1), d = ref([]), f = computed(() => u.value?.length ? [
|
|
2176
|
+
c.value,
|
|
2177
|
+
...u.value?.filter((b) => b?.id !== c.value?.id)
|
|
2178
|
+
].filter((b) => b !== null) : []), h = async () => {
|
|
2179
|
+
try {
|
|
2180
|
+
const { data: b } = await axios.get(
|
|
2181
|
+
`${t.host}/${t.prefix}/suggest/${t.data}?json=1`
|
|
2182
|
+
);
|
|
2183
|
+
return b.data;
|
|
2184
|
+
} catch {
|
|
2185
|
+
return [];
|
|
2186
|
+
}
|
|
2187
|
+
}, p = async (b) => {
|
|
2188
|
+
document.body.click(), l.value = b !== void 0 ? b : !l.value, l.value && !u.value?.length && (!t.options?.length && t.data ? u.value = await h() : t.options?.length && (u.value = [...t.options])), l.value && s.value ? (o.value.width = `${s.value.getBoundingClientRect()?.width}px`, i.value && dynamicPosition("bottom-start", s.value, i.value)) : a.value = -1;
|
|
2189
|
+
}, y = () => l.value ? p(!1) : null, m = (b) => {
|
|
2190
|
+
c.value = b, r.value = b.id, p(!1);
|
|
2191
|
+
}, $ = (b, g) => {
|
|
2192
|
+
if (!b || !g) return;
|
|
2193
|
+
const v = b.offsetTop, E = v + b.offsetHeight, S = g.scrollTop, B = S + g.clientHeight;
|
|
2194
|
+
v < S ? g.scrollTop = v - 80 : E > B && (g.scrollTop = E - g.clientHeight + 4);
|
|
2195
|
+
}, w = (b) => {
|
|
2196
|
+
if (!l.value) return;
|
|
2197
|
+
const { keyCode: g } = b;
|
|
2198
|
+
if ([38, 40, 13].includes(g) && b.preventDefault(), g == 38) {
|
|
2199
|
+
if (a.value == 0) return;
|
|
2200
|
+
a.value -= 1, $(d.value[a.value], i.value);
|
|
2201
|
+
} else if (g == 40) {
|
|
2202
|
+
if (a.value + 1 >= f.value?.length) return;
|
|
2203
|
+
a.value += 1, $(d.value[a.value], i.value);
|
|
2204
|
+
} else if (g == 13) {
|
|
2205
|
+
const v = f.value[a.value];
|
|
2206
|
+
v && m(v);
|
|
2207
|
+
}
|
|
2208
|
+
}, x = async (b) => {
|
|
2209
|
+
if (l.value) return;
|
|
2210
|
+
const { keyCode: g } = b;
|
|
2211
|
+
[38, 40].includes(g) && (await b.preventDefault(), a.value = 0, setTimeout(() => p()));
|
|
2212
|
+
}, _ = (b) => {
|
|
2213
|
+
l.value && s.value && i.value && !i.value.contains(b.target) && (l.value = !1);
|
|
2214
|
+
}, k = (b) => {
|
|
2215
|
+
b?.key === "Escape" && l.value && p(!1);
|
|
2216
|
+
};
|
|
2217
|
+
return onMounted(async () => {
|
|
2218
|
+
addEventListener("click", y), addEventListener("keydown", w), addEventListener("scroll", _, !0), addEventListener("keydown", k), r.value && !t.options?.length && t.data && (u.value = await h(), c.value = u.value?.find((b) => b?.id === r.value) || null);
|
|
2219
|
+
}), onUnmounted(() => {
|
|
2220
|
+
removeEventListener("click", y), removeEventListener("keydown", w), removeEventListener("scroll", _, !0), removeEventListener("keydown", k);
|
|
2221
|
+
}), (b, g) => (openBlock(), createElementBlock("div", {
|
|
2222
|
+
class: "relative w-full",
|
|
2223
|
+
ref_key: "select",
|
|
2224
|
+
ref: s,
|
|
2225
|
+
onClick: g[3] || (g[3] = withModifiers(() => {
|
|
2226
|
+
}, ["stop"]))
|
|
2227
|
+
}, [
|
|
2228
|
+
createElementVNode("button", {
|
|
2229
|
+
type: "button",
|
|
2230
|
+
class: normalizeClass(["block w-full flex items-center gap-[8px] pl-[16px] pr-[60px] bg-white w-[calc(100%)] overflow-ellipsis", [
|
|
2231
|
+
l.value ? `ring-rind ring-2 ring-${b.style?.primaryColor || "blue"}-500` : "",
|
|
2232
|
+
unref(n),
|
|
2233
|
+
b.customClass
|
|
2234
|
+
]]),
|
|
2235
|
+
onKeydown: x,
|
|
2236
|
+
onClick: g[0] || (g[0] = (v) => p(!l.value)),
|
|
2237
|
+
disabled: b.disabled,
|
|
2238
|
+
style: {
|
|
2239
|
+
border: "1px solid #e0e0e0"
|
|
2240
|
+
}
|
|
2241
|
+
}, [
|
|
2242
|
+
c.value?.color ? (openBlock(), createElementBlock("span", {
|
|
2243
|
+
key: 0,
|
|
2244
|
+
class: "w-[16px] h-[16px] rounded-md block",
|
|
2245
|
+
style: normalizeStyle({ backgroundColor: c.value?.color })
|
|
2246
|
+
}, null, 4)) : createCommentVNode("", !0),
|
|
2247
|
+
c.value?.text ? (openBlock(), createElementBlock("span", _hoisted_2$5, toDisplayString(c.value?.text), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(b.placeholder), 1))
|
|
2248
|
+
], 42, _hoisted_1$i),
|
|
2249
|
+
createElementVNode("span", _hoisted_4$2, [
|
|
2250
|
+
createVNode(unref(IconChevronTopBottom), {
|
|
2251
|
+
height: "14",
|
|
2252
|
+
width: "14"
|
|
2253
|
+
})
|
|
2254
|
+
]),
|
|
2255
|
+
c.value?.text ? (openBlock(), createElementBlock("button", {
|
|
2256
|
+
key: 0,
|
|
2257
|
+
type: "button",
|
|
2258
|
+
onClick: g[1] || (g[1] = (v) => {
|
|
2259
|
+
r.value = null, c.value = null;
|
|
2260
|
+
}),
|
|
2261
|
+
class: "absolute top-[50%] text-gray-500 translate-y-[-50%] hover:text-red-600 right-[30px]"
|
|
2262
|
+
}, [
|
|
2263
|
+
createVNode(unref(IconClose), {
|
|
2264
|
+
height: "14",
|
|
2265
|
+
width: "14"
|
|
2266
|
+
})
|
|
2267
|
+
])) : createCommentVNode("", !0),
|
|
2268
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
2269
|
+
withDirectives(createElementVNode("ul", {
|
|
2270
|
+
class: "z-[90] border rounded-lg fixed flex flex-col gap-[2px] p-1 bg-white overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-[6px] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",
|
|
2271
|
+
ref_key: "list",
|
|
2272
|
+
ref: i,
|
|
2273
|
+
style: normalizeStyle({
|
|
2274
|
+
width: o.value.width,
|
|
2275
|
+
maxHeight: b.maxHeight + "px",
|
|
2276
|
+
backgroundColor: "white"
|
|
2277
|
+
}),
|
|
2278
|
+
onClick: g[2] || (g[2] = withModifiers(() => {
|
|
2279
|
+
}, ["stop"]))
|
|
2280
|
+
}, [
|
|
2281
|
+
f.value?.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2282
|
+
g[4] || (g[4] = createElementVNode("li", { class: "sticky top-[-4px] text-[12px] bg-white p-1 z-[2] px-4 text-gray-400" }, " Натисніть Enter для вибору, ↑↓ для навігації, Esc для закриття ", -1)),
|
|
2283
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(f.value, (v, E) => (openBlock(), createElementBlock("li", {
|
|
2284
|
+
onClick: (S) => m(v),
|
|
2285
|
+
key: v?.id,
|
|
2286
|
+
ref_for: !0,
|
|
2287
|
+
ref: (S) => d.value[E] = S,
|
|
2288
|
+
class: normalizeClass(["cursor-pointer relative py-2 px-4 w-full text-[14px] text-gray-800 hover:bg-gray-100 rounded-lg", [a.value == E ? "bg-gray-100" : ""]])
|
|
2289
|
+
}, [
|
|
2290
|
+
createElementVNode("span", _hoisted_6, [
|
|
2291
|
+
v?.color ? (openBlock(), createElementBlock("span", {
|
|
2292
|
+
key: 0,
|
|
2293
|
+
class: "w-[16px] h-[16px] rounded-md block",
|
|
2294
|
+
style: normalizeStyle({ backgroundColor: v?.color })
|
|
2295
|
+
}, null, 4)) : createCommentVNode("", !0),
|
|
2296
|
+
createTextVNode(" " + toDisplayString(v?.text), 1)
|
|
2297
|
+
]),
|
|
2298
|
+
r.value == v?.id ? (openBlock(), createBlock(unref(IconCheck), {
|
|
2299
|
+
key: 0,
|
|
2300
|
+
height: "14",
|
|
2301
|
+
width: "14",
|
|
2302
|
+
"stroke-width": "2",
|
|
2303
|
+
class: "absolute right-[16px] top-[50%] translate-y-[-50%] text-blue-600"
|
|
2304
|
+
})) : createCommentVNode("", !0)
|
|
2305
|
+
], 10, _hoisted_5))), 128))
|
|
2306
|
+
], 64)) : (openBlock(), createElementBlock("li", _hoisted_7, "Дані відсутні"))
|
|
2307
|
+
], 4), [
|
|
2308
|
+
[vShow, l.value]
|
|
2309
|
+
])
|
|
2310
|
+
]))
|
|
2311
|
+
], 512));
|
|
2312
|
+
}
|
|
2313
|
+
}), _hoisted_1$h = ["disabled"], _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
2314
|
+
__name: "vs-input-switcher",
|
|
2315
|
+
props: /* @__PURE__ */ mergeModels({
|
|
2316
|
+
style: {
|
|
2317
|
+
type: Object,
|
|
2318
|
+
default: () => ({})
|
|
2319
|
+
},
|
|
2320
|
+
disabled: {
|
|
2321
|
+
type: Boolean,
|
|
2322
|
+
default: !1
|
|
2323
|
+
},
|
|
2324
|
+
customClass: {
|
|
2325
|
+
type: String,
|
|
2326
|
+
default: ""
|
|
2327
|
+
}
|
|
2328
|
+
}, {
|
|
2329
|
+
modelValue: { type: Boolean, default: !1 },
|
|
2330
|
+
modelModifiers: {}
|
|
2331
|
+
}),
|
|
2332
|
+
emits: ["update:modelValue"],
|
|
2333
|
+
setup(e) {
|
|
2334
|
+
const t = useModel(e, "modelValue");
|
|
2335
|
+
return (n, r) => (openBlock(), createElementBlock("button", {
|
|
2336
|
+
type: "button",
|
|
2337
|
+
class: normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50", [`bg-${e.style?.primaryColor || "blue"}-500`, e.customClass]]),
|
|
2338
|
+
disabled: e.disabled,
|
|
2339
|
+
onClick: r[0] || (r[0] = (o) => t.value = !t.value)
|
|
2340
|
+
}, [
|
|
2341
|
+
createElementVNode("span", {
|
|
2342
|
+
"data-state": "checked",
|
|
2343
|
+
class: normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform", [t.value ? "translate-x-4" : "translate-x-0"]])
|
|
2344
|
+
}, null, 2)
|
|
2345
|
+
], 10, _hoisted_1$h));
|
|
2346
|
+
}
|
|
2347
|
+
}), _hoisted_1$g = ["innerHTML"], _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
2348
|
+
__name: "vs-input-static",
|
|
2349
|
+
props: {
|
|
2350
|
+
html: {
|
|
2351
|
+
type: String,
|
|
2352
|
+
default: ""
|
|
2353
|
+
},
|
|
2354
|
+
customClass: {
|
|
2355
|
+
type: String,
|
|
2356
|
+
default: ""
|
|
2357
|
+
}
|
|
2358
|
+
},
|
|
2359
|
+
setup(e) {
|
|
2360
|
+
return (t, n) => (openBlock(), createElementBlock("div", {
|
|
2361
|
+
class: normalizeClass(e.customClass),
|
|
2362
|
+
innerHTML: e.html
|
|
2363
|
+
}, null, 10, _hoisted_1$g));
|
|
2364
|
+
}
|
|
2365
|
+
}), _hoisted_1$f = { class: "flex items-center justify-between" }, _hoisted_2$4 = { class: "grid gap-3" }, _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
2366
|
+
__name: "vs-container-switcher",
|
|
2367
|
+
props: {
|
|
2368
|
+
title: {
|
|
2369
|
+
type: String,
|
|
2370
|
+
default: ""
|
|
2371
|
+
},
|
|
2372
|
+
style: {
|
|
2373
|
+
type: Object,
|
|
2374
|
+
default: () => ({})
|
|
2375
|
+
},
|
|
2376
|
+
isOpen: {
|
|
2377
|
+
type: Boolean,
|
|
2378
|
+
default: !1
|
|
2379
|
+
}
|
|
2380
|
+
},
|
|
2381
|
+
setup(e) {
|
|
2382
|
+
const t = e, n = ref(t.isOpen);
|
|
2383
|
+
return watch(
|
|
2384
|
+
() => t.isOpen,
|
|
2385
|
+
(r) => {
|
|
2386
|
+
n.value = r;
|
|
2387
|
+
}
|
|
2388
|
+
), (r, o) => (openBlock(), createElementBlock("div", null, [
|
|
2389
|
+
createElementVNode("div", _hoisted_1$f, [
|
|
2390
|
+
createElementVNode("p", null, toDisplayString(e.title), 1),
|
|
2391
|
+
createVNode(_sfc_main$l, {
|
|
2392
|
+
modelValue: n.value,
|
|
2393
|
+
"onUpdate:modelValue": o[0] || (o[0] = (s) => n.value = s),
|
|
2394
|
+
style: normalizeStyle(e.style)
|
|
2395
|
+
}, null, 8, ["modelValue", "style"])
|
|
2396
|
+
]),
|
|
2397
|
+
createVNode(Transition, { name: "slide-fade" }, {
|
|
2398
|
+
default: withCtx(() => [
|
|
2399
|
+
withDirectives(createElementVNode("div", _hoisted_2$4, [
|
|
2400
|
+
renderSlot(r.$slots, "default", {}, void 0, !0)
|
|
2401
|
+
], 512), [
|
|
2402
|
+
[vShow, n.value]
|
|
2403
|
+
])
|
|
2404
|
+
]),
|
|
2405
|
+
_: 3
|
|
2406
|
+
})
|
|
2407
|
+
]));
|
|
2408
|
+
}
|
|
2409
|
+
}), VsContainerSwitcher = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-34f848b8"]]), _hoisted_1$e = { class: "grid gap-3" }, _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2410
|
+
__name: "vs-container-accordion",
|
|
2411
|
+
props: {
|
|
2412
|
+
title: {
|
|
2413
|
+
type: String,
|
|
2414
|
+
default: ""
|
|
2415
|
+
},
|
|
2416
|
+
style: {
|
|
2417
|
+
type: Object,
|
|
2418
|
+
default: () => ({})
|
|
2419
|
+
},
|
|
2420
|
+
isOpen: {
|
|
2421
|
+
type: Boolean,
|
|
2422
|
+
default: !1
|
|
2423
|
+
}
|
|
2424
|
+
},
|
|
2425
|
+
setup(e) {
|
|
2426
|
+
const t = e, n = ref(t.isOpen);
|
|
2427
|
+
return watch(
|
|
2428
|
+
() => t.isOpen,
|
|
2429
|
+
(r) => {
|
|
2430
|
+
n.value = r;
|
|
2431
|
+
}
|
|
2432
|
+
), (r, o) => (openBlock(), createElementBlock("div", null, [
|
|
2433
|
+
createElementVNode("button", {
|
|
2434
|
+
type: "button",
|
|
2435
|
+
onClick: o[0] || (o[0] = (s) => n.value = !n.value),
|
|
2436
|
+
class: "flex items-center gap-2"
|
|
2437
|
+
}, [
|
|
2438
|
+
createVNode(unref(IconChevronDown), {
|
|
2439
|
+
class: normalizeClass(["h-4 w-4 duration-300", [n.value ? "-rotate-180" : ""]])
|
|
2440
|
+
}, null, 8, ["class"]),
|
|
2441
|
+
createElementVNode("span", null, toDisplayString(e.title), 1)
|
|
2442
|
+
]),
|
|
2443
|
+
createVNode(Transition, { name: "slide-fade" }, {
|
|
2444
|
+
default: withCtx(() => [
|
|
2445
|
+
withDirectives(createElementVNode("div", _hoisted_1$e, [
|
|
2446
|
+
renderSlot(r.$slots, "default", {}, void 0, !0)
|
|
2447
|
+
], 512), [
|
|
2448
|
+
[vShow, n.value]
|
|
2449
|
+
])
|
|
2450
|
+
]),
|
|
2451
|
+
_: 3
|
|
2452
|
+
})
|
|
2453
|
+
]));
|
|
2454
|
+
}
|
|
2455
|
+
}), VsContainerAccordion = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-896e4c89"]]), _hoisted_1$d = { class: "flex items-center justify-between" }, _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
2456
|
+
__name: "vs-container-default",
|
|
2457
|
+
props: {
|
|
2458
|
+
title: {
|
|
2459
|
+
type: String,
|
|
2460
|
+
default: ""
|
|
2461
|
+
},
|
|
2462
|
+
style: {
|
|
2463
|
+
type: Object,
|
|
2464
|
+
default: () => ({})
|
|
2465
|
+
}
|
|
2466
|
+
},
|
|
2467
|
+
setup(e) {
|
|
2468
|
+
return (t, n) => (openBlock(), createElementBlock("div", null, [
|
|
2469
|
+
createElementVNode("div", _hoisted_1$d, [
|
|
2470
|
+
createElementVNode("p", null, toDisplayString(e.title), 1)
|
|
2471
|
+
]),
|
|
2472
|
+
renderSlot(t.$slots, "default")
|
|
2473
|
+
]));
|
|
2474
|
+
}
|
|
2475
|
+
}), views = {
|
|
2476
|
+
switcher: VsContainerSwitcher,
|
|
2477
|
+
accordion: VsContainerAccordion,
|
|
2478
|
+
default: _sfc_main$h
|
|
2479
|
+
}, FormConditionsTypes = {
|
|
2480
|
+
Equal: "==",
|
|
2481
|
+
Inequal: "!=",
|
|
2482
|
+
Higer: ">",
|
|
2483
|
+
HigerOrEqual: ">=",
|
|
2484
|
+
Lower: "<",
|
|
2485
|
+
LowerOrEqual: "<=",
|
|
2486
|
+
Between: "between",
|
|
2487
|
+
StartWith: "^",
|
|
2488
|
+
EndWith: "$",
|
|
2489
|
+
Contain: "*",
|
|
2490
|
+
In: "in",
|
|
2491
|
+
NotIn: "not_in"
|
|
2492
|
+
}, checkEqual = (e, t) => e === t, checkInequal = (e, t) => e !== t, checkHigher = (e, t) => e > t, checkHigherOrEqual = (e, t) => e >= t, checkLower = (e, t) => e < t, checkLowerOrEqual = (e, t) => e <= t, checkBetween = (e, t) => Array.isArray(t) && t.length === 2 ? e >= t[0] && e <= t[1] : !1, checkStartWith = (e, t) => String(e).startsWith(String(t)), checkEndWith = (e, t) => String(e).endsWith(String(t)), checkContain = (e, t) => String(e).includes(String(t)), checkIn = (e, t) => Array.isArray(t) ? t.includes(e) : !1, checkNotIn = (e, t) => Array.isArray(t) ? !t.includes(e) : !0, isVisible = (e, t) => {
|
|
2493
|
+
if (!t) return !0;
|
|
2494
|
+
switch (t?.[1]) {
|
|
2495
|
+
case FormConditionsTypes.Equal:
|
|
2496
|
+
return checkEqual(e, t?.[2]);
|
|
2497
|
+
case FormConditionsTypes.Inequal:
|
|
2498
|
+
return checkInequal(e, t?.[2]);
|
|
2499
|
+
case FormConditionsTypes.Higer:
|
|
2500
|
+
return checkHigher(e, t?.[2]);
|
|
2501
|
+
case FormConditionsTypes.HigerOrEqual:
|
|
2502
|
+
return checkHigherOrEqual(e, t?.[2]);
|
|
2503
|
+
case FormConditionsTypes.Lower:
|
|
2504
|
+
return checkLower(e, t?.[2]);
|
|
2505
|
+
case FormConditionsTypes.LowerOrEqual:
|
|
2506
|
+
return checkLowerOrEqual(e, t?.[2]);
|
|
2507
|
+
case FormConditionsTypes.Between:
|
|
2508
|
+
return checkBetween(e, t?.[2]);
|
|
2509
|
+
case FormConditionsTypes.StartWith:
|
|
2510
|
+
return checkStartWith(e, t?.[2]);
|
|
2511
|
+
case FormConditionsTypes.EndWith:
|
|
2512
|
+
return checkEndWith(e, t?.[2]);
|
|
2513
|
+
case FormConditionsTypes.Contain:
|
|
2514
|
+
return checkContain(e, t?.[2]);
|
|
2515
|
+
case FormConditionsTypes.In:
|
|
2516
|
+
return checkIn(e, t?.[2]);
|
|
2517
|
+
case FormConditionsTypes.NotIn:
|
|
2518
|
+
return checkNotIn(e, t?.[2]);
|
|
2519
|
+
default:
|
|
2520
|
+
return !0;
|
|
2521
|
+
}
|
|
2522
|
+
}, _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
2523
|
+
__name: "vs-input-container",
|
|
2524
|
+
props: {
|
|
2525
|
+
style: {
|
|
2526
|
+
type: Object,
|
|
2527
|
+
default: () => ({})
|
|
2528
|
+
},
|
|
2529
|
+
title: {
|
|
2530
|
+
type: String,
|
|
2531
|
+
default: ""
|
|
2532
|
+
},
|
|
2533
|
+
view: {
|
|
2534
|
+
type: String,
|
|
2535
|
+
default: "default"
|
|
2536
|
+
},
|
|
2537
|
+
schema: {
|
|
2538
|
+
type: Array,
|
|
2539
|
+
default: () => []
|
|
2540
|
+
}
|
|
2541
|
+
},
|
|
2542
|
+
setup(e) {
|
|
2543
|
+
const t = e, n = inject("formValues", { default: {} }), r = inject("form"), o = computed(() => t.schema?.filter((i) => {
|
|
2544
|
+
const l = i?.conditions;
|
|
2545
|
+
if (!l) return !0;
|
|
2546
|
+
const c = Array.isArray(l) ? l[0] : l, u = n?.value?.[c];
|
|
2547
|
+
return isVisible(u, l);
|
|
2548
|
+
})), s = computed(() => views[t.view]);
|
|
2549
|
+
return (i, l) => e.schema?.length ? (openBlock(), createBlock(resolveDynamicComponent(s.value), {
|
|
2550
|
+
key: 0,
|
|
2551
|
+
title: e.title,
|
|
2552
|
+
style: normalizeStyle(e.style)
|
|
2553
|
+
}, {
|
|
2554
|
+
default: withCtx(() => [
|
|
2555
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(o.value, (c) => (openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
2556
|
+
key: c.name
|
|
2557
|
+
}, { ref_for: !0 }, c, {
|
|
2558
|
+
item: c,
|
|
2559
|
+
modelValue: unref(n)[c.name],
|
|
2560
|
+
"onUpdate:modelValue": (u) => unref(n)[c.name] = u,
|
|
2561
|
+
style: e.style,
|
|
2562
|
+
error: unref(r)?.errors?.[c.name]
|
|
2563
|
+
}), null, 16, ["item", "modelValue", "onUpdate:modelValue", "style", "error"]))), 128))
|
|
2564
|
+
]),
|
|
2565
|
+
_: 1
|
|
2566
|
+
}, 8, ["title", "style"])) : createCommentVNode("", !0);
|
|
2567
|
+
}
|
|
2568
|
+
}), _hoisted_1$c = { class: "flex items-center gap-[4px]" }, _hoisted_2$3 = ["value", "id", "disabled"], _hoisted_3$1 = ["for"], _hoisted_4$1 = { class: "text-[13px] text-gray-500 flex items-center gap-x-1 ml-1 dark:text-neutral-400" }, _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
2569
|
+
__name: "vs-checkbox-default",
|
|
2570
|
+
props: {
|
|
2571
|
+
value: { type: [String, Number], default: "" },
|
|
2572
|
+
label: { type: [String, Number], default: "" },
|
|
2573
|
+
disabled: { type: Boolean, default: !1 },
|
|
2574
|
+
id: { type: [String, Number] },
|
|
2575
|
+
modelValue: Boolean,
|
|
2576
|
+
info: { type: String, default: () => "" }
|
|
2577
|
+
},
|
|
2578
|
+
emits: ["update:modelValue"],
|
|
2579
|
+
setup(e, { emit: t }) {
|
|
2580
|
+
const n = t, r = e, o = computed({
|
|
2581
|
+
get: () => r.modelValue,
|
|
2582
|
+
set: (s) => n("update:modelValue", s)
|
|
2583
|
+
});
|
|
2584
|
+
return (s, i) => (openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
2585
|
+
withDirectives(createElementVNode("input", {
|
|
2586
|
+
type: "checkbox",
|
|
2587
|
+
value: e.value,
|
|
2588
|
+
"onUpdate:modelValue": i[0] || (i[0] = (l) => o.value = l),
|
|
2589
|
+
class: normalizeClass(["shrink-0 border border-solid hidden border-gray-200 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer", { "!cursor-not-allowed": e.disabled }]),
|
|
2590
|
+
id: e.id,
|
|
2591
|
+
disabled: e.disabled
|
|
2592
|
+
}, null, 10, _hoisted_2$3), [
|
|
2593
|
+
[vModelCheckbox, o.value]
|
|
2594
|
+
]),
|
|
2595
|
+
createElementVNode("label", {
|
|
2596
|
+
for: e.id,
|
|
2597
|
+
class: normalizeClass(["flex flex-1 checkbox-label items-center gap-x-3 cursor-pointer text-sm text-gray-800 dark:text-neutral-300", { "!cursor-not-allowed": e.disabled }])
|
|
2598
|
+
}, [
|
|
2599
|
+
createElementVNode("div", {
|
|
2600
|
+
class: normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded", [o.value ? "bg-blue-600" : "bg-white"]])
|
|
2601
|
+
}, [
|
|
2602
|
+
createVNode(IconCheck, {
|
|
2603
|
+
height: "12",
|
|
2604
|
+
width: "12"
|
|
2605
|
+
})
|
|
2606
|
+
], 2),
|
|
2607
|
+
createElementVNode("span", _hoisted_4$1, [
|
|
2608
|
+
renderSlot(s.$slots, "default", {}, () => [
|
|
2609
|
+
createTextVNode(toDisplayString(e.label), 1)
|
|
2610
|
+
])
|
|
2611
|
+
])
|
|
2612
|
+
], 10, _hoisted_3$1)
|
|
2613
|
+
]));
|
|
2614
|
+
}
|
|
2615
|
+
}), _hoisted_1$b = ["name", "value", "disabled"], _hoisted_2$2 = { class: "flex items-center gap-[6px] text-[14px]" }, _hoisted_3 = {
|
|
2616
|
+
key: 0,
|
|
2617
|
+
class: "text-[16px]"
|
|
2618
|
+
}, _hoisted_4 = ["src"], _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
2619
|
+
__name: "vs-checkbox-buttons",
|
|
2620
|
+
props: {
|
|
2621
|
+
value: { type: [String, Number, Boolean], default: "" },
|
|
2622
|
+
label: { type: [String, Number], default: "" },
|
|
2623
|
+
modelValue: {
|
|
2624
|
+
type: [Array, String, Boolean],
|
|
2625
|
+
default: ""
|
|
2626
|
+
},
|
|
2627
|
+
disabled: { type: Boolean, default: !1 },
|
|
2628
|
+
id: { type: [String, Number] },
|
|
2629
|
+
icon: { type: String },
|
|
2630
|
+
imgUrl: { type: String },
|
|
2631
|
+
style: { type: Object, default: () => null }
|
|
2632
|
+
},
|
|
2633
|
+
emits: ["update:modelValue"],
|
|
2634
|
+
setup(e, { emit: t }) {
|
|
2635
|
+
const n = e, r = t, o = computed({
|
|
2636
|
+
get: () => n.modelValue,
|
|
2637
|
+
set: (l) => {
|
|
2638
|
+
r("update:modelValue", l);
|
|
2639
|
+
}
|
|
2640
|
+
}), s = computed(() => Array.isArray(o.value) ? o.value.includes(n.value) : o.value === !0 || o.value === n.value), i = computed(() => n.style?.size === "xs" ? "p-1.5 text-xs" : n.style?.size === "lg" ? "p-3.5 text-[20px]" : "p-2.5 text-xs");
|
|
2641
|
+
return (l, c) => (openBlock(), createElementBlock("label", {
|
|
2642
|
+
class: normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg", [i.value, s.value ? "ring-blue-500" : "border border-gray-200 ring-transparent"]])
|
|
2643
|
+
}, [
|
|
2644
|
+
withDirectives(createElementVNode("input", {
|
|
2645
|
+
type: "checkbox",
|
|
2646
|
+
class: "hidden",
|
|
2647
|
+
name: e.id,
|
|
2648
|
+
value: e.value,
|
|
2649
|
+
"onUpdate:modelValue": c[0] || (c[0] = (u) => o.value = u),
|
|
2650
|
+
disabled: e.disabled
|
|
2651
|
+
}, null, 8, _hoisted_1$b), [
|
|
2652
|
+
[vModelCheckbox, o.value]
|
|
2653
|
+
]),
|
|
2654
|
+
createElementVNode("span", _hoisted_2$2, [
|
|
2655
|
+
e.icon || e.imgUrl ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
|
2656
|
+
e.icon ? (openBlock(), createElementBlock("i", {
|
|
2657
|
+
key: 0,
|
|
2658
|
+
class: normalizeClass(e.icon)
|
|
2659
|
+
}, null, 2)) : createCommentVNode("", !0),
|
|
2660
|
+
e.imgUrl ? (openBlock(), createElementBlock("img", {
|
|
2661
|
+
key: 1,
|
|
2662
|
+
src: e.imgUrl,
|
|
2663
|
+
width: "16",
|
|
2664
|
+
height: "16",
|
|
2665
|
+
alt: "icon"
|
|
2666
|
+
}, null, 8, _hoisted_4)) : createCommentVNode("", !0)
|
|
2667
|
+
])) : createCommentVNode("", !0),
|
|
2668
|
+
renderSlot(l.$slots, "default", {}, () => [
|
|
2669
|
+
createTextVNode(toDisplayString(e.label), 1)
|
|
2670
|
+
])
|
|
2671
|
+
])
|
|
2672
|
+
], 2));
|
|
2673
|
+
}
|
|
2674
|
+
}), VsCheckboxViews = {
|
|
2675
|
+
"vs-checkbox-default": _sfc_main$f,
|
|
2676
|
+
"vs-checkbox-buttons": _sfc_main$e
|
|
2677
|
+
}, _hoisted_1$a = { class: "flex items-center" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
2678
|
+
__name: "vs-input-checkbox-item",
|
|
2679
|
+
props: {
|
|
2680
|
+
value: { type: [String, Number], default: "" },
|
|
2681
|
+
label: { type: [String, Number], default: "" },
|
|
2682
|
+
disabled: { type: Boolean, default: !1 },
|
|
2683
|
+
view: { type: String, default: () => "default" },
|
|
2684
|
+
modelValue: {
|
|
2685
|
+
type: [Array, Boolean],
|
|
2686
|
+
default: !1
|
|
2687
|
+
},
|
|
2688
|
+
icon: { type: String },
|
|
2689
|
+
imgUrl: { type: String },
|
|
2690
|
+
slots: { type: Object, default: () => null },
|
|
2691
|
+
option: { type: [Object, String] },
|
|
2692
|
+
style: { type: String, default: () => null }
|
|
2693
|
+
},
|
|
2694
|
+
emits: ["update:modelValue"],
|
|
2695
|
+
setup(e, { emit: t }) {
|
|
2696
|
+
const n = e, r = t, o = `radio-${Math.floor(Math.random() * 1e4)}`, s = computed({
|
|
2697
|
+
get: () => Array.isArray(n.modelValue) ? Array.isArray(n.modelValue) && n.modelValue.includes(n.value) : n.modelValue,
|
|
2698
|
+
set: (l) => {
|
|
2699
|
+
if (Array.isArray(n.modelValue)) {
|
|
2700
|
+
let c = [...n.modelValue];
|
|
2701
|
+
l ? c.includes(n.value) || c.push(n.value) : c = c.filter((u) => u !== n.value), r("update:modelValue", c);
|
|
2702
|
+
} else
|
|
2703
|
+
r("update:modelValue", l);
|
|
2704
|
+
}
|
|
2705
|
+
}), i = ref("vs-checkbox-" + (n.view || "default"));
|
|
2706
|
+
return (l, c) => (openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
2707
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(VsCheckboxViews)?.[i.value]), {
|
|
2708
|
+
value: e.value,
|
|
2709
|
+
label: e.label,
|
|
2710
|
+
info: e.option?.info,
|
|
2711
|
+
disabled: e.disabled,
|
|
2712
|
+
modelValue: s.value,
|
|
2713
|
+
"onUpdate:modelValue": c[0] || (c[0] = (u) => s.value = u),
|
|
2714
|
+
id: o,
|
|
2715
|
+
icon: e.icon,
|
|
2716
|
+
imgUrl: e.imgUrl,
|
|
2717
|
+
style: normalizeStyle(e.style)
|
|
2718
|
+
}, {
|
|
2719
|
+
default: withCtx(() => [
|
|
2720
|
+
createTextVNode(toDisplayString(e.label), 1)
|
|
2721
|
+
]),
|
|
2722
|
+
_: 1
|
|
2723
|
+
}, 8, ["value", "label", "info", "disabled", "modelValue", "icon", "imgUrl", "style"]))
|
|
2724
|
+
]));
|
|
2725
|
+
}
|
|
2726
|
+
}), _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
2727
|
+
__name: "vs-input-checkbox",
|
|
2728
|
+
props: {
|
|
2729
|
+
options: {
|
|
2730
|
+
type: Array,
|
|
2731
|
+
default: () => []
|
|
2732
|
+
},
|
|
2733
|
+
modelValue: {
|
|
2734
|
+
type: [Boolean, Array],
|
|
2735
|
+
default: !1
|
|
2736
|
+
},
|
|
2737
|
+
position: { default: () => "vertical" },
|
|
2738
|
+
// vertical, horizontal
|
|
2739
|
+
slots: { type: Object, default: () => null },
|
|
2740
|
+
view: { type: String, default: () => null },
|
|
2741
|
+
colSpan: { type: Number, default: () => 0 },
|
|
2742
|
+
data: { type: String, default: () => null }
|
|
2743
|
+
},
|
|
2744
|
+
emits: ["update:modelValue"],
|
|
2745
|
+
setup(e, { emit: t }) {
|
|
2746
|
+
const n = e, r = t, o = ref([]), s = reactive({}), i = (a) => a?.value || a?.id || a?.text || a, l = (a) => a.text || String(a), c = (a) => `lg:col-span-${a || 12}`, u = async () => {
|
|
2747
|
+
try {
|
|
2748
|
+
const { data: a } = await axios.get(`/api/suggest/${n.data}`);
|
|
2749
|
+
o.value = a?.data || a;
|
|
2750
|
+
} catch (a) {
|
|
2751
|
+
console.error(a);
|
|
2752
|
+
}
|
|
2753
|
+
};
|
|
2754
|
+
return watch(
|
|
2755
|
+
() => n.modelValue,
|
|
2756
|
+
(a) => {
|
|
2757
|
+
if (typeof a == "boolean" && o.value.length === 1) {
|
|
2758
|
+
const d = i(o.value[0]);
|
|
2759
|
+
s[d] = a;
|
|
2760
|
+
} else if (Array.isArray(a)) {
|
|
2761
|
+
const d = new Set(a);
|
|
2762
|
+
o.value.forEach((f) => {
|
|
2763
|
+
if (!f.disabled) {
|
|
2764
|
+
const h = i(f);
|
|
2765
|
+
s[h] = d.has(h);
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
},
|
|
2770
|
+
{ immediate: !0 }
|
|
2771
|
+
), watch(
|
|
2772
|
+
s,
|
|
2773
|
+
() => {
|
|
2774
|
+
if (!o.value.length) {
|
|
2775
|
+
r("update:modelValue", null);
|
|
2776
|
+
return;
|
|
2777
|
+
}
|
|
2778
|
+
const a = Object.entries(s).filter(([, d]) => d).map(([d]) => d);
|
|
2779
|
+
r("update:modelValue", a.length === 0 ? null : a);
|
|
2780
|
+
},
|
|
2781
|
+
{ deep: !0 }
|
|
2782
|
+
), onMounted(() => {
|
|
2783
|
+
if (n.data)
|
|
2784
|
+
u().then(() => {
|
|
2785
|
+
if (typeof n.modelValue == "boolean" && o.value.length === 1) {
|
|
2786
|
+
const a = i(o.value[0]);
|
|
2787
|
+
s[a] = n.modelValue;
|
|
2788
|
+
} else if (Array.isArray(n.modelValue)) {
|
|
2789
|
+
const a = new Set(n.modelValue);
|
|
2790
|
+
o.value.forEach((d) => {
|
|
2791
|
+
if (!d.disabled) {
|
|
2792
|
+
const f = i(d);
|
|
2793
|
+
s[f] = a.has(f);
|
|
2794
|
+
}
|
|
2795
|
+
});
|
|
2796
|
+
}
|
|
2797
|
+
});
|
|
2798
|
+
else if (o.value = n.options, typeof n.modelValue == "boolean" && o.value.length === 1) {
|
|
2799
|
+
const a = i(o.value[0]);
|
|
2800
|
+
s[a] = n.modelValue;
|
|
2801
|
+
} else if (Array.isArray(n.modelValue)) {
|
|
2802
|
+
const a = new Set(n.modelValue);
|
|
2803
|
+
o.value.forEach((d) => {
|
|
2804
|
+
if (!d.disabled) {
|
|
2805
|
+
const f = i(d);
|
|
2806
|
+
s[f] = a.has(f);
|
|
2807
|
+
}
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
}), (a, d) => (openBlock(), createElementBlock("div", {
|
|
2811
|
+
class: normalizeClass(["p-0 w-full gap-[6px]", [e.position === "vertical" ? "flex-col" : "", e.colSpan ? "grid" : "flex justify-start"]])
|
|
2812
|
+
}, [
|
|
2813
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(o.value, (f) => (openBlock(), createBlock(_sfc_main$d, {
|
|
2814
|
+
modelValue: s[i(f)],
|
|
2815
|
+
"onUpdate:modelValue": (h) => s[i(f)] = h,
|
|
2816
|
+
value: i(f),
|
|
2817
|
+
class: normalizeClass(c(e.colSpan)),
|
|
2818
|
+
disabled: f.disabled,
|
|
2819
|
+
label: l(f),
|
|
2820
|
+
key: i(f),
|
|
2821
|
+
icon: f?.icon,
|
|
2822
|
+
imgUrl: f?.imgUrl,
|
|
2823
|
+
option: f,
|
|
2824
|
+
slots: e.slots,
|
|
2825
|
+
view: e.view
|
|
2826
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "value", "class", "disabled", "label", "icon", "imgUrl", "option", "slots", "view"]))), 128))
|
|
2827
|
+
], 2));
|
|
2828
|
+
}
|
|
2829
|
+
}), VsInputCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-06e7be2f"]]), fileUpload = async (e, t, n, r) => {
|
|
2830
|
+
try {
|
|
2831
|
+
const o = new FormData();
|
|
2832
|
+
o.append("unique", "true"), o.append("file", e);
|
|
2833
|
+
const { data: s } = await axios.post(
|
|
2834
|
+
`/file/upload/uploads?id=${t || ""}&form=${n || ""}&table=${r || ""}`,
|
|
2835
|
+
o
|
|
2836
|
+
);
|
|
2837
|
+
return s;
|
|
2838
|
+
} catch (o) {
|
|
2839
|
+
console.error(o);
|
|
2840
|
+
}
|
|
2841
|
+
}, fileDelete = async (e) => {
|
|
2842
|
+
try {
|
|
2843
|
+
return await axios.get(`file/delete${e}`), !0;
|
|
2844
|
+
} catch (t) {
|
|
2845
|
+
return console.error(t), !1;
|
|
2846
|
+
}
|
|
2847
|
+
}, fileDownload = async (e) => {
|
|
2848
|
+
try {
|
|
2849
|
+
const t = await axios.get(`file/download/files/uploads${e}`, {
|
|
2850
|
+
responseType: "arraybuffer",
|
|
2851
|
+
headers: {
|
|
2852
|
+
"Content-Type": "application/json"
|
|
2853
|
+
}
|
|
2854
|
+
}), n = t.headers["content-type"], r = new TextDecoder("utf-8").decode(t.data), o = new Blob([r], { type: n }), s = document.createElement("a");
|
|
2855
|
+
s.setAttribute("download", e), s.href = window.URL.createObjectURL(o), s.click();
|
|
2856
|
+
} catch (t) {
|
|
2857
|
+
console.error(t.message);
|
|
2858
|
+
}
|
|
2859
|
+
}, _sfc_main$b = {}, _hoisted_1$9 = {
|
|
2860
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2861
|
+
width: "24",
|
|
2862
|
+
height: "24",
|
|
2863
|
+
viewBox: "0 0 24 24",
|
|
2864
|
+
fill: "none",
|
|
2865
|
+
stroke: "currentColor",
|
|
2866
|
+
"stroke-width": "2",
|
|
2867
|
+
"stroke-linecap": "round",
|
|
2868
|
+
"stroke-linejoin": "round"
|
|
2869
|
+
};
|
|
2870
|
+
function _sfc_render$7(e, t) {
|
|
2871
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$9, t[0] || (t[0] = [
|
|
2872
|
+
createElementVNode("path", { d: "M5 12h14" }, null, -1),
|
|
2873
|
+
createElementVNode("path", { d: "M12 5v14" }, null, -1)
|
|
2874
|
+
]));
|
|
2875
|
+
}
|
|
2876
|
+
const IconPlus = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$7]]), _sfc_main$a = {}, _hoisted_1$8 = {
|
|
2877
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2878
|
+
class: "icon icon-tabler icon-tabler-file-text",
|
|
2879
|
+
width: "44",
|
|
2880
|
+
height: "44",
|
|
2881
|
+
viewBox: "0 0 24 24",
|
|
2882
|
+
"stroke-width": "1.5",
|
|
2883
|
+
stroke: "currentColor",
|
|
2884
|
+
fill: "none",
|
|
2885
|
+
"stroke-linecap": "round",
|
|
2886
|
+
"stroke-linejoin": "round"
|
|
2887
|
+
};
|
|
2888
|
+
function _sfc_render$6(e, t, n, r, o, s) {
|
|
2889
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$8, t[0] || (t[0] = [
|
|
2890
|
+
createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>', 6)
|
|
2891
|
+
]));
|
|
2892
|
+
}
|
|
2893
|
+
const iconPdf = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$6]]), _sfc_main$9 = {}, _hoisted_1$7 = {
|
|
2894
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2895
|
+
class: "icon icon-tabler icon-tabler-table",
|
|
2896
|
+
width: "44",
|
|
2897
|
+
height: "44",
|
|
2898
|
+
viewBox: "0 0 24 24",
|
|
2899
|
+
"stroke-width": "1.5",
|
|
2900
|
+
stroke: "currentColor",
|
|
2901
|
+
fill: "none",
|
|
2902
|
+
"stroke-linecap": "round",
|
|
2903
|
+
"stroke-linejoin": "round"
|
|
2904
|
+
};
|
|
2905
|
+
function _sfc_render$5(e, t, n, r, o, s) {
|
|
2906
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$7, t[0] || (t[0] = [
|
|
2907
|
+
createElementVNode("path", {
|
|
2908
|
+
stroke: "none",
|
|
2909
|
+
d: "M0 0h24v24H0z",
|
|
2910
|
+
fill: "none"
|
|
2911
|
+
}, null, -1),
|
|
2912
|
+
createElementVNode("rect", {
|
|
2913
|
+
x: "4",
|
|
2914
|
+
y: "4",
|
|
2915
|
+
width: "16",
|
|
2916
|
+
height: "16",
|
|
2917
|
+
rx: "2"
|
|
2918
|
+
}, null, -1),
|
|
2919
|
+
createElementVNode("line", {
|
|
2920
|
+
x1: "4",
|
|
2921
|
+
y1: "10",
|
|
2922
|
+
x2: "20",
|
|
2923
|
+
y2: "10"
|
|
2924
|
+
}, null, -1),
|
|
2925
|
+
createElementVNode("line", {
|
|
2926
|
+
x1: "10",
|
|
2927
|
+
y1: "4",
|
|
2928
|
+
x2: "10",
|
|
2929
|
+
y2: "20"
|
|
2930
|
+
}, null, -1)
|
|
2931
|
+
]));
|
|
2932
|
+
}
|
|
2933
|
+
const IconCsv = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$5]]), _sfc_main$8 = {}, _hoisted_1$6 = {
|
|
2934
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2935
|
+
width: "24",
|
|
2936
|
+
height: "24",
|
|
2937
|
+
viewBox: "0 0 24 24",
|
|
2938
|
+
fill: "none",
|
|
2939
|
+
stroke: "currentColor",
|
|
2940
|
+
"stroke-width": "2",
|
|
2941
|
+
"stroke-linecap": "round",
|
|
2942
|
+
"stroke-linejoin": "round",
|
|
2943
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-file-unknown"
|
|
2944
|
+
};
|
|
2945
|
+
function _sfc_render$4(e, t, n, r, o, s) {
|
|
2946
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$6, t[0] || (t[0] = [
|
|
2947
|
+
createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M12 17v.01"></path><path d="M12 14a1.5 1.5 0 1 0 -1.14 -2.474"></path>', 5)
|
|
2948
|
+
]));
|
|
2949
|
+
}
|
|
2950
|
+
const IconFile = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$4]]), _sfc_main$7 = {}, _hoisted_1$5 = {
|
|
2951
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2952
|
+
class: "icon icon-tabler icon-tabler-file-zip",
|
|
2953
|
+
width: "44",
|
|
2954
|
+
height: "44",
|
|
2955
|
+
viewBox: "0 0 24 24",
|
|
2956
|
+
"stroke-width": "1.5",
|
|
2957
|
+
stroke: "currentColor",
|
|
2958
|
+
fill: "none",
|
|
2959
|
+
"stroke-linecap": "round",
|
|
2960
|
+
"stroke-linejoin": "round"
|
|
2961
|
+
};
|
|
2962
|
+
function _sfc_render$3(e, t, n, r, o, s) {
|
|
2963
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$5, t[0] || (t[0] = [
|
|
2964
|
+
createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>', 9)
|
|
2965
|
+
]));
|
|
2966
|
+
}
|
|
2967
|
+
const IconZip = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3]]), _sfc_main$6 = {}, _hoisted_1$4 = {
|
|
2968
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2969
|
+
class: "icon icon-tabler icon-tabler-file-code",
|
|
2970
|
+
width: "44",
|
|
2971
|
+
height: "44",
|
|
2972
|
+
viewBox: "0 0 24 24",
|
|
2973
|
+
"stroke-width": "1.5",
|
|
2974
|
+
stroke: "currentColor",
|
|
2975
|
+
fill: "none",
|
|
2976
|
+
"stroke-linecap": "round",
|
|
2977
|
+
"stroke-linejoin": "round"
|
|
2978
|
+
};
|
|
2979
|
+
function _sfc_render$2(e, t, n, r, o, s) {
|
|
2980
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$4, t[0] || (t[0] = [
|
|
2981
|
+
createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>', 5)
|
|
2982
|
+
]));
|
|
2983
|
+
}
|
|
2984
|
+
const IconGeojson = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2]]), getFileType = (e) => {
|
|
2985
|
+
if (!e) return "";
|
|
2986
|
+
const t = e?.split(".");
|
|
2987
|
+
return t[t.length - 1];
|
|
2988
|
+
}, fileFormatPreview = (e) => {
|
|
2989
|
+
const t = getFileType(e), n = {
|
|
2990
|
+
imageFormat: ["tiff", "jpg", "jpeg", "png", "svg", "ico", "webp"],
|
|
2991
|
+
sheetsFormat: ["xls", "csv", "xlsx"],
|
|
2992
|
+
archivesFormat: ["zip", "rar"],
|
|
2993
|
+
textsFormat: ["json", "geojson", "txt", "yml", "yaml", "shp"],
|
|
2994
|
+
documentsFormat: ["pdf"]
|
|
2995
|
+
};
|
|
2996
|
+
return n.imageFormat.includes(t) ? "img" : n.sheetsFormat.includes(t) ? IconCsv : n.textsFormat.includes(t) ? IconGeojson : n.documentsFormat.includes(t) ? iconPdf : n.archivesFormat.includes(t) ? IconZip : IconFile;
|
|
2997
|
+
}, _sfc_main$5 = {}, _hoisted_1$3 = {
|
|
2998
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2999
|
+
width: "24",
|
|
3000
|
+
height: "24",
|
|
3001
|
+
viewBox: "0 0 24 24",
|
|
3002
|
+
fill: "none",
|
|
3003
|
+
stroke: "currentColor",
|
|
3004
|
+
"stroke-width": "2",
|
|
3005
|
+
"stroke-linecap": "round",
|
|
3006
|
+
"stroke-linejoin": "round",
|
|
3007
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-trash"
|
|
3008
|
+
};
|
|
3009
|
+
function _sfc_render$1(e, t) {
|
|
3010
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$3, t[0] || (t[0] = [
|
|
3011
|
+
createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>', 6)
|
|
3012
|
+
]));
|
|
3013
|
+
}
|
|
3014
|
+
const IconDelete = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]), _sfc_main$4 = {}, _hoisted_1$2 = {
|
|
3015
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3016
|
+
width: "24",
|
|
3017
|
+
height: "24",
|
|
3018
|
+
viewBox: "0 0 24 24",
|
|
3019
|
+
fill: "none",
|
|
3020
|
+
stroke: "currentColor",
|
|
3021
|
+
"stroke-width": "2",
|
|
3022
|
+
"stroke-linecap": "round",
|
|
3023
|
+
"stroke-linejoin": "round",
|
|
3024
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-download"
|
|
3025
|
+
};
|
|
3026
|
+
function _sfc_render(e, t) {
|
|
3027
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$2, t[0] || (t[0] = [
|
|
3028
|
+
createElementVNode("path", {
|
|
3029
|
+
stroke: "none",
|
|
3030
|
+
d: "M0 0h24v24H0z",
|
|
3031
|
+
fill: "none"
|
|
3032
|
+
}, null, -1),
|
|
3033
|
+
createElementVNode("path", { d: "M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" }, null, -1),
|
|
3034
|
+
createElementVNode("path", { d: "M7 11l5 5l5 -5" }, null, -1),
|
|
3035
|
+
createElementVNode("path", { d: "M12 4l0 12" }, null, -1)
|
|
3036
|
+
]));
|
|
3037
|
+
}
|
|
3038
|
+
const IconDownload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render]]), _hoisted_1$1 = { class: "h-[120px] w-[120px] border text-gray-300 border-dashed border-gray-300 rounded-lg overflow-hidden relative item-file" }, _hoisted_2$1 = { class: "absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3039
|
+
__name: "vs-input-file-list-item",
|
|
3040
|
+
props: /* @__PURE__ */ mergeModels({
|
|
3041
|
+
multiple: { type: Boolean }
|
|
3042
|
+
}, {
|
|
3043
|
+
value: {},
|
|
3044
|
+
valueModifiers: {},
|
|
3045
|
+
item: {},
|
|
3046
|
+
itemModifiers: {}
|
|
3047
|
+
}),
|
|
3048
|
+
emits: ["update:value", "update:item"],
|
|
3049
|
+
setup(e) {
|
|
3050
|
+
const t = useModel(e, "value"), n = useModel(e, "item"), r = e;
|
|
3051
|
+
return (o, s) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
3052
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(fileFormatPreview)(n.value)), {
|
|
3053
|
+
src: n.value,
|
|
3054
|
+
alt: "file",
|
|
3055
|
+
class: "w-full h-full object-cover cursor-pointer",
|
|
3056
|
+
onClick: s[0] || (s[0] = (i) => unref(fileDownload)(n.value))
|
|
3057
|
+
}, null, 8, ["src"])),
|
|
3058
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
3059
|
+
createElementVNode("button", {
|
|
3060
|
+
type: "button",
|
|
3061
|
+
onClick: s[1] || (s[1] = (i) => {
|
|
3062
|
+
unref(fileDelete)(n.value), t.value = r.multiple ? t.value?.filter((l) => l !== n.value) : "";
|
|
3063
|
+
}),
|
|
3064
|
+
class: "w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"
|
|
3065
|
+
}, [
|
|
3066
|
+
createVNode(IconDelete, { class: "w-4 h-4" })
|
|
3067
|
+
]),
|
|
3068
|
+
createElementVNode("button", {
|
|
3069
|
+
type: "button",
|
|
3070
|
+
onClick: s[2] || (s[2] = (i) => unref(fileDownload)(n.value)),
|
|
3071
|
+
class: "w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"
|
|
3072
|
+
}, [
|
|
3073
|
+
createVNode(IconDownload, { class: "w-4 h-4" })
|
|
3074
|
+
])
|
|
3075
|
+
])
|
|
3076
|
+
]));
|
|
3077
|
+
}
|
|
3078
|
+
}), VsInputFileListItem = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-147e810a"]]), _hoisted_1 = { class: "flex items-center gap-x-2" }, _hoisted_2 = {
|
|
3079
|
+
key: 1,
|
|
3080
|
+
class: "flex items-center flex-wrap gap-2"
|
|
3081
|
+
}, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3082
|
+
__name: "vs-input-file",
|
|
3083
|
+
props: /* @__PURE__ */ mergeModels({
|
|
3084
|
+
multiple: { type: Boolean },
|
|
3085
|
+
format: {},
|
|
3086
|
+
disabled: { type: Boolean }
|
|
3087
|
+
}, {
|
|
3088
|
+
modelValue: {},
|
|
3089
|
+
modelModifiers: {}
|
|
3090
|
+
}),
|
|
3091
|
+
emits: ["update:modelValue"],
|
|
3092
|
+
setup(e) {
|
|
3093
|
+
const t = e, n = useModel(e, "modelValue"), r = ref(null), o = (i) => Array.isArray(n.value) && n.value[i] || "", s = async (i) => {
|
|
3094
|
+
if (t.format) {
|
|
3095
|
+
const u = i.target.files?.[0];
|
|
3096
|
+
if (!u || !u.name.endsWith(t.format))
|
|
3097
|
+
return;
|
|
3098
|
+
}
|
|
3099
|
+
const l = i.target.files?.[0];
|
|
3100
|
+
if (!l) return;
|
|
3101
|
+
const c = await fileUpload(l, "1", "form", "table");
|
|
3102
|
+
n.value = t.multiple ? [...n.value || [], c.result?.file_path] : c.result?.file_path;
|
|
3103
|
+
};
|
|
3104
|
+
return (i, l) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
3105
|
+
createElementVNode("input", {
|
|
3106
|
+
class: "hidden",
|
|
3107
|
+
ref_key: "fileInput",
|
|
3108
|
+
ref: r,
|
|
3109
|
+
type: "file",
|
|
3110
|
+
onChange: s
|
|
3111
|
+
}, null, 544),
|
|
3112
|
+
!i.multiple && n.value ? (openBlock(), createBlock(VsInputFileListItem, {
|
|
3113
|
+
key: 0,
|
|
3114
|
+
item: n.value,
|
|
3115
|
+
"onUpdate:item": l[0] || (l[0] = (c) => n.value = c),
|
|
3116
|
+
value: n.value,
|
|
3117
|
+
"onUpdate:value": l[1] || (l[1] = (c) => n.value = c)
|
|
3118
|
+
}, null, 8, ["item", "value"])) : i.multiple ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
3119
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(n.value, (c, u) => (openBlock(), createBlock(VsInputFileListItem, {
|
|
3120
|
+
multiple: i.multiple,
|
|
3121
|
+
key: u,
|
|
3122
|
+
value: n.value,
|
|
3123
|
+
"onUpdate:value": l[2] || (l[2] = (a) => n.value = a),
|
|
3124
|
+
item: o(u)
|
|
3125
|
+
}, null, 8, ["multiple", "value", "item"]))), 128)),
|
|
3126
|
+
createElementVNode("div", {
|
|
3127
|
+
onClick: l[3] || (l[3] = (c) => !i.disabled && r.value?.click()),
|
|
3128
|
+
class: normalizeClass([
|
|
3129
|
+
"h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center transition-all duration-300",
|
|
3130
|
+
i.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:border-blue-500 hover:bg-blue-50"
|
|
3131
|
+
])
|
|
3132
|
+
}, [
|
|
3133
|
+
createVNode(IconPlus, { class: "w-6 h-6" })
|
|
3134
|
+
], 2)
|
|
3135
|
+
])) : createCommentVNode("", !0),
|
|
3136
|
+
i.multiple ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", {
|
|
3137
|
+
key: 2,
|
|
3138
|
+
onClick: l[4] || (l[4] = (c) => r.value?.click()),
|
|
3139
|
+
class: normalizeClass([i.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:border-blue-500", "h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])
|
|
3140
|
+
}, [
|
|
3141
|
+
createVNode(IconPlus, { class: "w-6 h-6" })
|
|
3142
|
+
], 2))
|
|
3143
|
+
]));
|
|
3144
|
+
}
|
|
3145
|
+
}), inputs = {
|
|
3146
|
+
VsInputText: _sfc_main$v,
|
|
3147
|
+
VsInputRadio: _sfc_main$r,
|
|
3148
|
+
"vs-input-text": _sfc_main$v,
|
|
3149
|
+
"vs-input-number": _sfc_main$u,
|
|
3150
|
+
"vs-input-radio": _sfc_main$r,
|
|
3151
|
+
"vs-input-select": _sfc_main$m,
|
|
3152
|
+
"vs-input-switcher": _sfc_main$l,
|
|
3153
|
+
"vs-input-static": _sfc_main$k,
|
|
3154
|
+
"vs-input-container": _sfc_main$g,
|
|
3155
|
+
// 'vs-input-date': VsInputDate,
|
|
3156
|
+
"vs-input-checkbox": VsInputCheckbox,
|
|
3157
|
+
"vs-input-file": _sfc_main$2
|
|
3158
|
+
}, _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3159
|
+
__name: "vs-compact-form-layout",
|
|
3160
|
+
props: {
|
|
3161
|
+
type: {
|
|
3162
|
+
type: String,
|
|
3163
|
+
default: ""
|
|
3164
|
+
},
|
|
3165
|
+
style: {
|
|
3166
|
+
type: Object,
|
|
3167
|
+
default: () => ({})
|
|
3168
|
+
},
|
|
3169
|
+
item: {
|
|
3170
|
+
type: Object,
|
|
3171
|
+
default: () => ({})
|
|
3172
|
+
},
|
|
3173
|
+
layout: {
|
|
3174
|
+
type: String,
|
|
3175
|
+
default: "default"
|
|
3176
|
+
}
|
|
3177
|
+
},
|
|
3178
|
+
setup(e) {
|
|
3179
|
+
const t = e, n = computed(() => layouts$1[`${t.layout}`]), r = computed(() => inputs?.[`vs-input-${t.type}`]);
|
|
3180
|
+
return (o, s) => (openBlock(), createBlock(resolveDynamicComponent(n.value), mergeProps(o.$attrs, {
|
|
3181
|
+
style: e.style,
|
|
3182
|
+
item: e.item
|
|
3183
|
+
}), {
|
|
3184
|
+
default: withCtx(() => [
|
|
3185
|
+
(openBlock(), createBlock(resolveDynamicComponent(r.value), mergeProps(o.$attrs, { style: e.style }), null, 16, ["style"]))
|
|
3186
|
+
]),
|
|
3187
|
+
_: 1
|
|
3188
|
+
}, 16, ["style", "item"]));
|
|
3189
|
+
}
|
|
3190
|
+
}), formErrorsUa = {
|
|
3191
|
+
required: "Це поле є обов’язковим",
|
|
3192
|
+
email: "Неправильний email"
|
|
3193
|
+
}, required = (e) => e ? !1 : formErrorsUa.required, email = (e) => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) && e ? formErrorsUa.email : !1, regexp = (e, t) => !t.pattern.test(e) && e ? t.message : !1, custom = (value, custom) => {
|
|
3194
|
+
const func = eval(custom.function);
|
|
3195
|
+
return func(value) ? !1 : custom.message;
|
|
3196
|
+
}, checkFormRules = (e, t) => {
|
|
3197
|
+
switch (typeof t == "string" ? t : t.type) {
|
|
3198
|
+
case "required":
|
|
3199
|
+
return required(e);
|
|
3200
|
+
case "email":
|
|
3201
|
+
return email(e);
|
|
3202
|
+
case "regexp":
|
|
3203
|
+
return regexp(e, t);
|
|
3204
|
+
case "custom":
|
|
3205
|
+
return custom(e, t);
|
|
3206
|
+
default:
|
|
3207
|
+
return !1;
|
|
3208
|
+
}
|
|
3209
|
+
};
|
|
3210
|
+
function useForm(e, t) {
|
|
3211
|
+
const n = ref({}), r = (i = t, l = !0) => {
|
|
3212
|
+
if (i.forEach((c) => {
|
|
3213
|
+
c.rules && c.rules.forEach((u) => {
|
|
3214
|
+
n.value[c.name] = checkFormRules(e.value[c.name], u);
|
|
3215
|
+
}), c.schema && r(c.schema, !1);
|
|
3216
|
+
}), l && Object.values(n.value).some(Boolean))
|
|
3217
|
+
throw new Error("Помилка валідації");
|
|
3218
|
+
}, o = computed(() => t?.filter((i) => {
|
|
3219
|
+
const l = i?.conditions;
|
|
3220
|
+
if (!l) return !0;
|
|
3221
|
+
const c = Array.isArray(l) ? l[0] : l, u = e?.value?.[c];
|
|
3222
|
+
return isVisible(u, l);
|
|
3223
|
+
}));
|
|
3224
|
+
return {
|
|
3225
|
+
errors: n,
|
|
3226
|
+
validate: r,
|
|
3227
|
+
reset: () => {
|
|
3228
|
+
e.value = {}, n.value = {};
|
|
3229
|
+
},
|
|
3230
|
+
visibleSchema: o
|
|
3231
|
+
};
|
|
3232
|
+
}
|
|
3233
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3234
|
+
__name: "vs-compact-form",
|
|
3235
|
+
props: /* @__PURE__ */ mergeModels({
|
|
3236
|
+
schema: {
|
|
3237
|
+
type: Array,
|
|
3238
|
+
default: () => []
|
|
3239
|
+
},
|
|
3240
|
+
style: {
|
|
3241
|
+
type: Object,
|
|
3242
|
+
default: () => ({})
|
|
3243
|
+
}
|
|
3244
|
+
}, {
|
|
3245
|
+
form: { default: () => ({}) },
|
|
3246
|
+
formModifiers: {},
|
|
3247
|
+
formValues: { default: () => ({}) },
|
|
3248
|
+
formValuesModifiers: {}
|
|
3249
|
+
}),
|
|
3250
|
+
emits: /* @__PURE__ */ mergeModels(["handle-submit"], ["update:form", "update:formValues"]),
|
|
3251
|
+
setup(e, { emit: t }) {
|
|
3252
|
+
const n = t, r = e, o = useAttrs(), s = useModel(e, "form"), i = useModel(e, "formValues"), {
|
|
3253
|
+
errors: l,
|
|
3254
|
+
validate: c,
|
|
3255
|
+
reset: u,
|
|
3256
|
+
visibleSchema: a
|
|
3257
|
+
} = useForm(i, r.schema), d = () => {
|
|
3258
|
+
c(), n("handle-submit", i.value);
|
|
3259
|
+
};
|
|
3260
|
+
return onMounted(() => {
|
|
3261
|
+
s.value.value = i.value, s.value.errors = l.value, s.value.reset = u, s.value.validate = c;
|
|
3262
|
+
}), provide("form", s), provide("formValues", i), (f, h) => (openBlock(), createElementBlock("form", {
|
|
3263
|
+
onSubmit: withModifiers(d, ["prevent"]),
|
|
3264
|
+
class: "grid grid-cols-12 gap-3"
|
|
3265
|
+
}, [
|
|
3266
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (p) => (openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
3267
|
+
key: p.name,
|
|
3268
|
+
class: `col-span-${p.col || 12} `
|
|
3269
|
+
}, { ref_for: !0 }, { ...unref(o), ...e.style, ...p }, {
|
|
3270
|
+
item: p,
|
|
3271
|
+
modelValue: i.value[p.name],
|
|
3272
|
+
"onUpdate:modelValue": (y) => i.value[p.name] = y,
|
|
3273
|
+
style: e.style,
|
|
3274
|
+
error: unref(l)[p.name]
|
|
3275
|
+
}), null, 16, ["class", "item", "modelValue", "onUpdate:modelValue", "style", "error"]))), 128))
|
|
3276
|
+
], 32));
|
|
3277
|
+
}
|
|
3278
|
+
});
|
|
3279
|
+
_sfc_main.install = function e(t) {
|
|
3280
|
+
t.component("VForm", _sfc_main);
|
|
3281
|
+
};
|
|
3282
|
+
export {
|
|
3283
|
+
_sfc_main as VForm,
|
|
3284
|
+
_sfc_main$v as VsInputText,
|
|
3285
|
+
_sfc_main as default
|
|
3286
|
+
};
|