import { n as e, r as t } from "./component-AqiMonitor-BUy1MSaP.mjs";
import { n } from "./component-HighWayEarlyWarningRed-C5fDgaPG.mjs";
import { t as r } from "./component-RadarLegend-DW3-sWxw.mjs";
import { ElCheckbox as i, ElIcon as a, ElLoadingDirective as o } from "element-plus/es";
import { Fragment as s, computed as c, createBlock as l, createCommentVNode as ee, createElementBlock as u, createElementVNode as d, createTextVNode as te, createVNode as f, defineComponent as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as ne, onMounted as re, openBlock as _, ref as v, renderList as y, toDisplayString as b, unref as x, vShow as S, watch as C, withCtx as w, withDirectives as T } from "vue";
import { ArrowRight as E, VideoPause as ie, VideoPlay as ae } from "@element-plus/icons-vue";
import "element-plus/es/components/loading/style/css";
import "element-plus/es/components/checkbox/style/css";
import "element-plus/es/components/slider/style/css";
//#region src/components/RadarShortTerm/RadarShortTerm.vue?vue&type=script&setup=true&lang.ts
var oe = {
	class: "RadarShortTerm",
	"element-loading-background": "rgba(0, 0, 0, 0.4)"
}, se = { class: "RadarShortTerm-setting-panel" }, ce = { class: "display-setting" }, le = { class: "setting-row setting-row-pile" }, ue = { class: "setting-pile-options" }, de = { class: "RadarShortTerm-table" }, fe = { class: "table-head" }, pe = { class: "table-body" }, me = ["onClick"], he = { class: "name" }, ge = ["onClick"], _e = {
	key: 0,
	style: { color: "red" }
}, ve = { class: "pile-panel" }, ye = { class: "pile-head" }, be = {
	key: 0,
	class: "pile-body"
}, xe = ["onClick"], Se = {
	key: 1,
	class: "pile-empty"
}, Ce = { class: "RadarShortTerm-timeline" }, we = ["title"], Te = { class: "timeline-slider-wrap" }, Ee = { class: "timeline-time-label" }, De = { class: "radarAxis-li" }, Oe = ["onClick"], ke = { class: "radarAxis-li-node-text" }, D = /* @__PURE__ */ e(/* @__PURE__ */ p({
	__name: "RadarShortTerm",
	props: {
		appKey: {
			type: String,
			default: ""
		},
		appSalt: {
			type: String,
			default: ""
		},
		baseHttp: {
			type: String,
			default: ""
		},
		ids: {
			type: Object,
			default: () => ({})
		},
		type: {
			type: String,
			default: "高速"
		}
	},
	emits: [
		"close",
		"addDataTitle",
		"removeDataTitle",
		"showRadarLegend",
		"toMapView",
		"addImageAniArr",
		"clearImgAniArr",
		"setImgAniShowByIndex",
		"changeLoading"
	],
	setup(e, { emit: p }) {
		let D = e, O = p, k = v(!0), A = v(!1), j = v(0), M = v(null), N = v([]), P = v({}), F = v({}), I = v({}), L = v(""), R = v(null), z = v(!0), B = v(null), V = v(!0), H = v(null), U = v({
			httpurl: "",
			lngStart: void 0,
			latStart: void 0,
			lngEnd: void 0,
			latEnd: void 0
		}), W = v({
			httpurl: "",
			lngStart: void 0,
			latStart: void 0,
			lngEnd: void 0,
			latEnd: void 0
		});
		re(() => {
			G(), B.value = setInterval(() => {
				G();
			}, 1e3 * 60 * 10);
		}), ne(() => {
			Q(), clearInterval(B.value), B.value = null;
		});
		let G = async () => {
			z.value = !0, await K(), N.value = (await Ae()).map((e) => {
				let t = Fe(e), n = "";
				D.type === "高速" && (n = "zhflds"), D.type === "地质" && (n = "pointflds"), D.type === "水库" && (n = "pointflds");
				let r = Ie(e[n] || []);
				return {
					name: e.name,
					tags: Le(t),
					piles: r
				};
			}), Pe(), z.value = !1;
		}, K = async () => {
			z.value = !0;
			let e = await t({
				appKey: D.appKey,
				appSalt: D.appSalt,
				id: D.ids.radar.id,
				variables: {},
				baseHttp: D.baseHttp,
				reqType: D.ids.radar.reqType,
				isFormData: D.ids.radar.isFormData
			});
			console.log("雷达", e.data.result);
			let n = await t({
				appKey: D.appKey,
				appSalt: D.appSalt,
				id: D.ids.historyRadar.id,
				variables: {},
				baseHttp: D.baseHttp,
				reqType: D.ids.historyRadar.reqType,
				isFormData: D.ids.historyRadar.isFormData
			});
			console.log("历史雷达", n.data.result), z.value = !1;
			let r = Me(e.data.result), i = Me(n.data.result);
			U.value = {
				httpurl: r.httpurl,
				...r.extent
			}, W.value = {
				httpurl: i.httpurl,
				...i.extent
			};
			let a = i.frames.slice(-3).map((e, t) => ({
				...e,
				focarcast_time: e.observation_time,
				_isHistory: !0,
				_label: t === 0 ? "-2" : t === 1 ? "-1" : "现在",
				_httpurl: (i.httpurl || "") + (e.observation_time || "").slice(0, 10).replaceAll("-", "") + "/"
			})), o = r.frames.map((e, t) => ({
				...e,
				_isHistory: !1,
				_label: `+${t + 1}`,
				_httpurl: r.httpurl || ""
			})), s = [...a, ...o];
			I.value = {
				ds: s,
				httpurl: r.httpurl,
				...i.extent
			}, j.value = 2, k.value && (O("clearImgAniArr"), s.forEach((e) => {
				let t = ze(e);
				t && O("addImageAniArr", { data: { imgArr: [t] } });
			}), setTimeout(() => {
				O("setImgAniShowByIndex", { index: j.value });
				let e = s[j.value];
				Z(e), O("showRadarLegend", !0);
			}, 1e3));
		}, Ae = async () => {
			let e = await t({
				appKey: D.appKey,
				appSalt: D.appSalt,
				id: D.ids.shortTerm.id,
				variables: {},
				baseHttp: D.baseHttp,
				reqType: D.ids.shortTerm.reqType,
				isFormData: D.ids.shortTerm.isFormData
			});
			return console.log("短时预报", e.data.result.ds), e.data.result.ds || [];
		}, je = (e) => {
			let t = String(e || "").split(",").map((e) => Number(e.trim()));
			return {
				latStart: t[0],
				latEnd: t[1],
				lngStart: t[2],
				lngEnd: t[3]
			};
		}, Me = (e) => {
			let t = Array.isArray(e?.ds) ? e : e?.ds, n = Array.isArray(t?.ds) ? t.ds : [];
			n = [...n].reverse();
			let r = je(n[0]?.extendstr || ""), i = t?.httpUrl || t?.httpurl || "";
			return {
				frames: n,
				httpurl: i,
				extent: r
			};
		}, Ne = c(() => X(N.value, (e) => Y(e.tags))), q = c(() => I.value?.ds || []), J = c(() => q.value.map((e) => {
			let t = new Date(e.focarcast_time);
			return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
		})), Pe = () => {
			let e = Ne.value.find((e) => Y(e.tags)), t = {}, n = {};
			e && (t[e.name] = !0, n[e.name] = !0), P.value = t, F.value = n;
		}, Fe = (e) => {
			let t = "";
			D.type === "高速" && (t = "zhflds"), D.type === "地质" && (t = "pointflds"), D.type === "水库" && (t = "pointflds");
			let n = e[t] || [];
			return {
				iswarnpre1h: n.some((e) => e?.iswarnpre1h === 1) ? 1 : 0,
				iswarnpre2h: n.some((e) => e?.iswarnpre2h === 1) ? 1 : 0,
				iswarnpre3h: n.some((e) => e?.iswarnpre3h === 1) ? 1 : 0
			};
		}, Ie = (e) => X((e || []).map((e) => ({
			pileNo: D.type === "高速" ? `${e.type || ""}${e.Name || ""}` : D.type === "地质" ? e.name : D.type === "水库" ? e.river_name : "",
			isWarn: e?.iswarnpre1h === 1 || e?.iswarnpre2h === 1 || e?.iswarnpre3h === 1,
			rain1h: e?.rain_1h ?? "-",
			rain2h: e?.rain_2h ?? "-",
			rain3h: e?.rain_3h ?? "-",
			x: e.x,
			y: e.y
		})), (e) => e.isWarn), Le = (e) => [
			{
				label: "未来R1h",
				warn: e.iswarnpre1h === 1
			},
			{
				label: "未来R2h",
				warn: e.iswarnpre2h === 1
			},
			{
				label: "未来R3h",
				warn: e.iswarnpre3h === 1
			}
		], Y = (e) => e.some((e) => e.warn), X = (e, t) => [...e].sort((e, n) => Number(t(n)) - Number(t(e))), Re = (e) => e.filter((e) => e.isWarn).length, ze = (e) => {
			if (!e) return null;
			let t = e._isHistory ? W.value : U.value, n = String(e?._httpurl || t.httpurl || ""), r = String(e?.file_name || "");
			return {
				alt: "",
				imgUrl: r.startsWith("http") ? r : `${n}${r.replace(/^\/+/, "")}`,
				lngStart: t.lngStart,
				latStart: t.latStart,
				lngEnd: t.lngEnd,
				latEnd: t.latEnd,
				opacity: 1,
				zIndex: 1e3,
				otherData: { imgId: "radar_RadarShortTerm" }
			};
		}, Z = (e) => {
			L.value && O("removeDataTitle", L.value), L.value = "雷达观测时间：" + n(e.focarcast_time).format("YYYY-MM-DD HH:mm "), O("addDataTitle", L.value);
		}, Be = (e) => {
			O("setImgAniShowByIndex", { index: e });
			let t = q.value[e];
			Z(t);
		}, Q = () => {
			M.value &&= (clearInterval(M.value), null);
		}, $ = () => {
			A.value = !1, Q();
		}, Ve = () => {
			J.value.length <= 1 || (A.value = !0, Q(), V.value && (H.value = j.value, O("changeLoading", !0)), M.value = setInterval(() => {
				j.value = (j.value + 1) % J.value.length;
			}, 1e3));
		}, He = () => {
			if (A.value) {
				$();
				return;
			}
			Ve();
		};
		C(j, (e) => {
			Be(e), V.value && H.value !== null && e === H.value && (V.value = !1, H.value = null, O("changeLoading", !1));
		}), C(j, () => {
			m(() => {
				let e = R.value;
				if (!e) return;
				let t = e.querySelectorAll(".radarAxis-li")[j.value];
				t && t.scrollIntoView({
					behavior: "smooth",
					inline: "center",
					block: "nearest"
				});
			});
		});
		let Ue = () => {
			$();
		}, We = async () => {
			if (!k.value) {
				O("clearImgAniArr"), O("removeDataTitle", L.value), O("showRadarLegend", !1), $();
				return;
			}
			z.value = !0, await K(), z.value = !1;
		}, Ge = (e) => {
			let t = !!P.value[e];
			P.value[e] = !t, t || (F.value[e] = !0);
		}, Ke = (e) => {
			F.value[e] = !F.value[e];
		}, qe = () => {
			O("close", "RadarShortTerm");
		}, Je = (e) => {
			O("toMapView", {
				lng: Number(e.x),
				lat: Number(e.y),
				zoom: 11
			});
		};
		return (e, t) => {
			let n = i, c = a, p = r, m = o;
			return T((_(), u("div", oe, [
				d("div", { class: "RadarShortTerm-head" }, [d("div", { class: "RadarShortTerm-head-top" }, [t[1] ||= d("div", null, "雷达短临预报", -1), d("div", { class: "head-actions" }, [d("div", {
					class: "closeBtn",
					onClick: qe,
					title: "关闭"
				})])]), t[2] ||= d("img", {
					class: "RadarShortTerm-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)]),
				d("div", se, [d("div", ce, [d("div", le, [t[4] ||= d("span", { class: "setting-label" }, "雷达展示：", -1), d("div", ue, [f(n, {
					modelValue: k.value,
					"onUpdate:modelValue": t[0] ||= (e) => k.value = e,
					class: "pile-checkbox",
					onChange: We
				}, {
					default: w(() => [...t[3] ||= [te(" 显示 ", -1)]]),
					_: 1
				}, 8, ["modelValue"])])])])]),
				d("div", de, [d("div", fe, [
					T(d("span", null, "高速名称", 512), [[S, D.type === "高速"]]),
					T(d("span", null, "隐患类别", 512), [[S, D.type === "地质"]]),
					T(d("span", null, "水库类别", 512), [[S, D.type === "水库"]]),
					t[5] ||= d("span", null, "状态要素", -1),
					t[6] ||= d("span", { class: "head-arrow" }, null, -1)
				]), d("div", pe, [(_(!0), u(s, null, y(Ne.value, (e) => (_(), u("div", {
					class: "table-row",
					key: e.name
				}, [
					d("div", {
						class: "table-row-main",
						onClick: (t) => Ge(e.name)
					}, [
						d("span", he, b(e.name), 1),
						d("div", { class: h(["status-tags", { "has-warn": Y(e.tags) }]) }, [(_(!0), u(s, null, y(e.tags, (t) => (_(), u("span", {
							class: h(["status-tag", { warn: t.warn }]),
							key: `${e.name}-${t.label}`
						}, [d("span", null, b(t.label), 1)], 2))), 128))], 2),
						d("span", {
							class: h(["expand-arrow", { expanded: P.value[e.name] }]),
							"aria-hidden": "true"
						}, [f(c, null, {
							default: w(() => [f(x(E))]),
							_: 1
						})], 2)
					], 8, me),
					T(d("div", {
						class: "pile-title",
						onClick: (t) => Ke(e.name)
					}, [d("span", null, [
						T(d("span", null, "桩号数据", 512), [[S, D.type === "高速"]]),
						T(d("span", null, "隐患点数据", 512), [[S, D.type === "地质"]]),
						T(d("span", null, "水库点数据", 512), [[S, D.type === "水库"]]),
						Re(e.piles) > 0 ? (_(), u("span", _e, " （报警数量：" + b(Re(e.piles)) + "个）", 1)) : ee("", !0)
					]), d("span", { class: h(["panel-arrow", { expanded: F.value[e.name] }]) }, [f(c, null, {
						default: w(() => [f(x(E))]),
						_: 1
					})], 2)], 8, ge), [[S, P.value[e.name]]]),
					T(d("div", ve, [d("div", ye, [
						T(d("span", null, "桩号", 512), [[S, D.type === "高速"]]),
						T(d("span", null, "隐患点", 512), [[S, D.type === "地质"]]),
						T(d("span", null, "水库点", 512), [[S, D.type === "水库"]]),
						t[7] ||= d("span", null, "未来R1h", -1),
						t[8] ||= d("span", null, "未来R2h", -1),
						t[9] ||= d("span", null, "未来R3h", -1)
					]), e.piles.length ? (_(), u("div", be, [(_(!0), u(s, null, y(e.piles, (e) => (_(), u("div", {
						class: h(["pile-row", { "is-warn": e.isWarn }]),
						key: e.pileNo,
						onClick: (t) => Je(e)
					}, [
						d("span", null, b(e.pileNo), 1),
						d("span", null, b(e.rain1h), 1),
						d("span", null, b(e.rain2h), 1),
						d("span", null, b(e.rain3h), 1)
					], 10, xe))), 128))])) : (_(), u("div", Se, "暂无数据"))], 512), [[S, P.value[e.name] && F.value[e.name]]])
				]))), 128))])]),
				T(f(p, {
					show: !0,
					isVertical: !1,
					class: "RadarShortTerm-legend"
				}, null, 512), [[S, k.value]]),
				T(d("div", Ce, [d("button", {
					type: "button",
					class: "timeline-play-btn",
					title: A.value ? "暂停" : "播放",
					onClick: He
				}, [f(c, null, {
					default: w(() => [A.value ? (_(), l(x(ie), { key: 0 })) : (_(), l(x(ae), { key: 1 }))]),
					_: 1
				})], 8, we), d("div", Te, [d("span", Ee, b(J.value[j.value] || ""), 1), d("div", {
					class: "radarAxis",
					ref_key: "ref_radarAxis",
					ref: R
				}, [(_(!0), u(s, null, y(q.value, (e, n) => (_(), u("div", De, [d("div", {
					class: "radarAxis-li-node",
					onClick: (e) => (j.value = Number(n), Ue())
				}, [
					d("i", { style: g({ backgroundColor: e._isHistory ? "" : "#ca9e64" }) }, null, 4),
					T(d("span", null, [...t[10] ||= [d("i", null, null, -1)]], 512), [[S, n === j.value]]),
					d("div", ke, [d("b", null, b(e._label), 1)])
				], 8, Oe), (_(), u(s, null, y(4, (t) => T(d("div", {
					class: "radarAxis-li-point",
					key: t,
					style: g({ backgroundColor: e._isHistory ? "" : "#ca9e64" })
				}, null, 4), [[S, n !== q.value.length - 1]])), 64))]))), 256))], 512)])], 512), [[S, k.value]])
			])), [[m, z.value]]);
		};
	}
}), [["__scopeId", "data-v-847a7ed4"]]);
//#endregion
export { D as t };
