import { defineComponent as B, ref as u, computed as te, onMounted as oe, watch as F, withDirectives as re, createElementBlock as l, openBlock as c, normalizeClass as y, unref as o, createElementVNode as s, createVNode as ie, normalizeStyle as h, createCommentVNode as S, toDisplayString as O, Transition as pe, withCtx as me, Fragment as ne, renderList as ae, withModifiers as le } from "vue";
import { nanoid as V } from "nanoid";
import { cloneDeep as I, isEqual as j } from "lodash";
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 "./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 "../scene-map3d/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 "../commons/custom-component-render/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 ce } from "../../plugins/datasource/index.mjs";
import { SHJParseEvent as z } from "../../plugins/event/index.mjs";
import { jsonToCssStyle as r, autoInstallFont as f } from "../../commons/utils/json2css.mjs";
import se from "../../commons/utils/clickOutSide.mjs";
const de = { style: { display: "flex", "align-items": "center", gap: "4px" } }, ue = {
  key: 1,
  class: "zerov-widget-select__prefix"
}, fe = ["src"], ve = ["src"], he = ["onClick"], be = ["src"], Se = { class: "zerov-widget-select__option-label" }, ge = B({ name: "zv-interaction-select" }), fi = /* @__PURE__ */ B({
  ...ge,
  props: {
    basicOption: {},
    sources: {},
    useEvents: {},
    uuid: {}
  },
  emits: ["update:modelValue", "on-change"],
  setup(L, { expose: R, emit: T }) {
    const d = L, N = () => {
      const t = u(), a = (e) => {
        if (t.value) {
          f(e.fontFamily), f(e.hover.fontFamily), f(e.focus.fontFamily);
          const i = u("");
          return e.boxShadow && (i.value = `${e.boxShadow.isInset ? "inset" : ""} ${e.boxShadow.offsetX}px ${e.boxShadow.offsetY}px ${e.boxShadow.blur}px ${e.boxShadow.diffus}px ${e.boxShadow.color}`), {
            ...r(e),
            ...r(e.hover, "hover"),
            ...r(e.focus, "focus"),
            boxShadow: i.value,
            padding: `${e.padding.map((p) => `${p}px`).join(" ")}`,
            background: e.isBgImage ? `no-repeat center/100% url(${e.backgroundImage})` : e.backgroundColor
          };
        }
        return {};
      }, m = (e) => {
        if (t.value) {
          f(e.fontFamily);
          const i = `${e.boxShadow.isInset ? "inset" : ""} ${e.boxShadow.offsetX}px ${e.boxShadow.offsetY}px ${e.boxShadow.blur}px ${e.boxShadow.diffus}px ${e.boxShadow.color}`;
          return e.placement === "bottom" ? {
            ...r(e),
            top: "100%",
            marginTop: "6px",
            boxShadow: i,
            padding: `${e.padding.map((p) => `${p}px`).join(" ")}`
          } : {
            ...r(e),
            bottom: "100%",
            marginBottom: "6px",
            boxShadow: i,
            padding: `${e.padding.map((p) => `${p}px`).join(" ")}`
          };
        }
      }, P = (e) => {
        if (t.value)
          return f(e.fontFamily), {
            padding: `${e.padding.map((i) => `${i}px`).join(" ")}`,
            ...r(e),
            ...r(e.hover, "hover"),
            ...r(e.active, "active")
          };
      }, W = (e) => {
        if (t.value)
          return f(e.fontFamily), {
            ...r(e)
          };
      }, Z = (e) => {
        if (t.value)
          return f(e.fontFamily), {
            ...r(e),
            ...r(e, "hover"),
            ...r(e, "focus")
          };
      }, C = (e, i) => {
        const p = i.find((k) => k.type === e);
        return p ? p.url : "";
      }, ee = (e, i) => {
        if (t.value) {
          const p = i.find((k) => k.type === e);
          if (p)
            return {
              ...r(p)
            };
        }
      }, $ = u(), b = u([]);
      return {
        key: $,
        init: () => {
          ce.parse({
            tId: d.uuid,
            sources: d.sources,
            callback: (e) => {
              try {
                z.parseEvents(d.useEvents, "dataListener", b), $.value = V(), e && e.data ? b.value = I(e.data[0].data) : b.value = [];
              } catch {
                z.parseEvents(d.useEvents, "dataListener", null), $.value = V(), b.value = [];
              }
            }
          });
        },
        options: b,
        selectRef: t,
        rendererSelectInput: a,
        rendererSelectOption: P,
        rendererSelectDropdown: m,
        rendererSelectSelected: Z,
        rendererSelectPlaceholder: W,
        rendererPrefixIcon: C,
        rendererPrefixIconCss: ee
      };
    }, w = u(""), E = T, n = u(!1), g = te(() => {
      const t = D.value.find((a) => a.value === w.value);
      return t ? t.label : "";
    }), H = () => {
      n.value = !n.value;
    }, _ = u(""), J = (t) => {
      w.value = t.value, _.value = t.type, E("update:modelValue", t.value), E("on-change", t), z.parseEvents(d.useEvents, "on-change", {
        data: t
      }), n.value = !1;
    }, M = () => {
      n.value = !1;
    }, {
      key: X,
      init: v,
      options: D,
      selectRef: Y,
      rendererSelectInput: q,
      rendererSelectOption: A,
      rendererSelectDropdown: G,
      rendererSelectSelected: K,
      rendererSelectPlaceholder: Q,
      rendererPrefixIcon: x,
      rendererPrefixIconCss: U
    } = N();
    return oe(() => v()), F(
      () => I(d.basicOption),
      (t, a) => {
        j(t, a) || v();
      },
      { deep: !0 }
    ), F(
      () => I(d.sources),
      (t, a) => {
        j(t, a) || v();
      },
      { deep: !0 }
    ), R({
      refresh: () => v(),
      refreshView: () => v(),
      refreshData: () => v()
    }), (t, a) => re((c(), l("div", {
      key: o(X),
      ref_key: "selectRef",
      ref: Y,
      class: y(["zerov-widget-select", { "is-open": n.value }]),
      onClick: H
    }, [
      s("div", {
        class: y(["zerov-widget-select__trigger", { "is-active": n.value }]),
        style: h({
          ...o(q)(t.basicOption.input)
        })
      }, [
        s("div", de, [
          g.value ? S("", !0) : (c(), l("span", {
            key: 0,
            class: "zerov-widget-select__placeholder",
            style: h({
              ...o(Q)(t.basicOption.input.placeholder)
            })
          }, O(t.basicOption.input.placeholder.value), 5)),
          g.value && o(x)(_.value, t.basicOption.dropdown.option.prefixs) ? (c(), l("span", ue, [
            s("img", {
              src: o(x)(_.value, t.basicOption.dropdown.option.prefixs),
              alt: ""
            }, null, 8, fe)
          ])) : S("", !0),
          g.value ? (c(), l("span", {
            key: 2,
            class: "zerov-widget-select__selected",
            style: h({
              ...o(K)(t.basicOption.input.selected)
            })
          }, O(g.value), 5)) : S("", !0)
        ]),
        s("span", {
          class: y(["zerov-widget-select__arrow", { "is-open": n.value }])
        }, [
          s("img", {
            src: t.basicOption.input.arrow.url,
            alt: ""
          }, null, 8, ve)
        ], 2)
      ], 6),
      ie(pe, { name: "fade-in-linear" }, {
        default: me(() => [
          n.value ? (c(), l("div", {
            key: 0,
            class: "zerov-widget-select__dropdown",
            style: h({
              ...o(G)(t.basicOption.dropdown)
            })
          }, [
            s("ul", null, [
              (c(!0), l(ne, null, ae(o(D), (m) => (c(), l("li", {
                key: m.value,
                class: y([{ "is-selected": m.value === w.value }, "zerov-widget-select__option"]),
                style: h({
                  ...o(A)(t.basicOption.dropdown.option)
                }),
                onClick: le((P) => J(m), ["stop"])
              }, [
                o(x)(m.type, t.basicOption.dropdown.option.prefixs) ? (c(), l("span", {
                  key: 0,
                  class: "zerov-widget-select__option-prefix",
                  style: h({
                    ...o(U)(m.type, t.basicOption.dropdown.option.prefixs)
                  })
                }, [
                  s("img", {
                    src: o(x)(m.type, t.basicOption.dropdown.option.prefixs),
                    alt: ""
                  }, null, 8, be)
                ], 4)) : S("", !0),
                s("span", Se, O(m.label), 1)
              ], 14, he))), 128))
            ])
          ], 4)) : S("", !0)
        ]),
        _: 1
      })
    ], 2)), [
      [o(se), M]
    ]);
  }
});
export {
  fi as default
};
