import { n as e, r as t } from "./component-AqiMonitor-BUy1MSaP.mjs";
import { A as n, C as r, D as i, E as a, M as o, N as s, O as ee, P as c, S as l, T as u, _ as d, a as f, b as te, c as ne, d as re, f as ie, g as ae, h as p, i as m, j as h, k as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, u as w, v as T, w as E, x as D, y as O } from "./component-HighwayWeatherForecast-BplmvdB0.mjs";
import { n as k } from "./component-LithiumBatteryMiningArea-uQetbL3w.mjs";
import { ElLoadingDirective as A } from "element-plus/es";
import { Fragment as j, createElementBlock as M, createElementVNode as N, defineComponent as P, getCurrentInstance as F, onMounted as I, openBlock as L, ref as R, renderList as z, toDisplayString as B, withDirectives as V } from "vue";
//#region src/components/WeatherForecast/WeatherForecast.vue?vue&type=script&setup=true&lang.ts
var H = {
	class: "WeatherForecast",
	"element-loading-background": "rgba(0, 0, 0, 0.4)"
}, U = { class: "WeatherForecast__head" }, W = { class: "WeatherForecast__head-top" }, G = { class: "WeatherForecast__body" }, K = { class: "WeatherForecast__wrap" }, q = ["src", "alt"], J = /* @__PURE__ */ e(/* @__PURE__ */ P({
	__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(e, { emit: P }) {
		let J = F()?.appContext.config.globalProperties.$bus, Y = e, oe = P, X = R(!1), Z = R([]), Q = R({});
		R([
			{
				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"
			}
		]), R(null);
		let $ = R(!1);
		I(() => {
			J?.on("toComponent", (e) => {
				e.componentName === "WeatherForecast" && (Q.value = e.data, se());
			});
		}), document.addEventListener("click", (e) => {
			e.target.closest(".WeatherForecast__area-select") || ($.value = !1);
		});
		let se = async () => {
			await le();
		}, ce = () => {
			oe("close", "WeatherForecast");
		}, le = async () => {
			X.value = !0;
			let e = {
				lon: Q.value.longitude,
				lat: Q.value.latitude,
				hours: 168
			}, A = await t({
				appKey: Y.appKey,
				appSalt: Y.appSalt,
				id: Y.ids.data.id,
				variables: { str: k.encode(JSON.stringify(e)) },
				baseHttp: Y.baseHttp,
				reqType: Y.ids.data.reqType,
				isFormData: Y.ids.data.isFormData
			});
			X.value = !1;
			let j = A.data?.result?.output;
			if (!j) {
				console.warn("天气预报接口返回为空", A), Z.value = [];
				return;
			}
			let M = (typeof j == "string" ? JSON.parse(j) : j).ds;
			if (!Array.isArray(M) || M.length === 0) {
				Z.value = [];
				return;
			}
			let N = [
				"日",
				"一",
				"二",
				"三",
				"四",
				"五",
				"六"
			];
			Z.value = M.map((e, t) => {
				let k = new Date(e.observation_time.replace(/\//g, "-"));
				k.setDate(k.getDate() + t);
				let A = `${k.getMonth() + 1}`.padStart(2, "0"), j = `${k.getDate()}`.padStart(2, "0");
				return {
					...e,
					_date: `${A}-${j}`,
					_week: `周${N[k.getDay()]}`,
					_icon: new URL((/* @__PURE__ */ Object.assign({
						"../../assets/img/weatherIcon/0.gif": c,
						"../../assets/img/weatherIcon/1.gif": s,
						"../../assets/img/weatherIcon/10.gif": o,
						"../../assets/img/weatherIcon/11.gif": h,
						"../../assets/img/weatherIcon/12.gif": n,
						"../../assets/img/weatherIcon/13.gif": g,
						"../../assets/img/weatherIcon/14.gif": ee,
						"../../assets/img/weatherIcon/15.gif": i,
						"../../assets/img/weatherIcon/16.gif": a,
						"../../assets/img/weatherIcon/17.gif": u,
						"../../assets/img/weatherIcon/18.gif": E,
						"../../assets/img/weatherIcon/19.gif": r,
						"../../assets/img/weatherIcon/2.gif": l,
						"../../assets/img/weatherIcon/20.gif": D,
						"../../assets/img/weatherIcon/21.gif": te,
						"../../assets/img/weatherIcon/22.gif": O,
						"../../assets/img/weatherIcon/23.gif": T,
						"../../assets/img/weatherIcon/24.gif": d,
						"../../assets/img/weatherIcon/25.gif": ae,
						"../../assets/img/weatherIcon/26.gif": p,
						"../../assets/img/weatherIcon/27.gif": v,
						"../../assets/img/weatherIcon/28.gif": x,
						"../../assets/img/weatherIcon/29.gif": ie,
						"../../assets/img/weatherIcon/3.gif": re,
						"../../assets/img/weatherIcon/30.gif": w,
						"../../assets/img/weatherIcon/31.gif": _,
						"../../assets/img/weatherIcon/4.gif": ne,
						"../../assets/img/weatherIcon/5.gif": C,
						"../../assets/img/weatherIcon/53.gif": b,
						"../../assets/img/weatherIcon/6.gif": f,
						"../../assets/img/weatherIcon/7.gif": m,
						"../../assets/img/weatherIcon/8.gif": S,
						"../../assets/img/weatherIcon/9.gif": y
					}))[`../../assets/img/weatherIcon/${e.weatherPhenomenon}.gif`], import.meta.url).href
				};
			});
		};
		return (t, n) => {
			let r = A;
			return V((L(), M("div", H, [N("div", U, [N("div", W, [N("div", null, B(e.title), 1), N("div", {
				class: "closeBtn",
				onClick: ce,
				title: "关闭"
			})]), n[0] ||= N("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)]), N("div", G, [N("div", K, [(L(!0), M(j, null, z(Z.value, (e) => (L(), M("div", {
				class: "WeatherForecast__item",
				key: `${e.observation_time}-${e.hour}`
			}, [
				N("div", null, B(e._date), 1),
				N("div", null, B(e._week), 1),
				N("img", {
					src: e._icon,
					alt: e.weather
				}, null, 8, q),
				N("div", null, B(e.weather), 1),
				N("div", null, B(e.temp_low) + "~" + B(e.temp_high) + "℃", 1),
				N("div", null, B(e.wind_directinfo), 1),
				N("div", null, B(e.wind_speedinfo === null || Number(e.wind_speedinfo) < 3 ? "<3级" : `${e.wind_speedinfo}级`), 1)
			]))), 128))])])])), [[r, X.value]]);
		};
	}
}), [["__scopeId", "data-v-a730bcd5"]]);
//#endregion
export { J as t };
