import "./rolldown-runtime-Dd0fQ6-X.mjs";
import { a as e, n as t, r as n } from "./component-AqiMonitor-DoGm_NCt.mjs";
import { A as r, C as i, D as a, E as ee, M as o, N as s, O as c, P as te, S as ne, T as re, _ as ie, a as l, b as u, c as d, d as f, f as p, g as m, h, i as g, j as _, k as v, l as y, m as b, n as x, o as S, p as C, r as w, s as T, u as E, v as D, w as O, x as k, y as A } from "./component-HighwayWeatherForecast-Dn6tjaR-.mjs";
import { n as j } from "./component-LithiumBatteryMiningArea-Dj1DMKuU.mjs";
import { Fragment as M, createElementBlock as N, createElementVNode as P, defineComponent as F, getCurrentInstance as I, onMounted as L, openBlock as R, ref as z, renderList as B, toDisplayString as V, withDirectives as H } from "vue";
//#region src/components/WeatherForecast/WeatherForecast.vue?vue&type=script&setup=true&lang.ts
var U = {
	class: "WeatherForecast",
	"element-loading-background": "rgba(0, 0, 0, 0.4)"
}, W = { class: "WeatherForecast__head" }, G = { class: "WeatherForecast__head-top" }, K = { class: "WeatherForecast__body" }, q = { class: "WeatherForecast__wrap" }, J = ["src", "alt"], Y = /* @__PURE__ */ t(/* @__PURE__ */ F({
	__name: "WeatherForecast",
	props: {
		appKey: {
			type: String,
			default: ""
		},
		appSalt: {
			type: String,
			default: ""
		},
		baseHttp: {
			type: String,
			default: ""
		},
		ids: {
			type: Object,
			default: () => ({})
		},
		title: {
			type: String,
			default: "天气预报"
		}
	},
	emits: ["close"],
	setup(t, { emit: F }) {
		let Y = I()?.appContext.config.globalProperties.$bus, X = t, ae = F, Z = z(!1), Q = z([]), $ = z({});
		z([
			{
				name: "阿克苏市",
				value: "aksu",
				longitude: "80.2651",
				latitude: "41.1707"
			},
			{
				name: "库车市",
				value: "kuche",
				longitude: "82.9989",
				latitude: "41.7160"
			},
			{
				name: "拜城县",
				value: "baicheng",
				longitude: "81.8670",
				latitude: "41.7860"
			},
			{
				name: "新和县",
				value: "xinhe",
				longitude: "82.6100",
				latitude: "41.5490"
			},
			{
				name: "沙雅县",
				value: "shaya",
				longitude: "82.7800",
				latitude: "41.2200"
			},
			{
				name: "温宿县",
				value: "wensu",
				longitude: "80.3000",
				latitude: "41.1600"
			},
			{
				name: "乌什县",
				value: "wushi",
				longitude: "79.2300",
				latitude: "41.2100"
			},
			{
				name: "柯坪县",
				value: "keping",
				longitude: "79.0200",
				latitude: "40.5000"
			}
		]), z(null);
		let oe = z(!1);
		L(() => {
			Y?.on("toComponent", (e) => {
				e.componentName === "WeatherForecast" && ($.value = e.data, se());
			});
		}), document.addEventListener("click", (e) => {
			e.target.closest(".WeatherForecast__area-select") || (oe.value = !1);
		});
		let se = async () => {
			await le();
		}, ce = () => {
			ae("close", "WeatherForecast");
		}, le = async () => {
			Z.value = !0;
			let e = {
				lon: $.value.longitude,
				lat: $.value.latitude,
				hours: 168
			}, t = await n({
				appKey: X.appKey,
				appSalt: X.appSalt,
				id: X.ids.data.id,
				variables: { str: j.encode(JSON.stringify(e)) },
				baseHttp: X.baseHttp,
				reqType: X.ids.data.reqType,
				isFormData: X.ids.data.isFormData
			});
			Z.value = !1;
			let M = t.data?.result?.output;
			if (!M) {
				console.warn("天气预报接口返回为空", t), Q.value = [];
				return;
			}
			let N = (typeof M == "string" ? JSON.parse(M) : M).ds;
			if (!Array.isArray(N) || N.length === 0) {
				Q.value = [];
				return;
			}
			let P = [
				"日",
				"一",
				"二",
				"三",
				"四",
				"五",
				"六"
			];
			Q.value = N.map((e, t) => {
				let n = new Date(e.observation_time.replace(/\//g, "-"));
				n.setDate(n.getDate() + t);
				let j = `${n.getMonth() + 1}`.padStart(2, "0"), M = `${n.getDate()}`.padStart(2, "0");
				return {
					...e,
					_date: `${j}-${M}`,
					_week: `周${P[n.getDay()]}`,
					_icon: new URL((/* @__PURE__ */ Object.assign({
						"../../assets/img/weatherIcon/0.gif": te,
						"../../assets/img/weatherIcon/1.gif": s,
						"../../assets/img/weatherIcon/10.gif": o,
						"../../assets/img/weatherIcon/11.gif": _,
						"../../assets/img/weatherIcon/12.gif": r,
						"../../assets/img/weatherIcon/13.gif": v,
						"../../assets/img/weatherIcon/14.gif": c,
						"../../assets/img/weatherIcon/15.gif": a,
						"../../assets/img/weatherIcon/16.gif": ee,
						"../../assets/img/weatherIcon/17.gif": re,
						"../../assets/img/weatherIcon/18.gif": O,
						"../../assets/img/weatherIcon/19.gif": i,
						"../../assets/img/weatherIcon/2.gif": ne,
						"../../assets/img/weatherIcon/20.gif": k,
						"../../assets/img/weatherIcon/21.gif": u,
						"../../assets/img/weatherIcon/22.gif": A,
						"../../assets/img/weatherIcon/23.gif": D,
						"../../assets/img/weatherIcon/24.gif": ie,
						"../../assets/img/weatherIcon/25.gif": m,
						"../../assets/img/weatherIcon/26.gif": h,
						"../../assets/img/weatherIcon/27.gif": b,
						"../../assets/img/weatherIcon/28.gif": C,
						"../../assets/img/weatherIcon/29.gif": p,
						"../../assets/img/weatherIcon/3.gif": f,
						"../../assets/img/weatherIcon/30.gif": E,
						"../../assets/img/weatherIcon/31.gif": y,
						"../../assets/img/weatherIcon/4.gif": d,
						"../../assets/img/weatherIcon/5.gif": T,
						"../../assets/img/weatherIcon/53.gif": S,
						"../../assets/img/weatherIcon/6.gif": l,
						"../../assets/img/weatherIcon/7.gif": g,
						"../../assets/img/weatherIcon/8.gif": w,
						"../../assets/img/weatherIcon/9.gif": x
					}))[`../../assets/img/weatherIcon/${e.weatherPhenomenon}.gif`], import.meta.url).href
				};
			});
		};
		return (n, r) => {
			let i = e;
			return H((R(), N("div", U, [P("div", W, [P("div", G, [P("div", null, V(t.title), 1), P("div", {
				class: "closeBtn",
				onClick: ce,
				title: "关闭"
			})]), r[0] ||= P("img", {
				class: "WeatherForecast__head-line",
				src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbsAAAASBAMAAAAwI22/AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAwUExURQAAAAem/wem/wem/wem/wem/wem/wem/wem/wem/wem/wem/wem/wem/wem/wem/5bu5GYAAAAPdFJOUwAFwAwc2M8ULQYDn/hGXGnV2UoAAAGZSURBVEjH7ZM/S8NAGId/JYGmmeLspptThurk0CHWRXGo0Nk/S50y6CYSHMRF7Efo4uQXEIpbwUnM6OhnEIeChXjv5ZLLXdLtLCX68vDCe0eGJ7/3AJN1VcL+UImB/SruVJwYTqSAW5V3LLyaPR1c+IIdH12OPZiLcyTAjccZEdccZ0Nn4bXpC3KpCuFu5tkdziX3FJxBSBZZdFk9HempCduMk4xSitJTpOgJSSIPrx10YAUB0tYOwrQ1g12k7ZyODIYXZmQpppLV26rtbDFOXVhua2Fn7WTWwUEyAe5Zc2hiLWTTC3jjk8Hw+jrSM9/Z8raKOAtZVmyr9jbpee4lU9hvSUStw6YvOpqwiXlK9d8IL0Oq5tuqvc3KLMs7q9uyCC0y22aKvDVp4u2SjnJ1c+Wecg7h9gV4CFV8NHpEaw7yF2wVGcIa6OBx/Ax3PI6pRWx6Am98alBbpSODNVTxgAbQUpF3KeVv0s80xMUow8N//YVaqWEV9BJDdby2PBUZ1/te0uU0YzeLa623jjrrvaLOep/+str9ACyAtv25BhHcAAAAAElFTkSuQmCC",
				alt: ""
			}, null, -1)]), P("div", K, [P("div", q, [(R(!0), N(M, null, B(Q.value, (e) => (R(), N("div", {
				class: "WeatherForecast__item",
				key: `${e.observation_time}-${e.hour}`
			}, [
				P("div", null, V(e._date), 1),
				P("div", null, V(e._week), 1),
				P("img", {
					src: e._icon,
					alt: e.weather
				}, null, 8, J),
				P("div", null, V(e.weather), 1),
				P("div", null, V(e.temp_low) + "~" + V(e.temp_high) + "℃", 1),
				P("div", null, V(e.wind_directinfo), 1),
				P("div", null, V(e.wind_speedinfo === null || Number(e.wind_speedinfo) < 3 ? "<3级" : `${e.wind_speedinfo}级`), 1)
			]))), 128))])])])), [[i, Z.value]]);
		};
	}
}), [["__scopeId", "data-v-a730bcd5"]]);
//#endregion
export { Y as t };
