@qynpm/ui 1.0.22 → 1.0.23
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 +7 -5
- package/dist/index.cjs +3 -2
- package/dist/index.mjs +16 -14
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +1 -1
- package/dist/qy-autocomplete/index.cjs +1 -1
- package/dist/qy-autocomplete/index.mjs +4 -2
- package/dist/qy-checkbox/index.cjs +1 -1
- package/dist/qy-checkbox/index.mjs +4 -2
- package/dist/qy-date-picker/index.cjs +1 -1
- package/dist/qy-date-picker/index.mjs +4 -2
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +1 -1
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +1 -1
- package/dist/qy-image/index.cjs +1 -1
- package/dist/qy-image/index.mjs +4 -2
- package/dist/qy-image-preview/index.cjs +1 -1
- package/dist/qy-image-preview/index.mjs +6 -3
- package/dist/qy-image-upload/index.cjs +1 -1
- package/dist/qy-image-upload/index.mjs +1 -1
- package/dist/qy-input-number/index.cjs +1 -1
- package/dist/qy-input-number/index.mjs +4 -2
- package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
- package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
- package/dist/qy-menu-actions/index.cjs +1 -1
- package/dist/qy-menu-actions/index.mjs +1 -1
- package/dist/qy-money-input/index.cjs +1 -1
- package/dist/qy-money-input/index.mjs +1 -1
- package/dist/qy-radio-group/index.cjs +1 -1
- package/dist/qy-radio-group/index.mjs +1 -1
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +1 -1
- package/dist/qy-remark-image/index.cjs +1 -1
- package/dist/qy-remark-image/index.mjs +1 -1
- package/dist/qy-remote-select/index.cjs +1 -1
- package/dist/qy-remote-select/index.mjs +1 -1
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +1 -1
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +4 -2
- package/dist/qy-selection-dialog/index.cjs +1 -1
- package/dist/qy-selection-dialog/index.mjs +1 -1
- package/dist/qy-table-column-settings/index.cjs +1 -1
- package/dist/qy-table-column-settings/index.mjs +1 -1
- package/dist/qy-tree-select/index.cjs +1 -1
- package/dist/qy-tree-select/index.mjs +4 -2
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +1 -1
- package/dist/shared/index-BXlQSIWX.mjs +119 -0
- package/dist/shared/index-D3l7tLgw.cjs +1 -0
- package/dist/shared/index-DyK6vf5h.cjs +1 -0
- package/dist/shared/index-ZLoAI88M.mjs +3418 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-5gku7Zwv.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BJakDlgd.mjs +70 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-C-Pf9TJ0.mjs +152 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-CKp87br2.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-CelW13DE.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DA1Nh7U1.mjs +130 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DEpXmMj5.mjs +162 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DNEVwqm7.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DWS8bsiP.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DfKTEci_.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DoL8xnpo.mjs +48 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-EiHoQBXt.mjs +94 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-gTkP1LWg.mjs +61 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-svvSFv2K.cjs +1 -0
- package/dist/shared/utils-D2KAQCCB.cjs +1 -0
- package/dist/shared/utils-DUntDntI.mjs +112 -0
- package/package.json +218 -218
- package/dist/shared/index-BMqHC4GE.mjs +0 -4239
- package/dist/shared/index-Cuw6WFH3.cjs +0 -1
- /package/dist/shared/{index-BZ2L7Rch.cjs → index-B3U7dqMt.cjs} +0 -0
- /package/dist/shared/{index-BnMUdIAd.cjs → index-BbpD7hM0.cjs} +0 -0
- /package/dist/shared/{index-DaqN69ii.mjs → index-D7lMppIb.mjs} +0 -0
- /package/dist/shared/{index-D8iNLsjJ.mjs → index-NCpeoBUZ.mjs} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineComponent as x, useAttrs as K, ref as M, computed as s, unref as r, openBlock as k, createBlock as q, mergeProps as F } from "vue";
|
|
2
|
+
import { ElAutocomplete as I } from "element-plus";
|
|
3
|
+
const T = /* @__PURE__ */ x({
|
|
4
|
+
name: "QyAutocomplete",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { default: "" },
|
|
9
|
+
options: { default: () => [] },
|
|
10
|
+
valueKey: { default: "value" },
|
|
11
|
+
labelKey: { default: "label" },
|
|
12
|
+
placeholder: { default: "请输入" },
|
|
13
|
+
disabled: { type: Boolean, default: !1 },
|
|
14
|
+
clearable: { type: Boolean, default: !0 },
|
|
15
|
+
size: { default: void 0 },
|
|
16
|
+
teleported: { type: Boolean, default: !0 },
|
|
17
|
+
appendTo: { default: "body" },
|
|
18
|
+
popperClass: { default: "" },
|
|
19
|
+
filterMethod: { type: Function, default: void 0 }
|
|
20
|
+
},
|
|
21
|
+
emits: ["update:modelValue", "input", "change", "select", "focus", "blur", "clear"],
|
|
22
|
+
setup(t, { expose: f, emit: p }) {
|
|
23
|
+
const n = t, u = p, i = K(), d = M(null), m = s(
|
|
24
|
+
() => ["qy-autocomplete__popper", n.popperClass].filter(Boolean).join(" ")
|
|
25
|
+
), h = s(() => {
|
|
26
|
+
const e = r(n.options);
|
|
27
|
+
return (Array.isArray(e) ? e : r(e == null ? void 0 : e.value) || []).map((l) => ({
|
|
28
|
+
...l,
|
|
29
|
+
value: (l == null ? void 0 : l[n.valueKey]) ?? (l == null ? void 0 : l.value) ?? (l == null ? void 0 : l[n.labelKey]) ?? (l == null ? void 0 : l.label) ?? ""
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
function c(e, a) {
|
|
33
|
+
const l = String(e ?? ""), S = h.value.filter((o) => n.filterMethod ? n.filterMethod(l, o) : l ? String(o.value ?? "").includes(l) : !0);
|
|
34
|
+
a(S);
|
|
35
|
+
}
|
|
36
|
+
function b(e) {
|
|
37
|
+
u("update:modelValue", e);
|
|
38
|
+
}
|
|
39
|
+
function y(e) {
|
|
40
|
+
u("input", e);
|
|
41
|
+
}
|
|
42
|
+
function v(e) {
|
|
43
|
+
u("change", e);
|
|
44
|
+
}
|
|
45
|
+
function g(e) {
|
|
46
|
+
u("select", e);
|
|
47
|
+
}
|
|
48
|
+
function B(e) {
|
|
49
|
+
u("focus", e);
|
|
50
|
+
}
|
|
51
|
+
function C(e) {
|
|
52
|
+
u("blur", e);
|
|
53
|
+
}
|
|
54
|
+
function A() {
|
|
55
|
+
u("clear");
|
|
56
|
+
}
|
|
57
|
+
function V() {
|
|
58
|
+
var e, a;
|
|
59
|
+
(a = (e = d.value) == null ? void 0 : e.focus) == null || a.call(e);
|
|
60
|
+
}
|
|
61
|
+
function z() {
|
|
62
|
+
var e, a;
|
|
63
|
+
(a = (e = d.value) == null ? void 0 : e.blur) == null || a.call(e);
|
|
64
|
+
}
|
|
65
|
+
return f({
|
|
66
|
+
querySearch: c,
|
|
67
|
+
focus: V,
|
|
68
|
+
blur: z
|
|
69
|
+
}), (e, a) => (k(), q(r(I), F({
|
|
70
|
+
ref_key: "autocompleteRef",
|
|
71
|
+
ref: d
|
|
72
|
+
}, r(i), {
|
|
73
|
+
"model-value": t.modelValue,
|
|
74
|
+
"fetch-suggestions": c,
|
|
75
|
+
placeholder: t.placeholder,
|
|
76
|
+
disabled: t.disabled,
|
|
77
|
+
clearable: t.clearable,
|
|
78
|
+
size: t.size,
|
|
79
|
+
teleported: t.teleported,
|
|
80
|
+
"append-to": t.appendTo,
|
|
81
|
+
"popper-class": m.value,
|
|
82
|
+
"onUpdate:modelValue": b,
|
|
83
|
+
onInput: y,
|
|
84
|
+
onChange: v,
|
|
85
|
+
onSelect: g,
|
|
86
|
+
onFocus: B,
|
|
87
|
+
onBlur: C,
|
|
88
|
+
onClear: A
|
|
89
|
+
}), null, 16, ["model-value", "placeholder", "disabled", "clearable", "size", "teleported", "append-to", "popper-class"]));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
export {
|
|
93
|
+
T as _
|
|
94
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defineComponent as h, useAttrs as V, ref as g, computed as u, openBlock as x, createBlock as k, unref as y, mergeProps as B, withCtx as v, renderSlot as C } from "vue";
|
|
2
|
+
import { ElCheckbox as z } from "element-plus";
|
|
3
|
+
const F = /* @__PURE__ */ h({
|
|
4
|
+
name: "QyCheckbox",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { type: [String, Number, Boolean], default: !1 },
|
|
9
|
+
disabled: { type: Boolean, default: !1 },
|
|
10
|
+
size: { default: void 0 },
|
|
11
|
+
trueValue: { type: [String, Number, Boolean], default: !0 },
|
|
12
|
+
falseValue: { type: [String, Number, Boolean], default: !1 }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue", "change", "focus", "blur"],
|
|
15
|
+
setup(l, { expose: n, emit: r }) {
|
|
16
|
+
const t = l, a = r, s = V(), o = g(null), d = u(() => typeof t.trueValue == "boolean" && typeof t.falseValue == "boolean" ? {} : {
|
|
17
|
+
trueValue: t.trueValue,
|
|
18
|
+
falseValue: t.falseValue
|
|
19
|
+
}), f = u(() => ({
|
|
20
|
+
...s,
|
|
21
|
+
...d.value
|
|
22
|
+
}));
|
|
23
|
+
function c(e) {
|
|
24
|
+
a("update:modelValue", e);
|
|
25
|
+
}
|
|
26
|
+
function i(e) {
|
|
27
|
+
a("change", e);
|
|
28
|
+
}
|
|
29
|
+
function m(e) {
|
|
30
|
+
a("focus", e);
|
|
31
|
+
}
|
|
32
|
+
function p(e) {
|
|
33
|
+
a("blur", e);
|
|
34
|
+
}
|
|
35
|
+
function b() {
|
|
36
|
+
return o.value;
|
|
37
|
+
}
|
|
38
|
+
return n({
|
|
39
|
+
getCheckboxInstance: b
|
|
40
|
+
}), (e, S) => (x(), k(y(z), B({
|
|
41
|
+
ref_key: "checkboxRef",
|
|
42
|
+
ref: o
|
|
43
|
+
}, f.value, {
|
|
44
|
+
"model-value": l.modelValue,
|
|
45
|
+
disabled: l.disabled,
|
|
46
|
+
size: l.size,
|
|
47
|
+
"onUpdate:modelValue": c,
|
|
48
|
+
onChange: i,
|
|
49
|
+
onFocus: m,
|
|
50
|
+
onBlur: p
|
|
51
|
+
}), {
|
|
52
|
+
default: v(() => [
|
|
53
|
+
C(e.$slots, "default")
|
|
54
|
+
]),
|
|
55
|
+
_: 3
|
|
56
|
+
}, 16, ["model-value", "disabled", "size"]));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export {
|
|
60
|
+
F as _
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("vue"),R=require("element-plus"),$=l.defineComponent({name:"QyDatePicker",inheritAttrs:!1,__name:"index",props:{modelValue:{default:void 0},type:{default:"date"},placeholder:{default:"请选择日期"},startPlaceholder:{default:"开始时间"},endPlaceholder:{default:"结束时间"},rangeSeparator:{default:"-"},format:{default:void 0},valueFormat:{default:void 0},defaultTime:{default:void 0},disabledDate:{type:Function,default:void 0},shortcuts:{default:void 0},clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},size:{default:void 0},teleported:{type:Boolean,default:!0},appendTo:{default:"body"},popperClass:{default:""},normalizeRangeEndTime:{type:Boolean,default:!1}},emits:["update:modelValue","change","clear","calendar-change","panel-change","visible-change","focus","blur"],setup(t,{expose:c,emit:i}){const r=t,n=i,s=l.useAttrs(),o=l.ref(null),f=l.computed(()=>["qy-date-picker__popper",r.popperClass].filter(Boolean).join(" "));function h(e){return Array.isArray(e)}function p(e){const a=new Date(e);return a.getHours()===0&&a.getMinutes()===0&&a.getSeconds()===0&&a.setHours(23,59,59,0),a}function m(e){return/\s00:00:00$/.test(e)?e.replace(/\s00:00:00$/," 23:59:59"):/T00:00:00(?:\.000)?(?:Z|[+-]\d{2}:?\d{2})?$/.test(e)?e.replace(/T00:00:00(\.000)?(Z|[+-]\d{2}:?\d{2})?$/,"T23:59:59$1$2"):e}function u(e){if(!r.normalizeRangeEndTime||!h(e)||e.length<2)return e;const a=[...e],d=a[1];return d instanceof Date?a[1]=p(d):typeof d=="string"&&(a[1]=m(d)),a}function g(e){n("update:modelValue",u(e))}function b(e){n("change",u(e))}function C(){n("clear")}function y(e){n("calendar-change",e)}function v(e,a,d){n("panel-change",e,a,d)}function P(e){n("visible-change",e)}function V(e){n("focus",e)}function z(e){n("blur",e)}function B(){var e,a;(a=(e=o.value)==null?void 0:e.focus)==null||a.call(e)}function T(){var e,a;(a=(e=o.value)==null?void 0:e.blur)==null||a.call(e)}function k(){var e,a;(a=(e=o.value)==null?void 0:e.handleOpen)==null||a.call(e)}function D(){var e,a;(a=(e=o.value)==null?void 0:e.handleClose)==null||a.call(e)}return c({focus:B,blur:T,handleOpen:k,handleClose:D}),(e,a)=>(l.openBlock(),l.createBlock(l.unref(R.ElDatePicker),l.mergeProps({ref_key:"datePickerRef",ref:o},l.unref(s),{"model-value":t.modelValue,type:t.type,placeholder:t.placeholder,"start-placeholder":t.startPlaceholder,"end-placeholder":t.endPlaceholder,"range-separator":t.rangeSeparator,format:t.format,"value-format":t.valueFormat,"default-time":t.defaultTime,"disabled-date":t.disabledDate,shortcuts:t.shortcuts,clearable:t.clearable,disabled:t.disabled,size:t.size,teleported:t.teleported,"append-to":t.appendTo,"popper-class":f.value,"onUpdate:modelValue":g,onChange:b,onClear:C,onCalendarChange:y,onPanelChange:v,onVisibleChange:P,onFocus:V,onBlur:z}),null,16,["model-value","type","placeholder","start-placeholder","end-placeholder","range-separator","format","value-format","default-time","disabled-date","shortcuts","clearable","disabled","size","teleported","append-to","popper-class"]))}});exports._sfc_main=$;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("vue"),m=require("element-plus"),f={w:200,h:200,q:50};function l(t){const r=String(t||"").trim();return r?r.includes("ys.diansan.com")?r.replace(/^http:\/\//,"https://").replace("ys.diansan.com","admin.qiyinbz.com"):r:""}function h(t,r=!0){const n=String(t||"").trim();if(!n)return"";const e=l(n);if(!r)return e;const o=d(r);return n.includes("ys.diansan.com")?`${e}?small=true&style=image/resize,h_${o.h},w_${o.w}`:`${e}?w=${o.w}`}async function w(t,r={}){const n=l(t);if(!n)throw new Error("图片地址不能为空");const e=r.compressor??!0;if(!e)return{src:n,source:"original"};const o=h(t,e),i=r.loadBlob??b,a=r.compressBlob??I;try{return await i(o),{src:o,source:"thumbnail"}}catch{const c=await i(n);return{src:await a(c,d(e)),source:"fallback"}}}function y(t={}){if(typeof document>"u")return{close(){}};const r=g(t.urlList,t.url);if(!r.length)return{close(){}};const n=globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__??u.createApp,e=document.createElement("div"),o=document.body.style.overflow;let i=!1,a;const c=()=>{var s;i||(i=!0,document.body.style.overflow=o,(s=a==null?void 0:a.unmount)==null||s.call(a),e.parentNode&&e.parentNode.removeChild(e))};return document.body.appendChild(e),document.body.style.overflow="hidden",a=n({setup(){return()=>u.h(m.ElImageViewer,{urlList:r,initialIndex:t.initialIndex??0,hideOnClickModal:t.hideOnClickModal??!0,teleport:"body",onClose:c})}}),a.mount(e),{close:c}}function d(t){return{...f,...typeof t=="object"?t:{}}}function g(t,r){return(Array.isArray(t)?t:[r]).map(e=>l(e)).filter(Boolean)}async function b(t){const r=await fetch(t,{redirect:"follow"});if(!r.ok)throw new Error(t);return r.blob()}async function I(t,r){if(typeof document>"u"||typeof Image>"u")return R(t);const n=URL.createObjectURL(t);try{const e=await p(n),o=document.createElement("canvas"),i=v(e,r);return o.width=Math.max(1,Math.round(e.naturalWidth*i)),o.height=Math.max(1,Math.round(e.naturalHeight*i)),o.getContext("2d").drawImage(e,0,0,o.width,o.height),o.toDataURL(t.type||"image/jpeg",r.q/100)}finally{URL.revokeObjectURL(n)}}function p(t){return new Promise((r,n)=>{const e=new Image;e.onload=()=>r(e),e.onerror=n,e.src=t})}function v(t,r){const n=r.w?r.w/t.naturalWidth:1,e=r.h?r.h/t.naturalHeight:1;return Math.min(1,n,e)}function R(t){return new Promise((r,n)=>{const e=new FileReader;e.onloadend=()=>r(e.result),e.onerror=n,e.readAsDataURL(t)})}exports.normalizeImageSrc=l;exports.openQyImagePreview=y;exports.resolveQyImageDisplaySrc=w;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { h as d, createApp as m } from "vue";
|
|
2
|
+
import { ElImageViewer as f } from "element-plus";
|
|
3
|
+
const h = {
|
|
4
|
+
w: 200,
|
|
5
|
+
h: 200,
|
|
6
|
+
q: 50
|
|
7
|
+
};
|
|
8
|
+
function l(t) {
|
|
9
|
+
const r = String(t || "").trim();
|
|
10
|
+
return r ? r.includes("ys.diansan.com") ? r.replace(/^http:\/\//, "https://").replace("ys.diansan.com", "admin.qiyinbz.com") : r : "";
|
|
11
|
+
}
|
|
12
|
+
function w(t, r = !0) {
|
|
13
|
+
const n = String(t || "").trim();
|
|
14
|
+
if (!n) return "";
|
|
15
|
+
const e = l(n);
|
|
16
|
+
if (!r) return e;
|
|
17
|
+
const o = u(r);
|
|
18
|
+
return n.includes("ys.diansan.com") ? `${e}?small=true&style=image/resize,h_${o.h},w_${o.w}` : `${e}?w=${o.w}`;
|
|
19
|
+
}
|
|
20
|
+
async function S(t, r = {}) {
|
|
21
|
+
const n = l(t);
|
|
22
|
+
if (!n) throw new Error("图片地址不能为空");
|
|
23
|
+
const e = r.compressor ?? !0;
|
|
24
|
+
if (!e)
|
|
25
|
+
return {
|
|
26
|
+
src: n,
|
|
27
|
+
source: "original"
|
|
28
|
+
};
|
|
29
|
+
const o = w(t, e), i = r.loadBlob ?? g, a = r.compressBlob ?? b;
|
|
30
|
+
try {
|
|
31
|
+
return await i(o), {
|
|
32
|
+
src: o,
|
|
33
|
+
source: "thumbnail"
|
|
34
|
+
};
|
|
35
|
+
} catch {
|
|
36
|
+
const c = await i(n);
|
|
37
|
+
return {
|
|
38
|
+
src: await a(c, u(e)),
|
|
39
|
+
source: "fallback"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function _(t = {}) {
|
|
44
|
+
if (typeof document > "u") return { close() {
|
|
45
|
+
} };
|
|
46
|
+
const r = y(t.urlList, t.url);
|
|
47
|
+
if (!r.length) return { close() {
|
|
48
|
+
} };
|
|
49
|
+
const n = globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__ ?? m, e = document.createElement("div"), o = document.body.style.overflow;
|
|
50
|
+
let i = !1, a;
|
|
51
|
+
const c = () => {
|
|
52
|
+
var s;
|
|
53
|
+
i || (i = !0, document.body.style.overflow = o, (s = a == null ? void 0 : a.unmount) == null || s.call(a), e.parentNode && e.parentNode.removeChild(e));
|
|
54
|
+
};
|
|
55
|
+
return document.body.appendChild(e), document.body.style.overflow = "hidden", a = n({
|
|
56
|
+
setup() {
|
|
57
|
+
return () => d(f, {
|
|
58
|
+
urlList: r,
|
|
59
|
+
initialIndex: t.initialIndex ?? 0,
|
|
60
|
+
hideOnClickModal: t.hideOnClickModal ?? !0,
|
|
61
|
+
teleport: "body",
|
|
62
|
+
onClose: c
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}), a.mount(e), { close: c };
|
|
66
|
+
}
|
|
67
|
+
function u(t) {
|
|
68
|
+
return {
|
|
69
|
+
...h,
|
|
70
|
+
...typeof t == "object" ? t : {}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function y(t, r) {
|
|
74
|
+
return (Array.isArray(t) ? t : [r]).map((e) => l(e)).filter(Boolean);
|
|
75
|
+
}
|
|
76
|
+
async function g(t) {
|
|
77
|
+
const r = await fetch(t, { redirect: "follow" });
|
|
78
|
+
if (!r.ok) throw new Error(t);
|
|
79
|
+
return r.blob();
|
|
80
|
+
}
|
|
81
|
+
async function b(t, r) {
|
|
82
|
+
if (typeof document > "u" || typeof Image > "u")
|
|
83
|
+
return v(t);
|
|
84
|
+
const n = URL.createObjectURL(t);
|
|
85
|
+
try {
|
|
86
|
+
const e = await p(n), o = document.createElement("canvas"), i = I(e, r);
|
|
87
|
+
return o.width = Math.max(1, Math.round(e.naturalWidth * i)), o.height = Math.max(1, Math.round(e.naturalHeight * i)), o.getContext("2d").drawImage(e, 0, 0, o.width, o.height), o.toDataURL(t.type || "image/jpeg", r.q / 100);
|
|
88
|
+
} finally {
|
|
89
|
+
URL.revokeObjectURL(n);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function p(t) {
|
|
93
|
+
return new Promise((r, n) => {
|
|
94
|
+
const e = new Image();
|
|
95
|
+
e.onload = () => r(e), e.onerror = n, e.src = t;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function I(t, r) {
|
|
99
|
+
const n = r.w ? r.w / t.naturalWidth : 1, e = r.h ? r.h / t.naturalHeight : 1;
|
|
100
|
+
return Math.min(1, n, e);
|
|
101
|
+
}
|
|
102
|
+
function v(t) {
|
|
103
|
+
return new Promise((r, n) => {
|
|
104
|
+
const e = new FileReader();
|
|
105
|
+
e.onloadend = () => r(e.result), e.onerror = n, e.readAsDataURL(t);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
l as n,
|
|
110
|
+
_ as o,
|
|
111
|
+
S as r
|
|
112
|
+
};
|