import { n as e, r as t } from "./component-AqiMonitor-BUy1MSaP.mjs";
import { Fragment as n, computed as r, createElementBlock as i, createElementVNode as a, defineComponent as o, normalizeClass as s, onMounted as c, openBlock as l, ref as u, renderList as d, toDisplayString as f } from "vue";
//#region src/components/MaterialPreview/MaterialPreview.vue?vue&type=script&setup=true&lang.ts
var p = { class: "MaterialPreview" }, m = { class: "MaterialPreview__list" }, h = ["onClick"], g = { class: "MaterialPreview__file-name" }, _ = ["src"], v = /* @__PURE__ */ e(/* @__PURE__ */ o({
	__name: "MaterialPreview",
	props: {
		appKey: {
			type: String,
			default: ""
		},
		appSalt: {
			type: String,
			default: ""
		},
		baseHttp: {
			type: String,
			default: ""
		},
		ids: {
			type: Object,
			default: () => ({})
		}
	},
	setup(e) {
		let o = e, v = u([]), y = u(-1), b = r(() => {
			let e = v.value[y.value];
			return !e || !e.http_png ? [] : e.http_png.split(",").map((e) => e.trim()).filter(Boolean);
		});
		c(() => {
			x();
		});
		let x = async () => {
			v.value = (await t({
				appKey: o.appKey,
				appSalt: o.appSalt,
				id: o.ids.data.id,
				variables: { materialType: "供电气象服务" },
				baseHttp: o.baseHttp,
				reqType: o.ids.data.reqType,
				isFormData: o.ids.data.isFormData
			})).data.result.output || [], v.value.length > 0 && (y.value = 0);
		};
		return (e, t) => (l(), i("div", p, [a("div", m, [(l(!0), i(n, null, d(v.value, (e, t) => (l(), i("div", {
			key: e.title,
			class: s(["MaterialPreview__file", { "is-active": y.value === t }]),
			onClick: (e) => y.value = t
		}, [a("span", g, f(e.title), 1)], 10, h))), 128))]), (l(), i("div", {
			class: "MaterialPreview__preview",
			key: y.value
		}, [(l(!0), i(n, null, d(b.value, (e, t) => (l(), i("img", {
			key: t,
			src: e,
			alt: ""
		}, null, 8, _))), 128))]))]));
	}
}), [["__scopeId", "data-v-b23b21e9"]]);
//#endregion
export { v as t };
