import { defineComponent as P, ref as f, onMounted as Q, onBeforeUnmount as X, computed as Y, watch as b, createElementBlock as c, openBlock as u, normalizeClass as L, createCommentVNode as E, normalizeStyle as y, Fragment as R, renderList as T, createElementVNode as I, toDisplayString as w, unref as Z } from "vue";
import { cloneDeep as d, isEqual as k } from "lodash";
import $ from "gsap";
import { useFps as x } from "@vueuse/core";
import { World as ee } from "./map3d/map.mjs";
import { initWatch as te } from "./watch.mjs";
import "three";
import "d3-geo";
import "three/examples/jsm/controls/OrbitControls";
import "three/examples/jsm/loaders/GLTFLoader";
import "three/examples/jsm/loaders/DRACOLoader.js";
import { createHistory as oe } from "./map3d/mini3d/utils/CreateHistory.mjs";
import "three/examples/jsm/libs/lil-gui.module.min";
import "three/examples/jsm/utils/BufferGeometryUtils";
import "three/examples/jsm/renderers/CSS3DRenderer";
import "../text-text-basic/index.mjs";
import "../text-table-basic/index.mjs";
import "../chart-other-gauge/index.mjs";
import "../chart-other-gauge-stage/index.mjs";
import "../chart-other-gauge-grade/index.mjs";
import "../chart-other-word-cloud/index.mjs";
import "../chart-other-liquidfill/index.mjs";
import "../chart-other-funnel/index.mjs";
import "../chart-other-force/index.mjs";
import "../chart-other-radar/index.mjs";
import "../chart-other-funnel-split/index.mjs";
import "../chart-other-funnel-contrast/index.mjs";
import "../chart-other-candlestick-basic/index.mjs";
import "../chart-other-candlestick-shanghai/index.mjs";
import "../chart-other-candlestick-demo/index.mjs";
import "../chart-other-heatmap/index.mjs";
import "../chart-other-force2/index.mjs";
import "../chart-other-graph-basic/index.mjs";
import "../chart-other-graph-basic2/index.mjs";
import "../chart-other-graph-calendar/index.mjs";
import "../chart-other-tree-line/index.mjs";
import "../chart-other-treemap-basic/index.mjs";
import "../chart-other-sunburst-basic/index.mjs";
import "../chart-other-sunburst-basic2/index.mjs";
import "../chart-other-sunburst-basic3/index.mjs";
import "../chart-other-sunburst-basic4/index.mjs";
import "../chart-other-sunburst-book/index.mjs";
import "../chart-other-sunburst-radius/index.mjs";
import "../chart-other-sunburst-flavors/index.mjs";
import "../chart-other-parallel-basic/index.mjs";
import "../chart-other-parallel-mul/index.mjs";
import "../chart-other-circular-graph/index.mjs";
import "../map-earth-basic/index.mjs";
import "../map-earth-cool-tech/index.mjs";
import "../map-earth-particle/index.mjs";
import "../map-earth-hacker/index.mjs";
import "../map-earth-fly-line/index.mjs";
import "../chart-other-grid-percentage/index.mjs";
import "../chart-other-radar-stack/index.mjs";
import "../chart-other-funnel2/index.mjs";
import "../chart-other-label-gauge/index.mjs";
import "../chart-other-theme-river/index.mjs";
import "../chart-other-tree/index.mjs";
import "../chart-other-treemap/index.mjs";
import "../commons-product-model/index.mjs";
import "../commons-vr-photo/index.mjs";
import "../commons-vr-video/index.mjs";
import "../commons-three-loader/index.mjs";
import "../commons-three-loader3/index.mjs";
import "../commons-loop-iterator/index.mjs";
import "../commons-gaussian-splatting-view/index.mjs";
import "../commons-babylon/index.mjs";
import "../commons-svg/index.mjs";
import "../commons-weather/index.mjs";
import "../commons-weather-dynamic/index.mjs";
import "../media-wavesurfer/index.mjs";
import "../interaction-tabs/index.mjs";
import "../interaction-tabs2/index.mjs";
import "../interaction-button/index.mjs";
import "../interaction-button-image/index.mjs";
import "../interaction-select/index.mjs";
import "../interaction-input/index.mjs";
import "../interaction-radio/index.mjs";
import "../interaction-slider/index.mjs";
import "../interaction-switch/index.mjs";
import "../interaction-data-picker/index.mjs";
import "../interaction-button-refresh/index.mjs";
import "../media-image/index.mjs";
import "../text-title/index.mjs";
import "../commons-qrcode/index.mjs";
import "../media-video/index.mjs";
import "../media-audio/index.mjs";
import "../text-real-time/index.mjs";
import "../media-carousel/index.mjs";
import "../media-carousel-slides/index.mjs";
import "../media-iframe-carousel/index.mjs";
import "../media-iframe/index.mjs";
import "../media-m3u8/index.mjs";
import "../media-m3u8-dynamic/index.mjs";
import "../media-audio-dynamic/index.mjs";
import "../media-video-dynamic/index.mjs";
import "../media-image-dynamic/index.mjs";
import "../media-iframe-dynamic/index.mjs";
import "../media-flv/index.mjs";
import "../commons-echarts/index.mjs";
import "../text-over-number/index.mjs";
import "../text-table-scroll/index.mjs";
import "../text-carousel/index.mjs";
import "../text-row-scroll/index.mjs";
import "../text-text-dynamic/index.mjs";
import "../text-count-down/index.mjs";
import "../graphical-circle/index.mjs";
import "../graphical-diamond/index.mjs";
import "../graphical-hexagon/index.mjs";
import "../graphical-isosceles-triangle/index.mjs";
import "../graphical-pentagon/index.mjs";
import "../graphical-rect/index.mjs";
import "../graphical-right-triangle/index.mjs";
import "./index.mjs";
import "../scene-amap2d/index.mjs";
import "../scene-amap3d/index.mjs";
import "../scene-vr/index.mjs";
import "../scene-unity-iframe/index.mjs";
import "../scene-unity-webgl/index.mjs";
import "../scene-ue-iframe/index.mjs";
import "../scene-ue-shj/index.mjs";
import "../scene-default/index.mjs";
import "../interaction/tabs/index.mjs";
import "../interaction/tabs-icon/index.mjs";
import "../interaction/button/index.mjs";
import "../interaction/date-picker/src/date-picker/index.mjs";
import "../interaction/date-picker/src/date-picker-range/index.mjs";
import "../text/list/index.mjs";
import "../chart/src/bar/basic/index.mjs";
import "../chart/src/bar/animation/index.mjs";
import "../chart/src/bar/contrast/index.mjs";
import "../chart/src/bar/contrast2/index.mjs";
import "../chart/src/bar/contrast3/index.mjs";
import "../chart/src/bar/gradient-column-chart/index.mjs";
import "../chart/src/bar/horizontal/index.mjs";
import "../chart/src/bar/horizontal-stack/index.mjs";
import "../chart/src/bar/line-bar/index.mjs";
import "../chart/src/bar/line-bar2/index.mjs";
import "../chart/src/bar/loop/index.mjs";
import "../chart/src/bar/mini/index.mjs";
import "../chart/src/bar/polar/index.mjs";
import "../chart/src/bar/polar-stack/index.mjs";
import "../chart/src/bar/polar2/index.mjs";
import "../chart/src/bar/radius-circle/index.mjs";
import "../chart/src/bar/rank/index.mjs";
import "../chart/src/bar/segmented-progress/index.mjs";
import "../chart/src/bar/spire/index.mjs";
import "../chart/src/bar/stack/index.mjs";
import "../chart/src/bar/stack-line/index.mjs";
import "../chart/src/bar/stack2/index.mjs";
import "../chart/src/bar/stack3/index.mjs";
import "../chart/src/bar/staggered/index.mjs";
import "../chart/src/bar/three/index.mjs";
import "../chart/src/bar/waterfall/index.mjs";
import "../chart/src/bar/zebra/index.mjs";
import "../chart/src/line/area-gradient/index.mjs";
import "../chart/src/line/area-highlight/index.mjs";
import "../chart/src/line/area-highlight2/index.mjs";
import "../chart/src/line/basic/index.mjs";
import "../chart/src/line/bump/index.mjs";
import "../chart/src/line/dashed/index.mjs";
import "../chart/src/line/ladder/index.mjs";
import "../chart/src/line/logarithm/index.mjs";
import "../chart/src/line/multix/index.mjs";
import "../chart/src/line/polar-double/index.mjs";
import "../chart/src/line/rain-flow/index.mjs";
import "../chart/src/line/scale/index.mjs";
import "../chart/src/line/smooth/index.mjs";
import "../chart/src/line/smooth-area/index.mjs";
import "../chart/src/line/stack/index.mjs";
import "../chart/src/line/stack-area/index.mjs";
import "../chart/src/line/temp/index.mjs";
import "../chart/src/line/vertical/index.mjs";
import "../chart/src/map/basic/index.mjs";
import "../chart/src/map/bmap-basic/index.mjs";
import "../chart/src/map/bmap-heatmap/index.mjs";
import "../chart/src/map/bmap-rich/index.mjs";
import "../chart/src/map/customize/index.mjs";
import "../chart/src/map/lines/index.mjs";
import "../chart/src/map/scatter/index.mjs";
import "../chart/src/pie/3d/index.mjs";
import "../chart/src/pie/basic/index.mjs";
import "../chart/src/pie/basic2/index.mjs";
import "../chart/src/pie/customized/index.mjs";
import "../chart/src/pie/index/index.mjs";
import "../chart/src/pie/interval/index.mjs";
import "../chart/src/pie/legend-scroll/index.mjs";
import "../chart/src/pie/radius/index.mjs";
import "../chart/src/pie/rose/index.mjs";
import "../chart/src/pie/round/index.mjs";
import "../chart/src/pie/sunburst/index.mjs";
import "../chart/src/scatter/basic/index.mjs";
import "../chart/src/scatter/basic2/index.mjs";
import "../chart/src/scatter/bubble/index.mjs";
import "../chart/src/scatter/ripples/index.mjs";
import "../hj-componets/zv-hj-tree-list/index.mjs";
import "../hj-componets/zv-hj-model-resource/index.mjs";
import "../hj-componets/zv-hj-one-map-config/index.mjs";
import "../hj-componets/zv-hj-video-control/index.mjs";
import "../hj-componets/zv-hj-video-page/index.mjs";
import "../hj-componets/zv-hj-password-input/index.mjs";
import "../hj-componets/zv-hj-carousel/index.mjs";
import "../hj-componets/zv-hj-video-monitor/index.mjs";
import "../hj-componets/zv-hj-scene-amap2d/index.mjs";
import "../hj-componets/zv-hj-scene-amap3d/index.mjs";
import "../hj-componets/zv-hj-person-face/index.mjs";
import "../hj-componets/zv-hj-resource-type-phone/index.mjs";
import "../hj-componets/zv-hj-tree-list-phone/index.mjs";
import "../hj-componets/zv-hj-video-page-phone/index.mjs";
import "../hj-componets/zv-hj-model-resource-phone/index.mjs";
import "../hj-componets/zv-hj-bottom-suspend/index.mjs";
import "../hj-componets/zv-hj-pagination/index.mjs";
import "../hj-componets/zv-hj-password-input-phone/index.mjs";
/* empty css                        */
/* empty css                               */
import { SHJDatasourceV2 as re } from "../../plugins/datasource/index.mjs";
import { SHJParseEvent as n } from "../../plugins/event/index.mjs";
import { autoInstallFont as H, jsonToCssStyle as O } from "../../commons/utils/json2css.mjs";
const ie = { class: "value" }, ae = ["onClick"], le = {
  key: 3,
  class: "fps"
}, ne = P({ name: "zv-scene-map3d" }), ci = /* @__PURE__ */ P({
  ...ne,
  props: {
    basicOption: {},
    sources: {},
    useEvents: {},
    uuid: {}
  },
  emits: [
    "on-loaded",
    "on-animated",
    "on-drill-down",
    "on-area-mouseover",
    "on-area-mouseout",
    "on-area-click",
    "on-bar-click",
    "on-scatter-click",
    "on-flyline-click",
    "on-return",
    "on-data-change"
  ],
  setup(V, { expose: N, emit: j }) {
    const r = V, p = j;
    n.parseEvents(r.useEvents, "on-page-loaded", null);
    const i = f(), C = f(!1), B = f(!1), S = "zerov-map3d-scene", A = "zerov-map3d-scene-wrap", a = new oe(), v = f(!1), h = (e = !0) => {
      i.value.cleanAllBar(), i.value.cleanAllScatter(), i.value.cleanAllFlyLine(), i.value.createAllRegionalLevel(), r.sources && r.sources.length > 0 && re.parse({
        tId: r.uuid,
        sources: r.sources,
        callback: (o) => {
          try {
            const t = r.basicOption.widgets && r.basicOption.widgets.find((s) => s._sourceId === o.id);
            t && t.type === "bar" && i.value.createBar(t, o.data[0].data, !0, e), t && t.type === "scatter" && i.value.createScatter(t, o.data[0].data, !0, e), t && t.type === "flyline" && i.value.createFlyLine(t, o.data[0].data, !0, e), t && t.type === "regionalLevel" && i.value.createRegionalLevel(t, o.data[0].data, !0, e), e && (i.value.createBarTimeLine(), i.value.createScatterTimeLine(), i.value.createFlyLineTimeLine(), i.value.createRegionalLevelTimeLine()), p("on-data-change", o), n.parseEvents(r.useEvents, "on-data-change", o);
          } catch {
            p("on-data-change", null), n.parseEvents(r.useEvents, "on-data-change", null);
          }
        }
      });
    }, D = () => {
      try {
        document.getElementById(S) && document.getElementById(A).removeChild(document.getElementById(S));
        const e = document.createElement("canvas");
        e.id = S, e.className = "zerov-map-3d", e.style.width = "100%", e.style.height = "100%", document.getElementById(A).appendChild(e);
      } catch {
      }
    }, g = (e) => (C.value = !1, B.value = !1, i.value && (i.value.destroy(), i.value = null), D(), new ee(document.getElementById(S), { geoProjectionCenter: [108.55, 36.32] }, e, {
      onAreaMouseover: (t) => {
        p("on-area-mouseover", t), n.parseEvents(r.useEvents, "on-area-mouseover", t);
      },
      onAreaMouseout: (t) => {
        p("on-area-mouseout", t), n.parseEvents(r.useEvents, "on-area-mouseout", t);
      },
      onLoadChild: (t) => {
        if (p("on-area-click", t), n.parseEvents(r.useEvents, "on-area-click", t), t.adcode !== a.present && r.basicOption.scene.isDrilling && r.basicOption.scene.defaultMapAdcode !== 1) {
          p("on-drill-down", t), n.parseEvents(r.useEvents, "on-drill-down", t);
          const s = d(r.basicOption);
          s.scene.defaultMapAdcode = t.adcode, i.value = g(s), a.push(t.adcode), a.past.length <= 0 ? v.value = !1 : v.value = !0;
        }
      },
      onMapSuccess: () => {
        C.value = !0, p("on-loaded"), n.parseEvents(r.useEvents, "on-loaded", null);
      },
      onMapAnimationSuccess: () => {
        h(), B.value = !0, p("on-animated"), n.parseEvents(r.useEvents, "on-animated", null);
      },
      onClickBar: (t) => {
        p("on-bar-click", t), n.parseEvents(r.useEvents, "on-bar-click", t);
      },
      onClickScatter: (t) => {
        p("on-scatter-click", t), n.parseEvents(r.useEvents, "on-scatter-click", t);
      },
      onClickFlyline: (t) => {
        p("on-flyline-click", t), n.parseEvents(r.useEvents, "on-flyline-click", t);
      }
    }));
    Q(() => {
      setTimeout(() => {
        i.value = g(r.basicOption), a.push(r.basicOption.scene.defaultMapAdcode), te(r, i, g, h, J);
      }, 0), window.addEventListener("resize", () => {
        i.value = g(r.basicOption);
      });
    }), X(() => {
      i.value && i.value.destroy();
    });
    const F = () => {
      p("on-return", {
        parentAdcode: a.past[a.past.length - 1],
        adcode: a.present
      }), n.parseEvents(r.useEvents, "on-return", {
        parentAdcode: a.past[a.past.length - 1],
        adcode: a.present
      }), a.undo();
      const e = d(r.basicOption);
      e.scene.defaultMapAdcode = a.present, i.value = g(e), a.past.length <= 0 ? v.value = !1 : v.value = !0;
    }, J = () => {
      a.empty(), a.push(r.basicOption.scene.defaultMapAdcode), i.value = g(r.basicOption), a.past.length <= 0 ? v.value = !1 : v.value = !0;
    }, U = (e, o, t) => {
      $.timeline().add($.to(i.value.camera.instance.position, {
        duration: 2,
        delay: 0,
        x: e,
        y: o,
        z: t,
        ease: "circ.out"
      }));
    };
    N({
      refresh: () => h(),
      refreshView: () => h(),
      refreshData: () => h(),
      // 返回上一级
      goBack: () => F(),
      // 更新相机位置
      setCameraPosition: (e, o, t) => U(e, o, t)
    });
    const _ = x(), W = f(), q = (e) => {
      if (W.value && e) {
        H(r.basicOption.backButtonCss.fontFamily);
        const o = `url(${e.backgroundImage})`;
        return {
          ...O(e),
          left: r.basicOption.backButtonLeft + "%",
          bottom: r.basicOption.backButtonBottom + "%",
          "background-image": o
        };
      }
      return {};
    }, m = f(d(r.basicOption.widgets)), l = Y(() => {
      try {
        const e = m.value.filter((o) => o.type === "regionalLevel");
        return e.length > 0 ? (H(e[0].labelStyle.fontFamily), e[0].isHide ? null : e[0]) : null;
      } catch {
        return null;
      }
    });
    b(() => d(r.basicOption.widgets), (e, o) => {
      try {
        !k(e, o) && i.value && (m.value = d(r.basicOption.widgets));
      } catch {
      }
    }, {
      deep: !0
    }), b(() => d(m.value.filter((e) => e.type === "bar")), (e, o) => {
      try {
        !k(e, o) && i.value && e.length === o.length && e.forEach((t) => {
          i.value.createBar(t, void 0, !1);
        });
      } catch {
      }
    }, {
      deep: !0
    }), b(() => d(m.value.filter((e) => e.type === "scatter")), (e, o) => {
      try {
        !k(e, o) && i.value && e.length === o.length && e.forEach((t) => {
          i.value.createScatter(t, void 0, !1);
        });
      } catch {
      }
    }, {
      deep: !0
    }), b(() => d(m.value.filter((e) => e.type === "flyline")), (e, o) => {
      try {
        !k(e, o) && i.value && e.length === o.length && e.forEach((t) => {
          i.value.createFlyLine(t, void 0, !1);
        });
      } catch {
      }
    }, {
      deep: !0
    }), b(() => d(m.value.filter((e) => e.type === "regionalLevel")), (e, o) => {
      try {
        !k(e, o) && i.value && e.length === o.length && e.forEach((t) => {
          i.value.createRegionalLevel(t, void 0, !1);
        });
      } catch {
      }
    }, {
      deep: !0
    });
    const G = (e) => {
      try {
        e.isHide === void 0 ? e.isHide = !0 : e.isHide = !e.isHide;
      } catch {
      }
    }, K = () => {
      try {
        const e = m.value.every((o) => !o.isHide);
        m.value.forEach((o) => o.isHide = e);
      } catch {
      }
    }, z = (e) => {
      H(r.basicOption.widgetControlStyle.fontFamily);
      const o = `url(${e.backgroundImage})`, t = `url(${M(e.hover.backgroundImage)})`, s = `url(${M(e.active.backgroundImage)})`;
      return {
        ...O(e),
        ...O(e.hover, "hover"),
        ...O(e.active, "active"),
        "background-image": o,
        "--hover-background-image": t,
        "--active-background-image": s
      };
    }, M = (e) => !e.startsWith("http") && !e.startsWith("//") ? "../" + e : e;
    return (e, o) => (u(), c("div", {
      id: "zerov-map3d-scene-wrap",
      class: L(["map-3d-wrap", { show: C.value }])
    }, [
      B.value && v.value && e.basicOption.backButton ? (u(), c("div", {
        key: 0,
        ref_key: "buttonRef",
        ref: W,
        class: "return-btn",
        style: y(q(e.basicOption.backButtonCss)),
        onClick: F
      }, " 返回上一级 ", 4)) : E("", !0),
      l.value ? (u(), c("div", {
        key: 1,
        class: "regional-level",
        style: y({
          left: l.value.labelStyle.left + "%",
          top: l.value.labelStyle.top + "%",
          flexDirection: l.value.labelStyle.direction,
          gap: l.value.labelStyle.gap + "px",
          fontSize: l.value.labelStyle.fontSize + "px",
          fontFamily: l.value.labelStyle.fontFamily,
          fontStyle: l.value.labelStyle.fontStyle,
          color: l.value.labelStyle.color,
          "--color-width": l.value.labelStyle.colorStyle.width + "px",
          "--color-height": l.value.labelStyle.colorStyle.height + "px",
          "--color-borderRadius": l.value.labelStyle.colorStyle.borderRadius + "px"
        })
      }, [
        (u(!0), c(R, null, T(l.value.rules, (t, s) => (u(), c("div", {
          key: s,
          class: "item"
        }, [
          I("div", {
            class: "color",
            style: y({ backgroundColor: t.color })
          }, null, 4),
          I("span", ie, w(t.label), 1)
        ]))), 128))
      ], 4)) : E("", !0),
      e.basicOption.widgets.length > 0 && e.basicOption.widgetControlStyle && e.basicOption.widgetControlStyle.show ? (u(), c("div", {
        key: 2,
        class: "widget-control",
        style: y({
          left: e.basicOption.widgetControlStyle.left + "%",
          top: e.basicOption.widgetControlStyle.top + "%",
          flexDirection: e.basicOption.widgetControlStyle.direction,
          gap: e.basicOption.widgetControlStyle.gap + "px",
          "--widget-width": e.basicOption.widgetControlStyle.width + "px",
          "--widget-height": e.basicOption.widgetControlStyle.height + "px"
        })
      }, [
        I("div", {
          class: L(["control-button", {
            active: m.value.every((t) => !t.isHide)
          }]),
          style: y(z(e.basicOption.widgetControlStyle)),
          onClick: K
        }, w(m.value.every((t) => !t.isHide) ? "隐藏" : "显示") + "/全部 ", 7),
        (u(!0), c(R, null, T(m.value, (t) => (u(), c("div", {
          key: t.id,
          class: L(["control-button", {
            active: !t.isHide
          }]),
          style: y(z(e.basicOption.widgetControlStyle)),
          onClick: (s) => G(t)
        }, w(t.name || "-"), 15, ae))), 128))
      ], 4)) : E("", !0),
      e.basicOption.debugger ? (u(), c("div", le, " fps:" + w(Z(_)), 1)) : E("", !0)
    ], 2));
  }
});
export {
  ci as default
};
